Files
StudyDiary-20251025/.obsidian/plugins/copilot/main.js
T

1738 lines
3.5 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Oer=Object.create;var u2=Object.defineProperty;var Per=Object.getOwnPropertyDescriptor;var Eer=Object.getOwnPropertyNames;var Ter=Object.getPrototypeOf,Aer=Object.prototype.hasOwnProperty;var dUe=t=>{throw TypeError(t)};var Ier=(t,e,r)=>e in t?u2(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),Cf=(t,e)=>{for(var r in e)u2(t,r,{get:e[r],enumerable:!0})},fUe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Eer(e))!Aer.call(t,o)&&o!==r&&u2(t,o,{get:()=>e[o],enumerable:!(n=Per(e,o))||n.enumerable});return t};var F=(t,e,r)=>(r=t!=null?Oer(Ter(t)):{},fUe(e||!t||!t.__esModule?u2(r,"default",{value:t,enumerable:!0}):r,t)),zl=t=>fUe(u2({},"__esModule",{value:!0}),t);var Cc=(t,e,r)=>Ier(t,typeof e!="symbol"?e+"":e,r),Mer=(t,e,r)=>e.has(t)||dUe("Cannot "+r);var pUe=(t,e,r)=>e.has(t)?dUe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var mUe=(t,e,r)=>(Mer(t,e,"access private method"),r);function epe(){if(!yK&&(yK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yK(Rer)}var yK,Rer,hUe=w(()=>{Rer=new Uint8Array(16)});function gUe(t,e=0){return Oc[t[e+0]]+Oc[t[e+1]]+Oc[t[e+2]]+Oc[t[e+3]]+"-"+Oc[t[e+4]]+Oc[t[e+5]]+"-"+Oc[t[e+6]]+Oc[t[e+7]]+"-"+Oc[t[e+8]]+Oc[t[e+9]]+"-"+Oc[t[e+10]]+Oc[t[e+11]]+Oc[t[e+12]]+Oc[t[e+13]]+Oc[t[e+14]]+Oc[t[e+15]]}var Oc,yUe=w(()=>{Oc=[];for(let t=0;t<256;++t)Oc.push((t+256).toString(16).slice(1))});var jer,tpe,bUe=w(()=>{jer=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tpe={randomUUID:jer}});function Ner(t,e,r){if(tpe.randomUUID&&!e&&!t)return tpe.randomUUID();t=t||{};let n=t.random||(t.rng||epe)();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 gUe(n)}var yC,_Ue=w(()=>{bUe();hUe();yUe();yC=Ner});var l2=w(()=>{_Ue()});function Ler(t){xUe=t}function bK(){return xUe}function ut(t,e){let r=bK(),n=_K({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===DL?void 0:DL].filter(o=>!!o)});t.common.issues.push(n)}function vK(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 CUe(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 Hr(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)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}function PUe(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function etr(t){return new RegExp(`^${PUe(t)}$`)}function EUe(t){let e=`${OUe}T${PUe(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 ttr(t,e){return!!((e==="v4"||!e)&&Ker.test(t)||(e==="v6"||!e)&&Jer.test(t))}function rtr(t,e){if(!zer.test(t))return!1;try{let[r]=t.split("."),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||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function ntr(t,e){return!!((e==="v4"||!e)&&Ger.test(t)||(e==="v6"||!e)&&Yer.test(t))}function otr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}function jL(t){if(t instanceof fp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=dp.create(jL(n))}return new fp({...t._def,shape:()=>e})}else return t instanceof wC?new wC({...t._def,type:jL(t.element)}):t instanceof dp?dp.create(jL(t.unwrap())):t instanceof qb?qb.create(jL(t.unwrap())):t instanceof Bb?Bb.create(t.items.map(e=>jL(e))):t}function ape(t,e){let r=_C(t),n=_C(e);if(t===e)return{valid:!0,data:t};if(r===bt.object&&n===bt.object){let o=Qn.objectKeys(e),i=Qn.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=ape(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===bt.array&&n===bt.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=ape(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===bt.date&&n===bt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function TUe(t,e){return new sR({values:t,typeName:de.ZodEnum,...Hr(e)})}function wUe(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function AUe(t,e={},r){return t?OE.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=wUe(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=wUe(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):OE.create()}var Qn,npe,bt,_C,Fe,Der,hm,DL,xUe,_K,Fer,Ed,hr,NL,Of,ope,ipe,YM,f2,kt,c2,d2,_h,vUe,Vr,ker,$er,Ber,qer,Uer,zer,Her,Ver,Wer,rpe,Ker,Ger,Jer,Yer,Zer,Xer,OUe,Qer,CE,ZM,XM,QM,eR,LL,tR,rR,OE,vC,dy,FL,wC,fp,nR,bC,wK,oR,Bb,SK,kL,$L,xK,iR,aR,sR,uR,PE,gm,dp,qb,lR,cR,BL,itr,p2,m2,dR,atr,de,str,IUe,MUe,utr,ltr,RUe,ctr,dtr,ftr,ptr,mtr,htr,gtr,ytr,btr,_tr,vtr,wtr,Str,xtr,Ctr,Otr,Ptr,Etr,Ttr,Atr,Itr,Mtr,Rtr,jtr,SUe,Ntr,Dtr,Ltr,Ftr,ktr,$tr,Btr,qtr,Utr,Wr,Td=w(()=>{(function(t){t.assertEqual=o=>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"&&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})(Qn||(Qn={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(npe||(npe={}));bt=Qn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_C=t=>{switch(typeof t){case"undefined":return bt.undefined;case"string":return bt.string;case"number":return isNaN(t)?bt.nan:bt.number;case"boolean":return bt.boolean;case"function":return bt.function;case"bigint":return bt.bigint;case"symbol":return bt.symbol;case"object":return Array.isArray(t)?bt.array:t===null?bt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?bt.promise:typeof Map<"u"&&t instanceof Map?bt.map:typeof Set<"u"&&t instanceof Set?bt.set:typeof Date<"u"&&t instanceof Date?bt.date:bt.object;default:return bt.unknown}},Fe=Qn.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"]),Der=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),hm=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};hm.create=t=>new hm(t);DL=(t,e)=>{let r;switch(t.code){case Fe.invalid_type:t.received===bt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Fe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Qn.jsonStringifyReplacer)}`;break;case Fe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Qn.joinValues(t.keys,", ")}`;break;case Fe.invalid_union:r="Invalid input";break;case Fe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Qn.joinValues(t.options)}`;break;case Fe.invalid_enum_value:r=`Invalid enum value. Expected ${Qn.joinValues(t.options)}, received '${t.received}'`;break;case Fe.invalid_arguments:r="Invalid function arguments";break;case Fe.invalid_return_type:r="Invalid function return type";break;case Fe.invalid_date:r="Invalid date";break;case Fe.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}"`:Qn.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Fe.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==="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 Fe.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 Fe.custom:r="Invalid input";break;case Fe.invalid_intersection_types:r="Intersection results could not be merged";break;case Fe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Fe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Qn.assertNever(t)}return{message:r}},xUe=DL;_K=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}},Fer=[];Ed=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 hr;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 hr;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}}},hr=Object.freeze({status:"aborted"}),NL=t=>({status:"dirty",value:t}),Of=t=>({status:"valid",value:t}),ope=t=>t.status==="aborted",ipe=t=>t.status==="dirty",YM=t=>t.status==="valid",f2=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(kt||(kt={}));_h=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||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},vUe=(t,e)=>{if(YM(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new hm(t.common.issues);return this._error=r,this._error}}};Vr=class{get description(){return this._def.description}_getType(e){return _C(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:_C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ed,ctx:{common:e.parent.common,data:e.data,parsedType:_C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(f2(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){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_C(e)},i=this._parseSync({data:e,path:o.path,parent:o});return vUe(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:_C(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return YM(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>YM(i)?{value:i.value}:{issues:o.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:_C(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(f2(o)?o:Promise.resolve(o));return vUe(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:Fe.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 gm({schema:this,typeName:de.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 dp.create(this,this._def)}nullable(){return qb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wC.create(this)}promise(){return PE.create(this,this._def)}or(e){return nR.create([this,e],this._def)}and(e){return oR.create(this,e,this._def)}transform(e){return new gm({...Hr(this._def),schema:this,typeName:de.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new lR({...Hr(this._def),innerType:this,defaultValue:r,typeName:de.ZodDefault})}brand(){return new p2({typeName:de.ZodBranded,type:this,...Hr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new cR({...Hr(this._def),innerType:this,catchValue:r,typeName:de.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return m2.create(this,e)}readonly(){return dR.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ker=/^c[^\s-]{8,}$/i,$er=/^[0-9a-z]+$/,Ber=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qer=/^[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,Uer=/^[a-z0-9_-]{21}$/i,zer=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Her=/^[-+]?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)?)??$/,Ver=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wer="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ker=/^(?:(?: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])$/,Ger=/^(?:(?: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])$/,Jer=/^(([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]))$/,Yer=/^(([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])$/,Zer=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xer=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OUe="((\\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])))",Qer=new RegExp(`^${OUe}$`);CE=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==bt.string){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.string,received:i.parsedType}),hr}let n=new Ed,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?ut(o,{code:Fe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&ut(o,{code:Fe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Ver.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"email",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")rpe||(rpe=new RegExp(Wer,"u")),rpe.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"emoji",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")qer.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"uuid",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Uer.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"nanoid",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ker.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")$er.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cuid2",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ber.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ulid",code:Fe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),ut(o,{validation:"url",code:Fe.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"regex",code:Fe.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?EUe(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Qer.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?etr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Her.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"duration",code:Fe.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ttr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"ip",code:Fe.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?rtr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"jwt",code:Fe.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ntr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"cidr",code:Fe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Zer.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64",code:Fe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Xer.test(e.data)||(o=this._getOrReturnCtx(e,o),ut(o,{validation:"base64url",code:Fe.invalid_string,message:i.message}),n.dirty()):Qn.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Fe.invalid_string,...kt.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...kt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...kt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...kt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...kt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...kt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...kt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...kt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...kt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...kt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...kt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...kt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...kt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...kt.errToObj(e)})}datetime(e){var r,n;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:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...kt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...kt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...kt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...kt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...kt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...kt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...kt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...kt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...kt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...kt.errToObj(r)})}nonempty(e){return this.min(1,kt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};CE.create=t=>{var e;return new CE({checks:[],typeName:de.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};ZM=class t extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==bt.number){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.number,received:i.parsedType}),hr}let n,o=new Ed;for(let i of this._def.checks)i.kind==="int"?Qn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?otr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_finite,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:kt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:kt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Qn.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)}};ZM.create=t=>new ZM({checks:[],typeName:de.ZodNumber,coerce:t?.coerce||!1,...Hr(t)});XM=class t extends Vr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==bt.bigint)return this._getInvalidInput(e);let n,o=new Ed;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),ut(n,{code:Fe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qn.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.bigint,received:r.parsedType}),hr}gte(e,r){return this.setLimit("min",e,!0,kt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,kt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,kt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,kt.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:kt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:kt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:kt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};XM.create=t=>{var e;return new XM({checks:[],typeName:de.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Hr(t)})};QM=class extends Vr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==bt.boolean){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.boolean,received:n.parsedType}),hr}return Of(e.data)}};QM.create=t=>new QM({typeName:de.ZodBoolean,coerce:t?.coerce||!1,...Hr(t)});eR=class t extends Vr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==bt.date){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_type,expected:bt.date,received:i.parsedType}),hr}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:Fe.invalid_date}),hr}let n=new Ed,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:Fe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Qn.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:kt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:kt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};eR.create=t=>new eR({checks:[],coerce:t?.coerce||!1,typeName:de.ZodDate,...Hr(t)});LL=class extends Vr{_parse(e){if(this._getType(e)!==bt.symbol){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.symbol,received:n.parsedType}),hr}return Of(e.data)}};LL.create=t=>new LL({typeName:de.ZodSymbol,...Hr(t)});tR=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.undefined,received:n.parsedType}),hr}return Of(e.data)}};tR.create=t=>new tR({typeName:de.ZodUndefined,...Hr(t)});rR=class extends Vr{_parse(e){if(this._getType(e)!==bt.null){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.null,received:n.parsedType}),hr}return Of(e.data)}};rR.create=t=>new rR({typeName:de.ZodNull,...Hr(t)});OE=class extends Vr{constructor(){super(...arguments),this._any=!0}_parse(e){return Of(e.data)}};OE.create=t=>new OE({typeName:de.ZodAny,...Hr(t)});vC=class extends Vr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Of(e.data)}};vC.create=t=>new vC({typeName:de.ZodUnknown,...Hr(t)});dy=class extends Vr{_parse(e){let r=this._getOrReturnCtx(e);return ut(r,{code:Fe.invalid_type,expected:bt.never,received:r.parsedType}),hr}};dy.create=t=>new dy({typeName:de.ZodNever,...Hr(t)});FL=class extends Vr{_parse(e){if(this._getType(e)!==bt.undefined){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.void,received:n.parsedType}),hr}return Of(e.data)}};FL.create=t=>new FL({typeName:de.ZodVoid,...Hr(t)});wC=class t extends Vr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==bt.array)return ut(r,{code:Fe.invalid_type,expected:bt.array,received:r.parsedType}),hr;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(ut(r,{code:a?Fe.too_big:Fe.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ut(r,{code:Fe.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ut(r,{code:Fe.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 _h(r,a,r.path,s)))).then(a=>Ed.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new _h(r,a,r.path,s)));return Ed.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:kt.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:kt.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:kt.toString(r)}})}nonempty(e){return this.min(1,e)}};wC.create=(t,e)=>new wC({type:t,minLength:null,maxLength:null,exactLength:null,typeName:de.ZodArray,...Hr(e)});fp=class t extends Vr{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=Qn.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==bt.object){let l=this._getOrReturnCtx(e);return ut(l,{code:Fe.invalid_type,expected:bt.object,received:l.parsedType}),hr}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof dy&&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 _h(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof dy){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&(ut(o,{code:Fe.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 _h(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=>Ed.mergeObjectSync(n,l)):Ed.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return kt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=kt.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}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:de.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Qn.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return jL(this)}partial(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return Qn.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof dp;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return TUe(Qn.objectKeys(this.shape))}};fp.create=(t,e)=>new fp({shape:()=>t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.strictCreate=(t,e)=>new fp({shape:()=>t,unknownKeys:"strict",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});fp.lazycreate=(t,e)=>new fp({shape:t,unknownKeys:"strip",catchall:dy.create(),typeName:de.ZodObject,...Hr(e)});nR=class extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new hm(s.ctx.common.issues));return ut(r,{code:Fe.invalid_union,unionErrors:a}),hr}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new hm(u));return ut(r,{code:Fe.invalid_union,unionErrors:s}),hr}}get options(){return this._def.options}};nR.create=(t,e)=>new nR({options:t,typeName:de.ZodUnion,...Hr(e)});bC=t=>t instanceof iR?bC(t.schema):t instanceof gm?bC(t.innerType()):t instanceof aR?[t.value]:t instanceof sR?t.options:t instanceof uR?Qn.objectValues(t.enum):t instanceof lR?bC(t._def.innerType):t instanceof tR?[void 0]:t instanceof rR?[null]:t instanceof dp?[void 0,...bC(t.unwrap())]:t instanceof qb?[null,...bC(t.unwrap())]:t instanceof p2||t instanceof dR?bC(t.unwrap()):t instanceof cR?bC(t._def.innerType):[],wK=class t extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.object)return ut(r,{code:Fe.invalid_type,expected:bt.object,received:r.parsedType}),hr;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(ut(r,{code:Fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),hr)}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=bC(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:de.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Hr(n)})}};oR=class extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(ope(i)||ope(a))return hr;let s=ape(i.value,a.value);return s.valid?((ipe(i)||ipe(a))&&r.dirty(),{status:r.value,value:s.data}):(ut(n,{code:Fe.invalid_intersection_types}),hr)};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}))}};oR.create=(t,e,r)=>new oR({left:t,right:e,typeName:de.ZodIntersection,...Hr(r)});Bb=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.array)return ut(n,{code:Fe.invalid_type,expected:bt.array,received:n.parsedType}),hr;if(n.data.length<this._def.items.length)return ut(n,{code:Fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),hr;!this._def.rest&&n.data.length>this._def.items.length&&(ut(n,{code:Fe.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 _h(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ed.mergeArray(r,a)):Ed.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Bb.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bb({items:t,typeName:de.ZodTuple,rest:null,...Hr(e)})};SK=class t extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.object)return ut(n,{code:Fe.invalid_type,expected:bt.object,received:n.parsedType}),hr;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new _h(n,s,n.path,s)),value:a._parse(new _h(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ed.mergeObjectAsync(r,o):Ed.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Vr?new t({keyType:e,valueType:r,typeName:de.ZodRecord,...Hr(n)}):new t({keyType:CE.create(),valueType:e,typeName:de.ZodRecord,...Hr(r)})}},kL=class extends Vr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.map)return ut(n,{code:Fe.invalid_type,expected:bt.map,received:n.parsedType}),hr;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new _h(n,s,n.path,[l,"key"])),value:i._parse(new _h(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 hr;(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 hr;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};kL.create=(t,e,r)=>new kL({valueType:e,keyType:t,typeName:de.ZodMap,...Hr(r)});$L=class t extends Vr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==bt.set)return ut(n,{code:Fe.invalid_type,expected:bt.set,received:n.parsedType}),hr;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(ut(n,{code:Fe.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(ut(n,{code:Fe.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 hr;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 _h(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:kt.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:kt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};$L.create=(t,e)=>new $L({valueType:t,minSize:null,maxSize:null,typeName:de.ZodSet,...Hr(e)});xK=class t extends Vr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.function)return ut(r,{code:Fe.invalid_type,expected:bt.function,received:r.parsedType}),hr;function n(s,u){return _K({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bK(),DL].filter(l=>!!l),issueData:{code:Fe.invalid_arguments,argumentsError:u}})}function o(s,u){return _K({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bK(),DL].filter(l=>!!l),issueData:{code:Fe.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof PE){let s=this;return Of(async function(...u){let l=new hm([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return Of(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new hm([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new hm([o(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Bb.create(e).rest(vC.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||Bb.create([]).rest(vC.create()),returns:r||vC.create(),typeName:de.ZodFunction,...Hr(n)})}},iR=class extends Vr{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})}};iR.create=(t,e)=>new iR({getter:t,typeName:de.ZodLazy,...Hr(e)});aR=class extends Vr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ut(r,{received:r.data,code:Fe.invalid_literal,expected:this._def.value}),hr}return{status:"valid",value:e.data}}get value(){return this._def.value}};aR.create=(t,e)=>new aR({value:t,typeName:de.ZodLiteral,...Hr(e)});sR=class t extends Vr{constructor(){super(...arguments),c2.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{expected:Qn.joinValues(n),received:r.parsedType,code:Fe.invalid_type}),hr}if(vK(this,c2,"f")||CUe(this,c2,new Set(this._def.values),"f"),!vK(this,c2,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return ut(r,{received:r.data,code:Fe.invalid_enum_value,options:n}),hr}return Of(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})}};c2=new WeakMap;sR.create=TUe;uR=class extends Vr{constructor(){super(...arguments),d2.set(this,void 0)}_parse(e){let r=Qn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==bt.string&&n.parsedType!==bt.number){let o=Qn.objectValues(r);return ut(n,{expected:Qn.joinValues(o),received:n.parsedType,code:Fe.invalid_type}),hr}if(vK(this,d2,"f")||CUe(this,d2,new Set(Qn.getValidEnumValues(this._def.values)),"f"),!vK(this,d2,"f").has(e.data)){let o=Qn.objectValues(r);return ut(n,{received:n.data,code:Fe.invalid_enum_value,options:o}),hr}return Of(e.data)}get enum(){return this._def.values}};d2=new WeakMap;uR.create=(t,e)=>new uR({values:t,typeName:de.ZodNativeEnum,...Hr(e)});PE=class extends Vr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==bt.promise&&r.common.async===!1)return ut(r,{code:Fe.invalid_type,expected:bt.promise,received:r.parsedType}),hr;let n=r.parsedType===bt.promise?r.data:Promise.resolve(r.data);return Of(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};PE.create=(t,e)=>new PE({type:t,typeName:de.ZodPromise,...Hr(e)});gm=class extends Vr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===de.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{ut(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return hr;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?hr:u.status==="dirty"||r.value==="dirty"?NL(u.value):u});{if(r.value==="aborted")return hr;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?hr:s.status==="dirty"||r.value==="dirty"?NL(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"?hr:(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"?hr:(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(!YM(a))return a;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=>YM(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);Qn.assertNever(o)}};gm.create=(t,e,r)=>new gm({schema:t,typeName:de.ZodEffects,effect:e,...Hr(r)});gm.createWithPreprocess=(t,e,r)=>new gm({schema:e,effect:{type:"preprocess",transform:t},typeName:de.ZodEffects,...Hr(r)});dp=class extends Vr{_parse(e){return this._getType(e)===bt.undefined?Of(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dp.create=(t,e)=>new dp({innerType:t,typeName:de.ZodOptional,...Hr(e)});qb=class extends Vr{_parse(e){return this._getType(e)===bt.null?Of(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qb.create=(t,e)=>new qb({innerType:t,typeName:de.ZodNullable,...Hr(e)});lR=class extends Vr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===bt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};lR.create=(t,e)=>new lR({innerType:t,typeName:de.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Hr(e)});cR=class extends Vr{_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 f2(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new hm(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cR.create=(t,e)=>new cR({innerType:t,typeName:de.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Hr(e)});BL=class extends Vr{_parse(e){if(this._getType(e)!==bt.nan){let n=this._getOrReturnCtx(e);return ut(n,{code:Fe.invalid_type,expected:bt.nan,received:n.parsedType}),hr}return{status:"valid",value:e.data}}};BL.create=t=>new BL({typeName:de.ZodNaN,...Hr(t)});itr=Symbol("zod_brand"),p2=class extends Vr{_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}},m2=class t extends Vr{_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"?hr:i.status==="dirty"?(r.dirty(),NL(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"?hr: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:de.ZodPipeline})}},dR=class extends Vr{_parse(e){let r=this._def.innerType._parse(e),n=o=>(YM(o)&&(o.value=Object.freeze(o.value)),o);return f2(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};dR.create=(t,e)=>new dR({innerType:t,typeName:de.ZodReadonly,...Hr(e)});atr={object:fp.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"})(de||(de={}));str=(t,e={message:`Input not instance of ${t.name}`})=>AUe(r=>r instanceof t,e),IUe=CE.create,MUe=ZM.create,utr=BL.create,ltr=XM.create,RUe=QM.create,ctr=eR.create,dtr=LL.create,ftr=tR.create,ptr=rR.create,mtr=OE.create,htr=vC.create,gtr=dy.create,ytr=FL.create,btr=wC.create,_tr=fp.create,vtr=fp.strictCreate,wtr=nR.create,Str=wK.create,xtr=oR.create,Ctr=Bb.create,Otr=SK.create,Ptr=kL.create,Etr=$L.create,Ttr=xK.create,Atr=iR.create,Itr=aR.create,Mtr=sR.create,Rtr=uR.create,jtr=PE.create,SUe=gm.create,Ntr=dp.create,Dtr=qb.create,Ltr=gm.createWithPreprocess,Ftr=m2.create,ktr=()=>IUe().optional(),$tr=()=>MUe().optional(),Btr=()=>RUe().optional(),qtr={string:t=>CE.create({...t,coerce:!0}),number:t=>ZM.create({...t,coerce:!0}),boolean:t=>QM.create({...t,coerce:!0}),bigint:t=>XM.create({...t,coerce:!0}),date:t=>eR.create({...t,coerce:!0})},Utr=hr,Wr=Object.freeze({__proto__:null,defaultErrorMap:DL,setErrorMap:Ler,getErrorMap:bK,makeIssue:_K,EMPTY_PATH:Fer,addIssueToContext:ut,ParseStatus:Ed,INVALID:hr,DIRTY:NL,OK:Of,isAborted:ope,isDirty:ipe,isValid:YM,isAsync:f2,get util(){return Qn},get objectUtil(){return npe},ZodParsedType:bt,getParsedType:_C,ZodType:Vr,datetimeRegex:EUe,ZodString:CE,ZodNumber:ZM,ZodBigInt:XM,ZodBoolean:QM,ZodDate:eR,ZodSymbol:LL,ZodUndefined:tR,ZodNull:rR,ZodAny:OE,ZodUnknown:vC,ZodNever:dy,ZodVoid:FL,ZodArray:wC,ZodObject:fp,ZodUnion:nR,ZodDiscriminatedUnion:wK,ZodIntersection:oR,ZodTuple:Bb,ZodRecord:SK,ZodMap:kL,ZodSet:$L,ZodFunction:xK,ZodLazy:iR,ZodLiteral:aR,ZodEnum:sR,ZodNativeEnum:uR,ZodPromise:PE,ZodEffects:gm,ZodTransformer:gm,ZodOptional:dp,ZodNullable:qb,ZodDefault:lR,ZodCatch:cR,ZodNaN:BL,BRAND:itr,ZodBranded:p2,ZodPipeline:m2,ZodReadonly:dR,custom:AUe,Schema:Vr,ZodSchema:Vr,late:atr,get ZodFirstPartyTypeKind(){return de},coerce:qtr,any:mtr,array:btr,bigint:ltr,boolean:RUe,date:ctr,discriminatedUnion:Str,effect:SUe,enum:Mtr,function:Ttr,instanceof:str,intersection:xtr,lazy:Atr,literal:Itr,map:Ptr,nan:utr,nativeEnum:Rtr,never:gtr,null:ptr,nullable:Dtr,number:MUe,object:_tr,oboolean:Btr,onumber:$tr,optional:Ntr,ostring:ktr,pipeline:Ftr,preprocess:Ltr,promise:jtr,record:Otr,set:Etr,strictObject:vtr,string:IUe,symbol:dtr,transformer:SUe,tuple:Ctr,undefined:ftr,union:wtr,unknown:htr,void:ytr,NEVER:Utr,ZodIssueCode:Fe,quotelessJson:Der,ZodError:hm})});var NUe=v((f1n,jUe)=>{function vh(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))}jUe.exports=vh;vh.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};vh.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};vh.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};vh.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)};vh.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};vh.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};vh.prototype.start=vh.prototype.try;vh.prototype.errors=function(){return this._errors};vh.prototype.attempts=function(){return this._attempts};vh.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 DUe=v(fR=>{var ztr=NUe();fR.operation=function(t){var e=fR.timeouts(t);return new ztr(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};fR.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};fR.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};fR.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=fR.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 FUe=v((m1n,LUe)=>{LUe.exports=DUe()});var PK=v((h1n,OK)=>{"use strict";var Htr=FUe(),Vtr=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],CK=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}},Wtr=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},Ktr=t=>Vtr.includes(t),kUe=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=Htr.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 CK)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!Ktr(a.message))o.stop(),n(a);else{Wtr(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});OK.exports=kUe;OK.exports.default=kUe;OK.exports.AbortError=CK});var $Ue,BUe=w(()=>{$Ue=/^(?:[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 Gtr(t){return typeof t=="string"&&$Ue.test(t)}var EE,qUe=w(()=>{BUe();EE=Gtr});function UUe(t,e=0){return(Pc[t[e+0]]+Pc[t[e+1]]+Pc[t[e+2]]+Pc[t[e+3]]+"-"+Pc[t[e+4]]+Pc[t[e+5]]+"-"+Pc[t[e+6]]+Pc[t[e+7]]+"-"+Pc[t[e+8]]+Pc[t[e+9]]+"-"+Pc[t[e+10]]+Pc[t[e+11]]+Pc[t[e+12]]+Pc[t[e+13]]+Pc[t[e+14]]+Pc[t[e+15]]).toLowerCase()}var Pc,EK,zUe=w(()=>{Pc=[];for(EK=0;EK<256;++EK)Pc.push((EK+256).toString(16).slice(1))});function spe(){if(!TK&&(TK=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!TK))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return TK(Jtr)}var TK,Jtr,HUe=w(()=>{Jtr=new Uint8Array(16)});var Ytr,upe,VUe=w(()=>{Ytr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),upe={randomUUID:Ytr}});function Ztr(t,e,r){if(upe.randomUUID&&!e&&!t)return upe.randomUUID();t=t||{};var n=t.random||(t.rng||spe)();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 UUe(n)}var as,WUe=w(()=>{VUe();HUe();zUe();as=Ztr});var TE=w(()=>{WUe();qUe()});var GUe=v((T1n,lpe)=>{"use strict";var Xtr=Object.prototype.hasOwnProperty,Pf="~";function h2(){}Object.create&&(h2.prototype=Object.create(null),new h2().__proto__||(Pf=!1));function Qtr(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function KUe(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Qtr(r,n||t,o),a=Pf?Pf+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 IK(t,e){--t._eventsCount===0?t._events=new h2:delete t._events[e]}function Ad(){this._events=new h2,this._eventsCount=0}Ad.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Xtr.call(r,n)&&e.push(Pf?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ad.prototype.listeners=function(e){var r=Pf?Pf+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};Ad.prototype.listenerCount=function(e){var r=Pf?Pf+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Ad.prototype.emit=function(e,r,n,o,i,a){var s=Pf?Pf+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};Ad.prototype.on=function(e,r,n){return KUe(this,e,r,n,!1)};Ad.prototype.once=function(e,r,n){return KUe(this,e,r,n,!0)};Ad.prototype.removeListener=function(e,r,n,o){var i=Pf?Pf+e:e;if(!this._events[i])return this;if(!r)return IK(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&IK(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:IK(this,i)}return this};Ad.prototype.removeAllListeners=function(e){var r;return e?(r=Pf?Pf+e:e,this._events[r]&&IK(this,r)):(this._events=new h2,this._eventsCount=0),this};Ad.prototype.off=Ad.prototype.removeListener;Ad.prototype.addListener=Ad.prototype.on;Ad.prefixed=Pf;Ad.EventEmitter=Ad;typeof lpe<"u"&&(lpe.exports=Ad)});var YUe=v((A1n,JUe)=>{"use strict";JUe.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 XUe=v((I1n,RK)=>{"use strict";var err=YUe(),MK=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},ZUe=(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 MK(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);err(t.then(n,o),()=>{clearTimeout(i)})});RK.exports=ZUe;RK.exports.default=ZUe;RK.exports.TimeoutError=MK});var QUe=v(cpe=>{"use strict";Object.defineProperty(cpe,"__esModule",{value:!0});function trr(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}cpe.default=trr});var eze=v(fpe=>{"use strict";Object.defineProperty(fpe,"__esModule",{value:!0});var rrr=QUe(),dpe=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=rrr.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}};fpe.default=dpe});var NK=v(mpe=>{"use strict";Object.defineProperty(mpe,"__esModule",{value:!0});var nrr=GUe(),tze=XUe(),orr=eze(),jK=()=>{},irr=new tze.TimeoutError,ppe=class extends nrr{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=jK,this._resolveIdle=jK,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:orr.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=jK,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=jK,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():tze.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(irr)});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}};mpe.default=ppe});var arr,srr,Vt,DK=w(()=>{g2();arr=(...t)=>fetch(...t),srr=Symbol.for("ls:fetch_implementation"),Vt=t=>async(...e)=>{if(t||pp("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[srr]??arr)(...e);return(t||pp("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var rze,LK,urr,lrr,y2,nze=w(()=>{rze=F(PK(),1),LK=F(NK(),1);DK();urr=[400,401,403,404,405,406,407,408],lrr=[409],y2=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 LK.default?this.queue=new LK.default.default({concurrency:this.maxConcurrency}):this.queue=new LK.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,rze.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(urr.includes(+a))throw o;if(lrr.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 hpe(t){return typeof t?._getType=="function"}function gpe(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 oze=w(()=>{});function Kr(t,e){if(!EE(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var ize=w(()=>{TE()});function FK(t){aze[t]||(console.warn(t),aze[t]=!0)}var aze,ype=w(()=>{aze={}});var b2=v((q1n,sze)=>{var crr="2.0.0",drr=Number.MAX_SAFE_INTEGER||9007199254740991,frr=16,prr=250,mrr=["major","premajor","minor","preminor","patch","prepatch","prerelease"];sze.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:frr,MAX_SAFE_BUILD_LENGTH:prr,MAX_SAFE_INTEGER:drr,RELEASE_TYPES:mrr,SEMVER_SPEC_VERSION:crr,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var _2=v((U1n,uze)=>{var hrr=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};uze.exports=hrr});var qL=v((SC,lze)=>{var{MAX_SAFE_COMPONENT_LENGTH:bpe,MAX_SAFE_BUILD_LENGTH:grr,MAX_LENGTH:yrr}=b2(),brr=_2();SC=lze.exports={};var _rr=SC.re=[],vrr=SC.safeRe=[],wt=SC.src=[],St=SC.t={},wrr=0,_pe="[a-zA-Z0-9-]",Srr=[["\\s",1],["\\d",yrr],[_pe,grr]],xrr=t=>{for(let[e,r]of Srr)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Fr=(t,e,r)=>{let n=xrr(e),o=wrr++;brr(t,o,e),St[t]=o,wt[o]=e,_rr[o]=new RegExp(e,r?"g":void 0),vrr[o]=new RegExp(n,r?"g":void 0)};Fr("NUMERICIDENTIFIER","0|[1-9]\\d*");Fr("NUMERICIDENTIFIERLOOSE","\\d+");Fr("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${_pe}*`);Fr("MAINVERSION",`(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})\\.(${wt[St.NUMERICIDENTIFIER]})`);Fr("MAINVERSIONLOOSE",`(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})\\.(${wt[St.NUMERICIDENTIFIERLOOSE]})`);Fr("PRERELEASEIDENTIFIER",`(?:${wt[St.NUMERICIDENTIFIER]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASEIDENTIFIERLOOSE",`(?:${wt[St.NUMERICIDENTIFIERLOOSE]}|${wt[St.NONNUMERICIDENTIFIER]})`);Fr("PRERELEASE",`(?:-(${wt[St.PRERELEASEIDENTIFIER]}(?:\\.${wt[St.PRERELEASEIDENTIFIER]})*))`);Fr("PRERELEASELOOSE",`(?:-?(${wt[St.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${wt[St.PRERELEASEIDENTIFIERLOOSE]})*))`);Fr("BUILDIDENTIFIER",`${_pe}+`);Fr("BUILD",`(?:\\+(${wt[St.BUILDIDENTIFIER]}(?:\\.${wt[St.BUILDIDENTIFIER]})*))`);Fr("FULLPLAIN",`v?${wt[St.MAINVERSION]}${wt[St.PRERELEASE]}?${wt[St.BUILD]}?`);Fr("FULL",`^${wt[St.FULLPLAIN]}$`);Fr("LOOSEPLAIN",`[v=\\s]*${wt[St.MAINVERSIONLOOSE]}${wt[St.PRERELEASELOOSE]}?${wt[St.BUILD]}?`);Fr("LOOSE",`^${wt[St.LOOSEPLAIN]}$`);Fr("GTLT","((?:<|>)?=?)");Fr("XRANGEIDENTIFIERLOOSE",`${wt[St.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Fr("XRANGEIDENTIFIER",`${wt[St.NUMERICIDENTIFIER]}|x|X|\\*`);Fr("XRANGEPLAIN",`[v=\\s]*(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:\\.(${wt[St.XRANGEIDENTIFIER]})(?:${wt[St.PRERELEASE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGEPLAINLOOSE",`[v=\\s]*(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wt[St.XRANGEIDENTIFIERLOOSE]})(?:${wt[St.PRERELEASELOOSE]})?${wt[St.BUILD]}?)?)?`);Fr("XRANGE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAIN]}$`);Fr("XRANGELOOSE",`^${wt[St.GTLT]}\\s*${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COERCEPLAIN",`(^|[^\\d])(\\d{1,${bpe}})(?:\\.(\\d{1,${bpe}}))?(?:\\.(\\d{1,${bpe}}))?`);Fr("COERCE",`${wt[St.COERCEPLAIN]}(?:$|[^\\d])`);Fr("COERCEFULL",wt[St.COERCEPLAIN]+`(?:${wt[St.PRERELEASE]})?(?:${wt[St.BUILD]})?(?:$|[^\\d])`);Fr("COERCERTL",wt[St.COERCE],!0);Fr("COERCERTLFULL",wt[St.COERCEFULL],!0);Fr("LONETILDE","(?:~>?)");Fr("TILDETRIM",`(\\s*)${wt[St.LONETILDE]}\\s+`,!0);SC.tildeTrimReplace="$1~";Fr("TILDE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAIN]}$`);Fr("TILDELOOSE",`^${wt[St.LONETILDE]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("LONECARET","(?:\\^)");Fr("CARETTRIM",`(\\s*)${wt[St.LONECARET]}\\s+`,!0);SC.caretTrimReplace="$1^";Fr("CARET",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAIN]}$`);Fr("CARETLOOSE",`^${wt[St.LONECARET]}${wt[St.XRANGEPLAINLOOSE]}$`);Fr("COMPARATORLOOSE",`^${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]})$|^$`);Fr("COMPARATOR",`^${wt[St.GTLT]}\\s*(${wt[St.FULLPLAIN]})$|^$`);Fr("COMPARATORTRIM",`(\\s*)${wt[St.GTLT]}\\s*(${wt[St.LOOSEPLAIN]}|${wt[St.XRANGEPLAIN]})`,!0);SC.comparatorTrimReplace="$1$2$3";Fr("HYPHENRANGE",`^\\s*(${wt[St.XRANGEPLAIN]})\\s+-\\s+(${wt[St.XRANGEPLAIN]})\\s*$`);Fr("HYPHENRANGELOOSE",`^\\s*(${wt[St.XRANGEPLAINLOOSE]})\\s+-\\s+(${wt[St.XRANGEPLAINLOOSE]})\\s*$`);Fr("STAR","(<|>)?=?\\s*\\*");Fr("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Fr("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var kK=v((z1n,cze)=>{var Crr=Object.freeze({loose:!0}),Orr=Object.freeze({}),Prr=t=>t?typeof t!="object"?Crr:t:Orr;cze.exports=Prr});var vpe=v((H1n,pze)=>{var dze=/^[0-9]+$/,fze=(t,e)=>{let r=dze.test(t),n=dze.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Err=(t,e)=>fze(e,t);pze.exports={compareIdentifiers:fze,rcompareIdentifiers:Err}});var Id=v((V1n,yze)=>{var $K=_2(),{MAX_LENGTH:mze,MAX_SAFE_INTEGER:BK}=b2(),{safeRe:hze,t:gze}=qL(),Trr=kK(),{compareIdentifiers:UL}=vpe(),wpe=class t{constructor(e,r){if(r=Trr(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>mze)throw new TypeError(`version is longer than ${mze} characters`);$K("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?hze[gze.LOOSE]:hze[gze.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>BK||this.major<0)throw new TypeError("Invalid major version");if(this.minor>BK||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>BK||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<BK)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($K("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)),UL(this.major,e.major)||UL(this.minor,e.minor)||UL(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($K("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 UL(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($K("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 UL(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]),UL(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}};yze.exports=wpe});var pR=v((W1n,_ze)=>{var bze=Id(),Arr=(t,e,r=!1)=>{if(t instanceof bze)return t;try{return new bze(t,e)}catch(n){if(!r)return null;throw n}};_ze.exports=Arr});var wze=v((K1n,vze)=>{var Irr=pR(),Mrr=(t,e)=>{let r=Irr(t,e);return r?r.version:null};vze.exports=Mrr});var xze=v((G1n,Sze)=>{var Rrr=pR(),jrr=(t,e)=>{let r=Rrr(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Sze.exports=jrr});var Pze=v((J1n,Oze)=>{var Cze=Id(),Nrr=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Cze(t instanceof Cze?t.version:t,r).inc(e,n,o).version}catch{return null}};Oze.exports=Nrr});var Aze=v((Y1n,Tze)=>{var Eze=pR(),Drr=(t,e)=>{let r=Eze(t,null,!0),n=Eze(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"};Tze.exports=Drr});var Mze=v((Z1n,Ize)=>{var Lrr=Id(),Frr=(t,e)=>new Lrr(t,e).major;Ize.exports=Frr});var jze=v((X1n,Rze)=>{var krr=Id(),$rr=(t,e)=>new krr(t,e).minor;Rze.exports=$rr});var Dze=v((Q1n,Nze)=>{var Brr=Id(),qrr=(t,e)=>new Brr(t,e).patch;Nze.exports=qrr});var Fze=v((ejn,Lze)=>{var Urr=pR(),zrr=(t,e)=>{let r=Urr(t,e);return r&&r.prerelease.length?r.prerelease:null};Lze.exports=zrr});var wh=v((tjn,$ze)=>{var kze=Id(),Hrr=(t,e,r)=>new kze(t,r).compare(new kze(e,r));$ze.exports=Hrr});var qze=v((rjn,Bze)=>{var Vrr=wh(),Wrr=(t,e,r)=>Vrr(e,t,r);Bze.exports=Wrr});var zze=v((njn,Uze)=>{var Krr=wh(),Grr=(t,e)=>Krr(t,e,!0);Uze.exports=Grr});var qK=v((ojn,Vze)=>{var Hze=Id(),Jrr=(t,e,r)=>{let n=new Hze(t,r),o=new Hze(e,r);return n.compare(o)||n.compareBuild(o)};Vze.exports=Jrr});var Kze=v((ijn,Wze)=>{var Yrr=qK(),Zrr=(t,e)=>t.sort((r,n)=>Yrr(r,n,e));Wze.exports=Zrr});var Jze=v((ajn,Gze)=>{var Xrr=qK(),Qrr=(t,e)=>t.sort((r,n)=>Xrr(n,r,e));Gze.exports=Qrr});var v2=v((sjn,Yze)=>{var enr=wh(),tnr=(t,e,r)=>enr(t,e,r)>0;Yze.exports=tnr});var UK=v((ujn,Zze)=>{var rnr=wh(),nnr=(t,e,r)=>rnr(t,e,r)<0;Zze.exports=nnr});var Spe=v((ljn,Xze)=>{var onr=wh(),inr=(t,e,r)=>onr(t,e,r)===0;Xze.exports=inr});var xpe=v((cjn,Qze)=>{var anr=wh(),snr=(t,e,r)=>anr(t,e,r)!==0;Qze.exports=snr});var zK=v((djn,e2e)=>{var unr=wh(),lnr=(t,e,r)=>unr(t,e,r)>=0;e2e.exports=lnr});var HK=v((fjn,t2e)=>{var cnr=wh(),dnr=(t,e,r)=>cnr(t,e,r)<=0;t2e.exports=dnr});var Cpe=v((pjn,r2e)=>{var fnr=Spe(),pnr=xpe(),mnr=v2(),hnr=zK(),gnr=UK(),ynr=HK(),bnr=(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 fnr(t,r,n);case"!=":return pnr(t,r,n);case">":return mnr(t,r,n);case">=":return hnr(t,r,n);case"<":return gnr(t,r,n);case"<=":return ynr(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};r2e.exports=bnr});var o2e=v((mjn,n2e)=>{var _nr=Id(),vnr=pR(),{safeRe:VK,t:WK}=qL(),wnr=(t,e)=>{if(t instanceof _nr)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?VK[WK.COERCEFULL]:VK[WK.COERCE]);else{let u=e.includePrerelease?VK[WK.COERCERTLFULL]:VK[WK.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 vnr(`${n}.${o}.${i}${a}${s}`,e)};n2e.exports=wnr});var a2e=v((hjn,i2e)=>{var Ope=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}};i2e.exports=Ope});var Sh=v((gjn,c2e)=>{var Snr=/\s+/g,Ppe=class t{constructor(e,r){if(r=Cnr(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Epe)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(Snr," "),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=>!u2e(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&&Mnr(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&&Anr)|(this.options.loose&&Inr))+":"+e,o=s2e.get(n);if(o)return o;let i=this.options.loose,a=i?mp[Ef.HYPHENRANGELOOSE]:mp[Ef.HYPHENRANGE];e=e.replace(a,qnr(this.options.includePrerelease)),na("hyphen replace",e),e=e.replace(mp[Ef.COMPARATORTRIM],Pnr),na("comparator trim",e),e=e.replace(mp[Ef.TILDETRIM],Enr),na("tilde trim",e),e=e.replace(mp[Ef.CARETTRIM],Tnr),na("caret trim",e);let s=e.split(" ").map(d=>Rnr(d,this.options)).join(" ").split(/\s+/).map(d=>Bnr(d,this.options));i&&(s=s.filter(d=>(na("loose invalid filter",d,this.options),!!d.match(mp[Ef.COMPARATORLOOSE])))),na("range list",s);let u=new Map,l=s.map(d=>new Epe(d,this.options));for(let d of l){if(u2e(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return s2e.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>l2e(n,r)&&e.set.some(o=>l2e(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 Onr(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Unr(this.set[r],e,this.options))return!0;return!1}};c2e.exports=Ppe;var xnr=a2e(),s2e=new xnr,Cnr=kK(),Epe=w2(),na=_2(),Onr=Id(),{safeRe:mp,t:Ef,comparatorTrimReplace:Pnr,tildeTrimReplace:Enr,caretTrimReplace:Tnr}=qL(),{FLAG_INCLUDE_PRERELEASE:Anr,FLAG_LOOSE:Inr}=b2(),u2e=t=>t.value==="<0.0.0-0",Mnr=t=>t.value==="",l2e=(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},Rnr=(t,e)=>(na("comp",t,e),t=Dnr(t,e),na("caret",t),t=jnr(t,e),na("tildes",t),t=Fnr(t,e),na("xrange",t),t=$nr(t,e),na("stars",t),t),Tf=t=>!t||t.toLowerCase()==="x"||t==="*",jnr=(t,e)=>t.trim().split(/\s+/).map(r=>Nnr(r,e)).join(" "),Nnr=(t,e)=>{let r=e.loose?mp[Ef.TILDELOOSE]:mp[Ef.TILDE];return t.replace(r,(n,o,i,a,s)=>{na("tilde",t,n,o,i,a,s);let u;return Tf(o)?u="":Tf(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Tf(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(na("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,na("tilde return",u),u})},Dnr=(t,e)=>t.trim().split(/\s+/).map(r=>Lnr(r,e)).join(" "),Lnr=(t,e)=>{na("caret",t,e);let r=e.loose?mp[Ef.CARETLOOSE]:mp[Ef.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{na("caret",t,o,i,a,s,u);let l;return Tf(i)?l="":Tf(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Tf(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(na("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`):(na("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`),na("caret return",l),l})},Fnr=(t,e)=>(na("replaceXRanges",t,e),t.split(/\s+/).map(r=>knr(r,e)).join(" ")),knr=(t,e)=>{t=t.trim();let r=e.loose?mp[Ef.XRANGELOOSE]:mp[Ef.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{na("xRange",t,n,o,i,a,s,u);let l=Tf(i),c=l||Tf(a),d=c||Tf(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`),na("xRange return",n),n})},$nr=(t,e)=>(na("replaceStars",t,e),t.trim().replace(mp[Ef.STAR],"")),Bnr=(t,e)=>(na("replaceGTE0",t,e),t.trim().replace(mp[e.includePrerelease?Ef.GTE0PRE:Ef.GTE0],"")),qnr=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Tf(n)?r="":Tf(o)?r=`>=${n}.0.0${t?"-0":""}`:Tf(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Tf(l)?u="":Tf(c)?u=`<${+l+1}.0.0-0`:Tf(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()),Unr=(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(na(t[n].semver),t[n].semver!==Epe.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 w2=v((yjn,g2e)=>{var S2=Symbol("SemVer ANY"),Ipe=class t{static get ANY(){return S2}constructor(e,r){if(r=d2e(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Ape("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===S2?this.value="":this.value=this.operator+this.semver.version,Ape("comp",this)}parse(e){let r=this.options.loose?f2e[p2e.COMPARATORLOOSE]:f2e[p2e.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 m2e(n[2],this.options.loose):this.semver=S2}toString(){return this.value}test(e){if(Ape("Comparator.test",e,this.options.loose),this.semver===S2||e===S2)return!0;if(typeof e=="string")try{e=new m2e(e,this.options)}catch{return!1}return Tpe(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 h2e(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new h2e(this.value,r).test(e.semver):(r=d2e(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("=")||Tpe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Tpe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};g2e.exports=Ipe;var d2e=kK(),{safeRe:f2e,t:p2e}=qL(),Tpe=Cpe(),Ape=_2(),m2e=Id(),h2e=Sh()});var x2=v((bjn,y2e)=>{var znr=Sh(),Hnr=(t,e,r)=>{try{e=new znr(e,r)}catch{return!1}return e.test(t)};y2e.exports=Hnr});var _2e=v((_jn,b2e)=>{var Vnr=Sh(),Wnr=(t,e)=>new Vnr(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));b2e.exports=Wnr});var w2e=v((vjn,v2e)=>{var Knr=Id(),Gnr=Sh(),Jnr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Gnr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new Knr(n,r))}),n};v2e.exports=Jnr});var x2e=v((wjn,S2e)=>{var Ynr=Id(),Znr=Sh(),Xnr=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Znr(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new Ynr(n,r))}),n};S2e.exports=Xnr});var P2e=v((Sjn,O2e)=>{var Mpe=Id(),Qnr=Sh(),C2e=v2(),eor=(t,e)=>{t=new Qnr(t,e);let r=new Mpe("0.0.0");if(t.test(r)||(r=new Mpe("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 Mpe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||C2e(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||C2e(r,i))&&(r=i)}return r&&t.test(r)?r:null};O2e.exports=eor});var T2e=v((xjn,E2e)=>{var tor=Sh(),ror=(t,e)=>{try{return new tor(t,e).range||"*"}catch{return null}};E2e.exports=ror});var KK=v((Cjn,R2e)=>{var nor=Id(),M2e=w2(),{ANY:oor}=M2e,ior=Sh(),aor=x2(),A2e=v2(),I2e=UK(),sor=HK(),uor=zK(),lor=(t,e,r,n)=>{t=new nor(t,n),e=new ior(e,n);let o,i,a,s,u;switch(r){case">":o=A2e,i=sor,a=I2e,s=">",u=">=";break;case"<":o=I2e,i=uor,a=A2e,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(aor(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===oor&&(p=new M2e(">=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};R2e.exports=lor});var N2e=v((Ojn,j2e)=>{var cor=KK(),dor=(t,e,r)=>cor(t,e,">",r);j2e.exports=dor});var L2e=v((Pjn,D2e)=>{var por=KK(),mor=(t,e,r)=>por(t,e,"<",r);D2e.exports=mor});var $2e=v((Ejn,k2e)=>{var F2e=Sh(),hor=(t,e,r)=>(t=new F2e(t,r),e=new F2e(e,r),t.intersects(e,r));k2e.exports=hor});var q2e=v((Tjn,B2e)=>{var gor=x2(),yor=wh();B2e.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>yor(c,d,r));for(let c of a)gor(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 K2e=v((Ajn,W2e)=>{var U2e=Sh(),jpe=w2(),{ANY:Rpe}=jpe,C2=x2(),Npe=wh(),bor=(t,e,r={})=>{if(t===e)return!0;t=new U2e(t,r),e=new U2e(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=vor(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},_or=[new jpe(">=0.0.0-0")],z2e=[new jpe(">=0.0.0")],vor=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Rpe){if(e.length===1&&e[0].semver===Rpe)return!0;r.includePrerelease?t=_or:t=z2e}if(e.length===1&&e[0].semver===Rpe){if(r.includePrerelease)return!0;e=z2e}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=H2e(o,p,r):p.operator==="<"||p.operator==="<="?i=V2e(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Npe(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&&!C2(p,String(o),r)||i&&!C2(p,String(i),r))return null;for(let m of e)if(!C2(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=H2e(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!C2(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=V2e(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!C2(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)},H2e=(t,e,r)=>{if(!t)return e;let n=Npe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},V2e=(t,e,r)=>{if(!t)return e;let n=Npe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};W2e.exports=bor});var Z2e=v((Ijn,Y2e)=>{var Dpe=qL(),G2e=b2(),wor=Id(),J2e=vpe(),Sor=pR(),xor=wze(),Cor=xze(),Oor=Pze(),Por=Aze(),Eor=Mze(),Tor=jze(),Aor=Dze(),Ior=Fze(),Mor=wh(),Ror=qze(),jor=zze(),Nor=qK(),Dor=Kze(),Lor=Jze(),For=v2(),kor=UK(),$or=Spe(),Bor=xpe(),qor=zK(),Uor=HK(),zor=Cpe(),Hor=o2e(),Vor=w2(),Wor=Sh(),Kor=x2(),Gor=_2e(),Jor=w2e(),Yor=x2e(),Zor=P2e(),Xor=T2e(),Qor=KK(),eir=N2e(),tir=L2e(),rir=$2e(),nir=q2e(),oir=K2e();Y2e.exports={parse:Sor,valid:xor,clean:Cor,inc:Oor,diff:Por,major:Eor,minor:Tor,patch:Aor,prerelease:Ior,compare:Mor,rcompare:Ror,compareLoose:jor,compareBuild:Nor,sort:Dor,rsort:Lor,gt:For,lt:kor,eq:$or,neq:Bor,gte:qor,lte:Uor,cmp:zor,coerce:Hor,Comparator:Vor,Range:Wor,satisfies:Kor,toComparators:Gor,maxSatisfying:Jor,minSatisfying:Yor,minVersion:Zor,validRange:Xor,outside:Qor,gtr:eir,ltr:tir,intersects:rir,simplifyRange:nir,subset:oir,SemVer:wor,re:Dpe.re,src:Dpe.src,tokens:Dpe.t,SEMVER_SPEC_VERSION:G2e.SEMVER_SPEC_VERSION,RELEASE_TYPES:G2e.RELEASE_TYPES,compareIdentifiers:J2e.compareIdentifiers,rcompareIdentifiers:J2e.rcompareIdentifiers}});function xC(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 iir,X2e=w(()=>{iir=F(Z2e(),1)});async function sn(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}`;throw t.status===409?new Lpe(o):new Error(o)}var Lpe,Q2e=w(()=>{Lpe=class extends Error{constructor(e){super(e),this.name="LangSmithConflictError"}}});function uir(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function GK(t){return sir.encode(t)}function hp(t,e,r,n){try{let o=JSON.stringify(t,e,r);return GK(o)}catch(o){if(!o.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."),GK("[Unserializable]");console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance."),typeof n>"u"&&(n=uir()),kpe(t,"",0,[],void 0,0,n);let i;try{zL.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,lir(e),r)}catch{return GK("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;JK.length!==0;){let a=JK.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return GK(i)}}function Fpe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),JK.push([n,r,e,o])):zL.push([e,r,t]):(n[r]=t,JK.push([n,r,e]))}function kpe(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){Fpe(air,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Fpe(e4e,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Fpe(e4e,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)kpe(t[s],s,s,n,t,i,a);else{var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];kpe(t[l],l,s,n,t,i,a)}}n.pop()}}function lir(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(zL.length>0)for(var n=0;n<zL.length;n++){var o=zL[n];if(o[1]===e&&o[0]===r){r=o[2],zL.splice(n,1);break}}return t.call(this,e,r)}}var e4e,air,JK,zL,sir,t4e=w(()=>{e4e="[...]",air={result:"[Circular]"},JK=[],zL=[],sir=new TextEncoder});function r4e(t){let e=XK(),r=i4e(),n=t.extra??{},o=n.metadata;return t.extra={...n,runtime:{...e,...n?.runtime},metadata:{...r,...r.revision_id||t.revision_id?{revision_id:t.revision_id??r.revision_id}:{},...o}},t}async function fir(t){let e=[];for await(let r of t)e.push(r);return e}function $pe(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function n4e(t){return typeof t=="number"?Number(t.toFixed(4)):t}function o4e(t){return"dataset_id"in t||"dataset_name"in t}var cir,dir,pir,Bpe,mir,hir,mR,qpe=w(()=>{TE();nze();oze();g2();ZK();ize();ype();X2e();Q2e();DK();t4e();cir=t=>{let e=t?.toString()??pp("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},dir=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};pir=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};Bpe=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=hp(e.item).length;return this.items.push({action:e.action,payload:e.item,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})),()=>r.forEach(o=>o.itemPromiseResolve())]}},mir=20971520,hir=2500,mR=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 Bpe}),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:Ub("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,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Ub("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=cir(e.tracingSamplingRate),this.apiUrl=$pe(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=$pe(e.apiKey??r.apiKey),this.webUrl=$pe(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.timeout_ms=e.timeout_ms??9e4,this.caller=new y2({...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 y2({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:pir,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}static getDefaultClientConfig(){let e=pp("API_KEY"),r=pp("ENDPOINT")??"https://api.smith.langchain.com",n=pp("HIDE_INPUTS")==="true",o=pp("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:dir(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/${YK}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),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 sn(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 sn(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.id)?this.filteredPostUuids.delete(o.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??mir}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=this._processBatch(n,o).catch(console.error);r.push(i)}return Promise.all(r)}async _processBatch(e,r){if(!e.length){r();return}try{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):await this.batchIngestRuns(n)}finally{r()}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.action==="create"&&(e.item=r4e(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 Vt(this.debug)(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(hir),...this.fetchOptions});await sn(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{console.warn("[WARNING]: LangSmith failed to fetch info on supported operations. 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)}async createRun(e){if(!this._filterForSampling([e]).length)return;let r={...this.headers,"Content-Type":"application/json"},n=e.project_name;delete e.project_name;let o=await this.prepareRunCreateOrUpdateInputs({session_name:n,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){this.processRunOperation({action:"create",item:o}).catch(console.error);return}let i=r4e(o),a=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs`,{method:"POST",headers:r,body:hp(i),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(a,"create run",!0)}async batchIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n=await Promise.all(e?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]),o=await Promise.all(r?.map(s=>this.prepareRunCreateOrUpdateInputs(s))??[]);if(n.length>0&&o.length>0){let s=n.reduce((l,c)=>(c.id&&(l[c.id]=c),l),{}),u=[];for(let l of o)l.id!==void 0&&s[l.id]?s[l.id]={...s[l.id],...l}:u.push(l);n=Object.values(s),o=u}let i={post:n,patch:o};if(!i.post.length&&!i.patch.length)return;let a={post:[],patch:[]};for(let s of["post","patch"]){let u=s,l=i[u].reverse(),c=l.pop();for(;c!==void 0;)a[u].push(c),c=l.pop()}(a.post.length>0||a.patch.length>0)&&await this._postBatchIngestRuns(hp(a))}async _postBatchIngestRuns(e){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"},n=await this.batchIngestCaller.call(Vt(this.debug),`${this.apiUrl}/runs/batch`,{method:"POST",headers:r,body:e,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"batch create run",!0)}async multipartIngestRuns({runCreates:e,runUpdates:r}){if(e===void 0&&r===void 0)return;let n={},o=[];for(let c of e??[]){let d=await this.prepareRunCreateOrUpdateInputs(c);d.id!==void 0&&d.attachments!==void 0&&(n[d.id]=d.attachments),delete d.attachments,o.push(d)}let i=[];for(let c of r??[])i.push(await this.prepareRunCreateOrUpdateInputs(c));if(o.find(c=>c.trace_id===void 0||c.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(i.find(c=>c.trace_id===void 0||c.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(o.length>0&&i.length>0){let c=o.reduce((f,p)=>(p.id&&(f[p.id]=p),f),{}),d=[];for(let f of i)f.id!==void 0&&c[f.id]?c[f.id]={...c[f.id],...f}:d.push(f);o=Object.values(c),i=d}if(o.length===0&&i.length===0)return;let u=[],l=[];for(let[c,d]of[["post",o],["patch",i]])for(let f of d){let{inputs:p,outputs:m,events:h,attachments:b,...g}=f,y={inputs:p,outputs:m,events:h},S=hp(g);l.push({name:`${c}.${g.id}`,payload:new Blob([S],{type:`application/json; length=${S.length}`})});for(let[x,O]of Object.entries(y)){if(O===void 0)continue;let P=hp(O);l.push({name:`${c}.${g.id}.${x}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})})}if(g.id!==void 0){let x=n[g.id];if(x){delete n[g.id];for(let[O,P]of Object.entries(x)){let E,A;if(Array.isArray(P)?[E,A]=P:(E=P.mimeType,A=P.data),O.includes(".")){console.warn(`Skipping attachment '${O}' for run ${g.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}l.push({name:`attachment.${g.id}.${O}`,payload:new Blob([A],{type:`${E}; length=${A.byteLength}`})})}}}u.push(`trace=${g.trace_id},id=${g.id}`)}await this._sendMultipartRequest(l,u.join("; "))}async _sendMultipartRequest(e,r){try{let n="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),o=[];for(let u of e)o.push(new Blob([`--${n}\r
`])),o.push(new Blob([`Content-Disposition: form-data; name="${u.name}"\r
`,`Content-Type: ${u.payload.type}\r
\r
`])),o.push(u.payload),o.push(new Blob([`\r
`]));o.push(new Blob([`--${n}--\r
`]));let a=await new Blob(o).arrayBuffer(),s=await this.batchIngestCaller.call(Vt(this.debug),`${this.apiUrl}/runs/multipart`,{method:"POST",headers:{...this.headers,"Content-Type":`multipart/form-data; boundary=${n}`},body:a,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(s,"ingest multipart runs",!0)}catch(n){console.warn(`${n.message.trim()}
Context: ${r}`)}}async updateRun(e,r){Kr(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let n={...r,id:e};if(!this._filterForSampling([n],!0).length)return;if(this.autoBatchTracing&&n.trace_id!==void 0&&n.dotted_order!==void 0){if(r.end_time!==void 0&&n.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:n}).catch(console.error);return}else this.processRunOperation({action:"update",item:n}).catch(console.error);return}let o={...this.headers,"Content-Type":"application/json"},i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/${e}`,{method:"PATCH",headers:o,body:hp(r),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update run",!0)}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Kr(e);let n=await this._get(`/runs/${e}`);return r&&n.child_run_ids&&(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:pp("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 fir(this.listRuns({id:e.child_run_ids})),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.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}=e,S=[];if(r&&(S=Array.isArray(r)?r:[r]),n){let E=Array.isArray(n)?n:[n],A=await Promise.all(E.map(I=>this.readProject({projectName:I}).then(R=>R.id)));S.push(...A)}let x=["app_path","child_run_ids","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"],O={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||x,is_root:l},P=0;for await(let E of this._getCursorPaginatedList("/runs/query",O))if(g){if(P>=g)break;if(E.length+P>g){yield*E.slice(0,g-P);break}P+=E.length,yield*E}else yield*E}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(P=>this.readProject({projectName:P}).then(E=>E.id)))]);let S=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(([P,E])=>E!==void 0));return await(await this.caller.call(Vt(this.debug),`${this.apiUrl}/runs/stats`,{method:"POST",headers:this.headers,body:JSON.stringify(S),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||as()};Kr(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){Kr(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 sn(r,"unshare run",!0)}async readRunSharedLink(e){Kr(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 Kr(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),Kr(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};Kr(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){Kr(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 sn(r,"unshare dataset",!0)}async readSharedDataset(e){return Kr(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: ${a.detail.join(`
`)}`):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 sn(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 sn(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)Kr(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)Kr(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,Kr(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 sn(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 sn(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 sn(u,"create dataset"),await u.json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)Kr(e),n+=`/${e}`;else if(r!==void 0)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;Kr(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 sn(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;Kr(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 sn(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)Kr(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 sn(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),Kr(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 sn(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),Kr(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 sn(a,"fetch similar examples"),(await a.json()).examples}async createExample(e,r,n){if(o4e(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;o4e(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]??as())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let y=e,S=y[0].dataset_id,x=y[0].dataset_name;if(S===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(S!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");S===void 0&&(S=(await this.readDataset({datasetName:x})).id);let O=await this._uploadExamplesMultipart(S,y);return await Promise.all(O.example_ids.map(E=>this.readExample(E)))}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,S)=>({dataset_id:p,inputs:y,outputs:n?.[S],metadata:o?.[S],split:i?.[S],id:c?.[S],attachments:l?.[S],source_run_id:a?.[S],use_source_run_io:s?.[S],use_source_run_attachments:u?.[S]})),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=>hpe(a)?gpe(a):a),i=hpe(r)?gpe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Kr(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:S,...x}=y,O=x;S&&(O.attachments=Object.entries(S).reduce((P,[E,A])=>(P[E.slice(11)]={presigned_url:A.presigned_url,mime_type:A.mime_type||void 0},P),{})),yield O,b++}if(u!==void 0&&b>=u)break}}async deleteExample(e){Kr(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 sn(n,`delete ${r}`),await n.json()}async updateExample(e,r){let n;r?n=e:n=e.id,Kr(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,Kr(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 sn(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,Kr(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,Kr(a);let s={split_name:n,examples:o.map(l=>(Kr(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 sn(u,"update dataset splits",!0)}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){FK("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&&Kr(m.metadata.__run.run_id);let h={id:c??as(),run_id:e,key:r,score:n4e(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 sn(g,"create feedback",!0),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=n4e(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Kr(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 sn(s,"update feedback",!0)}async readFeedback(e){Kr(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Kr(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 sn(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){Kr(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)=>{Kr(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}=e,i={name:r,description:n,id:o||as()},a=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(i).filter(([u,l])=>l!==void 0))),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(a,"create annotation queue"),await a.json()}async readAnnotationQueue(e){let r=await this.listAnnotationQueues({queueIds:[e]}).next();if(r.done)throw new Error(`Annotation queue with ID ${e} not found`);return r.value}async updateAnnotationQueue(e,r){let{name:n,description:o}=r,i=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({name:n,description:o}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(i,"update annotation queue")}async deleteAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(r,"delete annotation queue")}async addRunsToAnnotationQueue(e,r){let n=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify(r.map((o,i)=>Kr(o,`runIds[${i}]`).toString())),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"add runs to annotation queue")}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Kr(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 sn(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/${Kr(e,"queueId")}/runs/${Kr(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});await sn(n,"delete run from annotation queue")}async getSizeFromAnnotationQueue(e){let r=await this.caller.call(Vt(this.debug),`${this.apiUrl}/annotation-queues/${Kr(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await sn(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]=xC(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 sn(a,`${r?"like":"unlike"} prompt`),await a.json()}async _getPromptUrl(e){let[r,n,o]=xC(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]=xC(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 sn(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]=xC(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 sn(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]=xC(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 sn(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=hp(l),d=new Blob([c],{type:"application/json"});if(n.append(u,d),s.inputs){let f=hp(s.inputs),p=new Blob([f],{type:"application/json"});n.append(`${u}.inputs`,p)}if(s.outputs){let f=hp(s.outputs),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=hp(s.attachments_operations),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}/v1/platform/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??as()).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=hp(u),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=hp(a.inputs),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=hp(a.outputs),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}/v1/platform/datasets/${e}/examples`,{method:"POST",headers:this.headers,body:n});return await sn(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]=xC(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 sn(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]=xC(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]=xC(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 sn(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 Kr(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}`)}}awaitPendingTraceBatches(){return this.manualFlushMode?(console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve()):Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()])}}});var YK,ZK=w(()=>{qpe();QK();DK();YK="0.3.20"});function XK(){if(Upe===void 0){let t=vir(),e=Sir();Upe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:YK,...e}}return Upe}function i4e(){let t=wir()||{},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 wir(){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 Ub(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function pp(t){return Ub(`LANGSMITH_${t}`)||Ub(`LANGCHAIN_${t}`)}function Sir(){if(zpe!==void 0)return zpe;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=Ub(r);n!==void 0&&(e[r]=n)}return zpe=e,e}var OC,gir,yir,bir,a4e,_ir,vir,Upe,zpe,g2=w(()=>{ZK();gir=()=>typeof window<"u"&&typeof window.document<"u",yir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",bir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a4e=()=>typeof Deno<"u",_ir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!a4e(),vir=()=>OC||(gir()?OC="browser":_ir()?OC="node":yir()?OC="webworker":bir()?OC="jsdom":a4e()?OC="deno":OC="other",OC)});var s4e,u4e=w(()=>{g2();s4e=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>pp(r)==="true")});var eG,l4e=w(()=>{eG=Symbol.for("lc:context_variables")});function xir(t){return t.replace(/[-:.]/g,"")}function Cir(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return xir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function rG(t){return t!==void 0&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function d4e(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function c4e(t){return Array.isArray(t)&&t.some(e=>d4e(e))}function Oir(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function Pir(t){return t!==void 0&&typeof t.callbacks=="object"&&(c4e(t.callbacks?.handlers)||c4e(t.callbacks))}var tG,CC,QK=w(()=>{TE();g2();qpe();u4e();ype();l4e();tG=class t{constructor(e,r,n){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}),this.metadata=e,this.tags=r,this.project_name=n}static fromHeader(e){let r=e.split(","),n={},o=[],i;for(let a of r){let[s,u]=a.split("="),l=decodeURIComponent(u);s==="langsmith-metadata"?n=JSON.parse(l):s==="langsmith-tags"?o=l.split(","):s==="langsmith-project"&&(i=l)}return new t(n,o,i)}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(",")}},CC=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,"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}),rG(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.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let s=Cir(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}static getDefaultConfig(){return{id:as(),run_type:"chain",project_name:pp("PROJECT")??Ub("LANGCHAIN_SESSION")??"default",child_runs:[],api_url:Ub("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Ub("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new mR),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});eG in this&&(n[eG]=this[eG]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(Pir(i)){let u={...i},l=Oir(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(d4e)?.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||(o.runtime={}),r)for(let[u,l]of Object.entries(r))o.runtime[u]||(o.runtime[u]=l);let i,a;return n?(a=e.parent_run?.id,i=[]):(i=e.child_runs.map(u=>this._convertToCreate(u,r,n)),a=void 0),{id:e.id,name:e.name,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}}async postRun(e=!0){try{let r=XK(),n=await this._convertToCreate(this,r,!0);if(await this.client.createRun(n),!e){FK("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let o of this.child_runs)await o.postRun(!1)}}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(){try{let e={end_time:this.end_time,error:this.error,inputs:this.inputs,outputs:this.outputs,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=s4e();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=tG.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new tG(this.extra?.metadata,this.tags,this.project_name).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(CC,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});function nG(t){return typeof t=="function"&&"langsmith:traceable"in t}var Vpe,Hpe,Eir,Wpe,Tir,f4e,uNn,p4e=w(()=>{QK();Vpe=class{getStore(){}run(e,r){return r()}},Hpe=Symbol.for("ls:tracing_async_local_storage"),Eir=new Vpe,Wpe=class{getInstance(){return globalThis[Hpe]??Eir}initializeGlobalInstance(e){globalThis[Hpe]===void 0&&(globalThis[Hpe]=e)}},Tir=new Wpe,f4e=()=>{let t=Tir.getInstance().getStore();if(!rG(t))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."].join(`
`));return t},uNn=Symbol.for("langsmith:traceable:root")});var Kpe=w(()=>{p4e()});function iG(t,e){return Air.call(t,e)}function aG(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)iG(t,r)&&e.push(r);return e}function Md(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function sG(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 zb(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function O2(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function oG(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(oG(t[r]))return!0}else if(typeof t=="object"){let r=aG(t),n=r.length;for(var e=0;e<n;e++)if(oG(t[r[e]]))return!0}}return!1}function m4e(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 Air,hR,P2=w(()=>{Air=Object.prototype.hasOwnProperty;hR=class extends Error{constructor(e,r,n,o,i){super(m4e(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=m4e(e,{name:r,index:n,operation:o,tree:i})}}});var Gpe={};Cf(Gpe,{JsonPatchError:()=>ss,_areEquals:()=>E2,applyOperation:()=>gR,applyPatch:()=>AE,applyReducer:()=>Rir,deepClone:()=>Iir,getValueByPointer:()=>uG,validate:()=>h4e,validator:()=>lG});function uG(t,e){if(e=="")return t;var r={op:"_get",path:e};return gR(t,r),r.value}function gR(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):lG(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=uG(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=E2(t,e.value),a.test===!1)throw new ss("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 ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Md(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=lG;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=O2(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&&!sG(f))throw new ss("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);sG(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new ss("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=Mir[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=HL[e.op].call(e,u,f,t);if(m.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new ss("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function AE(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new ss("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Md(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=gR(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function Rir(t,e,r){let n=gR(t,e);if(n.test===!1)throw new ss("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function lG(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new ss("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(HL[t.op]){if(typeof t.path!="string")throw new ss("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new ss('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 ss("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 ss("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")&&oG(t.value))throw new ss("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 ss("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 ss("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=h4e([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new ss("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new ss("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function h4e(t,e,r){try{if(!Array.isArray(t))throw new ss("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)AE(Md(e),Md(t),r||!0);else{r=r||lG;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof ss)return o;throw o}}function E2(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(!E2(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],!E2(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var ss,Iir,HL,Mir,cG=w(()=>{P2();ss=hR,Iir=Md,HL={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=uG(r,this.path);n&&(n=Md(n));let o=gR(r,{op:"remove",path:this.from}).removed;return gR(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=uG(r,this.from);return gR(r,{op:"add",path:this.path,value:Md(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:E2(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Mir={add:function(t,e,r){return sG(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:HL.move,copy:HL.copy,test:HL.test,_get:HL._get}});function g4e(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=aG(e),a=aG(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(iG(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)?g4e(d,f,r,n+"/"+zb(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"replace",path:n+"/"+zb(c),value:Md(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+zb(c),value:Md(d)}),r.push({op:"remove",path:n+"/"+zb(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];!iG(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+zb(c),value:Md(e[c])})}}}function dG(t,e,r=!1){var n=[];return g4e(t,e,n,"",r),n}var y4e=w(()=>{P2();cG();});var bNn,Jpe=w(()=>{cG();y4e();P2();cG();P2();bNn={...Gpe,JsonPatchError:hR,deepClone:Md,escapePathComponent:zb,unescapePathComponent:O2}});var _4e=v((xNn,b4e)=>{"use strict";b4e.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 P4e=v((CNn,Ype)=>{"use strict";var jir=/[\p{Lu}]/u,Nir=/[\p{Ll}]/u,v4e=/^[\p{Lu}](?![\p{Lu}])/gu,x4e=/([\p{Alpha}\p{N}_]|$)/u,C4e=/[_.\- ]+/,Dir=new RegExp("^"+C4e.source),w4e=new RegExp(C4e.source+x4e.source,"gu"),S4e=new RegExp("\\d+"+x4e.source,"gu"),Lir=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&jir.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&Nir.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},Fir=(t,e)=>(v4e.lastIndex=0,t.replace(v4e,r=>e(r))),kir=(t,e)=>(w4e.lastIndex=0,S4e.lastIndex=0,t.replace(w4e,(r,n)=>e(n)).replace(S4e,r=>e(r))),O4e=(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=Lir(t,r,n)),t=t.replace(Dir,""),e.preserveConsecutiveUppercase?t=Fir(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),kir(t,n))};Ype.exports=O4e;Ype.exports.default=O4e});function T4e(t,e){return e?.[t]||(0,E4e.default)(t)}function A4e(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var E4e,$ir,I4e=w(()=>{E4e=F(_4e(),1),$ir=F(P4e(),1)});function M4e(t){return Array.isArray(t)?[...t]:{...t}}function Bir(t,e){let r=M4e(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]=M4e(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Zpe(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 gp,yR=w(()=>{I4e();gp=class t{static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Zpe(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:A4e(Object.keys(r).length?Bir(n,r):n,T4e,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});async function R4e(){return Xpe===void 0&&(Xpe={library:"langchain-js",runtime:fG()}),Xpe}function ot(t){try{return typeof process<"u"?process.env?.[t]:Qpe()?Deno?.env.get(t):void 0}catch{return}}var qir,Uir,zir,Qpe,Hir,fG,Xpe,bR=w(()=>{qir=()=>typeof window<"u"&&typeof window.document<"u",Uir=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",zir=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),Qpe=()=>typeof Deno<"u",Hir=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Qpe(),fG=()=>{let t;return qir()?t="browser":Hir()?t="node":Uir()?t="webworker":zir()?t="jsdom":Qpe()?t="deno":t="other",t}});function tme(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var eme,_R,j4e,T2=w(()=>{TE();yR();bR();eme=class{};_R=class t extends eme{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,Zpe(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:ot("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 gp.prototype.toJSON.call(this)}toJSONNotImplemented(){return gp.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends t{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:as()}),Object.assign(this,e)}}return new r}},j4e=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});function rme(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function Vir(t){return t.replace(/[-:.]/g,"")}function Wir(t,e,r){let n=r.toFixed(0).slice(0,3).padStart(3,"0");return Vir(`${new Date(t).toISOString().slice(0,-1)}${n}Z`)+e}function VL(t){return typeof t._addRunToRunMap=="function"}var xh,vR=w(()=>{T2();xh=class extends _R{constructor(e){super(...arguments),Object.defineProperty(this,"runMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}copy(){return this}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 r=Wir(e.start_time,e.id,e.execution_order),n={...e};if(n.parent_run_id!==void 0){let o=this.runMap.get(n.parent_run_id);o&&(this._addChildRun(o,n),o.child_execution_order=Math.max(o.child_execution_order,n.child_execution_order),n.trace_id=o.trace_id,o.dotted_order!==void 0&&(n.dotted_order=[o.dotted_order,r].join(".")))}else n.trace_id=n.id,n.dotted_order=r;return this.runMap.set(n.id,n),n}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.runMap.get(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),this.runMap.delete(e.id),await this.onRunUpdate?.(e)}_getExecutionOrder(e){let r=e!==void 0&&this.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=rme(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=rme(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.runMap.get(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=rme(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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.runMap.get(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 F4e=v((NNn,L4e)=>{"use strict";var N4e=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,D4e=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function Kir(){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=N4e(),e.color.ansi16m=D4e(),e.bgColor.ansi256=N4e(10),e.bgColor.ansi16m=D4e(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(L4e,"exports",{enumerable:!0,get:Kir})});function Af(t,e){return`${t.open}${e}${t.close}`}function Ch(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function k4e(t){return typeof t=="string"?t.trim():t==null?t:Ch(t,t.toString())}function IE(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 nme,yp,A2,$4e=w(()=>{nme=F(F4e(),1);vR();({color:yp}=nme.default),A2=class extends xh{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?Af(nme.default.bold,s):s}).join(" > ");return Af(yp.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Ch(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[chain/end]")} [${r}] [${IE(e)}] Exiting Chain run with output: ${Ch(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[chain/error]")} [${r}] [${IE(e)}] Chain run errored with error: ${Ch(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(`${Af(yp.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Ch(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[llm/end]")} [${r}] [${IE(e)}] Exiting LLM run with output: ${Ch(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[llm/error]")} [${r}] [${IE(e)}] LLM run errored with error: ${Ch(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[tool/start]")} [${r}] Entering Tool run with input: "${k4e(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[tool/end]")} [${r}] [${IE(e)}] Exiting Tool run with output: "${k4e(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[tool/error]")} [${r}] [${IE(e)}] Tool run errored with error: ${Ch(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Ch(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.cyan,"[retriever/end]")} [${r}] [${IE(e)}] Exiting Retriever run with output: ${Ch(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Af(yp.red,"[retriever/error]")} [${r}] [${IE(e)}] Retriever run errored with error: ${Ch(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Af(yp.blue,"[agent/action]")} [${n}] Agent selected action: ${Ch(r.actions[r.actions.length-1],"[action]")}`)}}});function ME(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var I2=w(()=>{});function RE(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function B4e(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 wR,pG=w(()=>{wR=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 ome(t,e=WL){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 WL(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 ime=w(()=>{});function jE(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 q4e(t){return jE(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function U4e(t){return jE(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function z4e(t){if(jE(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 ame({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 H4e(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 sme=w(()=>{});function Oh(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>jE(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?M2(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>jE(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function V4e(t,e){return t==="error"||e==="error"?"error":"success"}function Gir(t,e){function r(n,o){if(typeof n!="object"||n===null||n===void 0)return n;if(o>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(a=>r(a,o+1));let i={};for(let a of Object.keys(n))i[a]=r(n[a],o+1);return i}return JSON.stringify(r(t,0),null,2)}function xs(t,e){let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=xs(r[n],o);else if(Array.isArray(r[n]))r[n]=M2(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 M2(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>i.index===n.index);o!==-1?r[o]=xs(r[o],n):r.push(n)}else{if(typeof n=="object"&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function W4e(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 M2(t,e);if(typeof t=="object"&&typeof e=="object")return xs(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
Left ${t}
Right ${e}`)}function K4e(t){return typeof t.role=="string"}function Ph(t){return typeof t?._getType=="function"}function ume(t){return Ph(t)&&typeof t.concat=="function"}var Sl,bp,Eh=w(()=>{yR();sme();Sl=class extends gp{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=Gir(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};bp=class extends Sl{}});function G4e(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function J4e(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 PC,Th,KL=w(()=>{Eh();PC=class extends Sl{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,"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}_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}}},Th=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),artifact:W4e(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:V4e(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function Oi(t){return t._getType()==="ai"}function lme(t){return t._getType()==="ai"}var gn,dr,SR=w(()=>{ime();Eh();KL();gn=class extends Sl{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]=J4e(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}}};dr=class t extends bp{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=[],o=[];for(let i of e.tool_call_chunks){let a={};try{if(a=WL(i.args||"{}"),a===null||typeof a!="object"||Array.isArray(a))throw new Error("Malformed tool call chunk args.");n.push({name:i.name??"",args:a,id:i.id,type:"tool_call"})}catch{o.push({name:i.name,args:i.args,id:i.id,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:n,invalid_tool_calls:o,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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),tool_call_chunks:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let n=M2(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 Cs,If,mG=w(()=>{Eh();Cs=class t extends Sl{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}}},If=class t extends bp{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:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}get _printableFields(){return{...super._printableFields,role:this.role}}}});var ym,hG=w(()=>{Eh();ym=class t extends bp{static lc_name(){return"FunctionMessageChunk"}_getType(){return"function"}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Os,Mf,R2=w(()=>{Eh();Os=class extends Sl{static lc_name(){return"HumanMessage"}_getType(){return"human"}constructor(e,r){super(e,r)}},Mf=class t extends bp{static lc_name(){return"HumanMessageChunk"}_getType(){return"human"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});var EC,Rd,gG=w(()=>{Eh();EC=class extends Sl{static lc_name(){return"SystemMessage"}_getType(){return"system"}constructor(e,r){super(e,r)}},Rd=class t extends bp{static lc_name(){return"SystemMessageChunk"}_getType(){return"system"}constructor(e,r){super(e,r)}concat(e){return new t({content:Oh(this.content,e.content),additional_kwargs:xs(this.additional_kwargs,e.additional_kwargs),response_metadata:xs(this.response_metadata,e.response_metadata),id:this.id??e.id})}}});function Yir(t){return RE(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 Zir(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function cme(t){let e,r;if(Zir(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 Os(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new gn(r);let i=n.map(Yir);return new gn({...o,tool_calls:i})}else{if(e==="system")return new EC(r);if(e==="developer")return new EC({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new PC({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});throw ME(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 fy(t){if(typeof t=="string")return new Os(t);if(Ph(t))return t;if(Array.isArray(t)){let[e,r]=t;return cme({type:e,content:r})}else if(K4e(t)){let{role:e,...r}=t;return cme({...r,type:e})}else return cme(t)}function Rf(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 dme(t){let e=t._getType();if(e==="human")return new Mf({...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 dr({...r})}else{if(e==="system")return new Rd({...t});if(e==="function")return new ym({...t});if(Cs.isInstance(t))return new If({...t});throw new Error("Unknown message type.")}}var NE=w(()=>{I2();pG();SR();Eh();mG();hG();R2();gG();KL()});var fme=w(()=>{QK()});var pme=w(()=>{ZK()});var mme,Y4e,Z4e=w(()=>{pme();bR();Y4e=()=>{if(mme===void 0){let t=ot("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};mme=new mR(t)}return mme}});var GL,X4e=w(()=>{fme();Kpe();bR();vR();Z4e();GL=class t extends xh{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});let{exampleId:r,projectName:n,client:o}=e;this.projectName=n??ot("LANGCHAIN_PROJECT")??ot("LANGCHAIN_SESSION"),this.exampleId=r,this.client=o??Y4e();let i=t.getTraceableRunTree();i&&this.updateFromRunTree(i)}async _convertToCreate(e,r=void 0){return{...e,extra:{...e.extra,runtime:await R4e()},child_runs:void 0,session_name:this.projectName,reference_example_id:e.parent_run_id?void 0:r}}async persistRun(e){}async onRunCreate(e){let r=await this._convertToCreate(e,this.exampleId);await this.client.createRun(r)}async onRunUpdate(e){let r={end_time:e.end_time,error:e.error,outputs:e.outputs,events:e.events,inputs:e.inputs,trace_id:e.trace_id,dotted_order:e.dotted_order,parent_run_id:e.parent_run_id,extra:e.extra,session_name:this.projectName};await this.client.updateRun(e.id,r)}getRun(e){return this.runMap.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.runMap.set(i.id,i),i.child_runs&&o.push(...i.child_runs))}this.client=e.client??this.client,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId}convertToRunTree(e){let r={},n=[];for(let[o,i]of this.runMap){let a=new CC({...i,child_runs:[],parent_run:void 0,client:this.client,project_name:this.projectName,reference_example_id:this.exampleId,tracingEnabled:!0});r[o]=a,n.push([o,i.dotted_order])}n.sort((o,i)=>!o[1]||!i[1]?0:o[1].localeCompare(i[1]));for(let[o]of n){let i=this.runMap.get(o),a=r[o];if(!(!i||!a)&&i.parent_run_id){let s=r[i.parent_run_id];s&&(s.child_runs.push(a),a.parent_run=s)}}return r[e]}static getTraceableRunTree(){try{return f4e()}catch{return}}}});var Q4e,xR,e3e,DE,j2=w(()=>{Q4e=Symbol.for("ls:tracing_async_local_storage"),xR=Symbol.for("lc:context_variables"),e3e=t=>{globalThis[Q4e]=t},DE=()=>globalThis[Q4e]});function Xir(){let t="default"in yG.default?yG.default.default:yG.default;return new t({autoStart:!0,concurrency:1})}function Qir(){return typeof N2>"u"&&(N2=Xir()),N2}async function Ps(t,e){if(e===!0){let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()}else N2=Qir(),N2.add(async()=>{let r=DE();r!==void 0?await r.run(void 0,async()=>t()):await t()})}var yG,N2,t3e=w(()=>{yG=F(NK(),1);j2()});var r3e=w(()=>{t3e()});var n3e,o3e=w(()=>{bR();n3e=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>ot(r)==="true")});function hme(t){let e=DE();return e===void 0?void 0:e.getStore()?.[xR]?.[t]}var ear,i3e,a3e=w(()=>{fme();j2();ear=Symbol("lc:configure_hooks"),i3e=()=>hme(ear)||[]});function CR(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function D2(t){return"name"in t?t:_R.fromMethods(t)}var gme,JL,yme,bG,bme,_me,Bs,LE=w(()=>{TE();T2();$4e();NE();bR();X4e();r3e();o3e();vR();a3e();gme=class{setHandler(e){return this.setHandlers([e])}},JL=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=>Ps(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=>Ps(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)))}},yme=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},bG=class extends JL{async handleLLMNewToken(e,r,n,o,i,a){await Promise.all(this.handlers.map(s=>Ps(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=>Ps(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=>Ps(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)))}},bme=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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=>Ps(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=>Ps(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)))}},_me=class extends JL{getChild(e){let r=new Bs(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=>Ps(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=>Ps(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)))}},Bs=class t extends gme{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:as();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return VL(f)&&f._createRunForLLMStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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 bG(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:as();return await Promise.all(this.handlers.map(f=>{if(!f.ignoreLLM)return VL(f)&&f._createRunForChatModelStart(e,[l],d,this._parentRunId,i,this.tags,this.metadata,u),Ps(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=Rf(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 bG(d,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,r,n=as(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreChain)return VL(u)&&u._createRunForChainStart(e,r,n,this._parentRunId,this.tags,this.metadata,o,s),Ps(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 bme(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,r,n=as(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return VL(u)&&u._createRunForToolStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 _me(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,r,n=as(),o=void 0,i=void 0,a=void 0,s=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreRetriever)return VL(u)&&u._createRunForRetrieverStart(e,r,n,this._parentRunId,this.tags,this.metadata,s),Ps(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 yme(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=>Ps(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 _R{constructor(){super(),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:as()}),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(D2)??[],!0)):u=e,u=u.copy(Array.isArray(r)?r.map(D2):r?.handlers,!1));let l=ot("LANGCHAIN_VERBOSE")==="true"||s?.verbose,c=GL.getTraceableRunTree()?.tracingEnabled||n3e(),d=c||(ot("LANGCHAIN_TRACING")??!1);if(l||d){if(u||(u=new t),l&&!u.handlers.some(f=>f.name===A2.prototype.name)){let f=new A2;u.addHandler(f,!0)}if(d&&!u.handlers.some(f=>f.name==="langchain_tracer")&&c){let f=new GL;u.addHandler(f,!0),u._parentRunId=GL.getTraceableRunTree()?.id??u._parentRunId}}for(let{contextVar:f,inheritable:p=!0,handlerClass:m,envVar:h}of i3e()){let b=h&&ot(h)==="true"&&m,g,y=f!==void 0?hme(f):void 0;y&&j4e(y)?g=y:b&&(g=new m({})),g!==void 0&&(u||(u=new t),u.handlers.some(S=>S.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 _G,tar,s3e,vme,jd,u3e=w(()=>{pme();j2();LE();_G=class{getStore(){}run(e,r){return r()}enterWith(e){}},tar=new _G,s3e=Symbol.for("lc:child_config"),vme=class{getInstance(){return DE()??tar}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[s3e]}runWithConfig(e,r,n){let o=Bs._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.convertToRunTree(s):n||(l=new CC({name:"<runnable_lambda>",tracingEnabled:!1})),l&&(l.extra={...l.extra,[s3e]:e}),a!==void 0&&a[xR]!==void 0&&(l===void 0&&(l={}),l[xR]=a[xR]),i.run(l,r)}initializeGlobalInstance(e){DE()===void 0&&e3e(e)}},jd=new vme});var YL=w(()=>{u3e();j2()});async function _p(t){return Bs._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function wG(...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(D2(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(D2(s),!0);e.callbacks=a}else e.callbacks=new Bs(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 un(t){let e=jd.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))rar.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 us(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=un(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 bm(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 vG,rar,Hb=w(()=>{LE();YL();vG=25;rar=new Set(["string","number","boolean"])});async function Vb(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 wme=w(()=>{});function Sme(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 Hl(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]=Hl(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function l3e(t,e,r,n,...o){let i=new TC({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Nd,TC,Wb=w(()=>{Hb();YL();wme();Nd=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)}})}};TC=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)=>{jd.runWithConfig(bm(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?jd.runWithConfig(bm(this.config),this.signal?async()=>Vb(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 c3e(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 d3e(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 nar(t){return t!==void 0&&t.message!==void 0}var py,L2,f3e,F2,p3e=w(()=>{Jpe();vR();Wb();SR();py=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=AE({},r);return new L2({ops:r,state:n[n.length-1].newDocument})}},L2=class t extends py{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=AE(this.state,e.ops);return new t({ops:r,state:n[n.length-1].newDocument})}static fromRunLogPatch(e){let r=AE({},e.ops);return new t({ops:e.ops,state:r[r.length-1].newDocument})}},f3e=t=>t.name==="log_stream_tracer";F2=class extends xh{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=Nd.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 py({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 py({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 c3e(e,this._schemaFormat)),await this.writer.write(new py({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 c3e(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await d3e(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 py({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new py({ops:[{op:"replace",path:"/final_output",value:await d3e(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?nar(n?.chunk)?a=n?.chunk:a=new dr({id:`run-${e.id}`,content:r}):a=r;let s=new py({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 k2,vp,qn,ZL=w(()=>{k2="__run",vp=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}})}},qn=class t extends vp{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 SG({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 m3e,xG,h3e=w(()=>{vR();Wb();SR();ZL();m3e=t=>t.name==="event_stream_tracer",xG=class extends xh{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=Nd.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 vp({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=SG(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 dr({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 vp({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=SG(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=SG(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=SG(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 g3e,CG,oar,iar,_m,XL=w(()=>{g3e=F(PK(),1),CG=F(NK(),1),oar=[400,401,402,403,404,405,406,407,409],iar=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&&oar.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},_m=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??iar;let r="default"in CG.default?CG.default.default:CG.default;this.queue=new r({concurrency:this.maxConcurrency})}call(e,...r){return this.queue.add(()=>(0,g3e.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 $2,y3e=w(()=>{vR();$2=class extends xh{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 B2(t){return t?t.lc_runnable:!1}var OG,xme=w(()=>{OG=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}}});var _3e,b3e,v3e,PG=w(()=>{_3e=Symbol("Let zodToJsonSchema decide on which parser to use"),b3e={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"},v3e=t=>typeof t=="string"?{...b3e,name:t}:{...b3e,...t}});var w3e,Cme=w(()=>{PG();w3e=t=>{let e=v3e(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 Ome(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Un(t,e,r,n,o){t[e]=r,Ome(t,e,n,o)}var FE=w(()=>{});function S3e(){return{}}var Pme=w(()=>{});function x3e(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==de.ZodAny&&(r.items=fr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Un(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Un(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Un(r,"minItems",t.exactLength.value,t.exactLength.message,e),Un(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Eme=w(()=>{Td();FE();qs()});function C3e(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?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Tme=w(()=>{FE()});function O3e(){return{type:"boolean"}}var Ame=w(()=>{});function EG(t,e){return fr(t.type._def,e)}var TG=w(()=>{qs()});var P3e,Ime=w(()=>{qs();P3e=(t,e)=>fr(t.innerType._def,e)});function Mme(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Mme(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 aar(t,e)}}var aar,Rme=w(()=>{FE();aar=(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":Un(r,"minimum",n.value,n.message,e);break;case"max":Un(r,"maximum",n.value,n.message,e);break}return r}});function E3e(t,e){return{...fr(t.innerType._def,e),default:t.defaultValue()}}var jme=w(()=>{qs()});function T3e(t,e){return e.effectStrategy==="input"?fr(t.schema._def,e):{}}var Nme=w(()=>{qs()});function A3e(t){return{type:"string",enum:Array.from(t.values)}}var Dme=w(()=>{});function I3e(t,e){let r=[fr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),fr(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(sar(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 sar,Lme=w(()=>{qs();sar=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function M3e(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 Fme=w(()=>{});function AG(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Un(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":hy(r,"email",n.message,e);break;case"format:idn-email":hy(r,"idn-email",n.message,e);break;case"pattern:zod":jf(r,my.email,n.message,e);break}break;case"url":hy(r,"uri",n.message,e);break;case"uuid":hy(r,"uuid",n.message,e);break;case"regex":jf(r,n.regex,n.message,e);break;case"cuid":jf(r,my.cuid,n.message,e);break;case"cuid2":jf(r,my.cuid2,n.message,e);break;case"startsWith":jf(r,RegExp(`^${$me(n.value,e)}`),n.message,e);break;case"endsWith":jf(r,RegExp(`${$me(n.value,e)}$`),n.message,e);break;case"datetime":hy(r,"date-time",n.message,e);break;case"date":hy(r,"date",n.message,e);break;case"time":hy(r,"time",n.message,e);break;case"duration":hy(r,"duration",n.message,e);break;case"length":Un(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Un(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{jf(r,RegExp($me(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hy(r,"ipv4",n.message,e),n.version!=="v4"&&hy(r,"ipv6",n.message,e);break}case"base64url":jf(r,my.base64url,n.message,e);break;case"jwt":jf(r,my.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&jf(r,my.ipv4Cidr,n.message,e),n.version!=="v4"&&jf(r,my.ipv6Cidr,n.message,e);break}case"emoji":jf(r,my.emoji(),n.message,e);break;case"ulid":{jf(r,my.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hy(r,"binary",n.message,e);break}case"contentEncoding:base64":{Un(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{jf(r,my.base64,n.message,e);break}}break}case"nanoid":jf(r,my.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function $me(t,e){return e.patternStrategy==="escape"?lar(t):t}function lar(t){let e="";for(let r=0;r<t.length;r++)uar.has(t[r])||(e+="\\"),e+=t[r];return e}function hy(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}}})):Un(t,"format",e,r,n)}function jf(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:R3e(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Un(t,"pattern",R3e(e,n),r,n)}function R3e(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 kme,my,uar,IG=w(()=>{FE();my={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:()=>(kme===void 0&&(kme=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kme),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-_]*$/};uar=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function MG(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===de.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=AG(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===de.ZodBranded&&t.keyType._def.type._def.typeName===de.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=EG(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var RG=w(()=>{Td();qs();IG();TG()});function j3e(t,e){if(e.mapStrategy==="record")return MG(t,e);let r=fr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=fr(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 Bme=w(()=>{qs();RG()});function N3e(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 qme=w(()=>{});function D3e(){return{not:{}}}var Ume=w(()=>{});function L3e(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var zme=w(()=>{});function k3e(t,e){if(e.target==="openApi3")return F3e(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in q2&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=q2[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 F3e(t,e)}var q2,F3e,jG=w(()=>{qs();q2={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};F3e=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>fr(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 $3e(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:q2[t.innerType._def.typeName],nullable:!0}:{type:[q2[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=fr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Hme=w(()=>{qs();jG()});function B3e(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",Ome(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Un(r,"minimum",n.value,n.message,e):Un(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Un(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Un(r,"maximum",n.value,n.message,e):Un(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Un(r,"maximum",n.value,n.message,e));break;case"multipleOf":Un(r,"multipleOf",n.value,n.message,e);break}return r}var Vme=w(()=>{FE()});function car(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":fr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function q3e(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 dp&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=fr(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:car(t,e)};return n.required.length||delete n.required,n}var Wme=w(()=>{Td();qs()});var U3e,Kme=w(()=>{qs();U3e=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return fr(t.innerType._def,e);let r=fr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var z3e,Gme=w(()=>{qs();z3e=(t,e)=>{if(e.pipeStrategy==="input")return fr(t.in._def,e);if(e.pipeStrategy==="output")return fr(t.out._def,e);let r=fr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=fr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function H3e(t,e){return fr(t.type._def,e)}var Jme=w(()=>{qs()});function V3e(t,e){let n={type:"array",uniqueItems:!0,items:fr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Un(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Un(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Yme=w(()=>{FE();qs()});function W3e(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:fr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>fr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Zme=w(()=>{qs()});function K3e(){return{not:{}}}var Xme=w(()=>{});function G3e(){return{}}var Qme=w(()=>{});var J3e,ehe=w(()=>{qs();J3e=(t,e)=>fr(t.innerType._def,e)});function fr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==_3e)return a}if(n&&!r){let a=dar(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=par(t,t.typeName,e);return i&&mar(t,e,i),o.jsonSchema=i,i}var dar,far,par,mar,qs=w(()=>{Td();Pme();Eme();Tme();Ame();TG();Ime();Rme();jme();Nme();Dme();Lme();Fme();Bme();qme();Ume();zme();Hme();Vme();Wme();Kme();Gme();Jme();RG();Yme();IG();Zme();Xme();jG();Qme();ehe();PG();dar=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:far(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}},far=(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("/")},par=(t,e,r)=>{switch(e){case de.ZodString:return AG(t,r);case de.ZodNumber:return B3e(t,r);case de.ZodObject:return q3e(t,r);case de.ZodBigInt:return C3e(t,r);case de.ZodBoolean:return O3e();case de.ZodDate:return Mme(t,r);case de.ZodUndefined:return K3e();case de.ZodNull:return L3e(r);case de.ZodArray:return x3e(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return k3e(t,r);case de.ZodIntersection:return I3e(t,r);case de.ZodTuple:return W3e(t,r);case de.ZodRecord:return MG(t,r);case de.ZodLiteral:return M3e(t,r);case de.ZodEnum:return A3e(t);case de.ZodNativeEnum:return N3e(t);case de.ZodNullable:return $3e(t,r);case de.ZodOptional:return U3e(t,r);case de.ZodMap:return j3e(t,r);case de.ZodSet:return V3e(t,r);case de.ZodLazy:return fr(t.getter()._def,r);case de.ZodPromise:return H3e(t,r);case de.ZodNaN:case de.ZodNever:return D3e();case de.ZodEffects:return T3e(t,r);case de.ZodAny:return S3e();case de.ZodUnknown:return G3e();case de.ZodDefault:return E3e(t,r);case de.ZodBranded:return EG(t,r);case de.ZodReadonly:return J3e(t,r);case de.ZodCatch:return P3e(t,r);case de.ZodPipeline:return z3e(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(n=>{})(e)}},mar=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var So,the=w(()=>{qs();Cme();So=(t,e)=>{let r=w3e(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:fr(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=fr(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 Ec=w(()=>{PG();Cme();FE();qs();Pme();Eme();Tme();Ame();TG();Ime();Rme();jme();Nme();Dme();Lme();Fme();Bme();qme();Ume();zme();Hme();Vme();Wme();Kme();Gme();Jme();ehe();RG();Yme();IG();Zme();Xme();jG();Qme();the();the()});function rhe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function gar(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
`;return e}function Y3e(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()??"",S=har.some(O=>g.startsWith(O)&&g.endsWith(O))?`<p>${g}</p>`:g;Object.keys(b.metadata??{}).length&&(S+=`<hr/><small><em>${Object.entries(b.metadata??{}).map(([O,P])=>`${O} = ${P}`).join(`
`)}</em></small>`);let x=(m[h]??m[p]).replace("{0}",rhe(h)).replace("{1}",S);l+=` ${x}
`}}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:S,conditional:x}=b,O="";if(S!==void 0){let P=S,E=P.split(" ");E.length>u&&(P=Array.from({length:Math.ceil(E.length/u)},(A,I)=>E.slice(I*u,(I+1)*u).join(" ")).join("&nbsp;<br>&nbsp;")),O=x?` -. &nbsp;${P}&nbsp; .-> `:` -- &nbsp;${P}&nbsp; --> `}else O=x?" -.-> ":" --> ";l+=` ${rhe(g)}${O}${rhe(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+=gar(i??{})),l}async function Z3e(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 har,X3e=w(()=>{har=["*","_","`"]});function yar(t,e){if(t!==void 0&&!EE(t))return t;if(B2(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 bar(t){return B2(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...So(t.data.schema),title:t.data.name}}}function Q3e(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 eHe(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 U2,tHe=w(()=>{Ec();TE();xme();X3e();U2=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]=EE(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...bar(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??as(),i={id:o,data:e,name:yar(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 Q3e(this)}lastNode(){return eHe(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(EE)&&(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&&Q3e(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&eHe(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 EE(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 Y3e(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 Z3e(r,{backgroundColor:e?.backgroundColor})}}});function rHe(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 Nd.fromReadableStream(r)}var nHe=w(()=>{Wb()});function nhe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function NG(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*ohe(t,e){for(;;){let{value:r,done:n}=jd.runWithConfig(bm(t),e.next.bind(e),!0);if(n)break;yield r}}async function*DG(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await jd.runWithConfig(bm(t),r.next.bind(e),!0);if(o)break;yield n}}var oHe,iHe=w(()=>{YL();Hb();oHe=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function xl(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function _ar(t){if(nG(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function AC(t){if(typeof t=="function")return new Nf({func:t});if(xn.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=AC(n);return new kE({steps:e})}else throw new Error(`Expected a Runnable, function or object.
Instead got an unsupported type.`)}function war(t,e){let r=e.name??t.getName(),n=e.description??e.schema?.description;return e.schema.constructor===Wr.ZodString?new z2({name:r,description:n,schema:Wr.object({input:Wr.string()}).transform(o=>o.input),bound:t}):new z2({name:r,description:n,schema:e.schema,bound:t})}var ihe,xn,IC,LG,FG,bi,kE,ahe,Nf,kG,QL,$G,z2,Df=w(()=>{Td();ihe=F(PK(),1);TE();Kpe();p3e();h3e();yR();Wb();wme();Hb();XL();y3e();xme();YL();tHe();nHe();iHe();pG();xn=class extends gp{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 IC({bound:this,kwargs:e,config:{}})}map(){return new LG({bound:this})}withRetry(e){return new FG({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new IC({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new kG({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(un);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)=>un(i===0?e:n))}return Array.from({length:r},()=>un(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new _m({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=un(r),o=new TC({generator:this._streamIterator(e,n),config:n});return await o.setup,Nd.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=un(e):r=un({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=un(n),a=await(await _p(o))?.handleChainStart(this.toJSON(),xl(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 Vb(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(xl(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(_p)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),xl(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 Vb(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(xl(u,"output")))),u}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=un(n),l=await _p(u);async function*c(){for await(let f of e){if(i)if(o===void 0)o=f;else try{o=Hl(o,f)}catch{o=void 0,i=!1}yield f}}let d;try{let f=await l3e(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(m3e),m=f.output;p!==void 0&&d!==void 0&&(m=p.tapOutputIterable(d.runId,m));let h=d?.handlers.find(f3e);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=Hl(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:xl(o,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:xl(o,"input")})}getGraph(e){let r=new U2,n=r.addNode({name:`${this.getName()}Input`,schema:Wr.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Wr.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new bi({first:this,last:AC(e)})}pick(e){return this.pipe(new $G(e))}assign(e){return this.pipe(new QL(new kE({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=Hl(n,o);yield*this._streamIterator(n,un(r))}async*streamLog(e,r,n){let o=new F2({...n,autoClose:!1,_schemaFormat:"original"}),i=un(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 py({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"?rHe(o):Nd.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new xG({...n,autoClose:!1}),i=un(r),a=i.runId??as();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(){try{let m;r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,r.signal.addEventListener("abort",()=>{u.abort()},{once:!0})):m=u.signal;let h=await l.stream(e,{...i,signal:m}),b=o.tapOutputIterable(a,h);for await(let g of b)if(u.signal.aborted)break}finally{await o.finish()}}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=un(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new F2({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new OG({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=L2.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},S={run_id:y.id,event:`on_${y.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(S,y.type)&&(yield S)}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 S,x={},O=o.state.logs[y];if(O.end_time===void 0?O.streamed_output.length>0?S="stream":S="start":S="end",S==="start")O.inputs!==void 0&&(x.input=O.inputs);else if(S==="end")O.inputs!==void 0&&(x.input=O.inputs),x.output=O.final_output;else if(S==="stream"){let P=O.streamed_output.length;if(P!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${P} instead. Encountered in: "${O.name}"`);x={chunk:O.streamed_output[0]},O.streamed_output=[]}yield{event:`on_${O.type}_${S}`,name:O.name,run_id:O.id,tags:O.tags,metadata:O.metadata,data:x}}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 S={chunk:g.streamed_output[0]};g.streamed_output=[];let x={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:S};d.includeEvent(x,g.type)&&(yield x)}}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 B2(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new IC({bound:this,config:{},configFactories:[o=>({callbacks:[new $2({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return war(this,e)}},IC=class t extends xn{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=wG(this.config,...e);return wG(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 this.constructor({bound:this.bound.withRetry(e),kwargs:this.kwargs,config:this.config})}async invoke(e,r){return this.bound.invoke(e,await this._mergeConfig(un(r),this.kwargs))}async batch(e,r,n){let o=Array.isArray(r)?await Promise.all(r.map(async i=>this._mergeConfig(un(i),this.kwargs))):await this._mergeConfig(un(r),this.kwargs);return this.bound.batch(e,o,n)}async*_streamIterator(e,r){yield*this.bound._streamIterator(e,await this._mergeConfig(un(r),this.kwargs))}async stream(e,r){return this.bound.stream(e,await this._mergeConfig(un(r),this.kwargs))}async*transform(e,r){yield*this.bound.transform(e,await this._mergeConfig(un(r),this.kwargs))}streamEvents(e,r,n){let o=this,i=async function*(){yield*o.bound.streamEvents(e,{...await o._mergeConfig(un(r),o.kwargs),version:r.version},n)};return Nd.fromAsyncGenerator(i())}static isRunnableBinding(e){return e.bound&&xn.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 $2({config:o,onStart:e,onEnd:r,onError:n})]})]})}},LG=class t extends xn{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,us(r,{callbacks:n?.getChild()}))}withListeners({onStart:e,onEnd:r,onError:n}){return new t({bound:this.bound.withListeners({onStart:e,onEnd:r,onError:n})})}},FG=class extends IC{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 us(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,ihe.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,ihe.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)}},bi=class t extends xn{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=un(r),i=await(await _p(n))?.handleChainStart(this.toJSON(),xl(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,us(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`)}));a=await Vb(d,r?.signal)}if(r?.signal?.aborted)throw new Error("Aborted");s=await this.last.invoke(a,us(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(xl(s,"output")),s}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=await Promise.all(o.map(_p)),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),xl(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 us(o[f],{callbacks:p})}),n);s=await Vb(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(xl(s,"output")))),s}async*_streamIterator(e,r){let n=await _p(r),{runId:o,...i}=r??{},a=await n?.handleChainStart(this.toJSON(),xl(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(),us(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,us(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=Hl(l,f)}catch{l=void 0,u=!1}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(xl(l,"output"))}getGraph(e){let r=new U2,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:AC(e),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&xn.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:AC(e),middle:r.slice(0,-1).map(AC),last:AC(r[r.length-1])})}},kE=class t extends xn{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]=AC(n)}static from(e){return new t({steps:e})}async invoke(e,r){let n=un(r),i=await(await _p(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,us(n,{callbacks:i?.getChild(`map:key:${u}`)}))});await Vb(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=Sme(e,Object.keys(o).length),a=new Map(Object.entries(o).map(([s,u],l)=>{let c=u.transform(i[l],us(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 Vb(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},ahe=class t extends xn{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}),!nG(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 _p(n),i=this.func(us(n,{callbacks:o}),e);return Vb(i,n?.signal)}async*_streamIterator(e,r){let[n]=this._getOptionsList(r??{},1),o=await this.invoke(e,r);if(NG(o)){for await(let i of o)n?.signal?.throwIfAborted(),yield i;return}if(oHe(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})}};Nf=class t extends xn{static lc_name(){return"RunnableLambda"}constructor(e){if(nG(e.func))return ahe.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}),_ar(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=us(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??vG)-1});jd.runWithConfig(bm(a),async()=>{try{let s=await this.func(e,{...a});if(s&&xn.isRunnable(s)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");s=await s.invoke(e,{...a,recursionLimit:(a.recursionLimit??vG)-1})}else if(NG(s)){let u;for await(let l of DG(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(u,l)}catch{u=l}s=u}else if(nhe(s)){let u;for(let l of ohe(a,s))if(r?.signal?.throwIfAborted(),u===void 0)u=l;else try{u=Hl(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=Hl(o,s)}catch{o=s}let i=us(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??vG)-1}),a=await new Promise((s,u)=>{jd.runWithConfig(bm(i),async()=>{try{let l=await this.func(o,{...i,config:i});s(l)}catch(l){u(l)}})});if(a&&xn.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(NG(a))for await(let s of DG(i,a))n?.signal?.throwIfAborted(),yield s;else if(nhe(a))for(let s of ohe(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},kG=class extends xn{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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u=us(a,{callbacks:s?.getChild()});return await jd.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(xl(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=un(r),o=await _p(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),xl(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=us(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=DG(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:Hl(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(xl(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=>_p(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),xl(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)=>us(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(xl(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.")}};QL=class extends xn{static lc_name(){return"RunnableAssign"}constructor(e){e instanceof kE&&(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]=Sme(e),s=this.mapper.transform(a,us(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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},$G=class extends xn{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=un(r),i=new TC({generator:this.transform(n(),o),config:o});return await i.setup,Nd.fromAsyncGenerator(i)}},z2=class extends IC{constructor(e){let r=bi.from([Nf.from(async n=>{let o;if(RE(n))try{o=await this.schema.parseAsync(n.args)}catch{throw new wR("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 go,BG=w(()=>{Wb();Df();Hb();go=class extends xn{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=un(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=un(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=Hl(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new QL(new kE({steps:e}))}}});var aHe=w(()=>{Df();Hb()});var sHe=w(()=>{Df();Hb();Wb()});var she=w(()=>{Eh()});var uHe=w(()=>{Df();SR();Eh();mG();hG();R2();she();gG();KL();NE()});var OR=w(()=>{SR();Eh();mG();hG();R2();gG();NE();uHe();she();sme();KL()});var lHe=w(()=>{OR();Df();BG()});var uhe=w(()=>{Df();Hb();BG();aHe();sHe();lHe()});var PR,ER,vm,eF=w(()=>{uhe();I2();PR=class extends xn{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"})}},ER=class extends PR{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")}},vm=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");ME(this,"OUTPUT_PARSING_FAILURE")}}});function MC(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(!MC(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(!MC(t[a],e[a]))return!1;return!0}return t===e}var lhe=w(()=>{});function wm(t){return encodeURI(Sar(t))}function Sar(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var qG=w(()=>{});function RC(t,e=Object.create(null),r=Par,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:RC(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(Oar[i])continue;let a=`${n}/${wm(i)}`,s=t[i];if(Array.isArray(s)){if(xar[i]){let u=s.length;for(let l=0;l<u;l++)RC(s[l],e,r,`${a}/${l}`)}}else if(Car[i])for(let u in s)RC(s[u],e,r,`${a}/${wm(u)}`);else RC(s,e,r,a)}return e}var xar,Car,Oar,Par,UG=w(()=>{qG();xar={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Car={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Oar={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},Par=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 wp(t){return t.test.bind(t)}function Kar(t){return t%4===0&&(t%100!==0||t%400===0)}function cHe(t){let e=t.match(Ear);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&Kar(r)?29:Tar[n])}function dHe(t,e){let r=e.match(Aar);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 Jar(t){let e=t.split(Gar);return e.length==2&&cHe(e[0])&&dHe(!0,e[1])}function Xar(t){return Yar.test(t)&&Zar.test(t)}function esr(t){if(Qar.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var Ear,Tar,Aar,Iar,Mar,Rar,jar,Nar,Dar,Lar,Far,kar,$ar,Bar,qar,Uar,zar,Har,Var,War,che,Gar,Yar,Zar,Qar,dhe=w(()=>{Ear=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Tar=[0,31,28,31,30,31,30,31,31,30,31,30,31],Aar=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Iar=/^(?=.{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,Mar=/^(?:[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,Rar=/^(?:(?:[^\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,jar=/^(?:(?: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,Nar=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Dar=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Lar=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Far=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,kar=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$ar=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Bar=/^\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,qar=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,Uar=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))},zar=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Har=/^((([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,Var=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));War={date:cHe,time:dHe.bind(void 0,!1),"date-time":Jar,duration:Var,uri:Xar,"uri-reference":wp(Mar),"uri-template":wp(Rar),url:wp(jar),email:Uar,hostname:wp(Iar),ipv4:wp(zar),ipv6:wp(Har),regex:esr,uuid:wp(Nar),"json-pointer":wp(Dar),"json-pointer-uri-fragment":wp(Lar),"relative-json-pointer":wp(Far)},che={...War,date:wp(kar),time:wp($ar),"date-time":wp(Bar),"uri-reference":wp(qar)};Gar=/t|\s/i;Yar=/\/|:/,Zar=/^(?:[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;Qar=/[^\\]\\Z/});var fHe,pHe=w(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(fHe||(fHe={}))});function mHe(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 fhe=w(()=>{});function oa(t,e,r="2019-09",n=RC(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:S,allOf:x,oneOf:O,if:P,then:E,else:A,format:I,properties:R,patternProperties:N,additionalProperties:j,unevaluatedProperties:$,minProperties:k,maxProperties:z,propertyNames:V,dependentRequired:Q,dependentSchemas:J,dependencies:D,prefixItems:B,items:q,additionalItems:K,unevaluatedItems:H,contains:ee,minContains:U,maxContains:W,minItems:Y,maxItems:ae,uniqueItems:Oe,minimum:le,maximum:Be,exclusiveMinimum:ze,exclusiveMaximum:rt,multipleOf:cr,minLength:wn,maxLength:Le,pattern:pt,__absolute_ref__:mt,__absolute_recursive_ref__:ht}=e,te=[];if(p===!0&&i===null&&(i=e),f==="#"){let Re=i===null?n[ht]:i,Pe=`${s}/$recursiveRef`,oe=oa(t,i===null?e:i,r,n,o,Re,a,Pe,u);oe.valid||te.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Pe,error:"A subschema had errors."},...oe.errors)}if(d!==void 0){let Pe=n[mt||d];if(Pe===void 0){let ce=`Unresolved $ref "${d}".`;throw mt&&mt!==d&&(ce+=` Absolute URI "${mt}".`),ce+=`
Known schemas:
- ${Object.keys(n).join(`
- `)}`,new Error(ce)}let oe=`${s}/$ref`,se=oa(t,Pe,r,n,o,i,a,oe,u);if(se.valid||te.push({instanceLocation:a,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...se.errors),r==="4"||r==="7")return{valid:te.length===0,errors:te}}if(Array.isArray(m)){let Re=m.length,Pe=!1;for(let oe=0;oe<Re;oe++)if(c===m[oe]||m[oe]==="integer"&&c==="number"&&t%1===0&&t===t){Pe=!0;break}Pe||te.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)&&te.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&te.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?MC(t,h)||te.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&te.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(Re=>MC(t,Re))||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`}):b.some(Re=>t===Re)||te.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(b)}.`})),y!==void 0){let Re=`${s}/not`;oa(t,y,r,n,o,i,a,Re).valid&&te.push({instanceLocation:a,keyword:"not",keywordLocation:Re,error:'Instance matched "not" schema.'})}let et=[];if(S!==void 0){let Re=`${s}/anyOf`,Pe=te.length,oe=!1;for(let se=0;se<S.length;se++){let ce=S[se],Ce=Object.create(u),Je=oa(t,ce,r,n,o,p===!0?i:null,a,`${Re}/${se}`,Ce);te.push(...Je.errors),oe=oe||Je.valid,Je.valid&&et.push(Ce)}oe?te.length=Pe:te.splice(Pe,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:Re,error:"Instance does not match any subschemas."})}if(x!==void 0){let Re=`${s}/allOf`,Pe=te.length,oe=!0;for(let se=0;se<x.length;se++){let ce=x[se],Ce=Object.create(u),Je=oa(t,ce,r,n,o,p===!0?i:null,a,`${Re}/${se}`,Ce);te.push(...Je.errors),oe=oe&&Je.valid,Je.valid&&et.push(Ce)}oe?te.length=Pe:te.splice(Pe,0,{instanceLocation:a,keyword:"allOf",keywordLocation:Re,error:"Instance does not match every subschema."})}if(O!==void 0){let Re=`${s}/oneOf`,Pe=te.length,oe=O.filter((se,ce)=>{let Ce=Object.create(u),Je=oa(t,se,r,n,o,p===!0?i:null,a,`${Re}/${ce}`,Ce);return te.push(...Je.errors),Je.valid&&et.push(Ce),Je.valid}).length;oe===1?te.length=Pe:te.splice(Pe,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:Re,error:`Instance does not match exactly one subschema (${oe} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...et),P!==void 0){let Re=`${s}/if`;if(oa(t,P,r,n,o,i,a,Re,u).valid){if(E!==void 0){let oe=oa(t,E,r,n,o,i,a,`${s}/then`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(A!==void 0){let oe=oa(t,A,r,n,o,i,a,`${s}/else`,u);oe.valid||te.push({instanceLocation:a,keyword:"if",keywordLocation:Re,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(g!==void 0)for(let se of g)se in t||te.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${se}".`});let Re=Object.keys(t);if(k!==void 0&&Re.length<k&&te.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${k} properties.`}),z!==void 0&&Re.length>z&&te.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${z} properties.`}),V!==void 0){let se=`${s}/propertyNames`;for(let ce in t){let Ce=`${a}/${wm(ce)}`,Je=oa(ce,V,r,n,o,i,Ce,se);Je.valid||te.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:se,error:`Property name "${ce}" does not match schema.`},...Je.errors)}}if(Q!==void 0){let se=`${s}/dependantRequired`;for(let ce in Q)if(ce in t){let Ce=Q[ce];for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`})}}if(J!==void 0)for(let se in J){let ce=`${s}/dependentSchemas`;if(se in t){let Ce=oa(t,J[se],r,n,o,i,a,`${ce}/${wm(se)}`,u);Ce.valid||te.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:ce,error:`Instance has "${se}" but does not match dependant schema.`},...Ce.errors)}}if(D!==void 0){let se=`${s}/dependencies`;for(let ce in D)if(ce in t){let Ce=D[ce];if(Array.isArray(Ce))for(let Je of Ce)Je in t||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not have "${Je}".`});else{let Je=oa(t,Ce,r,n,o,i,a,`${se}/${wm(ce)}`);Je.valid||te.push({instanceLocation:a,keyword:"dependencies",keywordLocation:se,error:`Instance has "${ce}" but does not match dependant schema.`},...Je.errors)}}}let Pe=Object.create(null),oe=!1;if(R!==void 0){let se=`${s}/properties`;for(let ce in R){if(!(ce in t))continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],R[ce],r,n,o,i,Ce,`${se}/${wm(ce)}`);if(Je.valid)u[ce]=Pe[ce]=!0;else if(oe=o,te.push({instanceLocation:a,keyword:"properties",keywordLocation:se,error:`Property "${ce}" does not match schema.`},...Je.errors),oe)break}}if(!oe&&N!==void 0){let se=`${s}/patternProperties`;for(let ce in N){let Ce=new RegExp(ce,"u"),Je=N[ce];for(let ir in t){if(!Ce.test(ir))continue;let ea=`${a}/${wm(ir)}`,ta=oa(t[ir],Je,r,n,o,i,ea,`${se}/${wm(ce)}`);ta.valid?u[ir]=Pe[ir]=!0:(oe=o,te.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:se,error:`Property "${ir}" matches pattern "${ce}" but does not match associated schema.`},...ta.errors))}}}if(!oe&&j!==void 0){let se=`${s}/additionalProperties`;for(let ce in t){if(Pe[ce])continue;let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],j,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:(oe=o,te.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:se,error:`Property "${ce}" does not match additional properties schema.`},...Je.errors))}}else if(!oe&&$!==void 0){let se=`${s}/unevaluatedProperties`;for(let ce in t)if(!u[ce]){let Ce=`${a}/${wm(ce)}`,Je=oa(t[ce],$,r,n,o,i,Ce,se);Je.valid?u[ce]=!0:te.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:se,error:`Property "${ce}" does not match unevaluated properties schema.`},...Je.errors)}}}else if(c==="array"){ae!==void 0&&t.length>ae&&te.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${ae}).`}),Y!==void 0&&t.length<Y&&te.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${Y}).`});let Re=t.length,Pe=0,oe=!1;if(B!==void 0){let se=`${s}/prefixItems`,ce=Math.min(B.length,Re);for(;Pe<ce;Pe++){let Ce=oa(t[Pe],B[Pe],r,n,o,i,`${a}/${Pe}`,`${se}/${Pe}`);if(u[Pe]=!0,!Ce.valid&&(oe=o,te.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:se,error:"Items did not match schema."},...Ce.errors),oe))break}}if(q!==void 0){let se=`${s}/items`;if(Array.isArray(q)){let ce=Math.min(q.length,Re);for(;Pe<ce;Pe++){let Ce=oa(t[Pe],q[Pe],r,n,o,i,`${a}/${Pe}`,`${se}/${Pe}`);if(u[Pe]=!0,!Ce.valid&&(oe=o,te.push({instanceLocation:a,keyword:"items",keywordLocation:se,error:"Items did not match schema."},...Ce.errors),oe))break}}else for(;Pe<Re;Pe++){let ce=oa(t[Pe],q,r,n,o,i,`${a}/${Pe}`,se);if(u[Pe]=!0,!ce.valid&&(oe=o,te.push({instanceLocation:a,keyword:"items",keywordLocation:se,error:"Items did not match schema."},...ce.errors),oe))break}if(!oe&&K!==void 0){let ce=`${s}/additionalItems`;for(;Pe<Re;Pe++){let Ce=oa(t[Pe],K,r,n,o,i,`${a}/${Pe}`,ce);u[Pe]=!0,Ce.valid||(oe=o,te.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:ce,error:"Items did not match additional items schema."},...Ce.errors))}}}if(ee!==void 0)if(Re===0&&U===void 0)te.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&&Re<U)te.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${Re}) than minContains (${U}).`});else{let se=`${s}/contains`,ce=te.length,Ce=0;for(let Je=0;Je<Re;Je++){let ir=oa(t[Je],ee,r,n,o,i,`${a}/${Je}`,se);ir.valid?(u[Je]=!0,Ce++):te.push(...ir.errors)}Ce>=(U||0)&&(te.length=ce),U===void 0&&W===void 0&&Ce===0?te.splice(ce,0,{instanceLocation:a,keyword:"contains",keywordLocation:se,error:"Array does not contain item matching schema."}):U!==void 0&&Ce<U?te.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${U} items matching schema. Only ${Ce} items were found.`}):W!==void 0&&Ce>W&&te.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${W} items matching schema. ${Ce} items were found.`})}if(!oe&&H!==void 0){let se=`${s}/unevaluatedItems`;for(Pe;Pe<Re;Pe++){if(u[Pe])continue;let ce=oa(t[Pe],H,r,n,o,i,`${a}/${Pe}`,se);u[Pe]=!0,ce.valid||te.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:se,error:"Items did not match unevaluated items schema."},...ce.errors)}}if(Oe)for(let se=0;se<Re;se++){let ce=t[se],Ce=typeof ce=="object"&&ce!==null;for(let Je=0;Je<Re;Je++){if(se===Je)continue;let ir=t[Je];(ce===ir||Ce&&(typeof ir=="object"&&ir!==null)&&MC(ce,ir))&&(te.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${se} and ${Je}.`}),se=Number.MAX_SAFE_INTEGER,Je=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(le!==void 0&&(ze===!0&&t<=le||t<le)&&te.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ze?"or equal to ":""} ${le}.`}),Be!==void 0&&(rt===!0&&t>=Be||t>Be)&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${rt?"or equal to ":""} ${Be}.`})):(le!==void 0&&t<le&&te.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${le}.`}),Be!==void 0&&t>Be&&te.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Be}.`}),ze!==void 0&&t<=ze&&te.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${ze}.`}),rt!==void 0&&t>=rt&&te.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${rt}.`})),cr!==void 0){let Re=t%cr;Math.abs(0-Re)>=11920929e-14&&Math.abs(cr-Re)>=11920929e-14&&te.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${cr}.`})}}else if(c==="string"){let Re=wn===void 0&&Le===void 0?0:mHe(t);wn!==void 0&&Re<wn&&te.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${Re} < ${wn}).`}),Le!==void 0&&Re>Le&&te.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${Re} > ${Le}).`}),pt!==void 0&&!new RegExp(pt,"u").test(t)&&te.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&che[I]&&!che[I](t)&&te.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:te.length===0,errors:te}}var phe=w(()=>{lhe();UG();dhe();qG();fhe()});var hHe=w(()=>{UG();phe()});var H2=w(()=>{lhe();UG();dhe();qG();pHe();fhe();phe();hHe()});var TR,AR,$E=w(()=>{H2();eF();Eh();NE();ZL();TR=class extends ER{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"})}},AR=class extends TR{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(ume(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:o,text:o.content})}else if(Ph(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new qn({message:dme(o),text:o.content})}else i=new vp({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!MC(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var gHe=w(()=>{$E()});var yHe=w(()=>{eF();$E()});var zG,bHe=w(()=>{$E();zG=class extends TR{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 Tc,_He=w(()=>{Td();Ec();eF();Tc=class extends ER{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=Wr.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Wr.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(So(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 this.schema.parseAsync(JSON.parse(n))}catch(r){throw new vm(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}}});var mhe=w(()=>{Jpe()});var Ac,hhe=w(()=>{$E();mhe();ime();Ac=class extends AR{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?dG(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return ome(e[0].text)}async parse(e){return ome(e,JSON.parse)}getFormatInstructions(){return""}}});var vHe=w(()=>{});var wHe=w(()=>{$E();mhe();vHe()});var SHe=w(()=>{eF();gHe();yHe();bHe();_He();$E();hhe();wHe()});var gy=w(()=>{SHe()});var V2,tF,rF,HG,W2=w(()=>{yR();R2();NE();V2=class extends gp{},tF=class extends V2{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 Os(this.value)]}},rF=class extends V2{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 Rf(this.messages)}toChatMessages(){return this.messages}},HG=class extends V2{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 Os({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var jC,K2=w(()=>{W2();nF();jC=class extends Kb{async formatPromptValue(e){let r=await this.format(e);return new tF(r)}}});function yhe(t){return typeof t=="function"}function rsr(t){return iF(t)?"array":typeof t}function ghe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xHe(t,e){return t!=null&&typeof t=="object"&&e in t}function nsr(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function isr(t,e){return osr.call(t,e)}function ssr(t){return!isr(asr,t)}function lsr(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return usr[r]})}function msr(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(dsr,2)),!iF(A)||A.length!==2)throw new Error("Invalid tags: "+A);d=new RegExp(ghe(A[0])+"\\s*"),f=new RegExp("\\s*"+ghe(A[1])),p=new RegExp("\\s*"+ghe("}"+A[1]))}m(e||Ah.tags);for(var h=new J2(t),b,g,y,S,x,O;!h.eos();){if(b=h.pos,y=h.scanUntil(d),y)for(var P=0,E=y.length;P<E;++P)S=y.charAt(P),ssr(S)?(i.push(o.length),u+=S):(s=!0,r=!0,u+=" "),o.push(["text",S,b,b+1]),b+=1,S===`
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(psr)||"name",h.scan(csr),g==="="?(y=h.scanUntil(CHe),h.scan(CHe),h.scanUntil(f)):g==="{"?(y=h.scanUntil(p),h.scan(fsr),h.scanUntil(f),g="&"):y=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?x=[g,y,b,h.pos,u,l,r]:x=[g,y,b,h.pos],l++,o.push(x),g==="#"||g==="^")n.push(x);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 gsr(hsr(o))}function hsr(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 gsr(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 J2(t){this.string=t,this.tail=t,this.pos=0}function oF(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function Lf(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var tsr,iF,osr,asr,usr,csr,dsr,CHe,fsr,psr,Ah,G2,VG,OHe=w(()=>{tsr=Object.prototype.toString,iF=Array.isArray||function(e){return tsr.call(e)==="[object Array]"};osr=RegExp.prototype.test;asr=/\S/;usr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};csr=/\s*/,dsr=/\s+/,CHe=/\s*=/,fsr=/\s*\}/,psr=/#|\^|\/|>|\{|&|=|!/;J2.prototype.eos=function(){return this.tail===""};J2.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};J2.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};oF.prototype.push=function(e){return new oF(e,this)};oF.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=xHe(i,a[s])||nsr(i,a[s])),i=i[a[s++]];else i=o.view[e],u=xHe(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return yhe(n)&&(n=n.call(this.view)),n};Lf.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};Lf.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||Ah.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=msr(e,r),i&&n.set(o,a)),a};Lf.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof oF?r:new oF(r,void 0);return this.renderTokens(a,s,n,e,o)};Lf.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};Lf.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(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(yhe(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}};Lf.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||iF(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};Lf.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(`
`)};Lf.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=yhe(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)}}};Lf.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};Lf.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Ah.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Ah.escape?String(i):o(i)};Lf.prototype.rawValue=function(e){return e[1]};Lf.prototype.getConfigTags=function(e){return iF(e)?e:e&&typeof e=="object"?e.tags:void 0};Lf.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!iF(e))return e.escape};Ah={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){G2.templateCache=t},get templateCache(){return G2.templateCache}},G2=new Lf;Ah.clearCache=function(){return G2.clearCache()};Ah.parse=function(e,r){return G2.parse(e,r)};Ah.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+rsr(e)+'" was given as the first argument for mustache#render(template, view, partials)');return G2.render(e,r,n,o)};Ah.escape=lsr;Ah.Scanner=J2;Ah.Context=oF;Ah.Writer=Lf;VG=Ah});function PHe(){VG.escape=t=>t}var Y2,ysr,WG,bsr,_sr,bhe,vsr,Sp,Z2,IR,MR=w(()=>{OHe();I2();Y2=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},ysr=t=>t.map(e=>e[0]==="name"?{type:"variable",name:e[1].includes(".")?e[1].split(".")[0]:e[1]}:["#","&","^",">"].includes(e[0])?{type:"variable",name:e[1]}:{type:"literal",text:e[1]}),WG=t=>{PHe();let e=VG.parse(t);return ysr(e)},bsr=(t,e)=>Y2(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},""),_sr=(t,e)=>(PHe(),VG.render(t,e)),bhe={"f-string":bsr,mustache:_sr},vsr={"f-string":Y2,mustache:WG},Sp=(t,e,r)=>{try{return bhe[e](t,r)}catch(n){throw ME(n,"INVALID_PROMPT_INPUT")}},Z2=(t,e)=>vsr[e](t),IR=(t,e,r)=>{if(!(e in bhe)){let n=Object.keys(bhe);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")Sp(o.text,e,n);else if(o.type==="image_url")if(typeof o.image_url=="string")Sp(o.image_url,e,n);else{let i=o.image_url.url;Sp(i,e,n)}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Sp(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var _he={};Cf(_he,{PromptTemplate:()=>Dd});var Dd,aF=w(()=>{K2();MR();Dd=class t extends jC{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))),IR(this.template,this.templateFormat,r)}}_getPromptType(){return"prompt"}async format(e){let r=await this.mergePartialAndUserVariables(e);return Sp(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 Z2(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 sF,vhe=w(()=>{W2();nF();MR();sF=class t extends Kb{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))),IR([{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]=Sp(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 HG(r)}}});function whe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")Z2(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?Z2(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...whe(o,e));else typeof n=="object"&&n!==null&&r.push(...whe(n,e));return Array.from(new Set(r))}function She(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Sp(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Sp(s,r,e)):typeof s=="object"&&a.push(She(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=She(i,e,r):n[o]=i;return n}var X2,xhe=w(()=>{Df();MR();X2=class extends xn{static lc_name(){return"DictPromptTemplate"}constructor(e){let r=e.templateFormat??"f-string",n=whe(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 She(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function wsr(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function Ssr(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 xsr(t){return typeof t.formatMessages=="function"}function Csr(t,e){if(xsr(t)||Ph(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 Gb({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new Gb({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=fy(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 Jb.fromTemplate(n,e);if(r._getType()==="ai")return Phe.fromTemplate(n,e);if(r._getType()==="system")return BE.fromTemplate(n,e);if(Cs.isInstance(r))return Ohe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function Osr(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var Q2,Gb,Che,e4,Ohe,t4,Jb,Phe,BE,xp,r4=w(()=>{OR();W2();Df();K2();nF();aF();vhe();MR();I2();xhe();Q2=class extends xn{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"})}},Gb=class extends Q2{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(fy):n=[fy(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}},Che=class extends Q2{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)]}},e4=class extends Kb{constructor(e){super(e)}async format(e){return(await this.formatPromptValue(e)).toString()}async formatPromptValue(e){let r=await this.formatMessages(e);return new rF(r)}},Ohe=class extends Che{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 Cs(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(Dd.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};t4=class extends Q2{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(Dd.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(Dd.fromTemplate(o,r));else if(o!==null)if(wsr(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(Dd.fromTemplate(i,a))}else if(Ssr(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=WG(i):u=Y2(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 sF({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=WG(i.url):u=Y2(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new sF({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 X2({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof jC){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 jC){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),r.push({...a,type:"text",text:i})}else if(n instanceof sF){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 X2){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)]}},Jb=class extends t4{static _messageClass(){return Os}static lc_name(){return"HumanMessagePromptTemplate"}},Phe=class extends t4{static _messageClass(){return gn}static lc_name(){return"AIMessagePromptTemplate"}},BE=class extends t4{static _messageClass(){return EC}static lc_name(){return"SystemMessagePromptTemplate"}};xp=class t extends e4{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 Sl))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 Dd.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 Sl)n.push(await this._parseImagePrompts(o,r));else{let i=o.inputVariables.reduce((s,u)=>{if(!(u in r)&&!(Osr(o)&&o.optional))throw ME(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=Dd.fromTemplate(e,r),o=new Jb({prompt:n});return this.fromMessages([o])}static fromMessages(e,r){let n=e.reduce((a,s)=>a.concat(s instanceof t?s.promptMessages:[Csr(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 Sl))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 EHe={};Cf(EHe,{FewShotChatMessagePromptTemplate:()=>The,FewShotPromptTemplate:()=>Ehe});var Ehe,The,Ahe=w(()=>{K2();MR();aF();r4();Ehe=class t extends jC{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))),IR(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 Sp(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 Dd.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})}},The=class t extends e4{_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))),IR(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 Sp(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 Kb,nF=w(()=>{Df();Kb=class extends xn{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(()=>(aF(),_he));return r.deserialize(e)}case void 0:{let{PromptTemplate:r}=await Promise.resolve().then(()=>(aF(),_he));return r.deserialize({...e,_type:"prompt"})}case"few_shot":{let{FewShotPromptTemplate:r}=await Promise.resolve().then(()=>(Ahe(),EHe));return r.deserialize(e)}default:throw new Error(`Invalid prompt type in config: ${e._type}`)}}}});var THe=w(()=>{nF();r4()});var AHe=w(()=>{});var IHe=w(()=>{r4()});var MHe=w(()=>{nF();r4();Ahe();THe();aF();AHe();K2();MR();vhe();IHe();xhe()});var qE=w(()=>{MHe()});var Sm=w(()=>{uhe()});var Ihe,Mhe=w(()=>{Ihe=t=>t.map(e=>e.pageContent).join(`
`)});var RHe=w(()=>{Mhe()});function Ih(t,e){let r=`atom${++Psr}`,n={toString(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Esr,n.write=Tsr),e&&(n.write=e),n}function Esr(t){return t(this)}function Tsr(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Sa,Psr,jHe,Rhe,jhe,GG,Dhe,Asr,Isr,Lhe,NHe,KG,FHe,DHe,uF,Nhe,Msr,Rsr,LHe,UE,kHe,lF,n4,$He,Fhe=w(()=>{Sa={},Psr=0;jHe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Rhe=t=>"init"in t,jhe=t=>!!t.write,GG=new WeakMap,Dhe=t=>{var e;return Lhe(t)&&!((e=GG.get(t))!=null&&e[1])},Asr=(t,e)=>{let r=GG.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Sa.env?Sa.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Isr=t=>{if(GG.has(t))return;let e=[new Set,!1];GG.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Lhe=t=>typeof t?.then=="function",NHe=t=>"v"in t||"e"in t,KG=t=>{if("e"in t)throw t.e;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},FHe=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},DHe=(t,e,r,n,o)=>{var i;if((Sa.env?Sa.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),Dhe(r.v)&&FHe(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&Msr(t,n,e)},uF=()=>[new Map,new Map,new Set],Nhe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},Msr=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},Rsr=(t,e)=>t[0].get(e),LHe=(t,e)=>{t[2].add(e)},UE=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},kHe=(...[t,e,r,n])=>{let o;(Sa.env?Sa.env.MODE:void 0)!=="production"&&(o=new Set);let i=(S,x,O)=>{let P="v"in x,E=x.v,A=Dhe(x.v)?x.v:null;if(Lhe(O)){Isr(O);for(let I of x.d.keys())FHe(S,O,t(I));x.v=O,delete x.e}else x.v=O,delete x.e;(!P||!Object.is(E,x.v))&&(++x.n,A&&Asr(A,O))},a=(S,x,O)=>{var P;let E=t(x);if(NHe(E)&&(E.m&&!O?.has(x)||Array.from(E.d).every(([$,k])=>a(S,$,O).n===k)))return E;E.d.clear();let A=!0,I=$=>{if(jHe(x,$)){let z=t($);if(!NHe(z))if(Rhe($))i($,z,$.init);else throw new Error("no atom init");return KG(z)}let k=a(S,$,O);try{return KG(k)}finally{if(A)DHe(S,x,E,$,k);else{let z=uF();DHe(z,x,E,$,k),p(z,x,E),UE(z)}}},R,N,j={get signal(){return R||(R=new AbortController),R.signal},get setSelf(){return(Sa.env?Sa.env.MODE:void 0)!=="production"&&!jhe(x)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&jhe(x)&&(N=(...$)=>{if((Sa.env?Sa.env.MODE:void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)return f(x,...$)}),N}};try{let $=e(x,I,j);if(i(x,E,$),Lhe($)){(P=$.onCancel)==null||P.call($,()=>R?.abort());let k=()=>{if(E.m){let z=uF();p(z,x,E),UE(z)}};$.then(k,k)}return E}catch($){return delete E.v,E.e=$,++E.n,E}finally{A=!1}},s=S=>KG(a(void 0,S)),u=(S,x,O)=>{var P,E;let A=new Map;for(let I of((P=O.m)==null?void 0:P.t)||[])A.set(I,t(I));for(let I of O.p)A.set(I,t(I));return(E=Rsr(S,x))==null||E.forEach(I=>{A.set(I,t(I))}),A};function l(S,x,O){let P=[],E=new Set,A=new Set,I=[[x,O]];for(;I.length>0;){let[R,N]=I[I.length-1];if(A.has(R)){I.pop();continue}if(E.has(R)){P.push([R,N,N.n]),A.add(R),I.pop();continue}E.add(R);for(let[j,$]of u(S,R,N))R!==j&&!E.has(j)&&I.push([j,$])}return[P,A]}let c=(S,x,O)=>{let[P,E]=l(S,x,O),A=new Set([x]);for(let I=P.length-1;I>=0;--I){let[R,N,j]=P[I],$=!1;for(let k of N.d.keys())if(k!==R&&A.has(k)){$=!0;break}$&&(a(S,R,E),p(S,R,N),j!==N.n&&(Nhe(S,R,N),A.add(R))),E.delete(R)}},d=(S,x,...O)=>{let P=!0,E=I=>KG(a(S,I)),A=(I,...R)=>{let N=t(I);try{if(jHe(x,I)){if(!Rhe(I))throw new Error("atom not writable");let j=N.n,$=R[0];i(I,N,$),p(S,I,N),j!==N.n&&(Nhe(S,I,N),c(S,I,N));return}else return d(S,I,...R)}finally{P||UE(S)}};try{return r(x,E,A,...O)}finally{P=!1}},f=(S,...x)=>{let O=uF();try{return d(O,S,...x)}finally{UE(O)}},p=(S,x,O)=>{if(O.m&&!Dhe(O.v)){for(let P of O.d.keys())O.m.d.has(P)||(m(S,P,t(P)).t.add(x),O.m.d.add(P));for(let P of O.m.d||[])if(!O.d.has(P)){O.m.d.delete(P);let E=h(S,P,t(P));E?.t.delete(x)}}},m=(S,x,O)=>{if(!O.m){a(S,x);for(let P of O.d.keys())m(S,P,t(P)).t.add(x);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.add(x),jhe(x)){let P=O.m,E,A=(I,R)=>{let N=!0;E=(...j)=>{try{return d(I,x,...j)}finally{N||UE(I)}};try{return R()}finally{N=!1}};LHe(S,()=>{let I=A(S,()=>n(x,(...R)=>E(...R)));I&&(P.u=R=>A(R,I))})}}return O.m},h=(S,x,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(P=>{var E;return(E=t(P).m)==null?void 0:E.d.has(x)})){let P=O.m.u;P&&LHe(S,()=>P(S)),delete O.m,(Sa.env?Sa.env.MODE:void 0)!=="production"&&o.delete(x);for(let E of O.d.keys()){let A=h(S,E,t(E));A?.t.delete(x)}return}return O.m},y={get:s,set:f,sub:(S,x)=>{let O=uF(),P=t(S),A=m(O,S,P).l;return A.add(x),UE(O),()=>{A.delete(x);let I=uF();h(I,S,P),UE(I)}},unstable_derive:S=>kHe(...S(t,e,r,n))};return(Sa.env?Sa.env.MODE:void 0)!=="production"&&Object.assign(y,{dev4_get_internal_weak_map:()=>({get:x=>{let O=t(x);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let O=uF();for(let[P,E]of x)if(Rhe(P)){let A=t(P),I=A.n;i(P,A,E),p(O,P,A),I!==A.n&&(Nhe(O,P,A),c(O,P,A))}UE(O)}}),y},lF=()=>{let t=new WeakMap;return kHe(r=>{if((Sa.env?Sa.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)})},$He=()=>(n4||(n4=lF(),(Sa.env?Sa.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=n4),globalThis.__JOTAI_DEFAULT_STORE__!==n4&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),n4)});var YHe=v(Mn=>{"use strict";var o4=Symbol.for("react.element"),jsr=Symbol.for("react.portal"),Nsr=Symbol.for("react.fragment"),Dsr=Symbol.for("react.strict_mode"),Lsr=Symbol.for("react.profiler"),Fsr=Symbol.for("react.provider"),ksr=Symbol.for("react.context"),$sr=Symbol.for("react.forward_ref"),Bsr=Symbol.for("react.suspense"),qsr=Symbol.for("react.memo"),Usr=Symbol.for("react.lazy"),BHe=Symbol.iterator;function zsr(t){return t===null||typeof t!="object"?null:(t=BHe&&t[BHe]||t["@@iterator"],typeof t=="function"?t:null)}var zHe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},HHe=Object.assign,VHe={};function cF(t,e,r){this.props=t,this.context=e,this.refs=VHe,this.updater=r||zHe}cF.prototype.isReactComponent={};cF.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")};cF.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function WHe(){}WHe.prototype=cF.prototype;function $he(t,e,r){this.props=t,this.context=e,this.refs=VHe,this.updater=r||zHe}var Bhe=$he.prototype=new WHe;Bhe.constructor=$he;HHe(Bhe,cF.prototype);Bhe.isPureReactComponent=!0;var qHe=Array.isArray,KHe=Object.prototype.hasOwnProperty,qhe={current:null},GHe={key:!0,ref:!0,__self:!0,__source:!0};function JHe(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)KHe.call(e,n)&&!GHe.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:o4,type:t,key:i,ref:a,props:o,_owner:qhe.current}}function Hsr(t,e){return{$$typeof:o4,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Uhe(t){return typeof t=="object"&&t!==null&&t.$$typeof===o4}function Vsr(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var UHe=/\/+/g;function khe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Vsr(""+t.key):e.toString(36)}function YG(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 o4:case jsr:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+khe(a,0):n,qHe(o)?(r="",t!=null&&(r=t.replace(UHe,"$&/")+"/"),YG(o,e,r,"",function(l){return l})):o!=null&&(Uhe(o)&&(o=Hsr(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(UHe,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",qHe(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+khe(i,s);a+=YG(i,e,r,u,o)}else if(u=zsr(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+khe(i,s++),a+=YG(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 JG(t,e,r){if(t==null)return t;var n=[],o=0;return YG(t,n,"","",function(i){return e.call(r,i,o++)}),n}function Wsr(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 Ff={current:null},ZG={transition:null},Ksr={ReactCurrentDispatcher:Ff,ReactCurrentBatchConfig:ZG,ReactCurrentOwner:qhe};Mn.Children={map:JG,forEach:function(t,e,r){JG(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return JG(t,function(){e++}),e},toArray:function(t){return JG(t,function(e){return e})||[]},only:function(t){if(!Uhe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Mn.Component=cF;Mn.Fragment=Nsr;Mn.Profiler=Lsr;Mn.PureComponent=$he;Mn.StrictMode=Dsr;Mn.Suspense=Bsr;Mn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ksr;Mn.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=HHe({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=qhe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)KHe.call(e,u)&&!GHe.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:o4,type:t.type,key:o,ref:i,props:n,_owner:a}};Mn.createContext=function(t){return t={$$typeof:ksr,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Fsr,_context:t},t.Consumer=t};Mn.createElement=JHe;Mn.createFactory=function(t){var e=JHe.bind(null,t);return e.type=t,e};Mn.createRef=function(){return{current:null}};Mn.forwardRef=function(t){return{$$typeof:$sr,render:t}};Mn.isValidElement=Uhe;Mn.lazy=function(t){return{$$typeof:Usr,_payload:{_status:-1,_result:t},_init:Wsr}};Mn.memo=function(t,e){return{$$typeof:qsr,type:t,compare:e===void 0?null:e}};Mn.startTransition=function(t){var e=ZG.transition;ZG.transition={};try{t()}finally{ZG.transition=e}};Mn.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Mn.useCallback=function(t,e){return Ff.current.useCallback(t,e)};Mn.useContext=function(t){return Ff.current.useContext(t)};Mn.useDebugValue=function(){};Mn.useDeferredValue=function(t){return Ff.current.useDeferredValue(t)};Mn.useEffect=function(t,e){return Ff.current.useEffect(t,e)};Mn.useId=function(){return Ff.current.useId()};Mn.useImperativeHandle=function(t,e,r){return Ff.current.useImperativeHandle(t,e,r)};Mn.useInsertionEffect=function(t,e){return Ff.current.useInsertionEffect(t,e)};Mn.useLayoutEffect=function(t,e){return Ff.current.useLayoutEffect(t,e)};Mn.useMemo=function(t,e){return Ff.current.useMemo(t,e)};Mn.useReducer=function(t,e,r){return Ff.current.useReducer(t,e,r)};Mn.useRef=function(t){return Ff.current.useRef(t)};Mn.useState=function(t){return Ff.current.useState(t)};Mn.useSyncExternalStore=function(t,e,r){return Ff.current.useSyncExternalStore(t,e,r)};Mn.useTransition=function(){return Ff.current.useTransition()};Mn.version="18.2.0"});var X=v((QUn,ZHe)=>{"use strict";ZHe.exports=YHe()});function i4(t,e){let r=QHe(e),[[n,o,i],a]=(0,Ld.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,Ld.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);Hhe(c)&&eVe(XHe(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Ld.useDebugValue)(s),Hhe(s)){let l=XHe(s);return Jsr(l)}return s}function Ysr(t,e){let r=QHe(e);return(0,Ld.useCallback)((...o)=>{if((XG.env?XG.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function a4(t,e){return[i4(t,e),Ysr(t,e)]}var Ld,XG,Gsr,QHe,Hhe,eVe,Jsr,zhe,XHe,tVe=w(()=>{"use client";Ld=F(X(),1);Fhe();XG={},Gsr=(0,Ld.createContext)(void 0),QHe=t=>{let e=(0,Ld.useContext)(Gsr);return t?.store||e||$He()},Hhe=t=>typeof t?.then=="function",eVe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Jsr=Ld.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(eVe(t),t)}),zhe=new WeakMap,XHe=t=>{let e=zhe.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((XG.env?XG.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");Hhe(l)?(zhe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),zhe.set(t,e)),e}});var s4=w(()=>{Fhe();tVe()});function zE(t){let e=Zsr({...ue(),...t});ls.set(RR,e)}function dt(t,e){let r=ue();zE({...r,[t]:e})}function ue(){return ls.get(RR)}function nVe(){let t={...Ic,activeModels:Zb.map(e=>({...e,enabled:!0})),activeEmbeddingModels:jR.map(e=>({...e,enabled:!0}))};zE(t)}function xa(t){let e=ue();return ls.sub(RR,()=>{let r=ue();t(e,r),e=r})}function Rn(){return i4(RR,{store:ls})}function oVe(t){let e=t||Ic;e.userId||(e.userId=yC()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(u=>({...u,provider:u.provider==="azure_openai"?"azure openai":u.provider})):e.activeEmbeddingModels=jR.map(u=>({...u,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Ic.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Ic.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Ic.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Ic.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);return r.embeddingBatchSize=isNaN(s)?Ic.embeddingBatchSize:s,typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=Ic.includeActiveNoteAsContext),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Ic.passMarkdownImages),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Ic.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=Ic.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=Ic.enableWordCompletion),r}function iVe(){return ue().isPlusUser?sVe:""}function Yb(){let t=ue().userSystemPrompt,e=aVe;return t?`${e}
<user_custom_instructions>
${t}
</user_custom_instructions>`:e}function Zsr(t){return t.activeModels=rVe(t.activeModels,Zb),t.activeEmbeddingModels=rVe(t.activeEmbeddingModels,jR),t}function kr(t){return`${t.name}|${t.provider}`}function rVe(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(kr(n),{...n})}),t.forEach(n=>{let o=kr(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 ls,RR,nr=w(()=>{s4();l2();$r();ls=lF(),RR=Ih(Ic)});function ie(...t){ue().debug&&console.log(...t)}function fe(...t){ue().debug&&console.error(...t)}function Mh(...t){ue().debug&&console.warn(...t)}var yo=w(()=>{nr()});var uVe=v((Vhe,dF)=>{(function(t,e){typeof Vhe=="object"&&typeof dF<"u"?dF.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(Vhe,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 zqe(_,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=[],S=!1;function x(_,C){var T,M,L,Z=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),Z>0)for(T=0;T<Z;T++)M=y[T],L=C[M],s(L)||(_[M]=L);return _}function O(_){x(this,_),this._d=new Date(_._d!=null?_._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),S===!1&&(S=!0,e.updateOffset(this),S=!1)}function P(_){return _ instanceof O||_!=null&&_._isAMomentObject!=null}function E(_){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,Z,he,tr=arguments.length;for(Z=0;Z<tr;Z++){if(L="",typeof arguments[Z]=="object"){L+=`
[`+Z+"] ";for(he in arguments[0])i(arguments[0],he)&&(L+=he+": "+arguments[0][he]+", ");L=L.slice(0,-2)}else L=arguments[Z];M.push(L)}E(_+`
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[_]||(E(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 z;Object.keys?z=Object.keys:z=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 J(_,C,T){var M=""+Math.abs(_),L=C-M.length,Z=_>=0;return(Z?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,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,q={},K={};function H(_,C,T,M){var L=M;typeof M=="string"&&(L=function(){return this[M]()}),_&&(K[_]=L),C&&(K[C[0]]=function(){return J(L.apply(this,arguments),C[1],C[2])}),T&&(K[T]=function(){return this.localeData().ordinal(L.apply(this,arguments),_)})}function ee(_){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]=ee(C[T]);return function(L){var Z="",he;for(he=0;he<M;he++)Z+=N(C[he])?C[he].call(L,_):C[he];return Z}}function W(_,C){return _.isValid()?(C=Y(C,_.localeData()),q[C]=q[C]||U(C),q[C](_)):_.localeData().invalidDate()}function Y(_,C){var T=5;function M(L){return C.longDateFormat(L)||L}for(B.lastIndex=0;T>=0&&B.test(_);)_=_.replace(B,M),B.lastIndex=0,T-=1;return _}var ae={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 Oe(_){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 le="Invalid date";function Be(){return this._invalidDate}var ze="%d",rt=/\d{1,2}/;function cr(_){return this._ordinal.replace("%d",_)}var wn={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 Le(_,C,T,M){var L=this._relativeTime[T];return N(L)?L(_,C,T,M):L.replace(/%d/i,_)}function pt(_,C){var T=this._relativeTime[_>0?"future":"past"];return N(T)?T(C):T.replace(/%s/i,C)}var mt={};function ht(_,C){var T=_.toLowerCase();mt[T]=mt[T+"s"]=mt[C]=_}function te(_){return typeof _=="string"?mt[_]||mt[_.toLowerCase()]:void 0}function et(_){var C={},T,M;for(M in _)i(_,M)&&(T=te(M),T&&(C[T]=_[M]));return C}var Re={};function Pe(_,C){Re[_]=C}function oe(_){var C=[],T;for(T in _)i(_,T)&&C.push({unit:T,priority:Re[T]});return C.sort(function(M,L){return M.priority-L.priority}),C}function se(_){return _%4===0&&_%100!==0||_%400===0}function ce(_){return _<0?Math.ceil(_)||0:Math.floor(_)}function Ce(_){var C=+_,T=0;return C!==0&&isFinite(C)&&(T=ce(C)),T}function Je(_,C){return function(T){return T!=null?(ea(this,_,T),e.updateOffset(this,C),this):ir(this,_)}}function ir(_,C){return _.isValid()?_._d["get"+(_._isUTC?"UTC":"")+C]():NaN}function ea(_,C,T){_.isValid()&&!isNaN(T)&&(C==="FullYear"&&se(_.year())&&_.month()===1&&_.date()===29?(T=Ce(T),_._d["set"+(_._isUTC?"UTC":"")+C](T,_.month(),iK(T,_.month()))):_._d["set"+(_._isUTC?"UTC":"")+C](T))}function ta(_){return _=te(_),N(this[_])?this[_]():this}function xc(_,C){if(typeof _=="object"){_=et(_);var T=oe(_),M,L=T.length;for(M=0;M<L;M++)this[T[M].unit](_[T[M].unit])}else if(_=te(_),N(this[_]))return this[_](C);return this}var Cd=/\d/,qi=/\d\d/,lp=/\d{3}/,yf=/\d{4}/,bf=/[+-]?\d{6}/,Sn=/\d\d?/,_f=/\d\d\d\d?/,sC=/\d\d\d\d\d\d?/,kb=/\d{1,3}/,is=/\d{1,4}/,$s=/[+-]?\d{1,6}/,La=/\d+/,vf=/[+-]?\d+/,Od=/Z|[+-]\d\d:?\d\d/gi,ws=/Z|[+-]\d\d(?::?\d\d)?/gi,cp=/[+-]?\d+(\.\d{1,3})?/,wf=/[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,In;In={};function Ye(_,C,T){In[_]=N(C)?C:function(M,L){return M&&T?T:C}}function Sf(_,C){return i(In,_)?In[_](C._strict,C._locale):new RegExp(mm(_))}function mm(_){return vl(_.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(C,T,M,L,Z){return T||M||L||Z}))}function vl(_){return _.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var uC={};function En(_,C){var T,M=C,L;for(typeof _=="string"&&(_=[_]),u(C)&&(M=function(Z,he){he[C]=Ce(Z)}),L=_.length,T=0;T<L;T++)uC[_[T]]=M}function uy(_,C){En(_,function(T,M,L,Z){L._w=L._w||{},C(T,L._w,L,Z)})}function t2(_,C,T){C!=null&&i(uC,_)&&uC[_](C,T._a,T,_)}var Pd=0,lC=1,$b=2,wl=3,ly=4,cC=5,KM=6,YYt=7,ZYt=8;function XYt(_,C){return(_%C+C)%C}var Ss;Array.prototype.indexOf?Ss=Array.prototype.indexOf:Ss=function(_){var C;for(C=0;C<this.length;++C)if(this[C]===_)return C;return-1};function iK(_,C){if(isNaN(_)||isNaN(C))return NaN;var T=XYt(C,12);return _+=(C-T)/12,T===1?se(_)?29:28:31-T%7%2}H("M",["MM",2],"Mo",function(){return this.month()+1}),H("MMM",0,0,function(_){return this.localeData().monthsShort(this,_)}),H("MMMM",0,0,function(_){return this.localeData().months(this,_)}),ht("month","M"),Pe("month",8),Ye("M",Sn),Ye("MM",Sn,qi),Ye("MMM",function(_,C){return C.monthsShortRegex(_)}),Ye("MMMM",function(_,C){return C.monthsRegex(_)}),En(["M","MM"],function(_,C){C[lC]=Ce(_)-1}),En(["MMM","MMMM"],function(_,C,T,M){var L=T._locale.monthsParse(_,M,T._strict);L!=null?C[lC]=L:m(T).invalidMonth=_});var QYt="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Tqe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Aqe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,eZt=wf,tZt=wf;function rZt(_,C){return _?n(this._months)?this._months[_.month()]:this._months[(this._months.isFormat||Aqe).test(C)?"format":"standalone"][_.month()]:n(this._months)?this._months:this._months.standalone}function nZt(_,C){return _?n(this._monthsShort)?this._monthsShort[_.month()]:this._monthsShort[Aqe.test(C)?"format":"standalone"][_.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function oZt(_,C,T){var M,L,Z,he=_.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],M=0;M<12;++M)Z=f([2e3,M]),this._shortMonthsParse[M]=this.monthsShort(Z,"").toLocaleLowerCase(),this._longMonthsParse[M]=this.months(Z,"").toLocaleLowerCase();return T?C==="MMM"?(L=Ss.call(this._shortMonthsParse,he),L!==-1?L:null):(L=Ss.call(this._longMonthsParse,he),L!==-1?L:null):C==="MMM"?(L=Ss.call(this._shortMonthsParse,he),L!==-1?L:(L=Ss.call(this._longMonthsParse,he),L!==-1?L:null)):(L=Ss.call(this._longMonthsParse,he),L!==-1?L:(L=Ss.call(this._shortMonthsParse,he),L!==-1?L:null))}function iZt(_,C,T){var M,L,Z;if(this._monthsParseExact)return oZt.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]&&(Z="^"+this.months(L,"")+"|^"+this.monthsShort(L,""),this._monthsParse[M]=new RegExp(Z.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 Iqe(_,C){var T;if(!_.isValid())return _;if(typeof C=="string"){if(/^\d+$/.test(C))C=Ce(C);else if(C=_.localeData().monthsParse(C),!u(C))return _}return T=Math.min(_.date(),iK(_.year(),C)),_._d["set"+(_._isUTC?"UTC":"")+"Month"](C,T),_}function Mqe(_){return _!=null?(Iqe(this,_),e.updateOffset(this,!0),this):ir(this,"Month")}function aZt(){return iK(this.year(),this.month())}function sZt(_){return this._monthsParseExact?(i(this,"_monthsRegex")||Rqe.call(this),_?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=eZt),this._monthsShortStrictRegex&&_?this._monthsShortStrictRegex:this._monthsShortRegex)}function uZt(_){return this._monthsParseExact?(i(this,"_monthsRegex")||Rqe.call(this),_?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=tZt),this._monthsStrictRegex&&_?this._monthsStrictRegex:this._monthsRegex)}function Rqe(){function _(he,tr){return tr.length-he.length}var C=[],T=[],M=[],L,Z;for(L=0;L<12;L++)Z=f([2e3,L]),C.push(this.monthsShort(Z,"")),T.push(this.months(Z,"")),M.push(this.months(Z,"")),M.push(this.monthsShort(Z,""));for(C.sort(_),T.sort(_),M.sort(_),L=0;L<12;L++)C[L]=vl(C[L]),T[L]=vl(T[L]);for(L=0;L<24;L++)M[L]=vl(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")}H("Y",0,0,function(){var _=this.year();return _<=9999?J(_,4):"+"+_}),H(0,["YY",2],0,function(){return this.year()%100}),H(0,["YYYY",4],0,"year"),H(0,["YYYYY",5],0,"year"),H(0,["YYYYYY",6,!0],0,"year"),ht("year","y"),Pe("year",1),Ye("Y",vf),Ye("YY",Sn,qi),Ye("YYYY",is,yf),Ye("YYYYY",$s,bf),Ye("YYYYYY",$s,bf),En(["YYYYY","YYYYYY"],Pd),En("YYYY",function(_,C){C[Pd]=_.length===2?e.parseTwoDigitYear(_):Ce(_)}),En("YY",function(_,C){C[Pd]=e.parseTwoDigitYear(_)}),En("Y",function(_,C){C[Pd]=parseInt(_,10)});function r2(_){return se(_)?366:365}e.parseTwoDigitYear=function(_){return Ce(_)+(Ce(_)>68?1900:2e3)};var jqe=Je("FullYear",!0);function lZt(){return se(this.year())}function cZt(_,C,T,M,L,Z,he){var tr;return _<100&&_>=0?(tr=new Date(_+400,C,T,M,L,Z,he),isFinite(tr.getFullYear())&&tr.setFullYear(_)):tr=new Date(_,C,T,M,L,Z,he),tr}function n2(_){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 aK(_,C,T){var M=7+C-T,L=(7+n2(_,0,M).getUTCDay()-C)%7;return-L+M-1}function Nqe(_,C,T,M,L){var Z=(7+T-M)%7,he=aK(_,M,L),tr=1+7*(C-1)+Z+he,an,Ci;return tr<=0?(an=_-1,Ci=r2(an)+tr):tr>r2(_)?(an=_+1,Ci=tr-r2(_)):(an=_,Ci=tr),{year:an,dayOfYear:Ci}}function o2(_,C,T){var M=aK(_.year(),C,T),L=Math.floor((_.dayOfYear()-M-1)/7)+1,Z,he;return L<1?(he=_.year()-1,Z=L+dC(he,C,T)):L>dC(_.year(),C,T)?(Z=L-dC(_.year(),C,T),he=_.year()+1):(he=_.year(),Z=L),{week:Z,year:he}}function dC(_,C,T){var M=aK(_,C,T),L=aK(_+1,C,T);return(r2(_)-M+L)/7}H("w",["ww",2],"wo","week"),H("W",["WW",2],"Wo","isoWeek"),ht("week","w"),ht("isoWeek","W"),Pe("week",5),Pe("isoWeek",5),Ye("w",Sn),Ye("ww",Sn,qi),Ye("W",Sn),Ye("WW",Sn,qi),uy(["w","ww","W","WW"],function(_,C,T,M){C[M.substr(0,1)]=Ce(_)});function dZt(_){return o2(_,this._week.dow,this._week.doy).week}var fZt={dow:0,doy:6};function pZt(){return this._week.dow}function mZt(){return this._week.doy}function hZt(_){var C=this.localeData().week(this);return _==null?C:this.add((_-C)*7,"d")}function gZt(_){var C=o2(this,1,4).week;return _==null?C:this.add((_-C)*7,"d")}H("d",0,"do","day"),H("dd",0,0,function(_){return this.localeData().weekdaysMin(this,_)}),H("ddd",0,0,function(_){return this.localeData().weekdaysShort(this,_)}),H("dddd",0,0,function(_){return this.localeData().weekdays(this,_)}),H("e",0,0,"weekday"),H("E",0,0,"isoWeekday"),ht("day","d"),ht("weekday","e"),ht("isoWeekday","E"),Pe("day",11),Pe("weekday",11),Pe("isoWeekday",11),Ye("d",Sn),Ye("e",Sn),Ye("E",Sn),Ye("dd",function(_,C){return C.weekdaysMinRegex(_)}),Ye("ddd",function(_,C){return C.weekdaysShortRegex(_)}),Ye("dddd",function(_,C){return C.weekdaysRegex(_)}),uy(["dd","ddd","dddd"],function(_,C,T,M){var L=T._locale.weekdaysParse(_,M,T._strict);L!=null?C.d=L:m(T).invalidWeekday=_}),uy(["d","e","E"],function(_,C,T,M){C[M]=Ce(_)});function yZt(_,C){return typeof _!="string"?_:isNaN(_)?(_=C.weekdaysParse(_),typeof _=="number"?_:null):parseInt(_,10)}function bZt(_,C){return typeof _=="string"?C.weekdaysParse(_)%7||7:isNaN(_)?null:_}function Ffe(_,C){return _.slice(C,7).concat(_.slice(0,C))}var _Zt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Dqe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),vZt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),wZt=wf,SZt=wf,xZt=wf;function CZt(_,C){var T=n(this._weekdays)?this._weekdays:this._weekdays[_&&_!==!0&&this._weekdays.isFormat.test(C)?"format":"standalone"];return _===!0?Ffe(T,this._week.dow):_?T[_.day()]:T}function OZt(_){return _===!0?Ffe(this._weekdaysShort,this._week.dow):_?this._weekdaysShort[_.day()]:this._weekdaysShort}function PZt(_){return _===!0?Ffe(this._weekdaysMin,this._week.dow):_?this._weekdaysMin[_.day()]:this._weekdaysMin}function EZt(_,C,T){var M,L,Z,he=_.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],M=0;M<7;++M)Z=f([2e3,1]).day(M),this._minWeekdaysParse[M]=this.weekdaysMin(Z,"").toLocaleLowerCase(),this._shortWeekdaysParse[M]=this.weekdaysShort(Z,"").toLocaleLowerCase(),this._weekdaysParse[M]=this.weekdays(Z,"").toLocaleLowerCase();return T?C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1?L:null):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null):(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null):C==="dddd"?(L=Ss.call(this._weekdaysParse,he),L!==-1||(L=Ss.call(this._shortWeekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):C==="ddd"?(L=Ss.call(this._shortWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._minWeekdaysParse,he),L!==-1?L:null)):(L=Ss.call(this._minWeekdaysParse,he),L!==-1||(L=Ss.call(this._weekdaysParse,he),L!==-1)?L:(L=Ss.call(this._shortWeekdaysParse,he),L!==-1?L:null))}function TZt(_,C,T){var M,L,Z;if(this._weekdaysParseExact)return EZt.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]||(Z="^"+this.weekdays(L,"")+"|^"+this.weekdaysShort(L,"")+"|^"+this.weekdaysMin(L,""),this._weekdaysParse[M]=new RegExp(Z.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 AZt(_){if(!this.isValid())return _!=null?this:NaN;var C=this._isUTC?this._d.getUTCDay():this._d.getDay();return _!=null?(_=yZt(_,this.localeData()),this.add(_-C,"d")):C}function IZt(_){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 MZt(_){if(!this.isValid())return _!=null?this:NaN;if(_!=null){var C=bZt(_,this.localeData());return this.day(this.day()%7?C:C-7)}else return this.day()||7}function RZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=wZt),this._weekdaysStrictRegex&&_?this._weekdaysStrictRegex:this._weekdaysRegex)}function jZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=SZt),this._weekdaysShortStrictRegex&&_?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function NZt(_){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||kfe.call(this),_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=xZt),this._weekdaysMinStrictRegex&&_?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function kfe(){function _(xf,gC){return gC.length-xf.length}var C=[],T=[],M=[],L=[],Z,he,tr,an,Ci;for(Z=0;Z<7;Z++)he=f([2e3,1]).day(Z),tr=vl(this.weekdaysMin(he,"")),an=vl(this.weekdaysShort(he,"")),Ci=vl(this.weekdays(he,"")),C.push(tr),T.push(an),M.push(Ci),L.push(tr),L.push(an),L.push(Ci);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 $fe(){return this.hours()%12||12}function DZt(){return this.hours()||24}H("H",["HH",2],0,"hour"),H("h",["hh",2],0,$fe),H("k",["kk",2],0,DZt),H("hmm",0,0,function(){return""+$fe.apply(this)+J(this.minutes(),2)}),H("hmmss",0,0,function(){return""+$fe.apply(this)+J(this.minutes(),2)+J(this.seconds(),2)}),H("Hmm",0,0,function(){return""+this.hours()+J(this.minutes(),2)}),H("Hmmss",0,0,function(){return""+this.hours()+J(this.minutes(),2)+J(this.seconds(),2)});function Lqe(_,C){H(_,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),C)})}Lqe("a",!0),Lqe("A",!1),ht("hour","h"),Pe("hour",13);function Fqe(_,C){return C._meridiemParse}Ye("a",Fqe),Ye("A",Fqe),Ye("H",Sn),Ye("h",Sn),Ye("k",Sn),Ye("HH",Sn,qi),Ye("hh",Sn,qi),Ye("kk",Sn,qi),Ye("hmm",_f),Ye("hmmss",sC),Ye("Hmm",_f),Ye("Hmmss",sC),En(["H","HH"],wl),En(["k","kk"],function(_,C,T){var M=Ce(_);C[wl]=M===24?0:M}),En(["a","A"],function(_,C,T){T._isPm=T._locale.isPM(_),T._meridiem=_}),En(["h","hh"],function(_,C,T){C[wl]=Ce(_),m(T).bigHour=!0}),En("hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M)),m(T).bigHour=!0}),En("hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[cC]=Ce(_.substr(L)),m(T).bigHour=!0}),En("Hmm",function(_,C,T){var M=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M))}),En("Hmmss",function(_,C,T){var M=_.length-4,L=_.length-2;C[wl]=Ce(_.substr(0,M)),C[ly]=Ce(_.substr(M,2)),C[cC]=Ce(_.substr(L))});function LZt(_){return(_+"").toLowerCase().charAt(0)==="p"}var FZt=/[ap]\.?m?\.?/i,kZt=Je("Hours",!0);function $Zt(_,C,T){return _>11?T?"pm":"PM":T?"am":"AM"}var kqe={calendar:V,longDateFormat:ae,invalidDate:le,ordinal:ze,dayOfMonthOrdinalParse:rt,relativeTime:wn,months:QYt,monthsShort:Tqe,week:fZt,weekdays:_Zt,weekdaysMin:vZt,weekdaysShort:Dqe,meridiemParse:FZt},wa={},i2={},a2;function BZt(_,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 $qe(_){return _&&_.toLowerCase().replace("_","-")}function qZt(_){for(var C=0,T,M,L,Z;C<_.length;){for(Z=$qe(_[C]).split("-"),T=Z.length,M=$qe(_[C+1]),M=M?M.split("-"):null;T>0;){if(L=sK(Z.slice(0,T).join("-")),L)return L;if(M&&M.length>=T&&BZt(Z,M)>=T-1)break;T--}C++}return a2}function UZt(_){return _.match("^[^/\\\\]*$")!=null}function sK(_){var C=null,T;if(wa[_]===void 0&&typeof dF<"u"&&dF&&dF.exports&&UZt(_))try{C=a2._abbr,T=require,T("./locale/"+_),wE(C)}catch{wa[_]=null}return wa[_]}function wE(_,C){var T;return _&&(s(C)?T=fC(_):T=Bfe(_,C),T?a2=T:typeof console<"u"&&console.warn&&console.warn("Locale "+_+" not found. Did you forget to load it?")),a2._abbr}function Bfe(_,C){if(C!==null){var T,M=kqe;if(C.abbr=_,wa[_]!=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=wa[_]._config;else if(C.parentLocale!=null)if(wa[C.parentLocale]!=null)M=wa[C.parentLocale]._config;else if(T=sK(C.parentLocale),T!=null)M=T._config;else return i2[C.parentLocale]||(i2[C.parentLocale]=[]),i2[C.parentLocale].push({name:_,config:C}),null;return wa[_]=new k($(M,C)),i2[_]&&i2[_].forEach(function(L){Bfe(L.name,L.config)}),wE(_),wa[_]}else return delete wa[_],null}function zZt(_,C){if(C!=null){var T,M,L=kqe;wa[_]!=null&&wa[_].parentLocale!=null?wa[_].set($(wa[_]._config,C)):(M=sK(_),M!=null&&(L=M._config),C=$(L,C),M==null&&(C.abbr=_),T=new k(C),T.parentLocale=wa[_],wa[_]=T),wE(_)}else wa[_]!=null&&(wa[_].parentLocale!=null?(wa[_]=wa[_].parentLocale,_===wE()&&wE(_)):wa[_]!=null&&delete wa[_]);return wa[_]}function fC(_){var C;if(_&&_._locale&&_._locale._abbr&&(_=_._locale._abbr),!_)return a2;if(!n(_)){if(C=sK(_),C)return C;_=[_]}return qZt(_)}function HZt(){return z(wa)}function qfe(_){var C,T=_._a;return T&&m(_).overflow===-2&&(C=T[lC]<0||T[lC]>11?lC:T[$b]<1||T[$b]>iK(T[Pd],T[lC])?$b:T[wl]<0||T[wl]>24||T[wl]===24&&(T[ly]!==0||T[cC]!==0||T[KM]!==0)?wl:T[ly]<0||T[ly]>59?ly:T[cC]<0||T[cC]>59?cC:T[KM]<0||T[KM]>999?KM:-1,m(_)._overflowDayOfYear&&(C<Pd||C>$b)&&(C=$b),m(_)._overflowWeeks&&C===-1&&(C=YYt),m(_)._overflowWeekday&&C===-1&&(C=ZYt),m(_).overflow=C),_}var VZt=/^\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)?)?$/,WZt=/^\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)?)?$/,KZt=/Z|[+-]\d\d(?::?\d\d)?/,uK=[["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]],Ufe=[["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/]],GZt=/^\/?Date\((-?\d+)/i,JZt=/^(?:(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}))$/,YZt={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 Bqe(_){var C,T,M=_._i,L=VZt.exec(M)||WZt.exec(M),Z,he,tr,an,Ci=uK.length,xf=Ufe.length;if(L){for(m(_).iso=!0,C=0,T=Ci;C<T;C++)if(uK[C][1].exec(L[1])){he=uK[C][0],Z=uK[C][2]!==!1;break}if(he==null){_._isValid=!1;return}if(L[3]){for(C=0,T=xf;C<T;C++)if(Ufe[C][1].exec(L[3])){tr=(L[2]||" ")+Ufe[C][0];break}if(tr==null){_._isValid=!1;return}}if(!Z&&tr!=null){_._isValid=!1;return}if(L[4])if(KZt.exec(L[4]))an="Z";else{_._isValid=!1;return}_._f=he+(tr||"")+(an||""),Hfe(_)}else _._isValid=!1}function ZZt(_,C,T,M,L,Z){var he=[XZt(_),Tqe.indexOf(C),parseInt(T,10),parseInt(M,10),parseInt(L,10)];return Z&&he.push(parseInt(Z,10)),he}function XZt(_){var C=parseInt(_,10);return C<=49?2e3+C:C<=999?1900+C:C}function QZt(_){return _.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function eXt(_,C,T){if(_){var M=Dqe.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 tXt(_,C,T){if(_)return YZt[_];if(C)return 0;var M=parseInt(T,10),L=M%100,Z=(M-L)/100;return Z*60+L}function qqe(_){var C=JZt.exec(QZt(_._i)),T;if(C){if(T=ZZt(C[4],C[3],C[2],C[5],C[6],C[7]),!eXt(C[1],T,_))return;_._a=T,_._tzm=tXt(C[8],C[9],C[10]),_._d=n2.apply(null,_._a),_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),m(_).rfc2822=!0}else _._isValid=!1}function rXt(_){var C=GZt.exec(_._i);if(C!==null){_._d=new Date(+C[1]);return}if(Bqe(_),_._isValid===!1)delete _._isValid;else return;if(qqe(_),_._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 TL(_,C,T){return _??C??T}function nXt(_){var C=new Date(e.now());return _._useUTC?[C.getUTCFullYear(),C.getUTCMonth(),C.getUTCDate()]:[C.getFullYear(),C.getMonth(),C.getDate()]}function zfe(_){var C,T,M=[],L,Z,he;if(!_._d){for(L=nXt(_),_._w&&_._a[$b]==null&&_._a[lC]==null&&oXt(_),_._dayOfYear!=null&&(he=TL(_._a[Pd],L[Pd]),(_._dayOfYear>r2(he)||_._dayOfYear===0)&&(m(_)._overflowDayOfYear=!0),T=n2(he,0,_._dayOfYear),_._a[lC]=T.getUTCMonth(),_._a[$b]=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[wl]===24&&_._a[ly]===0&&_._a[cC]===0&&_._a[KM]===0&&(_._nextDay=!0,_._a[wl]=0),_._d=(_._useUTC?n2:cZt).apply(null,M),Z=_._useUTC?_._d.getUTCDay():_._d.getDay(),_._tzm!=null&&_._d.setUTCMinutes(_._d.getUTCMinutes()-_._tzm),_._nextDay&&(_._a[wl]=24),_._w&&typeof _._w.d<"u"&&_._w.d!==Z&&(m(_).weekdayMismatch=!0)}}function oXt(_){var C,T,M,L,Z,he,tr,an,Ci;C=_._w,C.GG!=null||C.W!=null||C.E!=null?(Z=1,he=4,T=TL(C.GG,_._a[Pd],o2(ra(),1,4).year),M=TL(C.W,1),L=TL(C.E,1),(L<1||L>7)&&(an=!0)):(Z=_._locale._week.dow,he=_._locale._week.doy,Ci=o2(ra(),Z,he),T=TL(C.gg,_._a[Pd],Ci.year),M=TL(C.w,Ci.week),C.d!=null?(L=C.d,(L<0||L>6)&&(an=!0)):C.e!=null?(L=C.e+Z,(C.e<0||C.e>6)&&(an=!0)):L=Z),M<1||M>dC(T,Z,he)?m(_)._overflowWeeks=!0:an!=null?m(_)._overflowWeekday=!0:(tr=Nqe(T,M,L,Z,he),_._a[Pd]=tr.year,_._dayOfYear=tr.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Hfe(_){if(_._f===e.ISO_8601){Bqe(_);return}if(_._f===e.RFC_2822){qqe(_);return}_._a=[],m(_).empty=!0;var C=""+_._i,T,M,L,Z,he,tr=C.length,an=0,Ci,xf;for(L=Y(_._f,_._locale).match(D)||[],xf=L.length,T=0;T<xf;T++)Z=L[T],M=(C.match(Sf(Z,_))||[])[0],M&&(he=C.substr(0,C.indexOf(M)),he.length>0&&m(_).unusedInput.push(he),C=C.slice(C.indexOf(M)+M.length),an+=M.length),K[Z]?(M?m(_).empty=!1:m(_).unusedTokens.push(Z),t2(Z,M,_)):_._strict&&!M&&m(_).unusedTokens.push(Z);m(_).charsLeftOver=tr-an,C.length>0&&m(_).unusedInput.push(C),_._a[wl]<=12&&m(_).bigHour===!0&&_._a[wl]>0&&(m(_).bigHour=void 0),m(_).parsedDateParts=_._a.slice(0),m(_).meridiem=_._meridiem,_._a[wl]=iXt(_._locale,_._a[wl],_._meridiem),Ci=m(_).era,Ci!==null&&(_._a[Pd]=_._locale.erasConvertYear(Ci,_._a[Pd])),zfe(_),qfe(_)}function iXt(_,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 aXt(_){var C,T,M,L,Z,he,tr=!1,an=_._f.length;if(an===0){m(_).invalidFormat=!0,_._d=new Date(NaN);return}for(L=0;L<an;L++)Z=0,he=!1,C=x({},_),_._useUTC!=null&&(C._useUTC=_._useUTC),C._f=_._f[L],Hfe(C),b(C)&&(he=!0),Z+=m(C).charsLeftOver,Z+=m(C).unusedTokens.length*10,m(C).score=Z,tr?Z<M&&(M=Z,T=C):(M==null||Z<M||he)&&(M=Z,T=C,he&&(tr=!0));d(_,T||C)}function sXt(_){if(!_._d){var C=et(_._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)}),zfe(_)}}function uXt(_){var C=new O(qfe(Uqe(_)));return C._nextDay&&(C.add(1,"d"),C._nextDay=void 0),C}function Uqe(_){var C=_._i,T=_._f;return _._locale=_._locale||fC(_._l),C===null||T===void 0&&C===""?g({nullInput:!0}):(typeof C=="string"&&(_._i=C=_._locale.preparse(C)),P(C)?new O(qfe(C)):(l(C)?_._d=C:n(T)?aXt(_):T?Hfe(_):lXt(_),b(_)||(_._d=null),_))}function lXt(_){var C=_._i;s(C)?_._d=new Date(e.now()):l(C)?_._d=new Date(C.valueOf()):typeof C=="string"?rXt(_):n(C)?(_._a=c(C.slice(0),function(T){return parseInt(T,10)}),zfe(_)):o(C)?sXt(_):u(C)?_._d=new Date(C):e.createFromInputFallback(_)}function zqe(_,C,T,M,L){var Z={};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),Z._isAMomentObject=!0,Z._useUTC=Z._isUTC=L,Z._l=T,Z._i=_,Z._f=C,Z._strict=M,uXt(Z)}function ra(_,C,T,M){return zqe(_,C,T,M,!1)}var cXt=A("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var _=ra.apply(null,arguments);return this.isValid()&&_.isValid()?_<this?this:_:g()}),dXt=A("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var _=ra.apply(null,arguments);return this.isValid()&&_.isValid()?_>this?this:_:g()});function Hqe(_,C){var T,M;if(C.length===1&&n(C[0])&&(C=C[0]),!C.length)return ra();for(T=C[0],M=1;M<C.length;++M)(!C[M].isValid()||C[M][_](T))&&(T=C[M]);return T}function fXt(){var _=[].slice.call(arguments,0);return Hqe("isBefore",_)}function pXt(){var _=[].slice.call(arguments,0);return Hqe("isAfter",_)}var mXt=function(){return Date.now?Date.now():+new Date},s2=["year","quarter","month","week","day","hour","minute","second","millisecond"];function hXt(_){var C,T=!1,M,L=s2.length;for(C in _)if(i(_,C)&&!(Ss.call(s2,C)!==-1&&(_[C]==null||!isNaN(_[C]))))return!1;for(M=0;M<L;++M)if(_[s2[M]]){if(T)return!1;parseFloat(_[s2[M]])!==Ce(_[s2[M]])&&(T=!0)}return!0}function gXt(){return this._isValid}function yXt(){return cy(NaN)}function lK(_){var C=et(_),T=C.year||0,M=C.quarter||0,L=C.month||0,Z=C.week||C.isoWeek||0,he=C.day||0,tr=C.hour||0,an=C.minute||0,Ci=C.second||0,xf=C.millisecond||0;this._isValid=hXt(C),this._milliseconds=+xf+Ci*1e3+an*6e4+tr*1e3*60*60,this._days=+he+Z*7,this._months=+L+M*3+T*12,this._data={},this._locale=fC(),this._bubble()}function cK(_){return _ instanceof lK}function Vfe(_){return _<0?Math.round(-1*_)*-1:Math.round(_)}function bXt(_,C,T){var M=Math.min(_.length,C.length),L=Math.abs(_.length-C.length),Z=0,he;for(he=0;he<M;he++)(T&&_[he]!==C[he]||!T&&Ce(_[he])!==Ce(C[he]))&&Z++;return Z+L}function Vqe(_,C){H(_,0,0,function(){var T=this.utcOffset(),M="+";return T<0&&(T=-T,M="-"),M+J(~~(T/60),2)+C+J(~~T%60,2)})}Vqe("Z",":"),Vqe("ZZ",""),Ye("Z",ws),Ye("ZZ",ws),En(["Z","ZZ"],function(_,C,T){T._useUTC=!0,T._tzm=Wfe(ws,_)});var _Xt=/([\+\-]|\d\d)/gi;function Wfe(_,C){var T=(C||"").match(_),M,L,Z;return T===null?null:(M=T[T.length-1]||[],L=(M+"").match(_Xt)||["-",0,0],Z=+(L[1]*60)+Ce(L[2]),Z===0?0:L[0]==="+"?Z:-Z)}function Kfe(_,C){var T,M;return C._isUTC?(T=C.clone(),M=(P(_)||l(_)?_.valueOf():ra(_).valueOf())-T.valueOf(),T._d.setTime(T._d.valueOf()+M),e.updateOffset(T,!1),T):ra(_).local()}function Gfe(_){return-Math.round(_._d.getTimezoneOffset())}e.updateOffset=function(){};function vXt(_,C,T){var M=this._offset||0,L;if(!this.isValid())return _!=null?this:NaN;if(_!=null){if(typeof _=="string"){if(_=Wfe(ws,_),_===null)return this}else Math.abs(_)<16&&!T&&(_=_*60);return!this._isUTC&&C&&(L=Gfe(this)),this._offset=_,this._isUTC=!0,L!=null&&this.add(L,"m"),M!==_&&(!C||this._changeInProgress?Jqe(this,cy(_-M,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?M:Gfe(this)}function wXt(_,C){return _!=null?(typeof _!="string"&&(_=-_),this.utcOffset(_,C),this):-this.utcOffset()}function SXt(_){return this.utcOffset(0,_)}function xXt(_){return this._isUTC&&(this.utcOffset(0,_),this._isUTC=!1,_&&this.subtract(Gfe(this),"m")),this}function CXt(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var _=Wfe(Od,this._i);_!=null?this.utcOffset(_):this.utcOffset(0,!0)}return this}function OXt(_){return this.isValid()?(_=_?ra(_).utcOffset():0,(this.utcOffset()-_)%60===0):!1}function PXt(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function EXt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var _={},C;return x(_,this),_=Uqe(_),_._a?(C=_._isUTC?f(_._a):ra(_._a),this._isDSTShifted=this.isValid()&&bXt(_._a,C.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function TXt(){return this.isValid()?!this._isUTC:!1}function AXt(){return this.isValid()?this._isUTC:!1}function Wqe(){return this.isValid()?this._isUTC&&this._offset===0:!1}var IXt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,MXt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function cy(_,C){var T=_,M=null,L,Z,he;return cK(_)?T={ms:_._milliseconds,d:_._days,M:_._months}:u(_)||!isNaN(+_)?(T={},C?T[C]=+_:T.milliseconds=+_):(M=IXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:0,d:Ce(M[$b])*L,h:Ce(M[wl])*L,m:Ce(M[ly])*L,s:Ce(M[cC])*L,ms:Ce(Vfe(M[KM]*1e3))*L}):(M=MXt.exec(_))?(L=M[1]==="-"?-1:1,T={y:GM(M[2],L),M:GM(M[3],L),w:GM(M[4],L),d:GM(M[5],L),h:GM(M[6],L),m:GM(M[7],L),s:GM(M[8],L)}):T==null?T={}:typeof T=="object"&&("from"in T||"to"in T)&&(he=RXt(ra(T.from),ra(T.to)),T={},T.ms=he.milliseconds,T.M=he.months),Z=new lK(T),cK(_)&&i(_,"_locale")&&(Z._locale=_._locale),cK(_)&&i(_,"_isValid")&&(Z._isValid=_._isValid),Z}cy.fn=lK.prototype,cy.invalid=yXt;function GM(_,C){var T=_&&parseFloat(_.replace(",","."));return(isNaN(T)?0:T)*C}function Kqe(_,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 RXt(_,C){var T;return _.isValid()&&C.isValid()?(C=Kfe(C,_),_.isBefore(C)?T=Kqe(_,C):(T=Kqe(C,_),T.milliseconds=-T.milliseconds,T.months=-T.months),T):{milliseconds:0,months:0}}function Gqe(_,C){return function(T,M){var L,Z;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."),Z=T,T=M,M=Z),L=cy(T,M),Jqe(this,L,_),this}}function Jqe(_,C,T,M){var L=C._milliseconds,Z=Vfe(C._days),he=Vfe(C._months);_.isValid()&&(M=M??!0,he&&Iqe(_,ir(_,"Month")+he*T),Z&&ea(_,"Date",ir(_,"Date")+Z*T),L&&_._d.setTime(_._d.valueOf()+L*T),M&&e.updateOffset(_,Z||he))}var jXt=Gqe(1,"add"),NXt=Gqe(-1,"subtract");function Yqe(_){return typeof _=="string"||_ instanceof String}function DXt(_){return P(_)||l(_)||Yqe(_)||u(_)||FXt(_)||LXt(_)||_===null||_===void 0}function LXt(_){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,Z,he=M.length;for(L=0;L<he;L+=1)Z=M[L],T=T||i(_,Z);return C&&T}function FXt(_){var C=n(_),T=!1;return C&&(T=_.filter(function(M){return!u(M)&&Yqe(_)}).length===0),C&&T}function kXt(_){var C=o(_)&&!a(_),T=!1,M=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],L,Z;for(L=0;L<M.length;L+=1)Z=M[L],T=T||i(_,Z);return C&&T}function $Xt(_,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 BXt(_,C){arguments.length===1&&(arguments[0]?DXt(arguments[0])?(_=arguments[0],C=void 0):kXt(arguments[0])&&(C=arguments[0],_=void 0):(_=void 0,C=void 0));var T=_||ra(),M=Kfe(T,this).startOf("day"),L=e.calendarFormat(this,M)||"sameElse",Z=C&&(N(C[L])?C[L].call(this,T):C[L]);return this.format(Z||this.localeData().calendar(L,this,ra(T)))}function qXt(){return new O(this)}function UXt(_,C){var T=P(_)?_:ra(_);return this.isValid()&&T.isValid()?(C=te(C)||"millisecond",C==="millisecond"?this.valueOf()>T.valueOf():T.valueOf()<this.clone().startOf(C).valueOf()):!1}function zXt(_,C){var T=P(_)?_:ra(_);return this.isValid()&&T.isValid()?(C=te(C)||"millisecond",C==="millisecond"?this.valueOf()<T.valueOf():this.clone().endOf(C).valueOf()<T.valueOf()):!1}function HXt(_,C,T,M){var L=P(_)?_:ra(_),Z=P(C)?C:ra(C);return this.isValid()&&L.isValid()&&Z.isValid()?(M=M||"()",(M[0]==="("?this.isAfter(L,T):!this.isBefore(L,T))&&(M[1]===")"?this.isBefore(Z,T):!this.isAfter(Z,T))):!1}function VXt(_,C){var T=P(_)?_:ra(_),M;return this.isValid()&&T.isValid()?(C=te(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 WXt(_,C){return this.isSame(_,C)||this.isAfter(_,C)}function KXt(_,C){return this.isSame(_,C)||this.isBefore(_,C)}function GXt(_,C,T){var M,L,Z;if(!this.isValid())return NaN;if(M=Kfe(_,this),!M.isValid())return NaN;switch(L=(M.utcOffset()-this.utcOffset())*6e4,C=te(C),C){case"year":Z=dK(this,M)/12;break;case"month":Z=dK(this,M);break;case"quarter":Z=dK(this,M)/3;break;case"second":Z=(this-M)/1e3;break;case"minute":Z=(this-M)/6e4;break;case"hour":Z=(this-M)/36e5;break;case"day":Z=(this-M-L)/864e5;break;case"week":Z=(this-M-L)/6048e5;break;default:Z=this-M}return T?Z:ce(Z)}function dK(_,C){if(_.date()<C.date())return-dK(C,_);var T=(C.year()-_.year())*12+(C.month()-_.month()),M=_.clone().add(T,"months"),L,Z;return C-M<0?(L=_.clone().add(T-1,"months"),Z=(C-M)/(M-L)):(L=_.clone().add(T+1,"months"),Z=(C-M)/(L-M)),-(T+Z)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function JXt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function YXt(_){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 ZXt(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var _="moment",C="",T,M,L,Z;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",Z=C+'[")]',this.format(T+M+L+Z)}function XXt(_){_||(_=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var C=W(this,_);return this.localeData().postformat(C)}function QXt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({to:this,from:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function eQt(_){return this.from(ra(),_)}function tQt(_,C){return this.isValid()&&(P(_)&&_.isValid()||ra(_).isValid())?cy({from:this,to:_}).locale(this.locale()).humanize(!C):this.localeData().invalidDate()}function rQt(_){return this.to(ra(),_)}function Zqe(_){var C;return _===void 0?this._locale._abbr:(C=fC(_),C!=null&&(this._locale=C),this)}var Xqe=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 Qqe(){return this._locale}var fK=1e3,AL=60*fK,pK=60*AL,eUe=(365*400+97)*24*pK;function IL(_,C){return(_%C+C)%C}function tUe(_,C,T){return _<100&&_>=0?new Date(_+400,C,T)-eUe:new Date(_,C,T).valueOf()}function rUe(_,C,T){return _<100&&_>=0?Date.UTC(_+400,C,T)-eUe:Date.UTC(_,C,T)}function nQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?rUe:tUe,_){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-=IL(C+(this._isUTC?0:this.utcOffset()*AL),pK);break;case"minute":C=this._d.valueOf(),C-=IL(C,AL);break;case"second":C=this._d.valueOf(),C-=IL(C,fK);break}return this._d.setTime(C),e.updateOffset(this,!0),this}function oQt(_){var C,T;if(_=te(_),_===void 0||_==="millisecond"||!this.isValid())return this;switch(T=this._isUTC?rUe:tUe,_){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+=pK-IL(C+(this._isUTC?0:this.utcOffset()*AL),pK)-1;break;case"minute":C=this._d.valueOf(),C+=AL-IL(C,AL)-1;break;case"second":C=this._d.valueOf(),C+=fK-IL(C,fK)-1;break}return this._d.setTime(C),e.updateOffset(this,!0),this}function iQt(){return this._d.valueOf()-(this._offset||0)*6e4}function aQt(){return Math.floor(this.valueOf()/1e3)}function sQt(){return new Date(this.valueOf())}function uQt(){var _=this;return[_.year(),_.month(),_.date(),_.hour(),_.minute(),_.second(),_.millisecond()]}function lQt(){var _=this;return{years:_.year(),months:_.month(),date:_.date(),hours:_.hours(),minutes:_.minutes(),seconds:_.seconds(),milliseconds:_.milliseconds()}}function cQt(){return this.isValid()?this.toISOString():null}function dQt(){return b(this)}function fQt(){return d({},m(this))}function pQt(){return m(this).overflow}function mQt(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}H("N",0,0,"eraAbbr"),H("NN",0,0,"eraAbbr"),H("NNN",0,0,"eraAbbr"),H("NNNN",0,0,"eraName"),H("NNNNN",0,0,"eraNarrow"),H("y",["y",1],"yo","eraYear"),H("y",["yy",2],0,"eraYear"),H("y",["yyy",3],0,"eraYear"),H("y",["yyyy",4],0,"eraYear"),Ye("N",Jfe),Ye("NN",Jfe),Ye("NNN",Jfe),Ye("NNNN",OQt),Ye("NNNNN",PQt),En(["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=_}),Ye("y",La),Ye("yy",La),Ye("yyy",La),Ye("yyyy",La),Ye("yo",EQt),En(["y","yy","yyy","yyyy"],Pd),En(["yo"],function(_,C,T,M){var L;T._locale._eraYearOrdinalRegex&&(L=_.match(T._locale._eraYearOrdinalRegex)),T._locale.eraYearOrdinalParse?C[Pd]=T._locale.eraYearOrdinalParse(_,L):C[Pd]=parseInt(_,10)});function hQt(_,C){var T,M,L,Z=this._eras||fC("en")._eras;for(T=0,M=Z.length;T<M;++T){switch(typeof Z[T].since){case"string":L=e(Z[T].since).startOf("day"),Z[T].since=L.valueOf();break}switch(typeof Z[T].until){case"undefined":Z[T].until=1/0;break;case"string":L=e(Z[T].until).startOf("day").valueOf(),Z[T].until=L.valueOf();break}}return Z}function gQt(_,C,T){var M,L,Z=this.eras(),he,tr,an;for(_=_.toUpperCase(),M=0,L=Z.length;M<L;++M)if(he=Z[M].name.toUpperCase(),tr=Z[M].abbr.toUpperCase(),an=Z[M].narrow.toUpperCase(),T)switch(C){case"N":case"NN":case"NNN":if(tr===_)return Z[M];break;case"NNNN":if(he===_)return Z[M];break;case"NNNNN":if(an===_)return Z[M];break}else if([he,tr,an].indexOf(_)>=0)return Z[M]}function yQt(_,C){var T=_.since<=_.until?1:-1;return C===void 0?e(_.since).year():e(_.since).year()+(C-_.offset)*T}function bQt(){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 _Qt(){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 vQt(){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 wQt(){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 SQt(_){return i(this,"_erasNameRegex")||Yfe.call(this),_?this._erasNameRegex:this._erasRegex}function xQt(_){return i(this,"_erasAbbrRegex")||Yfe.call(this),_?this._erasAbbrRegex:this._erasRegex}function CQt(_){return i(this,"_erasNarrowRegex")||Yfe.call(this),_?this._erasNarrowRegex:this._erasRegex}function Jfe(_,C){return C.erasAbbrRegex(_)}function OQt(_,C){return C.erasNameRegex(_)}function PQt(_,C){return C.erasNarrowRegex(_)}function EQt(_,C){return C._eraYearOrdinalRegex||La}function Yfe(){var _=[],C=[],T=[],M=[],L,Z,he=this.eras();for(L=0,Z=he.length;L<Z;++L)C.push(vl(he[L].name)),_.push(vl(he[L].abbr)),T.push(vl(he[L].narrow)),M.push(vl(he[L].name)),M.push(vl(he[L].abbr)),M.push(vl(he[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")}H(0,["gg",2],0,function(){return this.weekYear()%100}),H(0,["GG",2],0,function(){return this.isoWeekYear()%100});function mK(_,C){H(0,[_,_.length],0,C)}mK("gggg","weekYear"),mK("ggggg","weekYear"),mK("GGGG","isoWeekYear"),mK("GGGGG","isoWeekYear"),ht("weekYear","gg"),ht("isoWeekYear","GG"),Pe("weekYear",1),Pe("isoWeekYear",1),Ye("G",vf),Ye("g",vf),Ye("GG",Sn,qi),Ye("gg",Sn,qi),Ye("GGGG",is,yf),Ye("gggg",is,yf),Ye("GGGGG",$s,bf),Ye("ggggg",$s,bf),uy(["gggg","ggggg","GGGG","GGGGG"],function(_,C,T,M){C[M.substr(0,2)]=Ce(_)}),uy(["gg","GG"],function(_,C,T,M){C[M]=e.parseTwoDigitYear(_)});function TQt(_){return nUe.call(this,_,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function AQt(_){return nUe.call(this,_,this.isoWeek(),this.isoWeekday(),1,4)}function IQt(){return dC(this.year(),1,4)}function MQt(){return dC(this.isoWeekYear(),1,4)}function RQt(){var _=this.localeData()._week;return dC(this.year(),_.dow,_.doy)}function jQt(){var _=this.localeData()._week;return dC(this.weekYear(),_.dow,_.doy)}function nUe(_,C,T,M,L){var Z;return _==null?o2(this,M,L).year:(Z=dC(_,M,L),C>Z&&(C=Z),NQt.call(this,_,C,T,M,L))}function NQt(_,C,T,M,L){var Z=Nqe(_,C,T,M,L),he=n2(Z.year,0,Z.dayOfYear);return this.year(he.getUTCFullYear()),this.month(he.getUTCMonth()),this.date(he.getUTCDate()),this}H("Q",0,"Qo","quarter"),ht("quarter","Q"),Pe("quarter",7),Ye("Q",Cd),En("Q",function(_,C){C[lC]=(Ce(_)-1)*3});function DQt(_){return _==null?Math.ceil((this.month()+1)/3):this.month((_-1)*3+this.month()%3)}H("D",["DD",2],"Do","date"),ht("date","D"),Pe("date",9),Ye("D",Sn),Ye("DD",Sn,qi),Ye("Do",function(_,C){return _?C._dayOfMonthOrdinalParse||C._ordinalParse:C._dayOfMonthOrdinalParseLenient}),En(["D","DD"],$b),En("Do",function(_,C){C[$b]=Ce(_.match(Sn)[0])});var oUe=Je("Date",!0);H("DDD",["DDDD",3],"DDDo","dayOfYear"),ht("dayOfYear","DDD"),Pe("dayOfYear",4),Ye("DDD",kb),Ye("DDDD",lp),En(["DDD","DDDD"],function(_,C,T){T._dayOfYear=Ce(_)});function LQt(_){var C=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return _==null?C:this.add(_-C,"d")}H("m",["mm",2],0,"minute"),ht("minute","m"),Pe("minute",14),Ye("m",Sn),Ye("mm",Sn,qi),En(["m","mm"],ly);var FQt=Je("Minutes",!1);H("s",["ss",2],0,"second"),ht("second","s"),Pe("second",15),Ye("s",Sn),Ye("ss",Sn,qi),En(["s","ss"],cC);var kQt=Je("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return this.millisecond()*10}),H(0,["SSSSS",5],0,function(){return this.millisecond()*100}),H(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),H(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),H(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),H(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),ht("millisecond","ms"),Pe("millisecond",16),Ye("S",kb,Cd),Ye("SS",kb,qi),Ye("SSS",kb,lp);var SE,iUe;for(SE="SSSS";SE.length<=9;SE+="S")Ye(SE,La);function $Qt(_,C){C[KM]=Ce(("0."+_)*1e3)}for(SE="S";SE.length<=9;SE+="S")En(SE,$Qt);iUe=Je("Milliseconds",!1),H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");function BQt(){return this._isUTC?"UTC":""}function qQt(){return this._isUTC?"Coordinated Universal Time":""}var He=O.prototype;He.add=jXt,He.calendar=BXt,He.clone=qXt,He.diff=GXt,He.endOf=oQt,He.format=XXt,He.from=QXt,He.fromNow=eQt,He.to=tQt,He.toNow=rQt,He.get=ta,He.invalidAt=pQt,He.isAfter=UXt,He.isBefore=zXt,He.isBetween=HXt,He.isSame=VXt,He.isSameOrAfter=WXt,He.isSameOrBefore=KXt,He.isValid=dQt,He.lang=Xqe,He.locale=Zqe,He.localeData=Qqe,He.max=dXt,He.min=cXt,He.parsingFlags=fQt,He.set=xc,He.startOf=nQt,He.subtract=NXt,He.toArray=uQt,He.toObject=lQt,He.toDate=sQt,He.toISOString=YXt,He.inspect=ZXt,typeof Symbol<"u"&&Symbol.for!=null&&(He[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),He.toJSON=cQt,He.toString=JXt,He.unix=aQt,He.valueOf=iQt,He.creationData=mQt,He.eraName=bQt,He.eraNarrow=_Qt,He.eraAbbr=vQt,He.eraYear=wQt,He.year=jqe,He.isLeapYear=lZt,He.weekYear=TQt,He.isoWeekYear=AQt,He.quarter=He.quarters=DQt,He.month=Mqe,He.daysInMonth=aZt,He.week=He.weeks=hZt,He.isoWeek=He.isoWeeks=gZt,He.weeksInYear=RQt,He.weeksInWeekYear=jQt,He.isoWeeksInYear=IQt,He.isoWeeksInISOWeekYear=MQt,He.date=oUe,He.day=He.days=AZt,He.weekday=IZt,He.isoWeekday=MZt,He.dayOfYear=LQt,He.hour=He.hours=kZt,He.minute=He.minutes=FQt,He.second=He.seconds=kQt,He.millisecond=He.milliseconds=iUe,He.utcOffset=vXt,He.utc=SXt,He.local=xXt,He.parseZone=CXt,He.hasAlignedHourOffset=OXt,He.isDST=PXt,He.isLocal=TXt,He.isUtcOffset=AXt,He.isUtc=Wqe,He.isUTC=Wqe,He.zoneAbbr=BQt,He.zoneName=qQt,He.dates=A("dates accessor is deprecated. Use date instead.",oUe),He.months=A("months accessor is deprecated. Use month instead",Mqe),He.years=A("years accessor is deprecated. Use year instead",jqe),He.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",wXt),He.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",EXt);function UQt(_){return ra(_*1e3)}function zQt(){return ra.apply(null,arguments).parseZone()}function aUe(_){return _}var wo=k.prototype;wo.calendar=Q,wo.longDateFormat=Oe,wo.invalidDate=Be,wo.ordinal=cr,wo.preparse=aUe,wo.postformat=aUe,wo.relativeTime=Le,wo.pastFuture=pt,wo.set=j,wo.eras=hQt,wo.erasParse=gQt,wo.erasConvertYear=yQt,wo.erasAbbrRegex=xQt,wo.erasNameRegex=SQt,wo.erasNarrowRegex=CQt,wo.months=rZt,wo.monthsShort=nZt,wo.monthsParse=iZt,wo.monthsRegex=uZt,wo.monthsShortRegex=sZt,wo.week=dZt,wo.firstDayOfYear=mZt,wo.firstDayOfWeek=pZt,wo.weekdays=CZt,wo.weekdaysMin=PZt,wo.weekdaysShort=OZt,wo.weekdaysParse=TZt,wo.weekdaysRegex=RZt,wo.weekdaysShortRegex=jZt,wo.weekdaysMinRegex=NZt,wo.isPM=LZt,wo.meridiem=$Zt;function hK(_,C,T,M){var L=fC(),Z=f().set(M,C);return L[T](Z,_)}function sUe(_,C,T){if(u(_)&&(C=_,_=void 0),_=_||"",C!=null)return hK(_,C,T,"month");var M,L=[];for(M=0;M<12;M++)L[M]=hK(_,M,T,"month");return L}function Zfe(_,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=fC(),Z=_?L._week.dow:0,he,tr=[];if(T!=null)return hK(C,(T+Z)%7,M,"day");for(he=0;he<7;he++)tr[he]=hK(C,(he+Z)%7,M,"day");return tr}function HQt(_,C){return sUe(_,C,"months")}function VQt(_,C){return sUe(_,C,"monthsShort")}function WQt(_,C,T){return Zfe(_,C,T,"weekdays")}function KQt(_,C,T){return Zfe(_,C,T,"weekdaysShort")}function GQt(_,C,T){return Zfe(_,C,T,"weekdaysMin")}wE("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=Ce(_%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.",wE),e.langData=A("moment.langData is deprecated. Use moment.localeData instead.",fC);var pC=Math.abs;function JQt(){var _=this._data;return this._milliseconds=pC(this._milliseconds),this._days=pC(this._days),this._months=pC(this._months),_.milliseconds=pC(_.milliseconds),_.seconds=pC(_.seconds),_.minutes=pC(_.minutes),_.hours=pC(_.hours),_.months=pC(_.months),_.years=pC(_.years),this}function uUe(_,C,T,M){var L=cy(C,T);return _._milliseconds+=M*L._milliseconds,_._days+=M*L._days,_._months+=M*L._months,_._bubble()}function YQt(_,C){return uUe(this,_,C,1)}function ZQt(_,C){return uUe(this,_,C,-1)}function lUe(_){return _<0?Math.floor(_):Math.ceil(_)}function XQt(){var _=this._milliseconds,C=this._days,T=this._months,M=this._data,L,Z,he,tr,an;return _>=0&&C>=0&&T>=0||_<=0&&C<=0&&T<=0||(_+=lUe(Xfe(T)+C)*864e5,C=0,T=0),M.milliseconds=_%1e3,L=ce(_/1e3),M.seconds=L%60,Z=ce(L/60),M.minutes=Z%60,he=ce(Z/60),M.hours=he%24,C+=ce(he/24),an=ce(cUe(C)),T+=an,C-=lUe(Xfe(an)),tr=ce(T/12),T%=12,M.days=C,M.months=T,M.years=tr,this}function cUe(_){return _*4800/146097}function Xfe(_){return _*146097/4800}function QQt(_){if(!this.isValid())return NaN;var C,T,M=this._milliseconds;if(_=te(_),_==="month"||_==="quarter"||_==="year")switch(C=this._days+M/864e5,T=this._months+cUe(C),_){case"month":return T;case"quarter":return T/3;case"year":return T/12}else switch(C=this._days+Math.round(Xfe(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 eer(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ce(this._months/12)*31536e6:NaN}function mC(_){return function(){return this.as(_)}}var ter=mC("ms"),rer=mC("s"),ner=mC("m"),oer=mC("h"),ier=mC("d"),aer=mC("w"),ser=mC("M"),uer=mC("Q"),ler=mC("y");function cer(){return cy(this)}function der(_){return _=te(_),this.isValid()?this[_+"s"]():NaN}function JM(_){return function(){return this.isValid()?this._data[_]:NaN}}var fer=JM("milliseconds"),per=JM("seconds"),mer=JM("minutes"),her=JM("hours"),ger=JM("days"),yer=JM("months"),ber=JM("years");function _er(){return ce(this.days()/7)}var hC=Math.round,ML={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ver(_,C,T,M,L){return L.relativeTime(C||1,!!T,_,M)}function wer(_,C,T,M){var L=cy(_).abs(),Z=hC(L.as("s")),he=hC(L.as("m")),tr=hC(L.as("h")),an=hC(L.as("d")),Ci=hC(L.as("M")),xf=hC(L.as("w")),gC=hC(L.as("y")),xE=Z<=T.ss&&["s",Z]||Z<T.s&&["ss",Z]||he<=1&&["m"]||he<T.m&&["mm",he]||tr<=1&&["h"]||tr<T.h&&["hh",tr]||an<=1&&["d"]||an<T.d&&["dd",an];return T.w!=null&&(xE=xE||xf<=1&&["w"]||xf<T.w&&["ww",xf]),xE=xE||Ci<=1&&["M"]||Ci<T.M&&["MM",Ci]||gC<=1&&["y"]||["yy",gC],xE[2]=C,xE[3]=+_>0,xE[4]=M,ver.apply(null,xE)}function Ser(_){return _===void 0?hC:typeof _=="function"?(hC=_,!0):!1}function xer(_,C){return ML[_]===void 0?!1:C===void 0?ML[_]:(ML[_]=C,_==="s"&&(ML.ss=C-1),!0)}function Cer(_,C){if(!this.isValid())return this.localeData().invalidDate();var T=!1,M=ML,L,Z;return typeof _=="object"&&(C=_,_=!1),typeof _=="boolean"&&(T=_),typeof C=="object"&&(M=Object.assign({},ML,C),C.s!=null&&C.ss==null&&(M.ss=C.s-1)),L=this.localeData(),Z=wer(this,!T,M,L),T&&(Z=L.pastFuture(+this,Z)),L.postformat(Z)}var Qfe=Math.abs;function RL(_){return(_>0)-(_<0)||+_}function gK(){if(!this.isValid())return this.localeData().invalidDate();var _=Qfe(this._milliseconds)/1e3,C=Qfe(this._days),T=Qfe(this._months),M,L,Z,he,tr=this.asSeconds(),an,Ci,xf,gC;return tr?(M=ce(_/60),L=ce(M/60),_%=60,M%=60,Z=ce(T/12),T%=12,he=_?_.toFixed(3).replace(/\.?0+$/,""):"",an=tr<0?"-":"",Ci=RL(this._months)!==RL(tr)?"-":"",xf=RL(this._days)!==RL(tr)?"-":"",gC=RL(this._milliseconds)!==RL(tr)?"-":"",an+"P"+(Z?Ci+Z+"Y":"")+(T?Ci+T+"M":"")+(C?xf+C+"D":"")+(L||M||_?"T":"")+(L?gC+L+"H":"")+(M?gC+M+"M":"")+(_?gC+he+"S":"")):"P0D"}var Xn=lK.prototype;Xn.isValid=gXt,Xn.abs=JQt,Xn.add=YQt,Xn.subtract=ZQt,Xn.as=QQt,Xn.asMilliseconds=ter,Xn.asSeconds=rer,Xn.asMinutes=ner,Xn.asHours=oer,Xn.asDays=ier,Xn.asWeeks=aer,Xn.asMonths=ser,Xn.asQuarters=uer,Xn.asYears=ler,Xn.valueOf=eer,Xn._bubble=XQt,Xn.clone=cer,Xn.get=der,Xn.milliseconds=fer,Xn.seconds=per,Xn.minutes=mer,Xn.hours=her,Xn.days=ger,Xn.weeks=_er,Xn.months=yer,Xn.years=ber,Xn.humanize=Cer,Xn.toISOString=gK,Xn.toString=gK,Xn.toJSON=gK,Xn.locale=Zqe,Xn.localeData=Qqe,Xn.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",gK),Xn.lang=Xqe,H("X",0,0,"unix"),H("x",0,0,"valueOf"),Ye("x",vf),Ye("X",cp),En("X",function(_,C,T){T._d=new Date(parseFloat(_)*1e3)}),En("x",function(_,C,T){T._d=new Date(Ce(_))});return e.version="2.29.4",r(ra),e.fn=He,e.min=fXt,e.max=pXt,e.now=mXt,e.utc=f,e.unix=UQt,e.months=HQt,e.isDate=l,e.locale=wE,e.invalid=g,e.duration=cy,e.isMoment=P,e.weekdays=WQt,e.parseZone=zQt,e.localeData=fC,e.isDuration=cK,e.monthsShort=VQt,e.weekdaysMin=GQt,e.defineLocale=Bfe,e.updateLocale=zZt,e.locales=HZt,e.weekdaysShort=KQt,e.normalizeUnits=te,e.relativeTimeRounding=Ser,e.relativeTimeThreshold=xer,e.calendarFormat=$Xt,e.prototype=He,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 lVe(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function Xsr(t){let e=lVe(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function cVe(t){let e=lVe(t);return Xsr(t)?Whe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:Whe.UNKNOWN_ERROR)}function fF(t){return t.replace(/^#/,"").trim().toLowerCase()}function NR(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(fF(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(fF(i))}):typeof n=="string"&&o.add(fF(n))),Array.from(o)}function dVe(t,e,r){if(e.length===0)return[];e=e.map(i=>fF(i));let n=r&&r.length>0?r:Jhe(t,"/"),o=[];for(let i of n){let a=NR(i);e.some(s=>a.includes(s))&&o.push(i)}return o}function Yhe(t){let e=(0,Ghe.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()}:Vl(new Date)}async function pF(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function QG(t){return t.basename}function pVe(t,e){return!t||!e?!1:t.includes(Khe)&&e.includes(Khe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function DR(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 NC(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 Rh.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(Zhe(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 Zhe(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function mVe(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function hVe(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function gVe(t){return Xhe.test(t)}function Qhe(t){let e=t.match(Xhe);return e?e[0]:null}function yVe(t){let e=t.matchAll(new RegExp(Xhe,"g"));return Array.from(e,r=>r[0])}async function Us(t,e={}){let r=e.headers?{...e.headers}:{};delete r["content-length"],ie("==== safeFetch method request ====");let n=e.method?.toUpperCase()||"POST",i=await(0,Rh.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(Whe.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:tur(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 tur(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function ei(t,e=!1){return t instanceof Error?t.message+`
${t?.cause?"more message: "+t.cause.message:""}
${e?t.stack:""}`:JSON.stringify(t)}function u4(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function eJ(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 Xb(t){let e=hF[t];return{...e,label:e.label||t}}function kf(t,e){let r=hF[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}async function l4(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new Rh.Notice("No active leaf found.");return}if(r.view instanceof Rh.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof Rh.MarkdownView)){new Rh.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=FR(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new Rh.Notice("Message inserted into the active note.")}function tJ(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function rJ(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 bVe(){try{return{version:(await(0,Rh.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 LR(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 nJ(t,e="system"){return LR(t)?"human":e}function ege(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(hF).filter(([e])=>!t.includes(e)).map(([e])=>e)}function mF(t,e){let r=!!ege().find(i=>i===t.provider),n=Qb[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 rur(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function FR(t){let r=rur(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function _Ve(){return crypto.randomUUID()}async function yy(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 Ghe,Rh,Whe,Jhe,Qsr,eur,fVe,Vl,Xhe,Cn=w(()=>{Fd();$r();yo();Ghe=F(uVe()),Rh=require("obsidian"),Whe={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}`};Jhe=(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})};Qsr=t=>t.last.bound.modelName||t.last.bound.model,eur=t=>t.last.bound.retriever!==void 0,fVe=t=>Qsr(t)||eur(t),Vl=(t,e="local")=>{let r=(0,Ghe.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};Xhe=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var gF,tge,c4,Fd=w(()=>{gy();qE();Sm();RHe();Cn();gF=class gF{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.bind({signal:i?.signal}),s=bi.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return gF.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=gF.instances.get("llm_chain");return r||(r=gF.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=Dd.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=Dd.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=bi.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 zG,b=>{let g=FR(b);return n&&console.log("Standalone Question: ",g),g}]),p=async b=>(r(b),Ihe(b)),m=bi.from([{context:i.pipe(p),question:new go,system_message:()=>a},c,o]);return f.pipe(m)}};gF.instances=new Map;tge=gF,c4=tge});var d4=w(()=>{});var VE,Es,Pi,e_,aVe,sVe,f4,oJ,wVe,rge,SVe,nge,oge,t_,LC,jh,DC,WE,Zb,HE,jR,Khe,hF,Qb,xVe,Br,ige,Nh,Ic,Dh,$r=w(()=>{l2();Fd();d4();VE="https://api.brevilabs.com/v1",Es="copilot-chat-view",Pi="user",e_="ai",aVe=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
1. Never mention that you do not have access to something. Always rely on the user provided context.
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
6. Always use $'s instead of \\[ etc. for LaTeX equations.
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`.
10. When generating a table, 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.`,sVe=`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`,f4="note_context",oJ=`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.`,wVe=6e3,rge=.4,SVe=.4,nge=15,oge=448e3,t_={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},LC={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},jh={MAX_TOKENS:6e3,TEMPERATURE:.1},DC=(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))(DC||{}),WE={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Zb=[{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-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,core:!0,capabilities:["vision"]},{name:"o4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["reasoning"]},{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:"claude-3-5-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-3-5-haiku-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0},{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:"command-r",provider:"cohereai",enabled:!0,isBuiltIn:!0},{name:"command-r-plus",provider:"cohereai",enabled:!0,isBuiltIn:!0},{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"]}],HE=(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))(HE||{}),jR=[{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}],Khe="nomic-embed-text",hF={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:""}},Qb={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey"},xVe=["NEVER","ON STARTUP","ON MODE SWITCH"],Br={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"},ige={[Br.APPLY_ADHOC_PROMPT]:"Apply ad-hoc custom prompt",[Br.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[Br.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[Br.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[Br.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[Br.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[Br.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[Br.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[Br.LIST_INDEXED_FILES]:"List all indexed files (debug)",[Br.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[Br.NEW_CHAT]:"New Copilot Chat",[Br.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[Br.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[Br.SEARCH_ORAMA_DB]:"Search OramaDB (debug)",[Br.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[Br.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[Br.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context"},Nh={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},Ic={userId:yC(),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:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:"copilot-conversations",defaultConversationTag:"copilot-conversation",autosaveChat:!1,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:"copilot-custom-prompts",indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:"",qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:3,groqApiKey:"",activeModels:Zb,activeEmbeddingModels:jR,embeddingRequestsPerMin:90,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Nh.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableCustomPromptTemplating:!0,suggestedDefaultCommands:!1},Dh={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var sge=v(iJ=>{"use strict";iJ.byteLength=our;iJ.toByteArray=aur;iJ.fromByteArray=lur;var r_=[],Lh=[],nur=typeof Uint8Array<"u"?Uint8Array:Array,age="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(kR=0,CVe=age.length;kR<CVe;++kR)r_[kR]=age[kR],Lh[age.charCodeAt(kR)]=kR;var kR,CVe;Lh[45]=62;Lh[95]=63;function OVe(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 our(t){var e=OVe(t),r=e[0],n=e[1];return(r+n)*3/4-n}function iur(t,e,r){return(e+r)*3/4-r}function aur(t){var e,r=OVe(t),n=r[0],o=r[1],i=new nur(iur(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Lh[t.charCodeAt(u)]<<18|Lh[t.charCodeAt(u+1)]<<12|Lh[t.charCodeAt(u+2)]<<6|Lh[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Lh[t.charCodeAt(u)]<<2|Lh[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Lh[t.charCodeAt(u)]<<10|Lh[t.charCodeAt(u+1)]<<4|Lh[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function sur(t){return r_[t>>18&63]+r_[t>>12&63]+r_[t>>6&63]+r_[t&63]}function uur(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(sur(n));return o.join("")}function lur(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(uur(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(r_[e>>2]+r_[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(r_[e>>10]+r_[e>>4&63]+r_[e<<2&63]+"=")),o.join("")}});var PVe=v(uge=>{uge.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)};uge.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 Pp=v(vF=>{"use strict";var lge=sge(),bF=PVe(),EVe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vF.Buffer=be;vF.SlowBuffer=hur;vF.INSPECT_MAX_BYTES=50;var aJ=2147483647;vF.kMaxLength=aJ;be.TYPED_ARRAY_SUPPORT=cur();!be.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 cur(){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(be.prototype,"parent",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.buffer}});Object.defineProperty(be.prototype,"offset",{enumerable:!0,get:function(){if(be.isBuffer(this))return this.byteOffset}});function FC(t){if(t>aJ)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,be.prototype),e}function be(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 pge(t)}return MVe(t,e,r)}be.poolSize=8192;function MVe(t,e,r){if(typeof t=="string")return fur(t,e);if(ArrayBuffer.isView(t))return pur(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(n_(t,ArrayBuffer)||t&&n_(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(n_(t,SharedArrayBuffer)||t&&n_(t.buffer,SharedArrayBuffer)))return dge(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 be.from(n,e,r);let o=mur(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return be.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)}be.from=function(t,e,r){return MVe(t,e,r)};Object.setPrototypeOf(be.prototype,Uint8Array.prototype);Object.setPrototypeOf(be,Uint8Array);function RVe(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 dur(t,e,r){return RVe(t),t<=0?FC(t):e!==void 0?typeof r=="string"?FC(t).fill(e,r):FC(t).fill(e):FC(t)}be.alloc=function(t,e,r){return dur(t,e,r)};function pge(t){return RVe(t),FC(t<0?0:mge(t)|0)}be.allocUnsafe=function(t){return pge(t)};be.allocUnsafeSlow=function(t){return pge(t)};function fur(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!be.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=jVe(t,e)|0,n=FC(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function cge(t){let e=t.length<0?0:mge(t.length)|0,r=FC(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function pur(t){if(n_(t,Uint8Array)){let e=new Uint8Array(t);return dge(e.buffer,e.byteOffset,e.byteLength)}return cge(t)}function dge(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,be.prototype),n}function mur(t){if(be.isBuffer(t)){let e=mge(t.length)|0,r=FC(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||gge(t.length)?FC(0):cge(t);if(t.type==="Buffer"&&Array.isArray(t.data))return cge(t.data)}function mge(t){if(t>=aJ)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+aJ.toString(16)+" bytes");return t|0}function hur(t){return+t!=t&&(t=0),be.alloc(+t)}be.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==be.prototype};be.compare=function(e,r){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),n_(r,Uint8Array)&&(r=be.from(r,r.offset,r.byteLength)),!be.isBuffer(e)||!be.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};be.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}};be.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return be.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=be.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(n_(a,Uint8Array))i+a.length>o.length?(be.isBuffer(a)||(a=be.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(be.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function jVe(t,e){if(be.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||n_(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 fge(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return UVe(t).length;default:if(o)return n?-1:fge(t).length;e=(""+e).toLowerCase(),o=!0}}be.byteLength=jVe;function gur(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 Pur(this,e,r);case"utf8":case"utf-8":return DVe(this,e,r);case"ascii":return Cur(this,e,r);case"latin1":case"binary":return Our(this,e,r);case"base64":return Sur(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Eur(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}be.prototype._isBuffer=!0;function $R(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}be.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)$R(this,r,r+1);return this};be.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)$R(this,r,r+3),$R(this,r+1,r+2);return this};be.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)$R(this,r,r+7),$R(this,r+1,r+6),$R(this,r+2,r+5),$R(this,r+3,r+4);return this};be.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?DVe(this,0,e):gur.apply(this,arguments)};be.prototype.toLocaleString=be.prototype.toString;be.prototype.equals=function(e){if(!be.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:be.compare(this,e)===0};be.prototype.inspect=function(){let e="",r=vF.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};EVe&&(be.prototype[EVe]=be.prototype.inspect);be.prototype.compare=function(e,r,n,o,i){if(n_(e,Uint8Array)&&(e=be.from(e,e.offset,e.byteLength)),!be.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 NVe(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,gge(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=be.from(e,n)),be.isBuffer(e))return e.length===0?-1:TVe(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):TVe(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function TVe(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}be.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};be.prototype.indexOf=function(e,r,n){return NVe(this,e,r,n,!0)};be.prototype.lastIndexOf=function(e,r,n){return NVe(this,e,r,n,!1)};function yur(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(gge(s))return a;t[r+a]=s}return a}function bur(t,e,r,n){return sJ(fge(e,t.length-r),t,r,n)}function _ur(t,e,r,n){return sJ(Mur(e),t,r,n)}function vur(t,e,r,n){return sJ(UVe(e),t,r,n)}function wur(t,e,r,n){return sJ(Rur(e,t.length-r),t,r,n)}be.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 yur(this,e,r,n);case"utf8":case"utf-8":return bur(this,e,r,n);case"ascii":case"latin1":case"binary":return _ur(this,e,r,n);case"base64":return vur(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wur(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};be.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Sur(t,e,r){return e===0&&r===t.length?lge.fromByteArray(t):lge.fromByteArray(t.slice(e,r))}function DVe(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 xur(n)}var AVe=4096;function xur(t){let e=t.length;if(e<=AVe)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=AVe));return r}function Cur(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 Our(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 Pur(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+=jur[t[i]];return o}function Eur(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}be.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,be.prototype),o};function Wl(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")}be.prototype.readUintLE=be.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};be.prototype.readUintBE=be.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};be.prototype.readUint8=be.prototype.readUInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]};be.prototype.readUint16LE=be.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]|this[e+1]<<8};be.prototype.readUint16BE=be.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Wl(e,2,this.length),this[e]<<8|this[e+1]};be.prototype.readUint32LE=be.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};be.prototype.readUint32BE=be.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};be.prototype.readBigUInt64LE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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))});be.prototype.readBigUInt64BE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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)});be.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(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};be.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Wl(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};be.prototype.readInt8=function(e,r){return e=e>>>0,r||Wl(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};be.prototype.readInt16LE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};be.prototype.readInt16BE=function(e,r){e=e>>>0,r||Wl(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};be.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};be.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};be.prototype.readBigInt64LE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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)});be.prototype.readBigInt64BE=KE(function(e){e=e>>>0,_F(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&p4(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)});be.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),bF.read(this,e,!0,23,4)};be.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Wl(e,4,this.length),bF.read(this,e,!1,23,4)};be.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),bF.read(this,e,!0,52,8)};be.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Wl(e,8,this.length),bF.read(this,e,!1,52,8)};function Op(t,e,r,n,o,i){if(!be.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")}be.prototype.writeUintLE=be.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;Op(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};be.prototype.writeUintBE=be.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;Op(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};be.prototype.writeUint8=be.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,255,0),this[r]=e&255,r+1};be.prototype.writeUint16LE=be.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeUint16BE=be.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeUint32LE=be.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeUint32BE=be.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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 LVe(t,e,r,n,o){qVe(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 FVe(t,e,r,n,o){qVe(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}be.prototype.writeBigUInt64LE=KE(function(e,r=0){return LVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeBigUInt64BE=KE(function(e,r=0){return FVe(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});be.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(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};be.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);Op(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};be.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};be.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};be.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};be.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Op(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};be.prototype.writeBigInt64LE=KE(function(e,r=0){return LVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});be.prototype.writeBigInt64BE=KE(function(e,r=0){return FVe(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function kVe(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 $Ve(t,e,r,n,o){return e=+e,r=r>>>0,o||kVe(t,e,r,4,34028234663852886e22,-34028234663852886e22),bF.write(t,e,r,n,23,4),r+4}be.prototype.writeFloatLE=function(e,r,n){return $Ve(this,e,r,!0,n)};be.prototype.writeFloatBE=function(e,r,n){return $Ve(this,e,r,!1,n)};function BVe(t,e,r,n,o){return e=+e,r=r>>>0,o||kVe(t,e,r,8,17976931348623157e292,-17976931348623157e292),bF.write(t,e,r,n,52,8),r+8}be.prototype.writeDoubleLE=function(e,r,n){return BVe(this,e,r,!0,n)};be.prototype.writeDoubleBE=function(e,r,n){return BVe(this,e,r,!1,n)};be.prototype.copy=function(e,r,n,o){if(!be.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};be.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"&&!be.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=be.isBuffer(e)?e:be.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 yF={};function hge(t,e,r){yF[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}`}}}hge("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);hge("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);hge("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=IVe(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=IVe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function IVe(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 Tur(t,e,r){_F(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&p4(e,t.length-(r+1))}function qVe(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 yF.ERR_OUT_OF_RANGE("value",s,t)}Tur(n,o,i)}function _F(t,e){if(typeof t!="number")throw new yF.ERR_INVALID_ARG_TYPE(e,"number",t)}function p4(t,e,r){throw Math.floor(t)!==t?(_F(t,r),new yF.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new yF.ERR_BUFFER_OUT_OF_BOUNDS:new yF.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Aur=/[^+/0-9A-Za-z-_]/g;function Iur(t){if(t=t.split("=")[0],t=t.trim().replace(Aur,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function fge(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 Mur(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Rur(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 UVe(t){return lge.toByteArray(Iur(t))}function sJ(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 n_(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function gge(t){return t!==t}var jur=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 KE(t){return typeof BigInt>"u"?Nur:t}function Nur(){throw new Error("BigInt not supported")}});function m4(){return HVe.Platform.isDesktop&&uJ||(uJ=require("electron")?.remote?.safeStorage),uJ}async function wge(){return await crypto.subtle.importKey("raw",Dur,lJ.name,!1,["encrypt","decrypt"])}async function VVe(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 yge(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await yge(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await yge(n.apiKey||"")})))),e}async function yge(t){if(!t||t.startsWith(Sge))return t;WVe(t)&&(t=t.replace(cJ,""));try{if(m4()?.isEncryptionAvailable()){let o=m4().encryptString(t);return _ge+o.toString("base64")}let e=await wge(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(lJ,e,r);return vge+Fur(n)}catch(e){return console.error("Encryption failed:",e),t}}async function eo(t){if(!t||Lur(t))return t;if(WVe(t))return t.replace(cJ,"");if(t.startsWith(_ge)){let r=t.replace(_ge,""),n=bge.Buffer.from(r,"base64");return m4().decryptString(n)}if(t.startsWith(vge)){let r=t.replace(vge,""),n=await wge(),o=zVe(r),i=await crypto.subtle.decrypt(lJ,n,o);return new TextDecoder().decode(i)}let e=t.replace(Sge,"");try{if(m4()?.isEncryptionAvailable())try{let i=bge.Buffer.from(e,"base64");return m4().decryptString(i)}catch{}let r=await wge(),n=zVe(e),o=await crypto.subtle.decrypt(lJ,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function Lur(t){return!t.startsWith(Sge)&&!t.startsWith(cJ)}function WVe(t){return t.startsWith(cJ)}function Fur(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 zVe(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 bge,HVe,uJ,_ge,vge,Sge,cJ,Dur,lJ,BR=w(()=>{bge=F(Pp()),HVe=require("obsidian"),uJ=null;_ge="enc_desk_",vge="enc_web_",Sge="enc_",cJ="dec_",Dur=new TextEncoder().encode("obsidian-copilot-v1"),lJ={name:"AES-GCM",iv:new Uint8Array(12)}});function YVe(t){ls.set(fJ,t)}function mJ(){return ls.get(fJ)}function ZVe(t){return ls.sub(fJ,t)}function wF(){return a4(fJ,{store:ls})}function Fh(){return ls.get(pJ)}function qR(t){ls.set(pJ,t)}function XVe(t){return ls.sub(pJ,t)}function by(){return a4(pJ,{store:ls})}function UR(t){ls.set(dJ,t)}function Mc(){return ls.get(dJ)}function SF(t){return ls.sub(dJ,()=>{t(ls.get(dJ))})}function GE(t){ls.set(JVe,t)}function QVe(){return a4(JVe,{store:ls})}function zR(){return Fh()==="project"}function Cge(t){ls.set(xge,t)}function hJ(){return ls.get(xge)}function e8e(t){let e=hJ();Cge([...e,t])}function t8e(t){let e=hJ();Cge(e.filter(r=>r.id!==t))}function r8e(){Cge([])}function n8e(){return a4(xge,{store:ls})}var KVe,fJ,GVe,pJ,dJ,JVe,xge,Cl=w(()=>{Fd();nr();s4();KVe=Ih(null),fJ=Ih(t=>{let e=t(KVe);return e!==null?e:t(RR).defaultModelKey},(t,e,r)=>{e(KVe,r)}),GVe=Ih(null),pJ=Ih(t=>{let e=t(GVe);return e!==null?e:t(RR).defaultChainType},(t,e,r)=>{e(GVe,r)}),dJ=Ih(null),JVe=Ih(!1),xge=Ih([])});var p8e=v(Ui=>{"use strict";function Tge(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<gJ(o,e))t[n]=e,t[r]=o,r=n;else break e}}function _y(t){return t.length===0?null:t[0]}function bJ(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>gJ(s,r))u<o&&0>gJ(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>gJ(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function gJ(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(o8e=performance,Ui.unstable_now=function(){return o8e.now()}):(Oge=Date,i8e=Oge.now(),Ui.unstable_now=function(){return Oge.now()-i8e});var o8e,Oge,i8e,o_=[],JE=[],kur=1,kh=null,kd=3,_J=!1,HR=!1,g4=!1,u8e=typeof setTimeout=="function"?setTimeout:null,l8e=typeof clearTimeout=="function"?clearTimeout:null,a8e=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Age(t){for(var e=_y(JE);e!==null;){if(e.callback===null)bJ(JE);else if(e.startTime<=t)bJ(JE),e.sortIndex=e.expirationTime,Tge(o_,e);else break;e=_y(JE)}}function Ige(t){if(g4=!1,Age(t),!HR)if(_y(o_)!==null)HR=!0,Rge(Mge);else{var e=_y(JE);e!==null&&jge(Ige,e.startTime-t)}}function Mge(t,e){HR=!1,g4&&(g4=!1,l8e(y4),y4=-1),_J=!0;var r=kd;try{for(Age(e),kh=_y(o_);kh!==null&&(!(kh.expirationTime>e)||t&&!f8e());){var n=kh.callback;if(typeof n=="function"){kh.callback=null,kd=kh.priorityLevel;var o=n(kh.expirationTime<=e);e=Ui.unstable_now(),typeof o=="function"?kh.callback=o:kh===_y(o_)&&bJ(o_),Age(e)}else bJ(o_);kh=_y(o_)}if(kh!==null)var i=!0;else{var a=_y(JE);a!==null&&jge(Ige,a.startTime-e),i=!1}return i}finally{kh=null,kd=r,_J=!1}}var vJ=!1,yJ=null,y4=-1,c8e=5,d8e=-1;function f8e(){return!(Ui.unstable_now()-d8e<c8e)}function Pge(){if(yJ!==null){var t=Ui.unstable_now();d8e=t;var e=!0;try{e=yJ(!0,t)}finally{e?h4():(vJ=!1,yJ=null)}}else vJ=!1}var h4;typeof a8e=="function"?h4=function(){a8e(Pge)}:typeof MessageChannel<"u"?(Ege=new MessageChannel,s8e=Ege.port2,Ege.port1.onmessage=Pge,h4=function(){s8e.postMessage(null)}):h4=function(){u8e(Pge,0)};var Ege,s8e;function Rge(t){yJ=t,vJ||(vJ=!0,h4())}function jge(t,e){y4=u8e(function(){t(Ui.unstable_now())},e)}Ui.unstable_IdlePriority=5;Ui.unstable_ImmediatePriority=1;Ui.unstable_LowPriority=4;Ui.unstable_NormalPriority=3;Ui.unstable_Profiling=null;Ui.unstable_UserBlockingPriority=2;Ui.unstable_cancelCallback=function(t){t.callback=null};Ui.unstable_continueExecution=function(){HR||_J||(HR=!0,Rge(Mge))};Ui.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"):c8e=0<t?Math.floor(1e3/t):5};Ui.unstable_getCurrentPriorityLevel=function(){return kd};Ui.unstable_getFirstCallbackNode=function(){return _y(o_)};Ui.unstable_next=function(t){switch(kd){case 1:case 2:case 3:var e=3;break;default:e=kd}var r=kd;kd=e;try{return t()}finally{kd=r}};Ui.unstable_pauseExecution=function(){};Ui.unstable_requestPaint=function(){};Ui.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=kd;kd=t;try{return e()}finally{kd=r}};Ui.unstable_scheduleCallback=function(t,e,r){var n=Ui.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:kur++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,Tge(JE,t),_y(o_)===null&&t===_y(JE)&&(g4?(l8e(y4),y4=-1):g4=!0,jge(Ige,r-n))):(t.sortIndex=o,Tge(o_,t),HR||_J||(HR=!0,Rge(Mge))),t};Ui.unstable_shouldYield=f8e;Ui.unstable_wrapCallback=function(t){var e=kd;return function(){var r=kd;kd=e;try{return t.apply(this,arguments)}finally{kd=r}}}});var h8e=v((zzn,m8e)=>{"use strict";m8e.exports=p8e()});var wWe=v(Tm=>{"use strict";var S6e=X(),Pm=h8e();function qe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)e+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var x6e=new Set,$4={};function n1(t,e){zF(t,e),zF(t+"Capture",e)}function zF(t,e){for($4[t]=e,t=0;t<e.length;t++)x6e.add(e[t])}var zC=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rye=Object.prototype.hasOwnProperty,$ur=/^[: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]*$/,g8e={},y8e={};function Bur(t){return rye.call(y8e,t)?!0:rye.call(g8e,t)?!1:$ur.test(t)?y8e[t]=!0:(g8e[t]=!0,!1)}function qur(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 Uur(t,e,r,n){if(e===null||typeof e>"u"||qur(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 qf(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 Nc={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Nc[t]=new qf(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Nc[e]=new qf(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Nc[t]=new qf(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Nc[t]=new qf(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){Nc[t]=new qf(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Nc[t]=new qf(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Nc[t]=new qf(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Nc[t]=new qf(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Nc[t]=new qf(t,5,!1,t.toLowerCase(),null,!1,!1)});var Gye=/[\-:]([a-z])/g;function Jye(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(Gye,Jye);Nc[e]=new qf(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(Gye,Jye);Nc[e]=new qf(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(Gye,Jye);Nc[e]=new qf(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!1,!1)});Nc.xlinkHref=new qf("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Nc[t]=new qf(t,1,!1,t.toLowerCase(),null,!0,!0)});function Yye(t,e,r,n){var o=Nc.hasOwnProperty(e)?Nc[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Uur(e,r,o,n)&&(r=null),n||o===null?Bur(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 KC=S6e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,wJ=Symbol.for("react.element"),OF=Symbol.for("react.portal"),PF=Symbol.for("react.fragment"),Zye=Symbol.for("react.strict_mode"),nye=Symbol.for("react.profiler"),C6e=Symbol.for("react.provider"),O6e=Symbol.for("react.context"),Xye=Symbol.for("react.forward_ref"),oye=Symbol.for("react.suspense"),iye=Symbol.for("react.suspense_list"),Qye=Symbol.for("react.memo"),ZE=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var P6e=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var b8e=Symbol.iterator;function b4(t){return t===null||typeof t!="object"?null:(t=b8e&&t[b8e]||t["@@iterator"],typeof t=="function"?t:null)}var $a=Object.assign,Nge;function P4(t){if(Nge===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);Nge=e&&e[1]||""}return`
`+Nge+t}var Dge=!1;function Lge(t,e){if(!t||Dge)return"";Dge=!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{Dge=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?P4(t):""}function zur(t){switch(t.tag){case 5:return P4(t.type);case 16:return P4("Lazy");case 13:return P4("Suspense");case 19:return P4("SuspenseList");case 0:case 2:case 15:return t=Lge(t.type,!1),t;case 11:return t=Lge(t.type.render,!1),t;case 1:return t=Lge(t.type,!0),t;default:return""}}function aye(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 PF:return"Fragment";case OF:return"Portal";case nye:return"Profiler";case Zye:return"StrictMode";case oye:return"Suspense";case iye:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case O6e:return(t.displayName||"Context")+".Consumer";case C6e:return(t._context.displayName||"Context")+".Provider";case Xye:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qye:return e=t.displayName||null,e!==null?e:aye(t.type)||"Memo";case ZE:e=t._payload,t=t._init;try{return aye(t(e))}catch{}}return null}function Hur(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 aye(e);case 8:return e===Zye?"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 dT(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function E6e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Vur(t){var e=E6e(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 SJ(t){t._valueTracker||(t._valueTracker=Vur(t))}function T6e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=E6e(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function YJ(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 sye(t,e){var r=e.checked;return $a({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function _8e(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=dT(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 A6e(t,e){e=e.checked,e!=null&&Yye(t,"checked",e,!1)}function uye(t,e){A6e(t,e);var r=dT(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")?lye(t,e.type,r):e.hasOwnProperty("defaultValue")&&lye(t,e.type,dT(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function v8e(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 lye(t,e,r){(e!=="number"||YJ(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var E4=Array.isArray;function FF(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=""+dT(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 cye(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(qe(91));return $a({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function w8e(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(qe(92));if(E4(r)){if(1<r.length)throw Error(qe(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:dT(r)}}function I6e(t,e){var r=dT(e.value),n=dT(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 S8e(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function M6e(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 dye(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?M6e(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var xJ,R6e=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(xJ=xJ||document.createElement("div"),xJ.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=xJ.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function B4(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var I4={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},Wur=["Webkit","ms","Moz","O"];Object.keys(I4).forEach(function(t){Wur.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),I4[e]=I4[t]})});function j6e(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||I4.hasOwnProperty(t)&&I4[t]?(""+e).trim():e+"px"}function N6e(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=j6e(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var Kur=$a({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 fye(t,e){if(e){if(Kur[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(qe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(qe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(qe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(qe(62))}}function pye(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 mye=null;function ebe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var hye=null,kF=null,$F=null;function x8e(t){if(t=o3(t)){if(typeof hye!="function")throw Error(qe(280));var e=t.stateNode;e&&(e=C7(e),hye(t.stateNode,t.type,e))}}function D6e(t){kF?$F?$F.push(t):$F=[t]:kF=t}function L6e(){if(kF){var t=kF,e=$F;if($F=kF=null,x8e(t),e)for(t=0;t<e.length;t++)x8e(e[t])}}function F6e(t,e){return t(e)}function k6e(){}var Fge=!1;function $6e(t,e,r){if(Fge)return t(e,r);Fge=!0;try{return F6e(t,e,r)}finally{Fge=!1,(kF!==null||$F!==null)&&(k6e(),L6e())}}function q4(t,e){var r=t.stateNode;if(r===null)return null;var n=C7(r);if(n===null)return null;r=n[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(qe(231,e,typeof r));return r}var gye=!1;if(zC)try{xF={},Object.defineProperty(xF,"passive",{get:function(){gye=!0}}),window.addEventListener("test",xF,xF),window.removeEventListener("test",xF,xF)}catch{gye=!1}var xF;function Gur(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 M4=!1,ZJ=null,XJ=!1,yye=null,Jur={onError:function(t){M4=!0,ZJ=t}};function Yur(t,e,r,n,o,i,a,s,u){M4=!1,ZJ=null,Gur.apply(Jur,arguments)}function Zur(t,e,r,n,o,i,a,s,u){if(Yur.apply(this,arguments),M4){if(M4){var l=ZJ;M4=!1,ZJ=null}else throw Error(qe(198));XJ||(XJ=!0,yye=l)}}function o1(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 B6e(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 C8e(t){if(o1(t)!==t)throw Error(qe(188))}function Xur(t){var e=t.alternate;if(!e){if(e=o1(t),e===null)throw Error(qe(188));return e!==t?null:t}for(var r=t,n=e;;){var o=r.return;if(o===null)break;var i=o.alternate;if(i===null){if(n=o.return,n!==null){r=n;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===r)return C8e(o),t;if(i===n)return C8e(o),e;i=i.sibling}throw Error(qe(188))}if(r.return!==n.return)r=o,n=i;else{for(var a=!1,s=o.child;s;){if(s===r){a=!0,r=o,n=i;break}if(s===n){a=!0,n=o,r=i;break}s=s.sibling}if(!a){for(s=i.child;s;){if(s===r){a=!0,r=i,n=o;break}if(s===n){a=!0,n=i,r=o;break}s=s.sibling}if(!a)throw Error(qe(189))}}if(r.alternate!==n)throw Error(qe(190))}if(r.tag!==3)throw Error(qe(188));return r.stateNode.current===r?t:e}function q6e(t){return t=Xur(t),t!==null?U6e(t):null}function U6e(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=U6e(t);if(e!==null)return e;t=t.sibling}return null}var z6e=Pm.unstable_scheduleCallback,O8e=Pm.unstable_cancelCallback,Qur=Pm.unstable_shouldYield,elr=Pm.unstable_requestPaint,Ts=Pm.unstable_now,tlr=Pm.unstable_getCurrentPriorityLevel,tbe=Pm.unstable_ImmediatePriority,H6e=Pm.unstable_UserBlockingPriority,QJ=Pm.unstable_NormalPriority,rlr=Pm.unstable_LowPriority,V6e=Pm.unstable_IdlePriority,v7=null,u_=null;function nlr(t){if(u_&&typeof u_.onCommitFiberRoot=="function")try{u_.onCommitFiberRoot(v7,t,void 0,(t.current.flags&128)===128)}catch{}}var Cy=Math.clz32?Math.clz32:alr,olr=Math.log,ilr=Math.LN2;function alr(t){return t>>>=0,t===0?32:31-(olr(t)/ilr|0)|0}var CJ=64,OJ=4194304;function T4(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 e7(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=T4(s):(i&=a,i!==0&&(n=T4(i)))}else a=r&~o,a!==0?n=T4(a):i!==0&&(n=T4(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-Cy(e),o=1<<r,n|=t[r],e&=~o;return n}function slr(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 ulr(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-Cy(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=slr(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function bye(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function W6e(){var t=CJ;return CJ<<=1,(CJ&4194240)===0&&(CJ=64),t}function kge(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function r3(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Cy(e),t[e]=r}function llr(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-Cy(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function rbe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-Cy(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var _i=0;function K6e(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var G6e,nbe,J6e,Y6e,Z6e,_ye=!1,PJ=[],nT=null,oT=null,iT=null,U4=new Map,z4=new Map,QE=[],clr="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 P8e(t,e){switch(t){case"focusin":case"focusout":nT=null;break;case"dragenter":case"dragleave":oT=null;break;case"mouseover":case"mouseout":iT=null;break;case"pointerover":case"pointerout":U4.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":z4.delete(e.pointerId)}}function _4(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=o3(e),e!==null&&nbe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function dlr(t,e,r,n,o){switch(e){case"focusin":return nT=_4(nT,t,e,r,n,o),!0;case"dragenter":return oT=_4(oT,t,e,r,n,o),!0;case"mouseover":return iT=_4(iT,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return U4.set(i,_4(U4.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,z4.set(i,_4(z4.get(i)||null,t,e,r,n,o)),!0}return!1}function X6e(t){var e=KR(t.target);if(e!==null){var r=o1(e);if(r!==null){if(e=r.tag,e===13){if(e=B6e(r),e!==null){t.blockedOn=e,Z6e(t.priority,function(){J6e(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 BJ(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=vye(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);mye=n,r.target.dispatchEvent(n),mye=null}else return e=o3(r),e!==null&&nbe(e),t.blockedOn=r,!1;e.shift()}return!0}function E8e(t,e,r){BJ(t)&&r.delete(e)}function flr(){_ye=!1,nT!==null&&BJ(nT)&&(nT=null),oT!==null&&BJ(oT)&&(oT=null),iT!==null&&BJ(iT)&&(iT=null),U4.forEach(E8e),z4.forEach(E8e)}function v4(t,e){t.blockedOn===e&&(t.blockedOn=null,_ye||(_ye=!0,Pm.unstable_scheduleCallback(Pm.unstable_NormalPriority,flr)))}function H4(t){function e(o){return v4(o,t)}if(0<PJ.length){v4(PJ[0],t);for(var r=1;r<PJ.length;r++){var n=PJ[r];n.blockedOn===t&&(n.blockedOn=null)}}for(nT!==null&&v4(nT,t),oT!==null&&v4(oT,t),iT!==null&&v4(iT,t),U4.forEach(e),z4.forEach(e),r=0;r<QE.length;r++)n=QE[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<QE.length&&(r=QE[0],r.blockedOn===null);)X6e(r),r.blockedOn===null&&QE.shift()}var BF=KC.ReactCurrentBatchConfig,t7=!0;function plr(t,e,r,n){var o=_i,i=BF.transition;BF.transition=null;try{_i=1,obe(t,e,r,n)}finally{_i=o,BF.transition=i}}function mlr(t,e,r,n){var o=_i,i=BF.transition;BF.transition=null;try{_i=4,obe(t,e,r,n)}finally{_i=o,BF.transition=i}}function obe(t,e,r,n){if(t7){var o=vye(t,e,r,n);if(o===null)Vge(t,e,n,r7,r),P8e(t,n);else if(dlr(o,t,e,r,n))n.stopPropagation();else if(P8e(t,n),e&4&&-1<clr.indexOf(t)){for(;o!==null;){var i=o3(o);if(i!==null&&G6e(i),i=vye(t,e,r,n),i===null&&Vge(t,e,n,r7,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else Vge(t,e,n,null,r)}}var r7=null;function vye(t,e,r,n){if(r7=null,t=ebe(n),t=KR(t),t!==null)if(e=o1(t),e===null)t=null;else if(r=e.tag,r===13){if(t=B6e(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 r7=t,null}function Q6e(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(tlr()){case tbe:return 1;case H6e:return 4;case QJ:case rlr:return 16;case V6e:return 536870912;default:return 16}default:return 16}}var tT=null,ibe=null,qJ=null;function e5e(){if(qJ)return qJ;var t,e=ibe,r=e.length,n,o="value"in tT?tT.value:tT.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 qJ=o.slice(t,1<n?1-n:void 0)}function UJ(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 EJ(){return!0}function T8e(){return!1}function Em(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)?EJ:T8e,this.isPropagationStopped=T8e,this}return $a(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=EJ)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=EJ)},persist:function(){},isPersistent:EJ}),e}var YF={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},abe=Em(YF),n3=$a({},YF,{view:0,detail:0}),hlr=Em(n3),$ge,Bge,w4,w7=$a({},n3,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sbe,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!==w4&&(w4&&t.type==="mousemove"?($ge=t.screenX-w4.screenX,Bge=t.screenY-w4.screenY):Bge=$ge=0,w4=t),$ge)},movementY:function(t){return"movementY"in t?t.movementY:Bge}}),A8e=Em(w7),glr=$a({},w7,{dataTransfer:0}),ylr=Em(glr),blr=$a({},n3,{relatedTarget:0}),qge=Em(blr),_lr=$a({},YF,{animationName:0,elapsedTime:0,pseudoElement:0}),vlr=Em(_lr),wlr=$a({},YF,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Slr=Em(wlr),xlr=$a({},YF,{data:0}),I8e=Em(xlr),Clr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Olr={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"},Plr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Elr(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Plr[t])?!!e[t]:!1}function sbe(){return Elr}var Tlr=$a({},n3,{key:function(t){if(t.key){var e=Clr[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=UJ(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Olr[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sbe,charCode:function(t){return t.type==="keypress"?UJ(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?UJ(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Alr=Em(Tlr),Ilr=$a({},w7,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),M8e=Em(Ilr),Mlr=$a({},n3,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sbe}),Rlr=Em(Mlr),jlr=$a({},YF,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nlr=Em(jlr),Dlr=$a({},w7,{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}),Llr=Em(Dlr),Flr=[9,13,27,32],ube=zC&&"CompositionEvent"in window,R4=null;zC&&"documentMode"in document&&(R4=document.documentMode);var klr=zC&&"TextEvent"in window&&!R4,t5e=zC&&(!ube||R4&&8<R4&&11>=R4),R8e=" ",j8e=!1;function r5e(t,e){switch(t){case"keyup":return Flr.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function n5e(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var EF=!1;function $lr(t,e){switch(t){case"compositionend":return n5e(e);case"keypress":return e.which!==32?null:(j8e=!0,R8e);case"textInput":return t=e.data,t===R8e&&j8e?null:t;default:return null}}function Blr(t,e){if(EF)return t==="compositionend"||!ube&&r5e(t,e)?(t=e5e(),qJ=ibe=tT=null,EF=!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 t5e&&e.locale!=="ko"?null:e.data;default:return null}}var qlr={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 N8e(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!qlr[t.type]:e==="textarea"}function o5e(t,e,r,n){D6e(n),e=n7(e,"onChange"),0<e.length&&(r=new abe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var j4=null,V4=null;function Ulr(t){h5e(t,0)}function S7(t){var e=IF(t);if(T6e(e))return t}function zlr(t,e){if(t==="change")return e}var i5e=!1;zC&&(zC?(AJ="oninput"in document,AJ||(Uge=document.createElement("div"),Uge.setAttribute("oninput","return;"),AJ=typeof Uge.oninput=="function"),TJ=AJ):TJ=!1,i5e=TJ&&(!document.documentMode||9<document.documentMode));var TJ,AJ,Uge;function D8e(){j4&&(j4.detachEvent("onpropertychange",a5e),V4=j4=null)}function a5e(t){if(t.propertyName==="value"&&S7(V4)){var e=[];o5e(e,V4,t,ebe(t)),$6e(Ulr,e)}}function Hlr(t,e,r){t==="focusin"?(D8e(),j4=e,V4=r,j4.attachEvent("onpropertychange",a5e)):t==="focusout"&&D8e()}function Vlr(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return S7(V4)}function Wlr(t,e){if(t==="click")return S7(e)}function Klr(t,e){if(t==="input"||t==="change")return S7(e)}function Glr(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Py=typeof Object.is=="function"?Object.is:Glr;function W4(t,e){if(Py(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(!rye.call(e,o)||!Py(t[o],e[o]))return!1}return!0}function L8e(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function F8e(t,e){var r=L8e(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=L8e(r)}}function s5e(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?s5e(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function u5e(){for(var t=window,e=YJ();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=YJ(t.document)}return e}function lbe(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 Jlr(t){var e=u5e(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&s5e(r.ownerDocument.documentElement,r)){if(n!==null&&lbe(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=F8e(r,i);var a=F8e(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 Ylr=zC&&"documentMode"in document&&11>=document.documentMode,TF=null,wye=null,N4=null,Sye=!1;function k8e(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Sye||TF==null||TF!==YJ(n)||(n=TF,"selectionStart"in n&&lbe(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}),N4&&W4(N4,n)||(N4=n,n=n7(wye,"onSelect"),0<n.length&&(e=new abe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=TF)))}function IJ(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var AF={animationend:IJ("Animation","AnimationEnd"),animationiteration:IJ("Animation","AnimationIteration"),animationstart:IJ("Animation","AnimationStart"),transitionend:IJ("Transition","TransitionEnd")},zge={},l5e={};zC&&(l5e=document.createElement("div").style,"AnimationEvent"in window||(delete AF.animationend.animation,delete AF.animationiteration.animation,delete AF.animationstart.animation),"TransitionEvent"in window||delete AF.transitionend.transition);function x7(t){if(zge[t])return zge[t];if(!AF[t])return t;var e=AF[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in l5e)return zge[t]=e[r];return t}var c5e=x7("animationend"),d5e=x7("animationiteration"),f5e=x7("animationstart"),p5e=x7("transitionend"),m5e=new Map,$8e="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 pT(t,e){m5e.set(t,e),n1(e,[t])}for(MJ=0;MJ<$8e.length;MJ++)RJ=$8e[MJ],B8e=RJ.toLowerCase(),q8e=RJ[0].toUpperCase()+RJ.slice(1),pT(B8e,"on"+q8e);var RJ,B8e,q8e,MJ;pT(c5e,"onAnimationEnd");pT(d5e,"onAnimationIteration");pT(f5e,"onAnimationStart");pT("dblclick","onDoubleClick");pT("focusin","onFocus");pT("focusout","onBlur");pT(p5e,"onTransitionEnd");zF("onMouseEnter",["mouseout","mouseover"]);zF("onMouseLeave",["mouseout","mouseover"]);zF("onPointerEnter",["pointerout","pointerover"]);zF("onPointerLeave",["pointerout","pointerover"]);n1("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));n1("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));n1("onBeforeInput",["compositionend","keypress","textInput","paste"]);n1("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));n1("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));n1("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var A4="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(" "),Zlr=new Set("cancel close invalid load scroll toggle".split(" ").concat(A4));function U8e(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,Zur(n,e,void 0,t),t.currentTarget=null}function h5e(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;U8e(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;U8e(o,s,l),i=u}}}if(XJ)throw t=yye,XJ=!1,yye=null,t}function ia(t,e){var r=e[Eye];r===void 0&&(r=e[Eye]=new Set);var n=t+"__bubble";r.has(n)||(g5e(e,t,2,!1),r.add(n))}function Hge(t,e,r){var n=0;e&&(n|=4),g5e(r,t,n,e)}var jJ="_reactListening"+Math.random().toString(36).slice(2);function K4(t){if(!t[jJ]){t[jJ]=!0,x6e.forEach(function(r){r!=="selectionchange"&&(Zlr.has(r)||Hge(r,!1,t),Hge(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[jJ]||(e[jJ]=!0,Hge("selectionchange",!1,e))}}function g5e(t,e,r,n){switch(Q6e(e)){case 1:var o=plr;break;case 4:o=mlr;break;default:o=obe}r=o.bind(null,e,r,t),o=void 0,!gye||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 Vge(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=KR(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}$6e(function(){var l=i,c=ebe(r),d=[];e:{var f=m5e.get(t);if(f!==void 0){var p=abe,m=t;switch(t){case"keypress":if(UJ(r)===0)break e;case"keydown":case"keyup":p=Alr;break;case"focusin":m="focus",p=qge;break;case"focusout":m="blur",p=qge;break;case"beforeblur":case"afterblur":p=qge;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=A8e;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=ylr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Rlr;break;case c5e:case d5e:case f5e:p=vlr;break;case p5e:p=Nlr;break;case"scroll":p=hlr;break;case"wheel":p=Llr;break;case"copy":case"cut":case"paste":p=Slr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=M8e}var h=(e&4)!==0,b=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var y=l,S;y!==null;){S=y;var x=S.stateNode;if(S.tag===5&&x!==null&&(S=x,g!==null&&(x=q4(y,g),x!=null&&h.push(G4(y,x,S)))),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!==mye&&(m=r.relatedTarget||r.fromElement)&&(KR(m)||m[HC]))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?KR(m):null,m!==null&&(b=o1(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=A8e,x="onMouseLeave",g="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(h=M8e,x="onPointerLeave",g="onPointerEnter",y="pointer"),b=p==null?f:IF(p),S=m==null?f:IF(m),f=new h(x,y+"leave",p,r,c),f.target=b,f.relatedTarget=S,x=null,KR(c)===l&&(h=new h(g,y+"enter",m,r,c),h.target=S,h.relatedTarget=b,x=h),b=x,p&&m)t:{for(h=p,g=m,y=0,S=h;S;S=CF(S))y++;for(S=0,x=g;x;x=CF(x))S++;for(;0<y-S;)h=CF(h),y--;for(;0<S-y;)g=CF(g),S--;for(;y--;){if(h===g||g!==null&&h===g.alternate)break t;h=CF(h),g=CF(g)}h=null}else h=null;p!==null&&z8e(d,f,p,h,!1),m!==null&&b!==null&&z8e(d,b,m,h,!0)}}e:{if(f=l?IF(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var O=zlr;else if(N8e(f))if(i5e)O=Klr;else{O=Vlr;var P=Hlr}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=Wlr);if(O&&(O=O(t,l))){o5e(d,O,r,c);break e}P&&P(t,f,l),t==="focusout"&&(P=f._wrapperState)&&P.controlled&&f.type==="number"&&lye(f,"number",f.value)}switch(P=l?IF(l):window,t){case"focusin":(N8e(P)||P.contentEditable==="true")&&(TF=P,wye=l,N4=null);break;case"focusout":N4=wye=TF=null;break;case"mousedown":Sye=!0;break;case"contextmenu":case"mouseup":case"dragend":Sye=!1,k8e(d,r,c);break;case"selectionchange":if(Ylr)break;case"keydown":case"keyup":k8e(d,r,c)}var E;if(ube)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 EF?r5e(t,r)&&(A="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(A="onCompositionStart");A&&(t5e&&r.locale!=="ko"&&(EF||A!=="onCompositionStart"?A==="onCompositionEnd"&&EF&&(E=e5e()):(tT=c,ibe="value"in tT?tT.value:tT.textContent,EF=!0)),P=n7(l,A),0<P.length&&(A=new I8e(A,t,null,r,c),d.push({event:A,listeners:P}),E?A.data=E:(E=n5e(r),E!==null&&(A.data=E)))),(E=klr?$lr(t,r):Blr(t,r))&&(l=n7(l,"onBeforeInput"),0<l.length&&(c=new I8e("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}h5e(d,e)})}function G4(t,e,r){return{instance:t,listener:e,currentTarget:r}}function n7(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=q4(t,r),i!=null&&n.unshift(G4(t,i,o)),i=q4(t,e),i!=null&&n.push(G4(t,i,o))),t=t.return}return n}function CF(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function z8e(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=q4(r,i),u!=null&&a.unshift(G4(r,u,s))):o||(u=q4(r,i),u!=null&&a.push(G4(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var Xlr=/\r\n?/g,Qlr=/\u0000|\uFFFD/g;function H8e(t){return(typeof t=="string"?t:""+t).replace(Xlr,`
`).replace(Qlr,"")}function NJ(t,e,r){if(e=H8e(e),H8e(t)!==e&&r)throw Error(qe(425))}function o7(){}var xye=null,Cye=null;function Oye(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 Pye=typeof setTimeout=="function"?setTimeout:void 0,ecr=typeof clearTimeout=="function"?clearTimeout:void 0,V8e=typeof Promise=="function"?Promise:void 0,tcr=typeof queueMicrotask=="function"?queueMicrotask:typeof V8e<"u"?function(t){return V8e.resolve(null).then(t).catch(rcr)}:Pye;function rcr(t){setTimeout(function(){throw t})}function Wge(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),H4(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);H4(e)}function aT(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 W8e(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 ZF=Math.random().toString(36).slice(2),s_="__reactFiber$"+ZF,J4="__reactProps$"+ZF,HC="__reactContainer$"+ZF,Eye="__reactEvents$"+ZF,ncr="__reactListeners$"+ZF,ocr="__reactHandles$"+ZF;function KR(t){var e=t[s_];if(e)return e;for(var r=t.parentNode;r;){if(e=r[HC]||r[s_]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=W8e(t);t!==null;){if(r=t[s_])return r;t=W8e(t)}return e}t=r,r=t.parentNode}return null}function o3(t){return t=t[s_]||t[HC],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function IF(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(qe(33))}function C7(t){return t[J4]||null}var Tye=[],MF=-1;function mT(t){return{current:t}}function aa(t){0>MF||(t.current=Tye[MF],Tye[MF]=null,MF--)}function zi(t,e){MF++,Tye[MF]=t.current,t.current=e}var fT={},Ud=mT(fT),Ap=mT(!1),XR=fT;function HF(t,e){var r=t.type.contextTypes;if(!r)return fT;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 Ip(t){return t=t.childContextTypes,t!=null}function i7(){aa(Ap),aa(Ud)}function K8e(t,e,r){if(Ud.current!==fT)throw Error(qe(168));zi(Ud,e),zi(Ap,r)}function y5e(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var o in n)if(!(o in e))throw Error(qe(108,Hur(t)||"Unknown",o));return $a({},r,n)}function a7(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fT,XR=Ud.current,zi(Ud,t),zi(Ap,Ap.current),!0}function G8e(t,e,r){var n=t.stateNode;if(!n)throw Error(qe(169));r?(t=y5e(t,e,XR),n.__reactInternalMemoizedMergedChildContext=t,aa(Ap),aa(Ud),zi(Ud,t)):aa(Ap),zi(Ap,r)}var $C=null,O7=!1,Kge=!1;function b5e(t){$C===null?$C=[t]:$C.push(t)}function icr(t){O7=!0,b5e(t)}function hT(){if(!Kge&&$C!==null){Kge=!0;var t=0,e=_i;try{var r=$C;for(_i=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}$C=null,O7=!1}catch(o){throw $C!==null&&($C=$C.slice(t+1)),z6e(tbe,hT),o}finally{_i=e,Kge=!1}}return null}var RF=[],jF=0,s7=null,u7=0,$h=[],Bh=0,QR=null,BC=1,qC="";function VR(t,e){RF[jF++]=u7,RF[jF++]=s7,s7=t,u7=e}function _5e(t,e,r){$h[Bh++]=BC,$h[Bh++]=qC,$h[Bh++]=QR,QR=t;var n=BC;t=qC;var o=32-Cy(n)-1;n&=~(1<<o),r+=1;var i=32-Cy(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,BC=1<<32-Cy(e)+o|r<<o|n,qC=i+t}else BC=1<<i|r<<o|n,qC=t}function cbe(t){t.return!==null&&(VR(t,1),_5e(t,1,0))}function dbe(t){for(;t===s7;)s7=RF[--jF],RF[jF]=null,u7=RF[--jF],RF[jF]=null;for(;t===QR;)QR=$h[--Bh],$h[Bh]=null,qC=$h[--Bh],$h[Bh]=null,BC=$h[--Bh],$h[Bh]=null}var Om=null,Cm=null,Ca=!1,xy=null;function v5e(t,e){var r=qh(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 J8e(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,Om=t,Cm=aT(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Om=t,Cm=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=QR!==null?{id:BC,overflow:qC}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=qh(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Om=t,Cm=null,!0):!1;default:return!1}}function Aye(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Iye(t){if(Ca){var e=Cm;if(e){var r=e;if(!J8e(t,e)){if(Aye(t))throw Error(qe(418));e=aT(r.nextSibling);var n=Om;e&&J8e(t,e)?v5e(n,r):(t.flags=t.flags&-4097|2,Ca=!1,Om=t)}}else{if(Aye(t))throw Error(qe(418));t.flags=t.flags&-4097|2,Ca=!1,Om=t}}}function Y8e(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Om=t}function DJ(t){if(t!==Om)return!1;if(!Ca)return Y8e(t),Ca=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Oye(t.type,t.memoizedProps)),e&&(e=Cm)){if(Aye(t))throw w5e(),Error(qe(418));for(;e;)v5e(t,e),e=aT(e.nextSibling)}if(Y8e(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(qe(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Cm=aT(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Cm=null}}else Cm=Om?aT(t.stateNode.nextSibling):null;return!0}function w5e(){for(var t=Cm;t;)t=aT(t.nextSibling)}function VF(){Cm=Om=null,Ca=!1}function fbe(t){xy===null?xy=[t]:xy.push(t)}var acr=KC.ReactCurrentBatchConfig;function wy(t,e){if(t&&t.defaultProps){e=$a({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var l7=mT(null),c7=null,NF=null,pbe=null;function mbe(){pbe=NF=c7=null}function hbe(t){var e=l7.current;aa(l7),t._currentValue=e}function Mye(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 qF(t,e){c7=t,pbe=NF=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(Tp=!0),t.firstContext=null)}function zh(t){var e=t._currentValue;if(pbe!==t)if(t={context:t,memoizedValue:e,next:null},NF===null){if(c7===null)throw Error(qe(308));NF=t,c7.dependencies={lanes:0,firstContext:t}}else NF=NF.next=t;return e}var GR=null;function gbe(t){GR===null?GR=[t]:GR.push(t)}function S5e(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,gbe(e)):(r.next=o.next,o.next=r),e.interleaved=r,VC(t,n)}function VC(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 XE=!1;function ybe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function x5e(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 UC(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function sT(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(bo&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,VC(t,r)}return o=n.interleaved,o===null?(e.next=e,gbe(n)):(e.next=o.next,o.next=e),n.interleaved=e,VC(t,r)}function zJ(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,rbe(t,r)}}function Z8e(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 d7(t,e,r,n){var o=t.updateQueue;XE=!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=$a({},d,f);break e;case 2:XE=!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);t1|=a,t.lanes=a,t.memoizedState=d}}function X8e(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],o=n.callback;if(o!==null){if(n.callback=null,n=r,typeof o!="function")throw Error(qe(191,o));o.call(n)}}}var C5e=new S6e.Component().refs;function Rye(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:$a({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var P7={isMounted:function(t){return(t=t._reactInternals)?o1(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Bf(),o=lT(t),i=UC(n,o);i.payload=e,r!=null&&(i.callback=r),e=sT(t,i,o),e!==null&&(Oy(e,t,o,n),zJ(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Bf(),o=lT(t),i=UC(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=sT(t,i,o),e!==null&&(Oy(e,t,o,n),zJ(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Bf(),n=lT(t),o=UC(r,n);o.tag=2,e!=null&&(o.callback=e),e=sT(t,o,n),e!==null&&(Oy(e,t,n,r),zJ(e,t,n))}};function Q8e(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?!W4(r,n)||!W4(o,i):!0}function O5e(t,e,r){var n=!1,o=fT,i=e.contextType;return typeof i=="object"&&i!==null?i=zh(i):(o=Ip(e)?XR:Ud.current,n=e.contextTypes,i=(n=n!=null)?HF(t,o):fT),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=P7,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function e6e(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&&P7.enqueueReplaceState(e,e.state,null)}function jye(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=C5e,ybe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=zh(i):(i=Ip(e)?XR:Ud.current,o.context=HF(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Rye(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&&P7.enqueueReplaceState(o,o.state,null),d7(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function S4(t,e,r){if(t=r.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(qe(309));var n=r.stateNode}if(!n)throw Error(qe(147,t));var o=n,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(a){var s=o.refs;s===C5e&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(qe(284));if(!r._owner)throw Error(qe(290,t))}return t}function LJ(t,e){throw t=Object.prototype.toString.call(e),Error(qe(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function t6e(t){var e=t._init;return e(t._payload)}function P5e(t){function e(g,y){if(t){var S=g.deletions;S===null?(g.deletions=[y],g.flags|=16):S.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=cT(g,y),g.index=0,g.sibling=null,g}function i(g,y,S){return g.index=S,t?(S=g.alternate,S!==null?(S=S.index,S<y?(g.flags|=2,y):S):(g.flags|=2,y)):(g.flags|=1048576,y)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,y,S,x){return y===null||y.tag!==6?(y=eye(S,g.mode,x),y.return=g,y):(y=o(y,S),y.return=g,y)}function u(g,y,S,x){var O=S.type;return O===PF?c(g,y,S.props.children,x,S.key):y!==null&&(y.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===ZE&&t6e(O)===y.type)?(x=o(y,S.props),x.ref=S4(g,y,S),x.return=g,x):(x=JJ(S.type,S.key,S.props,null,g.mode,x),x.ref=S4(g,y,S),x.return=g,x)}function l(g,y,S,x){return y===null||y.tag!==4||y.stateNode.containerInfo!==S.containerInfo||y.stateNode.implementation!==S.implementation?(y=tye(S,g.mode,x),y.return=g,y):(y=o(y,S.children||[]),y.return=g,y)}function c(g,y,S,x,O){return y===null||y.tag!==7?(y=ZR(S,g.mode,x,O),y.return=g,y):(y=o(y,S),y.return=g,y)}function d(g,y,S){if(typeof y=="string"&&y!==""||typeof y=="number")return y=eye(""+y,g.mode,S),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case wJ:return S=JJ(y.type,y.key,y.props,null,g.mode,S),S.ref=S4(g,null,y),S.return=g,S;case OF:return y=tye(y,g.mode,S),y.return=g,y;case ZE:var x=y._init;return d(g,x(y._payload),S)}if(E4(y)||b4(y))return y=ZR(y,g.mode,S,null),y.return=g,y;LJ(g,y)}return null}function f(g,y,S,x){var O=y!==null?y.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return O!==null?null:s(g,y,""+S,x);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case wJ:return S.key===O?u(g,y,S,x):null;case OF:return S.key===O?l(g,y,S,x):null;case ZE:return O=S._init,f(g,y,O(S._payload),x)}if(E4(S)||b4(S))return O!==null?null:c(g,y,S,x,null);LJ(g,S)}return null}function p(g,y,S,x,O){if(typeof x=="string"&&x!==""||typeof x=="number")return g=g.get(S)||null,s(y,g,""+x,O);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case wJ:return g=g.get(x.key===null?S:x.key)||null,u(y,g,x,O);case OF:return g=g.get(x.key===null?S:x.key)||null,l(y,g,x,O);case ZE:var P=x._init;return p(g,y,S,P(x._payload),O)}if(E4(x)||b4(x))return g=g.get(S)||null,c(y,g,x,O,null);LJ(y,x)}return null}function m(g,y,S,x){for(var O=null,P=null,E=y,A=y=0,I=null;E!==null&&A<S.length;A++){E.index>A?(I=E,E=null):I=E.sibling;var R=f(g,E,S[A],x);if(R===null){E===null&&(E=I);break}t&&E&&R.alternate===null&&e(g,E),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R,E=I}if(A===S.length)return r(g,E),Ca&&VR(g,A),O;if(E===null){for(;A<S.length;A++)E=d(g,S[A],x),E!==null&&(y=i(E,y,A),P===null?O=E:P.sibling=E,P=E);return Ca&&VR(g,A),O}for(E=n(g,E);A<S.length;A++)I=p(E,g,A,S[A],x),I!==null&&(t&&I.alternate!==null&&E.delete(I.key===null?A:I.key),y=i(I,y,A),P===null?O=I:P.sibling=I,P=I);return t&&E.forEach(function(N){return e(g,N)}),Ca&&VR(g,A),O}function h(g,y,S,x){var O=b4(S);if(typeof O!="function")throw Error(qe(150));if(S=O.call(S),S==null)throw Error(qe(151));for(var P=O=null,E=y,A=y=0,I=null,R=S.next();E!==null&&!R.done;A++,R=S.next()){E.index>A?(I=E,E=null):I=E.sibling;var N=f(g,E,R.value,x);if(N===null){E===null&&(E=I);break}t&&E&&N.alternate===null&&e(g,E),y=i(N,y,A),P===null?O=N:P.sibling=N,P=N,E=I}if(R.done)return r(g,E),Ca&&VR(g,A),O;if(E===null){for(;!R.done;A++,R=S.next())R=d(g,R.value,x),R!==null&&(y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return Ca&&VR(g,A),O}for(E=n(g,E);!R.done;A++,R=S.next())R=p(E,g,A,R.value,x),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?A:R.key),y=i(R,y,A),P===null?O=R:P.sibling=R,P=R);return t&&E.forEach(function(j){return e(g,j)}),Ca&&VR(g,A),O}function b(g,y,S,x){if(typeof S=="object"&&S!==null&&S.type===PF&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case wJ:e:{for(var O=S.key,P=y;P!==null;){if(P.key===O){if(O=S.type,O===PF){if(P.tag===7){r(g,P.sibling),y=o(P,S.props.children),y.return=g,g=y;break e}}else if(P.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===ZE&&t6e(O)===P.type){r(g,P.sibling),y=o(P,S.props),y.ref=S4(g,P,S),y.return=g,g=y;break e}r(g,P);break}else e(g,P);P=P.sibling}S.type===PF?(y=ZR(S.props.children,g.mode,x,S.key),y.return=g,g=y):(x=JJ(S.type,S.key,S.props,null,g.mode,x),x.ref=S4(g,y,S),x.return=g,g=x)}return a(g);case OF:e:{for(P=S.key;y!==null;){if(y.key===P)if(y.tag===4&&y.stateNode.containerInfo===S.containerInfo&&y.stateNode.implementation===S.implementation){r(g,y.sibling),y=o(y,S.children||[]),y.return=g,g=y;break e}else{r(g,y);break}else e(g,y);y=y.sibling}y=tye(S,g.mode,x),y.return=g,g=y}return a(g);case ZE:return P=S._init,b(g,y,P(S._payload),x)}if(E4(S))return m(g,y,S,x);if(b4(S))return h(g,y,S,x);LJ(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,y!==null&&y.tag===6?(r(g,y.sibling),y=o(y,S),y.return=g,g=y):(r(g,y),y=eye(S,g.mode,x),y.return=g,g=y),a(g)):r(g,y)}return b}var WF=P5e(!0),E5e=P5e(!1),i3={},l_=mT(i3),Y4=mT(i3),Z4=mT(i3);function JR(t){if(t===i3)throw Error(qe(174));return t}function bbe(t,e){switch(zi(Z4,e),zi(Y4,t),zi(l_,i3),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:dye(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=dye(e,t)}aa(l_),zi(l_,e)}function KF(){aa(l_),aa(Y4),aa(Z4)}function T5e(t){JR(Z4.current);var e=JR(l_.current),r=dye(e,t.type);e!==r&&(zi(Y4,t),zi(l_,r))}function _be(t){Y4.current===t&&(aa(l_),aa(Y4))}var Fa=mT(0);function f7(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 Gge=[];function vbe(){for(var t=0;t<Gge.length;t++)Gge[t]._workInProgressVersionPrimary=null;Gge.length=0}var HJ=KC.ReactCurrentDispatcher,Jge=KC.ReactCurrentBatchConfig,e1=0,ka=null,Ol=null,Kl=null,p7=!1,D4=!1,X4=0,scr=0;function $d(){throw Error(qe(321))}function wbe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!Py(t[r],e[r]))return!1;return!0}function Sbe(t,e,r,n,o,i){if(e1=i,ka=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,HJ.current=t===null||t.memoizedState===null?dcr:fcr,t=r(n,o),D4){i=0;do{if(D4=!1,X4=0,25<=i)throw Error(qe(301));i+=1,Kl=Ol=null,e.updateQueue=null,HJ.current=pcr,t=r(n,o)}while(D4)}if(HJ.current=m7,e=Ol!==null&&Ol.next!==null,e1=0,Kl=Ol=ka=null,p7=!1,e)throw Error(qe(300));return t}function xbe(){var t=X4!==0;return X4=0,t}function a_(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kl===null?ka.memoizedState=Kl=t:Kl=Kl.next=t,Kl}function Hh(){if(Ol===null){var t=ka.alternate;t=t!==null?t.memoizedState:null}else t=Ol.next;var e=Kl===null?ka.memoizedState:Kl.next;if(e!==null)Kl=e,Ol=t;else{if(t===null)throw Error(qe(310));Ol=t,t={memoizedState:Ol.memoizedState,baseState:Ol.baseState,baseQueue:Ol.baseQueue,queue:Ol.queue,next:null},Kl===null?ka.memoizedState=Kl=t:Kl=Kl.next=t}return Kl}function Q4(t,e){return typeof e=="function"?e(t):e}function Yge(t){var e=Hh(),r=e.queue;if(r===null)throw Error(qe(311));r.lastRenderedReducer=t;var n=Ol,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((e1&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,ka.lanes|=c,t1|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,Py(n,e.memoizedState)||(Tp=!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,ka.lanes|=i,t1|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function Zge(t){var e=Hh(),r=e.queue;if(r===null)throw Error(qe(311));r.lastRenderedReducer=t;var n=r.dispatch,o=r.pending,i=e.memoizedState;if(o!==null){r.pending=null;var a=o=o.next;do i=t(i,a.action),a=a.next;while(a!==o);Py(i,e.memoizedState)||(Tp=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function A5e(){}function I5e(t,e){var r=ka,n=Hh(),o=e(),i=!Py(n.memoizedState,o);if(i&&(n.memoizedState=o,Tp=!0),n=n.queue,Cbe(j5e.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||Kl!==null&&Kl.memoizedState.tag&1){if(r.flags|=2048,e3(9,R5e.bind(null,r,n,o,e),void 0,null),Gl===null)throw Error(qe(349));(e1&30)!==0||M5e(r,e,o)}return o}function M5e(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=ka.updateQueue,e===null?(e={lastEffect:null,stores:null},ka.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function R5e(t,e,r,n){e.value=r,e.getSnapshot=n,N5e(e)&&D5e(t)}function j5e(t,e,r){return r(function(){N5e(e)&&D5e(t)})}function N5e(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!Py(t,r)}catch{return!0}}function D5e(t){var e=VC(t,1);e!==null&&Oy(e,t,1,-1)}function r6e(t){var e=a_();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Q4,lastRenderedState:t},e.queue=t,t=t.dispatch=ccr.bind(null,ka,t),[e.memoizedState,t]}function e3(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=ka.updateQueue,e===null?(e={lastEffect:null,stores:null},ka.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 L5e(){return Hh().memoizedState}function VJ(t,e,r,n){var o=a_();ka.flags|=t,o.memoizedState=e3(1|e,r,void 0,n===void 0?null:n)}function E7(t,e,r,n){var o=Hh();n=n===void 0?null:n;var i=void 0;if(Ol!==null){var a=Ol.memoizedState;if(i=a.destroy,n!==null&&wbe(n,a.deps)){o.memoizedState=e3(e,r,i,n);return}}ka.flags|=t,o.memoizedState=e3(1|e,r,i,n)}function n6e(t,e){return VJ(8390656,8,t,e)}function Cbe(t,e){return E7(2048,8,t,e)}function F5e(t,e){return E7(4,2,t,e)}function k5e(t,e){return E7(4,4,t,e)}function $5e(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 B5e(t,e,r){return r=r!=null?r.concat([t]):null,E7(4,4,$5e.bind(null,e,t),r)}function Obe(){}function q5e(t,e){var r=Hh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&wbe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function U5e(t,e){var r=Hh();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&wbe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function z5e(t,e,r){return(e1&21)===0?(t.baseState&&(t.baseState=!1,Tp=!0),t.memoizedState=r):(Py(r,e)||(r=W6e(),ka.lanes|=r,t1|=r,t.baseState=!0),e)}function ucr(t,e){var r=_i;_i=r!==0&&4>r?r:4,t(!0);var n=Jge.transition;Jge.transition={};try{t(!1),e()}finally{_i=r,Jge.transition=n}}function H5e(){return Hh().memoizedState}function lcr(t,e,r){var n=lT(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},V5e(t))W5e(e,r);else if(r=S5e(t,e,r,n),r!==null){var o=Bf();Oy(r,t,n,o),K5e(r,e,n)}}function ccr(t,e,r){var n=lT(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(V5e(t))W5e(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,Py(s,a)){var u=e.interleaved;u===null?(o.next=o,gbe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=S5e(t,e,o,n),r!==null&&(o=Bf(),Oy(r,t,n,o),K5e(r,e,n))}}function V5e(t){var e=t.alternate;return t===ka||e!==null&&e===ka}function W5e(t,e){D4=p7=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function K5e(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,rbe(t,r)}}var m7={readContext:zh,useCallback:$d,useContext:$d,useEffect:$d,useImperativeHandle:$d,useInsertionEffect:$d,useLayoutEffect:$d,useMemo:$d,useReducer:$d,useRef:$d,useState:$d,useDebugValue:$d,useDeferredValue:$d,useTransition:$d,useMutableSource:$d,useSyncExternalStore:$d,useId:$d,unstable_isNewReconciler:!1},dcr={readContext:zh,useCallback:function(t,e){return a_().memoizedState=[t,e===void 0?null:e],t},useContext:zh,useEffect:n6e,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,VJ(4194308,4,$5e.bind(null,e,t),r)},useLayoutEffect:function(t,e){return VJ(4194308,4,t,e)},useInsertionEffect:function(t,e){return VJ(4,2,t,e)},useMemo:function(t,e){var r=a_();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=a_();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=lcr.bind(null,ka,t),[n.memoizedState,t]},useRef:function(t){var e=a_();return t={current:t},e.memoizedState=t},useState:r6e,useDebugValue:Obe,useDeferredValue:function(t){return a_().memoizedState=t},useTransition:function(){var t=r6e(!1),e=t[0];return t=ucr.bind(null,t[1]),a_().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ka,o=a_();if(Ca){if(r===void 0)throw Error(qe(407));r=r()}else{if(r=e(),Gl===null)throw Error(qe(349));(e1&30)!==0||M5e(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,n6e(j5e.bind(null,n,i,t),[t]),n.flags|=2048,e3(9,R5e.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=a_(),e=Gl.identifierPrefix;if(Ca){var r=qC,n=BC;r=(n&~(1<<32-Cy(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=X4++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=scr++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},fcr={readContext:zh,useCallback:q5e,useContext:zh,useEffect:Cbe,useImperativeHandle:B5e,useInsertionEffect:F5e,useLayoutEffect:k5e,useMemo:U5e,useReducer:Yge,useRef:L5e,useState:function(){return Yge(Q4)},useDebugValue:Obe,useDeferredValue:function(t){var e=Hh();return z5e(e,Ol.memoizedState,t)},useTransition:function(){var t=Yge(Q4)[0],e=Hh().memoizedState;return[t,e]},useMutableSource:A5e,useSyncExternalStore:I5e,useId:H5e,unstable_isNewReconciler:!1},pcr={readContext:zh,useCallback:q5e,useContext:zh,useEffect:Cbe,useImperativeHandle:B5e,useInsertionEffect:F5e,useLayoutEffect:k5e,useMemo:U5e,useReducer:Zge,useRef:L5e,useState:function(){return Zge(Q4)},useDebugValue:Obe,useDeferredValue:function(t){var e=Hh();return Ol===null?e.memoizedState=t:z5e(e,Ol.memoizedState,t)},useTransition:function(){var t=Zge(Q4)[0],e=Hh().memoizedState;return[t,e]},useMutableSource:A5e,useSyncExternalStore:I5e,useId:H5e,unstable_isNewReconciler:!1};function GF(t,e){try{var r="",n=e;do r+=zur(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 Xge(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Nye(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var mcr=typeof WeakMap=="function"?WeakMap:Map;function G5e(t,e,r){r=UC(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){g7||(g7=!0,Hye=n),Nye(t,e)},r}function J5e(t,e,r){r=UC(-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(){Nye(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Nye(t,e),typeof n!="function"&&(uT===null?uT=new Set([this]):uT.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function o6e(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new mcr;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=Tcr.bind(null,t,e,r),e.then(t,t))}function i6e(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 a6e(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=UC(-1,1),e.tag=2,sT(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var hcr=KC.ReactCurrentOwner,Tp=!1;function $f(t,e,r,n){e.child=t===null?E5e(e,null,r,n):WF(e,t.child,r,n)}function s6e(t,e,r,n,o){r=r.render;var i=e.ref;return qF(e,o),n=Sbe(t,e,r,n,i,o),r=xbe(),t!==null&&!Tp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,WC(t,e,o)):(Ca&&r&&cbe(e),e.flags|=1,$f(t,e,n,o),e.child)}function u6e(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!jbe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,Y5e(t,e,i,n,o)):(t=JJ(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:W4,r(a,n)&&t.ref===e.ref)return WC(t,e,o)}return e.flags|=1,t=cT(i,n),t.ref=e.ref,t.return=e,e.child=t}function Y5e(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(W4(i,n)&&t.ref===e.ref)if(Tp=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(Tp=!0);else return e.lanes=t.lanes,WC(t,e,o)}return Dye(t,e,r,n,o)}function Z5e(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},zi(LF,xm),xm|=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,zi(LF,xm),xm|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,zi(LF,xm),xm|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,zi(LF,xm),xm|=n;return $f(t,e,o,r),e.child}function X5e(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function Dye(t,e,r,n,o){var i=Ip(r)?XR:Ud.current;return i=HF(e,i),qF(e,o),r=Sbe(t,e,r,n,i,o),n=xbe(),t!==null&&!Tp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,WC(t,e,o)):(Ca&&n&&cbe(e),e.flags|=1,$f(t,e,r,o),e.child)}function l6e(t,e,r,n,o){if(Ip(r)){var i=!0;a7(e)}else i=!1;if(qF(e,o),e.stateNode===null)WJ(t,e),O5e(e,r,n),jye(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=zh(l):(l=Ip(r)?XR:Ud.current,l=HF(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)&&e6e(e,a,n,l),XE=!1;var f=e.memoizedState;a.state=f,d7(e,n,a,o),u=e.memoizedState,s!==n||f!==u||Ap.current||XE?(typeof c=="function"&&(Rye(e,r,c,n),u=e.memoizedState),(s=XE||Q8e(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,x5e(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:wy(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=zh(u):(u=Ip(r)?XR:Ud.current,u=HF(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)&&e6e(e,a,n,u),XE=!1,f=e.memoizedState,a.state=f,d7(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||Ap.current||XE?(typeof p=="function"&&(Rye(e,r,p,n),m=e.memoizedState),(l=XE||Q8e(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 Lye(t,e,r,n,i,o)}function Lye(t,e,r,n,o,i){X5e(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&G8e(e,r,!1),WC(t,e,i);n=e.stateNode,hcr.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=WF(e,t.child,null,i),e.child=WF(e,null,s,i)):$f(t,e,s,i),e.memoizedState=n.state,o&&G8e(e,r,!0),e.child}function Q5e(t){var e=t.stateNode;e.pendingContext?K8e(t,e.pendingContext,e.pendingContext!==e.context):e.context&&K8e(t,e.context,!1),bbe(t,e.containerInfo)}function c6e(t,e,r,n,o){return VF(),fbe(o),e.flags|=256,$f(t,e,r,n),e.child}var Fye={dehydrated:null,treeContext:null,retryLane:0};function kye(t){return{baseLanes:t,cachePool:null,transitions:null}}function eWe(t,e,r){var n=e.pendingProps,o=Fa.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),zi(Fa,o&1),t===null)return Iye(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=I7(a,n,0,null),t=ZR(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=kye(r),e.memoizedState=Fye,t):Pbe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return gcr(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=cT(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=cT(s,i):(i=ZR(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?kye(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=Fye,n}return i=t.child,t=i.sibling,n=cT(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 Pbe(t,e){return e=I7({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function FJ(t,e,r,n){return n!==null&&fbe(n),WF(e,t.child,null,r),t=Pbe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function gcr(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=Xge(Error(qe(422))),FJ(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=I7({mode:"visible",children:n.children},o,0,null),i=ZR(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&WF(e,t.child,null,a),e.child.memoizedState=kye(a),e.memoizedState=Fye,i);if((e.mode&1)===0)return FJ(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(qe(419)),n=Xge(i,n,void 0),FJ(t,e,a,n)}if(s=(a&t.childLanes)!==0,Tp||s){if(n=Gl,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,VC(t,o),Oy(n,t,o,-1))}return Rbe(),n=Xge(Error(qe(421))),FJ(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=Acr.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Cm=aT(o.nextSibling),Om=e,Ca=!0,xy=null,t!==null&&($h[Bh++]=BC,$h[Bh++]=qC,$h[Bh++]=QR,BC=t.id,qC=t.overflow,QR=e),e=Pbe(e,n.children),e.flags|=4096,e)}function d6e(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Mye(t.return,e,r)}function Qge(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 tWe(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if($f(t,e,n.children,r),n=Fa.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&&d6e(t,r,e);else if(t.tag===19)d6e(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(zi(Fa,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&&f7(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),Qge(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&&f7(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}Qge(e,!0,r,null,i);break;case"together":Qge(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function WJ(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function WC(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),t1|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(qe(153));if(e.child!==null){for(t=e.child,r=cT(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=cT(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function ycr(t,e,r){switch(e.tag){case 3:Q5e(e),VF();break;case 5:T5e(e);break;case 1:Ip(e.type)&&a7(e);break;case 4:bbe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;zi(l7,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(zi(Fa,Fa.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?eWe(t,e,r):(zi(Fa,Fa.current&1),t=WC(t,e,r),t!==null?t.sibling:null);zi(Fa,Fa.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return tWe(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),zi(Fa,Fa.current),n)break;return null;case 22:case 23:return e.lanes=0,Z5e(t,e,r)}return WC(t,e,r)}var rWe,$ye,nWe,oWe;rWe=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}};$ye=function(){};nWe=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,JR(l_.current);var i=null;switch(r){case"input":o=sye(t,o),n=sye(t,n),i=[];break;case"select":o=$a({},o,{value:void 0}),n=$a({},n,{value:void 0}),i=[];break;case"textarea":o=cye(t,o),n=cye(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=o7)}fye(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"&&($4.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"&&($4.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&ia("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)}};oWe=function(t,e,r,n){r!==n&&(e.flags|=4)};function x4(t,e){if(!Ca)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 Bd(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 bcr(t,e,r){var n=e.pendingProps;switch(dbe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bd(e),null;case 1:return Ip(e.type)&&i7(),Bd(e),null;case 3:return n=e.stateNode,KF(),aa(Ap),aa(Ud),vbe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(DJ(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,xy!==null&&(Kye(xy),xy=null))),$ye(t,e),Bd(e),null;case 5:_be(e);var o=JR(Z4.current);if(r=e.type,t!==null&&e.stateNode!=null)nWe(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(qe(166));return Bd(e),null}if(t=JR(l_.current),DJ(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[s_]=e,n[J4]=i,t=(e.mode&1)!==0,r){case"dialog":ia("cancel",n),ia("close",n);break;case"iframe":case"object":case"embed":ia("load",n);break;case"video":case"audio":for(o=0;o<A4.length;o++)ia(A4[o],n);break;case"source":ia("error",n);break;case"img":case"image":case"link":ia("error",n),ia("load",n);break;case"details":ia("toggle",n);break;case"input":_8e(n,i),ia("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},ia("invalid",n);break;case"textarea":w8e(n,i),ia("invalid",n)}fye(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&&NJ(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&NJ(n.textContent,s,t),o=["children",""+s]):$4.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&ia("scroll",n)}switch(r){case"input":SJ(n),v8e(n,i,!0);break;case"textarea":SJ(n),S8e(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=o7)}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=M6e(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[s_]=e,t[J4]=n,rWe(t,e,!1,!1),e.stateNode=t;e:{switch(a=pye(r,n),r){case"dialog":ia("cancel",t),ia("close",t),o=n;break;case"iframe":case"object":case"embed":ia("load",t),o=n;break;case"video":case"audio":for(o=0;o<A4.length;o++)ia(A4[o],t);o=n;break;case"source":ia("error",t),o=n;break;case"img":case"image":case"link":ia("error",t),ia("load",t),o=n;break;case"details":ia("toggle",t),o=n;break;case"input":_8e(t,n),o=sye(t,n),ia("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=$a({},n,{value:void 0}),ia("invalid",t);break;case"textarea":w8e(t,n),o=cye(t,n),ia("invalid",t);break;default:o=n}fye(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?N6e(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&R6e(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&B4(t,u):typeof u=="number"&&B4(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&($4.hasOwnProperty(i)?u!=null&&i==="onScroll"&&ia("scroll",t):u!=null&&Yye(t,i,u,a))}switch(r){case"input":SJ(t),v8e(t,n,!1);break;case"textarea":SJ(t),S8e(t);break;case"option":n.value!=null&&t.setAttribute("value",""+dT(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?FF(t,!!n.multiple,i,!1):n.defaultValue!=null&&FF(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=o7)}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 Bd(e),null;case 6:if(t&&e.stateNode!=null)oWe(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(qe(166));if(r=JR(Z4.current),JR(l_.current),DJ(e)){if(n=e.stateNode,r=e.memoizedProps,n[s_]=e,(i=n.nodeValue!==r)&&(t=Om,t!==null))switch(t.tag){case 3:NJ(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&NJ(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[s_]=e,e.stateNode=n}return Bd(e),null;case 13:if(aa(Fa),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ca&&Cm!==null&&(e.mode&1)!==0&&(e.flags&128)===0)w5e(),VF(),e.flags|=98560,i=!1;else if(i=DJ(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(qe(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(qe(317));i[s_]=e}else VF(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Bd(e),i=!1}else xy!==null&&(Kye(xy),xy=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||(Fa.current&1)!==0?Pl===0&&(Pl=3):Rbe())),e.updateQueue!==null&&(e.flags|=4),Bd(e),null);case 4:return KF(),$ye(t,e),t===null&&K4(e.stateNode.containerInfo),Bd(e),null;case 10:return hbe(e.type._context),Bd(e),null;case 17:return Ip(e.type)&&i7(),Bd(e),null;case 19:if(aa(Fa),i=e.memoizedState,i===null)return Bd(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)x4(i,!1);else{if(Pl!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=f7(t),a!==null){for(e.flags|=128,x4(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 zi(Fa,Fa.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ts()>JF&&(e.flags|=128,n=!0,x4(i,!1),e.lanes=4194304)}else{if(!n)if(t=f7(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),x4(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ca)return Bd(e),null}else 2*Ts()-i.renderingStartTime>JF&&r!==1073741824&&(e.flags|=128,n=!0,x4(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=Ts(),e.sibling=null,r=Fa.current,zi(Fa,n?r&1|2:r&1),e):(Bd(e),null);case 22:case 23:return Mbe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(xm&1073741824)!==0&&(Bd(e),e.subtreeFlags&6&&(e.flags|=8192)):Bd(e),null;case 24:return null;case 25:return null}throw Error(qe(156,e.tag))}function _cr(t,e){switch(dbe(e),e.tag){case 1:return Ip(e.type)&&i7(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return KF(),aa(Ap),aa(Ud),vbe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return _be(e),null;case 13:if(aa(Fa),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(qe(340));VF()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return aa(Fa),null;case 4:return KF(),null;case 10:return hbe(e.type._context),null;case 22:case 23:return Mbe(),null;case 24:return null;default:return null}}var kJ=!1,qd=!1,vcr=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function DF(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){cs(t,e,n)}else r.current=null}function Bye(t,e,r){try{r()}catch(n){cs(t,e,n)}}var f6e=!1;function wcr(t,e){if(xye=t7,t=u5e(),lbe(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(Cye={focusedElem:t,selectionRange:r},t7=!1,Ct=e;Ct!==null;)if(e=Ct,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ct=t;else for(;Ct!==null;){e=Ct;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:wy(e.type,h),b);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(qe(163))}}catch(x){cs(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,Ct=t;break}Ct=e.return}return m=f6e,f6e=!1,m}function L4(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&&Bye(e,r,i)}o=o.next}while(o!==n)}}function T7(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 qye(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 iWe(t){var e=t.alternate;e!==null&&(t.alternate=null,iWe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[s_],delete e[J4],delete e[Eye],delete e[ncr],delete e[ocr])),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 aWe(t){return t.tag===5||t.tag===3||t.tag===4}function p6e(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||aWe(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 Uye(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=o7));else if(n!==4&&(t=t.child,t!==null))for(Uye(t,e,r),t=t.sibling;t!==null;)Uye(t,e,r),t=t.sibling}function zye(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(zye(t,e,r),t=t.sibling;t!==null;)zye(t,e,r),t=t.sibling}var Rc=null,Sy=!1;function YE(t,e,r){for(r=r.child;r!==null;)sWe(t,e,r),r=r.sibling}function sWe(t,e,r){if(u_&&typeof u_.onCommitFiberUnmount=="function")try{u_.onCommitFiberUnmount(v7,r)}catch{}switch(r.tag){case 5:qd||DF(r,e);case 6:var n=Rc,o=Sy;Rc=null,YE(t,e,r),Rc=n,Sy=o,Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Rc.removeChild(r.stateNode));break;case 18:Rc!==null&&(Sy?(t=Rc,r=r.stateNode,t.nodeType===8?Wge(t.parentNode,r):t.nodeType===1&&Wge(t,r),H4(t)):Wge(Rc,r.stateNode));break;case 4:n=Rc,o=Sy,Rc=r.stateNode.containerInfo,Sy=!0,YE(t,e,r),Rc=n,Sy=o;break;case 0:case 11:case 14:case 15:if(!qd&&(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)&&Bye(r,e,a),o=o.next}while(o!==n)}YE(t,e,r);break;case 1:if(!qd&&(DF(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){cs(r,e,s)}YE(t,e,r);break;case 21:YE(t,e,r);break;case 22:r.mode&1?(qd=(n=qd)||r.memoizedState!==null,YE(t,e,r),qd=n):YE(t,e,r);break;default:YE(t,e,r)}}function m6e(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new vcr),e.forEach(function(n){var o=Icr.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function vy(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:Rc=s.stateNode,Sy=!1;break e;case 3:Rc=s.stateNode.containerInfo,Sy=!0;break e;case 4:Rc=s.stateNode.containerInfo,Sy=!0;break e}s=s.return}if(Rc===null)throw Error(qe(160));sWe(i,a,o),Rc=null,Sy=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){cs(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)uWe(e,t),e=e.sibling}function uWe(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(vy(e,t),i_(t),n&4){try{L4(3,t,t.return),T7(3,t)}catch(h){cs(t,t.return,h)}try{L4(5,t,t.return)}catch(h){cs(t,t.return,h)}}break;case 1:vy(e,t),i_(t),n&512&&r!==null&&DF(r,r.return);break;case 5:if(vy(e,t),i_(t),n&512&&r!==null&&DF(r,r.return),t.flags&32){var o=t.stateNode;try{B4(o,"")}catch(h){cs(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&&A6e(o,i),pye(s,a);var l=pye(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?N6e(o,d):c==="dangerouslySetInnerHTML"?R6e(o,d):c==="children"?B4(o,d):Yye(o,c,d,l)}switch(s){case"input":uye(o,i);break;case"textarea":I6e(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?FF(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?FF(o,!!i.multiple,i.defaultValue,!0):FF(o,!!i.multiple,i.multiple?[]:"",!1))}o[J4]=i}catch(h){cs(t,t.return,h)}}break;case 6:if(vy(e,t),i_(t),n&4){if(t.stateNode===null)throw Error(qe(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){cs(t,t.return,h)}}break;case 3:if(vy(e,t),i_(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{H4(e.containerInfo)}catch(h){cs(t,t.return,h)}break;case 4:vy(e,t),i_(t);break;case 13:vy(e,t),i_(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Abe=Ts())),n&4&&m6e(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(qd=(l=qd)||c,vy(e,t),qd=l):vy(e,t),i_(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(Ct=t,c=t.child;c!==null;){for(d=Ct=c;Ct!==null;){switch(f=Ct,p=f.child,f.tag){case 0:case 11:case 14:case 15:L4(4,f,f.return);break;case 1:DF(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){cs(n,r,h)}}break;case 5:DF(f,f.return);break;case 22:if(f.memoizedState!==null){g6e(d);continue}}p!==null?(p.return=f,Ct=p):g6e(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=j6e("display",a))}catch(h){cs(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){cs(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:vy(e,t),i_(t),n&4&&m6e(t);break;case 21:break;default:vy(e,t),i_(t)}}function i_(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(aWe(r)){var n=r;break e}r=r.return}throw Error(qe(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(B4(o,""),n.flags&=-33);var i=p6e(t);zye(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=p6e(t);Uye(t,s,a);break;default:throw Error(qe(161))}}catch(u){cs(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Scr(t,e,r){Ct=t,lWe(t,e,r)}function lWe(t,e,r){for(var n=(t.mode&1)!==0;Ct!==null;){var o=Ct,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||kJ;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||qd;s=kJ;var l=qd;if(kJ=a,(qd=u)&&!l)for(Ct=o;Ct!==null;)a=Ct,u=a.child,a.tag===22&&a.memoizedState!==null?y6e(o):u!==null?(u.return=a,Ct=u):y6e(o);for(;i!==null;)Ct=i,lWe(i,e,r),i=i.sibling;Ct=o,kJ=s,qd=l}h6e(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,Ct=i):h6e(t,e,r)}}function h6e(t){for(;Ct!==null;){var e=Ct;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:qd||T7(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!qd)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:wy(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&X8e(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}X8e(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&&H4(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(qe(163))}qd||e.flags&512&&qye(e)}catch(f){cs(e,e.return,f)}}if(e===t){Ct=null;break}if(r=e.sibling,r!==null){r.return=e.return,Ct=r;break}Ct=e.return}}function g6e(t){for(;Ct!==null;){var e=Ct;if(e===t){Ct=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Ct=r;break}Ct=e.return}}function y6e(t){for(;Ct!==null;){var e=Ct;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{T7(4,e)}catch(u){cs(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){cs(e,o,u)}}var i=e.return;try{qye(e)}catch(u){cs(e,i,u)}break;case 5:var a=e.return;try{qye(e)}catch(u){cs(e,a,u)}}}catch(u){cs(e,e.return,u)}if(e===t){Ct=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Ct=s;break}Ct=e.return}}var xcr=Math.ceil,h7=KC.ReactCurrentDispatcher,Ebe=KC.ReactCurrentOwner,Uh=KC.ReactCurrentBatchConfig,bo=0,Gl=null,zs=null,jc=0,xm=0,LF=mT(0),Pl=0,t3=null,t1=0,A7=0,Tbe=0,F4=null,Ep=null,Abe=0,JF=1/0,kC=null,g7=!1,Hye=null,uT=null,$J=!1,rT=null,y7=0,k4=0,Vye=null,KJ=-1,GJ=0;function Bf(){return(bo&6)!==0?Ts():KJ!==-1?KJ:KJ=Ts()}function lT(t){return(t.mode&1)===0?1:(bo&2)!==0&&jc!==0?jc&-jc:acr.transition!==null?(GJ===0&&(GJ=W6e()),GJ):(t=_i,t!==0||(t=window.event,t=t===void 0?16:Q6e(t.type)),t)}function Oy(t,e,r,n){if(50<k4)throw k4=0,Vye=null,Error(qe(185));r3(t,r,n),((bo&2)===0||t!==Gl)&&(t===Gl&&((bo&2)===0&&(A7|=r),Pl===4&&eT(t,jc)),Mp(t,n),r===1&&bo===0&&(e.mode&1)===0&&(JF=Ts()+500,O7&&hT()))}function Mp(t,e){var r=t.callbackNode;ulr(t,e);var n=e7(t,t===Gl?jc:0);if(n===0)r!==null&&O8e(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&O8e(r),e===1)t.tag===0?icr(b6e.bind(null,t)):b5e(b6e.bind(null,t)),tcr(function(){(bo&6)===0&&hT()}),r=null;else{switch(K6e(n)){case 1:r=tbe;break;case 4:r=H6e;break;case 16:r=QJ;break;case 536870912:r=V6e;break;default:r=QJ}r=yWe(r,cWe.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function cWe(t,e){if(KJ=-1,GJ=0,(bo&6)!==0)throw Error(qe(327));var r=t.callbackNode;if(UF()&&t.callbackNode!==r)return null;var n=e7(t,t===Gl?jc:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=b7(t,n);else{e=n;var o=bo;bo|=2;var i=fWe();(Gl!==t||jc!==e)&&(kC=null,JF=Ts()+500,YR(t,e));do try{Pcr();break}catch(s){dWe(t,s)}while(!0);mbe(),h7.current=i,bo=o,zs!==null?e=0:(Gl=null,jc=0,e=Pl)}if(e!==0){if(e===2&&(o=bye(t),o!==0&&(n=o,e=Wye(t,o))),e===1)throw r=t3,YR(t,0),eT(t,n),Mp(t,Ts()),r;if(e===6)eT(t,n);else{if(o=t.current.alternate,(n&30)===0&&!Ccr(o)&&(e=b7(t,n),e===2&&(i=bye(t),i!==0&&(n=i,e=Wye(t,i))),e===1))throw r=t3,YR(t,0),eT(t,n),Mp(t,Ts()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(qe(345));case 2:WR(t,Ep,kC);break;case 3:if(eT(t,n),(n&130023424)===n&&(e=Abe+500-Ts(),10<e)){if(e7(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Bf(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=Pye(WR.bind(null,t,Ep,kC),e);break}WR(t,Ep,kC);break;case 4:if(eT(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-Cy(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=Ts()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*xcr(n/1960))-n,10<n){t.timeoutHandle=Pye(WR.bind(null,t,Ep,kC),n);break}WR(t,Ep,kC);break;case 5:WR(t,Ep,kC);break;default:throw Error(qe(329))}}}return Mp(t,Ts()),t.callbackNode===r?cWe.bind(null,t):null}function Wye(t,e){var r=F4;return t.current.memoizedState.isDehydrated&&(YR(t,e).flags|=256),t=b7(t,e),t!==2&&(e=Ep,Ep=r,e!==null&&Kye(e)),t}function Kye(t){Ep===null?Ep=t:Ep.push.apply(Ep,t)}function Ccr(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(!Py(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 eT(t,e){for(e&=~Tbe,e&=~A7,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-Cy(e),n=1<<r;t[r]=-1,e&=~n}}function b6e(t){if((bo&6)!==0)throw Error(qe(327));UF();var e=e7(t,0);if((e&1)===0)return Mp(t,Ts()),null;var r=b7(t,e);if(t.tag!==0&&r===2){var n=bye(t);n!==0&&(e=n,r=Wye(t,n))}if(r===1)throw r=t3,YR(t,0),eT(t,e),Mp(t,Ts()),r;if(r===6)throw Error(qe(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,WR(t,Ep,kC),Mp(t,Ts()),null}function Ibe(t,e){var r=bo;bo|=1;try{return t(e)}finally{bo=r,bo===0&&(JF=Ts()+500,O7&&hT())}}function r1(t){rT!==null&&rT.tag===0&&(bo&6)===0&&UF();var e=bo;bo|=1;var r=Uh.transition,n=_i;try{if(Uh.transition=null,_i=1,t)return t()}finally{_i=n,Uh.transition=r,bo=e,(bo&6)===0&&hT()}}function Mbe(){xm=LF.current,aa(LF)}function YR(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,ecr(r)),zs!==null)for(r=zs.return;r!==null;){var n=r;switch(dbe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&i7();break;case 3:KF(),aa(Ap),aa(Ud),vbe();break;case 5:_be(n);break;case 4:KF();break;case 13:aa(Fa);break;case 19:aa(Fa);break;case 10:hbe(n.type._context);break;case 22:case 23:Mbe()}r=r.return}if(Gl=t,zs=t=cT(t.current,null),jc=xm=e,Pl=0,t3=null,Tbe=A7=t1=0,Ep=F4=null,GR!==null){for(e=0;e<GR.length;e++)if(r=GR[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}GR=null}return t}function dWe(t,e){do{var r=zs;try{if(mbe(),HJ.current=m7,p7){for(var n=ka.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}p7=!1}if(e1=0,Kl=Ol=ka=null,D4=!1,X4=0,Ebe.current=null,r===null||r.return===null){Pl=1,t3=e,zs=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=jc,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=i6e(a);if(p!==null){p.flags&=-257,a6e(p,a,s,i,e),p.mode&1&&o6e(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){o6e(i,l,e),Rbe();break e}u=Error(qe(426))}}else if(Ca&&s.mode&1){var b=i6e(a);if(b!==null){(b.flags&65536)===0&&(b.flags|=256),a6e(b,a,s,i,e),fbe(GF(u,s));break e}}i=u=GF(u,s),Pl!==4&&(Pl=2),F4===null?F4=[i]:F4.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=G5e(i,u,e);Z8e(i,g);break e;case 1:s=u;var y=i.type,S=i.stateNode;if((i.flags&128)===0&&(typeof y.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(uT===null||!uT.has(S)))){i.flags|=65536,e&=-e,i.lanes|=e;var x=J5e(i,s,e);Z8e(i,x);break e}}i=i.return}while(i!==null)}mWe(r)}catch(O){e=O,zs===r&&r!==null&&(zs=r=r.return);continue}break}while(!0)}function fWe(){var t=h7.current;return h7.current=m7,t===null?m7:t}function Rbe(){(Pl===0||Pl===3||Pl===2)&&(Pl=4),Gl===null||(t1&268435455)===0&&(A7&268435455)===0||eT(Gl,jc)}function b7(t,e){var r=bo;bo|=2;var n=fWe();(Gl!==t||jc!==e)&&(kC=null,YR(t,e));do try{Ocr();break}catch(o){dWe(t,o)}while(!0);if(mbe(),bo=r,h7.current=n,zs!==null)throw Error(qe(261));return Gl=null,jc=0,Pl}function Ocr(){for(;zs!==null;)pWe(zs)}function Pcr(){for(;zs!==null&&!Qur();)pWe(zs)}function pWe(t){var e=gWe(t.alternate,t,xm);t.memoizedProps=t.pendingProps,e===null?mWe(t):zs=e,Ebe.current=null}function mWe(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=bcr(r,e,xm),r!==null){zs=r;return}}else{if(r=_cr(r,e),r!==null){r.flags&=32767,zs=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Pl=6,zs=null;return}}if(e=e.sibling,e!==null){zs=e;return}zs=e=t}while(e!==null);Pl===0&&(Pl=5)}function WR(t,e,r){var n=_i,o=Uh.transition;try{Uh.transition=null,_i=1,Ecr(t,e,r,n)}finally{Uh.transition=o,_i=n}return null}function Ecr(t,e,r,n){do UF();while(rT!==null);if((bo&6)!==0)throw Error(qe(327));r=t.finishedWork;var o=t.finishedLanes;if(r===null)return null;if(t.finishedWork=null,t.finishedLanes=0,r===t.current)throw Error(qe(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(llr(t,i),t===Gl&&(zs=Gl=null,jc=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||$J||($J=!0,yWe(QJ,function(){return UF(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=Uh.transition,Uh.transition=null;var a=_i;_i=1;var s=bo;bo|=4,Ebe.current=null,wcr(t,r),uWe(r,t),Jlr(Cye),t7=!!xye,Cye=xye=null,t.current=r,Scr(r,t,o),elr(),bo=s,_i=a,Uh.transition=i}else t.current=r;if($J&&($J=!1,rT=t,y7=o),i=t.pendingLanes,i===0&&(uT=null),nlr(r.stateNode,n),Mp(t,Ts()),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(g7)throw g7=!1,t=Hye,Hye=null,t;return(y7&1)!==0&&t.tag!==0&&UF(),i=t.pendingLanes,(i&1)!==0?t===Vye?k4++:(k4=0,Vye=t):k4=0,hT(),null}function UF(){if(rT!==null){var t=K6e(y7),e=Uh.transition,r=_i;try{if(Uh.transition=null,_i=16>t?16:t,rT===null)var n=!1;else{if(t=rT,rT=null,y7=0,(bo&6)!==0)throw Error(qe(331));var o=bo;for(bo|=4,Ct=t.current;Ct!==null;){var i=Ct,a=i.child;if((Ct.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(Ct=l;Ct!==null;){var c=Ct;switch(c.tag){case 0:case 11:case 15:L4(8,c,i)}var d=c.child;if(d!==null)d.return=c,Ct=d;else for(;Ct!==null;){c=Ct;var f=c.sibling,p=c.return;if(iWe(c),c===l){Ct=null;break}if(f!==null){f.return=p,Ct=f;break}Ct=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)}}Ct=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,Ct=a;else e:for(;Ct!==null;){if(i=Ct,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:L4(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Ct=g;break e}Ct=i.return}}var y=t.current;for(Ct=y;Ct!==null;){a=Ct;var S=a.child;if((a.subtreeFlags&2064)!==0&&S!==null)S.return=a,Ct=S;else e:for(a=y;Ct!==null;){if(s=Ct,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:T7(9,s)}}catch(O){cs(s,s.return,O)}if(s===a){Ct=null;break e}var x=s.sibling;if(x!==null){x.return=s.return,Ct=x;break e}Ct=s.return}}if(bo=o,hT(),u_&&typeof u_.onPostCommitFiberRoot=="function")try{u_.onPostCommitFiberRoot(v7,t)}catch{}n=!0}return n}finally{_i=r,Uh.transition=e}}return!1}function _6e(t,e,r){e=GF(r,e),e=G5e(t,e,1),t=sT(t,e,1),e=Bf(),t!==null&&(r3(t,1,e),Mp(t,e))}function cs(t,e,r){if(t.tag===3)_6e(t,t,r);else for(;e!==null;){if(e.tag===3){_6e(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(uT===null||!uT.has(n))){t=GF(r,t),t=J5e(e,t,1),e=sT(e,t,1),t=Bf(),e!==null&&(r3(e,1,t),Mp(e,t));break}}e=e.return}}function Tcr(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Bf(),t.pingedLanes|=t.suspendedLanes&r,Gl===t&&(jc&r)===r&&(Pl===4||Pl===3&&(jc&130023424)===jc&&500>Ts()-Abe?YR(t,0):Tbe|=r),Mp(t,e)}function hWe(t,e){e===0&&((t.mode&1)===0?e=1:(e=OJ,OJ<<=1,(OJ&130023424)===0&&(OJ=4194304)));var r=Bf();t=VC(t,e),t!==null&&(r3(t,e,r),Mp(t,r))}function Acr(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),hWe(t,r)}function Icr(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,o=t.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(qe(314))}n!==null&&n.delete(e),hWe(t,r)}var gWe;gWe=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ap.current)Tp=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return Tp=!1,ycr(t,e,r);Tp=(t.flags&131072)!==0}else Tp=!1,Ca&&(e.flags&1048576)!==0&&_5e(e,u7,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;WJ(t,e),t=e.pendingProps;var o=HF(e,Ud.current);qF(e,r),o=Sbe(null,e,n,t,o,r);var i=xbe();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,Ip(n)?(i=!0,a7(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ybe(e),o.updater=P7,e.stateNode=o,o._reactInternals=e,jye(e,n,t,r),e=Lye(null,e,n,!0,i,r)):(e.tag=0,Ca&&i&&cbe(e),$f(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(WJ(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Rcr(n),t=wy(n,t),o){case 0:e=Dye(null,e,n,t,r);break e;case 1:e=l6e(null,e,n,t,r);break e;case 11:e=s6e(null,e,n,t,r);break e;case 14:e=u6e(null,e,n,wy(n.type,t),r);break e}throw Error(qe(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),Dye(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),l6e(t,e,n,o,r);case 3:e:{if(Q5e(e),t===null)throw Error(qe(387));n=e.pendingProps,i=e.memoizedState,o=i.element,x5e(t,e),d7(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=GF(Error(qe(423)),e),e=c6e(t,e,n,r,o);break e}else if(n!==o){o=GF(Error(qe(424)),e),e=c6e(t,e,n,r,o);break e}else for(Cm=aT(e.stateNode.containerInfo.firstChild),Om=e,Ca=!0,xy=null,r=E5e(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(VF(),n===o){e=WC(t,e,r);break e}$f(t,e,n,r)}e=e.child}return e;case 5:return T5e(e),t===null&&Iye(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,Oye(n,o)?a=null:i!==null&&Oye(n,i)&&(e.flags|=32),X5e(t,e),$f(t,e,a,r),e.child;case 6:return t===null&&Iye(e),null;case 13:return eWe(t,e,r);case 4:return bbe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=WF(e,null,n,r):$f(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),s6e(t,e,n,o,r);case 7:return $f(t,e,e.pendingProps,r),e.child;case 8:return $f(t,e,e.pendingProps.children,r),e.child;case 12:return $f(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,zi(l7,n._currentValue),n._currentValue=a,i!==null)if(Py(i.value,a)){if(i.children===o.children&&!Ap.current){e=WC(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=UC(-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),Mye(i.return,r,e),s.lanes|=r;break}u=u.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(qe(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),Mye(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}$f(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,qF(e,r),o=zh(o),n=n(o),e.flags|=1,$f(t,e,n,r),e.child;case 14:return n=e.type,o=wy(n,e.pendingProps),o=wy(n.type,o),u6e(t,e,n,o,r);case 15:return Y5e(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:wy(n,o),WJ(t,e),e.tag=1,Ip(n)?(t=!0,a7(e)):t=!1,qF(e,r),O5e(e,n,o),jye(e,n,o,r),Lye(null,e,n,!0,t,r);case 19:return tWe(t,e,r);case 22:return Z5e(t,e,r)}throw Error(qe(156,e.tag))};function yWe(t,e){return z6e(t,e)}function Mcr(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 qh(t,e,r,n){return new Mcr(t,e,r,n)}function jbe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Rcr(t){if(typeof t=="function")return jbe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Xye)return 11;if(t===Qye)return 14}return 2}function cT(t,e){var r=t.alternate;return r===null?(r=qh(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 JJ(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")jbe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case PF:return ZR(r.children,o,i,e);case Zye:a=8,o|=8;break;case nye:return t=qh(12,r,e,o|2),t.elementType=nye,t.lanes=i,t;case oye:return t=qh(13,r,e,o),t.elementType=oye,t.lanes=i,t;case iye:return t=qh(19,r,e,o),t.elementType=iye,t.lanes=i,t;case P6e:return I7(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case C6e:a=10;break e;case O6e:a=9;break e;case Xye:a=11;break e;case Qye:a=14;break e;case ZE:a=16,n=null;break e}throw Error(qe(130,t==null?t:typeof t,""))}return e=qh(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function ZR(t,e,r,n){return t=qh(7,t,n,e),t.lanes=r,t}function I7(t,e,r,n){return t=qh(22,t,n,e),t.elementType=P6e,t.lanes=r,t.stateNode={isHidden:!1},t}function eye(t,e,r){return t=qh(6,t,null,e),t.lanes=r,t}function tye(t,e,r){return e=qh(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function jcr(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=kge(0),this.expirationTimes=kge(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kge(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Nbe(t,e,r,n,o,i,a,s,u){return t=new jcr(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=qh(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ybe(i),t}function Ncr(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:OF,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function bWe(t){if(!t)return fT;t=t._reactInternals;e:{if(o1(t)!==t||t.tag!==1)throw Error(qe(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Ip(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(qe(171))}if(t.tag===1){var r=t.type;if(Ip(r))return y5e(t,r,e)}return e}function _We(t,e,r,n,o,i,a,s,u){return t=Nbe(r,n,!0,t,o,i,a,s,u),t.context=bWe(null),r=t.current,n=Bf(),o=lT(r),i=UC(n,o),i.callback=e??null,sT(r,i,o),t.current.lanes=o,r3(t,o,n),Mp(t,n),t}function M7(t,e,r,n){var o=e.current,i=Bf(),a=lT(o);return r=bWe(r),e.context===null?e.context=r:e.pendingContext=r,e=UC(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=sT(o,e,a),t!==null&&(Oy(t,o,a,i),zJ(t,o,a)),a}function _7(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 v6e(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function Dbe(t,e){v6e(t,e),(t=t.alternate)&&v6e(t,e)}function Dcr(){return null}var vWe=typeof reportError=="function"?reportError:function(t){console.error(t)};function Lbe(t){this._internalRoot=t}R7.prototype.render=Lbe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(qe(409));M7(t,e,null,null)};R7.prototype.unmount=Lbe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;r1(function(){M7(null,t,null,null)}),e[HC]=null}};function R7(t){this._internalRoot=t}R7.prototype.unstable_scheduleHydration=function(t){if(t){var e=Y6e();t={blockedOn:null,target:t,priority:e};for(var r=0;r<QE.length&&e!==0&&e<QE[r].priority;r++);QE.splice(r,0,t),r===0&&X6e(t)}};function Fbe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function j7(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function w6e(){}function Lcr(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=_7(a);i.call(l)}}var a=_We(e,n,t,0,null,!1,!1,"",w6e);return t._reactRootContainer=a,t[HC]=a.current,K4(t.nodeType===8?t.parentNode:t),r1(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=_7(u);s.call(l)}}var u=Nbe(t,0,!1,null,null,!1,!1,"",w6e);return t._reactRootContainer=u,t[HC]=u.current,K4(t.nodeType===8?t.parentNode:t),r1(function(){M7(e,u,r,n)}),u}function N7(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=_7(a);s.call(u)}}M7(e,a,t,o)}else a=Lcr(r,e,t,o,n);return _7(a)}G6e=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=T4(e.pendingLanes);r!==0&&(rbe(e,r|1),Mp(e,Ts()),(bo&6)===0&&(JF=Ts()+500,hT()))}break;case 13:r1(function(){var n=VC(t,1);if(n!==null){var o=Bf();Oy(n,t,1,o)}}),Dbe(t,1)}};nbe=function(t){if(t.tag===13){var e=VC(t,134217728);if(e!==null){var r=Bf();Oy(e,t,134217728,r)}Dbe(t,134217728)}};J6e=function(t){if(t.tag===13){var e=lT(t),r=VC(t,e);if(r!==null){var n=Bf();Oy(r,t,e,n)}Dbe(t,e)}};Y6e=function(){return _i};Z6e=function(t,e){var r=_i;try{return _i=t,e()}finally{_i=r}};hye=function(t,e,r){switch(e){case"input":if(uye(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=C7(n);if(!o)throw Error(qe(90));T6e(n),uye(n,o)}}}break;case"textarea":I6e(t,r);break;case"select":e=r.value,e!=null&&FF(t,!!r.multiple,e,!1)}};F6e=Ibe;k6e=r1;var Fcr={usingClientEntryPoint:!1,Events:[o3,IF,C7,D6e,L6e,Ibe]},C4={findFiberByHostInstance:KR,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},kcr={bundleType:C4.bundleType,version:C4.version,rendererPackageName:C4.rendererPackageName,rendererConfig:C4.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:KC.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=q6e(t),t===null?null:t.stateNode},findFiberByHostInstance:C4.findFiberByHostInstance||Dcr,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(O4=__REACT_DEVTOOLS_GLOBAL_HOOK__,!O4.isDisabled&&O4.supportsFiber))try{v7=O4.inject(kcr),u_=O4}catch{}var O4;Tm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fcr;Tm.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Fbe(e))throw Error(qe(200));return Ncr(t,e,null,r)};Tm.createRoot=function(t,e){if(!Fbe(t))throw Error(qe(299));var r=!1,n="",o=vWe;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Nbe(t,1,!1,null,null,r,!1,n,o),t[HC]=e.current,K4(t.nodeType===8?t.parentNode:t),new Lbe(e)};Tm.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(qe(188)):(t=Object.keys(t).join(","),Error(qe(268,t)));return t=q6e(e),t=t===null?null:t.stateNode,t};Tm.flushSync=function(t){return r1(t)};Tm.hydrate=function(t,e,r){if(!j7(e))throw Error(qe(200));return N7(null,t,e,!0,r)};Tm.hydrateRoot=function(t,e,r){if(!Fbe(t))throw Error(qe(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=vWe;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=_We(e,null,t,1,r??null,o,!1,i,a),t[HC]=e.current,K4(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 R7(e)};Tm.render=function(t,e,r){if(!j7(e))throw Error(qe(200));return N7(null,t,e,!1,r)};Tm.unmountComponentAtNode=function(t){if(!j7(t))throw Error(qe(40));return t._reactRootContainer?(r1(function(){N7(null,null,t,!1,function(){t._reactRootContainer=null,t[HC]=null})}),!0):!1};Tm.unstable_batchedUpdates=Ibe;Tm.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!j7(r))throw Error(qe(200));if(t==null||t._reactInternals===void 0)throw Error(qe(38));return N7(t,e,r,!1,n)};Tm.version="18.2.0-next-9e3b772b8-20220608"});var ds=v((Vzn,xWe)=>{"use strict";function SWe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(SWe)}catch(t){console.error(t)}}SWe(),xWe.exports=wWe()});var Dc=v(kbe=>{"use strict";var CWe=ds();kbe.createRoot=CWe.createRoot,kbe.hydrateRoot=CWe.hydrateRoot;var Wzn});function OWe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function PWe(...t){return e=>{let r=!1,n=t.map(o=>{let i=OWe(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():OWe(t[o],null)}}}}var $cr,EWe=w(()=>{$cr=F(X(),1)});var AWe=v(D7=>{"use strict";var Bcr=X(),qcr=Symbol.for("react.element"),Ucr=Symbol.for("react.fragment"),zcr=Object.prototype.hasOwnProperty,Hcr=Bcr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vcr={key:!0,ref:!0,__self:!0,__source:!0};function TWe(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)zcr.call(e,n)&&!Vcr.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:qcr,type:t,key:i,ref:a,props:o,_owner:Hcr.current}}D7.Fragment=Ucr;D7.jsx=TWe;D7.jsxs=TWe});var ft=v((Yzn,IWe)=>{"use strict";IWe.exports=AWe()});function GC(t){let e=Wcr(t),r=El.forwardRef((n,o)=>{let{children:i,...a}=n,s=El.Children.toArray(i),u=s.find(Kcr);if(u){let l=u.props.children,c=s.map(d=>d===u?El.Children.count(l)>1?El.Children.only(null):El.isValidElement(l)?l.props.children:null:d);return(0,XF.jsx)(e,{...a,ref:o,children:El.isValidElement(l)?El.cloneElement(l,void 0,c):null})}return(0,XF.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Wcr(t){let e=El.forwardRef((r,n)=>{let{children:o,...i}=r;if(El.isValidElement(o)){let a=Jcr(o),s=Gcr(i,o.props);return o.type!==El.Fragment&&(s.ref=n?PWe(n,a):a),El.cloneElement(o,s)}return El.Children.count(o)>1?El.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function jWe(t){let e=({children:r})=>(0,XF.jsx)(XF.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=RWe,e}function Kcr(t){return El.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===RWe}function Gcr(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 Jcr(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 El,XF,MWe,RWe,i1=w(()=>{El=F(X(),1);EWe();XF=F(ft(),1);MWe=GC("Slot");RWe=Symbol("radix.slottable")});function NWe(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=NWe(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function L7(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=NWe(t))&&(n&&(n+=" "),n+=e);return n}var $be=w(()=>{});var DWe,LWe,QF,F7=w(()=>{$be();DWe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,LWe=L7,QF=(t,e)=>r=>{var n;if(e?.variants==null)return LWe(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=DWe(c)||DWe(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 LWe(t,a,u,r?.class,r?.className)}});function sdr(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=zWe(e))&&(n&&(n+=" "),n+=r);return n}function $We(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=odr(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=adr(u,r);return o(u,c),c}return function(){return i(sdr.apply(null,arguments))}}var Ube,Ycr,qWe,FWe,Zcr,Xcr,qbe,kWe,Qcr,edr,tdr,UWe,rdr,ndr,odr,idr,adr,zWe,sa,HWe,udr,ldr,cdr,ddr,fdr,pdr,mdr,JC,gT,ek,Bbe,a3,hdr,tn,yT,gdr,ydr,bdr,_dr,vdr,wdr,s3,tk,Sdr,VWe,xdr,Cdr,BWe,Odr,u3,Pdr,Edr,WWe,KWe=w(()=>{Ube="-",Ycr=t=>{let e=Xcr(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(Ube);return s[0]===""&&s.length!==1&&s.shift(),qWe(s,e)||Zcr(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},qWe=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?qWe(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Ube);return e.validators.find(({validator:a})=>a(i))?.classGroupId},FWe=/^\[(.+)\]$/,Zcr=t=>{if(FWe.test(t)){let e=FWe.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Xcr=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return edr(Object.entries(t.classGroups),r).forEach(([i,a])=>{qbe(a,n,i,e)}),n},qbe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:kWe(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(Qcr(o)){qbe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{qbe(a,kWe(e,i),r,n)})})},kWe=(t,e)=>{let r=t;return e.split(Ube).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Qcr=t=>t.isThemeGetter,edr=(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,tdr=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)}}},UWe="!",rdr=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(UWe),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},ndr=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},odr=t=>({cache:tdr(t.cacheSize),parseClassName:rdr(t),...Ycr(t)}),idr=/\s+/,adr=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(idr),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=ndr(c).join(":"),g=d?b+UWe:b,y=g+h;if(i.includes(y))continue;i.push(y);let S=o(h,m);for(let x=0;x<S.length;++x){let O=S[x];i.push(g+O)}s=l+(s.length>0?" "+s:s)}return s};zWe=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=zWe(t[n]))&&(r&&(r+=" "),r+=e);return r};sa=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},HWe=/^\[(?:([a-z-]+):)?(.+)\]$/i,udr=/^\d+\/\d+$/,ldr=new Set(["px","full","screen"]),cdr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ddr=/\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$/,fdr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,pdr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mdr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,JC=t=>ek(t)||ldr.has(t)||udr.test(t),gT=t=>tk(t,"length",Sdr),ek=t=>!!t&&!Number.isNaN(Number(t)),Bbe=t=>tk(t,"number",ek),a3=t=>!!t&&Number.isInteger(Number(t)),hdr=t=>t.endsWith("%")&&ek(t.slice(0,-1)),tn=t=>HWe.test(t),yT=t=>cdr.test(t),gdr=new Set(["length","size","percentage"]),ydr=t=>tk(t,gdr,VWe),bdr=t=>tk(t,"position",VWe),_dr=new Set(["image","url"]),vdr=t=>tk(t,_dr,Cdr),wdr=t=>tk(t,"",xdr),s3=()=>!0,tk=(t,e,r)=>{let n=HWe.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},Sdr=t=>ddr.test(t)&&!fdr.test(t),VWe=()=>!1,xdr=t=>pdr.test(t),Cdr=t=>mdr.test(t),BWe=()=>{let t=sa("colors"),e=sa("spacing"),r=sa("blur"),n=sa("brightness"),o=sa("borderColor"),i=sa("borderRadius"),a=sa("borderSpacing"),s=sa("borderWidth"),u=sa("contrast"),l=sa("grayscale"),c=sa("hueRotate"),d=sa("invert"),f=sa("gap"),p=sa("gradientColorStops"),m=sa("gradientColorStopPositions"),h=sa("inset"),b=sa("margin"),g=sa("opacity"),y=sa("padding"),S=sa("saturate"),x=sa("scale"),O=sa("sepia"),P=sa("skew"),E=sa("space"),A=sa("translate"),I=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",tn,e],j=()=>[tn,e],$=()=>["",JC,gT],k=()=>["auto",ek,tn],z=()=>["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"],J=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",tn],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[ek,tn];return{cacheSize:500,separator:":",theme:{colors:[s3],spacing:[JC,gT],blur:["none","",yT,tn],brightness:q(),borderColor:[t],borderRadius:["none","","full",yT,tn],borderSpacing:j(),borderWidth:$(),contrast:q(),grayscale:D(),hueRotate:q(),invert:D(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[hdr,gT],inset:N(),margin:N(),opacity:q(),padding:j(),saturate:q(),scale:q(),sepia:D(),skew:q(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",tn]}],container:["container"],columns:[{columns:[yT]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"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:[...z(),tn]}],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",a3,tn]}],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",tn]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",a3,tn]}],"grid-cols":[{"grid-cols":[s3]}],"col-start-end":[{col:["auto",{span:["full",a3,tn]},tn]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[s3]}],"row-start-end":[{row:["auto",{span:[a3,tn]},tn]}],"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",tn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",tn]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...J()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...J(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...J(),"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":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",tn,e]}],"min-w":[{"min-w":[tn,e,"min","max","fit"]}],"max-w":[{"max-w":[tn,e,"none","full","min","max","fit","prose",{screen:[yT]},yT]}],h:[{h:[tn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[tn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[tn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yT,gT]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bbe]}],"font-family":[{font:[s3]}],"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",tn]}],"line-clamp":[{"line-clamp":["none",ek,Bbe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",JC,tn]}],"list-image":[{"list-image":["none",tn]}],"list-style-type":[{list:["none","disc","decimal",tn]}],"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",JC,gT]}],"underline-offset":[{"underline-offset":["auto",JC,tn]}],"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",tn]}],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",tn]}],"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:[...z(),bdr]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ydr]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},vdr]}],"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":[JC,tn]}],"outline-w":[{outline:[JC,gT]}],"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":[JC,gT]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yT,wdr]}],"shadow-color":[{shadow:[s3]}],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",yT,tn]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],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":[S]}],"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",tn]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",tn]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",tn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[a3,tn]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",tn]}],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",tn]}],"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",tn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[JC,gT,Bbe]}],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"]}}},Odr=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{u3(t,"cacheSize",e),u3(t,"prefix",r),u3(t,"separator",n),u3(t,"experimentalParseClassName",o);for(let s in a)Pdr(t[s],a[s]);for(let s in i)Edr(t[s],i[s]);return t},u3=(t,e,r)=>{r!==void 0&&(t[e]=r)},Pdr=(t,e)=>{if(e)for(let r in e)u3(t,r,e[r])},Edr=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},WWe=(t,...e)=>typeof t=="function"?$We(BWe,t,...e):$We(()=>Odr(BWe(),t),...e)});function _e(...t){return Tdr(L7(t))}var Tdr,Tn=w(()=>{$be();KWe();Tdr=WWe({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 k7,Adr,ge,ti=w(()=>{k7=F(X());i1();F7();Tn();Adr=QF("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"}}),ge=k7.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>k7.createElement(n?MWe:"button",{className:_e(Adr({variant:e,size:r,className:t})),ref:i,...o}));ge.displayName="Button"});var GWe,$7,zbe=w(()=>{GWe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$7=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var JWe,YWe=w(()=>{JWe={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 l3,ZWe,XWe=w(()=>{l3=F(X());YWe();zbe();ZWe=(0,l3.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,l3.createElement)("svg",{ref:u,...JWe,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:$7("lucide",o),...s},[...a.map(([l,c])=>(0,l3.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var B7,we,It=w(()=>{B7=F(X());zbe();XWe();we=(t,e)=>{let r=(0,B7.forwardRef)(({className:n,...o},i)=>(0,B7.createElement)(ZWe,{ref:i,iconNode:e,className:$7(`lucide-${GWe(t)}`,n),...o}));return r.displayName=`${t}`,r}});var YC,QWe=w(()=>{It();YC=we("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var c3,e9e=w(()=>{It();c3=we("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var a1,t9e=w(()=>{It();a1=we("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 Jl,r9e=w(()=>{It();Jl=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Hi,n9e=w(()=>{It();Hi=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var ZC,o9e=w(()=>{It();ZC=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var Ey,i9e=w(()=>{It();Ey=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var di,a9e=w(()=>{It();di=we("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 Am,s9e=w(()=>{It();Am=we("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var bT,u9e=w(()=>{It();bT=we("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var _T,l9e=w(()=>{It();_T=we("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 d3,c9e=w(()=>{It();d3=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var f3,d9e=w(()=>{It();f3=we("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 p3,f9e=w(()=>{It();p3=we("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 c_,p9e=w(()=>{It();c_=we("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 Ty,m9e=w(()=>{It();Ty=we("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 Im,h9e=w(()=>{It();Im=we("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var m3,g9e=w(()=>{It();m3=we("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 h3,y9e=w(()=>{It();h3=we("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 g3,b9e=w(()=>{It();g3=we("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 XC,_9e=w(()=>{It();XC=we("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 vT,v9e=w(()=>{It();vT=we("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 s1,w9e=w(()=>{It();s1=we("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 y3,S9e=w(()=>{It();y3=we("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 QC,x9e=w(()=>{It();QC=we("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 b3,C9e=w(()=>{It();b3=we("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 _3,O9e=w(()=>{It();_3=we("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 v3,P9e=w(()=>{It();v3=we("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 w3,E9e=w(()=>{It();w3=we("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 Ay,T9e=w(()=>{It();Ay=we("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 S3,A9e=w(()=>{It();S3=we("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 x3,I9e=w(()=>{It();x3=we("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 Iy,M9e=w(()=>{It();Iy=we("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 u1,R9e=w(()=>{It();u1=we("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 d_,j9e=w(()=>{It();d_=we("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 C3,N9e=w(()=>{It();C3=we("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 O3,D9e=w(()=>{It();O3=we("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 f_,L9e=w(()=>{It();f_=we("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 P3,F9e=w(()=>{It();P3=we("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 l1,k9e=w(()=>{It();l1=we("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 eO,$9e=w(()=>{It();eO=we("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 Yl,B9e=w(()=>{It();Yl=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var E3,q9e=w(()=>{It();E3=we("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 rk,U9e=w(()=>{It();rk=we("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 p_,z9e=w(()=>{It();p_=we("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 tO,H9e=w(()=>{It();tO=we("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 nk,V9e=w(()=>{It();nk=we("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 ok,W9e=w(()=>{It();ok=we("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 Mm,K9e=w(()=>{It();Mm=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var T3,G9e=w(()=>{It();T3=we("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 m_,J9e=w(()=>{It();m_=we("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 A3,Y9e=w(()=>{It();A3=we("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 c1,Z9e=w(()=>{It();c1=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Vh,X9e=w(()=>{It();Vh=we("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 rO,Q9e=w(()=>{It();rO=we("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 Rp,eKe=w(()=>{It();Rp=we("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 d1,tKe=w(()=>{It();d1=we("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 I3,rKe=w(()=>{It();I3=we("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 Rm,nKe=w(()=>{It();Rm=we("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 Uf,oKe=w(()=>{It();Uf=we("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 M3,iKe=w(()=>{It();M3=we("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 f1,aKe=w(()=>{It();f1=we("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]])});var Vi,sKe=w(()=>{It();Vi=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var yn=w(()=>{a9e();s9e();u9e();l9e();_9e();v9e();B9e();z9e();H9e();X9e();Q9e();eKe();oKe();QWe();e9e();t9e();r9e();n9e();o9e();i9e();c9e();d9e();f9e();p9e();m9e();h9e();g9e();y9e();b9e();w9e();S9e();x9e();C9e();O9e();P9e();E9e();T9e();A9e();I9e();M9e();R9e();j9e();N9e();D9e();L9e();F9e();k9e();$9e();q9e();U9e();V9e();W9e();K9e();G9e();J9e();Y9e();Z9e();tKe();rKe();nKe();iKe();aKe();sKe();});function Idr({onCancel:t}){let e=ue(),r=Hbe(e.defaultModelKey)&&Hbe(e.embeddingModelKey);return h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},h_.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},h_.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&h_.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.")),h_.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},h_.default.createElement(ge,{variant:"ghost",onClick:t},"Close"),h_.default.createElement(ge,{variant:"default",onClick:()=>{p1(LC.EXPIRED_MODAL)}},"Renew Now ",h_.default.createElement(s1,{className:"tw-size-4"}))))}var h_,uKe,lKe,q7,cKe=w(()=>{h_=F(X()),uKe=require("obsidian"),lKe=F(Dc());ti();nO();$r();yn();nr();q7=class extends uKe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,lKe.createRoot)(e);let r=()=>{this.close()};this.root.render(h_.default.createElement(Idr,{onCancel:r}))}onClose(){this.root.unmount()}}});var Rr,wT=w(()=>{Rr=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}}});var dKe=v(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});U7.V2ChatStreamRequestCitationMode=void 0;U7.V2ChatStreamRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var fKe=v(z7=>{"use strict";Object.defineProperty(z7,"__esModule",{value:!0});z7.V2ChatRequestCitationMode=void 0;z7.V2ChatRequestCitationMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var mKe=v(pKe=>{"use strict";Object.defineProperty(pKe,"__esModule",{value:!0})});var gKe=v(hKe=>{"use strict";Object.defineProperty(hKe,"__esModule",{value:!0})});var bKe=v(yKe=>{"use strict";Object.defineProperty(yKe,"__esModule",{value:!0})});var vKe=v(_Ke=>{"use strict";Object.defineProperty(_Ke,"__esModule",{value:!0})});var SKe=v(wKe=>{"use strict";Object.defineProperty(wKe,"__esModule",{value:!0})});var CKe=v(xKe=>{"use strict";Object.defineProperty(xKe,"__esModule",{value:!0})});var PKe=v(OKe=>{"use strict";Object.defineProperty(OKe,"__esModule",{value:!0})});var TKe=v(EKe=>{"use strict";Object.defineProperty(EKe,"__esModule",{value:!0})});var IKe=v(AKe=>{"use strict";Object.defineProperty(AKe,"__esModule",{value:!0})});var RKe=v(MKe=>{"use strict";Object.defineProperty(MKe,"__esModule",{value:!0})});var NKe=v(jKe=>{"use strict";Object.defineProperty(jKe,"__esModule",{value:!0})});var LKe=v(DKe=>{"use strict";Object.defineProperty(DKe,"__esModule",{value:!0})});var kKe=v(FKe=>{"use strict";Object.defineProperty(FKe,"__esModule",{value:!0})});var BKe=v($Ke=>{"use strict";Object.defineProperty($Ke,"__esModule",{value:!0})});var UKe=v(qKe=>{"use strict";Object.defineProperty(qKe,"__esModule",{value:!0})});var HKe=v(zKe=>{"use strict";Object.defineProperty(zKe,"__esModule",{value:!0})});var WKe=v(VKe=>{"use strict";Object.defineProperty(VKe,"__esModule",{value:!0})});var GKe=v(KKe=>{"use strict";Object.defineProperty(KKe,"__esModule",{value:!0})});var YKe=v(JKe=>{"use strict";Object.defineProperty(JKe,"__esModule",{value:!0})});var XKe=v(ZKe=>{"use strict";Object.defineProperty(ZKe,"__esModule",{value:!0})});var eGe=v(QKe=>{"use strict";Object.defineProperty(QKe,"__esModule",{value:!0})});var rGe=v(tGe=>{"use strict";Object.defineProperty(tGe,"__esModule",{value:!0})});var oGe=v(nGe=>{"use strict";Object.defineProperty(nGe,"__esModule",{value:!0})});var iGe=v(H7=>{"use strict";Object.defineProperty(H7,"__esModule",{value:!0});H7.ChatFinishReason=void 0;H7.ChatFinishReason={Complete:"complete",StopSequence:"stop_sequence",MaxTokens:"max_tokens",ToolCall:"tool_call",Error:"error",ContentBlocked:"content_blocked",ErrorLimit:"error_limit"}});var sGe=v(aGe=>{"use strict";Object.defineProperty(aGe,"__esModule",{value:!0})});var lGe=v(uGe=>{"use strict";Object.defineProperty(uGe,"__esModule",{value:!0})});var dGe=v(cGe=>{"use strict";Object.defineProperty(cGe,"__esModule",{value:!0})});var pGe=v(fGe=>{"use strict";Object.defineProperty(fGe,"__esModule",{value:!0})});var hGe=v(mGe=>{"use strict";Object.defineProperty(mGe,"__esModule",{value:!0})});var yGe=v(gGe=>{"use strict";Object.defineProperty(gGe,"__esModule",{value:!0})});var _Ge=v(bGe=>{"use strict";Object.defineProperty(bGe,"__esModule",{value:!0})});var wGe=v(vGe=>{"use strict";Object.defineProperty(vGe,"__esModule",{value:!0})});var xGe=v(SGe=>{"use strict";Object.defineProperty(SGe,"__esModule",{value:!0})});var OGe=v(CGe=>{"use strict";Object.defineProperty(CGe,"__esModule",{value:!0})});var EGe=v(PGe=>{"use strict";Object.defineProperty(PGe,"__esModule",{value:!0})});var AGe=v(TGe=>{"use strict";Object.defineProperty(TGe,"__esModule",{value:!0})});var MGe=v(IGe=>{"use strict";Object.defineProperty(IGe,"__esModule",{value:!0})});var jGe=v(RGe=>{"use strict";Object.defineProperty(RGe,"__esModule",{value:!0})});var DGe=v(NGe=>{"use strict";Object.defineProperty(NGe,"__esModule",{value:!0})});var FGe=v(LGe=>{"use strict";Object.defineProperty(LGe,"__esModule",{value:!0})});var $Ge=v(kGe=>{"use strict";Object.defineProperty(kGe,"__esModule",{value:!0})});var qGe=v(BGe=>{"use strict";Object.defineProperty(BGe,"__esModule",{value:!0})});var zGe=v(UGe=>{"use strict";Object.defineProperty(UGe,"__esModule",{value:!0})});var VGe=v(HGe=>{"use strict";Object.defineProperty(HGe,"__esModule",{value:!0})});var KGe=v(WGe=>{"use strict";Object.defineProperty(WGe,"__esModule",{value:!0})});var JGe=v(GGe=>{"use strict";Object.defineProperty(GGe,"__esModule",{value:!0})});var ZGe=v(YGe=>{"use strict";Object.defineProperty(YGe,"__esModule",{value:!0})});var QGe=v(XGe=>{"use strict";Object.defineProperty(XGe,"__esModule",{value:!0})});var tJe=v(eJe=>{"use strict";Object.defineProperty(eJe,"__esModule",{value:!0})});var nJe=v(rJe=>{"use strict";Object.defineProperty(rJe,"__esModule",{value:!0})});var iJe=v(oJe=>{"use strict";Object.defineProperty(oJe,"__esModule",{value:!0})});var sJe=v(aJe=>{"use strict";Object.defineProperty(aJe,"__esModule",{value:!0})});var lJe=v(uJe=>{"use strict";Object.defineProperty(uJe,"__esModule",{value:!0})});var dJe=v(cJe=>{"use strict";Object.defineProperty(cJe,"__esModule",{value:!0})});var pJe=v(fJe=>{"use strict";Object.defineProperty(fJe,"__esModule",{value:!0})});var hJe=v(mJe=>{"use strict";Object.defineProperty(mJe,"__esModule",{value:!0})});var yJe=v(gJe=>{"use strict";Object.defineProperty(gJe,"__esModule",{value:!0})});var Vbe=v(Tt=>{"use strict";var Mdr=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]}),$t=Tt&&Tt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mdr(e,t,r)};Object.defineProperty(Tt,"__esModule",{value:!0});$t(dKe(),Tt);$t(fKe(),Tt);$t(mKe(),Tt);$t(gKe(),Tt);$t(bKe(),Tt);$t(vKe(),Tt);$t(SKe(),Tt);$t(CKe(),Tt);$t(PKe(),Tt);$t(TKe(),Tt);$t(IKe(),Tt);$t(RKe(),Tt);$t(NKe(),Tt);$t(LKe(),Tt);$t(kKe(),Tt);$t(BKe(),Tt);$t(UKe(),Tt);$t(HKe(),Tt);$t(WKe(),Tt);$t(GKe(),Tt);$t(YKe(),Tt);$t(XKe(),Tt);$t(eGe(),Tt);$t(rGe(),Tt);$t(oGe(),Tt);$t(iGe(),Tt);$t(sGe(),Tt);$t(lGe(),Tt);$t(dGe(),Tt);$t(pGe(),Tt);$t(hGe(),Tt);$t(yGe(),Tt);$t(_Ge(),Tt);$t(wGe(),Tt);$t(xGe(),Tt);$t(OGe(),Tt);$t(EGe(),Tt);$t(AGe(),Tt);$t(MGe(),Tt);$t(jGe(),Tt);$t(DGe(),Tt);$t(FGe(),Tt);$t($Ge(),Tt);$t(qGe(),Tt);$t(zGe(),Tt);$t(VGe(),Tt);$t(KGe(),Tt);$t(JGe(),Tt);$t(ZGe(),Tt);$t(QGe(),Tt);$t(tJe(),Tt);$t(nJe(),Tt);$t(iJe(),Tt);$t(sJe(),Tt);$t(lJe(),Tt);$t(dJe(),Tt);$t(pJe(),Tt);$t(hJe(),Tt);$t(yJe(),Tt)});var Wbe=v(bJe=>{"use strict";Object.defineProperty(bJe,"__esModule",{value:!0})});var _Je=v(m1=>{"use strict";var Rdr=m1&&m1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jdr=m1&&m1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rdr(e,t,r)};Object.defineProperty(m1,"__esModule",{value:!0});jdr(Wbe(),m1)});var wJe=v(ST=>{"use strict";var Ndr=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]}),vJe=ST&&ST.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ndr(e,t,r)};Object.defineProperty(ST,"__esModule",{value:!0});vJe(Vbe(),ST);vJe(_Je(),ST)});var SJe=v(V7=>{"use strict";Object.defineProperty(V7,"__esModule",{value:!0});V7.CreateEmbedJobRequestTruncate=void 0;V7.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var Kbe=v(h1=>{"use strict";var Ddr=h1&&h1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ldr=h1&&h1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ddr(e,t,r)};Object.defineProperty(h1,"__esModule",{value:!0});Ldr(SJe(),h1)});var Gbe=v(xJe=>{"use strict";Object.defineProperty(xJe,"__esModule",{value:!0})});var CJe=v(g1=>{"use strict";var Fdr=g1&&g1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kdr=g1&&g1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fdr(e,t,r)};Object.defineProperty(g1,"__esModule",{value:!0});kdr(Gbe(),g1)});var PJe=v(xT=>{"use strict";var $dr=xT&&xT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OJe=xT&&xT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$dr(e,t,r)};Object.defineProperty(xT,"__esModule",{value:!0});OJe(Kbe(),xT);OJe(CJe(),xT)});var TJe=v(EJe=>{"use strict";Object.defineProperty(EJe,"__esModule",{value:!0})});var IJe=v(AJe=>{"use strict";Object.defineProperty(AJe,"__esModule",{value:!0})});var RJe=v(MJe=>{"use strict";Object.defineProperty(MJe,"__esModule",{value:!0})});var NJe=v(jJe=>{"use strict";Object.defineProperty(jJe,"__esModule",{value:!0})});var LJe=v(DJe=>{"use strict";Object.defineProperty(DJe,"__esModule",{value:!0})});var Jbe=v(My=>{"use strict";var Bdr=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]}),R3=My&&My.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bdr(e,t,r)};Object.defineProperty(My,"__esModule",{value:!0});R3(TJe(),My);R3(IJe(),My);R3(RJe(),My);R3(NJe(),My);R3(LJe(),My)});var Ybe=v(FJe=>{"use strict";Object.defineProperty(FJe,"__esModule",{value:!0})});var kJe=v(y1=>{"use strict";var qdr=y1&&y1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Udr=y1&&y1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qdr(e,t,r)};Object.defineProperty(y1,"__esModule",{value:!0});Udr(Ybe(),y1)});var BJe=v(CT=>{"use strict";var zdr=CT&&CT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Je=CT&&CT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zdr(e,t,r)};Object.defineProperty(CT,"__esModule",{value:!0});$Je(Jbe(),CT);$Je(kJe(),CT)});var qJe=v(W7=>{"use strict";Object.defineProperty(W7,"__esModule",{value:!0});W7.BaseType=void 0;W7.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var UJe=v(K7=>{"use strict";Object.defineProperty(K7,"__esModule",{value:!0});K7.Strategy=void 0;K7.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var HJe=v(zJe=>{"use strict";Object.defineProperty(zJe,"__esModule",{value:!0})});var WJe=v(VJe=>{"use strict";Object.defineProperty(VJe,"__esModule",{value:!0})});var GJe=v(KJe=>{"use strict";Object.defineProperty(KJe,"__esModule",{value:!0})});var YJe=v(JJe=>{"use strict";Object.defineProperty(JJe,"__esModule",{value:!0})});var ZJe=v(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});G7.Status=void 0;G7.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 QJe=v(XJe=>{"use strict";Object.defineProperty(XJe,"__esModule",{value:!0})});var t7e=v(e7e=>{"use strict";Object.defineProperty(e7e,"__esModule",{value:!0})});var n7e=v(r7e=>{"use strict";Object.defineProperty(r7e,"__esModule",{value:!0})});var i7e=v(o7e=>{"use strict";Object.defineProperty(o7e,"__esModule",{value:!0})});var s7e=v(a7e=>{"use strict";Object.defineProperty(a7e,"__esModule",{value:!0})});var l7e=v(u7e=>{"use strict";Object.defineProperty(u7e,"__esModule",{value:!0})});var d7e=v(c7e=>{"use strict";Object.defineProperty(c7e,"__esModule",{value:!0})});var p7e=v(f7e=>{"use strict";Object.defineProperty(f7e,"__esModule",{value:!0})});var h7e=v(m7e=>{"use strict";Object.defineProperty(m7e,"__esModule",{value:!0})});var y7e=v(g7e=>{"use strict";Object.defineProperty(g7e,"__esModule",{value:!0})});var Zbe=v(Ba=>{"use strict";var Hdr=Ba&&Ba.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lc=Ba&&Ba.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hdr(e,t,r)};Object.defineProperty(Ba,"__esModule",{value:!0});Lc(qJe(),Ba);Lc(UJe(),Ba);Lc(HJe(),Ba);Lc(WJe(),Ba);Lc(GJe(),Ba);Lc(YJe(),Ba);Lc(ZJe(),Ba);Lc(QJe(),Ba);Lc(t7e(),Ba);Lc(n7e(),Ba);Lc(i7e(),Ba);Lc(s7e(),Ba);Lc(l7e(),Ba);Lc(d7e(),Ba);Lc(p7e(),Ba);Lc(h7e(),Ba);Lc(y7e(),Ba)});var b7e=v(b1=>{"use strict";var Vdr=b1&&b1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wdr=b1&&b1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vdr(e,t,r)};Object.defineProperty(b1,"__esModule",{value:!0});Wdr(Zbe(),b1)});var v7e=v(jm=>{"use strict";var _7e=jm&&jm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kdr=jm&&jm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gdr=jm&&jm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_7e(e,t,r);return Kdr(e,t),e},Jdr=jm&&jm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_7e(e,t,r)};Object.defineProperty(jm,"__esModule",{value:!0});jm.finetuning=void 0;jm.finetuning=Gdr(b7e());Jdr(Zbe(),jm)});var Xbe=v(w7e=>{"use strict";Object.defineProperty(w7e,"__esModule",{value:!0})});var S7e=v(_1=>{"use strict";var Ydr=_1&&_1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zdr=_1&&_1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ydr(e,t,r)};Object.defineProperty(_1,"__esModule",{value:!0});Zdr(Xbe(),_1)});var C7e=v(OT=>{"use strict";var Xdr=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]}),x7e=OT&&OT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xdr(e,t,r)};Object.defineProperty(OT,"__esModule",{value:!0});x7e(v7e(),OT);x7e(S7e(),OT)});var Qbe=v(O7e=>{"use strict";Object.defineProperty(O7e,"__esModule",{value:!0})});var P7e=v(v1=>{"use strict";var Qdr=v1&&v1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),efr=v1&&v1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qdr(e,t,r)};Object.defineProperty(v1,"__esModule",{value:!0});efr(Qbe(),v1)});var E7e=v(w1=>{"use strict";var tfr=w1&&w1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rfr=w1&&w1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tfr(e,t,r)};Object.defineProperty(w1,"__esModule",{value:!0});rfr(P7e(),w1)});var e_e=v(T7e=>{"use strict";Object.defineProperty(T7e,"__esModule",{value:!0})});var A7e=v(S1=>{"use strict";var nfr=S1&&S1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ofr=S1&&S1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nfr(e,t,r)};Object.defineProperty(S1,"__esModule",{value:!0});ofr(e_e(),S1)});var I7e=v(x1=>{"use strict";var ifr=x1&&x1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),afr=x1&&x1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ifr(e,t,r)};Object.defineProperty(x1,"__esModule",{value:!0});afr(A7e(),x1)});var R7e=v(ri=>{"use strict";var M7e=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]}),sfr=ri&&ri.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ik=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)&&M7e(e,t,r);return sfr(e,t),e},oO=ri&&ri.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M7e(e,t,r)};Object.defineProperty(ri,"__esModule",{value:!0});ri.models=ri.connectors=ri.finetuning=ri.datasets=ri.embedJobs=ri.v2=void 0;ri.v2=ik(wJe());oO(Vbe(),ri);ri.embedJobs=ik(PJe());oO(Kbe(),ri);ri.datasets=ik(BJe());oO(Jbe(),ri);ri.finetuning=ik(C7e());ri.connectors=ik(E7e());ri.models=ik(I7e());oO(Wbe(),ri);oO(Gbe(),ri);oO(Ybe(),ri);oO(Qbe(),ri);oO(e_e(),ri);oO(Xbe(),ri)});var j7e=v(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});J7.ChatStreamRequestPromptTruncation=void 0;J7.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var N7e=v(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});Y7.ChatStreamRequestCitationQuality=void 0;Y7.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var L7e=v(D7e=>{"use strict";Object.defineProperty(D7e,"__esModule",{value:!0})});var F7e=v(Z7=>{"use strict";Object.defineProperty(Z7,"__esModule",{value:!0});Z7.ChatStreamRequestSafetyMode=void 0;Z7.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var $7e=v(k7e=>{"use strict";Object.defineProperty(k7e,"__esModule",{value:!0})});var q7e=v(B7e=>{"use strict";Object.defineProperty(B7e,"__esModule",{value:!0})});var z7e=v(U7e=>{"use strict";Object.defineProperty(U7e,"__esModule",{value:!0})});var V7e=v(H7e=>{"use strict";Object.defineProperty(H7e,"__esModule",{value:!0})});var K7e=v(W7e=>{"use strict";Object.defineProperty(W7e,"__esModule",{value:!0})});var G7e=v(X7=>{"use strict";Object.defineProperty(X7,"__esModule",{value:!0});X7.ChatRequestPromptTruncation=void 0;X7.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var J7e=v(Q7=>{"use strict";Object.defineProperty(Q7,"__esModule",{value:!0});Q7.ChatRequestCitationQuality=void 0;Q7.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var Z7e=v(Y7e=>{"use strict";Object.defineProperty(Y7e,"__esModule",{value:!0})});var X7e=v(eY=>{"use strict";Object.defineProperty(eY,"__esModule",{value:!0});eY.ChatRequestSafetyMode=void 0;eY.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var Q7e=v(tY=>{"use strict";Object.defineProperty(tY,"__esModule",{value:!0});tY.GenerateStreamRequestTruncate=void 0;tY.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var eYe=v(rY=>{"use strict";Object.defineProperty(rY,"__esModule",{value:!0});rY.GenerateStreamRequestReturnLikelihoods=void 0;rY.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var tYe=v(nY=>{"use strict";Object.defineProperty(nY,"__esModule",{value:!0});nY.GenerateRequestTruncate=void 0;nY.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var rYe=v(oY=>{"use strict";Object.defineProperty(oY,"__esModule",{value:!0});oY.GenerateRequestReturnLikelihoods=void 0;oY.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var nYe=v(iY=>{"use strict";Object.defineProperty(iY,"__esModule",{value:!0});iY.EmbedRequestTruncate=void 0;iY.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var iYe=v(oYe=>{"use strict";Object.defineProperty(oYe,"__esModule",{value:!0})});var sYe=v(aYe=>{"use strict";Object.defineProperty(aYe,"__esModule",{value:!0})});var lYe=v(uYe=>{"use strict";Object.defineProperty(uYe,"__esModule",{value:!0})});var dYe=v(cYe=>{"use strict";Object.defineProperty(cYe,"__esModule",{value:!0})});var pYe=v(fYe=>{"use strict";Object.defineProperty(fYe,"__esModule",{value:!0})});var mYe=v(aY=>{"use strict";Object.defineProperty(aY,"__esModule",{value:!0});aY.ClassifyRequestTruncate=void 0;aY.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var gYe=v(hYe=>{"use strict";Object.defineProperty(hYe,"__esModule",{value:!0})});var yYe=v(sY=>{"use strict";Object.defineProperty(sY,"__esModule",{value:!0});sY.ClassifyResponseClassificationsItemClassificationType=void 0;sY.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var _Ye=v(bYe=>{"use strict";Object.defineProperty(bYe,"__esModule",{value:!0})});var wYe=v(vYe=>{"use strict";Object.defineProperty(vYe,"__esModule",{value:!0})});var SYe=v(uY=>{"use strict";Object.defineProperty(uY,"__esModule",{value:!0});uY.SummarizeRequestLength=void 0;uY.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var xYe=v(lY=>{"use strict";Object.defineProperty(lY,"__esModule",{value:!0});lY.SummarizeRequestFormat=void 0;lY.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var CYe=v(cY=>{"use strict";Object.defineProperty(cY,"__esModule",{value:!0});cY.SummarizeRequestExtractiveness=void 0;cY.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var PYe=v(OYe=>{"use strict";Object.defineProperty(OYe,"__esModule",{value:!0})});var TYe=v(EYe=>{"use strict";Object.defineProperty(EYe,"__esModule",{value:!0})});var IYe=v(AYe=>{"use strict";Object.defineProperty(AYe,"__esModule",{value:!0})});var RYe=v(MYe=>{"use strict";Object.defineProperty(MYe,"__esModule",{value:!0})});var NYe=v(jYe=>{"use strict";Object.defineProperty(jYe,"__esModule",{value:!0})});var LYe=v(DYe=>{"use strict";Object.defineProperty(DYe,"__esModule",{value:!0})});var kYe=v(FYe=>{"use strict";Object.defineProperty(FYe,"__esModule",{value:!0})});var BYe=v($Ye=>{"use strict";Object.defineProperty($Ye,"__esModule",{value:!0})});var UYe=v(qYe=>{"use strict";Object.defineProperty(qYe,"__esModule",{value:!0})});var HYe=v(zYe=>{"use strict";Object.defineProperty(zYe,"__esModule",{value:!0})});var WYe=v(VYe=>{"use strict";Object.defineProperty(VYe,"__esModule",{value:!0})});var GYe=v(KYe=>{"use strict";Object.defineProperty(KYe,"__esModule",{value:!0})});var YYe=v(JYe=>{"use strict";Object.defineProperty(JYe,"__esModule",{value:!0})});var XYe=v(ZYe=>{"use strict";Object.defineProperty(ZYe,"__esModule",{value:!0})});var eZe=v(QYe=>{"use strict";Object.defineProperty(QYe,"__esModule",{value:!0})});var rZe=v(tZe=>{"use strict";Object.defineProperty(tZe,"__esModule",{value:!0})});var oZe=v(nZe=>{"use strict";Object.defineProperty(nZe,"__esModule",{value:!0})});var aZe=v(iZe=>{"use strict";Object.defineProperty(iZe,"__esModule",{value:!0})});var uZe=v(sZe=>{"use strict";Object.defineProperty(sZe,"__esModule",{value:!0})});var cZe=v(lZe=>{"use strict";Object.defineProperty(lZe,"__esModule",{value:!0})});var dZe=v(dY=>{"use strict";Object.defineProperty(dY,"__esModule",{value:!0});dY.FinishReason=void 0;dY.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var pZe=v(fZe=>{"use strict";Object.defineProperty(fZe,"__esModule",{value:!0})});var hZe=v(mZe=>{"use strict";Object.defineProperty(mZe,"__esModule",{value:!0})});var yZe=v(gZe=>{"use strict";Object.defineProperty(gZe,"__esModule",{value:!0})});var _Ze=v(bZe=>{"use strict";Object.defineProperty(bZe,"__esModule",{value:!0})});var wZe=v(vZe=>{"use strict";Object.defineProperty(vZe,"__esModule",{value:!0})});var xZe=v(SZe=>{"use strict";Object.defineProperty(SZe,"__esModule",{value:!0})});var OZe=v(CZe=>{"use strict";Object.defineProperty(CZe,"__esModule",{value:!0})});var EZe=v(PZe=>{"use strict";Object.defineProperty(PZe,"__esModule",{value:!0})});var AZe=v(TZe=>{"use strict";Object.defineProperty(TZe,"__esModule",{value:!0})});var MZe=v(IZe=>{"use strict";Object.defineProperty(IZe,"__esModule",{value:!0})});var jZe=v(RZe=>{"use strict";Object.defineProperty(RZe,"__esModule",{value:!0})});var DZe=v(NZe=>{"use strict";Object.defineProperty(NZe,"__esModule",{value:!0})});var LZe=v(fY=>{"use strict";Object.defineProperty(fY,"__esModule",{value:!0});fY.ChatStreamEndEventFinishReason=void 0;fY.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var kZe=v(FZe=>{"use strict";Object.defineProperty(FZe,"__esModule",{value:!0})});var BZe=v($Ze=>{"use strict";Object.defineProperty($Ze,"__esModule",{value:!0})});var UZe=v(qZe=>{"use strict";Object.defineProperty(qZe,"__esModule",{value:!0})});var HZe=v(zZe=>{"use strict";Object.defineProperty(zZe,"__esModule",{value:!0})});var WZe=v(VZe=>{"use strict";Object.defineProperty(VZe,"__esModule",{value:!0})});var GZe=v(KZe=>{"use strict";Object.defineProperty(KZe,"__esModule",{value:!0})});var YZe=v(JZe=>{"use strict";Object.defineProperty(JZe,"__esModule",{value:!0})});var XZe=v(ZZe=>{"use strict";Object.defineProperty(ZZe,"__esModule",{value:!0})});var eXe=v(QZe=>{"use strict";Object.defineProperty(QZe,"__esModule",{value:!0})});var rXe=v(tXe=>{"use strict";Object.defineProperty(tXe,"__esModule",{value:!0})});var oXe=v(nXe=>{"use strict";Object.defineProperty(nXe,"__esModule",{value:!0})});var aXe=v(iXe=>{"use strict";Object.defineProperty(iXe,"__esModule",{value:!0})});var uXe=v(sXe=>{"use strict";Object.defineProperty(sXe,"__esModule",{value:!0})});var cXe=v(lXe=>{"use strict";Object.defineProperty(lXe,"__esModule",{value:!0})});var fXe=v(dXe=>{"use strict";Object.defineProperty(dXe,"__esModule",{value:!0})});var mXe=v(pXe=>{"use strict";Object.defineProperty(pXe,"__esModule",{value:!0})});var gXe=v(hXe=>{"use strict";Object.defineProperty(hXe,"__esModule",{value:!0})});var bXe=v(yXe=>{"use strict";Object.defineProperty(yXe,"__esModule",{value:!0})});var vXe=v(_Xe=>{"use strict";Object.defineProperty(_Xe,"__esModule",{value:!0})});var SXe=v(wXe=>{"use strict";Object.defineProperty(wXe,"__esModule",{value:!0})});var xXe=v(pY=>{"use strict";Object.defineProperty(pY,"__esModule",{value:!0});pY.EmbedInputType=void 0;pY.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering"}});var CXe=v(mY=>{"use strict";Object.defineProperty(mY,"__esModule",{value:!0});mY.EmbeddingType=void 0;mY.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"}});var PXe=v(OXe=>{"use strict";Object.defineProperty(OXe,"__esModule",{value:!0})});var TXe=v(EXe=>{"use strict";Object.defineProperty(EXe,"__esModule",{value:!0})});var IXe=v(AXe=>{"use strict";Object.defineProperty(AXe,"__esModule",{value:!0})});var MXe=v(hY=>{"use strict";Object.defineProperty(hY,"__esModule",{value:!0});hY.EmbedJobStatus=void 0;hY.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var RXe=v(gY=>{"use strict";Object.defineProperty(gY,"__esModule",{value:!0});gY.EmbedJobTruncate=void 0;gY.EmbedJobTruncate={Start:"START",End:"END"}});var NXe=v(jXe=>{"use strict";Object.defineProperty(jXe,"__esModule",{value:!0})});var LXe=v(DXe=>{"use strict";Object.defineProperty(DXe,"__esModule",{value:!0})});var kXe=v(FXe=>{"use strict";Object.defineProperty(FXe,"__esModule",{value:!0})});var BXe=v($Xe=>{"use strict";Object.defineProperty($Xe,"__esModule",{value:!0})});var UXe=v(qXe=>{"use strict";Object.defineProperty(qXe,"__esModule",{value:!0})});var zXe=v(yY=>{"use strict";Object.defineProperty(yY,"__esModule",{value:!0});yY.DatasetValidationStatus=void 0;yY.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var HXe=v(bY=>{"use strict";Object.defineProperty(bY,"__esModule",{value:!0});bY.DatasetType=void 0;bY.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 WXe=v(VXe=>{"use strict";Object.defineProperty(VXe,"__esModule",{value:!0})});var GXe=v(KXe=>{"use strict";Object.defineProperty(KXe,"__esModule",{value:!0})});var YXe=v(JXe=>{"use strict";Object.defineProperty(JXe,"__esModule",{value:!0})});var XXe=v(ZXe=>{"use strict";Object.defineProperty(ZXe,"__esModule",{value:!0})});var eQe=v(QXe=>{"use strict";Object.defineProperty(QXe,"__esModule",{value:!0})});var rQe=v(tQe=>{"use strict";Object.defineProperty(tQe,"__esModule",{value:!0})});var oQe=v(nQe=>{"use strict";Object.defineProperty(nQe,"__esModule",{value:!0})});var aQe=v(iQe=>{"use strict";Object.defineProperty(iQe,"__esModule",{value:!0})});var uQe=v(sQe=>{"use strict";Object.defineProperty(sQe,"__esModule",{value:!0})});var cQe=v(lQe=>{"use strict";Object.defineProperty(lQe,"__esModule",{value:!0})});var fQe=v(dQe=>{"use strict";Object.defineProperty(dQe,"__esModule",{value:!0})});var mQe=v(pQe=>{"use strict";Object.defineProperty(pQe,"__esModule",{value:!0})});var hQe=v(_Y=>{"use strict";Object.defineProperty(_Y,"__esModule",{value:!0});_Y.ConnectorAuthStatus=void 0;_Y.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var yQe=v(gQe=>{"use strict";Object.defineProperty(gQe,"__esModule",{value:!0})});var _Qe=v(bQe=>{"use strict";Object.defineProperty(bQe,"__esModule",{value:!0})});var wQe=v(vQe=>{"use strict";Object.defineProperty(vQe,"__esModule",{value:!0})});var SQe=v(vY=>{"use strict";Object.defineProperty(vY,"__esModule",{value:!0});vY.AuthTokenType=void 0;vY.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var CQe=v(xQe=>{"use strict";Object.defineProperty(xQe,"__esModule",{value:!0})});var PQe=v(OQe=>{"use strict";Object.defineProperty(OQe,"__esModule",{value:!0})});var TQe=v(EQe=>{"use strict";Object.defineProperty(EQe,"__esModule",{value:!0})});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 NQe=v(jQe=>{"use strict";Object.defineProperty(jQe,"__esModule",{value:!0})});var DQe=v(wY=>{"use strict";Object.defineProperty(wY,"__esModule",{value:!0});wY.CompatibleEndpoint=void 0;wY.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var FQe=v(LQe=>{"use strict";Object.defineProperty(LQe,"__esModule",{value:!0})});var $Qe=v(kQe=>{"use strict";Object.defineProperty(kQe,"__esModule",{value:!0})});var BQe=v(pe=>{"use strict";var ufr=pe&&pe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ufr(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});Se(j7e(),pe);Se(N7e(),pe);Se(L7e(),pe);Se(F7e(),pe);Se($7e(),pe);Se(q7e(),pe);Se(z7e(),pe);Se(V7e(),pe);Se(K7e(),pe);Se(G7e(),pe);Se(J7e(),pe);Se(Z7e(),pe);Se(X7e(),pe);Se(Q7e(),pe);Se(eYe(),pe);Se(tYe(),pe);Se(rYe(),pe);Se(nYe(),pe);Se(iYe(),pe);Se(sYe(),pe);Se(lYe(),pe);Se(dYe(),pe);Se(pYe(),pe);Se(mYe(),pe);Se(gYe(),pe);Se(yYe(),pe);Se(_Ye(),pe);Se(wYe(),pe);Se(SYe(),pe);Se(xYe(),pe);Se(CYe(),pe);Se(PYe(),pe);Se(TYe(),pe);Se(IYe(),pe);Se(RYe(),pe);Se(NYe(),pe);Se(LYe(),pe);Se(kYe(),pe);Se(BYe(),pe);Se(UYe(),pe);Se(HYe(),pe);Se(WYe(),pe);Se(GYe(),pe);Se(YYe(),pe);Se(XYe(),pe);Se(eZe(),pe);Se(rZe(),pe);Se(oZe(),pe);Se(aZe(),pe);Se(uZe(),pe);Se(cZe(),pe);Se(dZe(),pe);Se(pZe(),pe);Se(hZe(),pe);Se(yZe(),pe);Se(_Ze(),pe);Se(wZe(),pe);Se(xZe(),pe);Se(OZe(),pe);Se(EZe(),pe);Se(AZe(),pe);Se(MZe(),pe);Se(jZe(),pe);Se(DZe(),pe);Se(LZe(),pe);Se(kZe(),pe);Se(BZe(),pe);Se(UZe(),pe);Se(HZe(),pe);Se(WZe(),pe);Se(GZe(),pe);Se(YZe(),pe);Se(XZe(),pe);Se(eXe(),pe);Se(rXe(),pe);Se(oXe(),pe);Se(aXe(),pe);Se(uXe(),pe);Se(cXe(),pe);Se(fXe(),pe);Se(mXe(),pe);Se(gXe(),pe);Se(bXe(),pe);Se(vXe(),pe);Se(SXe(),pe);Se(xXe(),pe);Se(CXe(),pe);Se(PXe(),pe);Se(TXe(),pe);Se(IXe(),pe);Se(MXe(),pe);Se(RXe(),pe);Se(NXe(),pe);Se(LXe(),pe);Se(kXe(),pe);Se(BXe(),pe);Se(UXe(),pe);Se(zXe(),pe);Se(HXe(),pe);Se(WXe(),pe);Se(GXe(),pe);Se(YXe(),pe);Se(XXe(),pe);Se(eQe(),pe);Se(rQe(),pe);Se(oQe(),pe);Se(aQe(),pe);Se(uQe(),pe);Se(cQe(),pe);Se(fQe(),pe);Se(mQe(),pe);Se(hQe(),pe);Se(yQe(),pe);Se(_Qe(),pe);Se(wQe(),pe);Se(SQe(),pe);Se(CQe(),pe);Se(PQe(),pe);Se(TQe(),pe);Se(IQe(),pe);Se(RQe(),pe);Se(NQe(),pe);Se(DQe(),pe);Se(FQe(),pe);Se($Qe(),pe)});var qQe=v(SY=>{"use strict";Object.defineProperty(SY,"__esModule",{value:!0});SY.CohereError=void 0;var t_e=class t extends Error{constructor({message:e,statusCode:r,body:n}){super(lfr({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),r!=null&&(this.statusCode=r),n!==void 0&&(this.body=n)}};SY.CohereError=t_e;function lfr({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 UQe=v(xY=>{"use strict";Object.defineProperty(xY,"__esModule",{value:!0});xY.CohereTimeoutError=void 0;var r_e=class t extends Error{constructor(){super("Timeout"),Object.setPrototypeOf(this,t.prototype)}};xY.CohereTimeoutError=r_e});var As=v(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.CohereTimeoutError=ak.CohereError=void 0;var cfr=qQe();Object.defineProperty(ak,"CohereError",{enumerable:!0,get:function(){return cfr.CohereError}});var dfr=UQe();Object.defineProperty(ak,"CohereTimeoutError",{enumerable:!0,get:function(){return dfr.CohereTimeoutError}})});var zQe=v(g_=>{"use strict";var ffr=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]}),pfr=g_&&g_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mfr=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)&&ffr(e,t,r);return pfr(e,t),e};Object.defineProperty(g_,"__esModule",{value:!0});g_.BadRequestError=void 0;var hfr=mfr(As()),n_e=class t extends hfr.CohereError{constructor(e){super({message:"BadRequestError",statusCode:400,body:e}),Object.setPrototypeOf(this,t.prototype)}};g_.BadRequestError=n_e});var HQe=v(y_=>{"use strict";var gfr=y_&&y_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yfr=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bfr=y_&&y_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gfr(e,t,r);return yfr(e,t),e};Object.defineProperty(y_,"__esModule",{value:!0});y_.UnauthorizedError=void 0;var _fr=bfr(As()),o_e=class t extends _fr.CohereError{constructor(e){super({message:"UnauthorizedError",statusCode:401,body:e}),Object.setPrototypeOf(this,t.prototype)}};y_.UnauthorizedError=o_e});var VQe=v(b_=>{"use strict";var vfr=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wfr=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sfr=b_&&b_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vfr(e,t,r);return wfr(e,t),e};Object.defineProperty(b_,"__esModule",{value:!0});b_.ForbiddenError=void 0;var xfr=Sfr(As()),i_e=class t extends xfr.CohereError{constructor(e){super({message:"ForbiddenError",statusCode:403,body:e}),Object.setPrototypeOf(this,t.prototype)}};b_.ForbiddenError=i_e});var WQe=v(__=>{"use strict";var Cfr=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ofr=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pfr=__&&__.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Cfr(e,t,r);return Ofr(e,t),e};Object.defineProperty(__,"__esModule",{value:!0});__.NotFoundError=void 0;var Efr=Pfr(As()),a_e=class t extends Efr.CohereError{constructor(e){super({message:"NotFoundError",statusCode:404,body:e}),Object.setPrototypeOf(this,t.prototype)}};__.NotFoundError=a_e});var KQe=v(v_=>{"use strict";var Tfr=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]}),Afr=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ifr=v_&&v_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tfr(e,t,r);return Afr(e,t),e};Object.defineProperty(v_,"__esModule",{value:!0});v_.UnprocessableEntityError=void 0;var Mfr=Ifr(As()),s_e=class t extends Mfr.CohereError{constructor(e){super({message:"UnprocessableEntityError",statusCode:422,body:e}),Object.setPrototypeOf(this,t.prototype)}};v_.UnprocessableEntityError=s_e});var GQe=v(w_=>{"use strict";var Rfr=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]}),jfr=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nfr=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)&&Rfr(e,t,r);return jfr(e,t),e};Object.defineProperty(w_,"__esModule",{value:!0});w_.TooManyRequestsError=void 0;var Dfr=Nfr(As()),u_e=class t extends Dfr.CohereError{constructor(e){super({message:"TooManyRequestsError",statusCode:429,body:e}),Object.setPrototypeOf(this,t.prototype)}};w_.TooManyRequestsError=u_e});var JQe=v(S_=>{"use strict";var Lfr=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]}),Ffr=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kfr=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)&&Lfr(e,t,r);return Ffr(e,t),e};Object.defineProperty(S_,"__esModule",{value:!0});S_.ClientClosedRequestError=void 0;var $fr=kfr(As()),l_e=class t extends $fr.CohereError{constructor(e){super({message:"ClientClosedRequestError",statusCode:499,body:e}),Object.setPrototypeOf(this,t.prototype)}};S_.ClientClosedRequestError=l_e});var YQe=v(x_=>{"use strict";var Bfr=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]}),qfr=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ufr=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)&&Bfr(e,t,r);return qfr(e,t),e};Object.defineProperty(x_,"__esModule",{value:!0});x_.InternalServerError=void 0;var zfr=Ufr(As()),c_e=class t extends zfr.CohereError{constructor(e){super({message:"InternalServerError",statusCode:500,body:e}),Object.setPrototypeOf(this,t.prototype)}};x_.InternalServerError=c_e});var ZQe=v(C_=>{"use strict";var Hfr=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]}),Vfr=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wfr=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)&&Hfr(e,t,r);return Vfr(e,t),e};Object.defineProperty(C_,"__esModule",{value:!0});C_.NotImplementedError=void 0;var Kfr=Wfr(As()),d_e=class t extends Kfr.CohereError{constructor(e){super({message:"NotImplementedError",statusCode:501,body:e}),Object.setPrototypeOf(this,t.prototype)}};C_.NotImplementedError=d_e});var XQe=v(O_=>{"use strict";var Gfr=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]}),Jfr=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yfr=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)&&Gfr(e,t,r);return Jfr(e,t),e};Object.defineProperty(O_,"__esModule",{value:!0});O_.ServiceUnavailableError=void 0;var Zfr=Yfr(As()),f_e=class t extends Zfr.CohereError{constructor(e){super({message:"ServiceUnavailableError",statusCode:503,body:e}),Object.setPrototypeOf(this,t.prototype)}};O_.ServiceUnavailableError=f_e});var QQe=v(P_=>{"use strict";var Xfr=P_&&P_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qfr=P_&&P_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),epr=P_&&P_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xfr(e,t,r);return Qfr(e,t),e};Object.defineProperty(P_,"__esModule",{value:!0});P_.GatewayTimeoutError=void 0;var tpr=epr(As()),p_e=class t extends tpr.CohereError{constructor(e){super({message:"GatewayTimeoutError",statusCode:504,body:e}),Object.setPrototypeOf(this,t.prototype)}};P_.GatewayTimeoutError=p_e});var eet=v(Fc=>{"use strict";var rpr=Fc&&Fc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ry=Fc&&Fc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rpr(e,t,r)};Object.defineProperty(Fc,"__esModule",{value:!0});Ry(zQe(),Fc);Ry(HQe(),Fc);Ry(VQe(),Fc);Ry(WQe(),Fc);Ry(KQe(),Fc);Ry(GQe(),Fc);Ry(JQe(),Fc);Ry(YQe(),Fc);Ry(ZQe(),Fc);Ry(XQe(),Fc);Ry(QQe(),Fc)});var ret=v(tet=>{"use strict";Object.defineProperty(tet,"__esModule",{value:!0})});var net=v(C1=>{"use strict";var npr=C1&&C1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),opr=C1&&C1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&npr(e,t,r)};Object.defineProperty(C1,"__esModule",{value:!0});opr(ret(),C1)});var iO=v(E_=>{"use strict";var ipr=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]}),CY=E_&&E_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ipr(e,t,r)};Object.defineProperty(E_,"__esModule",{value:!0});CY(R7e(),E_);CY(BQe(),E_);CY(eet(),E_);CY(net(),E_)});var g_e={};Cf(g_e,{__addDisposableResource:()=>Pet,__assign:()=>OY,__asyncDelegator:()=>yet,__asyncGenerator:()=>get,__asyncValues:()=>bet,__await:()=>sk,__awaiter:()=>cet,__classPrivateFieldGet:()=>xet,__classPrivateFieldIn:()=>Oet,__classPrivateFieldSet:()=>Cet,__createBinding:()=>EY,__decorate:()=>aet,__disposeResources:()=>Eet,__esDecorate:()=>apr,__exportStar:()=>fet,__extends:()=>oet,__generator:()=>det,__importDefault:()=>wet,__importStar:()=>vet,__makeTemplateObject:()=>_et,__metadata:()=>uet,__param:()=>set,__propKey:()=>upr,__read:()=>h_e,__rest:()=>iet,__runInitializers:()=>spr,__setFunctionName:()=>lpr,__spread:()=>pet,__spreadArray:()=>het,__spreadArrays:()=>met,__values:()=>PY,default:()=>fpr});function oet(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");m_e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function iet(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 aet(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 set(t,e){return function(r,n){e(r,n,t)}}function apr(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 spr(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 upr(t){return typeof t=="symbol"?t:"".concat(t)}function lpr(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 uet(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function cet(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 det(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 fet(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EY(e,t,r)}function PY(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 h_e(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 pet(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h_e(arguments[e]));return t}function met(){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 het(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 sk(t){return this instanceof sk?(this.v=t,this):new sk(t)}function get(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 sk?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 yet(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:sk(t[o](a)),done:!1}:i?i(a):a}:i}}function bet(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 PY=="function"?PY(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 _et(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function vet(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&EY(e,t,r);return cpr(e,t),e}function wet(t){return t&&t.__esModule?t:{default:t}}function xet(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 Cet(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 Oet(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 Pet(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 Eet(t){function e(i){t.error=t.hasError?new dpr(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 m_e,OY,EY,cpr,dpr,fpr,y_e=w(()=>{m_e=function(t,e){return m_e=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])},m_e(t,e)};OY=function(){return OY=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},OY.apply(this,arguments)};EY=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};cpr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};dpr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};fpr={__extends:oet,__assign:OY,__rest:iet,__decorate:aet,__param:set,__metadata:uet,__awaiter:cet,__generator:det,__createBinding:EY,__exportStar:fet,__values:PY,__read:h_e,__spread:pet,__spreadArrays:met,__spreadArray:het,__await:sk,__asyncGenerator:get,__asyncDelegator:yet,__asyncValues:bet,__makeTemplateObject:_et,__importStar:vet,__importDefault:wet,__classPrivateFieldGet:xet,__classPrivateFieldSet:Cet,__classPrivateFieldIn:Oet,__addDisposableResource:Pet,__disposeResources:Eet}});var b_e=v(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.MAX_HASHABLE_LENGTH=Wh.INIT=Wh.KEY=Wh.DIGEST_LENGTH=Wh.BLOCK_SIZE=void 0;Wh.BLOCK_SIZE=64;Wh.DIGEST_LENGTH=32;Wh.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]);Wh.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Wh.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var Tet=v(TY=>{"use strict";Object.defineProperty(TY,"__esModule",{value:!0});TY.RawSha256=void 0;var Kh=b_e(),ppr=function(){function t(){this.state=Int32Array.from(Kh.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>Kh.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===Kh.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%Kh.BLOCK_SIZE>=Kh.BLOCK_SIZE-8){for(var o=this.bufferLength;o<Kh.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<Kh.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(Kh.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(Kh.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(Kh.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<Kh.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+(Kh.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}();TY.RawSha256=ppr});var Met=v((FWn,Iet)=>{var AY=Object.defineProperty,mpr=Object.getOwnPropertyDescriptor,hpr=Object.getOwnPropertyNames,gpr=Object.prototype.hasOwnProperty,ypr=(t,e)=>AY(t,"name",{value:e,configurable:!0}),bpr=(t,e)=>{for(var r in e)AY(t,r,{get:e[r],enumerable:!0})},_pr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hpr(e))!gpr.call(t,o)&&o!==r&&AY(t,o,{get:()=>e[o],enumerable:!(n=mpr(e,o))||n.enumerable});return t},vpr=t=>_pr(AY({},"__esModule",{value:!0}),t),Aet={};bpr(Aet,{isArrayBuffer:()=>wpr});Iet.exports=vpr(Aet);var wpr=ypr(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var Det=v((kWn,Net)=>{var IY=Object.defineProperty,Spr=Object.getOwnPropertyDescriptor,xpr=Object.getOwnPropertyNames,Cpr=Object.prototype.hasOwnProperty,Ret=(t,e)=>IY(t,"name",{value:e,configurable:!0}),Opr=(t,e)=>{for(var r in e)IY(t,r,{get:e[r],enumerable:!0})},Ppr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xpr(e))!Cpr.call(t,o)&&o!==r&&IY(t,o,{get:()=>e[o],enumerable:!(n=Spr(e,o))||n.enumerable});return t},Epr=t=>Ppr(IY({},"__esModule",{value:!0}),t),jet={};Opr(jet,{fromArrayBuffer:()=>Apr,fromString:()=>Ipr});Net.exports=Epr(jet);var Tpr=Met(),__e=Pp(),Apr=Ret((t,e=0,r=t.byteLength-e)=>{if(!(0,Tpr.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return __e.Buffer.from(t,e,r)},"fromArrayBuffer"),Ipr=Ret((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?__e.Buffer.from(t,e):__e.Buffer.from(t)},"fromString")});var Bet=v(($Wn,$et)=>{var MY=Object.defineProperty,Mpr=Object.getOwnPropertyDescriptor,Rpr=Object.getOwnPropertyNames,jpr=Object.prototype.hasOwnProperty,v_e=(t,e)=>MY(t,"name",{value:e,configurable:!0}),Npr=(t,e)=>{for(var r in e)MY(t,r,{get:e[r],enumerable:!0})},Dpr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rpr(e))!jpr.call(t,o)&&o!==r&&MY(t,o,{get:()=>e[o],enumerable:!(n=Mpr(e,o))||n.enumerable});return t},Lpr=t=>Dpr(MY({},"__esModule",{value:!0}),t),Let={};Npr(Let,{fromUtf8:()=>ket,toUint8Array:()=>Fpr,toUtf8:()=>kpr});$et.exports=Lpr(Let);var Fet=Det(),ket=v_e(t=>{let e=(0,Fet.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),Fpr=v_e(t=>typeof t=="string"?ket(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),kpr=v_e(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,Fet.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var qet=v(RY=>{"use strict";Object.defineProperty(RY,"__esModule",{value:!0});RY.convertToBuffer=void 0;var $pr=Bet(),Bpr=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:$pr.fromUtf8;function qpr(t){return t instanceof Uint8Array?t:typeof t=="string"?Bpr(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}RY.convertToBuffer=qpr});var Uet=v(jY=>{"use strict";Object.defineProperty(jY,"__esModule",{value:!0});jY.isEmptyData=void 0;function Upr(t){return typeof t=="string"?t.length===0:t.byteLength===0}jY.isEmptyData=Upr});var zet=v(NY=>{"use strict";Object.defineProperty(NY,"__esModule",{value:!0});NY.numToUint8=void 0;function zpr(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}NY.numToUint8=zpr});var Het=v(DY=>{"use strict";Object.defineProperty(DY,"__esModule",{value:!0});DY.uint32ArrayFrom=void 0;function Hpr(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)}DY.uint32ArrayFrom=Hpr});var LY=v(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});T_.uint32ArrayFrom=T_.numToUint8=T_.isEmptyData=T_.convertToBuffer=void 0;var Vpr=qet();Object.defineProperty(T_,"convertToBuffer",{enumerable:!0,get:function(){return Vpr.convertToBuffer}});var Wpr=Uet();Object.defineProperty(T_,"isEmptyData",{enumerable:!0,get:function(){return Wpr.isEmptyData}});var Kpr=zet();Object.defineProperty(T_,"numToUint8",{enumerable:!0,get:function(){return Kpr.numToUint8}});var Gpr=Het();Object.defineProperty(T_,"uint32ArrayFrom",{enumerable:!0,get:function(){return Gpr.uint32ArrayFrom}})});var Wet=v($Y=>{"use strict";Object.defineProperty($Y,"__esModule",{value:!0});$Y.Sha256=void 0;var Vet=(y_e(),zl(g_e)),kY=b_e(),FY=Tet(),w_e=LY(),Jpr=function(){function t(e){this.secret=e,this.hash=new FY.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,w_e.isEmptyData)(e)||this.error))try{this.hash.update((0,w_e.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 Vet.__awaiter(this,void 0,void 0,function(){return Vet.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new FY.RawSha256,this.secret){this.outer=new FY.RawSha256;var e=Ypr(this.secret),r=new Uint8Array(kY.BLOCK_SIZE);r.set(e);for(var n=0;n<kY.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}();$Y.Sha256=Jpr;function Ypr(t){var e=(0,w_e.convertToBuffer)(t);if(e.byteLength>kY.BLOCK_SIZE){var r=new FY.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(kY.BLOCK_SIZE);return n.set(e),n}});var x_e=v(S_e=>{"use strict";Object.defineProperty(S_e,"__esModule",{value:!0});var Zpr=(y_e(),zl(g_e));Zpr.__exportStar(Wet(),S_e)});var Ket=w(()=>{});var Get=w(()=>{});var Jet=w(()=>{});var O1,j3=w(()=>{O1=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 Tl,Yet=w(()=>{j3();Tl=class t extends O1{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var Zet=w(()=>{j3()});var Xet=w(()=>{j3()});var Qet=w(()=>{});var ett,ttt=w(()=>{ett=(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 aO=w(()=>{Yet();j3();Zet();Xet();Qet();ttt()});function BY(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 C_e=w(()=>{});var rtt=w(()=>{});var ntt=w(()=>{rtt()});var ott=w(()=>{});var itt,att=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(itt||(itt={}))});var O_e,stt=w(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(O_e||(O_e={}))});var utt=w(()=>{});var ltt=w(()=>{});var ctt=w(()=>{});var dtt=w(()=>{});var ftt=w(()=>{att();stt();utt();ltt();ctt();dtt()});var ptt=w(()=>{});var mtt=w(()=>{});var htt=w(()=>{});var gtt=w(()=>{});var ytt=w(()=>{});var btt=w(()=>{});var _tt=w(()=>{});var vtt=w(()=>{ytt();btt();_tt()});var wtt=w(()=>{});var Stt=w(()=>{});var uk,xtt=w(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(uk||(uk={}))});var Ctt=w(()=>{});var Ott=w(()=>{});var Ptt=w(()=>{});var Ett=w(()=>{});var Ttt=w(()=>{});var Att=w(()=>{Ctt();Ott();Ptt();Ett();Ttt()});var Itt=w(()=>{});var lk,P_e=w(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(lk||(lk={}))});var Mtt=w(()=>{P_e()});var Rtt=w(()=>{});var jtt=w(()=>{Mtt();Rtt();P_e()});var Nm,Ntt=w(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Nm||(Nm={}))});var Dtt=w(()=>{});var Ltt=w(()=>{});var Ftt=w(()=>{});var ktt=w(()=>{});var $tt=w(()=>{});var Btt=w(()=>{Ltt();Ftt();ktt();$tt()});var qtt=w(()=>{});var ck,Utt=w(()=>{ck="__smithy_context"});var ztt=w(()=>{});var Htt,Vtt=w(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Htt||(Htt={}))});var Wtt=w(()=>{});var Ktt=w(()=>{});var Gtt=w(()=>{});var Jtt=w(()=>{});var Ytt=w(()=>{});var Ztt=w(()=>{});var Xtt=w(()=>{});var Qtt=w(()=>{});var ert=w(()=>{});var trt,rrt=w(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(trt||(trt={}))});var nrt=w(()=>{});var ort=w(()=>{});var irt=w(()=>{});var art=w(()=>{});var srt=w(()=>{});var urt=w(()=>{});var Hs=w(()=>{ott();ftt();ptt();mtt();htt();gtt();vtt();wtt();Stt();xtt();Att();Itt();jtt();Ntt();Dtt();Btt();qtt();Utt();ztt();Vtt();Wtt();Ktt();Gtt();Jtt();Ytt();Ztt();Xtt();Qtt();ert();rrt();nrt();ort();irt();art();srt();urt()});var lrt=w(()=>{Hs()});var crt=w(()=>{});var drt=w(()=>{});function Xpr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var qY,frt=w(()=>{qY=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=Xpr(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 prt=w(()=>{});var mrt=w(()=>{});var hrt=w(()=>{});var grt=w(()=>{ntt();lrt();crt();drt();frt();prt();mrt();hrt()});var Qpr,emr,UY,E_e=w(()=>{grt();Qpr=t=>e=>async r=>{if(!qY.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)},emr={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},UY=t=>({applyToStack:e=>{e.add(Qpr(t),emr)}})});var tmr,rmr,zY,yrt=w(()=>{tmr=()=>(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}},rmr={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},zY=t=>({applyToStack:e=>{e.add(tmr(),rmr)}})});var T_e=w(()=>{yrt()});var brt=w(()=>{});var _rt=w(()=>{brt()});var vrt=w(()=>{Hs()});var wrt=w(()=>{});var Srt=w(()=>{});function nmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var HY,xrt=w(()=>{HY=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=nmr(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 Crt=w(()=>{});var Ort=w(()=>{});var Prt=w(()=>{});var Ert=w(()=>{_rt();vrt();wrt();Srt();xrt();Crt();Ort();Prt()});var Trt,omr,imr,amr,smr,VY,A_e=w(()=>{Ert();Trt="X-Amzn-Trace-Id",omr="AWS_LAMBDA_FUNCTION_NAME",imr="_X_AMZN_TRACE_ID",amr=t=>e=>async r=>{let{request:n}=r;if(!HY.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(Trt))return e(r);let o=process.env[omr],i=process.env[imr],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[Trt]=i),e({...r,request:n})},smr={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},VY=t=>({applyToStack:e=>{e.add(amr(t),smr)}})});function WY(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var Art=w(()=>{});var umr,N3,I_e=w(()=>{umr=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}$"),N3=t=>umr.test(t)||t.startsWith("[")&&t.endsWith("]")});var lmr,D3,M_e=w(()=>{lmr=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),D3=(t,e=!1)=>{if(!e)return lmr.test(t);let r=t.split(".");for(let n of r)if(!D3(n))return!1;return!0}});var sO,KY=w(()=>{sO={}});var uO,Irt=w(()=>{uO="endpoints"});function Gh(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Gh(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Gh).join(", ")})`:JSON.stringify(t,null,2)}var Mrt=w(()=>{});var L3=w(()=>{Irt();Mrt()});var Wi,Rrt=w(()=>{Wi=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var jrt=w(()=>{});var Nrt=w(()=>{});var Drt=w(()=>{});var Lrt=w(()=>{});var Frt=w(()=>{});var krt=w(()=>{});var Jh=w(()=>{Rrt();jrt();Nrt();Drt();Lrt();Frt();krt()});var $rt,Brt=w(()=>{$rt=(t,e)=>t===e});var qrt,Urt=w(()=>{Jh();qrt=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 Wi(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new Wi(`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 GY,zrt=w(()=>{Jh();Urt();GY=(t,e)=>qrt(e).reduce((r,n)=>{if(typeof r!="object")throw new Wi(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var Hrt,Vrt=w(()=>{Hrt=t=>t!=null});var Wrt,Krt=w(()=>{Wrt=t=>!t});var R_e,Grt,Jrt=w(()=>{Hs();I_e();R_e={[uk.HTTP]:80,[uk.HTTPS]:443},Grt=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,S])=>`${y}=${S}`).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(uk).includes(u))return null;let l=N3(o),c=r.includes(`${n}:${R_e[u]}`)||typeof t=="string"&&t.includes(`${n}:${R_e[u]}`),d=`${n}${c?`:${R_e[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var Yrt,Zrt=w(()=>{Yrt=(t,e)=>t===e});var Xrt,Qrt=w(()=>{Xrt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var ent,tnt=w(()=>{ent=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var j_e=w(()=>{Brt();zrt();Vrt();M_e();Krt();Jrt();Zrt();Qrt();tnt()});var rnt,nnt=w(()=>{j_e();rnt={booleanEquals:$rt,getAttr:GY,isSet:Hrt,isValidHostLabel:D3,not:Wrt,parseURL:Grt,stringEquals:Yrt,substring:Xrt,uriEncode:ent}});var JY,N_e=w(()=>{j_e();JY=(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(GY(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var ont,int=w(()=>{ont=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var PT,F3=w(()=>{Jh();D_e();N_e();int();PT=(t,e,r)=>{if(typeof t=="string")return JY(t,r);if(t.fn)return YY(t,r);if(t.ref)return ont(t,r);throw new Wi(`'${e}': ${String(t)} is not a string, function or reference.`)}});var YY,D_e=w(()=>{KY();nnt();F3();YY=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:PT(i,"arg",r)),o=t.split(".");return o[0]in sO&&o[1]!=null?sO[o[0]][o[1]](...n):rnt[t](...n)}});var ant,snt=w(()=>{L3();Jh();D_e();ant=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new Wi(`'${t}' is already defined in Reference Record.`);let n=YY(e,r);return r.logger?.debug?.(`${uO} evaluateCondition: ${Gh(e)} = ${Gh(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var dk,ZY=w(()=>{L3();snt();dk=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=ant(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${uO} assign: ${i.name} := ${Gh(i.value)}`))}return{result:!0,referenceRecord:r}}});var unt,lnt=w(()=>{Jh();F3();unt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=PT(i,"Header value entry",e);if(typeof a!="string")throw new Wi(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var L_e,cnt=w(()=>{Jh();N_e();F_e();L_e=(t,e)=>{if(Array.isArray(t))return t.map(r=>L_e(r,e));switch(typeof t){case"string":return JY(t,e);case"object":if(t===null)throw new Wi(`Unexpected endpoint property: ${t}`);return XY(t,e);case"boolean":return t;default:throw new Wi(`Unexpected endpoint property type: ${typeof t}`)}}});var XY,F_e=w(()=>{cnt();XY=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:L_e(o,e)}),{})});var dnt,fnt=w(()=>{Jh();F3();dnt=(t,e)=>{let r=PT(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 Wi(`Endpoint URL must be a string, got ${typeof r}`)}});var pnt,mnt=w(()=>{L3();ZY();lnt();F_e();fnt();pnt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${uO} Resolving endpoint from template: ${Gh(n)}`),{...l!=null&&{headers:unt(l,a)},...u!=null&&{properties:XY(u,a)},url:dnt(s,a)}}});var hnt,gnt=w(()=>{Jh();ZY();F3();hnt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(o)throw new Wi(PT(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var ynt,bnt=w(()=>{ZY();k_e();ynt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=dk(r,e);if(o)return QY(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var QY,k_e=w(()=>{Jh();mnt();gnt();bnt();QY=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=pnt(r,e);if(n)return n}else if(r.type==="error")hnt(r,e);else if(r.type==="tree"){let n=ynt(r,e);if(n)return n}else throw new Wi(`Unknown endpoint rule: ${r}`);throw new Wi("Rules evaluation failed")}});var _nt=w(()=>{KY();k_e()});var k3,vnt=w(()=>{L3();Jh();_nt();k3=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${uO} Initial EndpointParams: ${Gh(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 Wi(`Missing required parameter: '${l}'`);let u=QY(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?.(`${uO} Resolved endpoint: ${Gh(u)}`),u}});var ET=w(()=>{I_e();M_e();KY();vnt();Jh()});var $_e=w(()=>{ET()});var B_e,wnt=w(()=>{ET();$_e();B_e=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!B_e(r))return!1;return!0}return!(!D3(t)||t.length<3||t.length>63||t!==t.toLowerCase()||N3(t))}});var Snt,cmr,xnt,Cnt=w(()=>{Snt=":",cmr="/",xnt=t=>{let e=t.split(Snt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(Snt)==="")return null;let u=s.map(l=>l.split(cmr)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var Pnt,Ont=w(()=>{Pnt={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 fmr,pmr,Ent,Tnt,q_e=w(()=>{Ont();fmr=Pnt,pmr="",Ent=t=>{let{partitions:e}=fmr;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}},Tnt=()=>pmr});var $3,Ant=w(()=>{ET();wnt();Cnt();q_e();$3={isVirtualHostableS3Bucket:B_e,parseArn:xnt,partition:Ent};sO.aws=$3});var Int=w(()=>{ET()});var Mnt=w(()=>{ET()});var Rnt=w(()=>{});var jnt=w(()=>{});var Nnt=w(()=>{});var Dnt=w(()=>{});var Lnt=w(()=>{});var Fnt=w(()=>{Mnt();Rnt();jnt();Nnt();Dnt();Lnt()});var eZ=w(()=>{Ant();q_e();$_e();Int();Fnt()});var knt=w(()=>{});var $nt=w(()=>{knt()});var Bnt=w(()=>{Hs()});var qnt=w(()=>{});var Unt=w(()=>{});function mmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var tZ,znt=w(()=>{tZ=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=mmr(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 Hnt=w(()=>{});var Vnt=w(()=>{});var Wnt=w(()=>{});var Knt=w(()=>{$nt();Bnt();qnt();Unt();znt();Hnt();Vnt();Wnt()});var U_e,rZ,z_e,nZ,Gnt,Jnt,H_e,Ynt=w(()=>{U_e="user-agent",rZ="x-amz-user-agent",z_e=" ",nZ="/",Gnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Jnt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,H_e="-"});var hmr,V_e,gmr,oZ,Znt=w(()=>{eZ();Knt();Ynt();hmr=t=>(e,r)=>async n=>{let{request:o}=n;if(!tZ.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(V_e)||[],s=(await t.defaultUserAgentProvider()).map(V_e),u=t?.customUserAgent?.map(V_e)||[],l=Tnt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(z_e),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(z_e);return t.runtime!=="browser"?(d&&(i[rZ]=i[rZ]?`${i[U_e]} ${d}`:d),i[U_e]=c):i[rZ]=c,e({...n,request:o})},V_e=t=>{let e=t[0].split(nZ).map(a=>a.replace(Gnt,H_e)).join(nZ),r=t[1]?.replace(Jnt,H_e),n=e.indexOf(nZ),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}`}},"")},gmr={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},oZ=t=>({applyToStack:e=>{e.add(hmr(t),gmr)}})});var W_e=w(()=>{Art();Znt()});var Xnt=w(()=>{});var Qnt=w(()=>{});var iZ,eot=w(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(iZ||(iZ={}))});var K_e=w(()=>{Xnt();Qnt();eot()});var aZ,tot=w(()=>{K_e();aZ=!1});var sZ,rot=w(()=>{K_e();sZ=!1});var A_,not=w(()=>{Hs();A_=t=>t[ck]||(t[ck]={})});var zd,oot=w(()=>{zd=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var jy=w(()=>{not();oot()});var iot=w(()=>{jy()});var aot=w(()=>{});var sot=w(()=>{jy();aot()});var uot=w(()=>{tot();rot();iot();sot()});var lot=w(()=>{});var uZ,G_e=w(()=>{uZ=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var J_e,cot=w(()=>{G_e();J_e=t=>uZ(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var lZ,dot=w(()=>{cot();G_e();lZ=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return J_e(e);let n=await e();return J_e(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return uZ(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var fot=w(()=>{lot();dot()});var pot=w(()=>{});var mot=w(()=>{});var hot=w(()=>{});var got=w(()=>{});var yot=w(()=>{});var bot=w(()=>{});var _ot=w(()=>{hot();got();yot();bot()});var vot=w(()=>{pot();mot();_ot()});var B3=w(()=>{uot();fot();vot()});function bmr(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var Y_e,cZ=w(()=>{Hs();jy();Y_e=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=bmr(t.httpAuthSchemes),s=A_(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 wot,_mr,vmr,wmr,Smr,xmr,Sot=w(()=>{wot=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),xmr(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Smr(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},_mr=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,vmr=/(\d+\.){3}\d+/,wmr=/\.\./,Smr=t=>_mr.test(t)&&!vmr.test(t)&&!wmr.test(t),xmr=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 xot=w(()=>{Sot()});var Cot,Oot=w(()=>{Cot=(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 Pot,Eot=w(()=>{Pot=async t=>{}});function Tot(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 Aot=w(()=>{});var TT,dZ=w(()=>{Aot();TT=t=>{if(typeof t=="string")return TT(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=Tot(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var fZ,pZ=w(()=>{dZ();fZ=t=>typeof t=="object"?"url"in t?TT(t.url):t:TT(t)});var Iot,Cmr,Z_e=w(()=>{xot();Oot();Eot();pZ();Iot=async(t,e,r,n)=>{if(!r.endpoint){let a=await Pot(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(fZ(a)))}let o=await Cmr(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},Cmr=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 Cot(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 wot(n),n}});var Mot=w(()=>{Z_e();pZ()});var Rot,X_e=w(()=>{jy();Z_e();Rot=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await Iot(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=A_(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 jot,Q_e=w(()=>{jot=(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 Not,eve=w(()=>{Not=(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 Nt(t,e,r){return{applyToStack:n=>{n.add(jot(t,r),Omr),n.add(Not(t,e),q3)}}}var Omr,q3,Dot=w(()=>{Q_e();eve();Omr={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},q3={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var to=w(()=>{Q_e();Dot();eve()});var tve,Dt,Lot=w(()=>{to();X_e();tve={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:q3.name},Dt=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Rot({config:t,instructions:e}),tve)}})});var mZ,Fot=w(()=>{jy();pZ();mZ=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>fZ(await zd(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:zd(t.useDualstackEndpoint??!1),useFipsEndpoint:zd(t.useFipsEndpoint??!1)}}});var kot=w(()=>{});var zn=w(()=>{Mot();X_e();Lot();Fot();kot()});var Pmr,hZ,$ot=w(()=>{zn();cZ();Pmr={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:tve.name},hZ=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Y_e(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Pmr)}})});var wXn,Bot=w(()=>{to();cZ();wXn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:q3.name}});var qot=w(()=>{cZ();$ot();Bot()});var Uot=w(()=>{});var zot=w(()=>{Uot()});var Hot=w(()=>{Hs()});var Vot=w(()=>{});var Wot=w(()=>{});function Emr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var P1,Kot=w(()=>{P1=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=Emr(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 Got=w(()=>{});var Jot=w(()=>{});var Yot=w(()=>{});var U3=w(()=>{zot();Hot();Vot();Wot();Kot();Got();Jot();Yot()});var Tmr,Amr,Zot,rve=w(()=>{U3();Hs();jy();Tmr=t=>e=>{throw e},Amr=(t,e)=>{},Zot=t=>(e,r)=>async n=>{if(!P1.isInstance(n.request))return e(n);let i=A_(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||Tmr)(a));return(u.successHandler||Amr)(l.response,a),l}});var Ny,I_,z3,gZ=w(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Ny||(Ny={}));I_=3,z3=Ny.STANDARD});var Xot,Qot,eit,tit,rit=w(()=>{Xot=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Qot=["TimeoutError","RequestTimeout","RequestTimeoutException"],eit=[500,502,503,504],tit=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var Imr,fk,yZ,nit,H3=w(()=>{rit();Imr=t=>t.$metadata?.clockSkewCorrected,fk=t=>t.$metadata?.httpStatusCode===429||Xot.includes(t.name)||t.$retryable?.throttling==!0,yZ=t=>Imr(t)||Qot.includes(t.name)||tit.includes(t?.code||"")||eit.includes(t.$metadata?.httpStatusCode||0),nit=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!yZ(t)}return!1}});var V3,nve=w(()=>{H3();V3=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(),fk(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 bZ,_Z,pk=w(()=>{bZ="amz-sdk-invocation-id",_Z="amz-sdk-request"});var oit,iit=w(()=>{pk();oit=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var ove,ait=w(()=>{pk();ove=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var E1,wZ=w(()=>{gZ();pk();iit();ait();E1=class{constructor(e){this.maxAttempts=e,this.mode=Ny.STANDARD,this.capacity=500,this.retryBackoffStrategy=oit(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return ove({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,ove({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 ${I_}`),I_}}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 SZ,dit=w(()=>{gZ();nve();wZ();SZ=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Ny.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new V3,this.standardRetryStrategy=new E1(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 fit=w(()=>{pk();wZ()});var pit=w(()=>{});var M_=w(()=>{dit();fit();nve();wZ();gZ();pk();pit()});var mit=w(()=>{});var hit=w(()=>{mit()});var git=w(()=>{Hs()});var yit=w(()=>{});var bit=w(()=>{});function Mmr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var hk,_it=w(()=>{hk=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=Mmr(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 W3,vit=w(()=>{W3=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 wit=w(()=>{});var Sit=w(()=>{});var xZ=w(()=>{hit();git();yit();bit();_it();vit();wit();Sit()});var xit=w(()=>{M_()});var ave=w(()=>{M_()});var sve=w(()=>{H3()});var uve,lve=w(()=>{uve=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 cve=w(()=>{xZ();H3();M_();xit();ave();sve();lve()});var Cit=w(()=>{M_();cve()});var CZ,Oit=w(()=>{jy();M_();CZ=t=>{let{retryStrategy:e}=t,r=zd(t.maxAttempts??I_);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await zd(t.retryMode)()===Ny.ADAPTIVE?new SZ(r):new E1(r))}}});var Pit=w(()=>{xZ();M_()});var AT,Eit=w(()=>{AT=class{trace(){}debug(){}info(){}warn(){}error(){}}});var T1,IT,gk,Tit,Ait,Iit=w(()=>{T1=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},IT=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,gk=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>Tit[p.step]-Tit[f.step]||Ait[p.priority||"normal"]-Ait[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=T1(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 T1(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 T1(g.name,g.aliases))m[y]=g;f.push(g)}),e.forEach(b=>{let g={...b,before:[],after:[]};for(let y of T1(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 ${IT(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=T1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=t.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=t[S];if(x.step!==b.step||b.priority!==x.priority)throw new Error(`"${IT(x.name,x.aliases)}" middleware with ${x.priority} priority in ${x.step} step cannot be overridden by "${IT(p,h)}" middleware with ${b.priority} priority in ${b.step} step.`);t.splice(S,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=T1(p,h);if(g.length>0){if(g.some(y=>n.has(y))){if(!m)throw new Error(`Duplicate middleware name '${IT(p,h)}'`);for(let y of g){let S=e.findIndex(O=>O.name===y||O.aliases?.some(P=>P===y));if(S===-1)continue;let x=e[S];if(x.toMiddleware!==b.toMiddleware||x.relation!==b.relation)throw new Error(`"${IT(x.name,x.aliases)}" middleware ${x.relation} "${x.toMiddleware}" middleware cannot be overridden by "${IT(p,h)}" middleware ${b.relation} "${b.toMiddleware}" middleware.`);e.splice(S,1)}}for(let y of g)n.add(y)}e.push(b)},clone:()=>s(gk()),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=T1(b,g);for(let S of y)n.delete(S);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(gk());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 IT(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},Tit={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Ait={high:3,normal:2,low:1}});var dve=w(()=>{Iit()});var A1,Mit=w(()=>{dve();A1=class{constructor(e){this.middlewareStack=gk(),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 lO,I1,MT,M1,Rit,fve=w(()=>{lO={},I1=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);lO[n]=t,I1[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;lO[n]=o,I1[o]=n}for(let t=0;t<10;t++){lO[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;lO[e]=r,I1[r]=e}lO["+"]=62;I1[62]="+";lO["/"]=63;I1[63]="/";MT=6,M1=8,Rit=63});var RT,jit=w(()=>{fve();RT=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 lO))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=lO[t[l]]<<(c-l)*MT,a+=MT}else i>>=MT;let s=o/4*3;i>>=a%M1;let u=Math.floor(a/M1);for(let l=0;l<u;l++){let c=(u-l-1)*M1;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var pve,mve=w(()=>{pve=t=>new TextEncoder().encode(t)});var Nit=w(()=>{mve()});var Dit=w(()=>{});var Lit=w(()=>{mve();Nit();Dit()});function jT(t){let e;typeof t=="string"?e=pve(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)*M1,s+=M1;let u=Math.ceil(s/MT);a<<=u*MT-s;for(let l=1;l<=u;l++){let c=(u-l)*MT;o+=I1[(a&Rit<<c)>>c]}o+="==".slice(0,4-u)}return o}var Fit=w(()=>{Lit();fve()});var yk=w(()=>{jit();Fit()});var hve,gve=w(()=>{hve=t=>new TextEncoder().encode(t)});var kit=w(()=>{gve()});var OZ,$it=w(()=>{OZ=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 yve=w(()=>{gve();kit();$it()});function Bit(t,e="utf-8"){return e==="base64"?jT(t):OZ(t)}function qit(t,e){return e==="base64"?cO.mutate(RT(t)):cO.mutate(hve(t))}var Uit=w(()=>{yk();yve();bve()});var cO,bve=w(()=>{Uit();cO=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return qit(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 Bit(this,e)}}});var zit=w(()=>{});var Hit=w(()=>{});var Vit=w(()=>{Hit()});var Wit=w(()=>{Hs()});var Kit=w(()=>{});var Git=w(()=>{});var Jit=w(()=>{});var K3,Yit=w(()=>{K3=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 Zit=w(()=>{});var Xit=w(()=>{});var Qit=w(()=>{Vit();Wit();Kit();Git();Jit();Yit();Zit();Xit()});var Yh,Rmr,_ve=w(()=>{Yh=t=>encodeURIComponent(t).replace(/[!'()*]/g,Rmr),Rmr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var eat=w(()=>{_ve()});var PZ=w(()=>{_ve();eat()});function tat(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=Yh(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${Yh(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${Yh(n)}`),e.push(o)}}return e.join("&")}var rat=w(()=>{PZ()});function nat(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 oat=w(()=>{});var vve,NT,iat=w(()=>{Qit();rat();oat();vve={supported:void 0},NT=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)),vve.supported===void 0&&(vve.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=tat(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),vve.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),b=[fetch(h).then(g=>{let y=g.headers,S={};for(let O of y.entries())S[O[0]]=O[1];return g.body!=null?{response:new K3({headers:S,reason:g.statusText,statusCode:g.status,body:g.body})}:g.blob().then(O=>({response:new K3({headers:S,reason:g.statusText,statusCode:g.status,body:O})}))}),nat(n)];return r&&b.push(new Promise((g,y)=>{let S=()=>{let x=new Error("Request aborted");x.name="AbortError",y(x)};if(typeof r.addEventListener=="function"){let x=r;x.addEventListener("abort",S,{once:!0}),m=()=>x.removeEventListener("abort",S)}else r.onabort=S})),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 jmr(t){let e=await Dmr(t),r=RT(e);return new Uint8Array(r)}async function Nmr(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 Dmr(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 bk,aat=w(()=>{yk();bk=t=>typeof Blob=="function"&&t instanceof Blob?jmr(t):Nmr(t)});var G3=w(()=>{iat();aat()});function uat(t){let e="";for(let r=0;r<t.byteLength;r++)e+=sat[t[r]];return e}var sat,Lmr,lat=w(()=>{sat={},Lmr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),sat[t]=e,Lmr[e]=t}});var wve,Sve=w(()=>{wve=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var cat,fat,dat,pat=w(()=>{G3();yk();lat();yve();Sve();cat="The stream has already been transformed.",fat=t=>{if(!dat(t)&&!wve(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(cat);return e=!0,await bk(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 jT(i);if(o==="hex")return uat(i);if(o===void 0||o==="utf8"||o==="utf-8")return OZ(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(cat);if(e=!0,dat(t))return n(t);if(wve(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},dat=t=>typeof Blob=="function"&&t instanceof Blob});var mat=w(()=>{});var hat=w(()=>{});var xve=w(()=>{bve();zit();pat();mat();hat();Sve()});var DT,gat=w(()=>{xve();DT=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return cO.mutate(t);if(!t)return cO.mutate(new Uint8Array);let r=e.streamCollector(t);return cO.mutate(await r)}});var Ot,Cve,yat=w(()=>{dve();Hs();Ot=class{constructor(){this.middlewareStack=gk()}static classBuilder(){return new Cve}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,[ck]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(b=>h.handle(b.request,n||{}),m)}},Cve=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 Ot{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 EZ,bat=w(()=>{EZ="***SensitiveInformation***"});var TZ,_at=w(()=>{TZ=(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 R1,Fmr,vat,kmr,wat,Sat,xat,Ove,$mr,_k,ln,Cat,Oat,Bmr,J3,Y3,Pve,Pat,Eat,Tat,Eve=w(()=>{R1=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Tat.warn(Eat(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Fmr=Math.ceil(34028234663852886e22),vat=t=>{let e=R1(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Fmr)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},kmr=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},wat=t=>Ove(t,32),Sat=t=>Ove(t,16),xat=t=>Ove(t,8),Ove=(t,e)=>{let r=kmr(t);if(r!==void 0&&$mr(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},$mr=(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]}},_k=(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},ln=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Tat.warn(Eat(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},Cat=t=>R1(typeof t=="string"?J3(t):t),Oat=t=>vat(typeof t=="string"?J3(t):t),Bmr=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,J3=t=>{let e=t.match(Bmr);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Y3=t=>wat(typeof t=="string"?J3(t):t),Pve=t=>Sat(typeof t=="string"?J3(t):t),Pat=t=>xat(typeof t=="string"?J3(t):t),Eat=t=>String(new TypeError(t).stack||t).split(`
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
`),Tat={warn:console.warn}});var qmr,Umr,Aat,zmr,Iat,hro,gro,yro,AZ,Mat,bro,Hmr,Vmr,Wmr,j1,Kmr,Gmr,Tve,Rat=w(()=>{Eve();qmr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Umr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Aat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Umr.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=Pve(Tve(n)),d=j1(o,"month",1,12),f=j1(i,"day",1,31);return Mat(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},zmr=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Iat=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=zmr.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=Pve(Tve(n)),f=j1(o,"month",1,12),p=j1(i,"day",1,31),m=Mat(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-Gmr(c)),m},hro=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$/),gro=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$/),yro=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})$/),AZ=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Cat(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))},Mat=(t,e,r,n)=>{let o=e-1;return Vmr(t,o,r),new Date(Date.UTC(t,o,r,j1(n.hours,"hour",0,23),j1(n.minutes,"minute",0,59),j1(n.seconds,"seconds",0,60),Kmr(n.fractionalMilliseconds)))},bro=50*365*24*60*60*1e3,Hmr=[31,28,31,30,31,30,31,31,30,31,30,31],Vmr=(t,e,r)=>{let n=Hmr[e];if(e===1&&Wmr(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${qmr[e]} in ${t}: ${r}`)},Wmr=t=>t%4===0&&(t%100!==0||t%400===0),j1=(t,e,r,n)=>{let o=Pat(Tve(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},Kmr=t=>t==null?0:Oat("0."+t)*1e3,Gmr=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},Tve=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var vk,qa,Ave=w(()=>{vk=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 Jmr,IZ,Ymr,jat=w(()=>{Ave();Jmr=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=Ymr(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)},IZ=t=>({output:e,parsedBody:r,errorCode:n})=>{Jmr({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},Ymr=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 MZ,Nat=w(()=>{MZ=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 Dat=w(()=>{});var Lat,Fat,kat=w(()=>{Hs();Lat=t=>{let e=[];for(let r in lk){let n=lk[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}}},Fat=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var $at,Bat,qat=w(()=>{$at=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Bat=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var RZ,jZ,Uat=w(()=>{kat();qat();RZ=t=>({...Lat(t),...$at(t)}),jZ=t=>({...Fat(t),...Bat(t)})});var zat=w(()=>{Uat()});function NZ(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Ive=w(()=>{});var Hat=w(()=>{});var Mve,Vat=w(()=>{Mve=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]=Mve(t[r]));return t}});var Rve,Wat=w(()=>{Rve=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};Rve.prototype=Object.create(String.prototype,{constructor:{value:Rve,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(Rve,String)});var Z3,Zmr,Xmr,Qmr,Kat=w(()=>{Z3=(t,e)=>{let r={};for(let n in e)Zmr(r,t,e,n);return r},Zmr=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=Xmr,u=Qmr,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)}},Xmr=t=>t!=null,Qmr=t=>t});var Gat=w(()=>{Ive()});var Jat=w(()=>{});var or,Yat=w(()=>{or=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(or);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=or(t[r]));return e}return t}});var Zat=w(()=>{});var ar=w(()=>{Eit();Mit();gat();yat();bat();_at();Rat();jat();Nat();Dat();zat();Ave();Ive();Hat();Vat();Wat();Kat();Eve();Gat();Jat();Yat();Zat()});var Xat,Qat=w(()=>{Xat=t=>t?.body instanceof ReadableStream});var ehr,thr,rhr,nhr,jve,DZ,ohr,est=w(()=>{xZ();H3();ar();M_();l2();Qat();lve();ehr=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(thr(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=hk.isInstance(c);for(d&&(c.headers[bZ]=yC());;)try{d&&(c.headers[_Z]=`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=rhr(f);if(s=uve(f),d&&Xat(c))throw(r.logger instanceof AT?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)},thr=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",rhr=t=>{let e={error:t,errorType:nhr(t)},r=ohr(t.$response);return r&&(e.retryAfterHint=r),e},nhr=t=>fk(t)?"THROTTLING":yZ(t)?"TRANSIENT":nit(t)?"SERVER_ERROR":"CLIENT_ERROR",jve={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},DZ=t=>({applyToStack:e=>{e.add(ehr(t),jve)}}),ohr=t=>{if(!W3.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 LZ=w(()=>{Cit();cve();Oit();ave();Pit();sve();est()});var ihr,FZ,tst=w(()=>{LZ();rve();ihr={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:jve.name},FZ=t=>({applyToStack:e=>{e.addRelativeTo(Zot(t),ihr)}})});var rst=w(()=>{rve();tst()});var wk,nst=w(()=>{wk=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 ost=w(()=>{U3();Hs()});var ist=w(()=>{U3()});var Sk,ast=w(()=>{Sk=class{async sign(e,r,n){return e}}});var sst=w(()=>{ost();ist();ast()});var ahr,ust,Nve,lst,cst=w(()=>{ahr=t=>e=>Nve(e)&&e.expiration.getTime()-Date.now()<t,ust=ahr(3e5),Nve=t=>t.expiration!==void 0,lst=(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 dst=w(()=>{nst();sst();cst()});var fst=w(()=>{Hs()});var xk,pst=w(()=>{xk=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var mst=w(()=>{U3();ar()});function Dve(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 shr(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=uhr(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var shr,uhr,hst=w(()=>{shr=async(t,e,r,...n)=>await e.send(new t(r),...n);uhr=(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 LT=w(()=>{qot();rst();dst();fst();pst();mst();hst()});var gst=w(()=>{});var yst=w(()=>{gst()});var bst=w(()=>{Hs()});var _st=w(()=>{});var vst=w(()=>{});function lhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var kZ,wst=w(()=>{kZ=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=lhr(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 Sst=w(()=>{});var xst=w(()=>{});var Cst=w(()=>{});var Ost=w(()=>{yst();bst();_st();vst();wst();Sst();xst();Cst()});function chr(t){return e=>async r=>{let n=r.request;if(kZ.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(Pst)===-1)try{let a=t(o);n.headers={...n.headers,[Pst]:String(a)}}catch{}}return e({...r,request:n})}}var Pst,dhr,$Z,Lve=w(()=>{Ost();Pst="content-length";dhr={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},$Z=t=>({applyToStack:e=>{e.add(chr(t.bodyLengthChecker),dhr)}})});var Est=w(()=>{});var Tst=w(()=>{Est()});var Ast=w(()=>{});var Ist=w(()=>{Ast()});var Mst=w(()=>{Hs()});var Rst=w(()=>{});var jst=w(()=>{});function fhr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var FT,Nst=w(()=>{FT=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=fhr(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 BZ,Dst=w(()=>{BZ=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 Lst=w(()=>{});var Fst=w(()=>{});var X3=w(()=>{Ist();Mst();Rst();jst();Nst();Dst();Lst();Fst()});var Fve,kst=w(()=>{X3();Fve=t=>BZ.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var qZ,kve=w(()=>{qZ=t=>new Date(Date.now()+t)});var $st,Bst=w(()=>{kve();$st=(t,e)=>Math.abs(qZ(e).getTime()-t)>=3e5});var $ve,qst=w(()=>{Bst();$ve=(t,e)=>{let r=Date.parse(t);return $st(r,e)?r-Date.now():e}});var Ust=w(()=>{kst();kve();qst()});var Q3,zst,N1,Hst=w(()=>{X3();Ust();Q3=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},zst=async t=>{let e=Q3("context",t.context),r=Q3("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await Q3("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},N1=class{async sign(e,r,n){if(!FT.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await zst(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:qZ(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??Fve(r.$response);if(n){let o=Q3("config",e.config),i=o.systemClockOffset;o.systemClockOffset=$ve(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=Fve(e);if(n){let o=Q3("config",r.config);o.systemClockOffset=$ve(n,o.systemClockOffset)}}}});var Vst=w(()=>{LT();aO()});function Kst(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 Bve)e[r/2]=Bve[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Dy(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Wst[t[r]];return e}var Wst,Bve,eH=w(()=>{Wst={},Bve={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Wst[t]=e,Bve[e]=t}});var tH,qve=w(()=>{tH=t=>new TextEncoder().encode(t)});var kT,Gst=w(()=>{qve();kT=t=>typeof t=="string"?tH(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var Jst=w(()=>{});var rH=w(()=>{qve();Gst();Jst()});var Yst,Zst,Uve,Xst,Qst,zve,Hve,Vve,Wve,phr,eut,tut,nH,rut,nut,out,iut,UZ,aut,sut,uut,Kve,lut,D1=w(()=>{Yst="X-Amz-Algorithm",Zst="X-Amz-Credential",Uve="X-Amz-Date",Xst="X-Amz-SignedHeaders",Qst="X-Amz-Expires",zve="X-Amz-Signature",Hve="X-Amz-Security-Token",Vve="authorization",Wve=Uve.toLowerCase(),phr="date",eut=[Vve,Wve,phr],tut=zve.toLowerCase(),nH="x-amz-content-sha256",rut=Hve.toLowerCase(),nut={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},out=/^proxy-/,iut=/^sec-/,UZ="AWS4-HMAC-SHA256",aut="AWS4-HMAC-SHA256-PAYLOAD",sut="UNSIGNED-PAYLOAD",uut=50,Kve="aws4_request",lut=60*60*24*7});var zZ,Gve,HZ,dut,cut,Jve=w(()=>{eH();rH();D1();zZ={},Gve=[],HZ=(t,e,r)=>`${t}/${e}/${r}/${Kve}`,dut=async(t,e,r,n,o)=>{let i=await cut(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${Dy(i)}:${e.sessionToken}`;if(a in zZ)return zZ[a];for(Gve.push(a);Gve.length>uut;)delete zZ[Gve.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,Kve])s=await cut(t,s,u);return zZ[a]=s},cut=(t,e,r)=>{let n=new t(e);return n.update(kT(r)),n.digest()}});var VZ,Yve=w(()=>{D1();VZ=({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 nut||e?.has(i)||out.test(i)||iut.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var Zve,Xve=w(()=>{PZ();D1();Zve=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===tut)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${Yh(n)}=${Yh(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${Yh(n)}=${Yh(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var fut,put=w(()=>{fut=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var oH,Qve=w(()=>{put();eH();rH();D1();oH=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===nH)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||fut(e)){let n=new r;return n.update(kT(e)),Dy(await n.digest())}return sut}});function hut(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var WZ,mut,mhr,ewe,gut=w(()=>{eH();rH();WZ=class{format(e){let r=[];for(let i of Object.keys(e)){let a=tH(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=tH(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(ewe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!mhr.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(Kst(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"})(mut||(mut={}));mhr=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,ewe=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&&hut(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&hut(e),parseInt(Dy(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var yut,but=w(()=>{yut=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var twe,rwe=w(()=>{X3();twe=(t,e={})=>{let{headers:r,query:n={}}=FT.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 KZ,nwe=w(()=>{X3();D1();KZ=t=>{t=FT.clone(t);for(let e of Object.keys(t.headers))eut.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var _ut,hhr,vut=w(()=>{_ut=t=>hhr(t).toISOString().replace(/\.\d{3}Z$/,"Z"),hhr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var iH,GZ,wut,Sut=w(()=>{eH();jy();PZ();rH();D1();Jve();Yve();Xve();Qve();gut();but();rwe();nwe();vut();iH=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new WZ,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=zd(n),this.credentialProvider=zd(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}=GZ(n);if(o>lut)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=HZ(p,d,l??this.service),h=twe(KZ(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Hve]=c.sessionToken),h.query[Yst]=UZ,h.query[Zst]=`${c.accessKeyId}/${m}`,h.query[Uve]=f,h.query[Qst]=o.toString(10);let b=VZ(h,i,s);return h.query[Xst]=wut(b),h.query[zve]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await oH(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}=GZ(n),c=HZ(u,s,a??this.service),d=await oH({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=Dy(await f.digest()),m=[aut,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}=GZ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(kT(e)),Dy(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=KZ(e),{longDate:c,shortDate:d}=GZ(r),f=HZ(d,u,a??this.service);l.headers[Wve]=c,s.sessionToken&&(l.headers[rut]=s.sessionToken);let p=await oH(l,this.sha256);!yut(nH,l.headers)&&this.applyChecksum&&(l.headers[nH]=p);let m=VZ(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Vve]=`${UZ} Credential=${s.accessKeyId}/${f}, SignedHeaders=${wut(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${Zve(e)}
${o.map(i=>`${i}:${r[i]}`).join(`
`)}
${o.join(";")}
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(kT(n));let i=await o.digest();return`${UZ}
${e}
${r}
${Dy(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 Yh(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(kT(i)),Dy(await a.digest())}getSigningKey(e,r,n,o){return dut(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")}},GZ=t=>{let e=_ut(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},wut=t=>Object.keys(t).sort().join(";")});var xut=w(()=>{Sut();Yve();Xve();Qve();rwe();nwe();Jve()});var JZ,Cut=w(()=>{LT();xut();JZ=t=>{let e;t.credentials&&(e=lst(t.credentials,ust,Nve)),e||(t.credentialDefaultProvider?e=xk(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=xk(t.signer):t.regionInfoProvider?i=()=>xk(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||iH;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await xk(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||iH;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var Out=w(()=>{Hst();Vst();Cut()});var Put=w(()=>{Out()});var Eut=w(()=>{});var Tut=w(()=>{ar()});var YZ,owe=w(()=>{ar();YZ=(t,e)=>DT(t,e).then(r=>e.utf8Encoder(r))});var Is,Aut,Iut,Mut=w(()=>{owe();Is=(t,e)=>YZ(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{}}),Aut=async(t,e)=>{let r=await Is(t,e);return r.message=r.message??r.Message,r},Iut=(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 ZZ=v(dO=>{"use strict";var Rut=":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",ghr=Rut+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",jut="["+Rut+"]["+ghr+"]*",yhr=new RegExp("^"+jut+"$"),bhr=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},_hr=function(t){let e=yhr.exec(t);return!(e===null||typeof e>"u")};dO.isExist=function(t){return typeof t<"u"};dO.isEmptyObject=function(t){return Object.keys(t).length===0};dO.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]]}};dO.getValue=function(t){return dO.isExist(t)?t:""};dO.isName=_hr;dO.getAllMatches=bhr;dO.nameRegexp=jut});var awe=v(kut=>{"use strict";var iwe=ZZ(),vhr={allowBooleanAttributes:!1,unpairedTags:[]};kut.validate=function(t,e){e=Object.assign({},vhr,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=Dut(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=Lut(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--),!Thr(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Ms("InvalidTag",d,zf(t,i))}let l=xhr(t,i);if(l===!1)return Ms("InvalidAttr","Attributes for '"+u+"' have open quote.",zf(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=Fut(c,e);if(f===!0)n=!0;else return Ms(f.err.code,f.err.msg,zf(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Ms("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",zf(t,a));if(r.length===0)return Ms("InvalidTag","Closing tag '"+u+"' has not been opened.",zf(t,a));{let d=r.pop();if(u!==d.tagName){let f=zf(t,d.tagStartPos);return Ms("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",zf(t,a))}r.length==0&&(o=!0)}}else return Ms("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",zf(t,i));else{let d=Fut(c,e);if(d!==!0)return Ms(d.err.code,d.err.msg,zf(t,i-c.length+d.err.line));if(o===!0)return Ms("InvalidXml","Multiple possible root nodes found.",zf(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=Lut(t,i);continue}else if(t[i+1]==="?"){if(i=Dut(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=Phr(t,i);if(d==-1)return Ms("InvalidChar","char '&' is not expected.",zf(t,i));i=d}else if(o===!0&&!Nut(t[i]))return Ms("InvalidXml","Extra text at the end",zf(t,i));t[i]==="<"&&i--}}else{if(Nut(t[i]))continue;return Ms("InvalidChar","char '"+t[i]+"' is not expected.",zf(t,i))}if(n){if(r.length==1)return Ms("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",zf(t,r[0].tagStartPos));if(r.length>0)return Ms("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ms("InvalidXml","Start tag expected.",1);return!0};function Nut(t){return t===" "||t===" "||t===`
`||t==="\r"}function Dut(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 Ms("InvalidXml","XML declaration allowed only at the start of the document.",zf(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function Lut(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 whr='"',Shr="'";function xhr(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===whr||t[e]===Shr)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 Chr=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Fut(t,e){let r=iwe.getAllMatches(t,Chr),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return Ms("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",aH(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return Ms("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",aH(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return Ms("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",aH(r[o]));let i=r[o][2];if(!Ehr(i))return Ms("InvalidAttr","Attribute '"+i+"' is an invalid name.",aH(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return Ms("InvalidAttr","Attribute '"+i+"' is repeated.",aH(r[o]))}return!0}function Ohr(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 Phr(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Ohr(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 Ms(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function Ehr(t){return iwe.isName(t)}function Thr(t){return iwe.isName(t)}function zf(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function aH(t){return t.startIndex+t[1].length}});var But=v(swe=>{var $ut={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}},Ahr=function(t){return Object.assign({},$ut,t)};swe.buildOptions=Ahr;swe.defaultOptions=$ut});var Uut=v((Uao,qut)=>{"use strict";var uwe=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})}};qut.exports=uwe});var Hut=v((zao,zut)=>{var Ihr=ZZ();function Mhr(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&&Nhr(t,e))e+=7,[entityName,val,e]=Rhr(t,e+1),val.indexOf("&")===-1&&(r[khr(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&Dhr(t,e))e+=8;else if(o&&Lhr(t,e))e+=8;else if(o&&Fhr(t,e))e+=9;else if(jhr)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 Rhr(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 jhr(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Nhr(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 Dhr(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 Lhr(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 Fhr(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 khr(t){if(Ihr.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}zut.exports=Mhr});var Wut=v((Hao,Vut)=>{var $hr=/^[-+]?0x[a-fA-F0-9]+$/,Bhr=/^([\-\+])?(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 qhr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Uhr(t,e={}){if(e=Object.assign({},qhr,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&&$hr.test(r))return Number.parseInt(r,16);{let n=Bhr.exec(r);if(n){let o=n[1],i=n[2],a=zhr(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 zhr(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}Vut.exports=Uhr});var Jut=v((Vao,Gut)=>{"use strict";var Kut=ZZ(),sH=Uut(),Hhr=Hut(),Vhr=Wut(),lwe=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=Whr,this.parseXml=Zhr,this.parseTextData=Khr,this.resolveNameSpace=Ghr,this.buildAttributesMap=Yhr,this.isItStopNode=tgr,this.replaceEntitiesValue=Qhr,this.readStopNodeData=ngr,this.saveTextToParentTag=egr,this.addChild=Xhr}};function Whr(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 Khr(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?dwe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?dwe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Ghr(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 Jhr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Yhr(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=Kut.getAllMatches(t,Jhr),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]=dwe(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 Zhr=function(t){t=t.replace(/\r\n?/g,`
`);let e=new sH("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=L1(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=cwe(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 sH(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=L1(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=Hhr(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=L1(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=cwe(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 sH(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 sH(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 sH(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 Xhr(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var Qhr=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 egr(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 tgr(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 rgr(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 L1(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function cwe(t,e,r,n=">"){let o=rgr(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 ngr(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=L1(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=L1(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=L1(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=L1(t,"]]>",r,"StopNode is not closed.")-2;else{let i=cwe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function dwe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Vhr(t,r)}else return Kut.isExist(t)?t:""}Gut.exports=lwe});var Xut=v(Zut=>{"use strict";function ogr(t,e){return Yut(t,e)}function Yut(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=igr(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=Yut(a[s],e,u),c=sgr(l,e);a[":@"]?agr(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 igr(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function agr(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 sgr(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))}Zut.prettify=ogr});var elt=v((Kao,Qut)=>{var{buildOptions:ugr}=But(),lgr=Jut(),{prettify:cgr}=Xut(),dgr=awe(),fwe=class{constructor(e){this.externalEntities={},this.options=ugr(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=dgr.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new lgr(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:cgr(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};Qut.exports=fwe});var ilt=v((Gao,olt)=>{var fgr=`
`;function pgr(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=fgr),rlt(t,e,"",r)}function rlt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=mgr(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];hgr(l,e)||(m=e.tagValueProcessor(u,m),m=nlt(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=tlt(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=tlt(s[":@"],e),f=n+`<${u}${d}`,p=rlt(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 mgr(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 tlt(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=nlt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function hgr(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 nlt(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}olt.exports=pgr});var slt=v((Jao,alt)=>{"use strict";var ggr=ilt(),ygr={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function $T(t){this.options=Object.assign({},ygr,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=vgr),this.processTextOrObjNode=bgr,this.options.format?(this.indentate=_gr,this.tagEndChar=`>
`,this.newLine=`
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}$T.prototype.build=function(t){return this.options.preserveOrder?ggr(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};$T.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}};$T.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 bgr(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)}$T.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}};$T.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};$T.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}};$T.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 _gr(t){return this.options.indentBy.repeat(t)}function vgr(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}alt.exports=$T});var llt=v((Yao,ult)=>{"use strict";var wgr=awe(),Sgr=elt(),xgr=slt();ult.exports={XMLParser:Sgr,XMLValidator:wgr,XMLBuilder:xgr}});var clt,R_,dlt,flt=w(()=>{ar();clt=F(llt());owe();R_=(t,e)=>YZ(t,e).then(r=>{if(r.length){let n=new clt.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]),Mve(s)}return{}}),dlt=async(t,e)=>{let r=await R_(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var plt=w(()=>{Eut();Tut();Mut();flt()});var F1=w(()=>{Tst();Put();plt()});function Cgr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function XZ(t){return{schemeId:"smithy.api#noAuth"}}var mlt,hlt,glt,pwe=w(()=>{F1();jy();mlt=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});hlt=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(XZ(t));break}case"GetId":{e.push(XZ(t));break}case"GetOpenIdToken":{e.push(XZ(t));break}case"UnlinkIdentity":{e.push(XZ(t));break}default:e.push(Cgr(t))}return e},glt=t=>({...JZ(t)})});var ylt,Cr,ua=w(()=>{ylt=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Cr={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var _lt,blt=w(()=>{_lt={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 mwe,hwe,vlt,wlt=w(()=>{mwe={name:"SHA-256"},hwe={name:"HMAC",hash:mwe},vlt=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 Ck(){return typeof window<"u"?window:typeof self<"u"?self:Pgr}var Pgr,gwe=w(()=>{Pgr={}});var Ok,ywe,bwe=w(()=>{Ok=F(LY());wlt();gwe();ywe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,Ok.isEmptyData)(e)){var r=(0,Ok.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 Ck().crypto.subtle.sign(hwe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,Ok.isEmptyData)(this.toHash)?Promise.resolve(vlt):Promise.resolve().then(function(){return Ck().crypto.subtle.digest(mwe,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){Ck().crypto.subtle.importKey("raw",(0,Ok.convertToBuffer)(e.secret),hwe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function Slt(t){if(Tgr(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return Agr(e)}return!1}function Tgr(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function Agr(t){return t&&Egr.every(function(e){return typeof t[e]=="function"})}var Egr,xlt=w(()=>{Egr=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Clt=w(()=>{xlt()});var Olt,Plt,QZ,Elt=w(()=>{bwe();Olt=F(x_e());Clt();gwe();Plt=F(LY()),QZ=function(){function t(e){Slt(Ck())?this.hash=new ywe(e):this.hash=new Olt.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Plt.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var _we=w(()=>{Elt();bwe()});var wwe=v((uH,vwe)=>{(function(t,e){typeof uH=="object"&&typeof vwe=="object"?vwe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof uH=="object"?uH.bowser=e():t.bowser=e()})(uH,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),S=s.default.find(y,function(I){return p.isOS(I)});if(S){var x=this.satisfies(m[S]);if(x!==void 0)return x}var O=s.default.find(y,function(I){return p.isPlatform(I)});if(O){var P=this.satisfies(m[O]);if(P!==void 0)return P}}if(g>0){var E=Object.keys(b),A=s.default.find(E,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 Tlt,eX,Swe=w(()=>{Tlt=F(wwe()),eX=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?Tlt.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 Alt=w(()=>{});var tX,Ilt=w(()=>{tX=t=>()=>Promise.reject(t)});var xwe=w(()=>{Alt();Ilt()});var Mlt,rX,Rlt=w(()=>{Mlt=typeof TextEncoder=="function"?new TextEncoder:null,rX=t=>{if(typeof t=="string"){if(Mlt)return Mlt.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 Cwe=w(()=>{Rlt()});var Owe,Pwe=w(()=>{Owe=t=>new TextEncoder().encode(t)});var jlt=w(()=>{Pwe()});var Nlt,Dlt=w(()=>{Nlt=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 Llt=w(()=>{Pwe();jlt();Dlt()});var Wlt,N_,D_,Ek,Flt,cH,Pk,lH,fO,Ewe,klt,$lt,Blt,Klt,Glt,j_,qlt,Ult,zlt,Hlt,Vlt,Igr,Jlt,Ylt=w(()=>{Wlt="required",N_="fn",D_="argv",Ek="ref",Flt="isSet",cH="booleanEquals",Pk="error",lH="endpoint",fO="tree",Ewe="PartitionResult",klt={[Wlt]:!1,type:"String"},$lt={[Wlt]:!0,default:!1,type:"Boolean"},Blt={[Ek]:"Endpoint"},Klt={[N_]:cH,[D_]:[{[Ek]:"UseFIPS"},!0]},Glt={[N_]:cH,[D_]:[{[Ek]:"UseDualStack"},!0]},j_={},qlt={[N_]:"getAttr",[D_]:[{[Ek]:Ewe},"supportsFIPS"]},Ult={[N_]:cH,[D_]:[!0,{[N_]:"getAttr",[D_]:[{[Ek]:Ewe},"supportsDualStack"]}]},zlt=[Klt],Hlt=[Glt],Vlt=[{[Ek]:"Region"}],Igr={version:"1.0",parameters:{Region:klt,UseDualStack:$lt,UseFIPS:$lt,Endpoint:klt},rules:[{conditions:[{[N_]:Flt,[D_]:[Blt]}],rules:[{conditions:zlt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Pk},{conditions:Hlt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Pk},{endpoint:{url:Blt,properties:j_,headers:j_},type:lH}],type:fO},{conditions:[{[N_]:Flt,[D_]:Vlt}],rules:[{conditions:[{[N_]:"aws.partition",[D_]:Vlt,assign:Ewe}],rules:[{conditions:[Klt,Glt],rules:[{conditions:[{[N_]:cH,[D_]:[!0,qlt]},Ult],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Pk}],type:fO},{conditions:zlt,rules:[{conditions:[{[N_]:cH,[D_]:[qlt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"FIPS is enabled but this partition does not support FIPS",type:Pk}],type:fO},{conditions:Hlt,rules:[{conditions:[Ult],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO},{error:"DualStack is enabled but this partition does not support DualStack",type:Pk}],type:fO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:j_,headers:j_},type:lH}],type:fO}],type:fO},{error:"Invalid Configuration: Missing Region",type:Pk}]},Jlt=Igr});var Zlt,Xlt=w(()=>{eZ();ET();Ylt();Zlt=(t,e={})=>k3(Jlt,{endpointParams:t,logger:e.logger});sO.aws=$3});var Qlt,ect=w(()=>{F1();LT();ar();dZ();yk();Llt();pwe();Xlt();Qlt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Zlt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??hlt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new N1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Sk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??Owe,utf8Encoder:t?.utf8Encoder??Nlt})});var tct,rct=w(()=>{tct=["in-region","cross-region","mobile","standard","legacy"]});var nct,nX,Mgr,oct=w(()=>{aO();nct=F(wwe());rct();nX=({defaultsMode:t}={})=>ett(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(Mgr()?"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 ${tct.join(", ")}, got ${e}`)}}),Mgr=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?nct.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var Twe=w(()=>{oct()});var ict,act=w(()=>{blt();_we();Swe();B3();G3();xwe();Cwe();M_();ect();ar();Twe();ict=t=>{let e=nX(t),r=()=>e().then(MZ),n=Qlt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eX({serviceId:n.serviceId,clientVersion:_lt.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??tX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||z3),sha256:t?.sha256??QZ,streamCollector:t?.streamCollector??bk,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(aZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(sZ))}}});var oX,iX,sct=w(()=>{oX=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}}},iX=t=>({region:t.region()})});var uct=w(()=>{});var Awe=w(()=>{});var lct=w(()=>{Awe()});var cct=w(()=>{lct();Awe()});var dct=w(()=>{uct();cct()});var Iwe=w(()=>{sct();dct()});var fct,pct,mct=w(()=>{fct=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},pct=t=>({httpHandler:t.httpHandler()})});var hct=w(()=>{mct()});var gct=w(()=>{Hs()});var yct=w(()=>{});var bct=w(()=>{});function jgr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var aX,_ct=w(()=>{aX=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=jgr(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 vct=w(()=>{});var wct=w(()=>{});var Sct=w(()=>{});var Mwe=w(()=>{hct();gct();yct();bct();_ct();vct();wct();Sct()});var xct,Cct,Oct=w(()=>{xct=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}}},Cct=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var sX,Pct,Ect=w(()=>{Iwe();Mwe();ar();Oct();sX=t=>t,Pct=(t,e)=>{let r={...sX(oX(t)),...sX(RZ(t)),...sX(fct(t)),...sX(xct(t))};return e.forEach(n=>n.configure(r)),{...t,...iX(r),...jZ(r),...pct(r),...Cct(r)}}});var BT,uX=w(()=>{E_e();T_e();A_e();W_e();B3();LT();Lve();zn();LZ();ar();pwe();ua();act();Ect();BT=class extends A1{constructor(...[e]){let r=ict(e||{}),n=ylt(r),o=WY(n),i=CZ(o),a=lZ(i),s=a,u=mZ(s),l=glt(u),c=Pct(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(oZ(this.config)),this.middlewareStack.use(DZ(this.config)),this.middlewareStack.use($Z(this.config)),this.middlewareStack.use(UY(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(VY(this.config)),this.middlewareStack.use(hZ(this.config,{httpAuthSchemeParametersProvider:mlt,identityProviderConfigProvider:async d=>new wk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(FZ(this.config))}destroy(){super.destroy()}}});var Hd,Rwe=w(()=>{ar();Hd=class t extends vk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var lX,cX,dX,fX,pX,mX,hX,gX,yX,bX,_X,jwe=w(()=>{Rwe();lX=class t extends Hd{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},cX=class t extends Hd{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},dX=class t extends Hd{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},fX=class t extends Hd{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pX=class t extends Hd{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mX=class t extends Hd{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hX=class t extends Hd{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gX=class t extends Hd{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yX=class t extends Hd{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bX=class t extends Hd{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_X=class t extends Hd{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function Ha(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var Tct,Act,Ict,Mct,Rct,jct,Nct,Dct,Lct,Fct,kct,$ct,Bct,qct,Uct,zct,Hct,Vct,Wct,Kct,Gct,Jct,Yct,Zct,Xct,Qct,edt,tdt,rdt,ndt,odt,idt,adt,sdt,udt,ldt,cdt,ddt,fdt,pdt,mdt,hdt,gdt,ydt,bdt,_dt,Ua,Dgr,Lgr,Fgr,kgr,$gr,Bgr,qgr,Ugr,zgr,Hgr,Vgr,Wgr,Kgr,Ggr,vdt,Jgr,ro,Ygr,za,Oa=w(()=>{F1();Mwe();ar();Rwe();jwe();Tct=async(t,e)=>{let r=Ha("CreateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Act=async(t,e)=>{let r=Ha("DeleteIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Ict=async(t,e)=>{let r=Ha("DeleteIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Mct=async(t,e)=>{let r=Ha("DescribeIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Rct=async(t,e)=>{let r=Ha("DescribeIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},jct=async(t,e)=>{let r=Ha("GetCredentialsForIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Nct=async(t,e)=>{let r=Ha("GetId"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Dct=async(t,e)=>{let r=Ha("GetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Lct=async(t,e)=>{let r=Ha("GetOpenIdToken"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Fct=async(t,e)=>{let r=Ha("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},kct=async(t,e)=>{let r=Ha("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},$ct=async(t,e)=>{let r=Ha("ListIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Bct=async(t,e)=>{let r=Ha("ListIdentityPools"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},qct=async(t,e)=>{let r=Ha("ListTagsForResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Uct=async(t,e)=>{let r=Ha("LookupDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},zct=async(t,e)=>{let r=Ha("MergeDeveloperIdentities"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Hct=async(t,e)=>{let r=Ha("SetIdentityPoolRoles"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Vct=async(t,e)=>{let r=Ha("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Wct=async(t,e)=>{let r=Ha("TagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Kct=async(t,e)=>{let r=Ha("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Gct=async(t,e)=>{let r=Ha("UnlinkIdentity"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Jct=async(t,e)=>{let r=Ha("UntagResource"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Yct=async(t,e)=>{let r=Ha("UpdateIdentityPool"),n;return n=JSON.stringify(or(t)),za(e,r,"/",void 0,n)},Zct=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Xct=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Qct=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),edt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=vdt(r,e),{$metadata:ro(t),...n}},tdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},rdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Kgr(r,e),{$metadata:ro(t),...n}},ndt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},odt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},idt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},adt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},sdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},udt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=Jgr(r,e),{$metadata:ro(t),...n}},ldt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},cdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},ddt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},fdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},pdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),mdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},hdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},gdt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),ydt=async(t,e)=>t.statusCode>=300?Ua(t,e):(await DT(t.body,e),{$metadata:ro(t)}),bdt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},_dt=async(t,e)=>{if(t.statusCode>=300)return Ua(t,e);let r=await Is(t.body,e),n={};return n=or(r),{$metadata:ro(t),...n}},Ua=async(t,e)=>{let r={...t,body:await Aut(t.body,e)},n=Iut(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await kgr(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await Bgr(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await qgr(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await Ugr(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await zgr(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await Vgr(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await Hgr(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await Fgr(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await $gr(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await Lgr(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await Dgr(r,e);default:let o=r.body;return Ygr({output:t,parsedBody:o,errorCode:n})}},Dgr=async(t,e)=>{let r=t.body,n=or(r),o=new _X({$metadata:ro(t),...n});return qa(o,r)},Lgr=async(t,e)=>{let r=t.body,n=or(r),o=new bX({$metadata:ro(t),...n});return qa(o,r)},Fgr=async(t,e)=>{let r=t.body,n=or(r),o=new gX({$metadata:ro(t),...n});return qa(o,r)},kgr=async(t,e)=>{let r=t.body,n=or(r),o=new lX({$metadata:ro(t),...n});return qa(o,r)},$gr=async(t,e)=>{let r=t.body,n=or(r),o=new yX({$metadata:ro(t),...n});return qa(o,r)},Bgr=async(t,e)=>{let r=t.body,n=or(r),o=new cX({$metadata:ro(t),...n});return qa(o,r)},qgr=async(t,e)=>{let r=t.body,n=or(r),o=new dX({$metadata:ro(t),...n});return qa(o,r)},Ugr=async(t,e)=>{let r=t.body,n=or(r),o=new fX({$metadata:ro(t),...n});return qa(o,r)},zgr=async(t,e)=>{let r=t.body,n=or(r),o=new pX({$metadata:ro(t),...n});return qa(o,r)},Hgr=async(t,e)=>{let r=t.body,n=or(r),o=new hX({$metadata:ro(t),...n});return qa(o,r)},Vgr=async(t,e)=>{let r=t.body,n=or(r),o=new mX({$metadata:ro(t),...n});return qa(o,r)},Wgr=(t,e)=>Z3(t,{AccessKeyId:ln,Expiration:r=>_k(AZ(R1(r))),SecretKey:ln,SessionToken:ln}),Kgr=(t,e)=>Z3(t,{Credentials:r=>Wgr(r,e),IdentityId:ln}),Ggr=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>vdt(n,e)),vdt=(t,e)=>Z3(t,{CreationDate:r=>_k(AZ(R1(r))),IdentityId:ln,LastModifiedDate:r=>_k(AZ(R1(r))),Logins:or}),Jgr=(t,e)=>Z3(t,{Identities:r=>Ggr(r,e),IdentityPoolId:ln,NextToken:ln}),ro=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"]}),Ygr=IZ(Hd),za=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 aX(l)}});var vX,Nwe=w(()=>{zn();to();ar();ua();Oa();vX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(Tct).de(Zct).build(){}});var wX,Dwe=w(()=>{zn();to();ar();ua();Oa();wX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(Act).de(Xct).build(){}});var SX,Lwe=w(()=>{zn();to();ar();ua();Oa();SX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(Ict).de(Qct).build(){}});var xX,Fwe=w(()=>{zn();to();ar();ua();Oa();xX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(Mct).de(edt).build(){}});var CX,kwe=w(()=>{zn();to();ar();ua();Oa();CX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(Rct).de(tdt).build(){}});var Tk,$we=w(()=>{zn();to();ar();ua();Oa();Tk=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(jct).de(rdt).build(){}});var Ak,Bwe=w(()=>{zn();to();ar();ua();Oa();Ak=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(Nct).de(ndt).build(){}});var OX,qwe=w(()=>{zn();to();ar();ua();Oa();OX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(Dct).de(odt).build(){}});var PX,Uwe=w(()=>{zn();to();ar();ua();Oa();PX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(Lct).de(idt).build(){}});var EX,zwe=w(()=>{zn();to();ar();ua();Oa();EX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(Fct).de(adt).build(){}});var TX,Hwe=w(()=>{zn();to();ar();ua();Oa();TX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(kct).de(sdt).build(){}});var AX,Vwe=w(()=>{zn();to();ar();ua();Oa();AX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser($ct).de(udt).build(){}});var Ik,IX=w(()=>{zn();to();ar();ua();Oa();Ik=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(Bct).de(ldt).build(){}});var MX,Wwe=w(()=>{zn();to();ar();ua();Oa();MX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(qct).de(cdt).build(){}});var RX,Kwe=w(()=>{zn();to();ar();ua();Oa();RX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser(Uct).de(ddt).build(){}});var jX,Gwe=w(()=>{zn();to();ar();ua();Oa();jX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(zct).de(fdt).build(){}});var NX,Jwe=w(()=>{zn();to();ar();ua();Oa();NX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(Hct).de(pdt).build(){}});var DX,Ywe=w(()=>{zn();to();ar();ua();Oa();DX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(Vct).de(mdt).build(){}});var LX,Zwe=w(()=>{zn();to();ar();ua();Oa();LX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(Wct).de(hdt).build(){}});var FX,Xwe=w(()=>{zn();to();ar();ua();Oa();FX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(Kct).de(gdt).build(){}});var kX,Qwe=w(()=>{zn();to();ar();ua();Oa();kX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(Gct).de(ydt).build(){}});var $X,e0e=w(()=>{zn();to();ar();ua();Oa();$X=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(Jct).de(bdt).build(){}});var BX,t0e=w(()=>{zn();to();ar();ua();Oa();BX=class extends Ot.classBuilder().ep({...Cr}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(Yct).de(_dt).build(){}});var Zgr,r0e,wdt=w(()=>{ar();uX();Nwe();Dwe();Lwe();Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();IX();Wwe();Kwe();Gwe();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e();Zgr={CreateIdentityPoolCommand:vX,DeleteIdentitiesCommand:wX,DeleteIdentityPoolCommand:SX,DescribeIdentityCommand:xX,DescribeIdentityPoolCommand:CX,GetCredentialsForIdentityCommand:Tk,GetIdCommand:Ak,GetIdentityPoolRolesCommand:OX,GetOpenIdTokenCommand:PX,GetOpenIdTokenForDeveloperIdentityCommand:EX,GetPrincipalTagAttributeMapCommand:TX,ListIdentitiesCommand:AX,ListIdentityPoolsCommand:Ik,ListTagsForResourceCommand:MX,LookupDeveloperIdentityCommand:RX,MergeDeveloperIdentitiesCommand:jX,SetIdentityPoolRolesCommand:NX,SetPrincipalTagAttributeMapCommand:DX,TagResourceCommand:LX,UnlinkDeveloperIdentityCommand:FX,UnlinkIdentityCommand:kX,UntagResourceCommand:$X,UpdateIdentityPoolCommand:BX},r0e=class extends BT{};TZ(Zgr,r0e)});var Sdt=w(()=>{Nwe();Dwe();Lwe();Fwe();kwe();$we();Bwe();qwe();Uwe();zwe();Hwe();Vwe();IX();Wwe();Kwe();Gwe();Jwe();Ywe();Zwe();Xwe();Qwe();e0e();t0e()});var xdt=w(()=>{});var lpo,Cdt=w(()=>{LT();uX();IX();lpo=Dve(BT,Ik,"NextToken","NextToken","MaxResults")});var Odt=w(()=>{xdt();Cdt()});var Pdt=w(()=>{jwe()});var Edt=w(()=>{uX();wdt();Sdt();Odt();Pdt()});var n0e={};Cf(n0e,{CognitoIdentityClient:()=>BT,GetCredentialsForIdentityCommand:()=>Tk,GetIdCommand:()=>Ak});var o0e=w(()=>{Edt()});function qX(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(o0e(),n0e)),{Credentials:{AccessKeyId:n=Xgr(t.logger),Expiration:o,SecretKey:i=eyr(t.logger),SessionToken:a}=Qgr(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 BY(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function Xgr(t){throw new Tl("Response from Amazon Cognito contained no access key ID",{logger:t})}function Qgr(t){throw new Tl("Response from Amazon Cognito contained no credentials",{logger:t})}function eyr(t){throw new Tl("Response from Amazon Cognito contained no secret key",{logger:t})}var i0e=w(()=>{aO();C_e()});var a0e,UX,Tdt=w(()=>{a0e="IdentityIds",UX=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(a0e,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(a0e,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(a0e)))}).catch(i=>{throw n.close(),i})})}}});var zX,Adt=w(()=>{zX=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 Idt(){return typeof self=="object"&&self.indexedDB?new UX:typeof window=="object"&&window.localStorage?window.localStorage:tyr}var tyr,Mdt=w(()=>{Tdt();Adt();tyr=new zX});function Rdt({accountId:t,cache:e=Idt(),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(()=>(o0e(),n0e)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:b=ryr(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await BY(a):void 0}));h=b,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=qX({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function ryr(t){throw new Tl("Response from Amazon Cognito contained no identity ID",{logger:t})}var jdt=w(()=>{aO();i0e();Mdt();C_e()});var s0e=w(()=>{Ket();Get();Jet();i0e();jdt()});var nyr,Ndt=w(()=>{s0e();nyr=t=>qX({...t})});var oyr,Ddt=w(()=>{s0e();oyr=t=>Rdt({...t})});var iyr,ayr,syr,Ldt,Fdt=w(()=>{aO();iyr="169.254.170.2",ayr="169.254.170.23",syr="[fd00:ec2::23]",Ldt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===iyr||t.hostname===ayr||t.hostname===syr)){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 Tl(`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 kdt=w(()=>{});var $dt=w(()=>{kdt()});var Bdt=w(()=>{Hs()});var qdt=w(()=>{});var Udt=w(()=>{});function uyr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var HX,zdt=w(()=>{HX=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=uyr(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 Hdt=w(()=>{});var Vdt=w(()=>{});var Wdt=w(()=>{});var Kdt=w(()=>{$dt();Bdt();qdt();Udt();zdt();Hdt();Vdt();Wdt()});function Gdt(t){return new HX({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 Jdt(t,e){let n=await fat(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 Tl("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:Aat(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Tl(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Tl(`Server responded with status: ${t.statusCode}`,{logger:e})}var Ydt=w(()=>{aO();Kdt();ar();xve()});var Zdt,Xdt=w(()=>{Zdt=(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 u0e,Qdt=w(()=>{G3();aO();Fdt();Ydt();Xdt();u0e=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Tl("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);Ldt(n,t.logger);let o=new NT;return Zdt(async()=>{let i=Gdt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return Jdt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var eft=w(()=>{Qdt()});function lyr(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function tft(t){return{schemeId:"smithy.api#noAuth"}}var rft,nft,cyr,oft,l0e=w(()=>{F1();jy();dH();rft=async(t,e,r)=>({operation:A_(e).operation,region:await zd(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});nft=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(tft(t));break}case"AssumeRoleWithWebIdentity":{e.push(tft(t));break}default:e.push(lyr(t))}return e},cyr=t=>({...t,stsClientCtor:Zh}),oft=t=>{let e=cyr(t);return{...JZ(e)}}});var ift,Vd,L_=w(()=>{ift=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vd={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 sft,aft=w(()=>{sft={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 c0e,d0e=w(()=>{c0e=t=>new TextEncoder().encode(t)});var uft=w(()=>{d0e()});var lft,cft=w(()=>{lft=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 dft=w(()=>{d0e();uft();cft()});var Sft,rn,xo,Co,UT,qT,kc,xft,Cft,Oft,Pa,fft,F_,Mk,p0e,pft,f0e,Pft,mft,$c,hft,Eft,Tft,Wd,Dm,gft,Aft,Ift,yft,Mft,bft,_ft,vft,wft,fyr,Rft,jft=w(()=>{Sft="required",rn="type",xo="fn",Co="argv",UT="ref",qT="booleanEquals",kc="stringEquals",xft="sigv4",Cft="sts",Oft="us-east-1",Pa="endpoint",fft="https://sts.{Region}.{PartitionResult#dnsSuffix}",F_="tree",Mk="error",p0e="getAttr",pft={[Sft]:!1,[rn]:"String"},f0e={[Sft]:!0,default:!1,[rn]:"Boolean"},Pft={[UT]:"Endpoint"},mft={[xo]:"isSet",[Co]:[{[UT]:"Region"}]},$c={[UT]:"Region"},hft={[xo]:"aws.partition",[Co]:[$c],assign:"PartitionResult"},Eft={[UT]:"UseFIPS"},Tft={[UT]:"UseDualStack"},Wd={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:xft,signingName:Cft,signingRegion:Oft}]},headers:{}},Dm={},gft={conditions:[{[xo]:kc,[Co]:[$c,"aws-global"]}],[Pa]:Wd,[rn]:Pa},Aft={[xo]:qT,[Co]:[Eft,!0]},Ift={[xo]:qT,[Co]:[Tft,!0]},yft={[xo]:p0e,[Co]:[{[UT]:"PartitionResult"},"supportsFIPS"]},Mft={[UT]:"PartitionResult"},bft={[xo]:qT,[Co]:[!0,{[xo]:p0e,[Co]:[Mft,"supportsDualStack"]}]},_ft=[{[xo]:"isSet",[Co]:[Pft]}],vft=[Aft],wft=[Ift],fyr={version:"1.0",parameters:{Region:pft,UseDualStack:f0e,UseFIPS:f0e,Endpoint:pft,UseGlobalEndpoint:f0e},rules:[{conditions:[{[xo]:qT,[Co]:[{[UT]:"UseGlobalEndpoint"},!0]},{[xo]:"not",[Co]:_ft},mft,hft,{[xo]:qT,[Co]:[Eft,!1]},{[xo]:qT,[Co]:[Tft,!1]}],rules:[{conditions:[{[xo]:kc,[Co]:[$c,"ap-northeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-south-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"ap-southeast-2"]}],endpoint:Wd,[rn]:Pa},gft,{conditions:[{[xo]:kc,[Co]:[$c,"ca-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-central-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-north-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"eu-west-3"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"sa-east-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,Oft]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-east-2"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-1"]}],endpoint:Wd,[rn]:Pa},{conditions:[{[xo]:kc,[Co]:[$c,"us-west-2"]}],endpoint:Wd,[rn]:Pa},{endpoint:{url:fft,properties:{authSchemes:[{name:xft,signingName:Cft,signingRegion:"{Region}"}]},headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:_ft,rules:[{conditions:vft,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[rn]:Mk},{conditions:wft,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[rn]:Mk},{endpoint:{url:Pft,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{conditions:[mft],rules:[{conditions:[hft],rules:[{conditions:[Aft,Ift],rules:[{conditions:[{[xo]:qT,[Co]:[!0,yft]},bft],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[rn]:Mk}],[rn]:F_},{conditions:vft,rules:[{conditions:[{[xo]:qT,[Co]:[yft,!0]}],rules:[{conditions:[{[xo]:kc,[Co]:[{[xo]:p0e,[Co]:[Mft,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Dm,headers:Dm},[rn]:Pa},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"FIPS is enabled but this partition does not support FIPS",[rn]:Mk}],[rn]:F_},{conditions:wft,rules:[{conditions:[bft],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_},{error:"DualStack is enabled but this partition does not support DualStack",[rn]:Mk}],[rn]:F_},gft,{endpoint:{url:fft,properties:Dm,headers:Dm},[rn]:Pa}],[rn]:F_}],[rn]:F_},{error:"Invalid Configuration: Missing Region",[rn]:Mk}]},Rft=fyr});var Nft,Dft=w(()=>{eZ();ET();jft();Nft=(t,e={})=>k3(Rft,{endpointParams:t,logger:e.logger});sO.aws=$3});var Lft,Fft=w(()=>{F1();LT();ar();dZ();yk();dft();l0e();Dft();Lft=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??RT,base64Encoder:t?.base64Encoder??jT,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Nft,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??nft,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new N1},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Sk}],logger:t?.logger??new AT,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??TT,utf8Decoder:t?.utf8Decoder??c0e,utf8Encoder:t?.utf8Encoder??lft})});var kft,$ft=w(()=>{aft();_we();Swe();B3();G3();xwe();Cwe();M_();Fft();ar();Twe();kft=t=>{let e=nX(t),r=()=>e().then(MZ),n=Lft(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rX,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eX({serviceId:n.serviceId,clientVersion:sft.version}),maxAttempts:t?.maxAttempts??I_,region:t?.region??tX("Region is missing"),requestHandler:NT.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||z3),sha256:t?.sha256??QZ,streamCollector:t?.streamCollector??bk,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(aZ)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(sZ))}}});var Bft,qft,Uft=w(()=>{Bft=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},qft=t=>({httpHandler:t.httpHandler()})});var zft=w(()=>{Uft()});var Hft=w(()=>{Hs()});var Vft=w(()=>{});var Wft=w(()=>{});function pyr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var VX,Kft=w(()=>{VX=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=pyr(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 Gft=w(()=>{});var Jft=w(()=>{});var Yft=w(()=>{});var m0e=w(()=>{zft();Hft();Vft();Wft();Kft();Gft();Jft();Yft()});var Zft,Xft,Qft=w(()=>{Zft=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}}},Xft=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var WX,ept,tpt=w(()=>{Iwe();m0e();ar();Qft();WX=t=>t,ept=(t,e)=>{let r={...WX(oX(t)),...WX(RZ(t)),...WX(Bft(t)),...WX(Zft(t))};return e.forEach(n=>n.configure(r)),{...t,...iX(r),...jZ(r),...qft(r),...Xft(r)}}});var Zh,dH=w(()=>{E_e();T_e();A_e();W_e();B3();LT();Lve();zn();LZ();ar();l0e();L_();$ft();tpt();Zh=class extends A1{constructor(...[e]){let r=kft(e||{}),n=ift(r),o=WY(n),i=CZ(o),a=lZ(i),s=a,u=mZ(s),l=oft(u),c=ept(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(oZ(this.config)),this.middlewareStack.use(DZ(this.config)),this.middlewareStack.use($Z(this.config)),this.middlewareStack.use(UY(this.config)),this.middlewareStack.use(zY(this.config)),this.middlewareStack.use(VY(this.config)),this.middlewareStack.use(hZ(this.config,{httpAuthSchemeParametersProvider:rft,identityProviderConfigProvider:async d=>new wk({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(FZ(this.config))}destroy(){super.destroy()}}});var Hf,KX=w(()=>{ar();Hf=class t extends vk{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var fH,pH,mH,hH,gH,yH,bH,_H,Rk,h0e,g0e,y0e,b0e,_0e,v0e,w0e,zT=w(()=>{ar();KX();fH=class t extends Hf{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pH=class t extends Hf{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mH=class t extends Hf{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hH=class t extends Hf{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gH=class t extends Hf{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yH=class t extends Hf{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bH=class t extends Hf{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_H=class t extends Hf{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Rk=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:EZ}}),h0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),g0e=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:EZ}}),y0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),b0e=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:EZ}}),_0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),v0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}}),w0e=t=>({...t,...t.Credentials&&{Credentials:Rk(t.Credentials)}})});var rpt,npt,opt,ipt,apt,spt,upt,lpt,cpt,dpt,fpt,ppt,mpt,hpt,gpt,ypt,HT,myr,hyr,gyr,yyr,byr,_yr,vyr,wyr,Syr,xyr,Cyr,Oyr,Pyr,Eyr,Tyr,Ayr,GX,Iyr,Myr,Ryr,jyr,Nyr,bpt,Y0e,Dyr,Lyr,Fyr,vH,kyr,$yr,Byr,qyr,Uyr,zyr,Hyr,Vyr,Wyr,Kyr,Gyr,Jyr,Yyr,Zyr,Kd,Xyr,VT,WT,KT,GT,jk,Qyr,S0e,pO,ebr,tbr,Nk,mO,Dk,Vf,x0e,rbr,C0e,Wf,O0e,P0e,E0e,T0e,A0e,nbr,obr,ibr,abr,I0e,M0e,R0e,j0e,Xh,Qh,N0e,D0e,L0e,F0e,eg,k0e,hO,Lk,$0e,B0e,q0e,U0e,tg,Fk,z0e,H0e,kk,$k,V0e,W0e,JT,K0e,G0e,J0e,Ea,YT,sbr,gO=w(()=>{F1();m0e();ar();zT();KX();rpt=async(t,e)=>{let r=WT,n;return n=YT({...Syr(t,e),[GT]:Qyr,[JT]:KT}),VT(e,r,"/",void 0,n)},npt=async(t,e)=>{let r=WT,n;return n=YT({...xyr(t,e),[GT]:ebr,[JT]:KT}),VT(e,r,"/",void 0,n)},opt=async(t,e)=>{let r=WT,n;return n=YT({...Cyr(t,e),[GT]:tbr,[JT]:KT}),VT(e,r,"/",void 0,n)},ipt=async(t,e)=>{let r=WT,n;return n=YT({...Oyr(t,e),[GT]:rbr,[JT]:KT}),VT(e,r,"/",void 0,n)},apt=async(t,e)=>{let r=WT,n;return n=YT({...Pyr(t,e),[GT]:nbr,[JT]:KT}),VT(e,r,"/",void 0,n)},spt=async(t,e)=>{let r=WT,n;return n=YT({...Eyr(t,e),[GT]:obr,[JT]:KT}),VT(e,r,"/",void 0,n)},upt=async(t,e)=>{let r=WT,n;return n=YT({...Tyr(t,e),[GT]:ibr,[JT]:KT}),VT(e,r,"/",void 0,n)},lpt=async(t,e)=>{let r=WT,n;return n=YT({...Ayr(t,e),[GT]:abr,[JT]:KT}),VT(e,r,"/",void 0,n)},cpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Dyr(r.AssumeRoleResult,e),{$metadata:Kd(t),...n}},dpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Lyr(r.AssumeRoleWithSAMLResult,e),{$metadata:Kd(t),...n}},fpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Fyr(r.AssumeRoleWithWebIdentityResult,e),{$metadata:Kd(t),...n}},ppt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=kyr(r.DecodeAuthorizationMessageResult,e),{$metadata:Kd(t),...n}},mpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=qyr(r.GetAccessKeyInfoResult,e),{$metadata:Kd(t),...n}},hpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Uyr(r.GetCallerIdentityResult,e),{$metadata:Kd(t),...n}},gpt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=zyr(r.GetFederationTokenResult,e),{$metadata:Kd(t),...n}},ypt=async(t,e)=>{if(t.statusCode>=300)return HT(t,e);let r=await R_(t.body,e),n={};return n=Hyr(r.GetSessionTokenResult,e),{$metadata:Kd(t),...n}},HT=async(t,e)=>{let r={...t,body:await dlt(t.body,e)},n=sbr(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await myr(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await _yr(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await vyr(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await wyr(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await gyr(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await byr(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await hyr(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await yyr(r,e);default:let o=r.body;return Xyr({output:t,parsedBody:o.Error,errorCode:n})}},myr=async(t,e)=>{let r=t.body,n=$yr(r.Error,e),o=new fH({$metadata:Kd(t),...n});return qa(o,r)},hyr=async(t,e)=>{let r=t.body,n=Vyr(r.Error,e),o=new bH({$metadata:Kd(t),...n});return qa(o,r)},gyr=async(t,e)=>{let r=t.body,n=Wyr(r.Error,e),o=new gH({$metadata:Kd(t),...n});return qa(o,r)},yyr=async(t,e)=>{let r=t.body,n=Kyr(r.Error,e),o=new _H({$metadata:Kd(t),...n});return qa(o,r)},byr=async(t,e)=>{let r=t.body,n=Gyr(r.Error,e),o=new yH({$metadata:Kd(t),...n});return qa(o,r)},_yr=async(t,e)=>{let r=t.body,n=Jyr(r.Error,e),o=new pH({$metadata:Kd(t),...n});return qa(o,r)},vyr=async(t,e)=>{let r=t.body,n=Yyr(r.Error,e),o=new mH({$metadata:Kd(t),...n});return qa(o,r)},wyr=async(t,e)=>{let r=t.body,n=Zyr(r.Error,e),o=new hH({$metadata:Kd(t),...n});return qa(o,r)},Syr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[Lk]!=null&&(r[Lk]=t[Lk]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),t[kk]!=null){let n=bpt(t[kk],e);t[kk]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[V0e]!=null){let n=Nyr(t[V0e],e);t[V0e]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[P0e]!=null&&(r[P0e]=t[P0e]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[$k]!=null&&(r[$k]=t[$k]),t[tg]!=null&&(r[tg]=t[tg]),t[L0e]!=null){let n=Ryr(t[L0e],e);t[L0e]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},xyr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[N0e]!=null&&(r[N0e]=t[N0e]),t[q0e]!=null&&(r[q0e]=t[q0e]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Cyr=(t,e)=>{let r={};if(t[hO]!=null&&(r[hO]=t[hO]),t[Lk]!=null&&(r[Lk]=t[Lk]),t[G0e]!=null&&(r[G0e]=t[G0e]),t[F0e]!=null&&(r[F0e]=t[F0e]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[Xh]!=null&&(r[Xh]=t[Xh]),t[Wf]!=null&&(r[Wf]=t[Wf]),r},Oyr=(t,e)=>{let r={};return t[E0e]!=null&&(r[E0e]=t[E0e]),r},Pyr=(t,e)=>{let r={};return t[jk]!=null&&(r[jk]=t[jk]),r},Eyr=(t,e)=>({}),Tyr=(t,e)=>{let r={};if(t[R0e]!=null&&(r[R0e]=t[R0e]),t[Xh]!=null&&(r[Xh]=t[Xh]),t[Qh]!=null){let n=GX(t[Qh],e);t[Qh]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[Wf]!=null&&(r[Wf]=t[Wf]),t[kk]!=null){let n=bpt(t[kk],e);t[kk]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},Ayr=(t,e)=>{let r={};return t[Wf]!=null&&(r[Wf]=t[Wf]),t[Fk]!=null&&(r[Fk]=t[Fk]),t[$k]!=null&&(r[$k]=t[$k]),r},GX=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Iyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Iyr=(t,e)=>{let r={};return t[J0e]!=null&&(r[J0e]=t[J0e]),r},Myr=(t,e)=>{let r={};return t[D0e]!=null&&(r[D0e]=t[D0e]),t[x0e]!=null&&(r[x0e]=t[x0e]),r},Ryr=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=Myr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},jyr=(t,e)=>{let r={};return t[M0e]!=null&&(r[M0e]=t[M0e]),t[K0e]!=null&&(r[K0e]=t[K0e]),r},Nyr=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},bpt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=jyr(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Y0e=(t,e)=>{let r={};return t[S0e]!=null&&(r[S0e]=ln(t[S0e])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},Dyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},Lyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[$0e]!=null&&(r[$0e]=ln(t[$0e])),t[z0e]!=null&&(r[z0e]=ln(t[z0e])),t[I0e]!=null&&(r[I0e]=ln(t[I0e])),t[Dk]!=null&&(r[Dk]=ln(t[Dk])),t[j0e]!=null&&(r[j0e]=ln(t[j0e])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},Fyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[U0e]!=null&&(r[U0e]=ln(t[U0e])),t[pO]!=null&&(r[pO]=Y0e(t[pO],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),t[k0e]!=null&&(r[k0e]=ln(t[k0e])),t[Dk]!=null&&(r[Dk]=ln(t[Dk])),t[tg]!=null&&(r[tg]=ln(t[tg])),r},vH=(t,e)=>{let r={};return t[jk]!=null&&(r[jk]=ln(t[jk])),t[B0e]!=null&&(r[B0e]=ln(t[B0e])),t[H0e]!=null&&(r[H0e]=ln(t[H0e])),t[O0e]!=null&&(r[O0e]=_k(Iat(t[O0e]))),r},kyr=(t,e)=>{let r={};return t[C0e]!=null&&(r[C0e]=ln(t[C0e])),r},$yr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Byr=(t,e)=>{let r={};return t[A0e]!=null&&(r[A0e]=ln(t[A0e])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},qyr=(t,e)=>{let r={};return t[Nk]!=null&&(r[Nk]=ln(t[Nk])),r},Uyr=(t,e)=>{let r={};return t[W0e]!=null&&(r[W0e]=ln(t[W0e])),t[Nk]!=null&&(r[Nk]=ln(t[Nk])),t[mO]!=null&&(r[mO]=ln(t[mO])),r},zyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),t[T0e]!=null&&(r[T0e]=Byr(t[T0e],e)),t[eg]!=null&&(r[eg]=Y3(t[eg])),r},Hyr=(t,e)=>{let r={};return t[Vf]!=null&&(r[Vf]=vH(t[Vf],e)),r},Vyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Wyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Kyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Gyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Jyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Yyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Zyr=(t,e)=>{let r={};return t[Ea]!=null&&(r[Ea]=ln(t[Ea])),r},Kd=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"]}),Xyr=IZ(Hf),VT=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 VX(l)},WT={"content-type":"application/x-www-form-urlencoded"},KT="2011-06-15",GT="Action",jk="AccessKeyId",Qyr="AssumeRole",S0e="AssumedRoleId",pO="AssumedRoleUser",ebr="AssumeRoleWithSAML",tbr="AssumeRoleWithWebIdentity",Nk="Account",mO="Arn",Dk="Audience",Vf="Credentials",x0e="ContextAssertion",rbr="DecodeAuthorizationMessage",C0e="DecodedMessage",Wf="DurationSeconds",O0e="Expiration",P0e="ExternalId",E0e="EncodedMessage",T0e="FederatedUser",A0e="FederatedUserId",nbr="GetAccessKeyInfo",obr="GetCallerIdentity",ibr="GetFederationToken",abr="GetSessionToken",I0e="Issuer",M0e="Key",R0e="Name",j0e="NameQualifier",Xh="Policy",Qh="PolicyArns",N0e="PrincipalArn",D0e="ProviderArn",L0e="ProvidedContexts",F0e="ProviderId",eg="PackedPolicySize",k0e="Provider",hO="RoleArn",Lk="RoleSessionName",$0e="Subject",B0e="SecretAccessKey",q0e="SAMLAssertion",U0e="SubjectFromWebIdentityToken",tg="SourceIdentity",Fk="SerialNumber",z0e="SubjectType",H0e="SessionToken",kk="Tags",$k="TokenCode",V0e="TransitiveTagKeys",W0e="UserId",JT="Version",K0e="Value",G0e="WebIdentityToken",J0e="arn",Ea="message",YT=t=>Object.entries(t).map(([e,r])=>NZ(e)+"="+NZ(r)).join("&"),sbr=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var yO,JX=w(()=>{zn();to();ar();L_();zT();gO();yO=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,h0e).ser(rpt).de(cpt).build(){}});var wH,Z0e=w(()=>{zn();to();ar();L_();zT();gO();wH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(g0e,y0e).ser(npt).de(dpt).build(){}});var k1,YX=w(()=>{zn();to();ar();L_();zT();gO();k1=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(b0e,_0e).ser(opt).de(fpt).build(){}});var SH,X0e=w(()=>{zn();to();ar();L_();gO();SH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(ipt).de(ppt).build(){}});var xH,Q0e=w(()=>{zn();to();ar();L_();gO();xH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(apt).de(mpt).build(){}});var CH,eSe=w(()=>{zn();to();ar();L_();gO();CH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(spt).de(hpt).build(){}});var OH,tSe=w(()=>{zn();to();ar();L_();zT();gO();OH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,v0e).ser(upt).de(gpt).build(){}});var PH,rSe=w(()=>{zn();to();ar();L_();zT();gO();PH=class extends Ot.classBuilder().ep({...Vd}).m(function(e,r,n,o){return[Nt(n,this.serialize,this.deserialize),Dt(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,w0e).ser(lpt).de(ypt).build(){}});var ubr,ZX,_pt=w(()=>{ar();JX();Z0e();YX();X0e();Q0e();eSe();tSe();rSe();dH();ubr={AssumeRoleCommand:yO,AssumeRoleWithSAMLCommand:wH,AssumeRoleWithWebIdentityCommand:k1,DecodeAuthorizationMessageCommand:SH,GetAccessKeyInfoCommand:xH,GetCallerIdentityCommand:CH,GetFederationTokenCommand:OH,GetSessionTokenCommand:PH},ZX=class extends Zh{};TZ(ubr,ZX)});var vpt=w(()=>{JX();Z0e();YX();X0e();Q0e();eSe();tSe();rSe()});var wpt=w(()=>{zT()});var Spt,xpt,Cpt,Opt,Ppt,Ept,Tpt=w(()=>{JX();YX();Spt="us-east-1",xpt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},Cpt=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)`,`${Spt} (STS default)`),n??o??Spt},Opt=(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 Cpt(c,t?.parentClientConfig?.region,f),m=!Ept(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 yO(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=xpt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},Ppt=(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 Cpt(u,t?.parentClientConfig?.region,c),f=!Ept(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new k1(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=xpt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},Ept=t=>t?.metadata?.handlerProtocol==="h2"});var Apt,Ipt,Mpt,lbr,Rpt=w(()=>{Tpt();dH();Apt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,Ipt=(t={},e)=>Opt(t,Apt(Zh,e)),Mpt=(t={},e)=>Ppt(t,Apt(Zh,e)),lbr=t=>e=>t({roleAssumer:Ipt(e),roleAssumerWithWebIdentity:Mpt(e),...e})});var jpt={};Cf(jpt,{$Command:()=>Ot,AssumeRoleCommand:()=>yO,AssumeRoleResponseFilterSensitiveLog:()=>h0e,AssumeRoleWithSAMLCommand:()=>wH,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>g0e,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>y0e,AssumeRoleWithWebIdentityCommand:()=>k1,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>b0e,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>_0e,CredentialsFilterSensitiveLog:()=>Rk,DecodeAuthorizationMessageCommand:()=>SH,ExpiredTokenException:()=>fH,GetAccessKeyInfoCommand:()=>xH,GetCallerIdentityCommand:()=>CH,GetFederationTokenCommand:()=>OH,GetFederationTokenResponseFilterSensitiveLog:()=>v0e,GetSessionTokenCommand:()=>PH,GetSessionTokenResponseFilterSensitiveLog:()=>w0e,IDPCommunicationErrorException:()=>bH,IDPRejectedClaimException:()=>gH,InvalidAuthorizationMessageException:()=>_H,InvalidIdentityTokenException:()=>yH,MalformedPolicyDocumentException:()=>pH,PackedPolicyTooLargeException:()=>mH,RegionDisabledException:()=>hH,STS:()=>ZX,STSClient:()=>Zh,STSServiceException:()=>Hf,__Client:()=>A1,decorateDefaultCredentialProvider:()=>lbr,getDefaultRoleAssumer:()=>Ipt,getDefaultRoleAssumerWithWebIdentity:()=>Mpt});var nSe=w(()=>{dH();_pt();vpt();wpt();Rpt();KX()});var Npt={};Cf(Npt,{AssumeRoleCommand:()=>yO,STSClient:()=>Zh});var Dpt=w(()=>{nSe()});var cbr,Lpt=w(()=>{aO();cbr=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 Tl("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(()=>(Dpt(),Npt));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 Tl(`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 Fpt=w(()=>{});var kpt,$pt=w(()=>{kpt=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(()=>(nSe(),jpt));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 Bpt=w(()=>{Fpt();$pt()});var dbr,qpt=w(()=>{Bpt();dbr=t=>kpt({...t})});var Upt={};Cf(Upt,{fromCognitoIdentity:()=>nyr,fromCognitoIdentityPool:()=>oyr,fromHttp:()=>u0e,fromTemporaryCredentials:()=>cbr,fromWebToken:()=>dbr});var zpt=w(()=>{Ndt();Ddt();eft();Lpt();qpt()});var $1={};Cf($1,{__addDisposableResource:()=>cmt,__assign:()=>XX,__asyncDelegator:()=>rmt,__asyncGenerator:()=>tmt,__asyncValues:()=>nmt,__await:()=>Bk,__awaiter:()=>Jpt,__classPrivateFieldGet:()=>smt,__classPrivateFieldIn:()=>lmt,__classPrivateFieldSet:()=>umt,__createBinding:()=>eQ,__decorate:()=>Wpt,__disposeResources:()=>dmt,__esDecorate:()=>fbr,__exportStar:()=>Zpt,__extends:()=>Hpt,__generator:()=>Ypt,__importDefault:()=>amt,__importStar:()=>imt,__makeTemplateObject:()=>omt,__metadata:()=>Gpt,__param:()=>Kpt,__propKey:()=>mbr,__read:()=>iSe,__rest:()=>Vpt,__runInitializers:()=>pbr,__setFunctionName:()=>hbr,__spread:()=>Xpt,__spreadArray:()=>emt,__spreadArrays:()=>Qpt,__values:()=>QX,default:()=>bbr});function Hpt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Vpt(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 Wpt(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 Kpt(t,e){return function(r,n){e(r,n,t)}}function fbr(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 pbr(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 mbr(t){return typeof t=="symbol"?t:"".concat(t)}function hbr(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Gpt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Jpt(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 Ypt(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 Zpt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eQ(e,t,r)}function QX(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 iSe(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 Xpt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(iSe(arguments[e]));return t}function Qpt(){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 emt(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 Bk(t){return this instanceof Bk?(this.v=t,this):new Bk(t)}function tmt(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 Bk?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 rmt(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:Bk(t[o](a)),done:!1}:i?i(a):a}:i}}function nmt(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 QX=="function"?QX(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 omt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function imt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eQ(e,t,r);return gbr(e,t),e}function amt(t){return t&&t.__esModule?t:{default:t}}function smt(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 umt(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 lmt(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 cmt(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 dmt(t){function e(i){t.error=t.hasError?new ybr(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 oSe,XX,eQ,gbr,ybr,bbr,B1=w(()=>{oSe=function(t,e){return oSe=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])},oSe(t,e)};XX=function(){return XX=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},XX.apply(this,arguments)};eQ=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};gbr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};ybr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};bbr={__extends:Hpt,__assign:XX,__rest:Vpt,__decorate:Wpt,__param:Kpt,__metadata:Gpt,__awaiter:Jpt,__generator:Ypt,__createBinding:eQ,__exportStar:Zpt,__values:QX,__read:iSe,__spread:Xpt,__spreadArrays:Qpt,__spreadArray:emt,__await:Bk,__asyncGenerator:tmt,__asyncDelegator:rmt,__asyncValues:nmt,__makeTemplateObject:omt,__importStar:imt,__importDefault:amt,__classPrivateFieldGet:smt,__classPrivateFieldSet:umt,__classPrivateFieldIn:lmt,__addDisposableResource:cmt,__disposeResources:dmt}});var pmt=v(fmt=>{"use strict";Object.defineProperty(fmt,"__esModule",{value:!0})});var mmt=v(EH=>{"use strict";Object.defineProperty(EH,"__esModule",{value:!0});EH.HttpAuthLocation=void 0;var _br;(function(t){t.HEADER="header",t.QUERY="query"})(_br=EH.HttpAuthLocation||(EH.HttpAuthLocation={}))});var gmt=v(hmt=>{"use strict";Object.defineProperty(hmt,"__esModule",{value:!0})});var bmt=v(ymt=>{"use strict";Object.defineProperty(ymt,"__esModule",{value:!0})});var vmt=v(_mt=>{"use strict";Object.defineProperty(_mt,"__esModule",{value:!0})});var Smt=v(wmt=>{"use strict";Object.defineProperty(wmt,"__esModule",{value:!0})});var Cmt=v(xmt=>{"use strict";Object.defineProperty(xmt,"__esModule",{value:!0})});var Pmt=v(Omt=>{"use strict";Object.defineProperty(Omt,"__esModule",{value:!0})});var Tmt=v(Emt=>{"use strict";Object.defineProperty(Emt,"__esModule",{value:!0})});var Amt=v(TH=>{"use strict";Object.defineProperty(TH,"__esModule",{value:!0});var aSe=(B1(),zl($1));aSe.__exportStar(Cmt(),TH);aSe.__exportStar(Pmt(),TH);aSe.__exportStar(Tmt(),TH)});var Mmt=v(Imt=>{"use strict";Object.defineProperty(Imt,"__esModule",{value:!0})});var jmt=v(Rmt=>{"use strict";Object.defineProperty(Rmt,"__esModule",{value:!0})});var Nmt=v(AH=>{"use strict";Object.defineProperty(AH,"__esModule",{value:!0});AH.EndpointURLScheme=void 0;var vbr;(function(t){t.HTTP="http",t.HTTPS="https"})(vbr=AH.EndpointURLScheme||(AH.EndpointURLScheme={}))});var Lmt=v(Dmt=>{"use strict";Object.defineProperty(Dmt,"__esModule",{value:!0})});var kmt=v(Fmt=>{"use strict";Object.defineProperty(Fmt,"__esModule",{value:!0})});var Bmt=v($mt=>{"use strict";Object.defineProperty($mt,"__esModule",{value:!0})});var Umt=v(qmt=>{"use strict";Object.defineProperty(qmt,"__esModule",{value:!0})});var Hmt=v(zmt=>{"use strict";Object.defineProperty(zmt,"__esModule",{value:!0})});var Vmt=v(q1=>{"use strict";Object.defineProperty(q1,"__esModule",{value:!0});var IH=(B1(),zl($1));IH.__exportStar(Lmt(),q1);IH.__exportStar(kmt(),q1);IH.__exportStar(Bmt(),q1);IH.__exportStar(Umt(),q1);IH.__exportStar(Hmt(),q1)});var Kmt=v(Wmt=>{"use strict";Object.defineProperty(Wmt,"__esModule",{value:!0})});var Gmt=v(MH=>{"use strict";Object.defineProperty(MH,"__esModule",{value:!0});MH.FieldPosition=void 0;var wbr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(wbr=MH.FieldPosition||(MH.FieldPosition={}))});var Ymt=v(Jmt=>{"use strict";Object.defineProperty(Jmt,"__esModule",{value:!0})});var Xmt=v(Zmt=>{"use strict";Object.defineProperty(Zmt,"__esModule",{value:!0})});var eht=v(tQ=>{"use strict";Object.defineProperty(tQ,"__esModule",{value:!0});var Qmt=(B1(),zl($1));Qmt.__exportStar(Ymt(),tQ);Qmt.__exportStar(Xmt(),tQ)});var rht=v(tht=>{"use strict";Object.defineProperty(tht,"__esModule",{value:!0})});var oht=v(nht=>{"use strict";Object.defineProperty(nht,"__esModule",{value:!0})});var aht=v(iht=>{"use strict";Object.defineProperty(iht,"__esModule",{value:!0})});var uht=v(sht=>{"use strict";Object.defineProperty(sht,"__esModule",{value:!0})});var cht=v(lht=>{"use strict";Object.defineProperty(lht,"__esModule",{value:!0})});var fht=v(dht=>{"use strict";Object.defineProperty(dht,"__esModule",{value:!0})});var mht=v(pht=>{"use strict";Object.defineProperty(pht,"__esModule",{value:!0})});var ght=v(hht=>{"use strict";Object.defineProperty(hht,"__esModule",{value:!0})});var bht=v(yht=>{"use strict";Object.defineProperty(yht,"__esModule",{value:!0})});var vht=v(_ht=>{"use strict";Object.defineProperty(_ht,"__esModule",{value:!0})});var Sht=v(wht=>{"use strict";Object.defineProperty(wht,"__esModule",{value:!0})});var Cht=v(xht=>{"use strict";Object.defineProperty(xht,"__esModule",{value:!0})});var Pht=v(Oht=>{"use strict";Object.defineProperty(Oht,"__esModule",{value:!0})});var Eht=v(RH=>{"use strict";Object.defineProperty(RH,"__esModule",{value:!0});RH.RequestHandlerProtocol=void 0;var Sbr;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(Sbr=RH.RequestHandlerProtocol||(RH.RequestHandlerProtocol={}))});var Aht=v(Tht=>{"use strict";Object.defineProperty(Tht,"__esModule",{value:!0})});var Mht=v(Iht=>{"use strict";Object.defineProperty(Iht,"__esModule",{value:!0})});var jht=v(Rht=>{"use strict";Object.defineProperty(Rht,"__esModule",{value:!0})});var Dht=v(Nht=>{"use strict";Object.defineProperty(Nht,"__esModule",{value:!0})});var Fht=v(Lht=>{"use strict";Object.defineProperty(Lht,"__esModule",{value:!0})});var kht=v(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});var _o=(B1(),zl($1));_o.__exportStar(pmt(),Hn);_o.__exportStar(mmt(),Hn);_o.__exportStar(gmt(),Hn);_o.__exportStar(bmt(),Hn);_o.__exportStar(vmt(),Hn);_o.__exportStar(Smt(),Hn);_o.__exportStar(Amt(),Hn);_o.__exportStar(Mmt(),Hn);_o.__exportStar(jmt(),Hn);_o.__exportStar(Nmt(),Hn);_o.__exportStar(Vmt(),Hn);_o.__exportStar(Kmt(),Hn);_o.__exportStar(Gmt(),Hn);_o.__exportStar(eht(),Hn);_o.__exportStar(rht(),Hn);_o.__exportStar(oht(),Hn);_o.__exportStar(aht(),Hn);_o.__exportStar(uht(),Hn);_o.__exportStar(cht(),Hn);_o.__exportStar(fht(),Hn);_o.__exportStar(mht(),Hn);_o.__exportStar(ght(),Hn);_o.__exportStar(bht(),Hn);_o.__exportStar(vht(),Hn);_o.__exportStar(Sht(),Hn);_o.__exportStar(Cht(),Hn);_o.__exportStar(Pht(),Hn);_o.__exportStar(Eht(),Hn);_o.__exportStar(Aht(),Hn);_o.__exportStar(Mht(),Hn);_o.__exportStar(jht(),Hn);_o.__exportStar(Dht(),Hn);_o.__exportStar(Fht(),Hn)});var $ht=v(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});rQ.Field=void 0;var xbr=kht(),sSe=class{constructor({name:e,kind:r=xbr.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}};rQ.Field=sSe});var Bht=v(nQ=>{"use strict";Object.defineProperty(nQ,"__esModule",{value:!0});nQ.Fields=void 0;var uSe=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)}};nQ.Fields=uSe});var Uht=v(qht=>{"use strict";Object.defineProperty(qht,"__esModule",{value:!0})});var zht=v(oQ=>{"use strict";Object.defineProperty(oQ,"__esModule",{value:!0});oQ.HttpRequest=void 0;var lSe=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=Cbr(e.query)),e}};oQ.HttpRequest=lSe;function Cbr(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}});var Hht=v(iQ=>{"use strict";Object.defineProperty(iQ,"__esModule",{value:!0});iQ.HttpResponse=void 0;var cSe=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"}};iQ.HttpResponse=cSe});var Vht=v(aQ=>{"use strict";Object.defineProperty(aQ,"__esModule",{value:!0});aQ.isValidHostname=void 0;function Obr(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}aQ.isValidHostname=Obr});var Kht=v(Wht=>{"use strict";Object.defineProperty(Wht,"__esModule",{value:!0})});var Ght=v(bO=>{"use strict";Object.defineProperty(bO,"__esModule",{value:!0});var U1=(B1(),zl($1));U1.__exportStar($ht(),bO);U1.__exportStar(Bht(),bO);U1.__exportStar(Uht(),bO);U1.__exportStar(zht(),bO);U1.__exportStar(Hht(),bO);U1.__exportStar(Vht(),bO);U1.__exportStar(Kht(),bO)});var Jht=v(dSe=>{"use strict";Object.defineProperty(dSe,"__esModule",{value:!0});var Pbr=(B1(),zl($1));Pbr.__exportStar(Ght(),dSe)});var z1={};Cf(z1,{__addDisposableResource:()=>ggt,__assign:()=>sQ,__asyncDelegator:()=>ugt,__asyncGenerator:()=>sgt,__asyncValues:()=>lgt,__await:()=>qk,__awaiter:()=>tgt,__classPrivateFieldGet:()=>pgt,__classPrivateFieldIn:()=>hgt,__classPrivateFieldSet:()=>mgt,__createBinding:()=>lQ,__decorate:()=>Xht,__disposeResources:()=>ygt,__esDecorate:()=>Ebr,__exportStar:()=>ngt,__extends:()=>Yht,__generator:()=>rgt,__importDefault:()=>fgt,__importStar:()=>dgt,__makeTemplateObject:()=>cgt,__metadata:()=>egt,__param:()=>Qht,__propKey:()=>Abr,__read:()=>pSe,__rest:()=>Zht,__runInitializers:()=>Tbr,__setFunctionName:()=>Ibr,__spread:()=>ogt,__spreadArray:()=>agt,__spreadArrays:()=>igt,__values:()=>uQ,default:()=>jbr});function Yht(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zht(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 Xht(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 Qht(t,e){return function(r,n){e(r,n,t)}}function Ebr(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 Tbr(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 Abr(t){return typeof t=="symbol"?t:"".concat(t)}function Ibr(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 egt(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function tgt(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 rgt(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 ngt(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&lQ(e,t,r)}function uQ(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 pSe(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 ogt(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(pSe(arguments[e]));return t}function igt(){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 agt(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 qk(t){return this instanceof qk?(this.v=t,this):new qk(t)}function sgt(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 qk?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 ugt(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:qk(t[o](a)),done:!1}:i?i(a):a}:i}}function lgt(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 uQ=="function"?uQ(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 cgt(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dgt(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lQ(e,t,r);return Mbr(e,t),e}function fgt(t){return t&&t.__esModule?t:{default:t}}function pgt(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 mgt(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 hgt(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 ggt(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 ygt(t){function e(i){t.error=t.hasError?new Rbr(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 fSe,sQ,lQ,Mbr,Rbr,jbr,H1=w(()=>{fSe=function(t,e){return fSe=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])},fSe(t,e)};sQ=function(){return sQ=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},sQ.apply(this,arguments)};lQ=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};Mbr=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Rbr=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};jbr={__extends:Yht,__assign:sQ,__rest:Zht,__decorate:Xht,__param:Qht,__metadata:egt,__awaiter:tgt,__generator:rgt,__createBinding:lQ,__exportStar:ngt,__values:uQ,__read:pSe,__spread:ogt,__spreadArrays:igt,__spreadArray:agt,__await:qk,__asyncGenerator:sgt,__asyncDelegator:ugt,__asyncValues:lgt,__makeTemplateObject:cgt,__importStar:dgt,__importDefault:fgt,__classPrivateFieldGet:pgt,__classPrivateFieldSet:mgt,__classPrivateFieldIn:hgt,__addDisposableResource:ggt,__disposeResources:ygt}});var ySe={};Cf(ySe,{__assign:()=>hSe,__asyncDelegator:()=>Wbr,__asyncGenerator:()=>Vbr,__asyncValues:()=>Kbr,__await:()=>jH,__awaiter:()=>$br,__classPrivateFieldGet:()=>Zbr,__classPrivateFieldSet:()=>Xbr,__createBinding:()=>qbr,__decorate:()=>Lbr,__exportStar:()=>Ubr,__extends:()=>Nbr,__generator:()=>Bbr,__importDefault:()=>Ybr,__importStar:()=>Jbr,__makeTemplateObject:()=>Gbr,__metadata:()=>kbr,__param:()=>Fbr,__read:()=>bgt,__rest:()=>Dbr,__spread:()=>zbr,__spreadArrays:()=>Hbr,__values:()=>gSe});function Nbr(t,e){mSe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Dbr(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 Lbr(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 Fbr(t,e){return function(r,n){e(r,n,t)}}function kbr(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $br(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 Bbr(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 qbr(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Ubr(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function gSe(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 bgt(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 zbr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(bgt(arguments[e]));return t}function Hbr(){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 jH(t){return this instanceof jH?(this.v=t,this):new jH(t)}function Vbr(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 jH?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 Wbr(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:jH(t[o](a)),done:o==="return"}:i?i(a):a}:i}}function Kbr(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 gSe=="function"?gSe(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 Gbr(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Jbr(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 Ybr(t){return t&&t.__esModule?t:{default:t}}function Zbr(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Xbr(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 mSe,hSe,bSe=w(()=>{mSe=function(t,e){return mSe=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])},mSe(t,e)};hSe=function(){return hSe=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},hSe.apply(this,arguments)}});var _gt=v(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});Uk.toUtf8=Uk.fromUtf8=void 0;var Qbr=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)};Uk.fromUtf8=Qbr;var e_r=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};Uk.toUtf8=e_r});var vgt=v(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});zk.toUtf8=zk.fromUtf8=void 0;function t_r(t){return new TextEncoder().encode(t)}zk.fromUtf8=t_r;function r_r(t){return new TextDecoder("utf-8").decode(t)}zk.toUtf8=r_r});var xgt=v(Hk=>{"use strict";Object.defineProperty(Hk,"__esModule",{value:!0});Hk.toUtf8=Hk.fromUtf8=void 0;var wgt=_gt(),Sgt=vgt(),n_r=t=>typeof TextEncoder=="function"?(0,Sgt.fromUtf8)(t):(0,wgt.fromUtf8)(t);Hk.fromUtf8=n_r;var o_r=t=>typeof TextDecoder=="function"?(0,Sgt.toUtf8)(t):(0,wgt.toUtf8)(t);Hk.toUtf8=o_r});var Cgt=v(cQ=>{"use strict";Object.defineProperty(cQ,"__esModule",{value:!0});cQ.convertToBuffer=void 0;var i_r=xgt(),a_r=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:i_r.fromUtf8;function s_r(t){return t instanceof Uint8Array?t:typeof t=="string"?a_r(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}cQ.convertToBuffer=s_r});var Ogt=v(dQ=>{"use strict";Object.defineProperty(dQ,"__esModule",{value:!0});dQ.isEmptyData=void 0;function u_r(t){return typeof t=="string"?t.length===0:t.byteLength===0}dQ.isEmptyData=u_r});var Pgt=v(fQ=>{"use strict";Object.defineProperty(fQ,"__esModule",{value:!0});fQ.numToUint8=void 0;function l_r(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}fQ.numToUint8=l_r});var Egt=v(pQ=>{"use strict";Object.defineProperty(pQ,"__esModule",{value:!0});pQ.uint32ArrayFrom=void 0;function c_r(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)}pQ.uint32ArrayFrom=c_r});var _Se=v(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});k_.uint32ArrayFrom=k_.numToUint8=k_.isEmptyData=k_.convertToBuffer=void 0;var d_r=Cgt();Object.defineProperty(k_,"convertToBuffer",{enumerable:!0,get:function(){return d_r.convertToBuffer}});var f_r=Ogt();Object.defineProperty(k_,"isEmptyData",{enumerable:!0,get:function(){return f_r.isEmptyData}});var p_r=Pgt();Object.defineProperty(k_,"numToUint8",{enumerable:!0,get:function(){return p_r.numToUint8}});var m_r=Egt();Object.defineProperty(k_,"uint32ArrayFrom",{enumerable:!0,get:function(){return m_r.uint32ArrayFrom}})});var Igt=v(mQ=>{"use strict";Object.defineProperty(mQ,"__esModule",{value:!0});mQ.AwsCrc32=void 0;var Tgt=(bSe(),zl(ySe)),vSe=_Se(),Agt=hQ(),h_r=function(){function t(){this.crc32=new Agt.Crc32}return t.prototype.update=function(e){(0,vSe.isEmptyData)(e)||this.crc32.update((0,vSe.convertToBuffer)(e))},t.prototype.digest=function(){return Tgt.__awaiter(this,void 0,void 0,function(){return Tgt.__generator(this,function(e){return[2,(0,vSe.numToUint8)(this.crc32.digest())]})})},t.prototype.reset=function(){this.crc32=new Agt.Crc32},t}();mQ.AwsCrc32=h_r});var hQ=v(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});ZT.AwsCrc32=ZT.Crc32=ZT.crc32=void 0;var g_r=(bSe(),zl(ySe)),y_r=_Se();function b_r(t){return new Mgt().update(t).digest()}ZT.crc32=b_r;var Mgt=function(){function t(){this.checksum=4294967295}return t.prototype.update=function(e){var r,n;try{for(var o=g_r.__values(e),i=o.next();!i.done;i=o.next()){var a=i.value;this.checksum=this.checksum>>>8^v_r[(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}();ZT.Crc32=Mgt;var __r=[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],v_r=(0,y_r.uint32ArrayFrom)(__r),w_r=Igt();Object.defineProperty(ZT,"AwsCrc32",{enumerable:!0,get:function(){return w_r.AwsCrc32}})});var Wk=v(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});Vk.toHex=Vk.fromHex=void 0;var Rgt={},wSe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Rgt[t]=e,wSe[e]=t}function S_r(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 wSe)e[r/2]=wSe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}Vk.fromHex=S_r;function x_r(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Rgt[t[r]];return e}Vk.toHex=x_r});var xSe=v(gQ=>{"use strict";Object.defineProperty(gQ,"__esModule",{value:!0});gQ.Int64=void 0;var C_r=Wk(),SSe=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&&jgt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&jgt(e),parseInt((0,C_r.toHex)(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};gQ.Int64=SSe;function jgt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}});var PSe=v(yQ=>{"use strict";Object.defineProperty(yQ,"__esModule",{value:!0});yQ.HeaderMarshaller=void 0;var Kk=Wk(),CSe=xSe(),OSe=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(CSe.Int64.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!j_r.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set((0,Kk.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:Dgt,value:!0};break;case 1:r[i]={type:Dgt,value:!1};break;case 2:r[i]={type:O_r,value:e.getInt8(n++)};break;case 3:r[i]={type:P_r,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:E_r,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:T_r,value:new CSe.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:A_r,value:new Uint8Array(e.buffer,e.byteOffset+n,a)},n+=a;break;case 7:let s=e.getUint16(n,!1);n+=2,r[i]={type:I_r,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s))},n+=s;break;case 8:r[i]={type:M_r,value:new Date(new CSe.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:R_r,value:`${(0,Kk.toHex)(u.subarray(0,4))}-${(0,Kk.toHex)(u.subarray(4,6))}-${(0,Kk.toHex)(u.subarray(6,8))}-${(0,Kk.toHex)(u.subarray(8,10))}-${(0,Kk.toHex)(u.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};yQ.HeaderMarshaller=OSe;var Ngt;(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"})(Ngt||(Ngt={}));var Dgt="boolean",O_r="byte",P_r="short",E_r="integer",T_r="long",A_r="binary",I_r="string",M_r="timestamp",R_r="uuid",j_r=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});var Fgt=v(bQ=>{"use strict";Object.defineProperty(bQ,"__esModule",{value:!0});bQ.splitMessage=void 0;var N_r=hQ(),Lgt=4,XT=Lgt*2,V1=4,D_r=XT+V1*2;function L_r({byteLength:t,byteOffset:e,buffer:r}){if(t<D_r)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),o=n.getUint32(0,!1);if(t!==o)throw new Error("Reported message length does not match received message length");let i=n.getUint32(Lgt,!1),a=n.getUint32(XT,!1),s=n.getUint32(t-V1,!1),u=new N_r.Crc32().update(new Uint8Array(r,e,XT));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+XT,t-(XT+V1))),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+XT+V1,i),body:new Uint8Array(r,e+XT+V1+i,o-i-(XT+V1+V1))}}bQ.splitMessage=L_r});var kgt=v(_Q=>{"use strict";Object.defineProperty(_Q,"__esModule",{value:!0});_Q.EventStreamCodec=void 0;var F_r=hQ(),k_r=PSe(),$_r=Fgt(),ESe=class{constructor(e,r){this.headerMarshaller=new k_r.HeaderMarshaller(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),o=n.byteLength+r.byteLength+16,i=new Uint8Array(o),a=new DataView(i.buffer,i.byteOffset,i.byteLength),s=new F_r.Crc32;return a.setUint32(0,o,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,s.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(r,n.byteLength+12),a.setUint32(o-4,s.update(i.subarray(8,o-4)).digest(),!1),i}decode(e){let{headers:r,body:n}=(0,$_r.splitMessage)(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}};_Q.EventStreamCodec=ESe});var Bgt=v($gt=>{"use strict";Object.defineProperty($gt,"__esModule",{value:!0})});var qgt=v(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:!0});vQ.MessageDecoderStream=void 0;var TSe=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)}};vQ.MessageDecoderStream=TSe});var Ugt=v(wQ=>{"use strict";Object.defineProperty(wQ,"__esModule",{value:!0});wQ.MessageEncoderStream=void 0;var ASe=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))}};wQ.MessageEncoderStream=ASe});var zgt=v(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:!0});SQ.SmithyMessageDecoderStream=void 0;var ISe=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)}}};SQ.SmithyMessageDecoderStream=ISe});var Hgt=v(xQ=>{"use strict";Object.defineProperty(xQ,"__esModule",{value:!0});xQ.SmithyMessageEncoderStream=void 0;var MSe=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)}};xQ.SmithyMessageEncoderStream=MSe});var Vgt=v($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var QT=(H1(),zl(z1));QT.__exportStar(kgt(),$_);QT.__exportStar(PSe(),$_);QT.__exportStar(xSe(),$_);QT.__exportStar(Bgt(),$_);QT.__exportStar(qgt(),$_);QT.__exportStar(Ugt(),$_);QT.__exportStar(zgt(),$_);QT.__exportStar(Hgt(),$_)});var Wgt=v(CQ=>{"use strict";Object.defineProperty(CQ,"__esModule",{value:!0});CQ.normalizeProvider=void 0;var B_r=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};CQ.normalizeProvider=B_r});var Kgt=v(RSe=>{"use strict";Object.defineProperty(RSe,"__esModule",{value:!0});var q_r=(H1(),zl(z1));q_r.__exportStar(Wgt(),RSe)});var jSe=v(OQ=>{"use strict";Object.defineProperty(OQ,"__esModule",{value:!0});OQ.isArrayBuffer=void 0;var U_r=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";OQ.isArrayBuffer=U_r});var DSe=v(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});Gk.fromString=Gk.fromArrayBuffer=void 0;var z_r=jSe(),NSe=Pp(),H_r=(t,e=0,r=t.byteLength-e)=>{if(!(0,z_r.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return NSe.Buffer.from(t,e,r)};Gk.fromArrayBuffer=H_r;var V_r=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?NSe.Buffer.from(t,e):NSe.Buffer.from(t)};Gk.fromString=V_r});var LSe=v(PQ=>{"use strict";Object.defineProperty(PQ,"__esModule",{value:!0});PQ.fromUtf8=void 0;var W_r=DSe(),K_r=t=>{let e=(0,W_r.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};PQ.fromUtf8=K_r});var Ggt=v(EQ=>{"use strict";Object.defineProperty(EQ,"__esModule",{value:!0});EQ.toUint8Array=void 0;var G_r=LSe(),J_r=t=>typeof t=="string"?(0,G_r.fromUtf8)(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);EQ.toUint8Array=J_r});var Jgt=v(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:!0});TQ.toUtf8=void 0;var Y_r=DSe(),Z_r=t=>(0,Y_r.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8");TQ.toUtf8=Z_r});var AQ=v(NH=>{"use strict";Object.defineProperty(NH,"__esModule",{value:!0});var FSe=(H1(),zl(z1));FSe.__exportStar(LSe(),NH);FSe.__exportStar(Ggt(),NH);FSe.__exportStar(Jgt(),NH)});var W1=v(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.MAX_PRESIGNED_TTL=Lt.KEY_TYPE_IDENTIFIER=Lt.MAX_CACHE_SIZE=Lt.UNSIGNED_PAYLOAD=Lt.EVENT_ALGORITHM_IDENTIFIER=Lt.ALGORITHM_IDENTIFIER_V4A=Lt.ALGORITHM_IDENTIFIER=Lt.UNSIGNABLE_PATTERNS=Lt.SEC_HEADER_PATTERN=Lt.PROXY_HEADER_PATTERN=Lt.ALWAYS_UNSIGNABLE_HEADERS=Lt.HOST_HEADER=Lt.TOKEN_HEADER=Lt.SHA256_HEADER=Lt.SIGNATURE_HEADER=Lt.GENERATED_HEADERS=Lt.DATE_HEADER=Lt.AMZ_DATE_HEADER=Lt.AUTH_HEADER=Lt.REGION_SET_PARAM=Lt.TOKEN_QUERY_PARAM=Lt.SIGNATURE_QUERY_PARAM=Lt.EXPIRES_QUERY_PARAM=Lt.SIGNED_HEADERS_QUERY_PARAM=Lt.AMZ_DATE_QUERY_PARAM=Lt.CREDENTIAL_QUERY_PARAM=Lt.ALGORITHM_QUERY_PARAM=void 0;Lt.ALGORITHM_QUERY_PARAM="X-Amz-Algorithm";Lt.CREDENTIAL_QUERY_PARAM="X-Amz-Credential";Lt.AMZ_DATE_QUERY_PARAM="X-Amz-Date";Lt.SIGNED_HEADERS_QUERY_PARAM="X-Amz-SignedHeaders";Lt.EXPIRES_QUERY_PARAM="X-Amz-Expires";Lt.SIGNATURE_QUERY_PARAM="X-Amz-Signature";Lt.TOKEN_QUERY_PARAM="X-Amz-Security-Token";Lt.REGION_SET_PARAM="X-Amz-Region-Set";Lt.AUTH_HEADER="authorization";Lt.AMZ_DATE_HEADER=Lt.AMZ_DATE_QUERY_PARAM.toLowerCase();Lt.DATE_HEADER="date";Lt.GENERATED_HEADERS=[Lt.AUTH_HEADER,Lt.AMZ_DATE_HEADER,Lt.DATE_HEADER];Lt.SIGNATURE_HEADER=Lt.SIGNATURE_QUERY_PARAM.toLowerCase();Lt.SHA256_HEADER="x-amz-content-sha256";Lt.TOKEN_HEADER=Lt.TOKEN_QUERY_PARAM.toLowerCase();Lt.HOST_HEADER="host";Lt.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};Lt.PROXY_HEADER_PATTERN=/^proxy-/;Lt.SEC_HEADER_PATTERN=/^sec-/;Lt.UNSIGNABLE_PATTERNS=[/^proxy-/i,/^sec-/i];Lt.ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256";Lt.ALGORITHM_IDENTIFIER_V4A="AWS4-ECDSA-P256-SHA256";Lt.EVENT_ALGORITHM_IDENTIFIER="AWS4-HMAC-SHA256-PAYLOAD";Lt.UNSIGNED_PAYLOAD="UNSIGNED-PAYLOAD";Lt.MAX_CACHE_SIZE=50;Lt.KEY_TYPE_IDENTIFIER="aws4_request";Lt.MAX_PRESIGNED_TTL=60*60*24*7});var $Se=v(eA=>{"use strict";Object.defineProperty(eA,"__esModule",{value:!0});eA.clearCredentialCache=eA.getSigningKey=eA.createScope=void 0;var X_r=Wk(),Q_r=AQ(),kSe=W1(),Jk={},IQ=[],evr=(t,e,r)=>`${t}/${e}/${r}/${kSe.KEY_TYPE_IDENTIFIER}`;eA.createScope=evr;var tvr=async(t,e,r,n,o)=>{let i=await Ygt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${(0,X_r.toHex)(i)}:${e.sessionToken}`;if(a in Jk)return Jk[a];for(IQ.push(a);IQ.length>kSe.MAX_CACHE_SIZE;)delete Jk[IQ.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,kSe.KEY_TYPE_IDENTIFIER])s=await Ygt(t,s,u);return Jk[a]=s};eA.getSigningKey=tvr;var rvr=()=>{IQ.length=0,Object.keys(Jk).forEach(t=>{delete Jk[t]})};eA.clearCredentialCache=rvr;var Ygt=(t,e,r)=>{let n=new t(e);return n.update((0,Q_r.toUint8Array)(r)),n.digest()}});var qSe=v(MQ=>{"use strict";Object.defineProperty(MQ,"__esModule",{value:!0});MQ.getCanonicalHeaders=void 0;var BSe=W1(),nvr=({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 BSe.ALWAYS_UNSIGNABLE_HEADERS||e?.has(i)||BSe.PROXY_HEADER_PATTERN.test(i)||BSe.SEC_HEADER_PATTERN.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n};MQ.getCanonicalHeaders=nvr});var USe=v(RQ=>{"use strict";Object.defineProperty(RQ,"__esModule",{value:!0});RQ.escapeUri=void 0;var ovr=t=>encodeURIComponent(t).replace(/[!'()*]/g,ivr);RQ.escapeUri=ovr;var ivr=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var Zgt=v(jQ=>{"use strict";Object.defineProperty(jQ,"__esModule",{value:!0});jQ.escapeUriPath=void 0;var avr=USe(),svr=t=>t.split("/").map(avr.escapeUri).join("/");jQ.escapeUriPath=svr});var Qgt=v(NQ=>{"use strict";Object.defineProperty(NQ,"__esModule",{value:!0});var Xgt=(H1(),zl(z1));Xgt.__exportStar(USe(),NQ);Xgt.__exportStar(Zgt(),NQ)});var zSe=v(LQ=>{"use strict";Object.defineProperty(LQ,"__esModule",{value:!0});LQ.getCanonicalQuery=void 0;var DQ=Qgt(),uvr=W1(),lvr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===uvr.SIGNATURE_HEADER)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${(0,DQ.escapeUri)(n)}=${(0,DQ.escapeUri)(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).sort().reduce((i,a)=>i.concat([`${(0,DQ.escapeUri)(n)}=${(0,DQ.escapeUri)(a)}`]),[]).join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")};LQ.getCanonicalQuery=lvr});var HSe=v(FQ=>{"use strict";Object.defineProperty(FQ,"__esModule",{value:!0});FQ.getPayloadHash=void 0;var cvr=jSe(),dvr=Wk(),fvr=AQ(),eyt=W1(),pvr=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===eyt.SHA256_HEADER)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||(0,cvr.isArrayBuffer)(e)){let n=new r;return n.update((0,fvr.toUint8Array)(e)),(0,dvr.toHex)(await n.digest())}return eyt.UNSIGNED_PAYLOAD};FQ.getPayloadHash=pvr});var tyt=v(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});tA.deleteHeader=tA.getHeaderValue=tA.hasHeader=void 0;var mvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1};tA.hasHeader=mvr;var hvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return e[r]};tA.getHeaderValue=hvr;var gvr=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))t===r.toLowerCase()&&delete e[r]};tA.deleteHeader=gvr});var VSe=v(K1=>{"use strict";Object.defineProperty(K1,"__esModule",{value:!0});K1.cloneQuery=K1.cloneRequest=void 0;var yvr=({headers:t,query:e,...r})=>({...r,headers:{...t},query:e?(0,K1.cloneQuery)(e):void 0});K1.cloneRequest=yvr;var bvr=t=>Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{});K1.cloneQuery=bvr});var WSe=v(kQ=>{"use strict";Object.defineProperty(kQ,"__esModule",{value:!0});kQ.moveHeadersToQuery=void 0;var _vr=VSe(),vvr=(t,e={})=>{var r;let{headers:n,query:o={}}=typeof t.clone=="function"?t.clone():(0,_vr.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}};kQ.moveHeadersToQuery=vvr});var KSe=v($Q=>{"use strict";Object.defineProperty($Q,"__esModule",{value:!0});$Q.prepareRequest=void 0;var wvr=VSe(),Svr=W1(),xvr=t=>{t=typeof t.clone=="function"?t.clone():(0,wvr.cloneRequest)(t);for(let e of Object.keys(t.headers))Svr.GENERATED_HEADERS.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t};$Q.prepareRequest=xvr});var ryt=v(G1=>{"use strict";Object.defineProperty(G1,"__esModule",{value:!0});G1.toDate=G1.iso8601=void 0;var Cvr=t=>(0,G1.toDate)(t).toISOString().replace(/\.\d{3}Z$/,"Z");G1.iso8601=Cvr;var Ovr=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;G1.toDate=Ovr});var syt=v(zQ=>{"use strict";Object.defineProperty(zQ,"__esModule",{value:!0});zQ.SignatureV4=void 0;var Pvr=Vgt(),BQ=Wk(),nyt=Kgt(),DH=AQ(),Bc=W1(),qQ=$Se(),oyt=qSe(),Evr=zSe(),GSe=HSe(),Tvr=tyt(),Avr=WSe(),iyt=KSe(),Ivr=ryt(),JSe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerMarshaller=new Pvr.HeaderMarshaller(DH.toUtf8,DH.fromUtf8),this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,nyt.normalizeProvider)(n),this.credentialProvider=(0,nyt.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}=UQ(n);if(o>Bc.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,qQ.createScope)(p,d,l??this.service),h=(0,Avr.moveHeadersToQuery)((0,iyt.prepareRequest)(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[Bc.TOKEN_QUERY_PARAM]=c.sessionToken),h.query[Bc.ALGORITHM_QUERY_PARAM]=Bc.ALGORITHM_IDENTIFIER,h.query[Bc.CREDENTIAL_QUERY_PARAM]=`${c.accessKeyId}/${m}`,h.query[Bc.AMZ_DATE_QUERY_PARAM]=f,h.query[Bc.EXPIRES_QUERY_PARAM]=o.toString(10);let b=(0,oyt.getCanonicalHeaders)(h,i,s);return h.query[Bc.SIGNED_HEADERS_QUERY_PARAM]=ayt(b),h.query[Bc.SIGNATURE_QUERY_PARAM]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,b,await(0,GSe.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}=UQ(n),c=(0,qQ.createScope)(u,s,a??this.service),d=await(0,GSe.getPayloadHash)({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=(0,BQ.toHex)(await f.digest()),m=[Bc.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}=UQ(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update((0,DH.toUint8Array)(e)),(0,BQ.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,iyt.prepareRequest)(e),{longDate:c,shortDate:d}=UQ(r),f=(0,qQ.createScope)(d,u,a??this.service);l.headers[Bc.AMZ_DATE_HEADER]=c,s.sessionToken&&(l.headers[Bc.TOKEN_HEADER]=s.sessionToken);let p=await(0,GSe.getPayloadHash)(l,this.sha256);!(0,Tvr.hasHeader)(Bc.SHA256_HEADER,l.headers)&&this.applyChecksum&&(l.headers[Bc.SHA256_HEADER]=p);let m=(0,oyt.getCanonicalHeaders)(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[Bc.AUTH_HEADER]=`${Bc.ALGORITHM_IDENTIFIER} Credential=${s.accessKeyId}/${f}, SignedHeaders=${ayt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
${this.getCanonicalPath(e)}
${(0,Evr.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,DH.toUint8Array)(n));let i=await o.digest();return`${Bc.ALGORITHM_IDENTIFIER}
${e}
${r}
${(0,BQ.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,DH.toUint8Array)(i)),(0,BQ.toHex)(await a.digest())}getSigningKey(e,r,n,o){return(0,qQ.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")}};zQ.SignatureV4=JSe;var UQ=t=>{let e=(0,Ivr.iso8601)(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},ayt=t=>Object.keys(t).sort().join(";")});var lyt=v(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});jp.prepareRequest=jp.moveHeadersToQuery=jp.getPayloadHash=jp.getCanonicalQuery=jp.getCanonicalHeaders=void 0;var uyt=(H1(),zl(z1));uyt.__exportStar(syt(),jp);var Mvr=qSe();Object.defineProperty(jp,"getCanonicalHeaders",{enumerable:!0,get:function(){return Mvr.getCanonicalHeaders}});var Rvr=zSe();Object.defineProperty(jp,"getCanonicalQuery",{enumerable:!0,get:function(){return Rvr.getCanonicalQuery}});var jvr=HSe();Object.defineProperty(jp,"getPayloadHash",{enumerable:!0,get:function(){return jvr.getPayloadHash}});var Nvr=WSe();Object.defineProperty(jp,"moveHeadersToQuery",{enumerable:!0,get:function(){return Nvr.moveHeadersToQuery}});var Dvr=KSe();Object.defineProperty(jp,"prepareRequest",{enumerable:!0,get:function(){return Dvr.prepareRequest}});uyt.__exportStar($Se(),jp)});var cyt=v(YSe=>{"use strict";Object.defineProperty(YSe,"__esModule",{value:!0});var Lvr=(H1(),zl(z1));Lvr.__exportStar(lyt(),YSe)});var Va=v((W_o,dyt)=>{"use strict";dyt.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 Yk=v((K_o,HQ)=>{"use strict";var{AbortController:fyt,AbortSignal:Fvr}=typeof self<"u"?self:typeof window<"u"?window:void 0;HQ.exports=fyt;HQ.exports.AbortSignal=Fvr;HQ.exports.default=fyt});var LH=v((G_o,ZSe)=>{"use strict";var Zk=typeof Reflect=="object"?Reflect:null,pyt=Zk&&typeof Zk.apply=="function"?Zk.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},VQ;Zk&&typeof Zk.ownKeys=="function"?VQ=Zk.ownKeys:Object.getOwnPropertySymbols?VQ=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:VQ=function(e){return Object.getOwnPropertyNames(e)};function kvr(t){console&&console.warn&&console.warn(t)}var hyt=Number.isNaN||function(e){return e!==e};function Ei(){Ei.init.call(this)}ZSe.exports=Ei;ZSe.exports.once=Uvr;Ei.EventEmitter=Ei;Ei.prototype._events=void 0;Ei.prototype._eventsCount=0;Ei.prototype._maxListeners=void 0;var myt=10;function WQ(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ei,"defaultMaxListeners",{enumerable:!0,get:function(){return myt},set:function(t){if(typeof t!="number"||t<0||hyt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");myt=t}});Ei.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};Ei.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hyt(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 gyt(t){return t._maxListeners===void 0?Ei.defaultMaxListeners:t._maxListeners}Ei.prototype.getMaxListeners=function(){return gyt(this)};Ei.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")pyt(u,this,r);else for(var l=u.length,c=wyt(u,l),n=0;n<l;++n)pyt(c[n],this,r);return!0};function yyt(t,e,r,n){var o,i,a;if(WQ(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=gyt(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,kvr(s)}return t}Ei.prototype.addListener=function(e,r){return yyt(this,e,r,!1)};Ei.prototype.on=Ei.prototype.addListener;Ei.prototype.prependListener=function(e,r){return yyt(this,e,r,!0)};function $vr(){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 byt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=$vr.bind(n);return o.listener=r,n.wrapFn=o,o}Ei.prototype.once=function(e,r){return WQ(r),this.on(e,byt(this,e,r)),this};Ei.prototype.prependOnceListener=function(e,r){return WQ(r),this.prependListener(e,byt(this,e,r)),this};Ei.prototype.removeListener=function(e,r){var n,o,i,a,s;if(WQ(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():Bvr(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};Ei.prototype.off=Ei.prototype.removeListener;Ei.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 _yt(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?qvr(o):wyt(o,o.length)}Ei.prototype.listeners=function(e){return _yt(this,e,!0)};Ei.prototype.rawListeners=function(e){return _yt(this,e,!1)};Ei.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vyt.call(t,e)};Ei.prototype.listenerCount=vyt;function vyt(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}Ei.prototype.eventNames=function(){return this._eventsCount>0?VQ(this._events):[]};function wyt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Bvr(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function qvr(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Uvr(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))}Syt(t,e,i,{once:!0}),e!=="error"&&zvr(t,o,{once:!0})})}function zvr(t,e,r){typeof t.on=="function"&&Syt(t,"error",e,r)}function Syt(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 Gd=v((J_o,QSe)=>{"use strict";var Hvr=Pp(),{kResistStopPropagation:Vvr,SymbolDispose:Wvr}=Va(),Kvr=globalThis.AbortSignal||Yk().AbortSignal,Gvr=globalThis.AbortController||Yk().AbortController,Jvr=Object.getPrototypeOf(async function(){}).constructor,xyt=globalThis.Blob||Hvr.Blob,Yvr=typeof xyt<"u"?function(e){return e instanceof xyt}:function(e){return!1},Cyt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},Zvr=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},XSe=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}};QSe.exports={AggregateError:XSe,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 Jvr},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Yvr,deprecate(t,e){return t},addAbortListener:LH().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);Cyt(e,"signal"),Zvr(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Vvr]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Wvr](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:Kvr.any||function(e){if(e.length===1)return e[0];let r=new Gvr,n=()=>r.abort();return e.forEach(o=>{Cyt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};QSe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Kf=v((Y_o,Eyt)=>{"use strict";var{format:Xvr,inspect:KQ,AggregateError:Qvr}=Gd(),ewr=globalThis.AggregateError||Qvr,twr=Symbol("kIsNodeError"),rwr=["string","function","number","object","Function","Object","boolean","bigint","symbol"],nwr=/^([A-Z][a-z0-9]*)+$/,owr="__node_internal_",GQ={};function J1(t,e){if(!t)throw new GQ.ERR_INTERNAL_ASSERTION(e)}function Oyt(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 iwr(t,e,r){if(typeof e=="function")return J1(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 J1(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Xvr(e,...r)}function qc(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(iwr(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[twr]=!0,GQ[t]=n}function Pyt(t){let e=owr+t.name;return Object.defineProperty(t,"name",{value:e}),t}function awr(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ewr([e,t],e.message);return r.code=e.code,r}return t||e}var exe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new GQ.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};qc("ERR_ASSERTION","%s",Error);qc("ERR_INVALID_ARG_TYPE",(t,e,r)=>{J1(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)J1(typeof u=="string","All expected entries have to be of type string"),rwr.includes(u)?o.push(u.toLowerCase()):nwr.test(u)?i.push(u):(J1(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=KQ(r,{depth:-1});n+=`. Received ${u}`}}else{let u=KQ(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);qc("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=KQ(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);qc("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);qc("ERR_MISSING_ARGS",(...t)=>{J1(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);qc("ERR_OUT_OF_RANGE",(t,e,r)=>{J1(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Oyt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Oyt(n)),n+="n"):n=KQ(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);qc("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);qc("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);qc("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);qc("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);qc("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);qc("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qc("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);qc("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);qc("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);qc("ERR_STREAM_WRITE_AFTER_END","write after end",Error);qc("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Eyt.exports={AbortError:exe,aggregateTwoErrors:Pyt(awr),hideStackFrames:Pyt,codes:GQ}});var Qk=v((Z_o,Fyt)=>{"use strict";var{ArrayIsArray:rxe,ArrayPrototypeIncludes:Myt,ArrayPrototypeJoin:Ryt,ArrayPrototypeMap:swr,NumberIsInteger:nxe,NumberIsNaN:uwr,NumberMAX_SAFE_INTEGER:lwr,NumberMIN_SAFE_INTEGER:cwr,NumberParseInt:dwr,ObjectPrototypeHasOwnProperty:fwr,RegExpPrototypeExec:jyt,String:pwr,StringPrototypeToUpperCase:mwr,StringPrototypeTrim:hwr}=Va(),{hideStackFrames:rg,codes:{ERR_SOCKET_BAD_PORT:gwr,ERR_INVALID_ARG_TYPE:Jd,ERR_INVALID_ARG_VALUE:Xk,ERR_OUT_OF_RANGE:Y1,ERR_UNKNOWN_SIGNAL:Tyt}}=Kf(),{normalizeEncoding:ywr}=Gd(),{isAsyncFunction:bwr,isArrayBufferView:_wr}=Gd().types,Ayt={};function vwr(t){return t===(t|0)}function wwr(t){return t===t>>>0}var Swr=/^[0-7]+$/,xwr="must be a 32-bit unsigned integer or an octal string";function Cwr(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(jyt(Swr,t)===null)throw new Xk(e,t,xwr);t=dwr(t,8)}return Nyt(t,e),t}var Owr=rg((t,e,r=cwr,n=lwr)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);if(t<r||t>n)throw new Y1(e,`>= ${r} && <= ${n}`,t)}),Pwr=rg((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);if(t<r||t>n)throw new Y1(e,`>= ${r} && <= ${n}`,t)}),Nyt=rg((t,e,r=!1)=>{if(typeof t!="number")throw new Jd(e,"number",t);if(!nxe(t))throw new Y1(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new Y1(e,`>= ${n} && <= ${o}`,t)});function oxe(t,e){if(typeof t!="string")throw new Jd(e,"string",t)}function Ewr(t,e,r=void 0,n){if(typeof t!="number")throw new Jd(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&uwr(t))throw new Y1(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Twr=rg((t,e,r)=>{if(!Myt(r,t)){let o="must be one of: "+Ryt(swr(r,i=>typeof i=="string"?`'${i}'`:pwr(i)),", ");throw new Xk(e,t,o)}});function Dyt(t,e){if(typeof t!="boolean")throw new Jd(e,"boolean",t)}function txe(t,e,r){return t==null||!fwr(t,e)?r:t[e]}var Awr=rg((t,e,r=null)=>{let n=txe(r,"allowArray",!1),o=txe(r,"allowFunction",!1);if(!txe(r,"nullable",!1)&&t===null||!n&&rxe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Jd(e,"Object",t)}),Iwr=rg((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Jd(e,"a dictionary",t)}),JQ=rg((t,e,r=0)=>{if(!rxe(t))throw new Jd(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Xk(e,t,n)}});function Mwr(t,e){JQ(t,e);for(let r=0;r<t.length;r++)oxe(t[r],`${e}[${r}]`)}function Rwr(t,e){JQ(t,e);for(let r=0;r<t.length;r++)Dyt(t[r],`${e}[${r}]`)}function jwr(t,e){JQ(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Jd(o,"AbortSignal",n);Lyt(n,o)}}function Nwr(t,e="signal"){if(oxe(t,e),Ayt[t]===void 0)throw Ayt[mwr(t)]!==void 0?new Tyt(t+" (signals must use all capital letters)"):new Tyt(t)}var Dwr=rg((t,e="buffer")=>{if(!_wr(t))throw new Jd(e,["Buffer","TypedArray","DataView"],t)});function Lwr(t,e){let r=ywr(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Xk("encoding",e,`is invalid for data of length ${n}`)}function Fwr(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&hwr(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new gwr(e,t,r);return t|0}var Lyt=rg((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Jd(e,"AbortSignal",t)}),kwr=rg((t,e)=>{if(typeof t!="function")throw new Jd(e,"Function",t)}),$wr=rg((t,e)=>{if(typeof t!="function"||bwr(t))throw new Jd(e,"Function",t)}),Bwr=rg((t,e)=>{if(t!==void 0)throw new Jd(e,"undefined",t)});function qwr(t,e,r){if(!Myt(r,t))throw new Jd(e,`('${Ryt(r,"|")}')`,t)}var Uwr=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Iyt(t,e){if(typeof t>"u"||!jyt(Uwr,t))throw new Xk(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function zwr(t){if(typeof t=="string")return Iyt(t,"hints"),t;if(rxe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];Iyt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new Xk("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Fyt.exports={isInt32:vwr,isUint32:wwr,parseFileMode:Cwr,validateArray:JQ,validateStringArray:Mwr,validateBooleanArray:Rwr,validateAbortSignalArray:jwr,validateBoolean:Dyt,validateBuffer:Dwr,validateDictionary:Iwr,validateEncoding:Lwr,validateFunction:kwr,validateInt32:Pwr,validateInteger:Owr,validateNumber:Ewr,validateObject:Awr,validateOneOf:Twr,validatePlainFunction:$wr,validatePort:Fwr,validateSignalName:Nwr,validateString:oxe,validateUint32:Nyt,validateUndefined:Bwr,validateUnion:qwr,validateAbortSignal:Lyt,validateLinkHeaderValue:zwr}});var rA=v((X_o,qyt)=>{var Rs=qyt.exports={},B_,q_;function ixe(){throw new Error("setTimeout has not been defined")}function axe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?B_=setTimeout:B_=ixe}catch{B_=ixe}try{typeof clearTimeout=="function"?q_=clearTimeout:q_=axe}catch{q_=axe}})();function kyt(t){if(B_===setTimeout)return setTimeout(t,0);if((B_===ixe||!B_)&&setTimeout)return B_=setTimeout,setTimeout(t,0);try{return B_(t,0)}catch{try{return B_.call(null,t,0)}catch{return B_.call(this,t,0)}}}function Hwr(t){if(q_===clearTimeout)return clearTimeout(t);if((q_===axe||!q_)&&clearTimeout)return q_=clearTimeout,clearTimeout(t);try{return q_(t)}catch{try{return q_.call(null,t)}catch{return q_.call(this,t)}}}var _O=[],e$=!1,Z1,YQ=-1;function Vwr(){!e$||!Z1||(e$=!1,Z1.length?_O=Z1.concat(_O):YQ=-1,_O.length&&$yt())}function $yt(){if(!e$){var t=kyt(Vwr);e$=!0;for(var e=_O.length;e;){for(Z1=_O,_O=[];++YQ<e;)Z1&&Z1[YQ].run();YQ=-1,e=_O.length}Z1=null,e$=!1,Hwr(t)}}Rs.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];_O.push(new Byt(t,e)),_O.length===1&&!e$&&kyt($yt)};function Byt(t,e){this.fun=t,this.array=e}Byt.prototype.run=function(){this.fun.apply(null,this.array)};Rs.title="browser";Rs.browser=!0;Rs.env={};Rs.argv=[];Rs.version="";Rs.versions={};function vO(){}Rs.on=vO;Rs.addListener=vO;Rs.once=vO;Rs.off=vO;Rs.removeListener=vO;Rs.removeAllListeners=vO;Rs.emit=vO;Rs.prependListener=vO;Rs.prependOnceListener=vO;Rs.listeners=function(t){return[]};Rs.binding=function(t){throw new Error("process.binding is not supported")};Rs.cwd=function(){return"/"};Rs.chdir=function(t){throw new Error("process.chdir is not supported")};Rs.umask=function(){return 0}});var z_=v((Q_o,rbt)=>{"use strict";var{SymbolAsyncIterator:Uyt,SymbolIterator:zyt,SymbolFor:X1}=Va(),Hyt=X1("nodejs.stream.destroyed"),Vyt=X1("nodejs.stream.errored"),sxe=X1("nodejs.stream.readable"),uxe=X1("nodejs.stream.writable"),Wyt=X1("nodejs.stream.disturbed"),Wwr=X1("nodejs.webstream.isClosedPromise"),Kwr=X1("nodejs.webstream.controllerErrorFunction");function ZQ(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 XQ(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 Gwr(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function U_(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Kyt(t){return!!(t&&!U_(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Gyt(t){return!!(t&&!U_(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Jyt(t){return!!(t&&!U_(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Jwr(t){return Kyt(t)||Gyt(t)||Jyt(t)}function Ywr(t,e){return t==null?!1:e===!0?typeof t[Uyt]=="function":e===!1?typeof t[zyt]=="function":typeof t[Uyt]=="function"||typeof t[zyt]=="function"}function QQ(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Hyt]||n!=null&&n.destroyed)}function Yyt(t){if(!XQ(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 Zwr(t,e){if(!XQ(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 Xwr(t){if(!ZQ(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 Zyt(t,e){if(!ZQ(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 Xyt(t){return t&&t[sxe]!=null?t[sxe]:typeof t?.readable!="boolean"?null:QQ(t)?!1:ZQ(t)&&t.readable&&!Zyt(t)}function Qyt(t){return t&&t[uxe]!=null?t[uxe]:typeof t?.writable!="boolean"?null:QQ(t)?!1:XQ(t)&&t.writable&&!Yyt(t)}function Qwr(t,e){return U_(t)?QQ(t)?!0:!(e?.readable!==!1&&Xyt(t)||e?.writable!==!1&&Qyt(t)):null}function e0r(t){var e,r;return U_(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 t0r(t){var e,r;return U_(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 r0r(t){if(!U_(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"&&ebt(t)?t._closed:null}function ebt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function tbt(t){return typeof t._sent100=="boolean"&&ebt(t)}function n0r(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 o0r(t){if(!U_(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&tbt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function i0r(t){var e;return!!(t&&((e=t[Wyt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function a0r(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[Vyt])!==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))}rbt.exports={isDestroyed:QQ,kIsDestroyed:Hyt,isDisturbed:i0r,kIsDisturbed:Wyt,isErrored:a0r,kIsErrored:Vyt,isReadable:Xyt,kIsReadable:sxe,kIsClosedPromise:Wwr,kControllerErrorFunction:Kwr,kIsWritable:uxe,isClosed:r0r,isDuplexNodeStream:Gwr,isFinished:Qwr,isIterable:Ywr,isReadableNodeStream:ZQ,isReadableStream:Kyt,isReadableEnded:Xwr,isReadableFinished:Zyt,isReadableErrored:t0r,isNodeStream:U_,isWebStream:Jwr,isWritable:Qyt,isWritableNodeStream:XQ,isWritableStream:Gyt,isWritableEnded:Yyt,isWritableFinished:Zwr,isWritableErrored:e0r,isServerRequest:n0r,isServerResponse:tbt,willEmitClose:o0r,isTransformStream:Jyt}});var wO=v((evo,pxe)=>{var nA=rA(),{AbortError:dbt,codes:s0r}=Kf(),{ERR_INVALID_ARG_TYPE:u0r,ERR_STREAM_PREMATURE_CLOSE:nbt}=s0r,{kEmptyObject:cxe,once:dxe}=Gd(),{validateAbortSignal:l0r,validateFunction:c0r,validateObject:d0r,validateBoolean:f0r}=Qk(),{Promise:p0r,PromisePrototypeThen:m0r,SymbolDispose:fbt}=Va(),{isClosed:h0r,isReadable:obt,isReadableNodeStream:lxe,isReadableStream:g0r,isReadableFinished:ibt,isReadableErrored:abt,isWritable:sbt,isWritableNodeStream:ubt,isWritableStream:y0r,isWritableFinished:lbt,isWritableErrored:cbt,isNodeStream:b0r,willEmitClose:_0r,kIsClosedPromise:v0r}=z_(),t$;function w0r(t){return t.setHeader&&typeof t.abort=="function"}var fxe=()=>{};function pbt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=cxe):e==null?e=cxe:d0r(e,"options"),c0r(r,"callback"),l0r(e.signal,"options.signal"),r=dxe(r),g0r(t)||y0r(t))return S0r(t,e,r);if(!b0r(t))throw new u0r("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:lxe(t),a=(o=e.writable)!==null&&o!==void 0?o:ubt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=_0r(t)&&lxe(t)===i&&ubt(t)===a,d=lbt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=ibt(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=h0r(t),g=()=>{b=!0;let O=cbt(t)||abt(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&lxe(t,!0)&&!ibt(t,!1))return r.call(t,new nbt);if(a&&!d&&!lbt(t,!1))return r.call(t,new nbt);r.call(t)},y=()=>{b=!0;let O=cbt(t)||abt(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},S=()=>{t.req.on("finish",f)};w0r(t)?(t.on("complete",f),c||t.on("abort",g),t.req?S():t.on("request",S)):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?nA.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||nA.nextTick(y):(!i&&(!c||obt(t))&&(d||sbt(t)===!1)||!a&&(!c||sbt(t))&&(p||obt(t)===!1)||u&&t.req&&t.aborted)&&nA.nextTick(y);let x=()=>{r=fxe,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",S),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 P=r;x(),P.call(t,new dbt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)nA.nextTick(O);else{t$=t$||Gd().addAbortListener;let P=t$(e.signal,O),E=r;r=dxe((...A)=>{P[fbt](),E.apply(t,A)})}}return x}function S0r(t,e,r){let n=!1,o=fxe;if(e.signal)if(o=()=>{n=!0,r.call(t,new dbt(void 0,{cause:e.signal.reason}))},e.signal.aborted)nA.nextTick(o);else{t$=t$||Gd().addAbortListener;let a=t$(e.signal,o),s=r;r=dxe((...u)=>{a[fbt](),s.apply(t,u)})}let i=(...a)=>{n||nA.nextTick(()=>r.apply(t,a))};return m0r(t[v0r].promise,i,i),fxe}function x0r(t,e){var r;let n=!1;return e===null&&(e=cxe),(r=e)!==null&&r!==void 0&&r.cleanup&&(f0r(e.cleanup,"cleanup"),n=e.cleanup),new p0r((o,i)=>{let a=pbt(t,e,s=>{n&&a(),s?i(s):o()})})}pxe.exports=pbt;pxe.exports.finished=x0r});var Q1=v((tvo,wbt)=>{"use strict";var H_=rA(),{aggregateTwoErrors:C0r,codes:{ERR_MULTIPLE_CALLBACK:O0r},AbortError:P0r}=Kf(),{Symbol:gbt}=Va(),{kIsDestroyed:E0r,isDestroyed:T0r,isFinished:A0r,isServerRequest:I0r}=z_(),ybt=gbt("kDestroy"),mxe=gbt("kConstruct");function bbt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function M0r(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):(bbt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?mbt(this,t,e):this.once(ybt,function(i){mbt(this,C0r(i,t),e)}),this)}function mbt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;bbt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?H_.nextTick(R0r,t,i):H_.nextTick(_bt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function R0r(t,e){hxe(t,e),_bt(t)}function _bt(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 hxe(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 j0r(){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 gxe(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?H_.nextTick(hxe,t,e):hxe(t,e))}function N0r(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(mxe,e),!(t.listenerCount(mxe)>1)&&H_.nextTick(D0r,t)}function D0r(t){let e=!1;function r(n){if(e){gxe(t,n??new O0r);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(ybt,n):n?gxe(t,n,!0):H_.nextTick(L0r,t)}try{t._construct(n=>{H_.nextTick(r,n)})}catch(n){H_.nextTick(r,n)}}function L0r(t){t.emit(mxe)}function hbt(t){return t?.setHeader&&typeof t.abort=="function"}function vbt(t){t.emit("close")}function F0r(t,e){t.emit("error",e),H_.nextTick(vbt,t)}function k0r(t,e){!t||T0r(t)||(!e&&!A0r(t)&&(e=new P0r),I0r(t)?(t.socket=null,t.destroy(e)):hbt(t)?t.abort():hbt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?H_.nextTick(F0r,t,e):H_.nextTick(vbt,t),t.destroyed||(t[E0r]=!0))}wbt.exports={construct:N0r,destroyer:k0r,destroy:M0r,undestroy:j0r,errorOrDestroy:gxe}});var ree=v((rvo,xbt)=>{"use strict";var{ArrayIsArray:$0r,ObjectSetPrototypeOf:Sbt}=Va(),{EventEmitter:eee}=LH();function tee(t){eee.call(this,t)}Sbt(tee.prototype,eee.prototype);Sbt(tee,eee);tee.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(),eee.listenerCount(this,"error")===0&&this.emit("error",c)}yxe(r,"error",u),yxe(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 yxe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):$0r(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}xbt.exports={Stream:tee,prependListener:yxe}});var FH=v((nvo,nee)=>{"use strict";var{SymbolDispose:B0r}=Va(),{AbortError:Cbt,codes:q0r}=Kf(),{isNodeStream:Obt,isWebStream:U0r,kControllerErrorFunction:z0r}=z_(),H0r=wO(),{ERR_INVALID_ARG_TYPE:Pbt}=q0r,bxe,V0r=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Pbt(e,"AbortSignal",t)};nee.exports.addAbortSignal=function(e,r){if(V0r(e,"signal"),!Obt(r)&&!U0r(r))throw new Pbt("stream",["ReadableStream","WritableStream","Stream"],r);return nee.exports.addAbortSignalNoValidate(e,r)};nee.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Obt(e)?()=>{e.destroy(new Cbt(void 0,{cause:t.reason}))}:()=>{e[z0r](new Cbt(void 0,{cause:t.reason}))};if(t.aborted)r();else{bxe=bxe||Gd().addAbortListener;let n=bxe(t,r);H0r(e,n[B0r])}return e}});var Abt=v((ivo,Tbt)=>{"use strict";var{StringPrototypeSlice:Ebt,SymbolIterator:W0r,TypedArrayPrototypeSet:oee,Uint8Array:K0r}=Va(),{Buffer:_xe}=Pp(),{inspect:G0r}=Gd();Tbt.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 _xe.alloc(0);let r=_xe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)oee(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}*[W0r](){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+=Ebt(i,0,e),this.head=n,n.data=Ebt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=_xe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)oee(r,a,n-e),e-=a.length;else{e===a.length?(oee(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(oee(r,new K0r(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 G0r(this,{...r,depth:0,customInspect:!1})}}});var kH=v((avo,jbt)=>{"use strict";var{MathFloor:J0r,NumberIsInteger:Y0r}=Va(),{validateInteger:Z0r}=Qk(),{ERR_INVALID_ARG_VALUE:X0r}=Kf().codes,Ibt=16*1024,Mbt=16;function Q0r(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Rbt(t){return t?Mbt:Ibt}function eSr(t,e){Z0r(e,"value",0),t?Mbt=e:Ibt=e}function tSr(t,e,r,n){let o=Q0r(e,n,r);if(o!=null){if(!Y0r(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new X0r(i,o)}return J0r(o)}return Rbt(t.objectMode)}jbt.exports={getHighWaterMark:tSr,getDefaultHighWaterMark:Rbt,setDefaultHighWaterMark:eSr}});var Lbt=v((vxe,Dbt)=>{var iee=Pp(),V_=iee.Buffer;function Nbt(t,e){for(var r in t)e[r]=t[r]}V_.from&&V_.alloc&&V_.allocUnsafe&&V_.allocUnsafeSlow?Dbt.exports=iee:(Nbt(iee,vxe),vxe.Buffer=ej);function ej(t,e,r){return V_(t,e,r)}ej.prototype=Object.create(V_.prototype);Nbt(V_,ej);ej.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return V_(t,e,r)};ej.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=V_(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};ej.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return V_(t)};ej.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return iee.SlowBuffer(t)}});var $bt=v(kbt=>{"use strict";var Sxe=Lbt().Buffer,Fbt=Sxe.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 rSr(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 nSr(t){var e=rSr(t);if(typeof e!="string"&&(Sxe.isEncoding===Fbt||!Fbt(t)))throw new Error("Unknown encoding: "+t);return e||t}kbt.StringDecoder=$H;function $H(t){this.encoding=nSr(t);var e;switch(this.encoding){case"utf16le":this.text=lSr,this.end=cSr,e=4;break;case"utf8":this.fillLast=aSr,e=4;break;case"base64":this.text=dSr,this.end=fSr,e=3;break;default:this.write=pSr,this.end=mSr;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Sxe.allocUnsafe(e)}$H.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||""};$H.prototype.end=uSr;$H.prototype.text=sSr;$H.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 wxe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function oSr(t,e,r){var n=e.length-1;if(n<r)return 0;var o=wxe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=wxe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=wxe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function iSr(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 aSr(t){var e=this.lastTotal-this.lastNeed,r=iSr(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 sSr(t,e){var r=oSr(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 uSr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function lSr(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 cSr(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 dSr(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 fSr(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function pSr(t){return t.toString(this.encoding)}function mSr(t){return t&&t.length?this.write(t):""}});var xxe=v((uvo,zbt)=>{"use strict";var Bbt=rA(),{PromisePrototypeThen:hSr,SymbolAsyncIterator:qbt,SymbolIterator:Ubt}=Va(),{Buffer:gSr}=Pp(),{ERR_INVALID_ARG_TYPE:ySr,ERR_STREAM_NULL_VALUES:bSr}=Kf().codes;function _Sr(t,e,r){let n;if(typeof e=="string"||e instanceof gSr)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[qbt])o=!0,n=e[qbt]();else if(e&&e[Ubt])o=!1,n=e[Ubt]();else throw new ySr("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){hSr(s(l),()=>Bbt.nextTick(c,l),d=>Bbt.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 bSr;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}zbt.exports=_Sr});var qH=v((lvo,s_t)=>{var Ly=rA(),{ArrayPrototypeIndexOf:vSr,NumberIsInteger:wSr,NumberIsNaN:SSr,NumberParseInt:xSr,ObjectDefineProperties:Mxe,ObjectKeys:CSr,ObjectSetPrototypeOf:Wbt,Promise:Kbt,SafeSet:OSr,SymbolAsyncDispose:PSr,SymbolAsyncIterator:ESr,Symbol:TSr}=Va();s_t.exports=cn;cn.ReadableState=lee;var{EventEmitter:ASr}=LH(),{Stream:oA,prependListener:ISr}=ree(),{Buffer:Cxe}=Pp(),{addAbortSignal:MSr}=FH(),Gbt=wO(),jn=Gd().debuglog("stream",t=>{jn=t}),RSr=Abt(),o$=Q1(),{getHighWaterMark:jSr,getDefaultHighWaterMark:NSr}=kH(),{aggregateTwoErrors:Hbt,codes:{ERR_INVALID_ARG_TYPE:DSr,ERR_METHOD_NOT_IMPLEMENTED:LSr,ERR_OUT_OF_RANGE:FSr,ERR_STREAM_PUSH_AFTER_EOF:kSr,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:$Sr},AbortError:BSr}=Kf(),{validateObject:qSr}=Qk(),tj=TSr("kPaused"),{StringDecoder:Jbt}=$bt(),USr=xxe();Wbt(cn.prototype,oA.prototype);Wbt(cn,oA);var Oxe=()=>{},{errorOrDestroy:r$}=o$,n$=1,zSr=2,Ybt=4,BH=8,Zbt=16,aee=32,see=64,Xbt=128,HSr=256,VSr=512,WSr=1024,Axe=2048,Ixe=4096,KSr=8192,GSr=16384,JSr=32768,Qbt=65536,YSr=1<<17,ZSr=1<<18;function Al(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Mxe(lee.prototype,{objectMode:Al(n$),ended:Al(zSr),endEmitted:Al(Ybt),reading:Al(BH),constructed:Al(Zbt),sync:Al(aee),needReadable:Al(see),emittedReadable:Al(Xbt),readableListening:Al(HSr),resumeScheduled:Al(VSr),errorEmitted:Al(WSr),emitClose:Al(Axe),autoDestroy:Al(Ixe),destroyed:Al(KSr),closed:Al(GSr),closeEmitted:Al(JSr),multiAwaitDrain:Al(Qbt),readingMore:Al(YSr),dataEmitted:Al(ZSr)});function lee(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.state=Axe|Ixe|Zbt|aee,t&&t.objectMode&&(this.state|=n$),r&&t&&t.readableObjectMode&&(this.state|=n$),this.highWaterMark=t?jSr(this,t,"readableHighWaterMark",r):NSr(!1),this.buffer=new RSr,this.length=0,this.pipes=[],this.flowing=null,this[tj]=null,t&&t.emitClose===!1&&(this.state&=~Axe),t&&t.autoDestroy===!1&&(this.state&=~Ixe),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Jbt(t.encoding),this.encoding=t.encoding)}function cn(t){if(!(this instanceof cn))return new cn(t);let e=this instanceof W_();this._readableState=new lee(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&&MSr(t.signal,this)),oA.call(this,t),o$.construct(this,()=>{this._readableState.needReadable&&uee(this,this._readableState)})}cn.prototype.destroy=o$.destroy;cn.prototype._undestroy=o$.undestroy;cn.prototype._destroy=function(t,e){e(t)};cn.prototype[ASr.captureRejectionSymbol]=function(t){this.destroy(t)};cn.prototype[PSr]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new BSr,this.destroy(t)),new Kbt((e,r)=>Gbt(this,n=>n&&n!==t?r(n):e(null)))};cn.prototype.push=function(t,e){return e_t(this,t,e,!1)};cn.prototype.unshift=function(t,e){return e_t(this,t,e,!0)};function e_t(t,e,r,n){jn("readableAddChunk",e);let o=t._readableState,i;if((o.state&n$)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=Cxe.from(e,r).toString(o.encoding):(e=Cxe.from(e,r),r=""))):e instanceof Cxe?r="":oA._isUint8Array(e)?(e=oA._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new DSr("chunk",["string","Buffer","Uint8Array"],e))),i)r$(t,i);else if(e===null)o.state&=~BH,exr(t,o);else if((o.state&n$)!==0||e&&e.length>0)if(n)if((o.state&Ybt)!==0)r$(t,new $Sr);else{if(o.destroyed||o.errored)return!1;Pxe(t,o,e,!0)}else if(o.ended)r$(t,new kSr);else{if(o.destroyed||o.errored)return!1;o.state&=~BH,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?Pxe(t,o,e,!1):uee(t,o)):Pxe(t,o,e,!1)}else n||(o.state&=~BH,uee(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function Pxe(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Qbt)!==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&see)!==0&&cee(t)),uee(t,e)}cn.prototype.isPaused=function(){let t=this._readableState;return t[tj]===!0||t.flowing===!1};cn.prototype.setEncoding=function(t){let e=new Jbt(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 XSr=1073741824;function QSr(t){if(t>XSr)throw new FSr("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Vbt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&n$)!==0?1:SSr(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}cn.prototype.read=function(t){jn("read",t),t===void 0?t=NaN:wSr(t)||(t=xSr(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=QSr(t)),t!==0&&(e.state&=~Xbt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return jn("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Exe(this):cee(this),null;if(t=Vbt(t,e),t===0&&e.ended)return e.length===0&&Exe(this),null;let n=(e.state&see)!==0;if(jn("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,jn("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,jn("reading, ended or constructing",n);else if(n){jn("do read"),e.state|=BH|aee,e.length===0&&(e.state|=see);try{this._read(e.highWaterMark)}catch(i){r$(this,i)}e.state&=~aee,e.reading||(t=Vbt(r,e))}let o;return t>0?o=i_t(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&&Exe(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function exr(t,e){if(jn("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?cee(t):(e.needReadable=!1,e.emittedReadable=!0,t_t(t))}}function cee(t){let e=t._readableState;jn("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(jn("emitReadable",e.flowing),e.emittedReadable=!0,Ly.nextTick(t_t,t))}function t_t(t){let e=t._readableState;jn("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,n_t(t)}function uee(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ly.nextTick(txr,t,e))}function txr(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(jn("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}cn.prototype._read=function(t){throw new LSr("_read()")};cn.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new OSr(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),jn("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==Ly.stdout&&t!==Ly.stderr?s:b;n.endEmitted?Ly.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,y){jn("onunpipe"),g===r&&y&&y.hasUnpiped===!1&&(y.hasUnpiped=!0,c())}function s(){jn("onend"),t.end()}let u,l=!1;function c(){jn("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?(jn("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(jn("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=rxr(r,t),t.on("drain",u))}r.on("data",f);function f(g){jn("ondata");let y=t.write(g);jn("dest.write",y),y===!1&&d()}function p(g){if(jn("onerror",g),b(),t.removeListener("error",p),t.listenerCount("error")===0){let y=t._writableState||t._readableState;y&&!y.errorEmitted?r$(t,g):t.emit("error",g)}}ISr(t,"error",p);function m(){t.removeListener("finish",h),b()}t.once("close",m);function h(){jn("onfinish"),t.removeListener("close",m),b()}t.once("finish",h);function b(){jn("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(jn("pipe resume"),r.resume()),t};function rxr(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(jn("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(jn("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}cn.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=vSr(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};cn.prototype.on=function(t,e){let r=oA.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,jn("on readable",n.length,n.reading),n.length?cee(this):n.reading||Ly.nextTick(nxr,this)),r};cn.prototype.addListener=cn.prototype.on;cn.prototype.removeListener=function(t,e){let r=oA.prototype.removeListener.call(this,t,e);return t==="readable"&&Ly.nextTick(r_t,this),r};cn.prototype.off=cn.prototype.removeListener;cn.prototype.removeAllListeners=function(t){let e=oA.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ly.nextTick(r_t,this),e};function r_t(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[tj]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function nxr(t){jn("readable nexttick read 0"),t.read(0)}cn.prototype.resume=function(){let t=this._readableState;return t.flowing||(jn("resume"),t.flowing=!t.readableListening,oxr(this,t)),t[tj]=!1,this};function oxr(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ly.nextTick(ixr,t,e))}function ixr(t,e){jn("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),n_t(t),e.flowing&&!e.reading&&t.read(0)}cn.prototype.pause=function(){return jn("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(jn("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[tj]=!0,this};function n_t(t){let e=t._readableState;for(jn("flow",e.flowing);e.flowing&&t.read()!==null;);}cn.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=>{r$(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=CSr(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};cn.prototype[ESr]=function(){return o_t(this)};cn.prototype.iterator=function(t){return t!==void 0&&qSr(t,"options"),o_t(this,t)};function o_t(t,e){typeof t.read!="function"&&(t=cn.wrap(t,{objectMode:!0}));let r=axr(t,e);return r.stream=t,r}async function*axr(t,e){let r=Oxe;function n(a){this===t?(r(),r=Oxe):r=a}t.on("readable",n);let o,i=Gbt(t,{writable:!1},a=>{o=a?Hbt(o,a):null,r(),r=Oxe});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 Kbt(n)}}}catch(a){throw o=Hbt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?o$.destroyer(t,null):(t.off("readable",n),i())}}Mxe(cn.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}}});Mxe(lee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[tj]!==!1},set(t){this[tj]=!!t}}});cn._fromList=i_t;function i_t(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 Exe(t){let e=t._readableState;jn("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ly.nextTick(sxr,e,t))}function sxr(t,e){if(jn("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)Ly.nextTick(uxr,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function uxr(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}cn.from=function(t,e){return USr(cn,t,e)};var Txe;function a_t(){return Txe===void 0&&(Txe={}),Txe}cn.fromWeb=function(t,e){return a_t().newStreamReadableFromReadableStream(t,e)};cn.toWeb=function(t,e){return a_t().newReadableStreamFromStreamReadable(t,e)};cn.wrap=function(t,e){var r,n;return new cn({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){o$.destroyer(t,o),i(o)}}).wrap(t)}});var hee=v((cvo,__t)=>{var rj=rA(),{ArrayPrototypeSlice:c_t,Error:lxr,FunctionPrototypeSymbolHasInstance:d_t,ObjectDefineProperty:f_t,ObjectDefineProperties:cxr,ObjectSetPrototypeOf:p_t,StringPrototypeToLowerCase:dxr,Symbol:fxr,SymbolHasInstance:pxr}=Va();__t.exports=Wa;Wa.WritableState=HH;var{EventEmitter:mxr}=LH(),UH=ree().Stream,{Buffer:dee}=Pp(),mee=Q1(),{addAbortSignal:hxr}=FH(),{getHighWaterMark:gxr,getDefaultHighWaterMark:yxr}=kH(),{ERR_INVALID_ARG_TYPE:bxr,ERR_METHOD_NOT_IMPLEMENTED:_xr,ERR_MULTIPLE_CALLBACK:m_t,ERR_STREAM_CANNOT_PIPE:vxr,ERR_STREAM_DESTROYED:zH,ERR_STREAM_ALREADY_FINISHED:wxr,ERR_STREAM_NULL_VALUES:Sxr,ERR_STREAM_WRITE_AFTER_END:xxr,ERR_UNKNOWN_ENCODING:h_t}=Kf().codes,{errorOrDestroy:i$}=mee;p_t(Wa.prototype,UH.prototype);p_t(Wa,UH);function Nxe(){}var a$=fxr("kOnFinished");function HH(t,e,r){typeof r!="boolean"&&(r=e instanceof W_()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?gxr(this,t,"writableHighWaterMark",r):yxr(!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=Oxr.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,pee(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[a$]=[]}function pee(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}HH.prototype.getBuffer=function(){return c_t(this.buffered,this.bufferedIndex)};f_t(HH.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Wa(t){let e=this instanceof W_();if(!e&&!d_t(Wa,this))return new Wa(t);this._writableState=new HH(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&&hxr(t.signal,this)),UH.call(this,t),mee.construct(this,()=>{let r=this._writableState;r.writing||Lxe(this,r),Fxe(this,r)})}f_t(Wa,pxr,{__proto__:null,value:function(t){return d_t(this,t)?!0:this!==Wa?!1:t&&t._writableState instanceof HH}});Wa.prototype.pipe=function(){i$(this,new vxr)};function g_t(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"&&!dee.isEncoding(r))throw new h_t(r);typeof n!="function"&&(n=Nxe)}if(e===null)throw new Sxr;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=dee.from(e,r),r="buffer");else if(e instanceof dee)r="buffer";else if(UH._isUint8Array(e))e=UH._uint8ArrayToBuffer(e),r="buffer";else throw new bxr("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new xxr:o.destroyed&&(i=new zH("write")),i?(rj.nextTick(n,i),i$(t,i,!0),i):(o.pendingcb++,Cxr(t,o,e,r,n))}Wa.prototype.write=function(t,e,r){return g_t(this,t,e,r)===!0};Wa.prototype.cork=function(){this._writableState.corked++};Wa.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Lxe(this,t))};Wa.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=dxr(e)),!dee.isEncoding(e))throw new h_t(e);return this._writableState.defaultEncoding=e,this};function Cxr(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!==Nxe&&(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 u_t(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new zH("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function l_t(t,e,r,n){--e.pendingcb,n(r),Dxe(e),i$(t,r)}function Oxr(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){i$(t,new m_t);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?rj.nextTick(l_t,t,r,e,o):l_t(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&Lxe(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},rj.nextTick(Pxr,r.afterWriteTickInfo)):y_t(t,r,1,o))}function Pxr({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,y_t(t,e,r,n)}function y_t(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&&Dxe(e),Fxe(t,e)}function Dxe(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 zH("write"))}let r=t[a$].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new zH("end"))}pee(t)}function Lxe(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?Nxe:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:c_t(r,a);u.allBuffers=e.allBuffers,u_t(t,e,!0,e.length,u,"",s),pee(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;u_t(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?pee(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Wa.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new _xr("_write()")};Wa.prototype._writev=null;Wa.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=g_t(this,t,e);i instanceof lxr&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,Fxe(this,n,!0),n.ended=!0):n.finished?o=new wxr("end"):n.destroyed&&(o=new zH("end"))),typeof r=="function"&&(o||n.finished?rj.nextTick(r,o):n[a$].push(r)),this};function fee(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 Exr(t,e){let r=!1;function n(o){if(r){i$(t,o??m_t());return}if(r=!0,e.pendingcb--,o){let i=e[a$].splice(0);for(let a=0;a<i.length;a++)i[a](o);i$(t,o,e.sync)}else fee(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,rj.nextTick(jxe,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function Txr(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Exr(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Fxe(t,e,r){fee(e)&&(Txr(t,e),e.pendingcb===0&&(r?(e.pendingcb++,rj.nextTick((n,o)=>{fee(o)?jxe(n,o):o.pendingcb--},t,e)):fee(e)&&(e.pendingcb++,jxe(t,e))))}function jxe(t,e){e.pendingcb--,e.finished=!0;let r=e[a$].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()}}cxr(Wa.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 Axr=mee.destroy;Wa.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[a$].length)&&rj.nextTick(Dxe,r),Axr.call(this,t,e),this};Wa.prototype._undestroy=mee.undestroy;Wa.prototype._destroy=function(t,e){e(t)};Wa.prototype[mxr.captureRejectionSymbol]=function(t){this.destroy(t)};var Rxe;function b_t(){return Rxe===void 0&&(Rxe={}),Rxe}Wa.fromWeb=function(t,e){return b_t().newStreamWritableFromWritableStream(t,e)};Wa.toWeb=function(t){return b_t().newWritableStreamFromStreamWritable(t)}});var N_t=v((dvo,j_t)=>{var kxe=rA(),Ixr=Pp(),{isReadable:Mxr,isWritable:Rxr,isIterable:v_t,isNodeStream:jxr,isReadableNodeStream:w_t,isWritableNodeStream:S_t,isDuplexNodeStream:Nxr,isReadableStream:x_t,isWritableStream:C_t}=z_(),O_t=wO(),{AbortError:M_t,codes:{ERR_INVALID_ARG_TYPE:Dxr,ERR_INVALID_RETURN_VALUE:P_t}}=Kf(),{destroyer:u$}=Q1(),Lxr=W_(),R_t=qH(),Fxr=hee(),{createDeferredPromise:E_t}=Gd(),T_t=xxe(),A_t=globalThis.Blob||Ixr.Blob,kxr=typeof A_t<"u"?function(e){return e instanceof A_t}:function(e){return!1},$xr=globalThis.AbortController||Yk().AbortController,{FunctionPrototypeCall:I_t}=Va(),iA=class extends Lxr{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)}};j_t.exports=function t(e,r){if(Nxr(e))return e;if(w_t(e))return s$({readable:e});if(S_t(e))return s$({writable:e});if(jxr(e))return s$({writable:!1,readable:!1});if(x_t(e))return s$({readable:R_t.fromWeb(e)});if(C_t(e))return s$({writable:Fxr.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Bxr(e);if(v_t(o))return T_t(iA,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=I_t(u,o,d=>{if(d!=null)throw new P_t("nully","body",d)},d=>{u$(l,d)});return l=new iA({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,kxe.nextTick(d,null)}catch(f){kxe.nextTick(d,f)}})},destroy:s})}throw new P_t("Iterable, AsyncIterable or AsyncFunction",r,o)}if(kxr(e))return t(e.arrayBuffer());if(v_t(e))return T_t(iA,e,{objectMode:!0,writable:!1});if(x_t(e?.readable)&&C_t(e?.writable))return iA.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?w_t(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?S_t(e?.writable)?e?.writable:t(e.writable):void 0;return s$({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return I_t(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{u$(o,i)}),o=new iA({objectMode:!0,writable:!1,read(){}})}throw new Dxr(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Bxr(t){let{promise:e,resolve:r}=E_t(),n=new $xr,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(kxe.nextTick(l),u)return;if(o.aborted)throw new M_t(void 0,{cause:o.reason});({promise:e,resolve:r}=E_t()),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 s$(t){let e=t.readable&&typeof t.readable.read!="function"?R_t.wrap(t.readable):t.readable,r=t.writable,n=!!Mxr(e),o=!!Rxr(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new iA({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(O_t(r,d=>{o=!1,d&&u$(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&&(O_t(e,d=>{n=!1,d&&u$(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 M_t),s=null,i=null,a=null,u===null?f(d):(u=f,u$(r,d),u$(e,d))},l}});var W_=v((fvo,F_t)=>{"use strict";var{ObjectDefineProperties:qxr,ObjectGetOwnPropertyDescriptor:SO,ObjectKeys:Uxr,ObjectSetPrototypeOf:D_t}=Va();F_t.exports=Fy;var qxe=qH(),ng=hee();D_t(Fy.prototype,qxe.prototype);D_t(Fy,qxe);{let t=Uxr(ng.prototype);for(let e=0;e<t.length;e++){let r=t[e];Fy.prototype[r]||(Fy.prototype[r]=ng.prototype[r])}}function Fy(t){if(!(this instanceof Fy))return new Fy(t);qxe.call(this,t),ng.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}qxr(Fy.prototype,{writable:{__proto__:null,...SO(ng.prototype,"writable")},writableHighWaterMark:{__proto__:null,...SO(ng.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...SO(ng.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...SO(ng.prototype,"writableBuffer")},writableLength:{__proto__:null,...SO(ng.prototype,"writableLength")},writableFinished:{__proto__:null,...SO(ng.prototype,"writableFinished")},writableCorked:{__proto__:null,...SO(ng.prototype,"writableCorked")},writableEnded:{__proto__:null,...SO(ng.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...SO(ng.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 $xe;function L_t(){return $xe===void 0&&($xe={}),$xe}Fy.fromWeb=function(t,e){return L_t().newStreamDuplexFromReadableWritablePair(t,e)};Fy.toWeb=function(t){return L_t().newReadableWritablePairFromDuplex(t)};var Bxe;Fy.from=function(t){return Bxe||(Bxe=N_t()),Bxe(t,"body")}});var Hxe=v((pvo,$_t)=>{"use strict";var{ObjectSetPrototypeOf:k_t,Symbol:zxr}=Va();$_t.exports=xO;var{ERR_METHOD_NOT_IMPLEMENTED:Hxr}=Kf().codes,zxe=W_(),{getHighWaterMark:Vxr}=kH();k_t(xO.prototype,zxe.prototype);k_t(xO,zxe);var VH=zxr("kCallback");function xO(t){if(!(this instanceof xO))return new xO(t);let e=t?Vxr(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),zxe.call(this,t),this._readableState.sync=!1,this[VH]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Wxr)}function Uxe(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 Wxr(){this._final!==Uxe&&Uxe.call(this)}xO.prototype._final=Uxe;xO.prototype._transform=function(t,e,r){throw new Hxr("_transform()")};xO.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[VH]=r})};xO.prototype._read=function(){if(this[VH]){let t=this[VH];this[VH]=null,t()}}});var Wxe=v((mvo,q_t)=>{"use strict";var{ObjectSetPrototypeOf:B_t}=Va();q_t.exports=l$;var Vxe=Hxe();B_t(l$.prototype,Vxe.prototype);B_t(l$,Vxe);function l$(t){if(!(this instanceof l$))return new l$(t);Vxe.call(this,t)}l$.prototype._transform=function(t,e,r){r(null,t)}});var _ee=v((hvo,W_t)=>{var WH=rA(),{ArrayIsArray:Kxr,Promise:Gxr,SymbolAsyncIterator:Jxr,SymbolDispose:Yxr}=Va(),bee=wO(),{once:Zxr}=Gd(),Xxr=Q1(),U_t=W_(),{aggregateTwoErrors:Qxr,codes:{ERR_INVALID_ARG_TYPE:tCe,ERR_INVALID_RETURN_VALUE:Kxe,ERR_MISSING_ARGS:eCr,ERR_STREAM_DESTROYED:tCr,ERR_STREAM_PREMATURE_CLOSE:rCr},AbortError:nCr}=Kf(),{validateFunction:oCr,validateAbortSignal:iCr}=Qk(),{isIterable:nj,isReadable:Gxe,isReadableNodeStream:yee,isNodeStream:z_t,isTransformStream:c$,isWebStream:aCr,isReadableStream:Jxe,isReadableFinished:sCr}=z_(),uCr=globalThis.AbortController||Yk().AbortController,Yxe,Zxe,Xxe;function H_t(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=bee(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,Xxr.destroyer(t,i||new tCr("pipe")))},cleanup:o}}function lCr(t){return oCr(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Qxe(t){if(nj(t))return t;if(yee(t))return cCr(t);throw new tCe("val",["Readable","Iterable","AsyncIterable"],t)}async function*cCr(t){Zxe||(Zxe=qH()),yield*Zxe.prototype[Jxr].call(t)}async function gee(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new Gxr((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=bee(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?Qxr(o,l):l)}finally{u(),e.off("drain",a)}}async function eCe(t,e,r,{end:n}){c$(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 dCr(...t){return V_t(t,Zxr(lCr(t)))}function V_t(t,e,r){if(t.length===1&&Kxr(t[0])&&(t=t[0]),t.length<2)throw new eCr("streams");let n=new uCr,o=n.signal,i=r?.signal,a=[];iCr(i,"options.signal");function s(){m(new nCr)}Xxe=Xxe||Gd().addAbortListener;let u;i&&(u=Xxe(i,s));let l,c,d=[],f=0;function p(S){m(S,--f===0)}function m(S,x){var O;if(S&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=S),!(!l&&!x)){for(;d.length;)d.shift()(l);(O=u)===null||O===void 0||O[Yxr](),n.abort(),x&&(l||a.forEach(P=>P()),WH.nextTick(e,l,c))}}let h;for(let S=0;S<t.length;S++){let x=t[S],O=S<t.length-1,P=S>0,E=O||r?.end!==!1,A=S===t.length-1;if(z_t(x)){let I=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var y=I;if(E){let{destroy:R,cleanup:N}=H_t(x,O,P);d.push(R),Gxe(x)&&A&&a.push(N)}x.on("error",I),Gxe(x)&&A&&a.push(()=>{x.removeListener("error",I)})}if(S===0)if(typeof x=="function"){if(h=x({signal:o}),!nj(h))throw new Kxe("Iterable, AsyncIterable or Stream","source",h)}else nj(x)||yee(x)||c$(x)?h=x:h=U_t.from(x);else if(typeof x=="function"){if(c$(h)){var b;h=Qxe((b=h)===null||b===void 0?void 0:b.readable)}else h=Qxe(h);if(h=x(h,{signal:o}),O){if(!nj(h,!0))throw new Kxe("AsyncIterable",`transform[${S-1}]`,h)}else{var g;Yxe||(Yxe=Wxe());let I=new Yxe({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($),E&&I.end(),WH.nextTick(p)},$=>{I.destroy($),WH.nextTick(p,$)});else if(nj(h,!0))f++,gee(h,I,p,{end:E});else if(Jxe(h)||c$(h)){let $=h.readable||h;f++,gee($,I,p,{end:E})}else throw new Kxe("AsyncIterable or Promise","destination",h);h=I;let{destroy:N,cleanup:j}=H_t(h,!1,!0);d.push(N),A&&a.push(j)}}else if(z_t(x)){if(yee(h)){f+=2;let I=fCr(h,x,p,{end:E});Gxe(x)&&A&&a.push(I)}else if(c$(h)||Jxe(h)){let I=h.readable||h;f++,gee(I,x,p,{end:E})}else if(nj(h))f++,gee(h,x,p,{end:E});else throw new tCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else if(aCr(x)){if(yee(h))f++,eCe(Qxe(h),x,p,{end:E});else if(Jxe(h)||nj(h))f++,eCe(h,x,p,{end:E});else if(c$(h))f++,eCe(h.readable,x,p,{end:E});else throw new tCe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=x}else h=U_t.from(x)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&WH.nextTick(s),h}function fCr(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new rCr)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;sCr(t)?WH.nextTick(a):t.once("end",a)}else r();return bee(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)}),bee(e,{readable:!1,writable:!0},r)}W_t.exports={pipelineImpl:V_t,pipeline:dCr}});var nCe=v((gvo,X_t)=>{"use strict";var{pipeline:pCr}=_ee(),vee=W_(),{destroyer:mCr}=Q1(),{isNodeStream:wee,isReadable:K_t,isWritable:G_t,isWebStream:rCe,isTransformStream:oj,isWritableStream:J_t,isReadableStream:Y_t}=z_(),{AbortError:hCr,codes:{ERR_INVALID_ARG_VALUE:Z_t,ERR_MISSING_ARGS:gCr}}=Kf(),yCr=wO();X_t.exports=function(...e){if(e.length===0)throw new gCr("streams");if(e.length===1)return vee.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=vee.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=vee.from(e[p])}for(let p=0;p<e.length;++p)if(!(!wee(e[p])&&!rCe(e[p]))){if(p<e.length-1&&!(K_t(e[p])||Y_t(e[p])||oj(e[p])))throw new Z_t(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(G_t(e[p])||J_t(e[p])||oj(e[p])))throw new Z_t(`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=pCr(e,u),d=!!(G_t(l)||J_t(l)||oj(l)),f=!!(K_t(c)||Y_t(c)||oj(c));if(s=new vee({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(wee(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(rCe(l)){let h=(oj(l)?l.writable:l).getWriter();s._write=async function(b,g,y){try{await h.ready,h.write(b).catch(()=>{}),y()}catch(S){y(S)}},s._final=async function(b){try{await h.ready,h.close().catch(()=>{}),o=b}catch(g){b(g)}}}let p=oj(c)?c.readable:c;yCr(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(wee(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(rCe(c)){let m=(oj(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 hCr),i=null,n=null,o=null,a===null?m(p):(a=m,wee(c)&&mCr(c,p))},s}});var uvt=v((yvo,aCe)=>{"use strict";var bCr=globalThis.AbortController||Yk().AbortController,{codes:{ERR_INVALID_ARG_VALUE:_Cr,ERR_INVALID_ARG_TYPE:KH,ERR_MISSING_ARGS:vCr,ERR_OUT_OF_RANGE:wCr},AbortError:K_}=Kf(),{validateAbortSignal:ij,validateInteger:Q_t,validateObject:aj}=Qk(),SCr=Va().Symbol("kWeak"),xCr=Va().Symbol("kResistStopPropagation"),{finished:CCr}=wO(),OCr=nCe(),{addAbortSignalNoValidate:PCr}=FH(),{isWritable:ECr,isNodeStream:TCr}=z_(),{deprecate:ACr}=Gd(),{ArrayPrototypePush:ICr,Boolean:MCr,MathFloor:evt,Number:RCr,NumberIsNaN:jCr,Promise:tvt,PromiseReject:rvt,PromiseResolve:NCr,PromisePrototypeThen:nvt,Symbol:ivt}=Va(),See=ivt("kEmpty"),ovt=ivt("kEof");function DCr(t,e){if(e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),TCr(t)&&!ECr(t))throw new _Cr("stream",t,"must be writable");let r=OCr(this,t);return e!=null&&e.signal&&PCr(e.signal,r),r}function xee(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=evt(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=evt(e.highWaterMark)),Q_t(r,"options.concurrency",1),Q_t(n,"options.highWaterMark",0),n+=r,async function*(){let i=Gd().AbortSignalAny([e?.signal].filter(MCr)),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 K_;try{if(g=t(g,u),g===See)continue;g=NCr(g)}catch(y){g=rvt(y)}f+=1,nvt(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new tvt(y=>{c=y})}s.push(ovt)}catch(g){let y=rvt(g);nvt(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===ovt)return;if(i.aborted)throw new K_;g!==See&&(yield g),s.shift(),h()}await new tvt(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function LCr(t=void 0){return t!=null&&aj(t,"options"),t?.signal!=null&&ij(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 K_({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function avt(t,e=void 0){for await(let r of iCe.call(this,t,e))return!0;return!1}async function FCr(t,e=void 0){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);return!await avt.call(this,async(...r)=>!await t(...r),e)}async function kCr(t,e){for await(let r of iCe.call(this,t,e))return r}async function $Cr(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),See}for await(let n of xee.call(this,r,e));}function iCe(t,e){if(typeof t!="function")throw new KH("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:See}return xee.call(this,r,e)}var oCe=class extends vCr{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function BCr(t,e,r){var n;if(typeof t!="function")throw new KH("reducer",["Function","AsyncFunction"],t);r!=null&&aj(r,"options"),r?.signal!=null&&ij(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new K_(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await CCr(this.destroy(l)),l}let i=new bCr,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[SCr]:this,[xCr]:!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 K_;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new oCe}finally{i.abort()}return e}async function qCr(t){t!=null&&aj(t,"options"),t?.signal!=null&&ij(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 K_(void 0,{cause:t.signal.reason});ICr(e,n)}return e}function UCr(t,e){let r=xee.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function svt(t){if(t=RCr(t),jCr(t))return 0;if(t<0)throw new wCr("number",">= 0",t);return t}function zCr(t,e=void 0){return e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),t=svt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;t--<=0&&(yield i)}}.call(this)}function HCr(t,e=void 0){return e!=null&&aj(e,"options"),e?.signal!=null&&ij(e.signal,"options.signal"),t=svt(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new K_;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new K_;if(t-- >0&&(yield i),t<=0)return}}.call(this)}aCe.exports.streamReturningOperators={asIndexedPairs:ACr(LCr,"readable.asIndexedPairs will be removed in a future version."),drop:zCr,filter:iCe,flatMap:UCr,map:xee,take:HCr,compose:DCr};aCe.exports.promiseReturningOperators={every:FCr,forEach:$Cr,reduce:BCr,toArray:qCr,some:avt,find:kCr}});var sCe=v((bvo,lvt)=>{"use strict";var{ArrayPrototypePop:VCr,Promise:WCr}=Va(),{isIterable:KCr,isNodeStream:GCr,isWebStream:JCr}=z_(),{pipelineImpl:YCr}=_ee(),{finished:ZCr}=wO();uCe();function XCr(...t){return new WCr((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!GCr(i)&&!KCr(i)&&!JCr(i)){let a=VCr(t);n=a.signal,o=a.end}YCr(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}lvt.exports={finished:ZCr,pipeline:XCr}});var uCe=v((_vo,bvt)=>{var{Buffer:QCr}=Pp(),{ObjectDefineProperty:CO,ObjectKeys:fvt,ReflectApply:pvt}=Va(),{promisify:{custom:mvt}}=Gd(),{streamReturningOperators:cvt,promiseReturningOperators:dvt}=uvt(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:hvt}}=Kf(),eOr=nCe(),{setDefaultHighWaterMark:tOr,getDefaultHighWaterMark:rOr}=kH(),{pipeline:gvt}=_ee(),{destroyer:nOr}=Q1(),yvt=wO(),lCe=sCe(),GH=z_(),la=bvt.exports=ree().Stream;la.isDestroyed=GH.isDestroyed;la.isDisturbed=GH.isDisturbed;la.isErrored=GH.isErrored;la.isReadable=GH.isReadable;la.isWritable=GH.isWritable;la.Readable=qH();for(let t of fvt(cvt)){let r=function(...n){if(new.target)throw hvt();return la.Readable.from(pvt(e,this,n))};cCe=r;let e=cvt[t];CO(r,"name",{__proto__:null,value:e.name}),CO(r,"length",{__proto__:null,value:e.length}),CO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var cCe;for(let t of fvt(dvt)){let r=function(...o){if(new.target)throw hvt();return pvt(e,this,o)};cCe=r;let e=dvt[t];CO(r,"name",{__proto__:null,value:e.name}),CO(r,"length",{__proto__:null,value:e.length}),CO(la.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var cCe;la.Writable=hee();la.Duplex=W_();la.Transform=Hxe();la.PassThrough=Wxe();la.pipeline=gvt;var{addAbortSignal:oOr}=FH();la.addAbortSignal=oOr;la.finished=yvt;la.destroy=nOr;la.compose=eOr;la.setDefaultHighWaterMark=tOr;la.getDefaultHighWaterMark=rOr;CO(la,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return lCe}});CO(gvt,mvt,{__proto__:null,enumerable:!0,get(){return lCe.pipeline}});CO(yvt,mvt,{__proto__:null,enumerable:!0,get(){return lCe.finished}});la.Stream=la;la._isUint8Array=function(e){return e instanceof Uint8Array};la._uint8ArrayToBuffer=function(e){return QCr.from(e.buffer,e.byteOffset,e.byteLength)}});var JH=v((vvo,js)=>{"use strict";var Il=uCe(),iOr=sCe(),aOr=Il.Readable.destroy;js.exports=Il.Readable;js.exports._uint8ArrayToBuffer=Il._uint8ArrayToBuffer;js.exports._isUint8Array=Il._isUint8Array;js.exports.isDisturbed=Il.isDisturbed;js.exports.isErrored=Il.isErrored;js.exports.isReadable=Il.isReadable;js.exports.Readable=Il.Readable;js.exports.Writable=Il.Writable;js.exports.Duplex=Il.Duplex;js.exports.Transform=Il.Transform;js.exports.PassThrough=Il.PassThrough;js.exports.addAbortSignal=Il.addAbortSignal;js.exports.finished=Il.finished;js.exports.destroy=Il.destroy;js.exports.destroy=aOr;js.exports.pipeline=Il.pipeline;js.exports.compose=Il.compose;Object.defineProperty(Il,"promises",{configurable:!0,enumerable:!0,get(){return iOr}});js.exports.Stream=Il.Stream;js.exports.default=js.exports});var sj=v((wvo,_vt)=>{"use strict";_vt.exports=TypeError});var vvt=v(()=>{});var QH=v((Cvo,Bvt)=>{var vCe=typeof Map=="function"&&Map.prototype,dCe=Object.getOwnPropertyDescriptor&&vCe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Oee=vCe&&dCe&&typeof dCe.get=="function"?dCe.get:null,wvt=vCe&&Map.prototype.forEach,wCe=typeof Set=="function"&&Set.prototype,fCe=Object.getOwnPropertyDescriptor&&wCe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Pee=wCe&&fCe&&typeof fCe.get=="function"?fCe.get:null,Svt=wCe&&Set.prototype.forEach,sOr=typeof WeakMap=="function"&&WeakMap.prototype,ZH=sOr?WeakMap.prototype.has:null,uOr=typeof WeakSet=="function"&&WeakSet.prototype,XH=uOr?WeakSet.prototype.has:null,lOr=typeof WeakRef=="function"&&WeakRef.prototype,xvt=lOr?WeakRef.prototype.deref:null,cOr=Boolean.prototype.valueOf,dOr=Object.prototype.toString,fOr=Function.prototype.toString,pOr=String.prototype.match,SCe=String.prototype.slice,aA=String.prototype.replace,mOr=String.prototype.toUpperCase,Cvt=String.prototype.toLowerCase,jvt=RegExp.prototype.test,Ovt=Array.prototype.concat,G_=Array.prototype.join,hOr=Array.prototype.slice,Pvt=Math.floor,hCe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,pCe=Object.getOwnPropertySymbols,gCe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,d$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Yd=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===d$||!0)?Symbol.toStringTag:null,Nvt=Object.prototype.propertyIsEnumerable,Evt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Tvt(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||jvt.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Pvt(-t):Pvt(t);if(n!==t){var o=String(n),i=SCe.call(e,o.length+1);return aA.call(o,r,"$&_")+"."+aA.call(aA.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return aA.call(e,r,"$&_")}var yCe=vvt(),Avt=yCe.custom,Ivt=Fvt(Avt)?Avt:null,Dvt={__proto__:null,double:'"',single:"'"},gOr={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Bvt.exports=function t(e,r,n,o){var i=r||{};if(OO(i,"quoteStyle")&&!OO(Dvt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(OO(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=OO(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(OO(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(OO(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 $vt(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?Tvt(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?Tvt(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 bCe(e)?"[Array]":"[Object]";var d=NOr(i,n);if(typeof o>"u")o=[];else if(kvt(o,e)>=0)return"[Circular]";function f($,k,z){if(k&&(o=hOr.call(o),o.push(k)),z){var V={depth:i.depth};return OO(i,"quoteStyle")&&(V.quoteStyle=i.quoteStyle),t($,V,n+1,o)}return t($,i,n+1,o)}if(typeof e=="function"&&!Mvt(e)){var p=OOr(e),m=Cee(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+G_.call(m,", ")+" }":"")}if(Fvt(e)){var h=d$?aA.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):gCe.call(e);return typeof e=="object"&&!d$?YH(h):h}if(MOr(e)){for(var b="<"+Cvt.call(String(e.nodeName)),g=e.attributes||[],y=0;y<g.length;y++)b+=" "+g[y].name+"="+Lvt(yOr(g[y].value),"double",i);return b+=">",e.childNodes&&e.childNodes.length&&(b+="..."),b+="</"+Cvt.call(String(e.nodeName))+">",b}if(bCe(e)){if(e.length===0)return"[]";var S=Cee(e,f);return d&&!jOr(S)?"["+_Ce(S,d)+"]":"[ "+G_.call(S,", ")+" ]"}if(_Or(e)){var x=Cee(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Nvt.call(e,"cause")?"{ ["+String(e)+"] "+G_.call(Ovt.call("[cause]: "+f(e.cause),x),", ")+" }":x.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+G_.call(x,", ")+" }"}if(typeof e=="object"&&a){if(Ivt&&typeof e[Ivt]=="function"&&yCe)return yCe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(POr(e)){var O=[];return wvt&&wvt.call(e,function($,k){O.push(f(k,e,!0)+" => "+f($,e))}),Rvt("Map",Oee.call(e),O,d)}if(AOr(e)){var P=[];return Svt&&Svt.call(e,function($){P.push(f($,e))}),Rvt("Set",Pee.call(e),P,d)}if(EOr(e))return mCe("WeakMap");if(IOr(e))return mCe("WeakSet");if(TOr(e))return mCe("WeakRef");if(wOr(e))return YH(f(Number(e)));if(xOr(e))return YH(f(hCe.call(e)));if(SOr(e))return YH(cOr.call(e));if(vOr(e))return YH(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(!bOr(e)&&!Mvt(e)){var E=Cee(e,f),A=Evt?Evt(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",R=!A&&Yd&&Object(e)===e&&Yd in e?SCe.call(sA(e),8,-1):I?"Object":"",N=A||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",j=N+(R||I?"["+G_.call(Ovt.call([],R||[],I||[]),": ")+"] ":"");return E.length===0?j+"{}":d?j+"{"+_Ce(E,d)+"}":j+"{ "+G_.call(E,", ")+" }"}return String(e)};function Lvt(t,e,r){var n=r.quoteStyle||e,o=Dvt[n];return o+t+o}function yOr(t){return aA.call(String(t),/"/g,"&quot;")}function bCe(t){return sA(t)==="[object Array]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function bOr(t){return sA(t)==="[object Date]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function Mvt(t){return sA(t)==="[object RegExp]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function _Or(t){return sA(t)==="[object Error]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function vOr(t){return sA(t)==="[object String]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function wOr(t){return sA(t)==="[object Number]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function SOr(t){return sA(t)==="[object Boolean]"&&(!Yd||!(typeof t=="object"&&Yd in t))}function Fvt(t){if(d$)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!gCe)return!1;try{return gCe.call(t),!0}catch{}return!1}function xOr(t){if(!t||typeof t!="object"||!hCe)return!1;try{return hCe.call(t),!0}catch{}return!1}var COr=Object.prototype.hasOwnProperty||function(t){return t in this};function OO(t,e){return COr.call(t,e)}function sA(t){return dOr.call(t)}function OOr(t){if(t.name)return t.name;var e=pOr.call(fOr.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function kvt(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 POr(t){if(!Oee||!t||typeof t!="object")return!1;try{Oee.call(t);try{Pee.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function EOr(t){if(!ZH||!t||typeof t!="object")return!1;try{ZH.call(t,ZH);try{XH.call(t,XH)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function TOr(t){if(!xvt||!t||typeof t!="object")return!1;try{return xvt.call(t),!0}catch{}return!1}function AOr(t){if(!Pee||!t||typeof t!="object")return!1;try{Pee.call(t);try{Oee.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function IOr(t){if(!XH||!t||typeof t!="object")return!1;try{XH.call(t,XH);try{ZH.call(t,ZH)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function MOr(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function $vt(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return $vt(SCe.call(t,0,e.maxStringLength),e)+n}var o=gOr[e.quoteStyle||"single"];o.lastIndex=0;var i=aA.call(aA.call(t,o,"\\$1"),/[\x00-\x1f]/g,ROr);return Lvt(i,"single",e)}function ROr(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":"")+mOr.call(e.toString(16))}function YH(t){return"Object("+t+")"}function mCe(t){return t+" { ? }"}function Rvt(t,e,r,n){var o=n?_Ce(r,n):G_.call(r,", ");return t+" ("+e+") {"+o+"}"}function jOr(t){for(var e=0;e<t.length;e++)if(kvt(t[e],`
`)>=0)return!1;return!0}function NOr(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=G_.call(Array(t.indent+1)," ");else return null;return{base:r,prev:G_.call(Array(e+1),r)}}function _Ce(t,e){if(t.length===0)return"";var r=`
`+e.prev+e.base;return r+G_.call(t,","+r)+`
`+e.prev}function Cee(t,e){var r=bCe(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=OO(t,o)?e(t[o],t):""}var i=typeof pCe=="function"?pCe(t):[],a;if(d$){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)OO(t,u)&&(r&&String(Number(u))===u&&u<t.length||d$&&a["$"+u]instanceof Symbol||(jvt.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof pCe=="function")for(var l=0;l<i.length;l++)Nvt.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var Uvt=v((Ovo,qvt)=>{"use strict";var DOr=QH(),LOr=sj(),Eee=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},FOr=function(t,e){if(t){var r=Eee(t,e);return r&&r.value}},kOr=function(t,e,r){var n=Eee(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},$Or=function(t,e){return t?!!Eee(t,e):!1},BOr=function(t,e){if(t)return Eee(t,e,!0)};qvt.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new LOr("Side channel does not contain "+DOr(n))},delete:function(n){var o=e&&e.next,i=BOr(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return FOr(e,n)},has:function(n){return $Or(e,n)},set:function(n,o){e||(e={next:void 0}),kOr(e,n,o)}};return r}});var xCe=v((Pvo,zvt)=>{"use strict";zvt.exports=Object});var Vvt=v((Evo,Hvt)=>{"use strict";Hvt.exports=Error});var Kvt=v((Tvo,Wvt)=>{"use strict";Wvt.exports=EvalError});var Jvt=v((Avo,Gvt)=>{"use strict";Gvt.exports=RangeError});var Zvt=v((Ivo,Yvt)=>{"use strict";Yvt.exports=ReferenceError});var Qvt=v((Mvo,Xvt)=>{"use strict";Xvt.exports=SyntaxError});var twt=v((Rvo,ewt)=>{"use strict";ewt.exports=URIError});var nwt=v((jvo,rwt)=>{"use strict";rwt.exports=Math.abs});var iwt=v((Nvo,owt)=>{"use strict";owt.exports=Math.floor});var swt=v((Dvo,awt)=>{"use strict";awt.exports=Math.max});var lwt=v((Lvo,uwt)=>{"use strict";uwt.exports=Math.min});var dwt=v((Fvo,cwt)=>{"use strict";cwt.exports=Math.pow});var pwt=v((kvo,fwt)=>{"use strict";fwt.exports=Math.round});var hwt=v(($vo,mwt)=>{"use strict";mwt.exports=Number.isNaN||function(e){return e!==e}});var ywt=v((Bvo,gwt)=>{"use strict";var qOr=hwt();gwt.exports=function(e){return qOr(e)||e===0?e:e<0?-1:1}});var _wt=v((qvo,bwt)=>{"use strict";bwt.exports=Object.getOwnPropertyDescriptor});var CCe=v((Uvo,vwt)=>{"use strict";var Tee=_wt();if(Tee)try{Tee([],"length")}catch{Tee=null}vwt.exports=Tee});var Swt=v((zvo,wwt)=>{"use strict";var Aee=Object.defineProperty||!1;if(Aee)try{Aee({},"a",{value:1})}catch{Aee=!1}wwt.exports=Aee});var Cwt=v((Hvo,xwt)=>{"use strict";xwt.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 Ewt=v((Vvo,Pwt)=>{"use strict";var Owt=typeof Symbol<"u"&&Symbol,UOr=Cwt();Pwt.exports=function(){return typeof Owt!="function"||typeof Symbol!="function"||typeof Owt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:UOr()}});var OCe=v((Wvo,Twt)=>{"use strict";Twt.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var PCe=v((Kvo,Awt)=>{"use strict";var zOr=xCe();Awt.exports=zOr.getPrototypeOf||null});var Rwt=v((Gvo,Mwt)=>{"use strict";var HOr="Function.prototype.bind called on incompatible ",VOr=Object.prototype.toString,WOr=Math.max,KOr="[object Function]",Iwt=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},GOr=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},JOr=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};Mwt.exports=function(e){var r=this;if(typeof r!="function"||VOr.apply(r)!==KOr)throw new TypeError(HOr+r);for(var n=GOr(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,Iwt(n,arguments));return Object(c)===c?c:this}return r.apply(e,Iwt(n,arguments))},a=WOr(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+JOr(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 eV=v((Jvo,jwt)=>{"use strict";var YOr=Rwt();jwt.exports=Function.prototype.bind||YOr});var Iee=v((Yvo,Nwt)=>{"use strict";Nwt.exports=Function.prototype.call});var ECe=v((Zvo,Dwt)=>{"use strict";Dwt.exports=Function.prototype.apply});var Fwt=v((Xvo,Lwt)=>{"use strict";Lwt.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var $wt=v((Qvo,kwt)=>{"use strict";var ZOr=eV(),XOr=ECe(),QOr=Iee(),ePr=Fwt();kwt.exports=ePr||ZOr.call(QOr,XOr)});var TCe=v((ewo,Bwt)=>{"use strict";var tPr=eV(),rPr=sj(),nPr=Iee(),oPr=$wt();Bwt.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new rPr("a function is required");return oPr(tPr,nPr,e)}});var Wwt=v((two,Vwt)=>{"use strict";var iPr=TCe(),qwt=CCe(),zwt;try{zwt=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var ACe=!!zwt&&qwt&&qwt(Object.prototype,"__proto__"),Hwt=Object,Uwt=Hwt.getPrototypeOf;Vwt.exports=ACe&&typeof ACe.get=="function"?iPr([ACe.get]):typeof Uwt=="function"?function(e){return Uwt(e==null?e:Hwt(e))}:!1});var Zwt=v((rwo,Ywt)=>{"use strict";var Kwt=OCe(),Gwt=PCe(),Jwt=Wwt();Ywt.exports=Kwt?function(e){return Kwt(e)}:Gwt?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Gwt(e)}:Jwt?function(e){return Jwt(e)}:null});var Qwt=v((nwo,Xwt)=>{"use strict";var aPr=Function.prototype.call,sPr=Object.prototype.hasOwnProperty,uPr=eV();Xwt.exports=uPr.call(aPr,sPr)});var jee=v((owo,i0t)=>{"use strict";var Nn,lPr=xCe(),cPr=Vvt(),dPr=Kvt(),fPr=Jvt(),pPr=Zvt(),h$=Qvt(),m$=sj(),mPr=twt(),hPr=nwt(),gPr=iwt(),yPr=swt(),bPr=lwt(),_Pr=dwt(),vPr=pwt(),wPr=ywt(),n0t=Function,ICe=function(t){try{return n0t('"use strict"; return ('+t+").constructor;")()}catch{}},tV=CCe(),SPr=Swt(),MCe=function(){throw new m$},xPr=tV?function(){try{return arguments.callee,MCe}catch{try{return tV(arguments,"callee").get}catch{return MCe}}}():MCe,f$=Ewt()(),Zl=Zwt(),CPr=PCe(),OPr=OCe(),o0t=ECe(),rV=Iee(),p$={},PPr=typeof Uint8Array>"u"||!Zl?Nn:Zl(Uint8Array),uj={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Nn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Nn:ArrayBuffer,"%ArrayIteratorPrototype%":f$&&Zl?Zl([][Symbol.iterator]()):Nn,"%AsyncFromSyncIteratorPrototype%":Nn,"%AsyncFunction%":p$,"%AsyncGenerator%":p$,"%AsyncGeneratorFunction%":p$,"%AsyncIteratorPrototype%":p$,"%Atomics%":typeof Atomics>"u"?Nn:Atomics,"%BigInt%":typeof BigInt>"u"?Nn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Nn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Nn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Nn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":cPr,"%eval%":eval,"%EvalError%":dPr,"%Float32Array%":typeof Float32Array>"u"?Nn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Nn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Nn:FinalizationRegistry,"%Function%":n0t,"%GeneratorFunction%":p$,"%Int8Array%":typeof Int8Array>"u"?Nn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Nn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Nn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f$&&Zl?Zl(Zl([][Symbol.iterator]())):Nn,"%JSON%":typeof JSON=="object"?JSON:Nn,"%Map%":typeof Map>"u"?Nn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!f$||!Zl?Nn:Zl(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":lPr,"%Object.getOwnPropertyDescriptor%":tV,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Nn:Promise,"%Proxy%":typeof Proxy>"u"?Nn:Proxy,"%RangeError%":fPr,"%ReferenceError%":pPr,"%Reflect%":typeof Reflect>"u"?Nn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Nn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!f$||!Zl?Nn:Zl(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Nn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f$&&Zl?Zl(""[Symbol.iterator]()):Nn,"%Symbol%":f$?Symbol:Nn,"%SyntaxError%":h$,"%ThrowTypeError%":xPr,"%TypedArray%":PPr,"%TypeError%":m$,"%Uint8Array%":typeof Uint8Array>"u"?Nn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Nn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Nn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Nn:Uint32Array,"%URIError%":mPr,"%WeakMap%":typeof WeakMap>"u"?Nn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Nn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Nn:WeakSet,"%Function.prototype.call%":rV,"%Function.prototype.apply%":o0t,"%Object.defineProperty%":SPr,"%Object.getPrototypeOf%":CPr,"%Math.abs%":hPr,"%Math.floor%":gPr,"%Math.max%":yPr,"%Math.min%":bPr,"%Math.pow%":_Pr,"%Math.round%":vPr,"%Math.sign%":wPr,"%Reflect.getPrototypeOf%":OPr};if(Zl)try{null.error}catch(t){e0t=Zl(Zl(t)),uj["%Error.prototype%"]=e0t}var e0t,EPr=function t(e){var r;if(e==="%AsyncFunction%")r=ICe("async function () {}");else if(e==="%GeneratorFunction%")r=ICe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ICe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&Zl&&(r=Zl(o.prototype))}return uj[e]=r,r},t0t={__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"]},nV=eV(),Mee=Qwt(),TPr=nV.call(rV,Array.prototype.concat),APr=nV.call(o0t,Array.prototype.splice),r0t=nV.call(rV,String.prototype.replace),Ree=nV.call(rV,String.prototype.slice),IPr=nV.call(rV,RegExp.prototype.exec),MPr=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,RPr=/\\(\\)?/g,jPr=function(e){var r=Ree(e,0,1),n=Ree(e,-1);if(r==="%"&&n!=="%")throw new h$("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new h$("invalid intrinsic syntax, expected opening `%`");var o=[];return r0t(e,MPr,function(i,a,s,u){o[o.length]=s?r0t(u,RPr,"$1"):a||i}),o},NPr=function(e,r){var n=e,o;if(Mee(t0t,n)&&(o=t0t[n],n="%"+o[0]+"%"),Mee(uj,n)){var i=uj[n];if(i===p$&&(i=EPr(n)),typeof i>"u"&&!r)throw new m$("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new h$("intrinsic "+e+" does not exist!")};i0t.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new m$("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new m$('"allowMissing" argument must be a boolean');if(IPr(/^%?[^%]*%?$/,e)===null)throw new h$("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=jPr(e),o=n.length>0?n[0]:"",i=NPr("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],APr(n,TPr([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=Ree(f,0,1),m=Ree(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new h$("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",Mee(uj,a))s=uj[a];else if(s!=null){if(!(f in s)){if(!r)throw new m$("base intrinsic for "+e+" exists, but the property is not available.");return}if(tV&&c+1>=n.length){var h=tV(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=Mee(s,f),s=s[f];d&&!u&&(uj[a]=s)}}return s}});var RCe=v((iwo,u0t)=>{"use strict";var a0t=jee(),s0t=TCe(),DPr=s0t([a0t("%String.prototype.indexOf%")]);u0t.exports=function(e,r){var n=a0t(e,!!r);return typeof n=="function"&&DPr(e,".prototype.")>-1?s0t([n]):n}});var jCe=v((awo,c0t)=>{"use strict";var LPr=jee(),oV=RCe(),FPr=QH(),kPr=sj(),l0t=LPr("%Map%",!0),$Pr=oV("Map.prototype.get",!0),BPr=oV("Map.prototype.set",!0),qPr=oV("Map.prototype.has",!0),UPr=oV("Map.prototype.delete",!0),zPr=oV("Map.prototype.size",!0);c0t.exports=!!l0t&&function(){var e,r={assert:function(n){if(!r.has(n))throw new kPr("Side channel does not contain "+FPr(n))},delete:function(n){if(e){var o=UPr(e,n);return zPr(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return $Pr(e,n)},has:function(n){return e?qPr(e,n):!1},set:function(n,o){e||(e=new l0t),BPr(e,n,o)}};return r}});var f0t=v((swo,d0t)=>{"use strict";var HPr=jee(),Dee=RCe(),VPr=QH(),Nee=jCe(),WPr=sj(),g$=HPr("%WeakMap%",!0),KPr=Dee("WeakMap.prototype.get",!0),GPr=Dee("WeakMap.prototype.set",!0),JPr=Dee("WeakMap.prototype.has",!0),YPr=Dee("WeakMap.prototype.delete",!0);d0t.exports=g$?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new WPr("Side channel does not contain "+VPr(o))},delete:function(o){if(g$&&o&&(typeof o=="object"||typeof o=="function")){if(e)return YPr(e,o)}else if(Nee&&r)return r.delete(o);return!1},get:function(o){return g$&&o&&(typeof o=="object"||typeof o=="function")&&e?KPr(e,o):r&&r.get(o)},has:function(o){return g$&&o&&(typeof o=="object"||typeof o=="function")&&e?JPr(e,o):!!r&&r.has(o)},set:function(o,i){g$&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new g$),GPr(e,o,i)):Nee&&(r||(r=Nee()),r.set(o,i))}};return n}:Nee});var m0t=v((uwo,p0t)=>{"use strict";var ZPr=sj(),XPr=QH(),QPr=Uvt(),eEr=jCe(),tEr=f0t(),rEr=tEr||eEr||QPr;p0t.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new ZPr("Side channel does not contain "+XPr(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=rEr()),e.set(n,o)}};return r}});var Lee=v((lwo,h0t)=>{"use strict";var nEr=String.prototype.replace,oEr=/%20/g,NCe={RFC1738:"RFC1738",RFC3986:"RFC3986"};h0t.exports={default:NCe.RFC3986,formatters:{RFC1738:function(t){return nEr.call(t,oEr,"+")},RFC3986:function(t){return String(t)}},RFC1738:NCe.RFC1738,RFC3986:NCe.RFC3986}});var LCe=v((cwo,y0t)=>{"use strict";var iEr=Lee(),DCe=Object.prototype.hasOwnProperty,lj=Array.isArray,J_=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),aEr=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(lj(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},g0t=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},sEr=function t(e,r,n){if(!r)return e;if(typeof r!="object"){if(lj(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!DCe.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 lj(e)&&!lj(r)&&(o=g0t(e,n)),lj(e)&&lj(r)?(r.forEach(function(i,a){if(DCe.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 DCe.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},uEr=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},lEr=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}},cEr=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===iEr.RFC1738&&(l===40||l===41)){s+=a.charAt(u);continue}if(l<128){s=s+J_[l];continue}if(l<2048){s=s+(J_[192|l>>6]+J_[128|l&63]);continue}if(l<55296||l>=57344){s=s+(J_[224|l>>12]+J_[128|l>>6&63]+J_[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|a.charCodeAt(u)&1023),s+=J_[240|l>>18]+J_[128|l>>12&63]+J_[128|l>>6&63]+J_[128|l&63]}return s},dEr=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 aEr(r),e},fEr=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},pEr=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},mEr=function(e,r){return[].concat(e,r)},hEr=function(e,r){if(lj(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};y0t.exports={arrayToObject:g0t,assign:uEr,combine:mEr,compact:dEr,decode:lEr,encode:cEr,isBuffer:pEr,isRegExp:fEr,maybeMap:hEr,merge:sEr}});var x0t=v((dwo,S0t)=>{"use strict";var v0t=m0t(),Fee=LCe(),iV=Lee(),gEr=Object.prototype.hasOwnProperty,b0t={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},PO=Array.isArray,yEr=Array.prototype.push,w0t=function(t,e){yEr.apply(t,PO(e)?e:[e])},bEr=Date.prototype.toISOString,_0t=iV.default,Zd={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Fee.encode,encodeValuesOnly:!1,format:_0t,formatter:iV.formatters[_0t],indices:!1,serializeDate:function(e){return bEr.call(e)},skipNulls:!1,strictNullHandling:!1},_Er=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},FCe={},vEr=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b){for(var g=e,y=b,S=0,x=!1;(y=y.get(FCe))!==void 0&&!x;){var O=y.get(e);if(S+=1,typeof O<"u"){if(O===S)throw new RangeError("Cyclic object value");x=!0}typeof y.get(FCe)>"u"&&(S=0)}if(typeof u=="function"?g=u(r,g):g instanceof Date?g=d(g):n==="comma"&&PO(g)&&(g=Fee.maybeMap(g,function(V){return V instanceof Date?d(V):V})),g===null){if(i)return s&&!m?s(r,Zd.encoder,h,"key",f):r;g=""}if(_Er(g)||Fee.isBuffer(g)){if(s){var P=m?r:s(r,Zd.encoder,h,"key",f);return[p(P)+"="+p(s(g,Zd.encoder,h,"value",f))]}return[p(r)+"="+p(String(g))]}var E=[];if(typeof g>"u")return E;var A;if(n==="comma"&&PO(g))m&&s&&(g=Fee.maybeMap(g,s)),A=[{value:g.length>0?g.join(",")||null:void 0}];else if(PO(u))A=u;else{var I=Object.keys(g);A=l?I.sort(l):I}for(var R=o&&PO(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=PO(g)?typeof n=="function"?n(R,j):R:R+(c?"."+j:"["+j+"]");b.set(e,S);var z=v0t();z.set(FCe,b),w0t(E,t($,k,n,o,i,a,n==="comma"&&m&&PO(g)?null:s,u,l,c,d,f,p,m,h,z))}}return E},wEr=function(e){if(!e)return Zd;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||Zd.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=iV.default;if(typeof e.format<"u"){if(!gEr.call(iV.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=iV.formatters[n],i=Zd.filter;return(typeof e.filter=="function"||PO(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Zd.addQueryPrefix,allowDots:typeof e.allowDots>"u"?Zd.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Zd.charsetSentinel,delimiter:typeof e.delimiter>"u"?Zd.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Zd.encode,encoder:typeof e.encoder=="function"?e.encoder:Zd.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Zd.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Zd.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Zd.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Zd.strictNullHandling}};S0t.exports=function(t,e){var r=t,n=wEr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):PO(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s;e&&e.arrayFormat in b0t?s=e.arrayFormat:e&&"indices"in e?s=e.indices?"indices":"repeat":s="indices";var u=b0t[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=v0t(),d=0;d<o.length;++d){var f=o[d];n.skipNulls&&r[f]===null||w0t(a,vEr(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 P0t=v((fwo,O0t)=>{"use strict";var y$=LCe(),kCe=Object.prototype.hasOwnProperty,SEr=Array.isArray,Xl={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:y$.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},xEr=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},C0t=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},CEr="utf8=%26%2310003%3B",OEr="utf8=%E2%9C%93",PEr=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]===OEr?l="utf-8":a[u]===CEr&&(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,Xl.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Xl.decoder,l,"key"),m=y$.maybeMap(C0t(c.slice(f+1),r),function(h){return r.decoder(h,Xl.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=xEr(m)),c.indexOf("[]=")>-1&&(m=SEr(m)?[m]:m),kCe.call(n,p)?n[p]=y$.combine(n[p],m):n[p]=m}return n},EEr=function(t,e,r,n){for(var o=n?e:C0t(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},TEr=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&&kCe.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&&kCe.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}return u&&c.push("["+i.slice(u.index)+"]"),EEr(c,r,n,o)}},AEr=function(e){if(!e)return Xl;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"?Xl.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Xl.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Xl.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Xl.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Xl.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Xl.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Xl.comma,decoder:typeof e.decoder=="function"?e.decoder:Xl.decoder,delimiter:typeof e.delimiter=="string"||y$.isRegExp(e.delimiter)?e.delimiter:Xl.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Xl.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Xl.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Xl.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Xl.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Xl.strictNullHandling}};O0t.exports=function(t,e){var r=AEr(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?PEr(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=TEr(s,n[s],r,typeof t=="string");o=y$.merge(o,u,r)}return r.allowSparse===!0?o:y$.compact(o)}});var T0t=v((pwo,E0t)=>{"use strict";var IEr=x0t(),MEr=P0t(),REr=Lee();E0t.exports={formats:REr,parse:MEr,stringify:IEr}});var A0t=v(b$=>{"use strict";var jEr=b$&&b$.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(b$,"__esModule",{value:!0});b$.createRequestUrl=void 0;var NEr=jEr(T0t());function DEr(t,e){return Object.keys(e??{}).length>0?`${t}?${NEr.default.stringify(e,{arrayFormat:"repeat"})}`:t}b$.createRequestUrl=DEr});var R0t=v(kee=>{"use strict";var $Ce,BCe,qCe,UCe,zCe;Object.defineProperty(kee,"__esModule",{value:!0});kee.RUNTIME=void 0;var LEr=typeof window<"u"&&typeof window.document<"u",FEr=typeof self=="object"&&typeof self?.importScripts=="function"&&((($Ce=self.constructor)===null||$Ce===void 0?void 0:$Ce.name)==="DedicatedWorkerGlobalScope"||((BCe=self.constructor)===null||BCe===void 0?void 0:BCe.name)==="ServiceWorkerGlobalScope"||((qCe=self.constructor)===null||qCe===void 0?void 0:qCe.name)==="SharedWorkerGlobalScope"),I0t=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",M0t=typeof Bun<"u"&&typeof Bun.version<"u",kEr=typeof process<"u"&&!!process.version&&!!(!((UCe=process.versions)===null||UCe===void 0)&&UCe.node)&&!I0t&&!M0t,$Er=typeof navigator<"u"&&navigator?.product==="ReactNative",BEr=typeof globalThis<"u"&&((zCe=globalThis?.navigator)===null||zCe===void 0?void 0:zCe.userAgent)==="Cloudflare-Workers";kee.RUNTIME=qEr();function qEr(){return LEr?{type:"browser",version:window.navigator.userAgent}:BEr?{type:"workerd"}:FEr?{type:"web-worker"}:I0t?{type:"deno",version:Deno.version.deno}:M0t?{type:"bun",version:Bun.version}:kEr?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:$Er?{type:"react-native"}:{type:"unknown"}}});var _$=v($ee=>{"use strict";Object.defineProperty($ee,"__esModule",{value:!0});$ee.RUNTIME=void 0;var UEr=R0t();Object.defineProperty($ee,"RUNTIME",{enumerable:!0,get:function(){return UEr.RUNTIME}})});var HCe=v((v$,j0t)=>{"use strict";var zEr=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},cj=zEr();j0t.exports=v$=cj.fetch;cj.fetch&&(v$.default=cj.fetch.bind(cj));v$.Headers=cj.Headers;v$.Request=cj.Request;v$.Response=cj.Response});var D0t=v(og=>{"use strict";var HEr=og&&og.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VEr=og&&og.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N0t=og&&og.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HEr(e,t,r);return VEr(e,t),e},WEr=og&&og.__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(og,"__esModule",{value:!0});og.getFetchFn=void 0;var Bee=_$();function KEr(){return WEr(this,void 0,void 0,function*(){return Bee.RUNTIME.type==="node"&&Bee.RUNTIME.parsedVersion!=null&&Bee.RUNTIME.parsedVersion>=18?fetch:Bee.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>N0t(HCe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>N0t(HCe()))).default})}og.getFetchFn=KEr});var L0t=v(w$=>{"use strict";var GEr=w$&&w$.__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(w$,"__esModule",{value:!0});w$.getRequestBody=void 0;function JEr({body:t,type:e}){return GEr(this,void 0,void 0,function*(){return e.includes("json")?JSON.stringify(t):t})}w$.getRequestBody=JEr});var F0t=v(S$=>{"use strict";var ky=S$&&S$.__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(S$,"__esModule",{value:!0});S$.Node18UniversalStreamWrapper=void 0;var VCe=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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>ky(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=>ky(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",()=>ky(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>ky(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 ky(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 ky(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 ky(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 ky(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:()=>ky(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}}}};S$.Node18UniversalStreamWrapper=VCe});var k0t=v(x$=>{"use strict";var aV=x$&&x$.__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(x$,"__esModule",{value:!0});x$.UndiciStreamWrapper=void 0;var WCe=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 aV(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 aV(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 aV(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 aV(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:()=>aV(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}}}};x$.UndiciStreamWrapper=WCe});var $0t=v(uA=>{"use strict";var qee=uA&&uA.__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())})},YEr=uA&&uA.__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(uA,"__esModule",{value:!0});uA.NodePre18StreamWrapper=void 0;var KCe=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 qee(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 qee(this,void 0,void 0,function*(){let n=[],o=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var i=YEr(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 qee(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 qee(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};uA.NodePre18StreamWrapper=KCe});var B0t=v(ig=>{"use strict";var ZEr=ig&&ig.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XEr=ig&&ig.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GCe=ig&&ig.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ZEr(e,t,r);return XEr(e,t),e},QEr=ig&&ig.__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(ig,"__esModule",{value:!0});ig.chooseStreamWrapper=void 0;var Uee=_$();function eTr(t){return QEr(this,void 0,void 0,function*(){return Uee.RUNTIME.type==="node"&&Uee.RUNTIME.parsedVersion!=null&&Uee.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>GCe(F0t()))).Node18UniversalStreamWrapper(t):Uee.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>GCe(k0t()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>GCe($0t()))).NodePre18StreamWrapper(t)})}ig.chooseStreamWrapper=eTr});var q0t=v(C$=>{"use strict";var tTr=C$&&C$.__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(C$,"__esModule",{value:!0});C$.getResponseBody=void 0;var rTr=B0t();function nTr(t,e){return tTr(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,rTr.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}})}C$.getResponseBody=nTr});var U0t=v(O$=>{"use strict";Object.defineProperty(O$,"__esModule",{value:!0});O$.anySignal=O$.getTimeoutSignal=void 0;var oTr="timeout";function iTr(t){let e=new AbortController,r=setTimeout(()=>e.abort(oTr),t);return{signal:e.signal,abortId:r}}O$.getTimeoutSignal=iTr;function aTr(...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}O$.anySignal=aTr});var H0t=v(P$=>{"use strict";var sTr=P$&&P$.__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(P$,"__esModule",{value:!0});P$.makeRequest=void 0;var z0t=U0t(),uTr=(t,e,r,n,o,i,a,s,u)=>sTr(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,z0t.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,z0t.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});P$.makeRequest=uTr});var V0t=v(E$=>{"use strict";var lTr=E$&&E$.__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(E$,"__esModule",{value:!0});E$.requestWithRetries=void 0;var cTr=1,dTr=60,fTr=2;function pTr(t,e=fTr){return lTr(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(cTr*Math.pow(2,n),dTr);yield new Promise(i=>setTimeout(i,o)),r=yield t()}return r})}E$.requestWithRetries=pTr});var G0t=v(lA=>{"use strict";var W0t=lA&&lA.__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(lA,"__esModule",{value:!0});lA.fetcher=lA.fetcherImpl=void 0;var mTr=A0t(),hTr=D0t(),gTr=L0t(),yTr=q0t(),bTr=H0t(),_Tr=V0t();function K0t(t){return W0t(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,mTr.createRequestUrl)(t.url,t.queryParameters),n=yield(0,gTr.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,hTr.getFetchFn)();try{let i=yield(0,_Tr.requestWithRetries)(()=>W0t(this,void 0,void 0,function*(){return(0,bTr.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,yTr.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)}}}})}lA.fetcherImpl=K0t;lA.fetcher=K0t});var J0t=v(zee=>{"use strict";Object.defineProperty(zee,"__esModule",{value:!0});zee.getHeader=void 0;function vTr(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}zee.getHeader=vTr});var Y0t=v(T$=>{"use strict";var wTr=T$&&T$.__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(T$,"__esModule",{value:!0});T$.Supplier=void 0;T$.Supplier={get:t=>wTr(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var Z0t=v(cA=>{"use strict";Object.defineProperty(cA,"__esModule",{value:!0});cA.Supplier=cA.getHeader=cA.fetcher=void 0;var STr=G0t();Object.defineProperty(cA,"fetcher",{enumerable:!0,get:function(){return STr.fetcher}});var xTr=J0t();Object.defineProperty(cA,"getHeader",{enumerable:!0,get:function(){return xTr.getHeader}});var CTr=Y0t();Object.defineProperty(cA,"Supplier",{enumerable:!0,get:function(){return CTr.Supplier}})});var X0t=v((JCe,YCe)=>{(function(t,e){typeof JCe=="object"&&typeof YCe<"u"?YCe.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:JCe,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,ae){return W[Y]=ae}),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,ae,Oe,le="",Be=U.length%3,ze=0;ze<U.length;){if((Y=U.charCodeAt(ze++))>255||(ae=U.charCodeAt(ze++))>255||(Oe=U.charCodeAt(ze++))>255)throw new TypeError("invalid character found");W=Y<<16|ae<<8|Oe,le+=u[W>>18&63]+u[W>>12&63]+u[W>>6&63]+u[W&63]}return Be?le.slice(0,Be-3)+"===".substring(Be):le},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=[],ae=0,Oe=U.length;ae<Oe;ae+=W)Y.push(d.apply(null,U.subarray(ae,ae+W)));return b(Y.join(""))},y=function(U,W){return W===void 0&&(W=!1),W?p(g(U)):g(U)},S=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)}},x=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,O=function(U){return U.replace(x,S)},P=o?function(U){return Buffer.from(U,"utf8").toString("base64")}:a?function(U){return g(a.encode(U))}:function(U){return b(O(U))},E=function(U,W){return W===void 0&&(W=!1),W?p(P(U)):P(U)},A=function(U){return E(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="",ae,Oe,le=0;le<U.length;)W=l[U.charAt(le++)]<<18|l[U.charAt(le++)]<<12|(ae=l[U.charAt(le++)])<<6|(Oe=l[U.charAt(le++)]),Y+=ae===64?d(W>>16&255):Oe===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)})},z=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=="-"?"+":"/"}))},J=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)},B=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},q=function(){var U=function(W,Y){return Object.defineProperty(String.prototype,W,B(Y))};U("fromBase64",function(){return J(this)}),U("toBase64",function(W){return E(this,W)}),U("toBase64URI",function(){return E(this,!0)}),U("toBase64URL",function(){return E(this,!0)}),U("toUint8Array",function(){return z(this)})},K=function(){var U=function(W,Y){return Object.defineProperty(Uint8Array.prototype,W,B(Y))};U("toBase64",function(W){return y(this,W)}),U("toBase64URI",function(){return y(this,!0)}),U("toBase64URL",function(){return y(this,!0)})},H=function(){q(),K()},ee={version:t,VERSION:e,atob:$,atobPolyfill:j,btoa:b,btoaPolyfill:h,fromBase64:J,toBase64:E,encode:E,encodeURI:A,encodeURL:A,utob:O,btou:N,decode:J,isValid:D,fromUint8Array:y,toUint8Array:z,extendString:q,extendUint8Array:K,extendBuiltins:H};return ee.Base64={},Object.keys(ee).forEach(function(U){return ee.Base64[U]=ee[U]}),ee})});var eSt=v(Hee=>{"use strict";Object.defineProperty(Hee,"__esModule",{value:!0});Hee.BasicAuth=void 0;var Q0t=X0t(),OTr=/^Basic /i;Hee.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${Q0t.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(OTr,""),r=Q0t.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 tSt=v(Vee=>{"use strict";Object.defineProperty(Vee,"__esModule",{value:!0});Vee.BearerToken=void 0;var PTr=/^Bearer /i;Vee.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(PTr,"").trim()}});var rSt=v(A$=>{"use strict";Object.defineProperty(A$,"__esModule",{value:!0});A$.BearerToken=A$.BasicAuth=void 0;var ETr=eSt();Object.defineProperty(A$,"BasicAuth",{enumerable:!0,get:function(){return ETr.BasicAuth}});var TTr=tSt();Object.defineProperty(A$,"BearerToken",{enumerable:!0,get:function(){return TTr.BearerToken}})});var XCe=v(Np=>{"use strict";var nSt=Np&&Np.__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())})},oSt=Np&&Np.__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)}},$y=Np&&Np.__await||function(t){return this instanceof $y?(this.v=t,this):new $y(t)},iSt=Np&&Np.__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 $y?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(Np,"__esModule",{value:!0});Np.readableStreamAsyncIterable=Np.Stream=void 0;var ATr=_$(),ITr="data:",ZCe=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=ITr,this.messageTerminator=`
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return iSt(this,arguments,function*(){var r,n;this.controller.signal;let o=aSt(this.stream),i="",a=!1;try{for(var s=oSt(o),u;u=yield $y(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 $y(void 0);let f=yield $y(this.parse(JSON.parse(d)));yield yield $y(f),a=!1}}}catch(l){r={error:l}}finally{try{u&&!u.done&&(n=s.return)&&(yield $y(n.call(s)))}finally{if(r)throw r.error}}})}[Symbol.asyncIterator](){return iSt(this,arguments,function*(){var r,n;try{for(var o=oSt(this.iterMessages()),i;i=yield $y(o.next()),!i.done;){let a=i.value;yield yield $y(a)}}catch(a){r={error:a}}finally{try{i&&!i.done&&(n=o.return)&&(yield $y(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 ATr.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Np.Stream=ZCe;function aSt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return nSt(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 nSt(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Np.readableStreamAsyncIterable=aSt});var sSt=v(Wee=>{"use strict";Object.defineProperty(Wee,"__esModule",{value:!0});Wee.Stream=void 0;var MTr=XCe();Object.defineProperty(Wee,"Stream",{enumerable:!0,get:function(){return MTr.Stream}})});var cSt=v((Lwo,lSt)=>{"use strict";var QCe=Object.defineProperty,RTr=Object.getOwnPropertyDescriptor,jTr=Object.getOwnPropertyNames,NTr=Object.prototype.hasOwnProperty,DTr=(t,e)=>{for(var r in e)QCe(t,r,{get:e[r],enumerable:!0})},LTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jTr(e))!NTr.call(t,o)&&o!==r&&QCe(t,o,{get:()=>e[o],enumerable:!(n=RTr(e,o))||n.enumerable});return t},FTr=t=>LTr(QCe({},"__esModule",{value:!0}),t),uSt={};DTr(uSt,{Blob:()=>BTr,File:()=>qTr,FormData:()=>$Tr});lSt.exports=FTr(uSt);var kTr=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:$Tr,Blob:BTr,File:qTr}=kTr});var xSt=v((Fwo,SSt)=>{"use strict";var rOe=Object.defineProperty,UTr=Object.getOwnPropertyDescriptor,zTr=Object.getOwnPropertyNames,HTr=Object.prototype.hasOwnProperty,VTr=(t,e)=>{for(var r in e)rOe(t,r,{get:e[r],enumerable:!0})},WTr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zTr(e))!HTr.call(t,o)&&o!==r&&rOe(t,o,{get:()=>e[o],enumerable:!(n=UTr(e,o))||n.enumerable});return t},KTr=t=>WTr(rOe({},"__esModule",{value:!0}),t),nOe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},fs=(t,e,r)=>(nOe(t,e,"read from private field"),r?r.call(t):e.get(t)),Y_=(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)},sV=(t,e,r,n)=>(nOe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),eOe=(t,e,r)=>(nOe(t,e,"access private method"),r),ySt={};VTr(ySt,{FormDataEncoder:()=>tAr,isFile:()=>fj,isFormData:()=>vSt});SSt.exports=KTr(ySt);var EO=t=>typeof t=="function",GTr=t=>EO(t[Symbol.asyncIterator]),dSt=65536;function*bSt(t){if(t.byteLength<=dSt){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,dSt),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*JTr(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*fSt(t){for await(let e of t)yield*bSt(e)}var YTr=t=>{if(GTr(t))return fSt(t);if(EO(t.getReader))return fSt(JTr(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},pSt="abcdefghijklmnopqrstuvwxyz0123456789";function ZTr(){let t=16,e="";for(;t--;)e+=pSt[Math.random()*pSt.length<<0];return e}var _St=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
`||e===`
`&&n[r-1]!=="\r"?`\r
`:e),XTr=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function mSt(t){if(XTr(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function hSt(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var QTr=t=>new Proxy(t,{get:(e,r)=>hSt(e,r),has:(e,r)=>hSt(e,r)!==void 0}),vSt=t=>!!(t&&EO(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&EO(t.append)&&EO(t.getAll)&&EO(t.entries)&&EO(t[Symbol.iterator])),gSt=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),fj=t=>!!(t&&typeof t=="object"&&EO(t.constructor)&&t[Symbol.toStringTag]==="File"&&EO(t.stream)&&t.name!=null),eAr={enableAdditionalHeaders:!1},Kee={writable:!1,configurable:!1},dA,uV,Gee,lV,dj,cV,dV,Jee,Yee,oOe,tOe,wSt,tAr=class{constructor(t,e,r){if(Y_(this,Yee),Y_(this,tOe),Y_(this,dA,`\r
`),Y_(this,uV,void 0),Y_(this,Gee,void 0),Y_(this,lV,"-".repeat(2)),Y_(this,dj,new TextEncoder),Y_(this,cV,void 0),Y_(this,dV,void 0),Y_(this,Jee,void 0),!vSt(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(mSt(e)?r=e:n=e,n||(n=ZTr()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!mSt(r))throw new TypeError("Expected options argument to be an object.");sV(this,dV,Array.from(t.entries())),sV(this,Jee,{...eAr,...r}),sV(this,uV,fs(this,dj).encode(fs(this,dA))),sV(this,Gee,fs(this,uV).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,sV(this,cV,fs(this,dj).encode(`${fs(this,lV)}${this.boundary}${fs(this,lV)}${fs(this,dA).repeat(2)}`));let o={"Content-Type":this.contentType},i=eOe(this,tOe,wSt).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=QTr(Object.freeze(o)),Object.defineProperties(this,{boundary:Kee,contentType:Kee,contentLength:Kee,headers:Kee})}*values(){for(let[t,e]of fs(this,dV)){let r=fj(e)?e:fs(this,dj).encode(_St(e));yield eOe(this,Yee,oOe).call(this,t,r),yield r,yield fs(this,uV)}yield fs(this,cV)}async*encode(){for(let t of this.values())fj(t)?yield*YTr(t.stream()):yield*bSt(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};dA=new WeakMap;uV=new WeakMap;Gee=new WeakMap;lV=new WeakMap;dj=new WeakMap;cV=new WeakMap;dV=new WeakMap;Jee=new WeakMap;Yee=new WeakSet;oOe=function(t,e){let r="";if(r+=`${fs(this,lV)}${this.boundary}${fs(this,dA)}`,r+=`Content-Disposition: form-data; name="${gSt(t)}"`,fj(e)&&(r+=`; filename="${gSt(e.name)}"${fs(this,dA)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),fs(this,Jee).enableAdditionalHeaders===!0){let n=fj(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${fs(this,dA)}Content-Length: ${n}`)}return fs(this,dj).encode(`${r}${fs(this,dA).repeat(2)}`)};tOe=new WeakSet;wSt=function(){let t=0;for(let[e,r]of fs(this,dV)){let n=fj(r)?r:fs(this,dj).encode(_St(r)),o=fj(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=eOe(this,Yee,oOe).call(this,e,n).byteLength,t+=o,t+=fs(this,Gee)}return String(t+fs(this,cV).byteLength)}});var OSt=v(($wo,CSt)=>{CSt.exports=typeof self=="object"?self.FormData:window.FormData});var PSt=v(Ql=>{"use strict";var rAr=Ql&&Ql.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nAr=Ql&&Ql.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I$=Ql&&Ql.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rAr(e,t,r);return nAr(e,t),e},fA=Ql&&Ql.__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(Ql,"__esModule",{value:!0});Ql.WebFormData=Ql.Node16FormData=Ql.Node18FormData=Ql.newFormData=void 0;var Zee=_$();function iOe(t){return typeof t=="object"&&t!=null&&"name"in t}function oAr(){return fA(this,void 0,void 0,function*(){let t;return Zee.RUNTIME.type==="node"&&Zee.RUNTIME.parsedVersion!=null&&Zee.RUNTIME.parsedVersion>=18?t=new Xee:Zee.RUNTIME.type==="node"?t=new Qee:t=new ete,yield t.setup(),t})}Ql.newFormData=oAr;var Xee=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>I$(cSt()))).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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>I$(JH()))).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 fA(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>I$(xSt()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>I$(JH()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};Ql.Node18FormData=Xee;var Qee=class{setup(){return fA(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>I$(OSt()))).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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>I$(JH()))).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():{}}}};Ql.Node16FormData=Qee;var ete=class{setup(){return fA(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 fA(this,void 0,void 0,function*(){n==null&&iOe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};Ql.WebFormData=ete});var ESt=v(pj=>{"use strict";var iAr=pj&&pj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aAr=pj&&pj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iAr(e,t,r)};Object.defineProperty(pj,"__esModule",{value:!0});aAr(PSt(),pj)});var Uc=v(tte=>{"use strict";Object.defineProperty(tte,"__esModule",{value:!0});tte.SchemaType=void 0;tte.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 Dp=v(rte=>{"use strict";Object.defineProperty(rte,"__esModule",{value:!0});rte.getErrorMessageForIncorrectType=void 0;function sAr(t,e){return`Expected ${e}. Received ${uAr(t)}.`}rte.getErrorMessageForIncorrectType=sAr;function uAr(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 TO=v(nte=>{"use strict";Object.defineProperty(nte,"__esModule",{value:!0});nte.maybeSkipValidation=void 0;function lAr(t){return Object.assign(Object.assign({},t),{json:TSt(t.json),parse:TSt(t.parse)})}nte.maybeSkipValidation=lAr;function TSt(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 aOe=v(ote=>{"use strict";Object.defineProperty(ote,"__esModule",{value:!0});ote.stringifyValidationError=void 0;function cAr(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}ote.stringifyValidationError=cAr});var uOe=v(ite=>{"use strict";Object.defineProperty(ite,"__esModule",{value:!0});ite.JsonError=void 0;var dAr=aOe(),sOe=class t extends Error{constructor(e){super(e.map(dAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ite.JsonError=sOe});var cOe=v(ate=>{"use strict";Object.defineProperty(ate,"__esModule",{value:!0});ate.ParseError=void 0;var fAr=aOe(),lOe=class t extends Error{constructor(e){super(e.map(fAr.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ate.ParseError=lOe});var MSt=v(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.transform=pA.optional=pA.getSchemaUtils=void 0;var pAr=Uc(),mAr=uOe(),hAr=cOe();function dOe(t){return{optional:()=>ASt(t),transform:e=>ISt(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new hAr.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new mAr.JsonError(n.errors)}}}pA.getSchemaUtils=dOe;function ASt(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:()=>pAr.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),dOe(e))}pA.optional=ASt;function ISt(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),dOe(r))}pA.transform=ISt});var Lm=v(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.ParseError=ag.JsonError=ag.transform=ag.optional=ag.getSchemaUtils=void 0;var fOe=MSt();Object.defineProperty(ag,"getSchemaUtils",{enumerable:!0,get:function(){return fOe.getSchemaUtils}});Object.defineProperty(ag,"optional",{enumerable:!0,get:function(){return fOe.optional}});Object.defineProperty(ag,"transform",{enumerable:!0,get:function(){return fOe.transform}});var gAr=uOe();Object.defineProperty(ag,"JsonError",{enumerable:!0,get:function(){return gAr.JsonError}});var yAr=cOe();Object.defineProperty(ag,"ParseError",{enumerable:!0,get:function(){return yAr.ParseError}})});var RSt=v(ste=>{"use strict";Object.defineProperty(ste,"__esModule",{value:!0});ste.date=void 0;var bAr=Uc(),pOe=Dp(),_Ar=TO(),vAr=Lm(),wAr=/^([+-]?\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 SAr(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,pOe.getErrorMessageForIncorrectType)(e,"string")}]}:wAr.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,pOe.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,pOe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>bAr.SchemaType.DATE};return Object.assign(Object.assign({},(0,_Ar.maybeSkipValidation)(t)),(0,vAr.getSchemaUtils)(t))}ste.date=SAr});var jSt=v(ute=>{"use strict";Object.defineProperty(ute,"__esModule",{value:!0});ute.date=void 0;var xAr=RSt();Object.defineProperty(ute,"date",{enumerable:!0,get:function(){return xAr.date}})});var AO=v(lte=>{"use strict";Object.defineProperty(lte,"__esModule",{value:!0});lte.createIdentitySchemaCreator=void 0;var CAr=Lm(),OAr=TO();function PAr(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,OAr.maybeSkipValidation)(r)),(0,CAr.getSchemaUtils)(r))}}lte.createIdentitySchemaCreator=PAr});var DSt=v(cte=>{"use strict";Object.defineProperty(cte,"__esModule",{value:!0});cte.enum_=void 0;var EAr=Uc(),TAr=AO(),NSt=Dp();function AAr(t){let e=new Set(t);return(0,TAr.createIdentitySchemaCreator)(EAr.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,NSt.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,NSt.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}cte.enum_=AAr});var mOe=v(dte=>{"use strict";Object.defineProperty(dte,"__esModule",{value:!0});dte.enum_=void 0;var IAr=DSt();Object.defineProperty(dte,"enum_",{enumerable:!0,get:function(){return IAr.enum_}})});var hOe=v(mA=>{"use strict";Object.defineProperty(mA,"__esModule",{value:!0});mA.getMemoizedSchema=mA.constructLazyBaseSchema=mA.lazy=void 0;var MAr=Lm();function RAr(t){let e=LSt(t);return Object.assign(Object.assign({},e),(0,MAr.getSchemaUtils)(e))}mA.lazy=RAr;function LSt(t){return{parse:(e,r)=>fte(t).parse(e,r),json:(e,r)=>fte(t).json(e,r),getType:()=>fte(t).getType()}}mA.constructLazyBaseSchema=LSt;function fte(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}mA.getMemoizedSchema=fte});var gOe=v(pte=>{"use strict";Object.defineProperty(pte,"__esModule",{value:!0});pte.entries=void 0;function jAr(t){return Object.entries(t)}pte.entries=jAr});var yOe=v(mte=>{"use strict";Object.defineProperty(mte,"__esModule",{value:!0});mte.filterObject=void 0;function NAr(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}mte.filterObject=NAr});var fV=v(hte=>{"use strict";Object.defineProperty(hte,"__esModule",{value:!0});hte.isPlainObject=void 0;function DAr(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}hte.isPlainObject=DAr});var bOe=v(gte=>{"use strict";Object.defineProperty(gte,"__esModule",{value:!0});gte.keys=void 0;function LAr(t){return Object.keys(t)}gte.keys=LAr});var FSt=v(yte=>{"use strict";Object.defineProperty(yte,"__esModule",{value:!0});yte.partition=void 0;function FAr(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}yte.partition=FAr});var BSt=v(M$=>{"use strict";Object.defineProperty(M$,"__esModule",{value:!0});M$.withParsedProperties=M$.getObjectLikeUtils=void 0;var kAr=yOe(),$Ar=Dp(),BAr=fV(),qAr=Lm();function kSt(t){return{withParsedProperties:e=>$St(t,e)}}M$.getObjectLikeUtils=kSt;function $St(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,BAr.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,$Ar.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,kAr.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,qAr.getSchemaUtils)(r)),kSt(r))}M$.withParsedProperties=$St});var pV=v(R$=>{"use strict";Object.defineProperty(R$,"__esModule",{value:!0});R$.withParsedProperties=R$.getObjectLikeUtils=void 0;var qSt=BSt();Object.defineProperty(R$,"getObjectLikeUtils",{enumerable:!0,get:function(){return qSt.getObjectLikeUtils}});Object.defineProperty(R$,"withParsedProperties",{enumerable:!0,get:function(){return qSt.withParsedProperties}})});var _Oe=v(j$=>{"use strict";Object.defineProperty(j$,"__esModule",{value:!0});j$.isProperty=j$.property=void 0;function UAr(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}j$.property=UAr;function zAr(t){return t.isProperty}j$.isProperty=zAr});var wOe=v(N$=>{"use strict";Object.defineProperty(N$,"__esModule",{value:!0});N$.getObjectUtils=N$.object=void 0;var hV=Uc(),USt=gOe(),zSt=yOe(),HAr=Dp(),VAr=fV(),KSt=bOe(),WAr=TO(),KAr=FSt(),GSt=pV(),JSt=Lm(),mV=_Oe();function GAr(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,mV.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,KSt.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,USt.entries)(t)){let u=(0,mV.isProperty)(s)?s.rawKey:a,l=(0,mV.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,WSt(l)&&i.push(u)}return HSt({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,USt.entries)(t)){let s=(0,mV.isProperty)(a)?a.valueSchema:a;WSt(s)&&o.push(i)}return HSt({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,mV.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:()=>hV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,WAr.maybeSkipValidation)(e)),(0,JSt.getSchemaUtils)(e)),(0,GSt.getObjectLikeUtils)(e)),vOe(e))}N$.object=GAr;function HSt({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,VAr.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,HAr.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 vOe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>VSt({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>VSt({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>hV.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,JSt.getSchemaUtils)(r)),(0,GSt.getObjectLikeUtils)(r)),vOe(r))}}}N$.getObjectUtils=vOe;function VSt({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,KAr.partition)((0,KSt.keys)(e),l=>o.has(l)),s=r((0,zSt.filterObject)(e,a)),u=n((0,zSt.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 WSt(t){return!JAr(t)}function JAr(t){switch(t.getType()){case hV.SchemaType.ANY:case hV.SchemaType.UNKNOWN:case hV.SchemaType.OPTIONAL:return!0;default:return!1}}});var YSt=v(bte=>{"use strict";Object.defineProperty(bte,"__esModule",{value:!0});bte.objectWithoutOptionalProperties=void 0;var YAr=wOe();function ZAr(t){return(0,YAr.object)(t)}bte.objectWithoutOptionalProperties=ZAr});var SOe=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});sg.property=sg.isProperty=sg.objectWithoutOptionalProperties=sg.object=sg.getObjectUtils=void 0;var ZSt=wOe();Object.defineProperty(sg,"getObjectUtils",{enumerable:!0,get:function(){return ZSt.getObjectUtils}});Object.defineProperty(sg,"object",{enumerable:!0,get:function(){return ZSt.object}});var XAr=YSt();Object.defineProperty(sg,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return XAr.objectWithoutOptionalProperties}});var XSt=_Oe();Object.defineProperty(sg,"isProperty",{enumerable:!0,get:function(){return XSt.isProperty}});Object.defineProperty(sg,"property",{enumerable:!0,get:function(){return XSt.property}})});var QSt=v(_te=>{"use strict";Object.defineProperty(_te,"__esModule",{value:!0});_te.lazyObject=void 0;var QAr=SOe(),eIr=pV(),tIr=Lm(),xOe=hOe();function rIr(t){let e=Object.assign(Object.assign({},(0,xOe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,xOe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,xOe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,tIr.getSchemaUtils)(e)),(0,eIr.getObjectLikeUtils)(e)),(0,QAr.getObjectUtils)(e))}_te.lazyObject=rIr});var ext=v(D$=>{"use strict";Object.defineProperty(D$,"__esModule",{value:!0});D$.lazyObject=D$.lazy=void 0;var nIr=hOe();Object.defineProperty(D$,"lazy",{enumerable:!0,get:function(){return nIr.lazy}});var oIr=QSt();Object.defineProperty(D$,"lazyObject",{enumerable:!0,get:function(){return oIr.lazyObject}})});var rxt=v(vte=>{"use strict";Object.defineProperty(vte,"__esModule",{value:!0});vte.list=void 0;var iIr=Uc(),aIr=Dp(),sIr=TO(),uIr=Lm();function lIr(t){let e={parse:(r,n)=>txt(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)=>txt(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:()=>iIr.SchemaType.LIST};return Object.assign(Object.assign({},(0,sIr.maybeSkipValidation)(e)),(0,uIr.getSchemaUtils)(e))}vte.list=lIr;function txt(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,aIr.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var COe=v(wte=>{"use strict";Object.defineProperty(wte,"__esModule",{value:!0});wte.list=void 0;var cIr=rxt();Object.defineProperty(wte,"list",{enumerable:!0,get:function(){return cIr.list}})});var nxt=v(Ste=>{"use strict";Object.defineProperty(Ste,"__esModule",{value:!0});Ste.stringLiteral=void 0;var dIr=Uc(),fIr=AO(),pIr=Dp();function mIr(t){return(0,fIr.createIdentitySchemaCreator)(dIr.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,pIr.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}Ste.stringLiteral=mIr});var oxt=v(xte=>{"use strict";Object.defineProperty(xte,"__esModule",{value:!0});xte.booleanLiteral=void 0;var hIr=Uc(),gIr=AO(),yIr=Dp();function bIr(t){return(0,gIr.createIdentitySchemaCreator)(hIr.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,yIr.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}xte.booleanLiteral=bIr});var ixt=v(L$=>{"use strict";Object.defineProperty(L$,"__esModule",{value:!0});L$.booleanLiteral=L$.stringLiteral=void 0;var _Ir=nxt();Object.defineProperty(L$,"stringLiteral",{enumerable:!0,get:function(){return _Ir.stringLiteral}});var vIr=oxt();Object.defineProperty(L$,"booleanLiteral",{enumerable:!0,get:function(){return vIr.booleanLiteral}})});var axt=v(Cte=>{"use strict";Object.defineProperty(Cte,"__esModule",{value:!0});Cte.any=void 0;var wIr=Uc(),SIr=AO();Cte.any=(0,SIr.createIdentitySchemaCreator)(wIr.SchemaType.ANY,t=>({ok:!0,value:t}))});var sxt=v(Ote=>{"use strict";Object.defineProperty(Ote,"__esModule",{value:!0});Ote.boolean=void 0;var xIr=Uc(),CIr=AO(),OIr=Dp();Ote.boolean=(0,CIr.createIdentitySchemaCreator)(xIr.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,OIr.getErrorMessageForIncorrectType)(t,"boolean")}]})});var uxt=v(Pte=>{"use strict";Object.defineProperty(Pte,"__esModule",{value:!0});Pte.number=void 0;var PIr=Uc(),EIr=AO(),TIr=Dp();Pte.number=(0,EIr.createIdentitySchemaCreator)(PIr.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,TIr.getErrorMessageForIncorrectType)(t,"number")}]})});var lxt=v(Ete=>{"use strict";Object.defineProperty(Ete,"__esModule",{value:!0});Ete.string=void 0;var AIr=Uc(),IIr=AO(),MIr=Dp();Ete.string=(0,IIr.createIdentitySchemaCreator)(AIr.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,MIr.getErrorMessageForIncorrectType)(t,"string")}]})});var cxt=v(Tte=>{"use strict";Object.defineProperty(Tte,"__esModule",{value:!0});Tte.unknown=void 0;var RIr=Uc(),jIr=AO();Tte.unknown=(0,jIr.createIdentitySchemaCreator)(RIr.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var dxt=v(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});ug.unknown=ug.string=ug.number=ug.boolean=ug.any=void 0;var NIr=axt();Object.defineProperty(ug,"any",{enumerable:!0,get:function(){return NIr.any}});var DIr=sxt();Object.defineProperty(ug,"boolean",{enumerable:!0,get:function(){return DIr.boolean}});var LIr=uxt();Object.defineProperty(ug,"number",{enumerable:!0,get:function(){return LIr.number}});var FIr=lxt();Object.defineProperty(ug,"string",{enumerable:!0,get:function(){return FIr.string}});var kIr=cxt();Object.defineProperty(ug,"unknown",{enumerable:!0,get:function(){return kIr.unknown}})});var pxt=v(Ate=>{"use strict";Object.defineProperty(Ate,"__esModule",{value:!0});Ate.record=void 0;var OOe=Uc(),$Ir=gOe(),BIr=Dp(),qIr=fV(),UIr=TO(),zIr=Lm();function HIr(t,e){let r={parse:(n,o)=>fxt({value:n,isKeyNumeric:t.getType()===OOe.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)=>fxt({value:n,isKeyNumeric:t.getType()===OOe.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:()=>OOe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,UIr.maybeSkipValidation)(r)),(0,zIr.getSchemaUtils)(r))}Ate.record=HIr;function fxt({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,qIr.isPlainObject)(t)?(0,$Ir.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,BIr.getErrorMessageForIncorrectType)(t,"object")}]}}});var mxt=v(Ite=>{"use strict";Object.defineProperty(Ite,"__esModule",{value:!0});Ite.record=void 0;var VIr=pxt();Object.defineProperty(Ite,"record",{enumerable:!0,get:function(){return VIr.record}})});var hxt=v(Mte=>{"use strict";Object.defineProperty(Mte,"__esModule",{value:!0});Mte.set=void 0;var WIr=Uc(),KIr=Dp(),GIr=TO(),JIr=COe(),YIr=Lm();function ZIr(t){let e=(0,JIr.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,KIr.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>WIr.SchemaType.SET};return Object.assign(Object.assign({},(0,GIr.maybeSkipValidation)(r)),(0,YIr.getSchemaUtils)(r))}Mte.set=ZIr});var gxt=v(Rte=>{"use strict";Object.defineProperty(Rte,"__esModule",{value:!0});Rte.set=void 0;var XIr=hxt();Object.defineProperty(Rte,"set",{enumerable:!0,get:function(){return XIr.set}})});var bxt=v(jte=>{"use strict";Object.defineProperty(jte,"__esModule",{value:!0});jte.undiscriminatedUnion=void 0;var QIr=Uc(),eMr=TO(),tMr=Lm();function rMr(t){let e={parse:(r,n)=>yxt((o,i)=>o.parse(r,i),t,n),json:(r,n)=>yxt((o,i)=>o.json(r,i),t,n),getType:()=>QIr.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,eMr.maybeSkipValidation)(e)),(0,tMr.getSchemaUtils)(e))}jte.undiscriminatedUnion=rMr;function yxt(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 _xt=v(Nte=>{"use strict";Object.defineProperty(Nte,"__esModule",{value:!0});Nte.undiscriminatedUnion=void 0;var nMr=bxt();Object.defineProperty(Nte,"undiscriminatedUnion",{enumerable:!0,get:function(){return nMr.undiscriminatedUnion}})});var vxt=v(Dte=>{"use strict";Object.defineProperty(Dte,"__esModule",{value:!0});Dte.discriminant=void 0;function oMr(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}Dte.discriminant=oMr});var Sxt=v(F$=>{"use strict";var iMr=F$&&F$.__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(F$,"__esModule",{value:!0});F$.union=void 0;var aMr=Uc(),sMr=Dp(),uMr=fV(),lMr=bOe(),cMr=TO(),dMr=mOe(),fMr=pV(),pMr=Lm();function mMr(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,dMr.enum_)((0,lMr.keys)(e)),i={parse:(a,s)=>wxt({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)=>wxt({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:()=>aMr.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,cMr.maybeSkipValidation)(i)),(0,pMr.getSchemaUtils)(i)),(0,fMr.getObjectLikeUtils)(i))}F$.union=mMr;function wxt({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,uMr.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,sMr.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=iMr(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 xxt=v(k$=>{"use strict";Object.defineProperty(k$,"__esModule",{value:!0});k$.union=k$.discriminant=void 0;var hMr=vxt();Object.defineProperty(k$,"discriminant",{enumerable:!0,get:function(){return hMr.discriminant}});var gMr=Sxt();Object.defineProperty(k$,"union",{enumerable:!0,get:function(){return gMr.union}})});var Cxt=v(Ml=>{"use strict";var yMr=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]}),Fm=Ml&&Ml.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yMr(e,t,r)};Object.defineProperty(Ml,"__esModule",{value:!0});Fm(jSt(),Ml);Fm(mOe(),Ml);Fm(ext(),Ml);Fm(COe(),Ml);Fm(ixt(),Ml);Fm(SOe(),Ml);Fm(pV(),Ml);Fm(dxt(),Ml);Fm(mxt(),Ml);Fm(Lm(),Ml);Fm(gxt(),Ml);Fm(_xt(),Ml);Fm(xxt(),Ml)});var Oxt=v(mj=>{"use strict";var bMr=mj&&mj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Mr=mj&&mj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bMr(e,t,r)};Object.defineProperty(mj,"__esModule",{value:!0});_Mr(Cxt(),mj)});var G=v(zc=>{"use strict";var Pxt=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]}),vMr=zc&&zc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=zc&&zc.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pxt(e,t,r)},wMr=zc&&zc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Pxt(e,t,r);return vMr(e,t),e};Object.defineProperty(zc,"__esModule",{value:!0});zc.serialization=void 0;gV(Z0t(),zc);gV(rSt(),zc);gV(sSt(),zc);gV(_$(),zc);gV(ESt(),zc);zc.serialization=wMr(Oxt())});var Txt=v(Vs=>{"use strict";var yV=Vs&&Vs.__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())})},bV=Vs&&Vs.__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)}},Ta=Vs&&Vs.__await||function(t){return this instanceof Ta?(this.v=t,this):new Ta(t)},_V=Vs&&Vs.__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 Ta?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(Vs,"__esModule",{value:!0});Vs.readableStreamAsyncIterable=Vs._decodeChunks=Vs.LineDecoder=Vs._iterSSEMessages=Vs.StreamUtils=void 0;var $$=As(),POe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return _V(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=bV(Ext(e,r)),c;c=yield Ta(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 $$.CohereError({message:`Error: ${f.error}`});yield yield Ta(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 $$.CohereError({message:`Error: ${f.message}, ${f.error}`});yield yield Ta({event:d.event,data:f})}}}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&(yield Ta(s.call(l)))}finally{if(a)throw a.error}}u=!0}catch(d){if(d instanceof Error&&d.name==="AbortError")return yield Ta(void 0);throw d}finally{u||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return _V(this,arguments,function*(){var s,u;let l=new hA,c=TOe(e);try{for(var d=bV(c),f;f=yield Ta(d.next()),!f.done;){let p=f.value;for(let m of l.decode(p))yield yield Ta(m)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(u=d.return)&&(yield Ta(u.call(d)))}finally{if(s)throw s.error}}for(let p of l.flush())yield yield Ta(p)})}function i(){return _V(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=bV(o()),d;d=yield Ta(c.next()),!d.done;){let f=d.value;l||f&&(yield yield Ta(JSON.parse(f)))}}catch(f){s={error:f}}finally{try{d&&!d.done&&(u=c.return)&&(yield Ta(u.call(c)))}finally{if(s)throw s.error}}l=!0}catch(f){if(f instanceof Error&&f.name==="AbortError")return yield Ta(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 yV(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return yV(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 yV(this,void 0,void 0,function*(){yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Vs.StreamUtils=POe;function Ext(t,e){return _V(this,arguments,function*(){var n,o;if(!t.body)throw e?.abort(),new $$.CohereError({message:"Attempted to iterate over a response with no body"});let i=new EOe,a=new hA,s=TOe(t.body);try{for(var u=bV(SMr(s)),l;l=yield Ta(u.next()),!l.done;){let c=l.value;for(let d of a.decode(c)){let f=i.decode(d);f&&(yield yield Ta(f))}}}catch(c){n={error:c}}finally{try{l&&!l.done&&(o=u.return)&&(yield Ta(o.call(u)))}finally{if(n)throw n.error}}for(let c of a.flush()){let d=i.decode(c);d&&(yield yield Ta(d))}})}Vs._iterSSEMessages=Ext;function SMr(t){return _V(this,arguments,function*(){var r,n;let o=new Uint8Array;try{for(var i=bV(t),a;a=yield Ta(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=xMr(o))!==-1;)yield yield Ta(o.slice(0,c)),o=o.slice(c)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&(yield Ta(n.call(i)))}finally{if(r)throw r.error}}o.length>0&&(yield yield Ta(o))})}function xMr(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 EOe=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]=OMr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},hA=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 $$.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 $$.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new $$.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}};Vs.LineDecoder=hA;hA.NEWLINE_CHARS=new Set([`
`,"\r"]);hA.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function CMr(t){let e=new hA,r=[];for(let n of t)r.push(...e.decode(n));return r}Vs._decodeChunks=CMr;function OMr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function TOe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return yV(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 yV(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}Vs.readableStreamAsyncIterable=TOe});var AOe=v(Z_=>{"use strict";var PMr=Z_&&Z_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EMr=Z_&&Z_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TMr=Z_&&Z_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&PMr(e,t,r);return EMr(e,t),e};Object.defineProperty(Z_,"__esModule",{value:!0});Z_.V2ChatStreamRequestCitationMode=void 0;var AMr=TMr(G());Z_.V2ChatStreamRequestCitationMode=AMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var IOe=v(X_=>{"use strict";var IMr=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]}),MMr=X_&&X_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RMr=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)&&IMr(e,t,r);return MMr(e,t),e};Object.defineProperty(X_,"__esModule",{value:!0});X_.V2ChatRequestCitationMode=void 0;var jMr=RMr(G());X_.V2ChatRequestCitationMode=jMr.serialization.enum_(["FAST","ACCURATE","OFF"])});var B$=v(Q_=>{"use strict";var NMr=Q_&&Q_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DMr=Q_&&Q_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LMr=Q_&&Q_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&NMr(e,t,r);return DMr(e,t),e};Object.defineProperty(Q_,"__esModule",{value:!0});Q_.TextContent=void 0;var Axt=LMr(G());Q_.TextContent=Axt.serialization.object({text:Axt.serialization.string()})});var MOe=v(ev=>{"use strict";var FMr=ev&&ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kMr=ev&&ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Mr=ev&&ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&FMr(e,t,r);return kMr(e,t),e};Object.defineProperty(ev,"__esModule",{value:!0});ev.Content=void 0;var BMr=$Mr(G()),qMr=B$();ev.Content=BMr.serialization.union("type",{text:qMr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var jOe=v(tv=>{"use strict";var UMr=tv&&tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zMr=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HMr=tv&&tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UMr(e,t,r);return zMr(e,t),e};Object.defineProperty(tv,"__esModule",{value:!0});tv.UserMessageContent=void 0;var ROe=HMr(G()),VMr=MOe();tv.UserMessageContent=ROe.serialization.undiscriminatedUnion([ROe.serialization.string(),ROe.serialization.list(VMr.Content)])});var hj=v(rv=>{"use strict";var WMr=rv&&rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KMr=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMr=rv&&rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&WMr(e,t,r);return KMr(e,t),e};Object.defineProperty(rv,"__esModule",{value:!0});rv.ChatDocument=void 0;var NOe=GMr(G());rv.ChatDocument=NOe.serialization.record(NOe.serialization.string(),NOe.serialization.string())});var DOe=v(nv=>{"use strict";var JMr=nv&&nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YMr=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZMr=nv&&nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JMr(e,t,r);return YMr(e,t),e};Object.defineProperty(nv,"__esModule",{value:!0});nv.UserMessage=void 0;var Ixt=ZMr(G()),XMr=jOe(),QMr=hj();nv.UserMessage=Ixt.serialization.object({content:XMr.UserMessageContent,documents:Ixt.serialization.list(QMr.ChatDocument).optional()})});var FOe=v(ov=>{"use strict";var eRr=ov&&ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tRr=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rRr=ov&&ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&eRr(e,t,r);return tRr(e,t),e};Object.defineProperty(ov,"__esModule",{value:!0});ov.ToolCall2Function=void 0;var LOe=rRr(G());ov.ToolCall2Function=LOe.serialization.object({name:LOe.serialization.string().optional(),arguments:LOe.serialization.string().optional()})});var Lte=v(iv=>{"use strict";var nRr=iv&&iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oRr=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iRr=iv&&iv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nRr(e,t,r);return oRr(e,t),e};Object.defineProperty(iv,"__esModule",{value:!0});iv.ToolCall2=void 0;var kOe=iRr(G()),aRr=FOe();iv.ToolCall2=kOe.serialization.object({id:kOe.serialization.string().optional(),type:kOe.serialization.stringLiteral("function").optional(),function:aRr.ToolCall2Function.optional()})});var $Oe=v(av=>{"use strict";var sRr=av&&av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uRr=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lRr=av&&av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sRr(e,t,r);return uRr(e,t),e};Object.defineProperty(av,"__esModule",{value:!0});av.ToolSource=void 0;var q$=lRr(G());av.ToolSource=q$.serialization.object({id:q$.serialization.string().optional(),toolOutput:q$.serialization.property("tool_output",q$.serialization.record(q$.serialization.string(),q$.serialization.unknown()).optional())})});var BOe=v(sv=>{"use strict";var cRr=sv&&sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dRr=sv&&sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fRr=sv&&sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cRr(e,t,r);return dRr(e,t),e};Object.defineProperty(sv,"__esModule",{value:!0});sv.DocumentSource=void 0;var vV=fRr(G());sv.DocumentSource=vV.serialization.object({id:vV.serialization.string().optional(),document:vV.serialization.record(vV.serialization.string(),vV.serialization.unknown()).optional()})});var qOe=v(uv=>{"use strict";var pRr=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]}),mRr=uv&&uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hRr=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)&&pRr(e,t,r);return mRr(e,t),e};Object.defineProperty(uv,"__esModule",{value:!0});uv.Source=void 0;var gRr=hRr(G()),yRr=$Oe(),bRr=BOe();uv.Source=gRr.serialization.union("type",{tool:yRr.ToolSource,document:bRr.DocumentSource}).transform({transform:t=>t,untransform:t=>t})});var SV=v(lv=>{"use strict";var _Rr=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]}),vRr=lv&&lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wRr=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)&&_Rr(e,t,r);return vRr(e,t),e};Object.defineProperty(lv,"__esModule",{value:!0});lv.Citation=void 0;var wV=wRr(G()),SRr=qOe();lv.Citation=wV.serialization.object({start:wV.serialization.number().optional(),end:wV.serialization.number().optional(),text:wV.serialization.string().optional(),sources:wV.serialization.list(SRr.Source).optional()})});var UOe=v(cv=>{"use strict";var xRr=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]}),CRr=cv&&cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORr=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)&&xRr(e,t,r);return CRr(e,t),e};Object.defineProperty(cv,"__esModule",{value:!0});cv.AssistantMessageContentItem=void 0;var PRr=ORr(G()),ERr=B$();cv.AssistantMessageContentItem=PRr.serialization.union("type",{text:ERr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var HOe=v(dv=>{"use strict";var TRr=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]}),ARr=dv&&dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IRr=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)&&TRr(e,t,r);return ARr(e,t),e};Object.defineProperty(dv,"__esModule",{value:!0});dv.AssistantMessageContent=void 0;var zOe=IRr(G()),MRr=UOe();dv.AssistantMessageContent=zOe.serialization.undiscriminatedUnion([zOe.serialization.string(),zOe.serialization.list(MRr.AssistantMessageContentItem)])});var VOe=v(fv=>{"use strict";var RRr=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]}),jRr=fv&&fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NRr=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)&&RRr(e,t,r);return jRr(e,t),e};Object.defineProperty(fv,"__esModule",{value:!0});fv.AssistantMessage=void 0;var U$=NRr(G()),DRr=Lte(),LRr=HOe(),FRr=SV();fv.AssistantMessage=U$.serialization.object({toolCalls:U$.serialization.property("tool_calls",U$.serialization.list(DRr.ToolCall2).optional()),toolPlan:U$.serialization.property("tool_plan",U$.serialization.string().optional()),content:LRr.AssistantMessageContent.optional(),citations:U$.serialization.list(FRr.Citation).optional()})});var WOe=v(pv=>{"use strict";var kRr=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]}),$Rr=pv&&pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BRr=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)&&kRr(e,t,r);return $Rr(e,t),e};Object.defineProperty(pv,"__esModule",{value:!0});pv.SystemMessageContentItem=void 0;var qRr=BRr(G()),URr=B$();pv.SystemMessageContentItem=qRr.serialization.union("type",{text:URr.TextContent}).transform({transform:t=>t,untransform:t=>t})});var GOe=v(mv=>{"use strict";var zRr=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]}),HRr=mv&&mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRr=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)&&zRr(e,t,r);return HRr(e,t),e};Object.defineProperty(mv,"__esModule",{value:!0});mv.SystemMessageContent=void 0;var KOe=VRr(G()),WRr=WOe();mv.SystemMessageContent=KOe.serialization.undiscriminatedUnion([KOe.serialization.string(),KOe.serialization.list(WRr.SystemMessageContentItem)])});var JOe=v(hv=>{"use strict";var KRr=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]}),GRr=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JRr=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)&&KRr(e,t,r);return GRr(e,t),e};Object.defineProperty(hv,"__esModule",{value:!0});hv.SystemMessage=void 0;var YRr=JRr(G()),ZRr=GOe();hv.SystemMessage=YRr.serialization.object({content:ZRr.SystemMessageContent})});var YOe=v(gv=>{"use strict";var XRr=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]}),QRr=gv&&gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1r=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)&&XRr(e,t,r);return QRr(e,t),e};Object.defineProperty(gv,"__esModule",{value:!0});gv.ToolContent=void 0;var Fte=e1r(G());gv.ToolContent=Fte.serialization.object({output:Fte.serialization.record(Fte.serialization.string(),Fte.serialization.unknown())})});var ZOe=v(yv=>{"use strict";var t1r=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]}),r1r=yv&&yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1r=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)&&t1r(e,t,r);return r1r(e,t),e};Object.defineProperty(yv,"__esModule",{value:!0});yv.ToolMessage2ToolContentItem=void 0;var o1r=n1r(G()),i1r=YOe();yv.ToolMessage2ToolContentItem=o1r.serialization.union("type",{tool_result_object:i1r.ToolContent}).transform({transform:t=>t,untransform:t=>t})});var XOe=v(bv=>{"use strict";var a1r=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]}),s1r=bv&&bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1r=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)&&a1r(e,t,r);return s1r(e,t),e};Object.defineProperty(bv,"__esModule",{value:!0});bv.ToolMessage2=void 0;var xV=u1r(G()),l1r=ZOe();bv.ToolMessage2=xV.serialization.object({toolCallId:xV.serialization.property("tool_call_id",xV.serialization.string()),toolContent:xV.serialization.property("tool_content",xV.serialization.list(l1r.ToolMessage2ToolContentItem))})});var QOe=v(_v=>{"use strict";var c1r=_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]}),d1r=_v&&_v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f1r=_v&&_v.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&c1r(e,t,r);return d1r(e,t),e};Object.defineProperty(_v,"__esModule",{value:!0});_v.ChatMessage2=void 0;var p1r=f1r(G()),m1r=DOe(),h1r=VOe(),g1r=JOe(),y1r=XOe();_v.ChatMessage2=p1r.serialization.union("role",{user:m1r.UserMessage,assistant:h1r.AssistantMessage,system:g1r.SystemMessage,tool:y1r.ToolMessage2}).transform({transform:t=>t,untransform:t=>t})});var kte=v(vv=>{"use strict";var b1r=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]}),_1r=vv&&vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v1r=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)&&b1r(e,t,r);return _1r(e,t),e};Object.defineProperty(vv,"__esModule",{value:!0});vv.ChatMessages=void 0;var w1r=v1r(G()),S1r=QOe();vv.ChatMessages=w1r.serialization.list(S1r.ChatMessage2)});var ePe=v(wv=>{"use strict";var x1r=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]}),C1r=wv&&wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1r=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)&&x1r(e,t,r);return C1r(e,t),e};Object.defineProperty(wv,"__esModule",{value:!0});wv.Tool2Function=void 0;var z$=O1r(G());wv.Tool2Function=z$.serialization.object({name:z$.serialization.string().optional(),description:z$.serialization.string().optional(),parameters:z$.serialization.record(z$.serialization.string(),z$.serialization.unknown()).optional()})});var $te=v(Sv=>{"use strict";var P1r=Sv&&Sv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E1r=Sv&&Sv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T1r=Sv&&Sv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&P1r(e,t,r);return E1r(e,t),e};Object.defineProperty(Sv,"__esModule",{value:!0});Sv.Tool2=void 0;var Mxt=T1r(G()),A1r=ePe();Sv.Tool2=Mxt.serialization.object({type:Mxt.serialization.stringLiteral("function").optional(),function:A1r.Tool2Function.optional()})});var Bte=v(xv=>{"use strict";var I1r=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]}),M1r=xv&&xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R1r=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)&&I1r(e,t,r);return M1r(e,t),e};Object.defineProperty(xv,"__esModule",{value:!0});xv.ChatFinishReason=void 0;var j1r=R1r(G());xv.ChatFinishReason=j1r.serialization.enum_(["complete","stop_sequence","max_tokens","tool_call","error","content_blocked","error_limit"])});var tPe=v(Cv=>{"use strict";var N1r=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]}),D1r=Cv&&Cv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L1r=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)&&N1r(e,t,r);return D1r(e,t),e};Object.defineProperty(Cv,"__esModule",{value:!0});Cv.AssistantMessageResponseContentItem=void 0;var F1r=L1r(G()),k1r=B$();Cv.AssistantMessageResponseContentItem=F1r.serialization.union("type",{text:k1r.TextContent}).transform({transform:t=>t,untransform:t=>t})});var rPe=v(Ov=>{"use strict";var $1r=Ov&&Ov.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B1r=Ov&&Ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q1r=Ov&&Ov.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$1r(e,t,r);return B1r(e,t),e};Object.defineProperty(Ov,"__esModule",{value:!0});Ov.AssistantMessageResponse=void 0;var gA=q1r(G()),U1r=Lte(),z1r=tPe(),H1r=SV();Ov.AssistantMessageResponse=gA.serialization.object({role:gA.serialization.stringLiteral("assistant"),toolCalls:gA.serialization.property("tool_calls",gA.serialization.list(U1r.ToolCall2).optional()),toolPlan:gA.serialization.property("tool_plan",gA.serialization.string().optional()),content:gA.serialization.list(z1r.AssistantMessageResponseContentItem).optional(),citations:gA.serialization.list(H1r.Citation).optional()})});var nPe=v(Pv=>{"use strict";var V1r=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]}),W1r=Pv&&Pv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K1r=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)&&V1r(e,t,r);return W1r(e,t),e};Object.defineProperty(Pv,"__esModule",{value:!0});Pv.UsageBilledUnits=void 0;var yA=K1r(G());Pv.UsageBilledUnits=yA.serialization.object({inputTokens:yA.serialization.property("input_tokens",yA.serialization.number().optional()),outputTokens:yA.serialization.property("output_tokens",yA.serialization.number().optional()),searchUnits:yA.serialization.property("search_units",yA.serialization.number().optional()),classifications:yA.serialization.number().optional()})});var oPe=v(Ev=>{"use strict";var G1r=Ev&&Ev.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J1r=Ev&&Ev.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y1r=Ev&&Ev.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&G1r(e,t,r);return J1r(e,t),e};Object.defineProperty(Ev,"__esModule",{value:!0});Ev.UsageTokens=void 0;var CV=Y1r(G());Ev.UsageTokens=CV.serialization.object({inputTokens:CV.serialization.property("input_tokens",CV.serialization.number().optional()),outputTokens:CV.serialization.property("output_tokens",CV.serialization.number().optional())})});var qte=v(Tv=>{"use strict";var Z1r=Tv&&Tv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X1r=Tv&&Tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q1r=Tv&&Tv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z1r(e,t,r);return X1r(e,t),e};Object.defineProperty(Tv,"__esModule",{value:!0});Tv.Usage=void 0;var Rxt=Q1r(G()),ejr=nPe(),tjr=oPe();Tv.Usage=Rxt.serialization.object({billedUnits:Rxt.serialization.property("billed_units",ejr.UsageBilledUnits.optional()),tokens:tjr.UsageTokens.optional()})});var jxt=v(Av=>{"use strict";var rjr=Av&&Av.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),njr=Av&&Av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ojr=Av&&Av.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rjr(e,t,r);return njr(e,t),e};Object.defineProperty(Av,"__esModule",{value:!0});Av.NonStreamedChatResponse2=void 0;var Ute=ojr(G()),ijr=Bte(),ajr=rPe(),sjr=qte();Av.NonStreamedChatResponse2=Ute.serialization.object({id:Ute.serialization.string(),finishReason:Ute.serialization.property("finish_reason",ijr.ChatFinishReason),prompt:Ute.serialization.string().optional(),message:ajr.AssistantMessageResponse.optional(),usage:sjr.Usage.optional()})});var km=v(Iv=>{"use strict";var ujr=Iv&&Iv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Iv&&Iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cjr=Iv&&Iv.__importStar||function(t){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(Iv,"__esModule",{value:!0});Iv.ChatStreamEventType=void 0;var djr=cjr(G());Iv.ChatStreamEventType=djr.serialization.object({})});var iPe=v(Mv=>{"use strict";var fjr=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]}),pjr=Mv&&Mv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mjr=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)&&fjr(e,t,r);return pjr(e,t),e};Object.defineProperty(Mv,"__esModule",{value:!0});Mv.ChatMessageStartEventDeltaMessage=void 0;var Nxt=mjr(G());Mv.ChatMessageStartEventDeltaMessage=Nxt.serialization.object({role:Nxt.serialization.stringLiteral("assistant").optional()})});var aPe=v(Rv=>{"use strict";var hjr=Rv&&Rv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gjr=Rv&&Rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yjr=Rv&&Rv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hjr(e,t,r);return gjr(e,t),e};Object.defineProperty(Rv,"__esModule",{value:!0});Rv.ChatMessageStartEventDelta=void 0;var bjr=yjr(G()),_jr=iPe();Rv.ChatMessageStartEventDelta=bjr.serialization.object({message:_jr.ChatMessageStartEventDeltaMessage.optional()})});var sPe=v(jv=>{"use strict";var vjr=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]}),wjr=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sjr=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)&&vjr(e,t,r);return wjr(e,t),e};Object.defineProperty(jv,"__esModule",{value:!0});jv.ChatMessageStartEvent=void 0;var Dxt=Sjr(G()),xjr=aPe(),Cjr=km();jv.ChatMessageStartEvent=Dxt.serialization.object({id:Dxt.serialization.string().optional(),delta:xjr.ChatMessageStartEventDelta.optional()}).extend(Cjr.ChatStreamEventType)});var lPe=v(Nv=>{"use strict";var Ojr=Nv&&Nv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pjr=Nv&&Nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ejr=Nv&&Nv.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ojr(e,t,r);return Pjr(e,t),e};Object.defineProperty(Nv,"__esModule",{value:!0});Nv.ChatContentStartEventDeltaMessageContent=void 0;var uPe=Ejr(G());Nv.ChatContentStartEventDeltaMessageContent=uPe.serialization.object({text:uPe.serialization.string().optional(),type:uPe.serialization.stringLiteral("text").optional()})});var cPe=v(Dv=>{"use strict";var Tjr=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]}),Ajr=Dv&&Dv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ijr=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)&&Tjr(e,t,r);return Ajr(e,t),e};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.ChatContentStartEventDeltaMessage=void 0;var Mjr=Ijr(G()),Rjr=lPe();Dv.ChatContentStartEventDeltaMessage=Mjr.serialization.object({content:Rjr.ChatContentStartEventDeltaMessageContent.optional()})});var dPe=v(Lv=>{"use strict";var jjr=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]}),Njr=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Djr=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)&&jjr(e,t,r);return Njr(e,t),e};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.ChatContentStartEventDelta=void 0;var Ljr=Djr(G()),Fjr=cPe();Lv.ChatContentStartEventDelta=Ljr.serialization.object({message:Fjr.ChatContentStartEventDeltaMessage.optional()})});var fPe=v(Fv=>{"use strict";var kjr=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]}),$jr=Fv&&Fv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bjr=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)&&kjr(e,t,r);return $jr(e,t),e};Object.defineProperty(Fv,"__esModule",{value:!0});Fv.ChatContentStartEvent=void 0;var Lxt=Bjr(G()),qjr=dPe(),Ujr=km();Fv.ChatContentStartEvent=Lxt.serialization.object({index:Lxt.serialization.number().optional(),delta:qjr.ChatContentStartEventDelta.optional()}).extend(Ujr.ChatStreamEventType)});var pPe=v(kv=>{"use strict";var zjr=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]}),Hjr=kv&&kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vjr=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)&&zjr(e,t,r);return Hjr(e,t),e};Object.defineProperty(kv,"__esModule",{value:!0});kv.ChatContentDeltaEventDeltaMessageContent=void 0;var Fxt=Vjr(G());kv.ChatContentDeltaEventDeltaMessageContent=Fxt.serialization.object({text:Fxt.serialization.string().optional()})});var mPe=v($v=>{"use strict";var Wjr=$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]}),Kjr=$v&&$v.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gjr=$v&&$v.__importStar||function(t){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($v,"__esModule",{value:!0});$v.ChatContentDeltaEventDeltaMessage=void 0;var Jjr=Gjr(G()),Yjr=pPe();$v.ChatContentDeltaEventDeltaMessage=Jjr.serialization.object({content:Yjr.ChatContentDeltaEventDeltaMessageContent.optional()})});var hPe=v(Bv=>{"use strict";var Zjr=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]}),Xjr=Bv&&Bv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qjr=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)&&Zjr(e,t,r);return Xjr(e,t),e};Object.defineProperty(Bv,"__esModule",{value:!0});Bv.ChatContentDeltaEventDelta=void 0;var eNr=Qjr(G()),tNr=mPe();Bv.ChatContentDeltaEventDelta=eNr.serialization.object({message:tNr.ChatContentDeltaEventDeltaMessage.optional()})});var gPe=v(qv=>{"use strict";var rNr=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]}),nNr=qv&&qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oNr=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)&&rNr(e,t,r);return nNr(e,t),e};Object.defineProperty(qv,"__esModule",{value:!0});qv.ChatContentDeltaEvent=void 0;var kxt=oNr(G()),iNr=hPe(),aNr=km();qv.ChatContentDeltaEvent=kxt.serialization.object({index:kxt.serialization.number().optional(),delta:iNr.ChatContentDeltaEventDelta.optional()}).extend(aNr.ChatStreamEventType)});var yPe=v(Uv=>{"use strict";var sNr=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]}),uNr=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lNr=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)&&sNr(e,t,r);return uNr(e,t),e};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.ChatContentEndEvent=void 0;var $xt=lNr(G()),cNr=km();Uv.ChatContentEndEvent=$xt.serialization.object({index:$xt.serialization.number().optional()}).extend(cNr.ChatStreamEventType)});var _Pe=v(zv=>{"use strict";var dNr=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]}),fNr=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pNr=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)&&dNr(e,t,r);return fNr(e,t),e};Object.defineProperty(zv,"__esModule",{value:!0});zv.ChatToolPlanDeltaEventDelta=void 0;var bPe=pNr(G());zv.ChatToolPlanDeltaEventDelta=bPe.serialization.object({toolPlan:bPe.serialization.property("tool_plan",bPe.serialization.string().optional())})});var vPe=v(Hv=>{"use strict";var mNr=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]}),hNr=Hv&&Hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gNr=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)&&mNr(e,t,r);return hNr(e,t),e};Object.defineProperty(Hv,"__esModule",{value:!0});Hv.ChatToolPlanDeltaEvent=void 0;var yNr=gNr(G()),bNr=_Pe(),_Nr=km();Hv.ChatToolPlanDeltaEvent=yNr.serialization.object({delta:bNr.ChatToolPlanDeltaEventDelta.optional()}).extend(_Nr.ChatStreamEventType)});var SPe=v(Vv=>{"use strict";var vNr=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]}),wNr=Vv&&Vv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SNr=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)&&vNr(e,t,r);return wNr(e,t),e};Object.defineProperty(Vv,"__esModule",{value:!0});Vv.ChatToolCallStartEventDeltaToolCallFunction=void 0;var wPe=SNr(G());Vv.ChatToolCallStartEventDeltaToolCallFunction=wPe.serialization.object({name:wPe.serialization.string().optional(),arguments:wPe.serialization.string().optional()})});var CPe=v(Wv=>{"use strict";var xNr=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]}),CNr=Wv&&Wv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ONr=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)&&xNr(e,t,r);return CNr(e,t),e};Object.defineProperty(Wv,"__esModule",{value:!0});Wv.ChatToolCallStartEventDeltaToolCall=void 0;var xPe=ONr(G()),PNr=SPe();Wv.ChatToolCallStartEventDeltaToolCall=xPe.serialization.object({id:xPe.serialization.string().optional(),type:xPe.serialization.stringLiteral("function").optional(),function:PNr.ChatToolCallStartEventDeltaToolCallFunction.optional()})});var OPe=v(Kv=>{"use strict";var ENr=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]}),TNr=Kv&&Kv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ANr=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)&&ENr(e,t,r);return TNr(e,t),e};Object.defineProperty(Kv,"__esModule",{value:!0});Kv.ChatToolCallStartEventDelta=void 0;var Bxt=ANr(G()),INr=CPe();Kv.ChatToolCallStartEventDelta=Bxt.serialization.object({toolCall:Bxt.serialization.property("tool_call",INr.ChatToolCallStartEventDeltaToolCall.optional())})});var PPe=v(Gv=>{"use strict";var MNr=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]}),RNr=Gv&&Gv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jNr=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)&&MNr(e,t,r);return RNr(e,t),e};Object.defineProperty(Gv,"__esModule",{value:!0});Gv.ChatToolCallStartEvent=void 0;var qxt=jNr(G()),NNr=OPe(),DNr=km();Gv.ChatToolCallStartEvent=qxt.serialization.object({index:qxt.serialization.number().optional(),delta:NNr.ChatToolCallStartEventDelta.optional()}).extend(DNr.ChatStreamEventType)});var EPe=v(Jv=>{"use strict";var LNr=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]}),FNr=Jv&&Jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kNr=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)&&LNr(e,t,r);return FNr(e,t),e};Object.defineProperty(Jv,"__esModule",{value:!0});Jv.ChatToolCallDeltaEventDeltaToolCallFunction=void 0;var Uxt=kNr(G());Jv.ChatToolCallDeltaEventDeltaToolCallFunction=Uxt.serialization.object({arguments:Uxt.serialization.string().optional()})});var TPe=v(Yv=>{"use strict";var $Nr=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]}),BNr=Yv&&Yv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qNr=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)&&$Nr(e,t,r);return BNr(e,t),e};Object.defineProperty(Yv,"__esModule",{value:!0});Yv.ChatToolCallDeltaEventDeltaToolCall=void 0;var UNr=qNr(G()),zNr=EPe();Yv.ChatToolCallDeltaEventDeltaToolCall=UNr.serialization.object({function:zNr.ChatToolCallDeltaEventDeltaToolCallFunction.optional()})});var APe=v(Zv=>{"use strict";var HNr=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]}),VNr=Zv&&Zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WNr=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)&&HNr(e,t,r);return VNr(e,t),e};Object.defineProperty(Zv,"__esModule",{value:!0});Zv.ChatToolCallDeltaEventDelta=void 0;var zxt=WNr(G()),KNr=TPe();Zv.ChatToolCallDeltaEventDelta=zxt.serialization.object({toolCall:zxt.serialization.property("tool_call",KNr.ChatToolCallDeltaEventDeltaToolCall.optional())})});var IPe=v(Xv=>{"use strict";var GNr=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]}),JNr=Xv&&Xv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YNr=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)&&GNr(e,t,r);return JNr(e,t),e};Object.defineProperty(Xv,"__esModule",{value:!0});Xv.ChatToolCallDeltaEvent=void 0;var Hxt=YNr(G()),ZNr=APe(),XNr=km();Xv.ChatToolCallDeltaEvent=Hxt.serialization.object({index:Hxt.serialization.number().optional(),delta:ZNr.ChatToolCallDeltaEventDelta.optional()}).extend(XNr.ChatStreamEventType)});var MPe=v(Qv=>{"use strict";var QNr=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]}),eDr=Qv&&Qv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tDr=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)&&QNr(e,t,r);return eDr(e,t),e};Object.defineProperty(Qv,"__esModule",{value:!0});Qv.ChatToolCallEndEvent=void 0;var Vxt=tDr(G()),rDr=km();Qv.ChatToolCallEndEvent=Vxt.serialization.object({index:Vxt.serialization.number().optional()}).extend(rDr.ChatStreamEventType)});var RPe=v(ew=>{"use strict";var nDr=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]}),oDr=ew&&ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iDr=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)&&nDr(e,t,r);return oDr(e,t),e};Object.defineProperty(ew,"__esModule",{value:!0});ew.ChatMessageEndEventDelta=void 0;var Wxt=iDr(G()),aDr=Bte(),sDr=qte();ew.ChatMessageEndEventDelta=Wxt.serialization.object({finishReason:Wxt.serialization.property("finish_reason",aDr.ChatFinishReason.optional()),usage:sDr.Usage.optional()})});var jPe=v(tw=>{"use strict";var uDr=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]}),lDr=tw&&tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cDr=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)&&uDr(e,t,r);return lDr(e,t),e};Object.defineProperty(tw,"__esModule",{value:!0});tw.ChatMessageEndEvent=void 0;var Kxt=cDr(G()),dDr=RPe(),fDr=km();tw.ChatMessageEndEvent=Kxt.serialization.object({id:Kxt.serialization.string().optional(),delta:dDr.ChatMessageEndEventDelta.optional()}).extend(fDr.ChatStreamEventType)});var NPe=v(rw=>{"use strict";var pDr=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]}),mDr=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=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)&&pDr(e,t,r);return mDr(e,t),e};Object.defineProperty(rw,"__esModule",{value:!0});rw.CitationStartEventDeltaMessage=void 0;var gDr=hDr(G()),yDr=SV();rw.CitationStartEventDeltaMessage=gDr.serialization.object({citations:yDr.Citation.optional()})});var DPe=v(nw=>{"use strict";var bDr=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]}),_Dr=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDr=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)&&bDr(e,t,r);return _Dr(e,t),e};Object.defineProperty(nw,"__esModule",{value:!0});nw.CitationStartEventDelta=void 0;var wDr=vDr(G()),SDr=NPe();nw.CitationStartEventDelta=wDr.serialization.object({message:SDr.CitationStartEventDeltaMessage.optional()})});var LPe=v(ow=>{"use strict";var xDr=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]}),CDr=ow&&ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ODr=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)&&xDr(e,t,r);return CDr(e,t),e};Object.defineProperty(ow,"__esModule",{value:!0});ow.CitationStartEvent=void 0;var Gxt=ODr(G()),PDr=DPe(),EDr=km();ow.CitationStartEvent=Gxt.serialization.object({index:Gxt.serialization.number().optional(),delta:PDr.CitationStartEventDelta.optional()}).extend(EDr.ChatStreamEventType)});var FPe=v(iw=>{"use strict";var TDr=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]}),ADr=iw&&iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IDr=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)&&TDr(e,t,r);return ADr(e,t),e};Object.defineProperty(iw,"__esModule",{value:!0});iw.CitationEndEvent=void 0;var Jxt=IDr(G()),MDr=km();iw.CitationEndEvent=Jxt.serialization.object({index:Jxt.serialization.number().optional()}).extend(MDr.ChatStreamEventType)});var Yxt=v(aw=>{"use strict";var RDr=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]}),jDr=aw&&aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NDr=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)&&RDr(e,t,r);return jDr(e,t),e};Object.defineProperty(aw,"__esModule",{value:!0});aw.StreamedChatResponse2=void 0;var DDr=NDr(G()),LDr=sPe(),FDr=fPe(),kDr=gPe(),$Dr=yPe(),BDr=vPe(),qDr=PPe(),UDr=IPe(),zDr=MPe(),HDr=LPe(),VDr=FPe(),WDr=jPe();aw.StreamedChatResponse2=DDr.serialization.union("type",{"message-start":LDr.ChatMessageStartEvent,"content-start":FDr.ChatContentStartEvent,"content-delta":kDr.ChatContentDeltaEvent,"content-end":$Dr.ChatContentEndEvent,"tool-plan-delta":BDr.ChatToolPlanDeltaEvent,"tool-call-start":qDr.ChatToolCallStartEvent,"tool-call-delta":UDr.ChatToolCallDeltaEvent,"tool-call-end":zDr.ChatToolCallEndEvent,"citation-start":HDr.CitationStartEvent,"citation-end":VDr.CitationEndEvent,"message-end":WDr.ChatMessageEndEvent}).transform({transform:t=>t,untransform:t=>t})});var kPe=v(At=>{"use strict";var KDr=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]}),Bt=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KDr(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});Bt(AOe(),At);Bt(IOe(),At);Bt(B$(),At);Bt(MOe(),At);Bt(jOe(),At);Bt(DOe(),At);Bt(FOe(),At);Bt(Lte(),At);Bt($Oe(),At);Bt(BOe(),At);Bt(qOe(),At);Bt(SV(),At);Bt(UOe(),At);Bt(HOe(),At);Bt(VOe(),At);Bt(WOe(),At);Bt(GOe(),At);Bt(JOe(),At);Bt(YOe(),At);Bt(ZOe(),At);Bt(XOe(),At);Bt(QOe(),At);Bt(kte(),At);Bt(ePe(),At);Bt($te(),At);Bt(Bte(),At);Bt(tPe(),At);Bt(rPe(),At);Bt(nPe(),At);Bt(oPe(),At);Bt(qte(),At);Bt(jxt(),At);Bt(km(),At);Bt(iPe(),At);Bt(aPe(),At);Bt(sPe(),At);Bt(lPe(),At);Bt(cPe(),At);Bt(dPe(),At);Bt(fPe(),At);Bt(pPe(),At);Bt(mPe(),At);Bt(hPe(),At);Bt(gPe(),At);Bt(yPe(),At);Bt(_Pe(),At);Bt(vPe(),At);Bt(SPe(),At);Bt(CPe(),At);Bt(OPe(),At);Bt(PPe(),At);Bt(EPe(),At);Bt(TPe(),At);Bt(APe(),At);Bt(IPe(),At);Bt(MPe(),At);Bt(RPe(),At);Bt(jPe(),At);Bt(Yxt(),At)});var zte=v(sw=>{"use strict";var GDr=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]}),JDr=sw&&sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YDr=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)&&GDr(e,t,r);return JDr(e,t),e};Object.defineProperty(sw,"__esModule",{value:!0});sw.TextResponseFormat=void 0;var ZDr=YDr(G());sw.TextResponseFormat=ZDr.serialization.object({})});var $Pe=v(uw=>{"use strict";var XDr=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]}),QDr=uw&&uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eLr=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)&&XDr(e,t,r);return QDr(e,t),e};Object.defineProperty(uw,"__esModule",{value:!0});uw.JsonResponseFormat2=void 0;var OV=eLr(G());uw.JsonResponseFormat2=OV.serialization.object({jsonSchema:OV.serialization.property("json_schema",OV.serialization.record(OV.serialization.string(),OV.serialization.unknown()).optional())})});var Hte=v(lw=>{"use strict";var tLr=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]}),rLr=lw&&lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nLr=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)&&tLr(e,t,r);return rLr(e,t),e};Object.defineProperty(lw,"__esModule",{value:!0});lw.ResponseFormat2=void 0;var oLr=nLr(G()),iLr=zte(),aLr=$Pe();lw.ResponseFormat2=oLr.serialization.union("type",{text:iLr.TextResponseFormat,json_object:aLr.JsonResponseFormat2}).transform({transform:t=>t,untransform:t=>t})});var Zxt=v(cw=>{"use strict";var sLr=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]}),uLr=cw&&cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lLr=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)&&sLr(e,t,r);return uLr(e,t),e};Object.defineProperty(cw,"__esModule",{value:!0});cw.V2ChatStreamRequest=void 0;var Ws=lLr(G()),cLr=kte(),dLr=$te(),fLr=AOe(),pLr=Hte();cw.V2ChatStreamRequest=Ws.serialization.object({model:Ws.serialization.string(),messages:cLr.ChatMessages,tools:Ws.serialization.list(dLr.Tool2).optional(),citationMode:Ws.serialization.property("citation_mode",fLr.V2ChatStreamRequestCitationMode.optional()),responseFormat:Ws.serialization.property("response_format",pLr.ResponseFormat2.optional()),maxTokens:Ws.serialization.property("max_tokens",Ws.serialization.number().optional()),stopSequences:Ws.serialization.property("stop_sequences",Ws.serialization.list(Ws.serialization.string()).optional()),temperature:Ws.serialization.number().optional(),seed:Ws.serialization.number().optional(),frequencyPenalty:Ws.serialization.property("frequency_penalty",Ws.serialization.number().optional()),presencePenalty:Ws.serialization.property("presence_penalty",Ws.serialization.number().optional()),k:Ws.serialization.number().optional(),p:Ws.serialization.number().optional(),returnPrompt:Ws.serialization.property("return_prompt",Ws.serialization.boolean().optional())})});var Xxt=v(dw=>{"use strict";var mLr=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]}),hLr=dw&&dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gLr=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)&&mLr(e,t,r);return hLr(e,t),e};Object.defineProperty(dw,"__esModule",{value:!0});dw.V2ChatRequest=void 0;var Ks=gLr(G()),yLr=kte(),bLr=$te(),_Lr=IOe(),vLr=Hte();dw.V2ChatRequest=Ks.serialization.object({model:Ks.serialization.string(),messages:yLr.ChatMessages,tools:Ks.serialization.list(bLr.Tool2).optional(),citationMode:Ks.serialization.property("citation_mode",_Lr.V2ChatRequestCitationMode.optional()),responseFormat:Ks.serialization.property("response_format",vLr.ResponseFormat2.optional()),maxTokens:Ks.serialization.property("max_tokens",Ks.serialization.number().optional()),stopSequences:Ks.serialization.property("stop_sequences",Ks.serialization.list(Ks.serialization.string()).optional()),temperature:Ks.serialization.number().optional(),seed:Ks.serialization.number().optional(),frequencyPenalty:Ks.serialization.property("frequency_penalty",Ks.serialization.number().optional()),presencePenalty:Ks.serialization.property("presence_penalty",Ks.serialization.number().optional()),k:Ks.serialization.number().optional(),p:Ks.serialization.number().optional(),returnPrompt:Ks.serialization.property("return_prompt",Ks.serialization.boolean().optional())})});var BPe=v(H$=>{"use strict";Object.defineProperty(H$,"__esModule",{value:!0});H$.V2ChatRequest=H$.V2ChatStreamRequest=void 0;var wLr=Zxt();Object.defineProperty(H$,"V2ChatStreamRequest",{enumerable:!0,get:function(){return wLr.V2ChatStreamRequest}});var SLr=Xxt();Object.defineProperty(H$,"V2ChatRequest",{enumerable:!0,get:function(){return SLr.V2ChatRequest}})});var Qxt=v(gj=>{"use strict";var xLr=gj&&gj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CLr=gj&&gj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xLr(e,t,r)};Object.defineProperty(gj,"__esModule",{value:!0});CLr(BPe(),gj)});var tCt=v(bA=>{"use strict";var OLr=bA&&bA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eCt=bA&&bA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OLr(e,t,r)};Object.defineProperty(bA,"__esModule",{value:!0});eCt(kPe(),bA);eCt(Qxt(),bA)});var qPe=v(fw=>{"use strict";var PLr=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]}),ELr=fw&&fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TLr=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)&&PLr(e,t,r);return ELr(e,t),e};Object.defineProperty(fw,"__esModule",{value:!0});fw.CreateEmbedJobRequestTruncate=void 0;var ALr=TLr(G());fw.CreateEmbedJobRequestTruncate=ALr.serialization.enum_(["START","END"])});var UPe=v(yj=>{"use strict";var ILr=yj&&yj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MLr=yj&&yj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ILr(e,t,r)};Object.defineProperty(yj,"__esModule",{value:!0});MLr(qPe(),yj)});var Vte=v(pw=>{"use strict";var RLr=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]}),jLr=pw&&pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NLr=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)&&RLr(e,t,r);return jLr(e,t),e};Object.defineProperty(pw,"__esModule",{value:!0});pw.EmbedInputType=void 0;var DLr=NLr(G());pw.EmbedInputType=DLr.serialization.enum_(["search_document","search_query","classification","clustering"])});var Wte=v(mw=>{"use strict";var LLr=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]}),FLr=mw&&mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kLr=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)&&LLr(e,t,r);return FLr(e,t),e};Object.defineProperty(mw,"__esModule",{value:!0});mw.EmbeddingType=void 0;var $Lr=kLr(G());mw.EmbeddingType=$Lr.serialization.enum_(["float","int8","uint8","binary","ubinary"])});var rCt=v(hw=>{"use strict";var BLr=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]}),qLr=hw&&hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ULr=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)&&BLr(e,t,r);return qLr(e,t),e};Object.defineProperty(hw,"__esModule",{value:!0});hw.CreateEmbedJobRequest=void 0;var _A=ULr(G()),zLr=Vte(),HLr=Wte(),VLr=qPe();hw.CreateEmbedJobRequest=_A.serialization.object({model:_A.serialization.string(),datasetId:_A.serialization.property("dataset_id",_A.serialization.string()),inputType:_A.serialization.property("input_type",zLr.EmbedInputType),name:_A.serialization.string().optional(),embeddingTypes:_A.serialization.property("embedding_types",_A.serialization.list(HLr.EmbeddingType).optional()),truncate:VLr.CreateEmbedJobRequestTruncate.optional()})});var zPe=v(Kte=>{"use strict";Object.defineProperty(Kte,"__esModule",{value:!0});Kte.CreateEmbedJobRequest=void 0;var WLr=rCt();Object.defineProperty(Kte,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return WLr.CreateEmbedJobRequest}})});var nCt=v(bj=>{"use strict";var KLr=bj&&bj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GLr=bj&&bj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KLr(e,t,r)};Object.defineProperty(bj,"__esModule",{value:!0});GLr(zPe(),bj)});var iCt=v(vA=>{"use strict";var JLr=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]}),oCt=vA&&vA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JLr(e,t,r)};Object.defineProperty(vA,"__esModule",{value:!0});oCt(UPe(),vA);oCt(nCt(),vA)});var HPe=v(gw=>{"use strict";var YLr=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]}),ZLr=gw&&gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XLr=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)&&YLr(e,t,r);return ZLr(e,t),e};Object.defineProperty(gw,"__esModule",{value:!0});gw.DatasetType=void 0;var QLr=XLr(G());gw.DatasetType=QLr.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 VPe=v(yw=>{"use strict";var eFr=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]}),tFr=yw&&yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFr=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)&&eFr(e,t,r);return tFr(e,t),e};Object.defineProperty(yw,"__esModule",{value:!0});yw.DatasetValidationStatus=void 0;var nFr=rFr(G());yw.DatasetValidationStatus=nFr.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var WPe=v(bw=>{"use strict";var oFr=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]}),iFr=bw&&bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aFr=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)&&oFr(e,t,r);return iFr(e,t),e};Object.defineProperty(bw,"__esModule",{value:!0});bw.DatasetPart=void 0;var $m=aFr(G());bw.DatasetPart=$m.serialization.object({id:$m.serialization.string(),name:$m.serialization.string(),url:$m.serialization.string().optional(),index:$m.serialization.number().optional(),sizeBytes:$m.serialization.property("size_bytes",$m.serialization.number().optional()),numRows:$m.serialization.property("num_rows",$m.serialization.number().optional()),originalUrl:$m.serialization.property("original_url",$m.serialization.string().optional()),samples:$m.serialization.list($m.serialization.string()).optional()})});var Gte=v(_w=>{"use strict";var sFr=_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]}),uFr=_w&&_w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lFr=_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)&&sFr(e,t,r);return uFr(e,t),e};Object.defineProperty(_w,"__esModule",{value:!0});_w.Dataset=void 0;var Ka=lFr(G()),cFr=HPe(),dFr=VPe(),fFr=WPe();_w.Dataset=Ka.serialization.object({id:Ka.serialization.string(),name:Ka.serialization.string(),createdAt:Ka.serialization.property("created_at",Ka.serialization.date()),updatedAt:Ka.serialization.property("updated_at",Ka.serialization.date()),datasetType:Ka.serialization.property("dataset_type",cFr.DatasetType),validationStatus:Ka.serialization.property("validation_status",dFr.DatasetValidationStatus),validationError:Ka.serialization.property("validation_error",Ka.serialization.string().optional()),schema:Ka.serialization.string().optional(),requiredFields:Ka.serialization.property("required_fields",Ka.serialization.list(Ka.serialization.string()).optional()),preserveFields:Ka.serialization.property("preserve_fields",Ka.serialization.list(Ka.serialization.string()).optional()),datasetParts:Ka.serialization.property("dataset_parts",Ka.serialization.list(fFr.DatasetPart).optional()),validationWarnings:Ka.serialization.property("validation_warnings",Ka.serialization.list(Ka.serialization.string()).optional())})});var sCt=v(vw=>{"use strict";var pFr=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]}),mFr=vw&&vw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hFr=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)&&pFr(e,t,r);return mFr(e,t),e};Object.defineProperty(vw,"__esModule",{value:!0});vw.DatasetsListResponse=void 0;var aCt=hFr(G()),gFr=Gte();vw.DatasetsListResponse=aCt.serialization.object({datasets:aCt.serialization.list(gFr.Dataset).optional()})});var uCt=v(ww=>{"use strict";var yFr=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]}),bFr=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Fr=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)&&yFr(e,t,r);return bFr(e,t),e};Object.defineProperty(ww,"__esModule",{value:!0});ww.DatasetsCreateResponseDatasetPartsItem=void 0;var wA=_Fr(G());ww.DatasetsCreateResponseDatasetPartsItem=wA.serialization.object({name:wA.serialization.string().optional(),numRows:wA.serialization.property("num_rows",wA.serialization.number().optional()),samples:wA.serialization.list(wA.serialization.string()).optional(),partKind:wA.serialization.property("part_kind",wA.serialization.string().optional())})});var cCt=v(Sw=>{"use strict";var vFr=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]}),wFr=Sw&&Sw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFr=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)&&vFr(e,t,r);return wFr(e,t),e};Object.defineProperty(Sw,"__esModule",{value:!0});Sw.DatasetsCreateResponse=void 0;var lCt=SFr(G());Sw.DatasetsCreateResponse=lCt.serialization.object({id:lCt.serialization.string().optional()})});var dCt=v(xw=>{"use strict";var xFr=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]}),CFr=xw&&xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OFr=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)&&xFr(e,t,r);return CFr(e,t),e};Object.defineProperty(xw,"__esModule",{value:!0});xw.DatasetsGetUsageResponse=void 0;var KPe=OFr(G());xw.DatasetsGetUsageResponse=KPe.serialization.object({organizationUsage:KPe.serialization.property("organization_usage",KPe.serialization.number().optional())})});var fCt=v(Cw=>{"use strict";var PFr=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]}),EFr=Cw&&Cw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TFr=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)&&PFr(e,t,r);return EFr(e,t),e};Object.defineProperty(Cw,"__esModule",{value:!0});Cw.DatasetsGetResponse=void 0;var AFr=TFr(G()),IFr=Gte();Cw.DatasetsGetResponse=AFr.serialization.object({dataset:IFr.Dataset})});var GPe=v(By=>{"use strict";var MFr=By&&By.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PV=By&&By.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MFr(e,t,r)};Object.defineProperty(By,"__esModule",{value:!0});PV(sCt(),By);PV(uCt(),By);PV(cCt(),By);PV(dCt(),By);PV(fCt(),By)});var pCt=v(Ow=>{"use strict";var RFr=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]}),jFr=Ow&&Ow.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NFr=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)&&RFr(e,t,r);return jFr(e,t),e};Object.defineProperty(Ow,"__esModule",{value:!0});Ow.Response=void 0;var JPe=NFr(G());Ow.Response=JPe.serialization.record(JPe.serialization.string(),JPe.serialization.unknown())});var mCt=v(Pw=>{"use strict";var DFr=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]}),LFr=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FFr=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)&&DFr(e,t,r);return LFr(e,t),e};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.delete=void 0;Pw.delete=FFr(pCt())});var gCt=v(SA=>{"use strict";var kFr=SA&&SA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hCt=SA&&SA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kFr(e,t,r)};Object.defineProperty(SA,"__esModule",{value:!0});hCt(GPe(),SA);hCt(mCt(),SA)});var YPe=v(Ew=>{"use strict";var $Fr=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]}),BFr=Ew&&Ew.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qFr=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)&&$Fr(e,t,r);return BFr(e,t),e};Object.defineProperty(Ew,"__esModule",{value:!0});Ew.BaseType=void 0;var UFr=qFr(G());Ew.BaseType=UFr.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var ZPe=v(Tw=>{"use strict";var zFr=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]}),HFr=Tw&&Tw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VFr=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)&&zFr(e,t,r);return HFr(e,t),e};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.Strategy=void 0;var WFr=VFr(G());Tw.Strategy=WFr.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var XPe=v(Aw=>{"use strict";var KFr=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]}),GFr=Aw&&Aw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JFr=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)&&KFr(e,t,r);return GFr(e,t),e};Object.defineProperty(Aw,"__esModule",{value:!0});Aw.BaseModel=void 0;var Jte=JFr(G()),YFr=YPe(),ZFr=ZPe();Aw.BaseModel=Jte.serialization.object({name:Jte.serialization.string().optional(),version:Jte.serialization.string().optional(),baseType:Jte.serialization.property("base_type",YFr.BaseType),strategy:ZFr.Strategy.optional()})});var QPe=v(Iw=>{"use strict";var XFr=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]}),QFr=Iw&&Iw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ekr=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)&&XFr(e,t,r);return QFr(e,t),e};Object.defineProperty(Iw,"__esModule",{value:!0});Iw.Hyperparameters=void 0;var qy=ekr(G());Iw.Hyperparameters=qy.serialization.object({earlyStoppingPatience:qy.serialization.property("early_stopping_patience",qy.serialization.number().optional()),earlyStoppingThreshold:qy.serialization.property("early_stopping_threshold",qy.serialization.number().optional()),trainBatchSize:qy.serialization.property("train_batch_size",qy.serialization.number().optional()),trainEpochs:qy.serialization.property("train_epochs",qy.serialization.number().optional()),learningRate:qy.serialization.property("learning_rate",qy.serialization.number().optional())})});var eEe=v(Mw=>{"use strict";var tkr=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]}),rkr=Mw&&Mw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nkr=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)&&tkr(e,t,r);return rkr(e,t),e};Object.defineProperty(Mw,"__esModule",{value:!0});Mw.WandbConfig=void 0;var EV=nkr(G());Mw.WandbConfig=EV.serialization.object({project:EV.serialization.string(),apiKey:EV.serialization.property("api_key",EV.serialization.string()),entity:EV.serialization.string().optional()})});var Yte=v(Rw=>{"use strict";var okr=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]}),ikr=Rw&&Rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),akr=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)&&okr(e,t,r);return ikr(e,t),e};Object.defineProperty(Rw,"__esModule",{value:!0});Rw.Settings=void 0;var V$=akr(G()),skr=XPe(),ukr=QPe(),lkr=eEe();Rw.Settings=V$.serialization.object({baseModel:V$.serialization.property("base_model",skr.BaseModel),datasetId:V$.serialization.property("dataset_id",V$.serialization.string()),hyperparameters:ukr.Hyperparameters.optional(),multiLabel:V$.serialization.property("multi_label",V$.serialization.boolean().optional()),wandb:lkr.WandbConfig.optional()})});var TV=v(jw=>{"use strict";var ckr=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]}),dkr=jw&&jw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fkr=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)&&ckr(e,t,r);return dkr(e,t),e};Object.defineProperty(jw,"__esModule",{value:!0});jw.Status=void 0;var pkr=fkr(G());jw.Status=pkr.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var W$=v(Nw=>{"use strict";var mkr=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]}),hkr=Nw&&Nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gkr=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)&&mkr(e,t,r);return hkr(e,t),e};Object.defineProperty(Nw,"__esModule",{value:!0});Nw.FinetunedModel=void 0;var Gf=gkr(G()),ykr=Yte(),bkr=TV();Nw.FinetunedModel=Gf.serialization.object({id:Gf.serialization.string().optional(),name:Gf.serialization.string(),creatorId:Gf.serialization.property("creator_id",Gf.serialization.string().optional()),organizationId:Gf.serialization.property("organization_id",Gf.serialization.string().optional()),settings:ykr.Settings,status:bkr.Status.optional(),createdAt:Gf.serialization.property("created_at",Gf.serialization.date().optional()),updatedAt:Gf.serialization.property("updated_at",Gf.serialization.date().optional()),completedAt:Gf.serialization.property("completed_at",Gf.serialization.date().optional()),lastUsed:Gf.serialization.property("last_used",Gf.serialization.date().optional())})});var yCt=v(Dw=>{"use strict";var _kr=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]}),vkr=Dw&&Dw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wkr=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)&&_kr(e,t,r);return vkr(e,t),e};Object.defineProperty(Dw,"__esModule",{value:!0});Dw.ListFinetunedModelsResponse=void 0;var _j=wkr(G()),Skr=W$();Dw.ListFinetunedModelsResponse=_j.serialization.object({finetunedModels:_j.serialization.property("finetuned_models",_j.serialization.list(Skr.FinetunedModel).optional()),nextPageToken:_j.serialization.property("next_page_token",_j.serialization.string().optional()),totalSize:_j.serialization.property("total_size",_j.serialization.number().optional())})});var _Ct=v(Lw=>{"use strict";var xkr=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]}),Ckr=Lw&&Lw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Okr=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)&&xkr(e,t,r);return Ckr(e,t),e};Object.defineProperty(Lw,"__esModule",{value:!0});Lw.CreateFinetunedModelResponse=void 0;var bCt=Okr(G()),Pkr=W$();Lw.CreateFinetunedModelResponse=bCt.serialization.object({finetunedModel:bCt.serialization.property("finetuned_model",Pkr.FinetunedModel.optional())})});var wCt=v(Fw=>{"use strict";var Ekr=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]}),Tkr=Fw&&Fw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Akr=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)&&Ekr(e,t,r);return Tkr(e,t),e};Object.defineProperty(Fw,"__esModule",{value:!0});Fw.GetFinetunedModelResponse=void 0;var vCt=Akr(G()),Ikr=W$();Fw.GetFinetunedModelResponse=vCt.serialization.object({finetunedModel:vCt.serialization.property("finetuned_model",Ikr.FinetunedModel.optional())})});var SCt=v(kw=>{"use strict";var Mkr=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]}),Rkr=kw&&kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jkr=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)&&Mkr(e,t,r);return Rkr(e,t),e};Object.defineProperty(kw,"__esModule",{value:!0});kw.DeleteFinetunedModelResponse=void 0;var tEe=jkr(G());kw.DeleteFinetunedModelResponse=tEe.serialization.record(tEe.serialization.string(),tEe.serialization.unknown())});var CCt=v($w=>{"use strict";var Nkr=$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]}),Dkr=$w&&$w.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lkr=$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)&&Nkr(e,t,r);return Dkr(e,t),e};Object.defineProperty($w,"__esModule",{value:!0});$w.UpdateFinetunedModelResponse=void 0;var xCt=Lkr(G()),Fkr=W$();$w.UpdateFinetunedModelResponse=xCt.serialization.object({finetunedModel:xCt.serialization.property("finetuned_model",Fkr.FinetunedModel.optional())})});var rEe=v(Bw=>{"use strict";var kkr=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]}),$kr=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkr=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)&&kkr(e,t,r);return $kr(e,t),e};Object.defineProperty(Bw,"__esModule",{value:!0});Bw.Event=void 0;var AV=Bkr(G()),qkr=TV();Bw.Event=AV.serialization.object({userId:AV.serialization.property("user_id",AV.serialization.string().optional()),status:qkr.Status.optional(),createdAt:AV.serialization.property("created_at",AV.serialization.date().optional())})});var OCt=v(qw=>{"use strict";var Ukr=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]}),zkr=qw&&qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hkr=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)&&Ukr(e,t,r);return zkr(e,t),e};Object.defineProperty(qw,"__esModule",{value:!0});qw.ListEventsResponse=void 0;var K$=Hkr(G()),Vkr=rEe();qw.ListEventsResponse=K$.serialization.object({events:K$.serialization.list(Vkr.Event).optional(),nextPageToken:K$.serialization.property("next_page_token",K$.serialization.string().optional()),totalSize:K$.serialization.property("total_size",K$.serialization.number().optional())})});var nEe=v(Uw=>{"use strict";var Wkr=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]}),Kkr=Uw&&Uw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gkr=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)&&Wkr(e,t,r);return Kkr(e,t),e};Object.defineProperty(Uw,"__esModule",{value:!0});Uw.TrainingStepMetrics=void 0;var xA=Gkr(G());Uw.TrainingStepMetrics=xA.serialization.object({createdAt:xA.serialization.property("created_at",xA.serialization.date().optional()),stepNumber:xA.serialization.property("step_number",xA.serialization.number().optional()),metrics:xA.serialization.record(xA.serialization.string(),xA.serialization.number()).optional()})});var PCt=v(zw=>{"use strict";var Jkr=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]}),Ykr=zw&&zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zkr=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)&&Jkr(e,t,r);return Ykr(e,t),e};Object.defineProperty(zw,"__esModule",{value:!0});zw.ListTrainingStepMetricsResponse=void 0;var IV=Zkr(G()),Xkr=nEe();zw.ListTrainingStepMetricsResponse=IV.serialization.object({stepMetrics:IV.serialization.property("step_metrics",IV.serialization.list(Xkr.TrainingStepMetrics).optional()),nextPageToken:IV.serialization.property("next_page_token",IV.serialization.string().optional())})});var oEe=v(Ga=>{"use strict";var Qkr=Ga&&Ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hc=Ga&&Ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qkr(e,t,r)};Object.defineProperty(Ga,"__esModule",{value:!0});Hc(YPe(),Ga);Hc(ZPe(),Ga);Hc(XPe(),Ga);Hc(QPe(),Ga);Hc(eEe(),Ga);Hc(Yte(),Ga);Hc(TV(),Ga);Hc(W$(),Ga);Hc(yCt(),Ga);Hc(_Ct(),Ga);Hc(wCt(),Ga);Hc(SCt(),Ga);Hc(CCt(),Ga);Hc(rEe(),Ga);Hc(OCt(),Ga);Hc(nEe(),Ga);Hc(PCt(),Ga)});var ECt=v(vj=>{"use strict";var e$r=vj&&vj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),t$r=vj&&vj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e$r(e,t,r)};Object.defineProperty(vj,"__esModule",{value:!0});t$r(oEe(),vj)});var ACt=v(Bm=>{"use strict";var TCt=Bm&&Bm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r$r=Bm&&Bm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n$r=Bm&&Bm.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&TCt(e,t,r);return r$r(e,t),e},o$r=Bm&&Bm.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TCt(e,t,r)};Object.defineProperty(Bm,"__esModule",{value:!0});Bm.finetuning=void 0;Bm.finetuning=n$r(ECt());o$r(oEe(),Bm)});var ICt=v(Hw=>{"use strict";var i$r=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]}),a$r=Hw&&Hw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s$r=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)&&i$r(e,t,r);return a$r(e,t),e};Object.defineProperty(Hw,"__esModule",{value:!0});Hw.FinetuningUpdateFinetunedModelRequest=void 0;var Lp=s$r(G()),u$r=Yte(),l$r=TV();Hw.FinetuningUpdateFinetunedModelRequest=Lp.serialization.object({name:Lp.serialization.string(),creatorId:Lp.serialization.property("creator_id",Lp.serialization.string().optional()),organizationId:Lp.serialization.property("organization_id",Lp.serialization.string().optional()),settings:u$r.Settings,status:l$r.Status.optional(),createdAt:Lp.serialization.property("created_at",Lp.serialization.date().optional()),updatedAt:Lp.serialization.property("updated_at",Lp.serialization.date().optional()),completedAt:Lp.serialization.property("completed_at",Lp.serialization.date().optional()),lastUsed:Lp.serialization.property("last_used",Lp.serialization.date().optional())})});var iEe=v(Zte=>{"use strict";Object.defineProperty(Zte,"__esModule",{value:!0});Zte.FinetuningUpdateFinetunedModelRequest=void 0;var c$r=ICt();Object.defineProperty(Zte,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return c$r.FinetuningUpdateFinetunedModelRequest}})});var MCt=v(wj=>{"use strict";var d$r=wj&&wj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f$r=wj&&wj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d$r(e,t,r)};Object.defineProperty(wj,"__esModule",{value:!0});f$r(iEe(),wj)});var jCt=v(CA=>{"use strict";var p$r=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]}),RCt=CA&&CA.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p$r(e,t,r)};Object.defineProperty(CA,"__esModule",{value:!0});RCt(ACt(),CA);RCt(MCt(),CA)});var Xte=v(Ww=>{"use strict";var m$r=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]}),h$r=Ww&&Ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g$r=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)&&m$r(e,t,r);return h$r(e,t),e};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.CreateConnectorOAuth=void 0;var Vw=g$r(G());Ww.CreateConnectorOAuth=Vw.serialization.object({clientId:Vw.serialization.property("client_id",Vw.serialization.string().optional()),clientSecret:Vw.serialization.property("client_secret",Vw.serialization.string().optional()),authorizeUrl:Vw.serialization.property("authorize_url",Vw.serialization.string().optional()),tokenUrl:Vw.serialization.property("token_url",Vw.serialization.string().optional()),scope:Vw.serialization.string().optional()})});var aEe=v(Kw=>{"use strict";var y$r=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]}),b$r=Kw&&Kw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_$r=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)&&y$r(e,t,r);return b$r(e,t),e};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.AuthTokenType=void 0;var v$r=_$r(G());Kw.AuthTokenType=v$r.serialization.enum_(["bearer","basic","noscheme"])});var Qte=v(Gw=>{"use strict";var w$r=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]}),S$r=Gw&&Gw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x$r=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)&&w$r(e,t,r);return S$r(e,t),e};Object.defineProperty(Gw,"__esModule",{value:!0});Gw.CreateConnectorServiceAuth=void 0;var NCt=x$r(G()),C$r=aEe();Gw.CreateConnectorServiceAuth=NCt.serialization.object({type:C$r.AuthTokenType,token:NCt.serialization.string()})});var DCt=v(Yw=>{"use strict";var O$r=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]}),P$r=Yw&&Yw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E$r=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)&&O$r(e,t,r);return P$r(e,t),e};Object.defineProperty(Yw,"__esModule",{value:!0});Yw.CreateConnectorRequest=void 0;var Jw=E$r(G()),T$r=Xte(),A$r=Qte();Yw.CreateConnectorRequest=Jw.serialization.object({name:Jw.serialization.string(),description:Jw.serialization.string().optional(),url:Jw.serialization.string(),excludes:Jw.serialization.list(Jw.serialization.string()).optional(),oauth:T$r.CreateConnectorOAuth.optional(),active:Jw.serialization.boolean().optional(),continueOnFailure:Jw.serialization.property("continue_on_failure",Jw.serialization.boolean().optional()),serviceAuth:Jw.serialization.property("service_auth",A$r.CreateConnectorServiceAuth.optional())})});var LCt=v(Zw=>{"use strict";var I$r=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]}),M$r=Zw&&Zw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R$r=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)&&I$r(e,t,r);return M$r(e,t),e};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.UpdateConnectorRequest=void 0;var IO=R$r(G()),j$r=Xte(),N$r=Qte();Zw.UpdateConnectorRequest=IO.serialization.object({name:IO.serialization.string().optional(),url:IO.serialization.string().optional(),excludes:IO.serialization.list(IO.serialization.string()).optional(),oauth:j$r.CreateConnectorOAuth.optional(),active:IO.serialization.boolean().optional(),continueOnFailure:IO.serialization.property("continue_on_failure",IO.serialization.boolean().optional()),serviceAuth:IO.serialization.property("service_auth",N$r.CreateConnectorServiceAuth.optional())})});var sEe=v(G$=>{"use strict";Object.defineProperty(G$,"__esModule",{value:!0});G$.UpdateConnectorRequest=G$.CreateConnectorRequest=void 0;var D$r=DCt();Object.defineProperty(G$,"CreateConnectorRequest",{enumerable:!0,get:function(){return D$r.CreateConnectorRequest}});var L$r=LCt();Object.defineProperty(G$,"UpdateConnectorRequest",{enumerable:!0,get:function(){return L$r.UpdateConnectorRequest}})});var FCt=v(Sj=>{"use strict";var F$r=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]}),k$r=Sj&&Sj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F$r(e,t,r)};Object.defineProperty(Sj,"__esModule",{value:!0});k$r(sEe(),Sj)});var kCt=v(xj=>{"use strict";var $$r=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]}),B$r=xj&&xj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$$r(e,t,r)};Object.defineProperty(xj,"__esModule",{value:!0});B$r(FCt(),xj)});var BCt=v(Di=>{"use strict";var $Ct=Di&&Di.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q$r=Di&&Di.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MV=Di&&Di.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$Ct(e,t,r);return q$r(e,t),e},Cj=Di&&Di.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Ct(e,t,r)};Object.defineProperty(Di,"__esModule",{value:!0});Di.connectors=Di.finetuning=Di.datasets=Di.embedJobs=Di.v2=void 0;Di.v2=MV(tCt());Cj(kPe(),Di);Di.embedJobs=MV(iCt());Cj(UPe(),Di);Di.datasets=MV(gCt());Cj(GPe(),Di);Di.finetuning=MV(jCt());Cj(BPe(),Di);Cj(zPe(),Di);Di.connectors=MV(kCt());Cj(sEe(),Di);Cj(iEe(),Di)});var uEe=v(Xw=>{"use strict";var U$r=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]}),z$r=Xw&&Xw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H$r=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)&&U$r(e,t,r);return z$r(e,t),e};Object.defineProperty(Xw,"__esModule",{value:!0});Xw.ChatStreamRequestPromptTruncation=void 0;var V$r=H$r(G());Xw.ChatStreamRequestPromptTruncation=V$r.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var lEe=v(Qw=>{"use strict";var W$r=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]}),K$r=Qw&&Qw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G$r=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)&&W$r(e,t,r);return K$r(e,t),e};Object.defineProperty(Qw,"__esModule",{value:!0});Qw.ChatStreamRequestCitationQuality=void 0;var J$r=G$r(G());Qw.ChatStreamRequestCitationQuality=J$r.serialization.enum_(["fast","accurate","off"])});var UCt=v(e0=>{"use strict";var Y$r=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]}),Z$r=e0&&e0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X$r=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)&&Y$r(e,t,r);return Z$r(e,t),e};Object.defineProperty(e0,"__esModule",{value:!0});e0.ChatStreamRequestConnectorsSearchOptions=void 0;var qCt=X$r(G());e0.ChatStreamRequestConnectorsSearchOptions=qCt.serialization.object({seed:qCt.serialization.number().optional()})});var cEe=v(t0=>{"use strict";var Q$r=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]}),eBr=t0&&t0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tBr=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)&&Q$r(e,t,r);return eBr(e,t),e};Object.defineProperty(t0,"__esModule",{value:!0});t0.ChatStreamRequestSafetyMode=void 0;var rBr=tBr(G());t0.ChatStreamRequestSafetyMode=rBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var HCt=v(r0=>{"use strict";var nBr=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]}),oBr=r0&&r0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iBr=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)&&nBr(e,t,r);return oBr(e,t),e};Object.defineProperty(r0,"__esModule",{value:!0});r0.UnprocessableEntityErrorBody=void 0;var zCt=iBr(G());r0.UnprocessableEntityErrorBody=zCt.serialization.object({data:zCt.serialization.string().optional()})});var WCt=v(n0=>{"use strict";var aBr=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]}),sBr=n0&&n0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uBr=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)&&aBr(e,t,r);return sBr(e,t),e};Object.defineProperty(n0,"__esModule",{value:!0});n0.TooManyRequestsErrorBody=void 0;var VCt=uBr(G());n0.TooManyRequestsErrorBody=VCt.serialization.object({data:VCt.serialization.string().optional()})});var GCt=v(o0=>{"use strict";var lBr=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]}),cBr=o0&&o0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dBr=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)&&lBr(e,t,r);return cBr(e,t),e};Object.defineProperty(o0,"__esModule",{value:!0});o0.ClientClosedRequestErrorBody=void 0;var KCt=dBr(G());o0.ClientClosedRequestErrorBody=KCt.serialization.object({data:KCt.serialization.string().optional()})});var YCt=v(i0=>{"use strict";var fBr=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]}),pBr=i0&&i0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mBr=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)&&fBr(e,t,r);return pBr(e,t),e};Object.defineProperty(i0,"__esModule",{value:!0});i0.NotImplementedErrorBody=void 0;var JCt=mBr(G());i0.NotImplementedErrorBody=JCt.serialization.object({data:JCt.serialization.string().optional()})});var XCt=v(a0=>{"use strict";var hBr=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]}),gBr=a0&&a0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yBr=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)&&hBr(e,t,r);return gBr(e,t),e};Object.defineProperty(a0,"__esModule",{value:!0});a0.GatewayTimeoutErrorBody=void 0;var ZCt=yBr(G());a0.GatewayTimeoutErrorBody=ZCt.serialization.object({data:ZCt.serialization.string().optional()})});var dEe=v(s0=>{"use strict";var bBr=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]}),_Br=s0&&s0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vBr=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)&&bBr(e,t,r);return _Br(e,t),e};Object.defineProperty(s0,"__esModule",{value:!0});s0.ChatRequestPromptTruncation=void 0;var wBr=vBr(G());s0.ChatRequestPromptTruncation=wBr.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var fEe=v(u0=>{"use strict";var SBr=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]}),xBr=u0&&u0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CBr=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)&&SBr(e,t,r);return xBr(e,t),e};Object.defineProperty(u0,"__esModule",{value:!0});u0.ChatRequestCitationQuality=void 0;var OBr=CBr(G());u0.ChatRequestCitationQuality=OBr.serialization.enum_(["fast","accurate","off"])});var eOt=v(l0=>{"use strict";var PBr=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]}),EBr=l0&&l0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TBr=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)&&PBr(e,t,r);return EBr(e,t),e};Object.defineProperty(l0,"__esModule",{value:!0});l0.ChatRequestConnectorsSearchOptions=void 0;var QCt=TBr(G());l0.ChatRequestConnectorsSearchOptions=QCt.serialization.object({seed:QCt.serialization.number().optional()})});var pEe=v(c0=>{"use strict";var ABr=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]}),IBr=c0&&c0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MBr=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)&&ABr(e,t,r);return IBr(e,t),e};Object.defineProperty(c0,"__esModule",{value:!0});c0.ChatRequestSafetyMode=void 0;var RBr=MBr(G());c0.ChatRequestSafetyMode=RBr.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var mEe=v(d0=>{"use strict";var jBr=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]}),NBr=d0&&d0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DBr=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)&&jBr(e,t,r);return NBr(e,t),e};Object.defineProperty(d0,"__esModule",{value:!0});d0.GenerateStreamRequestTruncate=void 0;var LBr=DBr(G());d0.GenerateStreamRequestTruncate=LBr.serialization.enum_(["NONE","START","END"])});var hEe=v(f0=>{"use strict";var FBr=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]}),kBr=f0&&f0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Br=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)&&FBr(e,t,r);return kBr(e,t),e};Object.defineProperty(f0,"__esModule",{value:!0});f0.GenerateStreamRequestReturnLikelihoods=void 0;var BBr=$Br(G());f0.GenerateStreamRequestReturnLikelihoods=BBr.serialization.enum_(["GENERATION","ALL","NONE"])});var gEe=v(p0=>{"use strict";var qBr=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]}),UBr=p0&&p0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zBr=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)&&qBr(e,t,r);return UBr(e,t),e};Object.defineProperty(p0,"__esModule",{value:!0});p0.GenerateRequestTruncate=void 0;var HBr=zBr(G());p0.GenerateRequestTruncate=HBr.serialization.enum_(["NONE","START","END"])});var yEe=v(m0=>{"use strict";var VBr=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]}),WBr=m0&&m0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KBr=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)&&VBr(e,t,r);return WBr(e,t),e};Object.defineProperty(m0,"__esModule",{value:!0});m0.GenerateRequestReturnLikelihoods=void 0;var GBr=KBr(G());m0.GenerateRequestReturnLikelihoods=GBr.serialization.enum_(["GENERATION","ALL","NONE"])});var bEe=v(h0=>{"use strict";var JBr=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]}),YBr=h0&&h0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZBr=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)&&JBr(e,t,r);return YBr(e,t),e};Object.defineProperty(h0,"__esModule",{value:!0});h0.EmbedRequestTruncate=void 0;var XBr=ZBr(G());h0.EmbedRequestTruncate=XBr.serialization.enum_(["NONE","START","END"])});var _Ee=v(g0=>{"use strict";var QBr=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]}),eqr=g0&&g0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tqr=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)&&QBr(e,t,r);return eqr(e,t),e};Object.defineProperty(g0,"__esModule",{value:!0});g0.ApiMetaApiVersion=void 0;var J$=tqr(G());g0.ApiMetaApiVersion=J$.serialization.object({version:J$.serialization.string(),isDeprecated:J$.serialization.property("is_deprecated",J$.serialization.boolean().optional()),isExperimental:J$.serialization.property("is_experimental",J$.serialization.boolean().optional())})});var vEe=v(y0=>{"use strict";var rqr=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]}),nqr=y0&&y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oqr=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)&&rqr(e,t,r);return nqr(e,t),e};Object.defineProperty(y0,"__esModule",{value:!0});y0.ApiMetaBilledUnits=void 0;var OA=oqr(G());y0.ApiMetaBilledUnits=OA.serialization.object({inputTokens:OA.serialization.property("input_tokens",OA.serialization.number().optional()),outputTokens:OA.serialization.property("output_tokens",OA.serialization.number().optional()),searchUnits:OA.serialization.property("search_units",OA.serialization.number().optional()),classifications:OA.serialization.number().optional()})});var wEe=v(b0=>{"use strict";var iqr=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]}),aqr=b0&&b0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sqr=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)&&iqr(e,t,r);return aqr(e,t),e};Object.defineProperty(b0,"__esModule",{value:!0});b0.ApiMetaTokens=void 0;var RV=sqr(G());b0.ApiMetaTokens=RV.serialization.object({inputTokens:RV.serialization.property("input_tokens",RV.serialization.number().optional()),outputTokens:RV.serialization.property("output_tokens",RV.serialization.number().optional())})});var qm=v(_0=>{"use strict";var uqr=_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]}),lqr=_0&&_0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cqr=_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)&&uqr(e,t,r);return lqr(e,t),e};Object.defineProperty(_0,"__esModule",{value:!0});_0.ApiMeta=void 0;var jV=cqr(G()),dqr=_Ee(),fqr=vEe(),pqr=wEe();_0.ApiMeta=jV.serialization.object({apiVersion:jV.serialization.property("api_version",dqr.ApiMetaApiVersion.optional()),billedUnits:jV.serialization.property("billed_units",fqr.ApiMetaBilledUnits.optional()),tokens:pqr.ApiMetaTokens.optional(),warnings:jV.serialization.list(jV.serialization.string()).optional()})});var SEe=v(v0=>{"use strict";var mqr=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]}),hqr=v0&&v0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gqr=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)&&mqr(e,t,r);return hqr(e,t),e};Object.defineProperty(v0,"__esModule",{value:!0});v0.EmbedFloatsResponse=void 0;var Oj=gqr(G()),yqr=qm();v0.EmbedFloatsResponse=Oj.serialization.object({id:Oj.serialization.string(),embeddings:Oj.serialization.list(Oj.serialization.list(Oj.serialization.number())),texts:Oj.serialization.list(Oj.serialization.string()),meta:yqr.ApiMeta.optional()})});var xEe=v(w0=>{"use strict";var bqr=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]}),_qr=w0&&w0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vqr=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)&&bqr(e,t,r);return _qr(e,t),e};Object.defineProperty(w0,"__esModule",{value:!0});w0.EmbedByTypeResponseEmbeddings=void 0;var Xd=vqr(G());w0.EmbedByTypeResponseEmbeddings=Xd.serialization.object({float:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),int8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),uint8:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),binary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional(),ubinary:Xd.serialization.list(Xd.serialization.list(Xd.serialization.number())).optional()})});var CEe=v(S0=>{"use strict";var wqr=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]}),Sqr=S0&&S0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xqr=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)&&wqr(e,t,r);return Sqr(e,t),e};Object.defineProperty(S0,"__esModule",{value:!0});S0.EmbedByTypeResponse=void 0;var ere=xqr(G()),Cqr=xEe(),Oqr=qm();S0.EmbedByTypeResponse=ere.serialization.object({id:ere.serialization.string(),embeddings:Cqr.EmbedByTypeResponseEmbeddings,texts:ere.serialization.list(ere.serialization.string()),meta:Oqr.ApiMeta.optional()})});var rOt=v(x0=>{"use strict";var Pqr=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]}),Eqr=x0&&x0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tqr=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)&&Pqr(e,t,r);return Eqr(e,t),e};Object.defineProperty(x0,"__esModule",{value:!0});x0.EmbedResponse=void 0;var tOt=Tqr(G()),Aqr=SEe(),Iqr=CEe();x0.EmbedResponse=tOt.serialization.union(tOt.serialization.discriminant("responseType","response_type"),{embeddings_floats:Aqr.EmbedFloatsResponse,embeddings_by_type:Iqr.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var PEe=v(C0=>{"use strict";var Mqr=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]}),Rqr=C0&&C0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jqr=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)&&Mqr(e,t,r);return Rqr(e,t),e};Object.defineProperty(C0,"__esModule",{value:!0});C0.RerankDocument=void 0;var OEe=jqr(G());C0.RerankDocument=OEe.serialization.record(OEe.serialization.string(),OEe.serialization.string())});var EEe=v(O0=>{"use strict";var Nqr=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]}),Dqr=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lqr=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)&&Nqr(e,t,r);return Dqr(e,t),e};Object.defineProperty(O0,"__esModule",{value:!0});O0.RerankRequestDocumentsItem=void 0;var nOt=Lqr(G()),Fqr=PEe();O0.RerankRequestDocumentsItem=nOt.serialization.undiscriminatedUnion([nOt.serialization.string(),Fqr.RerankDocument])});var TEe=v(P0=>{"use strict";var kqr=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]}),$qr=P0&&P0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bqr=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)&&kqr(e,t,r);return $qr(e,t),e};Object.defineProperty(P0,"__esModule",{value:!0});P0.RerankResponseResultsItemDocument=void 0;var oOt=Bqr(G());P0.RerankResponseResultsItemDocument=oOt.serialization.object({text:oOt.serialization.string()})});var AEe=v(E0=>{"use strict";var qqr=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]}),Uqr=E0&&E0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zqr=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)&&qqr(e,t,r);return Uqr(e,t),e};Object.defineProperty(E0,"__esModule",{value:!0});E0.RerankResponseResultsItem=void 0;var tre=zqr(G()),Hqr=TEe();E0.RerankResponseResultsItem=tre.serialization.object({document:Hqr.RerankResponseResultsItemDocument.optional(),index:tre.serialization.number(),relevanceScore:tre.serialization.property("relevance_score",tre.serialization.number())})});var iOt=v(T0=>{"use strict";var Vqr=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]}),Wqr=T0&&T0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kqr=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)&&Vqr(e,t,r);return Wqr(e,t),e};Object.defineProperty(T0,"__esModule",{value:!0});T0.RerankResponse=void 0;var IEe=Kqr(G()),Gqr=AEe(),Jqr=qm();T0.RerankResponse=IEe.serialization.object({id:IEe.serialization.string().optional(),results:IEe.serialization.list(Gqr.RerankResponseResultsItem),meta:Jqr.ApiMeta.optional()})});var MEe=v(A0=>{"use strict";var Yqr=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]}),Zqr=A0&&A0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xqr=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)&&Yqr(e,t,r);return Zqr(e,t),e};Object.defineProperty(A0,"__esModule",{value:!0});A0.ClassifyRequestTruncate=void 0;var Qqr=Xqr(G());A0.ClassifyRequestTruncate=Qqr.serialization.enum_(["NONE","START","END"])});var REe=v(I0=>{"use strict";var eUr=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]}),tUr=I0&&I0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rUr=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)&&eUr(e,t,r);return tUr(e,t),e};Object.defineProperty(I0,"__esModule",{value:!0});I0.ClassifyResponseClassificationsItemLabelsValue=void 0;var aOt=rUr(G());I0.ClassifyResponseClassificationsItemLabelsValue=aOt.serialization.object({confidence:aOt.serialization.number().optional()})});var jEe=v(M0=>{"use strict";var nUr=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]}),oUr=M0&&M0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iUr=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)&&nUr(e,t,r);return oUr(e,t),e};Object.defineProperty(M0,"__esModule",{value:!0});M0.ClassifyResponseClassificationsItemClassificationType=void 0;var aUr=iUr(G());M0.ClassifyResponseClassificationsItemClassificationType=aUr.serialization.enum_(["single-label","multi-label"])});var NEe=v(R0=>{"use strict";var sUr=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]}),uUr=R0&&R0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lUr=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)&&sUr(e,t,r);return uUr(e,t),e};Object.defineProperty(R0,"__esModule",{value:!0});R0.ClassifyResponseClassificationsItem=void 0;var lg=lUr(G()),cUr=REe(),dUr=jEe();R0.ClassifyResponseClassificationsItem=lg.serialization.object({id:lg.serialization.string(),input:lg.serialization.string().optional(),prediction:lg.serialization.string().optional(),predictions:lg.serialization.list(lg.serialization.string()),confidence:lg.serialization.number().optional(),confidences:lg.serialization.list(lg.serialization.number()),labels:lg.serialization.record(lg.serialization.string(),cUr.ClassifyResponseClassificationsItemLabelsValue),classificationType:lg.serialization.property("classification_type",dUr.ClassifyResponseClassificationsItemClassificationType)})});var sOt=v(j0=>{"use strict";var fUr=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]}),pUr=j0&&j0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mUr=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)&&fUr(e,t,r);return pUr(e,t),e};Object.defineProperty(j0,"__esModule",{value:!0});j0.ClassifyResponse=void 0;var DEe=mUr(G()),hUr=NEe(),gUr=qm();j0.ClassifyResponse=DEe.serialization.object({id:DEe.serialization.string(),classifications:DEe.serialization.list(hUr.ClassifyResponseClassificationsItem),meta:gUr.ApiMeta.optional()})});var LEe=v(N0=>{"use strict";var yUr=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]}),bUr=N0&&N0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ur=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)&&yUr(e,t,r);return bUr(e,t),e};Object.defineProperty(N0,"__esModule",{value:!0});N0.SummarizeRequestLength=void 0;var vUr=_Ur(G());N0.SummarizeRequestLength=vUr.serialization.enum_(["short","medium","long"])});var FEe=v(D0=>{"use strict";var wUr=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]}),SUr=D0&&D0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xUr=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)&&wUr(e,t,r);return SUr(e,t),e};Object.defineProperty(D0,"__esModule",{value:!0});D0.SummarizeRequestFormat=void 0;var CUr=xUr(G());D0.SummarizeRequestFormat=CUr.serialization.enum_(["paragraph","bullets"])});var kEe=v(L0=>{"use strict";var OUr=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]}),PUr=L0&&L0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EUr=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)&&OUr(e,t,r);return PUr(e,t),e};Object.defineProperty(L0,"__esModule",{value:!0});L0.SummarizeRequestExtractiveness=void 0;var TUr=EUr(G());L0.SummarizeRequestExtractiveness=TUr.serialization.enum_(["low","medium","high"])});var uOt=v(F0=>{"use strict";var AUr=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]}),IUr=F0&&F0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MUr=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)&&AUr(e,t,r);return IUr(e,t),e};Object.defineProperty(F0,"__esModule",{value:!0});F0.SummarizeResponse=void 0;var $Ee=MUr(G()),RUr=qm();F0.SummarizeResponse=$Ee.serialization.object({id:$Ee.serialization.string().optional(),summary:$Ee.serialization.string().optional(),meta:RUr.ApiMeta.optional()})});var lOt=v(k0=>{"use strict";var jUr=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]}),NUr=k0&&k0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DUr=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)&&jUr(e,t,r);return NUr(e,t),e};Object.defineProperty(k0,"__esModule",{value:!0});k0.TokenizeResponse=void 0;var Y$=DUr(G()),LUr=qm();k0.TokenizeResponse=Y$.serialization.object({tokens:Y$.serialization.list(Y$.serialization.number()),tokenStrings:Y$.serialization.property("token_strings",Y$.serialization.list(Y$.serialization.string())),meta:LUr.ApiMeta.optional()})});var dOt=v($0=>{"use strict";var FUr=$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]}),kUr=$0&&$0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ur=$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)&&FUr(e,t,r);return kUr(e,t),e};Object.defineProperty($0,"__esModule",{value:!0});$0.DetokenizeResponse=void 0;var cOt=$Ur(G()),BUr=qm();$0.DetokenizeResponse=cOt.serialization.object({text:cOt.serialization.string(),meta:BUr.ApiMeta.optional()})});var fOt=v(B0=>{"use strict";var qUr=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]}),UUr=B0&&B0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zUr=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)&&qUr(e,t,r);return UUr(e,t),e};Object.defineProperty(B0,"__esModule",{value:!0});B0.CheckApiKeyResponse=void 0;var Z$=zUr(G());B0.CheckApiKeyResponse=Z$.serialization.object({valid:Z$.serialization.boolean(),organizationId:Z$.serialization.property("organization_id",Z$.serialization.string().optional()),ownerId:Z$.serialization.property("owner_id",Z$.serialization.string().optional())})});var X$=v(q0=>{"use strict";var HUr=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]}),VUr=q0&&q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WUr=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)&&HUr(e,t,r);return VUr(e,t),e};Object.defineProperty(q0,"__esModule",{value:!0});q0.ToolCall=void 0;var NV=WUr(G());q0.ToolCall=NV.serialization.object({name:NV.serialization.string(),parameters:NV.serialization.record(NV.serialization.string(),NV.serialization.unknown())})});var BEe=v(U0=>{"use strict";var KUr=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]}),GUr=U0&&U0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JUr=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)&&KUr(e,t,r);return GUr(e,t),e};Object.defineProperty(U0,"__esModule",{value:!0});U0.ChatMessage=void 0;var rre=JUr(G()),YUr=X$();U0.ChatMessage=rre.serialization.object({message:rre.serialization.string(),toolCalls:rre.serialization.property("tool_calls",rre.serialization.list(YUr.ToolCall).optional())})});var LV=v(z0=>{"use strict";var ZUr=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]}),XUr=z0&&z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QUr=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)&&ZUr(e,t,r);return XUr(e,t),e};Object.defineProperty(z0,"__esModule",{value:!0});z0.ToolResult=void 0;var DV=QUr(G()),ezr=X$();z0.ToolResult=DV.serialization.object({call:ezr.ToolCall,outputs:DV.serialization.list(DV.serialization.record(DV.serialization.string(),DV.serialization.unknown()))})});var UEe=v(H0=>{"use strict";var tzr=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]}),rzr=H0&&H0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nzr=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)&&tzr(e,t,r);return rzr(e,t),e};Object.defineProperty(H0,"__esModule",{value:!0});H0.ToolMessage=void 0;var qEe=nzr(G()),ozr=LV();H0.ToolMessage=qEe.serialization.object({toolResults:qEe.serialization.property("tool_results",qEe.serialization.list(ozr.ToolResult).optional())})});var FV=v(V0=>{"use strict";var izr=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]}),azr=V0&&V0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),szr=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)&&izr(e,t,r);return azr(e,t),e};Object.defineProperty(V0,"__esModule",{value:!0});V0.Message=void 0;var uzr=szr(G()),zEe=BEe(),lzr=UEe();V0.Message=uzr.serialization.union("role",{CHATBOT:zEe.ChatMessage,SYSTEM:zEe.ChatMessage,USER:zEe.ChatMessage,TOOL:lzr.ToolMessage}).transform({transform:t=>t,untransform:t=>t})});var nre=v(W0=>{"use strict";var czr=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]}),dzr=W0&&W0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fzr=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)&&czr(e,t,r);return dzr(e,t),e};Object.defineProperty(W0,"__esModule",{value:!0});W0.ChatConnector=void 0;var MO=fzr(G());W0.ChatConnector=MO.serialization.object({id:MO.serialization.string(),userAccessToken:MO.serialization.property("user_access_token",MO.serialization.string().optional()),continueOnFailure:MO.serialization.property("continue_on_failure",MO.serialization.boolean().optional()),options:MO.serialization.record(MO.serialization.string(),MO.serialization.unknown()).optional()})});var HEe=v(K0=>{"use strict";var pzr=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]}),mzr=K0&&K0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hzr=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)&&pzr(e,t,r);return mzr(e,t),e};Object.defineProperty(K0,"__esModule",{value:!0});K0.ToolParameterDefinitionsValue=void 0;var ore=hzr(G());K0.ToolParameterDefinitionsValue=ore.serialization.object({description:ore.serialization.string().optional(),type:ore.serialization.string(),required:ore.serialization.boolean().optional()})});var ire=v(G0=>{"use strict";var gzr=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]}),yzr=G0&&G0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bzr=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)&&gzr(e,t,r);return yzr(e,t),e};Object.defineProperty(G0,"__esModule",{value:!0});G0.Tool=void 0;var Q$=bzr(G()),_zr=HEe();G0.Tool=Q$.serialization.object({name:Q$.serialization.string(),description:Q$.serialization.string(),parameterDefinitions:Q$.serialization.property("parameter_definitions",Q$.serialization.record(Q$.serialization.string(),_zr.ToolParameterDefinitionsValue).optional())})});var VEe=v(J0=>{"use strict";var vzr=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]}),wzr=J0&&J0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Szr=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)&&vzr(e,t,r);return wzr(e,t),e};Object.defineProperty(J0,"__esModule",{value:!0});J0.JsonResponseFormat=void 0;var are=Szr(G());J0.JsonResponseFormat=are.serialization.object({schema:are.serialization.record(are.serialization.string(),are.serialization.unknown()).optional()})});var sre=v(Y0=>{"use strict";var xzr=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]}),Czr=Y0&&Y0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ozr=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)&&xzr(e,t,r);return Czr(e,t),e};Object.defineProperty(Y0,"__esModule",{value:!0});Y0.ResponseFormat=void 0;var Pzr=Ozr(G()),Ezr=zte(),Tzr=VEe();Y0.ResponseFormat=Pzr.serialization.union("type",{text:Ezr.TextResponseFormat,json_object:Tzr.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var ure=v(Z0=>{"use strict";var Azr=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]}),Izr=Z0&&Z0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mzr=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)&&Azr(e,t,r);return Izr(e,t),e};Object.defineProperty(Z0,"__esModule",{value:!0});Z0.ChatCitation=void 0;var Pj=Mzr(G());Z0.ChatCitation=Pj.serialization.object({start:Pj.serialization.number(),end:Pj.serialization.number(),text:Pj.serialization.string(),documentIds:Pj.serialization.property("document_ids",Pj.serialization.list(Pj.serialization.string()))})});var kV=v(X0=>{"use strict";var Rzr=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]}),jzr=X0&&X0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nzr=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)&&Rzr(e,t,r);return jzr(e,t),e};Object.defineProperty(X0,"__esModule",{value:!0});X0.ChatSearchQuery=void 0;var lre=Nzr(G());X0.ChatSearchQuery=lre.serialization.object({text:lre.serialization.string(),generationId:lre.serialization.property("generation_id",lre.serialization.string())})});var WEe=v(Q0=>{"use strict";var Dzr=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]}),Lzr=Q0&&Q0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fzr=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)&&Dzr(e,t,r);return Lzr(e,t),e};Object.defineProperty(Q0,"__esModule",{value:!0});Q0.ChatSearchResultConnector=void 0;var pOt=Fzr(G());Q0.ChatSearchResultConnector=pOt.serialization.object({id:pOt.serialization.string()})});var cre=v(eS=>{"use strict";var kzr=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]}),$zr=eS&&eS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bzr=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)&&kzr(e,t,r);return $zr(e,t),e};Object.defineProperty(eS,"__esModule",{value:!0});eS.ChatSearchResult=void 0;var RO=Bzr(G()),qzr=kV(),Uzr=WEe();eS.ChatSearchResult=RO.serialization.object({searchQuery:RO.serialization.property("search_query",qzr.ChatSearchQuery.optional()),connector:Uzr.ChatSearchResultConnector,documentIds:RO.serialization.property("document_ids",RO.serialization.list(RO.serialization.string())),errorMessage:RO.serialization.property("error_message",RO.serialization.string().optional()),continueOnFailure:RO.serialization.property("continue_on_failure",RO.serialization.boolean().optional())})});var eB=v(tS=>{"use strict";var zzr=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]}),Hzr=tS&&tS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vzr=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)&&zzr(e,t,r);return Hzr(e,t),e};Object.defineProperty(tS,"__esModule",{value:!0});tS.FinishReason=void 0;var Wzr=Vzr(G());tS.FinishReason=Wzr.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var KEe=v(rS=>{"use strict";var Kzr=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]}),Gzr=rS&&rS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jzr=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)&&Kzr(e,t,r);return Gzr(e,t),e};Object.defineProperty(rS,"__esModule",{value:!0});rS.NonStreamedChatResponse=void 0;var ec=Jzr(G()),Yzr=ure(),Zzr=hj(),Xzr=kV(),Qzr=cre(),e2r=eB(),t2r=X$(),r2r=FV(),n2r=qm();rS.NonStreamedChatResponse=ec.serialization.object({text:ec.serialization.string(),generationId:ec.serialization.property("generation_id",ec.serialization.string().optional()),citations:ec.serialization.list(Yzr.ChatCitation).optional(),documents:ec.serialization.list(Zzr.ChatDocument).optional(),isSearchRequired:ec.serialization.property("is_search_required",ec.serialization.boolean().optional()),searchQueries:ec.serialization.property("search_queries",ec.serialization.list(Xzr.ChatSearchQuery).optional()),searchResults:ec.serialization.property("search_results",ec.serialization.list(Qzr.ChatSearchResult).optional()),finishReason:ec.serialization.property("finish_reason",e2r.FinishReason.optional()),toolCalls:ec.serialization.property("tool_calls",ec.serialization.list(t2r.ToolCall).optional()),chatHistory:ec.serialization.property("chat_history",ec.serialization.list(r2r.Message).optional()),prompt:ec.serialization.string().optional(),meta:n2r.ApiMeta.optional()})});var oS=v(nS=>{"use strict";var o2r=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]}),i2r=nS&&nS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a2r=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)&&o2r(e,t,r);return i2r(e,t),e};Object.defineProperty(nS,"__esModule",{value:!0});nS.ChatStreamEvent=void 0;var s2r=a2r(G());nS.ChatStreamEvent=s2r.serialization.object({})});var JEe=v(iS=>{"use strict";var u2r=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]}),l2r=iS&&iS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c2r=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)&&u2r(e,t,r);return l2r(e,t),e};Object.defineProperty(iS,"__esModule",{value:!0});iS.ChatStreamStartEvent=void 0;var GEe=c2r(G()),d2r=oS();iS.ChatStreamStartEvent=GEe.serialization.object({generationId:GEe.serialization.property("generation_id",GEe.serialization.string())}).extend(d2r.ChatStreamEvent)});var ZEe=v(aS=>{"use strict";var f2r=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]}),p2r=aS&&aS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m2r=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)&&f2r(e,t,r);return p2r(e,t),e};Object.defineProperty(aS,"__esModule",{value:!0});aS.ChatSearchQueriesGenerationEvent=void 0;var YEe=m2r(G()),h2r=kV(),g2r=oS();aS.ChatSearchQueriesGenerationEvent=YEe.serialization.object({searchQueries:YEe.serialization.property("search_queries",YEe.serialization.list(h2r.ChatSearchQuery))}).extend(g2r.ChatStreamEvent)});var XEe=v(sS=>{"use strict";var y2r=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]}),b2r=sS&&sS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_2r=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)&&y2r(e,t,r);return b2r(e,t),e};Object.defineProperty(sS,"__esModule",{value:!0});sS.ChatSearchResultsEvent=void 0;var dre=_2r(G()),v2r=cre(),w2r=hj(),S2r=oS();sS.ChatSearchResultsEvent=dre.serialization.object({searchResults:dre.serialization.property("search_results",dre.serialization.list(v2r.ChatSearchResult).optional()),documents:dre.serialization.list(w2r.ChatDocument).optional()}).extend(S2r.ChatStreamEvent)});var QEe=v(uS=>{"use strict";var x2r=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]}),C2r=uS&&uS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2r=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)&&x2r(e,t,r);return C2r(e,t),e};Object.defineProperty(uS,"__esModule",{value:!0});uS.ChatTextGenerationEvent=void 0;var mOt=O2r(G()),P2r=oS();uS.ChatTextGenerationEvent=mOt.serialization.object({text:mOt.serialization.string()}).extend(P2r.ChatStreamEvent)});var eTe=v(lS=>{"use strict";var E2r=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]}),T2r=lS&&lS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A2r=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)&&E2r(e,t,r);return T2r(e,t),e};Object.defineProperty(lS,"__esModule",{value:!0});lS.ChatCitationGenerationEvent=void 0;var hOt=A2r(G()),I2r=ure(),M2r=oS();lS.ChatCitationGenerationEvent=hOt.serialization.object({citations:hOt.serialization.list(I2r.ChatCitation)}).extend(M2r.ChatStreamEvent)});var tTe=v(cS=>{"use strict";var R2r=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]}),j2r=cS&&cS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N2r=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)&&R2r(e,t,r);return j2r(e,t),e};Object.defineProperty(cS,"__esModule",{value:!0});cS.ChatToolCallsGenerationEvent=void 0;var fre=N2r(G()),D2r=X$(),L2r=oS();cS.ChatToolCallsGenerationEvent=fre.serialization.object({text:fre.serialization.string().optional(),toolCalls:fre.serialization.property("tool_calls",fre.serialization.list(D2r.ToolCall))}).extend(L2r.ChatStreamEvent)});var rTe=v(dS=>{"use strict";var F2r=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]}),k2r=dS&&dS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$2r=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)&&F2r(e,t,r);return k2r(e,t),e};Object.defineProperty(dS,"__esModule",{value:!0});dS.ChatStreamEndEventFinishReason=void 0;var B2r=$2r(G());dS.ChatStreamEndEventFinishReason=B2r.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var nTe=v(fS=>{"use strict";var q2r=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]}),U2r=fS&&fS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z2r=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)&&q2r(e,t,r);return U2r(e,t),e};Object.defineProperty(fS,"__esModule",{value:!0});fS.ChatStreamEndEvent=void 0;var gOt=z2r(G()),H2r=rTe(),V2r=KEe(),W2r=oS();fS.ChatStreamEndEvent=gOt.serialization.object({finishReason:gOt.serialization.property("finish_reason",H2r.ChatStreamEndEventFinishReason),response:V2r.NonStreamedChatResponse}).extend(W2r.ChatStreamEvent)});var oTe=v(pS=>{"use strict";var K2r=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]}),G2r=pS&&pS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J2r=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)&&K2r(e,t,r);return G2r(e,t),e};Object.defineProperty(pS,"__esModule",{value:!0});pS.ToolCallDelta=void 0;var $V=J2r(G());pS.ToolCallDelta=$V.serialization.object({name:$V.serialization.string().optional(),index:$V.serialization.number().optional(),parameters:$V.serialization.string().optional(),text:$V.serialization.string().optional()})});var iTe=v(mS=>{"use strict";var Y2r=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]}),Z2r=mS&&mS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X2r=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)&&Y2r(e,t,r);return Z2r(e,t),e};Object.defineProperty(mS,"__esModule",{value:!0});mS.ChatToolCallsChunkEvent=void 0;var yOt=X2r(G()),Q2r=oTe(),e4r=oS();mS.ChatToolCallsChunkEvent=yOt.serialization.object({toolCallDelta:yOt.serialization.property("tool_call_delta",Q2r.ToolCallDelta)}).extend(e4r.ChatStreamEvent)});var _Ot=v(hS=>{"use strict";var t4r=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]}),r4r=hS&&hS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n4r=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)&&t4r(e,t,r);return r4r(e,t),e};Object.defineProperty(hS,"__esModule",{value:!0});hS.StreamedChatResponse=void 0;var bOt=n4r(G()),o4r=JEe(),i4r=ZEe(),a4r=XEe(),s4r=QEe(),u4r=eTe(),l4r=tTe(),c4r=nTe(),d4r=iTe();hS.StreamedChatResponse=bOt.serialization.union(bOt.serialization.discriminant("eventType","event_type"),{"stream-start":o4r.ChatStreamStartEvent,"search-queries-generation":i4r.ChatSearchQueriesGenerationEvent,"search-results":a4r.ChatSearchResultsEvent,"text-generation":s4r.ChatTextGenerationEvent,"citation-generation":u4r.ChatCitationGenerationEvent,"tool-calls-generation":l4r.ChatToolCallsGenerationEvent,"stream-end":c4r.ChatStreamEndEvent,"tool-calls-chunk":d4r.ChatToolCallsChunkEvent}).transform({transform:t=>t,untransform:t=>t})});var sTe=v(gS=>{"use strict";var f4r=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]}),p4r=gS&&gS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4r=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)&&f4r(e,t,r);return p4r(e,t),e};Object.defineProperty(gS,"__esModule",{value:!0});gS.SingleGenerationTokenLikelihoodsItem=void 0;var aTe=m4r(G());gS.SingleGenerationTokenLikelihoodsItem=aTe.serialization.object({token:aTe.serialization.string(),likelihood:aTe.serialization.number()})});var uTe=v(yS=>{"use strict";var h4r=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]}),g4r=yS&&yS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4r=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)&&h4r(e,t,r);return g4r(e,t),e};Object.defineProperty(yS,"__esModule",{value:!0});yS.SingleGeneration=void 0;var Ej=y4r(G()),b4r=sTe();yS.SingleGeneration=Ej.serialization.object({id:Ej.serialization.string(),text:Ej.serialization.string(),index:Ej.serialization.number().optional(),likelihood:Ej.serialization.number().optional(),tokenLikelihoods:Ej.serialization.property("token_likelihoods",Ej.serialization.list(b4r.SingleGenerationTokenLikelihoodsItem).optional())})});var vOt=v(bS=>{"use strict";var _4r=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]}),v4r=bS&&bS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w4r=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)&&_4r(e,t,r);return v4r(e,t),e};Object.defineProperty(bS,"__esModule",{value:!0});bS.Generation=void 0;var pre=w4r(G()),S4r=uTe(),x4r=qm();bS.Generation=pre.serialization.object({id:pre.serialization.string(),prompt:pre.serialization.string().optional(),generations:pre.serialization.list(S4r.SingleGeneration),meta:x4r.ApiMeta.optional()})});var BV=v(_S=>{"use strict";var C4r=_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]}),O4r=_S&&_S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4r=_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)&&C4r(e,t,r);return O4r(e,t),e};Object.defineProperty(_S,"__esModule",{value:!0});_S.GenerateStreamEvent=void 0;var E4r=P4r(G());_S.GenerateStreamEvent=E4r.serialization.object({})});var lTe=v(vS=>{"use strict";var T4r=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]}),A4r=vS&&vS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4r=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)&&T4r(e,t,r);return A4r(e,t),e};Object.defineProperty(vS,"__esModule",{value:!0});vS.GenerateStreamText=void 0;var qV=I4r(G()),M4r=BV();vS.GenerateStreamText=qV.serialization.object({text:qV.serialization.string(),index:qV.serialization.number().optional(),isFinished:qV.serialization.property("is_finished",qV.serialization.boolean())}).extend(M4r.GenerateStreamEvent)});var cTe=v(wS=>{"use strict";var R4r=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]}),j4r=wS&&wS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N4r=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)&&R4r(e,t,r);return j4r(e,t),e};Object.defineProperty(wS,"__esModule",{value:!0});wS.SingleGenerationInStream=void 0;var UV=N4r(G()),D4r=eB();wS.SingleGenerationInStream=UV.serialization.object({id:UV.serialization.string(),text:UV.serialization.string(),index:UV.serialization.number().optional(),finishReason:UV.serialization.property("finish_reason",D4r.FinishReason)})});var dTe=v(SS=>{"use strict";var L4r=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]}),F4r=SS&&SS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4r=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)&&L4r(e,t,r);return F4r(e,t),e};Object.defineProperty(SS,"__esModule",{value:!0});SS.GenerateStreamEndResponse=void 0;var mre=k4r(G()),$4r=cTe();SS.GenerateStreamEndResponse=mre.serialization.object({id:mre.serialization.string(),prompt:mre.serialization.string().optional(),generations:mre.serialization.list($4r.SingleGenerationInStream).optional()})});var fTe=v(xS=>{"use strict";var B4r=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]}),q4r=xS&&xS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U4r=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)&&B4r(e,t,r);return q4r(e,t),e};Object.defineProperty(xS,"__esModule",{value:!0});xS.GenerateStreamEnd=void 0;var hre=U4r(G()),z4r=eB(),H4r=dTe(),V4r=BV();xS.GenerateStreamEnd=hre.serialization.object({isFinished:hre.serialization.property("is_finished",hre.serialization.boolean()),finishReason:hre.serialization.property("finish_reason",z4r.FinishReason.optional()),response:H4r.GenerateStreamEndResponse}).extend(V4r.GenerateStreamEvent)});var pTe=v(CS=>{"use strict";var W4r=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]}),K4r=CS&&CS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G4r=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)&&W4r(e,t,r);return K4r(e,t),e};Object.defineProperty(CS,"__esModule",{value:!0});CS.GenerateStreamError=void 0;var tB=G4r(G()),J4r=eB(),Y4r=BV();CS.GenerateStreamError=tB.serialization.object({index:tB.serialization.number().optional(),isFinished:tB.serialization.property("is_finished",tB.serialization.boolean()),finishReason:tB.serialization.property("finish_reason",J4r.FinishReason),err:tB.serialization.string()}).extend(Y4r.GenerateStreamEvent)});var SOt=v(OS=>{"use strict";var Z4r=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]}),X4r=OS&&OS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4r=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)&&Z4r(e,t,r);return X4r(e,t),e};Object.defineProperty(OS,"__esModule",{value:!0});OS.GenerateStreamedResponse=void 0;var wOt=Q4r(G()),e3r=lTe(),t3r=fTe(),r3r=pTe();OS.GenerateStreamedResponse=wOt.serialization.union(wOt.serialization.discriminant("eventType","event_type"),{"text-generation":e3r.GenerateStreamText,"stream-end":t3r.GenerateStreamEnd,"stream-error":r3r.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var mTe=v(PS=>{"use strict";var n3r=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]}),o3r=PS&&PS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i3r=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)&&n3r(e,t,r);return o3r(e,t),e};Object.defineProperty(PS,"__esModule",{value:!0});PS.EmbedJobStatus=void 0;var a3r=i3r(G());PS.EmbedJobStatus=a3r.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var hTe=v(ES=>{"use strict";var s3r=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]}),u3r=ES&&ES.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l3r=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)&&s3r(e,t,r);return u3r(e,t),e};Object.defineProperty(ES,"__esModule",{value:!0});ES.EmbedJobTruncate=void 0;var c3r=l3r(G());ES.EmbedJobTruncate=c3r.serialization.enum_(["START","END"])});var gTe=v(TS=>{"use strict";var d3r=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]}),f3r=TS&&TS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p3r=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)&&d3r(e,t,r);return f3r(e,t),e};Object.defineProperty(TS,"__esModule",{value:!0});TS.EmbedJob=void 0;var Uy=p3r(G()),m3r=mTe(),h3r=hTe(),g3r=qm();TS.EmbedJob=Uy.serialization.object({jobId:Uy.serialization.property("job_id",Uy.serialization.string()),name:Uy.serialization.string().optional(),status:m3r.EmbedJobStatus,createdAt:Uy.serialization.property("created_at",Uy.serialization.date()),inputDatasetId:Uy.serialization.property("input_dataset_id",Uy.serialization.string()),outputDatasetId:Uy.serialization.property("output_dataset_id",Uy.serialization.string().optional()),model:Uy.serialization.string(),truncate:h3r.EmbedJobTruncate,meta:g3r.ApiMeta.optional()})});var xOt=v(AS=>{"use strict";var y3r=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]}),b3r=AS&&AS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_3r=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)&&y3r(e,t,r);return b3r(e,t),e};Object.defineProperty(AS,"__esModule",{value:!0});AS.ListEmbedJobResponse=void 0;var yTe=_3r(G()),v3r=gTe();AS.ListEmbedJobResponse=yTe.serialization.object({embedJobs:yTe.serialization.property("embed_jobs",yTe.serialization.list(v3r.EmbedJob).optional())})});var COt=v(IS=>{"use strict";var w3r=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]}),S3r=IS&&IS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3r=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)&&w3r(e,t,r);return S3r(e,t),e};Object.defineProperty(IS,"__esModule",{value:!0});IS.CreateEmbedJobResponse=void 0;var bTe=x3r(G()),C3r=qm();IS.CreateEmbedJobResponse=bTe.serialization.object({jobId:bTe.serialization.property("job_id",bTe.serialization.string()),meta:C3r.ApiMeta.optional()})});var vTe=v(MS=>{"use strict";var O3r=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]}),P3r=MS&&MS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E3r=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)&&O3r(e,t,r);return P3r(e,t),e};Object.defineProperty(MS,"__esModule",{value:!0});MS.ClassifyExample=void 0;var _Te=E3r(G());MS.ClassifyExample=_Te.serialization.object({text:_Te.serialization.string().optional(),label:_Te.serialization.string().optional()})});var OOt=v(RS=>{"use strict";var T3r=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]}),A3r=RS&&RS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I3r=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)&&T3r(e,t,r);return A3r(e,t),e};Object.defineProperty(RS,"__esModule",{value:!0});RS.ParseInfo=void 0;var wTe=I3r(G());RS.ParseInfo=wTe.serialization.object({separator:wTe.serialization.string().optional(),delimiter:wTe.serialization.string().optional()})});var POt=v(jS=>{"use strict";var M3r=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]}),R3r=jS&&jS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j3r=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)&&M3r(e,t,r);return R3r(e,t),e};Object.defineProperty(jS,"__esModule",{value:!0});jS.RerankerDataMetrics=void 0;var Um=j3r(G());jS.RerankerDataMetrics=Um.serialization.object({numTrainQueries:Um.serialization.property("num_train_queries",Um.serialization.number().optional()),numTrainRelevantPassages:Um.serialization.property("num_train_relevant_passages",Um.serialization.number().optional()),numTrainHardNegatives:Um.serialization.property("num_train_hard_negatives",Um.serialization.number().optional()),numEvalQueries:Um.serialization.property("num_eval_queries",Um.serialization.number().optional()),numEvalRelevantPassages:Um.serialization.property("num_eval_relevant_passages",Um.serialization.number().optional()),numEvalHardNegatives:Um.serialization.property("num_eval_hard_negatives",Um.serialization.number().optional())})});var EOt=v(NS=>{"use strict";var N3r=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]}),D3r=NS&&NS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L3r=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)&&N3r(e,t,r);return D3r(e,t),e};Object.defineProperty(NS,"__esModule",{value:!0});NS.ChatDataMetrics=void 0;var rB=L3r(G());NS.ChatDataMetrics=rB.serialization.object({numTrainTurns:rB.serialization.property("num_train_turns",rB.serialization.number().optional()),numEvalTurns:rB.serialization.property("num_eval_turns",rB.serialization.number().optional()),preamble:rB.serialization.string().optional()})});var STe=v(DS=>{"use strict";var F3r=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]}),k3r=DS&&DS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$3r=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)&&F3r(e,t,r);return k3r(e,t),e};Object.defineProperty(DS,"__esModule",{value:!0});DS.LabelMetric=void 0;var nB=$3r(G());DS.LabelMetric=nB.serialization.object({totalExamples:nB.serialization.property("total_examples",nB.serialization.number().optional()),label:nB.serialization.string().optional(),samples:nB.serialization.list(nB.serialization.string()).optional()})});var TOt=v(LS=>{"use strict";var B3r=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]}),q3r=LS&&LS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U3r=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)&&B3r(e,t,r);return q3r(e,t),e};Object.defineProperty(LS,"__esModule",{value:!0});LS.ClassifyDataMetrics=void 0;var xTe=U3r(G()),z3r=STe();LS.ClassifyDataMetrics=xTe.serialization.object({labelMetrics:xTe.serialization.property("label_metrics",xTe.serialization.list(z3r.LabelMetric).optional())})});var CTe=v(FS=>{"use strict";var H3r=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]}),V3r=FS&&FS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W3r=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)&&H3r(e,t,r);return V3r(e,t),e};Object.defineProperty(FS,"__esModule",{value:!0});FS.FinetuneDatasetMetrics=void 0;var zm=W3r(G());FS.FinetuneDatasetMetrics=zm.serialization.object({trainableTokenCount:zm.serialization.property("trainable_token_count",zm.serialization.number().optional()),totalExamples:zm.serialization.property("total_examples",zm.serialization.number().optional()),trainExamples:zm.serialization.property("train_examples",zm.serialization.number().optional()),trainSizeBytes:zm.serialization.property("train_size_bytes",zm.serialization.number().optional()),evalExamples:zm.serialization.property("eval_examples",zm.serialization.number().optional()),evalSizeBytes:zm.serialization.property("eval_size_bytes",zm.serialization.number().optional())})});var PTe=v(kS=>{"use strict";var K3r=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]}),G3r=kS&&kS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J3r=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)&&K3r(e,t,r);return G3r(e,t),e};Object.defineProperty(kS,"__esModule",{value:!0});kS.MetricsEmbedDataFieldsItem=void 0;var OTe=J3r(G());kS.MetricsEmbedDataFieldsItem=OTe.serialization.object({name:OTe.serialization.string().optional(),count:OTe.serialization.number().optional()})});var ETe=v($S=>{"use strict";var Y3r=$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]}),Z3r=$S&&$S.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X3r=$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)&&Y3r(e,t,r);return Z3r(e,t),e};Object.defineProperty($S,"__esModule",{value:!0});$S.MetricsEmbedData=void 0;var AOt=X3r(G()),Q3r=PTe();$S.MetricsEmbedData=AOt.serialization.object({fields:AOt.serialization.list(Q3r.MetricsEmbedDataFieldsItem).optional()})});var IOt=v(BS=>{"use strict";var eHr=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]}),tHr=BS&&BS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rHr=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)&&eHr(e,t,r);return tHr(e,t),e};Object.defineProperty(BS,"__esModule",{value:!0});BS.Metrics=void 0;var TTe=rHr(G()),nHr=CTe(),oHr=ETe();BS.Metrics=TTe.serialization.object({finetuneDatasetMetrics:TTe.serialization.property("finetune_dataset_metrics",nHr.FinetuneDatasetMetrics.optional()),embedData:TTe.serialization.property("embed_data",oHr.MetricsEmbedData.optional())})});var ATe=v(US=>{"use strict";var iHr=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]}),aHr=US&&US.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sHr=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)&&iHr(e,t,r);return aHr(e,t),e};Object.defineProperty(US,"__esModule",{value:!0});US.ConnectorOAuth=void 0;var qS=sHr(G());US.ConnectorOAuth=qS.serialization.object({clientId:qS.serialization.property("client_id",qS.serialization.string().optional()),clientSecret:qS.serialization.property("client_secret",qS.serialization.string().optional()),authorizeUrl:qS.serialization.property("authorize_url",qS.serialization.string()),tokenUrl:qS.serialization.property("token_url",qS.serialization.string()),scope:qS.serialization.string().optional()})});var ITe=v(zS=>{"use strict";var uHr=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]}),lHr=zS&&zS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cHr=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)&&uHr(e,t,r);return lHr(e,t),e};Object.defineProperty(zS,"__esModule",{value:!0});zS.ConnectorAuthStatus=void 0;var dHr=cHr(G());zS.ConnectorAuthStatus=dHr.serialization.enum_(["valid","expired"])});var oB=v(HS=>{"use strict";var fHr=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]}),pHr=HS&&HS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHr=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)&&fHr(e,t,r);return pHr(e,t),e};Object.defineProperty(HS,"__esModule",{value:!0});HS.Connector=void 0;var Rl=mHr(G()),hHr=ATe(),gHr=ITe();HS.Connector=Rl.serialization.object({id:Rl.serialization.string(),organizationId:Rl.serialization.property("organization_id",Rl.serialization.string().optional()),name:Rl.serialization.string(),description:Rl.serialization.string().optional(),url:Rl.serialization.string().optional(),createdAt:Rl.serialization.property("created_at",Rl.serialization.date()),updatedAt:Rl.serialization.property("updated_at",Rl.serialization.date()),excludes:Rl.serialization.list(Rl.serialization.string()).optional(),authType:Rl.serialization.property("auth_type",Rl.serialization.string().optional()),oauth:hHr.ConnectorOAuth.optional(),authStatus:Rl.serialization.property("auth_status",gHr.ConnectorAuthStatus.optional()),active:Rl.serialization.boolean().optional(),continueOnFailure:Rl.serialization.property("continue_on_failure",Rl.serialization.boolean().optional())})});var MOt=v(VS=>{"use strict";var yHr=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]}),bHr=VS&&VS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Hr=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)&&yHr(e,t,r);return bHr(e,t),e};Object.defineProperty(VS,"__esModule",{value:!0});VS.ListConnectorsResponse=void 0;var gre=_Hr(G()),vHr=oB();VS.ListConnectorsResponse=gre.serialization.object({connectors:gre.serialization.list(vHr.Connector),totalCount:gre.serialization.property("total_count",gre.serialization.number().optional())})});var ROt=v(WS=>{"use strict";var wHr=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]}),SHr=WS&&WS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xHr=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)&&wHr(e,t,r);return SHr(e,t),e};Object.defineProperty(WS,"__esModule",{value:!0});WS.CreateConnectorResponse=void 0;var CHr=xHr(G()),OHr=oB();WS.CreateConnectorResponse=CHr.serialization.object({connector:OHr.Connector})});var jOt=v(KS=>{"use strict";var PHr=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]}),EHr=KS&&KS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),THr=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)&&PHr(e,t,r);return EHr(e,t),e};Object.defineProperty(KS,"__esModule",{value:!0});KS.GetConnectorResponse=void 0;var AHr=THr(G()),IHr=oB();KS.GetConnectorResponse=AHr.serialization.object({connector:IHr.Connector})});var NOt=v(GS=>{"use strict";var MHr=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]}),RHr=GS&&GS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHr=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)&&MHr(e,t,r);return RHr(e,t),e};Object.defineProperty(GS,"__esModule",{value:!0});GS.DeleteConnectorResponse=void 0;var MTe=jHr(G());GS.DeleteConnectorResponse=MTe.serialization.record(MTe.serialization.string(),MTe.serialization.unknown())});var DOt=v(JS=>{"use strict";var NHr=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]}),DHr=JS&&JS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LHr=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)&&NHr(e,t,r);return DHr(e,t),e};Object.defineProperty(JS,"__esModule",{value:!0});JS.UpdateConnectorResponse=void 0;var FHr=LHr(G()),kHr=oB();JS.UpdateConnectorResponse=FHr.serialization.object({connector:kHr.Connector})});var LOt=v(YS=>{"use strict";var $Hr=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]}),BHr=YS&&YS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHr=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)&&$Hr(e,t,r);return BHr(e,t),e};Object.defineProperty(YS,"__esModule",{value:!0});YS.OAuthAuthorizeResponse=void 0;var RTe=qHr(G());YS.OAuthAuthorizeResponse=RTe.serialization.object({redirectUrl:RTe.serialization.property("redirect_url",RTe.serialization.string().optional())})});var jTe=v(ZS=>{"use strict";var UHr=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]}),zHr=ZS&&ZS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HHr=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)&&UHr(e,t,r);return zHr(e,t),e};Object.defineProperty(ZS,"__esModule",{value:!0});ZS.CompatibleEndpoint=void 0;var VHr=HHr(G());ZS.CompatibleEndpoint=VHr.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var NTe=v(QS=>{"use strict";var WHr=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]}),KHr=QS&&QS.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GHr=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)&&WHr(e,t,r);return KHr(e,t),e};Object.defineProperty(QS,"__esModule",{value:!0});QS.GetModelResponse=void 0;var XS=GHr(G()),FOt=jTe();QS.GetModelResponse=XS.serialization.object({name:XS.serialization.string().optional(),endpoints:XS.serialization.list(FOt.CompatibleEndpoint).optional(),finetuned:XS.serialization.boolean().optional(),contextLength:XS.serialization.property("context_length",XS.serialization.number().optional()),tokenizerUrl:XS.serialization.property("tokenizer_url",XS.serialization.string().optional()),defaultEndpoints:XS.serialization.property("default_endpoints",XS.serialization.list(FOt.CompatibleEndpoint).optional())})});var kOt=v(ex=>{"use strict";var JHr=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]}),YHr=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZHr=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)&&JHr(e,t,r);return YHr(e,t),e};Object.defineProperty(ex,"__esModule",{value:!0});ex.ListModelsResponse=void 0;var yre=ZHr(G()),XHr=NTe();ex.ListModelsResponse=yre.serialization.object({models:yre.serialization.list(XHr.GetModelResponse),nextPageToken:yre.serialization.property("next_page_token",yre.serialization.string().optional())})});var $Ot=v(me=>{"use strict";var QHr=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]}),xe=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&QHr(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});xe(uEe(),me);xe(lEe(),me);xe(UCt(),me);xe(cEe(),me);xe(HCt(),me);xe(WCt(),me);xe(GCt(),me);xe(YCt(),me);xe(XCt(),me);xe(dEe(),me);xe(fEe(),me);xe(eOt(),me);xe(pEe(),me);xe(mEe(),me);xe(hEe(),me);xe(gEe(),me);xe(yEe(),me);xe(bEe(),me);xe(rOt(),me);xe(EEe(),me);xe(TEe(),me);xe(AEe(),me);xe(iOt(),me);xe(MEe(),me);xe(REe(),me);xe(jEe(),me);xe(NEe(),me);xe(sOt(),me);xe(LEe(),me);xe(FEe(),me);xe(kEe(),me);xe(uOt(),me);xe(lOt(),me);xe(dOt(),me);xe(fOt(),me);xe(X$(),me);xe(BEe(),me);xe(LV(),me);xe(UEe(),me);xe(FV(),me);xe(nre(),me);xe(hj(),me);xe(HEe(),me);xe(ire(),me);xe(zte(),me);xe(VEe(),me);xe(sre(),me);xe(ure(),me);xe(kV(),me);xe(WEe(),me);xe(cre(),me);xe(eB(),me);xe(_Ee(),me);xe(vEe(),me);xe(wEe(),me);xe(qm(),me);xe(KEe(),me);xe(oS(),me);xe(JEe(),me);xe(ZEe(),me);xe(XEe(),me);xe(QEe(),me);xe(eTe(),me);xe(tTe(),me);xe(rTe(),me);xe(nTe(),me);xe(oTe(),me);xe(iTe(),me);xe(_Ot(),me);xe($Pe(),me);xe(Hte(),me);xe(NPe(),me);xe(DPe(),me);xe(LPe(),me);xe(FPe(),me);xe(sTe(),me);xe(uTe(),me);xe(vOt(),me);xe(BV(),me);xe(lTe(),me);xe(cTe(),me);xe(dTe(),me);xe(fTe(),me);xe(pTe(),me);xe(SOt(),me);xe(Vte(),me);xe(Wte(),me);xe(SEe(),me);xe(xEe(),me);xe(CEe(),me);xe(mTe(),me);xe(hTe(),me);xe(gTe(),me);xe(xOt(),me);xe(COt(),me);xe(PEe(),me);xe(vTe(),me);xe(VPe(),me);xe(HPe(),me);xe(WPe(),me);xe(OOt(),me);xe(POt(),me);xe(EOt(),me);xe(STe(),me);xe(TOt(),me);xe(CTe(),me);xe(PTe(),me);xe(ETe(),me);xe(IOt(),me);xe(Gte(),me);xe(ATe(),me);xe(ITe(),me);xe(oB(),me);xe(MOt(),me);xe(Xte(),me);xe(aEe(),me);xe(Qte(),me);xe(ROt(),me);xe(jOt(),me);xe(NOt(),me);xe(DOt(),me);xe(LOt(),me);xe(jTe(),me);xe(NTe(),me);xe(kOt(),me)});var BOt=v(tx=>{"use strict";var eVr=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]}),tVr=tx&&tx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rVr=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)&&eVr(e,t,r);return tVr(e,t),e};Object.defineProperty(tx,"__esModule",{value:!0});tx.ChatStreamRequest=void 0;var dn=rVr(G()),nVr=FV(),oVr=uEe(),iVr=nre(),aVr=hj(),sVr=lEe(),uVr=ire(),lVr=LV(),cVr=sre(),dVr=cEe();tx.ChatStreamRequest=dn.serialization.object({message:dn.serialization.string(),model:dn.serialization.string().optional(),preamble:dn.serialization.string().optional(),chatHistory:dn.serialization.property("chat_history",dn.serialization.list(nVr.Message).optional()),conversationId:dn.serialization.property("conversation_id",dn.serialization.string().optional()),promptTruncation:dn.serialization.property("prompt_truncation",oVr.ChatStreamRequestPromptTruncation.optional()),connectors:dn.serialization.list(iVr.ChatConnector).optional(),searchQueriesOnly:dn.serialization.property("search_queries_only",dn.serialization.boolean().optional()),documents:dn.serialization.list(aVr.ChatDocument).optional(),citationQuality:dn.serialization.property("citation_quality",sVr.ChatStreamRequestCitationQuality.optional()),temperature:dn.serialization.number().optional(),maxTokens:dn.serialization.property("max_tokens",dn.serialization.number().optional()),maxInputTokens:dn.serialization.property("max_input_tokens",dn.serialization.number().optional()),k:dn.serialization.number().optional(),p:dn.serialization.number().optional(),seed:dn.serialization.number().optional(),stopSequences:dn.serialization.property("stop_sequences",dn.serialization.list(dn.serialization.string()).optional()),frequencyPenalty:dn.serialization.property("frequency_penalty",dn.serialization.number().optional()),presencePenalty:dn.serialization.property("presence_penalty",dn.serialization.number().optional()),rawPrompting:dn.serialization.property("raw_prompting",dn.serialization.boolean().optional()),returnPrompt:dn.serialization.property("return_prompt",dn.serialization.boolean().optional()),tools:dn.serialization.list(uVr.Tool).optional(),toolResults:dn.serialization.property("tool_results",dn.serialization.list(lVr.ToolResult).optional()),forceSingleStep:dn.serialization.property("force_single_step",dn.serialization.boolean().optional()),responseFormat:dn.serialization.property("response_format",cVr.ResponseFormat.optional()),safetyMode:dn.serialization.property("safety_mode",dVr.ChatStreamRequestSafetyMode.optional())})});var qOt=v(rx=>{"use strict";var fVr=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]}),pVr=rx&&rx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mVr=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)&&fVr(e,t,r);return pVr(e,t),e};Object.defineProperty(rx,"__esModule",{value:!0});rx.ChatRequest=void 0;var fn=mVr(G()),hVr=FV(),gVr=dEe(),yVr=nre(),bVr=hj(),_Vr=fEe(),vVr=ire(),wVr=LV(),SVr=sre(),xVr=pEe();rx.ChatRequest=fn.serialization.object({message:fn.serialization.string(),model:fn.serialization.string().optional(),preamble:fn.serialization.string().optional(),chatHistory:fn.serialization.property("chat_history",fn.serialization.list(hVr.Message).optional()),conversationId:fn.serialization.property("conversation_id",fn.serialization.string().optional()),promptTruncation:fn.serialization.property("prompt_truncation",gVr.ChatRequestPromptTruncation.optional()),connectors:fn.serialization.list(yVr.ChatConnector).optional(),searchQueriesOnly:fn.serialization.property("search_queries_only",fn.serialization.boolean().optional()),documents:fn.serialization.list(bVr.ChatDocument).optional(),citationQuality:fn.serialization.property("citation_quality",_Vr.ChatRequestCitationQuality.optional()),temperature:fn.serialization.number().optional(),maxTokens:fn.serialization.property("max_tokens",fn.serialization.number().optional()),maxInputTokens:fn.serialization.property("max_input_tokens",fn.serialization.number().optional()),k:fn.serialization.number().optional(),p:fn.serialization.number().optional(),seed:fn.serialization.number().optional(),stopSequences:fn.serialization.property("stop_sequences",fn.serialization.list(fn.serialization.string()).optional()),frequencyPenalty:fn.serialization.property("frequency_penalty",fn.serialization.number().optional()),presencePenalty:fn.serialization.property("presence_penalty",fn.serialization.number().optional()),rawPrompting:fn.serialization.property("raw_prompting",fn.serialization.boolean().optional()),returnPrompt:fn.serialization.property("return_prompt",fn.serialization.boolean().optional()),tools:fn.serialization.list(vVr.Tool).optional(),toolResults:fn.serialization.property("tool_results",fn.serialization.list(wVr.ToolResult).optional()),forceSingleStep:fn.serialization.property("force_single_step",fn.serialization.boolean().optional()),responseFormat:fn.serialization.property("response_format",SVr.ResponseFormat.optional()),safetyMode:fn.serialization.property("safety_mode",xVr.ChatRequestSafetyMode.optional())})});var UOt=v(nx=>{"use strict";var CVr=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]}),OVr=nx&&nx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PVr=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)&&CVr(e,t,r);return OVr(e,t),e};Object.defineProperty(nx,"__esModule",{value:!0});nx.GenerateStreamRequest=void 0;var ca=PVr(G()),EVr=mEe(),TVr=hEe();nx.GenerateStreamRequest=ca.serialization.object({prompt:ca.serialization.string(),model:ca.serialization.string().optional(),numGenerations:ca.serialization.property("num_generations",ca.serialization.number().optional()),maxTokens:ca.serialization.property("max_tokens",ca.serialization.number().optional()),truncate:EVr.GenerateStreamRequestTruncate.optional(),temperature:ca.serialization.number().optional(),seed:ca.serialization.number().optional(),preset:ca.serialization.string().optional(),endSequences:ca.serialization.property("end_sequences",ca.serialization.list(ca.serialization.string()).optional()),stopSequences:ca.serialization.property("stop_sequences",ca.serialization.list(ca.serialization.string()).optional()),k:ca.serialization.number().optional(),p:ca.serialization.number().optional(),frequencyPenalty:ca.serialization.property("frequency_penalty",ca.serialization.number().optional()),presencePenalty:ca.serialization.property("presence_penalty",ca.serialization.number().optional()),returnLikelihoods:ca.serialization.property("return_likelihoods",TVr.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:ca.serialization.property("raw_prompting",ca.serialization.boolean().optional())})});var zOt=v(ox=>{"use strict";var AVr=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]}),IVr=ox&&ox.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MVr=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)&&AVr(e,t,r);return IVr(e,t),e};Object.defineProperty(ox,"__esModule",{value:!0});ox.GenerateRequest=void 0;var da=MVr(G()),RVr=gEe(),jVr=yEe();ox.GenerateRequest=da.serialization.object({prompt:da.serialization.string(),model:da.serialization.string().optional(),numGenerations:da.serialization.property("num_generations",da.serialization.number().optional()),maxTokens:da.serialization.property("max_tokens",da.serialization.number().optional()),truncate:RVr.GenerateRequestTruncate.optional(),temperature:da.serialization.number().optional(),seed:da.serialization.number().optional(),preset:da.serialization.string().optional(),endSequences:da.serialization.property("end_sequences",da.serialization.list(da.serialization.string()).optional()),stopSequences:da.serialization.property("stop_sequences",da.serialization.list(da.serialization.string()).optional()),k:da.serialization.number().optional(),p:da.serialization.number().optional(),frequencyPenalty:da.serialization.property("frequency_penalty",da.serialization.number().optional()),presencePenalty:da.serialization.property("presence_penalty",da.serialization.number().optional()),returnLikelihoods:da.serialization.property("return_likelihoods",jVr.GenerateRequestReturnLikelihoods.optional()),rawPrompting:da.serialization.property("raw_prompting",da.serialization.boolean().optional())})});var HOt=v(ix=>{"use strict";var NVr=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]}),DVr=ix&&ix.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LVr=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)&&NVr(e,t,r);return DVr(e,t),e};Object.defineProperty(ix,"__esModule",{value:!0});ix.EmbedRequest=void 0;var Tj=LVr(G()),FVr=Vte(),kVr=Wte(),$Vr=bEe();ix.EmbedRequest=Tj.serialization.object({texts:Tj.serialization.list(Tj.serialization.string()),model:Tj.serialization.string().optional(),inputType:Tj.serialization.property("input_type",FVr.EmbedInputType.optional()),embeddingTypes:Tj.serialization.property("embedding_types",Tj.serialization.list(kVr.EmbeddingType).optional()),truncate:$Vr.EmbedRequestTruncate.optional()})});var VOt=v(ax=>{"use strict";var BVr=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]}),qVr=ax&&ax.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UVr=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)&&BVr(e,t,r);return qVr(e,t),e};Object.defineProperty(ax,"__esModule",{value:!0});ax.RerankRequest=void 0;var Hm=UVr(G()),zVr=EEe();ax.RerankRequest=Hm.serialization.object({model:Hm.serialization.string().optional(),query:Hm.serialization.string(),documents:Hm.serialization.list(zVr.RerankRequestDocumentsItem),topN:Hm.serialization.property("top_n",Hm.serialization.number().optional()),rankFields:Hm.serialization.property("rank_fields",Hm.serialization.list(Hm.serialization.string()).optional()),returnDocuments:Hm.serialization.property("return_documents",Hm.serialization.boolean().optional()),maxChunksPerDoc:Hm.serialization.property("max_chunks_per_doc",Hm.serialization.number().optional())})});var WOt=v(sx=>{"use strict";var HVr=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]}),VVr=sx&&sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WVr=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)&&HVr(e,t,r);return VVr(e,t),e};Object.defineProperty(sx,"__esModule",{value:!0});sx.ClassifyRequest=void 0;var iB=WVr(G()),KVr=vTe(),GVr=MEe();sx.ClassifyRequest=iB.serialization.object({inputs:iB.serialization.list(iB.serialization.string()),examples:iB.serialization.list(KVr.ClassifyExample).optional(),model:iB.serialization.string().optional(),preset:iB.serialization.string().optional(),truncate:GVr.ClassifyRequestTruncate.optional()})});var KOt=v(ux=>{"use strict";var JVr=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]}),YVr=ux&&ux.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZVr=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)&&JVr(e,t,r);return YVr(e,t),e};Object.defineProperty(ux,"__esModule",{value:!0});ux.SummarizeRequest=void 0;var aB=ZVr(G()),XVr=LEe(),QVr=FEe(),e8r=kEe();ux.SummarizeRequest=aB.serialization.object({text:aB.serialization.string(),length:XVr.SummarizeRequestLength.optional(),format:QVr.SummarizeRequestFormat.optional(),model:aB.serialization.string().optional(),extractiveness:e8r.SummarizeRequestExtractiveness.optional(),temperature:aB.serialization.number().optional(),additionalCommand:aB.serialization.property("additional_command",aB.serialization.string().optional())})});var GOt=v(lx=>{"use strict";var t8r=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]}),r8r=lx&&lx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n8r=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)&&t8r(e,t,r);return r8r(e,t),e};Object.defineProperty(lx,"__esModule",{value:!0});lx.TokenizeRequest=void 0;var DTe=n8r(G());lx.TokenizeRequest=DTe.serialization.object({text:DTe.serialization.string(),model:DTe.serialization.string()})});var JOt=v(cx=>{"use strict";var o8r=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]}),i8r=cx&&cx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a8r=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)&&o8r(e,t,r);return i8r(e,t),e};Object.defineProperty(cx,"__esModule",{value:!0});cx.DetokenizeRequest=void 0;var bre=a8r(G());cx.DetokenizeRequest=bre.serialization.object({tokens:bre.serialization.list(bre.serialization.number()),model:bre.serialization.string()})});var YOt=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 s8r=BOt();Object.defineProperty(ps,"ChatStreamRequest",{enumerable:!0,get:function(){return s8r.ChatStreamRequest}});var u8r=qOt();Object.defineProperty(ps,"ChatRequest",{enumerable:!0,get:function(){return u8r.ChatRequest}});var l8r=UOt();Object.defineProperty(ps,"GenerateStreamRequest",{enumerable:!0,get:function(){return l8r.GenerateStreamRequest}});var c8r=zOt();Object.defineProperty(ps,"GenerateRequest",{enumerable:!0,get:function(){return c8r.GenerateRequest}});var d8r=HOt();Object.defineProperty(ps,"EmbedRequest",{enumerable:!0,get:function(){return d8r.EmbedRequest}});var f8r=VOt();Object.defineProperty(ps,"RerankRequest",{enumerable:!0,get:function(){return f8r.RerankRequest}});var p8r=WOt();Object.defineProperty(ps,"ClassifyRequest",{enumerable:!0,get:function(){return p8r.ClassifyRequest}});var m8r=KOt();Object.defineProperty(ps,"SummarizeRequest",{enumerable:!0,get:function(){return m8r.SummarizeRequest}});var h8r=GOt();Object.defineProperty(ps,"TokenizeRequest",{enumerable:!0,get:function(){return h8r.TokenizeRequest}});var g8r=JOt();Object.defineProperty(ps,"DetokenizeRequest",{enumerable:!0,get:function(){return g8r.DetokenizeRequest}})});var ZOt=v(Aj=>{"use strict";var y8r=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]}),b8r=Aj&&Aj.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y8r(e,t,r)};Object.defineProperty(Aj,"__esModule",{value:!0});b8r(YOt(),Aj)});var NO=v(jO=>{"use strict";var _8r=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]}),LTe=jO&&jO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_8r(e,t,r)};Object.defineProperty(jO,"__esModule",{value:!0});LTe(BCt(),jO);LTe($Ot(),jO);LTe(ZOt(),jO)});var FTe=v(ni=>{"use strict";var v8r=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]}),w8r=ni&&ni.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S8r=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)&&v8r(e,t,r);return w8r(e,t),e},_re=ni&&ni.__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())})},x8r=ni&&ni.__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(ni,"__esModule",{value:!0});ni.fetchOverride=ni.parseAWSEvent=ni.getEndpointFromUrl=ni.getAuthHeaders=ni.getUrl=ni.mapResponseFromBedrock=void 0;var C8r=x_e(),O8r=(zpt(),zl(Upt)),P8r=Jht(),E8r=cyt(),T8r=JH(),A8r=G(),I8r=XCe(),M8r=Txt(),zV=S8r(NO()),R8r=(t,e)=>_re(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),j8r={chat:zV.StreamedChatResponse,generate:zV.GenerateStreamedResponse},N8r={chat:zV.NonStreamedChatResponse,embed:zV.EmbedResponse,generate:zV.Generation},D8r=(t,e,r)=>_re(void 0,void 0,void 0,function*(){let n=t?j8r[e]:N8r[e],o={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},i=yield n.parseOrThrow(r,o);return n.jsonOrThrow(i,o)});ni.mapResponseFromBedrock=D8r;var L8r=(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]};ni.getUrl=L8r;var F8r=(t,e,r,n,o,i)=>_re(void 0,void 0,void 0,function*(){let a=(0,O8r.fromNodeProviderChain)(),s=yield R8r(()=>{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 E8r.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:C8r.Sha256});delete r.connection,r.host=t.hostname;let l=new P8r.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});ni.getAuthHeaders=F8r;var k8r=(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}`)};ni.getEndpointFromUrl=k8r;var $8r=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}}};ni.parseAWSEvent=$8r;var B8r=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>_re(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,ni.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,ni.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,A8r.fetcher)(i);if(!p.ok)return p;try{if(c){let b=(0,I8r.readableStreamAsyncIterable)(p.body),g=new M8r.LineDecoder,y=new T8r.PassThrough;try{for(var m=x8r(b),h;h=yield m.next(),!h.done;){let S=h.value;for(let x of g.decode(S)){let O=(0,ni.parseAWSEvent)(x);if(O){let P=yield(0,ni.mapResponseFromBedrock)(c,u,O);y.push(JSON.stringify(P)+`
`)}}}}catch(S){a={error:S}}finally{try{h&&!h.done&&(s=m.return)&&(yield s.call(m))}finally{if(a)throw a.error}}for(let S of g.flush()){let x=(0,ni.parseAWSEvent)(S);if(x){let O=yield(0,ni.mapResponseFromBedrock)(c,u,x);y.push(JSON.stringify(O)+`
`)}}return y.end(),{ok:!0,body:y}}else{let b=yield p.body;return{ok:!0,body:yield(0,ni.mapResponseFromBedrock)(c,u,b)}}}catch(b){throw b}});ni.fetchOverride=B8r});var DO=v(vre=>{"use strict";Object.defineProperty(vre,"__esModule",{value:!0});vre.CohereEnvironment=void 0;vre.CohereEnvironment={Production:"https://api.cohere.com"}});var PA=v((XOt,wre)=>{(function(t,e,r){typeof wre<"u"&&wre.exports?wre.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",XOt,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 $Te=v($p=>{"use strict";var q8r=$p&&$p.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U8r=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HV=$p&&$p.__importStar||function(t){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 U8r(e,t),e},Sre=$p&&$p.__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())})},z8r=$p&&$p.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($p,"__esModule",{value:!0});$p.V2=void 0;var QOt=HV(DO()),Fp=HV(G()),ms=HV(iO()),kp=HV(NO()),ePt=z8r(PA()),LO=HV(As()),kTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Sre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,ePt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:QOt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 Fp.Stream({stream:i.body,parse:a=>Sre(this,void 0,void 0,function*(){return kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new LO.CohereTimeoutError;case"unknown":throw new LO.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Sre(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fp.fetcher)({url:(0,ePt.default)((o=yield Fp.Supplier.get(this._options.environment))!==null&&o!==void 0?o:QOt.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fp.Supplier.get(this._options.clientName))!=null?yield Fp.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":Fp.RUNTIME.type,"X-Fern-Runtime-Version":Fp.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},kp.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 kp.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 ms.BadRequestError(i.error.body);case 401:throw new ms.UnauthorizedError(i.error.body);case 403:throw new ms.ForbiddenError(i.error.body);case 404:throw new ms.NotFoundError(i.error.body);case 422:throw new ms.UnprocessableEntityError(kp.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new ms.TooManyRequestsError(kp.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new ms.ClientClosedRequestError(kp.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new ms.InternalServerError(i.error.body);case 501:throw new ms.NotImplementedError(kp.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new ms.ServiceUnavailableError(i.error.body);case 504:throw new ms.GatewayTimeoutError(kp.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new LO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new LO.CohereTimeoutError;case"unknown":throw new LO.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Sre(this,void 0,void 0,function*(){let r=(e=yield Fp.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new LO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};$p.V2=kTe});var tPt=v(Bp=>{"use strict";var H8r=Bp&&Bp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WV=Bp&&Bp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&H8r(e,t,r);return V8r(e,t),e},VV=Bp&&Bp.__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())})},W8r=Bp&&Bp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bp,"__esModule",{value:!0});Bp.EmbedJobs=void 0;var xre=WV(DO()),fa=WV(G()),Dr=WV(iO()),Cre=W8r(PA()),Aa=WV(NO()),Vc=WV(As()),BTe=class{constructor(e={}){this._options=e}list(e){var r,n;return VV(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:fa.fetcher)({url:(0,Cre.default)((n=yield fa.Supplier.get(this._options.environment))!==null&&n!==void 0?n:xre.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(o.error.body);case 401:throw new Dr.UnauthorizedError(o.error.body);case 403:throw new Dr.ForbiddenError(o.error.body);case 404:throw new Dr.NotFoundError(o.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(o.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(o.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Vc.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:o.error.errorMessage})}})}create(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.RUNTIME.version},contentType:"application/json",requestType:"json",body:Aa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Aa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}})}cancel(e,r){var n,o;return VV(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:fa.fetcher)({url:(0,Cre.default)((o=yield fa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:xre.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield fa.Supplier.get(this._options.clientName))!=null?yield fa.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":fa.RUNTIME.type,"X-Fern-Runtime-Version":fa.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 Dr.BadRequestError(i.error.body);case 401:throw new Dr.UnauthorizedError(i.error.body);case 403:throw new Dr.ForbiddenError(i.error.body);case 404:throw new Dr.NotFoundError(i.error.body);case 422:throw new Dr.UnprocessableEntityError(Aa.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Dr.TooManyRequestsError(Aa.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Dr.ClientClosedRequestError(Aa.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Dr.InternalServerError(i.error.body);case 501:throw new Dr.NotImplementedError(Aa.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Dr.ServiceUnavailableError(i.error.body);case 504:throw new Dr.GatewayTimeoutError(Aa.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Vc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Vc.CohereTimeoutError;case"unknown":throw new Vc.CohereError({message:i.error.errorMessage})}}})}_getAuthorizationHeader(){var e;return VV(this,void 0,void 0,function*(){let r=(e=yield fa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Vc.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Bp.EmbedJobs=BTe});var rPt=v(qp=>{"use strict";var K8r=qp&&qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G8r=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JV=qp&&qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K8r(e,t,r);return G8r(e,t),e},sB=qp&&qp.__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())})},J8r=qp&&qp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qp,"__esModule",{value:!0});qp.Datasets=void 0;var KV=JV(DO()),Oo=JV(G()),rr=JV(iO()),GV=J8r(PA()),fi=JV(NO()),Ns=JV(As()),qTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return sB(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:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(f.error.body);case 401:throw new rr.UnauthorizedError(f.error.body);case 403:throw new rr.ForbiddenError(f.error.body);case 404:throw new rr.NotFoundError(f.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(f.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(f.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(f.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.body})}switch(f.error.reason){case"non-json":throw new Ns.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:f.error.errorMessage})}})}create(e,r,n,o){var i,a;return sB(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 Oo.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:Oo.fetcher)({url:(0,GV.default)((a=yield Oo.Supplier.get(this._options.environment))!==null&&a!==void 0?a:KV.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(c.error.body);case 401:throw new rr.UnauthorizedError(c.error.body);case 403:throw new rr.ForbiddenError(c.error.body);case 404:throw new rr.NotFoundError(c.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(c.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(c.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new Ns.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:c.error.errorMessage})}})}getUsage(e){var r,n;return sB(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Oo.fetcher)({url:(0,GV.default)((n=yield Oo.Supplier.get(this._options.environment))!==null&&n!==void 0?n:KV.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(o.error.body);case 401:throw new rr.UnauthorizedError(o.error.body);case 403:throw new rr.ForbiddenError(o.error.body);case 404:throw new rr.NotFoundError(o.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(o.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(o.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new Ns.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:o.error.errorMessage})}})}get(e,r){var n,o;return sB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return sB(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Oo.fetcher)({url:(0,GV.default)((o=yield Oo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:KV.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Oo.Supplier.get(this._options.clientName))!=null?yield Oo.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":Oo.RUNTIME.type,"X-Fern-Runtime-Version":Oo.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 fi.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 rr.BadRequestError(i.error.body);case 401:throw new rr.UnauthorizedError(i.error.body);case 403:throw new rr.ForbiddenError(i.error.body);case 404:throw new rr.NotFoundError(i.error.body);case 422:throw new rr.UnprocessableEntityError(fi.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new rr.TooManyRequestsError(fi.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new rr.ClientClosedRequestError(fi.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new rr.InternalServerError(i.error.body);case 501:throw new rr.NotImplementedError(fi.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new rr.ServiceUnavailableError(i.error.body);case 504:throw new rr.GatewayTimeoutError(fi.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new Ns.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new Ns.CohereTimeoutError;case"unknown":throw new Ns.CohereError({message:i.error.errorMessage})}})}_getAuthorizationHeader(){var e;return sB(this,void 0,void 0,function*(){let r=(e=yield Oo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Ns.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};qp.Datasets=qTe});var nPt=v(Up=>{"use strict";var Y8r=Up&&Up.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YV=Up&&Up.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Y8r(e,t,r);return Z8r(e,t),e},Ij=Up&&Up.__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())})},X8r=Up&&Up.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Up,"__esModule",{value:!0});Up.Connectors=void 0;var uB=YV(DO()),An=YV(G()),Pt=YV(iO()),lB=X8r(PA()),On=YV(NO()),pa=YV(As()),UTe=class{constructor(e={}){this._options=e}list(e={},r){var n,o;return Ij(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:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}create(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}get(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}delete(e,r){var n,o;return Ij(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:An.fetcher)({url:(0,lB.default)((o=yield An.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(i.error.body);case 401:throw new Pt.UnauthorizedError(i.error.body);case 403:throw new Pt.ForbiddenError(i.error.body);case 404:throw new Pt.NotFoundError(i.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(i.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(i.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new pa.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:i.error.errorMessage})}})}update(e,r={},n){var o,i;return Ij(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:An.fetcher)({url:(0,lB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.RUNTIME.version},contentType:"application/json",requestType:"json",body:On.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 On.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 Pt.BadRequestError(a.error.body);case 401:throw new Pt.UnauthorizedError(a.error.body);case 403:throw new Pt.ForbiddenError(a.error.body);case 404:throw new Pt.NotFoundError(a.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(a.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(a.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(a.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new pa.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:a.error.errorMessage})}})}oAuthAuthorize(e,r={},n){var o,i;return Ij(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:An.fetcher)({url:(0,lB.default)((i=yield An.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uB.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}/oauth/authorize`),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield An.Supplier.get(this._options.clientName))!=null?yield An.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":An.RUNTIME.type,"X-Fern-Runtime-Version":An.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 On.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 Pt.BadRequestError(u.error.body);case 401:throw new Pt.UnauthorizedError(u.error.body);case 403:throw new Pt.ForbiddenError(u.error.body);case 404:throw new Pt.NotFoundError(u.error.body);case 422:throw new Pt.UnprocessableEntityError(On.UnprocessableEntityErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Pt.TooManyRequestsError(On.TooManyRequestsErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Pt.ClientClosedRequestError(On.ClientClosedRequestErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new Pt.InternalServerError(u.error.body);case 501:throw new Pt.NotImplementedError(On.NotImplementedErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new Pt.ServiceUnavailableError(u.error.body);case 504:throw new Pt.GatewayTimeoutError(On.GatewayTimeoutErrorBody.parseOrThrow(u.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.body})}switch(u.error.reason){case"non-json":throw new pa.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody});case"timeout":throw new pa.CohereTimeoutError;case"unknown":throw new pa.CohereError({message:u.error.errorMessage})}})}_getAuthorizationHeader(){var e;return Ij(this,void 0,void 0,function*(){let r=(e=yield An.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new pa.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Up.Connectors=UTe});var aPt=v(zp=>{"use strict";var Q8r=zp&&zp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=zp&&zp.__importStar||function(t){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 e6r(e,t),e},zTe=zp&&zp.__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())})},t6r=zp&&zp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zp,"__esModule",{value:!0});zp.Models=void 0;var oPt=ZV(DO()),Vm=ZV(G()),hs=ZV(iO()),iPt=t6r(PA()),cg=ZV(NO()),FO=ZV(As()),HTe=class{constructor(e={}){this._options=e}get(e,r){var n,o;return zTe(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vm.fetcher)({url:(0,iPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oPt.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(i.error.body);case 401:throw new hs.UnauthorizedError(i.error.body);case 403:throw new hs.ForbiddenError(i.error.body);case 404:throw new hs.NotFoundError(i.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(i.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(i.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new FO.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:i.error.errorMessage})}})}list(e={},r){var n,o;return zTe(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:Vm.fetcher)({url:(0,iPt.default)((o=yield Vm.Supplier.get(this._options.environment))!==null&&o!==void 0?o:oPt.CohereEnvironment.Production,"v1/models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vm.Supplier.get(this._options.clientName))!=null?yield Vm.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":Vm.RUNTIME.type,"X-Fern-Runtime-Version":Vm.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 cg.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 hs.BadRequestError(c.error.body);case 401:throw new hs.UnauthorizedError(c.error.body);case 403:throw new hs.ForbiddenError(c.error.body);case 404:throw new hs.NotFoundError(c.error.body);case 422:throw new hs.UnprocessableEntityError(cg.UnprocessableEntityErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new hs.TooManyRequestsError(cg.TooManyRequestsErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new hs.ClientClosedRequestError(cg.ClientClosedRequestErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 500:throw new hs.InternalServerError(c.error.body);case 501:throw new hs.NotImplementedError(cg.NotImplementedErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 503:throw new hs.ServiceUnavailableError(c.error.body);case 504:throw new hs.GatewayTimeoutError(cg.GatewayTimeoutErrorBody.parseOrThrow(c.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new FO.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new FO.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new FO.CohereTimeoutError;case"unknown":throw new FO.CohereError({message:c.error.errorMessage})}})}_getAuthorizationHeader(){var e;return zTe(this,void 0,void 0,function*(){let r=(e=yield Vm.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new FO.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};zp.Models=HTe});var sPt=v(Hp=>{"use strict";var r6r=Hp&&Hp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n6r=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XV=Hp&&Hp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&r6r(e,t,r);return n6r(e,t),e},EA=Hp&&Hp.__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())})},o6r=Hp&&Hp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hp,"__esModule",{value:!0});Hp.Finetuning=void 0;var Mj=XV(DO()),qr=XV(G()),Gr=XV(iO()),Rj=o6r(PA()),kO=XV(NO()),vi=XV(As()),VTe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){var n,o;return EA(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:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}createFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:kO.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}getFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}deleteFinetunedModel(e,r){var n,o;return EA(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qr.fetcher)({url:(0,Rj.default)((o=yield qr.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(i.error.body);case 401:throw new Gr.UnauthorizedError(i.error.body);case 403:throw new Gr.ForbiddenError(i.error.body);case 404:throw new Gr.NotFoundError(i.error.body);case 500:throw new Gr.InternalServerError(i.error.body);case 503:throw new Gr.ServiceUnavailableError(i.error.body);default:throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new vi.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:i.error.errorMessage})}})}updateFinetunedModel(e,r,n){var o,i;return EA(this,void 0,void 0,function*(){let a=yield((o=this._options.fetcher)!==null&&o!==void 0?o:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.RUNTIME.version},contentType:"application/json",requestType:"json",body:kO.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 kO.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 Gr.BadRequestError(a.error.body);case 401:throw new Gr.UnauthorizedError(a.error.body);case 403:throw new Gr.ForbiddenError(a.error.body);case 404:throw new Gr.NotFoundError(a.error.body);case 500:throw new Gr.InternalServerError(a.error.body);case 503:throw new Gr.ServiceUnavailableError(a.error.body);default:throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.body})}switch(a.error.reason){case"non-json":throw new vi.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:a.error.errorMessage})}})}listEvents(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/events`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(c.error.body);case 401:throw new Gr.UnauthorizedError(c.error.body);case 403:throw new Gr.ForbiddenError(c.error.body);case 404:throw new Gr.NotFoundError(c.error.body);case 500:throw new Gr.InternalServerError(c.error.body);case 503:throw new Gr.ServiceUnavailableError(c.error.body);default:throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.body})}switch(c.error.reason){case"non-json":throw new vi.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:c.error.errorMessage})}})}listTrainingStepMetrics(e,r={},n){var o,i;return EA(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:qr.fetcher)({url:(0,Rj.default)((i=yield qr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Mj.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}/training-step-metrics`),method:"GET",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qr.Supplier.get(this._options.clientName))!=null?yield qr.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":qr.RUNTIME.type,"X-Fern-Runtime-Version":qr.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 kO.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 Gr.BadRequestError(l.error.body);case 401:throw new Gr.UnauthorizedError(l.error.body);case 403:throw new Gr.ForbiddenError(l.error.body);case 404:throw new Gr.NotFoundError(l.error.body);case 500:throw new Gr.InternalServerError(l.error.body);case 503:throw new Gr.ServiceUnavailableError(l.error.body);default:throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.body})}switch(l.error.reason){case"non-json":throw new vi.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody});case"timeout":throw new vi.CohereTimeoutError;case"unknown":throw new vi.CohereError({message:l.error.errorMessage})}})}_getAuthorizationHeader(){var e;return EA(this,void 0,void 0,function*(){let r=(e=yield qr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new vi.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Hp.Finetuning=VTe});var Ore=v(Wp=>{"use strict";var i6r=Wp&&Wp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a6r=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QV=Wp&&Wp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&i6r(e,t,r);return a6r(e,t),e},Vp=Wp&&Wp.__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())})},s6r=Wp&&Wp.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Wp,"__esModule",{value:!0});Wp.CohereClient=void 0;var zy=QV(DO()),_t=QV(G()),Ee=QV(iO()),st=QV(NO()),Hy=s6r(PA()),jr=QV(As()),u6r=$Te(),l6r=tPt(),c6r=rPt(),d6r=nPt(),f6r=aPt(),p6r=sPt(),WTe=class{constructor(e={}){this._options=e}chatStream(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 _t.Stream({stream:i.body,parse:a=>Vp(this,void 0,void 0,function*(){return st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}chat(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}generateStream(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 _t.Stream({stream:i.body,parse:a=>Vp(this,void 0,void 0,function*(){return st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}generate(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}embed(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}rerank(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}classify(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}summarize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}tokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}detokenize(e,r){var n,o;return Vp(this,void 0,void 0,function*(){let i=yield((n=this._options.fetcher)!==null&&n!==void 0?n:_t.fetcher)({url:(0,Hy.default)((o=yield _t.Supplier.get(this._options.environment))!==null&&o!==void 0?o:zy.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.RUNTIME.version},contentType:"application/json",requestType:"json",body:st.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(i.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.body})}switch(i.error.reason){case"non-json":throw new jr.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:i.error.errorMessage})}})}checkApiKey(e){var r,n;return Vp(this,void 0,void 0,function*(){let o=yield((r=this._options.fetcher)!==null&&r!==void 0?r:_t.fetcher)({url:(0,Hy.default)((n=yield _t.Supplier.get(this._options.environment))!==null&&n!==void 0?n:zy.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:{Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield _t.Supplier.get(this._options.clientName))!=null?yield _t.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":_t.RUNTIME.type,"X-Fern-Runtime-Version":_t.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 st.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(st.UnprocessableEntityErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 429:throw new Ee.TooManyRequestsError(st.TooManyRequestsErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));case 499:throw new Ee.ClientClosedRequestError(st.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(st.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(st.GatewayTimeoutErrorBody.parseOrThrow(o.error.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}));default:throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.body})}switch(o.error.reason){case"non-json":throw new jr.CohereError({statusCode:o.error.statusCode,body:o.error.rawBody});case"timeout":throw new jr.CohereTimeoutError;case"unknown":throw new jr.CohereError({message:o.error.errorMessage})}})}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new u6r.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new l6r.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new c6r.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new d6r.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new f6r.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new p6r.Finetuning(this._options)}_getAuthorizationHeader(){var e;return Vp(this,void 0,void 0,function*(){let r=(e=yield _t.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new jr.CohereError({message:"Please specify CO_API_KEY when instantiating the client."});return`Bearer ${r}`})}};Wp.CohereClient=WTe});var GTe=v(Pre=>{"use strict";Object.defineProperty(Pre,"__esModule",{value:!0});Pre.AwsClient=void 0;var m6r=Ore(),KTe=class extends m6r.CohereClient{constructor(e){e.token="n/a",super(e)}};Pre.AwsClient=KTe});var uPt=v(Ere=>{"use strict";Object.defineProperty(Ere,"__esModule",{value:!0});Ere.BedrockClient=void 0;var h6r=FTe(),g6r=GTe(),JTe=class extends g6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,h6r.fetchOverride)("bedrock",e)}))}};Ere.BedrockClient=JTe});var lPt=v(Tre=>{"use strict";Object.defineProperty(Tre,"__esModule",{value:!0});Tre.CohereClientV2=void 0;var y6r=$Te(),b6r=Ore(),YTe=class{constructor(e){this._options=e,this.client=new b6r.CohereClient(this._options),this.clientV2=new y6r.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}};Tre.CohereClientV2=YTe});var cPt=v(Are=>{"use strict";Object.defineProperty(Are,"__esModule",{value:!0});Are.CustomClient=void 0;var _6r=Ore(),ZTe=class extends _6r.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}};Are.CustomClient=ZTe});var dPt=v(Ire=>{"use strict";Object.defineProperty(Ire,"__esModule",{value:!0});Ire.SagemakerClient=void 0;var v6r=GTe(),w6r=FTe(),XTe=class extends v6r.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,w6r.fetchOverride)("sagemaker",e)}))}};Ire.SagemakerClient=XTe});var e8=v(Ia=>{"use strict";var S6r=Ia&&Ia.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x6r=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C6r=Ia&&Ia.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&S6r(e,t,r);return x6r(e,t),e};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.SagemakerClient=Ia.CohereTimeoutError=Ia.CohereError=Ia.CohereEnvironment=Ia.CohereClient=Ia.CohereClientV2=Ia.BedrockClient=Ia.Cohere=void 0;Ia.Cohere=C6r(iO());var O6r=uPt();Object.defineProperty(Ia,"BedrockClient",{enumerable:!0,get:function(){return O6r.BedrockClient}});var P6r=lPt();Object.defineProperty(Ia,"CohereClientV2",{enumerable:!0,get:function(){return P6r.CohereClientV2}});var E6r=cPt();Object.defineProperty(Ia,"CohereClient",{enumerable:!0,get:function(){return E6r.CustomClient}});var T6r=DO();Object.defineProperty(Ia,"CohereEnvironment",{enumerable:!0,get:function(){return T6r.CohereEnvironment}});var fPt=As();Object.defineProperty(Ia,"CohereError",{enumerable:!0,get:function(){return fPt.CohereError}});Object.defineProperty(Ia,"CohereTimeoutError",{enumerable:!0,get:function(){return fPt.CohereTimeoutError}});var A6r=dPt();Object.defineProperty(Ia,"SagemakerClient",{enumerable:!0,get:function(){return A6r.SagemakerClient}})});var gs=w(()=>{OR()});function Wy(t){t?(tc[0]=tc[16]=tc[1]=tc[2]=tc[3]=tc[4]=tc[5]=tc[6]=tc[7]=tc[8]=tc[9]=tc[10]=tc[11]=tc[12]=tc[13]=tc[14]=tc[15]=0,this.blocks=tc):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 I6r,pn,M6r,Vy,tc,QTe,pPt=w(()=>{"use strict";I6r=typeof window=="object"?window:{},pn="0123456789abcdef".split(""),M6r=[-2147483648,8388608,32768,128],Vy=[24,16,8,0],tc=[];Wy.prototype.update=function(t){if(!this.finalized){var e=typeof t!="string";e&&t.constructor===I6r.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]<<Vy[o++&3];else for(o=this.start;n<i&&o<64;++n)r=t.charCodeAt(n),r<128?a[o>>2]|=r<<Vy[o++&3]:r<2048?(a[o>>2]|=(192|r>>6)<<Vy[o++&3],a[o>>2]|=(128|r&63)<<Vy[o++&3]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<Vy[o++&3],a[o>>2]|=(128|r>>6&63)<<Vy[o++&3],a[o>>2]|=(128|r&63)<<Vy[o++&3]):(r=65536+((r&1023)<<10|t.charCodeAt(++n)&1023),a[o>>2]|=(240|r>>18)<<Vy[o++&3],a[o>>2]|=(128|r>>12&63)<<Vy[o++&3],a[o>>2]|=(128|r>>6&63)<<Vy[o++&3],a[o>>2]|=(128|r&63)<<Vy[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}};Wy.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=M6r[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()}};Wy.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};Wy.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4;return pn[t>>28&15]+pn[t>>24&15]+pn[t>>20&15]+pn[t>>16&15]+pn[t>>12&15]+pn[t>>8&15]+pn[t>>4&15]+pn[t&15]+pn[e>>28&15]+pn[e>>24&15]+pn[e>>20&15]+pn[e>>16&15]+pn[e>>12&15]+pn[e>>8&15]+pn[e>>4&15]+pn[e&15]+pn[r>>28&15]+pn[r>>24&15]+pn[r>>20&15]+pn[r>>16&15]+pn[r>>12&15]+pn[r>>8&15]+pn[r>>4&15]+pn[r&15]+pn[n>>28&15]+pn[n>>24&15]+pn[n>>20&15]+pn[n>>16&15]+pn[n>>12&15]+pn[n>>8&15]+pn[n>>4&15]+pn[n&15]+pn[o>>28&15]+pn[o>>24&15]+pn[o>>20&15]+pn[o>>16&15]+pn[o>>12&15]+pn[o>>8&15]+pn[o>>4&15]+pn[o&15]};Wy.prototype.toString=Wy.prototype.hex;Wy.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]};Wy.prototype.array=Wy.prototype.digest;Wy.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};QTe=t=>new Wy(!0).update(t).hex()});var mPt=w(()=>{pPt()});var hPt,eAe,R6r,Mre,gPt=w(()=>{mPt();NE();hPt=(...t)=>QTe(t.join("_")),eAe=class{},R6r=new Map,Mre=class t extends eAe{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(hPt(e,r))??null)}async update(e,r,n){this.cache.set(hPt(e,r),n)}static global(){return new t(R6r)}}});function L6r(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 F6r(t,e){return t.length===1?[e.get(t.join(","))]:L6r(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function k6r(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function rAe(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 yPt,j6r,N6r,D6r,tAe,Rre,bPt=w(()=>{yPt=F(sge(),1),j6r=Object.defineProperty,N6r=(t,e,r)=>e in t?j6r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6r=(t,e,r)=>(N6r(t,typeof e!="symbol"?e+"":e,r),r);tAe=class{constructor(t,e){Cc(this,"specialTokens");Cc(this,"inverseSpecialTokens");Cc(this,"patStr");Cc(this,"textEncoder",new TextEncoder);Cc(this,"textDecoder",new TextDecoder("utf-8"));Cc(this,"rankMap",new Map);Cc(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=yPt.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=tAe.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=tAe.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(...F6r(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)}},Rre=tAe;D6r(Rre,"specialTokenRegex",t=>new RegExp(t.map(e=>k6r(e)).join("|"),"g"))});var _Pt=w(()=>{bPt()});async function vPt(t){return t in jre||(jre[t]=$6r.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new Rre(e)).catch(e=>{throw delete jre[t],e})),await jre[t]}async function wPt(t){return vPt(rAe(t))}var jre,$6r,nAe=w(()=>{_Pt();XL();jre={},$6r=new _m({})});function Wc(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 B6r,q6r,cB,dB,t8=w(()=>{gPt();W2();NE();XL();nAe();Df();B6r=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;q6r=()=>!1,cB=class extends xn{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??q6r(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}},dB=class extends cB{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=Mre.global():this.cache=void 0,this.caller=new _m(n??{})}async getNumTokens(e){if(typeof e!="string")return 0;let r=Math.ceil(e.length/4);if(!this._encoding)try{this._encoding=await wPt("modelName"in this?B6r(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(e).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new tF(e):Array.isArray(e)?new rF(e.map(fy)):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 Wm=w(()=>{t8()});function Gs(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return e._def||Object.values(Wr.ZodFirstPartyTypeKind).includes(e.constructor?.name??"NOT_INCLUDED")?!0:typeof e.parse=="function"&&typeof e.parseAsync=="function"&&typeof e.safeParse=="function"&&typeof e.safeParseAsync=="function"}var fB=w(()=>{Td()});function oAe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function iAe(t){return t!==void 0&&xn.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function aAe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Gs(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 rc(t){return aAe(t)||iAe(t)||oAe(t)}var Nre=w(()=>{Df();fB()});function SPt(t){return Gs(t)?So(t):t}function r8(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=>r8(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=>r8(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=RC(t);return r[e]?r8(r[e]):!1}return!1}var sAe=w(()=>{Ec();H2();fB();H2()});function TA(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:SPt(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function dx(t,e){let r=typeof e=="number"?void 0:e,n;return rc(t)?n={type:"function",function:TA(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var xPt=w(()=>{Nre();sAe();Nre()});var Km=w(()=>{xPt()});function uAe(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];(q4e(i)||U4e(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),z4e(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var Js,CPt=w(()=>{Ec();OR();ZL();t8();LE();Df();Wb();BG();fB();T2();Js=class t extends dB{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 Bs.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(),[uAe(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,lme(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(fy)),a;if(o!==void 0&&o.length===i.length)a=o;else{let d={...n.metadata,...this.getLsParams(r)},f=await Bs.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(uAe),n.runId,void 0,p,void 0,void 0,n.runName)}let s=[],u=[];if(!!a?.[0].handlers.find(tme)&&!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=Hl(f,m),lme(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,k2,{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(fy)),s={...i.metadata,...this.getLsParams(o)},u=await Bs.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(uAe),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(),S=await r.lookup(y,n);return S==null&&d.push(g),S}))).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 S=b.value;return m[y]=S.map(x=>("message"in x&&Ph(x.message)&&Oi(x.message)&&(x.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0}),x.generationInfo={...x.generationInfo,tokenUsage:{}},x)),S.length&&await g?.handleLLMNewToken(S[0].text),g?.handleLLMEnd({generations:[S]},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,k2,{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(fy)),[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(fy)],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 Os(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=n.description??"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;Gs(n)?l=[{type:"function",function:{name:u,description:i,parameters:So(n)}}]:("name"in n&&(u=n.name),l=[{type:"function",function:{name:u,description:i,parameters:n}}]);let c=this.bindTools(l),d=Nf.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=go.assign({parsed:(h,b)=>d.invoke(h.raw,b)}),p=go.assign({parsed:()=>null}),m=f.withFallbacks({fallbacks:[p]});return bi.from([{raw:c},m]).withConfig({runName:"StructuredOutputRunnable"})}}});var fx=w(()=>{CPt()});var Qd=w(()=>{ZL()});var Dn=w(()=>{bR()});function OPt(t,e=0){return(Kc[t[e+0]]+Kc[t[e+1]]+Kc[t[e+2]]+Kc[t[e+3]]+"-"+Kc[t[e+4]]+Kc[t[e+5]]+"-"+Kc[t[e+6]]+Kc[t[e+7]]+"-"+Kc[t[e+8]]+Kc[t[e+9]]+"-"+Kc[t[e+10]]+Kc[t[e+11]]+Kc[t[e+12]]+Kc[t[e+13]]+Kc[t[e+14]]+Kc[t[e+15]]).toLowerCase()}var Kc,Dre,PPt=w(()=>{Kc=[];for(Dre=0;Dre<256;++Dre)Kc.push((Dre+256).toString(16).slice(1))});function lAe(){if(!Lre&&(Lre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Lre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Lre(U6r)}var Lre,U6r,EPt=w(()=>{U6r=new Uint8Array(16)});var z6r,cAe,TPt=w(()=>{z6r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),cAe={randomUUID:z6r}});function H6r(t,e,r){if(cAe.randomUUID&&!e&&!t)return cAe.randomUUID();t=t||{};var n=t.random||(t.rng||lAe)();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 OPt(n)}var dAe,APt=w(()=>{TPt();EPt();PPt();dAe=H6r});var IPt=w(()=>{APt()});function MPt(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 Fre(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=>Oi(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 W6r(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function RPt(t){return t._getType()==="tool"}function jPt(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 K6r(t){if(t){if(t.every(W6r))return t;if(t.every(Wc))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:jPt(e.function.parameters)}));if(t.every(rc))return t.map(e=>{let r=So(e.schema);return{name:e.name,description:e.description??"",parameterDefinitions:jPt(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var NPt,kre,DPt=w(()=>{NPt=F(e8(),1);Ec();gs();Wm();Km();fx();Qd();gs();Dn();IPt();kre=class extends Js{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??ot("COHERE_API_KEY");if(!r)throw new Error("No API key provided for ChatCohere.");this.client=new NPt.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:K6r(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(!(Oi(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=Fre(c,s);i.push(d),s=[]}}else i.push(Fre(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=Fre(c,s);i.push(d),s=[]}}else i.push(Fre(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(RPt(o)){let i=o,a=n.filter(s=>Oi(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:MPt(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!RPt(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Oi(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:MPt(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:dAe().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 gn({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 qn({text:a.text,message:new dr({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new qn({text:"",message:new dr({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 qn({text:"",message:new dr({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 LPt=w(()=>{OR();ZL();LE();t8();Wb();T2()});var jj=w(()=>{LPt()});var G6r,kPt=w(()=>{G6r=F(e8(),1);Dn();jj()});var Jf,$Pt=w(()=>{XL();Jf=class{constructor(e){Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.caller=new _m(e??{})}}});var $O=w(()=>{$Pt()});var Yf,BPt=w(()=>{Yf=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var dg=w(()=>{BPt()});var qPt,$re,UPt=w(()=>{qPt=F(e8(),1);Dn();$O();dg();$re=class extends Jf{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||ot("COHERE_API_KEY");if(!n)throw new Error("Cohere API key not found");if(this.client=new qPt.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=Yf(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 zPt=w(()=>{});var HPt=w(()=>{zPt()});var J6r,VPt=w(()=>{HPt();Dn();J6r=F(e8(),1)});var WPt=w(()=>{DPt();kPt();UPt();VPt()});var fAe=w(()=>{WPt()});function e5r(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${Q6r}/${X6r}`),e.join(" ")}async function t5r(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",e5r(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 px(`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 px(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new px(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function r5r(t,e,r,n,o,i){let a=new pAe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},a5r(i)),{method:"POST",headers:await t5r(a),body:o})}}async function a8(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await r5r(t,e,r,n,o,i);return n5r(s,u,a)}async function n5r(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){o5r(o,t)}return n.ok||await i5r(n,t),n}function o5r(t,e){let r=t;throw t instanceof qre||t instanceof px||(r=new ef(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function i5r(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 qre(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function a5r(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 hAe(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return s5r(t)}else if(t.promptFeedback)throw new AA(`Text not available. ${IA(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),tEt(t)[0]}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(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.`),Bre(t.candidates[0]))throw new AA(`${IA(t)}`,t);return tEt(t)}else if(t.promptFeedback)throw new AA(`Function call not available. ${IA(t)}`,t)},t}function s5r(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 tEt(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 Bre(t){return!!t.finishReason&&u5r.includes(t.finishReason)}function IA(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];Bre(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function o8(t){return this instanceof o8?(this.v=t,this):new o8(t)}function l5r(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 o8?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 c5r(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=p5r(e),[n,o]=r.tee();return{stream:f5r(n),response:d5r(o)}}async function d5r(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return hAe(m5r(e));e.push(o)}}function f5r(t){return l5r(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield o8(r.read());if(o)break;yield yield o8(hAe(n))}})}function p5r(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 ef("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(rEt),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new ef(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(rEt)}return i()})}}})}function m5r(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 aEt(t,e,r,n){let o=await a8(e,Fj.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return c5r(o)}async function sEt(t,e,r,n){let i=await(await a8(e,Fj.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:hAe(i)}}function uEt(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 i8(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 h5r(e)}function h5r(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 ef("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 ef("No content is provided for sending chat message.");return n?e:r}function g5r(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 px("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=i8(t);n.contents=[i]}return{generateContentRequest:n}}function nEt(t){let e;return t.contents?e=t:e={contents:[i8(t)]},t.systemInstruction&&(e.systemInstruction=uEt(t.systemInstruction)),e}function y5r(t){return typeof t=="string"||Array.isArray(t)?{content:i8(t)}:t}function _5r(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new ef(`First content should be with role 'user', got ${n}`);if(!YPt.includes(n))throw new ef(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(YPt)}`);if(!Array.isArray(o))throw new ef("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new ef("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 oEt)u in s&&(i[u]+=1);let a=b5r[n];for(let s of oEt)if(!a.includes(s)&&i[s]>0)throw new ef(`Content with role '${n}' can't contain '${s}' part`);e=!0}}async function v5r(t,e,r,n){return(await a8(e,Fj.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function w5r(t,e,r,n){return(await a8(e,Fj.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function S5r(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await a8(e,Fj.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var KPt,GPt,JPt,YPt,Nj,Dj,ZPt,XPt,n8,QPt,Lj,eEt,ef,AA,qre,px,Y6r,Z6r,X6r,Q6r,Fj,pAe,u5r,rEt,oEt,b5r,iEt,mAe,Ure,kj,s8=w(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(KPt||(KPt={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(GPt||(GPt={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(JPt||(JPt={}));YPt=["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"})(Nj||(Nj={}));(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"})(Dj||(Dj={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(ZPt||(ZPt={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(XPt||(XPt={}));(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"})(n8||(n8={}));(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"})(QPt||(QPt={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Lj||(Lj={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(eEt||(eEt={}));ef=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},AA=class extends ef{constructor(e,r){super(e),this.response=r}},qre=class extends ef{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},px=class extends ef{};Y6r="https://generativelanguage.googleapis.com",Z6r="v1beta",X6r="0.21.0",Q6r="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"})(Fj||(Fj={}));pAe=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)||Z6r,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||Y6r}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};u5r=[n8.RECITATION,n8.SAFETY,n8.LANGUAGE];rEt=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;oEt=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],b5r={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};iEt="SILENT_ERROR",mAe=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&&(_5r(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=i8(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(()=>sEt(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=IA(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=i8(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=aEt(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(iEt)}).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=IA(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==iEt&&console.error(p)}),f}};Ure=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=uEt(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=nEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return sEt(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=nEt(e),i=Object.assign(Object.assign({},this._requestOptions),r);return aEt(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 mAe(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=g5r(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 v5r(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=y5r(e),o=Object.assign(Object.assign({},this._requestOptions),r);return w5r(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return S5r(this.apiKey,this.model,e,n)}};kj=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new ef("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new Ure(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new px("Cached content must contain a `name` field.");if(!e.model)throw new px("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 px(`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 Ure(this.apiKey,i,n)}}});var lEt=w(()=>{fB()});var pB=w(()=>{lEt()});function mB(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(mB):typeof e[r]=="object"&&e[r]!==null&&(e[r]=mB(e[r])));return e}return t}function zre(t){let e=mB(So(t)),{$schema:r,...n}=e;return n}function cEt(t){let e=mB(t),{$schema:r,...n}=e;return n}var Hre=w(()=>{Ec()});function x5r(t){let e=t._getType();return Cs.isInstance(t)?t.role:e==="tool"?e:t.name??e}function C5r(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 O5r(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};throw new Error("Invalid media content")}function P5r(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 O5r(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 gAe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Ph(o))throw new Error("Unsupported message input");let a=x5r(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=C5r(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=P5r(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 dEt(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 gn({content:a,tool_calls:r?.map(l=>({...l,type:"tool_call"})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}]}}function fEt(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 qn({text:s,message:new dr({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},usage_metadata:e.usageMetadata}),generationInfo:i})}function pEt(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(rc(e)){let r=zre(e.schema);return{name:e.name,description:e.description,parameters:r}}return Wc(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:cEt(e.function.parameters)}:e})}]}var yAe=w(()=>{gs();Qd();Km();Wm();Hre()});var u8,mEt=w(()=>{gy();u8=class extends PR{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 vm(`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 bAe(t,e){let r=E5r(t),n=A5r(r,e);return{tools:r,toolConfig:n}}function E5r(t){let e=[],r=[];return t.forEach(o=>{if(rc(o)){let[i]=pEt([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Wc(o)){let{functionDeclarations:i}=T5r(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 T5r(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:mB(t.function.parameters)}]}}function A5r(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:Lj.ANY,auto:Lj.AUTO,none:Lj.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:Lj.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var hEt=w(()=>{s8();Km();Wm();yAe();Hre()});var Vre,gEt=w(()=>{s8();Dn();fx();Sm();pB();Hre();yAe();mEt();hEt();Vre=class extends Js{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??ot("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 kj(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 kj(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:bAe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?bAe(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=gAe(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=dEt(s.response,{usageMetadata:u});return await n?.handleLLMNewToken(l.generations[0].text??""),l}async*_streamResponseChunks(e,r,n){let o=gAe(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=fEt(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(Gs(n)){let m=zre(n);l=[{functionDeclarations:[{name:s,description:m.description??"A function available to call.",parameters:m}]}],u=new u8({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 u8({returnSingle:!0,keyName:s})}let c=this.bind({tools:l,tool_choice:s});if(!a)return c.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let d=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}}});var Wre,yEt=w(()=>{s8();Dn();$O();dg();Wre=class extends Jf{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??ot("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 kj(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=Yf(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 bEt=w(()=>{gEt();yEt()});var _Ae=w(()=>{bEt()});function I5r(t){return t&&DataView.prototype.isPrototypeOf(t)}function hB(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 wAe(t){return typeof t!="string"&&(t=String(t)),t}function SAe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return Zf.iterable&&(e[Symbol.iterator]=function(){return e}),e}function jl(t){this.map={},t instanceof jl?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 vAe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function SEt(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function M5r(t){var e=new FileReader,r=SEt(e);return e.readAsArrayBuffer(t),r}function R5r(t){var e=new FileReader,r=SEt(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function j5r(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 vEt(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function xEt(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:Zf.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:Zf.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:Zf.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():Zf.arrayBuffer&&Zf.blob&&I5r(t)?(this._bodyArrayBuffer=vEt(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):Zf.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||wEt(t))?this._bodyArrayBuffer=vEt(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):Zf.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},Zf.blob&&(this.blob=function(){var t=vAe(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=vAe(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(Zf.blob)return this.blob().then(M5r);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=vAe(this);if(t)return t;if(this._bodyBlob)return R5r(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(j5r(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},Zf.formData&&(this.formData=function(){return this.text().then(L5r)}),this.json=function(){return this.text().then(JSON.parse)},this}function D5r(t){var e=t.toUpperCase();return N5r.indexOf(e)>-1?e:t}function Bj(t,e){if(!(this instanceof Bj))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 Bj){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new jl(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 jl(e.headers)),this.method=D5r(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Gc){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 L5r(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 F5r(t){var e=new jl,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 mx(t,e){if(!(this instanceof mx))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 jl(e.headers),this.url=e.url||"",this._initBody(t)}function CEt(t,e){return new Promise(function(r,n){var o=new Bj(t,e);if(o.signal&&o.signal.aborted)return n(new $j("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:F5r(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 mx(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 $j("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Gc.location.href?Gc.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&&(Zf.blob?i.responseType="blob":Zf.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof jl||Gc.Headers&&e.headers instanceof Gc.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(hB(l)),i.setRequestHeader(l,wAe(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 Gc,Zf,_Et,wEt,N5r,k5r,$j,OEt=w(()=>{Gc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},Zf={searchParams:"URLSearchParams"in Gc,iterable:"Symbol"in Gc&&"iterator"in Symbol,blob:"FileReader"in Gc&&"Blob"in Gc&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Gc,arrayBuffer:"ArrayBuffer"in Gc};Zf.arrayBuffer&&(_Et=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],wEt=ArrayBuffer.isView||function(t){return t&&_Et.indexOf(Object.prototype.toString.call(t))>-1});jl.prototype.append=function(t,e){t=hB(t),e=wAe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};jl.prototype.delete=function(t){delete this.map[hB(t)]};jl.prototype.get=function(t){return t=hB(t),this.has(t)?this.map[t]:null};jl.prototype.has=function(t){return this.map.hasOwnProperty(hB(t))};jl.prototype.set=function(t,e){this.map[hB(t)]=wAe(e)};jl.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};jl.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),SAe(t)};jl.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),SAe(t)};jl.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),SAe(t)};Zf.iterable&&(jl.prototype[Symbol.iterator]=jl.prototype.entries);N5r=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];Bj.prototype.clone=function(){return new Bj(this,{body:this._bodyInit})};xEt.call(Bj.prototype);xEt.call(mx.prototype);mx.prototype.clone=function(){return new mx(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new jl(this.headers),url:this.url})};mx.error=function(){var t=new mx(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};k5r=[301,302,303,307,308];mx.redirect=function(t,e){if(k5r.indexOf(e)===-1)throw new RangeError("Invalid status code");return new mx(null,{status:e,headers:{location:t}})};$j=Gc.DOMException;try{new $j}catch{$j=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},$j.prototype=Object.create(Error.prototype),$j.prototype.constructor=$j}CEt.polyfill=!0;Gc.fetch||(Gc.fetch=CEt,Gc.Headers=jl,Gc.Request=Bj,Gc.Response=mx)});function U5r(){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 z5r(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 $5r,EEt,TEt,B5r,q5r,xAe,OAe,PAe,EAe,TAe,PEt,gB,H5r,V5r,W5r,K5r,G5r,CAe,yB,AAo,Kre=w(()=>{OEt();$5r="0.5.14",EEt="11434",TEt=`http://127.0.0.1:${EEt}`,B5r=Object.defineProperty,q5r=(t,e,r)=>e in t?B5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xAe=(t,e,r)=>(q5r(t,typeof e!="symbol"?e+"":e,r),r),OAe=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)}},PAe=class{constructor(e,r,n){xAe(this,"abortController"),xAe(this,"itr"),xAe(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.")}},EAe=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 OAe(e,t.status)};TAe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${$5r} (${U5r()})`};r.headers=z5r(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)},PEt=async(t,e,r)=>{let n=await TAe(t,e,{headers:r?.headers});return await EAe(n),n},gB=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await TAe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await EAe(a),a},H5r=async(t,e,r,n)=>{let o=await TAe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await EAe(o),o},V5r=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)}},W5r=t=>{if(!t)return TEt;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=EEt);let o=`${r.protocol}//${r.hostname}:${n}${r.pathname}`;return o.endsWith("/")&&(o=o.slice(0,-1)),o},K5r=Object.defineProperty,G5r=(t,e,r)=>e in t?K5r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,CAe=(t,e,r)=>(G5r(t,typeof e!="symbol"?e+"":e,r),r),yB=class{constructor(e){CAe(this,"config"),CAe(this,"fetch"),CAe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=W5r(e?.host??TEt)),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 gB(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=V5r(a.body),u=new PAe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await gB(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 H5r(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await gB(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await PEt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await gB(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await gB(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await gB(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await PEt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},AAo=new yB});var AEt=w(()=>{Wb()});function IEt(t,e=0){return(Jc[t[e+0]]+Jc[t[e+1]]+Jc[t[e+2]]+Jc[t[e+3]]+"-"+Jc[t[e+4]]+Jc[t[e+5]]+"-"+Jc[t[e+6]]+Jc[t[e+7]]+"-"+Jc[t[e+8]]+Jc[t[e+9]]+"-"+Jc[t[e+10]]+Jc[t[e+11]]+Jc[t[e+12]]+Jc[t[e+13]]+Jc[t[e+14]]+Jc[t[e+15]]).toLowerCase()}var Jc,Gre,MEt=w(()=>{Jc=[];for(Gre=0;Gre<256;++Gre)Jc.push((Gre+256).toString(16).slice(1))});function AAe(){if(!Jre&&(Jre=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jre))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jre(J5r)}var Jre,J5r,REt=w(()=>{J5r=new Uint8Array(16)});var Y5r,IAe,jEt=w(()=>{Y5r=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),IAe={randomUUID:Y5r}});function Z5r(t,e,r){if(IAe.randomUUID&&!e&&!t)return IAe.randomUUID();t=t||{};var n=t.random||(t.rng||AAe)();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 IEt(n)}var MAe,NEt=w(()=>{jEt();REt();MEt();MAe=Z5r});var DEt=w(()=>{NEt()});function RAe(t,e){return new dr({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:MAe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function LEt(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function X5r(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 Q5r(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:[LEt(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[LEt(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function eWr(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 tWr(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function FEt(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Q5r(e);if(e._getType()==="ai")return X5r(e);if(e._getType()==="system")return eWr(e);if(e._getType()==="tool")return tWr(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var kEt=w(()=>{gs();DEt()});var Yre,$Et=w(()=>{gs();fx();Kre();Qd();gs();Sm();Km();AEt();gy();pB();Ec();kEt();Yre=class extends Js{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 yB({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=>dx(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=>dx(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=Hl(o,a.message):o=a.message;let i=new gn({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=FEt(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 qn({text:c.content,message:RAe(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 qn({text:c.content??"",message:RAe(c)}),await n?.handleLLMNewToken(c.content??"")}yield new qn({text:"",message:new dr({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Gs(e),o=n?So(e):e,i=this.bind({format:o}),a=n?Tc.fromZodSchema(e):new Ac;if(!r?.includeRaw)return i.pipe(a);let s=go.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=go.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return bi.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var Zre,BEt=w(()=>{$O();Kre();Zre=class extends Jf{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 yB({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 qEt=w(()=>{});var UEt=w(()=>{Qd();jj();Kre()});var zEt=w(()=>{$Et();BEt();qEt();UEt()});var jAe=w(()=>{zEt()});var Xre,Qre,HEt,NAe=w(()=>{Xre="RFC3986",Qre={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},HEt="RFC1738"});function WEt(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function LAe(t,e){if(rWr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var rWr,hx,DAe,VEt,KEt=w(()=>{NAe();rWr=Array.isArray,hx=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),DAe=1024,VEt=(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+=DAe){let u=i.length>=DAe?i.slice(s,s+DAe):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===HEt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=hx[d];continue}if(d<2048){l[l.length]=hx[192|d>>6]+hx[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=hx[224|d>>12]+hx[128|d>>6&63]+hx[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=hx[240|d>>18]+hx[128|d>>12&63]+hx[128|d>>6&63]+hx[128|d&63]}a+=l.join("")}return a}});function aWr(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function YEt(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,b,g){let y=t,S=g,x=0,O=!1;for(;(S=S.get(FAe))!==void 0&&!O;){let R=S.get(t);if(x+=1,typeof R<"u"){if(R===x)throw new RangeError("Cyclic object value");O=!0}typeof S.get(FAe)>"u"&&(x=0)}if(typeof l=="function"?y=l(e,y):y instanceof Date?y=f?.(y):r==="comma"&&gx(y)&&(y=LAe(y,function(R){return R instanceof Date?f?.(R):R})),y===null){if(i)return u&&!h?u(e,Nl.encoder,b,"key",p):e;y=""}if(aWr(y)||WEt(y)){if(u){let R=h?e:u(e,Nl.encoder,b,"key",p);return[m?.(R)+"="+m?.(u(y,Nl.encoder,b,"value",p))]}return[m?.(e)+"="+m?.(String(y))]}let P=[];if(typeof y>"u")return P;let E;if(r==="comma"&&gx(y))h&&u&&(y=LAe(y,u)),E=[{value:y.length>0?y.join(",")||null:void 0}];else if(gx(l))E=l;else{let R=Object.keys(y);E=c?R.sort(c):R}let A=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&gx(y)&&y.length===1?A+"[]":A;if(o&&gx(y)&&y.length===0)return I+"[]";for(let R=0;R<E.length;++R){let N=E[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=gx(y)?typeof r=="function"?r(I,$):I:I+(d?"."+$:"["+$+"]");g.set(t,x);let z=new WeakMap;z.set(FAe,g),JEt(P,YEt(j,k,r,n,o,i,a,s,r==="comma"&&h&&gx(y)?null:u,l,c,d,f,p,m,h,b,z))}return P}function sWr(t=Nl){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||Nl.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=Xre;if(typeof t.format<"u"){if(!nWr.call(Qre,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=Qre[r],o=Nl.filter;(typeof t.filter=="function"||gx(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in GEt?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Nl.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:Nl.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Nl.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Nl.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Nl.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Nl.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Nl.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Nl.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Nl.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Nl.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Nl.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Nl.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Nl.strictNullHandling}}function kAe(t,e={}){let r=t,n=sWr(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):gx(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=GEt[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||JEt(a,YEt(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 nWr,GEt,gx,oWr,JEt,iWr,Nl,FAe,ZEt=w(()=>{KEt();NAe();nWr=Object.prototype.hasOwnProperty,GEt={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},gx=Array.isArray,oWr=Array.prototype.push,JEt=function(t,e){oWr.apply(t,gx(e)?e:[e])},iWr=Date.prototype.toISOString,Nl={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:VEt,encodeValuesOnly:!1,format:Xre,formatter:Qre[Xre],indices:!1,serializeDate(t){return iWr.call(t)},skipNulls:!1,strictNullHandling:!1};FAe={}});var XEt=w(()=>{ZEt()});var qj,QEt=w(()=>{qj="4.95.1"});function tTt(t,e={auto:!1}){if(eTt)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(Uj)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${Uj}'\``);eTt=e.auto,Uj=t.kind,$Ae=t.fetch,lWr=t.Request,cWr=t.Response,dWr=t.Headers,BAe=t.FormData,fWr=t.Blob,ene=t.File,qAe=t.ReadableStream,UAe=t.getMultipartRequestOptions,zAe=t.getDefaultAgent,tne=t.fileFromPath,HAe=t.isFsReadStream}var eTt,Uj,$Ae,lWr,cWr,dWr,BAe,fWr,ene,qAe,UAe,zAe,tne,HAe,VAe=w(()=>{eTt=!1});var rne,rTt=w(()=>{rne=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function nTt({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 rne(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 oTt=w(()=>{rTt()});var iTt=w(()=>{oTt()});var WAe,l8=w(()=>{VAe();iTt();VAe();WAe=()=>{Uj||tTt(nTt(),{auto:!0})};WAe()});var vt,Ys,Li,BO,Xf,bB,_B,vB,wB,SB,xB,CB,OB,PB,EB,Kp=w(()=>{Vn();vt=class extends Error{},Ys=class t extends vt{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 BO({message:n,cause:nne(r)});let i=r?.error;return e===400?new bB(e,i,n,o):e===401?new _B(e,i,n,o):e===403?new vB(e,i,n,o):e===404?new wB(e,i,n,o):e===409?new SB(e,i,n,o):e===422?new xB(e,i,n,o):e===429?new CB(e,i,n,o):e>=500?new OB(e,i,n,o):new t(e,i,n,o)}},Li=class extends Ys{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},BO=class extends Ys{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Xf=class extends BO{constructor({message:e}={}){super({message:e??"Request timed out."})}},bB=class extends Ys{},_B=class extends Ys{},vB=class extends Ys{},wB=class extends Ys{},SB=class extends Ys{},xB=class extends Ys{},CB=class extends Ys{},OB=class extends Ys{},PB=class extends vt{constructor(){super("Could not parse response content as the length limit was reached")}},EB=class extends vt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function gWr(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 aTt(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 one,zj,Gm,Hj,sTt=w(()=>{Kp();one=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},zj=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)},Hj=class{constructor(){Gm.set(this,void 0),this.buffer=new Uint8Array,one(this,Gm,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=gWr(this.buffer,zj(this,Gm,"f")))!=null;){if(i.carriage&&zj(this,Gm,"f")==null){one(this,Gm,i.index,"f");continue}if(zj(this,Gm,"f")!=null&&(i.index!==zj(this,Gm,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,zj(this,Gm,"f")-1))),this.buffer=this.buffer.slice(zj(this,Gm,"f")),one(this,Gm,null,"f");continue}let a=zj(this,Gm,"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),one(this,Gm,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 vt(`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 vt(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new vt("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};Gm=new WeakMap;Hj.NEWLINE_CHARS=new Set([`
`,"\r"]);Hj.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function KAe(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 uTt=w(()=>{});async function*yWr(t,e){if(!t.body)throw e.abort(),new vt("Attempted to iterate over a response with no body");let r=new GAe,n=new Hj,o=KAe(t.body);for await(let i of bWr(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*bWr(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=aTt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function _Wr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var yx,GAe,ine=w(()=>{l8();Kp();sTt();uTt();Vn();Kp();yx=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 yWr(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 Ys(void 0,s.error,void 0,JAe(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 Ys(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 Hj,s=KAe(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 qAe({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?.()}})}};GAe=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]=_Wr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function XAe(t,e,r){if(t=await t,cTt(t))return t;if(lTt(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=c8(o)?[await o.arrayBuffer()]:[o];return new ene(i,e,r)}let n=await wWr(t);if(e||(e=xWr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new ene(n,e,r)}async function wWr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(c8(t))e.push(await t.arrayBuffer());else if(CWr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${SWr(t)}`);return e}function SWr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function xWr(t){return YAe(t.name)||YAe(t.filename)||YAe(t.path)?.split(/[\\/]/).pop()}var lTt,cTt,c8,vWr,YAe,CWr,QAe,fg,dTt,ZAe,ane=w(()=>{l8();l8();lTt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",cTt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&c8(t),c8=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",vWr=t=>cTt(t)||lTt(t)||HAe(t);YAe=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},CWr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",QAe=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",fg=async t=>{let e=await dTt(t.body);return UAe(e,t)},dTt=async t=>{let e=new BAe;return await Promise.all(Object.entries(t||{}).map(([r,n])=>ZAe(e,r,n))),e},ZAe=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(vWr(r)){let n=await XAe(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>ZAe(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>ZAe(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 yTt(t){let{response:e}=t;if(t.options.stream)return qO("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):yx.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 qO("response",e.status,e.url,e.headers,a),bTt(a,e)}let i=await e.text();return qO("response",e.status,e.url,e.headers,i),i}function bTt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}function IWr(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}function _Tt(t){if(!t)return!0;for(let e in t)return!1;return!0}function vTt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function hTt(t,e){for(let r in e){if(!vTt(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 qO(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)gTt.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)gTt.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function TB(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var PWr,EWr,sne,lne,cne,d8,tIe,JAe,TWr,Jr,AWr,fTt,pTt,mTt,MWr,RWr,jWr,NWr,UO,eIe,nne,MA,gTt,DWr,wTt,LWr,une,STt,Vn=w(()=>{QEt();ine();Kp();l8();ane();ane();PWr=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},EWr=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)};WAe();lne=class t extends Promise{constructor(e,r=yTt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>bTt(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)}},cne=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=eIe("maxRetries",r),this.timeout=eIe("timeout",n),this.httpAgent=o,this.fetch=i??$Ae}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...MWr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${DWr()}`}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&&c8(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:QAe(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&&eIe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??zAe(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 hTt(i,a),hTt(i,r),QAe(e.body)&&Uj!=="node"&&delete i["content-type"],une(a,"x-stainless-retry-count")===void 0&&une(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),une(a,"x-stainless-timeout")===void 0&&une(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 Ys.generate(e,r,n,o)}request(e,r=null){return new lne(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}),qO("request",a,n,i.headers),n.signal?.aborted)throw new Li;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(nne);if(l instanceof Error){if(n.signal?.aborted)throw new Li;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Xf:new BO({cause:l})}let c=JAe(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return qO(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>nne(b).message),f=RWr(d),p=f?void 0:d;throw qO(`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 tIe(this,n,e)}buildURL(e,r){let n=NWr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return _Tt(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 vt(`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 UO(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 ${qj}`}},d8=class{constructor(e,r,n,o){sne.set(this,void 0),PWr(this,sne,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 vt("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 EWr(this,sne,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(sne=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},tIe=class extends lne{constructor(e,r,n){super(r,async o=>new n(e,o.response,await yTt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},JAe=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),TWr={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},Jr=t=>typeof t=="object"&&t!==null&&!_Tt(t)&&Object.keys(t).every(e=>vTt(TWr,e)),AWr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qj,"X-Stainless-OS":pTt(Deno.build.os),"X-Stainless-Arch":fTt(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":qj,"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":qj,"X-Stainless-OS":pTt(process.platform),"X-Stainless-Arch":fTt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=IWr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qj,"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":qj,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};fTt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",pTt=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"),MWr=()=>mTt??(mTt=AWr()),RWr=t=>{try{return JSON.parse(t)}catch{return}},jWr=/^[a-z][a-z0-9+.-]*:/i,NWr=t=>jWr.test(t),UO=t=>new Promise(e=>setTimeout(e,t)),eIe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new vt(`${t} must be an integer`);if(e<0)throw new vt(`${t} must be a positive integer`);return e},nne=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)},MA=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};gTt=new Set(["authorization","api-key"]);DWr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),wTt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",LWr=t=>typeof t?.get=="function",une=(t,e)=>{let r=e.toLowerCase();if(LWr(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},STt=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 bx,no,nc=w(()=>{Vn();bx=class extends d8{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}},no=class extends d8{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 tt,nn=w(()=>{tt=class{constructor(e){this._client=e}}});var AB,rIe=w(()=>{nn();Vn();f8();AB=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,dne,{query:r,...n})}}});var jA,NA,dne,f8=w(()=>{nn();Vn();rIe();rIe();nc();jA=class extends tt{constructor(){super(...arguments),this.messages=new AB(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 Jr(e)?this.list({},e):this._client.getAPIList("/chat/completions",NA,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},NA=class extends no{},dne=class extends no{};jA.ChatCompletionsPage=NA;jA.Messages=AB});var zO,nIe=w(()=>{nn();f8();f8();zO=class extends tt{constructor(){super(...arguments),this.completions=new jA(this._client)}};zO.Completions=jA;zO.ChatCompletionsPage=NA});var xTt=w(()=>{nIe()});var CTt=w(()=>{});var IB,oIe=w(()=>{nn();IB=class extends tt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var MB,iIe=w(()=>{nn();Vn();MB=class extends tt{create(e,r){return this._client.post("/audio/transcriptions",fg({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var RB,aIe=w(()=>{nn();Vn();RB=class extends tt{create(e,r){return this._client.post("/audio/translations",fg({body:e,...r,__metadata:{model:e.model}}))}}});var _x,sIe=w(()=>{nn();oIe();oIe();iIe();iIe();aIe();aIe();_x=class extends tt{constructor(){super(...arguments),this.transcriptions=new MB(this._client),this.translations=new RB(this._client),this.speech=new IB(this._client)}};_x.Transcriptions=MB;_x.Translations=RB;_x.Speech=IB});var DA,Vj,uIe=w(()=>{nn();Vn();nc();DA=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/batches",Vj,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},Vj=class extends no{};DA.BatchesPage=Vj});var Wj,jB,lIe=w(()=>{nn();Vn();nc();Wj=class extends tt{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 Jr(e)?this.list({},e):this._client.getAPIList("/assistants",jB,{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}})}},jB=class extends no{};Wj.AssistantsPage=jB});function cIe(t){return typeof t.parse=="function"}var OTt=w(()=>{});var LA,dIe,fIe,pIe=w(()=>{LA=t=>t?.role==="assistant",dIe=t=>t?.role==="function",fIe=t=>t?.role==="tool"});var Ky,Ja,mIe,fne,pne,p8,m8,mne,h8,HO,g8,hne,gne,NB,PTt,FA,yne=w(()=>{Kp();Ky=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},Ja=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)},FA=class{constructor(){mIe.add(this),this.controller=new AbortController,fne.set(this,void 0),pne.set(this,()=>{}),p8.set(this,()=>{}),m8.set(this,void 0),mne.set(this,()=>{}),h8.set(this,()=>{}),HO.set(this,{}),g8.set(this,!1),hne.set(this,!1),gne.set(this,!1),NB.set(this,!1),Ky(this,fne,new Promise((e,r)=>{Ky(this,pne,e,"f"),Ky(this,p8,r,"f")}),"f"),Ky(this,m8,new Promise((e,r)=>{Ky(this,mne,e,"f"),Ky(this,h8,r,"f")}),"f"),Ja(this,fne,"f").catch(()=>{}),Ja(this,m8,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Ja(this,mIe,"m",PTt).bind(this))},0)}_connected(){this.ended||(Ja(this,pne,"f").call(this),this._emit("connect"))}get ended(){return Ja(this,g8,"f")}get errored(){return Ja(this,hne,"f")}get aborted(){return Ja(this,gne,"f")}abort(){this.controller.abort()}on(e,r){return(Ja(this,HO,"f")[e]||(Ja(this,HO,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ja(this,HO,"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(Ja(this,HO,"f")[e]||(Ja(this,HO,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Ky(this,NB,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Ky(this,NB,!0,"f"),await Ja(this,m8,"f")}_emit(e,...r){if(Ja(this,g8,"f"))return;e==="end"&&(Ky(this,g8,!0,"f"),Ja(this,mne,"f").call(this));let n=Ja(this,HO,"f")[e];if(n&&(Ja(this,HO,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ja(this,NB,"f")&&!n?.length&&Promise.reject(o),Ja(this,p8,"f").call(this,o),Ja(this,h8,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ja(this,NB,"f")&&!n?.length&&Promise.reject(o),Ja(this,p8,"f").call(this,o),Ja(this,h8,"f").call(this,o),this._emit("end")}}_emitFinal(){}};fne=new WeakMap,pne=new WeakMap,p8=new WeakMap,m8=new WeakMap,mne=new WeakMap,h8=new WeakMap,HO=new WeakMap,g8=new WeakMap,hne=new WeakMap,gne=new WeakMap,NB=new WeakMap,mIe=new WeakSet,PTt=function(e){if(Ky(this,hne,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Li),e instanceof Li)return Ky(this,gne,!0,"f"),this._emit("abort",e);if(e instanceof vt)return this._emit("error",e);if(e instanceof Error){let r=new vt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new vt(String(e)))}});function ETt(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function y8(t){return t?.$brand==="auto-parseable-response-format"}function TTt(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 Kj(t){return t?.$brand==="auto-parseable-tool"}function ATt(t,e){return!e||!hIe(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}}))}:b8(t,e)}function b8(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new PB;if(n.finish_reason==="content_filter")throw new EB;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>HWr(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?zWr(e,n.message.content):null}}});return{...t,choices:r}}function zWr(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 HWr(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:Kj(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function ITt(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return Kj(r)||r?.function.strict||!1}function hIe(t){return y8(t.response_format)?!0:t.tools?.some(e=>Kj(e)||e.type==="function"&&e.function.strict===!0)??!1}function MTt(t){for(let e of t??[]){if(e.type!=="function")throw new vt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new vt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var DB=w(()=>{Kp()});var Gp,tf,gIe,bne,yIe,bIe,_Ie,jTt,vIe,RTt,LB,wIe=w(()=>{Kp();OTt();pIe();yne();DB();Gp=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)},RTt=10,LB=class extends FA{constructor(){super(...arguments),tf.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),(dIe(e)||fIe(e))&&e.content)this._emit("functionCallResult",e.content);else if(LA(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(LA(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 vt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Gp(this,tf,"m",gIe).call(this)}async finalMessage(){return await this.done(),Gp(this,tf,"m",bne).call(this)}async finalFunctionCall(){return await this.done(),Gp(this,tf,"m",yIe).call(this)}async finalFunctionCallResult(){return await this.done(),Gp(this,tf,"m",bIe).call(this)}async totalUsage(){return await this.done(),Gp(this,tf,"m",_Ie).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Gp(this,tf,"m",bne).call(this);r&&this._emit("finalMessage",r);let n=Gp(this,tf,"m",gIe).call(this);n&&this._emit("finalContent",n);let o=Gp(this,tf,"m",yIe).call(this);o&&this._emit("finalFunctionCall",o);let i=Gp(this,tf,"m",bIe).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Gp(this,tf,"m",_Ie).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Gp(this,tf,"m",jTt).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(b8(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=RTt}=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 vt("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(P=>JSON.stringify(P.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:O});continue}let y;try{y=cIe(g)?await g.parse(b):b}catch(O){this._addMessage({role:o,name:h,content:O instanceof Error?O.message:String(O)});continue}let S=await g.function(y,this),x=Gp(this,tf,"m",vIe).call(this,S);if(this._addMessage({role:o,name:h,content:x}),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=RTt}=n||{},c=r.tools.map(p=>{if(Kj(p)){if(!p.$callback)throw new vt("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 vt("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:S}=b.function,x=d[y];if(x){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=cIe(x)?await x.parse(S):S}catch(A){let I=A instanceof Error?A.message:String(A);this._addMessage({role:o,tool_call_id:g,content:I});continue}let P=await x.function(O,this),E=Gp(this,tf,"m",vIe).call(this,P);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};tf=new WeakSet,gIe=function(){return Gp(this,tf,"m",bne).call(this).content??null},bne=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(LA(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 vt("stream ended without producing a ChatCompletionMessage with role=assistant")},yIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(LA(r)&&r?.function_call)return r.function_call;if(LA(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},bIe=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(dIe(r)&&r.content!=null||fIe(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}},_Ie=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},jTt=function(e){if(e.n!=null&&e.n>1)throw new vt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},vIe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var _8,NTt=w(()=>{wIe();pIe();_8=class t extends LB{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),LA(e)&&e.content&&this._emit("content",e.content)}}});function VWr(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 WWr(t.trim(),e)}var oc,SIe,xIe,WWr,CIe,DTt=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},SIe=class extends Error{},xIe=class extends Error{};WWr=(t,e)=>{let r=t.length,n=0,o=f=>{throw new SIe(`${f} at position ${n}`)},i=f=>{throw new xIe(`${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()},CIe=t=>VWr(t,oc.ALL^oc.NUM)});function KWr(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 vt(`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 vt(`missing role for choice ${d}`);if(h){let{arguments:S,name:x}=h;if(S==null)throw new vt(`missing function_call.arguments for choice ${d}`);if(!x)throw new vt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:S,name:x},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((S,x)=>{let{function:O,type:P,id:E,...A}=S,{arguments:I,name:R,...N}=O||{};if(E==null)throw new vt(`missing choices[${d}].tool_calls[${x}].id
${wne(t)}`);if(P==null)throw new vt(`missing choices[${d}].tool_calls[${x}].type
${wne(t)}`);if(R==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.name
${wne(t)}`);if(I==null)throw new vt(`missing choices[${d}].tool_calls[${x}].function.arguments
${wne(t)}`);return{...A,id:E,type:P,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 ATt(u,e)}function wne(t){return JSON.stringify(t)}var FB,Ti,Dl,VO,kB,kA,OIe,_ne,PIe,EIe,TIe,vne,AIe,LTt,$B,IIe=w(()=>{Kp();wIe();ine();DB();DTt();FB=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},Ti=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)},$B=class t extends LB{constructor(e){super(),Dl.add(this),VO.set(this,void 0),kB.set(this,void 0),kA.set(this,void 0),FB(this,VO,e,"f"),FB(this,kB,[],"f")}get currentChatCompletionSnapshot(){return Ti(this,kA,"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())),Ti(this,Dl,"m",OIe).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)Ti(this,Dl,"m",PIe).call(this,a);if(i.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",vne).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Ti(this,Dl,"m",OIe).call(this),this._connected();let o=yx.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Ti(this,Dl,"m",vne).call(this)),Ti(this,Dl,"m",PIe).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Li;return this._addChatCompletion(Ti(this,Dl,"m",vne).call(this))}[(VO=new WeakMap,kB=new WeakMap,kA=new WeakMap,Dl=new WeakSet,OIe=function(){this.ended||FB(this,kA,void 0,"f")},_ne=function(r){let n=Ti(this,kB,"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},Ti(this,kB,"f")[r.index]=n,n)},PIe=function(r){if(this.ended)return;let n=Ti(this,Dl,"m",LTt).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=Ti(this,Dl,"m",_ne).call(this,i);i.finish_reason&&(Ti(this,Dl,"m",TIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",EIe).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Ti(this,Dl,"m",TIe).call(this,i),a.current_tool_call_index!=null&&Ti(this,Dl,"m",EIe).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))}}},EIe=function(r,n){if(Ti(this,Dl,"m",_ne).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=Ti(this,VO,"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:Kj(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},TIe=function(r){let n=Ti(this,Dl,"m",_ne).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Ti(this,Dl,"m",AIe).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}))},vne=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=Ti(this,kA,"f");if(!r)throw new vt("request ended without sending any chunks");return FB(this,kA,void 0,"f"),FB(this,kB,[],"f"),KWr(r,Ti(this,VO,"f"))},AIe=function(){let r=Ti(this,VO,"f")?.response_format;return y8(r)?r:null},LTt=function(r){var n,o,i,a;let s=Ti(this,kA,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=FB(this,kA,{...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:P,refusal:E,...A}=p;Object.assign(h.logprobs,A),P&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...P)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Ti(this,VO,"f")&&hIe(Ti(this,VO,"f")))){if(d==="length")throw new PB;if(d==="content_filter")throw new EB}if(Object.assign(h,m),!c)continue;let{content:b,refusal:g,function_call:y,role:S,tool_calls:x,...O}=c;if(Object.assign(h.message,O),g&&(h.message.refusal=(h.message.refusal||"")+g),S&&(h.message.role=S),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&&Ti(this,Dl,"m",AIe).call(this)&&(h.message.parsed=CIe(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:P,id:E,type:A,function:I,...R}of x){let N=(a=h.message.tool_calls)[P]??(a[P]={});Object.assign(N,R),E&&(N.id=E),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,ITt(Ti(this,VO,"f"),N)&&(N.function.parsed_arguments=CIe(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 yx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var v8,FTt=w(()=>{IIe();v8=class t extends $B{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 w8,kTt=w(()=>{nn();NTt();FTt();IIe();DB();w8=class extends tt{parse(e,r){return MTt(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>b8(n,e))}runFunctions(e,r){return e.stream?v8.runFunctions(this._client,e,r):_8.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?v8.runTools(this._client,e,r):_8.runTools(this._client,e,r)}stream(e,r){return $B.createChatCompletion(this._client,e,r)}}});var BB,$Tt=w(()=>{nn();kTt();BB=class extends tt{constructor(){super(...arguments),this.completions=new w8(this._client)}};(function(t){t.Completions=w8})(BB||(BB={}))});var qB,MIe=w(()=>{nn();qB=class extends tt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var UB,RIe=w(()=>{nn();UB=class extends tt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var $A,jIe=w(()=>{nn();MIe();MIe();RIe();RIe();$A=class extends tt{constructor(){super(...arguments),this.sessions=new qB(this._client),this.transcriptionSessions=new UB(this._client)}};$A.Sessions=qB;$A.TranscriptionSessions=UB});var Gt,Jm,Yc,NIe,vx,Sne,Gy,Jj,zB,Gj,One,Ym,xne,Cne,C8,S8,x8,BTt,qTt,UTt,zTt,HTt,VTt,WTt,wx,DIe=w(()=>{Vn();ine();Kp();yne();Gt=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)},Jm=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},wx=class t extends FA{constructor(){super(...arguments),Yc.add(this),NIe.set(this,[]),vx.set(this,{}),Sne.set(this,{}),Gy.set(this,void 0),Jj.set(this,void 0),zB.set(this,void 0),Gj.set(this,void 0),One.set(this,void 0),Ym.set(this,void 0),xne.set(this,void 0),Cne.set(this,void 0),C8.set(this,void 0)}[(NIe=new WeakMap,vx=new WeakMap,Sne=new WeakMap,Gy=new WeakMap,Jj=new WeakMap,zB=new WeakMap,Gj=new WeakMap,One=new WeakMap,Ym=new WeakMap,xne=new WeakMap,Cne=new WeakMap,C8=new WeakMap,Yc=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=yx.fromReadableStream(e,this.controller);for await(let i of o)Gt(this,Yc,"m",S8).call(this,i);if(o.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).call(this))}toReadableStream(){return new yx(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)Gt(this,Yc,"m",S8).call(this,l);if(u.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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 Gt(this,xne,"f")}currentRun(){return Gt(this,Cne,"f")}currentMessageSnapshot(){return Gt(this,Gy,"f")}currentRunStepSnapshot(){return Gt(this,C8,"f")}async finalRunSteps(){return await this.done(),Object.values(Gt(this,vx,"f"))}async finalMessages(){return await this.done(),Object.values(Gt(this,Sne,"f"))}async finalRun(){if(await this.done(),!Gt(this,Jj,"f"))throw Error("Final run was not received.");return Gt(this,Jj,"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)Gt(this,Yc,"m",S8).call(this,s);if(a.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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)Gt(this,Yc,"m",S8).call(this,u);if(s.controller.signal?.aborted)throw new Li;return this._addRun(Gt(this,Yc,"m",x8).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(TB(i)&&TB(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(!TB(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)}};S8=function(e){if(!this.ended)switch(Jm(this,xne,e,"f"),Gt(this,Yc,"m",UTt).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":Gt(this,Yc,"m",WTt).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":Gt(this,Yc,"m",qTt).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":Gt(this,Yc,"m",BTt).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},x8=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");if(!Gt(this,Jj,"f"))throw Error("Final run has not been received");return Gt(this,Jj,"f")},BTt=function(e){let[r,n]=Gt(this,Yc,"m",HTt).call(this,e,Gt(this,Gy,"f"));Jm(this,Gy,r,"f"),Gt(this,Sne,"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!=Gt(this,zB,"f")){if(Gt(this,Gj,"f"))switch(Gt(this,Gj,"f").type){case"text":this._emit("textDone",Gt(this,Gj,"f").text,Gt(this,Gy,"f"));break;case"image_file":this._emit("imageFileDone",Gt(this,Gj,"f").image_file,Gt(this,Gy,"f"));break}Jm(this,zB,o.index,"f")}Jm(this,Gj,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Gt(this,zB,"f")!==void 0){let o=e.data.content[Gt(this,zB,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Gt(this,Gy,"f"));break;case"text":this._emit("textDone",o.text,Gt(this,Gy,"f"));break}}Gt(this,Gy,"f")&&this._emit("messageDone",e.data),Jm(this,Gy,void 0,"f")}},qTt=function(e){let r=Gt(this,Yc,"m",zTt).call(this,e);switch(Jm(this,C8,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==Gt(this,One,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Gt(this,Ym,"f")&&this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,One,i.index,"f"),Jm(this,Ym,r.step_details.tool_calls[i.index],"f"),Gt(this,Ym,"f")&&this._emit("toolCallCreated",Gt(this,Ym,"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":Jm(this,C8,void 0,"f"),e.data.step_details.type=="tool_calls"&&Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},UTt=function(e){Gt(this,NIe,"f").push(e),this._emit("event",e)},zTt=function(e){switch(e.event){case"thread.run.step.created":return Gt(this,vx,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Gt(this,vx,"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=wx.accumulateDelta(r,n.delta);Gt(this,vx,"f")[e.data.id]=o}return Gt(this,vx,"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":Gt(this,vx,"f")[e.data.id]=e.data;break}if(Gt(this,vx,"f")[e.data.id])return Gt(this,vx,"f")[e.data.id];throw new Error("No snapshot available")},HTt=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]=Gt(this,Yc,"m",VTt).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")},VTt=function(e,r){return wx.accumulateDelta(r,e)},WTt=function(e){switch(Jm(this,Cne,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":Jm(this,Jj,e.data,"f"),Gt(this,Ym,"f")&&(this._emit("toolCallDone",Gt(this,Ym,"f")),Jm(this,Ym,void 0,"f"));break;case"thread.run.cancelling":break}}});var Yj,HB,LIe=w(()=>{nn();Vn();nc();Yj=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,HB,{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}})}},HB=class extends no{};Yj.MessagesPage=HB});var Zj,VB,FIe=w(()=>{nn();Vn();nc();Zj=class extends tt{retrieve(e,r,n,o={},i){return Jr(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 Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,VB,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},VB=class extends no{};Zj.RunStepsPage=VB});var WO,WB,kIe=w(()=>{nn();Vn();DIe();Vn();FIe();FIe();nc();WO=class extends tt{constructor(){super(...arguments),this.steps=new Zj(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,WB,{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 wx.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 UO(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return wx.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 wx.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},WB=class extends no{};WO.RunsPage=WB;WO.Steps=Zj;WO.RunStepsPage=VB});var Sx,$Ie=w(()=>{nn();Vn();DIe();LIe();LIe();kIe();kIe();Sx=class extends tt{constructor(){super(...arguments),this.runs=new WO(this._client),this.messages=new Yj(this._client)}create(e={},r){return Jr(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 wx.createThreadAssistantStream(e,this._client.beta.threads,r)}};Sx.Runs=WO;Sx.RunsPage=WB;Sx.Messages=Yj;Sx.MessagesPage=HB});var Jy,BIe=w(()=>{nn();lIe();$Tt();lIe();jIe();jIe();$Ie();$Ie();Jy=class extends tt{constructor(){super(...arguments),this.realtime=new $A(this._client),this.chat=new BB(this._client),this.assistants=new Wj(this._client),this.threads=new Sx(this._client)}};Jy.Realtime=$A;Jy.Assistants=Wj;Jy.AssistantsPage=jB;Jy.Threads=Sx});var Xj,qIe=w(()=>{nn();Xj=class extends tt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var Qj,UIe=w(()=>{nn();Vn();Qj=class extends tt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&qO("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(qO("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=STt(u)}),a)))}}});var eN,KB,zIe=w(()=>{nn();Vn();nc();eN=class extends tt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Jr(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,KB,{query:n,...o})}},KB=class extends no{};eN.OutputItemListResponsesPage=KB});var KO,GB,HIe=w(()=>{nn();Vn();zIe();zIe();nc();KO=class extends tt{constructor(){super(...arguments),this.outputItems=new eN(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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,GB,{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)}},GB=class extends no{};KO.RunListResponsesPage=GB;KO.OutputItems=eN;KO.OutputItemListResponsesPage=KB});var xx,tN,VIe=w(()=>{nn();Vn();HIe();HIe();nc();xx=class extends tt{constructor(){super(...arguments),this.runs=new KO(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 Jr(e)?this.list({},e):this._client.getAPIList("/evals",tN,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},tN=class extends no{};xx.EvalListResponsesPage=tN;xx.Runs=KO;xx.RunListResponsesPage=GB});var BA,rN,WIe=w(()=>{nn();Vn();Vn();Kp();Vn();nc();BA=class extends tt{create(e,r){return this._client.post("/files",fg({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Jr(e)?this.list({},e):this._client.getAPIList("/files",rN,{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 UO(r),a=await this.retrieve(e),Date.now()-i>n)throw new Xf({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},rN=class extends no{};BA.FileObjectsPage=rN});var nN,JB,KIe=w(()=>{nn();Vn();nc();nN=class extends tt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,JB,{body:r,method:"post",...n})}retrieve(e,r={},n){return Jr(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)}},JB=class extends bx{};nN.PermissionCreateResponsesPage=JB});var qA,GIe=w(()=>{nn();KIe();KIe();qA=class extends tt{constructor(){super(...arguments),this.permissions=new nN(this._client)}};qA.Permissions=nN;qA.PermissionCreateResponsesPage=JB});var oN,YB,JIe=w(()=>{nn();Vn();nc();oN=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,YB,{query:r,...n})}},YB=class extends no{};oN.FineTuningJobCheckpointsPage=YB});var Cx,ZB,XB,YIe=w(()=>{nn();Vn();JIe();JIe();nc();Cx=class extends tt{constructor(){super(...arguments),this.checkpoints=new oN(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 Jr(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",ZB,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Jr(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,XB,{query:r,...n})}},ZB=class extends no{},XB=class extends no{};Cx.FineTuningJobsPage=ZB;Cx.FineTuningJobEventsPage=XB;Cx.Checkpoints=oN;Cx.FineTuningJobCheckpointsPage=YB});var Yy,ZIe=w(()=>{nn();GIe();GIe();YIe();YIe();Yy=class extends tt{constructor(){super(...arguments),this.jobs=new Cx(this._client),this.checkpoints=new qA(this._client)}};Yy.Jobs=Cx;Yy.FineTuningJobsPage=ZB;Yy.FineTuningJobEventsPage=XB;Yy.Checkpoints=qA});var iN,XIe=w(()=>{nn();Vn();iN=class extends tt{createVariation(e,r){return this._client.post("/images/variations",fg({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",fg({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var UA,aN,QIe=w(()=>{nn();nc();UA=class extends tt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",aN,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},aN=class extends bx{};UA.ModelsPage=aN});var sN,eMe=w(()=>{nn();sN=class extends tt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function KTt(t,e){return!e||!c9r(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)}:tMe(t,e)}function tMe(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:p9r(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:l9r(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||rMe(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 l9r(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function c9r(t){return!!y8(t.text?.format)}function d9r(t){return t?.$brand==="auto-parseable-tool"}function f9r(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function p9r(t,e){let r=f9r(t.tools??[],e.name);return{...e,...e,parsed_arguments:d9r(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function rMe(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 nMe=w(()=>{DB()});var QB,oMe=w(()=>{nn();Vn();Ene();QB=class extends tt{list(e,r={},n){return Jr(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,Pne,{query:r,...n})}}});function h9r(t,e){return KTt(t,e)}var eq,zA,tq,Tne,HA,Ane,GTt,JTt,YTt,ZTt,Ine,XTt=w(()=>{Kp();yne();nMe();eq=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},zA=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)},Ine=class t extends FA{constructor(e){super(),tq.add(this),Tne.set(this,void 0),HA.set(this,void 0),Ane.set(this,void 0),eq(this,Tne,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())),zA(this,tq,"m",GTt).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)zA(this,tq,"m",JTt).call(this,a);if(i.controller.signal?.aborted)throw new Li;return zA(this,tq,"m",YTt).call(this)}[(Tne=new WeakMap,HA=new WeakMap,Ane=new WeakMap,tq=new WeakSet,GTt=function(){this.ended||eq(this,HA,void 0,"f")},JTt=function(r){if(this.ended)return;let n=zA(this,tq,"m",ZTt).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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`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}},YTt=function(){if(this.ended)throw new vt("stream has ended, this shouldn't happen");let r=zA(this,HA,"f");if(!r)throw new vt("request ended without sending any events");eq(this,HA,void 0,"f");let n=h9r(r,zA(this,Tne,"f"));return eq(this,Ane,n,"f"),n},ZTt=function(r){let n=zA(this,HA,"f");if(!n){if(r.type!=="response.created")throw new vt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=eq(this,HA,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 vt(`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 vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new vt(`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 vt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{eq(this,HA,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=zA(this,Ane,"f");if(!e)throw new vt("stream ended without producing a ChatCompletion");return e}}});var VA,Pne,Ene=w(()=>{nMe();Vn();nn();oMe();oMe();XTt();nc();VA=class extends tt{constructor(){super(...arguments),this.inputItems=new QB(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"&&rMe(n),n))}retrieve(e,r={},n){return Jr(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=>tMe(n,e))}stream(e,r){return Ine.createResponse(this._client,e,r)}},Pne=class extends no{};VA.InputItems=QB});var rq,iMe=w(()=>{nn();Vn();rq=class extends tt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,fg({body:r,...n}))}}});var WA,aMe=w(()=>{nn();iMe();iMe();WA=class extends tt{constructor(){super(...arguments),this.parts=new rq(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})}};WA.Parts=rq});var QTt,eAt=w(()=>{QTt=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 KA,GA,nq,Mne=w(()=>{nn();Vn();nc();KA=class extends tt{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 Jr(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,GA,{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 UO(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`,nq,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},GA=class extends no{},nq=class extends bx{};KA.VectorStoreFilesPage=GA;KA.FileContentResponsesPage=nq});var oq,sMe=w(()=>{nn();Vn();Vn();eAt();Mne();oq=class extends tt{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 Jr(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,GA,{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 UO(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 QTt(d),await this.createAndPoll(e,{file_ids:l})}}});var Zm,uN,lN,uMe=w(()=>{nn();Vn();sMe();sMe();Mne();Mne();nc();Zm=class extends tt{constructor(){super(...arguments),this.files=new KA(this._client),this.fileBatches=new oq(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 Jr(e)?this.list({},e):this._client.getAPIList("/vector_stores",uN,{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`,lN,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},uN=class extends no{},lN=class extends bx{};Zm.VectorStoresPage=uN;Zm.VectorStoreSearchResponsesPage=lN;Zm.Files=KA;Zm.VectorStoreFilesPage=GA;Zm.FileContentResponsesPage=nq;Zm.FileBatches=oq});var tAt=w(()=>{xTt();CTt();sIe();uIe();BIe();qIe();UIe();VIe();WIe();ZIe();XIe();QIe();eMe();Ene();aMe();uMe()});var nAt,Wt,Rne,v9r,rAt,pg=w(()=>{XEt();Vn();Kp();ane();tAt();uIe();qIe();UIe();WIe();XIe();QIe();eMe();sIe();BIe();nIe();VIe();ZIe();Ene();aMe();uMe();f8();Kp();Wt=class extends cne{constructor({baseURL:e=MA("OPENAI_BASE_URL"),apiKey:r=MA("OPENAI_API_KEY"),organization:n=MA("OPENAI_ORG_ID")??null,project:o=MA("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new vt("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&&wTt())throw new vt(`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 Xj(this),this.chat=new zO(this),this.embeddings=new Qj(this),this.files=new BA(this),this.images=new iN(this),this.audio=new _x(this),this.moderations=new sN(this),this.models=new UA(this),this.fineTuning=new Yy(this),this.vectorStores=new Zm(this),this.beta=new Jy(this),this.batches=new DA(this),this.uploads=new WA(this),this.responses=new VA(this),this.evals=new xx(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 kAe(e,{arrayFormat:"brackets"})}};nAt=Wt;Wt.OpenAI=nAt;Wt.DEFAULT_TIMEOUT=6e5;Wt.OpenAIError=vt;Wt.APIError=Ys;Wt.APIConnectionError=BO;Wt.APIConnectionTimeoutError=Xf;Wt.APIUserAbortError=Li;Wt.NotFoundError=wB;Wt.ConflictError=SB;Wt.RateLimitError=CB;Wt.BadRequestError=bB;Wt.AuthenticationError=_B;Wt.InternalServerError=OB;Wt.PermissionDeniedError=vB;Wt.UnprocessableEntityError=xB;Wt.toFile=XAe;Wt.fileFromPath=tne;Wt.Completions=Xj;Wt.Chat=zO;Wt.ChatCompletionsPage=NA;Wt.Embeddings=Qj;Wt.Files=BA;Wt.FileObjectsPage=rN;Wt.Images=iN;Wt.Audio=_x;Wt.Moderations=sN;Wt.Models=UA;Wt.ModelsPage=aN;Wt.FineTuning=Yy;Wt.VectorStores=Zm;Wt.VectorStoresPage=uN;Wt.VectorStoreSearchResponsesPage=lN;Wt.Beta=Jy;Wt.Batches=DA;Wt.BatchesPage=Vj;Wt.Uploads=WA;Wt.Responses=VA;Wt.Evals=xx;Wt.EvalListResponsesPage=tN;Rne=class extends Wt{constructor({baseURL:e=MA("OPENAI_BASE_URL"),apiKey:r=MA("AZURE_OPENAI_API_KEY"),apiVersion:n=MA("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new vt("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 vt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new vt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(r??(r=rAt),u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new vt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new vt("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}buildRequest(e,r={}){if(v9r.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!TB(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 vt(`Expected 'azureADTokenProvider' argument to return a string but it returned ${e}`);return e}}authHeaders(e){return{}}async prepareOptions(e){if(e.headers?.["api-key"])return super.prepareOptions(e);let r=await this._getAzureADToken();if(e.headers??(e.headers={}),r)e.headers.Authorization=`Bearer ${r}`;else if(this.apiKey!==rAt)e.headers["api-key"]=this.apiKey;else throw new vt("Unable to handle auth");return super.prepareOptions(e)}},v9r=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations"]),rAt="<Missing Key>"});function Jp(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=WL(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new vm([`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 Ox(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 Xm(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var lMe,Zc,oAt=w(()=>{eF();hhe();$E();SR();lMe=class extends AR{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(Oi(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=>Jp(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}},Zc=class extends lMe{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 this.zodSchema.safeParseAsync(e);if(r.success)return r.data;throw new vm(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.errors)}`,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 iAt=w(()=>{oAt()});var iq=w(()=>{iAt()});var sAt,aAt,uAt,jne=w(()=>{sAt=Symbol("Let zodToJsonSchema decide on which parser to use"),aAt={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"},uAt=t=>typeof t=="string"?{...aAt,basePath:["#"],definitions:{},name:t}:{...aAt,basePath:["#"],definitions:{},...t}});function lAt(t){if(!t)return!0;for(let e in t)return!1;return!0}var O8,cMe=w(()=>{O8=t=>"_def"in t?t._def:t});var cAt,dMe=w(()=>{jne();cMe();cAt=t=>{let e=uAt(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])=>[O8(o),{def:O8(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function fMe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Wn(t,e,r,n,o){t[e]=r,fMe(t,e,n,o)}var JA=w(()=>{});function dAt(){return{}}var pMe=w(()=>{});function fAt(t,e){let r={type:"array"};return t.type?._def?.typeName!==de.ZodAny&&(r.items=pr(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Wn(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Wn(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Wn(r,"minItems",t.exactLength.value,t.exactLength.message,e),Wn(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var mMe=w(()=>{Td();JA();Zs()});function pAt(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?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var hMe=w(()=>{JA()});function mAt(){return{type:"boolean"}}var gMe=w(()=>{});function hAt(t,e){return pr(t.type._def,e)}var yMe=w(()=>{Zs()});var gAt,bMe=w(()=>{Zs();gAt=(t,e)=>pr(t.innerType._def,e)});function _Me(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>_Me(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 w9r(t,e)}}var w9r,vMe=w(()=>{JA();w9r=(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":Wn(r,"minimum",n.value,n.message,e);break;case"max":Wn(r,"maximum",n.value,n.message,e);break}return r}});function yAt(t,e){return{...pr(t.innerType._def,e),default:t.defaultValue()}}var wMe=w(()=>{Zs()});function bAt(t,e,r){return e.effectStrategy==="input"?pr(t.schema._def,e,r):{}}var SMe=w(()=>{Zs()});function _At(t){return{type:"string",enum:[...t.values]}}var xMe=w(()=>{});function vAt(t,e){let r=[pr(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),pr(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(S9r(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 S9r,CMe=w(()=>{Zs();S9r=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function wAt(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 OMe=w(()=>{});function Nne(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?x9r(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Wn(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":Zy(r,"email",o.message,e);break;case"format:idn-email":Zy(r,"idn-email",o.message,e);break;case"pattern:zod":Xy(r,cN.email,o.message,e);break}break;case"url":Zy(r,"uri",o.message,e);break;case"uuid":Zy(r,"uuid",o.message,e);break;case"regex":Xy(r,o.regex,o.message,e);break;case"cuid":Xy(r,cN.cuid,o.message,e);break;case"cuid2":Xy(r,cN.cuid2,o.message,e);break;case"startsWith":Xy(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Xy(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Zy(r,"date-time",o.message,e);break;case"date":Zy(r,"date",o.message,e);break;case"time":Zy(r,"time",o.message,e);break;case"duration":Zy(r,"duration",o.message,e);break;case"length":Wn(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Wn(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Xy(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Zy(r,"ipv4",o.message,e),o.version!=="v4"&&Zy(r,"ipv6",o.message,e);break}case"emoji":Xy(r,cN.emoji,o.message,e);break;case"ulid":{Xy(r,cN.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Zy(r,"binary",o.message,e);break}case"contentEncoding:base64":{Wn(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Xy(r,cN.base64,o.message,e);break}}break}case"nanoid":Xy(r,cN.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var PMe,cN,x9r,Zy,Xy,SAt,Dne=w(()=>{JA();cN={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:()=>(PMe===void 0&&(PMe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),PMe),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}$/};x9r=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Zy=(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}}})):Wn(t,"format",e,r,n)},Xy=(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:SAt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Wn(t,"pattern",SAt(e,n),r,n)},SAt=(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 Lne(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===de.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===de.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(Nne(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===de.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var Fne=w(()=>{Td();Zs();Dne()});function xAt(t,e){if(e.mapStrategy==="record")return Lne(t,e);let r=pr(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var EMe=w(()=>{Zs();Fne()});function CAt(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 TMe=w(()=>{});function OAt(){return{not:{}}}var AMe=w(()=>{});function PAt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var IMe=w(()=>{});function TAt(t,e){if(e.target==="openApi3")return EAt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in P8&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=P8[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 EAt(t,e)}var P8,EAt,kne=w(()=>{Zs();P8={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};EAt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>pr(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0}});function AAt(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:P8[t.innerType._def.typeName],nullable:!0}:{type:[P8[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=pr(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var MMe=w(()=>{Zs();kne()});function IAt(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",fMe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Wn(r,"minimum",n.value,n.message,e):Wn(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Wn(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Wn(r,"maximum",n.value,n.message,e):Wn(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Wn(r,"maximum",n.value,n.message,e));break;case"multipleOf":Wn(r,"multipleOf",n.value,n.message,e);break}return r}var RMe=w(()=>{JA()});function C9r(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":pr(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function MAt(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,i])=>{if(i===void 0||i._def===void 0)return n;let a=[...e.currentPath,"properties",o],s=pr(i._def,{...e,currentPath:a,propertyPath:a});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:C9r(t,e)};return r.required.length||delete r.required,r}var jMe=w(()=>{Zs()});var RAt,NMe=w(()=>{Zs();RAt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return pr(t.innerType._def,e);let r=pr(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var jAt,DMe=w(()=>{Zs();jAt=(t,e)=>{if(e.pipeStrategy==="input")return pr(t.in._def,e);if(e.pipeStrategy==="output")return pr(t.out._def,e);let r=pr(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=pr(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function NAt(t,e){return pr(t.type._def,e)}var LMe=w(()=>{Zs()});function DAt(t,e){let n={type:"array",uniqueItems:!0,items:pr(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Wn(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Wn(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var FMe=w(()=>{JA();Zs()});function LAt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:pr(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>pr(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var kMe=w(()=>{Zs()});function FAt(){return{not:{}}}var $Me=w(()=>{});function kAt(){return{}}var BMe=w(()=>{});var $At,qMe=w(()=>{Zs();$At=(t,e)=>pr(t.innerType._def,e)});function pr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==sAt)return a}if(n&&!r){let a=O9r(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=E9r(t,t.typeName,e,r);return i&&T9r(t,e,i),o.jsonSchema=i,i}var O9r,P9r,E9r,T9r,Zs=w(()=>{Td();pMe();mMe();hMe();gMe();yMe();bMe();vMe();wMe();SMe();xMe();CMe();OMe();EMe();TMe();AMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();Fne();FMe();Dne();kMe();$Me();kne();BMe();qMe();jne();O9r=(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:P9r(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}},P9r=(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("/")},E9r=(t,e,r,n)=>{switch(e){case de.ZodString:return Nne(t,r);case de.ZodNumber:return IAt(t,r);case de.ZodObject:return MAt(t,r);case de.ZodBigInt:return pAt(t,r);case de.ZodBoolean:return mAt();case de.ZodDate:return _Me(t,r);case de.ZodUndefined:return FAt();case de.ZodNull:return PAt(r);case de.ZodArray:return fAt(t,r);case de.ZodUnion:case de.ZodDiscriminatedUnion:return TAt(t,r);case de.ZodIntersection:return vAt(t,r);case de.ZodTuple:return LAt(t,r);case de.ZodRecord:return Lne(t,r);case de.ZodLiteral:return wAt(t,r);case de.ZodEnum:return _At(t);case de.ZodNativeEnum:return CAt(t);case de.ZodNullable:return AAt(t,r);case de.ZodOptional:return RAt(t,r);case de.ZodMap:return xAt(t,r);case de.ZodSet:return DAt(t,r);case de.ZodLazy:return pr(t.getter()._def,r);case de.ZodPromise:return NAt(t,r);case de.ZodNaN:case de.ZodNever:return OAt();case de.ZodEffects:return bAt(t,r,n);case de.ZodAny:return dAt();case de.ZodUnknown:return kAt();case de.ZodDefault:return yAt(t,r);case de.ZodBranded:return hAt(t,r);case de.ZodReadonly:return $At(t,r);case de.ZodCatch:return gAt(t,r);case de.ZodPipeline:return jAt(t,r);case de.ZodFunction:case de.ZodVoid:case de.ZodSymbol:return;default:return(o=>{})(e)}},T9r=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var BAt,qAt=w(()=>{Zs();dMe();cMe();BAt=(t,e)=>{let r=cAt(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=pr(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let a=(()=>{if(lAt(r.definitions))return;let u={},l=new Set;for(let c=0;c<500;c++){let d=Object.entries(r.definitions).filter(([f])=>!l.has(f));if(d.length===0)break;for(let[f,p]of d)u[f]=pr(O8(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 UAt=w(()=>{jne();dMe();JA();Zs();pMe();mMe();hMe();gMe();yMe();bMe();vMe();wMe();SMe();xMe();CMe();OMe();EMe();TMe();AMe();IMe();MMe();RMe();jMe();NMe();DMe();LMe();qMe();Fne();FMe();Dne();kMe();$Me();kne();BMe();qAt()});function zAt(t,e){return BAt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function aq(t,e,r){return ETt({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:zAt(t,{name:e})}},n=>t.parse(JSON.parse(n)))}function $ne(t){return TTt({type:"function",function:{name:t.name,parameters:zAt(t.parameters,{name:t.name}),strict:!0,...t.description?{description:t.description}:void 0}},{callback:t.function,parser:e=>t.parameters.parse(JSON.parse(e))})}var sq=w(()=>{DB();UAt()});function GO(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 YA=w(()=>{});function E8(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}var HAt=w(()=>{});function JO(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=E8(t,"INVALID_TOOL_RESULTS"):t.status===401?e=E8(t,"MODEL_AUTHENTICATION"):t.status===429?e=E8(t,"MODEL_RATE_LIMIT"):t.status===404?e=E8(t,"MODEL_NOT_FOUND"):e=t,e}function UMe(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}var dN=w(()=>{pg();Km();Ec();pB();HAt()});function A9r(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function VAt(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(WAt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function WAt(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}: ${Bne(o,e)},`):r.push(`${n}?: ${Bne(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function Bne(t,e){if(A9r(t))return t.anyOf.map(r=>Bne(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["{",WAt(t,e+2),"}"].join(`
`);case"array":return t.items?`${Bne(t.items,e)}[]`:"any[]";default:return""}}var KAt=w(()=>{});function GAt(t,e){let r;return rc(t)?r=dx(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}var JAt=w(()=>{Km();dN()});function I9r(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 VMe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return I9r(t)}default:throw new Error(`Unknown message type: ${e}`)}}function HMe(t,e){return t.flatMap(r=>{let n=VMe(r);n==="system"&&WMe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),o.content=""):(r.additional_kwargs.tool_calls!=null&&(o.tool_calls=r.additional_kwargs.tool_calls),r.tool_call_id!=null&&(o.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let i={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[o,i]}return o})}function YAt(t,e){return t.flatMap(r=>{let n=VMe(r);if(n==="system"&&WMe(e)&&(n="developer"),n==="function")throw new Error("Function messages are not supported in Responses API");if(n==="tool"){let i=r;return i.additional_kwargs?.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}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(n==="assistant"){let i=[];r.additional_kwargs.reasoning!=null&&(c=>typeof c=="object"&&c!=null&&"type"in c&&c.type==="reasoning")(r.additional_kwargs.reasoning)&&i.push(r.additional_kwargs.reasoning);let{content:a}=r;r.additional_kwargs.refusal!=null&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:r.additional_kwargs.refusal}]),i.push({type:"message",role:"assistant",content:typeof a=="string"?a:a.flatMap(l=>l.type==="text"?{type:"output_text",text:l.text,annotations:l.annotations??[]}:l.type==="output_text"||l.type==="refusal"?l:[])});let s=r.additional_kwargs[uq];Oi(r)&&r.tool_calls?.length?i.push(...r.tool_calls.map(l=>({type:"function_call",name:l.name,arguments:JSON.stringify(l.args),call_id:l.id,id:s?.[l.id]}))):r.additional_kwargs.tool_calls!=null&&i.push(...r.additional_kwargs.tool_calls.map(l=>({type:"function_call",name:l.function.name,call_id:l.id,id:s?.[l.id],arguments:l.function.arguments})));let u=r.response_metadata.output?.length?r.response_metadata.output:r.additional_kwargs.tool_outputs;if(u!=null){let l=u,c=l?.filter(f=>f.type==="reasoning"),d=l?.filter(f=>f.type==="computer_call");c.length>0&&d.length>0&&i.push(...c),d.length>0&&i.push(...d)}return i}let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>{if(i.type==="text")return{type:"input_text",text:i.text};if(i.type==="image_url"){let a=typeof i.image_url=="string"?i.image_url:i.image_url.url,s=typeof i.image_url=="string"?"auto":i.image_url.detail;return{type:"input_image",image_url:a,detail:s}}return i.type==="input_text"||i.type==="input_image"||i.type==="input_file"?i:[]});return n==="user"||n==="system"||n==="developer"?{type:"message",role:n,content:o}:(console.warn(`Unsupported role found when converting to OpenAI Responses API: ${n}`),[])})}function XAt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[uq]??(i[uq]={}),a.id&&(i[uq][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function M9r(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[uq]={[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=XAt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function zMe(t){return"type"in t&&t.type!=="function"}function R9r(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function ZAt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:GAt(t,e)}function WMe(t){return t?.startsWith("o1")||t?.startsWith("o3")||t?.startsWith("o4")}function qne(t){return typeof t?.parse=="function"}function j9r(t){return t!==void 0&&typeof t.schema=="object"}var uq,Px,Une=w(()=>{pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();YA();dN();KAt();JAt();uq="__openai_function_call_ids__";Px=class extends Js{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:void 0}),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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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.disableStreaming=e?.disableStreaming??this.disableStreaming,this.model==="o1"&&(this.disableStreaming=!0),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)}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=>zMe(o)?o:ZAt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&qne(e.json_schema.schema)?aq(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=>zMe(l)?l:Wc(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:R9r(e?.tool_choice)?e?.tool_choice:(()=>{let l=UMe(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=>ZAt(s,{strict:n})):void 0,tool_choice:UMe(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),WMe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:YAt(e,this.model),stream:!0},r);for await(let c of l){let d=M9r(c);d!=null&&(yield d)}return}let o=HMe(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 qn({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 qn({message:new dr({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=YAt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:XAt(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(zMe),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=HMe(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}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(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=VAt(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(VMe(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 JO(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 JO(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 JO(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=GO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;j9r(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"}}),qne(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),qne(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(qne(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}}});var QAt=w(()=>{Dn();Une();YA()});var KMe=w(()=>{Wm();Qd();Dn();jj();dg();YA();dN()});var rIt=w(()=>{Dn();KMe();YA()});var YO,GMe=w(()=>{pg();Dn();$O();dg();YA();dN();YO=class extends Jf{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??ot("OPENAI_API_KEY");this.organization=r?.configuration?.organization??ot("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=Yf(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=GO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw JO(n)}})}}});var zne,nIt=w(()=>{pg();Dn();GMe();YA();dN();zne=class extends YO{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??ot("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??ot("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??ot("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??ot("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(ot("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||ot("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=GO(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL,i.defaultHeaders={...i.defaultHeaders,"User-Agent":i.defaultHeaders?.["User-Agent"]?`${i.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new Rne({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 JO(n)}})}}});var oIt=w(()=>{});function Qm(t,e){let r=e.schema&&Gs(e.schema)&&(!("shape"in e.schema)||!e.schema.shape),n=r8(e.schema);if(!e.schema||r||n)return new JMe({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(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 YMe({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d=us(u,{callbacks:s?.getChild()});jd.runWithConfig(bm(d),async()=>{try{l(t(a,d))}catch(f){c(f)}})})})}function N9r(t){let{content:e,artifact:r,toolCallId:n}=t;return n&&!G4e(e)?typeof e=="string"||Array.isArray(e)&&e.every(o=>typeof o=="object")?new PC({content:e,artifact:r,tool_call_id:n,name:t.name}):new PC({content:D9r(e),artifact:r,tool_call_id:n,name:t.name}):e}function D9r(t){try{return JSON.stringify(t,null,2)}catch{return`${t}`}}var Hne,ZO,JMe,YMe,iIt=w(()=>{Td();H2();LE();t8();Hb();KL();YL();pG();fB();sAe();Nre();Hne=class extends cB{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"}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat}async invoke(e,r){let n,o=un(r);return RE(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=RE(e)?e.args:e,i;if(Gs(this.schema))try{i=await this.schema.parseAsync(o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
Details: ${m.message}`),new wR(h,JSON.stringify(e))}else{let m=oa(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 wR(h,JSON.stringify(e))}i=o}let a=CR(r),u=await Bs.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;RE(e)&&(f=e.id),!f&&B4e(a)&&(f=a.toolCall.id);let p=N9r({content:c,artifact:d,toolCallId:f,name:this.name});return await u?.handleToolEnd(p),p}},ZO=class extends Hne{constructor(e){super(e),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:Wr.object({input:Wr.string().optional()}).transform(r=>r.input)})}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},JMe=class extends ZO{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=CR(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)}},YMe=class extends Hne{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=CR(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 ZA=w(()=>{iIt()});var ZMe,aIt=w(()=>{Dn();pg();ZA();ZMe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseURL:e?.baseUrl};this.client=new Wt(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(ZMe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"})});var sIt=w(()=>{aIt()});var uIt=w(()=>{Une()});var lIt=w(()=>{Une();QAt();KMe();rIt();nIt();GMe();oIt();dN();YA();sIt();uIt()});var XMe=w(()=>{lIt()});var Vne,cIt=w(()=>{$O();dg();Dn();Vne=class extends Jf{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||ot("JINA_API_KEY")||ot("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=Yf(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 dIt=w(()=>{cIt()});var Wne,fIt=w(()=>{dIt();Wne=class extends Vne{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var Kne,L9r,Xs,fN=w(()=>{$r();BR();wT();nr();mg();Cn();fAe();_Ae();jAe();XMe();Kne=require("obsidian");fIt();L9r={"copilot-plus":YO,"copilot-plus-jina":Wne,openai:YO,cohereai:$re,google:Wre,"azure openai":zne,ollama:Zre,"lm-studio":YO,"3rd party (openai-format)":YO},Xs=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ue().plusLicenseKey,"copilot-plus-jina":()=>ue().plusLicenseKey,openai:()=>ue().openAIApiKey,cohereai:()=>ue().cohereApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),xa(()=>this.initialize())}initialize(){let e=ue().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=L9r[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(HE).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=kr(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=kr(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ue();if(!t.modelMap.hasOwnProperty(e))throw new Rr(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ue().isPlusUser)throw new Kne.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Rr("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Fi.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Kne.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Rr("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Rr(`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 Rr(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ue(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},"copilot-plus-jina":{model:n,apiKey:await eo(r.plusLicenseKey),timeout:1e4,batchSize:ue().embeddingBatchSize,dimensions:e.dimensions,baseUrl:VE+"/embeddings",configuration:{fetch:e.enableCors?Us:void 0}},openai:{modelName:n,apiKey:await eo(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0}},cohereai:{model:n,apiKey:await eo(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await eo(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await eo(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 eo(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await eo(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||""),batchSize:ue().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us: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 Kne.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: `+ei(n)+`
with CORS Error: `+ei(o);throw new Error(i)}}}}});function hIt(t){return t!==void 0&&T8.includes(t)?pIt[t]:void 0}var pIt,mIt,T8,Gne=w(()=>{pIt={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"},mIt={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},T8=Object.keys(pIt)});function ki(t,e){if(e.length<QMe)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=QMe)Array.prototype.push.apply(t,e.slice(n,n+QMe))}}function vIt(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 $9r(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function B9r(){return typeof process<"u"&&process.release&&process.release.name==="node"}function _It(){return BigInt(Math.floor(performance.now()*1e6))}function pN(t){return typeof t=="number"&&(t=BigInt(t)),t<gIt?`${t}ns`:t<yIt?`${t/gIt}\u03BCs`:t<bIt?`${t/yIt}ms`:`${t/bIt}s`}function Qy(){return $9r()?_It():B9r()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?_It():BigInt(0)}function A8(){return`${F9r}-${k9r++}`}function lq(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 wIt(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function cq(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 Jne(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 dq(t,e){return Jne(t,[e])[e]}function eRe(t,e){let r=q9r[e];if(r===void 0)throw new Error(qt("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function Yne(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 Qs(t){return t?.constructor?.name==="AsyncFunction"}var F9r,k9r,gIt,yIt,bIt,QMe,q9r,Ds=w(()=>{ic();F9r=Date.now().toString().slice(5),k9r=0,gIt=BigInt(1e3),yIt=BigInt(1e6),bIt=BigInt(1e9),QMe=65535;q9r={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function qt(t,...e){let r=new Error(vIt(z9r[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var U9r,z9r,ic=w(()=>{Gne();Ds();U9r=T8.join(`
- `),z9r={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:
- ${U9r}`,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 SIt(t){return{raw:Number(t),formatted:pN(t)}}function xIt(t){if(t.id){if(typeof t.id!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return A8()}function tRe(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(XO(n)){let i=nRe(n);if(!Array.isArray(o)||o.length!==i)throw qt("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(fq(n)){if(!Array.isArray(o))return r;let i=rRe(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=tRe(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function CIt(t){return t==="geopoint"}function XO(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function fq(t){return typeof t=="string"&&H9r[t]}function rRe(t){return V9r[t]}function nRe(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw qt("INVALID_VECTOR_VALUE",t);case e<=0:throw qt("INVALID_VECTOR_SIZE",t);default:return e}}var H9r,V9r,I8=w(()=>{ic();Ds();Ds();H9r={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},V9r={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function OIt(){return{idToInternalId:new Map,internalIdToId:[],save:W9r,load:K9r}}function W9r(t){return{internalIdToId:t.internalIdToId}}function K9r(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 wi(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?wi(t,e.toString()):e}function hg(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var gg=w(()=>{});function J9r(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Y9r(t,e){let r=wi(t.sharedInternalDocumentStore,e);return t.docs[r]}function Z9r(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=wi(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function X9r(t){return t.docs}function Q9r(t,e,r){let n=wi(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function eKr(t,e){let r=wi(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function tKr(t){return t.count}function rKr(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function nKr(t){return{docs:t.docs,count:t.count}}function PIt(){return{create:J9r,get:Y9r,getMultiple:Z9r,getAll:X9r,store:Q9r,remove:eKr,count:tKr,load:rKr,save:nKr}}var oRe=w(()=>{gg()});function TIt(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),qt("PLUGIN_CRASHED")}return r}var EIt,AIt=w(()=>{ic();EIt=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function eb(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function mN(t,e,r){if(t.some(Qs))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function pq(t,e,r,n,o){if(t.some(Qs))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function mq(t,e,r,n){if(t.some(Qs))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function MIt(t,e){if(t.some(Qs))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var IIt,iRe,XA=w(()=>{Ds();IIt=["tokenizer","index","documentsStore","sorter"],iRe=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function aRe(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 sRe(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 jIt(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 uRe(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 lRe(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 NIt(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 DIt(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function LIt(t,e,r,n=500){function o(i,a,s){if(i===null)return RIt++,{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 RIt%n===0?iKr(i,a):i}t.root=o(t.root,e,r)}function iKr(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?sRe(t):r<-1&&e>t.r.k?aRe(t):r>1&&e>t.l.k?(t.l=aRe(t.l),sRe(t)):r<-1&&e<t.r.k?(t.r=sRe(t.r),aRe(t)):t}function yg(t){return t!==null?t.h:-1}function FIt(t,e){let r=NIt(t.root,e);return r===null?null:r.v}function aKr(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 kIt(t,e,r){let n=NIt(t.root,r);if(n){if(n.v.length===1){aKr(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var RIt,$It=w(()=>{Ds();RIt=0});function BIt(){return{numberToDocumentId:new Map}}function qIt(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function UIt(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 zIt(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 HIt(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 cq(i)}}throw new Error("Invalid operation")}var VIt=w(()=>{Ds()});function sKr(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 cRe(t,e,r){let n=sKr(t,e,r);return{distance:n,isBounded:n>=0}}var dRe=w(()=>{});function hq(t,e){t.w=e.w+t.s}function Zne(t,e){t.d.push(e)}function uKr(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function pRe(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(lq(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&cRe(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),lq(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))pRe(t.c[i],e,r,n,o);return e}function WIt(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 hN(t=!1,e="",r=""){return new fRe(r,e,t)}function KIt(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=WIt(u,a),d=c.length;if(u===a){Zne(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=hN(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,hq(p,t),hq(m,p),Zne(p,r);return}if(d<l&&d<a.length){let p=hN(!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=hN(!0,e.substring(o+d),h);Zne(b,r),p.c[h]=b,hq(p,t),hq(b,p),hq(m,p);return}o+=l-1,t=s}else{let u=hN(!0,a,i);Zne(u,r),t.c[i]=u,hq(u,t);return}}}function M8(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){pRe(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(cRe(e,a,o).isBounded&&(i[a]=[]),lq(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&&M8(t.c[e[r]],e,r+1,n,o,i),M8(t,e,r+1,n-1,o,i);for(let a in t.c)M8(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&M8(t.c[a],e,r+1,n-1,o,i)}}}function mRe(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,M8(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=WIt(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 pRe(t,i,e,r,n),i}}function GIt(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||uKr(t,r)}else return!1}return!0}var fRe,JIt=w(()=>{dRe();Ds();fRe=class{constructor(e,r,n){Cc(this,"k");Cc(this,"s");Cc(this,"c",{});Cc(this,"d",[]);Cc(this,"e");Cc(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 YIt(){return{root:null}}function ZIt(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 XIt(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 QIt(t,e,r,n=!0,o="asc",i=!1){let a=i?rMt:tMt,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 eMt(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=cKr(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=lKr(e);if(n){let u=o?rMt:tMt;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 lKr(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 cKr(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 tMt(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 rMt(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,S,x,O,P;do{let j=Math.sin(h),$=Math.cos(h);x=Math.sqrt(m*j*(m*j)+(f*p-d*m*$)*(f*p-d*m*$)),O=d*p+f*m*$,P=Math.atan2(x,O),y=f*m*j/x,S=1-y*y;let k=O-2*d*p/S,z=n/16*S*(4+n*(4-3*S));b=h,h=u+(1-z)*n*y*(P+z*x*(k+z*O*(-1+2*k*k)))}while(Math.abs(h-b)>1e-12&&--g>0);let E=S*(6378137*6378137-o*o)/(o*o),A=1+E/16384*(4096+E*(-768+E*(320-175*E))),I=E/1024*(256+E*(-128+E*(74-47*E))),R=I*x*(O-2*d*p/S+I/4*(O*(-1+2*x*x)-I/6*P*(-3+4*x*x)*(-3+4*P*P)));return o*A*(P-R)}var nMt=w(()=>{});function Xne(t,e,r=0,n){if(e===0)throw qt("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[S,x]=b[y],O=x*e,P=o.get(S)?.[0];P!==void 0?o.set(S,[P*1.5+O,(o?.get(S)?.[1]||0)+1]):o.set(S,[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 hRe(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 R8=w(()=>{ic()});function gRe(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Qne(t,e,r,n=.8){let o=gRe(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 eoe=w(()=>{});function dKr(t,e,r,n,o){let i=wi(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 fKr(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=wi(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 pKr(t,e,r,n){let o=wi(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 mKr(t,e,r){t.tokenOccurrences[e][r]--}function hKr(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=wi(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,b=hRe(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,b])}return d}function iMt(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)){iMt(t,e,a,n,s);continue}if(XO(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:nRe(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:DIt(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:hN(),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:BIt(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:YIt(),isArray:u};break;default:throw qt("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function gKr(t,e,r,n,o,i,a,s){return u=>{let l=wi(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;LIt(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),KIt(d,p,l);break}case"Flat":{qIt(d,u,l);break}case"BKD":{ZIt(d,u,[l]);break}}}}function yKr(t,e,r,n,o,i,a,s,u,l){if(XO(i))return bKr(e,r,o,n);let c=gKr(t,e,r,n,a,s,u,l);if(!fq(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function bKr(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=gRe(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function oMt(t,e,r,n,o,i,a,s,u){let l=wi(e.sharedInternalDocumentStore,n);if(XO(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return kIt(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),GIt(d,p,l);return!0}case"Flat":return UIt(d,l,o),!0;case"BKD":return XIt(d,o,l),!1}}function _Kr(t,e,r,n,o,i,a,s,u){if(!fq(i))return oMt(t,e,r,n,o,i,a,s,u);let l=rRe(i),c=o,d=c.length;for(let f=0;f<d;f++)oMt(t,e,r,n,c[f],l,a,s,u);return!0}function vKr(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw qt("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=mRe(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(lq(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function wKr(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 qt("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=eRe(f,m),y=QIt(s.root,p,g,h,void 0,b);ki(o[i],y.flatMap(({docIDs:S})=>S))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=eMt(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=mRe(s,{term:p,exact:!0});ki(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw qt("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?HIt:zIt;ki(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=uRe(s,f,!1);break}case"gte":{p=uRe(s,f,!0);break}case"lt":{p=lRe(s,f,!1);break}case"lte":{p=lRe(s,f,!0);break}case"eq":{p=FIt(s,f)??[];break}case"between":{let[m,h]=f;p=jIt(s,m,h);break}}ki(o[i],p)}}return cq(Object.values(o))}function SKr(t){return t.searchableProperties}function xKr(t){return t.searchablePropertiesWithTypes}function aMt(t){let e=hN(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]=aMt(t.c[r]);return e}function CKr(t){return{numberToDocumentId:new Map(t)}}function OKr(t){return Array.from(t.numberToDocumentId.entries())}function PKr(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:aMt(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:CKr(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 EKr(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:OKr(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function sMt(){return{create:iMt,insert:yKr,remove:_Kr,insertDocumentScoreParameters:dKr,insertTokenScoreParameters:fKr,removeDocumentScoreParameters:pKr,removeTokenScoreParameters:mKr,calculateResultScores:hKr,search:vKr,searchByWhereClause:wKr,getSearchableProperties:SKr,getSearchablePropertiesWithTypes:xKr,load:PKr,save:EKr}}var yRe=w(()=>{ic();$It();VIt();JIt();nMt();Ds();R8();eoe();I8();gg()});function uMt(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=uMt(t,e,s,n,u);ki(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!XO(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 qt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function AKr(t,e,r,n){return n?.enabled!==!1?uMt(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function IKr(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=wi(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&bRe(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function lMt(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)NKr(t,r);t.isSorted=!0}function MKr(t,e,r){return e[1].localeCompare(r[1],hIt(t))}function RKr(t,e){return t[1]-e[1]}function jKr(t,e){return e[1]?-1:1}function NKr(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=MKr.bind(null,t.language);break;case"number":n=RKr.bind(null);break;case"boolean":n=jKr.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 DKr(t){let e=Object.keys(t.sorts);for(let r of e)bRe(t,r)}function bRe(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 LKr(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=wi(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function FKr(t,e,r){if(!t.enabled)throw qt("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw qt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return bRe(t,n),lMt(t),e.sort((a,s)=>{let u=i.docs.get(wi(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(wi(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 kKr(t){return t.enabled?t.sortableProperties:[]}function $Kr(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function BKr(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 qKr(t){if(!t.enabled)return{enabled:!1};DKr(t),lMt(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 cMt(){return{create:AKr,insert:IKr,remove:LKr,save:qKr,load:BKr,sortBy:FKr,getSortableProperties:kKr,getSortablePropertiesWithTypes:$Kr}}var _Re=w(()=>{ic();I8();gg();Ds();Gne()});function HKr(t){return t<192||t>383?t:zKr[t-192]||t}function dMt(t){let e=[];for(let r=0;r<t.length;r++)e[r]=HKr(t.charCodeAt(r));return String.fromCharCode(...e)}var zKr,fMt=w(()=>{zKr=[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 mMt(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(vRe),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(pMt),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+Ex+roe+"[^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(pMt),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(vRe),e&&n.test(e)&&(t=e+VKr[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(vRe),e&&n.test(e)&&(t=e+WKr[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(toe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(toe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(toe),o=new RegExp(GKr),i=new RegExp("^"+Ex+roe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(toe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var VKr,WKr,KKr,roe,Ex,j8,vRe,GKr,toe,pMt,hMt=w(()=>{VKr={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"},WKr={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},KKr="[^aeiou]",roe="[aeiouy]",Ex=KKr+"[^aeiouy]*",j8=roe+"[aeiou]*",vRe="^("+Ex+")?"+j8+Ex,GKr="^("+Ex+")?"+j8+Ex+"("+j8+")?$",toe="^("+Ex+")?"+j8+Ex+j8+Ex,pMt="^("+Ex+")?"+roe});function wRe(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=dMt(e),this.normalizationCache.set(r,e),e)}function JKr(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function gMt(t,e,r){if(e&&e!==this.language)throw qt("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=mIt[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=JKr(n);return this.allowDuplicates?o:Array.from(new Set(o))}function SRe(t={}){if(!t.language)t.language="english";else if(!T8.includes(t.language))throw qt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw qt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=mMt;else throw qt("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 qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:gMt,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:wRe,normalizationCache:new Map};return n.tokenize=gMt.bind(n),n.normalizeToken=wRe,n}var noe=w(()=>{ic();fMt();Gne();hMt()});function ZKr(t){let e={formatElapsedTime:SIt,getDocumentIndexId:xIt,getDocumentProperties:Jne,validateSchema:tRe};for(let r of iRe){let n=r;if(t[n]){if(typeof t[n]!="function")throw qt("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!IIt.includes(r)&&!iRe.includes(r))throw qt("UNSUPPORTED_COMPONENT",r)}function gq({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=A8());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=SRe(a):a=SRe({language:r??"english"}),n.tokenizer&&r)throw qt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=OIt();s||(s=sMt()),l||(l=cMt()),u||(u=PIt()),ZKr(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:XKr()};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 EIt)h[g]=(h[g]??[]).concat(TIt(h,g));let b=h.afterCreate;return b&&MIt(b,h),h}function XKr(){return"{{VERSION}}"}var yMt=w(()=>{I8();oRe();AIt();XA();yRe();gg();_Re();noe();ic();Ds()});var bMt=w(()=>{});var xRe=w(()=>{I8();oRe();yRe();noe();_Re();gg()});var ooe,CRe,ORe,PRe=w(()=>{ooe="fulltext",CRe="hybrid",ORe="vector"});var QA,eI,ERe=w(()=>{PRe();QA=Symbol("orama.insertions"),eI=Symbol("orama.removals")});function TRe(t){typeof t[QA]!="number"&&(queueMicrotask(()=>{t[QA]=void 0}),t[QA]=0),t[QA]>1e3?(_Mt("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[QA]=-1):t[QA]>=0&&t[QA]++}function ARe(t){typeof t[eI]!="number"&&(queueMicrotask(()=>{t[eI]=void 0}),t[eI]=0),t[eI]>1e3?(_Mt("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[eI]=-1):t[eI]>=0&&t[eI]++}var _Mt,IRe=w(()=>{ERe();_Mt=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function N8(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw qt("SCHEMA_VALIDATION_FAILURE",i);return Qs(t.index.beforeInsert)||Qs(t.index.insert)||Qs(t.index.afterInsert)?rGr(t,e,r,n,o):nGr(t,e,r,n,o)}async function rGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await eb(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];vMt(m,h,f,p)}return await oGr(t,s,l,d,u,r,e,o),n||await eb(t.afterInsert,t,s,e),TRe(t),s}function nGr(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw qt("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||eb(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];vMt(m,h,f,p)}return iGr(t,s,l,d,u,r,e,o),n||eb(t.afterInsert,t,s,e),TRe(t),s}function vMt(t,e,r,n){if(!(CIt(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(XO(e)&&Array.isArray(n))&&!(fq(e)&&Array.isArray(n))&&!(eGr.has(e)&&tGr.has(t))&&t!==e)throw qt("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function oGr(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 iGr(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 eGr,tGr,MRe=w(()=>{xRe();Ds();XA();IRe();ic();eGr=new Set(["enum","enum[]"]),tGr=new Set(["string","number"])});function gN(t,e,r,n){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)?aGr(t,e,r,n):sGr(t,e,r,n)}async function aGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await eb(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 eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ARe(t),o}function sGr(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=hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||eb(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||eb(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),ARe(t),o}function D8(t,e,r,n,o){return Qs(t.index.beforeRemove)||Qs(t.index.remove)||Qs(t.index.afterRemove)||Qs(t.beforeRemoveMultiple)||Qs(t.afterRemoveMultiple)?uGr(t,e,r,n,o):lGr(t,e,r,n,o)}async function uGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,s)));return o||await mN(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 gN(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await mN(t.afterRemoveMultiple,t,a),i}function lGr(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>hg(t.internalDocumentIDStore,wi(t.internalDocumentIDStore,l)));o||mN(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)gN(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||mN(t.afterRemoveMultiple,t,a),i}var RRe=w(()=>{XA();gg();IRe();Ds()});function cGr(t,e){return t[1]-e[1]}function dGr(t,e){return e[1]-t[1]}function fGr(t="desc"){return t.toLowerCase()==="asc"?cGr:dGr}function yq(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(".")?dq(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;wMt(h,m)(f);break}case"number[]":{let h=new Set,b=r[d].ranges,g=wMt(b,m,h);for(let y of f)g(y);break}case"boolean":case"enum":case"string":{SMt(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=SMt(m,p==="boolean[]"?"boolean":"string",new Set);for(let y of f)g(y);break}default:throw qt("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=fGr(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function wMt(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 SMt(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 ioe=w(()=>{ic();Ds()});function bq(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 aoe=w(()=>{});function _q(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 qt("UNKNOWN_GROUP_BY_PROPERTY",y);if(!xMt.includes(i[y]))throw qt("INVALID_GROUP_BY_PROPERTY",y,xMt.join(", "),i[y])}let a=e.map(([g])=>hg(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],S={property:y,perValue:{}},x=new Set;for(let O=0;O<u;O++){let P=s[O],E=dq(P,y);if(typeof E>"u")continue;let A=typeof E!="boolean"?E:""+E,I=S.perValue[A]??{indexes:[],count:0};I.count>=l||(I.indexes.push(O),I.count++,S.perValue[A]=I,x.add(E))}c.push(Array.from(x)),d[y]=S}let f=CMt(c),p=f.length,m=[];for(let g=0;g<p;g++){let y=f[g],S=y.length,x={values:[],indexes:[]},O=[];for(let P=0;P<S;P++){let E=y[P],A=n[P];O.push(d[A].perValue[typeof E!="boolean"?E:""+E].indexes),x.values.push(E)}x.indexes=cq(O).sort((P,E)=>P-E),x.indexes.length!==0&&m.push(x)}let h=m.length,b=Array.from({length:h});for(let g=0;g<h;g++){let y=m[g],S=r.reduce||pGr,x=y.indexes.map(A=>({id:a[A],score:e[A][1],document:s[A]})),O=S.reducer.bind(null,y.values),P=S.getInitialValue(y.indexes.length),E=x.reduce(O,P);b[g]={values:y.values,result:E}}return b}function CMt(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=CMt(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 pGr,xMt,soe=w(()=>{ic();Ds();gg();pGr={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},xMt=["string","number","boolean"]});function OMt(t,e,r){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(uoe,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,S=t.tokenizer.tokenize(d??"",r),x=t.caches.propertiesToSearch;if(!x){let j=t.index.getSearchablePropertiesWithTypes(g);x=t.index.getSearchableProperties(g),x=x.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let j of f)if(!x.includes(j))throw qt("UNKNOWN_INDEX",j,x.join(", "));x=x.filter(j=>f.includes(j))}let O=yN(t.tokenizer,t.index,t.documentsStore,r,e,x,S,t.documentsStore.count(y),n),P=Object.keys(e.where??{}).length>0,E=[];P&&(E=t.index.searchByWhereClause(O,g,e.where));let A=S.length;if(A||f?.length){let j=x.length;for(let $=0;$<j;$++){let k=x[$],z=O.indexMap[k];if(A!==0)for(let D=0;D<A;D++){let B=S[D],q=t.index.search(O,g,k,B);ki(z[B],q)}else{z[""]=[];let D=t.index.search(O,g,k,"");ki(z[""],D)}let V=Object.values(z);O.docsIntersection[k]=Xne(V,e?.boost?.[k]??1,p,A);let Q=O.docsIntersection[k],J=Q.length;for(let D=0;D<J;D++){let[B,q]=Q[D],K=O.uniqueDocsIDs[B];K?O.uniqueDocsIDs[B]=K+q+.5:O.uniqueDocsIDs[B]=q}}}else S.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(P&&(I=bq(E,I)),e.sortBy)if(typeof e.sortBy=="function"){let j=I.map(([z])=>z),k=t.documentsStore.getMultiple(t.data.docs,j).map((z,V)=>[I[V][0],I[V][1],z]);k.sort(e.sortBy),I=k.map(([z,V])=>[z,V])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]);else I=I.sort(wIt);let R;b||(R=m?EMt(t,I,c,l,m):loe(t,I,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof R<"u"&&(N.hits=R.filter(Boolean),h||Yne(N,s)),u){let j=yq(t,I,e.facets);N.facets=j}return e.groupBy&&(N.groups=_q(t,I,e.groupBy)),N.elapsed=t.formatElapsedTime(Qy()-O.timeStart),N}async function a(){t.beforeSearch&&await mq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await pq(t.afterSearch,t,e,r,s),s}return o?a():i()}var PMt=w(()=>{R8();ioe();aoe();soe();XA();gg();ic();Ds();bN()});function jRe(t,e,r="english"){let n=Qy(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw qt("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?qt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):qt("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let y=Qne(s.value,p,f,e.similarity).map(([j,$])=>[wi(t.internalDocumentIDStore,j),$]),S=t.caches.propertiesToSearch;if(!S){let j=t.index.getSearchablePropertiesWithTypes(b);S=t.index.getSearchableProperties(b),S=S.filter($=>j[$].startsWith("string")),t.caches.propertiesToSearch=S}let x=[],O=yN(t.tokenizer,t.index,t.documentsStore,r,e,S,x,t.documentsStore.count(g),n),P=[];h&&(P=t.index.searchByWhereClause(O,b,e.where),y=bq(P,y));let E=[];m&&(E=yq(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 z={id:hg(t.internalDocumentIDStore,$[0]),score:$[1],document:k};A[j]=z}}let I=[];e.groupBy&&(I=_q(t,y,e.groupBy));let N=Qy()-n;return{count:y.length,hits:A.filter(Boolean),elapsed:{raw:Number(N),formatted:pN(N)},...E?{facets:E}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await mq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await pq(t.afterSearch,t,e,r,s),s}return o?a():i()}var NRe=w(()=>{bN();Ds();ioe();ic();eoe();aoe();soe();gg();XA()});function AMt(t,e,r){let n=Qy(),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=mGr(t,e,r),f=hGr(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,b=yGr(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 qt("UNKNOWN_INDEX",N,y.join(", "));y=y.filter(N=>e.properties.includes(N))}let S=yN(t.tokenizer,t.index,t.documentsStore,r,e,y,g,t.documentsStore.count(m),n),x=Object.keys(e.where??{}).length>0,O=[];x&&(O=t.index.searchByWhereClause(S,p,e.where),b=bq(O,b));let P;c&&(P=yq(t,b,e.facets));let E;e.groupBy&&(E=_q(t,b,e.groupBy));let A=loe(t,b,s,u).filter(Boolean),I=Qy(),R={count:b.length,elapsed:{raw:Number(I-n),formatted:pN(I-n)},hits:A,...P?{facets:P}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);Yne(R,N)}return R}async function a(){t.beforeSearch&&await mq(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await pq(t.afterSearch,t,e,r,s),s}return o?a():i()}function mGr(t,e,r){let n=Qy();e.relevance=Object.assign(uoe,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 qt("UNKNOWN_INDEX",b,c.join(", "));c=c.filter(b=>h.has(b))}let d=yN(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 P=l[O],E=t.index.search(d,s,b,P);ki(d.indexMap[b][P],E)}else{let O=[];d.indexMap[b][""]=O;let P=t.index.search(d,s,b,"");ki(O,P)}let g=d.indexMap[b],y=Object.values(g);d.docsIntersection[b]=Xne(y,e?.boost?.[b]??1,a,f);let S=d.docsIntersection[b],x=S.length;for(let O=0;O<x;O++){let[P,E]=S[O],A=d.uniqueDocsIDs[P];d.uniqueDocsIDs[P]=A?A+E+.5:E}}}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 IMt(p)}function hGr(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 qt("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw qt("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Qne(r.value,i,o,e.similarity).map(([s,u])=>[wi(t.internalDocumentIDStore,s),u]);return IMt(a)}function DRe([,t]){return t}function IMt(t){let e=Math.max.apply(Math,t.map(DRe));return t.map(([r,n])=>[r,n/e])}function TMt(t,e){return t/e}function gGr(t,e){return(r,n)=>r*t+n*e}function yGr(t,e,r,n){let o=Math.max.apply(Math,t.map(DRe)),i=Math.max.apply(Math,e.map(DRe)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:bGr(r),l=new Map,c=t.length,d=gGr(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],b=TMt(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=TMt(h,i),g=l.get(m)??0;l.set(m,g+d(0,b))}return[...l].sort((p,m)=>m[1]-p[1])}function bGr(t){return{text:.5,vector:.5}}var MMt=w(()=>{Ds();aoe();R8();ic();bN();ioe();soe();eoe();gg();bN();XA()});function yN(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 Xc(t,e,r){let n=e.mode??ooe;if(n===ooe)return OMt(t,e,r);if(n===ORe)return jRe(t,e);if(n===CRe)return AMt(t,e);throw qt("INVALID_SEARCH_MODE",n)}function EMt(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=dq(h,o);if(!(typeof b>"u"||a.has(b))&&(a.set(b,!0),c++,!(c<=r)&&(s.push({id:hg(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function loe(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:hg(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var uoe,bN=w(()=>{gg();ic();Ds();PRe();PMt();NRe();MMt();uoe={k:1.2,b:.75,d:.5}});function coe(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 LRe(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 RMt=w(()=>{});var jMt=w(()=>{XA();ic();MRe();RRe();Ds()});var NMt=w(()=>{ic();bN()});var DMt=w(()=>{dRe();Ds();R8();noe()});var L8=w(()=>{yMt();bMt();MRe();RRe();bN();NRe();RMt();jMt();NMt();ERe();xRe();DMt()});function SGr(t,e){let r=LMt(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function LMt(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Bqo,qqo,vGr,wGr,FRe,xGr,doe,FMt=w(()=>{Bqo=new Error("timeout while waiting for mutex to become available"),qqo=new Error("mutex already locked"),vGr=new Error("request for lock canceled"),wGr=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())})},FRe=class{constructor(e,r=vGr){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=LMt(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return wGr(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]=[]),SGr(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}};xGr=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())})},doe=class{constructor(e){this._semaphore=new FRe(1,e)}acquire(){return xGr(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 kMt=v(()=>{});var Ln=v((foe,$Mt)=>{(function(t,e){typeof foe=="object"?$Mt.exports=foe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(foe,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=kMt()}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 S;return g.prototype=y,S=new g,g.prototype=null,S}}(),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,S=g.words,x=this.sigBytes,O=g.sigBytes;if(this.clamp(),x%4)for(var P=0;P<O;P++){var E=S[P>>>2]>>>24-P%4*8&255;y[x+P>>>2]|=E<<24-(x+P)%4*8}else for(var A=0;A<O;A+=4)y[x+A>>>2]=S[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=[],S=0;S<g;S+=4)y.push(o());return new l.init(y,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var y=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var P=y[O>>>2]>>>24-O%4*8&255;x.push((P>>>4).toString(16)),x.push((P&15).toString(16))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x<y;x+=2)S[x>>>3]|=parseInt(g.substr(x,2),16)<<24-x%8*4;return new l.init(S,y/2)}},f=c.Latin1={stringify:function(g){for(var y=g.words,S=g.sigBytes,x=[],O=0;O<S;O++){var P=y[O>>>2]>>>24-O%4*8&255;x.push(String.fromCharCode(P))}return x.join("")},parse:function(g){for(var y=g.length,S=[],x=0;x<y;x++)S[x>>>2]|=(g.charCodeAt(x)&255)<<24-x%4*8;return new l.init(S,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,S=this._data,x=S.words,O=S.sigBytes,P=this.blockSize,E=P*4,A=O/E;g?A=e.ceil(A):A=e.max((A|0)-this._minBufferSize,0);var I=A*P,R=e.min(I*4,O);if(I){for(var N=0;N<I;N+=P)this._doProcessBlock(x,N);y=x.splice(0,I),S.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,S){return new g.init(S).finalize(y)}},_createHmacHelper:function(g){return function(y,S){return new b.HMAC.init(g,S).finalize(y)}}}),b=a.algo={};return a}(Math);return t})});var F8=v((poe,BMt)=>{(function(t,e){typeof poe=="object"?BMt.exports=poe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(poe,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 UMt=v((moe,qMt)=>{(function(t,e){typeof moe=="object"?qMt.exports=moe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(moe,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 HMt=v((hoe,zMt)=>{(function(t,e){typeof hoe=="object"?zMt.exports=hoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(hoe,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 tI=v((goe,VMt)=>{(function(t,e){typeof goe=="object"?VMt.exports=goe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(goe,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 KMt=v((yoe,WMt)=>{(function(t,e){typeof yoe=="object"?WMt.exports=yoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(yoe,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 S=d.charAt(64);if(S)for(;f.length%4;)f.push(S);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 rI=v((boe,GMt)=>{(function(t,e){typeof boe=="object"?GMt.exports=boe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(boe,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,S=p[m+0],x=p[m+1],O=p[m+2],P=p[m+3],E=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],z=p[m+12],V=p[m+13],Q=p[m+14],J=p[m+15],D=y[0],B=y[1],q=y[2],K=y[3];D=l(D,B,q,K,S,7,s[0]),K=l(K,D,B,q,x,12,s[1]),q=l(q,K,D,B,O,17,s[2]),B=l(B,q,K,D,P,22,s[3]),D=l(D,B,q,K,E,7,s[4]),K=l(K,D,B,q,A,12,s[5]),q=l(q,K,D,B,I,17,s[6]),B=l(B,q,K,D,R,22,s[7]),D=l(D,B,q,K,N,7,s[8]),K=l(K,D,B,q,j,12,s[9]),q=l(q,K,D,B,$,17,s[10]),B=l(B,q,K,D,k,22,s[11]),D=l(D,B,q,K,z,7,s[12]),K=l(K,D,B,q,V,12,s[13]),q=l(q,K,D,B,Q,17,s[14]),B=l(B,q,K,D,J,22,s[15]),D=c(D,B,q,K,x,5,s[16]),K=c(K,D,B,q,I,9,s[17]),q=c(q,K,D,B,k,14,s[18]),B=c(B,q,K,D,S,20,s[19]),D=c(D,B,q,K,A,5,s[20]),K=c(K,D,B,q,$,9,s[21]),q=c(q,K,D,B,J,14,s[22]),B=c(B,q,K,D,E,20,s[23]),D=c(D,B,q,K,j,5,s[24]),K=c(K,D,B,q,Q,9,s[25]),q=c(q,K,D,B,P,14,s[26]),B=c(B,q,K,D,N,20,s[27]),D=c(D,B,q,K,V,5,s[28]),K=c(K,D,B,q,O,9,s[29]),q=c(q,K,D,B,R,14,s[30]),B=c(B,q,K,D,z,20,s[31]),D=d(D,B,q,K,A,4,s[32]),K=d(K,D,B,q,N,11,s[33]),q=d(q,K,D,B,k,16,s[34]),B=d(B,q,K,D,Q,23,s[35]),D=d(D,B,q,K,x,4,s[36]),K=d(K,D,B,q,E,11,s[37]),q=d(q,K,D,B,R,16,s[38]),B=d(B,q,K,D,$,23,s[39]),D=d(D,B,q,K,V,4,s[40]),K=d(K,D,B,q,S,11,s[41]),q=d(q,K,D,B,P,16,s[42]),B=d(B,q,K,D,I,23,s[43]),D=d(D,B,q,K,j,4,s[44]),K=d(K,D,B,q,z,11,s[45]),q=d(q,K,D,B,J,16,s[46]),B=d(B,q,K,D,O,23,s[47]),D=f(D,B,q,K,S,6,s[48]),K=f(K,D,B,q,R,10,s[49]),q=f(q,K,D,B,Q,15,s[50]),B=f(B,q,K,D,A,21,s[51]),D=f(D,B,q,K,z,6,s[52]),K=f(K,D,B,q,P,10,s[53]),q=f(q,K,D,B,$,15,s[54]),B=f(B,q,K,D,x,21,s[55]),D=f(D,B,q,K,N,6,s[56]),K=f(K,D,B,q,J,10,s[57]),q=f(q,K,D,B,I,15,s[58]),B=f(B,q,K,D,V,21,s[59]),D=f(D,B,q,K,E,6,s[60]),K=f(K,D,B,q,k,10,s[61]),q=f(q,K,D,B,O,15,s[62]),B=f(B,q,K,D,j,21,s[63]),y[0]=y[0]+D|0,y[1]=y[1]+B|0,y[2]=y[2]+q|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 S=this._hash,x=S.words,O=0;O<4;O++){var P=x[O];x[O]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}return S},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,b,g,y,S){var x=p+(m&h|~m&b)+g+S;return(x<<y|x>>>32-y)+m}function c(p,m,h,b,g,y,S){var x=p+(m&b|h&~b)+g+S;return(x<<y|x>>>32-y)+m}function d(p,m,h,b,g,y,S){var x=p+(m^h^b)+g+S;return(x<<y|x>>>32-y)+m}function f(p,m,h,b,g,y,S){var x=p+(h^(m|~b))+g+S;return(x<<y|x>>>32-y)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var kRe=v((_oe,JMt)=>{(function(t,e){typeof _oe=="object"?JMt.exports=_oe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(_oe,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 woe=v((voe,YMt)=>{(function(t,e){typeof voe=="object"?YMt.exports=voe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(voe,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],S=p[5],x=p[6],O=p[7],P=0;P<64;P++){if(P<16)l[P]=d[f+P]|0;else{var E=l[P-15],A=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,I=l[P-2],R=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[P]=A+l[P-7]+R+l[P-16]}var N=y&S^~y&x,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),z=O+k+N+u[P]+l[P],V=$+j;O=x,x=S,S=y,y=g+z|0,g=b,b=h,h=m,m=z+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]+S|0,p[6]=p[6]+x|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 XMt=v((Soe,ZMt)=>{(function(t,e,r){typeof Soe=="object"?ZMt.exports=Soe=e(Ln(),woe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Soe,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 $Re=v((xoe,QMt)=>{(function(t,e,r){typeof xoe=="object"?QMt.exports=xoe=e(Ln(),F8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(xoe,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],S=m[4],x=m[5],O=m[6],P=m[7],E=h.high,A=h.low,I=b.high,R=b.low,N=g.high,j=g.low,$=y.high,k=y.low,z=S.high,V=S.low,Q=x.high,J=x.low,D=O.high,B=O.low,q=P.high,K=P.low,H=E,ee=A,U=I,W=R,Y=N,ae=j,Oe=$,le=k,Be=z,ze=V,rt=Q,cr=J,wn=D,Le=B,pt=q,mt=K,ht=0;ht<80;ht++){var te,et,Re=c[ht];if(ht<16)et=Re.high=f[p+ht*2]|0,te=Re.low=f[p+ht*2+1]|0;else{var Pe=c[ht-15],oe=Pe.high,se=Pe.low,ce=(oe>>>1|se<<31)^(oe>>>8|se<<24)^oe>>>7,Ce=(se>>>1|oe<<31)^(se>>>8|oe<<24)^(se>>>7|oe<<25),Je=c[ht-2],ir=Je.high,ea=Je.low,ta=(ir>>>19|ea<<13)^(ir<<3|ea>>>29)^ir>>>6,xc=(ea>>>19|ir<<13)^(ea<<3|ir>>>29)^(ea>>>6|ir<<26),Cd=c[ht-7],qi=Cd.high,lp=Cd.low,yf=c[ht-16],bf=yf.high,Sn=yf.low;te=Ce+lp,et=ce+qi+(te>>>0<Ce>>>0?1:0),te=te+xc,et=et+ta+(te>>>0<xc>>>0?1:0),te=te+Sn,et=et+bf+(te>>>0<Sn>>>0?1:0),Re.high=et,Re.low=te}var _f=Be&rt^~Be&wn,sC=ze&cr^~ze&Le,kb=H&U^H&Y^U&Y,is=ee&W^ee&ae^W&ae,$s=(H>>>28|ee<<4)^(H<<30|ee>>>2)^(H<<25|ee>>>7),La=(ee>>>28|H<<4)^(ee<<30|H>>>2)^(ee<<25|H>>>7),vf=(Be>>>14|ze<<18)^(Be>>>18|ze<<14)^(Be<<23|ze>>>9),Od=(ze>>>14|Be<<18)^(ze>>>18|Be<<14)^(ze<<23|Be>>>9),ws=l[ht],cp=ws.high,wf=ws.low,In=mt+Od,Ye=pt+vf+(In>>>0<mt>>>0?1:0),In=In+sC,Ye=Ye+_f+(In>>>0<sC>>>0?1:0),In=In+wf,Ye=Ye+cp+(In>>>0<wf>>>0?1:0),In=In+te,Ye=Ye+et+(In>>>0<te>>>0?1:0),Sf=La+is,mm=$s+kb+(Sf>>>0<La>>>0?1:0);pt=wn,mt=Le,wn=rt,Le=cr,rt=Be,cr=ze,ze=le+In|0,Be=Oe+Ye+(ze>>>0<le>>>0?1:0)|0,Oe=Y,le=ae,Y=U,ae=W,U=H,W=ee,ee=In+Sf|0,H=Ye+mm+(ee>>>0<In>>>0?1:0)|0}A=h.low=A+ee,h.high=E+H+(A>>>0<ee>>>0?1:0),R=b.low=R+W,b.high=I+U+(R>>>0<W>>>0?1:0),j=g.low=j+ae,g.high=N+Y+(j>>>0<ae>>>0?1:0),k=y.low=k+le,y.high=$+Oe+(k>>>0<le>>>0?1:0),V=S.low=V+ze,S.high=z+Be+(V>>>0<ze>>>0?1:0),J=x.low=J+cr,x.high=Q+rt+(J>>>0<cr>>>0?1:0),B=O.low=B+Le,O.high=D+wn+(B>>>0<Le>>>0?1:0),K=P.low=K+mt,P.high=q+pt+(K>>>0<mt>>>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 tRt=v((Coe,eRt)=>{(function(t,e,r){typeof Coe=="object"?eRt.exports=Coe=e(Ln(),F8(),$Re()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Coe,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 nRt=v((Ooe,rRt)=>{(function(t,e,r){typeof Ooe=="object"?rRt.exports=Ooe=e(Ln(),F8()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Ooe,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 S=1,x=0;x<24;x++){for(var O=0,P=0,E=0;E<7;E++){if(S&1){var A=(1<<E)-1;A<32?P^=1<<A:O^=1<<A-32}S&128?S=S<<1^113:S<<=1}d[x]=s.create(O,P)}})();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 S=m[h+2*y],x=m[h+2*y+1];S=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,x=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360;var O=b[y];O.high^=x,O.low^=S}for(var P=0;P<24;P++){for(var E=0;E<5;E++){for(var A=0,I=0,R=0;R<5;R++){var O=b[E+5*R];A^=O.high,I^=O.low}var N=f[E];N.high=A,N.low=I}for(var E=0;E<5;E++)for(var j=f[(E+4)%5],$=f[(E+1)%5],k=$.high,z=$.low,A=j.high^(k<<1|z>>>31),I=j.low^(z<<1|k>>>31),R=0;R<5;R++){var O=b[E+5*R];O.high^=A,O.low^=I}for(var V=1;V<25;V++){var A,I,O=b[V],Q=O.high,J=O.low,D=l[V];D<32?(A=Q<<D|J>>>32-D,I=J<<D|Q>>>32-D):(A=J<<D-32|Q>>>64-D,I=Q<<D-32|J>>>64-D);var B=f[c[V]];B.high=A,B.low=I}var q=f[0],K=b[0];q.high=K.high,q.low=K.low;for(var E=0;E<5;E++)for(var R=0;R<5;R++){var V=E+5*R,O=b[V],H=f[V],ee=f[(E+1)%5+5*R],U=f[(E+2)%5+5*R];O.high=H.high^~ee.high&U.high,O.low=H.low^~ee.low&U.low}var O=b[0],W=d[P];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 S=this._state,x=this.cfg.outputLength/8,O=x/8,P=[],E=0;E<O;E++){var A=S[E],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,P.push(R),P.push(I)}return new o.init(P,x)},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 iRt=v((Poe,oRt)=>{(function(t,e){typeof Poe=="object"?oRt.exports=Poe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Poe,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(x,O){for(var P=0;P<16;P++){var E=O+P,A=x[E];x[E]=(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,z=c.words,V,Q,J,D,B,q,K,H,ee,U;q=V=I[0],K=Q=I[1],H=J=I[2],ee=D=I[3],U=B=I[4];for(var W,P=0;P<80;P+=1)W=V+x[O+j[P]]|0,P<16?W+=m(Q,J,D)+R[0]:P<32?W+=h(Q,J,D)+R[1]:P<48?W+=b(Q,J,D)+R[2]:P<64?W+=g(Q,J,D)+R[3]:W+=y(Q,J,D)+R[4],W=W|0,W=S(W,k[P]),W=W+B|0,V=B,B=D,D=S(J,10),J=Q,Q=W,W=q+x[O+$[P]]|0,P<16?W+=y(K,H,ee)+N[0]:P<32?W+=g(K,H,ee)+N[1]:P<48?W+=b(K,H,ee)+N[2]:P<64?W+=h(K,H,ee)+N[3]:W+=m(K,H,ee)+N[4],W=W|0,W=S(W,z[P]),W=W+U|0,q=U,U=ee,ee=S(H,10),H=K,K=W;W=I[1]+J+ee|0,I[1]=I[2]+D+U|0,I[2]=I[3]+B+q|0,I[3]=I[4]+V+K|0,I[4]=I[0]+Q+H|0,I[0]=W},_doFinalize:function(){var x=this._data,O=x.words,P=this._nDataBytes*8,E=x.sigBytes*8;O[E>>>5]|=128<<24-E%32,O[(E+64>>>9<<4)+14]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360,x.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 x=i.clone.call(this);return x._hash=this._hash.clone(),x}});function m(x,O,P){return x^O^P}function h(x,O,P){return x&O|~x&P}function b(x,O,P){return(x|~O)^P}function g(x,O,P){return x&P|O&~P}function y(x,O,P){return x^(O|~P)}function S(x,O){return x<<O|x>>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var Toe=v((Eoe,aRt)=>{(function(t,e){typeof Eoe=="object"?aRt.exports=Eoe=e(Ln()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Eoe,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 uRt=v((Aoe,sRt)=>{(function(t,e,r){typeof Aoe=="object"?sRt.exports=Aoe=e(Ln(),woe(),Toe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Aoe,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 S=f.update(c).finalize(m);f.reset();for(var x=S.words,O=x.length,P=S,E=1;E<y;E++){P=f.finalize(P),f.reset();for(var A=P.words,I=0;I<O;I++)x[I]^=A[I]}p.concat(S),b[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var QO=v((Ioe,lRt)=>{(function(t,e,r){typeof Ioe=="object"?lRt.exports=Ioe=e(Ln(),kRe(),Toe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(Ioe,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 Ll=v((Moe,cRt)=>{(function(t,e,r){typeof Moe=="object"?cRt.exports=Moe=e(Ln(),QO()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(Moe,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:E}return function(j){return{encrypt:function($,k,z){return N(k).encrypt(j,$,k,z)},decrypt:function($,k,z){return N(k).decrypt(j,$,k,z)}}}}()}),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 z=this._cipher,V=z.blockSize;j.call(this,$,k,V),z.encryptBlock($,k),this._prevBlock=$.slice(k,k+V)}}),N.Decryptor=N.extend({processBlock:function($,k){var z=this._cipher,V=z.blockSize,Q=$.slice(k,k+V);z.decryptBlock($,k),j.call(this,$,k,V),this._prevBlock=Q}});function j($,k,z){var V,Q=this._iv;Q?(V=Q,this._iv=e):V=this._prevBlock;for(var J=0;J<z;J++)$[k+J]^=V[J]}return N}(),g=r.pad={},y=g.Pkcs7={pad:function(N,j){for(var $=j*4,k=$-N.sigBytes%$,z=k<<24|k<<16|k<<8|k,V=[],Q=0;Q<k;Q+=4)V.push(z);var J=i.create(V,k);N.concat(J)},unpad:function(N){var j=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=j}},S=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}),x=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),O=r.format={},P=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),x.create({ciphertext:$,salt:j})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:P}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=N.createEncryptor($,k),V=z.finalize(j),Q=z.cfg;return x.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 z=N.createDecryptor($,k).finalize(j.ciphertext);return z},_parse:function(N,j){return typeof N=="string"?j.parse(N,this):N}}),A=r.kdf={},I=A.OpenSSL={execute:function(N,j,$,k,z){if(k||(k=i.random(64/8)),z)var V=d.create({keySize:j+$,hasher:z}).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,x.create({key:V,iv:Q,salt:k})}},R=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:I}),encrypt:function(N,j,$,k){k=this.cfg.extend(k);var z=k.kdf.execute($,N.keySize,N.ivSize,k.salt,k.hasher);k.iv=z.iv;var V=E.encrypt.call(this,N,j,z.key,k);return V.mixIn(z),V},decrypt:function(N,j,$,k){k=this.cfg.extend(k),j=this._parse(j,k.format);var z=k.kdf.execute($,N.keySize,N.ivSize,j.salt,k.hasher);k.iv=z.iv;var V=E.decrypt.call(this,N,j,z.key,k);return V}})}()})});var fRt=v((Roe,dRt)=>{(function(t,e,r){typeof Roe=="object"?dRt.exports=Roe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Roe,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 mRt=v((joe,pRt)=>{(function(t,e,r){typeof joe=="object"?pRt.exports=joe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(joe,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 gRt=v((Noe,hRt)=>{(function(t,e,r){typeof Noe=="object"?hRt.exports=Noe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Noe,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 bRt=v((Doe,yRt)=>{(function(t,e,r){typeof Doe=="object"?yRt.exports=Doe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Doe,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 vRt=v((Loe,_Rt)=>{(function(t,e,r){typeof Loe=="object"?_Rt.exports=Loe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Loe,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 SRt=v((Foe,wRt)=>{(function(t,e,r){typeof Foe=="object"?wRt.exports=Foe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Foe,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 CRt=v((koe,xRt)=>{(function(t,e,r){typeof koe=="object"?xRt.exports=koe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(koe,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 PRt=v(($oe,ORt)=>{(function(t,e,r){typeof $oe=="object"?ORt.exports=$oe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})($oe,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 TRt=v((Boe,ERt)=>{(function(t,e,r){typeof Boe=="object"?ERt.exports=Boe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Boe,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 IRt=v((qoe,ARt)=>{(function(t,e,r){typeof qoe=="object"?ARt.exports=qoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(qoe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var RRt=v((Uoe,MRt)=>{(function(t,e,r){typeof Uoe=="object"?MRt.exports=Uoe=e(Ln(),Ll()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(Uoe,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 NRt=v((zoe,jRt)=>{(function(t,e,r){typeof zoe=="object"?jRt.exports=zoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(zoe,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 S=0,x=0,y=0;y<256;y++){var O=x^x<<1^x<<2^x<<3^x<<4;O=O>>>8^O&255^99,i[S]=O,a[O]=S;var P=g[S],E=g[P],A=g[E],I=g[O]*257^O*16843008;s[S]=I<<24|I>>>8,u[S]=I<<16|I>>>16,l[S]=I<<8|I>>>24,c[S]=I;var I=A*16843009^E*65537^P*257^S*16843008;d[O]=I<<24|I>>>8,f[O]=I<<16|I>>>16,p[O]=I<<8|I>>>24,m[O]=I,S?(S=P^g[g[g[A^P]]],x^=g[g[x]]):S=x=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,S=y.words,x=y.sigBytes/4,O=this._nRounds=x+6,P=(O+1)*4,E=this._keySchedule=[],A=0;A<P;A++)A<x?E[A]=S[A]:(g=E[A-1],A%x?x>6&&A%x==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/x|0]<<24),E[A]=E[A-x]^g);for(var I=this._invKeySchedule=[],R=0;R<P;R++){var A=P-R;if(R%4)var g=E[A];else var g=E[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 S=g[y+1];g[y+1]=g[y+3],g[y+3]=S,this._doCryptBlock(g,y,this._invKeySchedule,d,f,p,m,a);var S=g[y+1];g[y+1]=g[y+3],g[y+3]=S},_doCryptBlock:function(g,y,S,x,O,P,E,A){for(var I=this._nRounds,R=g[y]^S[0],N=g[y+1]^S[1],j=g[y+2]^S[2],$=g[y+3]^S[3],k=4,z=1;z<I;z++){var V=x[R>>>24]^O[N>>>16&255]^P[j>>>8&255]^E[$&255]^S[k++],Q=x[N>>>24]^O[j>>>16&255]^P[$>>>8&255]^E[R&255]^S[k++],J=x[j>>>24]^O[$>>>16&255]^P[R>>>8&255]^E[N&255]^S[k++],D=x[$>>>24]^O[R>>>16&255]^P[N>>>8&255]^E[j&255]^S[k++];R=V,N=Q,j=J,$=D}var V=(A[R>>>24]<<24|A[N>>>16&255]<<16|A[j>>>8&255]<<8|A[$&255])^S[k++],Q=(A[N>>>24]<<24|A[j>>>16&255]<<16|A[$>>>8&255]<<8|A[R&255])^S[k++],J=(A[j>>>24]<<24|A[$>>>16&255]<<16|A[R>>>8&255]<<8|A[N&255])^S[k++],D=(A[$>>>24]<<24|A[R>>>16&255]<<16|A[N>>>8&255]<<8|A[j&255])^S[k++];g[y]=V,g[y+1]=Q,g[y+2]=J,g[y+3]=D},keySize:256/32});e.AES=n._createHelper(b)}(),t.AES})});var LRt=v((Hoe,DRt)=>{(function(t,e,r){typeof Hoe=="object"?DRt.exports=Hoe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Hoe,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 S=a[y]-1;g[y]=b[S>>>5]>>>31-S%32&1}for(var x=this._subKeys=[],O=0;O<16;O++){for(var P=x[O]=[],E=u[O],y=0;y<24;y++)P[y/6|0]|=g[(s[y]-1+E)%28]<<31-y%6,P[4+(y/6|0)]|=g[28+(s[y+24]-1+E)%28]<<31-y%6;P[0]=P[0]<<1|P[0]>>>31;for(var y=1;y<7;y++)P[y]=P[y]>>>(y-1)*4+3;P[7]=P[7]<<5|P[7]>>>27}for(var A=this._invSubKeys=[],y=0;y<16;y++)A[y]=x[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 S=g[y],x=this._lBlock,O=this._rBlock,P=0,E=0;E<8;E++)P|=l[E][((O^S[E])&c[E])>>>0];this._lBlock=O,this._rBlock=x^P}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),S=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(S))},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 kRt=v((Voe,FRt)=>{(function(t,e,r){typeof Voe=="object"?FRt.exports=Voe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Voe,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 BRt=v((Woe,$Rt)=>{(function(t,e,r){typeof Woe=="object"?$Rt.exports=Woe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Woe,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,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;m[0]^=y,m[1]^=x,m[2]^=S,m[3]^=O,m[4]^=y,m[5]^=x,m[6]^=S,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 URt=v((Koe,qRt)=>{(function(t,e,r){typeof Koe=="object"?qRt.exports=Koe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Koe,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,S=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x=y>>>16|S&4294901760,O=S<<16|y&65535;p[0]^=y,p[1]^=x,p[2]^=S,p[3]^=O,p[4]^=y,p[5]^=x,p[6]^=S,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 HRt=v((Goe,zRt)=>{(function(t,e,r){typeof Goe=="object"?zRt.exports=Goe=e(Ln(),tI(),rI(),QO(),Ll()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(Goe,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,S=h&255,x=m.sbox[0][b]+m.sbox[1][g];return x=x^m.sbox[2][y],x=x+m.sbox[3][S],x}function c(m,h,b){let g=h,y=b,S;for(let x=0;x<i;++x)g=g^m.pbox[x],y=l(m,g)^y,S=g,g=y,y=S;return S=g,g=y,y=S,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,S;for(let x=i+1;x>1;--x)g=g^m.pbox[x],y=l(m,g)^y,S=g,g=y,y=S;return S=g,g=y,y=S,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 P=0;P<256;P++)m.sbox[O][P]=s[O][P]}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,S=0,x=0;for(let O=0;O<i+2;O+=2)x=c(m,y,S),y=x.left,S=x.right,m.pbox[O]=y,m.pbox[O+1]=S;for(let O=0;O<4;O++)for(let P=0;P<256;P+=2)x=c(m,y,S),y=x.left,S=x.right,m.sbox[O][P]=y,m.sbox[O][P+1]=S;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 vq=v((Joe,VRt)=>{(function(t,e,r){typeof Joe=="object"?VRt.exports=Joe=e(Ln(),F8(),UMt(),HMt(),tI(),KMt(),rI(),kRe(),woe(),XMt(),$Re(),tRt(),nRt(),iRt(),Toe(),uRt(),QO(),Ll(),fRt(),mRt(),gRt(),bRt(),vRt(),SRt(),CRt(),PRt(),TRt(),IRt(),RRt(),NRt(),LRt(),kRt(),BRt(),URt(),HRt()):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)})(Joe,function(t){return t})});var BRe,CGr,Yoe,WRt=w(()=>{wT();nr();L8();BRe="copilot-index-chunk-",CGr=".json",Yoe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${BRe}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${BRe}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${CGr}`}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,[]);ue().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,ue().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ue().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 LRe(e),n=ue().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(ue().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)),ue().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)),ue().debug&&console.log(`Saved partition ${l+1}/${n}`)}ue().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Rr(`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 Rr("Invalid legacy database format");let l=await gq({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await coe(l,u),l}let r=await this.loadMetadata(),n=await gq({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 Rr("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++):ue().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 coe(n,o),n}catch(e){throw console.error("Error loading database:",e),new Rr(`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}/${BRe}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Rr(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ue().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 Rr("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Rr("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 GRt(t){if(!t)throw new Rr("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Rr("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${Xs.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Rr("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function JRt(t){let e="",{inclusions:r,exclusions:n}=rf(),o=t.vault.getMarkdownFiles().filter(i=>eu(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function bg(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function OGr(){return ue().qaExclusions?bg(ue().qaExclusions):[]}function PGr(){return ue().qaInclusions?bg(ue().qaInclusions):[]}function rf(t){let e=t?.inclusions?bg(t.inclusions):t?.isProject?[]:PGr(),r=t?.exclusions?bg(t.exclusions):t?.isProject?[]:OGr();return{inclusions:e.length>0?k8(e):null,exclusions:r.length>0?k8(r):null}}function eu(t,e,r){return!(r&&KRt(t.path,r)||e&&!KRt(t.path,e))}function k8(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 $8({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function EGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof qRe.TFile){let n=NR(r);if(e.some(o=>n.includes(fF(o))))return!0}return!1}function TGr(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 AGr(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 IGr(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof qRe.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function KRt(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return EGr(t,r??[])||TGr(t,n??[])||AGr(t,o??[])||IGr(t,i??[])}function Zoe(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 Xoe(t){return`#${t}`}function B8(t){return`[[${t.basename}]]`}function YRt(t){return`*.${t}`}var qRe,_g=w(()=>{wT();fN();nr();Cn();qRe=require("obsidian")});var ZRt,Tx,eP,Qoe=w(()=>{fN();wT();yo();nr();Cn();L8();FMt();ZRt=F(vq()),Tx=require("obsidian");WRt();_g();eP=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new doe;xa(async()=>{let r=ue();Tx.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):Tx.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(ie("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),ie("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Rr("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new Yoe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),Tx.Platform.isMobile&&ue().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Rr("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),ie("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 Tx.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(Tx.Platform.isMobile&&ue().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await Xs.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Rr("Orama database not found.")}catch(e){throw fe("Failed to initialize database during save:",e),new Rr("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ue().debug&&ie("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 Tx.Notice("Local Copilot index cleared successfully."),ie("Local Copilot index cleared successfully, new instance created.")}catch(r){throw fe("Error clearing the local Copilot index:",r),new Tx.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Rr("Orama database not found.");try{let r=await Xc(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await D8(this.oramaDb,r.hits.map(n=>n.id),500),ue().debug&&ie(`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(ue().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),ie("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,ZRt.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Rr("Embedding instance not found.");let r=await GRt(e);if(!r||r===0)throw new Rr("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await gq({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return ie(`Created new Orama database for ${this.dbPath}. Embedding model: ${Xs.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 Xc(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await Xc(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 Xc(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,ue().numPartitions),o=await Xc(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await gN(r,o.hits[0].id);try{return await N8(r,e),ie(`${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 N8(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 Xc(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){ie("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 Rr("Failed to initialize Orama database. Please check your embedding model settings.")}}let r=await Xc(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=Xs.getModelName(e);if(!pVe(n,o))return new Tx.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),ie(`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 ie("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Xc(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){ie("Orama database not found during garbage collection. Attempting to initialize...");try{let e=await Xs.getInstance().getEmbeddingsAPI();if(!e)throw new Rr("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Rr("Failed to initialize database after attempt.")}catch(e){throw fe("Failed to initialize database during garbage collection:",e),new Rr("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:(ie("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(o.map(i=>i.path))).join(", ")),o.length===1?await gN(this.oramaDb,o[0].id):await D8(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 Rr("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Rr("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 Rr("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Xc(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw fe("Error checking if database is empty:",e),new Rr("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 Rr("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 Rr("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?ie("Files missing embeddings after integrity check:",r.join(", ")):ie("Index integrity check completed. All documents have embeddings.")}catch(e){throw fe("Error checking index integrity:",e),new Rr("Failed to check index integrity.")}}}});var wq,MGr,eie,XRt=w(()=>{Cl();Fd();nr();wq=require("obsidian");_g();MGr=5e3,eie=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(wq.Platform.isMobile&&ue().disableIndexOnMobile||Fh()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof wq.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}=rf(),u=eu(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(()=>{ue().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},MGr)};this.handleFileDelete=async e=>{e instanceof wq.TFile&&await this.dbOps.removeDocs(e.path)};this.initializeEventListeners()}initializeEventListeners(){ue().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 q8,QRt=w(()=>{q8=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 tP,e1t=w(()=>{tP=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 tie,t1t=w(()=>{Df();tie=class extends xn{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 r1t=w(()=>{e1t();t1t()});var rie=w(()=>{r1t()});var n1t=w(()=>{nAe()});var URe,nie,o1t=w(()=>{rie();n1t();URe=class extends tie{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 x=this.numberOfNewLines(c,0,b);d+=x}else{let x=p+await this.lengthFunction(f);if(x<b){let O=this.numberOfNewLines(c,x,b);d+=O}else if(x>b){let O=this.numberOfNewLines(c,b,x);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 S={...o[l],loc:y};h+=m,u.push(new tP({pageContent:h,metadata:S})),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}},nie=class t extends URe{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 i1t=w(()=>{o1t()});var a1t=w(()=>{i1t()});var s1t=w(()=>{a1t()});var u1t=w(()=>{s1t()});var l1t,Ax,oie,c1t=w(()=>{$r();fN();yo();QRt();nr();Cn();l1t=F(vq());u1t();Ax=require("obsidian");_g();oie=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=ue();this.rateLimiter=new q8(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,xa(async()=>{let i=ue();this.rateLimiter=new q8(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 Ax.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 Ax.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(()=>{ie("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=Xs.getModelName(r),o=nie.fromLanguage("markdown",{chunkSize:wVe}),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:Vl(new Date(a.stat.ctime)).display,modified:Vl(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,l1t.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=rf(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>eu(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(!eu(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 ie([`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 Ax.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 Ax.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=ue(),o=bg(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...Zoe(this.app),...bg(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 Ax.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 Ax.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 Ax.Notice("Indexing cancelled");return}e.length>0?new Ax.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new Ax.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(),ue().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 d1t={};Cf(d1t,{default:()=>ma});var U8,ma,Ix=w(()=>{wT();fN();nr();U8=require("obsidian");Qoe();XRt();c1t();ma=class t{constructor(){this.embeddingsManager=Xs.getInstance(),this.dbOps=new eP(app),this.indexOps=new oie(app,this.dbOps,this.embeddingsManager),this.eventHandler=new eie(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={...ue()};let e=async()=>{let r=ue(),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())}};xa(()=>{this.initializationPromise=e()})}async initialize(){try{let e=3;for(;e>0;)try{await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI());break}catch(r){if(r instanceof Rr&&r.message.includes("Vault adapter not available")&&(e--,e>0)){await new Promise(n=>setTimeout(n,100));continue}new U8.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(),U8.Platform.isMobile&&ue().disableIndexOnMobile?(new U8.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(),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 Hbe(t){return t.split("|")[1]==="copilot-plus"}function Sq(){return Rn().isPlusUser}async function iie(){return ue().plusLicenseKey?(await Fi.getInstance().validateLicenseKey()).isValid:(KRe(),!1)}function p1t(){let t=RGr,e=VRe,r=ue().embeddingModelKey;ie("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),YVe(t),qR("copilot_plus"),zE({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(ie("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Ix(),d1t)).then(n=>{n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{fe("Failed to trigger indexing after Plus settings applied:",n),new f1t.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):ie("applyPlusSettings: No embedding model change, skipping indexing")}function WRe(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function p1(t){window.open(WRe(t),"_blank")}function m1t(){dt("isPlusUser",!0)}function KRe(){let t=ue().isPlusUser;dt("isPlusUser",!1),t&&new q7(app).open()}var f1t,zRe,RGr,HRe,VRe,_zo,vzo,nO=w(()=>{Cl();Fd();cKe();$r();mg();yo();nr();f1t=require("obsidian"),zRe="copilot-plus-flash",RGr=zRe+"|"+"copilot-plus",HRe="copilot-plus-small",VRe=HRe+"|"+"copilot-plus",_zo=Ic.defaultModelKey,vzo=Ic.embeddingModelKey});var h1t,g1t,Fi,mg=w(()=>{$r();BR();yo();nO();nr();h1t=F(Pp()),g1t=require("obsidian"),Fi=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ue().plusLicenseKey)throw new g1t.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=ue().userId;let a=new URL(`${VE}${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 eo(ue().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 ie(`==== ${e} request ====:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ue().userId);let o=new URL(`${VE}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await eo(ue().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 ie(`==== ${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 eo(ue().plusLicenseKey)},"POST",!0,!0);return r?r.message==="Invalid license key"?(KRe(),{isValid:!1}):{isValid:void 0}:(m1t(),{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=h1t.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 YRe=v((Izo,v1t)=>{var jGr="Expected a function",b1t=NaN,NGr="[object Symbol]",DGr=/^\s+|\s+$/g,LGr=/^[-+]0x[0-9a-f]+$/i,FGr=/^0b[01]+$/i,kGr=/^0o[0-7]+$/i,$Gr=parseInt,BGr=typeof window=="object"&&window&&window.Object===Object&&window,qGr=typeof self=="object"&&self&&self.Object===Object&&self,UGr=BGr||qGr||Function("return this")(),zGr=Object.prototype,HGr=zGr.toString,VGr=Math.max,WGr=Math.min,GRe=function(){return UGr.Date.now()};function KGr(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(jGr);e=_1t(e)||0,JRe(r)&&(c=!!r.leading,d="maxWait"in r,i=d?VGr(_1t(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(P){var E=n,A=o;return n=o=void 0,l=P,a=t.apply(A,E),a}function m(P){return l=P,s=setTimeout(g,e),c?p(P):a}function h(P){var E=P-u,A=P-l,I=e-E;return d?WGr(I,i-A):I}function b(P){var E=P-u,A=P-l;return u===void 0||E>=e||E<0||d&&A>=i}function g(){var P=GRe();if(b(P))return y(P);s=setTimeout(g,h(P))}function y(P){return s=void 0,f&&n?p(P):(n=o=void 0,a)}function S(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function x(){return s===void 0?a:y(GRe())}function O(){var P=GRe(),E=b(P);if(n=arguments,o=this,u=P,E){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=S,O.flush=x,O}function JRe(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function GGr(t){return!!t&&typeof t=="object"}function JGr(t){return typeof t=="symbol"||GGr(t)&&HGr.call(t)==NGr}function _1t(t){if(typeof t=="number")return t;if(JGr(t))return b1t;if(JRe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=JRe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(DGr,"");var r=FGr.test(t);return r||kGr.test(t)?$Gr(t.slice(2),r?2:8):LGr.test(t)?b1t:+t}v1t.exports=KGr});var R1t=v((n1e,o1e)=>{(function(t,e){typeof n1e=="object"&&typeof o1e<"u"?o1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(n1e,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 iI=v((i1e,a1e)=>{(function(t,e){typeof i1e=="object"&&typeof a1e<"u"?a1e.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(i1e,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 z=String(j);return!z||z.length>=$?j:""+Array($+1-z.length).join(k)+j},y={s:g,z:function(j){var $=-j.utcOffset(),k=Math.abs($),z=Math.floor(k/60),V=k%60;return($<=0?"+":"-")+g(z,2,"0")+":"+g(V,2,"0")},m:function j($,k){if($.date()<k.date())return-j(k,$);var z=12*(k.year()-$.year())+(k.month()-$.month()),V=$.clone().add(z,l),Q=k-V<0,J=$.clone().add(z+(Q?-1:1),l);return+(-(z+(k-V)/(Q?V-J:J-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}},S="en",x={};x[S]=b;var O="$isDayjsObject",P=function(j){return j instanceof R||!(!j||!j[O])},E=function j($,k,z){var V;if(!$)return S;if(typeof $=="string"){var Q=$.toLowerCase();x[Q]&&(V=Q),k&&(x[Q]=k,V=Q);var J=$.split("-");if(!V&&J.length>1)return j(J[0])}else{var D=$.name;x[D]=$,V=D}return!z&&V&&(S=V),V||!z&&S},A=function(j,$){if(P(j))return j.clone();var k=typeof $=="object"?$:{};return k.date=j,k.args=arguments,new R(k)},I=y;I.l=E,I.i=P,I.w=function(j,$){return A(j,{locale:$.$L,utc:$.$u,x:$.$x,$offset:$.$offset})};var R=function(){function j(k){this.$L=E(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(z){var V=z.date,Q=z.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 J=V.match(m);if(J){var D=J[2]-1||0,B=(J[7]||"0").substring(0,3);return Q?new Date(Date.UTC(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)):new Date(J[1],D,J[3]||1,J[4]||0,J[5]||0,J[6]||0,B)}}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,z){var V=A(k);return this.startOf(z)<=V&&V<=this.endOf(z)},$.isAfter=function(k,z){return A(k)<this.startOf(z)},$.isBefore=function(k,z){return this.endOf(z)<A(k)},$.$g=function(k,z,V){return I.u(k)?this[z]:this.set(V,k)},$.unix=function(){return Math.floor(this.valueOf()/1e3)},$.valueOf=function(){return this.$d.getTime()},$.startOf=function(k,z){var V=this,Q=!!I.u(z)||z,J=I.p(k),D=function(Y,ae){var Oe=I.w(V.$u?Date.UTC(V.$y,ae,Y):new Date(V.$y,ae,Y),V);return Q?Oe:Oe.endOf(s)},B=function(Y,ae){return I.w(V.toDate()[Y].apply(V.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice(ae)),V)},q=this.$W,K=this.$M,H=this.$D,ee="set"+(this.$u?"UTC":"");switch(J){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=(q<U?q+7:q)-U;return D(Q?H-W:H+(6-W),K);case s:case f:return B(ee+"Hours",0);case a:return B(ee+"Minutes",1);case i:return B(ee+"Seconds",2);case o:return B(ee+"Milliseconds",3);default:return this.clone()}},$.endOf=function(k){return this.startOf(k,!1)},$.$set=function(k,z){var V,Q=I.p(k),J="set"+(this.$u?"UTC":""),D=(V={},V[s]=J+"Date",V[f]=J+"Date",V[l]=J+"Month",V[d]=J+"FullYear",V[a]=J+"Hours",V[i]=J+"Minutes",V[o]=J+"Seconds",V[n]=J+"Milliseconds",V)[Q],B=Q===s?this.$D+(z-this.$W):z;if(Q===l||Q===d){var q=this.clone().set(f,1);q.$d[D](B),q.init(),this.$d=q.set(f,Math.min(this.$D,q.daysInMonth())).$d}else D&&this.$d[D](B);return this.init(),this},$.set=function(k,z){return this.clone().$set(k,z)},$.get=function(k){return this[I.p(k)]()},$.add=function(k,z){var V,Q=this;k=Number(k);var J=I.p(z),D=function(K){var H=A(Q);return I.w(H.date(H.date()+Math.round(K*k)),Q)};if(J===l)return this.set(l,this.$M+k);if(J===d)return this.set(d,this.$y+k);if(J===s)return D(1);if(J===u)return D(7);var B=(V={},V[i]=e,V[a]=r,V[o]=t,V)[J]||1,q=this.$d.getTime()+k*B;return I.w(q,this)},$.subtract=function(k,z){return this.add(-1*k,z)},$.format=function(k){var z=this,V=this.$locale();if(!this.isValid())return V.invalidDate||p;var Q=k||"YYYY-MM-DDTHH:mm:ssZ",J=I.z(this),D=this.$H,B=this.$m,q=this.$M,K=V.weekdays,H=V.months,ee=V.meridiem,U=function(ae,Oe,le,Be){return ae&&(ae[Oe]||ae(z,Q))||le[Oe].slice(0,Be)},W=function(ae){return I.s(D%12||12,ae,"0")},Y=ee||function(ae,Oe,le){var Be=ae<12?"AM":"PM";return le?Be.toLowerCase():Be};return Q.replace(h,function(ae,Oe){return Oe||function(le){switch(le){case"YY":return String(z.$y).slice(-2);case"YYYY":return I.s(z.$y,4,"0");case"M":return q+1;case"MM":return I.s(q+1,2,"0");case"MMM":return U(V.monthsShort,q,H,3);case"MMMM":return U(H,q);case"D":return z.$D;case"DD":return I.s(z.$D,2,"0");case"d":return String(z.$W);case"dd":return U(V.weekdaysMin,z.$W,K,2);case"ddd":return U(V.weekdaysShort,z.$W,K,3);case"dddd":return K[z.$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,B,!0);case"A":return Y(D,B,!1);case"m":return String(B);case"mm":return I.s(B,2,"0");case"s":return String(z.$s);case"ss":return I.s(z.$s,2,"0");case"SSS":return I.s(z.$ms,3,"0");case"Z":return J}return null}(ae)||J.replace(":","")})},$.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},$.diff=function(k,z,V){var Q,J=this,D=I.p(z),B=A(k),q=(B.utcOffset()-this.utcOffset())*e,K=this-B,H=function(){return I.m(J,B)};switch(D){case d:Q=H()/12;break;case l:Q=H();break;case c:Q=H()/3;break;case u:Q=(K-q)/6048e5;break;case s:Q=(K-q)/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 x[this.$L]},$.locale=function(k,z){if(!k)return this.$L;var V=this.clone(),Q=E(k,z,!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=E,A.isDayjs=P,A.unix=function(j){return A(1e3*j)},A.en=x[S],A.Ls=x,A.p={},A})});var To=v(Zje=>{"use strict";Object.defineProperty(Zje,"__esModule",{value:!0});Zje.pathToFunc=TXr;var EXr=Object.prototype.hasOwnProperty;function TXr(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!EXr.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 Dae=v(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});Ag.SDK_METADATA=Ag.ServerList=Ag.ServerEu=void 0;Ag.serverURLFromOptions=IXr;var AXr=To();Ag.ServerEu="eu";Ag.ServerList={[Ag.ServerEu]:"https://api.mistral.ai"};function IXr(t){let e=t.serverURL,r={};if(!e){let o=t.server??Ag.ServerEu;e=Ag.ServerList[o]||""}let n=(0,AXr.pathToFunc)(e)(r);return new URL(n)}Ag.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 Qje=v(Xje=>{"use strict";Object.defineProperty(Xje,"__esModule",{value:!0});Xje.readableStreamToArrayBuffer=MXr;async function MXr(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 HDt=v(Lae=>{"use strict";Object.defineProperty(Lae,"__esModule",{value:!0});Lae.CustomUserAgentHook=void 0;var RXr=Dae(),eNe=class{beforeRequest(e,r){let o=`mistral-client-typescript/${RXr.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};Lae.CustomUserAgentHook=eNe});var WDt=v(Fae=>{"use strict";Object.defineProperty(Fae,"__esModule",{value:!0});Fae.DeprecationWarningHook=void 0;var VDt="x-model-deprecation-timestamp",tNe=class{afterSuccess(e,r){return r.headers.has(VDt)&&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(VDt)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};Fae.DeprecationWarningHook=tNe});var KDt=v(rNe=>{"use strict";Object.defineProperty(rNe,"__esModule",{value:!0});rNe.initHooks=DXr;var jXr=HDt(),NXr=WDt();function DXr(t){let e=new jXr.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new NXr.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var GDt=v(kae=>{"use strict";Object.defineProperty(kae,"__esModule",{value:!0});kae.SDKHooks=void 0;var LXr=KDt(),nNe=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,LXr.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}}};kae.SDKHooks=nNe});var lNe=v(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});Zp.ConnectionError=Zp.RequestTimeoutError=Zp.RequestAbortedError=Zp.InvalidRequestError=Zp.UnexpectedClientError=Zp.HTTPClientError=void 0;var RI=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)}};Zp.HTTPClientError=RI;var oNe=class extends RI{constructor(){super(...arguments),this.name="UnexpectedClientError"}};Zp.UnexpectedClientError=oNe;var iNe=class extends RI{constructor(){super(...arguments),this.name="InvalidRequestError"}};Zp.InvalidRequestError=iNe;var aNe=class extends RI{constructor(){super(...arguments),this.name="RequestAbortedError"}};Zp.RequestAbortedError=aNe;var sNe=class extends RI{constructor(){super(...arguments),this.name="RequestTimeoutError"}};Zp.RequestTimeoutError=sNe;var uNe=class extends RI{constructor(){super(...arguments),this.name="ConnectionError"}};Zp.ConnectionError=uNe});var Ig=v(gU=>{"use strict";Object.defineProperty(gU,"__esModule",{value:!0});gU.OK=FXr;gU.ERR=kXr;gU.unwrap=$Xr;gU.unwrapAsync=BXr;function FXr(t){return{ok:!0,value:t}}function kXr(t){return{ok:!1,error:t}}function $Xr(t){if(!t.ok)throw t.error;return t.value}async function BXr(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var P5=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.getParsedType=Ki.ZodParsedType=Ki.objectUtil=Ki.util=void 0;var cNe;(function(t){t.assertEqual=o=>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"&&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})(cNe||(Ki.util=cNe={}));var JDt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(JDt||(Ki.objectUtil=JDt={}));Ki.ZodParsedType=cNe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var qXr=t=>{switch(typeof t){case"undefined":return Ki.ZodParsedType.undefined;case"string":return Ki.ZodParsedType.string;case"number":return isNaN(t)?Ki.ZodParsedType.nan:Ki.ZodParsedType.number;case"boolean":return Ki.ZodParsedType.boolean;case"function":return Ki.ZodParsedType.function;case"bigint":return Ki.ZodParsedType.bigint;case"symbol":return Ki.ZodParsedType.symbol;case"object":return Array.isArray(t)?Ki.ZodParsedType.array:t===null?Ki.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ki.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Ki.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Ki.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Ki.ZodParsedType.date:Ki.ZodParsedType.object;default:return Ki.ZodParsedType.unknown}};Ki.getParsedType=qXr});var $ae=v(jI=>{"use strict";Object.defineProperty(jI,"__esModule",{value:!0});jI.ZodError=jI.quotelessJson=jI.ZodIssueCode=void 0;var YDt=P5();jI.ZodIssueCode=YDt.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 UXr=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");jI.quotelessJson=UXr;var E5=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,YDt.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};jI.ZodError=E5;E5.create=t=>new E5(t)});var fNe=v(dNe=>{"use strict";Object.defineProperty(dNe,"__esModule",{value:!0});var KN=P5(),sf=$ae(),zXr=(t,e)=>{let r;switch(t.code){case sf.ZodIssueCode.invalid_type:t.received===KN.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case sf.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,KN.util.jsonStringifyReplacer)}`;break;case sf.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${KN.util.joinValues(t.keys,", ")}`;break;case sf.ZodIssueCode.invalid_union:r="Invalid input";break;case sf.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${KN.util.joinValues(t.options)}`;break;case sf.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${KN.util.joinValues(t.options)}, received '${t.received}'`;break;case sf.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case sf.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case sf.ZodIssueCode.invalid_date:r="Invalid date";break;case sf.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}"`:KN.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case sf.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==="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 sf.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 sf.ZodIssueCode.custom:r="Invalid input";break;case sf.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case sf.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case sf.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,KN.util.assertNever(t)}return{message:r}};dNe.default=zXr});var Bae=v(Lx=>{"use strict";var HXr=Lx&&Lx.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.getErrorMap=Lx.setErrorMap=Lx.defaultErrorMap=void 0;var ZDt=HXr(fNe());Lx.defaultErrorMap=ZDt.default;var XDt=ZDt.default;function VXr(t){XDt=t}Lx.setErrorMap=VXr;function WXr(){return XDt}Lx.getErrorMap=WXr});var mNe=v(hi=>{"use strict";var KXr=hi&&hi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hi,"__esModule",{value:!0});hi.isAsync=hi.isValid=hi.isDirty=hi.isAborted=hi.OK=hi.DIRTY=hi.INVALID=hi.ParseStatus=hi.addIssueToContext=hi.EMPTY_PATH=hi.makeIssue=void 0;var GXr=Bae(),QDt=KXr(fNe()),JXr=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}};hi.makeIssue=JXr;hi.EMPTY_PATH=[];function YXr(t,e){let r=(0,GXr.getErrorMap)(),n=(0,hi.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===QDt.default?void 0:QDt.default].filter(o=>!!o)});t.common.issues.push(n)}hi.addIssueToContext=YXr;var pNe=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 hi.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 hi.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}}};hi.ParseStatus=pNe;hi.INVALID=Object.freeze({status:"aborted"});var ZXr=t=>({status:"dirty",value:t});hi.DIRTY=ZXr;var XXr=t=>({status:"valid",value:t});hi.OK=XXr;var QXr=t=>t.status==="aborted";hi.isAborted=QXr;var eQr=t=>t.status==="dirty";hi.isDirty=eQr;var tQr=t=>t.status==="valid";hi.isValid=tQr;var rQr=t=>typeof Promise<"u"&&t instanceof Promise;hi.isAsync=rQr});var tLt=v(eLt=>{"use strict";Object.defineProperty(eLt,"__esModule",{value:!0})});var nLt=v(qae=>{"use strict";Object.defineProperty(qae,"__esModule",{value:!0});qae.errorUtil=void 0;var rLt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(rLt||(qae.errorUtil=rLt={}))});var gLt=v(re=>{"use strict";var zae=re&&re.__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)},aLt=re&&re.__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},T5,A5;Object.defineProperty(re,"__esModule",{value:!0});re.boolean=re.bigint=re.array=re.any=re.coerce=re.ZodFirstPartyTypeKind=re.late=re.ZodSchema=re.Schema=re.custom=re.ZodReadonly=re.ZodPipeline=re.ZodBranded=re.BRAND=re.ZodNaN=re.ZodCatch=re.ZodDefault=re.ZodNullable=re.ZodOptional=re.ZodTransformer=re.ZodEffects=re.ZodPromise=re.ZodNativeEnum=re.ZodEnum=re.ZodLiteral=re.ZodLazy=re.ZodFunction=re.ZodSet=re.ZodMap=re.ZodRecord=re.ZodTuple=re.ZodIntersection=re.ZodDiscriminatedUnion=re.ZodUnion=re.ZodObject=re.ZodArray=re.ZodVoid=re.ZodNever=re.ZodUnknown=re.ZodAny=re.ZodNull=re.ZodUndefined=re.ZodSymbol=re.ZodDate=re.ZodBoolean=re.ZodBigInt=re.ZodNumber=re.ZodString=re.datetimeRegex=re.ZodType=void 0;re.NEVER=re.void=re.unknown=re.union=re.undefined=re.tuple=re.transformer=re.symbol=re.string=re.strictObject=re.set=re.record=re.promise=re.preprocess=re.pipeline=re.ostring=re.optional=re.onumber=re.oboolean=re.object=re.number=re.nullable=re.null=re.never=re.nativeEnum=re.nan=re.map=re.literal=re.lazy=re.intersection=re.instanceof=re.function=re.enum=re.effect=re.discriminatedUnion=re.date=void 0;var Uae=Bae(),Ut=nLt(),ne=mNe(),nt=P5(),We=$ae(),Rg=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||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},oLt=(t,e)=>{if((0,ne.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 We.ZodError(t.common.issues);return this._error=r,this._error}}};function Zr(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)=>{var u,l;let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:(u=c??n)!==null&&u!==void 0?u:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=c??r)!==null&&l!==void 0?l:s.defaultError}},description:o}}var Xr=class{get description(){return this._def.description}_getType(e){return(0,nt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ne.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,nt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,ne.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){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)},i=this._parseSync({data:e,path:o.path,parent:o});return oLt(o,i)}"~validate"(e){var r,n;let o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,nt.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:o});return(0,ne.isValid)(i)?{value:i.value}:{issues:o.common.issues}}catch(i){!((n=(r=i?.message)===null||r===void 0?void 0:r.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(i=>(0,ne.isValid)(i)?{value:i.value}:{issues:o.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,nt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,ne.isAsync)(o)?o:Promise.resolve(o));return oLt(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:We.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 oh({schema:this,typeName:gr.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 Mg.create(this,this._def)}nullable(){return kx.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hP.create(this)}promise(){return LI.create(this,this._def)}or(e){return eD.create([this,e],this._def)}and(e){return tD.create(this,e,this._def)}transform(e){return new oh({...Zr(this._def),schema:this,typeName:gr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new aD({...Zr(this._def),innerType:this,defaultValue:r,typeName:gr.ZodDefault})}brand(){return new I5({typeName:gr.ZodBranded,type:this,...Zr(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new sD({...Zr(this._def),innerType:this,catchValue:r,typeName:gr.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return M5.create(this,e)}readonly(){return uD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};re.ZodType=Xr;re.Schema=Xr;re.ZodSchema=Xr;var nQr=/^c[^\s-]{8,}$/i,oQr=/^[0-9a-z]+$/,iQr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aQr=/^[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,sQr=/^[a-z0-9_-]{21}$/i,uQr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lQr=/^[-+]?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)?)??$/,cQr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dQr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hNe,fQr=/^(?:(?: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])$/,pQr=/^(?:(?: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])$/,mQr=/^(([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]))$/,hQr=/^(([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])$/,gQr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yQr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sLt="((\\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])))",bQr=new RegExp(`^${sLt}$`);function uLt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function _Qr(t){return new RegExp(`^${uLt(t)}$`)}function lLt(t){let e=`${sLt}T${uLt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}re.datetimeRegex=lLt;function vQr(t,e){return!!((e==="v4"||!e)&&fQr.test(t)||(e==="v6"||!e)&&mQr.test(t))}function wQr(t,e){if(!uQr.test(t))return!1;try{let[r]=t.split("."),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||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function SQr(t,e){return!!((e==="v4"||!e)&&pQr.test(t)||(e==="v6"||!e)&&hQr.test(t))}var NI=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==nt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.string,received:i.parsedType}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.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,ne.addIssueToContext)(o,{code:We.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,ne.addIssueToContext)(o,{code:We.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")cQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"email",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")hNe||(hNe=new RegExp(dQr,"u")),hNe.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"emoji",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")aQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"uuid",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")sQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"nanoid",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")nQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"cuid",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")oQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"cuid2",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")iQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"ulid",code:We.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,ne.addIssueToContext)(o,{validation:"url",code:We.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,ne.addIssueToContext)(o,{validation:"regex",code:We.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,ne.addIssueToContext)(o,{code:We.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,ne.addIssueToContext)(o,{code:We.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,ne.addIssueToContext)(o,{code:We.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?lLt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?bQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?_Qr(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?lQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"duration",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?vQr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"ip",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?wQr(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"jwt",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?SQr(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"cidr",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?gQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"base64",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?yQr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{validation:"base64url",code:We.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):nt.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:We.ZodIssueCode.invalid_string,...Ut.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ut.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ut.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ut.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ut.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ut.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ut.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ut.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ut.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ut.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ut.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ut.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ut.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ut.errorUtil.errToObj(e)})}datetime(e){var r,n;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:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...Ut.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,...Ut.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ut.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Ut.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Ut.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Ut.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Ut.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Ut.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Ut.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Ut.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Ut.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}};re.ZodString=NI;NI.create=t=>{var e;return new NI({checks:[],typeName:gr.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};function xQr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=parseInt(t.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var GN=class t extends Xr{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)!==nt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.number,received:i.parsedType}),ne.INVALID}let n,o=new ne.ParseStatus;for(let i of this._def.checks)i.kind==="int"?nt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?xQr(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_finite,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ut.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Ut.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ut.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ut.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"&&nt.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)}};re.ZodNumber=GN;GN.create=t=>new GN({checks:[],typeName:gr.ZodNumber,coerce:t?.coerce||!1,...Zr(t)});var JN=class t extends Xr{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)!==nt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new ne.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,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):nt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.bigint,received:r.parsedType}),ne.INVALID}gte(e,r){return this.setLimit("min",e,!0,Ut.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Ut.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Ut.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Ut.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Ut.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:Ut.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ut.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ut.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Ut.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}};re.ZodBigInt=JN;JN.create=t=>{var e;return new JN({checks:[],typeName:gr.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Zr(t)})};var YN=class extends Xr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==nt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.boolean,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodBoolean=YN;YN.create=t=>new YN({typeName:gr.ZodBoolean,coerce:t?.coerce||!1,...Zr(t)});var ZN=class t extends Xr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==nt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.date,received:i.parsedType}),ne.INVALID}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(i,{code:We.ZodIssueCode.invalid_date}),ne.INVALID}let n=new ne.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,ne.addIssueToContext)(o,{code:We.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,ne.addIssueToContext)(o,{code:We.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):nt.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:Ut.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Ut.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}};re.ZodDate=ZN;ZN.create=t=>new ZN({checks:[],coerce:t?.coerce||!1,typeName:gr.ZodDate,...Zr(t)});var bU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.symbol,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodSymbol=bU;bU.create=t=>new bU({typeName:gr.ZodSymbol,...Zr(t)});var XN=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.undefined,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodUndefined=XN;XN.create=t=>new XN({typeName:gr.ZodUndefined,...Zr(t)});var QN=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.null,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodNull=QN;QN.create=t=>new QN({typeName:gr.ZodNull,...Zr(t)});var DI=class extends Xr{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodAny=DI;DI.create=t=>new DI({typeName:gr.ZodAny,...Zr(t)});var mP=class extends Xr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,ne.OK)(e.data)}};re.ZodUnknown=mP;mP.create=t=>new mP({typeName:gr.ZodUnknown,...Zr(t)});var lb=class extends Xr{_parse(e){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.never,received:r.parsedType}),ne.INVALID}};re.ZodNever=lb;lb.create=t=>new lb({typeName:gr.ZodNever,...Zr(t)});var _U=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.void,received:n.parsedType}),ne.INVALID}return(0,ne.OK)(e.data)}};re.ZodVoid=_U;_U.create=t=>new _U({typeName:gr.ZodVoid,...Zr(t)});var hP=class t extends Xr{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:r.parsedType}),ne.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,ne.addIssueToContext)(r,{code:a?We.ZodIssueCode.too_big:We.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,ne.addIssueToContext)(r,{code:We.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,ne.addIssueToContext)(r,{code:We.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 Rg(r,a,r.path,s)))).then(a=>ne.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Rg(r,a,r.path,s)));return ne.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Ut.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Ut.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};re.ZodArray=hP;hP.create=(t,e)=>new hP({type:t,minLength:null,maxLength:null,exactLength:null,typeName:gr.ZodArray,...Zr(e)});function yU(t){if(t instanceof Xp){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Mg.create(yU(n))}return new Xp({...t._def,shape:()=>e})}else return t instanceof hP?new hP({...t._def,type:yU(t.element)}):t instanceof Mg?Mg.create(yU(t.unwrap())):t instanceof kx?kx.create(yU(t.unwrap())):t instanceof Fx?Fx.create(t.items.map(e=>yU(e))):t}var Xp=class t extends Xr{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=nt.util.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==nt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(l,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:l.parsedType}),ne.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof lb&&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 Rg(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof lb){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,ne.addIssueToContext)(o,{code:We.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 Rg(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=>ne.ParseStatus.mergeObjectSync(n,l)):ne.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Ut.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,i,a,s;let u=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,r,n).message)!==null&&a!==void 0?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=Ut.errorUtil.errToObj(e).message)!==null&&s!==void 0?s:u}:{message:u}}}:{}})}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:gr.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return nt.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return yU(this)}partial(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return nt.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Mg;)i=i._def.innerType;r[n]=i}}),new t({...this._def,shape:()=>r})}keyof(){return cLt(nt.util.objectKeys(this.shape))}};re.ZodObject=Xp;Xp.create=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.strictCreate=(t,e)=>new Xp({shape:()=>t,unknownKeys:"strict",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});Xp.lazycreate=(t,e)=>new Xp({shape:t,unknownKeys:"strip",catchall:lb.create(),typeName:gr.ZodObject,...Zr(e)});var eD=class extends Xr{_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 We.ZodError(s.ctx.common.issues));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:a}),ne.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 We.ZodError(u));return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union,unionErrors:s}),ne.INVALID}}get options(){return this._def.options}};re.ZodUnion=eD;eD.create=(t,e)=>new eD({options:t,typeName:gr.ZodUnion,...Zr(e)});var pP=t=>t instanceof rD?pP(t.schema):t instanceof oh?pP(t.innerType()):t instanceof nD?[t.value]:t instanceof oD?t.options:t instanceof iD?nt.util.objectValues(t.enum):t instanceof aD?pP(t._def.innerType):t instanceof XN?[void 0]:t instanceof QN?[null]:t instanceof Mg?[void 0,...pP(t.unwrap())]:t instanceof kx?[null,...pP(t.unwrap())]:t instanceof I5||t instanceof uD?pP(t.unwrap()):t instanceof sD?pP(t._def.innerType):[],Hae=class t extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:r.parsedType}),ne.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,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne.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=pP(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:gr.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Zr(n)})}};re.ZodDiscriminatedUnion=Hae;function gNe(t,e){let r=(0,nt.getParsedType)(t),n=(0,nt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===nt.ZodParsedType.object&&n===nt.ZodParsedType.object){let o=nt.util.objectKeys(e),i=nt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=gNe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===nt.ZodParsedType.array&&n===nt.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=gNe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===nt.ZodParsedType.date&&n===nt.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var tD=class extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,ne.isAborted)(i)||(0,ne.isAborted)(a))return ne.INVALID;let s=gNe(i.value,a.value);return s.valid?(((0,ne.isDirty)(i)||(0,ne.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_intersection_types}),ne.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}))}};re.ZodIntersection=tD;tD.create=(t,e,r)=>new tD({left:t,right:e,typeName:gr.ZodIntersection,...Zr(r)});var Fx=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.array)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.array,received:n.parsedType}),ne.INVALID;if(n.data.length<this._def.items.length)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,ne.addIssueToContext)(n,{code:We.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 Rg(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ne.ParseStatus.mergeArray(r,a)):ne.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};re.ZodTuple=Fx;Fx.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fx({items:t,typeName:gr.ZodTuple,rest:null,...Zr(e)})};var Vae=class t extends Xr{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!==nt.ZodParsedType.object)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.object,received:n.parsedType}),ne.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Rg(n,s,n.path,s)),value:a._parse(new Rg(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ne.ParseStatus.mergeObjectAsync(r,o):ne.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Xr?new t({keyType:e,valueType:r,typeName:gr.ZodRecord,...Zr(n)}):new t({keyType:NI.create(),valueType:e,typeName:gr.ZodRecord,...Zr(r)})}};re.ZodRecord=Vae;var vU=class extends Xr{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!==nt.ZodParsedType.map)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.map,received:n.parsedType}),ne.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new Rg(n,s,n.path,[l,"key"])),value:i._parse(new Rg(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 ne.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 ne.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};re.ZodMap=vU;vU.create=(t,e,r)=>new vU({valueType:e,keyType:t,typeName:gr.ZodMap,...Zr(r)});var wU=class t extends Xr{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nt.ZodParsedType.set)return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.set,received:n.parsedType}),ne.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,ne.addIssueToContext)(n,{code:We.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,ne.addIssueToContext)(n,{code:We.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 ne.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 Rg(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:Ut.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Ut.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};re.ZodSet=wU;wU.create=(t,e)=>new wU({valueType:t,minSize:null,maxSize:null,typeName:gr.ZodSet,...Zr(e)});var Wae=class t extends Xr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.function)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.function,received:r.parsedType}),ne.INVALID;function n(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uae.getErrorMap)(),Uae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,ne.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Uae.getErrorMap)(),Uae.defaultErrorMap].filter(l=>!!l),issueData:{code:We.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof LI){let s=this;return(0,ne.OK)(async function(...u){let l=new We.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,ne.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new We.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 We.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:Fx.create(e).rest(mP.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||Fx.create([]).rest(mP.create()),returns:r||mP.create(),typeName:gr.ZodFunction,...Zr(n)})}};re.ZodFunction=Wae;var rD=class extends Xr{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})}};re.ZodLazy=rD;rD.create=(t,e)=>new rD({getter:t,typeName:gr.ZodLazy,...Zr(e)});var nD=class extends Xr{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_literal,expected:this._def.value}),ne.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.ZodLiteral=nD;nD.create=(t,e)=>new nD({value:t,typeName:gr.ZodLiteral,...Zr(e)});function cLt(t,e){return new oD({values:t,typeName:gr.ZodEnum,...Zr(e)})}var oD=class t extends Xr{constructor(){super(...arguments),T5.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{expected:nt.util.joinValues(n),received:r.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(zae(this,T5,"f")||aLt(this,T5,new Set(this._def.values),"f"),!zae(this,T5,"f").has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,ne.addIssueToContext)(r,{received:r.data,code:We.ZodIssueCode.invalid_enum_value,options:n}),ne.INVALID}return(0,ne.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})}};re.ZodEnum=oD;T5=new WeakMap;oD.create=cLt;var iD=class extends Xr{constructor(){super(...arguments),A5.set(this,void 0)}_parse(e){let r=nt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==nt.ZodParsedType.string&&n.parsedType!==nt.ZodParsedType.number){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{expected:nt.util.joinValues(o),received:n.parsedType,code:We.ZodIssueCode.invalid_type}),ne.INVALID}if(zae(this,A5,"f")||aLt(this,A5,new Set(nt.util.getValidEnumValues(this._def.values)),"f"),!zae(this,A5,"f").has(e.data)){let o=nt.util.objectValues(r);return(0,ne.addIssueToContext)(n,{received:n.data,code:We.ZodIssueCode.invalid_enum_value,options:o}),ne.INVALID}return(0,ne.OK)(e.data)}get enum(){return this._def.values}};re.ZodNativeEnum=iD;A5=new WeakMap;iD.create=(t,e)=>new iD({values:t,typeName:gr.ZodNativeEnum,...Zr(e)});var LI=class extends Xr{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nt.ZodParsedType.promise&&r.common.async===!1)return(0,ne.addIssueToContext)(r,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.promise,received:r.parsedType}),ne.INVALID;let n=r.parsedType===nt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,ne.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};re.ZodPromise=LI;LI.create=(t,e)=>new LI({type:t,typeName:gr.ZodPromise,...Zr(e)});var oh=class extends Xr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===gr.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,ne.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 ne.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?ne.INVALID:u.status==="dirty"||r.value==="dirty"?(0,ne.DIRTY)(u.value):u});{if(r.value==="aborted")return ne.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ne.INVALID:s.status==="dirty"||r.value==="dirty"?(0,ne.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"?ne.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"?ne.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,ne.isValid)(a))return a;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,ne.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):a);nt.util.assertNever(o)}};re.ZodEffects=oh;re.ZodTransformer=oh;oh.create=(t,e,r)=>new oh({schema:t,typeName:gr.ZodEffects,effect:e,...Zr(r)});oh.createWithPreprocess=(t,e,r)=>new oh({schema:e,effect:{type:"preprocess",transform:t},typeName:gr.ZodEffects,...Zr(r)});var Mg=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.undefined?(0,ne.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodOptional=Mg;Mg.create=(t,e)=>new Mg({innerType:t,typeName:gr.ZodOptional,...Zr(e)});var kx=class extends Xr{_parse(e){return this._getType(e)===nt.ZodParsedType.null?(0,ne.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};re.ZodNullable=kx;kx.create=(t,e)=>new kx({innerType:t,typeName:gr.ZodNullable,...Zr(e)});var aD=class extends Xr{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===nt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};re.ZodDefault=aD;aD.create=(t,e)=>new aD({innerType:t,typeName:gr.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Zr(e)});var sD=class extends Xr{_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,ne.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new We.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.ZodCatch=sD;sD.create=(t,e)=>new sD({innerType:t,typeName:gr.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Zr(e)});var SU=class extends Xr{_parse(e){if(this._getType(e)!==nt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,ne.addIssueToContext)(n,{code:We.ZodIssueCode.invalid_type,expected:nt.ZodParsedType.nan,received:n.parsedType}),ne.INVALID}return{status:"valid",value:e.data}}};re.ZodNaN=SU;SU.create=t=>new SU({typeName:gr.ZodNaN,...Zr(t)});re.BRAND=Symbol("zod_brand");var I5=class extends Xr{_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}};re.ZodBranded=I5;var M5=class t extends Xr{_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"?ne.INVALID:i.status==="dirty"?(r.dirty(),(0,ne.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"?ne.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:gr.ZodPipeline})}};re.ZodPipeline=M5;var uD=class extends Xr{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,ne.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,ne.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};re.ZodReadonly=uD;uD.create=(t,e)=>new uD({innerType:t,typeName:gr.ZodReadonly,...Zr(e)});function iLt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function dLt(t,e={},r){return t?DI.create().superRefine((n,o)=>{var i,a;let s=t(n);if(s instanceof Promise)return s.then(u=>{var l,c;if(!u){let d=iLt(e,n),f=(c=(l=d.fatal)!==null&&l!==void 0?l:r)!==null&&c!==void 0?c:!0;o.addIssue({code:"custom",...d,fatal:f})}});if(!s){let u=iLt(e,n),l=(a=(i=u.fatal)!==null&&i!==void 0?i:r)!==null&&a!==void 0?a:!0;o.addIssue({code:"custom",...u,fatal:l})}}):DI.create()}re.custom=dLt;re.late={object:Xp.lazycreate};var gr;(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"})(gr||(re.ZodFirstPartyTypeKind=gr={}));var CQr=(t,e={message:`Input not instance of ${t.name}`})=>dLt(r=>r instanceof t,e);re.instanceof=CQr;var fLt=NI.create;re.string=fLt;var pLt=GN.create;re.number=pLt;var OQr=SU.create;re.nan=OQr;var PQr=JN.create;re.bigint=PQr;var mLt=YN.create;re.boolean=mLt;var EQr=ZN.create;re.date=EQr;var TQr=bU.create;re.symbol=TQr;var AQr=XN.create;re.undefined=AQr;var IQr=QN.create;re.null=IQr;var MQr=DI.create;re.any=MQr;var RQr=mP.create;re.unknown=RQr;var jQr=lb.create;re.never=jQr;var NQr=_U.create;re.void=NQr;var DQr=hP.create;re.array=DQr;var LQr=Xp.create;re.object=LQr;var FQr=Xp.strictCreate;re.strictObject=FQr;var kQr=eD.create;re.union=kQr;var $Qr=Hae.create;re.discriminatedUnion=$Qr;var BQr=tD.create;re.intersection=BQr;var qQr=Fx.create;re.tuple=qQr;var UQr=Vae.create;re.record=UQr;var zQr=vU.create;re.map=zQr;var HQr=wU.create;re.set=HQr;var VQr=Wae.create;re.function=VQr;var WQr=rD.create;re.lazy=WQr;var KQr=nD.create;re.literal=KQr;var GQr=oD.create;re.enum=GQr;var JQr=iD.create;re.nativeEnum=JQr;var YQr=LI.create;re.promise=YQr;var hLt=oh.create;re.effect=hLt;re.transformer=hLt;var ZQr=Mg.create;re.optional=ZQr;var XQr=kx.create;re.nullable=XQr;var QQr=oh.createWithPreprocess;re.preprocess=QQr;var een=M5.create;re.pipeline=een;var ten=()=>fLt().optional();re.ostring=ten;var ren=()=>pLt().optional();re.onumber=ren;var nen=()=>mLt().optional();re.oboolean=nen;re.coerce={string:t=>NI.create({...t,coerce:!0}),number:t=>GN.create({...t,coerce:!0}),boolean:t=>YN.create({...t,coerce:!0}),bigint:t=>JN.create({...t,coerce:!0}),date:t=>ZN.create({...t,coerce:!0})};re.NEVER=ne.INVALID});var yNe=v(jg=>{"use strict";var oen=jg&&jg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xU=jg&&jg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oen(e,t,r)};Object.defineProperty(jg,"__esModule",{value:!0});xU(Bae(),jg);xU(mNe(),jg);xU(tLt(),jg);xU(P5(),jg);xU(gLt(),jg);xU($ae(),jg)});var Te=v(Qp=>{"use strict";var yLt=Qp&&Qp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aen=Qp&&Qp.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&yLt(e,t,r);return ien(e,t),e},sen=Qp&&Qp.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yLt(e,t,r)};Object.defineProperty(Qp,"__esModule",{value:!0});Qp.z=void 0;var bLt=aen(yNe());Qp.z=bLt;sen(yNe(),Qp);Qp.default=bLt});var vNe=v(mc=>{"use strict";var uen=mc&&mc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),len=mc&&mc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cen=mc&&mc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uen(e,t,r);return len(e,t),e};Object.defineProperty(mc,"__esModule",{value:!0});mc.zodInbound=mc.zodOutbound=void 0;mc.bytesToBase64=_Lt;mc.bytesFromBase64=bNe;mc.stringToBytes=_Ne;mc.stringFromBytes=vLt;mc.stringToBase64=den;mc.stringFromBase64=fen;var Kae=cen(Te());function _Lt(t){return btoa(String.fromCodePoint(...t))}function bNe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function _Ne(t){return new TextEncoder().encode(t)}function vLt(t){return new TextDecoder().decode(t)}function den(t){return _Lt(_Ne(t))}function fen(t){return vLt(bNe(t))}mc.zodOutbound=Kae.instanceof(Uint8Array).or(Kae.string().transform(_Ne));mc.zodInbound=Kae.instanceof(Uint8Array).or(Kae.string().transform(bNe))});var SNe=v(wNe=>{"use strict";Object.defineProperty(wNe,"__esModule",{value:!0});wNe.isPlainObject=pen;function pen(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 ii=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.encodeDeepObjectQuery=ao.encodePipeDelimitedQuery=ao.encodeSpaceDelimitedQuery=ao.encodeFormQuery=ao.encodeJSONQuery=ao.encodeSimple=ao.encodePipeDelimited=ao.encodeSpaceDelimited=ao.encodeForm=ao.EncodingError=void 0;ao.encodeMatrix=men;ao.encodeLabel=hen;ao.encodeBodyForm=gen;ao.encodeDeepObject=SLt;ao.encodeDeepObjectObject=CNe;ao.encodeJSON=xLt;ao.queryJoin=CLt;ao.queryEncoder=OU;ao.appendForm=ben;var wLt=vNe(),cb=SNe(),R5=class extends Error{constructor(e){super(e),this.name="EncodingError"}};ao.EncodingError=R5;function men(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=N5(u,f=>`${a(f)}`)?.join(","):(0,cb.isPlainObject)(u)?c=Jae(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 hen(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=N5(u,c=>`${a(c)}`)?.join("."):(0,cb.isPlainObject)(u)?l=Jae(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function xNe(t){return(e,r,n)=>{let o="",i=n?.explode?j5(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(CU(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=N5(c,p=>`${s(p)}`)?.join(u):(0,cb.isPlainObject)(c)?f=Jae(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)}}ao.encodeForm=xNe(",");ao.encodeSpaceDelimited=xNe(" ");ao.encodePipeDelimited=xNe("|");function gen(t,e,r){let n="",o=r?.explode?j5(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,cb.isPlainObject)(u)?c=JSON.stringify(u,Gae):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function SLt(t,e,r){if(e!=null){if(!(0,cb.isPlainObject)(e))throw new R5(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return CNe(t,e,r)}}function CNe(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,cb.isPlainObject)(e))throw new R5(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,cb.isPlainObject)(a)){let c=CNe(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=N5(u,c=>`${o(s)}=${o(CU(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function xLt(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,Gae));return r?.explode?o:`${n(t)}=${o}`}var yen=(t,e,r)=>{let n="",o=r?.explode?j5(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(CU(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=N5(u,c=>`${a(c)}`)?.join(","):(0,cb.isPlainObject)(u)?l=Jae(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,cb.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};ao.encodeSimple=yen;function j5(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,cb.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function CU(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,wLt.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,Gae):`${t}`}function Gae(t,e){return e instanceof Uint8Array?(0,wLt.bytesToBase64)(e):e}function N5(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 Jae(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 CLt(...t){return t.filter(Boolean).join("&")}function OU(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 CLt(...i)}}ao.encodeJSONQuery=OU(xLt);ao.encodeFormQuery=OU(ao.encodeForm);ao.encodeSpaceDelimitedQuery=OU(ao.encodeSpaceDelimited);ao.encodePipeDelimitedQuery=OU(ao.encodePipeDelimited);ao.encodeDeepObjectQuery=OU(SLt);function ben(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 OLt=v(ONe=>{"use strict";Object.defineProperty(ONe,"__esModule",{value:!0});ONe.dlv=_en;function _en(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 ENe=v(ih=>{"use strict";var ven=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]}),wen=ih&&ih.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sen=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)&&ven(e,t,r);return wen(e,t),e};Object.defineProperty(ih,"__esModule",{value:!0});ih.envSchema=void 0;ih.env=xen;ih.resetEnv=Cen;var PLt=OLt(),PNe=Sen(Te());ih.envSchema=PNe.object({MISTRAL_API_KEY:PNe.string().optional(),MISTRAL_DEBUG:PNe.coerce.boolean().optional()});var D5;function xen(){return D5||(D5=ih.envSchema.parse((0,PLt.dlv)(globalThis,"process.env")??(0,PLt.dlv)(globalThis,"Deno.env")??{}),D5)}function Cen(){D5=void 0}});var L5=v($x=>{"use strict";Object.defineProperty($x,"__esModule",{value:!0});$x.HTTPClient=void 0;$x.matchContentType=TLt;$x.matchStatusCode=ALt;$x.matchResponse=Een;$x.isConnectionError=Ten;$x.isTimeoutError=Aen;$x.isAbortError=Ien;var Oen=(t,e)=>e==null?fetch(t):fetch(t,e),TNe=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Oen}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}};$x.HTTPClient=TNe;var ELt=/\s*;\s*/g;function TLt(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(ELt),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(ELt),[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 Pen=new RegExp("^[0-9]xx$","i");function ALt(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(!Pen.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 Een(t,e,r){return ALt(t,e)&&TLt(t,r)}function Ten(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 Aen(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 Ien(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 MLt=v(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0});cD.TemporaryError=cD.PermanentError=void 0;cD.retry=Ren;var ILt=L5(),Men={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},F5=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)}};cD.PermanentError=F5;var lD=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};cD.TemporaryError=lD;async function Ren(t,e){switch(e.config.strategy){case"backoff":return Len(jen(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??Men);default:return await t()}}function jen(t,e){return async()=>{try{let r=await t();if(Den(r,e.statusCodes))throw new lD("Response failed with retryable status code",r);return r}catch(r){throw r instanceof lD||e.retryConnectionErrors&&((0,ILt.isTimeoutError)(r)||(0,ILt.isConnectionError)(r))?r:new F5("Permanent error",{cause:r})}}}var Nen=new RegExp("^[0-9]xx$","i");function Den(t,e){let r=`${t.status}`;return e.some(n=>{if(!Nen.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 Len(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 F5)throw u.cause;if(Date.now()-a>r){if(u instanceof lD)return u.response;throw u}let c=0;u instanceof lD&&(c=Fen(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await ken(d),s++}}function Fen(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 ken(t){return new Promise(e=>setTimeout(e,t))}});var ah=v(kI=>{"use strict";var k5=kI&&kI.__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},Ng=kI&&kI.__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)},Zae,Bx,gP;Object.defineProperty(kI,"__esModule",{value:!0});kI.ClientSDK=void 0;var RLt=GDt(),PU=lNe(),FI=Ig(),$en=vNe(),jLt=Dae(),Ben=ii(),qen=ENe(),yP=L5(),Uen=MLt(),Yae=typeof globalThis>"u"?null:globalThis,zen=typeof Yae=="object"&&Yae!=null&&"importScripts"in Yae&&typeof Yae.importScripts=="function",Hen=zen||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",ANe=class{constructor(e={}){Zae.set(this,void 0),Bx.set(this,void 0),gP.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof RLt.SDKHooks?k5(this,Bx,r.hooks,"f"):k5(this,Bx,new RLt.SDKHooks,"f"),this._options={...e,hooks:Ng(this,Bx,"f")};let n=(0,jLt.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=Ng(this,Bx,"f").sdkInit({baseURL:n,client:e.httpClient||new yP.HTTPClient});this._baseURL=o,k5(this,Zae,i,"f"),k5(this,gP,e.debugLogger,"f"),!Ng(this,gP,"f")&&(0,qen.env)().MISTRAL_DEBUG&&k5(this,gP,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,FI.ERR)(new PU.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[P,E]of Object.entries(u?.queryParams||{})){let A=(0,Ben.encodeForm)(P,E,{charEncoding:"percent"});typeof A<"u"&&p.push(A)}if(p.length&&(f+=`&${p.join("&")}`),f){let P=f.startsWith("&")?f.slice(1):f;c.search=`?${P}`}let m=new Headers(s),h=u?.basic.username,b=u?.basic.password;if(h!=null||b!=null){let P=(0,$en.stringToBase64)([h||"",b||""].join(":"));m.set("Authorization",`Basic ${P}`)}let g=new Headers(u?.headers||{});for(let[P,E]of g)m.set(P,E);let y=m.get("cookie")||"";for(let[P,E]of Object.entries(u?.cookies||{}))y+=`; ${P}=${E}`;y=y.startsWith("; ")?y.slice(2):y,m.set("cookie",y);let S=new Headers(n?.fetchOptions?.headers);for(let[P,E]of S)m.set(P,E);Hen||m.set(r.uaHeader??"user-agent",jLt.SDK_METADATA.userAgent);let x=n?.fetchOptions;if(!x?.signal&&r.timeoutMs&&r.timeoutMs>0){let P=AbortSignal.timeout(r.timeoutMs);x?x.signal=P:x={signal:P}}r.body instanceof ReadableStream&&(x?x.duplex="half":x={duplex:"half"});let O;try{O=Ng(this,Bx,"f").beforeCreateRequest(e,{url:c,options:{...x,body:r.body??null,headers:m,method:o}})}catch(P){return(0,FI.ERR)(new PU.UnexpectedClientError("Create request hook failed to execute",{cause:P}))}return(0,FI.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Uen.retry)(async()=>{let i=await Ng(this,Bx,"f").beforeRequest(n,e.clone());await Ven(Ng(this,gP,"f"),i).catch(s=>Ng(this,gP,"f")?.log("Failed to log request:",s));let a=await Ng(this,Zae,"f").request(i);try{if((0,yP.matchStatusCode)(a,o)){let s=await Ng(this,Bx,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await Ng(this,Bx,"f").afterSuccess(n,a)}finally{await Wen(Ng(this,gP,"f"),a,i).catch(s=>Ng(this,gP,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,FI.OK)(i),i=>{switch(!0){case(0,yP.isAbortError)(i):return(0,FI.ERR)(new PU.RequestAbortedError("Request aborted by client",{cause:i}));case(0,yP.isTimeoutError)(i):return(0,FI.ERR)(new PU.RequestTimeoutError("Request timed out",{cause:i}));case(0,yP.isConnectionError)(i):return(0,FI.ERR)(new PU.ConnectionError("Unable to make request",{cause:i}));default:return(0,FI.ERR)(new PU.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};kI.ClientSDK=ANe;Zae=new WeakMap,Bx=new WeakMap,gP=new WeakMap;var NLt=/^application\/(?:.{0,100}\+)?json/;async function Ven(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 NLt.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 Wen(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,yP.matchContentType)(e,"application/json")||NLt.test(o)):t.log(await e.clone().json());break;case(0,yP.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,yP.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,yP.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 MNe=v(Xae=>{"use strict";Object.defineProperty(Xae,"__esModule",{value:!0});Xae.SDKError=void 0;var INe=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"}};Xae.SDKError=INe});var U5=v(q5=>{"use strict";Object.defineProperty(q5,"__esModule",{value:!0});q5.EventStream=void 0;q5.discardSentinel=Jen;var $5=10,B5=13,DLt=new Set([$5,B5]),Ken=[new Uint8Array([B5,$5,B5,$5]),new Uint8Array([B5,B5]),new Uint8Array([$5,$5])],RNe=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=LLt(r,s);if(u==null)continue;let l=r.slice(n,s);n=s+u.length;let c=jNe(l,this.decoder);c!=null&&(yield c)}n>0&&(r=r.slice(n),n=0)}if(r.length>0){let o=jNe(r,this.decoder);o!=null&&(yield o)}}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{e.releaseLock()}}};q5.EventStream=RNe;function LLt(t,e){let r=t[e],n=t[e+1];if(r==null||n==null||!DLt.has(r)||!DLt.has(n))return null;for(let o of Ken){let i=Gen(e,t,o);if(i!=null)return i}return null}function Gen(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 jNe(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 Jen(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=LLt(n,d);if(f==null)continue;let p=o,m=n.slice(p,d);o=d+f.length,jNe(m,Yen)?.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 Yen(t){return t}});var LNe=v(db=>{"use strict";var Zen=db&&db.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xen=db&&db.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qen=db&&db.__importStar||function(t){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 Xen(e,t),e};Object.defineProperty(db,"__esModule",{value:!0});db.SDKValidationError=void 0;db.formatZodError=DNe;var etn=Qen(Te()),NNe=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 etn.ZodError?`${this.rawMessage}
${DNe(this.cause)}`:this.toString()}};db.SDKValidationError=NNe;function DNe(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(`${DNe(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var ve=v(z5=>{"use strict";Object.defineProperty(z5,"__esModule",{value:!0});z5.parse=rtn;z5.safeParse=ntn;z5.collectExtraKeys=otn;var ttn=Te(),kLt=LNe(),FLt=Ig();function rtn(t,e,r){try{return e(t)}catch(n){throw n instanceof ttn.ZodError?new kLt.SDKValidationError(r,n,t):n}}function ntn(t,e,r){try{return(0,FLt.OK)(e(t))}catch(n){return(0,FLt.ERR)(new kLt.SDKValidationError(r,n,t))}}function otn(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 ai=v(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.jsonErr=stn;hc.json=utn;hc.textErr=ltn;hc.text=ctn;hc.bytesErr=dtn;hc.bytes=ftn;hc.streamErr=ptn;hc.stream=mtn;hc.sseErr=htn;hc.sse=gtn;hc.nilErr=ytn;hc.nil=btn;hc.fail=_tn;hc.match=vtn;hc.unpackHeaders=Qae;hc.discardResponseBody=zLt;var $Lt=MNe(),itn=U5(),BLt=L5(),qLt=SNe(),ULt=ve(),atn={json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function stn(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function utn(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function ltn(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function ctn(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function dtn(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function ftn(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function ptn(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function mtn(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function htn(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function gtn(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function ytn(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function btn(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function _tn(t){return{enc:"fail",codes:t}}function vtn(...t){return async function(r,n){let o,i;for(let l of t){let{codes:c}=l,d="ctype"in l?l.ctype:atn[l.enc];if(d&&(0,BLt.matchResponse)(r,c,d)){i=l;break}else if(!d&&(0,BLt.matchStatusCode)(r,c)){i=l;break}}if(!i){let l=await r.text();return[{ok:!1,error:new $Lt.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,itn.discardSentinel)(r.body,i.sseSentinel):r.body;break;case"nil":o=await zLt(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 $Lt.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:Qae(r.headers)}:null,...(0,qLt.isPlainObject)(o)?o:null}:s?u={...n?.extraFields,...i.hdrs?{Headers:Qae(r.headers)}:null,[s]:o}:i.hdrs?u={...n?.extraFields,...i.hdrs?{Headers:Qae(r.headers)}:null,...(0,qLt.isPlainObject)(o)?o:null}:u=o,"err"in i){let l=(0,ULt.safeParse)(u,c=>i.schema.parse(c),"Response validation failed");return[l.ok?{ok:!1,error:l.value}:l,o]}else return[(0,ULt.safeParse)(u,l=>i.schema.parse(l),"Response validation failed"),o]}}var wtn=/, */;function Qae(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(wtn);return e}async function zLt(t){let e=t.body?.getReader();if(e!=null)try{let r=!1;for(;!r;)r=(await e.read()).done}finally{e.releaseLock()}}});var Ue=v(dD=>{"use strict";Object.defineProperty(dD,"__esModule",{value:!0});dD.invariant=Stn;dD.remap=xtn;dD.combineSignals=Ctn;dD.abortSignalAny=HLt;dD.compactMap=Otn;var FNe=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Stn(t,e){if(!t)throw new FNe(e)}function xtn(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 Ctn(...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):HLt(e)}}function HLt(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 Otn(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}});var si=v(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});bP.SecurityError=bP.SecurityErrorCode=void 0;bP.resolveSecurity=VLt;bP.resolveGlobalSecurity=Ttn;bP.extractSecurity=Atn;var Ptn=ENe(),tse;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(tse||(bP.SecurityErrorCode=tse={}));var rse=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(tse.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(tse.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};bP.SecurityError=rse;function VLt(...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":Etn(e,n);break;case"http:custom":break;case"http:bearer":ese(e,n);break;case"oauth2":ese(e,n);break;case"oauth2:password":ese(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":ese(e,n);break;default:throw rse.unrecognizedType(o)}}),e)}function Etn(t,e){e.value!=null&&(t.basic=e.value)}function ese(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 Ttn(t){return VLt([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Ptn.env)().MISTRAL_API_KEY}])}async function Atn(t){if(t!=null)return typeof t=="function"?t():t}});var kNe=v(ru=>{"use strict";var Itn=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]}),Mtn=ru&&ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rtn=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)&&Itn(e,t,r);return Mtn(e,t),e};Object.defineProperty(ru,"__esModule",{value:!0});ru.ImageURL$=ru.ImageURL$outboundSchema=ru.ImageURL$inboundSchema=void 0;ru.imageURLToJSON=Ntn;ru.imageURLFromJSON=Dtn;var $I=Rtn(Te()),jtn=ve();ru.ImageURL$inboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});ru.ImageURL$outboundSchema=$I.object({url:$I.string(),detail:$I.nullable($I.string()).optional()});var WLt;(function(t){t.inboundSchema=ru.ImageURL$inboundSchema,t.outboundSchema=ru.ImageURL$outboundSchema})(WLt||(ru.ImageURL$=WLt={}));function Ntn(t){return JSON.stringify(ru.ImageURL$outboundSchema.parse(t))}function Dtn(t){return(0,jtn.safeParse)(t,e=>ru.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var $Ne=v(Pr=>{"use strict";var Ltn=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ftn=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ktn=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ltn(e,t,r);return Ftn(e,t),e};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ImageURLChunk$=Pr.ImageURLChunk$outboundSchema=Pr.ImageURLChunk$inboundSchema=Pr.ImageURLChunkType$=Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema=Pr.ImageURLChunkImageURL$=Pr.ImageURLChunkImageURL$outboundSchema=Pr.ImageURLChunkImageURL$inboundSchema=Pr.ImageURLChunkType=void 0;Pr.imageURLChunkImageURLToJSON=$tn;Pr.imageURLChunkImageURLFromJSON=Btn;Pr.imageURLChunkToJSON=qtn;Pr.imageURLChunkFromJSON=Utn;var fb=ktn(Te()),YLt=Ue(),ZLt=ve(),nse=kNe();Pr.ImageURLChunkType={ImageUrl:"image_url"};Pr.ImageURLChunkImageURL$inboundSchema=fb.union([nse.ImageURL$inboundSchema,fb.string()]);Pr.ImageURLChunkImageURL$outboundSchema=fb.union([nse.ImageURL$outboundSchema,fb.string()]);var KLt;(function(t){t.inboundSchema=Pr.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=Pr.ImageURLChunkImageURL$outboundSchema})(KLt||(Pr.ImageURLChunkImageURL$=KLt={}));function $tn(t){return JSON.stringify(Pr.ImageURLChunkImageURL$outboundSchema.parse(t))}function Btn(t){return(0,ZLt.safeParse)(t,e=>Pr.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}Pr.ImageURLChunkType$inboundSchema=fb.nativeEnum(Pr.ImageURLChunkType);Pr.ImageURLChunkType$outboundSchema=Pr.ImageURLChunkType$inboundSchema;var GLt;(function(t){t.inboundSchema=Pr.ImageURLChunkType$inboundSchema,t.outboundSchema=Pr.ImageURLChunkType$outboundSchema})(GLt||(Pr.ImageURLChunkType$=GLt={}));Pr.ImageURLChunk$inboundSchema=fb.object({image_url:fb.union([nse.ImageURL$inboundSchema,fb.string()]),type:Pr.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,YLt.remap)(t,{image_url:"imageUrl"}));Pr.ImageURLChunk$outboundSchema=fb.object({imageUrl:fb.union([nse.ImageURL$outboundSchema,fb.string()]),type:Pr.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,YLt.remap)(t,{imageUrl:"image_url"}));var JLt;(function(t){t.inboundSchema=Pr.ImageURLChunk$inboundSchema,t.outboundSchema=Pr.ImageURLChunk$outboundSchema})(JLt||(Pr.ImageURLChunk$=JLt={}));function qtn(t){return JSON.stringify(Pr.ImageURLChunk$outboundSchema.parse(t))}function Utn(t){return(0,ZLt.safeParse)(t,e=>Pr.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var BNe=v(so=>{"use strict";var ztn=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]}),Htn=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vtn=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)&&ztn(e,t,r);return Htn(e,t),e};Object.defineProperty(so,"__esModule",{value:!0});so.ReferenceChunk$=so.ReferenceChunk$outboundSchema=so.ReferenceChunk$inboundSchema=so.ReferenceChunkType$=so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema=so.ReferenceChunkType=void 0;so.referenceChunkToJSON=Ktn;so.referenceChunkFromJSON=Gtn;var fD=Vtn(Te()),eFt=Ue(),Wtn=ve();so.ReferenceChunkType={Reference:"reference"};so.ReferenceChunkType$inboundSchema=fD.nativeEnum(so.ReferenceChunkType);so.ReferenceChunkType$outboundSchema=so.ReferenceChunkType$inboundSchema;var XLt;(function(t){t.inboundSchema=so.ReferenceChunkType$inboundSchema,t.outboundSchema=so.ReferenceChunkType$outboundSchema})(XLt||(so.ReferenceChunkType$=XLt={}));so.ReferenceChunk$inboundSchema=fD.object({reference_ids:fD.array(fD.number().int()),type:so.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,eFt.remap)(t,{reference_ids:"referenceIds"}));so.ReferenceChunk$outboundSchema=fD.object({referenceIds:fD.array(fD.number().int()),type:so.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,eFt.remap)(t,{referenceIds:"reference_ids"}));var QLt;(function(t){t.inboundSchema=so.ReferenceChunk$inboundSchema,t.outboundSchema=so.ReferenceChunk$outboundSchema})(QLt||(so.ReferenceChunk$=QLt={}));function Ktn(t){return JSON.stringify(so.ReferenceChunk$outboundSchema.parse(t))}function Gtn(t){return(0,Wtn.safeParse)(t,e=>so.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var ose=v(uo=>{"use strict";var Jtn=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]}),Ytn=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ztn=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)&&Jtn(e,t,r);return Ytn(e,t),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.TextChunk$=uo.TextChunk$outboundSchema=uo.TextChunk$inboundSchema=uo.TextChunkType$=uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema=uo.TextChunkType=void 0;uo.textChunkToJSON=Qtn;uo.textChunkFromJSON=ern;var H5=Ztn(Te()),Xtn=ve();uo.TextChunkType={Text:"text"};uo.TextChunkType$inboundSchema=H5.nativeEnum(uo.TextChunkType);uo.TextChunkType$outboundSchema=uo.TextChunkType$inboundSchema;var tFt;(function(t){t.inboundSchema=uo.TextChunkType$inboundSchema,t.outboundSchema=uo.TextChunkType$outboundSchema})(tFt||(uo.TextChunkType$=tFt={}));uo.TextChunk$inboundSchema=H5.object({text:H5.string(),type:uo.TextChunkType$inboundSchema.default("text")});uo.TextChunk$outboundSchema=H5.object({text:H5.string(),type:uo.TextChunkType$outboundSchema.default("text")});var rFt;(function(t){t.inboundSchema=uo.TextChunk$inboundSchema,t.outboundSchema=uo.TextChunk$outboundSchema})(rFt||(uo.TextChunk$=rFt={}));function Qtn(t){return JSON.stringify(uo.TextChunk$outboundSchema.parse(t))}function ern(t){return(0,Xtn.safeParse)(t,e=>uo.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var EU=v(nu=>{"use strict";var trn=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]}),rrn=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nrn=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)&&trn(e,t,r);return rrn(e,t),e};Object.defineProperty(nu,"__esModule",{value:!0});nu.ContentChunk$=nu.ContentChunk$outboundSchema=nu.ContentChunk$inboundSchema=void 0;nu.contentChunkToJSON=irn;nu.contentChunkFromJSON=arn;var em=nrn(Te()),orn=ve(),oFt=$Ne(),iFt=BNe(),aFt=ose();nu.ContentChunk$inboundSchema=em.union([oFt.ImageURLChunk$inboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),aFt.TextChunk$inboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),iFt.ReferenceChunk$inboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);nu.ContentChunk$outboundSchema=em.union([oFt.ImageURLChunk$outboundSchema.and(em.object({type:em.literal("image_url")}).transform(t=>({type:t.type}))),aFt.TextChunk$outboundSchema.and(em.object({type:em.literal("text")}).transform(t=>({type:t.type}))),iFt.ReferenceChunk$outboundSchema.and(em.object({type:em.literal("reference")}).transform(t=>({type:t.type})))]);var nFt;(function(t){t.inboundSchema=nu.ContentChunk$inboundSchema,t.outboundSchema=nu.ContentChunk$outboundSchema})(nFt||(nu.ContentChunk$=nFt={}));function irn(t){return JSON.stringify(nu.ContentChunk$outboundSchema.parse(t))}function arn(t){return(0,orn.safeParse)(t,e=>nu.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var qNe=v(Ao=>{"use strict";var srn=Ao&&Ao.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),urn=Ao&&Ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lrn=Ao&&Ao.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&srn(e,t,r);return urn(e,t),e};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.FunctionCall$=Ao.FunctionCall$outboundSchema=Ao.FunctionCall$inboundSchema=Ao.Arguments$=Ao.Arguments$outboundSchema=Ao.Arguments$inboundSchema=void 0;Ao.argumentsToJSON=crn;Ao.argumentsFromJSON=drn;Ao.functionCallToJSON=frn;Ao.functionCallFromJSON=prn;var ou=lrn(Te()),lFt=ve();Ao.Arguments$inboundSchema=ou.union([ou.record(ou.any()),ou.string()]);Ao.Arguments$outboundSchema=ou.union([ou.record(ou.any()),ou.string()]);var sFt;(function(t){t.inboundSchema=Ao.Arguments$inboundSchema,t.outboundSchema=Ao.Arguments$outboundSchema})(sFt||(Ao.Arguments$=sFt={}));function crn(t){return JSON.stringify(Ao.Arguments$outboundSchema.parse(t))}function drn(t){return(0,lFt.safeParse)(t,e=>Ao.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}Ao.FunctionCall$inboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});Ao.FunctionCall$outboundSchema=ou.object({name:ou.string(),arguments:ou.union([ou.record(ou.any()),ou.string()])});var uFt;(function(t){t.inboundSchema=Ao.FunctionCall$inboundSchema,t.outboundSchema=Ao.FunctionCall$outboundSchema})(uFt||(Ao.FunctionCall$=uFt={}));function frn(t){return JSON.stringify(Ao.FunctionCall$outboundSchema.parse(t))}function prn(t){return(0,lFt.safeParse)(t,e=>Ao.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var BI=v(UNe=>{"use strict";Object.defineProperty(UNe,"__esModule",{value:!0});UNe.catchUnrecognizedEnum=mrn;function mrn(t){return t}});var V5=v(iu=>{"use strict";var hrn=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]}),grn=iu&&iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yrn=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)&&hrn(e,t,r);return grn(e,t),e};Object.defineProperty(iu,"__esModule",{value:!0});iu.ToolTypes$=iu.ToolTypes$outboundSchema=iu.ToolTypes$inboundSchema=iu.ToolTypes=void 0;var pD=yrn(Te()),brn=BI();iu.ToolTypes={Function:"function"};iu.ToolTypes$inboundSchema=pD.union([pD.nativeEnum(iu.ToolTypes),pD.string().transform(brn.catchUnrecognizedEnum)]);iu.ToolTypes$outboundSchema=pD.union([pD.nativeEnum(iu.ToolTypes),pD.string().and(pD.custom())]);var cFt;(function(t){t.inboundSchema=iu.ToolTypes$inboundSchema,t.outboundSchema=iu.ToolTypes$outboundSchema})(cFt||(iu.ToolTypes$=cFt={}))});var ise=v(au=>{"use strict";var _rn=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]}),vrn=au&&au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wrn=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)&&_rn(e,t,r);return vrn(e,t),e};Object.defineProperty(au,"__esModule",{value:!0});au.ToolCall$=au.ToolCall$outboundSchema=au.ToolCall$inboundSchema=void 0;au.toolCallToJSON=xrn;au.toolCallFromJSON=Crn;var TU=wrn(Te()),Srn=ve(),fFt=qNe(),pFt=V5();au.ToolCall$inboundSchema=TU.object({id:TU.string().default("null"),type:pFt.ToolTypes$inboundSchema.optional(),function:fFt.FunctionCall$inboundSchema,index:TU.number().int().default(0)});au.ToolCall$outboundSchema=TU.object({id:TU.string().default("null"),type:pFt.ToolTypes$outboundSchema.optional(),function:fFt.FunctionCall$outboundSchema,index:TU.number().int().default(0)});var dFt;(function(t){t.inboundSchema=au.ToolCall$inboundSchema,t.outboundSchema=au.ToolCall$outboundSchema})(dFt||(au.ToolCall$=dFt={}));function xrn(t){return JSON.stringify(au.ToolCall$outboundSchema.parse(t))}function Crn(t){return(0,Srn.safeParse)(t,e=>au.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var qI=v(Er=>{"use strict";var Orn=Er&&Er.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Prn=Er&&Er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ern=Er&&Er.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Orn(e,t,r);return Prn(e,t),e};Object.defineProperty(Er,"__esModule",{value:!0});Er.AssistantMessage$=Er.AssistantMessage$outboundSchema=Er.AssistantMessage$inboundSchema=Er.AssistantMessageRole$=Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema=Er.AssistantMessageContent$=Er.AssistantMessageContent$outboundSchema=Er.AssistantMessageContent$inboundSchema=Er.AssistantMessageRole=void 0;Er.assistantMessageContentToJSON=Trn;Er.assistantMessageContentFromJSON=Arn;Er.assistantMessageToJSON=Irn;Er.assistantMessageFromJSON=Mrn;var Xa=Ern(Te()),yFt=Ue(),bFt=ve(),ase=EU(),_Ft=ise();Er.AssistantMessageRole={Assistant:"assistant"};Er.AssistantMessageContent$inboundSchema=Xa.union([Xa.string(),Xa.array(ase.ContentChunk$inboundSchema)]);Er.AssistantMessageContent$outboundSchema=Xa.union([Xa.string(),Xa.array(ase.ContentChunk$outboundSchema)]);var mFt;(function(t){t.inboundSchema=Er.AssistantMessageContent$inboundSchema,t.outboundSchema=Er.AssistantMessageContent$outboundSchema})(mFt||(Er.AssistantMessageContent$=mFt={}));function Trn(t){return JSON.stringify(Er.AssistantMessageContent$outboundSchema.parse(t))}function Arn(t){return(0,bFt.safeParse)(t,e=>Er.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}Er.AssistantMessageRole$inboundSchema=Xa.nativeEnum(Er.AssistantMessageRole);Er.AssistantMessageRole$outboundSchema=Er.AssistantMessageRole$inboundSchema;var hFt;(function(t){t.inboundSchema=Er.AssistantMessageRole$inboundSchema,t.outboundSchema=Er.AssistantMessageRole$outboundSchema})(hFt||(Er.AssistantMessageRole$=hFt={}));Er.AssistantMessage$inboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(ase.ContentChunk$inboundSchema)])).optional(),tool_calls:Xa.nullable(Xa.array(_Ft.ToolCall$inboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,yFt.remap)(t,{tool_calls:"toolCalls"}));Er.AssistantMessage$outboundSchema=Xa.object({content:Xa.nullable(Xa.union([Xa.string(),Xa.array(ase.ContentChunk$outboundSchema)])).optional(),toolCalls:Xa.nullable(Xa.array(_Ft.ToolCall$outboundSchema)).optional(),prefix:Xa.boolean().default(!1),role:Er.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,yFt.remap)(t,{toolCalls:"tool_calls"}));var gFt;(function(t){t.inboundSchema=Er.AssistantMessage$inboundSchema,t.outboundSchema=Er.AssistantMessage$outboundSchema})(gFt||(Er.AssistantMessage$=gFt={}));function Irn(t){return JSON.stringify(Er.AssistantMessage$outboundSchema.parse(t))}function Mrn(t){return(0,bFt.safeParse)(t,e=>Er.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var AU=v(Io=>{"use strict";var Rrn=Io&&Io.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jrn=Io&&Io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nrn=Io&&Io.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rrn(e,t,r);return jrn(e,t),e};Object.defineProperty(Io,"__esModule",{value:!0});Io.Prediction$=Io.Prediction$outboundSchema=Io.Prediction$inboundSchema=Io.PredictionType$=Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema=Io.PredictionType=void 0;Io.predictionToJSON=Lrn;Io.predictionFromJSON=Frn;var mD=Nrn(Te()),Drn=ve();Io.PredictionType={Content:"content"};Io.PredictionType$inboundSchema=mD.nativeEnum(Io.PredictionType);Io.PredictionType$outboundSchema=Io.PredictionType$inboundSchema;var vFt;(function(t){t.inboundSchema=Io.PredictionType$inboundSchema,t.outboundSchema=Io.PredictionType$outboundSchema})(vFt||(Io.PredictionType$=vFt={}));Io.Prediction$inboundSchema=mD.object({type:mD.literal("content").default("content"),content:mD.string().default("")});Io.Prediction$outboundSchema=mD.object({type:mD.literal("content").default("content"),content:mD.string().default("")});var wFt;(function(t){t.inboundSchema=Io.Prediction$inboundSchema,t.outboundSchema=Io.Prediction$outboundSchema})(wFt||(Io.Prediction$=wFt={}));function Lrn(t){return JSON.stringify(Io.Prediction$outboundSchema.parse(t))}function Frn(t){return(0,Drn.safeParse)(t,e=>Io.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var zNe=v(su=>{"use strict";var krn=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]}),$rn=su&&su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Brn=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)&&krn(e,t,r);return $rn(e,t),e};Object.defineProperty(su,"__esModule",{value:!0});su.JsonSchema$=su.JsonSchema$outboundSchema=su.JsonSchema$inboundSchema=void 0;su.jsonSchemaToJSON=Urn;su.jsonSchemaFromJSON=zrn;var tm=Brn(Te()),xFt=Ue(),qrn=ve();su.JsonSchema$inboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schema:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,xFt.remap)(t,{schema:"schemaDefinition"}));su.JsonSchema$outboundSchema=tm.object({name:tm.string(),description:tm.nullable(tm.string()).optional(),schemaDefinition:tm.record(tm.any()),strict:tm.boolean().default(!1)}).transform(t=>(0,xFt.remap)(t,{schemaDefinition:"schema"}));var SFt;(function(t){t.inboundSchema=su.JsonSchema$inboundSchema,t.outboundSchema=su.JsonSchema$outboundSchema})(SFt||(su.JsonSchema$=SFt={}));function Urn(t){return JSON.stringify(su.JsonSchema$outboundSchema.parse(t))}function zrn(t){return(0,qrn.safeParse)(t,e=>su.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var HNe=v(uu=>{"use strict";var Hrn=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]}),Vrn=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wrn=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)&&Hrn(e,t,r);return Vrn(e,t),e};Object.defineProperty(uu,"__esModule",{value:!0});uu.ResponseFormats$=uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema=uu.ResponseFormats=void 0;var Krn=Wrn(Te());uu.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};uu.ResponseFormats$inboundSchema=Krn.nativeEnum(uu.ResponseFormats);uu.ResponseFormats$outboundSchema=uu.ResponseFormats$inboundSchema;var CFt;(function(t){t.inboundSchema=uu.ResponseFormats$inboundSchema,t.outboundSchema=uu.ResponseFormats$outboundSchema})(CFt||(uu.ResponseFormats$=CFt={}))});var IU=v(lu=>{"use strict";var Grn=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]}),Jrn=lu&&lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yrn=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)&&Grn(e,t,r);return Jrn(e,t),e};Object.defineProperty(lu,"__esModule",{value:!0});lu.ResponseFormat$=lu.ResponseFormat$outboundSchema=lu.ResponseFormat$inboundSchema=void 0;lu.responseFormatToJSON=Xrn;lu.responseFormatFromJSON=Qrn;var sse=Yrn(Te()),PFt=Ue(),Zrn=ve(),EFt=zNe(),TFt=HNe();lu.ResponseFormat$inboundSchema=sse.object({type:TFt.ResponseFormats$inboundSchema.optional(),json_schema:sse.nullable(EFt.JsonSchema$inboundSchema).optional()}).transform(t=>(0,PFt.remap)(t,{json_schema:"jsonSchema"}));lu.ResponseFormat$outboundSchema=sse.object({type:TFt.ResponseFormats$outboundSchema.optional(),jsonSchema:sse.nullable(EFt.JsonSchema$outboundSchema).optional()}).transform(t=>(0,PFt.remap)(t,{jsonSchema:"json_schema"}));var OFt;(function(t){t.inboundSchema=lu.ResponseFormat$inboundSchema,t.outboundSchema=lu.ResponseFormat$outboundSchema})(OFt||(lu.ResponseFormat$=OFt={}));function Xrn(t){return JSON.stringify(lu.ResponseFormat$outboundSchema.parse(t))}function Qrn(t){return(0,Zrn.safeParse)(t,e=>lu.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var hD=v(Tr=>{"use strict";var enn=Tr&&Tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tnn=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rnn=Tr&&Tr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&enn(e,t,r);return tnn(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.SystemMessage$=Tr.SystemMessage$outboundSchema=Tr.SystemMessage$inboundSchema=Tr.Role$=Tr.Role$outboundSchema=Tr.Role$inboundSchema=Tr.SystemMessageContent$=Tr.SystemMessageContent$outboundSchema=Tr.SystemMessageContent$inboundSchema=Tr.Role=void 0;Tr.systemMessageContentToJSON=nnn;Tr.systemMessageContentFromJSON=onn;Tr.systemMessageToJSON=inn;Tr.systemMessageFromJSON=ann;var Qf=rnn(Te()),RFt=ve(),use=ose();Tr.Role={System:"system"};Tr.SystemMessageContent$inboundSchema=Qf.union([Qf.string(),Qf.array(use.TextChunk$inboundSchema)]);Tr.SystemMessageContent$outboundSchema=Qf.union([Qf.string(),Qf.array(use.TextChunk$outboundSchema)]);var AFt;(function(t){t.inboundSchema=Tr.SystemMessageContent$inboundSchema,t.outboundSchema=Tr.SystemMessageContent$outboundSchema})(AFt||(Tr.SystemMessageContent$=AFt={}));function nnn(t){return JSON.stringify(Tr.SystemMessageContent$outboundSchema.parse(t))}function onn(t){return(0,RFt.safeParse)(t,e=>Tr.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}Tr.Role$inboundSchema=Qf.nativeEnum(Tr.Role);Tr.Role$outboundSchema=Tr.Role$inboundSchema;var IFt;(function(t){t.inboundSchema=Tr.Role$inboundSchema,t.outboundSchema=Tr.Role$outboundSchema})(IFt||(Tr.Role$=IFt={}));Tr.SystemMessage$inboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(use.TextChunk$inboundSchema)]),role:Tr.Role$inboundSchema.default("system")});Tr.SystemMessage$outboundSchema=Qf.object({content:Qf.union([Qf.string(),Qf.array(use.TextChunk$outboundSchema)]),role:Tr.Role$outboundSchema.default("system")});var MFt;(function(t){t.inboundSchema=Tr.SystemMessage$inboundSchema,t.outboundSchema=Tr.SystemMessage$outboundSchema})(MFt||(Tr.SystemMessage$=MFt={}));function inn(t){return JSON.stringify(Tr.SystemMessage$outboundSchema.parse(t))}function ann(t){return(0,RFt.safeParse)(t,e=>Tr.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var VNe=v(cu=>{"use strict";var snn=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]}),unn=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lnn=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)&&snn(e,t,r);return unn(e,t),e};Object.defineProperty(cu,"__esModule",{value:!0});cu.FunctionT$=cu.FunctionT$outboundSchema=cu.FunctionT$inboundSchema=void 0;cu.functionToJSON=dnn;cu.functionFromJSON=fnn;var Dg=lnn(Te()),cnn=ve();cu.FunctionT$inboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});cu.FunctionT$outboundSchema=Dg.object({name:Dg.string(),description:Dg.string().default(""),strict:Dg.boolean().default(!1),parameters:Dg.record(Dg.any())});var jFt;(function(t){t.inboundSchema=cu.FunctionT$inboundSchema,t.outboundSchema=cu.FunctionT$outboundSchema})(jFt||(cu.FunctionT$=jFt={}));function dnn(t){return JSON.stringify(cu.FunctionT$outboundSchema.parse(t))}function fnn(t){return(0,cnn.safeParse)(t,e=>cu.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var MU=v(du=>{"use strict";var pnn=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]}),mnn=du&&du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hnn=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)&&pnn(e,t,r);return mnn(e,t),e};Object.defineProperty(du,"__esModule",{value:!0});du.Tool$=du.Tool$outboundSchema=du.Tool$inboundSchema=void 0;du.toolToJSON=ynn;du.toolFromJSON=bnn;var DFt=hnn(Te()),gnn=ve(),LFt=VNe(),FFt=V5();du.Tool$inboundSchema=DFt.object({type:FFt.ToolTypes$inboundSchema.optional(),function:LFt.FunctionT$inboundSchema});du.Tool$outboundSchema=DFt.object({type:FFt.ToolTypes$outboundSchema.optional(),function:LFt.FunctionT$outboundSchema});var NFt;(function(t){t.inboundSchema=du.Tool$inboundSchema,t.outboundSchema=du.Tool$outboundSchema})(NFt||(du.Tool$=NFt={}));function ynn(t){return JSON.stringify(du.Tool$outboundSchema.parse(t))}function bnn(t){return(0,gnn.safeParse)(t,e=>du.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var WNe=v(fu=>{"use strict";var _nn=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]}),vnn=fu&&fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wnn=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)&&_nn(e,t,r);return vnn(e,t),e};Object.defineProperty(fu,"__esModule",{value:!0});fu.FunctionName$=fu.FunctionName$outboundSchema=fu.FunctionName$inboundSchema=void 0;fu.functionNameToJSON=xnn;fu.functionNameFromJSON=Cnn;var lse=wnn(Te()),Snn=ve();fu.FunctionName$inboundSchema=lse.object({name:lse.string()});fu.FunctionName$outboundSchema=lse.object({name:lse.string()});var kFt;(function(t){t.inboundSchema=fu.FunctionName$inboundSchema,t.outboundSchema=fu.FunctionName$outboundSchema})(kFt||(fu.FunctionName$=kFt={}));function xnn(t){return JSON.stringify(fu.FunctionName$outboundSchema.parse(t))}function Cnn(t){return(0,Snn.safeParse)(t,e=>fu.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var RU=v(pu=>{"use strict";var Onn=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]}),Pnn=pu&&pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Enn=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)&&Onn(e,t,r);return Pnn(e,t),e};Object.defineProperty(pu,"__esModule",{value:!0});pu.ToolChoice$=pu.ToolChoice$outboundSchema=pu.ToolChoice$inboundSchema=void 0;pu.toolChoiceToJSON=Ann;pu.toolChoiceFromJSON=Inn;var BFt=Enn(Te()),Tnn=ve(),qFt=WNe(),UFt=V5();pu.ToolChoice$inboundSchema=BFt.object({type:UFt.ToolTypes$inboundSchema.optional(),function:qFt.FunctionName$inboundSchema});pu.ToolChoice$outboundSchema=BFt.object({type:UFt.ToolTypes$outboundSchema.optional(),function:qFt.FunctionName$outboundSchema});var $Ft;(function(t){t.inboundSchema=pu.ToolChoice$inboundSchema,t.outboundSchema=pu.ToolChoice$outboundSchema})($Ft||(pu.ToolChoice$=$Ft={}));function Ann(t){return JSON.stringify(pu.ToolChoice$outboundSchema.parse(t))}function Inn(t){return(0,Tnn.safeParse)(t,e=>pu.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var jU=v(mu=>{"use strict";var Mnn=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]}),Rnn=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jnn=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)&&Mnn(e,t,r);return Rnn(e,t),e};Object.defineProperty(mu,"__esModule",{value:!0});mu.ToolChoiceEnum$=mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema=mu.ToolChoiceEnum=void 0;var Nnn=jnn(Te());mu.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};mu.ToolChoiceEnum$inboundSchema=Nnn.nativeEnum(mu.ToolChoiceEnum);mu.ToolChoiceEnum$outboundSchema=mu.ToolChoiceEnum$inboundSchema;var zFt;(function(t){t.inboundSchema=mu.ToolChoiceEnum$inboundSchema,t.outboundSchema=mu.ToolChoiceEnum$outboundSchema})(zFt||(mu.ToolChoiceEnum$=zFt={}))});var gD=v(Ar=>{"use strict";var Dnn=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]}),Lnn=Ar&&Ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fnn=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)&&Dnn(e,t,r);return Lnn(e,t),e};Object.defineProperty(Ar,"__esModule",{value:!0});Ar.ToolMessage$=Ar.ToolMessage$outboundSchema=Ar.ToolMessage$inboundSchema=Ar.ToolMessageRole$=Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema=Ar.ToolMessageContent$=Ar.ToolMessageContent$outboundSchema=Ar.ToolMessageContent$inboundSchema=Ar.ToolMessageRole=void 0;Ar.toolMessageContentToJSON=knn;Ar.toolMessageContentFromJSON=$nn;Ar.toolMessageToJSON=Bnn;Ar.toolMessageFromJSON=qnn;var ha=Fnn(Te()),KFt=Ue(),GFt=ve(),cse=EU();Ar.ToolMessageRole={Tool:"tool"};Ar.ToolMessageContent$inboundSchema=ha.union([ha.string(),ha.array(cse.ContentChunk$inboundSchema)]);Ar.ToolMessageContent$outboundSchema=ha.union([ha.string(),ha.array(cse.ContentChunk$outboundSchema)]);var HFt;(function(t){t.inboundSchema=Ar.ToolMessageContent$inboundSchema,t.outboundSchema=Ar.ToolMessageContent$outboundSchema})(HFt||(Ar.ToolMessageContent$=HFt={}));function knn(t){return JSON.stringify(Ar.ToolMessageContent$outboundSchema.parse(t))}function $nn(t){return(0,GFt.safeParse)(t,e=>Ar.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}Ar.ToolMessageRole$inboundSchema=ha.nativeEnum(Ar.ToolMessageRole);Ar.ToolMessageRole$outboundSchema=Ar.ToolMessageRole$inboundSchema;var VFt;(function(t){t.inboundSchema=Ar.ToolMessageRole$inboundSchema,t.outboundSchema=Ar.ToolMessageRole$outboundSchema})(VFt||(Ar.ToolMessageRole$=VFt={}));Ar.ToolMessage$inboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(cse.ContentChunk$inboundSchema)])),tool_call_id:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,KFt.remap)(t,{tool_call_id:"toolCallId"}));Ar.ToolMessage$outboundSchema=ha.object({content:ha.nullable(ha.union([ha.string(),ha.array(cse.ContentChunk$outboundSchema)])),toolCallId:ha.nullable(ha.string()).optional(),name:ha.nullable(ha.string()).optional(),role:Ar.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,KFt.remap)(t,{toolCallId:"tool_call_id"}));var WFt;(function(t){t.inboundSchema=Ar.ToolMessage$inboundSchema,t.outboundSchema=Ar.ToolMessage$outboundSchema})(WFt||(Ar.ToolMessage$=WFt={}));function Bnn(t){return JSON.stringify(Ar.ToolMessage$outboundSchema.parse(t))}function qnn(t){return(0,GFt.safeParse)(t,e=>Ar.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var yD=v(Ir=>{"use strict";var Unn=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]}),znn=Ir&&Ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hnn=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)&&Unn(e,t,r);return znn(e,t),e};Object.defineProperty(Ir,"__esModule",{value:!0});Ir.UserMessage$=Ir.UserMessage$outboundSchema=Ir.UserMessage$inboundSchema=Ir.UserMessageRole$=Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema=Ir.UserMessageContent$=Ir.UserMessageContent$outboundSchema=Ir.UserMessageContent$inboundSchema=Ir.UserMessageRole=void 0;Ir.userMessageContentToJSON=Vnn;Ir.userMessageContentFromJSON=Wnn;Ir.userMessageToJSON=Knn;Ir.userMessageFromJSON=Gnn;var rd=Hnn(Te()),XFt=ve(),dse=EU();Ir.UserMessageRole={User:"user"};Ir.UserMessageContent$inboundSchema=rd.union([rd.string(),rd.array(dse.ContentChunk$inboundSchema)]);Ir.UserMessageContent$outboundSchema=rd.union([rd.string(),rd.array(dse.ContentChunk$outboundSchema)]);var JFt;(function(t){t.inboundSchema=Ir.UserMessageContent$inboundSchema,t.outboundSchema=Ir.UserMessageContent$outboundSchema})(JFt||(Ir.UserMessageContent$=JFt={}));function Vnn(t){return JSON.stringify(Ir.UserMessageContent$outboundSchema.parse(t))}function Wnn(t){return(0,XFt.safeParse)(t,e=>Ir.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}Ir.UserMessageRole$inboundSchema=rd.nativeEnum(Ir.UserMessageRole);Ir.UserMessageRole$outboundSchema=Ir.UserMessageRole$inboundSchema;var YFt;(function(t){t.inboundSchema=Ir.UserMessageRole$inboundSchema,t.outboundSchema=Ir.UserMessageRole$outboundSchema})(YFt||(Ir.UserMessageRole$=YFt={}));Ir.UserMessage$inboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(dse.ContentChunk$inboundSchema)])),role:Ir.UserMessageRole$inboundSchema.default("user")});Ir.UserMessage$outboundSchema=rd.object({content:rd.nullable(rd.union([rd.string(),rd.array(dse.ContentChunk$outboundSchema)])),role:Ir.UserMessageRole$outboundSchema.default("user")});var ZFt;(function(t){t.inboundSchema=Ir.UserMessage$inboundSchema,t.outboundSchema=Ir.UserMessage$outboundSchema})(ZFt||(Ir.UserMessage$=ZFt={}));function Knn(t){return JSON.stringify(Ir.UserMessage$outboundSchema.parse(t))}function Gnn(t){return(0,XFt.safeParse)(t,e=>Ir.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var skt=v(Jt=>{"use strict";var Jnn=Jt&&Jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ynn=Jt&&Jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Znn=Jt&&Jt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Jnn(e,t,r);return Ynn(e,t),e};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.AgentsCompletionRequest$=Jt.AgentsCompletionRequest$outboundSchema=Jt.AgentsCompletionRequest$inboundSchema=Jt.AgentsCompletionRequestToolChoice$=Jt.AgentsCompletionRequestToolChoice$outboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema=Jt.AgentsCompletionRequestMessages$=Jt.AgentsCompletionRequestMessages$outboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema=Jt.AgentsCompletionRequestStop$=Jt.AgentsCompletionRequestStop$outboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema=void 0;Jt.agentsCompletionRequestStopToJSON=Xnn;Jt.agentsCompletionRequestStopFromJSON=Qnn;Jt.agentsCompletionRequestMessagesToJSON=eon;Jt.agentsCompletionRequestMessagesFromJSON=ton;Jt.agentsCompletionRequestToolChoiceToJSON=ron;Jt.agentsCompletionRequestToolChoiceFromJSON=non;Jt.agentsCompletionRequestToJSON=oon;Jt.agentsCompletionRequestFromJSON=ion;var Xe=Znn(Te()),nkt=Ue(),fse=ve(),pse=qI(),okt=AU(),ikt=IU(),mse=hD(),akt=MU(),hse=RU(),gse=jU(),yse=gD(),bse=yD();Jt.AgentsCompletionRequestStop$inboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);Jt.AgentsCompletionRequestStop$outboundSchema=Xe.union([Xe.string(),Xe.array(Xe.string())]);var QFt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestStop$outboundSchema})(QFt||(Jt.AgentsCompletionRequestStop$=QFt={}));function Xnn(t){return JSON.stringify(Jt.AgentsCompletionRequestStop$outboundSchema.parse(t))}function Qnn(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Jt.AgentsCompletionRequestMessages$inboundSchema=Xe.union([mse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);Jt.AgentsCompletionRequestMessages$outboundSchema=Xe.union([mse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))]);var ekt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestMessages$outboundSchema})(ekt||(Jt.AgentsCompletionRequestMessages$=ekt={}));function eon(t){return JSON.stringify(Jt.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function ton(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Jt.AgentsCompletionRequestToolChoice$inboundSchema=Xe.union([hse.ToolChoice$inboundSchema,gse.ToolChoiceEnum$inboundSchema]);Jt.AgentsCompletionRequestToolChoice$outboundSchema=Xe.union([hse.ToolChoice$outboundSchema,gse.ToolChoiceEnum$outboundSchema]);var tkt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequestToolChoice$outboundSchema})(tkt||(Jt.AgentsCompletionRequestToolChoice$=tkt={}));function ron(t){return JSON.stringify(Jt.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function non(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Jt.AgentsCompletionRequest$inboundSchema=Xe.object({max_tokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),random_seed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([mse.SystemMessage$inboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$inboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$inboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$inboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:ikt.ResponseFormat$inboundSchema.optional(),tools:Xe.nullable(Xe.array(akt.Tool$inboundSchema)).optional(),tool_choice:Xe.union([hse.ToolChoice$inboundSchema,gse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Xe.number().optional(),frequency_penalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:okt.Prediction$inboundSchema.optional(),agent_id:Xe.string()}).transform(t=>(0,nkt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Jt.AgentsCompletionRequest$outboundSchema=Xe.object({maxTokens:Xe.nullable(Xe.number().int()).optional(),stream:Xe.boolean().default(!1),stop:Xe.union([Xe.string(),Xe.array(Xe.string())]).optional(),randomSeed:Xe.nullable(Xe.number().int()).optional(),messages:Xe.array(Xe.union([mse.SystemMessage$outboundSchema.and(Xe.object({role:Xe.literal("system")}).transform(t=>({role:t.role}))),bse.UserMessage$outboundSchema.and(Xe.object({role:Xe.literal("user")}).transform(t=>({role:t.role}))),pse.AssistantMessage$outboundSchema.and(Xe.object({role:Xe.literal("assistant")}).transform(t=>({role:t.role}))),yse.ToolMessage$outboundSchema.and(Xe.object({role:Xe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:ikt.ResponseFormat$outboundSchema.optional(),tools:Xe.nullable(Xe.array(akt.Tool$outboundSchema)).optional(),toolChoice:Xe.union([hse.ToolChoice$outboundSchema,gse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Xe.number().optional(),frequencyPenalty:Xe.number().optional(),n:Xe.nullable(Xe.number().int()).optional(),prediction:okt.Prediction$outboundSchema.optional(),agentId:Xe.string()}).transform(t=>(0,nkt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var rkt;(function(t){t.inboundSchema=Jt.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Jt.AgentsCompletionRequest$outboundSchema})(rkt||(Jt.AgentsCompletionRequest$=rkt={}));function oon(t){return JSON.stringify(Jt.AgentsCompletionRequest$outboundSchema.parse(t))}function ion(t){return(0,fse.safeParse)(t,e=>Jt.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var gkt=v(Yt=>{"use strict";var aon=Yt&&Yt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),son=Yt&&Yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uon=Yt&&Yt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aon(e,t,r);return son(e,t),e};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.AgentsCompletionStreamRequest$=Yt.AgentsCompletionStreamRequest$outboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Yt.AgentsCompletionStreamRequestMessages$=Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Yt.AgentsCompletionStreamRequestStop$=Yt.AgentsCompletionStreamRequestStop$outboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Yt.agentsCompletionStreamRequestStopToJSON=lon;Yt.agentsCompletionStreamRequestStopFromJSON=con;Yt.agentsCompletionStreamRequestMessagesToJSON=don;Yt.agentsCompletionStreamRequestMessagesFromJSON=fon;Yt.agentsCompletionStreamRequestToolChoiceToJSON=pon;Yt.agentsCompletionStreamRequestToolChoiceFromJSON=mon;Yt.agentsCompletionStreamRequestToJSON=hon;Yt.agentsCompletionStreamRequestFromJSON=gon;var Qe=uon(Te()),fkt=Ue(),_se=ve(),vse=qI(),pkt=AU(),mkt=IU(),wse=hD(),hkt=MU(),Sse=RU(),xse=jU(),Cse=gD(),Ose=yD();Yt.AgentsCompletionStreamRequestStop$inboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);Yt.AgentsCompletionStreamRequestStop$outboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);var ukt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestStop$outboundSchema})(ukt||(Yt.AgentsCompletionStreamRequestStop$=ukt={}));function lon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function con(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Yt.AgentsCompletionStreamRequestMessages$inboundSchema=Qe.union([wse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);Yt.AgentsCompletionStreamRequestMessages$outboundSchema=Qe.union([wse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))]);var lkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestMessages$outboundSchema})(lkt||(Yt.AgentsCompletionStreamRequestMessages$=lkt={}));function don(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function fon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema=Qe.union([Sse.ToolChoice$inboundSchema,xse.ToolChoiceEnum$inboundSchema]);Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema=Qe.union([Sse.ToolChoice$outboundSchema,xse.ToolChoiceEnum$outboundSchema]);var ckt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema})(ckt||(Yt.AgentsCompletionStreamRequestToolChoice$=ckt={}));function pon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function mon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Yt.AgentsCompletionStreamRequest$inboundSchema=Qe.object({max_tokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),random_seed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([wse.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),response_format:mkt.ResponseFormat$inboundSchema.optional(),tools:Qe.nullable(Qe.array(hkt.Tool$inboundSchema)).optional(),tool_choice:Qe.union([Sse.ToolChoice$inboundSchema,xse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Qe.number().optional(),frequency_penalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:pkt.Prediction$inboundSchema.optional(),agent_id:Qe.string()}).transform(t=>(0,fkt.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",agent_id:"agentId"}));Yt.AgentsCompletionStreamRequest$outboundSchema=Qe.object({maxTokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),randomSeed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([wse.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),Ose.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),vse.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role}))),Cse.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:mkt.ResponseFormat$outboundSchema.optional(),tools:Qe.nullable(Qe.array(hkt.Tool$outboundSchema)).optional(),toolChoice:Qe.union([Sse.ToolChoice$outboundSchema,xse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Qe.number().optional(),frequencyPenalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:pkt.Prediction$outboundSchema.optional(),agentId:Qe.string()}).transform(t=>(0,fkt.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",agentId:"agent_id"}));var dkt;(function(t){t.inboundSchema=Yt.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Yt.AgentsCompletionStreamRequest$outboundSchema})(dkt||(Yt.AgentsCompletionStreamRequest$=dkt={}));function hon(t){return JSON.stringify(Yt.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function gon(t){return(0,_se.safeParse)(t,e=>Yt.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var KNe=v(hu=>{"use strict";var yon=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]}),bon=hu&&hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_on=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)&&yon(e,t,r);return bon(e,t),e};Object.defineProperty(hu,"__esModule",{value:!0});hu.ApiEndpoint$=hu.ApiEndpoint$outboundSchema=hu.ApiEndpoint$inboundSchema=hu.ApiEndpoint=void 0;var bD=_on(Te()),von=BI();hu.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations"};hu.ApiEndpoint$inboundSchema=bD.union([bD.nativeEnum(hu.ApiEndpoint),bD.string().transform(von.catchUnrecognizedEnum)]);hu.ApiEndpoint$outboundSchema=bD.union([bD.nativeEnum(hu.ApiEndpoint),bD.string().and(bD.custom())]);var ykt;(function(t){t.inboundSchema=hu.ApiEndpoint$inboundSchema,t.outboundSchema=hu.ApiEndpoint$outboundSchema})(ykt||(hu.ApiEndpoint$=ykt={}))});var vkt=v(Mo=>{"use strict";var won=Mo&&Mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Son=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xon=Mo&&Mo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&won(e,t,r);return Son(e,t),e};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArchiveFTModelOut$=Mo.ArchiveFTModelOut$outboundSchema=Mo.ArchiveFTModelOut$inboundSchema=Mo.ArchiveFTModelOutObject$=Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema=Mo.ArchiveFTModelOutObject=void 0;Mo.archiveFTModelOutToJSON=Oon;Mo.archiveFTModelOutFromJSON=Pon;var _P=xon(Te()),Con=ve();Mo.ArchiveFTModelOutObject={Model:"model"};Mo.ArchiveFTModelOutObject$inboundSchema=_P.nativeEnum(Mo.ArchiveFTModelOutObject);Mo.ArchiveFTModelOutObject$outboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema;var bkt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOutObject$outboundSchema})(bkt||(Mo.ArchiveFTModelOutObject$=bkt={}));Mo.ArchiveFTModelOut$inboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});Mo.ArchiveFTModelOut$outboundSchema=_P.object({id:_P.string(),object:_P.literal("model").default("model"),archived:_P.boolean().default(!0)});var _kt;(function(t){t.inboundSchema=Mo.ArchiveFTModelOut$inboundSchema,t.outboundSchema=Mo.ArchiveFTModelOut$outboundSchema})(_kt||(Mo.ArchiveFTModelOut$=_kt={}));function Oon(t){return JSON.stringify(Mo.ArchiveFTModelOut$outboundSchema.parse(t))}function Pon(t){return(0,Con.safeParse)(t,e=>Mo.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var Pse=v(gu=>{"use strict";var Eon=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]}),Ton=gu&&gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aon=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)&&Eon(e,t,r);return Ton(e,t),e};Object.defineProperty(gu,"__esModule",{value:!0});gu.ModelCapabilities$=gu.ModelCapabilities$outboundSchema=gu.ModelCapabilities$inboundSchema=void 0;gu.modelCapabilitiesToJSON=Mon;gu.modelCapabilitiesFromJSON=Ron;var Lg=Aon(Te()),Skt=Ue(),Ion=ve();gu.ModelCapabilities$inboundSchema=Lg.object({completion_chat:Lg.boolean().default(!0),completion_fim:Lg.boolean().default(!1),function_calling:Lg.boolean().default(!0),fine_tuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Skt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));gu.ModelCapabilities$outboundSchema=Lg.object({completionChat:Lg.boolean().default(!0),completionFim:Lg.boolean().default(!1),functionCalling:Lg.boolean().default(!0),fineTuning:Lg.boolean().default(!1),vision:Lg.boolean().default(!1)}).transform(t=>(0,Skt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var wkt;(function(t){t.inboundSchema=gu.ModelCapabilities$inboundSchema,t.outboundSchema=gu.ModelCapabilities$outboundSchema})(wkt||(gu.ModelCapabilities$=wkt={}));function Mon(t){return JSON.stringify(gu.ModelCapabilities$outboundSchema.parse(t))}function Ron(t){return(0,Ion.safeParse)(t,e=>gu.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var GNe=v(Ro=>{"use strict";var jon=Ro&&Ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Non=Ro&&Ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Don=Ro&&Ro.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jon(e,t,r);return Non(e,t),e};Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BaseModelCard$=Ro.BaseModelCard$outboundSchema=Ro.BaseModelCard$inboundSchema=Ro.Type$=Ro.Type$outboundSchema=Ro.Type$inboundSchema=Ro.Type=void 0;Ro.baseModelCardToJSON=Fon;Ro.baseModelCardFromJSON=kon;var Kn=Don(Te()),Okt=Ue(),Lon=ve(),Pkt=Pse();Ro.Type={Base:"base"};Ro.Type$inboundSchema=Kn.nativeEnum(Ro.Type);Ro.Type$outboundSchema=Ro.Type$inboundSchema;var xkt;(function(t){t.inboundSchema=Ro.Type$inboundSchema,t.outboundSchema=Ro.Type$outboundSchema})(xkt||(Ro.Type$=xkt={}));Ro.BaseModelCard$inboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),owned_by:Kn.string().default("mistralai"),capabilities:Pkt.ModelCapabilities$inboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),max_context_length:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Okt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Ro.BaseModelCard$outboundSchema=Kn.object({id:Kn.string(),object:Kn.string().default("model"),created:Kn.number().int().optional(),ownedBy:Kn.string().default("mistralai"),capabilities:Pkt.ModelCapabilities$outboundSchema,name:Kn.nullable(Kn.string()).optional(),description:Kn.nullable(Kn.string()).optional(),maxContextLength:Kn.number().int().default(32768),aliases:Kn.array(Kn.string()).optional(),deprecation:Kn.nullable(Kn.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:Kn.nullable(Kn.number()).optional(),type:Kn.literal("base").default("base")}).transform(t=>(0,Okt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var Ckt;(function(t){t.inboundSchema=Ro.BaseModelCard$inboundSchema,t.outboundSchema=Ro.BaseModelCard$outboundSchema})(Ckt||(Ro.BaseModelCard$=Ckt={}));function Fon(t){return JSON.stringify(Ro.BaseModelCard$outboundSchema.parse(t))}function kon(t){return(0,Lon.safeParse)(t,e=>Ro.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var JNe=v(yu=>{"use strict";var $on=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]}),Bon=yu&&yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qon=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)&&$on(e,t,r);return Bon(e,t),e};Object.defineProperty(yu,"__esModule",{value:!0});yu.BatchError$=yu.BatchError$outboundSchema=yu.BatchError$inboundSchema=void 0;yu.batchErrorToJSON=zon;yu.batchErrorFromJSON=Hon;var NU=qon(Te()),Uon=ve();yu.BatchError$inboundSchema=NU.object({message:NU.string(),count:NU.number().int().default(1)});yu.BatchError$outboundSchema=NU.object({message:NU.string(),count:NU.number().int().default(1)});var Ekt;(function(t){t.inboundSchema=yu.BatchError$inboundSchema,t.outboundSchema=yu.BatchError$outboundSchema})(Ekt||(yu.BatchError$=Ekt={}));function zon(t){return JSON.stringify(yu.BatchError$outboundSchema.parse(t))}function Hon(t){return(0,Uon.safeParse)(t,e=>yu.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var Mkt=v(bu=>{"use strict";var Von=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]}),Won=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kon=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)&&Von(e,t,r);return Won(e,t),e};Object.defineProperty(bu,"__esModule",{value:!0});bu.BatchJobIn$=bu.BatchJobIn$outboundSchema=bu.BatchJobIn$inboundSchema=void 0;bu.batchJobInToJSON=Jon;bu.batchJobInFromJSON=Yon;var uf=Kon(Te()),Akt=Ue(),Gon=ve(),Ikt=KNe();bu.BatchJobIn$inboundSchema=uf.object({input_files:uf.array(uf.string()),endpoint:Ikt.ApiEndpoint$inboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeout_hours:uf.number().int().default(24)}).transform(t=>(0,Akt.remap)(t,{input_files:"inputFiles",timeout_hours:"timeoutHours"}));bu.BatchJobIn$outboundSchema=uf.object({inputFiles:uf.array(uf.string()),endpoint:Ikt.ApiEndpoint$outboundSchema,model:uf.string(),metadata:uf.nullable(uf.record(uf.string())).optional(),timeoutHours:uf.number().int().default(24)}).transform(t=>(0,Akt.remap)(t,{inputFiles:"input_files",timeoutHours:"timeout_hours"}));var Tkt;(function(t){t.inboundSchema=bu.BatchJobIn$inboundSchema,t.outboundSchema=bu.BatchJobIn$outboundSchema})(Tkt||(bu.BatchJobIn$=Tkt={}));function Jon(t){return JSON.stringify(bu.BatchJobIn$outboundSchema.parse(t))}function Yon(t){return(0,Gon.safeParse)(t,e=>bu.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var YNe=v(_u=>{"use strict";var Zon=_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]}),Xon=_u&&_u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qon=_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)&&Zon(e,t,r);return Xon(e,t),e};Object.defineProperty(_u,"__esModule",{value:!0});_u.BatchJobStatus$=_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema=_u.BatchJobStatus=void 0;var ein=Qon(Te());_u.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};_u.BatchJobStatus$inboundSchema=ein.nativeEnum(_u.BatchJobStatus);_u.BatchJobStatus$outboundSchema=_u.BatchJobStatus$inboundSchema;var Rkt;(function(t){t.inboundSchema=_u.BatchJobStatus$inboundSchema,t.outboundSchema=_u.BatchJobStatus$outboundSchema})(Rkt||(_u.BatchJobStatus$=Rkt={}))});var ZNe=v(jo=>{"use strict";var tin=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]}),rin=jo&&jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nin=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)&&tin(e,t,r);return rin(e,t),e};Object.defineProperty(jo,"__esModule",{value:!0});jo.BatchJobOut$=jo.BatchJobOut$outboundSchema=jo.BatchJobOut$inboundSchema=jo.BatchJobOutObject$=jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema=jo.BatchJobOutObject=void 0;jo.batchJobOutToJSON=iin;jo.batchJobOutFromJSON=ain;var mr=nin(Te()),Dkt=Ue(),oin=ve(),Lkt=JNe(),Fkt=YNe();jo.BatchJobOutObject={Batch:"batch"};jo.BatchJobOutObject$inboundSchema=mr.nativeEnum(jo.BatchJobOutObject);jo.BatchJobOutObject$outboundSchema=jo.BatchJobOutObject$inboundSchema;var jkt;(function(t){t.inboundSchema=jo.BatchJobOutObject$inboundSchema,t.outboundSchema=jo.BatchJobOutObject$outboundSchema})(jkt||(jo.BatchJobOutObject$=jkt={}));jo.BatchJobOut$inboundSchema=mr.object({id:mr.string(),object:mr.literal("batch").default("batch"),input_files:mr.array(mr.string()),metadata:mr.nullable(mr.record(mr.any())).optional(),endpoint:mr.string(),model:mr.string(),output_file:mr.nullable(mr.string()).optional(),error_file:mr.nullable(mr.string()).optional(),errors:mr.array(Lkt.BatchError$inboundSchema),status:Fkt.BatchJobStatus$inboundSchema,created_at:mr.number().int(),total_requests:mr.number().int(),completed_requests:mr.number().int(),succeeded_requests:mr.number().int(),failed_requests:mr.number().int(),started_at:mr.nullable(mr.number().int()).optional(),completed_at:mr.nullable(mr.number().int()).optional()}).transform(t=>(0,Dkt.remap)(t,{input_files:"inputFiles",output_file:"outputFile",error_file:"errorFile",created_at:"createdAt",total_requests:"totalRequests",completed_requests:"completedRequests",succeeded_requests:"succeededRequests",failed_requests:"failedRequests",started_at:"startedAt",completed_at:"completedAt"}));jo.BatchJobOut$outboundSchema=mr.object({id:mr.string(),object:mr.literal("batch").default("batch"),inputFiles:mr.array(mr.string()),metadata:mr.nullable(mr.record(mr.any())).optional(),endpoint:mr.string(),model:mr.string(),outputFile:mr.nullable(mr.string()).optional(),errorFile:mr.nullable(mr.string()).optional(),errors:mr.array(Lkt.BatchError$outboundSchema),status:Fkt.BatchJobStatus$outboundSchema,createdAt:mr.number().int(),totalRequests:mr.number().int(),completedRequests:mr.number().int(),succeededRequests:mr.number().int(),failedRequests:mr.number().int(),startedAt:mr.nullable(mr.number().int()).optional(),completedAt:mr.nullable(mr.number().int()).optional()}).transform(t=>(0,Dkt.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 Nkt;(function(t){t.inboundSchema=jo.BatchJobOut$inboundSchema,t.outboundSchema=jo.BatchJobOut$outboundSchema})(Nkt||(jo.BatchJobOut$=Nkt={}));function iin(t){return JSON.stringify(jo.BatchJobOut$outboundSchema.parse(t))}function ain(t){return(0,oin.safeParse)(t,e=>jo.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var qkt=v(No=>{"use strict";var sin=No&&No.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uin=No&&No.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lin=No&&No.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&sin(e,t,r);return uin(e,t),e};Object.defineProperty(No,"__esModule",{value:!0});No.BatchJobsOut$=No.BatchJobsOut$outboundSchema=No.BatchJobsOut$inboundSchema=No.BatchJobsOutObject$=No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema=No.BatchJobsOutObject=void 0;No.batchJobsOutToJSON=din;No.batchJobsOutFromJSON=fin;var vP=lin(Te()),cin=ve(),Bkt=ZNe();No.BatchJobsOutObject={List:"list"};No.BatchJobsOutObject$inboundSchema=vP.nativeEnum(No.BatchJobsOutObject);No.BatchJobsOutObject$outboundSchema=No.BatchJobsOutObject$inboundSchema;var kkt;(function(t){t.inboundSchema=No.BatchJobsOutObject$inboundSchema,t.outboundSchema=No.BatchJobsOutObject$outboundSchema})(kkt||(No.BatchJobsOutObject$=kkt={}));No.BatchJobsOut$inboundSchema=vP.object({data:vP.array(Bkt.BatchJobOut$inboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});No.BatchJobsOut$outboundSchema=vP.object({data:vP.array(Bkt.BatchJobOut$outboundSchema).optional(),object:vP.literal("list").default("list"),total:vP.number().int()});var $kt;(function(t){t.inboundSchema=No.BatchJobsOut$inboundSchema,t.outboundSchema=No.BatchJobsOut$outboundSchema})($kt||(No.BatchJobsOut$=$kt={}));function din(t){return JSON.stringify(No.BatchJobsOut$outboundSchema.parse(t))}function fin(t){return(0,cin.safeParse)(t,e=>No.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Kkt=v(Zt=>{"use strict";var pin=Zt&&Zt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),min=Zt&&Zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hin=Zt&&Zt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&pin(e,t,r);return min(e,t),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.ChatClassificationRequest$=Zt.ChatClassificationRequest$outboundSchema=Zt.ChatClassificationRequest$inboundSchema=Zt.ChatClassificationRequestInputs$=Zt.ChatClassificationRequestInputs$outboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema=Zt.One$=Zt.One$outboundSchema=Zt.One$inboundSchema=Zt.Two$=Zt.Two$outboundSchema=Zt.Two$inboundSchema=void 0;Zt.twoToJSON=gin;Zt.twoFromJSON=yin;Zt.oneToJSON=bin;Zt.oneFromJSON=_in;Zt.chatClassificationRequestInputsToJSON=vin;Zt.chatClassificationRequestInputsFromJSON=win;Zt.chatClassificationRequestToJSON=Sin;Zt.chatClassificationRequestFromJSON=xin;var ye=hin(Te()),Wkt=Ue(),Ese=ve(),Fg=qI(),kg=hD(),$g=gD(),Bg=yD();Zt.Two$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.Two$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var Ukt;(function(t){t.inboundSchema=Zt.Two$inboundSchema,t.outboundSchema=Zt.Two$outboundSchema})(Ukt||(Zt.Two$=Ukt={}));function gin(t){return JSON.stringify(Zt.Two$outboundSchema.parse(t))}function yin(t){return(0,Ese.safeParse)(t,e=>Zt.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Zt.One$inboundSchema=ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);Zt.One$outboundSchema=ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))]);var zkt;(function(t){t.inboundSchema=Zt.One$inboundSchema,t.outboundSchema=Zt.One$outboundSchema})(zkt||(Zt.One$=zkt={}));function bin(t){return JSON.stringify(Zt.One$outboundSchema.parse(t))}function _in(t){return(0,Ese.safeParse)(t,e=>Zt.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Zt.ChatClassificationRequestInputs$inboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);Zt.ChatClassificationRequestInputs$outboundSchema=ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]);var Hkt;(function(t){t.inboundSchema=Zt.ChatClassificationRequestInputs$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequestInputs$outboundSchema})(Hkt||(Zt.ChatClassificationRequestInputs$=Hkt={}));function vin(t){return JSON.stringify(Zt.ChatClassificationRequestInputs$outboundSchema.parse(t))}function win(t){return(0,Ese.safeParse)(t,e=>Zt.ChatClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequestInputs' from JSON")}Zt.ChatClassificationRequest$inboundSchema=ye.object({input:ye.union([ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$inboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$inboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$inboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$inboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Wkt.remap)(t,{input:"inputs"}));Zt.ChatClassificationRequest$outboundSchema=ye.object({inputs:ye.union([ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])),ye.array(ye.array(ye.union([kg.SystemMessage$outboundSchema.and(ye.object({role:ye.literal("system")}).transform(t=>({role:t.role}))),Bg.UserMessage$outboundSchema.and(ye.object({role:ye.literal("user")}).transform(t=>({role:t.role}))),Fg.AssistantMessage$outboundSchema.and(ye.object({role:ye.literal("assistant")}).transform(t=>({role:t.role}))),$g.ToolMessage$outboundSchema.and(ye.object({role:ye.literal("tool")}).transform(t=>({role:t.role})))])))]),model:ye.nullable(ye.string())}).transform(t=>(0,Wkt.remap)(t,{inputs:"input"}));var Vkt;(function(t){t.inboundSchema=Zt.ChatClassificationRequest$inboundSchema,t.outboundSchema=Zt.ChatClassificationRequest$outboundSchema})(Vkt||(Zt.ChatClassificationRequest$=Vkt={}));function Sin(t){return JSON.stringify(Zt.ChatClassificationRequest$outboundSchema.parse(t))}function xin(t){return(0,Ese.safeParse)(t,e=>Zt.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var Tse=v(lo=>{"use strict";var Cin=lo&&lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pin=lo&&lo.__importStar||function(t){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(lo,"__esModule",{value:!0});lo.ChatCompletionChoice$=lo.ChatCompletionChoice$outboundSchema=lo.ChatCompletionChoice$inboundSchema=lo.FinishReason$=lo.FinishReason$outboundSchema=lo.FinishReason$inboundSchema=lo.FinishReason=void 0;lo.chatCompletionChoiceToJSON=Ain;lo.chatCompletionChoiceFromJSON=Iin;var pb=Pin(Te()),Ykt=Ue(),Ein=ve(),Tin=BI(),Zkt=qI();lo.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};lo.FinishReason$inboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().transform(Tin.catchUnrecognizedEnum)]);lo.FinishReason$outboundSchema=pb.union([pb.nativeEnum(lo.FinishReason),pb.string().and(pb.custom())]);var Gkt;(function(t){t.inboundSchema=lo.FinishReason$inboundSchema,t.outboundSchema=lo.FinishReason$outboundSchema})(Gkt||(lo.FinishReason$=Gkt={}));lo.ChatCompletionChoice$inboundSchema=pb.object({index:pb.number().int(),message:Zkt.AssistantMessage$inboundSchema,finish_reason:lo.FinishReason$inboundSchema}).transform(t=>(0,Ykt.remap)(t,{finish_reason:"finishReason"}));lo.ChatCompletionChoice$outboundSchema=pb.object({index:pb.number().int(),message:Zkt.AssistantMessage$outboundSchema,finishReason:lo.FinishReason$outboundSchema}).transform(t=>(0,Ykt.remap)(t,{finishReason:"finish_reason"}));var Jkt;(function(t){t.inboundSchema=lo.ChatCompletionChoice$inboundSchema,t.outboundSchema=lo.ChatCompletionChoice$outboundSchema})(Jkt||(lo.ChatCompletionChoice$=Jkt={}));function Ain(t){return JSON.stringify(lo.ChatCompletionChoice$outboundSchema.parse(t))}function Iin(t){return(0,Ein.safeParse)(t,e=>lo.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var a$t=v(Xt=>{"use strict";var Min=Xt&&Xt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rin=Xt&&Xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jin=Xt&&Xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Min(e,t,r);return Rin(e,t),e};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.ChatCompletionRequest$=Xt.ChatCompletionRequest$outboundSchema=Xt.ChatCompletionRequest$inboundSchema=Xt.ChatCompletionRequestToolChoice$=Xt.ChatCompletionRequestToolChoice$outboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema=Xt.Messages$=Xt.Messages$outboundSchema=Xt.Messages$inboundSchema=Xt.Stop$=Xt.Stop$outboundSchema=Xt.Stop$inboundSchema=void 0;Xt.stopToJSON=Nin;Xt.stopFromJSON=Din;Xt.messagesToJSON=Lin;Xt.messagesFromJSON=Fin;Xt.chatCompletionRequestToolChoiceToJSON=kin;Xt.chatCompletionRequestToolChoiceFromJSON=$in;Xt.chatCompletionRequestToJSON=Bin;Xt.chatCompletionRequestFromJSON=qin;var ke=jin(Te()),r$t=Ue(),Ase=ve(),Ise=qI(),n$t=AU(),o$t=IU(),Mse=hD(),i$t=MU(),Rse=RU(),jse=jU(),Nse=gD(),Dse=yD();Xt.Stop$inboundSchema=ke.union([ke.string(),ke.array(ke.string())]);Xt.Stop$outboundSchema=ke.union([ke.string(),ke.array(ke.string())]);var Xkt;(function(t){t.inboundSchema=Xt.Stop$inboundSchema,t.outboundSchema=Xt.Stop$outboundSchema})(Xkt||(Xt.Stop$=Xkt={}));function Nin(t){return JSON.stringify(Xt.Stop$outboundSchema.parse(t))}function Din(t){return(0,Ase.safeParse)(t,e=>Xt.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Xt.Messages$inboundSchema=ke.union([Mse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);Xt.Messages$outboundSchema=ke.union([Mse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))]);var Qkt;(function(t){t.inboundSchema=Xt.Messages$inboundSchema,t.outboundSchema=Xt.Messages$outboundSchema})(Qkt||(Xt.Messages$=Qkt={}));function Lin(t){return JSON.stringify(Xt.Messages$outboundSchema.parse(t))}function Fin(t){return(0,Ase.safeParse)(t,e=>Xt.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Xt.ChatCompletionRequestToolChoice$inboundSchema=ke.union([Rse.ToolChoice$inboundSchema,jse.ToolChoiceEnum$inboundSchema]);Xt.ChatCompletionRequestToolChoice$outboundSchema=ke.union([Rse.ToolChoice$outboundSchema,jse.ToolChoiceEnum$outboundSchema]);var e$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequestToolChoice$outboundSchema})(e$t||(Xt.ChatCompletionRequestToolChoice$=e$t={}));function kin(t){return JSON.stringify(Xt.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function $in(t){return(0,Ase.safeParse)(t,e=>Xt.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Xt.ChatCompletionRequest$inboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),top_p:ke.number().optional(),max_tokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),random_seed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Mse.SystemMessage$inboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$inboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$inboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$inboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),response_format:o$t.ResponseFormat$inboundSchema.optional(),tools:ke.nullable(ke.array(i$t.Tool$inboundSchema)).optional(),tool_choice:ke.union([Rse.ToolChoice$inboundSchema,jse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ke.number().optional(),frequency_penalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:n$t.Prediction$inboundSchema.optional(),safe_prompt:ke.boolean().optional()}).transform(t=>(0,r$t.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"}));Xt.ChatCompletionRequest$outboundSchema=ke.object({model:ke.nullable(ke.string()),temperature:ke.nullable(ke.number()).optional(),topP:ke.number().optional(),maxTokens:ke.nullable(ke.number().int()).optional(),stream:ke.boolean().default(!1),stop:ke.union([ke.string(),ke.array(ke.string())]).optional(),randomSeed:ke.nullable(ke.number().int()).optional(),messages:ke.array(ke.union([Mse.SystemMessage$outboundSchema.and(ke.object({role:ke.literal("system")}).transform(t=>({role:t.role}))),Dse.UserMessage$outboundSchema.and(ke.object({role:ke.literal("user")}).transform(t=>({role:t.role}))),Ise.AssistantMessage$outboundSchema.and(ke.object({role:ke.literal("assistant")}).transform(t=>({role:t.role}))),Nse.ToolMessage$outboundSchema.and(ke.object({role:ke.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:o$t.ResponseFormat$outboundSchema.optional(),tools:ke.nullable(ke.array(i$t.Tool$outboundSchema)).optional(),toolChoice:ke.union([Rse.ToolChoice$outboundSchema,jse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ke.number().optional(),frequencyPenalty:ke.number().optional(),n:ke.nullable(ke.number().int()).optional(),prediction:n$t.Prediction$outboundSchema.optional(),safePrompt:ke.boolean().optional()}).transform(t=>(0,r$t.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 t$t;(function(t){t.inboundSchema=Xt.ChatCompletionRequest$inboundSchema,t.outboundSchema=Xt.ChatCompletionRequest$outboundSchema})(t$t||(Xt.ChatCompletionRequest$=t$t={}));function Bin(t){return JSON.stringify(Xt.ChatCompletionRequest$outboundSchema.parse(t))}function qin(t){return(0,Ase.safeParse)(t,e=>Xt.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var DU=v(vu=>{"use strict";var Uin=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]}),zin=vu&&vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hin=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)&&Uin(e,t,r);return zin(e,t),e};Object.defineProperty(vu,"__esModule",{value:!0});vu.UsageInfo$=vu.UsageInfo$outboundSchema=vu.UsageInfo$inboundSchema=void 0;vu.usageInfoToJSON=Win;vu.usageInfoFromJSON=Kin;var UI=Hin(Te()),u$t=Ue(),Vin=ve();vu.UsageInfo$inboundSchema=UI.object({prompt_tokens:UI.number().int(),completion_tokens:UI.number().int(),total_tokens:UI.number().int()}).transform(t=>(0,u$t.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens"}));vu.UsageInfo$outboundSchema=UI.object({promptTokens:UI.number().int(),completionTokens:UI.number().int(),totalTokens:UI.number().int()}).transform(t=>(0,u$t.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens"}));var s$t;(function(t){t.inboundSchema=vu.UsageInfo$inboundSchema,t.outboundSchema=vu.UsageInfo$outboundSchema})(s$t||(vu.UsageInfo$=s$t={}));function Win(t){return JSON.stringify(vu.UsageInfo$outboundSchema.parse(t))}function Kin(t){return(0,Vin.safeParse)(t,e=>vu.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var f$t=v(wu=>{"use strict";var Gin=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]}),Jin=wu&&wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yin=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)&&Gin(e,t,r);return Jin(e,t),e};Object.defineProperty(wu,"__esModule",{value:!0});wu.ChatCompletionResponse$=wu.ChatCompletionResponse$outboundSchema=wu.ChatCompletionResponse$inboundSchema=void 0;wu.chatCompletionResponseToJSON=Xin;wu.chatCompletionResponseFromJSON=Qin;var qg=Yin(Te()),Zin=ve(),c$t=Tse(),d$t=DU();wu.ChatCompletionResponse$inboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:d$t.UsageInfo$inboundSchema,created:qg.number().int().optional(),choices:qg.array(c$t.ChatCompletionChoice$inboundSchema).optional()});wu.ChatCompletionResponse$outboundSchema=qg.object({id:qg.string(),object:qg.string(),model:qg.string(),usage:d$t.UsageInfo$outboundSchema,created:qg.number().int().optional(),choices:qg.array(c$t.ChatCompletionChoice$outboundSchema).optional()});var l$t;(function(t){t.inboundSchema=wu.ChatCompletionResponse$inboundSchema,t.outboundSchema=wu.ChatCompletionResponse$outboundSchema})(l$t||(wu.ChatCompletionResponse$=l$t={}));function Xin(t){return JSON.stringify(wu.ChatCompletionResponse$outboundSchema.parse(t))}function Qin(t){return(0,Zin.safeParse)(t,e=>wu.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var w$t=v(Qt=>{"use strict";var ean=Qt&&Qt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tan=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ran=Qt&&Qt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ean(e,t,r);return tan(e,t),e};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.ChatCompletionStreamRequest$=Qt.ChatCompletionStreamRequest$outboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=Qt.ChatCompletionStreamRequestMessages$=Qt.ChatCompletionStreamRequestMessages$outboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema=Qt.ChatCompletionStreamRequestStop$=Qt.ChatCompletionStreamRequestStop$outboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema=void 0;Qt.chatCompletionStreamRequestStopToJSON=nan;Qt.chatCompletionStreamRequestStopFromJSON=oan;Qt.chatCompletionStreamRequestMessagesToJSON=ian;Qt.chatCompletionStreamRequestMessagesFromJSON=aan;Qt.chatCompletionStreamRequestToolChoiceToJSON=san;Qt.chatCompletionStreamRequestToolChoiceFromJSON=uan;Qt.chatCompletionStreamRequestToJSON=lan;Qt.chatCompletionStreamRequestFromJSON=can;var $e=ran(Te()),y$t=Ue(),Lse=ve(),Fse=qI(),b$t=AU(),_$t=IU(),kse=hD(),v$t=MU(),$se=RU(),Bse=jU(),qse=gD(),Use=yD();Qt.ChatCompletionStreamRequestStop$inboundSchema=$e.union([$e.string(),$e.array($e.string())]);Qt.ChatCompletionStreamRequestStop$outboundSchema=$e.union([$e.string(),$e.array($e.string())]);var p$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestStop$outboundSchema})(p$t||(Qt.ChatCompletionStreamRequestStop$=p$t={}));function nan(t){return JSON.stringify(Qt.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function oan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Qt.ChatCompletionStreamRequestMessages$inboundSchema=$e.union([kse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);Qt.ChatCompletionStreamRequestMessages$outboundSchema=$e.union([kse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))]);var m$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestMessages$outboundSchema})(m$t||(Qt.ChatCompletionStreamRequestMessages$=m$t={}));function ian(t){return JSON.stringify(Qt.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function aan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Qt.ChatCompletionStreamRequestToolChoice$inboundSchema=$e.union([$se.ToolChoice$inboundSchema,Bse.ToolChoiceEnum$inboundSchema]);Qt.ChatCompletionStreamRequestToolChoice$outboundSchema=$e.union([$se.ToolChoice$outboundSchema,Bse.ToolChoiceEnum$outboundSchema]);var h$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequestToolChoice$outboundSchema})(h$t||(Qt.ChatCompletionStreamRequestToolChoice$=h$t={}));function san(t){return JSON.stringify(Qt.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function uan(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Qt.ChatCompletionStreamRequest$inboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),top_p:$e.number().optional(),max_tokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),random_seed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([kse.SystemMessage$inboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$inboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$inboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$inboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),response_format:_$t.ResponseFormat$inboundSchema.optional(),tools:$e.nullable($e.array(v$t.Tool$inboundSchema)).optional(),tool_choice:$e.union([$se.ToolChoice$inboundSchema,Bse.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:$e.number().optional(),frequency_penalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:b$t.Prediction$inboundSchema.optional(),safe_prompt:$e.boolean().optional()}).transform(t=>(0,y$t.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"}));Qt.ChatCompletionStreamRequest$outboundSchema=$e.object({model:$e.nullable($e.string()),temperature:$e.nullable($e.number()).optional(),topP:$e.number().optional(),maxTokens:$e.nullable($e.number().int()).optional(),stream:$e.boolean().default(!0),stop:$e.union([$e.string(),$e.array($e.string())]).optional(),randomSeed:$e.nullable($e.number().int()).optional(),messages:$e.array($e.union([kse.SystemMessage$outboundSchema.and($e.object({role:$e.literal("system")}).transform(t=>({role:t.role}))),Use.UserMessage$outboundSchema.and($e.object({role:$e.literal("user")}).transform(t=>({role:t.role}))),Fse.AssistantMessage$outboundSchema.and($e.object({role:$e.literal("assistant")}).transform(t=>({role:t.role}))),qse.ToolMessage$outboundSchema.and($e.object({role:$e.literal("tool")}).transform(t=>({role:t.role})))])),responseFormat:_$t.ResponseFormat$outboundSchema.optional(),tools:$e.nullable($e.array(v$t.Tool$outboundSchema)).optional(),toolChoice:$e.union([$se.ToolChoice$outboundSchema,Bse.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:$e.number().optional(),frequencyPenalty:$e.number().optional(),n:$e.nullable($e.number().int()).optional(),prediction:b$t.Prediction$outboundSchema.optional(),safePrompt:$e.boolean().optional()}).transform(t=>(0,y$t.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 g$t;(function(t){t.inboundSchema=Qt.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Qt.ChatCompletionStreamRequest$outboundSchema})(g$t||(Qt.ChatCompletionStreamRequest$=g$t={}));function lan(t){return JSON.stringify(Qt.ChatCompletionStreamRequest$outboundSchema.parse(t))}function can(t){return(0,Lse.safeParse)(t,e=>Qt.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var XNe=v(Su=>{"use strict";var dan=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]}),fan=Su&&Su.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pan=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)&&dan(e,t,r);return fan(e,t),e};Object.defineProperty(Su,"__esModule",{value:!0});Su.MetricOut$=Su.MetricOut$outboundSchema=Su.MetricOut$inboundSchema=void 0;Su.metricOutToJSON=han;Su.metricOutFromJSON=gan;var rm=pan(Te()),x$t=Ue(),man=ve();Su.MetricOut$inboundSchema=rm.object({train_loss:rm.nullable(rm.number()).optional(),valid_loss:rm.nullable(rm.number()).optional(),valid_mean_token_accuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,x$t.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));Su.MetricOut$outboundSchema=rm.object({trainLoss:rm.nullable(rm.number()).optional(),validLoss:rm.nullable(rm.number()).optional(),validMeanTokenAccuracy:rm.nullable(rm.number()).optional()}).transform(t=>(0,x$t.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var S$t;(function(t){t.inboundSchema=Su.MetricOut$inboundSchema,t.outboundSchema=Su.MetricOut$outboundSchema})(S$t||(Su.MetricOut$=S$t={}));function han(t){return JSON.stringify(Su.MetricOut$outboundSchema.parse(t))}function gan(t){return(0,man.safeParse)(t,e=>Su.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var QNe=v(xu=>{"use strict";var yan=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]}),ban=xu&&xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_an=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)&&yan(e,t,r);return ban(e,t),e};Object.defineProperty(xu,"__esModule",{value:!0});xu.CheckpointOut$=xu.CheckpointOut$outboundSchema=xu.CheckpointOut$inboundSchema=void 0;xu.checkpointOutToJSON=wan;xu.checkpointOutFromJSON=San;var LU=_an(Te()),O$t=Ue(),van=ve(),P$t=XNe();xu.CheckpointOut$inboundSchema=LU.object({metrics:P$t.MetricOut$inboundSchema,step_number:LU.number().int(),created_at:LU.number().int()}).transform(t=>(0,O$t.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));xu.CheckpointOut$outboundSchema=LU.object({metrics:P$t.MetricOut$outboundSchema,stepNumber:LU.number().int(),createdAt:LU.number().int()}).transform(t=>(0,O$t.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var C$t;(function(t){t.inboundSchema=xu.CheckpointOut$inboundSchema,t.outboundSchema=xu.CheckpointOut$outboundSchema})(C$t||(xu.CheckpointOut$=C$t={}));function wan(t){return JSON.stringify(xu.CheckpointOut$outboundSchema.parse(t))}function San(t){return(0,van.safeParse)(t,e=>xu.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var eDe=v(Cu=>{"use strict";var xan=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]}),Can=Cu&&Cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oan=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)&&xan(e,t,r);return Can(e,t),e};Object.defineProperty(Cu,"__esModule",{value:!0});Cu.ClassificationObject$=Cu.ClassificationObject$outboundSchema=Cu.ClassificationObject$inboundSchema=void 0;Cu.classificationObjectToJSON=Ean;Cu.classificationObjectFromJSON=Tan;var qx=Oan(Te()),T$t=Ue(),Pan=ve();Cu.ClassificationObject$inboundSchema=qx.object({categories:qx.record(qx.boolean()).optional(),category_scores:qx.record(qx.number()).optional()}).transform(t=>(0,T$t.remap)(t,{category_scores:"categoryScores"}));Cu.ClassificationObject$outboundSchema=qx.object({categories:qx.record(qx.boolean()).optional(),categoryScores:qx.record(qx.number()).optional()}).transform(t=>(0,T$t.remap)(t,{categoryScores:"category_scores"}));var E$t;(function(t){t.inboundSchema=Cu.ClassificationObject$inboundSchema,t.outboundSchema=Cu.ClassificationObject$outboundSchema})(E$t||(Cu.ClassificationObject$=E$t={}));function Ean(t){return JSON.stringify(Cu.ClassificationObject$outboundSchema.parse(t))}function Tan(t){return(0,Pan.safeParse)(t,e=>Cu.ClassificationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationObject' from JSON")}});var j$t=v(Do=>{"use strict";var Aan=Do&&Do.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ian=Do&&Do.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Man=Do&&Do.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Aan(e,t,r);return Ian(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.ClassificationRequest$=Do.ClassificationRequest$outboundSchema=Do.ClassificationRequest$inboundSchema=Do.ClassificationRequestInputs$=Do.ClassificationRequestInputs$outboundSchema=Do.ClassificationRequestInputs$inboundSchema=void 0;Do.classificationRequestInputsToJSON=Ran;Do.classificationRequestInputsFromJSON=jan;Do.classificationRequestToJSON=Nan;Do.classificationRequestFromJSON=Dan;var _s=Man(Te()),M$t=Ue(),R$t=ve();Do.ClassificationRequestInputs$inboundSchema=_s.union([_s.string(),_s.array(_s.string())]);Do.ClassificationRequestInputs$outboundSchema=_s.union([_s.string(),_s.array(_s.string())]);var A$t;(function(t){t.inboundSchema=Do.ClassificationRequestInputs$inboundSchema,t.outboundSchema=Do.ClassificationRequestInputs$outboundSchema})(A$t||(Do.ClassificationRequestInputs$=A$t={}));function Ran(t){return JSON.stringify(Do.ClassificationRequestInputs$outboundSchema.parse(t))}function jan(t){return(0,R$t.safeParse)(t,e=>Do.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}Do.ClassificationRequest$inboundSchema=_s.object({input:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,M$t.remap)(t,{input:"inputs"}));Do.ClassificationRequest$outboundSchema=_s.object({inputs:_s.union([_s.string(),_s.array(_s.string())]),model:_s.nullable(_s.string()).optional()}).transform(t=>(0,M$t.remap)(t,{inputs:"input"}));var I$t;(function(t){t.inboundSchema=Do.ClassificationRequest$inboundSchema,t.outboundSchema=Do.ClassificationRequest$outboundSchema})(I$t||(Do.ClassificationRequest$=I$t={}));function Nan(t){return JSON.stringify(Do.ClassificationRequest$outboundSchema.parse(t))}function Dan(t){return(0,R$t.safeParse)(t,e=>Do.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var L$t=v(Ou=>{"use strict";var Lan=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]}),Fan=Ou&&Ou.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kan=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)&&Lan(e,t,r);return Fan(e,t),e};Object.defineProperty(Ou,"__esModule",{value:!0});Ou.ClassificationResponse$=Ou.ClassificationResponse$outboundSchema=Ou.ClassificationResponse$inboundSchema=void 0;Ou.classificationResponseToJSON=Ban;Ou.classificationResponseFromJSON=qan;var zI=kan(Te()),$an=ve(),D$t=eDe();Ou.ClassificationResponse$inboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(D$t.ClassificationObject$inboundSchema).optional()});Ou.ClassificationResponse$outboundSchema=zI.object({id:zI.string().optional(),model:zI.string().optional(),results:zI.array(D$t.ClassificationObject$outboundSchema).optional()});var N$t;(function(t){t.inboundSchema=Ou.ClassificationResponse$inboundSchema,t.outboundSchema=Ou.ClassificationResponse$outboundSchema})(N$t||(Ou.ClassificationResponse$=N$t={}));function Ban(t){return JSON.stringify(Ou.ClassificationResponse$outboundSchema.parse(t))}function qan(t){return(0,$an.safeParse)(t,e=>Ou.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var tDe=v(Lo=>{"use strict";var Uan=Lo&&Lo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zan=Lo&&Lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Han=Lo&&Lo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Uan(e,t,r);return zan(e,t),e};Object.defineProperty(Lo,"__esModule",{value:!0});Lo.DeltaMessage$=Lo.DeltaMessage$outboundSchema=Lo.DeltaMessage$inboundSchema=Lo.Content$=Lo.Content$outboundSchema=Lo.Content$inboundSchema=void 0;Lo.contentToJSON=Van;Lo.contentFromJSON=Wan;Lo.deltaMessageToJSON=Kan;Lo.deltaMessageFromJSON=Gan;var Ma=Han(Te()),$$t=Ue(),B$t=ve(),zse=EU(),q$t=ise();Lo.Content$inboundSchema=Ma.union([Ma.string(),Ma.array(zse.ContentChunk$inboundSchema)]);Lo.Content$outboundSchema=Ma.union([Ma.string(),Ma.array(zse.ContentChunk$outboundSchema)]);var F$t;(function(t){t.inboundSchema=Lo.Content$inboundSchema,t.outboundSchema=Lo.Content$outboundSchema})(F$t||(Lo.Content$=F$t={}));function Van(t){return JSON.stringify(Lo.Content$outboundSchema.parse(t))}function Wan(t){return(0,B$t.safeParse)(t,e=>Lo.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}Lo.DeltaMessage$inboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(zse.ContentChunk$inboundSchema)])).optional(),tool_calls:Ma.nullable(Ma.array(q$t.ToolCall$inboundSchema)).optional()}).transform(t=>(0,$$t.remap)(t,{tool_calls:"toolCalls"}));Lo.DeltaMessage$outboundSchema=Ma.object({role:Ma.nullable(Ma.string()).optional(),content:Ma.nullable(Ma.union([Ma.string(),Ma.array(zse.ContentChunk$outboundSchema)])).optional(),toolCalls:Ma.nullable(Ma.array(q$t.ToolCall$outboundSchema)).optional()}).transform(t=>(0,$$t.remap)(t,{toolCalls:"tool_calls"}));var k$t;(function(t){t.inboundSchema=Lo.DeltaMessage$inboundSchema,t.outboundSchema=Lo.DeltaMessage$outboundSchema})(k$t||(Lo.DeltaMessage$=k$t={}));function Kan(t){return JSON.stringify(Lo.DeltaMessage$outboundSchema.parse(t))}function Gan(t){return(0,B$t.safeParse)(t,e=>Lo.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var rDe=v(co=>{"use strict";var Jan=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]}),Yan=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zan=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)&&Jan(e,t,r);return Yan(e,t),e};Object.defineProperty(co,"__esModule",{value:!0});co.CompletionResponseStreamChoice$=co.CompletionResponseStreamChoice$outboundSchema=co.CompletionResponseStreamChoice$inboundSchema=co.CompletionResponseStreamChoiceFinishReason$=co.CompletionResponseStreamChoiceFinishReason$outboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema=co.CompletionResponseStreamChoiceFinishReason=void 0;co.completionResponseStreamChoiceToJSON=esn;co.completionResponseStreamChoiceFromJSON=tsn;var sh=Zan(Te()),H$t=Ue(),Xan=ve(),Qan=BI(),V$t=tDe();co.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};co.CompletionResponseStreamChoiceFinishReason$inboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().transform(Qan.catchUnrecognizedEnum)]);co.CompletionResponseStreamChoiceFinishReason$outboundSchema=sh.union([sh.nativeEnum(co.CompletionResponseStreamChoiceFinishReason),sh.string().and(sh.custom())]);var U$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoiceFinishReason$outboundSchema})(U$t||(co.CompletionResponseStreamChoiceFinishReason$=U$t={}));co.CompletionResponseStreamChoice$inboundSchema=sh.object({index:sh.number().int(),delta:V$t.DeltaMessage$inboundSchema,finish_reason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,H$t.remap)(t,{finish_reason:"finishReason"}));co.CompletionResponseStreamChoice$outboundSchema=sh.object({index:sh.number().int(),delta:V$t.DeltaMessage$outboundSchema,finishReason:sh.nullable(co.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,H$t.remap)(t,{finishReason:"finish_reason"}));var z$t;(function(t){t.inboundSchema=co.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=co.CompletionResponseStreamChoice$outboundSchema})(z$t||(co.CompletionResponseStreamChoice$=z$t={}));function esn(t){return JSON.stringify(co.CompletionResponseStreamChoice$outboundSchema.parse(t))}function tsn(t){return(0,Xan.safeParse)(t,e=>co.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var nDe=v(Pu=>{"use strict";var rsn=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]}),nsn=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),osn=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)&&rsn(e,t,r);return nsn(e,t),e};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.CompletionChunk$=Pu.CompletionChunk$outboundSchema=Pu.CompletionChunk$inboundSchema=void 0;Pu.completionChunkToJSON=asn;Pu.completionChunkFromJSON=ssn;var Ug=osn(Te()),isn=ve(),K$t=rDe(),G$t=DU();Pu.CompletionChunk$inboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:G$t.UsageInfo$inboundSchema.optional(),choices:Ug.array(K$t.CompletionResponseStreamChoice$inboundSchema)});Pu.CompletionChunk$outboundSchema=Ug.object({id:Ug.string(),object:Ug.string().optional(),created:Ug.number().int().optional(),model:Ug.string(),usage:G$t.UsageInfo$outboundSchema.optional(),choices:Ug.array(K$t.CompletionResponseStreamChoice$outboundSchema)});var W$t;(function(t){t.inboundSchema=Pu.CompletionChunk$inboundSchema,t.outboundSchema=Pu.CompletionChunk$outboundSchema})(W$t||(Pu.CompletionChunk$=W$t={}));function asn(t){return JSON.stringify(Pu.CompletionChunk$outboundSchema.parse(t))}function ssn(t){return(0,isn.safeParse)(t,e=>Pu.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var Z$t=v(Eu=>{"use strict";var usn=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]}),lsn=Eu&&Eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),csn=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)&&usn(e,t,r);return lsn(e,t),e};Object.defineProperty(Eu,"__esModule",{value:!0});Eu.CompletionEvent$=Eu.CompletionEvent$outboundSchema=Eu.CompletionEvent$inboundSchema=void 0;Eu.completionEventToJSON=fsn;Eu.completionEventFromJSON=psn;var W5=csn(Te()),dsn=ve(),Y$t=nDe();Eu.CompletionEvent$inboundSchema=W5.object({data:W5.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:W5.ZodIssueCode.custom,message:`malformed json: ${r}`}),W5.NEVER}}).pipe(Y$t.CompletionChunk$inboundSchema)});Eu.CompletionEvent$outboundSchema=W5.object({data:Y$t.CompletionChunk$outboundSchema});var J$t;(function(t){t.inboundSchema=Eu.CompletionEvent$inboundSchema,t.outboundSchema=Eu.CompletionEvent$outboundSchema})(J$t||(Eu.CompletionEvent$=J$t={}));function fsn(t){return JSON.stringify(Eu.CompletionEvent$outboundSchema.parse(t))}function psn(t){return(0,dsn.safeParse)(t,e=>Eu.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var Q$t=v(Tu=>{"use strict";var msn=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]}),hsn=Tu&&Tu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gsn=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)&&msn(e,t,r);return hsn(e,t),e};Object.defineProperty(Tu,"__esModule",{value:!0});Tu.DeleteFileOut$=Tu.DeleteFileOut$outboundSchema=Tu.DeleteFileOut$inboundSchema=void 0;Tu.deleteFileOutToJSON=bsn;Tu.deleteFileOutFromJSON=_sn;var HI=gsn(Te()),ysn=ve();Tu.DeleteFileOut$inboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});Tu.DeleteFileOut$outboundSchema=HI.object({id:HI.string(),object:HI.string(),deleted:HI.boolean()});var X$t;(function(t){t.inboundSchema=Tu.DeleteFileOut$inboundSchema,t.outboundSchema=Tu.DeleteFileOut$outboundSchema})(X$t||(Tu.DeleteFileOut$=X$t={}));function bsn(t){return JSON.stringify(Tu.DeleteFileOut$outboundSchema.parse(t))}function _sn(t){return(0,ysn.safeParse)(t,e=>Tu.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var tBt=v(Au=>{"use strict";var vsn=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]}),wsn=Au&&Au.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ssn=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)&&vsn(e,t,r);return wsn(e,t),e};Object.defineProperty(Au,"__esModule",{value:!0});Au.DeleteModelOut$=Au.DeleteModelOut$outboundSchema=Au.DeleteModelOut$inboundSchema=void 0;Au.deleteModelOutToJSON=Csn;Au.deleteModelOutFromJSON=Osn;var VI=Ssn(Te()),xsn=ve();Au.DeleteModelOut$inboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});Au.DeleteModelOut$outboundSchema=VI.object({id:VI.string(),object:VI.string().default("model"),deleted:VI.boolean().default(!0)});var eBt;(function(t){t.inboundSchema=Au.DeleteModelOut$inboundSchema,t.outboundSchema=Au.DeleteModelOut$outboundSchema})(eBt||(Au.DeleteModelOut$=eBt={}));function Csn(t){return JSON.stringify(Au.DeleteModelOut$outboundSchema.parse(t))}function Osn(t){return(0,xsn.safeParse)(t,e=>Au.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var oDe=v(Iu=>{"use strict";var Psn=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]}),Esn=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tsn=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)&&Psn(e,t,r);return Esn(e,t),e};Object.defineProperty(Iu,"__esModule",{value:!0});Iu.EventOut$=Iu.EventOut$outboundSchema=Iu.EventOut$inboundSchema=void 0;Iu.eventOutToJSON=Isn;Iu.eventOutFromJSON=Msn;var zg=Tsn(Te()),nBt=Ue(),Asn=ve();Iu.EventOut$inboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),created_at:zg.number().int()}).transform(t=>(0,nBt.remap)(t,{created_at:"createdAt"}));Iu.EventOut$outboundSchema=zg.object({name:zg.string(),data:zg.nullable(zg.record(zg.any())).optional(),createdAt:zg.number().int()}).transform(t=>(0,nBt.remap)(t,{createdAt:"created_at"}));var rBt;(function(t){t.inboundSchema=Iu.EventOut$inboundSchema,t.outboundSchema=Iu.EventOut$outboundSchema})(rBt||(Iu.EventOut$=rBt={}));function Isn(t){return JSON.stringify(Iu.EventOut$outboundSchema.parse(t))}function Msn(t){return(0,Asn.safeParse)(t,e=>Iu.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var Hse=v(Fo=>{"use strict";var Rsn=Fo&&Fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jsn=Fo&&Fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nsn=Fo&&Fo.__importStar||function(t){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 jsn(e,t),e};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.GithubRepositoryOut$=Fo.GithubRepositoryOut$outboundSchema=Fo.GithubRepositoryOut$inboundSchema=Fo.GithubRepositoryOutType$=Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema=Fo.GithubRepositoryOutType=void 0;Fo.githubRepositoryOutToJSON=Lsn;Fo.githubRepositoryOutFromJSON=Fsn;var nd=Nsn(Te()),aBt=Ue(),Dsn=ve();Fo.GithubRepositoryOutType={Github:"github"};Fo.GithubRepositoryOutType$inboundSchema=nd.nativeEnum(Fo.GithubRepositoryOutType);Fo.GithubRepositoryOutType$outboundSchema=Fo.GithubRepositoryOutType$inboundSchema;var oBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOutType$outboundSchema})(oBt||(Fo.GithubRepositoryOutType$=oBt={}));Fo.GithubRepositoryOut$inboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commit_id:nd.string()}).transform(t=>(0,aBt.remap)(t,{commit_id:"commitId"}));Fo.GithubRepositoryOut$outboundSchema=nd.object({type:nd.literal("github").default("github"),name:nd.string(),owner:nd.string(),ref:nd.nullable(nd.string()).optional(),weight:nd.number().default(1),commitId:nd.string()}).transform(t=>(0,aBt.remap)(t,{commitId:"commit_id"}));var iBt;(function(t){t.inboundSchema=Fo.GithubRepositoryOut$inboundSchema,t.outboundSchema=Fo.GithubRepositoryOut$outboundSchema})(iBt||(Fo.GithubRepositoryOut$=iBt={}));function Lsn(t){return JSON.stringify(Fo.GithubRepositoryOut$outboundSchema.parse(t))}function Fsn(t){return(0,Dsn.safeParse)(t,e=>Fo.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Vse=v(Mu=>{"use strict";var ksn=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]}),$sn=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bsn=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)&&ksn(e,t,r);return $sn(e,t),e};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.JobMetadataOut$=Mu.JobMetadataOut$outboundSchema=Mu.JobMetadataOut$inboundSchema=void 0;Mu.jobMetadataOutToJSON=Usn;Mu.jobMetadataOutFromJSON=zsn;var gi=Bsn(Te()),uBt=Ue(),qsn=ve();Mu.JobMetadataOut$inboundSchema=gi.object({expected_duration_seconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),cost_currency:gi.nullable(gi.string()).optional(),train_tokens_per_step:gi.nullable(gi.number().int()).optional(),train_tokens:gi.nullable(gi.number().int()).optional(),data_tokens:gi.nullable(gi.number().int()).optional(),estimated_start_time:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,uBt.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Mu.JobMetadataOut$outboundSchema=gi.object({expectedDurationSeconds:gi.nullable(gi.number().int()).optional(),cost:gi.nullable(gi.number()).optional(),costCurrency:gi.nullable(gi.string()).optional(),trainTokensPerStep:gi.nullable(gi.number().int()).optional(),trainTokens:gi.nullable(gi.number().int()).optional(),dataTokens:gi.nullable(gi.number().int()).optional(),estimatedStartTime:gi.nullable(gi.number().int()).optional()}).transform(t=>(0,uBt.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 sBt;(function(t){t.inboundSchema=Mu.JobMetadataOut$inboundSchema,t.outboundSchema=Mu.JobMetadataOut$outboundSchema})(sBt||(Mu.JobMetadataOut$=sBt={}));function Usn(t){return JSON.stringify(Mu.JobMetadataOut$outboundSchema.parse(t))}function zsn(t){return(0,qsn.safeParse)(t,e=>Mu.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var Wse=v(Ru=>{"use strict";var Hsn=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]}),Vsn=Ru&&Ru.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wsn=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)&&Hsn(e,t,r);return Vsn(e,t),e};Object.defineProperty(Ru,"__esModule",{value:!0});Ru.TrainingParameters$=Ru.TrainingParameters$outboundSchema=Ru.TrainingParameters$inboundSchema=void 0;Ru.trainingParametersToJSON=Gsn;Ru.trainingParametersFromJSON=Jsn;var Ai=Wsn(Te()),cBt=Ue(),Ksn=ve();Ru.TrainingParameters$inboundSchema=Ai.object({training_steps:Ai.nullable(Ai.number().int()).optional(),learning_rate:Ai.number().default(1e-4),weight_decay:Ai.nullable(Ai.number()).optional(),warmup_fraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fim_ratio:Ai.nullable(Ai.number()).optional(),seq_len:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,cBt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));Ru.TrainingParameters$outboundSchema=Ai.object({trainingSteps:Ai.nullable(Ai.number().int()).optional(),learningRate:Ai.number().default(1e-4),weightDecay:Ai.nullable(Ai.number()).optional(),warmupFraction:Ai.nullable(Ai.number()).optional(),epochs:Ai.nullable(Ai.number()).optional(),fimRatio:Ai.nullable(Ai.number()).optional(),seqLen:Ai.nullable(Ai.number().int()).optional()}).transform(t=>(0,cBt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var lBt;(function(t){t.inboundSchema=Ru.TrainingParameters$inboundSchema,t.outboundSchema=Ru.TrainingParameters$outboundSchema})(lBt||(Ru.TrainingParameters$=lBt={}));function Gsn(t){return JSON.stringify(Ru.TrainingParameters$outboundSchema.parse(t))}function Jsn(t){return(0,Ksn.safeParse)(t,e=>Ru.TrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParameters' from JSON")}});var Kse=v(ko=>{"use strict";var Ysn=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]}),Zsn=ko&&ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xsn=ko&&ko.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ysn(e,t,r);return Zsn(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=eun;ko.wandbIntegrationOutFromJSON=tun;var ep=Xsn(Te()),pBt=Ue(),Qsn=ve();ko.WandbIntegrationOutType={Wandb:"wandb"};ko.WandbIntegrationOutType$inboundSchema=ep.nativeEnum(ko.WandbIntegrationOutType);ko.WandbIntegrationOutType$outboundSchema=ko.WandbIntegrationOutType$inboundSchema;var dBt;(function(t){t.inboundSchema=ko.WandbIntegrationOutType$inboundSchema,t.outboundSchema=ko.WandbIntegrationOutType$outboundSchema})(dBt||(ko.WandbIntegrationOutType$=dBt={}));ko.WandbIntegrationOut$inboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),run_name:ep.nullable(ep.string()).optional()}).transform(t=>(0,pBt.remap)(t,{run_name:"runName"}));ko.WandbIntegrationOut$outboundSchema=ep.object({type:ep.literal("wandb").default("wandb"),project:ep.string(),name:ep.nullable(ep.string()).optional(),runName:ep.nullable(ep.string()).optional()}).transform(t=>(0,pBt.remap)(t,{runName:"run_name"}));var fBt;(function(t){t.inboundSchema=ko.WandbIntegrationOut$inboundSchema,t.outboundSchema=ko.WandbIntegrationOut$outboundSchema})(fBt||(ko.WandbIntegrationOut$=fBt={}));function eun(t){return JSON.stringify(ko.WandbIntegrationOut$outboundSchema.parse(t))}function tun(t){return(0,Qsn.safeParse)(t,e=>ko.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var CBt=v(gt=>{"use strict";var run=gt&&gt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nun=gt&&gt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oun=gt&&gt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&run(e,t,r);return nun(e,t),e};Object.defineProperty(gt,"__esModule",{value:!0});gt.DetailedJobOut$=gt.DetailedJobOut$outboundSchema=gt.DetailedJobOut$inboundSchema=gt.DetailedJobOutRepositories$=gt.DetailedJobOutRepositories$outboundSchema=gt.DetailedJobOutRepositories$inboundSchema=gt.DetailedJobOutIntegrations$=gt.DetailedJobOutIntegrations$outboundSchema=gt.DetailedJobOutIntegrations$inboundSchema=gt.DetailedJobOutObject$=gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema=gt.DetailedJobOutStatus$=gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema=gt.DetailedJobOutObject=gt.DetailedJobOutStatus=void 0;gt.detailedJobOutIntegrationsToJSON=iun;gt.detailedJobOutIntegrationsFromJSON=aun;gt.detailedJobOutRepositoriesToJSON=sun;gt.detailedJobOutRepositoriesFromJSON=uun;gt.detailedJobOutToJSON=lun;gt.detailedJobOutFromJSON=cun;var ur=oun(Te()),_Bt=Ue(),iDe=ve(),vBt=QNe(),wBt=oDe(),Gse=Hse(),SBt=Vse(),xBt=Wse(),Jse=Kse();gt.DetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};gt.DetailedJobOutObject={Job:"job"};gt.DetailedJobOutStatus$inboundSchema=ur.nativeEnum(gt.DetailedJobOutStatus);gt.DetailedJobOutStatus$outboundSchema=gt.DetailedJobOutStatus$inboundSchema;var mBt;(function(t){t.inboundSchema=gt.DetailedJobOutStatus$inboundSchema,t.outboundSchema=gt.DetailedJobOutStatus$outboundSchema})(mBt||(gt.DetailedJobOutStatus$=mBt={}));gt.DetailedJobOutObject$inboundSchema=ur.nativeEnum(gt.DetailedJobOutObject);gt.DetailedJobOutObject$outboundSchema=gt.DetailedJobOutObject$inboundSchema;var hBt;(function(t){t.inboundSchema=gt.DetailedJobOutObject$inboundSchema,t.outboundSchema=gt.DetailedJobOutObject$outboundSchema})(hBt||(gt.DetailedJobOutObject$=hBt={}));gt.DetailedJobOutIntegrations$inboundSchema=Jse.WandbIntegrationOut$inboundSchema;gt.DetailedJobOutIntegrations$outboundSchema=Jse.WandbIntegrationOut$outboundSchema;var gBt;(function(t){t.inboundSchema=gt.DetailedJobOutIntegrations$inboundSchema,t.outboundSchema=gt.DetailedJobOutIntegrations$outboundSchema})(gBt||(gt.DetailedJobOutIntegrations$=gBt={}));function iun(t){return JSON.stringify(gt.DetailedJobOutIntegrations$outboundSchema.parse(t))}function aun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutIntegrations' from JSON")}gt.DetailedJobOutRepositories$inboundSchema=Gse.GithubRepositoryOut$inboundSchema;gt.DetailedJobOutRepositories$outboundSchema=Gse.GithubRepositoryOut$outboundSchema;var yBt;(function(t){t.inboundSchema=gt.DetailedJobOutRepositories$inboundSchema,t.outboundSchema=gt.DetailedJobOutRepositories$outboundSchema})(yBt||(gt.DetailedJobOutRepositories$=yBt={}));function sun(t){return JSON.stringify(gt.DetailedJobOutRepositories$outboundSchema.parse(t))}function uun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOutRepositories' from JSON")}gt.DetailedJobOut$inboundSchema=ur.object({id:ur.string(),auto_start:ur.boolean(),hyperparameters:xBt.TrainingParameters$inboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$inboundSchema,job_type:ur.string(),created_at:ur.number().int(),modified_at:ur.number().int(),training_files:ur.array(ur.string()),validation_files:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fine_tuned_model:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Jse.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Gse.GithubRepositoryOut$inboundSchema).optional(),metadata:ur.nullable(SBt.JobMetadataOut$inboundSchema).optional(),events:ur.array(wBt.EventOut$inboundSchema).optional(),checkpoints:ur.array(vBt.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,_Bt.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"}));gt.DetailedJobOut$outboundSchema=ur.object({id:ur.string(),autoStart:ur.boolean(),hyperparameters:xBt.TrainingParameters$outboundSchema,model:ur.string(),status:gt.DetailedJobOutStatus$outboundSchema,jobType:ur.string(),createdAt:ur.number().int(),modifiedAt:ur.number().int(),trainingFiles:ur.array(ur.string()),validationFiles:ur.nullable(ur.array(ur.string())).optional(),object:ur.literal("job").default("job"),fineTunedModel:ur.nullable(ur.string()).optional(),suffix:ur.nullable(ur.string()).optional(),integrations:ur.nullable(ur.array(Jse.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:ur.nullable(ur.number().int()).optional(),repositories:ur.array(Gse.GithubRepositoryOut$outboundSchema).optional(),metadata:ur.nullable(SBt.JobMetadataOut$outboundSchema).optional(),events:ur.array(wBt.EventOut$outboundSchema).optional(),checkpoints:ur.array(vBt.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,_Bt.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 bBt;(function(t){t.inboundSchema=gt.DetailedJobOut$inboundSchema,t.outboundSchema=gt.DetailedJobOut$outboundSchema})(bBt||(gt.DetailedJobOut$=bBt={}));function lun(t){return JSON.stringify(gt.DetailedJobOut$outboundSchema.parse(t))}function cun(t){return(0,iDe.safeParse)(t,e=>gt.DetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DetailedJobOut' from JSON")}});var ABt=v($o=>{"use strict";var dun=$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]}),fun=$o&&$o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pun=$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)&&dun(e,t,r);return fun(e,t),e};Object.defineProperty($o,"__esModule",{value:!0});$o.EmbeddingRequest$=$o.EmbeddingRequest$outboundSchema=$o.EmbeddingRequest$inboundSchema=$o.Inputs$=$o.Inputs$outboundSchema=$o.Inputs$inboundSchema=void 0;$o.inputsToJSON=mun;$o.inputsFromJSON=hun;$o.embeddingRequestToJSON=gun;$o.embeddingRequestFromJSON=yun;var Ra=pun(Te()),EBt=Ue(),TBt=ve();$o.Inputs$inboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);$o.Inputs$outboundSchema=Ra.union([Ra.string(),Ra.array(Ra.string())]);var OBt;(function(t){t.inboundSchema=$o.Inputs$inboundSchema,t.outboundSchema=$o.Inputs$outboundSchema})(OBt||($o.Inputs$=OBt={}));function mun(t){return JSON.stringify($o.Inputs$outboundSchema.parse(t))}function hun(t){return(0,TBt.safeParse)(t,e=>$o.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}$o.EmbeddingRequest$inboundSchema=Ra.object({input:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encoding_format:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,EBt.remap)(t,{input:"inputs",encoding_format:"encodingFormat"}));$o.EmbeddingRequest$outboundSchema=Ra.object({inputs:Ra.union([Ra.string(),Ra.array(Ra.string())]),model:Ra.string().default("mistral-embed"),encodingFormat:Ra.nullable(Ra.string()).optional()}).transform(t=>(0,EBt.remap)(t,{inputs:"input",encodingFormat:"encoding_format"}));var PBt;(function(t){t.inboundSchema=$o.EmbeddingRequest$inboundSchema,t.outboundSchema=$o.EmbeddingRequest$outboundSchema})(PBt||($o.EmbeddingRequest$=PBt={}));function gun(t){return JSON.stringify($o.EmbeddingRequest$outboundSchema.parse(t))}function yun(t){return(0,TBt.safeParse)(t,e=>$o.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var aDe=v(ju=>{"use strict";var bun=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]}),_un=ju&&ju.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vun=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)&&bun(e,t,r);return _un(e,t),e};Object.defineProperty(ju,"__esModule",{value:!0});ju.EmbeddingResponseData$=ju.EmbeddingResponseData$outboundSchema=ju.EmbeddingResponseData$inboundSchema=void 0;ju.embeddingResponseDataToJSON=Sun;ju.embeddingResponseDataFromJSON=xun;var Ux=vun(Te()),wun=ve();ju.EmbeddingResponseData$inboundSchema=Ux.object({object:Ux.string().optional(),embedding:Ux.array(Ux.number()).optional(),index:Ux.number().int().optional()});ju.EmbeddingResponseData$outboundSchema=Ux.object({object:Ux.string().optional(),embedding:Ux.array(Ux.number()).optional(),index:Ux.number().int().optional()});var IBt;(function(t){t.inboundSchema=ju.EmbeddingResponseData$inboundSchema,t.outboundSchema=ju.EmbeddingResponseData$outboundSchema})(IBt||(ju.EmbeddingResponseData$=IBt={}));function Sun(t){return JSON.stringify(ju.EmbeddingResponseData$outboundSchema.parse(t))}function xun(t){return(0,wun.safeParse)(t,e=>ju.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var NBt=v(Nu=>{"use strict";var Cun=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]}),Oun=Nu&&Nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pun=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)&&Cun(e,t,r);return Oun(e,t),e};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.EmbeddingResponse$=Nu.EmbeddingResponse$outboundSchema=Nu.EmbeddingResponse$inboundSchema=void 0;Nu.embeddingResponseToJSON=Tun;Nu.embeddingResponseFromJSON=Aun;var zx=Pun(Te()),Eun=ve(),RBt=aDe(),jBt=DU();Nu.EmbeddingResponse$inboundSchema=zx.object({id:zx.string(),object:zx.string(),model:zx.string(),usage:jBt.UsageInfo$inboundSchema,data:zx.array(RBt.EmbeddingResponseData$inboundSchema)});Nu.EmbeddingResponse$outboundSchema=zx.object({id:zx.string(),object:zx.string(),model:zx.string(),usage:jBt.UsageInfo$outboundSchema,data:zx.array(RBt.EmbeddingResponseData$outboundSchema)});var MBt;(function(t){t.inboundSchema=Nu.EmbeddingResponse$inboundSchema,t.outboundSchema=Nu.EmbeddingResponse$outboundSchema})(MBt||(Nu.EmbeddingResponse$=MBt={}));function Tun(t){return JSON.stringify(Nu.EmbeddingResponse$outboundSchema.parse(t))}function Aun(t){return(0,Eun.safeParse)(t,e=>Nu.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var K5=v(Du=>{"use strict";var Iun=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]}),Mun=Du&&Du.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Run=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)&&Iun(e,t,r);return Mun(e,t),e};Object.defineProperty(Du,"__esModule",{value:!0});Du.FilePurpose$=Du.FilePurpose$outboundSchema=Du.FilePurpose$inboundSchema=Du.FilePurpose=void 0;var _D=Run(Te()),jun=BI();Du.FilePurpose={FineTune:"fine-tune",Batch:"batch"};Du.FilePurpose$inboundSchema=_D.union([_D.nativeEnum(Du.FilePurpose),_D.string().transform(jun.catchUnrecognizedEnum)]);Du.FilePurpose$outboundSchema=_D.union([_D.nativeEnum(Du.FilePurpose),_D.string().and(_D.custom())]);var DBt;(function(t){t.inboundSchema=Du.FilePurpose$inboundSchema,t.outboundSchema=Du.FilePurpose$outboundSchema})(DBt||(Du.FilePurpose$=DBt={}))});var G5=v(Lu=>{"use strict";var Nun=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]}),Dun=Lu&&Lu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lun=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)&&Nun(e,t,r);return Dun(e,t),e};Object.defineProperty(Lu,"__esModule",{value:!0});Lu.SampleType$=Lu.SampleType$outboundSchema=Lu.SampleType$inboundSchema=Lu.SampleType=void 0;var vD=Lun(Te()),Fun=BI();Lu.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Lu.SampleType$inboundSchema=vD.union([vD.nativeEnum(Lu.SampleType),vD.string().transform(Fun.catchUnrecognizedEnum)]);Lu.SampleType$outboundSchema=vD.union([vD.nativeEnum(Lu.SampleType),vD.string().and(vD.custom())]);var LBt;(function(t){t.inboundSchema=Lu.SampleType$inboundSchema,t.outboundSchema=Lu.SampleType$outboundSchema})(LBt||(Lu.SampleType$=LBt={}))});var J5=v(Fu=>{"use strict";var kun=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]}),$un=Fu&&Fu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qun=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)&&kun(e,t,r);return $un(e,t),e};Object.defineProperty(Fu,"__esModule",{value:!0});Fu.Source$=Fu.Source$outboundSchema=Fu.Source$inboundSchema=Fu.Source=void 0;var wD=qun(Te()),Uun=BI();Fu.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};Fu.Source$inboundSchema=wD.union([wD.nativeEnum(Fu.Source),wD.string().transform(Uun.catchUnrecognizedEnum)]);Fu.Source$outboundSchema=wD.union([wD.nativeEnum(Fu.Source),wD.string().and(wD.custom())]);var FBt;(function(t){t.inboundSchema=Fu.Source$inboundSchema,t.outboundSchema=Fu.Source$outboundSchema})(FBt||(Fu.Source$=FBt={}))});var sDe=v(ku=>{"use strict";var zun=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]}),Hun=ku&&ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vun=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)&&zun(e,t,r);return Hun(e,t),e};Object.defineProperty(ku,"__esModule",{value:!0});ku.FileSchema$=ku.FileSchema$outboundSchema=ku.FileSchema$inboundSchema=void 0;ku.fileSchemaToJSON=Kun;ku.fileSchemaFromJSON=Gun;var lf=Vun(Te()),$Bt=Ue(),Wun=ve(),BBt=K5(),qBt=G5(),UBt=J5();ku.FileSchema$inboundSchema=lf.object({id:lf.string(),object:lf.string(),bytes:lf.number().int(),created_at:lf.number().int(),filename:lf.string(),purpose:BBt.FilePurpose$inboundSchema,sample_type:qBt.SampleType$inboundSchema,num_lines:lf.nullable(lf.number().int()).optional(),source:UBt.Source$inboundSchema}).transform(t=>(0,$Bt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));ku.FileSchema$outboundSchema=lf.object({id:lf.string(),object:lf.string(),sizeBytes:lf.number().int(),createdAt:lf.number().int(),filename:lf.string(),purpose:BBt.FilePurpose$outboundSchema,sampleType:qBt.SampleType$outboundSchema,numLines:lf.nullable(lf.number().int()).optional(),source:UBt.Source$outboundSchema}).transform(t=>(0,$Bt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var kBt;(function(t){t.inboundSchema=ku.FileSchema$inboundSchema,t.outboundSchema=ku.FileSchema$outboundSchema})(kBt||(ku.FileSchema$=kBt={}));function Kun(t){return JSON.stringify(ku.FileSchema$outboundSchema.parse(t))}function Gun(t){return(0,Wun.safeParse)(t,e=>ku.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var HBt=v($u=>{"use strict";var Jun=$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]}),Yun=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zun=$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)&&Jun(e,t,r);return Yun(e,t),e};Object.defineProperty($u,"__esModule",{value:!0});$u.FileSignedURL$=$u.FileSignedURL$outboundSchema=$u.FileSignedURL$inboundSchema=void 0;$u.fileSignedURLToJSON=Qun;$u.fileSignedURLFromJSON=eln;var Yse=Zun(Te()),Xun=ve();$u.FileSignedURL$inboundSchema=Yse.object({url:Yse.string()});$u.FileSignedURL$outboundSchema=Yse.object({url:Yse.string()});var zBt;(function(t){t.inboundSchema=$u.FileSignedURL$inboundSchema,t.outboundSchema=$u.FileSignedURL$outboundSchema})(zBt||($u.FileSignedURL$=zBt={}));function Qun(t){return JSON.stringify($u.FileSignedURL$outboundSchema.parse(t))}function eln(t){return(0,Xun.safeParse)(t,e=>$u.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var JBt=v(Bo=>{"use strict";var tln=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]}),rln=Bo&&Bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nln=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)&&tln(e,t,r);return rln(e,t),e};Object.defineProperty(Bo,"__esModule",{value:!0});Bo.FIMCompletionRequest$=Bo.FIMCompletionRequest$outboundSchema=Bo.FIMCompletionRequest$inboundSchema=Bo.FIMCompletionRequestStop$=Bo.FIMCompletionRequestStop$outboundSchema=Bo.FIMCompletionRequestStop$inboundSchema=void 0;Bo.fimCompletionRequestStopToJSON=oln;Bo.fimCompletionRequestStopFromJSON=iln;Bo.fimCompletionRequestToJSON=aln;Bo.fimCompletionRequestFromJSON=sln;var yr=nln(Te()),KBt=Ue(),GBt=ve();Bo.FIMCompletionRequestStop$inboundSchema=yr.union([yr.string(),yr.array(yr.string())]);Bo.FIMCompletionRequestStop$outboundSchema=yr.union([yr.string(),yr.array(yr.string())]);var VBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequestStop$outboundSchema})(VBt||(Bo.FIMCompletionRequestStop$=VBt={}));function oln(t){return JSON.stringify(Bo.FIMCompletionRequestStop$outboundSchema.parse(t))}function iln(t){return(0,GBt.safeParse)(t,e=>Bo.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}Bo.FIMCompletionRequest$inboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),top_p:yr.number().default(1),max_tokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),random_seed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),min_tokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,KBt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));Bo.FIMCompletionRequest$outboundSchema=yr.object({model:yr.nullable(yr.string()),temperature:yr.nullable(yr.number()).optional(),topP:yr.number().default(1),maxTokens:yr.nullable(yr.number().int()).optional(),stream:yr.boolean().default(!1),stop:yr.union([yr.string(),yr.array(yr.string())]).optional(),randomSeed:yr.nullable(yr.number().int()).optional(),prompt:yr.string(),suffix:yr.nullable(yr.string()).optional(),minTokens:yr.nullable(yr.number().int()).optional()}).transform(t=>(0,KBt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var WBt;(function(t){t.inboundSchema=Bo.FIMCompletionRequest$inboundSchema,t.outboundSchema=Bo.FIMCompletionRequest$outboundSchema})(WBt||(Bo.FIMCompletionRequest$=WBt={}));function aln(t){return JSON.stringify(Bo.FIMCompletionRequest$outboundSchema.parse(t))}function sln(t){return(0,GBt.safeParse)(t,e=>Bo.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var QBt=v(Bu=>{"use strict";var uln=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]}),lln=Bu&&Bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cln=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)&&uln(e,t,r);return lln(e,t),e};Object.defineProperty(Bu,"__esModule",{value:!0});Bu.FIMCompletionResponse$=Bu.FIMCompletionResponse$outboundSchema=Bu.FIMCompletionResponse$inboundSchema=void 0;Bu.fimCompletionResponseToJSON=fln;Bu.fimCompletionResponseFromJSON=pln;var Hg=cln(Te()),dln=ve(),ZBt=Tse(),XBt=DU();Bu.FIMCompletionResponse$inboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:XBt.UsageInfo$inboundSchema,created:Hg.number().int().optional(),choices:Hg.array(ZBt.ChatCompletionChoice$inboundSchema).optional()});Bu.FIMCompletionResponse$outboundSchema=Hg.object({id:Hg.string(),object:Hg.string(),model:Hg.string(),usage:XBt.UsageInfo$outboundSchema,created:Hg.number().int().optional(),choices:Hg.array(ZBt.ChatCompletionChoice$outboundSchema).optional()});var YBt;(function(t){t.inboundSchema=Bu.FIMCompletionResponse$inboundSchema,t.outboundSchema=Bu.FIMCompletionResponse$outboundSchema})(YBt||(Bu.FIMCompletionResponse$=YBt={}));function fln(t){return JSON.stringify(Bu.FIMCompletionResponse$outboundSchema.parse(t))}function pln(t){return(0,dln.safeParse)(t,e=>Bu.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var oqt=v(qo=>{"use strict";var mln=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]}),hln=qo&&qo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gln=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)&&mln(e,t,r);return hln(e,t),e};Object.defineProperty(qo,"__esModule",{value:!0});qo.FIMCompletionStreamRequest$=qo.FIMCompletionStreamRequest$outboundSchema=qo.FIMCompletionStreamRequest$inboundSchema=qo.FIMCompletionStreamRequestStop$=qo.FIMCompletionStreamRequestStop$outboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema=void 0;qo.fimCompletionStreamRequestStopToJSON=yln;qo.fimCompletionStreamRequestStopFromJSON=bln;qo.fimCompletionStreamRequestToJSON=_ln;qo.fimCompletionStreamRequestFromJSON=vln;var br=gln(Te()),rqt=Ue(),nqt=ve();qo.FIMCompletionStreamRequestStop$inboundSchema=br.union([br.string(),br.array(br.string())]);qo.FIMCompletionStreamRequestStop$outboundSchema=br.union([br.string(),br.array(br.string())]);var eqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequestStop$outboundSchema})(eqt||(qo.FIMCompletionStreamRequestStop$=eqt={}));function yln(t){return JSON.stringify(qo.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function bln(t){return(0,nqt.safeParse)(t,e=>qo.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}qo.FIMCompletionStreamRequest$inboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),top_p:br.number().default(1),max_tokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),random_seed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),min_tokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,rqt.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));qo.FIMCompletionStreamRequest$outboundSchema=br.object({model:br.nullable(br.string()),temperature:br.nullable(br.number()).optional(),topP:br.number().default(1),maxTokens:br.nullable(br.number().int()).optional(),stream:br.boolean().default(!0),stop:br.union([br.string(),br.array(br.string())]).optional(),randomSeed:br.nullable(br.number().int()).optional(),prompt:br.string(),suffix:br.nullable(br.string()).optional(),minTokens:br.nullable(br.number().int()).optional()}).transform(t=>(0,rqt.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var tqt;(function(t){t.inboundSchema=qo.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=qo.FIMCompletionStreamRequest$outboundSchema})(tqt||(qo.FIMCompletionStreamRequest$=tqt={}));function _ln(t){return JSON.stringify(qo.FIMCompletionStreamRequest$outboundSchema.parse(t))}function vln(t){return(0,nqt.safeParse)(t,e=>qo.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var uDe=v(qu=>{"use strict";var wln=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]}),Sln=qu&&qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xln=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)&&wln(e,t,r);return Sln(e,t),e};Object.defineProperty(qu,"__esModule",{value:!0});qu.FTModelCapabilitiesOut$=qu.FTModelCapabilitiesOut$outboundSchema=qu.FTModelCapabilitiesOut$inboundSchema=void 0;qu.ftModelCapabilitiesOutToJSON=Oln;qu.ftModelCapabilitiesOutFromJSON=Pln;var Hx=xln(Te()),aqt=Ue(),Cln=ve();qu.FTModelCapabilitiesOut$inboundSchema=Hx.object({completion_chat:Hx.boolean().default(!0),completion_fim:Hx.boolean().default(!1),function_calling:Hx.boolean().default(!1),fine_tuning:Hx.boolean().default(!1)}).transform(t=>(0,aqt.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));qu.FTModelCapabilitiesOut$outboundSchema=Hx.object({completionChat:Hx.boolean().default(!0),completionFim:Hx.boolean().default(!1),functionCalling:Hx.boolean().default(!1),fineTuning:Hx.boolean().default(!1)}).transform(t=>(0,aqt.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var iqt;(function(t){t.inboundSchema=qu.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=qu.FTModelCapabilitiesOut$outboundSchema})(iqt||(qu.FTModelCapabilitiesOut$=iqt={}));function Oln(t){return JSON.stringify(qu.FTModelCapabilitiesOut$outboundSchema.parse(t))}function Pln(t){return(0,Cln.safeParse)(t,e=>qu.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var lDe=v(Uo=>{"use strict";var Eln=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]}),Tln=Uo&&Uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aln=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)&&Eln(e,t,r);return Tln(e,t),e};Object.defineProperty(Uo,"__esModule",{value:!0});Uo.FTModelCard$=Uo.FTModelCard$outboundSchema=Uo.FTModelCard$inboundSchema=Uo.FTModelCardType$=Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema=Uo.FTModelCardType=void 0;Uo.ftModelCardToJSON=Mln;Uo.ftModelCardFromJSON=Rln;var on=Aln(Te()),lqt=Ue(),Iln=ve(),cqt=Pse();Uo.FTModelCardType={FineTuned:"fine-tuned"};Uo.FTModelCardType$inboundSchema=on.nativeEnum(Uo.FTModelCardType);Uo.FTModelCardType$outboundSchema=Uo.FTModelCardType$inboundSchema;var sqt;(function(t){t.inboundSchema=Uo.FTModelCardType$inboundSchema,t.outboundSchema=Uo.FTModelCardType$outboundSchema})(sqt||(Uo.FTModelCardType$=sqt={}));Uo.FTModelCard$inboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),owned_by:on.string().default("mistralai"),capabilities:cqt.ModelCapabilities$inboundSchema,name:on.nullable(on.string()).optional(),description:on.nullable(on.string()).optional(),max_context_length:on.number().int().default(32768),aliases:on.array(on.string()).optional(),deprecation:on.nullable(on.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),default_model_temperature:on.nullable(on.number()).optional(),type:on.literal("fine-tuned").default("fine-tuned"),job:on.string(),root:on.string(),archived:on.boolean().default(!1)}).transform(t=>(0,lqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",default_model_temperature:"defaultModelTemperature"}));Uo.FTModelCard$outboundSchema=on.object({id:on.string(),object:on.string().default("model"),created:on.number().int().optional(),ownedBy:on.string().default("mistralai"),capabilities:cqt.ModelCapabilities$outboundSchema,name:on.nullable(on.string()).optional(),description:on.nullable(on.string()).optional(),maxContextLength:on.number().int().default(32768),aliases:on.array(on.string()).optional(),deprecation:on.nullable(on.date().transform(t=>t.toISOString())).optional(),defaultModelTemperature:on.nullable(on.number()).optional(),type:on.literal("fine-tuned").default("fine-tuned"),job:on.string(),root:on.string(),archived:on.boolean().default(!1)}).transform(t=>(0,lqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",defaultModelTemperature:"default_model_temperature"}));var uqt;(function(t){t.inboundSchema=Uo.FTModelCard$inboundSchema,t.outboundSchema=Uo.FTModelCard$outboundSchema})(uqt||(Uo.FTModelCard$=uqt={}));function Mln(t){return JSON.stringify(Uo.FTModelCard$outboundSchema.parse(t))}function Rln(t){return(0,Iln.safeParse)(t,e=>Uo.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var hqt=v(zo=>{"use strict";var jln=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]}),Nln=zo&&zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dln=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)&&jln(e,t,r);return Nln(e,t),e};Object.defineProperty(zo,"__esModule",{value:!0});zo.FTModelOut$=zo.FTModelOut$outboundSchema=zo.FTModelOut$inboundSchema=zo.FTModelOutObject$=zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema=zo.FTModelOutObject=void 0;zo.ftModelOutToJSON=Fln;zo.ftModelOutFromJSON=kln;var ui=Dln(Te()),pqt=Ue(),Lln=ve(),mqt=uDe();zo.FTModelOutObject={Model:"model"};zo.FTModelOutObject$inboundSchema=ui.nativeEnum(zo.FTModelOutObject);zo.FTModelOutObject$outboundSchema=zo.FTModelOutObject$inboundSchema;var dqt;(function(t){t.inboundSchema=zo.FTModelOutObject$inboundSchema,t.outboundSchema=zo.FTModelOutObject$outboundSchema})(dqt||(zo.FTModelOutObject$=dqt={}));zo.FTModelOut$inboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),owned_by:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:mqt.FTModelCapabilitiesOut$inboundSchema,max_context_length:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,pqt.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength"}));zo.FTModelOut$outboundSchema=ui.object({id:ui.string(),object:ui.literal("model").default("model"),created:ui.number().int(),ownedBy:ui.string(),root:ui.string(),archived:ui.boolean(),name:ui.nullable(ui.string()).optional(),description:ui.nullable(ui.string()).optional(),capabilities:mqt.FTModelCapabilitiesOut$outboundSchema,maxContextLength:ui.number().int().default(32768),aliases:ui.array(ui.string()).optional(),job:ui.string()}).transform(t=>(0,pqt.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length"}));var fqt;(function(t){t.inboundSchema=zo.FTModelOut$inboundSchema,t.outboundSchema=zo.FTModelOut$outboundSchema})(fqt||(zo.FTModelOut$=fqt={}));function Fln(t){return JSON.stringify(zo.FTModelOut$outboundSchema.parse(t))}function kln(t){return(0,Lln.safeParse)(t,e=>zo.FTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelOut' from JSON")}});var cDe=v(Ho=>{"use strict";var $ln=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]}),Bln=Ho&&Ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qln=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)&&$ln(e,t,r);return Bln(e,t),e};Object.defineProperty(Ho,"__esModule",{value:!0});Ho.GithubRepositoryIn$=Ho.GithubRepositoryIn$outboundSchema=Ho.GithubRepositoryIn$inboundSchema=Ho.GithubRepositoryInType$=Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema=Ho.GithubRepositoryInType=void 0;Ho.githubRepositoryInToJSON=zln;Ho.githubRepositoryInFromJSON=Hln;var od=qln(Te()),Uln=ve();Ho.GithubRepositoryInType={Github:"github"};Ho.GithubRepositoryInType$inboundSchema=od.nativeEnum(Ho.GithubRepositoryInType);Ho.GithubRepositoryInType$outboundSchema=Ho.GithubRepositoryInType$inboundSchema;var gqt;(function(t){t.inboundSchema=Ho.GithubRepositoryInType$inboundSchema,t.outboundSchema=Ho.GithubRepositoryInType$outboundSchema})(gqt||(Ho.GithubRepositoryInType$=gqt={}));Ho.GithubRepositoryIn$inboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});Ho.GithubRepositoryIn$outboundSchema=od.object({type:od.literal("github").default("github"),name:od.string(),owner:od.string(),ref:od.nullable(od.string()).optional(),weight:od.number().default(1),token:od.string()});var yqt;(function(t){t.inboundSchema=Ho.GithubRepositoryIn$inboundSchema,t.outboundSchema=Ho.GithubRepositoryIn$outboundSchema})(yqt||(Ho.GithubRepositoryIn$=yqt={}));function zln(t){return JSON.stringify(Ho.GithubRepositoryIn$outboundSchema.parse(t))}function Hln(t){return(0,Uln.safeParse)(t,e=>Ho.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var dDe=v(Uu=>{"use strict";var Vln=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]}),Wln=Uu&&Uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kln=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)&&Vln(e,t,r);return Wln(e,t),e};Object.defineProperty(Uu,"__esModule",{value:!0});Uu.TrainingFile$=Uu.TrainingFile$outboundSchema=Uu.TrainingFile$inboundSchema=void 0;Uu.trainingFileToJSON=Jln;Uu.trainingFileFromJSON=Yln;var FU=Kln(Te()),_qt=Ue(),Gln=ve();Uu.TrainingFile$inboundSchema=FU.object({file_id:FU.string(),weight:FU.number().default(1)}).transform(t=>(0,_qt.remap)(t,{file_id:"fileId"}));Uu.TrainingFile$outboundSchema=FU.object({fileId:FU.string(),weight:FU.number().default(1)}).transform(t=>(0,_qt.remap)(t,{fileId:"file_id"}));var bqt;(function(t){t.inboundSchema=Uu.TrainingFile$inboundSchema,t.outboundSchema=Uu.TrainingFile$outboundSchema})(bqt||(Uu.TrainingFile$=bqt={}));function Jln(t){return JSON.stringify(Uu.TrainingFile$outboundSchema.parse(t))}function Yln(t){return(0,Gln.safeParse)(t,e=>Uu.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var fDe=v(zu=>{"use strict";var Zln=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]}),Xln=zu&&zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qln=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)&&Zln(e,t,r);return Xln(e,t),e};Object.defineProperty(zu,"__esModule",{value:!0});zu.TrainingParametersIn$=zu.TrainingParametersIn$outboundSchema=zu.TrainingParametersIn$inboundSchema=void 0;zu.trainingParametersInToJSON=tcn;zu.trainingParametersInFromJSON=rcn;var Ii=Qln(Te()),wqt=Ue(),ecn=ve();zu.TrainingParametersIn$inboundSchema=Ii.object({training_steps:Ii.nullable(Ii.number().int()).optional(),learning_rate:Ii.number().default(1e-4),weight_decay:Ii.nullable(Ii.number()).optional(),warmup_fraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fim_ratio:Ii.nullable(Ii.number()).optional(),seq_len:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,wqt.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",fim_ratio:"fimRatio",seq_len:"seqLen"}));zu.TrainingParametersIn$outboundSchema=Ii.object({trainingSteps:Ii.nullable(Ii.number().int()).optional(),learningRate:Ii.number().default(1e-4),weightDecay:Ii.nullable(Ii.number()).optional(),warmupFraction:Ii.nullable(Ii.number()).optional(),epochs:Ii.nullable(Ii.number()).optional(),fimRatio:Ii.nullable(Ii.number()).optional(),seqLen:Ii.nullable(Ii.number().int()).optional()}).transform(t=>(0,wqt.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",fimRatio:"fim_ratio",seqLen:"seq_len"}));var vqt;(function(t){t.inboundSchema=zu.TrainingParametersIn$inboundSchema,t.outboundSchema=zu.TrainingParametersIn$outboundSchema})(vqt||(zu.TrainingParametersIn$=vqt={}));function tcn(t){return JSON.stringify(zu.TrainingParametersIn$outboundSchema.parse(t))}function rcn(t){return(0,ecn.safeParse)(t,e=>zu.TrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingParametersIn' from JSON")}});var pDe=v(Vo=>{"use strict";var ncn=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]}),ocn=Vo&&Vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),icn=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)&&ncn(e,t,r);return ocn(e,t),e};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.WandbIntegration$=Vo.WandbIntegration$outboundSchema=Vo.WandbIntegration$inboundSchema=Vo.WandbIntegrationType$=Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema=Vo.WandbIntegrationType=void 0;Vo.wandbIntegrationToJSON=scn;Vo.wandbIntegrationFromJSON=ucn;var id=icn(Te()),Cqt=Ue(),acn=ve();Vo.WandbIntegrationType={Wandb:"wandb"};Vo.WandbIntegrationType$inboundSchema=id.nativeEnum(Vo.WandbIntegrationType);Vo.WandbIntegrationType$outboundSchema=Vo.WandbIntegrationType$inboundSchema;var Sqt;(function(t){t.inboundSchema=Vo.WandbIntegrationType$inboundSchema,t.outboundSchema=Vo.WandbIntegrationType$outboundSchema})(Sqt||(Vo.WandbIntegrationType$=Sqt={}));Vo.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,Cqt.remap)(t,{api_key:"apiKey",run_name:"runName"}));Vo.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,Cqt.remap)(t,{apiKey:"api_key",runName:"run_name"}));var xqt;(function(t){t.inboundSchema=Vo.WandbIntegration$inboundSchema,t.outboundSchema=Vo.WandbIntegration$outboundSchema})(xqt||(Vo.WandbIntegration$=xqt={}));function scn(t){return JSON.stringify(Vo.WandbIntegration$outboundSchema.parse(t))}function ucn(t){return(0,acn.safeParse)(t,e=>Vo.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var Mqt=v(Lr=>{"use strict";var lcn=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]}),ccn=Lr&&Lr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dcn=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)&&lcn(e,t,r);return ccn(e,t),e};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.JobIn$=Lr.JobIn$outboundSchema=Lr.JobIn$inboundSchema=Lr.JobInRepositories$=Lr.JobInRepositories$outboundSchema=Lr.JobInRepositories$inboundSchema=Lr.JobInIntegrations$=Lr.JobInIntegrations$outboundSchema=Lr.JobInIntegrations$inboundSchema=void 0;Lr.jobInIntegrationsToJSON=fcn;Lr.jobInIntegrationsFromJSON=pcn;Lr.jobInRepositoriesToJSON=mcn;Lr.jobInRepositoriesFromJSON=hcn;Lr.jobInToJSON=gcn;Lr.jobInFromJSON=ycn;var ja=dcn(Te()),Tqt=Ue(),mDe=ve(),Zse=cDe(),Aqt=dDe(),Iqt=fDe(),Xse=pDe();Lr.JobInIntegrations$inboundSchema=Xse.WandbIntegration$inboundSchema;Lr.JobInIntegrations$outboundSchema=Xse.WandbIntegration$outboundSchema;var Oqt;(function(t){t.inboundSchema=Lr.JobInIntegrations$inboundSchema,t.outboundSchema=Lr.JobInIntegrations$outboundSchema})(Oqt||(Lr.JobInIntegrations$=Oqt={}));function fcn(t){return JSON.stringify(Lr.JobInIntegrations$outboundSchema.parse(t))}function pcn(t){return(0,mDe.safeParse)(t,e=>Lr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Lr.JobInRepositories$inboundSchema=Zse.GithubRepositoryIn$inboundSchema;Lr.JobInRepositories$outboundSchema=Zse.GithubRepositoryIn$outboundSchema;var Pqt;(function(t){t.inboundSchema=Lr.JobInRepositories$inboundSchema,t.outboundSchema=Lr.JobInRepositories$outboundSchema})(Pqt||(Lr.JobInRepositories$=Pqt={}));function mcn(t){return JSON.stringify(Lr.JobInRepositories$outboundSchema.parse(t))}function hcn(t){return(0,mDe.safeParse)(t,e=>Lr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Lr.JobIn$inboundSchema=ja.object({model:ja.string(),training_files:ja.array(Aqt.TrainingFile$inboundSchema).optional(),validation_files:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Iqt.TrainingParametersIn$inboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(Xse.WandbIntegration$inboundSchema)).optional(),repositories:ja.array(Zse.GithubRepositoryIn$inboundSchema).optional(),auto_start:ja.boolean().optional()}).transform(t=>(0,Tqt.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart"}));Lr.JobIn$outboundSchema=ja.object({model:ja.string(),trainingFiles:ja.array(Aqt.TrainingFile$outboundSchema).optional(),validationFiles:ja.nullable(ja.array(ja.string())).optional(),hyperparameters:Iqt.TrainingParametersIn$outboundSchema,suffix:ja.nullable(ja.string()).optional(),integrations:ja.nullable(ja.array(Xse.WandbIntegration$outboundSchema)).optional(),repositories:ja.array(Zse.GithubRepositoryIn$outboundSchema).optional(),autoStart:ja.boolean().optional()}).transform(t=>(0,Tqt.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start"}));var Eqt;(function(t){t.inboundSchema=Lr.JobIn$inboundSchema,t.outboundSchema=Lr.JobIn$outboundSchema})(Eqt||(Lr.JobIn$=Eqt={}));function gcn(t){return JSON.stringify(Lr.JobIn$outboundSchema.parse(t))}function ycn(t){return(0,mDe.safeParse)(t,e=>Lr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var gDe=v(yt=>{"use strict";var bcn=yt&&yt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_cn=yt&&yt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vcn=yt&&yt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&bcn(e,t,r);return _cn(e,t),e};Object.defineProperty(yt,"__esModule",{value:!0});yt.JobOut$=yt.JobOut$outboundSchema=yt.JobOut$inboundSchema=yt.Repositories$=yt.Repositories$outboundSchema=yt.Repositories$inboundSchema=yt.Integrations$=yt.Integrations$outboundSchema=yt.Integrations$inboundSchema=yt.ObjectT$=yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema=yt.Status$=yt.Status$outboundSchema=yt.Status$inboundSchema=yt.ObjectT=yt.Status=void 0;yt.integrationsToJSON=wcn;yt.integrationsFromJSON=Scn;yt.repositoriesToJSON=xcn;yt.repositoriesFromJSON=Ccn;yt.jobOutToJSON=Ocn;yt.jobOutFromJSON=Pcn;var _r=vcn(Te()),Fqt=Ue(),hDe=ve(),Qse=Hse(),kqt=Vse(),$qt=Wse(),eue=Kse();yt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};yt.ObjectT={Job:"job"};yt.Status$inboundSchema=_r.nativeEnum(yt.Status);yt.Status$outboundSchema=yt.Status$inboundSchema;var Rqt;(function(t){t.inboundSchema=yt.Status$inboundSchema,t.outboundSchema=yt.Status$outboundSchema})(Rqt||(yt.Status$=Rqt={}));yt.ObjectT$inboundSchema=_r.nativeEnum(yt.ObjectT);yt.ObjectT$outboundSchema=yt.ObjectT$inboundSchema;var jqt;(function(t){t.inboundSchema=yt.ObjectT$inboundSchema,t.outboundSchema=yt.ObjectT$outboundSchema})(jqt||(yt.ObjectT$=jqt={}));yt.Integrations$inboundSchema=eue.WandbIntegrationOut$inboundSchema;yt.Integrations$outboundSchema=eue.WandbIntegrationOut$outboundSchema;var Nqt;(function(t){t.inboundSchema=yt.Integrations$inboundSchema,t.outboundSchema=yt.Integrations$outboundSchema})(Nqt||(yt.Integrations$=Nqt={}));function wcn(t){return JSON.stringify(yt.Integrations$outboundSchema.parse(t))}function Scn(t){return(0,hDe.safeParse)(t,e=>yt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}yt.Repositories$inboundSchema=Qse.GithubRepositoryOut$inboundSchema;yt.Repositories$outboundSchema=Qse.GithubRepositoryOut$outboundSchema;var Dqt;(function(t){t.inboundSchema=yt.Repositories$inboundSchema,t.outboundSchema=yt.Repositories$outboundSchema})(Dqt||(yt.Repositories$=Dqt={}));function xcn(t){return JSON.stringify(yt.Repositories$outboundSchema.parse(t))}function Ccn(t){return(0,hDe.safeParse)(t,e=>yt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}yt.JobOut$inboundSchema=_r.object({id:_r.string(),auto_start:_r.boolean(),hyperparameters:$qt.TrainingParameters$inboundSchema,model:_r.string(),status:yt.Status$inboundSchema,job_type:_r.string(),created_at:_r.number().int(),modified_at:_r.number().int(),training_files:_r.array(_r.string()),validation_files:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fine_tuned_model:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(eue.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(Qse.GithubRepositoryOut$inboundSchema).optional(),metadata:_r.nullable(kqt.JobMetadataOut$inboundSchema).optional()}).transform(t=>(0,Fqt.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"}));yt.JobOut$outboundSchema=_r.object({id:_r.string(),autoStart:_r.boolean(),hyperparameters:$qt.TrainingParameters$outboundSchema,model:_r.string(),status:yt.Status$outboundSchema,jobType:_r.string(),createdAt:_r.number().int(),modifiedAt:_r.number().int(),trainingFiles:_r.array(_r.string()),validationFiles:_r.nullable(_r.array(_r.string())).optional(),object:_r.literal("job").default("job"),fineTunedModel:_r.nullable(_r.string()).optional(),suffix:_r.nullable(_r.string()).optional(),integrations:_r.nullable(_r.array(eue.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:_r.nullable(_r.number().int()).optional(),repositories:_r.array(Qse.GithubRepositoryOut$outboundSchema).optional(),metadata:_r.nullable(kqt.JobMetadataOut$outboundSchema).optional()}).transform(t=>(0,Fqt.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 Lqt;(function(t){t.inboundSchema=yt.JobOut$inboundSchema,t.outboundSchema=yt.JobOut$outboundSchema})(Lqt||(yt.JobOut$=Lqt={}));function Ocn(t){return JSON.stringify(yt.JobOut$outboundSchema.parse(t))}function Pcn(t){return(0,hDe.safeParse)(t,e=>yt.JobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobOut' from JSON")}});var zqt=v(Wo=>{"use strict";var Ecn=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]}),Tcn=Wo&&Wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Acn=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)&&Ecn(e,t,r);return Tcn(e,t),e};Object.defineProperty(Wo,"__esModule",{value:!0});Wo.JobsOut$=Wo.JobsOut$outboundSchema=Wo.JobsOut$inboundSchema=Wo.JobsOutObject$=Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema=Wo.JobsOutObject=void 0;Wo.jobsOutToJSON=Mcn;Wo.jobsOutFromJSON=Rcn;var wP=Acn(Te()),Icn=ve(),Uqt=gDe();Wo.JobsOutObject={List:"list"};Wo.JobsOutObject$inboundSchema=wP.nativeEnum(Wo.JobsOutObject);Wo.JobsOutObject$outboundSchema=Wo.JobsOutObject$inboundSchema;var Bqt;(function(t){t.inboundSchema=Wo.JobsOutObject$inboundSchema,t.outboundSchema=Wo.JobsOutObject$outboundSchema})(Bqt||(Wo.JobsOutObject$=Bqt={}));Wo.JobsOut$inboundSchema=wP.object({data:wP.array(Uqt.JobOut$inboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});Wo.JobsOut$outboundSchema=wP.object({data:wP.array(Uqt.JobOut$outboundSchema).optional(),object:wP.literal("list").default("list"),total:wP.number().int()});var qqt;(function(t){t.inboundSchema=Wo.JobsOut$inboundSchema,t.outboundSchema=Wo.JobsOut$outboundSchema})(qqt||(Wo.JobsOut$=qqt={}));function Mcn(t){return JSON.stringify(Wo.JobsOut$outboundSchema.parse(t))}function Rcn(t){return(0,Icn.safeParse)(t,e=>Wo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var Kqt=v(Ko=>{"use strict";var jcn=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]}),Ncn=Ko&&Ko.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dcn=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)&&jcn(e,t,r);return Ncn(e,t),e};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.LegacyJobMetadataOut$=Ko.LegacyJobMetadataOut$outboundSchema=Ko.LegacyJobMetadataOut$inboundSchema=Ko.LegacyJobMetadataOutObject$=Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema=Ko.LegacyJobMetadataOutObject=void 0;Ko.legacyJobMetadataOutToJSON=Fcn;Ko.legacyJobMetadataOutFromJSON=kcn;var Nr=Dcn(Te()),Wqt=Ue(),Lcn=ve();Ko.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Ko.LegacyJobMetadataOutObject$inboundSchema=Nr.nativeEnum(Ko.LegacyJobMetadataOutObject);Ko.LegacyJobMetadataOutObject$outboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema;var Hqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOutObject$outboundSchema})(Hqt||(Ko.LegacyJobMetadataOutObject$=Hqt={}));Ko.LegacyJobMetadataOut$inboundSchema=Nr.object({expected_duration_seconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),cost_currency:Nr.nullable(Nr.string()).optional(),train_tokens_per_step:Nr.nullable(Nr.number().int()).optional(),train_tokens:Nr.nullable(Nr.number().int()).optional(),data_tokens:Nr.nullable(Nr.number().int()).optional(),estimated_start_time:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),training_steps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Wqt.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"}));Ko.LegacyJobMetadataOut$outboundSchema=Nr.object({expectedDurationSeconds:Nr.nullable(Nr.number().int()).optional(),cost:Nr.nullable(Nr.number()).optional(),costCurrency:Nr.nullable(Nr.string()).optional(),trainTokensPerStep:Nr.nullable(Nr.number().int()).optional(),trainTokens:Nr.nullable(Nr.number().int()).optional(),dataTokens:Nr.nullable(Nr.number().int()).optional(),estimatedStartTime:Nr.nullable(Nr.number().int()).optional(),deprecated:Nr.boolean().default(!0),details:Nr.string(),epochs:Nr.nullable(Nr.number()).optional(),trainingSteps:Nr.nullable(Nr.number().int()).optional(),object:Nr.literal("job.metadata").default("job.metadata")}).transform(t=>(0,Wqt.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 Vqt;(function(t){t.inboundSchema=Ko.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Ko.LegacyJobMetadataOut$outboundSchema})(Vqt||(Ko.LegacyJobMetadataOut$=Vqt={}));function Fcn(t){return JSON.stringify(Ko.LegacyJobMetadataOut$outboundSchema.parse(t))}function kcn(t){return(0,Lcn.safeParse)(t,e=>Ko.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var Yqt=v(Hu=>{"use strict";var $cn=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]}),Bcn=Hu&&Hu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qcn=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)&&$cn(e,t,r);return Bcn(e,t),e};Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ListFilesOut$=Hu.ListFilesOut$outboundSchema=Hu.ListFilesOut$inboundSchema=void 0;Hu.listFilesOutToJSON=zcn;Hu.listFilesOutFromJSON=Hcn;var WI=qcn(Te()),Ucn=ve(),Jqt=sDe();Hu.ListFilesOut$inboundSchema=WI.object({data:WI.array(Jqt.FileSchema$inboundSchema),object:WI.string(),total:WI.number().int()});Hu.ListFilesOut$outboundSchema=WI.object({data:WI.array(Jqt.FileSchema$outboundSchema),object:WI.string(),total:WI.number().int()});var Gqt;(function(t){t.inboundSchema=Hu.ListFilesOut$inboundSchema,t.outboundSchema=Hu.ListFilesOut$outboundSchema})(Gqt||(Hu.ListFilesOut$=Gqt={}));function zcn(t){return JSON.stringify(Hu.ListFilesOut$outboundSchema.parse(t))}function Hcn(t){return(0,Ucn.safeParse)(t,e=>Hu.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var eUt=v(Go=>{"use strict";var Vcn=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]}),Wcn=Go&&Go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kcn=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)&&Vcn(e,t,r);return Wcn(e,t),e};Object.defineProperty(Go,"__esModule",{value:!0});Go.ModelList$=Go.ModelList$outboundSchema=Go.ModelList$inboundSchema=Go.Data$=Go.Data$outboundSchema=Go.Data$inboundSchema=void 0;Go.dataToJSON=Gcn;Go.dataFromJSON=Jcn;Go.modelListToJSON=Ycn;Go.modelListFromJSON=Zcn;var Gi=Kcn(Te()),Qqt=ve(),tue=GNe(),rue=lDe();Go.Data$inboundSchema=Gi.union([tue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Go.Data$outboundSchema=Gi.union([tue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var Zqt;(function(t){t.inboundSchema=Go.Data$inboundSchema,t.outboundSchema=Go.Data$outboundSchema})(Zqt||(Go.Data$=Zqt={}));function Gcn(t){return JSON.stringify(Go.Data$outboundSchema.parse(t))}function Jcn(t){return(0,Qqt.safeParse)(t,e=>Go.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Go.ModelList$inboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([tue.BaseModelCard$inboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$inboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});Go.ModelList$outboundSchema=Gi.object({object:Gi.string().default("list"),data:Gi.array(Gi.union([tue.BaseModelCard$outboundSchema.and(Gi.object({type:Gi.literal("base")}).transform(t=>({type:t.type}))),rue.FTModelCard$outboundSchema.and(Gi.object({type:Gi.literal("fine-tuned")}).transform(t=>({type:t.type})))])).optional()});var Xqt;(function(t){t.inboundSchema=Go.ModelList$inboundSchema,t.outboundSchema=Go.ModelList$outboundSchema})(Xqt||(Go.ModelList$=Xqt={}));function Ycn(t){return JSON.stringify(Go.ModelList$outboundSchema.parse(t))}function Zcn(t){return(0,Qqt.safeParse)(t,e=>Go.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var aUt=v(Vu=>{"use strict";var Xcn=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]}),Qcn=Vu&&Vu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),edn=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)&&Xcn(e,t,r);return Qcn(e,t),e};Object.defineProperty(Vu,"__esModule",{value:!0});Vu.RetrieveFileOut$=Vu.RetrieveFileOut$outboundSchema=Vu.RetrieveFileOut$inboundSchema=void 0;Vu.retrieveFileOutToJSON=rdn;Vu.retrieveFileOutFromJSON=ndn;var gc=edn(Te()),rUt=Ue(),tdn=ve(),nUt=K5(),oUt=G5(),iUt=J5();Vu.RetrieveFileOut$inboundSchema=gc.object({id:gc.string(),object:gc.string(),bytes:gc.number().int(),created_at:gc.number().int(),filename:gc.string(),purpose:nUt.FilePurpose$inboundSchema,sample_type:oUt.SampleType$inboundSchema,num_lines:gc.nullable(gc.number().int()).optional(),source:iUt.Source$inboundSchema,deleted:gc.boolean()}).transform(t=>(0,rUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Vu.RetrieveFileOut$outboundSchema=gc.object({id:gc.string(),object:gc.string(),sizeBytes:gc.number().int(),createdAt:gc.number().int(),filename:gc.string(),purpose:nUt.FilePurpose$outboundSchema,sampleType:oUt.SampleType$outboundSchema,numLines:gc.nullable(gc.number().int()).optional(),source:iUt.Source$outboundSchema,deleted:gc.boolean()}).transform(t=>(0,rUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var tUt;(function(t){t.inboundSchema=Vu.RetrieveFileOut$inboundSchema,t.outboundSchema=Vu.RetrieveFileOut$outboundSchema})(tUt||(Vu.RetrieveFileOut$=tUt={}));function rdn(t){return JSON.stringify(Vu.RetrieveFileOut$outboundSchema.parse(t))}function ndn(t){return(0,tdn.safeParse)(t,e=>Vu.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var lUt=v(Wu=>{"use strict";var odn=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]}),idn=Wu&&Wu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),adn=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)&&odn(e,t,r);return idn(e,t),e};Object.defineProperty(Wu,"__esModule",{value:!0});Wu.Security$=Wu.Security$outboundSchema=Wu.Security$inboundSchema=void 0;Wu.securityToJSON=udn;Wu.securityFromJSON=ldn;var nue=adn(Te()),uUt=Ue(),sdn=ve();Wu.Security$inboundSchema=nue.object({ApiKey:nue.string().optional()}).transform(t=>(0,uUt.remap)(t,{ApiKey:"apiKey"}));Wu.Security$outboundSchema=nue.object({apiKey:nue.string().optional()}).transform(t=>(0,uUt.remap)(t,{apiKey:"ApiKey"}));var sUt;(function(t){t.inboundSchema=Wu.Security$inboundSchema,t.outboundSchema=Wu.Security$outboundSchema})(sUt||(Wu.Security$=sUt={}));function udn(t){return JSON.stringify(Wu.Security$outboundSchema.parse(t))}function ldn(t){return(0,sdn.safeParse)(t,e=>Wu.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var fUt=v(Jo=>{"use strict";var cdn=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]}),ddn=Jo&&Jo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fdn=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)&&cdn(e,t,r);return ddn(e,t),e};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.UnarchiveFTModelOut$=Jo.UnarchiveFTModelOut$outboundSchema=Jo.UnarchiveFTModelOut$inboundSchema=Jo.UnarchiveFTModelOutObject$=Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema=Jo.UnarchiveFTModelOutObject=void 0;Jo.unarchiveFTModelOutToJSON=mdn;Jo.unarchiveFTModelOutFromJSON=hdn;var SP=fdn(Te()),pdn=ve();Jo.UnarchiveFTModelOutObject={Model:"model"};Jo.UnarchiveFTModelOutObject$inboundSchema=SP.nativeEnum(Jo.UnarchiveFTModelOutObject);Jo.UnarchiveFTModelOutObject$outboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema;var cUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOutObject$outboundSchema})(cUt||(Jo.UnarchiveFTModelOutObject$=cUt={}));Jo.UnarchiveFTModelOut$inboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});Jo.UnarchiveFTModelOut$outboundSchema=SP.object({id:SP.string(),object:SP.literal("model").default("model"),archived:SP.boolean().default(!1)});var dUt;(function(t){t.inboundSchema=Jo.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Jo.UnarchiveFTModelOut$outboundSchema})(dUt||(Jo.UnarchiveFTModelOut$=dUt={}));function mdn(t){return JSON.stringify(Jo.UnarchiveFTModelOut$outboundSchema.parse(t))}function hdn(t){return(0,pdn.safeParse)(t,e=>Jo.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var mUt=v(Ku=>{"use strict";var gdn=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]}),ydn=Ku&&Ku.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bdn=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)&&gdn(e,t,r);return ydn(e,t),e};Object.defineProperty(Ku,"__esModule",{value:!0});Ku.UpdateFTModelIn$=Ku.UpdateFTModelIn$outboundSchema=Ku.UpdateFTModelIn$inboundSchema=void 0;Ku.updateFTModelInToJSON=vdn;Ku.updateFTModelInFromJSON=wdn;var Vx=bdn(Te()),_dn=ve();Ku.UpdateFTModelIn$inboundSchema=Vx.object({name:Vx.nullable(Vx.string()).optional(),description:Vx.nullable(Vx.string()).optional()});Ku.UpdateFTModelIn$outboundSchema=Vx.object({name:Vx.nullable(Vx.string()).optional(),description:Vx.nullable(Vx.string()).optional()});var pUt;(function(t){t.inboundSchema=Ku.UpdateFTModelIn$inboundSchema,t.outboundSchema=Ku.UpdateFTModelIn$outboundSchema})(pUt||(Ku.UpdateFTModelIn$=pUt={}));function vdn(t){return JSON.stringify(Ku.UpdateFTModelIn$outboundSchema.parse(t))}function wdn(t){return(0,_dn.safeParse)(t,e=>Ku.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var vUt=v(Gu=>{"use strict";var Sdn=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]}),xdn=Gu&&Gu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cdn=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)&&Sdn(e,t,r);return xdn(e,t),e};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.UploadFileOut$=Gu.UploadFileOut$outboundSchema=Gu.UploadFileOut$inboundSchema=void 0;Gu.uploadFileOutToJSON=Pdn;Gu.uploadFileOutFromJSON=Edn;var cf=Cdn(Te()),gUt=Ue(),Odn=ve(),yUt=K5(),bUt=G5(),_Ut=J5();Gu.UploadFileOut$inboundSchema=cf.object({id:cf.string(),object:cf.string(),bytes:cf.number().int(),created_at:cf.number().int(),filename:cf.string(),purpose:yUt.FilePurpose$inboundSchema,sample_type:bUt.SampleType$inboundSchema,num_lines:cf.nullable(cf.number().int()).optional(),source:_Ut.Source$inboundSchema}).transform(t=>(0,gUt.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Gu.UploadFileOut$outboundSchema=cf.object({id:cf.string(),object:cf.string(),sizeBytes:cf.number().int(),createdAt:cf.number().int(),filename:cf.string(),purpose:yUt.FilePurpose$outboundSchema,sampleType:bUt.SampleType$outboundSchema,numLines:cf.nullable(cf.number().int()).optional(),source:_Ut.Source$outboundSchema}).transform(t=>(0,gUt.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var hUt;(function(t){t.inboundSchema=Gu.UploadFileOut$inboundSchema,t.outboundSchema=Gu.UploadFileOut$outboundSchema})(hUt||(Gu.UploadFileOut$=hUt={}));function Pdn(t){return JSON.stringify(Gu.UploadFileOut$outboundSchema.parse(t))}function Edn(t){return(0,Odn.safeParse)(t,e=>Gu.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var CUt=v(Yo=>{"use strict";var Tdn=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]}),Adn=Yo&&Yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Idn=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)&&Tdn(e,t,r);return Adn(e,t),e};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.ValidationError$=Yo.ValidationError$outboundSchema=Yo.ValidationError$inboundSchema=Yo.Loc$=Yo.Loc$outboundSchema=Yo.Loc$inboundSchema=void 0;Yo.locToJSON=Mdn;Yo.locFromJSON=Rdn;Yo.validationErrorToJSON=jdn;Yo.validationErrorFromJSON=Ndn;var Ju=Idn(Te()),xUt=ve();Yo.Loc$inboundSchema=Ju.union([Ju.string(),Ju.number().int()]);Yo.Loc$outboundSchema=Ju.union([Ju.string(),Ju.number().int()]);var wUt;(function(t){t.inboundSchema=Yo.Loc$inboundSchema,t.outboundSchema=Yo.Loc$outboundSchema})(wUt||(Yo.Loc$=wUt={}));function Mdn(t){return JSON.stringify(Yo.Loc$outboundSchema.parse(t))}function Rdn(t){return(0,xUt.safeParse)(t,e=>Yo.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Yo.ValidationError$inboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});Yo.ValidationError$outboundSchema=Ju.object({loc:Ju.array(Ju.union([Ju.string(),Ju.number().int()])),msg:Ju.string(),type:Ju.string()});var SUt;(function(t){t.inboundSchema=Yo.ValidationError$inboundSchema,t.outboundSchema=Yo.ValidationError$outboundSchema})(SUt||(Yo.ValidationError$=SUt={}));function jdn(t){return JSON.stringify(Yo.ValidationError$outboundSchema.parse(t))}function Ndn(t){return(0,xUt.safeParse)(t,e=>Yo.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Fn=v(Ve=>{"use strict";var Ddn=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]}),Ze=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ddn(e,t,r)};Object.defineProperty(Ve,"__esModule",{value:!0});Ze(skt(),Ve);Ze(gkt(),Ve);Ze(KNe(),Ve);Ze(vkt(),Ve);Ze(qI(),Ve);Ze(GNe(),Ve);Ze(JNe(),Ve);Ze(Mkt(),Ve);Ze(ZNe(),Ve);Ze(qkt(),Ve);Ze(YNe(),Ve);Ze(Kkt(),Ve);Ze(Tse(),Ve);Ze(a$t(),Ve);Ze(f$t(),Ve);Ze(w$t(),Ve);Ze(QNe(),Ve);Ze(eDe(),Ve);Ze(j$t(),Ve);Ze(L$t(),Ve);Ze(nDe(),Ve);Ze(Z$t(),Ve);Ze(rDe(),Ve);Ze(EU(),Ve);Ze(Q$t(),Ve);Ze(tBt(),Ve);Ze(tDe(),Ve);Ze(CBt(),Ve);Ze(ABt(),Ve);Ze(NBt(),Ve);Ze(aDe(),Ve);Ze(oDe(),Ve);Ze(K5(),Ve);Ze(sDe(),Ve);Ze(HBt(),Ve);Ze(JBt(),Ve);Ze(QBt(),Ve);Ze(oqt(),Ve);Ze(uDe(),Ve);Ze(lDe(),Ve);Ze(hqt(),Ve);Ze(VNe(),Ve);Ze(qNe(),Ve);Ze(WNe(),Ve);Ze(cDe(),Ve);Ze(Hse(),Ve);Ze(kNe(),Ve);Ze($Ne(),Ve);Ze(Mqt(),Ve);Ze(Vse(),Ve);Ze(gDe(),Ve);Ze(zqt(),Ve);Ze(zNe(),Ve);Ze(Kqt(),Ve);Ze(Yqt(),Ve);Ze(XNe(),Ve);Ze(Pse(),Ve);Ze(eUt(),Ve);Ze(AU(),Ve);Ze(BNe(),Ve);Ze(IU(),Ve);Ze(HNe(),Ve);Ze(aUt(),Ve);Ze(G5(),Ve);Ze(lUt(),Ve);Ze(J5(),Ve);Ze(hD(),Ve);Ze(ose(),Ve);Ze(MU(),Ve);Ze(ise(),Ve);Ze(RU(),Ve);Ze(jU(),Ve);Ze(gD(),Ve);Ze(V5(),Ve);Ze(dDe(),Ve);Ze(Wse(),Ve);Ze(fDe(),Ve);Ze(fUt(),Ve);Ze(mUt(),Ve);Ze(vUt(),Ve);Ze(DU(),Ve);Ze(yD(),Ve);Ze(CUt(),Ve);Ze(pDe(),Ve);Ze(Kse(),Ve)});var TUt=v(yc=>{"use strict";var Ldn=yc&&yc.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fdn=yc&&yc.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PUt=yc&&yc.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ldn(e,t,r);return Fdn(e,t),e};Object.defineProperty(yc,"__esModule",{value:!0});yc.HTTPValidationError$=yc.HTTPValidationError$outboundSchema=yc.HTTPValidationError$inboundSchema=yc.HTTPValidationError=void 0;var Y5=PUt(Te()),EUt=PUt(Fn()),Z5=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"}};yc.HTTPValidationError=Z5;yc.HTTPValidationError$inboundSchema=Y5.object({detail:Y5.array(EUt.ValidationError$inboundSchema).optional()}).transform(t=>new Z5(t));yc.HTTPValidationError$outboundSchema=Y5.instanceof(Z5).transform(t=>t.data$).pipe(Y5.object({detail:Y5.array(EUt.ValidationError$outboundSchema).optional()}));var OUt;(function(t){t.inboundSchema=yc.HTTPValidationError$inboundSchema,t.outboundSchema=yc.HTTPValidationError$outboundSchema})(OUt||(yc.HTTPValidationError$=OUt={}))});var uh=v(Wx=>{"use strict";var kdn=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]}),oue=Wx&&Wx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kdn(e,t,r)};Object.defineProperty(Wx,"__esModule",{value:!0});oue(lNe(),Wx);oue(TUt(),Wx);oue(MNe(),Wx);oue(LNe(),Wx)});var MUt=v(xP=>{"use strict";var $dn=xP&&xP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bdn=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yDe=xP&&xP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$dn(e,t,r);return Bdn(e,t),e};Object.defineProperty(xP,"__esModule",{value:!0});xP.agentsComplete=Wdn;var qdn=ii(),X5=yDe(ai()),Udn=Ue(),zdn=ve(),AUt=si(),Hdn=To(),IUt=yDe(Fn()),Vdn=yDe(uh());async function Wdn(t,e,r){let n=(0,zdn.safeParse)(e,y=>IUt.AgentsCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,qdn.encodeJSON)("body",o,{explode:!0}),a=(0,Hdn.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,Udn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,AUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,AUt.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 X5.match(X5.json(200,IUt.ChatCompletionResponse$inboundSchema),X5.jsonErr(422,Vdn.HTTPValidationError$inboundSchema),X5.fail("4XX"),X5.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var NUt=v(CP=>{"use strict";var Kdn=CP&&CP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gdn=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iue=CP&&CP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Kdn(e,t,r);return Gdn(e,t),e};Object.defineProperty(CP,"__esModule",{value:!0});CP.agentsStream=rfn;var Jdn=iue(Te()),Ydn=ii(),Zdn=U5(),Q5=iue(ai()),Xdn=Ue(),Qdn=ve(),RUt=si(),efn=To(),jUt=iue(Fn()),tfn=iue(uh());async function rfn(t,e,r){let n=(0,Qdn.safeParse)(e,y=>jUt.AgentsCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Ydn.encodeJSON)("body",o,{explode:!0}),a=(0,efn.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,Xdn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,RUt.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,RUt.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 Q5.match(Q5.sse(200,Jdn.instanceof(ReadableStream).transform(y=>new Zdn.EventStream({stream:y,decoder(S){return jUt.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),Q5.jsonErr(422,tfn.HTTPValidationError$inboundSchema),Q5.fail("4XX"),Q5.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var LUt=v(aue=>{"use strict";Object.defineProperty(aue,"__esModule",{value:!0});aue.Agents=void 0;var nfn=MUt(),ofn=NUt(),ifn=ah(),DUt=Ig(),bDe=class extends ifn.ClientSDK{async complete(e,r){return(0,DUt.unwrapAsync)((0,nfn.agentsComplete)(this,e,r))}async stream(e,r){return(0,DUt.unwrapAsync)((0,ofn.agentsStream)(this,e,r))}};aue.Agents=bDe});var $Ut=v(Yu=>{"use strict";var afn=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]}),sfn=Yu&&Yu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ufn=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)&&afn(e,t,r);return sfn(e,t),e};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.DeleteModelV1ModelsModelIdDeleteRequest$=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Yu.deleteModelV1ModelsModelIdDeleteRequestToJSON=cfn;Yu.deleteModelV1ModelsModelIdDeleteRequestFromJSON=dfn;var sue=ufn(Te()),kUt=Ue(),lfn=ve();Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=sue.object({model_id:sue.string()}).transform(t=>(0,kUt.remap)(t,{model_id:"modelId"}));Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=sue.object({modelId:sue.string()}).transform(t=>(0,kUt.remap)(t,{modelId:"model_id"}));var FUt;(function(t){t.inboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(FUt||(Yu.DeleteModelV1ModelsModelIdDeleteRequest$=FUt={}));function cfn(t){return JSON.stringify(Yu.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function dfn(t){return(0,lfn.safeParse)(t,e=>Yu.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var UUt=v(Zu=>{"use strict";var ffn=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]}),pfn=Zu&&Zu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mfn=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)&&ffn(e,t,r);return pfn(e,t),e};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.FilesApiRoutesDeleteFileRequest$=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Zu.filesApiRoutesDeleteFileRequestToJSON=gfn;Zu.filesApiRoutesDeleteFileRequestFromJSON=yfn;var uue=mfn(Te()),qUt=Ue(),hfn=ve();Zu.FilesApiRoutesDeleteFileRequest$inboundSchema=uue.object({file_id:uue.string()}).transform(t=>(0,qUt.remap)(t,{file_id:"fileId"}));Zu.FilesApiRoutesDeleteFileRequest$outboundSchema=uue.object({fileId:uue.string()}).transform(t=>(0,qUt.remap)(t,{fileId:"file_id"}));var BUt;(function(t){t.inboundSchema=Zu.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Zu.FilesApiRoutesDeleteFileRequest$outboundSchema})(BUt||(Zu.FilesApiRoutesDeleteFileRequest$=BUt={}));function gfn(t){return JSON.stringify(Zu.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function yfn(t){return(0,hfn.safeParse)(t,e=>Zu.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var VUt=v(Xu=>{"use strict";var bfn=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]}),_fn=Xu&&Xu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vfn=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)&&bfn(e,t,r);return _fn(e,t),e};Object.defineProperty(Xu,"__esModule",{value:!0});Xu.FilesApiRoutesDownloadFileRequest$=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Xu.filesApiRoutesDownloadFileRequestToJSON=Sfn;Xu.filesApiRoutesDownloadFileRequestFromJSON=xfn;var lue=vfn(Te()),HUt=Ue(),wfn=ve();Xu.FilesApiRoutesDownloadFileRequest$inboundSchema=lue.object({file_id:lue.string()}).transform(t=>(0,HUt.remap)(t,{file_id:"fileId"}));Xu.FilesApiRoutesDownloadFileRequest$outboundSchema=lue.object({fileId:lue.string()}).transform(t=>(0,HUt.remap)(t,{fileId:"file_id"}));var zUt;(function(t){t.inboundSchema=Xu.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Xu.FilesApiRoutesDownloadFileRequest$outboundSchema})(zUt||(Xu.FilesApiRoutesDownloadFileRequest$=zUt={}));function Sfn(t){return JSON.stringify(Xu.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function xfn(t){return(0,wfn.safeParse)(t,e=>Xu.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var GUt=v(Qu=>{"use strict";var Cfn=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]}),Ofn=Qu&&Qu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pfn=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)&&Cfn(e,t,r);return Ofn(e,t),e};Object.defineProperty(Qu,"__esModule",{value:!0});Qu.FilesApiRoutesGetSignedUrlRequest$=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Qu.filesApiRoutesGetSignedUrlRequestToJSON=Tfn;Qu.filesApiRoutesGetSignedUrlRequestFromJSON=Afn;var kU=Pfn(Te()),KUt=Ue(),Efn=ve();Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema=kU.object({file_id:kU.string(),expiry:kU.number().int().default(24)}).transform(t=>(0,KUt.remap)(t,{file_id:"fileId"}));Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema=kU.object({fileId:kU.string(),expiry:kU.number().int().default(24)}).transform(t=>(0,KUt.remap)(t,{fileId:"file_id"}));var WUt;(function(t){t.inboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(WUt||(Qu.FilesApiRoutesGetSignedUrlRequest$=WUt={}));function Tfn(t){return JSON.stringify(Qu.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function Afn(t){return(0,Efn.safeParse)(t,e=>Qu.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var XUt=v(tl=>{"use strict";var Ifn=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]}),Mfn=tl&&tl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YUt=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)&&Ifn(e,t,r);return Mfn(e,t),e};Object.defineProperty(tl,"__esModule",{value:!0});tl.FilesApiRoutesListFilesRequest$=tl.FilesApiRoutesListFilesRequest$outboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema=void 0;tl.filesApiRoutesListFilesRequestToJSON=jfn;tl.filesApiRoutesListFilesRequestFromJSON=Nfn;var el=YUt(Te()),ZUt=Ue(),Rfn=ve(),$U=YUt(Fn());tl.FilesApiRoutesListFilesRequest$inboundSchema=el.object({page:el.number().int().default(0),page_size:el.number().int().default(100),sample_type:el.nullable(el.array($U.SampleType$inboundSchema)).optional(),source:el.nullable(el.array($U.Source$inboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable($U.FilePurpose$inboundSchema).optional()}).transform(t=>(0,ZUt.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));tl.FilesApiRoutesListFilesRequest$outboundSchema=el.object({page:el.number().int().default(0),pageSize:el.number().int().default(100),sampleType:el.nullable(el.array($U.SampleType$outboundSchema)).optional(),source:el.nullable(el.array($U.Source$outboundSchema)).optional(),search:el.nullable(el.string()).optional(),purpose:el.nullable($U.FilePurpose$outboundSchema).optional()}).transform(t=>(0,ZUt.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var JUt;(function(t){t.inboundSchema=tl.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=tl.FilesApiRoutesListFilesRequest$outboundSchema})(JUt||(tl.FilesApiRoutesListFilesRequest$=JUt={}));function jfn(t){return JSON.stringify(tl.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function Nfn(t){return(0,Rfn.safeParse)(t,e=>tl.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var tzt=v(rl=>{"use strict";var Dfn=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]}),Lfn=rl&&rl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ffn=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)&&Dfn(e,t,r);return Lfn(e,t),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.FilesApiRoutesRetrieveFileRequest$=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;rl.filesApiRoutesRetrieveFileRequestToJSON=$fn;rl.filesApiRoutesRetrieveFileRequestFromJSON=Bfn;var cue=Ffn(Te()),ezt=Ue(),kfn=ve();rl.FilesApiRoutesRetrieveFileRequest$inboundSchema=cue.object({file_id:cue.string()}).transform(t=>(0,ezt.remap)(t,{file_id:"fileId"}));rl.FilesApiRoutesRetrieveFileRequest$outboundSchema=cue.object({fileId:cue.string()}).transform(t=>(0,ezt.remap)(t,{fileId:"file_id"}));var QUt;(function(t){t.inboundSchema=rl.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=rl.FilesApiRoutesRetrieveFileRequest$outboundSchema})(QUt||(rl.FilesApiRoutesRetrieveFileRequest$=QUt={}));function $fn(t){return JSON.stringify(rl.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Bfn(t){return(0,kfn.safeParse)(t,e=>rl.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var _De=v(mb=>{"use strict";var qfn=mb&&mb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=mb&&mb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zfn=mb&&mb.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qfn(e,t,r);return Ufn(e,t),e};Object.defineProperty(mb,"__esModule",{value:!0});mb.blobLikeSchema=void 0;mb.isBlobLike=rzt;var Hfn=zfn(Te());mb.blobLikeSchema=Hfn.custom(rzt,{message:"expected a Blob, File or Blob-like object",fatal:!0});function rzt(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 uzt=v(fo=>{"use strict";var Vfn=fo&&fo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wfn=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),izt=fo&&fo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vfn(e,t,r);return Wfn(e,t),e};Object.defineProperty(fo,"__esModule",{value:!0});fo.FilesApiRoutesUploadFileMultiPartBodyParams$=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=fo.FileT$=fo.FileT$outboundSchema=fo.FileT$inboundSchema=void 0;fo.fileToJSON=Gfn;fo.fileFromJSON=Jfn;fo.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=Yfn;fo.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=Zfn;var bc=izt(Te()),azt=ve(),Kfn=_De(),szt=izt(Fn());fo.FileT$inboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});fo.FileT$outboundSchema=bc.object({fileName:bc.string(),content:bc.union([bc.instanceof(ReadableStream),bc.instanceof(Blob),bc.instanceof(ArrayBuffer),bc.instanceof(Uint8Array)])});var nzt;(function(t){t.inboundSchema=fo.FileT$inboundSchema,t.outboundSchema=fo.FileT$outboundSchema})(nzt||(fo.FileT$=nzt={}));function Gfn(t){return JSON.stringify(fo.FileT$outboundSchema.parse(t))}function Jfn(t){return(0,azt.safeParse)(t,e=>fo.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$inboundSchema),purpose:szt.FilePurpose$inboundSchema.optional()});fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=bc.object({file:bc.lazy(()=>fo.FileT$outboundSchema).or(Kfn.blobLikeSchema),purpose:szt.FilePurpose$outboundSchema.optional()});var ozt;(function(t){t.inboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(ozt||(fo.FilesApiRoutesUploadFileMultiPartBodyParams$=ozt={}));function Yfn(t){return JSON.stringify(fo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function Zfn(t){return(0,azt.safeParse)(t,e=>fo.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var dzt=v(nl=>{"use strict";var Xfn=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]}),Qfn=nl&&nl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),epn=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)&&Xfn(e,t,r);return Qfn(e,t),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.JobsApiRoutesBatchCancelBatchJobRequest$=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;nl.jobsApiRoutesBatchCancelBatchJobRequestToJSON=rpn;nl.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=npn;var due=epn(Te()),czt=Ue(),tpn=ve();nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=due.object({job_id:due.string()}).transform(t=>(0,czt.remap)(t,{job_id:"jobId"}));nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=due.object({jobId:due.string()}).transform(t=>(0,czt.remap)(t,{jobId:"job_id"}));var lzt;(function(t){t.inboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(lzt||(nl.JobsApiRoutesBatchCancelBatchJobRequest$=lzt={}));function rpn(t){return JSON.stringify(nl.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function npn(t){return(0,tpn.safeParse)(t,e=>nl.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var mzt=v(ol=>{"use strict";var opn=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]}),ipn=ol&&ol.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),apn=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)&&opn(e,t,r);return ipn(e,t),e};Object.defineProperty(ol,"__esModule",{value:!0});ol.JobsApiRoutesBatchGetBatchJobRequest$=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;ol.jobsApiRoutesBatchGetBatchJobRequestToJSON=upn;ol.jobsApiRoutesBatchGetBatchJobRequestFromJSON=lpn;var fue=apn(Te()),pzt=Ue(),spn=ve();ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=fue.object({job_id:fue.string()}).transform(t=>(0,pzt.remap)(t,{job_id:"jobId"}));ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=fue.object({jobId:fue.string()}).transform(t=>(0,pzt.remap)(t,{jobId:"job_id"}));var fzt;(function(t){t.inboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(fzt||(ol.JobsApiRoutesBatchGetBatchJobRequest$=fzt={}));function upn(t){return JSON.stringify(ol.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function lpn(t){return(0,spn.safeParse)(t,e=>ol.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var _zt=v(il=>{"use strict";var cpn=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]}),dpn=il&&il.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gzt=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)&&cpn(e,t,r);return dpn(e,t),e};Object.defineProperty(il,"__esModule",{value:!0});il.JobsApiRoutesBatchGetBatchJobsRequest$=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;il.jobsApiRoutesBatchGetBatchJobsRequestToJSON=ppn;il.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=mpn;var Na=gzt(Te()),yzt=Ue(),fpn=ve(),bzt=gzt(Fn());il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Na.object({page:Na.number().int().default(0),page_size:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),created_after:Na.nullable(Na.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Na.boolean().default(!1),status:Na.nullable(bzt.BatchJobStatus$inboundSchema).optional()}).transform(t=>(0,yzt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe"}));il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Na.object({page:Na.number().int().default(0),pageSize:Na.number().int().default(100),model:Na.nullable(Na.string()).optional(),metadata:Na.nullable(Na.record(Na.any())).optional(),createdAfter:Na.nullable(Na.date().transform(t=>t.toISOString())).optional(),createdByMe:Na.boolean().default(!1),status:Na.nullable(bzt.BatchJobStatus$outboundSchema).optional()}).transform(t=>(0,yzt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me"}));var hzt;(function(t){t.inboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(hzt||(il.JobsApiRoutesBatchGetBatchJobsRequest$=hzt={}));function ppn(t){return JSON.stringify(il.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function mpn(t){return(0,fpn.safeParse)(t,e=>il.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var Szt=v(al=>{"use strict";var hpn=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]}),gpn=al&&al.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ypn=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)&&hpn(e,t,r);return gpn(e,t),e};Object.defineProperty(al,"__esModule",{value:!0});al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=_pn;al.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=vpn;var pue=ypn(Te()),wzt=Ue(),bpn=ve();al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=pue.object({model_id:pue.string()}).transform(t=>(0,wzt.remap)(t,{model_id:"modelId"}));al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=pue.object({modelId:pue.string()}).transform(t=>(0,wzt.remap)(t,{modelId:"model_id"}));var vzt;(function(t){t.inboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(vzt||(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=vzt={}));function _pn(t){return JSON.stringify(al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function vpn(t){return(0,bpn.safeParse)(t,e=>al.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var Ozt=v(sl=>{"use strict";var wpn=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]}),Spn=sl&&sl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xpn=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)&&wpn(e,t,r);return Spn(e,t),e};Object.defineProperty(sl,"__esModule",{value:!0});sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=Opn;sl.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=Ppn;var mue=xpn(Te()),Czt=Ue(),Cpn=ve();sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=mue.object({job_id:mue.string()}).transform(t=>(0,Czt.remap)(t,{job_id:"jobId"}));sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=mue.object({jobId:mue.string()}).transform(t=>(0,Czt.remap)(t,{jobId:"job_id"}));var xzt;(function(t){t.inboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(xzt||(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=xzt={}));function Opn(t){return JSON.stringify(sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function Ppn(t){return(0,Cpn.safeParse)(t,e=>sl.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}});var Azt=v(ul=>{"use strict";var Epn=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]}),Tpn=ul&&ul.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ezt=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)&&Epn(e,t,r);return Tpn(e,t),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=void 0;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=Ipn;ul.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=Mpn;var Tzt=Ezt(Te()),Apn=ve(),hue=Ezt(Fn());ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Tzt.union([hue.LegacyJobMetadataOut$inboundSchema,hue.JobOut$inboundSchema]);ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Tzt.union([hue.LegacyJobMetadataOut$outboundSchema,hue.JobOut$outboundSchema]);var Pzt;(function(t){t.inboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(Pzt||(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Pzt={}));function Ipn(t){return JSON.stringify(ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function Mpn(t){return(0,Apn.safeParse)(t,e=>ul.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var Rzt=v(ll=>{"use strict";var Rpn=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]}),jpn=ll&&ll.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Npn=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)&&Rpn(e,t,r);return jpn(e,t),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=Lpn;ll.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=Fpn;var gue=Npn(Te()),Mzt=Ue(),Dpn=ve();ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=gue.object({job_id:gue.string()}).transform(t=>(0,Mzt.remap)(t,{job_id:"jobId"}));ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=gue.object({jobId:gue.string()}).transform(t=>(0,Mzt.remap)(t,{jobId:"job_id"}));var Izt;(function(t){t.inboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(Izt||(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Izt={}));function Lpn(t){return JSON.stringify(ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function Fpn(t){return(0,Dpn.safeParse)(t,e=>ll.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}});var Lzt=v(po=>{"use strict";var kpn=po&&po.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$pn=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bpn=po&&po.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&kpn(e,t,r);return $pn(e,t),e};Object.defineProperty(po,"__esModule",{value:!0});po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=po.Status$=po.Status$outboundSchema=po.Status$inboundSchema=po.Status=void 0;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=Upn;po.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=zpn;var li=Bpn(Te()),Dzt=Ue(),qpn=ve();po.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};po.Status$inboundSchema=li.nativeEnum(po.Status);po.Status$outboundSchema=po.Status$inboundSchema;var jzt;(function(t){t.inboundSchema=po.Status$inboundSchema,t.outboundSchema=po.Status$outboundSchema})(jzt||(po.Status$=jzt={}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=li.object({page:li.number().int().default(0),page_size:li.number().int().default(100),model:li.nullable(li.string()).optional(),created_after:li.nullable(li.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:li.boolean().default(!1),status:li.nullable(po.Status$inboundSchema).optional(),wandb_project:li.nullable(li.string()).optional(),wandb_name:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Dzt.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=li.object({page:li.number().int().default(0),pageSize:li.number().int().default(100),model:li.nullable(li.string()).optional(),createdAfter:li.nullable(li.date().transform(t=>t.toISOString())).optional(),createdByMe:li.boolean().default(!1),status:li.nullable(po.Status$outboundSchema).optional(),wandbProject:li.nullable(li.string()).optional(),wandbName:li.nullable(li.string()).optional(),suffix:li.nullable(li.string()).optional()}).transform(t=>(0,Dzt.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var Nzt;(function(t){t.inboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(Nzt||(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Nzt={}));function Upn(t){return JSON.stringify(po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function zpn(t){return(0,qpn.safeParse)(t,e=>po.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var $zt=v(cl=>{"use strict";var Hpn=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]}),Vpn=cl&&cl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wpn=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)&&Hpn(e,t,r);return Vpn(e,t),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=Gpn;cl.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=Jpn;var yue=Wpn(Te()),kzt=Ue(),Kpn=ve();cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=yue.object({job_id:yue.string()}).transform(t=>(0,kzt.remap)(t,{job_id:"jobId"}));cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=yue.object({jobId:yue.string()}).transform(t=>(0,kzt.remap)(t,{jobId:"job_id"}));var Fzt;(function(t){t.inboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(Fzt||(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Fzt={}));function Gpn(t){return JSON.stringify(cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function Jpn(t){return(0,Kpn.safeParse)(t,e=>cl.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}});var Uzt=v(dl=>{"use strict";var Ypn=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]}),Zpn=dl&&dl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xpn=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)&&Ypn(e,t,r);return Zpn(e,t),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=emn;dl.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=tmn;var bue=Xpn(Te()),qzt=Ue(),Qpn=ve();dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=bue.object({model_id:bue.string()}).transform(t=>(0,qzt.remap)(t,{model_id:"modelId"}));dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=bue.object({modelId:bue.string()}).transform(t=>(0,qzt.remap)(t,{modelId:"model_id"}));var Bzt;(function(t){t.inboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(Bzt||(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Bzt={}));function emn(t){return JSON.stringify(dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function tmn(t){return(0,Qpn.safeParse)(t,e=>dl.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var Kzt=v(fl=>{"use strict";var rmn=fl&&fl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nmn=fl&&fl.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hzt=fl&&fl.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&rmn(e,t,r);return nmn(e,t),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=imn;fl.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=amn;var _ue=Hzt(Te()),Vzt=Ue(),omn=ve(),Wzt=Hzt(Fn());fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=_ue.object({model_id:_ue.string(),UpdateFTModelIn:Wzt.UpdateFTModelIn$inboundSchema}).transform(t=>(0,Vzt.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=_ue.object({modelId:_ue.string(),updateFTModelIn:Wzt.UpdateFTModelIn$outboundSchema}).transform(t=>(0,Vzt.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var zzt;(function(t){t.inboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(zzt||(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=zzt={}));function imn(t){return JSON.stringify(fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function amn(t){return(0,omn.safeParse)(t,e=>fl.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}});var Qzt=v(Zo=>{"use strict";var smn=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]}),umn=Zo&&Zo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yzt=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)&&smn(e,t,r);return umn(e,t),e};Object.defineProperty(Zo,"__esModule",{value:!0});Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Zo.retrieveModelV1ModelsModelIdGetRequestToJSON=lmn;Zo.retrieveModelV1ModelsModelIdGetRequestFromJSON=cmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=dmn;Zo.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=fmn;var nm=Yzt(Te()),Zzt=Ue(),Xzt=ve(),vue=Yzt(Fn());Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=nm.object({model_id:nm.string()}).transform(t=>(0,Zzt.remap)(t,{model_id:"modelId"}));Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=nm.object({modelId:nm.string()}).transform(t=>(0,Zzt.remap)(t,{modelId:"model_id"}));var Gzt;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(Gzt||(Zo.RetrieveModelV1ModelsModelIdGetRequest$=Gzt={}));function lmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function cmn(t){return(0,Xzt.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=nm.union([vue.BaseModelCard$inboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),vue.FTModelCard$inboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=nm.union([vue.BaseModelCard$outboundSchema.and(nm.object({type:nm.literal("base")}).transform(t=>({type:t.type}))),vue.FTModelCard$outboundSchema.and(nm.object({type:nm.literal("fine-tuned")}).transform(t=>({type:t.type})))]);var Jzt;(function(t){t.inboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(Jzt||(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Jzt={}));function dmn(t){return JSON.stringify(Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function fmn(t){return(0,Xzt.safeParse)(t,e=>Zo.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var pl=v(ga=>{"use strict";var pmn=ga&&ga.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kl=ga&&ga.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&pmn(e,t,r)};Object.defineProperty(ga,"__esModule",{value:!0});kl($Ut(),ga);kl(UUt(),ga);kl(VUt(),ga);kl(GUt(),ga);kl(XUt(),ga);kl(tzt(),ga);kl(uzt(),ga);kl(dzt(),ga);kl(mzt(),ga);kl(_zt(),ga);kl(Szt(),ga);kl(Ozt(),ga);kl(Azt(),ga);kl(Rzt(),ga);kl(Lzt(),ga);kl($zt(),ga);kl(Uzt(),ga);kl(Kzt(),ga);kl(Qzt(),ga)});var t2t=v(OP=>{"use strict";var mmn=OP&&OP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hmn=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vDe=OP&&OP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&mmn(e,t,r);return hmn(e,t),e};Object.defineProperty(OP,"__esModule",{value:!0});OP.batchJobsCancel=Smn;var gmn=ii(),wue=vDe(ai()),ymn=Ue(),bmn=ve(),e2t=si(),_mn=To(),vmn=vDe(Fn()),wmn=vDe(pl());async function Smn(t,e,r){let n=(0,bmn.safeParse)(e,y=>wmn.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,gmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,_mn.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,ymn.compactMap)({Accept:"application/json"})),l=await(0,e2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,e2t.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 wue.match(wue.json(200,vmn.BatchJobOut$inboundSchema),wue.fail("4XX"),wue.fail("5XX"))(b);return g.ok,g}});var i2t=v(PP=>{"use strict";var xmn=PP&&PP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cmn=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o2t=PP&&PP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&xmn(e,t,r);return Cmn(e,t),e};Object.defineProperty(PP,"__esModule",{value:!0});PP.batchJobsCreate=Amn;var Omn=ii(),Sue=o2t(ai()),Pmn=Ue(),Emn=ve(),r2t=si(),Tmn=To(),n2t=o2t(Fn());async function Amn(t,e,r){let n=(0,Emn.safeParse)(e,g=>n2t.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Omn.encodeJSON)("body",o,{explode:!0}),a=(0,Tmn.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,Pmn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,r2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,r2t.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 Sue.match(Sue.json(200,n2t.BatchJobOut$inboundSchema),Sue.fail("4XX"),Sue.fail("5XX"))(h);return b.ok,b}});var s2t=v(EP=>{"use strict";var Imn=EP&&EP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wDe=EP&&EP.__importStar||function(t){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(EP,"__esModule",{value:!0});EP.batchJobsGet=kmn;var Rmn=ii(),xue=wDe(ai()),jmn=Ue(),Nmn=ve(),a2t=si(),Dmn=To(),Lmn=wDe(Fn()),Fmn=wDe(pl());async function kmn(t,e,r){let n=(0,Nmn.safeParse)(e,y=>Fmn.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Rmn.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Dmn.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,jmn.compactMap)({Accept:"application/json"})),l=await(0,a2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,a2t.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 xue.match(xue.json(200,Lmn.BatchJobOut$inboundSchema),xue.fail("4XX"),xue.fail("5XX"))(b);return g.ok,g}});var l2t=v(TP=>{"use strict";var $mn=TP&&TP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SDe=TP&&TP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$mn(e,t,r);return Bmn(e,t),e};Object.defineProperty(TP,"__esModule",{value:!0});TP.batchJobsList=Kmn;var qmn=ii(),Cue=SDe(ai()),Umn=Ue(),zmn=ve(),u2t=si(),Hmn=To(),Vmn=SDe(Fn()),Wmn=SDe(pl());async function Kmn(t,e,r){let n=(0,zmn.safeParse)(e,y=>Wmn.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,Hmn.pathToFunc)("/v1/batch/jobs")(),s=(0,qmn.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,Umn.compactMap)({Accept:"application/json"})),l=await(0,u2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,u2t.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 Cue.match(Cue.json(200,Vmn.BatchJobsOut$inboundSchema),Cue.fail("4XX"),Cue.fail("5XX"))(b);return g.ok,g}});var c2t=v(Pue=>{"use strict";Object.defineProperty(Pue,"__esModule",{value:!0});Pue.MistralJobs=void 0;var Gmn=t2t(),Jmn=i2t(),Ymn=s2t(),Zmn=l2t(),Xmn=ah(),Oue=Ig(),xDe=class extends Xmn.ClientSDK{async list(e,r){return(0,Oue.unwrapAsync)((0,Zmn.batchJobsList)(this,e,r))}async create(e,r){return(0,Oue.unwrapAsync)((0,Jmn.batchJobsCreate)(this,e,r))}async get(e,r){return(0,Oue.unwrapAsync)((0,Ymn.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,Oue.unwrapAsync)((0,Gmn.batchJobsCancel)(this,e,r))}};Pue.MistralJobs=xDe});var d2t=v(Eue=>{"use strict";Object.defineProperty(Eue,"__esModule",{value:!0});Eue.Batch=void 0;var Qmn=ah(),ehn=c2t(),CDe=class extends Qmn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new ehn.MistralJobs(this._options))}};Eue.Batch=CDe});var m2t=v(AP=>{"use strict";var thn=AP&&AP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rhn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ODe=AP&&AP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&thn(e,t,r);return rhn(e,t),e};Object.defineProperty(AP,"__esModule",{value:!0});AP.chatComplete=uhn;var nhn=ii(),eW=ODe(ai()),ohn=Ue(),ihn=ve(),f2t=si(),ahn=To(),p2t=ODe(Fn()),shn=ODe(uh());async function uhn(t,e,r){let n=(0,ihn.safeParse)(e,y=>p2t.ChatCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,nhn.encodeJSON)("body",o,{explode:!0}),a=(0,ahn.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,ohn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,f2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,f2t.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 eW.match(eW.json(200,p2t.ChatCompletionResponse$inboundSchema),eW.jsonErr(422,shn.HTTPValidationError$inboundSchema),eW.fail("4XX"),eW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var y2t=v(IP=>{"use strict";var lhn=IP&&IP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),chn=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tue=IP&&IP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lhn(e,t,r);return chn(e,t),e};Object.defineProperty(IP,"__esModule",{value:!0});IP.chatStream=bhn;var dhn=Tue(Te()),fhn=ii(),phn=U5(),tW=Tue(ai()),mhn=Ue(),hhn=ve(),h2t=si(),ghn=To(),g2t=Tue(Fn()),yhn=Tue(uh());async function bhn(t,e,r){let n=(0,hhn.safeParse)(e,y=>g2t.ChatCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,fhn.encodeJSON)("body",o,{explode:!0}),a=(0,ghn.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,mhn.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,h2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,h2t.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 tW.match(tW.sse(200,dhn.instanceof(ReadableStream).transform(y=>new phn.EventStream({stream:y,decoder(S){return g2t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),tW.jsonErr(422,yhn.HTTPValidationError$inboundSchema),tW.fail("4XX"),tW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var Aue=v(Kx=>{"use strict";Object.defineProperty(Kx,"__esModule",{value:!0});Kx.getDefaultOptions=Kx.defaultOptions=Kx.ignoreOverride=void 0;Kx.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");Kx.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 _hn=t=>typeof t=="string"?{...Kx.defaultOptions,name:t}:{...Kx.defaultOptions,...t};Kx.getDefaultOptions=_hn});var PDe=v(Iue=>{"use strict";Object.defineProperty(Iue,"__esModule",{value:!0});Iue.getRefs=void 0;var vhn=Aue(),whn=t=>{let e=(0,vhn.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}]))}};Iue.getRefs=whn});var KI=v(BU=>{"use strict";Object.defineProperty(BU,"__esModule",{value:!0});BU.setResponseValueAndErrors=BU.addErrorMessage=void 0;function b2t(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}BU.addErrorMessage=b2t;function Shn(t,e,r,n,o){t[e]=r,b2t(t,e,n,o)}BU.setResponseValueAndErrors=Shn});var EDe=v(Mue=>{"use strict";Object.defineProperty(Mue,"__esModule",{value:!0});Mue.parseAnyDef=void 0;function xhn(){return{}}Mue.parseAnyDef=xhn});var TDe=v(jue=>{"use strict";Object.defineProperty(jue,"__esModule",{value:!0});jue.parseArrayDef=void 0;var Chn=Te(),Rue=KI(),Ohn=ml();function Phn(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Chn.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,Ohn.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,Rue.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,Rue.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,Rue.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,Rue.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}jue.parseArrayDef=Phn});var ADe=v(Nue=>{"use strict";Object.defineProperty(Nue,"__esModule",{value:!0});Nue.parseBigintDef=void 0;var SD=KI();function Ehn(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,SD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,SD.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,SD.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,SD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,SD.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,SD.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,SD.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}Nue.parseBigintDef=Ehn});var IDe=v(Due=>{"use strict";Object.defineProperty(Due,"__esModule",{value:!0});Due.parseBooleanDef=void 0;function Thn(){return{type:"boolean"}}Due.parseBooleanDef=Thn});var Fue=v(Lue=>{"use strict";Object.defineProperty(Lue,"__esModule",{value:!0});Lue.parseBrandedDef=void 0;var Ahn=ml();function Ihn(t,e){return(0,Ahn.parseDef)(t.type._def,e)}Lue.parseBrandedDef=Ihn});var MDe=v(kue=>{"use strict";Object.defineProperty(kue,"__esModule",{value:!0});kue.parseCatchDef=void 0;var Mhn=ml(),Rhn=(t,e)=>(0,Mhn.parseDef)(t.innerType._def,e);kue.parseCatchDef=Rhn});var RDe=v($ue=>{"use strict";Object.defineProperty($ue,"__esModule",{value:!0});$ue.parseDateDef=void 0;var _2t=KI();function v2t(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>v2t(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 jhn(t,e)}}$ue.parseDateDef=v2t;var jhn=(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,_2t.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,_2t.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var jDe=v(Bue=>{"use strict";Object.defineProperty(Bue,"__esModule",{value:!0});Bue.parseDefaultDef=void 0;var Nhn=ml();function Dhn(t,e){return{...(0,Nhn.parseDef)(t.innerType._def,e),default:t.defaultValue()}}Bue.parseDefaultDef=Dhn});var NDe=v(que=>{"use strict";Object.defineProperty(que,"__esModule",{value:!0});que.parseEffectsDef=void 0;var Lhn=ml();function Fhn(t,e){return e.effectStrategy==="input"?(0,Lhn.parseDef)(t.schema._def,e):{}}que.parseEffectsDef=Fhn});var DDe=v(Uue=>{"use strict";Object.defineProperty(Uue,"__esModule",{value:!0});Uue.parseEnumDef=void 0;function khn(t){return{type:"string",enum:Array.from(t.values)}}Uue.parseEnumDef=khn});var LDe=v(zue=>{"use strict";Object.defineProperty(zue,"__esModule",{value:!0});zue.parseIntersectionDef=void 0;var w2t=ml(),$hn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Bhn(t,e){let r=[(0,w2t.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,w2t.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($hn(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}zue.parseIntersectionDef=Bhn});var FDe=v(Hue=>{"use strict";Object.defineProperty(Hue,"__esModule",{value:!0});Hue.parseLiteralDef=void 0;function qhn(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}}Hue.parseLiteralDef=qhn});var Vue=v(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});ad.parseStringDef=ad.zodPatterns=void 0;var xD=KI(),kDe;ad.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:()=>(kDe===void 0&&(kDe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),kDe),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 Uhn(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,xD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,xD.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":hb(r,"email",n.message,e);break;case"format:idn-email":hb(r,"idn-email",n.message,e);break;case"pattern:zod":tp(r,ad.zodPatterns.email,n.message,e);break}break;case"url":hb(r,"uri",n.message,e);break;case"uuid":hb(r,"uuid",n.message,e);break;case"regex":tp(r,n.regex,n.message,e);break;case"cuid":tp(r,ad.zodPatterns.cuid,n.message,e);break;case"cuid2":tp(r,ad.zodPatterns.cuid2,n.message,e);break;case"startsWith":tp(r,RegExp(`^${$De(n.value,e)}`),n.message,e);break;case"endsWith":tp(r,RegExp(`${$De(n.value,e)}$`),n.message,e);break;case"datetime":hb(r,"date-time",n.message,e);break;case"date":hb(r,"date",n.message,e);break;case"time":hb(r,"time",n.message,e);break;case"duration":hb(r,"duration",n.message,e);break;case"length":(0,xD.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,xD.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{tp(r,RegExp($De(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&hb(r,"ipv4",n.message,e),n.version!=="v4"&&hb(r,"ipv6",n.message,e);break}case"base64url":tp(r,ad.zodPatterns.base64url,n.message,e);break;case"jwt":tp(r,ad.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&tp(r,ad.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&tp(r,ad.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":tp(r,ad.zodPatterns.emoji(),n.message,e);break;case"ulid":{tp(r,ad.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{hb(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,xD.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{tp(r,ad.zodPatterns.base64,n.message,e);break}}break}case"nanoid":tp(r,ad.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}ad.parseStringDef=Uhn;function $De(t,e){return e.patternStrategy==="escape"?Hhn(t):t}var zhn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Hhn(t){let e="";for(let r=0;r<t.length;r++)zhn.has(t[r])||(e+="\\"),e+=t[r];return e}function hb(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,xD.setResponseValueAndErrors)(t,"format",e,r,n)}function tp(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:S2t(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,xD.setResponseValueAndErrors)(t,"pattern",S2t(e,n),r,n)}function S2t(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 Kue=v(Wue=>{"use strict";Object.defineProperty(Wue,"__esModule",{value:!0});Wue.parseRecordDef=void 0;var rW=Te(),x2t=ml(),Vhn=Vue(),Whn=Fue();function Khn(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===rW.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,x2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,x2t.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,Vhn.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===rW.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===rW.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,Whn.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}Wue.parseRecordDef=Khn});var BDe=v(Gue=>{"use strict";Object.defineProperty(Gue,"__esModule",{value:!0});Gue.parseMapDef=void 0;var C2t=ml(),Ghn=Kue();function Jhn(t,e){if(e.mapStrategy==="record")return(0,Ghn.parseRecordDef)(t,e);let r=(0,C2t.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,C2t.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}}}Gue.parseMapDef=Jhn});var qDe=v(Jue=>{"use strict";Object.defineProperty(Jue,"__esModule",{value:!0});Jue.parseNativeEnumDef=void 0;function Yhn(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}}Jue.parseNativeEnumDef=Yhn});var UDe=v(Yue=>{"use strict";Object.defineProperty(Yue,"__esModule",{value:!0});Yue.parseNeverDef=void 0;function Zhn(){return{not:{}}}Yue.parseNeverDef=Zhn});var zDe=v(Zue=>{"use strict";Object.defineProperty(Zue,"__esModule",{value:!0});Zue.parseNullDef=void 0;function Xhn(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}Zue.parseNullDef=Xhn});var Xue=v(GI=>{"use strict";Object.defineProperty(GI,"__esModule",{value:!0});GI.parseUnionDef=GI.primitiveMappings=void 0;var Qhn=ml();GI.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function egn(t,e){if(e.target==="openApi3")return O2t(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in GI.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=GI.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 O2t(t,e)}GI.parseUnionDef=egn;var O2t=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,Qhn.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 HDe=v(Que=>{"use strict";Object.defineProperty(Que,"__esModule",{value:!0});Que.parseNullableDef=void 0;var P2t=ml(),E2t=Xue();function tgn(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:E2t.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[E2t.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,P2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,P2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}Que.parseNullableDef=tgn});var VDe=v(ele=>{"use strict";Object.defineProperty(ele,"__esModule",{value:!0});ele.parseNumberDef=void 0;var JI=KI();function rgn(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,JI.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,JI.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,JI.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,JI.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,JI.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}ele.parseNumberDef=rgn});var KDe=v(tle=>{"use strict";Object.defineProperty(tle,"__esModule",{value:!0});tle.parseObjectDef=void 0;var ngn=Te(),WDe=ml();function ogn(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,WDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,WDe.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function ign(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 ngn.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,WDe.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:ogn(t,e)};return n.required.length||delete n.required,n}tle.parseObjectDef=ign});var GDe=v(rle=>{"use strict";Object.defineProperty(rle,"__esModule",{value:!0});rle.parseOptionalDef=void 0;var T2t=ml(),agn=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,T2t.parseDef)(t.innerType._def,e);let r=(0,T2t.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};rle.parseOptionalDef=agn});var JDe=v(ole=>{"use strict";Object.defineProperty(ole,"__esModule",{value:!0});ole.parsePipelineDef=void 0;var nle=ml(),sgn=(t,e)=>{if(e.pipeStrategy==="input")return(0,nle.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,nle.parseDef)(t.out._def,e);let r=(0,nle.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,nle.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};ole.parsePipelineDef=sgn});var YDe=v(ile=>{"use strict";Object.defineProperty(ile,"__esModule",{value:!0});ile.parsePromiseDef=void 0;var ugn=ml();function lgn(t,e){return(0,ugn.parseDef)(t.type._def,e)}ile.parsePromiseDef=lgn});var ZDe=v(ale=>{"use strict";Object.defineProperty(ale,"__esModule",{value:!0});ale.parseSetDef=void 0;var A2t=KI(),cgn=ml();function dgn(t,e){let n={type:"array",uniqueItems:!0,items:(0,cgn.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,A2t.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,A2t.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}ale.parseSetDef=dgn});var QDe=v(sle=>{"use strict";Object.defineProperty(sle,"__esModule",{value:!0});sle.parseTupleDef=void 0;var XDe=ml();function fgn(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,XDe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,XDe.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,XDe.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}sle.parseTupleDef=fgn});var eLe=v(ule=>{"use strict";Object.defineProperty(ule,"__esModule",{value:!0});ule.parseUndefinedDef=void 0;function pgn(){return{not:{}}}ule.parseUndefinedDef=pgn});var tLe=v(lle=>{"use strict";Object.defineProperty(lle,"__esModule",{value:!0});lle.parseUnknownDef=void 0;function mgn(){return{}}lle.parseUnknownDef=mgn});var rLe=v(cle=>{"use strict";Object.defineProperty(cle,"__esModule",{value:!0});cle.parseReadonlyDef=void 0;var hgn=ml(),ggn=(t,e)=>(0,hgn.parseDef)(t.innerType._def,e);cle.parseReadonlyDef=ggn});var ml=v(dle=>{"use strict";Object.defineProperty(dle,"__esModule",{value:!0});dle.parseDef=void 0;var kn=Te(),ygn=EDe(),bgn=TDe(),_gn=ADe(),vgn=IDe(),wgn=Fue(),Sgn=MDe(),xgn=RDe(),Cgn=jDe(),Ogn=NDe(),Pgn=DDe(),Egn=LDe(),Tgn=FDe(),Agn=BDe(),Ign=qDe(),Mgn=UDe(),Rgn=zDe(),jgn=HDe(),Ngn=VDe(),Dgn=KDe(),Lgn=GDe(),Fgn=JDe(),kgn=YDe(),$gn=Kue(),Bgn=ZDe(),qgn=Vue(),Ugn=QDe(),zgn=eLe(),Hgn=Xue(),Vgn=tLe(),Wgn=rLe(),Kgn=Aue();function I2t(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Kgn.ignoreOverride)return a}if(n&&!r){let a=Ggn(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=Ygn(t,t.typeName,e);return i&&Zgn(t,e,i),o.jsonSchema=i,i}dle.parseDef=I2t;var Ggn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Jgn(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}},Jgn=(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("/")},Ygn=(t,e,r)=>{switch(e){case kn.ZodFirstPartyTypeKind.ZodString:return(0,qgn.parseStringDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNumber:return(0,Ngn.parseNumberDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodObject:return(0,Dgn.parseObjectDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBigInt:return(0,_gn.parseBigintDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBoolean:return(0,vgn.parseBooleanDef)();case kn.ZodFirstPartyTypeKind.ZodDate:return(0,xgn.parseDateDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUndefined:return(0,zgn.parseUndefinedDef)();case kn.ZodFirstPartyTypeKind.ZodNull:return(0,Rgn.parseNullDef)(r);case kn.ZodFirstPartyTypeKind.ZodArray:return(0,bgn.parseArrayDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodUnion:case kn.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,Hgn.parseUnionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodIntersection:return(0,Egn.parseIntersectionDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodTuple:return(0,Ugn.parseTupleDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodRecord:return(0,$gn.parseRecordDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLiteral:return(0,Tgn.parseLiteralDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodEnum:return(0,Pgn.parseEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,Ign.parseNativeEnumDef)(t);case kn.ZodFirstPartyTypeKind.ZodNullable:return(0,jgn.parseNullableDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodOptional:return(0,Lgn.parseOptionalDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodMap:return(0,Agn.parseMapDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodSet:return(0,Bgn.parseSetDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodLazy:return I2t(t.getter()._def,r);case kn.ZodFirstPartyTypeKind.ZodPromise:return(0,kgn.parsePromiseDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodNaN:case kn.ZodFirstPartyTypeKind.ZodNever:return(0,Mgn.parseNeverDef)();case kn.ZodFirstPartyTypeKind.ZodEffects:return(0,Ogn.parseEffectsDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodAny:return(0,ygn.parseAnyDef)();case kn.ZodFirstPartyTypeKind.ZodUnknown:return(0,Vgn.parseUnknownDef)();case kn.ZodFirstPartyTypeKind.ZodDefault:return(0,Cgn.parseDefaultDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodBranded:return(0,wgn.parseBrandedDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodReadonly:return(0,Wgn.parseReadonlyDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodCatch:return(0,Sgn.parseCatchDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodPipeline:return(0,Fgn.parsePipelineDef)(t,r);case kn.ZodFirstPartyTypeKind.ZodFunction:case kn.ZodFirstPartyTypeKind.ZodVoid:case kn.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},Zgn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var nLe=v(fle=>{"use strict";Object.defineProperty(fle,"__esModule",{value:!0});fle.zodToJsonSchema=void 0;var M2t=ml(),Xgn=PDe(),Qgn=(t,e)=>{let r=(0,Xgn.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,M2t.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,M2t.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};fle.zodToJsonSchema=Qgn});var R2t=v(Qr=>{"use strict";var eyn=Qr&&Qr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Qr&&Qr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eyn(e,t,r)};Object.defineProperty(Qr,"__esModule",{value:!0});Gn(Aue(),Qr);Gn(PDe(),Qr);Gn(KI(),Qr);Gn(ml(),Qr);Gn(EDe(),Qr);Gn(TDe(),Qr);Gn(ADe(),Qr);Gn(IDe(),Qr);Gn(Fue(),Qr);Gn(MDe(),Qr);Gn(RDe(),Qr);Gn(jDe(),Qr);Gn(NDe(),Qr);Gn(DDe(),Qr);Gn(LDe(),Qr);Gn(FDe(),Qr);Gn(BDe(),Qr);Gn(qDe(),Qr);Gn(UDe(),Qr);Gn(zDe(),Qr);Gn(HDe(),Qr);Gn(VDe(),Qr);Gn(KDe(),Qr);Gn(GDe(),Qr);Gn(JDe(),Qr);Gn(YDe(),Qr);Gn(rLe(),Qr);Gn(Kue(),Qr);Gn(ZDe(),Qr);Gn(Vue(),Qr);Gn(QDe(),Qr);Gn(eLe(),Qr);Gn(Xue(),Qr);Gn(tLe(),Qr);Gn(nLe(),Qr);var tyn=nLe();Qr.default=tyn.zodToJsonSchema});var N2t=v(nW=>{"use strict";Object.defineProperty(nW,"__esModule",{value:!0});nW.transformToChatCompletionRequest=nyn;nW.convertToParsedChatCompletionResponse=oyn;nW.responseFormatFromZodObject=j2t;var ryn=R2t();function nyn(t){let{responseFormat:e,...r}=t,n=j2t(e);return{...r,responseFormat:n}}function oyn(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 j2t(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,ryn.zodToJsonSchema)(t),strict:!0}}}});var F2t=v(mle=>{"use strict";Object.defineProperty(mle,"__esModule",{value:!0});mle.Chat=void 0;var D2t=m2t(),L2t=y2t(),iyn=ah(),ple=Ig(),oLe=N2t(),iLe=class extends iyn.ClientSDK{async parse(e,r){let n=(0,oLe.transformToChatCompletionRequest)(e),o=await(0,ple.unwrapAsync)((0,D2t.chatComplete)(this,n,r));return(0,oLe.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,oLe.transformToChatCompletionRequest)(e);return(0,ple.unwrapAsync)((0,L2t.chatStream)(this,n,r))}async complete(e,r){return(0,ple.unwrapAsync)((0,D2t.chatComplete)(this,e,r))}async stream(e,r){return(0,ple.unwrapAsync)((0,L2t.chatStream)(this,e,r))}};mle.Chat=iLe});var B2t=v(MP=>{"use strict";var ayn=MP&&MP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aLe=MP&&MP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ayn(e,t,r);return syn(e,t),e};Object.defineProperty(MP,"__esModule",{value:!0});MP.classifiersModerate=pyn;var uyn=ii(),oW=aLe(ai()),lyn=Ue(),cyn=ve(),k2t=si(),dyn=To(),$2t=aLe(Fn()),fyn=aLe(uh());async function pyn(t,e,r){let n=(0,cyn.safeParse)(e,y=>$2t.ClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,uyn.encodeJSON)("body",o,{explode:!0}),a=(0,dyn.pathToFunc)("/v1/moderations")(),s=new Headers((0,lyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,k2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,k2t.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 oW.match(oW.json(200,$2t.ClassificationResponse$inboundSchema),oW.jsonErr(422,fyn.HTTPValidationError$inboundSchema),oW.fail("4XX"),oW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var z2t=v(RP=>{"use strict";var myn=RP&&RP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hyn=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sLe=RP&&RP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&myn(e,t,r);return hyn(e,t),e};Object.defineProperty(RP,"__esModule",{value:!0});RP.classifiersModerateChat=wyn;var gyn=ii(),iW=sLe(ai()),yyn=Ue(),byn=ve(),q2t=si(),_yn=To(),U2t=sLe(Fn()),vyn=sLe(uh());async function wyn(t,e,r){let n=(0,byn.safeParse)(e,y=>U2t.ChatClassificationRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,gyn.encodeJSON)("body",o,{explode:!0}),a=(0,_yn.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,yyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,q2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,q2t.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 iW.match(iW.json(200,U2t.ClassificationResponse$inboundSchema),iW.jsonErr(422,vyn.HTTPValidationError$inboundSchema),iW.fail("4XX"),iW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var V2t=v(hle=>{"use strict";Object.defineProperty(hle,"__esModule",{value:!0});hle.Classifiers=void 0;var Syn=B2t(),xyn=z2t(),Cyn=ah(),H2t=Ig(),uLe=class extends Cyn.ClientSDK{async moderate(e,r){return(0,H2t.unwrapAsync)((0,Syn.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,H2t.unwrapAsync)((0,xyn.classifiersModerateChat)(this,e,r))}};hle.Classifiers=uLe});var G2t=v(jP=>{"use strict";var Oyn=jP&&jP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pyn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lLe=jP&&jP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Oyn(e,t,r);return Pyn(e,t),e};Object.defineProperty(jP,"__esModule",{value:!0});jP.embeddingsCreate=Ryn;var Eyn=ii(),aW=lLe(ai()),Tyn=Ue(),Ayn=ve(),W2t=si(),Iyn=To(),K2t=lLe(Fn()),Myn=lLe(uh());async function Ryn(t,e,r){let n=(0,Ayn.safeParse)(e,y=>K2t.EmbeddingRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Eyn.encodeJSON)("body",o,{explode:!0}),a=(0,Iyn.pathToFunc)("/v1/embeddings")(),s=new Headers((0,Tyn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,W2t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,W2t.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 aW.match(aW.json(200,K2t.EmbeddingResponse$inboundSchema),aW.jsonErr(422,Myn.HTTPValidationError$inboundSchema),aW.fail("4XX"),aW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var J2t=v(gle=>{"use strict";Object.defineProperty(gle,"__esModule",{value:!0});gle.Embeddings=void 0;var jyn=G2t(),Nyn=ah(),Dyn=Ig(),cLe=class extends Nyn.ClientSDK{async create(e,r){return(0,Dyn.unwrapAsync)((0,jyn.embeddingsCreate)(this,e,r))}};gle.Embeddings=cLe});var Z2t=v(NP=>{"use strict";var Lyn=NP&&NP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fyn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dLe=NP&&NP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Lyn(e,t,r);return Fyn(e,t),e};Object.defineProperty(NP,"__esModule",{value:!0});NP.filesDelete=Hyn;var kyn=ii(),yle=dLe(ai()),$yn=Ue(),Byn=ve(),Y2t=si(),qyn=To(),Uyn=dLe(Fn()),zyn=dLe(pl());async function Hyn(t,e,r){let n=(0,Byn.safeParse)(e,y=>zyn.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,kyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,qyn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,$yn.compactMap)({Accept:"application/json"})),l=await(0,Y2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Y2t.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 yle.match(yle.json(200,Uyn.DeleteFileOut$inboundSchema),yle.fail("4XX"),yle.fail("5XX"))(b);return g.ok,g}});var Q2t=v(DP=>{"use strict";var Vyn=DP&&DP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wyn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fLe=DP&&DP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vyn(e,t,r);return Wyn(e,t),e};Object.defineProperty(DP,"__esModule",{value:!0});DP.filesDownload=Qyn;var Kyn=fLe(Te()),Gyn=ii(),ble=fLe(ai()),Jyn=Ue(),Yyn=ve(),X2t=si(),Zyn=To(),Xyn=fLe(pl());async function Qyn(t,e,r){let n=(0,Yyn.safeParse)(e,y=>Xyn.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,Gyn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Zyn.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,Jyn.compactMap)({Accept:"application/octet-stream"})),l=await(0,X2t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,X2t.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 ble.match(ble.stream(200,Kyn.instanceof(ReadableStream)),ble.fail("4XX"),ble.fail("5XX"))(b);return g.ok,g}});var r4t=v(LP=>{"use strict";var ebn=LP&&LP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pLe=LP&&LP.__importStar||function(t){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(LP,"__esModule",{value:!0});LP.filesGetSignedUrl=sbn;var e4t=ii(),_le=pLe(ai()),rbn=Ue(),nbn=ve(),t4t=si(),obn=To(),ibn=pLe(Fn()),abn=pLe(pl());async function sbn(t,e,r){let n=(0,nbn.safeParse)(e,S=>abn.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,e4t.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,obn.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,e4t.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,rbn.compactMap)({Accept:"application/json"})),c=await(0,t4t.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,t4t.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 _le.match(_le.json(200,ibn.FileSignedURL$inboundSchema),_le.fail("4XX"),_le.fail("5XX"))(g);return y.ok,y}});var o4t=v(FP=>{"use strict";var ubn=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]}),lbn=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mLe=FP&&FP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ubn(e,t,r);return lbn(e,t),e};Object.defineProperty(FP,"__esModule",{value:!0});FP.filesList=gbn;var cbn=ii(),vle=mLe(ai()),dbn=Ue(),fbn=ve(),n4t=si(),pbn=To(),mbn=mLe(Fn()),hbn=mLe(pl());async function gbn(t,e,r){let n=(0,fbn.safeParse)(e,y=>hbn.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,pbn.pathToFunc)("/v1/files")(),s=(0,cbn.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,dbn.compactMap)({Accept:"application/json"})),l=await(0,n4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,n4t.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 vle.match(vle.json(200,mbn.ListFilesOut$inboundSchema),vle.fail("4XX"),vle.fail("5XX"))(b);return g.ok,g}});var a4t=v(kP=>{"use strict";var ybn=kP&&kP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bbn=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hLe=kP&&kP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ybn(e,t,r);return bbn(e,t),e};Object.defineProperty(kP,"__esModule",{value:!0});kP.filesRetrieve=Obn;var _bn=ii(),wle=hLe(ai()),vbn=Ue(),wbn=ve(),i4t=si(),Sbn=To(),xbn=hLe(Fn()),Cbn=hLe(pl());async function Obn(t,e,r){let n=(0,wbn.safeParse)(e,y=>Cbn.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={file_id:(0,_bn.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,Sbn.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,vbn.compactMap)({Accept:"application/json"})),l=await(0,i4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,i4t.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 wle.match(wle.json(200,xbn.RetrieveFileOut$inboundSchema),wle.fail("4XX"),wle.fail("5XX"))(b);return g.ok,g}});var s4t=v(gLe=>{"use strict";Object.defineProperty(gLe,"__esModule",{value:!0});gLe.isReadableStream=Pbn;function Pbn(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 l4t=v($P=>{"use strict";var Ebn=$P&&$P.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yLe=$P&&$P.__importStar||function(t){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($P,"__esModule",{value:!0});$P.filesUpload=Fbn;var Sle=ii(),Abn=Qje(),xle=yLe(ai()),Ibn=Ue(),Mbn=ve(),u4t=si(),Rbn=To(),jbn=yLe(Fn()),Nbn=yLe(pl()),Dbn=_De(),Lbn=s4t();async function Fbn(t,e,r){let n=(0,Mbn.safeParse)(e,g=>Nbn.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=new FormData;if((0,Dbn.isBlobLike)(o.file))(0,Sle.appendForm)(i,"file",o.file);else if((0,Lbn.isReadableStream)(o.file.content)){let g=await(0,Abn.readableStreamToArrayBuffer)(o.file.content),y=new Blob([g],{type:"application/octet-stream"});(0,Sle.appendForm)(i,"file",y)}else(0,Sle.appendForm)(i,"file",new Blob([o.file.content],{type:"application/octet-stream"}),o.file.fileName);o.purpose!==void 0&&(0,Sle.appendForm)(i,"purpose",o.purpose);let a=(0,Rbn.pathToFunc)("/v1/files")(),s=new Headers((0,Ibn.compactMap)({Accept:"application/json"})),u=await(0,u4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,u4t.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 xle.match(xle.json(200,jbn.UploadFileOut$inboundSchema),xle.fail("4XX"),xle.fail("5XX"))(h);return b.ok,b}});var c4t=v(Cle=>{"use strict";Object.defineProperty(Cle,"__esModule",{value:!0});Cle.Files=void 0;var kbn=Z2t(),$bn=Q2t(),Bbn=r4t(),qbn=o4t(),Ubn=a4t(),zbn=l4t(),Hbn=ah(),qU=Ig(),bLe=class extends Hbn.ClientSDK{async upload(e,r){return(0,qU.unwrapAsync)((0,zbn.filesUpload)(this,e,r))}async list(e,r){return(0,qU.unwrapAsync)((0,qbn.filesList)(this,e,r))}async retrieve(e,r){return(0,qU.unwrapAsync)((0,Ubn.filesRetrieve)(this,e,r))}async delete(e,r){return(0,qU.unwrapAsync)((0,kbn.filesDelete)(this,e,r))}async download(e,r){return(0,qU.unwrapAsync)((0,$bn.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,qU.unwrapAsync)((0,Bbn.filesGetSignedUrl)(this,e,r))}};Cle.Files=bLe});var p4t=v(BP=>{"use strict";var Vbn=BP&&BP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wbn=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Le=BP&&BP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vbn(e,t,r);return Wbn(e,t),e};Object.defineProperty(BP,"__esModule",{value:!0});BP.fimComplete=Xbn;var Kbn=ii(),sW=_Le(ai()),Gbn=Ue(),Jbn=ve(),d4t=si(),Ybn=To(),f4t=_Le(Fn()),Zbn=_Le(uh());async function Xbn(t,e,r){let n=(0,Jbn.safeParse)(e,y=>f4t.FIMCompletionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,Kbn.encodeJSON)("body",o,{explode:!0}),a=(0,Ybn.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,Gbn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,d4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,d4t.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 sW.match(sW.json(200,f4t.FIMCompletionResponse$inboundSchema),sW.jsonErr(422,Zbn.HTTPValidationError$inboundSchema),sW.fail("4XX"),sW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var g4t=v(qP=>{"use strict";var Qbn=qP&&qP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e_n=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ole=qP&&qP.__importStar||function(t){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 e_n(e,t),e};Object.defineProperty(qP,"__esModule",{value:!0});qP.fimStream=u_n;var t_n=Ole(Te()),r_n=ii(),n_n=U5(),uW=Ole(ai()),o_n=Ue(),i_n=ve(),m4t=si(),a_n=To(),h4t=Ole(Fn()),s_n=Ole(uh());async function u_n(t,e,r){let n=(0,i_n.safeParse)(e,y=>h4t.FIMCompletionStreamRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,r_n.encodeJSON)("body",o,{explode:!0}),a=(0,a_n.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,o_n.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,m4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,m4t.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 uW.match(uW.sse(200,t_n.instanceof(ReadableStream).transform(y=>new n_n.EventStream({stream:y,decoder(S){return h4t.CompletionEvent$inboundSchema.parse(S)}})),{sseSentinel:"[DONE]"}),uW.jsonErr(422,s_n.HTTPValidationError$inboundSchema),uW.fail("4XX"),uW.fail("5XX"))(h,{extraFields:b});return g.ok,g}});var b4t=v(Ple=>{"use strict";Object.defineProperty(Ple,"__esModule",{value:!0});Ple.Fim=void 0;var l_n=p4t(),c_n=g4t(),d_n=ah(),y4t=Ig(),vLe=class extends d_n.ClientSDK{async complete(e,r){return(0,y4t.unwrapAsync)((0,l_n.fimComplete)(this,e,r))}async stream(e,r){return(0,y4t.unwrapAsync)((0,c_n.fimStream)(this,e,r))}};Ple.Fim=vLe});var v4t=v(UP=>{"use strict";var f_n=UP&&UP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p_n=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wLe=UP&&UP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&f_n(e,t,r);return p_n(e,t),e};Object.defineProperty(UP,"__esModule",{value:!0});UP.fineTuningJobsCancel=v_n;var m_n=ii(),Ele=wLe(ai()),h_n=Ue(),g_n=ve(),_4t=si(),y_n=To(),b_n=wLe(Fn()),__n=wLe(pl());async function v_n(t,e,r){let n=(0,g_n.safeParse)(e,y=>__n.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,m_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,y_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,h_n.compactMap)({Accept:"application/json"})),l=await(0,_4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_4t.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 Ele.match(Ele.json(200,b_n.DetailedJobOut$inboundSchema),Ele.fail("4XX"),Ele.fail("5XX"))(b);return g.ok,g}});var S4t=v(zP=>{"use strict";var w_n=zP&&zP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S_n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SLe=zP&&zP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&w_n(e,t,r);return S_n(e,t),e};Object.defineProperty(zP,"__esModule",{value:!0});zP.fineTuningJobsCreate=A_n;var x_n=ii(),Tle=SLe(ai()),C_n=Ue(),O_n=ve(),w4t=si(),P_n=To(),E_n=SLe(Fn()),T_n=SLe(pl());async function A_n(t,e,r){let n=(0,O_n.safeParse)(e,g=>E_n.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,x_n.encodeJSON)("body",o,{explode:!0}),a=(0,P_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,C_n.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,w4t.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,w4t.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 Tle.match(Tle.json(200,T_n.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),Tle.fail("4XX"),Tle.fail("5XX"))(h);return b.ok,b}});var C4t=v(HP=>{"use strict";var I_n=HP&&HP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M_n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xLe=HP&&HP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&I_n(e,t,r);return M_n(e,t),e};Object.defineProperty(HP,"__esModule",{value:!0});HP.fineTuningJobsGet=k_n;var R_n=ii(),Ale=xLe(ai()),j_n=Ue(),N_n=ve(),x4t=si(),D_n=To(),L_n=xLe(Fn()),F_n=xLe(pl());async function k_n(t,e,r){let n=(0,N_n.safeParse)(e,y=>F_n.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,R_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,D_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,j_n.compactMap)({Accept:"application/json"})),l=await(0,x4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,x4t.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 Ale.match(Ale.json(200,L_n.DetailedJobOut$inboundSchema),Ale.fail("4XX"),Ale.fail("5XX"))(b);return g.ok,g}});var P4t=v(VP=>{"use strict";var $_n=VP&&VP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B_n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLe=VP&&VP.__importStar||function(t){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 B_n(e,t),e};Object.defineProperty(VP,"__esModule",{value:!0});VP.fineTuningJobsList=K_n;var q_n=ii(),Ile=CLe(ai()),U_n=Ue(),z_n=ve(),O4t=si(),H_n=To(),V_n=CLe(Fn()),W_n=CLe(pl());async function K_n(t,e,r){let n=(0,z_n.safeParse)(e,y=>W_n.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a=(0,H_n.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,q_n.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,U_n.compactMap)({Accept:"application/json"})),l=await(0,O4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,O4t.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 Ile.match(Ile.json(200,V_n.JobsOut$inboundSchema),Ile.fail("4XX"),Ile.fail("5XX"))(b);return g.ok,g}});var T4t=v(WP=>{"use strict";var G_n=WP&&WP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J_n=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OLe=WP&&WP.__importStar||function(t){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 J_n(e,t),e};Object.defineProperty(WP,"__esModule",{value:!0});WP.fineTuningJobsStart=rvn;var Y_n=ii(),Mle=OLe(ai()),Z_n=Ue(),X_n=ve(),E4t=si(),Q_n=To(),evn=OLe(Fn()),tvn=OLe(pl());async function rvn(t,e,r){let n=(0,X_n.safeParse)(e,y=>tvn.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={job_id:(0,Y_n.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,Q_n.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,Z_n.compactMap)({Accept:"application/json"})),l=await(0,E4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,E4t.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 Mle.match(Mle.json(200,evn.DetailedJobOut$inboundSchema),Mle.fail("4XX"),Mle.fail("5XX"))(b);return g.ok,g}});var A4t=v(Rle=>{"use strict";Object.defineProperty(Rle,"__esModule",{value:!0});Rle.Jobs=void 0;var nvn=v4t(),ovn=S4t(),ivn=C4t(),avn=P4t(),svn=T4t(),uvn=ah(),lW=Ig(),PLe=class extends uvn.ClientSDK{async list(e,r){return(0,lW.unwrapAsync)((0,avn.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,lW.unwrapAsync)((0,ovn.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,lW.unwrapAsync)((0,ivn.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,lW.unwrapAsync)((0,nvn.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,lW.unwrapAsync)((0,svn.fineTuningJobsStart)(this,e,r))}};Rle.Jobs=PLe});var I4t=v(jle=>{"use strict";Object.defineProperty(jle,"__esModule",{value:!0});jle.FineTuning=void 0;var lvn=ah(),cvn=A4t(),ELe=class extends lvn.ClientSDK{get jobs(){return this._jobs??(this._jobs=new cvn.Jobs(this._options))}};jle.FineTuning=ELe});var R4t=v(KP=>{"use strict";var dvn=KP&&KP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fvn=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TLe=KP&&KP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dvn(e,t,r);return fvn(e,t),e};Object.defineProperty(KP,"__esModule",{value:!0});KP.modelsArchive=_vn;var pvn=ii(),Nle=TLe(ai()),mvn=Ue(),hvn=ve(),M4t=si(),gvn=To(),yvn=TLe(Fn()),bvn=TLe(pl());async function _vn(t,e,r){let n=(0,hvn.safeParse)(e,y=>bvn.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,pvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,gvn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,mvn.compactMap)({Accept:"application/json"})),l=await(0,M4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,M4t.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 Nle.match(Nle.json(200,yvn.ArchiveFTModelOut$inboundSchema),Nle.fail("4XX"),Nle.fail("5XX"))(b);return g.ok,g}});var N4t=v(GP=>{"use strict";var vvn=GP&&GP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wvn=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dle=GP&&GP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vvn(e,t,r);return wvn(e,t),e};Object.defineProperty(GP,"__esModule",{value:!0});GP.modelsDelete=Avn;var Svn=ii(),cW=Dle(ai()),xvn=Ue(),Cvn=ve(),j4t=si(),Ovn=To(),Pvn=Dle(Fn()),Evn=Dle(uh()),Tvn=Dle(pl());async function Avn(t,e,r){let n=(0,Cvn.safeParse)(e,S=>Tvn.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Svn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Ovn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,xvn.compactMap)({Accept:"application/json"})),l=await(0,j4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,j4t.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 cW.match(cW.json(200,Pvn.DeleteModelOut$inboundSchema),cW.jsonErr(422,Evn.HTTPValidationError$inboundSchema),cW.fail("4XX"),cW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var L4t=v(JP=>{"use strict";var Ivn=JP&&JP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Mvn=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ALe=JP&&JP.__importStar||function(t){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 Mvn(e,t),e};Object.defineProperty(JP,"__esModule",{value:!0});JP.modelsList=Lvn;var dW=ALe(ai()),Rvn=Ue(),D4t=si(),jvn=To(),Nvn=ALe(Fn()),Dvn=ALe(uh());async function Lvn(t,e){let r=(0,jvn.pathToFunc)("/v1/models")(),n=new Headers((0,Rvn.compactMap)({Accept:"application/json"})),o=await(0,D4t.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,D4t.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 dW.match(dW.json(200,Nvn.ModelList$inboundSchema),dW.jsonErr(422,Dvn.HTTPValidationError$inboundSchema),dW.fail("4XX"),dW.fail("5XX"))(d,{extraFields:f});return p.ok,p}});var $4t=v(YP=>{"use strict";var Fvn=YP&&YP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ILe=YP&&YP.__importStar||function(t){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(YP,"__esModule",{value:!0});YP.modelsRetrieve=Hvn;var $vn=ii(),fW=ILe(ai()),Bvn=Ue(),qvn=ve(),F4t=si(),Uvn=To(),zvn=ILe(uh()),k4t=ILe(pl());async function Hvn(t,e,r){let n=(0,qvn.safeParse)(e,S=>k4t.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(S),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,$vn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Uvn.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Bvn.compactMap)({Accept:"application/json"})),l=await(0,F4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,F4t.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 fW.match(fW.json(200,k4t.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),fW.jsonErr(422,zvn.HTTPValidationError$inboundSchema),fW.fail("4XX"),fW.fail("5XX"))(b,{extraFields:g});return y.ok,y}});var q4t=v(ZP=>{"use strict";var Vvn=ZP&&ZP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wvn=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MLe=ZP&&ZP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vvn(e,t,r);return Wvn(e,t),e};Object.defineProperty(ZP,"__esModule",{value:!0});ZP.modelsUnarchive=Qvn;var Kvn=ii(),Lle=MLe(ai()),Gvn=Ue(),Jvn=ve(),B4t=si(),Yvn=To(),Zvn=MLe(Fn()),Xvn=MLe(pl());async function Qvn(t,e,r){let n=(0,Jvn.safeParse)(e,y=>Xvn.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=null,a={model_id:(0,Kvn.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,Yvn.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Gvn.compactMap)({Accept:"application/json"})),l=await(0,B4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,B4t.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 Lle.match(Lle.json(200,Zvn.UnarchiveFTModelOut$inboundSchema),Lle.fail("4XX"),Lle.fail("5XX"))(b);return g.ok,g}});var H4t=v(XP=>{"use strict";var ewn=XP&&XP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),twn=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RLe=XP&&XP.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ewn(e,t,r);return twn(e,t),e};Object.defineProperty(XP,"__esModule",{value:!0});XP.modelsUpdate=swn;var U4t=ii(),Fle=RLe(ai()),rwn=Ue(),nwn=ve(),z4t=si(),own=To(),iwn=RLe(Fn()),awn=RLe(pl());async function swn(t,e,r){let n=(0,nwn.safeParse)(e,y=>awn.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return n;let o=n.value,i=(0,U4t.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,U4t.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,own.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,rwn.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,z4t.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,z4t.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 Fle.match(Fle.json(200,iwn.FTModelOut$inboundSchema),Fle.fail("4XX"),Fle.fail("5XX"))(b);return g.ok,g}});var V4t=v(kle=>{"use strict";Object.defineProperty(kle,"__esModule",{value:!0});kle.Models=void 0;var uwn=R4t(),lwn=N4t(),cwn=L4t(),dwn=$4t(),fwn=q4t(),pwn=H4t(),mwn=ah(),UU=Ig(),jLe=class extends mwn.ClientSDK{async list(e){return(0,UU.unwrapAsync)((0,cwn.modelsList)(this,e))}async retrieve(e,r){return(0,UU.unwrapAsync)((0,dwn.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,UU.unwrapAsync)((0,lwn.modelsDelete)(this,e,r))}async update(e,r){return(0,UU.unwrapAsync)((0,pwn.modelsUpdate)(this,e,r))}async archive(e,r){return(0,UU.unwrapAsync)((0,uwn.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,UU.unwrapAsync)((0,fwn.modelsUnarchive)(this,e,r))}};kle.Models=jLe});var W4t=v($le=>{"use strict";Object.defineProperty($le,"__esModule",{value:!0});$le.Mistral=void 0;var hwn=ah(),gwn=LUt(),ywn=d2t(),bwn=F2t(),_wn=V2t(),vwn=J2t(),wwn=c4t(),Swn=b4t(),xwn=I4t(),Cwn=V4t(),NLe=class extends hwn.ClientSDK{get models(){return this._models??(this._models=new Cwn.Models(this._options))}get files(){return this._files??(this._files=new wwn.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new xwn.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new ywn.Batch(this._options))}get chat(){return this._chat??(this._chat=new bwn.Chat(this._options))}get fim(){return this._fim??(this._fim=new Swn.Fim(this._options))}get agents(){return this._agents??(this._agents=new gwn.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new vwn.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new _wn.Classifiers(this._options))}};$le.Mistral=NLe});var J4t=v(om=>{"use strict";var K4t=om&&om.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Own=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G4t=om&&om.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K4t(e,t,r)},Pwn=om&&om.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K4t(e,t,r);return Own(e,t),e};Object.defineProperty(om,"__esModule",{value:!0});om.files=void 0;G4t(Dae(),om);om.files=Pwn(Qje());G4t(W4t(),om)});var u3t=w(()=>{LE()});var l3t=w(()=>{Qd();u3t();Sm();Wm()});var c3t=w(()=>{gy()});var VLe=w(()=>{Wm();qE();Sm();l3t();c3t()});var d3t={};Cf(d3t,{AutocompleteCache:()=>wW});var wW,WLe=w(()=>{yo();wW=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()}),ie(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),ie("[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 V6t=v((Eci,H6t)=>{"use strict";var aOn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";H6t.exports=aOn});var J6t=v((Tci,G6t)=>{"use strict";var sOn=V6t();function W6t(){}function K6t(){}K6t.resetWarningCache=W6t;G6t.exports=function(){function t(n,o,i,a,s,u){if(u!==sOn){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:K6t,resetWarningCache:W6t};return r.PropTypes=r,r}});var Z6t=v((Mci,Y6t)=>{Y6t.exports=J6t()();var Aci,Ici});var n5t=v(Mke=>{"use strict";Mke.__esModule=!0;Mke.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 e1n={};Cf(e1n,{default:()=>Lfe});module.exports=zl(e1n);mg();Cl();yo();var y1t=F(vq()),xq=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)||(ie("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,y1t.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return ie("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){ie("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 ie("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),ie("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),ie("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);ie("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)}}};yo();_g();nr();var w1t=F(vq()),aie=require("obsidian"),S1t=F(YRe()),nI=class nI{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.handleFileEvent=e=>{e instanceof aie.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ue().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=rf({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});eu(e,i,a)&&(await this.invalidateMarkdownContext(o),ie(`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,S1t.default)(e=>{this.handleFileChange(e)},nI.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=xq.getInstance(),this.initializeEventListeners()}static getInstance(){return nI.instance||(nI.instance=new nI),nI.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)||(ie("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,w1t.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 ie("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){ie("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 ie("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?(ie("Memory cache hit for project:",e.name),n):(ie("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);ie("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);ie("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);ie(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){fe("Error clearing project context cache:",e)}}async clearForProject(e){try{ie(`[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){ie(`[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++):Mh(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}ie(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else ie(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),ie(`[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),ie(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):ie(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),ie(`[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={},ie(`Flagged Web/YouTube contexts for full reload for project ${e.name}`)),await this.set(e,n),await this.cleanupProjectFileReferences(e),ie(`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),ie(`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 Mh(`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"?(Mh(`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 aie.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),ie(`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),ie(`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}=rf({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 aie.TFile)||!eu(u,n,o)?i++:a[s]=r.fileContexts[s]}i>0&&(r.fileContexts=a,await this.set(e,r),ie(`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{ie(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=rf({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(eu(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&&ie(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),ie(`[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),ie(`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),ie(`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),ie(`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),ie(`Updated YouTube context for URL ${r} in project ${e.name}`)}};nI.DEBOUNCE_DELAY=5e3;var tb=nI;Fd();$r();Cn();function x1t(t){let e=t.split(`
`),r=[],n="",o="",i="";for(let a of e)a.startsWith("**user**:")||a.startsWith("**ai**:")?(n&&o&&r.push({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Yhe(i):null}),n=a.startsWith("**user**:")?Pi:e_,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({sender:n===Pi?Pi:e_,message:o.trim(),isVisible:!0,timestamp:i?Yhe(i):null}),r}async function _N(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Pi){let o=t[r+1];o?.sender===e_&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}$r();yo();yo();Cn();var vN=require("obsidian"),Mx=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 Us(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 vN.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 Us(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 vN.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 vN.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 vN.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}};Mx.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],Mx.MAX_IMAGE_SIZE=3*1024*1024,Mx.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var wN=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 Mx.isImageUrl(e,n))return null;let o=await Mx.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 Mx.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 vN.Notice(`Failed to process images:
${e.join(`
`)}`)}};mg();Cn();var Cq=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Fi.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=>!gVe(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 Mx.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()}};_g();nr();yo();var C1t=F(vq()),sie=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)||(ie("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,C1t.MD5)(r).toString();return ie("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)){ie("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return ie("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);ie("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);ie("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)}}};yo();function SN(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 O1t(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var T1t=require("obsidian");var P1t=require("obsidian");var lie,E1t,uie=class{constructor(e){this.vault=e;pUe(this,lie)}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 P1t.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];mUe(this,lie,E1t).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}};lie=new WeakSet,E1t=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 ZRe=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},cie=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=sie.getInstance()}async parseFile(e,r){try{ie("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return ie("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);ie("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(){ie("Clearing PDF cache"),await this.pdfCache.clear()}},XRe=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{ie("Parsing Canvas file:",e.path);let n=new uie(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}]`}}},Oq=class Oq{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=tb.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){Oq.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(ie(`[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 ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;ie(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);ie(`[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),ie(`[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),SN(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-Oq.lastRateLimitNoticeTime<6e4)return;Oq.lastRateLimitNoticeTime=r;let n=O1t(e);new T1t.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(){ie("Cache clearing is now handled at the project level")}};Oq.lastRateLimitNoticeTime=0;var z8=Oq,oI=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new ZRe),this.registerParser(new z8(e,o)),n||this.registerParser(new cie(e)),this.registerParser(new XRe)}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 cie&&await e.clearCache()}};Cn();var vW=require("obsidian");mg();Cl();Fd();$r();Cl();Cn();async function die(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 yy(async()=>{let i=await ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]);return FR(i.content)})}$r();mg();yo();mg();fN();yo();Ix();nr();Cn();rie();qE();LE();Df();Hb();var fie=class extends xn{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,un(r))}async getRelevantDocuments(e,r){let n=un(CR(r)),i=await(await Bs.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}}};L8();Qoe();var Rx=class extends fie{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=xp.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 yy(async()=>{let o=NC(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 ue().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 Fi.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}}))),ue().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 yy(()=>ac.instance.getCurrentChainManager().chatModelManager.getChatModel().bind({temperature:0}).invoke(n));return o&&"content"in o?FR(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 ma.getInstance().getDb(),a=await eP.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new tP({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 ma.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&&(ue().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);ie("==== Daily note date range: ====",d[0],d[d.length-1]);let f=NC(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(S=>({...S,metadata:{...S.metadata,includeInContext:!0}}));ie("==== Modified time range: ====",l,c),s.where={mtime:{between:[l,c]}};let b=(await Xc(a,s)).hits.map(S=>new tP({pageContent:S.document.content,metadata:{...S.document.metadata,score:S.score,path:S.document.path,mtime:S.document.mtime,ctime:S.document.ctime,title:S.document.title,id:S.document.id,embeddingModel:S.document.embeddingModel,tags:S.document.tags,extension:S.document.extension,created_at:S.document.created_at,nchars:S.document.nchars}})),g=[...m,...b];return Array.from(new Set(g.map(S=>S.metadata.id))).map(S=>g.find(x=>x.metadata.id===S)).filter(S=>S!==void 0)}ue().debug&&console.log(`==== Orama Search Params: ====
`,s);let u=await Xc(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 tP({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 Xs.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}}))}};nr();var QRe=require("obsidian"),A1t=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""}},Pq=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 QRe.Notice(n.message):new QRe.Notice("An error occurred while executing the tool. Check console for details."),null}}};Cn();var UNt=require("obsidian");Cl();ZA();Td();_g();function YGr(t){return"children"in t&&"path"in t}function ZGr(t){return"path"in t&&!("children"in t)}function XGr(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function e1e(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=rf();for(let u of t.children)if(ZGr(u)){if(eu(u,i,a)){e&&r.push(u.name);let l=XGr(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(YGr(u)){let l=e1e(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 I1t=t=>Qm(async()=>{let e=e1e(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=e1e(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:Wr.void()});$r();wT();mg();Ix();nr();ZA();Td();var t1e=Qm(async({timeRange:t,query:e,salientTerms:r})=>{if(await ma.getInstance().isIndexEmpty())throw new Rr(oJ);let o=t!==void 0,i=ue().maxSourceChunks<nge?nge:ue().maxSourceChunks;ue().debug&&console.log("returnAll:",o);let u=(await new Rx({minSimilarityScore:o?0:.1,maxK:o?1e3:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:SVe,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:Wr.object({timeRange:Wr.object({startTime:Wr.any(),endTime:Wr.any()}).optional(),query:Wr.string().describe("The search query"),salientTerms:Wr.array(Wr.string()).describe("List of salient terms extracted from the query")})}),M1t=Qm(async()=>{try{let t=await ma.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"}),r1e=Qm(async({query:t,chatHistory:e})=>{try{let r=await die(t,e),n=await Fi.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:Wr.object({query:Wr.string().describe("The search query"),chatHistory:Wr.array(Wr.object({role:Wr.enum(["user","assistant"]),content:Wr.string()})).describe("Previous conversation turns")})});ZA();var D1t=F(R1t(),1),H8=F(iI(),1);var oo;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(oo||(oo={}));var tu;(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"})(tu||(tu={}));var eh;(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"})(eh||(eh={}));function j1t(t,e){e=e.add(1,"day"),xN(t,e),Eq(t,e)}function rb(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function pie(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",oo.AM):t.assign("meridiem",oo.PM)}function xN(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function Eq(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var s1e=F(iI(),1);var QGr={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=>N1t(t,eh.MARCH,tu.SUNDAY,2),dstEnd:t=>N1t(t,eh.OCTOBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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=>aI(t,eh.MARCH,tu.SUNDAY,2,2),dstEnd:t=>aI(t,eh.NOVEMBER,tu.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 aI(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 N1t(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 mie(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??QGr[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,s1e.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,s1e.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}H8.default.extend(D1t.default);var sI=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=mie(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}},io=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,H8.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,H8.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,H8.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?(pie(o,n),rb(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(Eq(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}},rP=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 io(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 u1e(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function eJr(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function Qc(t){return`(?:${eJr(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var L1t=F(iI(),1);function hie(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function uI(t,e,r){let n=(0,L1t.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 d1e={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},f1e={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},vg={...f1e,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},l1e={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},c1e={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},k1t={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"},V8={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",...k1t},$1t=`(?:${Qc(l1e)}|[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 tJr(t){let e=t.toLowerCase();return l1e[e]!==void 0?l1e[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 Tq=`(?:${Qc(c1e)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function Aq(t){let e=t.toLowerCase();return c1e[e]!==void 0?c1e[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var lI="(?:[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 cI(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 hie(e)}var B1t=`(${$1t})\\s{0,3}(${Qc(V8)})`,F1t=new RegExp(B1t,"i"),rJr=`(${$1t})\\s{0,3}(${Qc(k1t)})`,q1t="\\s{0,5},?(?:\\s*and)?\\s{0,5}",nP=u1e("(?:(?:about|around)\\s{0,3})?",B1t,q1t),dI=u1e("(?:(?:about|around)\\s{0,3})?",rJr,q1t);function wg(t){let e={},r=t,n=F1t.exec(r);for(;n;)nJr(e,n),r=r.substring(n[0].length).trim(),n=F1t.exec(r);return Object.keys(e).length==0?null:e}function nJr(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=tJr(e[1]),n=V8[e[2].toLowerCase()];t[n]=r}var pi=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 oJr=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${nP})(?=\\W|$)`,"i"),iJr=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${nP})(?=\\W|$)`,"i"),aJr=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${dI})(?=\\W|$)`,"i"),W8=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?aJr:e.option.forwardDate?oJr:iJr}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=wg(r[1]);return n?io.createRelativeFromReference(e.reference,n):null}};var sJr=new RegExp(`(?:on\\s{0,3})?(${Tq})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${Tq}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Qc(vg)})(?:(?:-|/|,?\\s{0,3})(${lI}(?!\\w)))?(?=\\W|$)`,"i"),U1t=1,z1t=2,uJr=3,H1t=4,K8=class extends pi{innerPattern(){return sJr}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=vg[r[uJr].toLowerCase()],i=Aq(r[U1t]);if(i>31)return r.index=r.index+r[U1t].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[H1t]){let a=cI(r[H1t]);n.start.assign("year",a)}else{let a=uI(e.refDate,i,o);n.start.imply("year",a)}if(r[z1t]){let a=Aq(r[z1t]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var lJr=new RegExp(`(${Qc(vg)})(?:-|/|\\s*,?\\s*)(${Tq})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${Tq})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${lI}))?(?=\\W|$)(?!\\:\\d)`,"i"),cJr=1,V1t=2,p1e=3,m1e=4,G8=class extends pi{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return lJr}innerExtract(e,r){let n=vg[r[cJr].toLowerCase()],o=Aq(r[V1t]);if(o>31||this.shouldSkipYearLikeDate&&!r[p1e]&&!r[m1e]&&r[V1t].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[m1e]){let u=cI(r[m1e]);i.assign("year",u)}else{let u=uI(e.refDate,o,n);i.imply("year",u)}if(!r[p1e])return i;let a=Aq(r[p1e]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var dJr=new RegExp(`((?:in)\\s*)?(${Qc(vg)})\\s*(?:[,-]?\\s*(${lI})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),fJr=1,pJr=2,W1t=3,J8=class extends pi{innerPattern(){return dJr}innerExtract(e,r){let n=r[pJr].toLowerCase();if(r[0].length<=3&&!f1e[n])return null;let o=e.createParsingResult(r.index+(r[fJr]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=vg[n];if(o.start.assign("month",i),r[W1t]){let a=cI(r[W1t]);o.start.assign("year",a)}else{let a=uI(e.refDate,1,i);o.start.imply("year",a)}return o}};var mJr=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Qc(vg)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),hJr=1,gJr=2,K1t=3,yJr=4,Y8=class extends pi{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return mJr}innerExtract(e,r){let n=parseInt(r[hJr]),o=parseInt(r[yJr]),i=r[K1t]?parseInt(r[K1t]):vg[r[gJr].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 bJr=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),_Jr=1,vJr=2,Z8=class extends pi{innerPattern(){return bJr}innerExtract(e,r){let n=parseInt(r[vJr]),o=parseInt(r[_Jr]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function wJr(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 SJr(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 G1t=2,Iq=3,gie=4,yie=5,X8=6,bie=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[G1t]);if(s>100){if(this.strictMode||r[Iq]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[Iq]!=null){if(r[Iq].length==1&&!r[X8])return null;i=parseInt(r[Iq])}if(i>=60)return null;if(s>12&&(a=oo.PM),r[X8]!=null){if(s>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(a=oo.AM,s==12&&(s=0)),u=="p"&&(a=oo.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",oo.AM):o.imply("meridiem",oo.PM),r[yie]!=null){let u=parseInt(r[yie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[gie]!=null){let u=parseInt(r[gie]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[yie]!=null){let u=parseInt(r[yie].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[gie]!=null){let u=parseInt(r[gie]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[G1t]),a=0,s=-1;if(r[Iq]!=null?a=parseInt(r[Iq]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=oo.PM),r[X8]!=null){if(i>12)return null;let u=r[X8][0].toLowerCase();u=="a"&&(s=oo.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=oo.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==oo.AM?(n.start.imply("meridiem",oo.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",oo.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",oo.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",oo.PM)):i>12?o.imply("meridiem",oo.PM):i<=12&&o.imply("meridiem",oo.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=wJr(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=SJr(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var Q8=class extends bie{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",oo.PM)):o<6&&n.assign("meridiem",oo.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",oo.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",oo.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function fI(t){let e={};for(let r in t)e[r]=-t[r];return e}function J1t(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 xJr=new RegExp(`(${nP})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),CJr=new RegExp(`(${dI})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),e6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?CJr:xJr}innerExtract(e,r){let n=wg(r[1]);if(!n)return null;let o=fI(n);return io.createRelativeFromReference(e.reference,o)}};var OJr=new RegExp(`(${nP})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),PJr=new RegExp(`(${dI})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),EJr=1,t6=class extends pi{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?PJr:OJr}innerExtract(e,r){let n=wg(r[EJr]);return n?io.createRelativeFromReference(e.reference,n):null}};var _ie=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},Sg=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 r6=class extends Sg{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 n6=class extends r6{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function h1e(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=Y1t(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=Y1t(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?rb(s,u):xN(s,u)}r.end=s}return r}function Y1t(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")==oo.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 o6=class extends Sg{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()?h1e(r,n):h1e(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var Mq=class extends o6{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var TJr=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),i6=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=TJr.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=mie(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 AJr=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),IJr=1,MJr=2,RJr=3,a6=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=AJr.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[MJr]),s=parseInt(i[RJr]||"0"),u=a*60+s;u>14*60||(i[IJr]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var pI=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 Z1t=F(iI(),1);var s6=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,Z1t.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),xN(n.start,o),n.end&&n.end.isOnlyTime()&&(xN(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),xN(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 u6=class extends _ie{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 jJr=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"),NJr=1,DJr=2,LJr=3,X1t=4,FJr=5,Q1t=6,ejt=7,kJr=8,tjt=9,rjt=10,l6=class extends pi{innerPattern(){return jJr}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[NJr]),month:parseInt(r[DJr]),day:parseInt(r[LJr])});if(r[X1t]!=null&&(n.assign("hour",parseInt(r[X1t])),n.assign("minute",parseInt(r[FJr])),r[Q1t]!=null&&n.assign("second",parseInt(r[Q1t])),r[ejt]!=null&&n.assign("millisecond",parseInt(r[ejt])),r[kJr]!=null)){let o=0;if(r[tjt]){let i=parseInt(r[tjt]),a=0;r[rjt]!=null&&(a=parseInt(r[rjt])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var c6=class extends Sg{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 njt(t,e=!1){return t.parsers.unshift(new l6),t.refiners.unshift(new c6),t.refiners.unshift(new a6),t.refiners.unshift(new pI),t.refiners.push(new i6),t.refiners.push(new pI),t.refiners.push(new s6),t.refiners.push(new u6(e)),t}var gjt=F(iI(),1);var Rq=F(iI(),1);function ojt(t){let e=(0,Rq.default)(t.instant),r=new io(t,{});return rb(r,e),pie(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function ijt(t){let e=(0,Rq.default)(t.instant),r=new io(t,{});return rb(r,e),Eq(r,e),r.addTag("casualReference/today"),r}function ajt(t){return $Jr(t,1).addTag("casualReference/yesterday")}function $Jr(t,e){return ujt(t,-e)}function sjt(t){return ujt(t,1).addTag("casualReference/tomorrow")}function ujt(t,e){let r=(0,Rq.default)(t.instant),n=new io(t,{});return r=r.add(e,"day"),rb(n,r),Eq(n,r),n}function ljt(t,e=22){let r=(0,Rq.default)(t.instant),n=new io(t,{});return rb(n,r),n.imply("hour",e),n.imply("meridiem",oo.PM),n.addTag("casualReference/tonight"),n}function cjt(t,e=20){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function djt(t){let e=new io(t,{}),r=(0,Rq.default)(t.instant);return r.hour()>2&&j1t(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function fjt(t,e=6){let r=new io(t,{});return r.imply("meridiem",oo.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function pjt(t,e=15){let r=new io(t,{});return r.imply("meridiem",oo.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function mjt(t){let e=new io(t,{});return e.imply("meridiem",oo.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var BJr=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,d6=class extends pi{innerPattern(e){return BJr}innerExtract(e,r){let n=(0,gjt.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=ojt(e.reference);break;case"today":i=ijt(e.reference);break;case"yesterday":i=ajt(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=sjt(e.reference);break;case"tonight":i=ljt(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),rb(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var qJr=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,f6=class extends pi{innerPattern(){return qJr}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=pjt(e.reference);break;case"evening":case"night":n=cjt(e.reference);break;case"midnight":n=djt(e.reference);break;case"morning":n=fjt(e.reference);break;case"noon":case"midday":n=mjt(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function yjt(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=UJr(n,e,r),i=new io(t);return i=J1t(i,{day:o}),i.assign("weekday",e),i}function UJr(t,e,r){let n=t.getDay();switch(r){case"this":return vie(t,e);case"last":return bjt(t,e);case"next":return n==tu.SUNDAY?e==tu.SUNDAY?7:e:n==tu.SATURDAY?e==tu.SATURDAY?7:e==tu.SUNDAY?8:1+e:e<n&&e!=tu.SUNDAY?vie(t,e):vie(t,e)+7}return zJr(t,e)}function zJr(t,e){let r=bjt(t,e),n=vie(t,e);return n<-r?n:r}function vie(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function bjt(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var HJr=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Qc(d1e)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),VJr=1,WJr=2,KJr=3,p6=class extends pi{innerPattern(){return HJr}innerExtract(e,r){let n=r[WJr].toLowerCase(),o=d1e[n],i=r[VJr],a=r[KJr],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"),yjt(e.reference,o,u)}};var _jt=F(iI(),1);var GJr=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Qc(V8)})(?=\\s*)(?=\\W|$)`,"i"),JJr=1,YJr=2,m6=class extends pi{innerPattern(){return GJr}innerExtract(e,r){let n=r[JJr].toLowerCase(),o=r[YJr].toLowerCase(),i=V8[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,io.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,io.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,_jt.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 ZJr=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"),XJr=1,QJr=5,vjt=2,wjt=3,g1e=4,h6=class{constructor(e){this.groupNumberMonth=e?wjt:vjt,this.groupNumberDay=e?vjt:wjt}pattern(){return ZJr}extract(e,r){let n=r.index+r[XJr].length,o=r.index+r[0].length-r[QJr].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[g1e]&&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[g1e]){let l=parseInt(r[g1e]),c=hie(l);a.start.assign("year",c)}else{let l=uI(e.refDate,u,s);a.start.imply("year",l)}return a}};var e7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${nP})(?=\\W|$)`,"i"),t7r=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${dI})(?=\\W|$)`,"i"),g6=class extends pi{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?e7r:t7r}innerExtract(e,r){let n=r[1].toLowerCase(),o=wg(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=fI(o);break}return io.createRelativeFromReference(e.reference,o)}};function r7r(t){return t.text.match(/^[+-]/i)!=null}function Sjt(t){return t.text.match(/^-/i)!=null}var y6=class extends Sg{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?r7r(n)||Sjt(n):!1}mergeResults(e,r,n,o){let i=wg(n.text);Sjt(n)&&(i=fI(i));let a=io.createRelativeFromReference(new sI(r.start.date()),i);return new rP(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function xjt(t){return t.text.match(/\s+(before|from)$/i)!=null}function n7r(t){return t.text.match(/\s+(after|since)$/i)!=null}var b6=class extends Sg{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!xjt(r)&&!n7r(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=wg(r.text);xjt(r)&&(o=fI(o));let i=io.createRelativeFromReference(new sI(n.start.date()),o);return new rP(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var o7r=new RegExp(`^\\s*(${lI})`,"i"),i7r=1,_6=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=o7r.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=cI(i[i7r]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var CN=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new d6),r.parsers.push(new f6),r.parsers.push(new J8),r.parsers.push(new m6),r.parsers.push(new g6),r}createConfiguration(e=!0,r=!1){let n=njt({parsers:[new h6(r),new W8(e),new K8,new G8(r),new p6,new Z8,new Q8(e),new e6(e),new t6(e)],refiners:[new Mq]},e);return n.parsers.unshift(new Y8(e)),n.refiners.unshift(new b6),n.refiners.unshift(new y6),n.refiners.unshift(new pI),n.refiners.push(new Mq),n.refiners.push(new _6),n.refiners.push(new n6),n}};var jq=class t{constructor(e){this.defaultConfig=new CN,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 y1e(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 rP?c=l:l instanceof io?(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}},y1e=class{constructor(e,r,n){this.text=e,this.reference=new sI(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof io?e:new io(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 rP(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 b1e=new CN,Cjt=new jq(b1e.createCasualConfiguration(!1)),a7r=new jq(b1e.createConfiguration(!0,!1)),KHo=new jq(b1e.createCasualConfiguration(!0));var u7r=Cjt;function _1e(t,e,r){return u7r.parse(t,e,r)}var oP=class extends Error{},wie=class extends oP{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Sie=class extends oP{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},xie=class extends oP{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},nb=class extends oP{},Nq=class extends oP{constructor(e){super(`Invalid unit ${e}`)}},ys=class extends oP{},ob=class extends oP{constructor(){super("Zone is an abstract class")}};var lt="numeric",ib="short",th="long",mI={year:lt,month:lt,day:lt},v6={year:lt,month:ib,day:lt},v1e={year:lt,month:ib,day:lt,weekday:ib},w6={year:lt,month:th,day:lt},S6={year:lt,month:th,day:lt,weekday:th},x6={hour:lt,minute:lt},C6={hour:lt,minute:lt,second:lt},O6={hour:lt,minute:lt,second:lt,timeZoneName:ib},P6={hour:lt,minute:lt,second:lt,timeZoneName:th},E6={hour:lt,minute:lt,hourCycle:"h23"},T6={hour:lt,minute:lt,second:lt,hourCycle:"h23"},A6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:ib},I6={hour:lt,minute:lt,second:lt,hourCycle:"h23",timeZoneName:th},M6={year:lt,month:lt,day:lt,hour:lt,minute:lt},R6={year:lt,month:lt,day:lt,hour:lt,minute:lt,second:lt},j6={year:lt,month:ib,day:lt,hour:lt,minute:lt},N6={year:lt,month:ib,day:lt,hour:lt,minute:lt,second:lt},w1e={year:lt,month:ib,day:lt,weekday:ib,hour:lt,minute:lt},D6={year:lt,month:th,day:lt,hour:lt,minute:lt,timeZoneName:ib},L6={year:lt,month:th,day:lt,hour:lt,minute:lt,second:lt,timeZoneName:ib},F6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,timeZoneName:th},k6={year:lt,month:th,day:lt,weekday:th,hour:lt,minute:lt,second:lt,timeZoneName:th};var Yp=class{get type(){throw new ob}get name(){throw new ob}get ianaName(){return this.name}get isUniversal(){throw new ob}offsetName(e,r){throw new ob}formatOffset(e,r){throw new ob}offset(e){throw new ob}equals(e){throw new ob}get isValid(){throw new ob}};var S1e=null,hI=class t extends Yp{static get instance(){return S1e===null&&(S1e=new t),S1e}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Oie(e,r,n)}formatOffset(e,r){return gI(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Eie={};function c7r(t){return Eie[t]||(Eie[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"})),Eie[t]}var d7r={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function f7r(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 p7r(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=d7r[i];i==="era"?n[s]=a:sr(s)||(n[s]=parseInt(a,10))}return n}var Pie={},nf=class t extends Yp{static create(e){return Pie[e]||(Pie[e]=new t(e)),Pie[e]}static resetCache(){Pie={},Eie={}}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 Oie(e,r,n,this.name)}formatOffset(e,r){return gI(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=c7r(this.name),[o,i,a,s,u,l,c]=n.formatToParts?p7r(n,r):f7r(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=Dq({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 Ojt={};function m7r(t,e={}){let r=JSON.stringify([t,e]),n=Ojt[r];return n||(n=new Intl.ListFormat(t,e),Ojt[r]=n),n}var x1e={};function C1e(t,e={}){let r=JSON.stringify([t,e]),n=x1e[r];return n||(n=new Intl.DateTimeFormat(t,e),x1e[r]=n),n}var O1e={};function h7r(t,e={}){let r=JSON.stringify([t,e]),n=O1e[r];return n||(n=new Intl.NumberFormat(t,e),O1e[r]=n),n}var P1e={};function g7r(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=P1e[o];return i||(i=new Intl.RelativeTimeFormat(t,e),P1e[o]=i),i}var $6=null;function y7r(){return $6||($6=new Intl.DateTimeFormat().resolvedOptions().locale,$6)}var Pjt={};function b7r(t){let e=Pjt[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Pjt[t]=e}return e}function _7r(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=C1e(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=C1e(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function v7r(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function w7r(t){let e=[];for(let r=1;r<=12;r++){let n=Yr.utc(2009,r,1);e.push(t(n))}return e}function S7r(t){let e=[];for(let r=1;r<=7;r++){let n=Yr.utc(2016,11,13+r);e.push(t(n))}return e}function Tie(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function x7r(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 E1e=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=h7r(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):Lq(e,3);return Ya(r,this.padTo)}}},T1e=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&&nf.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=C1e(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()}},A1e=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Aie()&&(this.rtf=g7r(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Ejt(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},C7r={firstDay:1,minimalDays:4,weekend:[6,7]},Eo=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||Po.defaultLocale,s=a||(i?"en-US":y7r()),u=r||Po.defaultNumberingSystem,l=n||Po.defaultOutputCalendar,c=B6(o)||Po.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){$6=null,x1e={},O1e={},P1e={}}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]=_7r(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=v7r(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=x7r(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,B6(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 Tie(this,e,I1e,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=w7r(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Tie(this,e,M1e,()=>{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]=S7r(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Tie(this,void 0,()=>R1e,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Yr.utc(2016,11,13,9),Yr.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Tie(this,e,j1e,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Yr.utc(-40,1,1),Yr.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 E1e(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new T1e(e,this.intl,r)}relFormatter(e={}){return new A1e(this.intl,this.isEnglish(),e)}listFormatter(e={}){return m7r(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:Iie()?b7r(this.locale):C7r}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 D1e=null,sc=class t extends Yp{static get utcInstance(){return D1e===null&&(D1e=new t(0)),D1e}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(ON(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${gI(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${gI(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return gI(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 Fq=class extends Yp{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 ab(t,e){let r;if(sr(t)||t===null)return e;if(t instanceof Yp)return t;if(Tjt(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?hI.instance:n==="utc"||n==="gmt"?sc.utcInstance:sc.parseSpecifier(n)||nf.create(t)}else return sb(t)?sc.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new Fq(t)}var L1e={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"},Ajt={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]},O7r=L1e.hanidec.replace(/[\[|\]]/g,"").split("");function Ijt(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(L1e.hanidec)!==-1)e+=O7r.indexOf(t[r]);else for(let o in Ajt){let[i,a]=Ajt[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var kq={};function Mjt(){kq={}}function xg({numberingSystem:t},e=""){let r=t||"latn";return kq[r]||(kq[r]={}),kq[r][e]||(kq[r][e]=new RegExp(`${L1e[r]}${e}`)),kq[r][e]}var Rjt=()=>Date.now(),jjt="system",Njt=null,Djt=null,Ljt=null,Fjt=60,kjt,$jt=null,Po=class{static get now(){return Rjt}static set now(e){Rjt=e}static set defaultZone(e){jjt=e}static get defaultZone(){return ab(jjt,hI.instance)}static get defaultLocale(){return Njt}static set defaultLocale(e){Njt=e}static get defaultNumberingSystem(){return Djt}static set defaultNumberingSystem(e){Djt=e}static get defaultOutputCalendar(){return Ljt}static set defaultOutputCalendar(e){Ljt=e}static get defaultWeekSettings(){return $jt}static set defaultWeekSettings(e){$jt=B6(e)}static get twoDigitCutoffYear(){return Fjt}static set twoDigitCutoffYear(e){Fjt=e%100}static get throwOnInvalid(){return kjt}static set throwOnInvalid(e){kjt=e}static resetCaches(){Eo.resetCache(),nf.resetCache(),Yr.resetCache(),Mjt()}};var uc=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var Bjt=[0,31,59,90,120,151,181,212,243,273,304,334],qjt=[0,31,60,91,121,152,182,213,244,274,305,335];function Cg(t,e){return new uc("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Mie(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 Ujt(t,e,r){return r+(EN(t)?qjt:Bjt)[e-1]}function zjt(t,e){let r=EN(t)?qjt:Bjt,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Rie(t,e){return(t-e+7)%7+1}function q6(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=Ujt(n,o,i),s=Rie(Mie(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=PN(l,e,r)):u>PN(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...z6(t)}}function F1e(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Rie(Mie(n,1,e),r),s=yI(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=yI(l)):u>s?(l=n+1,u-=yI(n)):l=n;let{month:c,day:d}=zjt(l,u);return{year:l,month:c,day:d,...z6(t)}}function jie(t){let{year:e,month:r,day:n}=t,o=Ujt(e,r,n);return{year:e,ordinal:o,...z6(t)}}function k1e(t){let{year:e,ordinal:r}=t,{month:n,day:o}=zjt(e,r);return{year:e,month:n,day:o,...z6(t)}}function $1e(t,e){if(!sr(t.localWeekday)||!sr(t.localWeekNumber)||!sr(t.localWeekYear)){if(!sr(t.weekday)||!sr(t.weekNumber)||!sr(t.weekYear))throw new nb("Cannot mix locale-based week fields with ISO-based week fields");return sr(t.localWeekday)||(t.weekday=t.localWeekday),sr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),sr(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 Hjt(t,e=4,r=1){let n=U6(t.weekYear),o=rh(t.weekNumber,1,PN(t.weekYear,e,r)),i=rh(t.weekday,1,7);return n?o?i?!1:Cg("weekday",t.weekday):Cg("week",t.weekNumber):Cg("weekYear",t.weekYear)}function Vjt(t){let e=U6(t.year),r=rh(t.ordinal,1,yI(t.year));return e?r?!1:Cg("ordinal",t.ordinal):Cg("year",t.year)}function B1e(t){let e=U6(t.year),r=rh(t.month,1,12),n=rh(t.day,1,$q(t.year,t.month));return e?r?n?!1:Cg("day",t.day):Cg("month",t.month):Cg("year",t.year)}function q1e(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=rh(e,0,23)||e===24&&r===0&&n===0&&o===0,a=rh(r,0,59),s=rh(n,0,59),u=rh(o,0,999);return i?a?s?u?!1:Cg("millisecond",o):Cg("second",n):Cg("minute",r):Cg("hour",e)}function sr(t){return typeof t>"u"}function sb(t){return typeof t=="number"}function U6(t){return typeof t=="number"&&t%1===0}function Tjt(t){return typeof t=="string"}function Kjt(t){return Object.prototype.toString.call(t)==="[object Date]"}function Aie(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Iie(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Gjt(t){return Array.isArray(t)?t:[t]}function U1e(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 Jjt(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function bI(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function B6(t){if(t==null)return null;if(typeof t!="object")throw new ys("Week settings must be an object");if(!rh(t.firstDay,1,7)||!rh(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!rh(e,1,7)))throw new ys("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function rh(t,e,r){return U6(t)&&t>=e&&t<=r}function P7r(t,e){return t-e*Math.floor(t/e)}function Ya(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function iP(t){if(!(sr(t)||t===null||t===""))return parseInt(t,10)}function _I(t){if(!(sr(t)||t===null||t===""))return parseFloat(t)}function H6(t){if(!(sr(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Lq(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function EN(t){return t%4===0&&(t%100!==0||t%400===0)}function yI(t){return EN(t)?366:365}function $q(t,e){let r=P7r(e-1,12)+1,n=t+(e-r)/12;return r===2?EN(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function Dq(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 Wjt(t,e,r){return-Rie(Mie(t,1,e),r)+e-1}function PN(t,e=4,r=1){let n=Wjt(t,e,r),o=Wjt(t+1,e,r);return(yI(t)-n+o)/7}function V6(t){return t>99?t:t>Po.twoDigitCutoffYear?1900+t:2e3+t}function Oie(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 ON(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 z1e(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new ys(`Invalid unit value ${t}`);return e}function Bq(t,e){let r={};for(let n in t)if(bI(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=z1e(o)}return r}function gI(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}${Ya(r,2)}:${Ya(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Ya(r,2)}${Ya(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function z6(t){return Jjt(t,["hour","minute","second","millisecond"])}var E7r=["January","February","March","April","May","June","July","August","September","October","November","December"],H1e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],T7r=["J","F","M","A","M","J","J","A","S","O","N","D"];function I1e(t){switch(t){case"narrow":return[...T7r];case"short":return[...H1e];case"long":return[...E7r];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 V1e=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],W1e=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],A7r=["M","T","W","T","F","S","S"];function M1e(t){switch(t){case"narrow":return[...A7r];case"short":return[...W1e];case"long":return[...V1e];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var R1e=["AM","PM"],I7r=["Before Christ","Anno Domini"],M7r=["BC","AD"],R7r=["B","A"];function j1e(t){switch(t){case"narrow":return[...R7r];case"short":return[...M7r];case"long":return[...I7r];default:return null}}function Yjt(t){return R1e[t.hour<12?0:1]}function Zjt(t,e){return M1e(e)[t.weekday-1]}function Xjt(t,e){return I1e(e)[t.month-1]}function Qjt(t,e){return j1e(e)[t.year<0?0:1]}function Ejt(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 eNt(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var j7r={D:mI,DD:v6,DDD:w6,DDDD:S6,t:x6,tt:C6,ttt:O6,tttt:P6,T:E6,TT:T6,TTT:A6,TTTT:I6,f:M6,ff:j6,fff:D6,ffff:F6,F:R6,FF:N6,FFF:L6,FFFF:k6},lc=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 j7r[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 Ya(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?Yjt(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?Xjt(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?Zjt(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?Qjt(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 eNt(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 eNt(i,o(s))}};var rNt=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Uq(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function zq(...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 Hq(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 nNt(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=iP(e[r+o]);return[n,null,r+o]}}var oNt=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,N7r=`(?:${oNt.source}?(?:\\[(${rNt.source})\\])?)?`,K1e=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,iNt=RegExp(`${K1e.source}${N7r}`),G1e=RegExp(`(?:T${iNt.source})?`),D7r=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,L7r=/(\d{4})-?W(\d\d)(?:-?(\d))?/,F7r=/(\d{4})-?(\d{3})/,k7r=nNt("weekYear","weekNumber","weekDay"),$7r=nNt("year","ordinal"),B7r=/(\d{4})-(\d\d)-(\d\d)/,aNt=RegExp(`${K1e.source} ?(?:${oNt.source}|(${rNt.source}))?`),q7r=RegExp(`(?: ${aNt.source})?`);function qq(t,e,r){let n=t[e];return sr(n)?r:iP(n)}function U7r(t,e){return[{year:qq(t,e),month:qq(t,e+1,1),day:qq(t,e+2,1)},null,e+3]}function Vq(t,e){return[{hours:qq(t,e,0),minutes:qq(t,e+1,0),seconds:qq(t,e+2,0),milliseconds:H6(t[e+3])},null,e+4]}function W6(t,e){let r=!t[e]&&!t[e+1],n=ON(t[e+1],t[e+2]),o=r?null:sc.instance(n);return[{},o,e+3]}function K6(t,e){let r=t[e]?nf.create(t[e]):null;return[{},r,e+1]}var z7r=RegExp(`^T?${K1e.source}$`),H7r=/^-?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 V7r(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(_I(r)),months:f(_I(n)),weeks:f(_I(o)),days:f(_I(i)),hours:f(_I(a)),minutes:f(_I(s)),seconds:f(_I(u),u==="-0"),milliseconds:f(H6(l),d)}]}var W7r={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 J1e(t,e,r,n,o,i,a){let s={year:e.length===2?V6(iP(e)):iP(e),month:H1e.indexOf(r)+1,day:iP(n),hour:iP(o),minute:iP(i)};return a&&(s.second=iP(a)),t&&(s.weekday=t.length>3?V1e.indexOf(t)+1:W1e.indexOf(t)+1),s}var K7r=/^(?:(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 G7r(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=J1e(e,o,n,r,i,a,s),p;return u?p=W7r[u]:l?p=0:p=ON(c,d),[f,new sc(p)]}function J7r(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var Y7r=/^(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$/,Z7r=/^(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$/,X7r=/^(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 tNt(t){let[,e,r,n,o,i,a,s]=t;return[J1e(e,o,n,r,i,a,s),sc.utcInstance]}function Q7r(t){let[,e,r,n,o,i,a,s]=t;return[J1e(e,s,r,n,o,i,a),sc.utcInstance]}var eYr=Uq(D7r,G1e),tYr=Uq(L7r,G1e),rYr=Uq(F7r,G1e),nYr=Uq(iNt),sNt=zq(U7r,Vq,W6,K6),oYr=zq(k7r,Vq,W6,K6),iYr=zq($7r,Vq,W6,K6),aYr=zq(Vq,W6,K6);function uNt(t){return Hq(t,[eYr,sNt],[tYr,oYr],[rYr,iYr],[nYr,aYr])}function lNt(t){return Hq(J7r(t),[K7r,G7r])}function cNt(t){return Hq(t,[Y7r,tNt],[Z7r,tNt],[X7r,Q7r])}function dNt(t){return Hq(t,[H7r,V7r])}var sYr=zq(Vq);function fNt(t){return Hq(t,[z7r,sYr])}var uYr=Uq(B7r,q7r),lYr=Uq(aNt),cYr=zq(Vq,W6,K6);function pNt(t){return Hq(t,[uYr,sNt],[lYr,cYr])}var mNt="Invalid Duration",gNt={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}},dYr={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},...gNt},Og=146097/400,Wq=146097/4800,fYr={years:{quarters:4,months:12,weeks:Og/7,days:Og,hours:Og*24,minutes:Og*24*60,seconds:Og*24*60*60,milliseconds:Og*24*60*60*1e3},quarters:{months:3,weeks:Og/28,days:Og/4,hours:Og*24/4,minutes:Og*24*60/4,seconds:Og*24*60*60/4,milliseconds:Og*24*60*60*1e3/4},months:{weeks:Wq/7,days:Wq,hours:Wq*24,minutes:Wq*24*60,seconds:Wq*24*60*60,milliseconds:Wq*24*60*60*1e3},...gNt},TN=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],pYr=TN.slice(0).reverse();function vI(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 Za(n)}function yNt(t,e){let r=e.milliseconds??0;for(let n of pYr.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function hNt(t,e){let r=yNt(t,e)<0?-1:1;TN.reduceRight((n,o)=>{if(sr(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),TN.reduce((n,o)=>{if(sr(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function mYr(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Za=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?fYr:dYr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Eo.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 ys(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:Bq(e,t.normalizeUnit),loc:Eo.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(sb(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new ys(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=dNt(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]=fNt(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 ys("need to specify a reason the Duration is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new xie(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 Nq(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?lc.create(this.loc,n).formatDurationFromString(this,e):mNt}toHuman(e={}){if(!this.isValid)return mNt;let r=TN.map(n=>{let o=this.values[n];return sr(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+=Lq(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},Yr.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?yNt(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 TN)(bI(r.values,o)||bI(this.values,o))&&(n[o]=r.get(o)+this.get(o));return vI(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]=z1e(e(this.values[n],n));return vI(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...Bq(e,t.normalizeUnit)};return vI(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 vI(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return hNt(this.matrix,e),vI(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=mYr(this.normalize().shiftToAll().toObject());return vI(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 TN)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;sb(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else sb(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 hNt(this.matrix,r),vI(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 vI(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 TN)if(!r(this.values[n],e.values[n]))return!1;return!0}};var Kq="Invalid Interval";function hYr(t,e){return!t||!t.isValid?aP.invalid("missing or invalid start"):!e||!e.isValid?aP.invalid("missing or invalid end"):e<t?aP.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 aP=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 ys("need to specify a reason the Interval is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new Sie(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Gq(e),o=Gq(r),i=hYr(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Za.fromDurationLike(r),o=Gq(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Za.fromDurationLike(r),o=Gq(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=Yr.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Yr.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Za.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Za.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(Gq).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=Za.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()})`:Kq}[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=mI,r={}){return this.isValid?lc.create(this.s.loc.clone(r),e).formatInterval(this):Kq}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Kq}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Kq}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Kq}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Kq}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Za.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var sP=class{static hasDST(e=Po.defaultZone){let r=Yr.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return nf.isValidZone(e)}static normalizeZone(e){return ab(e,Po.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Eo.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Eo.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Eo.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Eo.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Eo.create(r,null,"gregory").eras(e)}static features(){return{relative:Aie(),localeWeek:Iie()}}};function bNt(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Za.fromMillis(n).as("days"))}function gYr(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=bNt(u,l);return(c-c%7)/7}],["days",bNt]],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 _Nt(t,e,r,n){let[o,i,a,s]=gYr(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=Za.fromObject(i,n);return l.length>0?Za.fromMillis(u,n).shiftTo(...l).plus(c):c}var yYr="missing Intl.DateTimeFormat.formatToParts support";function oi(t,e=r=>r){return{regex:t,deser:([r])=>e(Ijt(r))}}var bYr="\xA0",SNt=`[ ${bYr}]`,xNt=new RegExp(SNt,"g");function _Yr(t){return t.replace(/\./g,"\\.?").replace(xNt,SNt)}function vNt(t){return t.replace(/\./g,"").replace(xNt," ").toLowerCase()}function ub(t,e){return t===null?null:{regex:RegExp(t.map(_Yr).join("|")),deser:([r])=>t.findIndex(n=>vNt(r)===vNt(n))+e}}function wNt(t,e){return{regex:t,deser:([,r,n])=>ON(r,n),groups:e}}function Nie(t){return{regex:t,deser:([e])=>e}}function vYr(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function wYr(t,e){let r=xg(e),n=xg(e,"{2}"),o=xg(e,"{3}"),i=xg(e,"{4}"),a=xg(e,"{6}"),s=xg(e,"{1,2}"),u=xg(e,"{1,3}"),l=xg(e,"{1,6}"),c=xg(e,"{1,9}"),d=xg(e,"{2,4}"),f=xg(e,"{4,6}"),p=b=>({regex:RegExp(vYr(b.val)),deser:([g])=>g,literal:!0}),h=(b=>{if(t.literal)return p(b);switch(b.val){case"G":return ub(e.eras("short"),0);case"GG":return ub(e.eras("long"),0);case"y":return oi(l);case"yy":return oi(d,V6);case"yyyy":return oi(i);case"yyyyy":return oi(f);case"yyyyyy":return oi(a);case"M":return oi(s);case"MM":return oi(n);case"MMM":return ub(e.months("short",!0),1);case"MMMM":return ub(e.months("long",!0),1);case"L":return oi(s);case"LL":return oi(n);case"LLL":return ub(e.months("short",!1),1);case"LLLL":return ub(e.months("long",!1),1);case"d":return oi(s);case"dd":return oi(n);case"o":return oi(u);case"ooo":return oi(o);case"HH":return oi(n);case"H":return oi(s);case"hh":return oi(n);case"h":return oi(s);case"mm":return oi(n);case"m":return oi(s);case"q":return oi(s);case"qq":return oi(n);case"s":return oi(s);case"ss":return oi(n);case"S":return oi(u);case"SSS":return oi(o);case"u":return Nie(c);case"uu":return Nie(s);case"uuu":return oi(r);case"a":return ub(e.meridiems(),0);case"kkkk":return oi(i);case"kk":return oi(d,V6);case"W":return oi(s);case"WW":return oi(n);case"E":case"c":return oi(r);case"EEE":return ub(e.weekdays("short",!1),1);case"EEEE":return ub(e.weekdays("long",!1),1);case"ccc":return ub(e.weekdays("short",!0),1);case"cccc":return ub(e.weekdays("long",!0),1);case"Z":case"ZZ":return wNt(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return wNt(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Nie(/[a-z_+-/]{1,256}?/i);case" ":return Nie(/[^\S\n\r]/);default:return p(b)}})(t)||{invalidReason:yYr};return h.token=t,h}var SYr={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 xYr(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=SYr[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function CYr(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function OYr(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(bI(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 PYr(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 sr(t.z)||(r=nf.create(t.z)),sr(t.Z)||(r||(r=new sc(t.Z)),n=t.Z),sr(t.q)||(t.M=(t.q-1)*3+1),sr(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),sr(t.u)||(t.S=H6(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var Y1e=null;function EYr(){return Y1e||(Y1e=Yr.fromMillis(1555555555555)),Y1e}function TYr(t,e){if(t.literal)return t;let r=lc.macroTokenToFormatOpts(t.val),n=Q1e(r,e);return n==null||n.includes(void 0)?t:n}function Z1e(t,e){return Array.prototype.concat(...t.map(r=>TYr(r,e)))}var G6=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Z1e(lc.parseFormat(r),e),this.units=this.tokens.map(n=>wYr(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=CYr(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=OYr(e,this.regex,this.handlers),[o,i,a]=n?PYr(n):[null,null,void 0];if(bI(n,"a")&&bI(n,"H"))throw new nb("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 X1e(t,e,r){return new G6(t,r).explainFromTokens(e)}function CNt(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=X1e(t,e,r);return[n,o,i,a]}function Q1e(t,e){if(!t)return null;let n=lc.create(e,t).dtFormatter(EYr()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>xYr(a,t,i))}var eje="Invalid DateTime",ONt=864e13;function J6(t){return new uc("unsupported zone",`the zone "${t.name}" is not supported`)}function tje(t){return t.weekData===null&&(t.weekData=q6(t.c)),t.weekData}function rje(t){return t.localWeekData===null&&(t.localWeekData=q6(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function AN(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Yr({...r,...e,old:r})}function RNt(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 Die(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 Fie(t,e,r){return RNt(Dq(t),e,r)}function PNt(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,$q(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Za.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=Dq(i),[u,l]=RNt(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function Jq(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=Yr.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Yr.invalid(new uc("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Lie(t,e,r=!0){return t.isValid?lc.create(Eo.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function nje(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Ya(t.c.year,r?6:4),e?(n+="-",n+=Ya(t.c.month),n+="-",n+=Ya(t.c.day)):(n+=Ya(t.c.month),n+=Ya(t.c.day)),n}function ENt(t,e,r,n,o,i){let a=Ya(t.c.hour);return e?(a+=":",a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Ya(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Ya(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Ya(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Ya(Math.trunc(-t.o/60)),a+=":",a+=Ya(Math.trunc(-t.o%60))):(a+="+",a+=Ya(Math.trunc(t.o/60)),a+=":",a+=Ya(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var jNt={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},AYr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},IYr={ordinal:1,hour:0,minute:0,second:0,millisecond:0},NNt=["year","month","day","hour","minute","second","millisecond"],MYr=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],RYr=["year","ordinal","hour","minute","second","millisecond"];function jYr(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 Nq(t);return e}function TNt(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return jYr(t)}}function NYr(t){return $ie[t]||(kie===void 0&&(kie=Po.now()),$ie[t]=t.offset(kie)),$ie[t]}function ANt(t,e){let r=ab(e.zone,Po.defaultZone);if(!r.isValid)return Yr.invalid(J6(r));let n=Eo.fromObject(e),o,i;if(sr(t.year))o=Po.now();else{for(let u of NNt)sr(t[u])&&(t[u]=jNt[u]);let a=B1e(t)||q1e(t);if(a)return Yr.invalid(a);let s=NYr(r);[o,i]=Fie(t,s,r)}return new Yr({ts:o,zone:r,loc:n,o:i})}function INt(t,e,r){let n=sr(r.round)?!0:r.round,o=(a,s)=>(a=Lq(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 MNt(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 kie,$ie={},Yr=class t{constructor(e){let r=e.zone||Po.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new uc("invalid input"):null)||(r.isValid?null:J6(r));this.ts=sr(e.ts)?Po.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=sb(e.o)&&!e.old?e.o:r.offset(this.ts);o=Die(this.ts,s),n=Number.isNaN(o.year)?new uc("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Eo.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]=MNt(arguments),[n,o,i,a,s,u,l]=r;return ANt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=MNt(arguments),[n,o,i,a,s,u,l]=r;return e.zone=sc.utcInstance,ANt({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=Kjt(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=ab(r.zone,Po.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Eo.fromObject(r)}):t.invalid(J6(o))}static fromMillis(e,r={}){if(sb(e))return e<-ONt||e>ONt?t.invalid("Timestamp out of range"):new t({ts:e,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(sb(e))return new t({ts:e*1e3,zone:ab(r.zone,Po.defaultZone),loc:Eo.fromObject(r)});throw new ys("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=ab(r.zone,Po.defaultZone);if(!n.isValid)return t.invalid(J6(n));let o=Eo.fromObject(r),i=Bq(e,TNt),{minDaysInFirstWeek:a,startOfWeek:s}=$1e(i,o),u=Po.now(),l=sr(r.specificOffset)?n.offset(u):r.specificOffset,c=!sr(i.ordinal),d=!sr(i.year),f=!sr(i.month)||!sr(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new nb("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,b,g,y=Die(u,l);h?(b=MYr,g=AYr,y=q6(y,a,s)):c?(b=RYr,g=IYr,y=jie(y)):(b=NNt,g=jNt);let S=!1;for(let R of b){let N=i[R];sr(N)?S?i[R]=g[R]:i[R]=y[R]:S=!0}let x=h?Hjt(i,a,s):c?Vjt(i):B1e(i),O=x||q1e(i);if(O)return t.invalid(O);let P=h?F1e(i,a,s):c?k1e(i):i,[E,A]=Fie(P,l,n),I=new t({ts:E,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]=uNt(e);return Jq(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=lNt(e);return Jq(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=cNt(e);return Jq(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=CNt(a,e,r);return c?t.invalid(c):Jq(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]=pNt(e);return Jq(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new ys("need to specify a reason the DateTime is invalid");let n=e instanceof uc?e:new uc(e,r);if(Po.throwOnInvalid)throw new wie(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Q1e(e,Eo.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Z1e(lc.parseFormat(e),Eo.fromObject(r)).map(o=>o.val).join("")}static resetCache(){kie=void 0,$ie={}}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?tje(this).weekYear:NaN}get weekNumber(){return this.isValid?tje(this).weekNumber:NaN}get weekday(){return this.isValid?tje(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?rje(this).weekday:NaN}get localWeekNumber(){return this.isValid?rje(this).weekNumber:NaN}get localWeekYear(){return this.isValid?rje(this).weekYear:NaN}get ordinal(){return this.isValid?jie(this.c).ordinal:NaN}get monthShort(){return this.isValid?sP.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?sP.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?sP.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?sP.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=Dq(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=Die(u,a),d=Die(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[AN(this,{ts:u}),AN(this,{ts:l})]:[this]}get isInLeapYear(){return EN(this.year)}get daysInMonth(){return $q(this.year,this.month)}get daysInYear(){return this.isValid?yI(this.year):NaN}get weeksInWeekYear(){return this.isValid?PN(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?PN(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=lc.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(sc.instance(e),r)}toLocal(){return this.setZone(Po.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=ab(e,Po.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]=Fie(a,i,e)}return AN(this,{ts:o,zone:e})}else return t.invalid(J6(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return AN(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=Bq(e,TNt),{minDaysInFirstWeek:n,startOfWeek:o}=$1e(r,this.loc),i=!sr(r.weekYear)||!sr(r.weekNumber)||!sr(r.weekday),a=!sr(r.ordinal),s=!sr(r.year),u=!sr(r.month)||!sr(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new nb("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new nb("Can't mix ordinal dates with month/day");let d;i?d=F1e({...q6(this.c,n,o),...r},n,o):sr(r.ordinal)?(d={...this.toObject(),...r},sr(r.day)&&(d.day=Math.min($q(d.year,d.month),d.day))):d=k1e({...jie(this.c),...r});let[f,p]=Fie(d,this.o,this.zone);return AN(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e);return AN(this,PNt(this,r))}minus(e){if(!this.isValid)return this;let r=Za.fromDurationLike(e).negate();return AN(this,PNt(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Za.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?lc.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):eje}toLocaleString(e=mI,r={}){return this.isValid?lc.create(this.loc.clone(r),e).formatDateTime(this):eje}toLocaleParts(e={}){return this.isValid?lc.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=nje(this,a);return s+="T",s+=ENt(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?nje(this,e==="extended"):null}toISOWeekDate(){return Lie(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":"")+ENt(this,a==="extended",r,e,n,i):null}toRFC2822(){return Lie(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Lie(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?nje(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")),Lie(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():eje}[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 Za.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=Gjt(r).map(Za.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=_Nt(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?aP.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),INt(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?INt(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 ys("min requires all arguments be DateTimes");return U1e(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new ys("max requires all arguments be DateTimes");return U1e(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return X1e(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=Eo.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new G6(i,e)}static fromFormatParser(e,r,n={}){if(sr(e)||sr(r))throw new ys("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Eo.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new ys(`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):Jq(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return mI}static get DATE_MED(){return v6}static get DATE_MED_WITH_WEEKDAY(){return v1e}static get DATE_FULL(){return w6}static get DATE_HUGE(){return S6}static get TIME_SIMPLE(){return x6}static get TIME_WITH_SECONDS(){return C6}static get TIME_WITH_SHORT_OFFSET(){return O6}static get TIME_WITH_LONG_OFFSET(){return P6}static get TIME_24_SIMPLE(){return E6}static get TIME_24_WITH_SECONDS(){return T6}static get TIME_24_WITH_SHORT_OFFSET(){return A6}static get TIME_24_WITH_LONG_OFFSET(){return I6}static get DATETIME_SHORT(){return M6}static get DATETIME_SHORT_WITH_SECONDS(){return R6}static get DATETIME_MED(){return j6}static get DATETIME_MED_WITH_SECONDS(){return N6}static get DATETIME_MED_WITH_WEEKDAY(){return w1e}static get DATETIME_FULL(){return D6}static get DATETIME_FULL_WITH_SECONDS(){return L6}static get DATETIME_HUGE(){return F6}static get DATETIME_HUGE_WITH_SECONDS(){return k6}};function Gq(t){if(Yr.isDateTime(t))return t;if(t&&t.valueOf&&sb(t.valueOf()))return Yr.fromJSDate(t);if(t&&typeof t=="object")return Yr.fromObject(t);throw new ys(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var DNt=require("obsidian");Td();async function DYr(){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 LNt=Qm(async()=>DYr(),{name:"getCurrentTime",description:"Get the current time in various formats, including timezone information",schema:Wr.object({})}),FNt={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 LYr(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 FYr(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 kYr(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=_1e(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Yr.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 $Yr(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=FNt[r[1]],o=e.year;n>e.month&&o--;let i=Yr.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 BYr(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=Yr.fromObject({year:n,month:1,day:1}),i=Yr.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 qYr(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=Yr.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 UYr(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=FNt[r[1].toLowerCase()],o=parseInt(r[2]),i=Yr.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 zYr(t){let e=Yr.now(),r=t.toLowerCase().replace("@vault","").trim(),n=LYr(r,e)||FYr(r,e)||kYr(r,e)||$Yr(r,e)||UYr(r,e)||qYr(r,e)||BYr(r,e);if(n)return{startTime:Y6(n.start),endTime:Y6(n.end)};let o=_1e(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Yr.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Yr.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:Y6(i),endTime:Y6(a)}}console.warn(`Unable to parse time expression: ${t}`)}function Y6(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 kNt=Qm(async({timeExpression:t})=>zYr(t),{name:"getTimeRangeMs",description:"Get a time range in milliseconds based on a natural language time expression",schema:Wr.object({timeExpression:Wr.string().describe("A natural language time expression (e.g., 'last week', 'from July 1 to July 15')")})});function HYr(t){let e=t.toString().length===10?t*1e3:t,r=Yr.fromMillis(e);return Y6(r)}var $Nt=Qm(async({epoch:t})=>HYr(t),{name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Wr.object({epoch:Wr.number().describe("Unix timestamp in seconds or milliseconds")})});function VYr(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 WYr(t="25min"){let e=VYr(t);return new Promise(r=>{setTimeout(()=>{new DNt.Notice(`Pomodoro timer (${t}) completed! Take a break!`),r()},e)})}var oje=Qm(async({interval:t="25min"})=>(WYr(t),`Pomodoro timer started. It will end in ${t}.`),{name:"startPomodoro",description:"Start a Pomodoro timer with a customizable interval",schema:Wr.object({interval:Wr.string().optional().describe("Time interval (e.g., '25min', '5s', '1h'). Default is 25min.")})});mg();ZA();Td();var Bie=Qm(async({url:t})=>{try{let e=await Fi.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:Wr.object({url:Wr.string().describe("The YouTube video URL"),brevilabsClient:Wr.any().describe("The BrevilabsClient instance")})});Cn();mg();var Z6=["@vault","@composer","@websearch","@youtube","@pomodoro"],IN=class{static initTools(e){this.tools.length===0&&(this.tools=[LNt,$Nt,kNt,t1e,M1t,oje,r1e,Bie,I1t(e.getRoot())])}static async analyzeIntent(e){try{let r=await Fi.getInstance().broca(e,zR());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 Pq.callTool(u,l)),u.name=="getFileTree"&&zR())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:t1e,args:{timeRange:i||void 0,query:u,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let u=this.removeAtCommands(e),c=await ac.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=DR(c);r.push({tool:r1e,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:oje,args:{interval:l}})}let s=yVe(e);for(let u of s)r.some(c=>c.tool.name===Bie.name&&c.args.url===u)||r.push({tool:Bie,args:{url:u}})}static removeAtCommands(e){return e.split(" ").filter(r=>!Z6.includes(r.toLowerCase())).join(" ").trim()}};IN.tools=[];var X6=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}},Q6=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:e_,isVisible:!0,timestamp:Vl(new Date),sources:a}),i("")):n.signal.reason==="new-chat"&&i(""),ie(`==== Chat Memory ====
`,this.chainManager.memoryManager.getMemory().chatHistory.messages.map(s=>s.content)),ie(`==== Final AI Response ====
`,e),e}async handleError(e,r,n){let o=ei(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:e_,isVisible:!0,timestamp:Vl(new Date)})}else new UNt.Notice(s),fe(i)}},qie=class extends Q6{async run(e,r,n,o,i){let a=new X6(n);try{let l=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),c=DR(l),d=[],f=Yb(),p=this.chainManager.chatModelManager.getChatModel();f&&d.push({role:nJ(p),content:f});for(let h of c)d.push({role:h.role,content:h.content});d.push({role:"user",content:e.message}),ie(`==== Final Request to AI ====
`,d);let m=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(d,{signal:r.signal}));for await(let h of m){if(r.signal.aborted){ie("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(h)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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)}},Uie=class extends Q6{async run(e,r,n,o,i){let a=new X6(n);try{if(await this.chainManager.vectorStoreManager.isIndexEmpty())return this.handleResponse(oJ,e,r,o,n);let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=DR(c),f=e.message;d.length>0&&(f=e.message);let m=await new Rx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]}).getRelevantDocuments(f);this.chainManager.storeRetrieverDocuments(m);let h=m.map(P=>P.pageContent).join(`
`),b=[],g=Yb(),y=`
Answer the question with as detailed as possible based only on the following context:
`+h,S=g+y,x=this.chainManager.chatModelManager.getChatModel();S&&b.push({role:nJ(x),content:S});for(let P of d)b.push({role:P.role,content:P.content});b.push({role:"user",content:e.message}),ie(`==== Final Request to AI ====
`,b);let O=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(b,{signal:r.signal}));for await(let P of O){if(r.signal.aborted){ie("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(P)}}catch(u){u.name==="AbortError"||r.signal.aborted?ie("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=hVe(this.chainManager.getRetrievedDocuments());if(r.length>0){let n=r.map(o=>`- [[${o}]]`).join(`
`);e+=`
#### Sources:
`+n}return e}},e5=class extends Q6{isYoutubeOnlyMessage(e){let r=e.trim(),n=r.includes("@youtube"),o=Qhe(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 wN.processUrlBatch(e,r,this.chainManager.app.vault);return wN.showFailedImagesNotice(r),n}async processChatInputImages(e){let r=[],n=await wN.processChatImageBatch(e,r,this.chainManager.app.vault);return wN.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=ue(),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=DR(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:nJ(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;ie("Enhanced user message: ",m),ie(`==== Final Request to AI ====
`,u);let h=new X6(o),b=await yy(()=>this.chainManager.chatModelManager.getChatModel().stream(u,{signal:n.signal}));for await(let g of b){if(n.signal.aborted){ie("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 S=Qhe(e.message),x="Transcript not available. Only videos with the auto transcript option turned on are supported at the moment.";if(S)try{let O=await Fi.getInstance().youtube4llm(S);return O.response.transcript?this.handleResponse(O.response.transcript,e,r,o,n):this.handleResponse(x,e,r,o,n)}catch(O){return fe("Error processing YouTube video:",O),this.handleResponse(x,e,r,o,n)}}ie("==== Step 1: Analyzing intent ====");let d,f=e.originalMessage||e.message;try{d=await IN.analyzeIntent(f)}catch(S){return this.handleResponse(cVe(S),e,r,o,n)}let p=e.message.split(" ").filter(S=>!Z6.includes(S.toLowerCase())).join(" ").trim(),m=await this.executeToolCalls(d,a),h=m.find(S=>S.tool==="localSearch"&&S.output&&S.output.length>0),g=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),y=DR(g);if(h){ie("==== Step 2: Processing local search results ====");let S=JSON.parse(h.output);ie("==== Step 3: Condensing Question ====");let x=await die(p,y);ie("Condensed standalone question: ",x),ie("==== Step 4: Preparing context ====");let O=this.getTimeExpression(d),P=this.prepareLocalSearchResult(S,O),E=m.filter(R=>R.tool==="getCurrentTime"),A=this.prepareEnhancedUserMessage(x,E);ie(P),ie("==== Step 5: Invoking QA Chain ====");let I=await this.chainManager.promptManager.getQAPrompt({question:A,context:P,systemMessage:""});s=await this.streamMultimodalResponse(I,e,r,c),u=this.getSources(S)}else{let S=this.prepareEnhancedUserMessage(p,m);ie("No local search results. Using standard LLM Chain."),s=await this.streamMultimodalResponse(S,e,r,c)}}catch(d){a?.(t_.DEFAULT),d.name==="AbortError"||r.signal.aborted?ie("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)?(Mh("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){Mh("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){ie(`==== Step 2: Calling tool: ${o.tool.name} ====`),o.tool.name==="localSearch"?r?.(t_.READING_FILES):o.tool.name==="webSearch"?r?.(t_.SEARCHING_WEB):o.tool.name==="getFileTree"&&r?.(t_.READING_FILE_TREE);let i=await Pq.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>oge){let s=oge/o;ie("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 Yb()}},zie=class extends e5{async getSystemPrompt(){let e=Yb(),r=Mc();if(!r)return e;let n=await ac.instance.getProjectContext(r.id);return e=`${e}
<project_system_prompt>
${r.systemPrompt}
</project_system_prompt>`,n&&(e=`${e}
<project_context>
${n}
</project_context>`),e}};yo();nr();Cn();qE();var Wle=require("obsidian");Cl();$r();BR();yo();nr();Cn();s8();var MN="0.39.0";var zNt=!1,RN,ije,KYr,GYr,JYr,HNt,YYr,Hie,aje,VNt,sje,Vie,WNt;function KNt(t,e={auto:!1}){if(zNt)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${t.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(RN)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${t.kind}'\` after \`import '@anthropic-ai/sdk/shims/${RN}'\``);zNt=e.auto,RN=t.kind,ije=t.fetch,KYr=t.Request,GYr=t.Response,JYr=t.Headers,HNt=t.FormData,YYr=t.Blob,Hie=t.File,aje=t.ReadableStream,VNt=t.getMultipartRequestOptions,sje=t.getDefaultAgent,Vie=t.fileFromPath,WNt=t.isFsReadStream}var Wie=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function GNt({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 Wie(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}}RN||KNt(GNt(),{auto:!0});var Or=class extends Error{},cc=class t extends Or{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 wI({message:n,cause:Kie(r)});let i=r;return e===400?new t5(e,i,n,o):e===401?new r5(e,i,n,o):e===403?new n5(e,i,n,o):e===404?new o5(e,i,n,o):e===409?new i5(e,i,n,o):e===422?new a5(e,i,n,o):e===429?new s5(e,i,n,o):e>=500?new u5(e,i,n,o):new t(e,i,n,o)}},ed=class extends cc{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},wI=class extends cc{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Yq=class extends wI{constructor({message:e}={}){super({message:e??"Request timed out."})}},t5=class extends cc{},r5=class extends cc{},n5=class extends cc{},o5=class extends cc{},i5=class extends cc{},a5=class extends cc{},s5=class extends cc{},u5=class extends cc{};var Gie=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},jN=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)},nh,uP=class{constructor(){nh.set(this,void 0),this.buffer=new Uint8Array,Gie(this,nh,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=QYr(this.buffer,jN(this,nh,"f")))!=null;){if(i.carriage&&jN(this,nh,"f")==null){Gie(this,nh,i.index,"f");continue}if(jN(this,nh,"f")!=null&&(i.index!==jN(this,nh,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,jN(this,nh,"f")-1))),this.buffer=this.buffer.slice(jN(this,nh,"f")),Gie(this,nh,null,"f");continue}let a=jN(this,nh,"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),Gie(this,nh,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 Or(`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 Or(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Or("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
`):[]}};nh=new WeakMap;uP.NEWLINE_CHARS=new Set([`
`,"\r"]);uP.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function QYr(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 JNt(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 l5(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 jx=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 eZr(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 cc.generate(void 0,`SSE Error: ${a.data}`,a.data,lje(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 uP,s=l5(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 aje({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*eZr(t,e){if(!t.body)throw e.abort(),new Or("Attempted to iterate over a response with no body");let r=new uje,n=new uP,o=l5(t.body);for await(let i of tZr(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*tZr(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=JNt(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var uje=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]=rZr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function rZr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var nZr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",oZr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&c5(t),c5=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 YNt(t,e,r){if(t=await t,oZr(t))return t;if(nZr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=c5(o)?[await o.arrayBuffer()]:[o];return new Hie(i,e,r)}let n=await iZr(t);if(e||(e=sZr(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Hie(n,e,r)}async function iZr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(c5(t))e.push(await t.arrayBuffer());else if(uZr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${aZr(t)}`);return e}function aZr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function sZr(t){return cje(t.name)||cje(t.filename)||cje(t.path)?.split(/[\\/]/).pop()}var cje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},uZr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",dje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var cZr=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},dZr=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)},Jie;async function tDt(t){let{response:e}=t;if(t.options.stream)return Zq("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):jx.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 Zq("response",e.status,e.url,e.headers,i),rDt(i,e)}let o=await e.text();return Zq("response",e.status,e.url,e.headers,o),o}function rDt(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 Zie=class t extends Promise{constructor(e,r=tDt){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>rDt(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)}},Xie=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=fje("maxRetries",r),this.timeout=fje("timeout",n),this.httpAgent=o,this.fetch=i??ije}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...hZr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${vZr()}`}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&&c5(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:dje(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&&fje("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??sje(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 eDt(i,a),eDt(i,r),dje(e.body)&&RN!=="node"&&delete i["content-type"],Yie(a,"x-stainless-retry-count")===void 0&&Yie(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),Yie(a,"x-stainless-timeout")===void 0&&Yie(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 Or("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 cc.generate(e,r,n,o)}request(e,r=null){return new Zie(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}),Zq("request",a,n,i.headers),n.signal?.aborted)throw new ed;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(Kie);if(l instanceof Error){if(n.signal?.aborted)throw new ed;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Yq:new wI({cause:l})}let c=lje(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let b=`retrying, ${r} attempts remaining`;return Zq(`response (error; ${b})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(b=>Kie(b).message),f=gZr(d),p=f?void 0:d;throw Zq(`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 pje(this,n,e)}buildURL(e,r){let n=bZr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return d5(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 Or(`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 _Zr(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 ${MN}`}},Qie=class{constructor(e,r,n,o){Jie.set(this,void 0),cZr(this,Jie,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 Or("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 dZr(this,Jie,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Jie=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},pje=class extends Zie{constructor(e,r,n){super(r,async o=>new n(e,o.response,await tDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},lje=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),fZr={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},Pg=t=>typeof t=="object"&&t!==null&&!d5(t)&&Object.keys(t).every(e=>nDt(fZr,e)),pZr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MN,"X-Stainless-OS":XNt(Deno.build.os),"X-Stainless-Arch":ZNt(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":MN,"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":MN,"X-Stainless-OS":XNt(process.platform),"X-Stainless-Arch":ZNt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=mZr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MN,"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":MN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function mZr(){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 ZNt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",XNt=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"),QNt,hZr=()=>QNt??(QNt=pZr()),gZr=t=>{try{return JSON.parse(t)}catch{return}},yZr=/^[a-z][a-z0-9+.-]*:/i,bZr=t=>yZr.test(t),_Zr=t=>new Promise(e=>setTimeout(e,t)),fje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Or(`${t} must be an integer`);if(e<0)throw new Or(`${t} must be a positive integer`);return e},Kie=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 eae=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function d5(t){if(!t)return!0;for(let e in t)return!1;return!0}function nDt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function eDt(t,e){for(let r in e){if(!nDt(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 Zq(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Anthropic:DEBUG:${t}`,...e)}var vZr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),oDt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",wZr=t=>typeof t?.get=="function";var Yie=(t,e)=>{let r=e.toLowerCase();if(wZr(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 Nx=class extends Qie{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 dc=class{constructor(e){this._client=e}};var NN=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}?beta=true`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models?beta=true",Xq,{query:e,...r})}},Xq=class extends Nx{};NN.BetaModelInfosPage=Xq;var Qq=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new uP;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 Or("Attempted to iterate over a response with no body");return new t(l5(e.body),r)}};var DN=class extends dc{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(Pg(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(Pg(e))return this.list({},e);let{betas:n,...o}=e;return this._client.getAPIList("/v1/messages/batches?beta=true",eU,{query:o,...r,headers:{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString(),...r?.headers}})}delete(e,r={},n){if(Pg(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(Pg(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(Pg(r))return this.results(e,{},r);let o=await this.retrieve(e);if(!o.results_url)throw new Or(`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)=>Qq.fromResponse(s.response,s.controller))}},eU=class extends Nx{};DN.BetaMessageBatchesPage=eU;var OZr=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},tU=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),tU(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),tU(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),tU(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),tU(t);break;case"delimiter":return t=t.slice(0,t.length-1),tU(t);break}return t},PZr=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},EZr=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},tae=t=>JSON.parse(EZr(PZr(tU(OZr(t)))));var of=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},bn=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Eg,SI,f5,rae,p5,m5,nae,h5,lP,g5,oae,iae,rU,aae,sae,mje,iDt,hje,gje,yje,bje,aDt,sDt="__json_buf",uae=class t{constructor(){Eg.add(this),this.messages=[],this.receivedMessages=[],SI.set(this,void 0),this.controller=new AbortController,f5.set(this,void 0),rae.set(this,()=>{}),p5.set(this,()=>{}),m5.set(this,void 0),nae.set(this,()=>{}),h5.set(this,()=>{}),lP.set(this,{}),g5.set(this,!1),oae.set(this,!1),iae.set(this,!1),rU.set(this,!1),aae.set(this,void 0),sae.set(this,void 0),hje.set(this,e=>{if(of(this,oae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return of(this,iae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),of(this,f5,new Promise((e,r)=>{of(this,rae,e,"f"),of(this,p5,r,"f")}),"f"),of(this,m5,new Promise((e,r)=>{of(this,nae,e,"f"),of(this,h5,r,"f")}),"f"),bn(this,f5,"f").catch(()=>{}),bn(this,m5,"f").catch(()=>{})}get response(){return bn(this,aae,"f")}get request_id(){return bn(this,sae,"f")}async withResponse(){let e=await bn(this,f5,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},bn(this,hje,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),bn(this,Eg,"m",gje).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)bn(this,Eg,"m",yje).call(this,s);if(a.controller.signal?.aborted)throw new ed;bn(this,Eg,"m",bje).call(this)}_connected(e){this.ended||(of(this,aae,e,"f"),of(this,sae,e?.headers.get("request-id"),"f"),bn(this,rae,"f").call(this,e),this._emit("connect"))}get ended(){return bn(this,g5,"f")}get errored(){return bn(this,oae,"f")}get aborted(){return bn(this,iae,"f")}abort(){this.controller.abort()}on(e,r){return(bn(this,lP,"f")[e]||(bn(this,lP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=bn(this,lP,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(bn(this,lP,"f")[e]||(bn(this,lP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{of(this,rU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){of(this,rU,!0,"f"),await bn(this,m5,"f")}get currentMessage(){return bn(this,SI,"f")}async finalMessage(){return await this.done(),bn(this,Eg,"m",mje).call(this)}async finalText(){return await this.done(),bn(this,Eg,"m",iDt).call(this)}_emit(e,...r){if(bn(this,g5,"f"))return;e==="end"&&(of(this,g5,!0,"f"),bn(this,nae,"f").call(this));let n=bn(this,lP,"f")[e];if(n&&(bn(this,lP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!bn(this,rU,"f")&&!n?.length&&Promise.reject(o),bn(this,p5,"f").call(this,o),bn(this,h5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!bn(this,rU,"f")&&!n?.length&&Promise.reject(o),bn(this,p5,"f").call(this,o),bn(this,h5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",bn(this,Eg,"m",mje).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),bn(this,Eg,"m",gje).call(this),this._connected(null);let o=jx.fromReadableStream(e,this.controller);for await(let i of o)bn(this,Eg,"m",yje).call(this,i);if(o.controller.signal?.aborted)throw new ed;bn(this,Eg,"m",bje).call(this)}[(SI=new WeakMap,f5=new WeakMap,rae=new WeakMap,p5=new WeakMap,m5=new WeakMap,nae=new WeakMap,h5=new WeakMap,lP=new WeakMap,g5=new WeakMap,oae=new WeakMap,iae=new WeakMap,rU=new WeakMap,aae=new WeakMap,sae=new WeakMap,hje=new WeakMap,Eg=new WeakSet,mje=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},iDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},gje=function(){this.ended||of(this,SI,void 0,"f")},yje=function(r){if(this.ended)return;let n=bn(this,Eg,"m",aDt).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":{of(this,SI,n,"f");break}case"content_block_start":case"message_delta":break}},bje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=bn(this,SI,"f");if(!r)throw new Or("request ended without sending any chunks");return of(this,SI,void 0,"f"),r},aDt=function(r){let n=bn(this,SI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[sDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,sDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tae(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 jx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var uDt={"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"},xI=class extends dc{constructor(){super(...arguments),this.batches=new DN(this._client)}create(e,r){let{betas:n,...o}=e;return o.model in uDt&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${uDt[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 uae.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}})}};xI.Batches=DN;xI.BetaMessageBatchesPage=eU;var Dx=class extends dc{constructor(){super(...arguments),this.models=new NN(this._client),this.messages=new xI(this._client)}};Dx.Models=NN;Dx.BetaModelInfosPage=Xq;Dx.Messages=xI;var LN=class extends dc{create(e,r){return this._client.post("/v1/complete",{body:e,timeout:this._client._options.timeout??6e5,...r,stream:e.stream??!1})}};var FN=class extends dc{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 Pg(e)?this.list({},e):this._client.getAPIList("/v1/messages/batches",nU,{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 Or(`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)=>Qq.fromResponse(i.response,i.controller))}},nU=class extends Nx{};FN.MessageBatchesPage=nU;var af=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},_n=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Tg,CI,y5,lae,b5,_5,cae,v5,cP,w5,dae,fae,oU,pae,mae,_je,lDt,vje,wje,Sje,xje,cDt,dDt="__json_buf",hae=class t{constructor(){Tg.add(this),this.messages=[],this.receivedMessages=[],CI.set(this,void 0),this.controller=new AbortController,y5.set(this,void 0),lae.set(this,()=>{}),b5.set(this,()=>{}),_5.set(this,void 0),cae.set(this,()=>{}),v5.set(this,()=>{}),cP.set(this,{}),w5.set(this,!1),dae.set(this,!1),fae.set(this,!1),oU.set(this,!1),pae.set(this,void 0),mae.set(this,void 0),vje.set(this,e=>{if(af(this,dae,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new ed),e instanceof ed)return af(this,fae,!0,"f"),this._emit("abort",e);if(e instanceof Or)return this._emit("error",e);if(e instanceof Error){let r=new Or(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Or(String(e)))}),af(this,y5,new Promise((e,r)=>{af(this,lae,e,"f"),af(this,b5,r,"f")}),"f"),af(this,_5,new Promise((e,r)=>{af(this,cae,e,"f"),af(this,v5,r,"f")}),"f"),_n(this,y5,"f").catch(()=>{}),_n(this,_5,"f").catch(()=>{})}get response(){return _n(this,pae,"f")}get request_id(){return _n(this,mae,"f")}async withResponse(){let e=await _n(this,y5,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t;return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,n){let o=new t;for(let i of r.messages)o._addMessageParam(i);return o._run(()=>o._createMessage(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},_n(this,vje,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_n(this,Tg,"m",wje).call(this);let{response:i,data:a}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(i);for await(let s of a)_n(this,Tg,"m",Sje).call(this,s);if(a.controller.signal?.aborted)throw new ed;_n(this,Tg,"m",xje).call(this)}_connected(e){this.ended||(af(this,pae,e,"f"),af(this,mae,e?.headers.get("request-id"),"f"),_n(this,lae,"f").call(this,e),this._emit("connect"))}get ended(){return _n(this,w5,"f")}get errored(){return _n(this,dae,"f")}get aborted(){return _n(this,fae,"f")}abort(){this.controller.abort()}on(e,r){return(_n(this,cP,"f")[e]||(_n(this,cP,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=_n(this,cP,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(_n(this,cP,"f")[e]||(_n(this,cP,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{af(this,oU,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){af(this,oU,!0,"f"),await _n(this,_5,"f")}get currentMessage(){return _n(this,CI,"f")}async finalMessage(){return await this.done(),_n(this,Tg,"m",_je).call(this)}async finalText(){return await this.done(),_n(this,Tg,"m",lDt).call(this)}_emit(e,...r){if(_n(this,w5,"f"))return;e==="end"&&(af(this,w5,!0,"f"),_n(this,cae,"f").call(this));let n=_n(this,cP,"f")[e];if(n&&(_n(this,cP,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!_n(this,oU,"f")&&!n?.length&&Promise.reject(o),_n(this,b5,"f").call(this,o),_n(this,v5,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!_n(this,oU,"f")&&!n?.length&&Promise.reject(o),_n(this,b5,"f").call(this,o),_n(this,v5,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",_n(this,Tg,"m",_je).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),_n(this,Tg,"m",wje).call(this),this._connected(null);let o=jx.fromReadableStream(e,this.controller);for await(let i of o)_n(this,Tg,"m",Sje).call(this,i);if(o.controller.signal?.aborted)throw new ed;_n(this,Tg,"m",xje).call(this)}[(CI=new WeakMap,y5=new WeakMap,lae=new WeakMap,b5=new WeakMap,_5=new WeakMap,cae=new WeakMap,v5=new WeakMap,cP=new WeakMap,w5=new WeakMap,dae=new WeakMap,fae=new WeakMap,oU=new WeakMap,pae=new WeakMap,mae=new WeakMap,vje=new WeakMap,Tg=new WeakSet,_je=function(){if(this.receivedMessages.length===0)throw new Or("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},lDt=function(){if(this.receivedMessages.length===0)throw new Or("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 Or("stream ended without producing a content block with type=text");return r.join(" ")},wje=function(){this.ended||af(this,CI,void 0,"f")},Sje=function(r){if(this.ended)return;let n=_n(this,Tg,"m",cDt).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":{af(this,CI,n,"f");break}case"content_block_start":case"message_delta":break}},xje=function(){if(this.ended)throw new Or("stream has ended, this shouldn't happen");let r=_n(this,CI,"f");if(!r)throw new Or("request ended without sending any chunks");return af(this,CI,void 0,"f"),r},cDt=function(r){let n=_n(this,CI,"f");if(r.type==="message_start"){if(n)throw new Or(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new Or(`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[dDt]||"";i+=r.delta.partial_json,Object.defineProperty(o,dDt,{value:i,enumerable:!1,writable:!0}),i&&(o.input=tae(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 jx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var dP=class extends dc{constructor(){super(...arguments),this.batches=new FN(this._client)}create(e,r){return e.model in fDt&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${fDt[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 hae.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},fDt={"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"};dP.Batches=FN;dP.MessageBatchesPage=nU;var OI=class extends dc{retrieve(e,r){return this._client.get(`/v1/models/${e}`,r)}list(e={},r){return Pg(e)?this.list({},e):this._client.getAPIList("/v1/models",kN,{query:e,...r})}},kN=class extends Nx{};OI.ModelInfosPage=kN;var pDt,mi=class extends Xie{constructor({baseURL:e=eae("ANTHROPIC_BASE_URL"),apiKey:r=eae("ANTHROPIC_API_KEY")??null,authToken:n=eae("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&oDt())throw new Or(`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 LN(this),this.messages=new dP(this),this.models=new OI(this),this.beta=new Dx(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&&!d5(r)?r:n!=null&&!d5(n)?n:{}}apiKeyAuth(e){return this.apiKey==null?{}:{"X-Api-Key":this.apiKey}}bearerAuth(e){return this.authToken==null?{}:{Authorization:`Bearer ${this.authToken}`}}};pDt=mi;mi.Anthropic=pDt;mi.HUMAN_PROMPT=`
Human:`;mi.AI_PROMPT=`
Assistant:`;mi.DEFAULT_TIMEOUT=6e5;mi.AnthropicError=Or;mi.APIError=cc;mi.APIConnectionError=wI;mi.APIConnectionTimeoutError=Yq;mi.APIUserAbortError=ed;mi.NotFoundError=o5;mi.ConflictError=i5;mi.RateLimitError=s5;mi.BadRequestError=t5;mi.AuthenticationError=r5;mi.InternalServerError=u5;mi.PermissionDeniedError=n5;mi.UnprocessableEntityError=a5;mi.toFile=YNt;mi.fileFromPath=Vie;mi.Completions=LN;mi.Messages=dP;mi.Models=OI;mi.ModelInfosPage=kN;mi.Beta=Dx;var{HUMAN_PROMPT:lWo,AI_PROMPT:cWo}=mi;gs();Qd();Dn();fx();Wm();Ec();Sm();pB();Km();gy();var S5=class extends PR{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 vm(`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 vm(`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)?Cje(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 Cje(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 mDt(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:typeof t=="string"?{type:"tool",name:t}:t}gs();function hDt(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 gDt(t){let e=ame({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 MZr(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 Os({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Os({content:[{type:"tool_result",content:Oje(r.content),tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function yDt(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 RZr={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=ame({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 Oje(t){let e=["tool_use","tool_result","input_json_delta"],r=["text","text_delta"];return typeof t=="string"?t:t.map(o=>{if(jE(o))return H4e(o,RZr);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=gDt(o.image_url):a=gDt(o.image_url.url),{type:"image",source:a,...i?{cache_control:i}:{}}}else{if(hDt(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 gae(t){let e=MZr(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(Oi(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(yDt)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(yDt)]};{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:Oje(i.content)}}}else return{role:a,content:Oje(i.content)}});return{messages:jZr(o),system:r}}function jZr(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}gs();function bDt(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 dr({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 dr({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 dr({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 dr({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 dr({content:[{index:t.index,...r,type:"thinking"}]})}:{chunk:new dr({content:[{index:t.index,...r,type:"text"}]})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new dr({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 dr({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 dr({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 dr({content:e.coerceContentToString?r:[{index:t.index,...t.content_block}]})}}}}return null}function _Dt(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 gn({content:t[0].text,additional_kwargs:e,usage_metadata:n,response_metadata:e,id:e.id})}];{let o=Cje(t);return[{text:"",message:new gn({content:t,additional_kwargs:e,tool_calls:o,usage_metadata:n,response_metadata:e,id:e.id})}]}}function yae(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function Pje(t){let e;return t.status===400&&t.message.includes("tool")?e=yae(t,"INVALID_TOOL_RESULTS"):t.status===401?e=yae(t,"MODEL_AUTHENTICATION"):t.status===404?e=yae(t,"MODEL_NOT_FOUND"):t.status===429?e=yae(t,"MODEL_RATE_LIMIT"):e=t,e}function NZr(t){return!!(t.tools&&t.tools.length>0)}function DZr(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 LZr(t){return!!(t.thinking&&t.thinking.type==="enabled")}function FZr(t){return"input_schema"in t}function kZr(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 Eje=class extends Js{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??ot("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 mi(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(FZr(r))return r;if(Wc(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(rc(r))return{name:r.name,description:r.description,input_schema:Gs(r.schema)?So(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=mDt(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=gae(e),a={...o,...i,stream:!0},s=!NZr(a)&&!DZr(a)&&!LZr(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=bDt(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=kZr(f),m=new qn({message:new dr({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,...gae(e)},n),{content:i,...a}=o,s=_Dt(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 Pje(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 Pje(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(Gs(n)){let m=So(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new S5({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 S5({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=go.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=go.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return bi.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},bae=class extends Eje{};fAe();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();function $N(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}pg();Ec();Km();function x5(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function BN(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=x5(t,"INVALID_TOOL_RESULTS"):t.status===401?e=x5(t,"MODEL_AUTHENTICATION"):t.status===429?e=x5(t,"MODEL_RATE_LIMIT"):t.status===404?e=x5(t,"MODEL_NOT_FOUND"):e=t,e}function Tje(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 $Zr(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function vDt(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(wDt(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function wDt(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}: ${_ae(o,e)},`):r.push(`${n}?: ${_ae(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function _ae(t,e){if($Zr(t))return t.anyOf.map(r=>_ae(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["{",wDt(t,e+2),"}"].join(`
`);case"array":return t.items?`${_ae(t.items,e)}[]`:"any[]";default:return""}}Km();sq();function SDt(t,e){let r;if(rc(t)){let n=$ne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function BZr(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 Mje(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return BZr(t)}default:throw new Error(`Unknown message type: ${e}`)}}function Ije(t,e){return t.flatMap(r=>{let n=Mje(r);n==="system"&&Rje(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),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 iU="__openai_function_call_ids__";function xDt(t,e){return t.flatMap(r=>{let n=Mje(r);if(n==="system"&&Rje(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[iU];if(Oi(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 ODt(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[iU]??(i[iU]={}),i[iU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function qZr(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[iU]={[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=ODt(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function Aje(t){return"type"in t&&t.type!=="function"}function UZr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function CDt(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:SDt(t,e)}function Rje(t){return t?.startsWith("o1")||t?.startsWith("o3")}var C5=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>Aje(o)?o:CDt(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&vae(e.json_schema.schema)?aq(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=>Aje(l)?l:Wc(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:UZr(e?.tool_choice)?e?.tool_choice:(()=>{let l=Tje(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=>CDt(s,{strict:n})):void 0,tool_choice:Tje(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),Rje(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:xDt(e,this.model),stream:!0},r);for await(let c of l){let d=qZr(c);d!=null&&(yield d)}return}let o=Ije(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 qn({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 qn({message:new dr({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=xDt(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:ODt(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(Aje),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=Ije(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}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(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=vDt(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(Mje(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 BN(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 BN(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 BN(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=$N(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;zZr(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"}}),vae(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),vae(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(vae(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function vae(t){return typeof t?.parse=="function"}function zZr(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();jj();dg();Dn();Dn();Dn();$O();dg();Dn();pg();ZA();var jje=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(jje,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var wae=class extends C5{static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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)}};_Ae();Ec();fx();gs();Qd();Dn();pB();var qN="0.5.0";var PDt=!1,UN,Nje,HZr,VZr,WZr,Dje,KZr,Sae,Lje,Fje,kje,xae,$je;function EDt(t,e={auto:!1}){if(PDt)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(UN)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${UN}'\``);PDt=e.auto,UN=t.kind,Nje=t.fetch,HZr=t.Request,VZr=t.Response,WZr=t.Headers,Dje=t.FormData,KZr=t.Blob,Sae=t.File,Lje=t.ReadableStream,Fje=t.getMultipartRequestOptions,kje=t.getDefaultAgent,xae=t.fileFromPath,$je=t.isFsReadStream}var Cae=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}};function TDt({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 Cae(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}}UN||EDt(TDt(),{auto:!0});var Bje={};Cf(Bje,{APIConnectionError:()=>fP,APIConnectionTimeoutError:()=>zN,APIError:()=>Fl,APIUserAbortError:()=>PI,AuthenticationError:()=>sU,BadRequestError:()=>aU,ConflictError:()=>cU,GroqError:()=>fc,InternalServerError:()=>pU,NotFoundError:()=>lU,PermissionDeniedError:()=>uU,RateLimitError:()=>fU,UnprocessableEntityError:()=>dU});var fc=class extends Error{},Fl=class t extends fc{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 fP({cause:Oae(r)});let i=r;return e===400?new aU(e,i,n,o):e===401?new sU(e,i,n,o):e===403?new uU(e,i,n,o):e===404?new lU(e,i,n,o):e===409?new cU(e,i,n,o):e===422?new dU(e,i,n,o):e===429?new fU(e,i,n,o):e>=500?new pU(e,i,n,o):new t(e,i,n,o)}},PI=class extends Fl{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0),this.status=void 0}},fP=class extends Fl{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),this.status=void 0,r&&(this.cause=r)}},zN=class extends fP{constructor({message:e}={}){super({message:e??"Request timed out."})}},aU=class extends Fl{constructor(){super(...arguments),this.status=400}},sU=class extends Fl{constructor(){super(...arguments),this.status=401}},uU=class extends Fl{constructor(){super(...arguments),this.status=403}},lU=class extends Fl{constructor(){super(...arguments),this.status=404}},cU=class extends Fl{constructor(){super(...arguments),this.status=409}},dU=class extends Fl{constructor(){super(...arguments),this.status=422}},fU=class extends Fl{constructor(){super(...arguments),this.status=429}},pU=class extends Fl{};var Pae=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new qje;async function*i(){if(!e.body)throw r.abort(),new fc("Attempted to iterate over a response with no body");let s=new mU,u=ADt(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 Fl(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 mU,s=ADt(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 Lje({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?.()}})}},qje=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]=JZr(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},mU=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 fc(`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 fc(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new fc("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}};mU.NEWLINE_CHARS=new Set([`
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);mU.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;function JZr(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function ADt(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 IDt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",MDt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Eae(t),Eae=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",YZr=t=>MDt(t)||IDt(t)||$je(t);async function Hje(t,e,r){if(t=await t,r??(r=MDt(t)?{lastModified:t.lastModified,type:t.type}:{}),IDt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file"),new Sae([o],e,r)}let n=await ZZr(t);if(e||(e=QZr(t)??"unknown_file"),!r.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new Sae(n,e,r)}async function ZZr(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Eae(t))e.push(await t.arrayBuffer());else if(eXr(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${XZr(t)}`);return e}function XZr(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function QZr(t){return Uje(t.name)||Uje(t.filename)||Uje(t.path)?.split(/[\\/]/).pop()}var Uje=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},eXr=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Vje=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody";var O5=async t=>{let e=await RDt(t.body);return Fje(e,t)},RDt=async t=>{let e=new Dje;return await Promise.all(Object.entries(t||{}).map(([r,n])=>zje(e,r,n))),e};var zje=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(YZr(r)){let n=await Hje(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>zje(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>zje(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 rXr=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},nXr=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)},Tae;async function kDt(t){let{response:e}=t;if(t.options.stream)return hU("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):Pae.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 hU("response",e.status,e.url,e.headers,i),i}let o=await e.text();return hU("response",e.status,e.url,e.headers,o),o}var Aae=class t extends Promise{constructor(e,r=kDt){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)}},Iae=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Wje("maxRetries",r),this.timeout=Wje("timeout",n),this.httpAgent=o,this.fetch=i??Nje}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...sXr(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${mXr()}`}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&&Eae(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:Vje(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&&Wje("timeout",e.timeout);let l=e.timeout??this.timeout,c=e.httpAgent??this.httpAgent??kje(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 FDt(o,i),FDt(o,r),Vje(e.body)&&UN!=="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 Fl.generate(e,r,n,o)}request(e,r=null){return new Aae(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}),hU("request",i,n,o.headers),n.signal?.aborted)throw new PI;let s=new AbortController,u=await this.fetchWithTimeout(i,o,a,s).catch(Oae);if(u instanceof Error){if(n.signal?.aborted)throw new PI;if(r)return this.retryRequest(n,r);throw u.name==="AbortError"?new zN:new fP({cause:u})}let l=oXr(u.headers);if(!u.ok){if(r&&this.shouldRetry(u)){let h=`retrying, ${r} attempts remaining`;return hU(`response (error; ${h})`,u.status,i,l),this.retryRequest(n,r,l)}let c=await u.text().catch(h=>Oae(h).message),d=uXr(c),f=d?void 0:c;throw hU(`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 Kje(this,n,e)}buildURL(e,r){let n=cXr(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return fXr(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 fc(`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 dXr(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 ${qN}`}},jDt=class{constructor(e,r,n,o){Tae.set(this,void 0),rXr(this,Tae,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 fc("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 nXr(this,Tae,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(Tae=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Kje=class extends Aae{constructor(e,r,n){super(r,async o=>new n(e,o.response,await kDt(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},oXr=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}});var iXr=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qN,"X-Stainless-OS":DDt(Deno.build.os),"X-Stainless-Arch":NDt(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":qN,"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":qN,"X-Stainless-OS":DDt(process.platform),"X-Stainless-Arch":NDt(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=aXr();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":qN,"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":qN,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function aXr(){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 NDt=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",DDt=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"),LDt,sXr=()=>LDt??(LDt=iXr()),uXr=t=>{try{return JSON.parse(t)}catch{return}},lXr=new RegExp("^(?:[a-z]+:)?//","i"),cXr=t=>lXr.test(t),dXr=t=>new Promise(e=>setTimeout(e,t)),Wje=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new fc(`${t} must be an integer`);if(e<0)throw new fc(`${t} must be a positive integer`);return e},Oae=t=>t instanceof Error?t:new Error(t);var Gje=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};function fXr(t){if(!t)return!0;for(let e in t)return!1;return!0}function pXr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function FDt(t,e){for(let r in e){if(!pXr(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 hU(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var mXr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),$Dt=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";var pc=class{constructor(e){this._client=e}};var HN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",O5({body:e,...r}))}};HN||(HN={});var VN=class extends pc{create(e,r){return this._client.post("/openai/v1/audio/translations",O5({body:e,...r}))}};VN||(VN={});var EI=class extends pc{constructor(){super(...arguments),this.transcriptions=new HN(this._client),this.translations=new VN(this._client)}};(function(t){t.Transcriptions=HN,t.Translations=VN})(EI||(EI={}));var WN=class extends pc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}};WN||(WN={});var TI=class extends pc{constructor(){super(...arguments),this.completions=new WN(this._client)}};(function(t){t.Completions=WN})(TI||(TI={}));var AI=class extends pc{};AI||(AI={});var II=class extends pc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}};II||(II={});var MI=class extends pc{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)}};MI||(MI={});var BDt,bs=class extends Iae{constructor({baseURL:e=Gje("GROQ_BASE_URL"),apiKey:r=Gje("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new fc("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&&$Dt())throw new fc(`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 AI(this),this.chat=new TI(this),this.embeddings=new II(this),this.audio=new EI(this),this.models=new MI(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}`}}};BDt=bs;bs.Groq=BDt;bs.GroqError=fc;bs.APIError=Fl;bs.APIConnectionError=fP;bs.APIConnectionTimeoutError=zN;bs.APIUserAbortError=PI;bs.NotFoundError=lU;bs.ConflictError=cU;bs.RateLimitError=fU;bs.BadRequestError=aU;bs.AuthenticationError=sU;bs.InternalServerError=pU;bs.PermissionDeniedError=uU;bs.UnprocessableEntityError=dU;bs.toFile=Hje;bs.fileFromPath=xae;var{GroqError:bGo,APIError:_Go,APIConnectionError:vGo,APIConnectionTimeoutError:wGo,APIUserAbortError:SGo,NotFoundError:xGo,ConflictError:CGo,RateLimitError:OGo,BadRequestError:PGo,AuthenticationError:EGo,InternalServerError:TGo,PermissionDeniedError:AGo,UnprocessableEntityError:IGo}=Bje;(function(t){t.Completions=AI,t.Chat=TI,t.Embeddings=II,t.Audio=EI,t.Models=MI})(bs||(bs={}));var qDt=bs;Sm();gy();iq();Km();function vXr(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 UDt(t){return t.map(e=>{if(typeof e.content!="string")throw new Error("Non string message content not supported");let r={role:vXr(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 Oi(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Ox):(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 wXr(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let i of r??[])try{n.push(Jp(i,{returnId:!0}))}catch(a){o.push(Xm(i,a.message))}return new gn({content:t.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:e})}default:return new Cs(t.content||"",t.role??"unknown")}}function SXr(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 xXr(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 Mf({content:o})};if(n==="assistant"){let u=SXr(t.tool_calls,e);return{message:new dr({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 Rd({content:o})}:{message:new If({content:o,role:n})}}var Mae=class extends Js{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||ot("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 qDt({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=>dx(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=UDt(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}=xXr({...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 qn({message:new dr({content:"",tool_call_chunks:h}),text:""})}let m=new qn({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 qn({message:new dr({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=UDt(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:wXr(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"}}),Gs(n)?u=Tc.fromZodSchema(n):u=new Ac;else if(Gs(n)){let p=So(n);l=this.bind({tools:[{type:"function",function:{name:s,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:s}}}),u=new Zc({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 Zc({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=go.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=go.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return bi.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}};var td=[];for(Rae=0;Rae<256;++Rae)td.push((Rae+256).toString(16).slice(1));var Rae;function zDt(t,e=0){return(td[t[e+0]]+td[t[e+1]]+td[t[e+2]]+td[t[e+3]]+"-"+td[t[e+4]]+td[t[e+5]]+"-"+td[t[e+6]]+td[t[e+7]]+"-"+td[t[e+8]]+td[t[e+9]]+"-"+td[t[e+10]]+td[t[e+11]]+td[t[e+12]]+td[t[e+13]]+td[t[e+14]]+td[t[e+15]]).toLowerCase()}var jae,CXr=new Uint8Array(16);function Jje(){if(!jae&&(jae=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jae))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jae(CXr)}var OXr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Yje={randomUUID:OXr};function PXr(t,e,r){if(Yje.randomUUID&&!e&&!t)return Yje.randomUUID();t=t||{};var n=t.random||(t.rng||Jje)();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 zDt(n)}var Nae=PXr;var Q4t=F(J4t(),1),e3t=F(L5(),1);gs();fx();Qd();XL();Dn();gy();iq();Sm();Ec();var Ewn=/^[a-zA-Z0-9]{9}$/;function Twn(t){return Ewn.test(t)}function Awn(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 Iwn(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 DLe(t){if(Twn(t))return t;{let e=Iwn(t),r=Awn(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function LLe(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 Y4t(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(Oi(o)&&o.tool_calls?.length)return o.tool_calls.map(i=>({...i,id:DLe(i.id??"")})).map(Ox)};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:DLe(o.tool_call_id)}:Oi(o)?i===void 0?{role:e(o.getType()),content:a}:{role:e(o.getType()),toolCalls:i}:{role:e(o.getType()),content:a}})}function Mwn(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=LLe(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Jp(s,{returnId:!0});i.push({...u,id:u.id??Nae().replace(/-/g,"")})}catch(u){a.push(Xm(s,u.message))}return new gn({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 Os({content:o})}}function Rwn(t,e){if(!t.content&&!t.toolCalls)return e?new dr({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??Nae().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=LLe(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 Mf({content:o}):n==="assistant"?new dr({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 Th({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new ym({content:o,additional_kwargs:i}):new If({content:o,role:n})}function Z4t(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:So(e.schema)}}})}var Ble=class extends Js{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??ot("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?Z4t(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:Z4t(e),...r})}async completionWithRetry(e,r){let n=new _m({maxRetries:this.maxRetries}),o=new Q4t.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=Y4t(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:Mwn(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=Y4t(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=Rwn(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 qn({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 e3t.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"}}),X4t(n)?u=Tc.fromZodSchema(n):u=new Ac;else{let f=o??"extract";if(X4t(n)){let p=So(n);s=this.bind({tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:"any"}),u=new Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function X4t(t){return typeof t?.parse=="function"}Dn();$O();dg();jj();Qd();Dn();dg();jAe();XMe();Dn();pg();gs();Qd();Dn();fx();Wm();Sm();gy();iq();Ec();sq();function CD(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}pg();Ec();Km();function pW(t,e){return t.lc_error_code=e,t.message=`${t.message}
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
`,t}function OD(t){let e;return t.constructor.name===Xf.name?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Li.name?(e=new Error(t.message),e.name="AbortError"):t.status===400&&t.message.includes("tool_calls")?e=pW(t,"INVALID_TOOL_RESULTS"):t.status===401?e=pW(t,"MODEL_AUTHENTICATION"):t.status===429?e=pW(t,"MODEL_RATE_LIMIT"):t.status===404?e=pW(t,"MODEL_NOT_FOUND"):e=t,e}function FLe(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 jwn(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function t3t(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(r3t(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
`)}function r3t(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}: ${qle(o,e)},`):r.push(`${n}?: ${qle(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
`)}function qle(t,e){if(jwn(t))return t.anyOf.map(r=>qle(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["{",r3t(t,e+2),"}"].join(`
`);case"array":return t.items?`${qle(t.items,e)}[]`:"any[]";default:return""}}Km();sq();function n3t(t,e){let r;if(rc(t)){let n=$ne({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:TA(t,e)}}else r=t;return e?.strict!==void 0&&(r.function.strict=e.strict),r}function Nwn(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 BLe(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(!Cs.isInstance(t))throw new Error("Invalid generic chat message");return Nwn(t)}default:throw new Error(`Unknown message type: ${e}`)}}function $Le(t,e){return t.flatMap(r=>{let n=BLe(r);n==="system"&&qLe(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=""),Oi(r)&&r.tool_calls?.length?(o.tool_calls=r.tool_calls.map(Ox),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 zU="__openai_function_call_ids__";function o3t(t,e){return t.flatMap(r=>{let n=BLe(r);if(n==="system"&&qLe(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[zU];if(Oi(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 a3t(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(Jp(s,{returnId:!0}))}catch(u){let l;typeof u=="object"&&u!=null&&"message"in u&&typeof u.message=="string"&&(l=u.message),n.push(Xm(s,l))}i[zU]??(i[zU]={}),i[zU][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 gn({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:t.usage,additional_kwargs:i,response_metadata:o})}function Dwn(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[zU]={[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=a3t(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 qn({text:e.map(u=>u.text).join(""),message:new dr({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}function kLe(t){return"type"in t&&t.type!=="function"}function Lwn(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function i3t(t,e){return Wc(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:n3t(t,e)}function qLe(t){return t?.startsWith("o1")||t?.startsWith("o3")}var mW=class extends Js{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??ot("OPENAI_API_KEY"),this.apiKey=this.openAIApiKey,this.organization=e?.configuration?.organization??ot("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=>kLe(o)?o:i3t(o,{strict:n})),...r})}createResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Ule(e.json_schema.schema)?aq(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=>kLe(l)?l:Wc(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:Lwn(e?.tool_choice)?e?.tool_choice:(()=>{let l=FLe(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=>i3t(s,{strict:n})):void 0,tool_choice:FLe(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),qLe(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(Jp(u,{returnId:!0}))}catch(l){i.push(Xm(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 gn({content:e.content||"",tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:r.id})}default:return new Cs(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 Mf({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 dr({content:i,tool_call_chunks:u,additional_kwargs:a,id:r.id,response_metadata:s})}else return o==="system"?new Rd({content:i,response_metadata:s}):o==="developer"?new Rd({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new ym({content:i,additional_kwargs:a,name:e.name,response_metadata:s}):o==="tool"?new Th({content:i,additional_kwargs:a,tool_call_id:e.tool_call_id,response_metadata:s}):new If({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:o3t(e,this.model),stream:!0},r);for await(let c of l){let d=Dwn(c);d!=null&&(yield d)}return}let o=$Le(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 qn({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 qn({message:new dr({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=o3t(e,this.model),a=await this.responseApiWithRetry({input:i,...o},{signal:r?.signal,...r?.options});return{generations:[{text:a.output_text,message:a3t(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(kLe),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=$Le(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}:{}},Oi(b.message)&&(b.message.usage_metadata=o),b.message=new gn(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=t3t(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(BLe(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 OD(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 OD(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 OD(o)}})}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=CD(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new Wt(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;Fwn(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"}}),Ule(n)?u=Tc.fromZodSchema(n):u=new Ac;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}}}),Ule(n)){let f=Tc.fromZodSchema(n);u=Nf.from(p=>"parsed"in p.additional_kwargs?p.additional_kwargs.parsed:f)}else u=new Ac;else{let f=o??"extract";if(Ule(n)){let p=So(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 Zc({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 Zc({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=go.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=go.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return bi.from([{raw:s},d])}};function Ule(t){return typeof t?.parse=="function"}function Fwn(t){return t!==void 0&&typeof t.schema=="object"}Dn();Wm();Qd();Dn();jj();dg();Dn();Dn();Dn();$O();dg();Dn();pg();ZA();var ULe=class extends ZO{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??ot("OPENAI_API_KEY"),n=e?.organization??ot("OPENAI_ORGANIZATION"),o={apiKey:r,organization:n,dangerouslyAllowBrowser:!0,baseUrl:e?.baseUrl};this.client=new Wt(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(ULe,"toolName",{enumerable:!0,configurable:!0,writable:!0,value:"dalle_api_wrapper"});var zle=class extends mW{static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}constructor(e){let r=e?.apiKey||ot("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 Hle=require("obsidian"),kwn={openai:Px,"azure openai":Px,anthropic:bae,cohereai:kre,google:Vre,xai:zle,openrouterai:Px,ollama:Yre,"lm-studio":Px,groq:Mae,"3rd party (openai-format)":Px,"copilot-plus":Px,mistralai:Ble,deepseek:wae},PD=class t{constructor(){this.providerApiKeyMap={openai:()=>ue().openAIApiKey,google:()=>ue().googleApiKey,"azure openai":()=>ue().azureOpenAIApiKey,anthropic:()=>ue().anthropicApiKey,cohereai:()=>ue().cohereApiKey,openrouterai:()=>ue().openRouterAiApiKey,groq:()=>ue().groqApiKey,xai:()=>ue().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ue().plusLicenseKey,mistralai:()=>ue().mistralApiKey,deepseek:()=>ue().deepseekApiKey};this.buildModelMap(),xa(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}async getModelConfig(e){let r=ue(),n=e.name,o=LR(n),i=n.startsWith("claude-3-7-sonnet")||n.startsWith("claude-sonnet-4"),a={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors};i||(a.temperature=e.temperature??r.temperature);let u={openai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,organization:await eo(e.openAIOrgId||r.openAIOrgId)},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},anthropic:{anthropicApiKey:await eo(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Us:void 0},...i&&{thinking:{type:"enabled",budget_tokens:1024}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,openAIApiKey:await eo(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 eo(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Us:void 0},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},cohereai:{apiKey:await eo(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await eo(e.apiKey||r.googleApiKey),modelName:n,safetySettings:[{category:Nj.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_HATE_SPEECH,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:Dj.BLOCK_NONE},{category:Nj.HARM_CATEGORY_HARASSMENT,threshold:Dj.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await eo(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,openAIApiKey:await eo(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Us:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}}},groq:{apiKey:await eo(e.apiKey||r.groqApiKey),modelName:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await eo(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,openAIApiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Us:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await eo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Us:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature)},"copilot-plus":{modelName:n,openAIApiKey:await eo(r.plusLicenseKey),configuration:{baseURL:VE,fetch:e.enableCors?Us:void 0}},mistralai:{model:n,apiKey:await eo(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await eo(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||hF.deepseek.host,fetch:e.enableCors?Us:void 0}}}[e.provider]||{},l=this.getProviderSpecificParams(e.provider,e),c=i?{maxTokens:e.maxTokens??r.maxTokens}:this.handleOpenAIExtraArgs(o,e.maxTokens??r.maxTokens,e.temperature??r.temperature),d={...a,...u,...l,...c};return i&&delete d.temperature,d}handleOpenAIExtraArgs(e,r,n){return e?{maxCompletionTokens:r,temperature:n===void 0?void 0:1}:{maxTokens:r,temperature:n}}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=ue().activeModels;t.modelMap={};let r=t.modelMap;(e??Zb).forEach(o=>{if(o.enabled){if(!Object.values(DC).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=kr(o);r[u]={hasApiKey:!!(o.apiKey||s),AIConstructor:i,vendor:o.provider}}})}getProviderConstructor(e){let r=kwn[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(!t.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return t.chatModel}async setChatModel(e){let r=kr(e);try{let n=await this.createModelInstance(e);t.chatModel=n}catch(n){fe(n),new Hle.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=kr(e),n=t.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 Hle.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 yy(async()=>t.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return ie("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!t.chatModel)return;let e=mJ();if(!e)return;t.modelMap[e]?.hasApiKey||(t.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=LR(o.name),d=this.handleOpenAIExtraArgs(c,30,i.temperature);await new(this.getProviderConstructor(o))({...l,...d}).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 Hle.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: `+ei(n)+`
with CORS Error: `+ei(o);throw new Error(i)}}}findModelByName(e){return ue().activeModels.find(n=>n.name===e)}};nr();gs();var HU=class{},s3t=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},Vle=(t,e)=>{let r=s3t(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},zLe=(t,e)=>{let r=s3t(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};yR();OR();var HLe=class extends gp{addUserMessage(e){return this.addMessage(new Os(e))}addAIChatMessage(e){return this.addMessage(new gn(e))}addAIMessage(e){return this.addMessage(new gn(e))}async addMessages(e){for(let r of e)await this.addMessage(r)}clear(){throw new Error("Not implemented.")}},VU=class extends HLe{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 gb=class extends HU{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 VU,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(Vle(e,this.inputKey)),await this.chatHistory.addAIChatMessage(zLe(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};var hW=class extends gb{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]:Rf(r,this.humanPrefix,this.aiPrefix)}}};gs();gs();VLe();qE();gs();var gW=class extends gb{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]:Rf(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};rie();Mhe();gs();yR();VLe();gs();gs();var yW=class t{constructor(){this.initMemory(),xa(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ue().contextTurns;this.memory=new gW({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)}};nr();qE();Cl();var bW=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),xa(()=>{this.initChatPrompt(),this.initQAPrompt()}),SF(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Yb(),r=Mc();r&&zR()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=xp.fromMessages([BE.fromTemplate(n),new Gb("history"),Jb.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=xp.fromMessages([BE.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 _W=class{constructor(e,r){this.retrievedDocuments=[];this.chatMessages=[];this.chatMessages=[],this.app=e,this.vectorStoreManager=r,this.memoryManager=yW.getInstance(),this.chatModelManager=PD.getInstance(),this.promptManager=bW.getInstance(),this.initialize(),xa(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 Wle.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!fVe(this.chain))&&(console.error("Chain is not initialized properly, re-initializing chain: ",Fh()),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=Fh(),o=Mc();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:mJ();if(!i)throw new Wle.Notice("No model key found"),new Error("No model key found");try{if(r){let a=eJ(i,ue().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=Zb[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ue().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new Wle.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),ie(`Setting model to ${i}`)}catch(a){fe(`createChainWithNewModel failed: ${a}`),ie(`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=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=new Rx({minSimilarityScore:.01,maxK:ue().maxSourceChunks,salientTerms:[]});this.retrievalChain=c4.createConversationalRetrievalChain({llm:n,retriever:a,systemMessage:Yb()},this.storeRetrieverDocuments.bind(this),ue().debug),qR("vault_qa"),ue().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=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=c4.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),qR("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=Fh();switch(e){case"llm_chain":return new qie(this);case"vault_qa":return new Uie(this);case"copilot_plus":return new e5(this);case"project":return new zie(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||LR(u)){let c=xp.fromMessages([new Gb("history"),Jb.fromTemplate("{input}")]);LR(u)&&(c=xp.fromMessages([[Pi,Yb()||""],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===Pi&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}clearHistory(){this.chatMessages=[]}getChatMessages(){return this.chatMessages}setChatMessages(e){this.chatMessages=[...e]}addChatMessage(e){this.chatMessages.push(e)}};var ac=class t{constructor(e,r,n){this.defaultProjectKey="defaultProjectKey";this.app=e,this.plugin=n,this.currentProjectId=null,this.chainMangerInstance=new _W(e,r),this.projectContextCache=tb.getInstance(),this.chatMessageCache=new Map,this.fileParserManager=new oI(Fi.getInstance(),this.app.vault,!0,null),ZVe(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),XVe(async()=>{zR()||await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:ue().indexVaultToVectorStore==="ON MODE SWITCH"&&(Fh()==="vault_qa"||Fh()==="copilot_plus")})}),SF(async o=>{await this.switchProject(o)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){xa(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}async switchProject(e){try{if(GE(!0),ie("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 oI(Fi.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),ie(`Switched to project: ${e.name}`)}catch(r){throw fe(`Failed to switch project: ${r}`),r}finally{GE(!1)}}async saveCurrentProjectMessage(){this.chatMessageCache.set(this.currentProjectId?this.currentProjectId:this.defaultProjectKey,this.getCurrentChainManager().getChatMessages()),await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){let e=this.getCurrentChainManager(),r=this.chatMessageCache.get(this.currentProjectId?this.currentProjectId:this.defaultProjectKey)??[];e.setChatMessages(r),await _N(r,e.memoryManager)}async loadProjectContext(e){try{if(!e.contextSource)return Mh(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;ie(`[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?ie(`[loadProjectContext] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${n.markdownNeedsReload}`):ie(`[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(ie(`[loadProjectContext] Project ${e.name}: Checking ${i} fileContexts for non-markdown processing.`),i>0){this.fileParserManager=new oI(Fi.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 vW.TFile&&u.extension!=="md"&&this.fileParserManager.supportsExtension(u.extension))try{await this.projectContextCache.getFileContext(e,s)||(ie(`[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),SN(l))throw l}}a>0&&ie(`[loadProjectContext] Project ${e.name}: Processed and cached ${a} non-markdown files.`)}}return o.timestamp=Date.now(),await this.projectContextCache.set(e,o),ie(`[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),ie(`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(Es)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ue().projectList.find(o=>o.id===e);if(!r)return Mh(`[getProjectContext] Project not found for ID: ${e}`),null;ie(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?ie(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):ie(`[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 ie(`[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){ie(`[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&&ie(`[processMarkdownFiles] Project ${e.name}: Added ${o-n} new file references via updateProjectFilesFromPatterns.`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){ie(`[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,ie(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else ie(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`)}return ie(`[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}=rf({inclusions:e,exclusions:r,isProject:!0}),a=this.app.vault.getFiles().filter(u=>u.extension==="md"&&eu(u,o,i));ie(`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),ie(`Completed processing markdown file: ${u.path}`)}catch(d){fe(`Error processing file ${u.path}: ${d}`),l=`[Error: ${ei(d)}]`}return`${c}
${l}`}));return ie("All markdown files processed for project context"),s.join(`
`)}async processWebUrls(e,r){ie(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(ie(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());ie(`[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&&ie(`[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){ie(`[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&&ie(`[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&&Mh(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),ie(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){ie(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(ie(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
`).filter(c=>c.trim());ie(`[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&&ie(`[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){ie(`[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&&ie(`[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&&Mh(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),ie(`[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=Cq.getInstance(),{urlContext:n}=await r.processUrls(e);return n||""}catch(r){return fe(`Failed to process web URLs: ${r}`),new vW.Notice(`Failed to process web URLs: ${ei(r)}`),""}}async processYoutubeUrlsContext(e){if(!e?.trim())return"";let n=e.split(`
`).filter(i=>i.trim()).map(async i=>{try{let a=await Fi.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 vW.Notice(`Failed to process YouTube URL ${i}: ${ei(a)}`),""}});return(await Promise.all(n)).join("")}onunload(){this.projectContextCache.cleanup()}};Cl();$r();yo();nr();WLe();$r();mg();yo();nr();var Vg=require("@codemirror/view"),QP=require("@codemirror/state");function f3t(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 Uwn=Object.defineProperty,zwn=(t,e,r)=>e in t?Uwn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,WU=(t,e,r)=>(zwn(t,typeof e!="symbol"?e+"":e,r),r),Kle=QP.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(ZLe));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),ZLe=QP.StateEffect.define();function Hwn(t,e){let r=t.state.selection.main.head,n=[],o=Vg.Decoration.widget({widget:new KLe(e),side:1});return n.push(o.range(r)),Vg.Decoration.set(n)}var KLe=class extends Vg.WidgetType{constructor(e){super(),WU(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}},GLe=t=>{let e=0;return Vg.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:ZLe.of({suggestion:i,doc:n})})}}})},JLe=class{constructor(){WU(this,"decorations"),this.decorations=Vg.Decoration.none}update(e){var r;let n=(r=e.state.field(Kle))==null?void 0:r.suggestion;if(!n){this.decorations=Vg.Decoration.none;return}this.decorations=Hwn(e.view,n.display_suggestion)}},p3t=Vg.ViewPlugin.fromClass(JLe,{decorations:t=>t.decorations}),YLe=class{constructor(e,r){WU(this,"suggestFn"),WU(this,"keymap"),WU(this,"completionId"),WU(this,"run",n=>{var o,i;let a=(o=n.state.field(Kle))==null?void 0:o.suggestion;return a?(n.dispatch({...Vwn(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:ZLe.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=QP.Prec.highest(Vg.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function Vwn(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:QP.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:QP.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function m3t(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function Wwn(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield m3t(r);return}for await(let n of r)yield m3t(n)}}function Gle(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=Wwn(t.fetchFn),{debounced:o,force:i}=f3t(n,e);return{extension:r?[Kle,GLe(o),p3t,new YLe(t.continue_suggesting?n:null,r).keymap]:[Kle,GLe(o),p3t],force_fetch:i}}var rFe=require("obsidian");var XLe=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"))}},QLe=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}},eFe=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}},Jle=class{constructor(){this.processors=[];this.processors.push(new eFe),this.processors.push(new XLe),this.processors.push(new QLe)}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}};d4();var h3t=require("obsidian");function g3t(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 y3t(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 h3t.TFile&&(r.push(i),r.length>=e))break}return r}Qoe();nr();var tFe=require("obsidian"),Kwn=.4,Gwn=20,b3t=.7,Yle=.3;async function Jwn(t,e){let r=ue().debug,n=await eP.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 Ywn(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 Zwn(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 Xwn({db:t,filePath:e}){let r=ue().debug,n=await Jwn(e,t),o=Ywn(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await eP.getDocsByEmbedding(t,o,{limit:Gwn,similarity:Kwn});return Zwn(i,e)}function Qwn(t){let e=new Map,n=g3t(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=y3t(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 e0n(t,e){let r=new Map,n=b3t+Yle;for(let[o,i]of t)r.set(o,i*b3t/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Yle:(i.links||i.backlinks)&&(a=Yle*.8),r.set(o,(r.get(o)??0)+a)}return r}async function Xle({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof tFe.TFile))return[];let n=await Xwn({db:t,filePath:e}),o=Qwn(r),i=e0n(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=Zle(n.get(l)??0),f=Zle(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 tFe.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 Zle(t){return t>.7?3:t>.55?2:1}Ix();var _3t=require("obsidian"),t0n={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 r0n(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function v3t(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(t0n).some(n=>r0n(r,n)))return!0;return!1}function w3t(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 YI=class YI{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return YI.instance||(YI.instance=new YI),YI.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 ma.getInstance().getDb(),o=(await Xle({db:r,filePath:e.path})).slice(0,YI.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 _3t.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=[]}};YI.MAX_RELEVANT_NOTES=3;var Qle=YI;var ED=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 SW=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}};yo();var S3t=require("obsidian");var xW=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new ED}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 S3t.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")}};yo();var yb=class yb{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...yb.DEFAULT_SETTINGS},this.performance={...yb.DEFAULT_PERFORMANCE},this.tokenizer=new ED,this.trie=new SW(this.performance.maxTrieSize),this.scanner=new xW(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return yb.instance||(yb.instance=new yb(e)),yb.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(),yb.instance=null}};yb.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},yb.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var TD=yb;yo();var n0n=require("obsidian");var ece=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=wW.getInstance(),this.client=Fi.getInstance(),this.postProcessor=new Jle,this.wordCompletionManager=TD.getInstance(app.vault);let r=ue().autocompleteAcceptKey||Nh.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=xa(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ue().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){fe("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=Gle({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(rFe.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 v3t(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(rFe.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=w3t(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=ue();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(E=>E.word),g=o.slice(-1e3),y=a.slice(0,500),S,x,O;if(this.cacheEnabled&&(x=this.cache.generateWordKey(g,y,b),O=this.cache.get(x)),O)S=O;else{let E=this.client.wordcomplete(g,y,b);this.activeRequests.set(d,E),this.lastRequestTime=s,S=await E,this.cacheEnabled&&x&&this.cache.set(x,S),this.activeRequests.delete(d)}let P=S.response.selected_word;if(P&&P!==c){let E=this.generateCaseMatchedCompletion(P,c);E&&(yield{display_suggestion:E,complete_suggestion:E})}}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 Qle.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 S=b.response.completion,x=this.detectContext(o);S=this.postProcessor.process(c,a,S,x),yield{display_suggestion:S,complete_suggestion:S}}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 tce=class t{constructor(e){this.plugin=e;let r=ue();this.cmIntegration=ece.getInstance({delay:Nh.DELAY_MS,minTriggerLength:Nh.MIN_TRIGGER_LENGTH,maxContextLength:Nh.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=xa((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()}};Cl();Fd();var x3t=require("obsidian"),rce=class extends x3t.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()}};L8();var ZI=require("obsidian"),nce=class extends ZI.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 ZI.Notice("Database not found");return}let s=await Xc(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 ZI.TFile?await this.app.vault.modify(c,u):await this.app.vault.create(l,u);let d=this.app.vault.getAbstractFileByPath(l);d instanceof ZI.TFile&&(await this.app.workspace.getLeaf().openFile(d),this.close())}catch(i){console.error("Error in debug search:",i),new ZI.Notice("Error executing search. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};Cn();var CW=require("obsidian"),oce=class extends CW.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=NC(o,this.app.vault).map(a=>a.path);if(i.length===0){new CW.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 CW.Notice("Error searching database. Check console for details.")}})}onClose(){let{contentEl:e}=this;e.empty()}};var OW=require("obsidian"),ice=class extends OW.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 OW.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 OW.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()}};_g();nr();var Ji=require("obsidian");l2();$r();function df(t,e,r){t.addCommand({id:e,name:ige[e],callback:r})}function C3t(t,e,r){t.addCommand({id:e,name:ige[e],editorCallback:r})}function nFe(t,e,r){C3t(t,Br.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 Ji.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),df(t,Br.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await JRt(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Ji.Notice(`Total tokens in your vault: ${o}`)}catch(n){console.error("Error counting tokens: ",n),new Ji.Notice("An error occurred while counting tokens.")}}),df(t,Br.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),df(t,Br.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),df(t,Br.NEW_CHAT,()=>{t.newChat()}),df(t,Br.APPLY_ADHOC_PROMPT,async()=>{new rce(t.app,async o=>{try{t.processCustomPrompt(Br.APPLY_ADHOC_PROMPT,o)}catch(i){console.error(i),new Ji.Notice("An error occurred.")}}).open()}),df(t,Br.CLEAR_LOCAL_COPILOT_INDEX,async()=>{await t.vectorStoreManager.clearIndex()}),df(t,Br.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.garbageCollectVectorStore();new Ji.Notice(`${n} documents removed from Copilot index.`)}catch(n){console.error("Error garbage collecting the Copilot index:",n),new Ji.Notice("An error occurred while garbage collecting the Copilot index.")}}),df(t,Br.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore();new Ji.Notice(`${n} vault files indexed to Copilot index.`)}catch(n){console.error("Error indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while indexing vault to Copilot index.")}}),df(t,Br.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let n=await t.vectorStoreManager.indexVaultToVectorStore(!0);new Ji.Notice(`${n} vault files re-indexed to Copilot index.`)}catch(n){console.error("Error re-indexing vault to Copilot index:",n),new Ji.Notice("An error occurred while re-indexing vault to Copilot index.")}}),df(t,Br.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),df(t,Br.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 Ji.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 Ji.TFile?await t.app.vault.modify(p,c):await t.app.vault.create(f,c);let m=t.app.vault.getAbstractFileByPath(f);m instanceof Ji.TFile&&(await t.app.workspace.getLeaf().openFile(m),new Ji.Notice(`Listed ${n.length} indexed files`))}catch(n){console.error("Error listing indexed files:",n),new Ji.Notice("Failed to list indexed files.")}}),r.debug&&(df(t,Br.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,()=>{new oce(t.app,t).open()}),df(t,Br.SEARCH_ORAMA_DB,()=>{new nce(t.app,t).open()}),df(t,Br.REMOVE_FILES_FROM_COPILOT_INDEX,async()=>{new ice(t.app,async n=>{let o=await t.vectorStoreManager.getDbOps();try{for(let i of n)await o.removeDocs(i);await o.saveDB(),new Ji.Notice(`Successfully removed ${n.length} files from the index.`)}catch(i){console.error("Error removing files from index:",i),new Ji.Notice("An error occurred while removing files from the index.")}}).open()})),df(t,Br.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await tb.getInstance().clearAllCache(),await xq.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(WLe(),d3t));o.getInstance().clear(),new Ji.Notice("All Copilot caches cleared successfully")}catch(n){console.error("Error clearing Copilot caches:",n),new Ji.Notice("Failed to clear Copilot caches")}}),df(t,Br.TOGGLE_AUTOCOMPLETE,()=>{let o=!ue().enableAutocomplete;dt("enableAutocomplete",o),new Ji.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),C3t(t,Br.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=Fh();if(o!=="copilot_plus"&&o!=="project"){new Ji.Notice("Selected text context is only available in Copilot Plus and Project modes");return}let i=n.getSelection();if(!i){new Ji.Notice("No text selected");return}let a=t.app.workspace.getActiveFile();if(!a){new Ji.Notice("No active file");return}let s=n.listSelections()[0];if(!s){new Ji.Notice("Could not determine selection range");return}let u=s.anchor.line+1,l=s.head.line+1,c={id:yC(),content:i,noteTitle:a.basename,notePath:a.path,startLine:Math.min(u,l),endLine:Math.max(u,l)};e8e(c),t.activateView()})}Cl();Fd();var oFe="{copilot-selection}";var XI={title:"",content:"",showInContextMenu:!1,showInSlashMenu:!1,order:Number.MAX_SAFE_INTEGER,modelKey:"",lastUsedMs:0},AD="copilot-command-context-menu-enabled",ID="copilot-command-slash-enabled",MD="copilot-command-context-menu-order",RD="copilot-command-model-key",jD="copilot-command-last-used",O3t=[{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 KU=require("obsidian");nr();s4();s4();var eE=lF(),tE=Ih([]);function ace(t){let e=eE.get(tE);e.some(r=>r.title===t)||eE.set(tE,[...e,{...XI,title:t}])}function PW(t){let e=eE.get(tE);eE.set(tE,e.filter(r=>r.title!==t))}function EW(t,e){let r=eE.get(tE),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],eE.set(tE,n)}function sce(t){eE.set(tE,t)}function P3t(){return i4(tE,{store:eE})}function Gx(){return eE.get(tE)}d4();Cn();$r();function GU(t,e,r){let n=t.trim();return r&&n===r?null:/[#<>:"/\\|?*[\]^\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}function JU(t){return encodeURIComponent(t.toLowerCase())}function QI(){return(0,KU.normalizePath)(ue().customPromptsFolder)}function ND(t){return`${QI()}/${t}.md`}function YU(t){if(!(t instanceof KU.TFile)||t.extension!=="md")return!1;let e=QI();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function o0n(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}async function TW(t){let e=await app.vault.read(t),r=o0n(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[AD]??XI.showInContextMenu,i=n?.frontmatter?.[ID]??XI.showInSlashMenu,a=n?.frontmatter?.[jD]??XI.lastUsedMs,s=n?.frontmatter?.[MD]??XI.order,u=n?.frontmatter?.[RD]??XI.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function uce(){let t=app.vault.getFiles().filter(r=>YU(r)),e=await Promise.all(t.map(TW));return sce(e),e}function AW(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function i0n(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function a0n(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function E3t(t){switch(ue().promptSortStrategy){case"timestamp":return i0n(t);case"alphabetical":return a0n(t);case"manual":return AW(t);default:return t}}async function iFe(t,e,r=!1){let o=(await lce(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes("{selectedText}")||r)return o;let i=o.indexOf(oFe);return i===-1&&e.trim()?o+`
<selectedText>`+e+"</selectedText>":o.slice(0,i)+e+o.slice(i+oFe.length)}var s0n=/\{(?!copilot-selection\})([^}]+)\}/g;async function u0n(t,e,r){let n=new Map,o=new Set,i;for(;(i=s0n.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await pF(r,e);u&&(s.content=`## ${QG(r)}
${u}`,s.files.push(r))}else new KU.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await dVe(e,u),c=[];for(let d of l){let f=await pF(d,e);f&&(c.push(`## ${QG(d)}
${f}`),s.files.push(d))}s.content=c.join(`
`)}else{let u=mVe(a),l=await Jhe(e,u),c=[];for(let d of l){let f=await pF(d,e);f&&(c.push(`## ${QG(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 lce(t,e,r,n){let o=ue(),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 u0n(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 pF(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=NC(u,r);for(let f of d)if(!i.has(f)){let p=await pF(f,r);if(p){let m=`<${f4}>
Title: [[${f.basename}]]
Path: ${f.path}
${p}
</${f4}>`;l&&(l+=`
`),l+=`${m}`,i.add(f)}}return{processedPrompt:l?`${u}
${l}`:`${u}
`,includedFiles:Array.from(i)}}Cl();Fd();ti();var T3t=require("obsidian"),DD=F(X()),A3t=F(Dc());function l0n({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return DD.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},DD.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),DD.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&DD.default.createElement(ge,{variant:"secondary",onClick:r},o),n&&DD.default.createElement(ge,{variant:"default",onClick:e},n)))}var sd=class extends T3t.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,A3t.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(DD.default.createElement(l0n,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};ti();var $i=F(X());var $l=F(X(),1);function IW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var c0n=F(X(),1);function I3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function cce(...t){return e=>{let r=!1,n=t.map(o=>{let i=I3t(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():I3t(t[o],null)}}}}var Wg=F(X(),1),aFe=F(ft(),1);function M3t(t,e){let r=Wg.createContext(e),n=i=>{let{children:a,...s}=i,u=Wg.useMemo(()=>s,Object.values(s));return(0,aFe.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=Wg.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 Yi(t,e=[]){let r=[];function n(i,a){let s=Wg.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=Wg.useMemo(()=>m,Object.values(m));return(0,aFe.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Wg.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=>Wg.createContext(a));return function(s){let u=s?.[t]||i;return Wg.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,d0n(o,...e)]}function d0n(...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 Wg.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var eM=F(X(),1);var ZU=F(X(),1);function Ur(t){let e=ZU.useRef(t);return ZU.useEffect(()=>{e.current=t}),ZU.useMemo(()=>(...r)=>e.current?.(...r),[])}function ud({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=f0n({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Ur(r),u=eM.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 f0n({defaultProp:t,onChange:e}){let r=eM.useState(t),[n]=r,o=eM.useRef(n),i=Ur(e);return eM.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var R3t=F(X(),1),y0n=F(ds(),1);var ld=F(X(),1);var XU=F(ft(),1),uFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t,o=ld.Children.toArray(r),i=o.find(m0n);if(i){let a=i.props.children,s=o.map(u=>u===i?ld.Children.count(a)>1?ld.Children.only(null):ld.isValidElement(a)?a.props.children:null:u);return(0,XU.jsx)(sFe,{...n,ref:e,children:ld.isValidElement(a)?ld.cloneElement(a,void 0,s):null})}return(0,XU.jsx)(sFe,{...n,ref:e,children:r})});uFe.displayName="Slot";var sFe=ld.forwardRef((t,e)=>{let{children:r,...n}=t;if(ld.isValidElement(r)){let o=g0n(r);return ld.cloneElement(r,{...h0n(n,r.props),ref:e?cce(e,o):o})}return ld.Children.count(r)>1?ld.Children.only(null):null});sFe.displayName="SlotClone";var p0n=({children:t})=>(0,XU.jsx)(XU.Fragment,{children:t});function m0n(t){return ld.isValidElement(t)&&t.type===p0n}function h0n(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 g0n(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 j3t=F(ft(),1),b0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],N3t=b0n.reduce((t,e)=>{let r=R3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?uFe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,j3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var zt=F(X(),1);function Zi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var rM=F(X(),1);var L3t=F(X(),1);function D3t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function MW(...t){return e=>{let r=!1,n=t.map(o=>{let i=D3t(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():D3t(t[o],null)}}}}function cd(...t){return L3t.useCallback(MW(...t),t)}var dd=F(X(),1);var QU=F(ft(),1),tM=dd.forwardRef((t,e)=>{let{children:r,...n}=t,o=dd.Children.toArray(r),i=o.find(v0n);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,QU.jsx)(lFe,{...n,ref:e,children:dd.isValidElement(a)?dd.cloneElement(a,void 0,s):null})}return(0,QU.jsx)(lFe,{...n,ref:e,children:r})});tM.displayName="Slot";var lFe=dd.forwardRef((t,e)=>{let{children:r,...n}=t;if(dd.isValidElement(r)){let o=S0n(r);return dd.cloneElement(r,{...w0n(n,r.props),ref:e?MW(e,o):o})}return dd.Children.count(r)>1?dd.Children.only(null):null});lFe.displayName="SlotClone";var _0n=({children:t})=>(0,QU.jsx)(QU.Fragment,{children:t});function v0n(t){return dd.isValidElement(t)&&t.type===_0n}function w0n(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 S0n(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 dce=F(ft(),1);function F3t(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=rM.default.useRef(null),g=rM.default.useRef(new Map).current;return(0,dce.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=rM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=cd(m,g.collectionRef);return(0,dce.jsx)(tM,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=rM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=rM.default.useRef(null),S=cd(m,y),x=i(l,h);return rM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,dce.jsx)(tM,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return rM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var fce=F(X(),1),x0n=F(ft(),1),C0n=fce.createContext(void 0);function nM(t){let e=fce.useContext(C0n);return t||e||"ltr"}var Qa=F(X(),1);var k3t=F(X(),1),$3t=F(ds(),1);var B3t=F(ft(),1),O0n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_c=O0n.reduce((t,e)=>{let r=k3t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?tM:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,B3t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function pce(t,e){t&&$3t.flushSync(()=>t.dispatchEvent(e))}var q3t=F(X(),1);function oM(t,e=globalThis?.document){let r=Ur(t);q3t.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 dFe=F(ft(),1),P0n="DismissableLayer",cFe="dismissableLayer.update",E0n="dismissableLayer.pointerDownOutside",T0n="dismissableLayer.focusOutside",U3t,H3t=Qa.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fFe=Qa.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Qa.useContext(H3t),[c,d]=Qa.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Qa.useState({}),m=cd(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=M0n(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=R0n(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Qa.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(U3t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),z3t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=U3t)}},[c,f,r,l]),Qa.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),z3t())},[c,l]),Qa.useEffect(()=>{let E=()=>p({});return document.addEventListener(cFe,E),()=>document.removeEventListener(cFe,E)},[]),(0,dFe.jsx)(_c.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Zi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Zi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Zi(t.onPointerDownCapture,O.onPointerDownCapture)})});fFe.displayName=P0n;var A0n="DismissableLayerBranch",I0n=Qa.forwardRef((t,e)=>{let r=Qa.useContext(H3t),n=Qa.useRef(null),o=cd(e,n);return Qa.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,dFe.jsx)(_c.div,{...t,ref:o})});I0n.displayName=A0n;function M0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1),o=Qa.useRef(()=>{});return Qa.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){V3t(E0n,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 R0n(t,e=globalThis?.document){let r=Ur(t),n=Qa.useRef(!1);return Qa.useEffect(()=>{let o=i=>{i.target&&!n.current&&V3t(T0n,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 z3t(){let t=new CustomEvent(cFe);document.dispatchEvent(t)}function V3t(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?pce(o,i):o.dispatchEvent(i)}var K3t=F(X(),1),pFe=0;function iM(){K3t.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??W3t()),document.body.insertAdjacentElement("beforeend",t[1]??W3t()),pFe++,()=>{pFe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),pFe--}},[])}function W3t(){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 Kg=F(X(),1);var X3t=F(ft(),1),mFe="focusScope.autoFocusOnMount",hFe="focusScope.autoFocusOnUnmount",G3t={bubbles:!1,cancelable:!0},j0n="FocusScope",gFe=Kg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Kg.useState(null),l=Ur(o),c=Ur(i),d=Kg.useRef(null),f=cd(e,h=>u(h)),p=Kg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Kg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:aM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||aM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&aM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Kg.useEffect(()=>{if(s){Y3t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(mFe,G3t);s.addEventListener(mFe,l),s.dispatchEvent(g),g.defaultPrevented||(N0n($0n(Q3t(s)),{select:!0}),document.activeElement===h&&aM(s))}return()=>{s.removeEventListener(mFe,l),setTimeout(()=>{let g=new CustomEvent(hFe,G3t);s.addEventListener(hFe,c),s.dispatchEvent(g),g.defaultPrevented||aM(h??document.body,{select:!0}),s.removeEventListener(hFe,c),Y3t.remove(p)},0)}}},[s,l,c,p]);let m=Kg.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,[S,x]=D0n(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&aM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&aM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,X3t.jsx)(_c.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});gFe.displayName=j0n;function N0n(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(aM(n,{select:e}),document.activeElement!==r)return}function D0n(t){let e=Q3t(t),r=J3t(e,t),n=J3t(e.reverse(),t);return[r,n]}function Q3t(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 J3t(t,e){for(let r of t)if(!L0n(r,{upTo:e}))return r}function L0n(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 F0n(t){return t instanceof HTMLInputElement&&"select"in t}function aM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&F0n(t)&&e&&t.select()}}var Y3t=k0n();function k0n(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Z3t(t,e),t.unshift(e)},remove(e){t=Z3t(t,e),t[0]?.resume()}}}function Z3t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function $0n(t){return t.filter(e=>e.tagName!=="A")}var mce=F(X(),1);var eHt=F(X(),1),Jn=globalThis?.document?eHt.useLayoutEffect:()=>{};var B0n=mce.useId||(()=>{}),q0n=0;function hl(t){let[e,r]=mce.useState(B0n());return Jn(()=>{t||r(n=>n??String(q0n++))},[t]),t||(e?`radix-${e}`:"")}var lh=F(X(),1);var tHt=["top","right","bottom","left"];var Jx=Math.min,rp=Math.max,jW=Math.round,NW=Math.floor,bb=t=>({x:t,y:t}),U0n={left:"right",right:"left",bottom:"top",top:"bottom"},z0n={start:"end",end:"start"};function gce(t,e,r){return rp(t,Jx(e,r))}function Yx(t,e){return typeof t=="function"?t(e):t}function Zx(t){return t.split("-")[0]}function LD(t){return t.split("-")[1]}function yce(t){return t==="x"?"y":"x"}function bce(t){return t==="y"?"height":"width"}function rE(t){return["top","bottom"].includes(Zx(t))?"y":"x"}function _ce(t){return yce(rE(t))}function rHt(t,e,r){r===void 0&&(r=!1);let n=LD(t),o=_ce(t),i=bce(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=RW(a)),[a,RW(a)]}function nHt(t){let e=RW(t);return[hce(t),e,hce(e)]}function hce(t){return t.replace(/start|end/g,e=>z0n[e])}function H0n(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 oHt(t,e,r,n){let o=LD(t),i=H0n(Zx(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(hce)))),i}function RW(t){return t.replace(/left|right|bottom|top/g,e=>U0n[e])}function V0n(t){return{top:0,right:0,bottom:0,left:0,...t}}function yFe(t){return typeof t!="number"?V0n(t):{top:t,right:t,bottom:t,left:t}}function FD(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 iHt(t,e,r){let{reference:n,floating:o}=t,i=rE(e),a=_ce(e),s=bce(a),u=Zx(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(LD(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var uHt=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}=iHt(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:S,data:x,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=S??d,p={...p,[b]:{...p[b],...x}},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}=iHt(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function ez(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}=Yx(e,t),m=yFe(p),b=s[f?d==="floating"?"reference":"floating":d],g=FD(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,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),x=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},O=FD(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:S,strategy:u}):y);return{top:(g.top-O.top+m.top)/x.y,bottom:(O.bottom-g.bottom+m.bottom)/x.y,left:(g.left-O.left+m.left)/x.x,right:(O.right-g.right+m.right)/x.x}}var lHt=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}=Yx(t,e)||{};if(l==null)return{};let d=yFe(c),f={x:r,y:n},p=_ce(o),m=bce(p),h=await a.getDimensions(l),b=p==="y",g=b?"top":"left",y=b?"bottom":"right",S=b?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-f[p]-i.floating[m],O=f[p]-i.reference[p],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=P?P[S]:0;(!E||!await(a.isElement==null?void 0:a.isElement(P)))&&(E=s.floating[S]||i.floating[m]);let A=x/2-O/2,I=E/2-h[m]/2-1,R=Jx(d[g],I),N=Jx(d[y],I),j=R,$=E-h[m]-N,k=E/2-h[m]/2+A,z=gce(j,k,$),V=!u.arrow&&LD(o)!=null&&k!==z&&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]:z,centerOffset:k-z-Q,...V&&{alignmentOffset:Q}},reset:V}}});var cHt=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}=Yx(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=Zx(o),y=rE(s),S=Zx(s)===s,x=await(u.isRTL==null?void 0:u.isRTL(l.floating)),O=f||(S||!h?[RW(s)]:nHt(s)),P=m!=="none";!f&&P&&O.push(...oHt(s,h,m,x));let E=[s,...O],A=await ez(e,b),I=[],R=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(A[g]),d){let k=rHt(o,a,x);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,z=E[k];if(z)return{data:{index:k,overflows:R},reset:{placement:z}};let V=(j=R.filter(Q=>Q.overflows[0]<=0).sort((Q,J)=>Q.overflows[1]-J.overflows[1])[0])==null?void 0:j.placement;if(!V)switch(p){case"bestFit":{var $;let Q=($=R.filter(J=>{if(P){let D=rE(J.placement);return D===y||D==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(D=>D>0).reduce((D,B)=>D+B,0)]).sort((J,D)=>J[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 aHt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function sHt(t){return tHt.some(e=>t[e]>=0)}var dHt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=Yx(t,e);switch(n){case"referenceHidden":{let i=await ez(e,{...o,elementContext:"reference"}),a=aHt(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:sHt(a)}}}case"escaped":{let i=await ez(e,{...o,altBoundary:!0}),a=aHt(i,r.floating);return{data:{escapedOffsets:a,escaped:sHt(a)}}}default:return{}}}}};async function W0n(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=Zx(r),s=LD(r),u=rE(r)==="y",l=["left","top"].includes(a)?-1:1,c=i&&u?-1:1,d=Yx(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 fHt=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 W0n(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}}}}},pHt=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}=Yx(t,e),l={x:r,y:n},c=await ez(e,u),d=rE(Zx(o)),f=yce(d),p=l[f],m=l[d];if(i){let b=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=p+c[b],S=p-c[g];p=gce(y,p,S)}if(a){let b=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=m+c[b],S=m-c[g];m=gce(y,m,S)}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}}}}}},mHt=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}=Yx(t,e),c={x:r,y:n},d=rE(o),f=yce(d),p=c[f],m=c[d],h=Yx(s,e),b=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let S=f==="y"?"height":"width",x=i.reference[f]-i.floating[S]+b.mainAxis,O=i.reference[f]+i.reference[S]-b.mainAxis;p<x?p=x:p>O&&(p=O)}if(l){var g,y;let S=f==="y"?"width":"height",x=["top","left"].includes(Zx(o)),O=i.reference[d]-i.floating[S]+(x&&((g=a.offset)==null?void 0:g[d])||0)+(x?0:b.crossAxis),P=i.reference[d]+i.reference[S]+(x?0:((y=a.offset)==null?void 0:y[d])||0)-(x?b.crossAxis:0);m<O?m=O:m>P&&(m=P)}return{[f]:p,[d]:m}}}},hHt=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}=Yx(t,e),c=await ez(e,l),d=Zx(o),f=LD(o),p=rE(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,S=m-c.left-c.right,x=Jx(h-c[b],y),O=Jx(m-c[g],S),P=!e.middlewareData.shift,E=x,A=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(A=S),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=y),P&&!f){let R=rp(c.left,0),N=rp(c.right,0),j=rp(c.top,0),$=rp(c.bottom,0);p?A=m-2*(R!==0||N!==0?R+N:rp(c.left,c.right)):E=h-2*(j!==0||$!==0?j+$:rp(c.top,c.bottom))}await u({...e,availableWidth:A,availableHeight:E});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function vce(){return typeof window<"u"}function $D(t){return yHt(t)?(t.nodeName||"").toLowerCase():"#document"}function im(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _b(t){var e;return(e=(yHt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function yHt(t){return vce()?t instanceof Node||t instanceof im(t).Node:!1}function Gg(t){return vce()?t instanceof Element||t instanceof im(t).Element:!1}function vb(t){return vce()?t instanceof HTMLElement||t instanceof im(t).HTMLElement:!1}function gHt(t){return!vce()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof im(t).ShadowRoot}function tz(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=Jg(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(o)}function bHt(t){return["table","td","th"].includes($D(t))}function DW(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function wce(t){let e=Sce(),r=Gg(t)?Jg(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 _Ht(t){let e=nE(t);for(;vb(e)&&!BD(e);){if(wce(e))return e;if(DW(e))return null;e=nE(e)}return null}function Sce(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function BD(t){return["html","body","#document"].includes($D(t))}function Jg(t){return im(t).getComputedStyle(t)}function LW(t){return Gg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function nE(t){if($D(t)==="html")return t;let e=t.assignedSlot||t.parentNode||gHt(t)&&t.host||_b(t);return gHt(e)?e.host:e}function vHt(t){let e=nE(t);return BD(e)?t.ownerDocument?t.ownerDocument.body:t.body:vb(e)&&tz(e)?e:vHt(e)}function kD(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=vHt(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=im(o);if(i){let s=xce(a);return e.concat(a,a.visualViewport||[],tz(o)?o:[],s&&r?kD(s):[])}return e.concat(o,kD(o,[],r))}function xce(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function xHt(t){let e=Jg(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=vb(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=jW(r)!==i||jW(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function _Fe(t){return Gg(t)?t:t.contextElement}function rz(t){let e=_Fe(t);if(!vb(e))return bb(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=xHt(e),a=(i?jW(r.width):r.width)/n,s=(i?jW(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var K0n=bb(0);function CHt(t){let e=im(t);return!Sce()||!e.visualViewport?K0n:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function G0n(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==im(t)?!1:e}function qD(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=_Fe(t),a=bb(1);e&&(n?Gg(n)&&(a=rz(n)):a=rz(t));let s=G0n(i,r,n)?CHt(i):bb(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=im(i),p=n&&Gg(n)?im(n):n,m=f,h=xce(m);for(;h&&n&&p!==m;){let b=rz(h),g=h.getBoundingClientRect(),y=Jg(h),S=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*b.x,x=g.top+(h.clientTop+parseFloat(y.paddingTop))*b.y;u*=b.x,l*=b.y,c*=b.x,d*=b.y,u+=S,l+=x,m=im(h),h=xce(m)}}return FD({width:c,height:d,x:u,y:l})}function vFe(t,e){let r=LW(t).scrollLeft;return e?e.left+r:qD(_b(t)).left+r}function OHt(t,e,r){r===void 0&&(r=!1);let n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(r?0:vFe(t,n)),i=n.top+e.scrollTop;return{x:o,y:i}}function J0n(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=_b(n),s=e?DW(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=bb(1),c=bb(0),d=vb(n);if((d||!d&&!i)&&(($D(n)!=="body"||tz(a))&&(u=LW(n)),vb(n))){let p=qD(n);l=rz(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?OHt(a,u,!0):bb(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 Y0n(t){return Array.from(t.getClientRects())}function Z0n(t){let e=_b(t),r=LW(t),n=t.ownerDocument.body,o=rp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+vFe(t),s=-r.scrollTop;return Jg(n).direction==="rtl"&&(a+=rp(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}function X0n(t,e){let r=im(t),n=_b(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let l=Sce();(!l||l&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:i,height:a,x:s,y:u}}function Q0n(t,e){let r=qD(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=vb(t)?rz(t):bb(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 wHt(t,e,r){let n;if(e==="viewport")n=X0n(t,r);else if(e==="document")n=Z0n(_b(t));else if(Gg(e))n=Q0n(e,r);else{let o=CHt(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return FD(n)}function PHt(t,e){let r=nE(t);return r===e||!Gg(r)||BD(r)?!1:Jg(r).position==="fixed"||PHt(r,e)}function eSn(t,e){let r=e.get(t);if(r)return r;let n=kD(t,[],!1).filter(s=>Gg(s)&&$D(s)!=="body"),o=null,i=Jg(t).position==="fixed",a=i?nE(t):t;for(;Gg(a)&&!BD(a);){let s=Jg(a),u=wce(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||tz(a)&&!u&&PHt(t,a))?n=n.filter(c=>c!==a):o=s,a=nE(a)}return e.set(t,n),n}function tSn(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?DW(e)?[]:eSn(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=wHt(e,c,o);return l.top=rp(d.top,l.top),l.right=Jx(d.right,l.right),l.bottom=Jx(d.bottom,l.bottom),l.left=rp(d.left,l.left),l},wHt(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function rSn(t){let{width:e,height:r}=xHt(t);return{width:e,height:r}}function nSn(t,e,r){let n=vb(e),o=_b(e),i=r==="fixed",a=qD(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=bb(0);if(n||!n&&!i)if(($D(e)!=="body"||tz(o))&&(s=LW(e)),n){let f=qD(e,!0,i,e);u.x=f.x+e.clientLeft,u.y=f.y+e.clientTop}else o&&(u.x=vFe(o));let l=o&&!n&&!i?OHt(o,s):bb(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 bFe(t){return Jg(t).position==="static"}function SHt(t,e){if(!vb(t)||Jg(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return _b(t)===r&&(r=r.ownerDocument.body),r}function EHt(t,e){let r=im(t);if(DW(t))return r;if(!vb(t)){let o=nE(t);for(;o&&!BD(o);){if(Gg(o)&&!bFe(o))return o;o=nE(o)}return r}let n=SHt(t,e);for(;n&&bHt(n)&&bFe(n);)n=SHt(n,e);return n&&BD(n)&&bFe(n)&&!wce(n)?r:n||_Ht(t)||r}var oSn=async function(t){let e=this.getOffsetParent||EHt,r=this.getDimensions,n=await r(t.floating);return{reference:nSn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function iSn(t){return Jg(t).direction==="rtl"}var THt={convertOffsetParentRelativeRectToViewportRelativeRect:J0n,getDocumentElement:_b,getClippingRect:tSn,getOffsetParent:EHt,getElementRects:oSn,getClientRects:Y0n,getDimensions:rSn,getScale:rz,isElement:Gg,isRTL:iSn};function aSn(t,e){let r=null,n,o=_b(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=NW(c),m=NW(o.clientWidth-(l+d)),h=NW(o.clientHeight-(c+f)),b=NW(l),y={rootMargin:-p+"px "+-m+"px "+-h+"px "+-b+"px",threshold:rp(0,Jx(1,u))||1},S=!0;function x(O){let P=O[0].intersectionRatio;if(P!==u){if(!S)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}S=!1}try{r=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,y)}r.observe(t)}return a(!0),i}function oE(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=_Fe(t),c=o||i?[...l?kD(l):[],...kD(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?aSn(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 S;(S=p)==null||S.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?qD(t):null;u&&b();function b(){let g=qD(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 AHt=fHt;var IHt=pHt,MHt=cHt,RHt=hHt,jHt=dHt,wFe=lHt;var NHt=mHt,SFe=(t,e,r)=>{let n=new Map,o={platform:THt,...r},i={...o.platform,_c:n};return uHt(t,e,{...o,platform:i})};var gl=F(X(),1),Pce=F(X(),1),LHt=F(ds(),1),Cce=typeof document<"u"?Pce.useLayoutEffect:Pce.useEffect;function Oce(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(!Oce(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)&&!Oce(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function FHt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function DHt(t,e){let r=FHt(t);return Math.round(e*r)/r}function xFe(t){let e=gl.useRef(t);return Cce(()=>{e.current=t}),e}function sM(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]=gl.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=gl.useState(n);Oce(f,n)||p(n);let[m,h]=gl.useState(null),[b,g]=gl.useState(null),y=gl.useCallback(J=>{J!==P.current&&(P.current=J,h(J))},[]),S=gl.useCallback(J=>{J!==E.current&&(E.current=J,g(J))},[]),x=i||m,O=a||b,P=gl.useRef(null),E=gl.useRef(null),A=gl.useRef(c),I=u!=null,R=xFe(u),N=xFe(o),j=xFe(l),$=gl.useCallback(()=>{if(!P.current||!E.current)return;let J={placement:e,strategy:r,middleware:f};N.current&&(J.platform=N.current),SFe(P.current,E.current,J).then(D=>{let B={...D,isPositioned:j.current!==!1};k.current&&!Oce(A.current,B)&&(A.current=B,LHt.flushSync(()=>{d(B)}))})},[f,e,r,N,j]);Cce(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(J=>({...J,isPositioned:!1})))},[l]);let k=gl.useRef(!1);Cce(()=>(k.current=!0,()=>{k.current=!1}),[]),Cce(()=>{if(x&&(P.current=x),O&&(E.current=O),x&&O){if(R.current)return R.current(x,O,$);$()}},[x,O,$,R,I]);let z=gl.useMemo(()=>({reference:P,floating:E,setReference:y,setFloating:S}),[y,S]),V=gl.useMemo(()=>({reference:x,floating:O}),[x,O]),Q=gl.useMemo(()=>{let J={position:r,left:0,top:0};if(!V.floating)return J;let D=DHt(V.floating,c.x),B=DHt(V.floating,c.y);return s?{...J,transform:"translate("+D+"px, "+B+"px)",...FHt(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:B}},[r,s,V.floating,c.x,c.y]);return gl.useMemo(()=>({...c,update:$,refs:z,elements:V,floatingStyles:Q}),[c,$,z,V,Q])}var sSn=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?wFe({element:n.current,padding:o}).fn(r):{}:n?wFe({element:n,padding:o}).fn(r):{}}}},uM=(t,e)=>({...AHt(t),options:[t,e]}),lM=(t,e)=>({...IHt(t),options:[t,e]}),cM=(t,e)=>({...NHt(t),options:[t,e]}),dM=(t,e)=>({...MHt(t),options:[t,e]}),fM=(t,e)=>({...RHt(t),options:[t,e]});var pM=(t,e)=>({...jHt(t),options:[t,e]});var mM=(t,e)=>({...sSn(t),options:[t,e]});var kHt=F(X(),1);var CFe=F(ft(),1),uSn="Arrow",$Ht=kHt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,CFe.jsx)(_c.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,CFe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});$Ht.displayName=uSn;var BHt=$Ht;var qHt=F(X(),1);function Xx(t){let[e,r]=qHt.useState(void 0);return Jn(()=>{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 hM=F(ft(),1);var OFe="Popper",[UHt,PFe]=Yi(OFe),[cSn,zHt]=UHt(OFe),HHt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=lh.useState(null);return(0,hM.jsx)(cSn,{scope:e,anchor:n,onAnchorChange:o,children:r})};HHt.displayName=OFe;var VHt="PopperAnchor",WHt=lh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=zHt(VHt,r),a=lh.useRef(null),s=cd(e,a);return lh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,hM.jsx)(_c.div,{...o,ref:s})});WHt.displayName=VHt;var EFe="PopperContent",[dSn,fSn]=UHt(EFe),KHt=lh.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=zHt(EFe,r),[g,y]=lh.useState(null),S=cd(e,Y=>y(Y)),[x,O]=lh.useState(null),P=Xx(x),E=P?.width??0,A=P?.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(mSn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),hSn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=YHt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=lh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,hM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,hM.jsx)(dSn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,hM.jsx)(_c.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});KHt.displayName=EFe;var GHt="PopperArrow",pSn={top:"bottom",right:"left",bottom:"top",left:"right"},JHt=lh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=fSn(GHt,n),a=pSn[i.placedSide];return(0,hM.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,hM.jsx)(BHt,{...o,ref:r,style:{...o.style,display:"block"}})})});JHt.displayName=GHt;function mSn(t){return t!==null}var hSn=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]=YHt(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 YHt(t){let[e,r="center"]=t.split("-");return[e,r]}var TFe=HHt,ZHt=WHt,XHt=KHt,QHt=JHt;var Ece=F(X(),1),eVt=F(ds(),1);var tVt=F(ft(),1),ySn="Portal",AFe=Ece.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Ece.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?eVt.default.createPortal((0,tVt.jsx)(_c.div,{...n,ref:e}),a):null});AFe.displayName=ySn;var am=F(X(),1);var nVt=F(X(),1);function rVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bSn(...t){return e=>{let r=!1,n=t.map(o=>{let i=rVt(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():rVt(t[o],null)}}}}function oVt(...t){return nVt.useCallback(bSn(...t),t)}var iVt=F(X(),1);function _Sn(t,e){return iVt.useReducer((r,n)=>e[r][n]??r,t)}var fd=t=>{let{present:e,children:r}=t,n=vSn(e),o=typeof r=="function"?r({present:n.isPresent}):am.Children.only(r),i=oVt(n.ref,wSn(o));return typeof r=="function"||n.isPresent?am.cloneElement(o,{ref:i}):null};fd.displayName="Presence";function vSn(t){let[e,r]=am.useState(),n=am.useRef({}),o=am.useRef(t),i=am.useRef("none"),a=t?"mounted":"unmounted",[s,u]=_Sn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return am.useEffect(()=>{let l=Tce(n.current);i.current=s==="mounted"?l:"none"},[s]),Jn(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Tce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Jn(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Tce(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=Tce(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:am.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function Tce(t){return t?.animationName||"none"}function wSn(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 vc=F(X(),1);function UD(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var gM=F(X(),1);var sVt=F(X(),1);function aVt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function IFe(...t){return e=>{let r=!1,n=t.map(o=>{let i=aVt(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():aVt(t[o],null)}}}}function FW(...t){return sVt.useCallback(IFe(...t),t)}var pd=F(X(),1);var nz=F(ft(),1),oz=pd.forwardRef((t,e)=>{let{children:r,...n}=t,o=pd.Children.toArray(r),i=o.find(xSn);if(i){let a=i.props.children,s=o.map(u=>u===i?pd.Children.count(a)>1?pd.Children.only(null):pd.isValidElement(a)?a.props.children:null:u);return(0,nz.jsx)(MFe,{...n,ref:e,children:pd.isValidElement(a)?pd.cloneElement(a,void 0,s):null})}return(0,nz.jsx)(MFe,{...n,ref:e,children:r})});oz.displayName="Slot";var MFe=pd.forwardRef((t,e)=>{let{children:r,...n}=t;if(pd.isValidElement(r)){let o=OSn(r);return pd.cloneElement(r,{...CSn(n,r.props),ref:e?IFe(e,o):o})}return pd.Children.count(r)>1?pd.Children.only(null):null});MFe.displayName="SlotClone";var SSn=({children:t})=>(0,nz.jsx)(nz.Fragment,{children:t});function xSn(t){return pd.isValidElement(t)&&t.type===SSn}function CSn(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 OSn(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 Ace=F(ft(),1);function uVt(t){let e=t+"CollectionProvider",[r,n]=Yi(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=gM.default.useRef(null),g=gM.default.useRef(new Map).current;return(0,Ace.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=gM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=FW(m,g.collectionRef);return(0,Ace.jsx)(oz,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=gM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=gM.default.useRef(null),S=FW(m,y),x=i(l,h);return gM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Ace.jsx)(oz,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return gM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var lVt=F(X(),1),PSn=F(ds(),1);var cVt=F(ft(),1),ESn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],RFe=ESn.reduce((t,e)=>{let r=lVt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?oz:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,cVt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var yM=F(ft(),1),jFe="rovingFocusGroup.onEntryFocus",TSn={bubbles:!1,cancelable:!0},Ice="RovingFocusGroup",[NFe,dVt,ASn]=uVt(Ice),[ISn,DFe]=Yi(Ice,[ASn]),[MSn,RSn]=ISn(Ice),fVt=vc.forwardRef((t,e)=>(0,yM.jsx)(NFe.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(NFe.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,yM.jsx)(jSn,{...t,ref:e})})}));fVt.displayName=Ice;var jSn=vc.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=vc.useRef(null),p=FW(e,f),m=nM(i),[h=null,b]=ud({prop:a,defaultProp:s,onChange:u}),[g,y]=vc.useState(!1),S=Ur(l),x=dVt(r),O=vc.useRef(!1),[P,E]=vc.useState(0);return vc.useEffect(()=>{let A=f.current;if(A)return A.addEventListener(jFe,S),()=>A.removeEventListener(jFe,S)},[S]),(0,yM.jsx)(MSn,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:vc.useCallback(A=>b(A),[b]),onItemShiftTab:vc.useCallback(()=>y(!0),[]),onFocusableItemAdd:vc.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:vc.useCallback(()=>E(A=>A-1),[]),children:(0,yM.jsx)(RFe.div,{tabIndex:g||P===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:UD(t.onMouseDown,()=>{O.current=!0}),onFocus:UD(t.onFocus,A=>{let I=!O.current;if(A.target===A.currentTarget&&I&&!g){let R=new CustomEvent(jFe,TSn);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){let N=x().filter(V=>V.focusable),j=N.find(V=>V.active),$=N.find(V=>V.id===h),z=[j,$,...N].filter(Boolean).map(V=>V.ref.current);hVt(z,c)}}O.current=!1}),onBlur:UD(t.onBlur,()=>y(!1))})})}),pVt="RovingFocusGroupItem",mVt=vc.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,...a}=t,s=hl(),u=i||s,l=RSn(pVt,r),c=l.currentTabStopId===u,d=dVt(r),{onFocusableItemAdd:f,onFocusableItemRemove:p}=l;return vc.useEffect(()=>{if(n)return f(),()=>p()},[n,f,p]),(0,yM.jsx)(NFe.ItemSlot,{scope:r,id:u,focusable:n,active:o,children:(0,yM.jsx)(RFe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...a,ref:e,onMouseDown:UD(t.onMouseDown,m=>{n?l.onItemFocus(u):m.preventDefault()}),onFocus:UD(t.onFocus,()=>l.onItemFocus(u)),onKeyDown:UD(t.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){l.onItemShiftTab();return}if(m.target!==m.currentTarget)return;let h=LSn(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?FSn(g,y+1):g.slice(y+1)}setTimeout(()=>hVt(g))}})})})});mVt.displayName=pVt;var NSn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DSn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function LSn(t,e,r){let n=DSn(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return NSn[n]}function hVt(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function FSn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var gVt=fVt,yVt=mVt;var $Sn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},iz=new WeakMap,Mce=new WeakMap,Rce={},LFe=0,bVt=function(t){return t&&(t.host||bVt(t.parentNode))},BSn=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=bVt(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})},qSn=function(t,e,r,n){var o=BSn(e,Array.isArray(t)?t:[t]);Rce[r]||(Rce[r]=new WeakMap);var i=Rce[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=(iz.get(f)||0)+1,b=(i.get(f)||0)+1;iz.set(f,h),i.set(f,b),a.push(f),h===1&&m&&Mce.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(),LFe++,function(){a.forEach(function(d){var f=iz.get(d)-1,p=i.get(d)-1;iz.set(d,f),i.set(d,p),f||(Mce.has(d)||d.removeAttribute(n),Mce.delete(d)),p||d.removeAttribute(r)}),LFe--,LFe||(iz=new WeakMap,iz=new WeakMap,Mce=new WeakMap,Rce={})}},bM=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||$Sn(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),qSn(n,o,r,"aria-hidden")):function(){return null}};var yi=function(){return yi=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},yi.apply(this,arguments)};function _M(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 az(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 Fce=F(X());var ff=F(X());var wb="right-scroll-bar-position",Sb="width-before-scroll-bar",FFe="with-scroll-bars-hidden",kFe="--removed-body-scroll-bar-size";function jce(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var _Vt=F(X());function vVt(t,e){var r=(0,_Vt.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 Nce=F(X());var USn=typeof window<"u"?Nce.useLayoutEffect:Nce.useEffect,wVt=new WeakMap;function zD(t,e){var r=vVt(e||null,function(n){return t.forEach(function(o){return jce(o,n)})});return USn(function(){var n=wVt.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||jce(s,null)}),i.forEach(function(s){o.has(s)||jce(s,a)})}wVt.set(r,t)},[t]),r}function zSn(t){return t}function HSn(t,e){e===void 0&&(e=zSn);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 HD(t){t===void 0&&(t={});var e=HSn(null);return e.options=yi({async:!0,ssr:!1},t),e}var SVt=F(X()),xVt=function(t){var e=t.sideCar,r=_M(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 SVt.createElement(n,yi({},r))};xVt.isSideCarExport=!0;function VD(t,e){return t.useMedium(e),xVt}var Dce=HD();var $Fe=function(){},kW=ff.forwardRef(function(t,e){var r=ff.useRef(null),n=ff.useState({onScrollCapture:$Fe,onWheelCapture:$Fe,onTouchMoveCapture:$Fe}),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,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=zD([r,e]),P=yi(yi({},S),o);return ff.createElement(ff.Fragment,null,c&&ff.createElement(x,{sideCar:Dce,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?ff.cloneElement(ff.Children.only(s),yi(yi({},P),{ref:O})):ff.createElement(g,yi({},P,{className:u,ref:O}),s))});kW.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kW.classNames={fullWidth:Sb,zeroRight:wb};var ya=F(X());var uz=F(X());var PVt=F(X());var CVt;var OVt=function(){if(CVt)return CVt;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function VSn(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=OVt();return e&&t.setAttribute("nonce",e),t}function WSn(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function KSn(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var BFe=function(){var t=0,e=null;return{add:function(r){t==0&&(e=VSn())&&(WSn(e,r),KSn(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var qFe=function(){var t=BFe();return function(e,r){PVt.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var iE=function(){var t=qFe(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var GSn={left:0,top:0,right:0,gap:0},UFe=function(t){return parseInt(t||"",10)||0},JSn=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[UFe(r),UFe(n),UFe(o)]},zFe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return GSn;var e=JSn(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 YSn=iE(),sz="data-scroll-locked",ZSn=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(FFe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(s,"px ").concat(n,`;
}
body[`).concat(sz,`] {
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(wb,` {
right: `).concat(s,"px ").concat(n,`;
}
.`).concat(Sb,` {
margin-right: `).concat(s,"px ").concat(n,`;
}
.`).concat(wb," .").concat(wb,` {
right: 0 `).concat(n,`;
}
.`).concat(Sb," .").concat(Sb,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(sz,`] {
`).concat(kFe,": ").concat(s,`px;
}
`)},EVt=function(){var t=parseInt(document.body.getAttribute(sz)||"0",10);return isFinite(t)?t:0},XSn=function(){uz.useEffect(function(){return document.body.setAttribute(sz,(EVt()+1).toString()),function(){var t=EVt()-1;t<=0?document.body.removeAttribute(sz):document.body.setAttribute(sz,t.toString())}},[])},WD=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;XSn();var i=uz.useMemo(function(){return zFe(o)},[o]);return uz.createElement(YSn,{styles:ZSn(i,!e,o,r?"":"!important")})};var HFe=!1;if(typeof window<"u")try{$W=Object.defineProperty({},"passive",{get:function(){return HFe=!0,!0}}),window.addEventListener("test",$W,$W),window.removeEventListener("test",$W,$W)}catch{HFe=!1}var $W,KD=HFe?{passive:!1}:!1;var QSn=function(t){return t.tagName==="TEXTAREA"},TVt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!QSn(t)&&r[e]==="visible")},exn=function(t){return TVt(t,"overflowY")},txn=function(t){return TVt(t,"overflowX")},VFe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=AVt(t,n);if(o){var i=IVt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rxn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},nxn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},AVt=function(t,e){return t==="v"?exn(e):txn(e)},IVt=function(t,e){return t==="v"?rxn(e):nxn(e)},oxn=function(t,e){return t==="h"&&e==="rtl"?-1:1},MVt=function(t,e,r,n,o){var i=oxn(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=IVt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&AVt(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 Lce=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RVt=function(t){return[t.deltaX,t.deltaY]},jVt=function(t){return t&&"current"in t?t.current:t},ixn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},axn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},sxn=0,lz=[];function NVt(t){var e=ya.useRef([]),r=ya.useRef([0,0]),n=ya.useRef(),o=ya.useState(sxn++)[0],i=ya.useState(iE)[0],a=ya.useRef(t);ya.useEffect(function(){a.current=t},[t]),ya.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(jVt),!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=ya.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Lce(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=VFe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=VFe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return MVt(I,b,h,I==="h"?S:x,!0)},[]),u=ya.useCallback(function(h){var b=h;if(!(!lz.length||lz[lz.length-1]!==i)){var g="deltaY"in b?RVt(b):Lce(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&ixn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(jVt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ya.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:uxn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ya.useCallback(function(h){r.current=Lce(h),n.current=void 0},[]),d=ya.useCallback(function(h){l(h.type,RVt(h),h.target,s(h,t.lockRef.current))},[]),f=ya.useCallback(function(h){l(h.type,Lce(h),h.target,s(h,t.lockRef.current))},[]);ya.useEffect(function(){return lz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,KD),document.addEventListener("touchmove",u,KD),document.addEventListener("touchstart",c,KD),function(){lz=lz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,KD),document.removeEventListener("touchmove",u,KD),document.removeEventListener("touchstart",c,KD)}},[]);var p=t.removeScrollBar,m=t.inert;return ya.createElement(ya.Fragment,null,m?ya.createElement(i,{styles:axn(o)}):null,p?ya.createElement(WD,{gapMode:t.gapMode}):null)}function uxn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var DVt=VD(Dce,NVt);var LVt=Fce.forwardRef(function(t,e){return Fce.createElement(kW,yi({},t,{ref:e,sideCar:DVt}))});LVt.classNames=kW.classNames;var WFe=LVt;var Mr=F(ft(),1),KFe=["Enter"," "],lxn=["ArrowDown","PageUp","Home"],kVt=["ArrowUp","PageDown","End"],cxn=[...lxn,...kVt],dxn={ltr:[...KFe,"ArrowRight"],rtl:[...KFe,"ArrowLeft"]},fxn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},zW="Menu",[qW,pxn,mxn]=F3t(zW),[GD,GFe]=Yi(zW,[mxn,PFe,DFe]),HW=PFe(),$Vt=DFe(),[BVt,vM]=GD(zW),[hxn,VW]=GD(zW),qVt=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=HW(e),[u,l]=zt.useState(null),c=zt.useRef(!1),d=Ur(i),f=nM(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,Mr.jsx)(TFe,{...s,children:(0,Mr.jsx)(BVt,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Mr.jsx)(hxn,{scope:e,onClose:zt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};qVt.displayName=zW;var gxn="MenuAnchor",JFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=HW(r);return(0,Mr.jsx)(ZHt,{...o,...n,ref:e})});JFe.displayName=gxn;var YFe="MenuPortal",[yxn,UVt]=GD(YFe,{forceMount:void 0}),zVt=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=vM(YFe,e);return(0,Mr.jsx)(yxn,{scope:e,forceMount:r,children:(0,Mr.jsx)(fd,{present:r||i.open,children:(0,Mr.jsx)(AFe,{asChild:!0,container:o,children:n})})})};zVt.displayName=YFe;var Yg="MenuContent",[bxn,ZFe]=GD(Yg),HVt=zt.forwardRef((t,e)=>{let r=UVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=VW(Yg,t.__scopeMenu);return(0,Mr.jsx)(qW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(qW.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Mr.jsx)(_xn,{...o,ref:e}):(0,Mr.jsx)(vxn,{...o,ref:e})})})})}),_xn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu),n=zt.useRef(null),o=cd(e,n);return zt.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Mr.jsx)(XFe,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Zi(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),vxn=zt.forwardRef((t,e)=>{let r=vM(Yg,t.__scopeMenu);return(0,Mr.jsx)(XFe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),XFe=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=vM(Yg,r),g=VW(Yg,r),y=HW(r),S=$Vt(r),x=pxn(r),[O,P]=zt.useState(null),E=zt.useRef(null),A=cd(e,E,b.onContentChange),I=zt.useRef(0),R=zt.useRef(""),N=zt.useRef(0),j=zt.useRef(null),$=zt.useRef("right"),k=zt.useRef(0),z=m?WFe:zt.Fragment,V=m?{as:tM,allowPinchZoom:!0}:void 0,Q=D=>{let B=R.current+D,q=x().filter(Y=>!Y.disabled),K=document.activeElement,H=q.find(Y=>Y.ref.current===K)?.textValue,ee=q.map(Y=>Y.textValue),U=jxn(ee,B,H),W=q.find(Y=>Y.textValue===U)?.ref.current;(function Y(ae){R.current=ae,window.clearTimeout(I.current),ae!==""&&(I.current=window.setTimeout(()=>Y(""),1e3))})(B),W&&setTimeout(()=>W.focus())};zt.useEffect(()=>()=>window.clearTimeout(I.current),[]),iM();let J=zt.useCallback(D=>$.current===j.current?.side&&Dxn(D,j.current?.area),[]);return(0,Mr.jsx)(bxn,{scope:r,searchRef:R,onItemEnter:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),onItemLeave:zt.useCallback(D=>{J(D)||(E.current?.focus(),P(null))},[J]),onTriggerLeave:zt.useCallback(D=>{J(D)&&D.preventDefault()},[J]),pointerGraceTimerRef:N,onPointerGraceIntentChange:zt.useCallback(D=>{j.current=D},[]),children:(0,Mr.jsx)(z,{...V,children:(0,Mr.jsx)(gFe,{asChild:!0,trapped:o,onMountAutoFocus:Zi(i,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Mr.jsx)(fFe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Mr.jsx)(gVt,{asChild:!0,...S,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:P,onEntryFocus:Zi(u,D=>{g.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Mr.jsx)(XHt,{role:"menu","aria-orientation":"vertical","data-state":a8t(b.open),"data-radix-menu-content":"",dir:g.dir,...y,...h,ref:A,style:{outline:"none",...h.style},onKeyDown:Zi(h.onKeyDown,D=>{let q=D.target.closest("[data-radix-menu-content]")===D.currentTarget,K=D.ctrlKey||D.altKey||D.metaKey,H=D.key.length===1;q&&(D.key==="Tab"&&D.preventDefault(),!K&&H&&Q(D.key));let ee=E.current;if(D.target!==ee||!cxn.includes(D.key))return;D.preventDefault();let W=x().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);kVt.includes(D.key)&&W.reverse(),Mxn(W)}),onBlur:Zi(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),R.current="")}),onPointerMove:Zi(t.onPointerMove,UW(D=>{let B=D.target,q=k.current!==D.clientX;if(D.currentTarget.contains(B)&&q){let K=D.clientX>k.current?"right":"left";$.current=K,k.current=D.clientX}}))})})})})})})});HVt.displayName=Yg;var wxn="MenuGroup",QFe=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"group",...n,ref:e})});QFe.displayName=wxn;var Sxn="MenuLabel",VVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{...n,ref:e})});VVt.displayName=Sxn;var kce="MenuItem",FVt="menu.itemSelect",Bce=zt.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=zt.useRef(null),a=VW(kce,t.__scopeMenu),s=ZFe(kce,t.__scopeMenu),u=cd(e,i),l=zt.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(FVt,{bubbles:!0,cancelable:!0});d.addEventListener(FVt,p=>n?.(p),{once:!0}),pce(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Mr.jsx)(WVt,{...o,ref:u,disabled:r,onClick:Zi(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Zi(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Zi(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||KFe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Bce.displayName=kce;var WVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=ZFe(kce,r),s=$Vt(r),u=zt.useRef(null),l=cd(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,Mr.jsx)(qW.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Mr.jsx)(yVt,{asChild:!0,...s,focusable:!n,children:(0,Mr.jsx)(_c.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Zi(t.onPointerMove,UW(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Zi(t.onPointerLeave,UW(m=>a.onItemLeave(m))),onFocus:Zi(t.onFocus,()=>d(!0)),onBlur:Zi(t.onBlur,()=>d(!1))})})})}),xxn="MenuCheckboxItem",KVt=zt.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Mr.jsx)(XVt,{scope:t.__scopeMenu,checked:r,children:(0,Mr.jsx)(Bce,{role:"menuitemcheckbox","aria-checked":$ce(r)?"mixed":r,...o,ref:e,"data-state":rke(r),onSelect:Zi(o.onSelect,()=>n?.($ce(r)?!0:!r),{checkForDefaultPrevented:!1})})})});KVt.displayName=xxn;var GVt="MenuRadioGroup",[Cxn,Oxn]=GD(GVt,{value:void 0,onValueChange:()=>{}}),JVt=zt.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=Ur(n);return(0,Mr.jsx)(Cxn,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Mr.jsx)(QFe,{...o,ref:e})})});JVt.displayName=GVt;var YVt="MenuRadioItem",ZVt=zt.forwardRef((t,e)=>{let{value:r,...n}=t,o=Oxn(YVt,t.__scopeMenu),i=r===o.value;return(0,Mr.jsx)(XVt,{scope:t.__scopeMenu,checked:i,children:(0,Mr.jsx)(Bce,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":rke(i),onSelect:Zi(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});ZVt.displayName=YVt;var eke="MenuItemIndicator",[XVt,Pxn]=GD(eke,{checked:!1}),QVt=zt.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Pxn(eke,r);return(0,Mr.jsx)(fd,{present:n||$ce(i.checked)||i.checked===!0,children:(0,Mr.jsx)(_c.span,{...o,ref:e,"data-state":rke(i.checked)})})});QVt.displayName=eke;var Exn="MenuSeparator",e8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Mr.jsx)(_c.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});e8t.displayName=Exn;var Txn="MenuArrow",t8t=zt.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=HW(r);return(0,Mr.jsx)(QHt,{...o,...n,ref:e})});t8t.displayName=Txn;var tke="MenuSub",[Axn,r8t]=GD(tke),Ixn=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=vM(tke,e),a=HW(e),[s,u]=zt.useState(null),[l,c]=zt.useState(null),d=Ur(o);return zt.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Mr.jsx)(TFe,{...a,children:(0,Mr.jsx)(BVt,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Mr.jsx)(Axn,{scope:e,contentId:hl(),triggerId:hl(),trigger:s,onTriggerChange:u,children:r})})})};Ixn.displayName=tke;var BW="MenuSubTrigger",n8t=zt.forwardRef((t,e)=>{let r=vM(BW,t.__scopeMenu),n=VW(BW,t.__scopeMenu),o=r8t(BW,t.__scopeMenu),i=ZFe(BW,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,Mr.jsx)(JFe,{asChild:!0,...l,children:(0,Mr.jsx)(WVt,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":a8t(r.open),...t,ref:MW(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Zi(t.onPointerMove,UW(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:Zi(t.onPointerLeave,UW(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:Zi(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||dxn[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});n8t.displayName=BW;var o8t="MenuSubContent",i8t=zt.forwardRef((t,e)=>{let r=UVt(Yg,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=vM(Yg,t.__scopeMenu),a=VW(Yg,t.__scopeMenu),s=r8t(o8t,t.__scopeMenu),u=zt.useRef(null),l=cd(e,u);return(0,Mr.jsx)(qW.Provider,{scope:t.__scopeMenu,children:(0,Mr.jsx)(fd,{present:n||i.open,children:(0,Mr.jsx)(qW.Slot,{scope:t.__scopeMenu,children:(0,Mr.jsx)(XFe,{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:Zi(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Zi(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Zi(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=fxn[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});i8t.displayName=o8t;function a8t(t){return t?"open":"closed"}function $ce(t){return t==="indeterminate"}function rke(t){return $ce(t)?"indeterminate":t?"checked":"unchecked"}function Mxn(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function Rxn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function jxn(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=Rxn(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 Nxn(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 Dxn(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return Nxn(r,e)}function UW(t){return e=>e.pointerType==="mouse"?t(e):void 0}var s8t=qVt,u8t=JFe,l8t=zVt,c8t=HVt,d8t=QFe,f8t=VVt,p8t=Bce,m8t=KVt,h8t=JVt,g8t=ZVt,y8t=QVt,b8t=e8t,_8t=t8t;var v8t=n8t,w8t=i8t;var wc=F(ft(),1),nke="DropdownMenu",[Fxn,Rui]=Yi(nke,[GFe]),np=GFe(),[kxn,S8t]=Fxn(nke),WW=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=np(e),l=$l.useRef(null),[c=!1,d]=ud({prop:o,defaultProp:i,onChange:a});return(0,wc.jsx)(kxn,{scope:e,triggerId:hl(),triggerRef:l,contentId:hl(),open:c,onOpenChange:d,onOpenToggle:$l.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,wc.jsx)(s8t,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};WW.displayName=nke;var x8t="DropdownMenuTrigger",KW=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=S8t(x8t,r),a=np(r);return(0,wc.jsx)(u8t,{asChild:!0,...a,children:(0,wc.jsx)(N3t.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:cce(e,i.triggerRef),onPointerDown:IW(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:IW(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});KW.displayName=x8t;var $xn="DropdownMenuPortal",C8t=t=>{let{__scopeDropdownMenu:e,...r}=t,n=np(e);return(0,wc.jsx)(l8t,{...n,...r})};C8t.displayName=$xn;var O8t="DropdownMenuContent",P8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=S8t(O8t,r),i=np(r),a=$l.useRef(!1);return(0,wc.jsx)(c8t,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:IW(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:IW(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)"}})});P8t.displayName=O8t;var Bxn="DropdownMenuGroup",qxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(d8t,{...o,...n,ref:e})});qxn.displayName=Bxn;var Uxn="DropdownMenuLabel",E8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(f8t,{...o,...n,ref:e})});E8t.displayName=Uxn;var zxn="DropdownMenuItem",T8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(p8t,{...o,...n,ref:e})});T8t.displayName=zxn;var Hxn="DropdownMenuCheckboxItem",A8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(m8t,{...o,...n,ref:e})});A8t.displayName=Hxn;var Vxn="DropdownMenuRadioGroup",Wxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(h8t,{...o,...n,ref:e})});Wxn.displayName=Vxn;var Kxn="DropdownMenuRadioItem",I8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(g8t,{...o,...n,ref:e})});I8t.displayName=Kxn;var Gxn="DropdownMenuItemIndicator",M8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(y8t,{...o,...n,ref:e})});M8t.displayName=Gxn;var Jxn="DropdownMenuSeparator",R8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(b8t,{...o,...n,ref:e})});R8t.displayName=Jxn;var Yxn="DropdownMenuArrow",Zxn=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(_8t,{...o,...n,ref:e})});Zxn.displayName=Yxn;var Xxn="DropdownMenuSubTrigger",j8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(v8t,{...o,...n,ref:e})});j8t.displayName=Xxn;var Qxn="DropdownMenuSubContent",N8t=$l.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=np(r);return(0,wc.jsx)(w8t,{...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)"}})});N8t.displayName=Qxn;var D8t=WW,L8t=KW,F8t=C8t,oke=P8t;var ike=E8t,ake=T8t,ske=A8t;var uke=I8t,lke=M8t,cke=R8t;var dke=j8t,fke=N8t;yn();Tn();var JD=D8t,YD=L8t;var tCn=$i.forwardRef(({className:t,inset:e,children:r,...n},o)=>$i.createElement(dke,{ref:o,className:_e("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,$i.createElement(ZC,{className:"tw-ml-auto"})));tCn.displayName=dke.displayName;var rCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(fke,{ref:r,className:_e("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}));rCn.displayName=fke.displayName;var xb=$i.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>$i.createElement(F8t,{container:r??activeDocument.body},$i.createElement(oke,{ref:o,sideOffset:e,className:_e("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})));xb.displayName=oke.displayName;var Si=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(ake,{ref:n,className:_e("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}));Si.displayName=ake.displayName;var nCn=$i.forwardRef(({className:t,children:e,checked:r,...n},o)=>$i.createElement(ske,{ref:o,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(lke,null,$i.createElement(Jl,{className:"tw-size-4"}))),e));nCn.displayName=ske.displayName;var oCn=$i.forwardRef(({className:t,children:e,...r},n)=>$i.createElement(uke,{ref:n,className:_e("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},$i.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$i.createElement(lke,null,$i.createElement(d3,{className:"tw-size-2 tw-fill-current"}))),e));oCn.displayName=uke.displayName;var iCn=$i.forwardRef(({className:t,inset:e,...r},n)=>$i.createElement(ike,{ref:n,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));iCn.displayName=ike.displayName;var aCn=$i.forwardRef(({className:t,...e},r)=>$i.createElement(cke,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));aCn.displayName=cke.displayName;var sCn=({className:t,...e})=>$i.createElement("span",{className:_e("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});sCn.displayName="DropdownMenuShortcut";var GW=F(X());Tn();var cz=GW.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 GW.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:_e("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},GW.createElement("div",{className:_e("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")}))});cz.displayName="SettingSwitch";var ZW=F(X());var en=F(X(),1);function Cb(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var $8t=F(X(),1);function k8t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function uCn(...t){return e=>{let r=!1,n=t.map(o=>{let i=k8t(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():k8t(t[o],null)}}}}function Ob(...t){return $8t.useCallback(uCn(...t),t)}var aE=F(X(),1),B8t=F(ft(),1);function qce(t,e=[]){let r=[];function n(i,a){let s=aE.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=aE.useMemo(()=>m,Object.values(m));return(0,B8t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=aE.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=>aE.createContext(a));return function(s){let u=s?.[t]||i;return aE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,lCn(o,...e)]}function lCn(...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 aE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var es=F(X(),1);var q8t=F(X(),1),U8t=F(ds(),1);i1();var z8t=F(ft(),1),cCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Zg=cCn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=q8t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,z8t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function H8t(t,e){t&&U8t.flushSync(()=>t.dispatchEvent(e))}var dz=F(X(),1);function ZD(t){let e=dz.useRef(t);return dz.useEffect(()=>{e.current=t}),dz.useMemo(()=>(...r)=>e.current?.(...r),[])}var V8t=F(X(),1);function W8t(t,e=globalThis?.document){let r=ZD(t);V8t.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 mke=F(ft(),1),dCn="DismissableLayer",pke="dismissableLayer.update",fCn="dismissableLayer.pointerDownOutside",pCn="dismissableLayer.focusOutside",K8t,J8t=es.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hke=es.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=es.useContext(J8t),[c,d]=es.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=es.useState({}),m=Ob(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=gCn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=yCn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return W8t(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),es.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(K8t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),G8t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=K8t)}},[c,f,r,l]),es.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),G8t())},[c,l]),es.useEffect(()=>{let E=()=>p({});return document.addEventListener(pke,E),()=>document.removeEventListener(pke,E)},[]),(0,mke.jsx)(Zg.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:Cb(t.onFocusCapture,P.onFocusCapture),onBlurCapture:Cb(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Cb(t.onPointerDownCapture,O.onPointerDownCapture)})});hke.displayName=dCn;var mCn="DismissableLayerBranch",hCn=es.forwardRef((t,e)=>{let r=es.useContext(J8t),n=es.useRef(null),o=Ob(e,n);return es.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,mke.jsx)(Zg.div,{...t,ref:o})});hCn.displayName=mCn;function gCn(t,e=globalThis?.document){let r=ZD(t),n=es.useRef(!1),o=es.useRef(()=>{});return es.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){Y8t(fCn,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 yCn(t,e=globalThis?.document){let r=ZD(t),n=es.useRef(!1);return es.useEffect(()=>{let o=i=>{i.target&&!n.current&&Y8t(pCn,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 G8t(){let t=new CustomEvent(pke);document.dispatchEvent(t)}function Y8t(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?H8t(o,i):o.dispatchEvent(i)}var gke=F(X(),1);var Z8t=F(X(),1),sm=globalThis?.document?Z8t.useLayoutEffect:()=>{};var bCn=gke[" useId ".trim().toString()]||(()=>{}),_Cn=0;function X8t(t){let[e,r]=gke.useState(bCn());return sm(()=>{t||r(n=>n??String(_Cn++))},[t]),t||(e?`radix-${e}`:"")}var ch=F(X(),1);var Q8t=F(X(),1);var yke=F(ft(),1),vCn="Arrow",e6t=Q8t.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,yke.jsx)(Zg.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,yke.jsx)("polygon",{points:"0,0 30,0 15,10"})})});e6t.displayName=vCn;var t6t=e6t;var r6t=F(X(),1);function n6t(t){let[e,r]=r6t.useState(void 0);return sm(()=>{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 wM=F(ft(),1);var bke="Popper",[o6t,_ke]=qce(bke),[SCn,i6t]=o6t(bke),a6t=t=>{let{__scopePopper:e,children:r}=t,[n,o]=ch.useState(null);return(0,wM.jsx)(SCn,{scope:e,anchor:n,onAnchorChange:o,children:r})};a6t.displayName=bke;var s6t="PopperAnchor",u6t=ch.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=i6t(s6t,r),a=ch.useRef(null),s=Ob(e,a);return ch.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,wM.jsx)(Zg.div,{...o,ref:s})});u6t.displayName=s6t;var vke="PopperContent",[xCn,CCn]=o6t(vke),l6t=ch.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=i6t(vke,r),[g,y]=ch.useState(null),S=Ob(e,Y=>y(Y)),[x,O]=ch.useState(null),P=n6t(x),E=P?.width??0,A=P?.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(PCn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),ECn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=f6t(V),q=ZD(m);sm(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=ch.useState();return sm(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,wM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,wM.jsx)(xCn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,wM.jsx)(Zg.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});l6t.displayName=vke;var c6t="PopperArrow",OCn={top:"bottom",right:"left",bottom:"top",left:"right"},d6t=ch.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=CCn(c6t,n),a=OCn[i.placedSide];return(0,wM.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,wM.jsx)(t6t,{...o,ref:r,style:{...o.style,display:"block"}})})});d6t.displayName=c6t;function PCn(t){return t!==null}var ECn=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]=f6t(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 f6t(t){let[e,r="center"]=t.split("-");return[e,r]}var p6t=a6t,m6t=u6t,h6t=l6t,g6t=d6t;var Uce=F(X(),1),y6t=F(ds(),1);var b6t=F(ft(),1),ACn="Portal",wke=Uce.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Uce.useState(!1);sm(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?y6t.default.createPortal((0,b6t.jsx)(Zg.div,{...n,ref:e}),a):null});wke.displayName=ACn;var um=F(X(),1);var _6t=F(X(),1);function ICn(t,e){return _6t.useReducer((r,n)=>e[r][n]??r,t)}var Hce=t=>{let{present:e,children:r}=t,n=MCn(e),o=typeof r=="function"?r({present:n.isPresent}):um.Children.only(r),i=Ob(n.ref,RCn(o));return typeof r=="function"||n.isPresent?um.cloneElement(o,{ref:i}):null};Hce.displayName="Presence";function MCn(t){let[e,r]=um.useState(),n=um.useRef(null),o=um.useRef(t),i=um.useRef("none"),a=t?"mounted":"unmounted",[s,u]=ICn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return um.useEffect(()=>{let l=zce(n.current);i.current=s==="mounted"?l:"none"},[s]),sm(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=zce(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),sm(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=zce(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=zce(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:um.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function zce(t){return t?.animationName||"none"}function RCn(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)}i1();var Xg=F(X(),1);var Vce=F(X(),1);var jCn=Xg[" useInsertionEffect ".trim().toString()]||sm;function v6t({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=NCn({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=Xg.useRef(t!==void 0);Xg.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=Xg.useCallback(c=>{if(s){let d=DCn(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function NCn({defaultProp:t,onChange:e}){let[r,n]=Xg.useState(t),o=Xg.useRef(r),i=Xg.useRef(e);return jCn(()=>{i.current=e},[e]),Xg.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function DCn(t){return typeof t=="function"}var wli=Symbol("RADIX:SYNC_STATE");var C6t=F(X(),1);var w6t=F(X(),1),LCn=F(ds(),1);i1();var S6t=F(ft(),1),FCn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x6t=FCn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=w6t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,S6t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var O6t=F(ft(),1),kCn=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"}),$Cn="VisuallyHidden",P6t=C6t.forwardRef((t,e)=>(0,O6t.jsx)(x6t.span,{...t,ref:e,style:{...kCn,...t.style}}));P6t.displayName=$Cn;var E6t=P6t;var yl=F(ft(),1),[Wce,Fli]=qce("Tooltip",[_ke]),Kce=_ke(),T6t="TooltipProvider",qCn=700,Ske="tooltip.open",[UCn,Cke]=Wce(T6t),A6t=t=>{let{__scopeTooltip:e,delayDuration:r=qCn,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=en.useRef(!0),s=en.useRef(!1),u=en.useRef(0);return en.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,yl.jsx)(UCn,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:en.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:en.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:en.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};A6t.displayName=T6t;var JW="Tooltip",[zCn,YW]=Wce(JW),I6t=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=Cke(JW,t.__scopeTooltip),l=Kce(e),[c,d]=en.useState(null),f=X8t(),p=en.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,b=en.useRef(!1),[g,y]=v6t({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(Ske))):u.onClose(),i?.(E)},caller:JW}),S=en.useMemo(()=>g?b.current?"delayed-open":"instant-open":"closed",[g]),x=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,y(!0)},[y]),O=en.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),P=en.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,y(!0),p.current=0},h)},[h,y]);return en.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,yl.jsx)(p6t,{...l,children:(0,yl.jsx)(zCn,{scope:e,contentId:f,open:g,stateAttribute:S,trigger:c,onTriggerChange:d,onTriggerEnter:en.useCallback(()=>{u.isOpenDelayedRef.current?P():x()},[u.isOpenDelayedRef,P,x]),onTriggerLeave:en.useCallback(()=>{m?O():(window.clearTimeout(p.current),p.current=0)},[O,m]),onOpen:x,onClose:O,disableHoverableContent:m,children:r})})};I6t.displayName=JW;var xke="TooltipTrigger",M6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=YW(xke,r),i=Cke(xke,r),a=Kce(r),s=en.useRef(null),u=Ob(e,s,o.onTriggerChange),l=en.useRef(!1),c=en.useRef(!1),d=en.useCallback(()=>l.current=!1,[]);return en.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,yl.jsx)(m6t,{asChild:!0,...a,children:(0,yl.jsx)(Zg.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Cb(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:Cb(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:Cb(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Cb(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:Cb(t.onBlur,o.onClose),onClick:Cb(t.onClick,o.onClose)})})});M6t.displayName=xke;var Oke="TooltipPortal",[HCn,VCn]=Wce(Oke,{forceMount:void 0}),R6t=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=YW(Oke,e);return(0,yl.jsx)(HCn,{scope:e,forceMount:r,children:(0,yl.jsx)(Hce,{present:r||i.open,children:(0,yl.jsx)(wke,{asChild:!0,container:o,children:n})})})};R6t.displayName=Oke;var fz="TooltipContent",j6t=en.forwardRef((t,e)=>{let r=VCn(fz,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=YW(fz,t.__scopeTooltip);return(0,yl.jsx)(Hce,{present:n||a.open,children:a.disableHoverableContent?(0,yl.jsx)(N6t,{side:o,...i,ref:e}):(0,yl.jsx)(WCn,{side:o,...i,ref:e})})}),WCn=en.forwardRef((t,e)=>{let r=YW(fz,t.__scopeTooltip),n=Cke(fz,t.__scopeTooltip),o=en.useRef(null),i=Ob(e,o),[a,s]=en.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=en.useCallback(()=>{s(null),d(!1)},[d]),p=en.useCallback((m,h)=>{let b=m.currentTarget,g={x:m.clientX,y:m.clientY},y=ZCn(g,b.getBoundingClientRect()),S=XCn(g,y),x=QCn(h.getBoundingClientRect()),O=tOn([...S,...x]);s(O),d(!0)},[d]);return en.useEffect(()=>()=>f(),[f]),en.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]),en.useEffect(()=>{if(a){let m=h=>{let b=h.target,g={x:h.clientX,y:h.clientY},y=u?.contains(b)||c?.contains(b),S=!eOn(g,a);y?f():S&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,yl.jsx)(N6t,{...t,ref:i})}),[KCn,GCn]=Wce(JW,{isInside:!1}),JCn=jWe("TooltipContent"),N6t=en.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=YW(fz,r),l=Kce(r),{onClose:c}=u;return en.useEffect(()=>(document.addEventListener(Ske,c),()=>document.removeEventListener(Ske,c)),[c]),en.useEffect(()=>{if(u.trigger){let d=f=>{f.target?.contains(u.trigger)&&c()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[u.trigger,c]),(0,yl.jsx)(hke,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,yl.jsxs)(h6t,{"data-state":u.stateAttribute,...l,...s,ref:e,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,yl.jsx)(JCn,{children:n}),(0,yl.jsx)(KCn,{scope:r,isInside:!0,children:(0,yl.jsx)(E6t,{id:u.contentId,role:"tooltip",children:o||n})})]})})});j6t.displayName=fz;var D6t="TooltipArrow",YCn=en.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Kce(r);return GCn(D6t,r).isInside?null:(0,yl.jsx)(g6t,{...o,...n,ref:e})});YCn.displayName=D6t;function ZCn(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 XCn(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 QCn(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 eOn(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 tOn(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),rOn(e)}function rOn(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 Gce=A6t,L6t=I6t,F6t=M6t,k6t=R6t,Pke=j6t;Tn();var vo=Gce,Rt=L6t,jt=F6t,Mt=ZW.forwardRef(({className:t,sideOffset:e=4,...r},n)=>ZW.createElement(k6t,{container:activeDocument.body},ZW.createElement(Pke,{ref:n,sideOffset:e,className:_e("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})));Mt.displayName=Pke.displayName;$r();yo();nO();Ix();nr();yn();var dh=require("obsidian"),Ft=F(X());async function nOn(){try{await ma.getInstance().indexVaultToVectorStore(),new dh.Notice("Vault index refreshed.")}catch(t){console.error("Error refreshing vault index:",t),new dh.Notice("Failed to refresh vault index. Check console for details.")}}async function oOn(){try{await ma.getInstance().indexVaultToVectorStore(!0),new dh.Notice("Vault force reindexed.")}catch(t){console.error("Error force reindexing vault:",t),new dh.Notice("Failed to force reindex vault. Check console for details.")}}async function Jce(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to reload.");return}try{GE(!0),await tb.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new dh.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),SN(e)||new dh.Notice("Failed to reload project context. Check console for details.")}finally{GE(!1)}}async function iOn(){let t=Mc();if(!t){new dh.Notice("No project is currently selected to rebuild.");return}new sd(app,async()=>{try{GE(!0),new dh.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),z8.resetRateLimitNoticeTimer(),await tb.getInstance().clearForProject(t),new dh.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 dh.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),SN(r)||new dh.Notice("Failed to force rebuild project context. Check console for details.")}finally{GE(!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 B6t({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o}){let i=Rn(),[a,s]=by(),u=Sq(),l=c=>{s(c),n(c),c!=="project"&&(UR(null),o?.())};return Ft.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},Ft.default.createElement("div",{className:"tw-flex-1"},Ft.default.createElement(WW,null,Ft.default.createElement(KW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-ml-1"},a==="llm_chain"&&"chat (free)",a==="vault_qa"&&"vault QA (free)",a==="copilot_plus"&&Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)"),a==="project"&&"projects (alpha)",Ft.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),Ft.default.createElement(xb,{align:"start"},Ft.default.createElement(Si,{onSelect:()=>{l("llm_chain")}},"chat (free)"),Ft.default.createElement(Si,{onSelect:()=>{l("vault_qa")}},"vault QA (free)"),u?Ft.default.createElement(Si,{onSelect:()=>{l("copilot_plus")}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"copilot plus (beta)")):Ft.default.createElement(Si,{onSelect:()=>{p1(LC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(rO,{className:"tw-size-3"})),u?Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{l("project")}},Ft.default.createElement(l1,{className:"tw-size-4"}),"projects (alpha)"):Ft.default.createElement(Si,{onSelect:()=>{p1(LC.CHAT_MODE_SELECT),o?.()}},"copilot plus (beta)",Ft.default.createElement(rO,{className:"tw-size-3"}))))),Ft.default.createElement("div",null,Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},Ft.default.createElement(E3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"New Chat")),!i.autosaveChat&&Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},Ft.default.createElement(g3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Save Chat as Note")),Ft.default.createElement(Rt,null,Ft.default.createElement(jt,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},Ft.default.createElement(C3,{className:"tw-size-4"}))),Ft.default.createElement(Mt,null,"Chat History")),Ft.default.createElement(WW,null,Ft.default.createElement(KW,{asChild:!0},Ft.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Advanced Settings"},Ft.default.createElement(vT,{className:"tw-size-4"}))),Ft.default.createElement(xb,{align:"end",className:"tw-w-64"},Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showSuggestedPrompts",!i.showSuggestedPrompts)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Vh,{className:"tw-size-4"}),"Suggested Prompt"),Ft.default.createElement(cz,{checked:i.showSuggestedPrompts})),Ft.default.createElement(Si,{className:"tw-flex tw-justify-between",onSelect:c=>{c.preventDefault(),dt("showRelevantNotes",!i.showRelevantNotes)}},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(Ay,{className:"tw-size-4"}),"Relevant Note"),Ft.default.createElement(cz,{checked:i.showRelevantNotes})),a==="project"?Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Jce()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Reload Current Project"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>iOn()},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Rebuild Context")):Ft.default.createElement(Ft.default.Fragment,null,Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>nOn()},Ft.default.createElement(m_,{className:"tw-size-4"}),"Refresh Vault Index"),Ft.default.createElement(Si,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new sd(app,()=>oOn(),"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()}},Ft.default.createElement(Uf,{className:"tw-size-4"}),"Force Reindex Vault"))))))}Cl();Fd();var q6t=require("obsidian");var Yce=require("obsidian"),pz=class extends Yce.FuzzySuggestModal{constructor(e){super(e),this.activeNote=e.workspace.getActiveFile()}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(i=>this.app.vault.getAbstractFileByPath(i)).filter(i=>i instanceof Yce.TFile&&(i.extension==="md"||i.extension==="pdf"||i.extension==="canvas")&&!e.includes(i.path)&&i.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(i=>i.extension==="md"||i.extension==="pdf"||i.extension==="canvas").filter(i=>!r.some(a=>a.path===i.path)&&!e.includes(i.path)&&i.path!==this.activeNote?.path);return[...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 SM=class extends pz{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 q6t.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 Zce=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 U6t=require("obsidian"),XW=class extends U6t.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)}};ti();var Qx=F(X());Cn();yn();$r();var Eke=({capabilities:t=[],iconSize:e=16})=>Qx.default.createElement(Qx.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return Qx.default.createElement(eO,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return Qx.default.createElement(QC,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return Qx.default.createElement(u1,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),Tke=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return Qx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Qx.default.createElement("span",null,r),t.capabilities&&t.capabilities.length>0&&Qx.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},Qx.default.createElement(Eke,{capabilities:t.capabilities,iconSize:e})))},Xce=t=>{let e=t.displayName||t.name,r=`(${kf(t.provider)})`;return`${e} ${r}`},QW=t=>{let e=t.displayName||t.name,r=`(${kf(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}`};Cl();Fd();var z6t=require("obsidian");$r();var mz=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 z6t.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=f4)=>{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=hJ();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}};var Qce=require("obsidian");wT();var lm=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r,n=!1){n||ace(e);let o=QI(),i=ND(e);await app.vault.adapter.exists(o)||await app.vault.createFolder(o);let s=await app.vault.create(i,r);await app.fileManager.processFrontMatter(s,u=>{u[AD]=!1,u[ID]=!1,u[MD]=Number.MAX_SAFE_INTEGER,u[RD]="",u[jD]=0})}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){n||EW(e,r);let o=app.vault.getAbstractFileByPath(ND(e.title));if(e.title!==r){let i=ND(e.title);if(app.vault.getAbstractFileByPath(i))throw new Rr("Error saving custom prompt. Please check if the title already exists.");let s=ND(r),u=app.vault.getAbstractFileByPath(s);u instanceof Qce.TFile&&(await app.vault.rename(u,i),o=u)}o||(await this.createCommand(e.title,e.content,n),o=app.vault.getAbstractFileByPath(ND(e.title))),o instanceof Qce.TFile&&(await app.vault.modify(o,e.content),await app.fileManager.processFrontMatter(o,i=>{i[AD]=e.showInContextMenu,i[ID]=e.showInSlashMenu,i[MD]=e.order,i[RD]=e.modelKey,i[jD]=e.lastUsedMs}))}async updateCommands(e){sce(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async deleteCommand(e){PW(e.title);let r=app.vault.getAbstractFileByPath(ND(e.title));r instanceof Qce.TFile&&await app.vault.delete(r)}};nr();Cn();yn();var CM=require("obsidian"),at=F(X());var vn=F(X()),Mi=F(Z6t());function xM(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 uOn=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 XD(t,e,r){let n=lOn(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&X6t(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),X6t(n,"relativePath",i),n}function lOn(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=uOn.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function X6t(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var cOn=[".DS_Store","Thumbs.db"];function Ike(t){return xM(this,void 0,void 0,function*(){return ede(t)&&dOn(t.dataTransfer)?hOn(t.dataTransfer,t.type):fOn(t)?pOn(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?mOn(t):[]})}function dOn(t){return ede(t)}function fOn(t){return ede(t)&&ede(t.target)}function ede(t){return typeof t=="object"&&t!==null}function pOn(t){return Ake(t.target.files).map(e=>XD(e))}function mOn(t){return xM(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>XD(r))})}function hOn(t,e){return xM(this,void 0,void 0,function*(){if(t.items){let r=Ake(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(gOn));return Q6t(t5t(n))}return Q6t(Ake(t.files).map(r=>XD(r)))})}function Q6t(t){return t.filter(e=>cOn.indexOf(e.name)===-1)}function Ake(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 gOn(t){if(typeof t.webkitGetAsEntry!="function")return e5t(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?r5t(e):e5t(t,e)}function t5t(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?t5t(r):[r]],[])}function e5t(t,e){return xM(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,XD(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return XD(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function yOn(t){return xM(this,void 0,void 0,function*(){return t.isDirectory?r5t(t):bOn(t)})}function r5t(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>xM(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(yOn));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function bOn(t){return xM(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=XD(n,t.fullPath);e(o)},n=>{r(n)})})})}var tde=F(n5t());function o5t(t){return wOn(t)||vOn(t)||c5t(t)||_On()}function _On(){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 vOn(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function wOn(t){if(Array.isArray(t))return Rke(t)}function i5t(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 a5t(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?i5t(Object(r),!0).forEach(function(n){l5t(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i5t(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function l5t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e9(t,e){return COn(t)||xOn(t,e)||c5t(t,e)||SOn()}function SOn(){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 c5t(t,e){if(t){if(typeof t=="string")return Rke(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 Rke(t,e)}}function Rke(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 xOn(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 COn(t){if(Array.isArray(t))return t}var OOn=typeof tde.default=="function"?tde.default:tde.default.default,POn="file-invalid-type",EOn="file-too-large",TOn="file-too-small",AOn="too-many-files";var IOn=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:POn,message:"File type must be ".concat(n)}},s5t=function(e){return{code:EOn,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},u5t=function(e){return{code:TOn,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},d5t={code:AOn,message:"Too many files"};function jke(t,e){var r=t.type==="application/x-moz-file"||OOn(t,e);return[r,r?null:IOn(e)]}function Nke(t,e,r){if(QD(t.size))if(QD(e)&&QD(r)){if(t.size>r)return[!1,s5t(r)];if(t.size<e)return[!1,u5t(e)]}else{if(QD(e)&&t.size<e)return[!1,u5t(e)];if(QD(r)&&t.size>r)return[!1,s5t(r)]}return[!0,null]}function QD(t){return t!=null}function f5t(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=jke(u,r),c=e9(l,1),d=c[0],f=Nke(u,n,o),p=e9(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function t9(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function r9(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 Dke(t){t.preventDefault()}function MOn(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function ROn(t){return t.indexOf("Edge/")!==-1}function p5t(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return MOn(t)||ROn(t)}function Pb(){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!t9(n)&&s&&s.apply(void 0,[n].concat(i)),t9(n)})}}function m5t(){return"showOpenFilePicker"in window}function h5t(t){if(QD(t)){var e=Object.entries(t).filter(function(r){var n=e9(r,2),o=n[0],i=n[1],a=!0;return _5t(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(v5t))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=e9(n,2),i=o[0],a=o[1];return a5t(a5t({},r),{},l5t({},i,a))},{});return[{description:"Files",accept:e}]}return t}function g5t(t){if(QD(t))return Object.entries(t).reduce(function(e,r){var n=e9(r,2),o=n[0],i=n[1];return[].concat(o5t(e),[o],o5t(i))},[]).filter(function(e){return _5t(e)||v5t(e)}).join(",")}function y5t(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function b5t(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function _5t(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function v5t(t){return/^.*\.[\w]+$/.test(t)}var jOn=["children"],NOn=["open"],DOn=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],LOn=["refKey","onChange","onClick"];function FOn(t){return BOn(t)||$On(t)||x5t(t)||kOn()}function kOn(){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 $On(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function BOn(t){if(Array.isArray(t))return Fke(t)}function Lke(t,e){return zOn(t)||UOn(t,e)||x5t(t,e)||qOn()}function qOn(){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 x5t(t,e){if(t){if(typeof t=="string")return Fke(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 Fke(t,e)}}function Fke(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 UOn(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 zOn(t){if(Array.isArray(t))return t}function w5t(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 ts(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?w5t(Object(r),!0).forEach(function(n){kke(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):w5t(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function kke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rde(t,e){if(t==null)return{};var r=HOn(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 HOn(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 Bke=(0,vn.forwardRef)(function(t,e){var r=t.children,n=rde(t,jOn),o=qke(n),i=o.open,a=rde(o,NOn);return(0,vn.useImperativeHandle)(e,function(){return{open:i}},[i]),vn.default.createElement(vn.Fragment,null,r(ts(ts({},a),{},{open:i})))});Bke.displayName="Dropzone";var C5t={disabled:!1,getFilesFromEvent:Ike,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};Bke.defaultProps=C5t;Bke.propTypes={children:Mi.default.func,accept:Mi.default.objectOf(Mi.default.arrayOf(Mi.default.string)),multiple:Mi.default.bool,preventDropOnDocument:Mi.default.bool,noClick:Mi.default.bool,noKeyboard:Mi.default.bool,noDrag:Mi.default.bool,noDragEventsBubbling:Mi.default.bool,minSize:Mi.default.number,maxSize:Mi.default.number,maxFiles:Mi.default.number,disabled:Mi.default.bool,getFilesFromEvent:Mi.default.func,onFileDialogCancel:Mi.default.func,onFileDialogOpen:Mi.default.func,useFsAccessApi:Mi.default.bool,autoFocus:Mi.default.bool,onDragEnter:Mi.default.func,onDragLeave:Mi.default.func,onDragOver:Mi.default.func,onDrop:Mi.default.func,onDropAccepted:Mi.default.func,onDropRejected:Mi.default.func,onError:Mi.default.func,validator:Mi.default.func};var $ke={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function qke(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=ts(ts({},C5t),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,S=e.preventDropOnDocument,x=e.noClick,O=e.noKeyboard,P=e.noDrag,E=e.noDragEventsBubbling,A=e.onError,I=e.validator,R=(0,vn.useMemo)(function(){return g5t(r)},[r]),N=(0,vn.useMemo)(function(){return h5t(r)},[r]),j=(0,vn.useMemo)(function(){return typeof b=="function"?b:S5t},[b]),$=(0,vn.useMemo)(function(){return typeof h=="function"?h:S5t},[h]),k=(0,vn.useRef)(null),z=(0,vn.useRef)(null),V=(0,vn.useReducer)(VOn,$ke),Q=Lke(V,2),J=Q[0],D=Q[1],B=J.isFocused,q=J.isFileDialogActive,K=(0,vn.useRef)(typeof window<"u"&&window.isSecureContext&&g&&m5t()),H=function(){!K.current&&q&&setTimeout(function(){if(z.current){var se=z.current.files;se.length||(D({type:"closeDialog"}),$())}},300)};(0,vn.useEffect)(function(){return window.addEventListener("focus",H,!1),function(){window.removeEventListener("focus",H,!1)}},[z,q,$,K]);var ee=(0,vn.useRef)([]),U=function(se){k.current&&k.current.contains(se.target)||(se.preventDefault(),ee.current=[])};(0,vn.useEffect)(function(){return S&&(document.addEventListener("dragover",Dke,!1),document.addEventListener("drop",U,!1)),function(){S&&(document.removeEventListener("dragover",Dke),document.removeEventListener("drop",U))}},[k,S]),(0,vn.useEffect)(function(){return!n&&y&&k.current&&k.current.focus(),function(){}},[k,y,n]);var W=(0,vn.useCallback)(function(oe){A?A(oe):console.error(oe)},[A]),Y=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[].concat(FOn(ee.current),[oe.target]),r9(oe)&&Promise.resolve(o(oe)).then(function(se){if(!(t9(oe)&&!E)){var ce=se.length,Ce=ce>0&&f5t({files:se,accept:R,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:I}),Je=ce>0&&!Ce;D({isDragAccept:Ce,isDragReject:Je,isDragActive:!0,type:"setDraggedFiles"}),l&&l(oe)}}).catch(function(se){return W(se)})},[o,l,W,E,R,a,i,s,u,I]),ae=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=r9(oe);if(se&&oe.dataTransfer)try{oe.dataTransfer.dropEffect="copy"}catch{}return se&&d&&d(oe),!1},[d,E]),Oe=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe);var se=ee.current.filter(function(Ce){return k.current&&k.current.contains(Ce)}),ce=se.indexOf(oe.target);ce!==-1&&se.splice(ce,1),ee.current=se,!(se.length>0)&&(D({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),r9(oe)&&c&&c(oe))},[k,c,E]),le=(0,vn.useCallback)(function(oe,se){var ce=[],Ce=[];oe.forEach(function(Je){var ir=jke(Je,R),ea=Lke(ir,2),ta=ea[0],xc=ea[1],Cd=Nke(Je,a,i),qi=Lke(Cd,2),lp=qi[0],yf=qi[1],bf=I?I(Je):null;if(ta&&lp&&!bf)ce.push(Je);else{var Sn=[xc,yf];bf&&(Sn=Sn.concat(bf)),Ce.push({file:Je,errors:Sn.filter(function(_f){return _f})})}}),(!s&&ce.length>1||s&&u>=1&&ce.length>u)&&(ce.forEach(function(Je){Ce.push({file:Je,errors:[d5t]})}),ce.splice(0)),D({acceptedFiles:ce,fileRejections:Ce,isDragReject:Ce.length>0,type:"setFiles"}),f&&f(ce,Ce,se),Ce.length>0&&m&&m(Ce,se),ce.length>0&&p&&p(ce,se)},[D,s,R,a,i,u,f,p,m,I]),Be=(0,vn.useCallback)(function(oe){oe.preventDefault(),oe.persist(),te(oe),ee.current=[],r9(oe)&&Promise.resolve(o(oe)).then(function(se){t9(oe)&&!E||le(se,oe)}).catch(function(se){return W(se)}),D({type:"reset"})},[o,le,W,E]),ze=(0,vn.useCallback)(function(){if(K.current){D({type:"openDialog"}),j();var oe={multiple:s,types:N};window.showOpenFilePicker(oe).then(function(se){return o(se)}).then(function(se){le(se,null),D({type:"closeDialog"})}).catch(function(se){y5t(se)?($(se),D({type:"closeDialog"})):b5t(se)?(K.current=!1,z.current?(z.current.value=null,z.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(se)});return}z.current&&(D({type:"openDialog"}),j(),z.current.value=null,z.current.click())},[D,j,$,g,le,W,N,s]),rt=(0,vn.useCallback)(function(oe){!k.current||!k.current.isEqualNode(oe.target)||(oe.key===" "||oe.key==="Enter"||oe.keyCode===32||oe.keyCode===13)&&(oe.preventDefault(),ze())},[k,ze]),cr=(0,vn.useCallback)(function(){D({type:"focus"})},[]),wn=(0,vn.useCallback)(function(){D({type:"blur"})},[]),Le=(0,vn.useCallback)(function(){x||(p5t()?setTimeout(ze,0):ze())},[x,ze]),pt=function(se){return n?null:se},mt=function(se){return O?null:pt(se)},ht=function(se){return P?null:pt(se)},te=function(se){E&&se.stopPropagation()},et=(0,vn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.role,Je=oe.onKeyDown,ir=oe.onFocus,ea=oe.onBlur,ta=oe.onClick,xc=oe.onDragEnter,Cd=oe.onDragOver,qi=oe.onDragLeave,lp=oe.onDrop,yf=rde(oe,DOn);return ts(ts(kke({onKeyDown:mt(Pb(Je,rt)),onFocus:mt(Pb(ir,cr)),onBlur:mt(Pb(ea,wn)),onClick:pt(Pb(ta,Le)),onDragEnter:ht(Pb(xc,Y)),onDragOver:ht(Pb(Cd,ae)),onDragLeave:ht(Pb(qi,Oe)),onDrop:ht(Pb(lp,Be)),role:typeof Ce=="string"&&Ce!==""?Ce:"presentation"},ce,k),!n&&!O?{tabIndex:0}:{}),yf)}},[k,rt,cr,wn,Le,Y,ae,Oe,Be,O,P,n]),Re=(0,vn.useCallback)(function(oe){oe.stopPropagation()},[]),Pe=(0,vn.useMemo)(function(){return function(){var oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=oe.refKey,ce=se===void 0?"ref":se,Ce=oe.onChange,Je=oe.onClick,ir=rde(oe,LOn),ea=kke({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:pt(Pb(Ce,Be)),onClick:pt(Pb(Je,Re)),tabIndex:-1},ce,z);return ts(ts({},ea),ir)}},[z,r,s,Be,n]);return ts(ts({},J),{},{isFocused:B&&!n,getRootProps:et,getInputProps:Pe,rootRef:k,inputRef:z,open:pt(ze)})}function VOn(t,e){switch(e.type){case"focus":return ts(ts({},t),{},{isFocused:!0});case"blur":return ts(ts({},t),{},{isFocused:!1});case"openDialog":return ts(ts({},$ke),{},{isFileDialogActive:!0});case"closeDialog":return ts(ts({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return ts(ts({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return ts(ts({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return ts({},$ke);default:return t}}function S5t(){}Cl();var E5t=F(X());Fd();yn();var Xo=F(X());ti();var nde=F(X());F7();Tn();var WOn=QF("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"}}),cm=nde.forwardRef(({className:t,variant:e,...r},n)=>nde.createElement("div",{ref:n,className:_e(WOn({variant:e}),t),...r}));cm.displayName="Badge";function O5t({note:t,isActive:e=!1,onRemoveContext:r}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.basename),e&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),t.extension==="pdf"&&Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(t.path),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function KOn({url:t,onRemoveUrl:e}){return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Link")),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}function GOn({selectedText:t,onRemoveSelectedText:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Xo.default.createElement(cm,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Xo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xo.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Xo.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Xo.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e(t.id),"aria-label":"Remove from context"},Xo.default.createElement(Vi,{className:"tw-size-4"})))}var P5t=({activeNote:t,contextNotes:e,contextUrls:r,selectedTextContexts:n=[],onAddContext:o,onRemoveContext:i,onRemoveUrl:a,onRemoveSelectedText:s})=>{let u=Xo.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=Xo.default.useMemo(()=>Array.from(new Set(r)),[r]),c=u.length>0||l.length>0||n.length>0||!!t;return Xo.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-gap-1"},Xo.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xo.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border"},Xo.default.createElement(Mm,{className:"tw-size-4"}),!c&&Xo.default.createElement("span",{className:"tw-pr-1 tw-text-xs tw-leading-4"},"Add context"))),Xo.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&Xo.default.createElement(O5t,{key:t.path,note:t,isActive:!0,onRemoveContext:i}),u.map(d=>Xo.default.createElement(O5t,{key:d.path,note:d,isActive:!1,onRemoveContext:i})),l.map(d=>Xo.default.createElement(KOn,{key:d,url:d,onRemoveUrl:a})),n.map(d=>Xo.default.createElement(GOn,{key:d.id,selectedText:d,onRemoveSelectedText:s||(()=>{})}))))};var JOn=({app:t,excludeNotePaths:e,contextNotes:r,setContextNotes:n,includeActiveNote:o,setIncludeActiveNote:i,activeNote:a,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})=>{let[d]=by(),f=()=>{new SM({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:E5t.default.createElement(P5t,{activeNote:o?a:null,contextNotes:r,onAddContext:f,onRemoveContext:p,contextUrls:s,onRemoveUrl:u,selectedTextContexts:l,onRemoveSelectedText:c})},T5t=JOn;var A5t=(0,at.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,S]=(0,at.useState)(!1),[x,O]=(0,at.useState)([]),P=(0,at.useRef)(null),E=(0,at.useRef)(null),[A,I]=wF(),[R,N]=(0,at.useState)(null),[j]=by(),[$]=QVe(),[k,z]=(0,at.useState)(i.workspace.getActiveFile()),[V,Q]=(0,at.useState)(null),J=Rn(),D=j==="copilot_plus"||j==="project",[B,q]=(0,at.useState)(0),K=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,at.useImperativeHandle)(g,()=>({focus:()=>{P.current?.focus()}})),(0,at.useEffect)(()=>{if(j==="project"){Q(Mc());let Le=SF(pt=>{Q(pt)});return()=>{Le()}}else Q(null)},[j]),(0,at.useEffect)(()=>{if(!$)return;let Le=setInterval(()=>{q(pt=>(pt+1)%K.length)},3e3);return()=>clearInterval(Le)},[$,K.length]);let H=()=>V&&j==="project"&&V.projectModelKey?V.projectModelKey:A,ee=Le=>{if(!D){r();return}r({toolCalls:Le?["@vault"]:[],contextNotes:a,urls:x})},U=async Le=>{let pt=Le.target.value,mt=Le.target.selectionStart,ht=mt>0&&pt[mt-1]==="/"&&(mt===1||pt[mt-2]===" ");e(pt),W();let et=c.extractAllUrls(pt).filter(Re=>!x.includes(Re));et.length>0&&O(Re=>Array.from(new Set([...Re,...et]))),mt>=2&&pt.slice(mt-2,mt)==="[["?Y(mt):ht?ae(mt,pt):pt.slice(-1)==="@"&&D&&Oe()},W=()=>{P.current&&(P.current.style.height="auto",P.current.style.height=`${P.current.scrollHeight}px`)};(0,at.useEffect)(()=>{W()},[t]);let Y=Le=>{(async()=>{let mt=mz.getInstance();new SM({app:i,onNoteSelect:async ht=>{let te=t.slice(0,Le-2),et=t.slice(Le-1),Pe=Zhe(ht.basename,i.vault)?ht.basename:ht.path,oe=`${te}[[${Pe}]]${et}`;e(oe);let se=i.workspace.getActiveFile();ht&&await mt.addNoteToContext(ht,i.vault,a,se,s,l),setTimeout(()=>{if(P.current){let ce=Le+Pe.length+2;P.current.setSelectionRange(ce,ce)}},0)},excludeNotePaths:wn}).open()})()},ae=(Le,pt)=>{let mt=lm.getInstance(),ht=Gx(),te=E3t(ht.filter(oe=>oe.showInSlashMenu)),et=te.map(oe=>oe.title),Re=Le-1;new XW(i,et,oe=>{let se=te.find(ce=>ce.title===oe);if(se){mt.recordUsage(se);let ce="",Ce="";Re>=0&&pt[Re]==="/"&&(ce=pt.slice(0,Re),Ce=pt.slice(Re+1));let Je=ce+se.content+Ce;e(Je),setTimeout(()=>{if(P.current){let ir=ce.length+se.content.length;P.current.setSelectionRange(ir,ir),P.current.focus()}},0)}}).open()},Oe=()=>{let Le=Z6.map(pt=>({title:pt,description:A1t(pt)}));new XW(i,Le.map(pt=>pt.title),pt=>{e(t+pt+" ")},Le.map(pt=>pt.description)).open()},le=Le=>{if(!Le.nativeEvent.isComposing){if(Le.key==="Enter"&&Le.shiftKey&&(CM.Platform.isMacOS?Le.metaKey:Le.ctrlKey)){Le.preventDefault(),Le.stopPropagation(),ee(!0);return}if(Le.key==="Enter"){if(!(!Le.shiftKey&&!CM.Platform.isMobile||Le.shiftKey&&CM.Platform.isMobile))return;Le.preventDefault(),ee(!1)}}},Be=(0,at.useCallback)(async Le=>{let pt=Le.clipboardData?.items;if(!pt||!D)return;let mt=Array.from(pt).filter(ht=>ht.type.indexOf("image")!==-1);if(mt.length>0){Le.preventDefault();let te=(await Promise.all(mt.map(et=>{let Re=et.getAsFile();return Re||null}))).filter(et=>et!==null);te.length>0&&f(te)}},[f,D]);(0,at.useEffect)(()=>{let Le=new Set(NC(t,i.vault)),pt=c.extractAllUrls(t);s(mt=>mt.filter(ht=>{if(ht.wasAddedManually===!0)return!0;let et=ht.wasAddedViaReference===!0;return ht.path===k?.path?et?Le.has(ht):u:et?Le.has(ht):!0})),O(mt=>mt.filter(ht=>pt.includes(ht)))},[t,u,k,c,s,i.vault]),(0,at.useEffect)(()=>{let Le,pt=()=>{clearTimeout(Le),Le=setTimeout(()=>{let ht=i.workspace.getActiveFile();z(ht)},100)},mt=i.workspace.on("active-leaf-change",pt);return()=>{clearTimeout(Le),i.workspace.offref(mt)}},[i.workspace]);let{getRootProps:ze,getInputProps:rt,isDragActive:cr}=qke({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Le=>{f(Le)},noClick:!0,noDragEventsBubbling:!0}),wn=(0,at.useMemo)(()=>[...a.map(Le=>Le.path),...u&&k?[k.path]:[]].filter(Le=>Le!=null),[a,u,k]);return at.default.createElement("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-0.5 tw-rounded-md tw-border tw-border-solid tw-border-border tw-px-1 tw-pb-1 tw-pt-2 tw-@container/chat-input",ref:E},at.default.createElement(T5t,{app:i,excludeNotePaths:wn,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,activeNote:k,contextUrls:x,onRemoveUrl:Le=>O(pt=>pt.filter(mt=>mt!==Le)),selectedTextContexts:h,onRemoveSelectedText:b}),d.length>0&&at.default.createElement("div",{className:"selected-images"},d.map((Le,pt)=>at.default.createElement("div",{key:pt,className:"image-preview-container"},at.default.createElement("img",{src:URL.createObjectURL(Le),alt:Le.name,className:"selected-image-preview"}),at.default.createElement("button",{className:"remove-image-button",onClick:()=>p(mt=>mt.filter((ht,te)=>te!==pt)),title:"Remove image"},at.default.createElement(Vi,{className:"tw-size-4"}))))),at.default.createElement("div",{className:"tw-relative",...D?ze():{}},$&&at.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"},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},at.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}),at.default.createElement("span",{className:"tw-text-sm"},K[B]))),at.default.createElement("textarea",{ref:P,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:le,onPaste:Be,disabled:$}),D&&at.default.createElement(at.default.Fragment,null,at.default.createElement("input",{...rt()}),cr&&at.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"},at.default.createElement("span",null,"Drop images here...")))),at.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-faint"},at.default.createElement(Yl,{className:"tw-size-3 tw-animate-spin"}),at.default.createElement("span",null,"Generating...")):at.default.createElement(JD,{open:y,onOpenChange:S},at.default.createElement(YD,{asChild:!0},at.default.createElement(ge,{variant:"ghost2",size:"fit",disabled:m},R?at.default.createElement("span",{className:"tw-text-error"},"Model Load Failed"):J.activeModels.find(Le=>Le.enabled&&kr(Le)===H())?at.default.createElement(Tke,{model:J.activeModels.find(Le=>Le.enabled&&kr(Le)===H()),iconSize:8}):"Select Model",!m&&at.default.createElement(Hi,{className:"tw-mt-0.5 tw-size-5"}))),at.default.createElement(xb,{align:"start"},!m&&J.activeModels.filter(Le=>Le.enabled).map(Le=>{let{hasApiKey:pt,errorNotice:mt}=mF(Le,J);return at.default.createElement(Si,{key:kr(Le),onSelect:async ht=>{if(!pt&&mt){ht.preventDefault(),new CM.Notice(mt);return}try{N(null),I(kr(Le))}catch(te){let et="Model switch failed: "+ei(te);N(et),new CM.Notice(et);let Re=J.activeModels.find(Pe=>Pe.enabled&&kr(Pe)===A);Re&&I(kr(Re))}},className:pt?"":"tw-cursor-not-allowed tw-opacity-50"},at.default.createElement(Tke,{model:Le,iconSize:12}))}))),at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},at.default.createElement(bT,{className:"tw-size-4"}),"Stop"):at.default.createElement(at.default.Fragment,null,D&&at.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>{new Zce(i,f).open()}},at.default.createElement(O3,{className:"tw-size-4"})),at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>ee(!1)},at.default.createElement(Im,{className:"!tw-size-3"}),at.default.createElement("span",null,"chat")),j==="copilot_plus"&&at.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-hidden tw-text-muted @xs/chat-input:tw-inline-flex",onClick:()=>ee(!0)},at.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},CM.Platform.isMacOS?at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement(c_,{className:"!tw-size-3"}),at.default.createElement(YC,{className:"!tw-size-3"}),at.default.createElement(Im,{className:"!tw-size-3"})):at.default.createElement("div",{className:"tw-flex tw-items-center"},at.default.createElement("span",null,"Ctrl"),at.default.createElement(YC,{className:"tw-size-4"}),at.default.createElement(Im,{className:"!tw-size-3"})),at.default.createElement("span",null,"vault")))))))});A5t.displayName="ChatInput";var I5t=A5t;ti();$r();Tn();yn();var M5t=require("obsidian"),vr=F(X()),R5t=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>vr.default.createElement("div",{className:_e("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!M5t.Platform.isMobile})},t.sender===Pi?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},vr.default.createElement(Rp,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Edit")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))):vr.default.createElement(vr.default.Fragment,null,u&&vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},vr.default.createElement(l1,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Show Sources")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},vr.default.createElement(I3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Insert / Replace at cursor")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?vr.default.createElement(Jl,{className:"tw-size-4"}):vr.default.createElement(Ty,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Copy")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},vr.default.createElement(A3,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Regenerate")),vr.default.createElement(Rt,null,vr.default.createElement(jt,{asChild:!0},vr.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},vr.default.createElement(Rm,{className:"tw-size-4"}))),vr.default.createElement(Mt,null,"Delete"))));$r();var j5t=require("obsidian"),ode=class extends j5t.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>=rge),n=this.sources.filter(o=>o.score<rge);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()}};$r();Tn();Cn();yn();var lE=require("obsidian");function Eb(){}Eb.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(x){return x=a.postProcess(x,o),i?(setTimeout(function(){i(x)},0),!0):x}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(N5t(a,m[0].lastComponent,r,e,a.useLongestToken));var b=-1/0,g=1/0;function y(){for(var x=Math.max(b,-c);x<=Math.min(g,c);x+=2){var O=void 0,P=m[x-1],E=m[x+1];P&&(m[x-1]=void 0);var A=!1;if(E){var I=E.oldPos-x;A=E&&0<=I&&I<u}var R=P&&P.oldPos+1<l;if(!A&&!R){m[x]=void 0;continue}if(!R||A&&P.oldPos<E.oldPos?O=a.addToPath(E,!0,!1,0,o):O=a.addToPath(P,!1,!0,1,o),h=a.extractCommon(O,r,e,x,o),O.oldPos+1>=l&&h+1>=u)return s(N5t(a,O.lastComponent,r,e,a.useLongestToken));m[x]=O,O.oldPos+1>=l&&(g=Math.min(g,x-1)),h+1>=u&&(b=Math.max(b,x+1))}c++}if(i)(function x(){setTimeout(function(){if(c>d||Date.now()>p)return i();y()||x()},0)})();else for(;c<=d&&Date.now()<=p;){var S=y();if(S)return S}},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 N5t(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 Ndi=new Eb;function D5t(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 L5t(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 Uke(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 zke(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 n9(t,e){return Uke(t,e,"")}function ide(t,e){return zke(t,e,"")}function F5t(t,e){return e.slice(0,YOn(t,e))}function YOn(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 ade="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}",ZOn=new RegExp("[".concat(ade,"]+|\\s+|[^").concat(ade,"]"),"ug"),i9=new Eb;i9.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};i9.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(ZOn)||[];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};i9.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};i9.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)&&k5t(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&k5t(r,o,n,null),t};function $5t(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?XOn(t,e,r):i9.diff(t,e,r)}function k5t(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=D5t(o,a);t.value=zke(t.value,a,u),e.value=n9(e.value,u),r.value=n9(r.value,u)}if(n){var l=L5t(i,s);n.value=Uke(n.value,s,l),e.value=ide(e.value,l),r.value=ide(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=D5t(c,d);e.value=n9(e.value,p);var m=L5t(n9(c,p),f);e.value=ide(e.value,m),n.value=Uke(n.value,c,m),t.value=zke(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=F5t(b,h);e.value=ide(e.value,g)}else if(t){var y=t.value.match(/\s*$/)[0],S=e.value.match(/^\s*/)[0],x=F5t(y,S);e.value=n9(e.value,x)}}var B5t=new Eb;B5t.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(ade,"]+|[^\\S\\n\\r]+|[^").concat(ade,"]"),"ug");return t.match(e)||[]};function XOn(t,e,r){return B5t.diff(t,e,r)}function QOn(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 sde=new Eb;sde.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};sde.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))),Eb.prototype.equals.call(this,t,e,r)};function q5t(t,e,r){var n=QOn(r,{ignoreWhitespace:!0});return sde.diff(t,e,n)}var ePn=new Eb;ePn.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var tPn=new Eb;tPn.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function Hke(t){"@babel/helpers - typeof";return Hke=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},Hke(t)}var o9=new Eb;o9.useLongestToken=!0;o9.tokenize=sde.tokenize;o9.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(Vke(t,null,null,o),o," ")};o9.equals=function(t,e,r){return Eb.prototype.equals.call(o9,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function Vke(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]=Vke(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),Hke(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]=Vke(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var Wke=new Eb;Wke.tokenize=function(t){return t.slice()};Wke.join=Wke.removeEmpty=function(t){return t};var Sr=F(X()),K5t=F(Dc());var Tb=F(X());ti();yn();Tn();yo();yn();var sE=require("obsidian"),wr=F(X()),U5t=F(Dc());ti();var z5t=F(X());function rPn(t){return t.trim().split(`
`).map(r=>"- "+r).join(`
`)}function Kke(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?rPn(a.value):"").join(`
`):r.map(s=>s.value).join(`
`).trim().length>0&&(i="..."),i}).join(`
`)}function a9(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 s9="obsidian-copilot-apply-view",ude=class extends sE.ItemView{constructor(r){super(r);this.root=null;this.state=null}getViewType(){return s9}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,U5t.createRoot)(n)),this.root.render(wr.default.createElement(nPn,{app:this.app,state:this.state,close:()=>this.leaf.detach()}))}},H5t=(0,wr.memo)(({oldLine:t,newLine:e})=>{let r=$5t(t,e);return wr.default.createElement(wr.default.Fragment,null,r.map((n,o)=>n.added?wr.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?wr.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):wr.default.createElement("span",{key:o},n.value)))});H5t.displayName="WordDiff";var nPn=({app:t,state:e,close:r})=>{let[n,o]=(0,z5t.useState)(()=>e.changes.map(p=>({...p,accepted:null}))),i=a9(n),a=(0,wr.useRef)([]);if(!e||!e.changes)return fe("Invalid state:",e),wr.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},wr.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),wr.default.createElement(ge,{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 sE.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 sE.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 sE.TFile)){new sE.Notice("File not found:"+e.path),r();return}await t.vault.modify(h,m),new sE.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(S=>S.added||S.removed),y=b.some(S=>(S.added||S.removed)&&S.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(S=>S===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(S=>S===g);y!==-1&&(h[y]={...h[y],accepted:!1})}),h}),setTimeout(()=>c(p),0)};return wr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},wr.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"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:u},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:s},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept")),wr.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),wr.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 wr.default.createElement("div",{key:m,ref:g=>a.current[m]=g,className:_e("tw-mb-4 tw-overflow-hidden tw-rounded-md")},b==="accepted"?wr.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)=>wr.default.createElement("div",{key:y},g.value))):b==="rejected"?wr.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)=>wr.default.createElement("div",{key:y},g.value))):p.map((g,y)=>{if(g.added){let S=p.findIndex((x,O)=>x.removed&&O!==y);if(S!==-1){let x=p[S].value;return wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},wr.default.createElement(H5t,{oldLine:x,newLine:g.value})))}}return g.removed&&p.findIndex((x,O)=>x.added&&O!==y)!==-1?null:wr.default.createElement("div",{key:`${m}-${y}`,className:"tw-relative"},wr.default.createElement("div",{className:_e("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"&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement(ge,{variant:"destructive",size:"sm",onClick:()=>f(m)},wr.default.createElement(Vi,{className:"tw-size-4"}),"Reject"),wr.default.createElement(ge,{variant:"success",size:"sm",onClick:()=>d(m)},wr.default.createElement(Jl,{className:"tw-size-4"}),"Accept"))),h&&(b==="accepted"||b==="rejected")&&wr.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"},wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wr.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},b==="accepted"?wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},wr.default.createElement(Jl,{className:"tw-size-4"}),wr.default.createElement("div",null,"Accepted")):wr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},wr.default.createElement(Vi,{className:"tw-size-4"}),wr.default.createElement("div",null,"Rejected"))),wr.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{o(g=>{let y=[...g],S=i?.[m];return S&&S.forEach(x=>{let O=y.findIndex(P=>P===x);O!==-1&&(y[O]={...y[O],accepted:null})}),y})}},"Revert"))))})))};yo();var uE=require("obsidian"),V5t=require("obsidian");var W5t=({note_path:t,note_content:e,note_changes:r})=>Tb.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&&Tb.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"},Tb.default.createElement("div",{className:"tw-flex-1 tw-truncate tw-p-1 tw-text-xs tw-text-muted"},t),Tb.default.createElement("div",{className:"tw-flex tw-gap-2"},Tb.default.createElement(ge,{className:"tw-text-muted",variant:"ghost2",size:"fit",onClick:()=>{try{let i=r.length>0?Kke(a9(r)):e;navigator.clipboard.writeText(i),new uE.Notice("Content copied to clipboard")}catch(i){fe("Error copying to clipboard:",i),new uE.Notice(`Failed to copy: ${i.message}`)}}},Tb.default.createElement(f3,{className:"tw-size-4"}),"Copy"),Tb.default.createElement(ge,{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 uE.Notice(`Created new file: ${t}`),a=!0;else{new uE.Notice(`Failed to create file: ${t}`);return}a=!0}catch(l){fe("Error creating file:",l),new uE.Notice(`Failed to create file: ${l.message}`);return}if(!(i instanceof V5t.TFile)){new uE.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 uE.Notice(`Switched to ${i.name}`)),a)return;await app.workspace.getLeaf(!0).setViewState({type:s9,active:!0,state:{changes:r,path:t}})}catch(i){fe("Error calling composer apply:",i),new uE.Notice(`Error processing code: ${i.message}`)}}},Tb.default.createElement(Jl,{className:"tw-size-4"}),app.vault.getAbstractFileByPath(t)?"Preview":"Apply"))),Tb.default.createElement("pre",{className:"tw-m-0 tw-border-none"},Tb.default.createElement("code",null,r.length>0?Kke(a9(r)):e)));function oPn({context:t}){return!t||t.notes.length===0&&t.urls.length===0?null:Sr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map(e=>Sr.default.createElement(Rt,{key:e.path},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e.basename))),Sr.default.createElement(Mt,null,e.path))),t.urls.map(e=>Sr.default.createElement(Rt,{key:e},Sr.default.createElement(jt,{asChild:!0},Sr.default.createElement(cm,{variant:"secondary"},Sr.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e))),Sr.default.createElement(Mt,null,e))))}var iPn=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i,chatHistory:a=[]})=>{let[s,u]=(0,Sr.useState)(!1),[l,c]=(0,Sr.useState)(!1),[d,f]=(0,Sr.useState)(t.message),p=(0,Sr.useRef)(null),m=(0,Sr.useRef)(null),h=(0,Sr.useRef)(null),b=()=>{!navigator.clipboard||!navigator.clipboard.writeText||navigator.clipboard.writeText(t.message).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},g=(0,Sr.useCallback)(j=>{let $=e.workspace.getActiveFile(),k=$?$.path:"",z=ee=>{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&&ee.includes("<think>"))return ee=ee.replace(/<think>([\s\S]*?)<\/think>/g,(Oe,le)=>`<details style="${U}">
<summary style="${W}">Thought for a second</summary>
<div class="tw-text-muted" style="${Y}">${le.trim()}</div>
</details>
`),ee=ee.replace(/<think>([\s\S]*)$/,(Oe,le)=>`<div style="${U}">
<div style="${W}">Thinking...</div>
<div class="tw-text-muted" style="${Y}">${le.trim()}</div>
</div>`),ee;let ae=/<think>([\s\S]*?)<\/think>/g;return ee.replace(ae,(Oe,le)=>`<details style="${U}">
<summary style="${W}">Thought for a second</summary>
<div class="tw-text-muted" style="${Y}">${le.trim()}</div>
</details>
`)},V=ee=>{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(ee))!==null;){let ae=Y[1],Oe=Y.index,le=ae.match(/"path"\s*:\s*"([^"]+)"/),Be=le?le[1].trim():"...";ee=ee.substring(0,Oe)+U(Be);break}}return ee},Q=(ee,U,W)=>ee.split(/(```[\s\S]*?```|`[^`]*`)/g).map((ae,Oe)=>Oe%2===0?ae.replace(U,(le,Be)=>{let ze=e.metadataCache.getFirstLinkpathDest(Be,k);return ze?W(ze):le}):ae).join(""),J=j.replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),D=V(J),B=Q(D,/!\[\[(.*?)]]/g,ee=>`![](${e.vault.getResourcePath(ee)})`),q=z(B),K=y(q);return Q(K,/(?<!!)\[\[([^\]]+)]]/g,ee=>`<a href="obsidian://open?file=${encodeURIComponent(ee.path)}">${ee.basename}</a>`)},[e,r]),y=j=>{let $=j.split(`
#### Sources:
`);if($.length!==2)return j;let[k,z]=$,V=z.split(`
`).map(Q=>{let J=Q.match(/- \[\[(.*?)\]\]/);return J?`<li>[[${J[1]}]]</li>`:Q}).join(`
`);return k+`
<br/>
<details><summary>Sources</summary>
<ul>
`+V+`
</ul>
</details>`};(0,Sr.useEffect)(()=>{let j=[],$=!1;if(p.current&&t.sender!==Pi){p.current.innerHTML="",m.current||(m.current=new lE.Component);let k=g(t.message);if(!$&&(lE.MarkdownRenderer.renderMarkdown(k,p.current,"",m.current),!r)){let z=p.current.querySelectorAll("pre");z.length>0&&z.forEach(V=>{if($)return;let Q=V.querySelector("code");if(!Q)return;let J=Q.textContent||"";try{if(J.trim().startsWith("{")&&J.trim().endsWith("}")){let D=JSON.parse(J);if(D.type==="composer"&&D.path&&(typeof D.content=="string"||typeof D.canvas_json=="string")){let B;typeof D.content=="string"?B=D.content:B=JSON.stringify(D.canvas_json);let q=D.path.trim();q.startsWith("/")&&(q=q.slice(1));let K=document.createElement("div");V.parentNode?.replaceChild(K,V);let H=(0,K5t.createRoot)(K);j.push(H);let ee=e.vault.getAbstractFileByPath(q),U=[];(async()=>{if(ee instanceof lE.TFile){let W=await e.vault.read(ee);U=q5t(W,B,{newlineIsToken:!0})}else{let W=q.split("/").pop()?.split(".")[0],Y=B.split(`
`);(Y[0]===`# ${W}
`||Y[0]===`## ${W}`)&&Y.shift(),B=Y.join(`
`)}$||H.render(Sr.default.createElement(W5t,{note_path:q,note_content:B,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,Sr.useEffect)(()=>{l&&h.current&&S(h.current)},[l]),(0,Sr.useEffect)(()=>{f(t.message)},[t.message]);let S=j=>{j.style.height="auto",j.style.height=`${j.scrollHeight}px`},x=j=>{f(j.target.value),S(j.target)},O=j=>{j.nativeEvent.isComposing||(j.key==="Enter"&&!j.shiftKey?(j.preventDefault(),A()):j.key==="Escape"&&(j.preventDefault(),P()))},P=()=>{c(!1),f(t.message)},E=()=>{c(!0)},A=()=>{c(!1),o&&o(d)},I=()=>{t.sources&&t.sources.length>0&&new ode(e,t.sources).open()},R=()=>{let j=e.workspace.getMostRecentLeaf();if((!j||!(j.view instanceof lE.MarkdownView))&&(j=e.workspace.getLeaf(!1),!j||!(j.view instanceof lE.MarkdownView)))return;let k=j.view.editor.getSelection().length>0;l4(t.message,k)},N=()=>t.content?Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((j,$)=>j.type==="text"?Sr.default.createElement("div",{key:$},t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""})):j.type==="image_url"?Sr.default.createElement("div",{key:$,className:"message-image-content"},Sr.default.createElement("img",{src:j.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Pi&&l?Sr.default.createElement("textarea",{ref:h,value:d,onChange:x,onKeyDown:O,autoFocus:!0,className:"edit-textarea"}):t.sender===Pi?Sr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Sr.default.createElement("div",{ref:p,className:t.isErrorMessage?"tw-text-error":""});return Sr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Sr.default.createElement("div",{className:_e("tw-group tw-mx-2 tw-flex tw-gap-2 tw-rounded-md tw-p-2",t.sender===Pi&&"tw-border tw-border-solid tw-border-border")},Sr.default.createElement("div",{className:"tw-w-6 tw-shrink-0"},t.sender===Pi?Sr.default.createElement(M3,null):Sr.default.createElement(a1,null)),Sr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-grow tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&Sr.default.createElement(oPn,{context:t.context}),Sr.default.createElement("div",{className:"message-content"},N()),!r&&Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Sr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Sr.default.createElement(R5t,{message:t,onCopy:b,isCopied:s,onInsertIntoEditor:R,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},Gke=iPn;ti();var hd=F(X(),1);function G5t(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Y5t=F(X(),1);function J5t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Jke(...t){return e=>{let r=!1,n=t.map(o=>{let i=J5t(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():J5t(t[o],null)}}}}function Z5t(...t){return Y5t.useCallback(Jke(...t),t)}var X5t=F(X(),1),cPn=F(ds(),1);var md=F(X(),1);var hz=F(ft(),1),Zke=md.forwardRef((t,e)=>{let{children:r,...n}=t,o=md.Children.toArray(r),i=o.find(sPn);if(i){let a=i.props.children,s=o.map(u=>u===i?md.Children.count(a)>1?md.Children.only(null):md.isValidElement(a)?a.props.children:null:u);return(0,hz.jsx)(Yke,{...n,ref:e,children:md.isValidElement(a)?md.cloneElement(a,void 0,s):null})}return(0,hz.jsx)(Yke,{...n,ref:e,children:r})});Zke.displayName="Slot";var Yke=md.forwardRef((t,e)=>{let{children:r,...n}=t;if(md.isValidElement(r)){let o=lPn(r);return md.cloneElement(r,{...uPn(n,r.props),ref:e?Jke(e,o):o})}return md.Children.count(r)>1?md.Children.only(null):null});Yke.displayName="SlotClone";var aPn=({children:t})=>(0,hz.jsx)(hz.Fragment,{children:t});function sPn(t){return md.isValidElement(t)&&t.type===aPn}function uPn(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 lPn(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 Q5t=F(ft(),1),dPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],lde=dPn.reduce((t,e)=>{let r=X5t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Zke:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Q5t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var eL=F(ft(),1),Xke="Collapsible",[fPn,Efi]=Yi(Xke),[pPn,Qke]=fPn(Xke),eWt=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=ud({prop:n,defaultProp:o,onChange:a});return(0,eL.jsx)(pPn,{scope:r,disabled:i,contentId:hl(),open:u,onOpenToggle:hd.useCallback(()=>l(c=>!c),[l]),children:(0,eL.jsx)(lde.div,{"data-state":n$e(u),"data-disabled":i?"":void 0,...s,ref:e})})});eWt.displayName=Xke;var tWt="CollapsibleTrigger",e$e=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=Qke(tWt,r);return(0,eL.jsx)(lde.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":n$e(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:G5t(t.onClick,o.onOpenToggle)})});e$e.displayName=tWt;var t$e="CollapsibleContent",r$e=hd.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Qke(t$e,t.__scopeCollapsible);return(0,eL.jsx)(fd,{present:r||o.open,children:({present:i})=>(0,eL.jsx)(mPn,{...n,ref:e,present:i})})});r$e.displayName=t$e;var mPn=hd.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=Qke(t$e,r),[s,u]=hd.useState(n),l=hd.useRef(null),c=Z5t(e,l),d=hd.useRef(0),f=d.current,p=hd.useRef(0),m=p.current,h=a.open||s,b=hd.useRef(h),g=hd.useRef(void 0);return hd.useEffect(()=>{let y=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(y)},[]),Jn(()=>{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 S=y.getBoundingClientRect();d.current=S.height,p.current=S.width,b.current||(y.style.transitionDuration=g.current.transitionDuration,y.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,eL.jsx)(lde.div,{"data-state":n$e(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 n$e(t){return t?"open":"closed"}var rWt=eWt;var cE=rWt,tL=e$e,dE=r$e;var f9=F(X());var Da=F(X(),1);function eC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var oWt=F(X(),1);function nWt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function o$e(...t){return e=>{let r=!1,n=t.map(o=>{let i=nWt(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():nWt(t[o],null)}}}}function Ab(...t){return oWt.useCallback(o$e(...t),t)}var rs=F(X(),1);var iWt=F(X(),1),aWt=F(ds(),1);var gd=F(X(),1);var gz=F(ft(),1),u9=gd.forwardRef((t,e)=>{let{children:r,...n}=t,o=gd.Children.toArray(r),i=o.find(yPn);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,gz.jsx)(i$e,{...n,ref:e,children:gd.isValidElement(a)?gd.cloneElement(a,void 0,s):null})}return(0,gz.jsx)(i$e,{...n,ref:e,children:r})});u9.displayName="Slot";var i$e=gd.forwardRef((t,e)=>{let{children:r,...n}=t;if(gd.isValidElement(r)){let o=_Pn(r);return gd.cloneElement(r,{...bPn(n,r.props),ref:e?o$e(e,o):o})}return gd.Children.count(r)>1?gd.Children.only(null):null});i$e.displayName="SlotClone";var gPn=({children:t})=>(0,gz.jsx)(gz.Fragment,{children:t});function yPn(t){return gd.isValidElement(t)&&t.type===gPn}function bPn(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 _Pn(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 sWt=F(ft(),1),vPn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],op=vPn.reduce((t,e)=>{let r=iWt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?u9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,sWt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function uWt(t,e){t&&aWt.flushSync(()=>t.dispatchEvent(e))}var s$e=F(ft(),1),wPn="DismissableLayer",a$e="dismissableLayer.update",SPn="dismissableLayer.pointerDownOutside",xPn="dismissableLayer.focusOutside",lWt,dWt=rs.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),u$e=rs.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=rs.useContext(dWt),[c,d]=rs.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=rs.useState({}),m=Ab(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=PPn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=EPn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),rs.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(lWt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),cWt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lWt)}},[c,f,r,l]),rs.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),cWt())},[c,l]),rs.useEffect(()=>{let E=()=>p({});return document.addEventListener(a$e,E),()=>document.removeEventListener(a$e,E)},[]),(0,s$e.jsx)(op.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:eC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:eC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:eC(t.onPointerDownCapture,O.onPointerDownCapture)})});u$e.displayName=wPn;var CPn="DismissableLayerBranch",OPn=rs.forwardRef((t,e)=>{let r=rs.useContext(dWt),n=rs.useRef(null),o=Ab(e,n);return rs.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,s$e.jsx)(op.div,{...t,ref:o})});OPn.displayName=CPn;function PPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1),o=rs.useRef(()=>{});return rs.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){fWt(SPn,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 EPn(t,e=globalThis?.document){let r=Ur(t),n=rs.useRef(!1);return rs.useEffect(()=>{let o=i=>{i.target&&!n.current&&fWt(xPn,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 cWt(){let t=new CustomEvent(a$e);document.dispatchEvent(t)}function fWt(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?uWt(o,i):o.dispatchEvent(i)}var Qg=F(X(),1);var yWt=F(ft(),1),l$e="focusScope.autoFocusOnMount",c$e="focusScope.autoFocusOnUnmount",pWt={bubbles:!1,cancelable:!0},TPn="FocusScope",d$e=Qg.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=Qg.useState(null),l=Ur(o),c=Ur(i),d=Qg.useRef(null),f=Ab(e,h=>u(h)),p=Qg.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Qg.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:OM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||OM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&OM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),Qg.useEffect(()=>{if(s){hWt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(l$e,pWt);s.addEventListener(l$e,l),s.dispatchEvent(g),g.defaultPrevented||(APn(NPn(bWt(s)),{select:!0}),document.activeElement===h&&OM(s))}return()=>{s.removeEventListener(l$e,l),setTimeout(()=>{let g=new CustomEvent(c$e,pWt);s.addEventListener(c$e,c),s.dispatchEvent(g),g.defaultPrevented||OM(h??document.body,{select:!0}),s.removeEventListener(c$e,c),hWt.remove(p)},0)}}},[s,l,c,p]);let m=Qg.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,[S,x]=IPn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&OM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&OM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,yWt.jsx)(op.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});d$e.displayName=TPn;function APn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(OM(n,{select:e}),document.activeElement!==r)return}function IPn(t){let e=bWt(t),r=mWt(e,t),n=mWt(e.reverse(),t);return[r,n]}function bWt(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 mWt(t,e){for(let r of t)if(!MPn(r,{upTo:e}))return r}function MPn(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 RPn(t){return t instanceof HTMLInputElement&&"select"in t}function OM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&RPn(t)&&e&&t.select()}}var hWt=jPn();function jPn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=gWt(t,e),t.unshift(e)},remove(e){t=gWt(t,e),t[0]?.resume()}}}function gWt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function NPn(t){return t.filter(e=>e.tagName!=="A")}var fh=F(X(),1);var _Wt=F(X(),1);var f$e=F(ft(),1),DPn="Arrow",vWt=_Wt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,f$e.jsx)(op.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,f$e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});vWt.displayName=DPn;var wWt=vWt;var PM=F(ft(),1);var p$e="Popper",[SWt,m$e]=Yi(p$e),[FPn,xWt]=SWt(p$e),CWt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=fh.useState(null);return(0,PM.jsx)(FPn,{scope:e,anchor:n,onAnchorChange:o,children:r})};CWt.displayName=p$e;var OWt="PopperAnchor",PWt=fh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=xWt(OWt,r),a=fh.useRef(null),s=Ab(e,a);return fh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,PM.jsx)(op.div,{...o,ref:s})});PWt.displayName=OWt;var h$e="PopperContent",[kPn,$Pn]=SWt(h$e),EWt=fh.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=xWt(h$e,r),[g,y]=fh.useState(null),S=Ab(e,Y=>y(Y)),[x,O]=fh.useState(null),P=Xx(x),E=P?.width??0,A=P?.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(qPn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),UPn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=IWt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=fh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,PM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,PM.jsx)(kPn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,PM.jsx)(op.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});EWt.displayName=h$e;var TWt="PopperArrow",BPn={top:"bottom",right:"left",bottom:"top",left:"right"},AWt=fh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=$Pn(TWt,n),a=BPn[i.placedSide];return(0,PM.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,PM.jsx)(wWt,{...o,ref:r,style:{...o.style,display:"block"}})})});AWt.displayName=TWt;function qPn(t){return t!==null}var UPn=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]=IWt(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 IWt(t){let[e,r="center"]=t.split("-");return[e,r]}var MWt=CWt,g$e=PWt,RWt=EWt,jWt=AWt;var cde=F(X(),1),NWt=F(ds(),1);var DWt=F(ft(),1),HPn="Portal",y$e=cde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=cde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?NWt.default.createPortal((0,DWt.jsx)(op.div,{...n,ref:e}),a):null});y$e.displayName=HPn;var pde=F(X());var pf=F(X());var dde=HD();var b$e=function(){},l9=pf.forwardRef(function(t,e){var r=pf.useRef(null),n=pf.useState({onScrollCapture:b$e,onWheelCapture:b$e,onTouchMoveCapture:b$e}),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,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=zD([r,e]),P=yi(yi({},S),o);return pf.createElement(pf.Fragment,null,c&&pf.createElement(x,{sideCar:dde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?pf.cloneElement(pf.Children.only(s),yi(yi({},P),{ref:O})):pf.createElement(g,yi({},P,{className:u,ref:O}),s))});l9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};l9.classNames={fullWidth:Sb,zeroRight:wb};var ba=F(X());var _$e=!1;if(typeof window<"u")try{c9=Object.defineProperty({},"passive",{get:function(){return _$e=!0,!0}}),window.addEventListener("test",c9,c9),window.removeEventListener("test",c9,c9)}catch{_$e=!1}var c9,rL=_$e?{passive:!1}:!1;var VPn=function(t){return t.tagName==="TEXTAREA"},LWt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!VPn(t)&&r[e]==="visible")},WPn=function(t){return LWt(t,"overflowY")},KPn=function(t){return LWt(t,"overflowX")},v$e=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=FWt(t,n);if(o){var i=kWt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},GPn=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},JPn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},FWt=function(t,e){return t==="v"?WPn(e):KPn(e)},kWt=function(t,e){return t==="v"?GPn(e):JPn(e)},YPn=function(t,e){return t==="h"&&e==="rtl"?-1:1},$Wt=function(t,e,r,n,o){var i=YPn(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=kWt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&FWt(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 fde=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},BWt=function(t){return[t.deltaX,t.deltaY]},qWt=function(t){return t&&"current"in t?t.current:t},ZPn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},XPn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},QPn=0,yz=[];function UWt(t){var e=ba.useRef([]),r=ba.useRef([0,0]),n=ba.useRef(),o=ba.useState(QPn++)[0],i=ba.useState(iE)[0],a=ba.useRef(t);ba.useEffect(function(){a.current=t},[t]),ba.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(qWt),!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=ba.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=fde(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=v$e(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=v$e(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return $Wt(I,b,h,I==="h"?S:x,!0)},[]),u=ba.useCallback(function(h){var b=h;if(!(!yz.length||yz[yz.length-1]!==i)){var g="deltaY"in b?BWt(b):fde(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&ZPn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(qWt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=ba.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:eEn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=ba.useCallback(function(h){r.current=fde(h),n.current=void 0},[]),d=ba.useCallback(function(h){l(h.type,BWt(h),h.target,s(h,t.lockRef.current))},[]),f=ba.useCallback(function(h){l(h.type,fde(h),h.target,s(h,t.lockRef.current))},[]);ba.useEffect(function(){return yz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,rL),document.addEventListener("touchmove",u,rL),document.addEventListener("touchstart",c,rL),function(){yz=yz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,rL),document.removeEventListener("touchmove",u,rL),document.removeEventListener("touchstart",c,rL)}},[]);var p=t.removeScrollBar,m=t.inert;return ba.createElement(ba.Fragment,null,m?ba.createElement(i,{styles:XPn(o)}):null,p?ba.createElement(WD,{gapMode:t.gapMode}):null)}function eEn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var zWt=VD(dde,UWt);var HWt=pde.forwardRef(function(t,e){return pde.createElement(l9,yi({},t,{ref:e,sideCar:zWt}))});HWt.classNames=l9.classNames;var w$e=HWt;var bl=F(ft(),1),S$e="Popover",[VWt,Upi]=Yi(S$e,[m$e]),d9=m$e(),[tEn,EM]=VWt(S$e),WWt=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=d9(e),u=Da.useRef(null),[l,c]=Da.useState(!1),[d=!1,f]=ud({prop:n,defaultProp:o,onChange:i});return(0,bl.jsx)(MWt,{...s,children:(0,bl.jsx)(tEn,{scope:e,contentId:hl(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Da.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Da.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Da.useCallback(()=>c(!1),[]),modal:a,children:r})})};WWt.displayName=S$e;var KWt="PopoverAnchor",rEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(KWt,r),i=d9(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Da.useEffect(()=>(a(),()=>s()),[a,s]),(0,bl.jsx)(g$e,{...i,...n,ref:e})});rEn.displayName=KWt;var GWt="PopoverTrigger",JWt=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(GWt,r),i=d9(r),a=Ab(e,o.triggerRef),s=(0,bl.jsx)(op.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":t9t(o.open),...n,ref:a,onClick:eC(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,bl.jsx)(g$e,{asChild:!0,...i,children:s})});JWt.displayName=GWt;var x$e="PopoverPortal",[nEn,oEn]=VWt(x$e,{forceMount:void 0}),YWt=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=EM(x$e,e);return(0,bl.jsx)(nEn,{scope:e,forceMount:r,children:(0,bl.jsx)(fd,{present:r||i.open,children:(0,bl.jsx)(y$e,{asChild:!0,container:o,children:n})})})};YWt.displayName=x$e;var bz="PopoverContent",ZWt=Da.forwardRef((t,e)=>{let r=oEn(bz,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=EM(bz,t.__scopePopover);return(0,bl.jsx)(fd,{present:n||i.open,children:i.modal?(0,bl.jsx)(iEn,{...o,ref:e}):(0,bl.jsx)(aEn,{...o,ref:e})})});ZWt.displayName=bz;var iEn=Da.forwardRef((t,e)=>{let r=EM(bz,t.__scopePopover),n=Da.useRef(null),o=Ab(e,n),i=Da.useRef(!1);return Da.useEffect(()=>{let a=n.current;if(a)return bM(a)},[]),(0,bl.jsx)(w$e,{as:u9,allowPinchZoom:!0,children:(0,bl.jsx)(XWt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:eC(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:eC(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:eC(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),aEn=Da.forwardRef((t,e)=>{let r=EM(bz,t.__scopePopover),n=Da.useRef(!1),o=Da.useRef(!1);return(0,bl.jsx)(XWt,{...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()}})}),XWt=Da.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=EM(bz,r),p=d9(r);return iM(),(0,bl.jsx)(d$e,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,bl.jsx)(u$e,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,bl.jsx)(RWt,{"data-state":t9t(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)"}})})})}),QWt="PopoverClose",e9t=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=EM(QWt,r);return(0,bl.jsx)(op.button,{type:"button",...n,ref:e,onClick:eC(t.onClick,()=>o.onOpenChange(!1))})});e9t.displayName=QWt;var sEn="PopoverArrow",uEn=Da.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=d9(r);return(0,bl.jsx)(jWt,{...o,...n,ref:e})});uEn.displayName=sEn;function t9t(t){return t?"open":"closed"}var r9t=WWt;var n9t=JWt,o9t=YWt,C$e=ZWt,i9t=e9t;Tn();var mde=r9t,hde=n9t;var p9=f9.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>f9.createElement(o9t,{container:n??activeDocument.body},f9.createElement(C$e,{ref:i,align:e,sideOffset:r,className:_e("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})));p9.displayName=C$e.displayName;var O$e=i9t;$r();var P$e=F(X()),gde=P$e.createContext(void 0),_z=P$e.createContext(void 0);var vz=F(X());function E$e(){let[t,e]=(0,vz.useState)(null),r=(0,vz.useContext)(_z);return(0,vz.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Dh.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Dh.ACTIVE_LEAF_CHANGE,n)}},[r]),t}Tn();Ix();yn();var m9=require("obsidian"),Ke=F(X());function cEn(t){let[e,r]=(0,Ke.useState)([]),n=E$e();return(0,Ke.useEffect)(()=>{async function o(){if(!n?.path)return;let i=await ma.getInstance().getDb(),a=await Xle({db:i,filePath:n.path});r(a)}o()},[n?.path,t]),e}function dEn(t,e){let[r,n]=(0,Ke.useState)(!0);return(0,Ke.useEffect)(()=>{if(!t)return;async function o(){let i=await ma.getInstance().hasIndex(t);n(i)}o()},[t,e]),r}function fEn({score:t}){let e=Zle(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Ke.default.createElement("span",{className:"tw-text-sm"},r)}function pEn({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Ke.useState)(!1),[i,a]=(0,Ke.useState)(null),s=(0,Ke.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof m9.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,Ke.useEffect)(()=>{n&&s()},[n,s]),Ke.default.createElement(cE,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Ke.default.createElement("div",{className:_e("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Ke.default.createElement(tL,null,Ke.default.createElement(ZC,{className:_e("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Ke.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Ke.default.createElement(fEn,{score:t.metadata.similarityScore??0})),Ke.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Ke.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)),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Ke.default.createElement(Am,{className:"tw-size-4"}))),Ke.default.createElement(Mt,null,"Add to Chat"))),Ke.default.createElement(dE,null,Ke.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Ke.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&&Ke.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)),Ke.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&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(w3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ke.default.createElement(v3,{className:"tw-size-4"}),Ke.default.createElement("span",null,"Backlinks")))))}function mEn({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Ke.default.createElement(mde,{key:t.document.path},Ke.default.createElement(hde,{asChild:!0},n),Ke.default.createElement(p9,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Ke.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Ke.default.createElement("div",{className:"tw-flex tw-gap-2"},Ke.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 ",Ke.default.createElement(Am,{className:"tw-size-4"})),Ke.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 ",Ke.default.createElement(c3,{className:"tw-size-4"})))))}var yde=(0,Ke.memo)(({className:t,onInsertToChat:e,defaultOpen:r=!1})=>{let[n,o]=(0,Ke.useState)(0),[i,a]=(0,Ke.useState)(r),s=cEn(n),u=E$e(),l=dEn(u?.path??"",n),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof m9.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{e(`[[${p}]]`)},f=async()=>{u&&(await ma.getInstance().reindexFile(u),new m9.Notice(`Reindexed ${u.name}`),o(n+1))};return Ke.default.createElement("div",{className:_e("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Ke.default.createElement(cE,{open:i,onOpenChange:a},Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Ke.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ke.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),Ke.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Relevance is a combination of semantic similarity and links.")),!l&&Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(Uf,{className:"tw-size-4 tw-text-warning"})),Ke.default.createElement(Mt,{side:"bottom"},"Note has not been indexed"))),Ke.default.createElement("div",{className:"tw-flex tw-items-center"},Ke.default.createElement(Rt,null,Ke.default.createElement(jt,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:f},Ke.default.createElement(T3,{className:"tw-size-4"}))),Ke.default.createElement(Mt,{side:"bottom"},"Reindex Current Note")),s.length>0&&Ke.default.createElement(tL,{asChild:!0},Ke.default.createElement(ge,{variant:"ghost2",size:"icon"},i?Ke.default.createElement(Ey,{className:"tw-size-5"}):Ke.default.createElement(Hi,{className:"tw-size-5"}))))),s.length===0&&Ke.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"},Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!i&&s.length>0&&Ke.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=>Ke.default.createElement(mEn,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},Ke.default.createElement(cm,{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"},Ke.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Ke.default.createElement(dE,null,Ke.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=>Ke.default.createElement(pEn,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});yde.displayName="RelevantNotes";Cl();Fd();ti();var dm=F(X());Tn();var h9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));h9.displayName="Card";var g9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));g9.displayName="CardHeader";var T$e=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));T$e.displayName="CardTitle";var hEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));hEn.displayName="CardDescription";var y9=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-p-6 tw-pt-0",t),...e}));y9.displayName="CardContent";var gEn=dm.forwardRef(({className:t,...e},r)=>dm.createElement("div",{ref:r,className:_e("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));gEn.displayName="CardFooter";$r();nr();yn();var Xi=F(X()),A$e={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>]]"]}},a9t={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function yEn(t="llm_chain"){let e=a9t[t]||a9t.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...A$e[n].prompts].sort(()=>Math.random()-.5)),{title:A$e[n].title,text:r[n].pop()||A$e[n].prompts[0]}))}var s9t=({onClick:t})=>{let[e]=by(),r=(0,Xi.useMemo)(()=>yEn(e),[e]),o=Rn().indexVaultToVectorStore;return Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Xi.default.createElement(h9,{className:"tw-w-full tw-bg-transparent"},Xi.default.createElement(g9,{className:"tw-px-2"},Xi.default.createElement(T$e,null,"Suggested Prompts")),Xi.default.createElement(y9,{className:"tw-p-2 tw-pt-0"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Xi.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"},Xi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Xi.default.createElement("div",{className:"tw-text-muted"},i.title),Xi.default.createElement("div",null,i.text)),Xi.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Xi.default.createElement(Rt,null,Xi.default.createElement(jt,{asChild:!0},Xi.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Xi.default.createElement(Am,{className:"tw-size-4"}))),Xi.default.createElement(Mt,null,"Add to Chat")))))))),e==="vault_qa"&&Xi.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"&&Xi.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Xi.default.createElement("div",null,Xi.default.createElement(Uf,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Xi.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Xi.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};nr();var mf=F(X()),u9t=(0,mf.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onInsertToChat:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,mf.useState)(""),p=Rn(),m=()=>{let b=document.querySelector("[data-testid='chat-messages']");b&&(b.scrollTop=b.scrollHeight)};if((0,mf.useEffect)(()=>{r||m()},[r]),(0,mf.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 mf.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&mf.default.createElement(yde,{onInsertToChat:u,defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&mf.default.createElement(s9t,{onClick:l}));let h=()=>n?`${n} ${d}`:d;return mf.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&mf.default.createElement(yde,{className:"tw-mb-4",onInsertToChat:u,defaultOpen:!1,key:"relevant-notes-in-chat"}),mf.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&&mf.default.createElement(Gke,{key:g,message:b,app:o,isStreaming:!1,onRegenerate:()=>i(g),onEdit:y=>a(g,y),onDelete:()=>s(g),chatHistory:t})),(e||r)&&mf.default.createElement(Gke,{key:`ai_message_${e}`,message:{sender:"AI",message:e||h(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{},chatHistory:t})))});u9t.displayName="ChatMessages";var l9t=u9t;ti();Cn();var bde=F(X());function _de(t){let[e,r]=(0,bde.useState)(null);(0,bde.useEffect)(()=>{(async()=>{let i=await bVe();i.version&&r(i.version)})()},[]);let n=e!==null&&rJ(e,t);return{latestVersion:e,hasUpdate:n}}Tn();nr();Cn();yn();var ey=F(X());function c9t({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=_de(t),n=Rn().lastDismissedVersion,[o,i]=(0,ey.useState)(!0),a=r&&e&&rJ(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{dt("lastDismissedVersion",e)},300))};return a?ey.default.createElement("div",{className:_e("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")},ey.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"},ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement("span",{className:"tw-font-medium"},"Update available:"),ey.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),ey.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ey.default.createElement(ge,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),ey.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:s},ey.default.createElement(Vi,{className:"tw-size-4"}))))):null}Cl();var d9t=require("obsidian");_g();var wz=class extends d9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=Zoe(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 I$e=require("obsidian");var b9=class extends pz{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 I$e.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 I$e.TFile){let o=n.createDiv(),i=e.item;o.setText(this.formatNoteTitle(i.basename,i===this.activeNote,i.extension)),this.titleOnly||n.createDiv({cls:"mt-1 text-muted text-xs"}).setText(i.path)}}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n&&(o+=` (${n.toUpperCase()})`),o}};Cn();var f9t=require("obsidian"),Sz=class extends f9t.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)NR(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};var xz=F(X());Tn();var vde=F(X()),bEn=2;function _En(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+bEn<t.current?.scrollWidth)??!1}function vEn(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var TM=({children:t,className:e,lineClamp:r,tooltipContent:n,...o})=>{let i=(0,vde.useRef)(null),[a,s]=(0,vde.useState)(!1);return xz.default.createElement(vo,{delayDuration:0},xz.default.createElement(Rt,{open:a,onOpenChange:l=>{s(l&&_En(i,r))}},xz.default.createElement(jt,{asChild:!0},xz.default.createElement("div",{...o,ref:i,className:_e("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&vEn(r),e),"data-testid":"truncatedText"},t)),xz.default.createElement(Mt,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};ti();var x9=F(X());yn();var w9t=F(X(),1),xt=F(X(),1),Ode=(0,xt.createContext)(null);Ode.displayName="PanelGroupContext";var vs={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"},F$e=10,oL=xt.useLayoutEffect,p9t=w9t.useId,wEn=typeof p9t=="function"?p9t:()=>null,SEn=0;function k$e(t=null){let e=wEn(),r=(0,xt.useRef)(t||e||null);return r.current===null&&(r.current=""+SEn++),t??r.current}function S9t({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,xt.useContext)(Ode);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:y,getPanelSize:S,getPanelStyle:x,groupId:O,isPanelCollapsed:P,reevaluatePanelConstraints:E,registerPanel:A,resizePanel:I,unregisterPanel:R}=b,N=k$e(a),j=(0,xt.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,xt.useRef)({didLogMissingDefaultSizeWarning:!1}),oL(()=>{let{callbacks:k,constraints:z}=j.current,V={...z};j.current.id=N,j.current.idIsFromProps=a!==void 0,j.current.order=f,k.onCollapse=l,k.onExpand=c,k.onResize=d,z.collapsedSize=r,z.collapsible=n,z.defaultSize=o,z.maxSize=s,z.minSize=u,(V.collapsedSize!==z.collapsedSize||V.collapsible!==z.collapsible||V.maxSize!==z.maxSize||V.minSize!==z.minSize)&&E(j.current,V)}),oL(()=>{let k=j.current;return A(k),()=>{R(k)}},[f,N,A,R]),(0,xt.useImperativeHandle)(i,()=>({collapse:()=>{g(j.current)},expand:k=>{y(j.current,k)},getId(){return N},getSize(){return S(j.current)},isCollapsed(){return P(j.current)},isExpanded(){return!P(j.current)},resize:k=>{I(j.current,k)}}),[g,y,S,P,N,I]);let $=x(j.current,o);return(0,xt.createElement)(m,{...h,children:t,className:e,id:N,style:{...$,...p},[vs.groupId]:O,[vs.panel]:"",[vs.panelCollapsible]:n||void 0,[vs.panelId]:N,[vs.panelSize]:parseFloat(""+$.flexGrow).toFixed(1)})}var $$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)(S9t,{...t,forwardedRef:e}));S9t.displayName="Panel";$$e.displayName="forwardRef(Panel)";var xEn;function CEn(){return xEn}var L$e=null,OEn=!0,Sde=-1,fE=null;function PEn(t,e){if(e){let r=(e&E9t)!==0,n=(e&T9t)!==0,o=(e&A9t)!==0,i=(e&I9t)!==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 EEn(){fE!==null&&(document.head.removeChild(fE),L$e=null,fE=null,Sde=-1)}function M$e(t,e){var r,n;if(!OEn)return;let o=PEn(t,e);if(L$e!==o){if(L$e=o,fE===null){fE=document.createElement("style");let a=CEn();a&&fE.setAttribute("nonce",a),document.head.appendChild(fE)}if(Sde>=0){var i;(i=fE.sheet)===null||i===void 0||i.removeRule(Sde)}Sde=(r=(n=fE.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function x9t(t){return t.type==="keydown"}function C9t(t){return t.type.startsWith("pointer")}function O9t(t){return t.type.startsWith("mouse")}function Pde(t){if(C9t(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(O9t(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function TEn(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function AEn(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 IEn(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:g9t(t),b:g9t(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;mn(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:h9t(m9t(r.a)),b:h9t(m9t(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 MEn=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function REn(t){var e;let r=getComputedStyle((e=P9t(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function jEn(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||REn(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"||MEn.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function m9t(t){let e=t.length;for(;e--;){let r=t[e];if(mn(r,"Missing node"),jEn(r))return r}return null}function h9t(t){return t&&Number(getComputedStyle(t).zIndex)||0}function g9t(t){let e=[];for(;t;)e.push(t),t=P9t(t);return e}function P9t(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var E9t=1,T9t=2,A9t=4,I9t=8,NEn=TEn()==="coarse",Ib=[],Ez=!1,AM=new Map,Ede=new Map,w9=new Set;function DEn(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=AM.get(a))!==null&&i!==void 0?i:0;return AM.set(a,u+1),w9.add(s),xde(),function(){var c;Ede.delete(t),w9.delete(s);let d=(c=AM.get(a))!==null&&c!==void 0?c:1;if(AM.set(a,d-1),xde(),d===1&&AM.delete(a),Ib.includes(s)){let f=Ib.indexOf(s);f>=0&&Ib.splice(f,1),q$e(),o("up",!0,null)}}}function LEn(t){let{target:e}=t,{x:r,y:n}=Pde(t);Ez=!0,B$e({target:e,x:r,y:n}),xde(),Ib.length>0&&(Cde("down",t),t.preventDefault(),M9t(e)||t.stopImmediatePropagation())}function R$e(t){let{x:e,y:r}=Pde(t);if(Ez&&t.buttons===0&&(Ez=!1,Cde("up",t)),!Ez){let{target:n}=t;B$e({target:n,x:e,y:r})}Cde("move",t),q$e(),Ib.length>0&&t.preventDefault()}function j$e(t){let{target:e}=t,{x:r,y:n}=Pde(t);Ede.clear(),Ez=!1,Ib.length>0&&(t.preventDefault(),M9t(e)||t.stopImmediatePropagation()),Cde("up",t),B$e({target:e,x:r,y:n}),q$e(),xde()}function M9t(t){let e=t;for(;e;){if(e.hasAttribute(vs.resizeHandle))return!0;e=e.parentElement}return!1}function B$e({target:t,x:e,y:r}){Ib.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),w9.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=NEn?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)&&IEn(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(AEn(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}Ib.push(o)}})}function N$e(t,e){Ede.set(t,e)}function q$e(){let t=!1,e=!1;Ib.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Ede.forEach(n=>{r|=n}),t&&e?M$e("intersection",r):t?M$e("horizontal",r):e?M$e("vertical",r):EEn()}var D$e=new AbortController;function xde(){D$e.abort(),D$e=new AbortController;let t={capture:!0,signal:D$e.signal};w9.size&&(Ez?(Ib.length>0&&AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",j$e,t),n.addEventListener("pointerleave",R$e,t),n.addEventListener("pointermove",R$e,t))}),AM.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",j$e,t),n.addEventListener("pointercancel",j$e,t)})):AM.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",LEn,t),n.addEventListener("pointermove",R$e,t))}))}function Cde(t,e){w9.forEach(r=>{let{setResizeHandlerState:n}=r,o=Ib.includes(r);n(t,o,e)})}function FEn(){let[t,e]=(0,xt.useState)(0);return(0,xt.useCallback)(()=>e(r=>r+1),[])}function mn(t,e){if(!t)throw console.error(e),Error(e)}function iL(t,e,r=F$e){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function pE(t,e,r=F$e){return iL(t,e,r)===0}function ph(t,e,r){return iL(t,e,r)===0}function kEn(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(!ph(o,i,r))return!1}return!0}function Pz({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];mn(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(iL(r,s)<0)if(i){let u=(o+s)/2;iL(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(F$e)),r}function _9({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(ph(t,0))return e;let a=[...e],[s,u]=n;mn(s!=null,"Invalid first pivot index"),mn(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];mn(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(mn(b!=null,`Previous layout not found for panel index ${d}`),ph(b,p)){let g=h-b;iL(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];mn(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(mn(b!=null,`Previous layout not found for panel index ${d}`),ph(b,h)){let g=b-p;iL(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];mn(h!=null,`Previous layout not found for panel index ${f}`);let g=Pz({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];mn(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,b=Pz({panelConstraints:r,panelIndex:f,size:h});if(!ph(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(kEn(o,a))return o;{let d=t<0?u:s,f=e[d];mn(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=Pz({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!ph(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let y=a[g];mn(y!=null,`Previous layout not found for panel index ${g}`);let S=y+h,x=Pz({panelConstraints:r,panelIndex:g,size:S});if(ph(y,x)||(h-=x-y,a[g]=x),ph(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return ph(c,100)?a:o}function $En({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];mn(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 S9(t,e=document){return Array.from(e.querySelectorAll(`[${vs.resizeHandleId}][data-panel-group-id="${t}"]`))}function R9t(t,e,r=document){let o=S9(t,r).findIndex(i=>i.getAttribute(vs.resizeHandleId)===e);return o??null}function j9t(t,e,r){let n=R9t(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function BEn(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function N9t(t,e=document){if(BEn(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Tde(t,e=document){let r=e.querySelector(`[${vs.resizeHandleId}="${t}"]`);return r||null}function qEn(t,e,r,n=document){var o,i,a,s;let u=Tde(e,n),l=S9(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 UEn({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,xt.useRef)({didWarnAboutMissingResizeHandle:!1}),oL(()=>{if(!i)return;let s=S9(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=$En({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];mn(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,xt.useEffect)(()=>{if(!i)return;let s=e.current;mn(s,"Eager values not found");let{panelDataArray:u}=s,l=N9t(r,i);mn(l!=null,`No group found for id "${r}"`);let c=S9(r,i);mn(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(vs.resizeHandleId);mn(p,"Resize handle element has no handle id attribute");let[m,h]=qEn(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(S=>S.id===m);if(y>=0){let S=u[y];mn(S,`No panel data found for index ${y}`);let x=n[y],{collapsedSize:O=0,collapsible:P,minSize:E=0}=S.constraints;if(x!=null&&P){let A=_9({delta:ph(x,O)?E-O:O-x,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:j9t(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 y9t(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 D9t(t,e){let r=t==="horizontal",{x:n,y:o}=Pde(e);return r?n:o}function zEn(t,e,r,n,o){let i=r==="horizontal",a=Tde(e,o);mn(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(vs.groupId);mn(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=D9t(r,t),c=N9t(s,o);mn(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function HEn(t,e,r,n,o,i){if(x9t(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:zEn(t,e,r,n,i)}function VEn({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];mn(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];mn(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 Cz(t,e,r){e.forEach((n,o)=>{let i=t[o];mn(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||pE(d,l))&&!pE(n,l)&&p(),f&&(d==null||!pE(d,l))&&pE(n,l)&&f())}})}function wde(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 WEn({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 KEn(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function b9t(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 L9t(t){return`react-resizable-panels:${t}`}function F9t(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 k9t(t,e){try{let r=L9t(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function GEn(t,e,r){var n,o;let i=(n=k9t(t,r))!==null&&n!==void 0?n:{},a=F9t(e);return(o=i[a])!==null&&o!==void 0?o:null}function JEn(t,e,r,n,o){var i;let a=L9t(t),s=F9t(e),u=(i=k9t(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 _9t({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(!ph(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];mn(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];mn(a!=null,`No layout data found for index ${i}`);let s=Pz({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!ph(o,0))for(let i=0;i<e.length;i++){let a=r[i];mn(a!=null,`No layout data found for index ${i}`);let s=a+o,u=Pz({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,ph(o,0)))break}return r}var YEn=100,v9={getItem:t=>(b9t(v9),v9.getItem(t)),setItem:(t,e)=>{b9t(v9),v9.setItem(t,e)}},v9t={};function $9t({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=v9,style:l,tagName:c="div",...d}){let f=k$e(i),p=(0,xt.useRef)(null),[m,h]=(0,xt.useState)(null),[b,g]=(0,xt.useState)([]),y=FEn(),S=(0,xt.useRef)({}),x=(0,xt.useRef)(new Map),O=(0,xt.useRef)(0),P=(0,xt.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,xt.useRef)({layout:b,panelDataArray:[],panelDataArrayChanged:!1});(0,xt.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,xt.useImperativeHandle)(o,()=>({getId:()=>P.current.id,getLayout:()=>{let{layout:H}=E.current;return H},setLayout:H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current,Y=_9t({layout:H,panelConstraints:W.map(ae=>ae.constraints)});y9t(U,Y)||(g(Y),E.current.layout=Y,ee&&ee(Y),Cz(W,Y,S.current))}}),[]),oL(()=>{P.current.autoSaveId=t,P.current.direction=n,P.current.dragState=m,P.current.id=f,P.current.onLayout=a,P.current.storage=u}),UEn({committedValuesRef:P,eagerValuesRef:E,groupId:f,layout:b,panelDataArray:E.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,xt.useEffect)(()=>{let{panelDataArray:H}=E.current;if(t){if(b.length===0||b.length!==H.length)return;let ee=v9t[t];ee==null&&(ee=KEn(JEn,YEn),v9t[t]=ee);let U=[...H],W=new Map(x.current);ee(t,U,W,b,u)}},[t,b,u]),(0,xt.useEffect)(()=>{});let A=(0,xt.useCallback)(H=>{let{onLayout:ee}=P.current,{layout:U,panelDataArray:W}=E.current;if(H.constraints.collapsible){let Y=W.map(Be=>Be.constraints),{collapsedSize:ae=0,panelSize:Oe,pivotIndices:le}=nL(W,H,U);if(mn(Oe!=null,`Panel size not found for panel "${H.id}"`),!pE(Oe,ae)){x.current.set(H.id,Oe);let ze=Oz(W,H)===W.length-1?Oe-ae:ae-Oe,rt=_9({delta:ze,initialLayout:U,panelConstraints:Y,pivotIndices:le,prevLayout:U,trigger:"imperative-api"});wde(U,rt)||(g(rt),E.current.layout=rt,ee&&ee(rt),Cz(W,rt,S.current))}}},[]),I=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current;if(H.constraints.collapsible){let ae=Y.map(cr=>cr.constraints),{collapsedSize:Oe=0,panelSize:le=0,minSize:Be=0,pivotIndices:ze}=nL(Y,H,W),rt=ee??Be;if(pE(le,Oe)){let cr=x.current.get(H.id),wn=cr!=null&&cr>=rt?cr:rt,pt=Oz(Y,H)===Y.length-1?le-wn:wn-le,mt=_9({delta:pt,initialLayout:W,panelConstraints:ae,pivotIndices:ze,prevLayout:W,trigger:"imperative-api"});wde(W,mt)||(g(mt),E.current.layout=mt,U&&U(mt),Cz(Y,mt,S.current))}}},[]),R=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{panelSize:W}=nL(U,H,ee);return mn(W!=null,`Panel size not found for panel "${H.id}"`),W},[]),N=(0,xt.useCallback)((H,ee)=>{let{panelDataArray:U}=E.current,W=Oz(U,H);return WEn({defaultSize:ee,dragState:m,layout:b,panelData:U,panelIndex:W})},[m,b]),j=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=nL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),Y===!0&&pE(ae,W)},[]),$=(0,xt.useCallback)(H=>{let{layout:ee,panelDataArray:U}=E.current,{collapsedSize:W=0,collapsible:Y,panelSize:ae}=nL(U,H,ee);return mn(ae!=null,`Panel size not found for panel "${H.id}"`),!Y||iL(ae,W)>0},[]),k=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current;ee.push(H),ee.sort((U,W)=>{let Y=U.order,ae=W.order;return Y==null&&ae==null?0:Y==null?-1:ae==null?1:Y-ae}),E.current.panelDataArrayChanged=!0,y()},[y]);oL(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:H,onLayout:ee,storage:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=null;if(H){let le=GEn(H,Y,U);le&&(x.current=new Map(Object.entries(le.expandToSizes)),ae=le.layout)}ae==null&&(ae=VEn({panelDataArray:Y}));let Oe=_9t({layout:ae,panelConstraints:Y.map(le=>le.constraints)});y9t(W,Oe)||(g(Oe),E.current.layout=Oe,ee&&ee(Oe),Cz(Y,Oe,S.current))}}),oL(()=>{let H=E.current;return()=>{H.layout=[]}},[]);let z=(0,xt.useCallback)(H=>{let ee=!1,U=p.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&(ee=!0),function(Y){Y.preventDefault();let ae=p.current;if(!ae)return()=>null;let{direction:Oe,dragState:le,id:Be,keyboardResizeBy:ze,onLayout:rt}=P.current,{layout:cr,panelDataArray:wn}=E.current,{initialLayout:Le}=le??{},pt=j9t(Be,H,ae),mt=HEn(Y,H,Oe,le,ze,ae),ht=Oe==="horizontal";ht&&ee&&(mt=-mt);let te=wn.map(Pe=>Pe.constraints),et=_9({delta:mt,initialLayout:Le??cr,panelConstraints:te,pivotIndices:pt,prevLayout:cr,trigger:x9t(Y)?"keyboard":"mouse-or-touch"}),Re=!wde(cr,et);(C9t(Y)||O9t(Y))&&O.current!=mt&&(O.current=mt,!Re&&mt!==0?ht?N$e(H,mt<0?E9t:T9t):N$e(H,mt<0?A9t:I9t):N$e(H,0)),Re&&(g(et),E.current.layout=et,rt&&rt(et),Cz(wn,et,S.current))}},[]),V=(0,xt.useCallback)((H,ee)=>{let{onLayout:U}=P.current,{layout:W,panelDataArray:Y}=E.current,ae=Y.map(cr=>cr.constraints),{panelSize:Oe,pivotIndices:le}=nL(Y,H,W);mn(Oe!=null,`Panel size not found for panel "${H.id}"`);let ze=Oz(Y,H)===Y.length-1?Oe-ee:ee-Oe,rt=_9({delta:ze,initialLayout:W,panelConstraints:ae,pivotIndices:le,prevLayout:W,trigger:"imperative-api"});wde(W,rt)||(g(rt),E.current.layout=rt,U&&U(rt),Cz(Y,rt,S.current))},[]),Q=(0,xt.useCallback)((H,ee)=>{let{layout:U,panelDataArray:W}=E.current,{collapsedSize:Y=0,collapsible:ae}=ee,{collapsedSize:Oe=0,collapsible:le,maxSize:Be=100,minSize:ze=0}=H.constraints,{panelSize:rt}=nL(W,H,U);rt!=null&&(ae&&le&&pE(rt,Y)?pE(Y,Oe)||V(H,Oe):rt<ze?V(H,ze):rt>Be&&V(H,Be))},[V]),J=(0,xt.useCallback)((H,ee)=>{let{direction:U}=P.current,{layout:W}=E.current;if(!p.current)return;let Y=Tde(H,p.current);mn(Y,`Drag handle element not found for id "${H}"`);let ae=D9t(U,ee);h({dragHandleId:H,dragHandleRect:Y.getBoundingClientRect(),initialCursorPosition:ae,initialLayout:W})},[]),D=(0,xt.useCallback)(()=>{h(null)},[]),B=(0,xt.useCallback)(H=>{let{panelDataArray:ee}=E.current,U=Oz(ee,H);U>=0&&(ee.splice(U,1),delete S.current[H.id],E.current.panelDataArrayChanged=!0,y())},[y]),q=(0,xt.useMemo)(()=>({collapsePanel:A,direction:n,dragState:m,expandPanel:I,getPanelSize:R,getPanelStyle:N,groupId:f,isPanelCollapsed:j,isPanelExpanded:$,reevaluatePanelConstraints:Q,registerPanel:k,registerResizeHandle:z,resizePanel:V,startDragging:J,stopDragging:D,unregisterPanel:B,panelGroupElement:p.current}),[A,m,n,I,R,N,f,j,$,Q,k,z,V,J,D,B]),K={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,xt.createElement)(Ode.Provider,{value:q},(0,xt.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...K,...l},[vs.group]:"",[vs.groupDirection]:n,[vs.groupId]:f}))}var U$e=(0,xt.forwardRef)((t,e)=>(0,xt.createElement)($9t,{...t,forwardedRef:e}));$9t.displayName="PanelGroup";U$e.displayName="forwardRef(PanelGroup)";function Oz(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function nL(t,e,r){let n=Oz(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function ZEn({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,xt.useEffect)(()=>{if(t||r==null||n==null)return;let o=Tde(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(vs.groupId);mn(s,`No group element found for id "${s}"`);let u=S9(s,n),l=R9t(s,e,n);mn(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 z$e({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,xt.useRef)(null),y=(0,xt.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,xt.useEffect)(()=>{y.current.onClick=a,y.current.onDragging=s,y.current.onPointerDown=l,y.current.onPointerUp=c});let S=(0,xt.useContext)(Ode);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:x,groupId:O,registerResizeHandle:P,startDragging:E,stopDragging:A,panelGroupElement:I}=S,R=k$e(o),[N,j]=(0,xt.useState)("inactive"),[$,k]=(0,xt.useState)(!1),[z,V]=(0,xt.useState)(null),Q=(0,xt.useRef)({state:N});oL(()=>{Q.current.state=N}),(0,xt.useEffect)(()=>{if(r)V(null);else{let q=P(R);V(()=>q)}},[r,R,P]);let J=(h=n?.coarse)!==null&&h!==void 0?h:15,D=(b=n?.fine)!==null&&b!==void 0?b:5;return(0,xt.useEffect)(()=>{if(r||z==null)return;let q=g.current;mn(q,"Element ref not attached");let K=!1;return DEn(R,q,x,{coarse:J,fine:D},(ee,U,W)=>{if(!U){j("inactive");return}switch(ee){case"down":{j("drag"),K=!1,mn(W,'Expected event to be defined for "down" action'),E(R,W);let{onDragging:Y,onPointerDown:ae}=y.current;Y?.(!0),ae?.();break}case"move":{let{state:Y}=Q.current;K=!0,Y!=="drag"&&j("hover"),mn(W,'Expected event to be defined for "move" action'),z(W);break}case"up":{j("hover"),A();let{onClick:Y,onDragging:ae,onPointerUp:Oe}=y.current;ae?.(!1),Oe?.(),K||Y?.();break}}})},[J,x,r,D,P,R,z,E,A]),ZEn({disabled:r,handleId:R,resizeHandler:z,panelGroupElement:I}),(0,xt.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,[vs.groupDirection]:x,[vs.groupId]:O,[vs.resizeHandle]:"",[vs.resizeHandleActive]:N==="drag"?"pointer":$?"keyboard":void 0,[vs.resizeHandleEnabled]:!r,[vs.resizeHandleId]:R,[vs.resizeHandleState]:N})}z$e.displayName="PanelResizeHandle";Tn();var B9t=({className:t,...e})=>x9.createElement(U$e,{className:_e("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),H$e=$$e,q9t=({withHandle:t,className:e,...r})=>x9.createElement(z$e,{className:_e("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&&x9.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"},x9.createElement(d_,{className:"tw-size-2.5"})));var rC=F(X());var er=F(X(),1);var U9t=F(X(),1),QEn=F(ds(),1);i1();var z9t=F(ft(),1),eTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tz=eTn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=U9t.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,z9t.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var fm=F(X(),1);var V9t=F(X(),1);function H9t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function tTn(...t){return e=>{let r=!1,n=t.map(o=>{let i=H9t(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():H9t(t[o],null)}}}}function mE(...t){return V9t.useCallback(tTn(...t),t)}var W9t=F(X(),1),C9=globalThis?.document?W9t.useLayoutEffect:()=>{};var K9t=F(X(),1);function rTn(t,e){return K9t.useReducer((r,n)=>e[r][n]??r,t)}var Az=t=>{let{present:e,children:r}=t,n=nTn(e),o=typeof r=="function"?r({present:n.isPresent}):fm.Children.only(r),i=mE(n.ref,oTn(o));return typeof r=="function"||n.isPresent?fm.cloneElement(o,{ref:i}):null};Az.displayName="Presence";function nTn(t){let[e,r]=fm.useState(),n=fm.useRef(null),o=fm.useRef(t),i=fm.useRef("none"),a=t?"mounted":"unmounted",[s,u]=rTn(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return fm.useEffect(()=>{let l=Ade(n.current);i.current=s==="mounted"?l:"none"},[s]),C9(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Ade(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),C9(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Ade(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=Ade(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 Ade(t){return t?.animationName||"none"}function oTn(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 hE=F(X(),1),G9t=F(ft(),1);function J9t(t,e=[]){let r=[];function n(i,a){let s=hE.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,b=hE.useMemo(()=>m,Object.values(m));return(0,G9t.jsx)(h.Provider,{value:b,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=hE.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=>hE.createContext(a));return function(s){let u=s?.[t]||i;return hE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,iTn(o,...e)]}function iTn(...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 hE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Iz=F(X(),1);function IM(t){let e=Iz.useRef(t);return Iz.useEffect(()=>{e.current=t}),Iz.useMemo(()=>(...r)=>e.current?.(...r),[])}var Ide=F(X(),1),aTn=F(ft(),1),sTn=Ide.createContext(void 0);function Y9t(t){let e=Ide.useContext(sTn);return t||e||"ltr"}function Z9t(t,[e,r]){return Math.min(r,Math.max(e,t))}function MM(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Q9t=F(X(),1),ci=F(ft(),1);function uTn(t,e){return Q9t.useReducer((r,n)=>e[r][n]??r,t)}var V$e="ScrollArea",[eKt,yhi]=J9t(V$e),[lTn,ty]=eKt(V$e),tKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=er.useState(null),[l,c]=er.useState(null),[d,f]=er.useState(null),[p,m]=er.useState(null),[h,b]=er.useState(null),[g,y]=er.useState(0),[S,x]=er.useState(0),[O,P]=er.useState(!1),[E,A]=er.useState(!1),I=mE(e,N=>u(N)),R=Y9t(o);return(0,ci.jsx)(lTn,{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:P,scrollbarY:h,onScrollbarYChange:b,scrollbarYEnabled:E,onScrollbarYEnabledChange:A,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,ci.jsx)(Tz.div,{dir:R,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});tKt.displayName=V$e;var rKt="ScrollAreaViewport",nKt=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=ty(rKt,r),s=er.useRef(null),u=mE(e,s,a.onViewportChange);return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.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,ci.jsx)(Tz.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,ci.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});nKt.displayName=rKt;var tC="ScrollAreaScrollbar",jde=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return er.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,ci.jsx)(cTn,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,ci.jsx)(dTn,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,ci.jsx)(oKt,{...n,ref:e,forceMount:r}):o.type==="always"?(0,ci.jsx)(W$e,{...n,ref:e}):null});jde.displayName=tC;var cTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),[i,a]=er.useState(!1);return er.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,ci.jsx)(Az,{present:r||i,children:(0,ci.jsx)(oKt,{"data-state":i?"visible":"hidden",...n,ref:e})})}),dTn=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=ty(tC,t.__scopeScrollArea),i=t.orientation==="horizontal",a=Dde(()=>u("SCROLL_END"),100),[s,u]=uTn("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 er.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),er.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,ci.jsx)(Az,{present:r||s!=="hidden",children:(0,ci.jsx)(W$e,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:MM(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:MM(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),oKt=er.forwardRef((t,e)=>{let r=ty(tC,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=er.useState(!1),s=t.orientation==="horizontal",u=Dde(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return Mz(r.viewport,u),Mz(r.content,u),(0,ci.jsx)(Az,{present:n||i,children:(0,ci.jsx)(W$e,{"data-state":i?"visible":"hidden",...o,ref:e})})}),W$e=er.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=ty(tC,t.__scopeScrollArea),i=er.useRef(null),a=er.useRef(0),[s,u]=er.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=uKt(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 yTn(f,a.current,s,p)}return r==="horizontal"?(0,ci.jsx)(fTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=X9t(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,ci.jsx)(pTn,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=X9t(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}),fTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(tC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarXChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(aKt,{"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":Nde(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),cKt(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:Rde(a.paddingLeft),paddingEnd:Rde(a.paddingRight)}})}})}),pTn=er.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=ty(tC,t.__scopeScrollArea),[a,s]=er.useState(),u=er.useRef(null),l=mE(e,u,i.onScrollbarYChange);return er.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,ci.jsx)(aKt,{"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":Nde(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),cKt(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:Rde(a.paddingTop),paddingEnd:Rde(a.paddingBottom)}})}})}),[mTn,iKt]=eKt(tC),aKt=er.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=ty(tC,r),[m,h]=er.useState(null),b=mE(e,I=>h(I)),g=er.useRef(null),y=er.useRef(""),S=p.viewport,x=n.content-n.viewport,O=IM(c),P=IM(u),E=Dde(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 er.useEffect(()=>{let I=R=>{let N=R.target;m?.contains(N)&&O(R,x)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[S,m,x,O]),er.useEffect(P,[n,P]),Mz(m,E),Mz(p.content,E),(0,ci.jsx)(mTn,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:IM(i),onThumbPointerUp:IM(a),onThumbPositionChange:P,onThumbPointerDown:IM(s),children:(0,ci.jsx)(Tz.div,{...f,ref:b,style:{position:"absolute",...f.style},onPointerDown:MM(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:MM(t.onPointerMove,A),onPointerUp:MM(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})})})}),Mde="ScrollAreaThumb",K$e=er.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=iKt(Mde,t.__scopeScrollArea);return(0,ci.jsx)(Az,{present:r||o.hasThumb,children:(0,ci.jsx)(hTn,{ref:e,...n})})}),hTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=ty(Mde,r),a=iKt(Mde,r),{onThumbPositionChange:s}=a,u=mE(e,d=>a.onThumbChange(d)),l=er.useRef(void 0),c=Dde(()=>{l.current&&(l.current(),l.current=void 0)},100);return er.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=bTn(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,ci.jsx)(Tz.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:MM(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:MM(t.onPointerUp,a.onThumbPointerUp)})});K$e.displayName=Mde;var G$e="ScrollAreaCorner",sKt=er.forwardRef((t,e)=>{let r=ty(G$e,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,ci.jsx)(gTn,{...t,ref:e}):null});sKt.displayName=G$e;var gTn=er.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=ty(G$e,r),[i,a]=er.useState(0),[s,u]=er.useState(0),l=!!(i&&s);return Mz(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),Mz(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,ci.jsx)(Tz.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 Rde(t){return t?parseInt(t,10):0}function uKt(t,e){let r=t/e;return isNaN(r)?0:r}function Nde(t){let e=uKt(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function yTn(t,e,r,n="ltr"){let o=Nde(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 lKt([u,l],d)(t)}function X9t(t,e,r="ltr"){let n=Nde(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=Z9t(t,u);return lKt([0,a],[0,s])(l)}function lKt(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 cKt(t,e){return t>0&&t<e}var bTn=(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 Dde(t,e){let r=IM(t),n=er.useRef(0);return er.useEffect(()=>()=>window.clearTimeout(n.current),[]),er.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function Mz(t,e){let r=IM(e);C9(()=>{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 J$e=tKt,dKt=nKt;var fKt=sKt;Tn();var Lde=rC.forwardRef(({className:t,children:e,...r},n)=>rC.createElement(J$e,{ref:n,className:_e("tw-relative tw-overflow-hidden",t),...r},rC.createElement(dKt,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),rC.createElement(pKt,null),rC.createElement(fKt,null)));Lde.displayName=J$e.displayName;var pKt=rC.forwardRef(({className:t,orientation:e="vertical",...r},n)=>rC.createElement(jde,{ref:n,orientation:e,className:_e("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},rC.createElement(K$e,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));pKt.displayName=jde.displayName;var Rz=F(X());var Fde=F(X());Tn();var mo=Fde.forwardRef(({className:t,type:e,...r},n)=>Fde.createElement("input",{type:e,className:_e("!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}));mo.displayName="Input";ti();yn();var kde=({value:t,onChange:e,placeholder:r="Search..."})=>Rz.default.createElement("div",{className:"tw-relative"},Rz.default.createElement(mo,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&Rz.default.createElement(ge,{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"},Rz.default.createElement(_T,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),Rz.default.createElement(c1,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var $de=F(X());var bKt=F(X(),1);var mKt=F(X(),1),vTn=F(ds(),1);i1();var hKt=F(ft(),1),wTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gKt=wTn.reduce((t,e)=>{let r=GC(`Primitive.${e}`),n=mKt.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,hKt.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var _Kt=F(ft(),1),STn="Separator",yKt="horizontal",xTn=["horizontal","vertical"],vKt=bKt.forwardRef((t,e)=>{let{decorative:r,orientation:n=yKt,...o}=t,i=CTn(n)?n:yKt,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,_Kt.jsx)(gKt.div,{"data-orientation":i,...s,...o,ref:e})});vKt.displayName=STn;function CTn(t){return xTn.includes(t)}var Y$e=vKt;Tn();var O9=$de.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>$de.createElement(Y$e,{ref:o,decorative:r,orientation:e,className:_e("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}));O9.displayName=Y$e.displayName;Tn();_g();Cn();yn();var qde=require("obsidian"),je=F(X()),SKt=F(Dc());function PTn({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?je.default.createElement(_3,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?je.default.createElement(b3,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?je.default.createElement(S3,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?je.default.createElement(Ay,{className:`${e}`}):je.default.createElement(Ay,{className:`tw-text-faint ${e}`})}var Z$e=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>je.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},je.default.createElement("div",{className:"tw-flex tw-items-center"},je.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&je.default.createElement(vo,{delayDuration:0},je.default.createElement(Rt,null,je.default.createElement(jt,{asChild:!0},je.default.createElement(di,{className:"tw-ml-2 tw-size-4 tw-text-muted"})),je.default.createElement(Mt,null,je.default.createElement("div",{className:"tw-max-w-80"},o))))),je.default.createElement(ge,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},je.default.createElement(Am,{className:`tw-size-4 ${r}`}))),wKt=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),je.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>je.default.createElement("div",{key:f.id,className:_e("tw-group tw-flex tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-md tw-p-2 hover:tw-bg-secondary/50",i===a&&o===f.id&&"tw-bg-secondary tw-text-normal"),onClick:()=>u(f.id,f.name)},je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):je.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),je.default.createElement(TM,{className:"tw-flex-1 tw-text-sm"},f.name)),je.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},je.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),je.default.createElement(Vi,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:p=>c(p,f)}))))));function ETn({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?Mm:Vi;return je.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md"},je.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},je.default.createElement(PTn,{extension:n,size:"tw-size-8"})),je.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},je.default.createElement(TM,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&je.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&je.default.createElement(TM,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),je.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},je.default.createElement(o,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:i=>r(i,t)})))}function TTn({initialProject:t,onSave:e,onCancel:r,app:n}){let{inclusions:o,exclusions:i}=(0,je.useMemo)(()=>rf({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),a=(0,je.useMemo)(()=>n.vault.getFiles(),[n.vault]),s=(0,je.useCallback)((B,q,K)=>{let H=B.filter(Oe=>eu(Oe,q,K)),ee=(Oe,le,Be,ze)=>{le&&le.forEach(rt=>{let cr={[Be]:[rt]};eu(Oe,cr,null)&&!ze[rt].some(wn=>wn.id===Oe.path)&&ze[rt].push({id:Oe.path,name:Oe.basename})})},U={},W={},Y={},ae=[];return(q?.tagPatterns??[]).forEach(Oe=>{U[Oe]=[]}),(q?.folderPatterns??[]).forEach(Oe=>{W[Oe]=[]}),(q?.extensionPatterns??[]).forEach(Oe=>{Y[Oe]=[]}),H.forEach(Oe=>{ee(Oe,q?.tagPatterns,"tagPatterns",U),ee(Oe,q?.folderPatterns,"folderPatterns",W),ee(Oe,q?.extensionPatterns,"extensionPatterns",Y),q?.notePatterns&&eu(Oe,{notePatterns:q.notePatterns},null)&&!ae.some(le=>le.id===Oe.path)&&ae.push({id:Oe.path,name:Oe.basename})}),{tags:U,folders:W,extensions:Y,notes:ae}},[]),[u,l]=(0,je.useState)(()=>s(a,o,i)),[c,d]=(0,je.useState)(()=>{let B=a.filter(q=>i&&eu(q,i,null));return{files:new Set(B)}}),f=(0,je.useRef)(u),p=(0,je.useRef)(c),[m,h]=(0,je.useState)(""),[b,g]=(0,je.useState)(null),[y,S]=(0,je.useState)(null),x=(0,je.useCallback)((B,q)=>{let K=Object.keys(B.tags),H=Object.keys(B.folders),ee=Object.keys(B.extensions),U=B.notes.map(W=>{let Y=q.find(ae=>ae.path===W.id);if(Y)return B8(Y)}).filter(Boolean);return $8({tagPatterns:K,folderPatterns:H,extensionPatterns:ee,notePatterns:U})},[]),O=(0,je.useCallback)(B=>{let q=new Array(...B.files).map(K=>B8(K));return $8({notePatterns:q})||""},[]);(0,je.useEffect)(()=>{f.current=u,p.current=c},[u,c]);let P=(0,je.useMemo)(()=>{let B=[],q=(H,ee)=>{ee.forEach(U=>{H.some(W=>W.id===U.id)||H.push({id:U.id,name:U.name})})};return[u.tags,u.folders,u.extensions,{notes:u.notes}].forEach(H=>{Object.values(H).forEach(ee=>{q(B,ee)})}),B},[u]),E=(0,je.useCallback)(B=>{let q=[],K=[],H=[];return B.split(",").map(U=>U.trim()).filter(U=>U).forEach(U=>{U.startsWith("#")?q.push(U.substring(1)):U.startsWith(".")||U.startsWith("*.")?H.push(U.replace("*","")):K.push(U)}),{tags:q,titles:K,extensions:H}},[]),A=(0,je.useMemo)(()=>{if(m){let B=E(m);return P.filter(q=>{let K=a.find(ae=>ae.path===q.id);if(!K)return!1;let H=K.extension==="md",ee=B.tags.length>0&&H&&B.tags.some(ae=>NR(K).some(le=>(le.startsWith("#")?le.substring(1):le).toLowerCase().includes(ae.toLowerCase()))),U=B.titles.length>0&&B.titles.some(ae=>K.basename.toLowerCase().includes(ae.toLowerCase())),W=B.extensions.length>0&&B.extensions.some(ae=>`.${K.extension}`.toLowerCase()===ae.toLowerCase());return B.tags.length>0||B.titles.length>0||B.extensions.length>0?ee||U||W:!1}).map(q=>({id:q.id,name:q.name}))}if(b==="tags"&&y){let B=u.tags[y];return B||[]}if(b==="folders"&&y){let B=u.folders[y];return B||[]}if(b==="files")return u.notes;if(b==="extensions"&&y){let B=u.extensions[y];return B||[]}return b==="ignoreFiles"?Array.from(c.files).map(B=>({id:B.path,name:B.basename})):[]},[m,b,y,E,P,a,u.tags,u.folders,u.notes,u.extensions,c.files]),I=(0,je.useCallback)(B=>[...B].sort((q,K)=>q.name.toLowerCase().localeCompare(K.name.toLowerCase())),[]),R=(0,je.useCallback)((B,q)=>Object.entries(B).sort(([K],[H])=>K.localeCompare(H)).map(([K,H])=>({id:K,name:q?q(K):K,count:H.length})),[]),N=(0,je.useCallback)((B,q,K)=>{let H=W=>a.filter(Y=>eu(Y,W,null)).map(Y=>({id:Y.path,name:Y.basename})),ee=[...p.current.files],U=H(K).map(W=>({...W,isIgnored:ee.some(Y=>Y.path===W.id)}));l(W=>({...W,[B]:{...W[B],[q]:U}}))},[a]),j=(0,je.useCallback)((B,q)=>{let K={tags:{...B.tags},folders:{...B.folders},extensions:{...B.extensions},notes:[...B.notes]},H=ee=>{Object.keys(ee).forEach(U=>{ee[U]=ee[U].filter(W=>W.id!==q)})};return H(K.tags),H(K.folders),H(K.extensions),K.notes=K.notes.filter(ee=>ee.id!==q),K},[]),$=(0,je.useCallback)((B,q=null,K=!0)=>{g(B),S(q),K&&h("")},[]),k=(0,je.useMemo)(()=>{let B=q=>(K,H)=>{K.stopPropagation(),l(ee=>{let U={...ee[q]};return delete U[H.id],{...ee,[q]:U}})};return{delete:{tag:B("tags"),folder:B("folders"),extension:B("extensions")},add:{tag:()=>{new Sz(n,q=>{let K=Xoe(q);N("tags",K,{tagPatterns:[K]})}).open()},folder:()=>{new wz(n,q=>{N("folders",q,{folderPatterns:[q]})}).open()},file:()=>{new b9({app:n,onFileSelect:q=>{u.notes.find(H=>H.id===q.path)||(d(H=>{let ee=new Set(H.files);return ee.delete(q),{...H,files:ee}}),l(H=>({...H,notes:[...H.notes,{id:q.path,name:q.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new qde.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new b9({app:n,onFileSelect:q=>{c.files.has(q)||(d(H=>{let ee=new Set(H.files);return ee.add(q),{...H,files:ee}}),l(H=>j(H,q.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:q=>{$("tags",q)},folder:q=>{$("folders",q)},extension:q=>{$("extensions",q)},files:()=>{$("files")},ignoreFiles:()=>{$("ignoreFiles")}}}},[n,u.notes,c.files,N,j,$]),z=()=>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=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.add(K),{...H,files:ee}}),l(H=>j(H,q.id)))},Q=(0,je.useCallback)(()=>{let B=x(f.current,a),q=O(p.current),{inclusions:K,exclusions:H}=rf({inclusions:B,exclusions:q,isProject:!0}),ee=s(a,K,H);l(ee)},[a,O,x,s]),J=(B,q)=>{B.stopPropagation();let K=a.find(H=>H.path===q.id);K&&(d(H=>{let ee=new Set(H.files);return ee.delete(K),{...H,files:ee}}),Q())},D=()=>{let B=x(u,a),q=O(c);e({...t,contextSource:{...t.contextSource,inclusions:B,exclusions:q}})};return je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement(B9t,{direction:"horizontal",className:"tw-flex-1"},je.default.createElement(H$e,{defaultSize:30,minSize:20,maxSize:40},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),je.default.createElement(Lde,{className:"tw-max-h-[500px] tw-flex-1"},je.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},je.default.createElement(wKt,{title:"Tags",IconComponent:d1,iconColorClassName:"tw-text-context-manager-orange",items:R(u.tags,B=>B.slice(1)),activeItem:y,activeSection:b,sectionType:"tags",renderIcon:B=>je.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:k.click.tag,onAddClick:k.add.tag,onDeleteItem:(B,q)=>k.delete.tag(B,q),tooltip:"must be in note property"}),je.default.createElement(O9,null),je.default.createElement(wKt,{title:"Folders",IconComponent:Iy,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:(B,q)=>k.delete.folder(B,q)}),je.default.createElement(O9,null),je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:Ay,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:k.add.file}),je.default.createElement("div",{className:_e("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,")")),je.default.createElement(O9,null),je.default.createElement("div",null,je.default.createElement(Z$e,{IconComponent:Vi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:k.add.ignoreFile}),je.default.createElement("div",{className:_e("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,")")))))),je.default.createElement(q9t,{withHandle:!0}),je.default.createElement(H$e,{defaultSize:70},je.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},je.default.createElement("div",{className:"tw-border-b tw-p-4"},je.default.createElement(kde,{placeholder:"Custom search: title, #tag1, .jpg",value:m,onChange:B=>{h(B),B&&$("search",null,!1)}})),je.default.createElement("div",{className:"tw-p-4"},je.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},z())),je.default.createElement(Lde,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},A.length===0?je.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."):je.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},I(A).map(B=>je.default.createElement(ETn,{key:B.id,item:B,viewMode:"list",onDelete:b==="ignoreFiles"||B.isIgnored?J:V}))))))),je.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},je.default.createElement(ge,{variant:"ghost",onClick:r},"Cancel"),je.default.createElement(ge,{onClick:D},"Save")))}var Bde=class extends qde.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,SKt.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(je.default.createElement(TTn,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};ti();var Nz=F(X());var Ude=F(X());var TKt=F(X(),1);var CKt=F(X(),1),OKt=F(ds(),1);var yd=F(X(),1);var xKt=F(X(),1);function ATn(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function aL(...t){return e=>t.forEach(r=>ATn(r,e))}function Ri(...t){return xKt.useCallback(aL(...t),t)}var jz=F(ft(),1),Q$e=yd.forwardRef((t,e)=>{let{children:r,...n}=t,o=yd.Children.toArray(r),i=o.find(MTn);if(i){let a=i.props.children,s=o.map(u=>u===i?yd.Children.count(a)>1?yd.Children.only(null):yd.isValidElement(a)?a.props.children:null:u);return(0,jz.jsx)(X$e,{...n,ref:e,children:yd.isValidElement(a)?yd.cloneElement(a,void 0,s):null})}return(0,jz.jsx)(X$e,{...n,ref:e,children:r})});Q$e.displayName="Slot";var X$e=yd.forwardRef((t,e)=>{let{children:r,...n}=t;if(yd.isValidElement(r)){let o=jTn(r);return yd.cloneElement(r,{...RTn(n,r.props),ref:e?aL(e,o):o})}return yd.Children.count(r)>1?yd.Children.only(null):null});X$e.displayName="SlotClone";var ITn=({children:t})=>(0,jz.jsx)(jz.Fragment,{children:t});function MTn(t){return yd.isValidElement(t)&&t.type===ITn}function RTn(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 jTn(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 PKt=F(ft(),1),NTn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ho=NTn.reduce((t,e)=>{let r=CKt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Q$e:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,PKt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function EKt(t,e){t&&OKt.flushSync(()=>t.dispatchEvent(e))}var AKt=F(ft(),1),DTn="Label",IKt=TKt.forwardRef((t,e)=>(0,AKt.jsx)(ho.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));IKt.displayName=DTn;var eBe=IKt;F7();Tn();var FTn=QF("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),ip=Ude.forwardRef(({className:t,...e},r)=>Ude.createElement(eBe,{ref:r,className:_e(FTn(),t),...e}));ip.displayName=eBe.displayName;var Yn=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>Nz.default.createElement("div",{className:"tw-space-y-2"},Nz.default.createElement(ip,{className:r?"tw-text-error":""},t," ",e&&Nz.default.createElement("span",{className:"tw-text-error"},"*")),n&&Nz.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&Nz.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var sL=F(X());Tn();yn();function zde({options:t,placeholder:e,containerClassName:r,className:n,...o}){return sL.default.createElement("div",{className:_e("tw-group tw-relative tw-w-full",r)},sL.default.createElement("select",{className:_e("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&&sL.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>sL.default.createElement("option",{key:i.value,value:i.value},i.label))),sL.default.createElement("div",{className:_e("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")},sL.default.createElement(Hi,{className:"tw-size-4"})))}var jM=F(X());Tn();var uL=F(X());var Bi=F(X(),1);function Dz(t,[e,r]){return Math.min(r,Math.max(e,t))}function xi(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Hde=F(X(),1);function Lz(t){let e=Hde.useRef({value:t,previous:t});return Hde.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var RM=F(X(),1);var gE=F(X(),1),MKt=F(ft(),1);function RKt(t,e=[]){let r=[];function n(i,a){let s=gE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=gE.useMemo(()=>m,Object.values(m));return(0,MKt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=gE.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=>gE.createContext(a));return function(s){let u=s?.[t]||i;return gE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,kTn(o,...e)]}function kTn(...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 gE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var bd=F(X(),1);var Fz=F(ft(),1),Vde=bd.forwardRef((t,e)=>{let{children:r,...n}=t,o=bd.Children.toArray(r),i=o.find(BTn);if(i){let a=i.props.children,s=o.map(u=>u===i?bd.Children.count(a)>1?bd.Children.only(null):bd.isValidElement(a)?a.props.children:null:u);return(0,Fz.jsx)(tBe,{...n,ref:e,children:bd.isValidElement(a)?bd.cloneElement(a,void 0,s):null})}return(0,Fz.jsx)(tBe,{...n,ref:e,children:r})});Vde.displayName="Slot";var tBe=bd.forwardRef((t,e)=>{let{children:r,...n}=t;if(bd.isValidElement(r)){let o=UTn(r);return bd.cloneElement(r,{...qTn(n,r.props),ref:e?aL(e,o):o})}return bd.Children.count(r)>1?bd.Children.only(null):null});tBe.displayName="SlotClone";var $Tn=({children:t})=>(0,Fz.jsx)(Fz.Fragment,{children:t});function BTn(t){return bd.isValidElement(t)&&t.type===$Tn}function qTn(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 UTn(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 Wde=F(ft(),1);function Kde(t){let e=t+"CollectionProvider",[r,n]=RKt(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,b=RM.default.useRef(null),g=RM.default.useRef(new Map).current;return(0,Wde.jsx)(o,{scope:m,itemMap:g,collectionRef:b,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=RM.default.forwardRef((p,m)=>{let{scope:h,children:b}=p,g=i(s,h),y=Ri(m,g.collectionRef);return(0,Wde.jsx)(Vde,{ref:y,children:b})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=RM.default.forwardRef((p,m)=>{let{scope:h,children:b,...g}=p,y=RM.default.useRef(null),S=Ri(m,y),x=i(l,h);return RM.default.useEffect(()=>(x.itemMap.set(y,{ref:y,...g}),()=>void x.itemMap.delete(y))),(0,Wde.jsx)(Vde,{[c]:"",ref:S,children:b})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return RM.default.useCallback(()=>{let b=m.collectionRef.current;if(!b)return[];let g=Array.from(b.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((x,O)=>g.indexOf(x.ref.current)-g.indexOf(O.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var Bl=F(ft(),1),jKt=["PageUp","PageDown"],NKt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],DKt={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},kz="Slider",[rBe,zTn,HTn]=Kde(kz),[LKt,Igi]=Yi(kz,[HTn]),[VTn,Gde]=LKt(kz),FKt=Bi.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=Bi.useRef(new Set),g=Bi.useRef(0),S=a==="horizontal"?WTn:KTn,[x=[],O]=ud({prop:c,defaultProp:l,onChange:N=>{[...b.current][g.current]?.focus(),d(N)}}),P=Bi.useRef(x);function E(N){let j=XTn(x,N);R(N,j)}function A(N){R(N,g.current)}function I(){let N=P.current[g.current];x[g.current]!==N&&f(x)}function R(N,j,{commit:$}={commit:!1}){let k=rAn(i),z=nAn(Math.round((N-n)/i)*i+n,k),V=Dz(z,[n,o]);O((Q=[])=>{let J=YTn(Q,V,j);if(tAn(J,u*i)){g.current=J.indexOf(V);let D=String(J)!==String(Q);return D&&$&&f(J),D?J:Q}else return Q})}return(0,Bl.jsx)(VTn,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:b.current,values:x,orientation:a,form:m,children:(0,Bl.jsx)(rBe.Provider,{scope:t.__scopeSlider,children:(0,Bl.jsx)(rBe.Slot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(S,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:xi(h.onPointerDown,()=>{s||(P.current=x)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:A,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&R(n,0,{commit:!0}),onEndKeyDown:()=>!s&&R(o,x.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:j})=>{if(!s){let z=jKt.includes(N.key)||N.shiftKey&&NKt.includes(N.key)?10:1,V=g.current,Q=x[V],J=i*z*j;R(Q+J,V,{commit:!0})}}})})})})});FKt.displayName=kz;var[kKt,$Kt]=LKt(kz,{startEdge:"left",endEdge:"right",size:"width",direction:1}),WTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Bi.useState(null),p=Ri(e,S=>f(S)),m=Bi.useRef(),h=nM(o),b=h==="ltr",g=b&&!i||!b&&i;function y(S){let x=m.current||d.getBoundingClientRect(),O=[0,x.width],E=iBe(O,g?[r,n]:[n,r]);return m.current=x,E(S-x.left)}return(0,Bl.jsx)(kKt,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,Bl.jsx)(BKt,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{let x=y(S.clientX);a?.(x)},onSlideMove:S=>{let x=y(S.clientX);s?.(x)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:S=>{let O=DKt[g?"from-left":"from-right"].includes(S.key);l?.({event:S,direction:O?-1:1})}})})}),KTn=Bi.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Bi.useRef(null),d=Ri(e,c),f=Bi.useRef(),p=!o;function m(h){let b=f.current||c.current.getBoundingClientRect(),g=[0,b.height],S=iBe(g,p?[n,r]:[r,n]);return f.current=b,S(h-b.top)}return(0,Bl.jsx)(kKt,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Bl.jsx)(BKt,{"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=DKt[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),BKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=Gde(kz,r);return(0,Bl.jsx)(ho.span,{...l,ref:e,onKeyDown:xi(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):jKt.concat(NKt).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:xi(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:xi(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:xi(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),qKt="SliderTrack",UKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Gde(qKt,r);return(0,Bl.jsx)(ho.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});UKt.displayName=qKt;var nBe="SliderRange",zKt=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=Gde(nBe,r),i=$Kt(nBe,r),a=Bi.useRef(null),s=Ri(e,a),u=o.values.length,l=o.values.map(f=>VKt(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Bl.jsx)(ho.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});zKt.displayName=nBe;var oBe="SliderThumb",HKt=Bi.forwardRef((t,e)=>{let r=zTn(t.__scopeSlider),[n,o]=Bi.useState(null),i=Ri(e,s=>o(s)),a=Bi.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Bl.jsx)(GTn,{...t,ref:i,index:a})}),GTn=Bi.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=Gde(oBe,r),s=$Kt(oBe,r),[u,l]=Bi.useState(null),c=Ri(e,y=>l(y)),d=u?a.form||!!u.closest("form"):!0,f=Xx(u),p=a.values[n],m=p===void 0?0:VKt(p,a.min,a.max),h=ZTn(n,a.values.length),b=f?.[s.size],g=b?QTn(b,m,s.direction):0;return Bi.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Bl.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,Bl.jsx)(rBe.ItemSlot,{scope:t.__scopeSlider,children:(0,Bl.jsx)(ho.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:xi(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Bl.jsx)(JTn,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});HKt.displayName=oBe;var JTn=t=>{let{value:e,...r}=t,n=Bi.useRef(null),o=Lz(e);return Bi.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,Bl.jsx)("input",{style:{display:"none"},...r,ref:n,defaultValue:e})};function YTn(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function VKt(t,e,r){let i=100/(r-e)*(t-e);return Dz(i,[0,100])}function ZTn(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function XTn(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 QTn(t,e,r){let n=t/2,i=iBe([0,50],[0,n]);return(n-i(e)*r)*r}function eAn(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function tAn(t,e){if(e>0){let r=eAn(t);return Math.min(...r)>=e}return!0}function iBe(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 rAn(t){return(String(t).split(".")[1]||"").length}function nAn(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var aBe=FKt,WKt=UKt,KKt=zKt,GKt=HKt;Tn();var sBe=uL.forwardRef(({className:t,...e},r)=>uL.createElement(aBe,{ref:r,className:_e("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},uL.createElement(WKt,{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"},uL.createElement(KKt,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),uL.createElement(GKt,{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"})));sBe.displayName=aBe.displayName;function nC({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a}){let[s,u]=(0,jM.useState)(t);return(0,jM.useEffect)(()=>{u(t)},[t]),jM.default.createElement("div",{className:_e("tw-flex tw-items-center tw-gap-4",a)},jM.default.createElement(sBe,{value:[s],onValueChange:([l])=>u(l),onValueCommit:([l])=>e?.(l),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),jM.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},s))}var ry=F(X());Tn();var yE=ry.forwardRef(({className:t,value:e,...r},n)=>{let o=ry.useRef(null),i=ry.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);ry.useLayoutEffect(()=>{i()},[e,i]),ry.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 ry.createElement("textarea",{className:_e("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})});yE.displayName="Textarea";$r();_g();nr();Cn();yn();var $z=require("obsidian"),Kt=F(X()),JKt=F(Dc());function iAn({initialProject:t,onSave:e,onCancel:r}){let n=Rn(),[o,i]=(0,Kt.useState)(!1),[a,s]=(0,Kt.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,Kt.useState)(t||{id:_Ve(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:jh.TEMPERATURE,maxTokens:jh.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=bg(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{new Bde(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,S]=h.split("."),O=g[y];if(typeof O=="object"&&O!==null)return{...g,[y]:{...O,[S]: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 $z.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new $z.Notice(ei(g)),s(y=>({...y,name:!0}))}finally{i(!1)}};return Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},Kt.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),Kt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Kt.default.createElement(Yn,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},Kt.default.createElement(mo,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Description",description:"Briefly describe the purpose and goals of the project"},Kt.default.createElement(mo,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},Kt.default.createElement(yE,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),Kt.default.createElement(Yn,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},Kt.default.createElement(zde,{value:u.projectModelKey,onChange:h=>{let b=h.target.value,g=n.activeModels.find(x=>x.enabled&&kr(x)===b);if(!g)return;let{hasApiKey:y,errorNotice:S}=mF(g,n);if(!y&&S){new $z.Notice(S);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:QW(h),value:kr(h)}))})),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),Kt.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},Kt.default.createElement(Yn,{label:"Temperature"},Kt.default.createElement(nC,{value:u.modelConfigs?.temperature??jh.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),Kt.default.createElement(Yn,{label:"Token Limit"},Kt.default.createElement(nC,{value:u.modelConfigs?.maxTokens??jh.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),Kt.default.createElement("div",{className:"tw-space-y-4"},Kt.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),Kt.default.createElement(Yn,{label:Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("span",null,"File Context"),Kt.default.createElement(vo,{delayDuration:0},Kt.default.createElement(Rt,null,Kt.default.createElement(jt,{asChild:!0},Kt.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Kt.default.createElement(Mt,null,Kt.default.createElement("div",{className:"tw-max-w-80"},Kt.default.createElement("strong",null,"Supported File Types:"),Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",Kt.default.createElement("br",null),Kt.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",Kt.default.createElement("br",null),Kt.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",Kt.default.createElement("br",null),Kt.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."},Kt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Kt.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},Kt.default.createElement(TM,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),Kt.default.createElement(ge,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),Kt.default.createElement(Yn,{label:"Web URLs"},Kt.default.createElement(yE,{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"})),Kt.default.createElement(Yn,{label:"YouTube URLs"},Kt.default.createElement(yE,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(`
`).map(y=>{if(!y.trim())return y;try{let S=new URL(y.trim());return S.hostname.includes("youtube.com")||S.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"})))),Kt.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},Kt.default.createElement(ge,{variant:"ghost",onClick:r,disabled:o},"Cancel"),Kt.default.createElement(ge,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var P9=class extends $z.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,JKt.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(Kt.default.createElement(iAn,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();var ji=F(X());var ct=F(X(),1),IBe=F(ds(),1);var ns=F(X(),1);var lBe=F(ft(),1),aAn="DismissableLayer",uBe="dismissableLayer.update",sAn="dismissableLayer.pointerDownOutside",uAn="dismissableLayer.focusOutside",YKt,XKt=ns.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cBe=ns.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=ns.useContext(XKt),[c,d]=ns.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=ns.useState({}),m=Ri(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=dAn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=fAn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),ns.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(YKt=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),ZKt(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=YKt)}},[c,f,r,l]),ns.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),ZKt())},[c,l]),ns.useEffect(()=>{let E=()=>p({});return document.addEventListener(uBe,E),()=>document.removeEventListener(uBe,E)},[]),(0,lBe.jsx)(ho.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:xi(t.onFocusCapture,P.onFocusCapture),onBlurCapture:xi(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:xi(t.onPointerDownCapture,O.onPointerDownCapture)})});cBe.displayName=aAn;var lAn="DismissableLayerBranch",cAn=ns.forwardRef((t,e)=>{let r=ns.useContext(XKt),n=ns.useRef(null),o=Ri(e,n);return ns.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,lBe.jsx)(ho.div,{...t,ref:o})});cAn.displayName=lAn;function dAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1),o=ns.useRef(()=>{});return ns.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){QKt(sAn,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 fAn(t,e=globalThis?.document){let r=Ur(t),n=ns.useRef(!1);return ns.useEffect(()=>{let o=i=>{i.target&&!n.current&&QKt(uAn,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 ZKt(){let t=new CustomEvent(uBe);document.dispatchEvent(t)}function QKt(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?EKt(o,i):o.dispatchEvent(i)}var ny=F(X(),1);var oGt=F(ft(),1),dBe="focusScope.autoFocusOnMount",fBe="focusScope.autoFocusOnUnmount",eGt={bubbles:!1,cancelable:!0},pAn="FocusScope",pBe=ny.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ny.useState(null),l=Ur(o),c=Ur(i),d=ny.useRef(null),f=Ri(e,h=>u(h)),p=ny.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;ny.useEffect(()=>{if(n){let y=function(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:NM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||NM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&NM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ny.useEffect(()=>{if(s){rGt.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(dBe,eGt);s.addEventListener(dBe,l),s.dispatchEvent(g),g.defaultPrevented||(mAn(_An(iGt(s)),{select:!0}),document.activeElement===h&&NM(s))}return()=>{s.removeEventListener(dBe,l),setTimeout(()=>{let g=new CustomEvent(fBe,eGt);s.addEventListener(fBe,c),s.dispatchEvent(g),g.defaultPrevented||NM(h??document.body,{select:!0}),s.removeEventListener(fBe,c),rGt.remove(p)},0)}}},[s,l,c,p]);let m=ny.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,[S,x]=hAn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&NM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&NM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,oGt.jsx)(ho.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});pBe.displayName=pAn;function mAn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(NM(n,{select:e}),document.activeElement!==r)return}function hAn(t){let e=iGt(t),r=tGt(e,t),n=tGt(e.reverse(),t);return[r,n]}function iGt(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 tGt(t,e){for(let r of t)if(!gAn(r,{upTo:e}))return r}function gAn(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 yAn(t){return t instanceof HTMLInputElement&&"select"in t}function NM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&yAn(t)&&e&&t.select()}}var rGt=bAn();function bAn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=nGt(t,e),t.unshift(e)},remove(e){t=nGt(t,e),t[0]?.resume()}}}function nGt(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function _An(t){return t.filter(e=>e.tagName!=="A")}var mh=F(X(),1);var aGt=F(X(),1);var mBe=F(ft(),1),vAn="Arrow",sGt=aGt.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,mBe.jsx)(ho.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,mBe.jsx)("polygon",{points:"0,0 30,0 15,10"})})});sGt.displayName=vAn;var uGt=sGt;var bE=F(X(),1),lGt=F(ft(),1);function cGt(t,e=[]){let r=[];function n(i,a){let s=bE.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,b=bE.useMemo(()=>m,Object.values(m));return(0,lGt.jsx)(h.Provider,{value:b,children:p})}function c(d,f){let p=f?.[t][u]||s,m=bE.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=>bE.createContext(a));return function(s){let u=s?.[t]||i;return bE.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,SAn(o,...e)]}function SAn(...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 bE.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var DM=F(ft(),1);var hBe="Popper",[dGt,gBe]=cGt(hBe),[xAn,fGt]=dGt(hBe),pGt=t=>{let{__scopePopper:e,children:r}=t,[n,o]=mh.useState(null);return(0,DM.jsx)(xAn,{scope:e,anchor:n,onAnchorChange:o,children:r})};pGt.displayName=hBe;var mGt="PopperAnchor",hGt=mh.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=fGt(mGt,r),a=mh.useRef(null),s=Ri(e,a);return mh.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,DM.jsx)(ho.div,{...o,ref:s})});hGt.displayName=mGt;var yBe="PopperContent",[CAn,OAn]=dGt(yBe),gGt=mh.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=fGt(yBe,r),[g,y]=mh.useState(null),S=Ri(e,Y=>y(Y)),[x,O]=mh.useState(null),P=Xx(x),E=P?.width??0,A=P?.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(EAn),altBoundary:j},{refs:k,floatingStyles:z,placement:V,isPositioned:Q,middlewareData:J}=sM({strategy:"fixed",placement:I,whileElementsMounted:(...Y)=>oE(...Y,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[uM({mainAxis:o+A,alignmentAxis:a}),u&&lM({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cM():void 0,...$}),u&&dM({...$}),fM({...$,apply:({elements:Y,rects:ae,availableWidth:Oe,availableHeight:le})=>{let{width:Be,height:ze}=ae.reference,rt=Y.floating.style;rt.setProperty("--radix-popper-available-width",`${Oe}px`),rt.setProperty("--radix-popper-available-height",`${le}px`),rt.setProperty("--radix-popper-anchor-width",`${Be}px`),rt.setProperty("--radix-popper-anchor-height",`${ze}px`)}}),x&&mM({element:x,padding:s}),TAn({arrowWidth:E,arrowHeight:A}),f&&pM({strategy:"referenceHidden",...$})]}),[D,B]=_Gt(V),q=Ur(m);Jn(()=>{Q&&q?.()},[Q,q]);let K=J.arrow?.x,H=J.arrow?.y,ee=J.arrow?.centerOffset!==0,[U,W]=mh.useState();return Jn(()=>{g&&W(window.getComputedStyle(g).zIndex)},[g]),(0,DM.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[J.transformOrigin?.x,J.transformOrigin?.y].join(" "),...J.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,DM.jsx)(CAn,{scope:r,placedSide:D,onArrowChange:O,arrowX:K,arrowY:H,shouldHideArrow:ee,children:(0,DM.jsx)(ho.div,{"data-side":D,"data-align":B,...h,ref:S,style:{...h.style,animation:Q?void 0:"none"}})})})});gGt.displayName=yBe;var yGt="PopperArrow",PAn={top:"bottom",right:"left",bottom:"top",left:"right"},bGt=mh.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=OAn(yGt,n),a=PAn[i.placedSide];return(0,DM.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,DM.jsx)(uGt,{...o,ref:r,style:{...o.style,display:"block"}})})});bGt.displayName=yGt;function EAn(t){return t!==null}var TAn=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]=_Gt(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 _Gt(t){let[e,r="center"]=t.split("-");return[e,r]}var vGt=pGt,wGt=hGt,SGt=gGt,xGt=bGt;var Jde=F(X(),1),CGt=F(ds(),1);var OGt=F(ft(),1),IAn="Portal",bBe=Jde.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Jde.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?CGt.default.createPortal((0,OGt.jsx)(ho.div,{...n,ref:e}),a):null});bBe.displayName=IAn;var _d=F(X(),1);var Bz=F(ft(),1),vBe=_d.forwardRef((t,e)=>{let{children:r,...n}=t,o=_d.Children.toArray(r),i=o.find(RAn);if(i){let a=i.props.children,s=o.map(u=>u===i?_d.Children.count(a)>1?_d.Children.only(null):_d.isValidElement(a)?a.props.children:null:u);return(0,Bz.jsx)(_Be,{...n,ref:e,children:_d.isValidElement(a)?_d.cloneElement(a,void 0,s):null})}return(0,Bz.jsx)(_Be,{...n,ref:e,children:r})});vBe.displayName="Slot";var _Be=_d.forwardRef((t,e)=>{let{children:r,...n}=t;if(_d.isValidElement(r)){let o=NAn(r);return _d.cloneElement(r,{...jAn(n,r.props),ref:e?aL(e,o):o})}return _d.Children.count(r)>1?_d.Children.only(null):null});_Be.displayName="SlotClone";var MAn=({children:t})=>(0,Bz.jsx)(Bz.Fragment,{children:t});function RAn(t){return _d.isValidElement(t)&&t.type===MAn}function jAn(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 NAn(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 PGt=F(X(),1);var EGt=F(ft(),1),DAn="VisuallyHidden",wBe=PGt.forwardRef((t,e)=>(0,EGt.jsx)(ho.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}}));wBe.displayName=DAn;var Xde=F(X());var hf=F(X());var Yde=HD();var SBe=function(){},E9=hf.forwardRef(function(t,e){var r=hf.useRef(null),n=hf.useState({onScrollCapture:SBe,onWheelCapture:SBe,onTouchMoveCapture:SBe}),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,S=_M(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=zD([r,e]),P=yi(yi({},S),o);return hf.createElement(hf.Fragment,null,c&&hf.createElement(x,{sideCar:Yde,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:y}),a?hf.cloneElement(hf.Children.only(s),yi(yi({},P),{ref:O})):hf.createElement(g,yi({},P,{className:u,ref:O}),s))});E9.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};E9.classNames={fullWidth:Sb,zeroRight:wb};var _a=F(X());var xBe=!1;if(typeof window<"u")try{T9=Object.defineProperty({},"passive",{get:function(){return xBe=!0,!0}}),window.addEventListener("test",T9,T9),window.removeEventListener("test",T9,T9)}catch{xBe=!1}var T9,lL=xBe?{passive:!1}:!1;var LAn=function(t){return t.tagName==="TEXTAREA"},TGt=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!LAn(t)&&r[e]==="visible")},FAn=function(t){return TGt(t,"overflowY")},kAn=function(t){return TGt(t,"overflowX")},CBe=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=AGt(t,n);if(o){var i=IGt(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},$An=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},BAn=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},AGt=function(t,e){return t==="v"?FAn(e):kAn(e)},IGt=function(t,e){return t==="v"?$An(e):BAn(e)},qAn=function(t,e){return t==="h"&&e==="rtl"?-1:1},MGt=function(t,e,r,n,o){var i=qAn(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=IGt(t,s),m=p[0],h=p[1],b=p[2],g=h-b-i*m;(m||g)&&AGt(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 Zde=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RGt=function(t){return[t.deltaX,t.deltaY]},jGt=function(t){return t&&"current"in t?t.current:t},UAn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},zAn=function(t){return`
.block-interactivity-`.concat(t,` {pointer-events: none;}
.allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},HAn=0,qz=[];function NGt(t){var e=_a.useRef([]),r=_a.useRef([0,0]),n=_a.useRef(),o=_a.useState(HAn++)[0],i=_a.useState(iE)[0],a=_a.useRef(t);_a.useEffect(function(){a.current=t},[t]),_a.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=az([t.lockRef.current],(t.shards||[]).map(jGt),!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=_a.useCallback(function(h,b){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=Zde(h),y=r.current,S="deltaX"in h?h.deltaX:y[0]-g[0],x="deltaY"in h?h.deltaY:y[1]-g[1],O,P=h.target,E=Math.abs(S)>Math.abs(x)?"h":"v";if("touches"in h&&E==="h"&&P.type==="range")return!1;var A=CBe(E,P);if(!A)return!0;if(A?O=E:(O=E==="v"?"h":"v",A=CBe(E,P)),!A)return!1;if(!n.current&&"changedTouches"in h&&(S||x)&&(n.current=O),!O)return!0;var I=n.current||O;return MGt(I,b,h,I==="h"?S:x,!0)},[]),u=_a.useCallback(function(h){var b=h;if(!(!qz.length||qz[qz.length-1]!==i)){var g="deltaY"in b?RGt(b):Zde(b),y=e.current.filter(function(O){return O.name===b.type&&(O.target===b.target||b.target===O.shadowParent)&&UAn(O.delta,g)})[0];if(y&&y.should){b.cancelable&&b.preventDefault();return}if(!y){var S=(a.current.shards||[]).map(jGt).filter(Boolean).filter(function(O){return O.contains(b.target)}),x=S.length>0?s(b,S[0]):!a.current.noIsolation;x&&b.cancelable&&b.preventDefault()}}},[]),l=_a.useCallback(function(h,b,g,y){var S={name:h,delta:b,target:g,should:y,shadowParent:VAn(g)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(x){return x!==S})},1)},[]),c=_a.useCallback(function(h){r.current=Zde(h),n.current=void 0},[]),d=_a.useCallback(function(h){l(h.type,RGt(h),h.target,s(h,t.lockRef.current))},[]),f=_a.useCallback(function(h){l(h.type,Zde(h),h.target,s(h,t.lockRef.current))},[]);_a.useEffect(function(){return qz.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,lL),document.addEventListener("touchmove",u,lL),document.addEventListener("touchstart",c,lL),function(){qz=qz.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,lL),document.removeEventListener("touchmove",u,lL),document.removeEventListener("touchstart",c,lL)}},[]);var p=t.removeScrollBar,m=t.inert;return _a.createElement(_a.Fragment,null,m?_a.createElement(i,{styles:zAn(o)}):null,p?_a.createElement(WD,{gapMode:t.gapMode}):null)}function VAn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var DGt=VD(Yde,NGt);var LGt=Xde.forwardRef(function(t,e){return Xde.createElement(E9,yi({},t,{ref:e,sideCar:DGt}))});LGt.classNames=E9.classNames;var A9=LGt;var lr=F(ft(),1),WAn=[" ","Enter","ArrowUp","ArrowDown"],KAn=[" ","Enter"],M9="Select",[efe,tfe,GAn]=Kde(M9),[Uz,vbi]=Yi(M9,[GAn,gBe]),rfe=gBe(),[JAn,LM]=Uz(M9),[YAn,ZAn]=Uz(M9),FGt=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=rfe(e),[b,g]=ct.useState(null),[y,S]=ct.useState(null),[x,O]=ct.useState(!1),P=nM(l),[E=!1,A]=ud({prop:n,defaultProp:o,onChange:i}),[I,R]=ud({prop:a,defaultProp:s,onChange:u}),N=ct.useRef(null),j=b?m||!!b.closest("form"):!0,[$,k]=ct.useState(new Set),z=Array.from($).map(V=>V.props.value).join(";");return(0,lr.jsx)(vGt,{...h,children:(0,lr.jsxs)(JAn,{required:p,scope:e,trigger:b,onTriggerChange:g,valueNode:y,onValueNodeChange:S,valueNodeHasChildren:x,onValueNodeHasChildrenChange:O,contentId:hl(),value:I,onValueChange:R,open:E,onOpenChange:A,dir:P,triggerPointerDownPosRef:N,disabled:f,children:[(0,lr.jsx)(efe.Provider,{scope:e,children:(0,lr.jsx)(YAn,{scope:t.__scopeSelect,onNativeOptionAdd:ct.useCallback(V=>{k(Q=>new Set(Q).add(V))},[]),onNativeOptionRemove:ct.useCallback(V=>{k(Q=>{let J=new Set(Q);return J.delete(V),J})},[]),children:r})}),j?(0,lr.jsxs)(uJt,{"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,lr.jsx)("option",{value:""}):null,Array.from($)]},z):null]})})};FGt.displayName=M9;var kGt="SelectTrigger",$Gt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=rfe(r),a=LM(kGt,r),s=a.disabled||n,u=Ri(e,a.onTriggerChange),l=tfe(r),c=ct.useRef("touch"),[d,f,p]=lJt(h=>{let b=l().filter(S=>!S.disabled),g=b.find(S=>S.value===a.value),y=cJt(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,lr.jsx)(wGt,{asChild:!0,...i,children:(0,lr.jsx)(ho.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":sJt(a.value)?"":void 0,...o,ref:u,onClick:xi(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:xi(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:xi(o.onKeyDown,h=>{let b=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(b&&h.key===" ")&&WAn.includes(h.key)&&(m(),h.preventDefault())})})})});$Gt.displayName=kGt;var BGt="SelectValue",qGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=LM(BGt,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Ri(e,u.onValueNodeChange);return Jn(()=>{l(c)},[l,c]),(0,lr.jsx)(ho.span,{...s,ref:d,style:{pointerEvents:"none"},children:sJt(u.value)?(0,lr.jsx)(lr.Fragment,{children:a}):i})});qGt.displayName=BGt;var XAn="SelectIcon",UGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,lr.jsx)(ho.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});UGt.displayName=XAn;var QAn="SelectPortal",zGt=t=>(0,lr.jsx)(bBe,{asChild:!0,...t});zGt.displayName=QAn;var cL="SelectContent",HGt=ct.forwardRef((t,e)=>{let r=LM(cL,t.__scopeSelect),[n,o]=ct.useState();if(Jn(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?IBe.createPortal((0,lr.jsx)(VGt,{scope:t.__scopeSelect,children:(0,lr.jsx)(efe.Slot,{scope:t.__scopeSelect,children:(0,lr.jsx)("div",{children:t.children})})}),i):null}return(0,lr.jsx)(WGt,{...t,ref:e})});HGt.displayName=cL;var Mb=10,[VGt,FM]=Uz(cL),eIn="SelectContentImpl",WGt=ct.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=LM(cL,r),[S,x]=ct.useState(null),[O,P]=ct.useState(null),E=Ri(e,Y=>x(Y)),[A,I]=ct.useState(null),[R,N]=ct.useState(null),j=tfe(r),[$,k]=ct.useState(!1),z=ct.useRef(!1);ct.useEffect(()=>{if(S)return bM(S)},[S]),iM();let V=ct.useCallback(Y=>{let[ae,...Oe]=j().map(ze=>ze.ref.current),[le]=Oe.slice(-1),Be=document.activeElement;for(let ze of Y)if(ze===Be||(ze?.scrollIntoView({block:"nearest"}),ze===ae&&O&&(O.scrollTop=0),ze===le&&O&&(O.scrollTop=O.scrollHeight),ze?.focus(),document.activeElement!==Be))return},[j,O]),Q=ct.useCallback(()=>V([A,S]),[V,A,S]);ct.useEffect(()=>{$&&Q()},[$,Q]);let{onOpenChange:J,triggerPointerDownPosRef:D}=y;ct.useEffect(()=>{if(S){let Y={x:0,y:0},ae=le=>{Y={x:Math.abs(Math.round(le.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(D.current?.y??0))}},Oe=le=>{Y.x<=10&&Y.y<=10?le.preventDefault():S.contains(le.target)||J(!1),document.removeEventListener("pointermove",ae),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[S,J,D]),ct.useEffect(()=>{let Y=()=>J(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[J]);let[B,q]=lJt(Y=>{let ae=j().filter(Be=>!Be.disabled),Oe=ae.find(Be=>Be.ref.current===document.activeElement),le=cJt(ae,Y,Oe);le&&setTimeout(()=>le.ref.current.focus())}),K=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&(I(Y),le&&(z.current=!0))},[y.value]),H=ct.useCallback(()=>S?.focus(),[S]),ee=ct.useCallback((Y,ae,Oe)=>{let le=!z.current&&!Oe;(y.value!==void 0&&y.value===ae||le)&&N(Y)},[y.value]),U=n==="popper"?OBe:KGt,W=U===OBe?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:b}:{};return(0,lr.jsx)(VGt,{scope:r,content:S,viewport:O,onViewportChange:P,itemRefCallback:K,selectedItem:A,onItemLeave:H,itemTextRefCallback:ee,focusSelectedItem:Q,selectedItemText:R,position:n,isPositioned:$,searchRef:B,children:(0,lr.jsx)(A9,{as:vBe,allowPinchZoom:!0,children:(0,lr.jsx)(pBe,{asChild:!0,trapped:y.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:xi(o,Y=>{y.trigger?.focus({preventScroll:!0}),Y.preventDefault()}),children:(0,lr.jsx)(cBe,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,lr.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:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:xi(g.onKeyDown,Y=>{let ae=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!ae&&Y.key.length===1&&q(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let le=j().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){let Be=Y.target,ze=le.indexOf(Be);le=le.slice(ze+1)}setTimeout(()=>V(le)),Y.preventDefault()}})})})})})})});WGt.displayName=eIn;var tIn="SelectItemAlignedPosition",KGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=LM(cL,r),a=FM(cL,r),[s,u]=ct.useState(null),[l,c]=ct.useState(null),d=Ri(e,E=>c(E)),f=tfe(r),p=ct.useRef(!1),m=ct.useRef(!0),{viewport:h,selectedItem:b,selectedItemText:g,focusSelectedItem:y}=a,S=ct.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&b&&g){let E=i.trigger.getBoundingClientRect(),A=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),R=g.getBoundingClientRect();if(i.dir!=="rtl"){let Be=R.left-A.left,ze=I.left-Be,rt=E.left-ze,cr=E.width+rt,wn=Math.max(cr,A.width),Le=window.innerWidth-Mb,pt=Dz(ze,[Mb,Math.max(Mb,Le-wn)]);s.style.minWidth=cr+"px",s.style.left=pt+"px"}else{let Be=A.right-R.right,ze=window.innerWidth-I.right-Be,rt=window.innerWidth-E.right-ze,cr=E.width+rt,wn=Math.max(cr,A.width),Le=window.innerWidth-Mb,pt=Dz(ze,[Mb,Math.max(Mb,Le-wn)]);s.style.minWidth=cr+"px",s.style.right=pt+"px"}let N=f(),j=window.innerHeight-Mb*2,$=h.scrollHeight,k=window.getComputedStyle(l),z=parseInt(k.borderTopWidth,10),V=parseInt(k.paddingTop,10),Q=parseInt(k.borderBottomWidth,10),J=parseInt(k.paddingBottom,10),D=z+V+$+J+Q,B=Math.min(b.offsetHeight*5,D),q=window.getComputedStyle(h),K=parseInt(q.paddingTop,10),H=parseInt(q.paddingBottom,10),ee=E.top+E.height/2-Mb,U=j-ee,W=b.offsetHeight/2,Y=b.offsetTop+W,ae=z+V+Y,Oe=D-ae;if(ae<=ee){let Be=N.length>0&&b===N[N.length-1].ref.current;s.style.bottom="0px";let ze=l.clientHeight-h.offsetTop-h.offsetHeight,rt=Math.max(U,W+(Be?H:0)+ze+Q),cr=ae+rt;s.style.height=cr+"px"}else{let Be=N.length>0&&b===N[0].ref.current;s.style.top="0px";let rt=Math.max(ee,z+h.offsetTop+(Be?K:0)+W)+Oe;s.style.height=rt+"px",h.scrollTop=ae-ee+h.offsetTop}s.style.margin=`${Mb}px 0`,s.style.minHeight=B+"px",s.style.maxHeight=j+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,b,g,i.dir,n]);Jn(()=>S(),[S]);let[x,O]=ct.useState();Jn(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let P=ct.useCallback(E=>{E&&m.current===!0&&(S(),y?.(),m.current=!1)},[S,y]);return(0,lr.jsx)(nIn,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:(0,lr.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:(0,lr.jsx)(ho.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});KGt.displayName=tIn;var rIn="SelectPopperPosition",OBe=ct.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Mb,...i}=t,a=rfe(r);return(0,lr.jsx)(SGt,{...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)"}})});OBe.displayName=rIn;var[nIn,MBe]=Uz(cL,{}),PBe="SelectViewport",GGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=FM(PBe,r),a=MBe(PBe,r),s=Ri(e,i.onViewportChange),u=ct.useRef(0);return(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.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,lr.jsx)(efe.Slot,{scope:r,children:(0,lr.jsx)(ho.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:xi(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-Mb*2,h=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),g=Math.max(h,b);if(g<m){let y=g+p,S=Math.min(m,y),x=y-S;d.style.height=S+"px",d.style.bottom==="0px"&&(c.scrollTop=x>0?x:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});GGt.displayName=PBe;var JGt="SelectGroup",[oIn,iIn]=Uz(JGt),aIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=hl();return(0,lr.jsx)(oIn,{scope:r,id:o,children:(0,lr.jsx)(ho.div,{role:"group","aria-labelledby":o,...n,ref:e})})});aIn.displayName=JGt;var YGt="SelectLabel",ZGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=iIn(YGt,r);return(0,lr.jsx)(ho.div,{id:o.id,...n,ref:e})});ZGt.displayName=YGt;var Qde="SelectItem",[sIn,XGt]=Uz(Qde),QGt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=LM(Qde,r),u=FM(Qde,r),l=s.value===n,[c,d]=ct.useState(i??""),[f,p]=ct.useState(!1),m=Ri(e,y=>u.itemRefCallback?.(y,n,o)),h=hl(),b=ct.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,lr.jsx)(sIn,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:ct.useCallback(y=>{d(S=>S||(y?.textContent??"").trim())},[]),children:(0,lr.jsx)(efe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,lr.jsx)(ho.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:xi(a.onFocus,()=>p(!0)),onBlur:xi(a.onBlur,()=>p(!1)),onClick:xi(a.onClick,()=>{b.current!=="mouse"&&g()}),onPointerUp:xi(a.onPointerUp,()=>{b.current==="mouse"&&g()}),onPointerDown:xi(a.onPointerDown,y=>{b.current=y.pointerType}),onPointerMove:xi(a.onPointerMove,y=>{b.current=y.pointerType,o?u.onItemLeave?.():b.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xi(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:xi(a.onKeyDown,y=>{u.searchRef?.current!==""&&y.key===" "||(KAn.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});QGt.displayName=Qde;var I9="SelectItemText",eJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=LM(I9,r),s=FM(I9,r),u=XGt(I9,r),l=ZAn(I9,r),[c,d]=ct.useState(null),f=Ri(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=ct.useMemo(()=>(0,lr.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:b}=l;return Jn(()=>(h(m),()=>b(m)),[h,b,m]),(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.jsx)(ho.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?IBe.createPortal(i.children,a.valueNode):null]})});eJt.displayName=I9;var tJt="SelectItemIndicator",rJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return XGt(tJt,r).isSelected?(0,lr.jsx)(ho.span,{"aria-hidden":!0,...n,ref:e}):null});rJt.displayName=tJt;var EBe="SelectScrollUpButton",nJt=ct.forwardRef((t,e)=>{let r=FM(EBe,t.__scopeSelect),n=MBe(EBe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{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,lr.jsx)(iJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});nJt.displayName=EBe;var TBe="SelectScrollDownButton",oJt=ct.forwardRef((t,e)=>{let r=FM(TBe,t.__scopeSelect),n=MBe(TBe,t.__scopeSelect),[o,i]=ct.useState(!1),a=Ri(e,n.onScrollButtonChange);return Jn(()=>{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,lr.jsx)(iJt,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});oJt.displayName=TBe;var iJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=FM("SelectScrollButton",r),a=ct.useRef(null),s=tfe(r),u=ct.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return ct.useEffect(()=>()=>u(),[u]),Jn(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,lr.jsx)(ho.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:xi(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:xi(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:xi(o.onPointerLeave,()=>{u()})})}),uIn="SelectSeparator",aJt=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,lr.jsx)(ho.div,{"aria-hidden":!0,...n,ref:e})});aJt.displayName=uIn;var ABe="SelectArrow",lIn=ct.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=rfe(r),i=LM(ABe,r),a=FM(ABe,r);return i.open&&a.position==="popper"?(0,lr.jsx)(xGt,{...o,...n,ref:e}):null});lIn.displayName=ABe;function sJt(t){return t===""||t===void 0}var uJt=ct.forwardRef((t,e)=>{let{value:r,...n}=t,o=ct.useRef(null),i=Ri(e,o),a=Lz(r);return ct.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,lr.jsx)(wBe,{asChild:!0,children:(0,lr.jsx)("select",{...n,ref:i,defaultValue:r})})});uJt.displayName="BubbleSelect";function lJt(t){let e=Ur(t),r=ct.useRef(""),n=ct.useRef(0),o=ct.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=ct.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return ct.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function cJt(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=cIn(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 cIn(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var dJt=FGt,RBe=$Gt,fJt=qGt,pJt=UGt,mJt=zGt,jBe=HGt,hJt=GGt;var NBe=ZGt,DBe=QGt,gJt=eJt,yJt=rJt,LBe=nJt,FBe=oJt,kBe=aJt;yn();Tn();var zz=dJt;var Hz=fJt,dL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(RBe,{ref:n,className:_e("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,ji.createElement(pJt,{asChild:!0},ji.createElement(Hi,{className:"tw-size-4"}))));dL.displayName=RBe.displayName;var bJt=ji.forwardRef(({className:t,...e},r)=>ji.createElement(LBe,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Ey,{className:"tw-size-4"})));bJt.displayName=LBe.displayName;var _Jt=ji.forwardRef(({className:t,...e},r)=>ji.createElement(FBe,{ref:r,className:_e("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},ji.createElement(Hi,{className:"tw-size-4"})));_Jt.displayName=FBe.displayName;var fL=ji.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>ji.createElement(mJt,{container:n},ji.createElement(jBe,{ref:i,className:_e("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},ji.createElement(bJt,null),ji.createElement(hJt,{className:_e("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),ji.createElement(_Jt,null))));fL.displayName=jBe.displayName;var fIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(NBe,{ref:r,className:_e("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));fIn.displayName=NBe.displayName;var pL=ji.forwardRef(({className:t,children:e,...r},n)=>ji.createElement(DBe,{ref:n,className:_e("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},ji.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},ji.createElement(yJt,null,ji.createElement(Jl,{className:"tw-size-4"}))),ji.createElement(gJt,null,e)));pL.displayName=DBe.displayName;var pIn=ji.forwardRef(({className:t,...e},r)=>ji.createElement(kBe,{ref:r,className:_e("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));pIn.displayName=kBe.displayName;Tn();yo();nr();yn();var wJt=require("obsidian"),Ne=F(X());function mIn(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 vJt(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>mIn(n,e,r)):t}function hIn({project:t,loadContext:e,onEdit:r,onDelete:n}){return Ne.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)},Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Ne.default.createElement("div",{className:"tw-text-accent"},Ne.default.createElement(Iy,{className:"tw-size-4"})),Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Ne.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Ne.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Ne.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Ne.default.createElement(tO,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Edit Project")),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Ne.default.createElement(rk,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Start Chat")),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new sd(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Ne.default.createElement(Rm,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Delete Project"))))}var $Be=(0,Ne.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,Ne.useState)(r),[f,p]=(0,Ne.useState)(!1),[m,h]=(0,Ne.useState)(null),[b,g]=(0,Ne.useState)("");(0,Ne.useEffect)(()=>{a&&d(!1)},[a]);let y=(0,Ne.useMemo)(()=>vJt(e,b),[e,b]),S=()=>{new P9(n,async I=>{o(I)}).open()},x=A=>{new P9(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&&P(!1),dt("projectList",R),new wJt.Notice(`Project "${A.name}" deleted successfully`)},P=(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),UR(null);return}},E=A=>{h(A),p(!0),d(!1),s(!0),UR(A),setTimeout(()=>{l.current&&l.current.focus()},0)};return Ne.default.createElement("div",{className:_e("tw-flex tw-flex-col",t)},Ne.default.createElement("div",{className:"tw-overflow-y-auto"},Ne.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ne.default.createElement(zz,{value:m.name,onValueChange:A=>{let I=e.find(R=>R.name===A);I&&E(I)}},Ne.default.createElement(dL,{className:"tw-w-[200px]"},Ne.default.createElement(Hz,null,Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(Iy,{className:"tw-size-4 tw-text-accent/70"}),Ne.default.createElement("span",null,m.name)))),Ne.default.createElement(fL,null,e.map(A=>Ne.default.createElement(pL,{key:A.name,value:A.name,className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(Iy,{className:"tw-size-4"}),A.name)))))),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(ge,{variant:"secondary",onClick:()=>x(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Ne.default.createElement(tO,{className:"tw-mr-1 tw-size-4"}),"Edit"),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>{P(!1)},"aria-label":"Close Current Project"},Ne.default.createElement(Vi,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Close Current Project")))):Ne.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Ne.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ne.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(f_,{className:"tw-size-4 tw-text-muted"})),Ne.default.createElement(Mt,{side:"bottom",className:"tw-w-64"},"Manage your projects with different contexts and configurations."))),Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(ge,{className:"tw-px-2",variant:"secondary",onClick:S},"Create",Ne.default.createElement(Mm,{className:"tw-size-3"})),e.length>0&&Ne.default.createElement(tL,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon"},c?Ne.default.createElement(Ey,{className:"tw-size-5"}):Ne.default.createElement(Hi,{className:"tw-size-5"}))),Ne.default.createElement(Rt,null,Ne.default.createElement(jt,{asChild:!0},Ne.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Ne.default.createElement(Vi,{className:"tw-size-4"}))),Ne.default.createElement(Mt,{side:"bottom"},"Close Project Mode")))),e.length===0&&Ne.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Ne.default.createElement(dE,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ne.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Ne.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Ne.default.createElement("div",{className:"tw-relative"},Ne.default.createElement(kde,{value:b,onChange:g,placeholder:"Search projects..."}))),Ne.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Ne.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=>Ne.default.createElement(hIn,{key:A.name,project:A,loadContext:E,onEdit:x,onDelete:O}))),b.trim()&&y.length===0&&Ne.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Ne.default.createElement(c1,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Ne.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Ne.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Ne.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&&Ne.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"},Ne.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Ne.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Ne.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Ne.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ne.default.createElement(rk,{className:"tw-size-4"}),Ne.default.createElement("span",null,"Click a project card to start chatting")))))))});$Be.displayName="ProjectList";$r();$r();Cn();yo();var BBe=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: "+ei(s);r({sender:e_,isErrorMessage:!0,message:`Error: ${u}`,isVisible:!0,timestamp:Vl(new Date)})}};nO();nr();var mL=F(X()),qBe=class{constructor(e){this.plugin=e;this.chatHistory=[];this.plugin=e}addMessage(e){this.chatHistory.push(e),this.plugin.projectManager.getCurrentChainManager().addChatMessage(e)}getMessages(){return this.chatHistory}clearChatHistory(){this.chatHistory=[],this.plugin.projectManager.getCurrentChainManager().clearHistory()}replaceMessages(e){this.chatHistory=[...e]}};function SJt(t){let[e,r]=(0,mL.useState)(t.getMessages());(0,mL.useEffect)(()=>{r([...t.getMessages()])},[t,t.chatHistory]);let n=(0,mL.useCallback)(i=>{t.addMessage(i),r([...t.getMessages()])},[t]),o=(0,mL.useCallback)(()=>{t.clearChatHistory(),r([])},[t]);return[e,n,o]}var xJt=qBe;Cn();var CJt=F(Pp()),pm=require("obsidian"),xr=F(X()),gIn=({sharedState:t,chainManager:e,onSaveChat:r,updateUserMessageHistory:n,fileParserManager:o,plugin:i})=>{let a=Rn(),s=(0,xr.useContext)(_z),[u,l,c]=SJt(t),[d]=wF(),[f]=by(),[p,m]=(0,xr.useState)(""),[h,b]=(0,xr.useState)(""),[g,y]=(0,xr.useState)(null),[S,x]=(0,xr.useState)(!1),[O,P]=(0,xr.useState)(t_.DEFAULT),[E,A]=(0,xr.useState)([]),[I,R]=(0,xr.useState)(!1),[N,j]=(0,xr.useState)([]),[$,k]=(0,xr.useState)(!1),[z]=n8e(),[V,Q]=(0,xr.useState)(null),[J,D]=by(),B=Sq(),q=Cq.getInstance(),K=mz.getInstance(),H=(0,xr.useRef)(null);(0,xr.useEffect)(()=>{let te=()=>{H.current&&H.current.focus()};return s?.addEventListener(Dh.CHAT_IS_VISIBLE,te),()=>{s?.removeEventListener(Dh.CHAT_IS_VISIBLE,te)}},[s]);let ee=(0,xr.useContext)(gde),U=i.app||ee,W=async({toolCalls:te,urls:et,contextNotes:Re}={})=>{if(!h&&N.length===0)return;let Pe=Vl(new Date),oe=[];h&&oe.push({type:"text",text:h});for(let _f of N){let sC=await _f.arrayBuffer(),kb=CJt.Buffer.from(sC).toString("base64");oe.push({type:"image_url",image_url:{url:`data:${_f.type};base64,${kb}`}})}let se=[...Re||[]],ce=U.workspace.getActiveFile();I&&J!=="project"&&ce&&!se.some(_f=>_f.path===ce.path)&&se.push(ce);let Ce={message:h||"Image message",originalMessage:h,sender:Pi,isVisible:!0,timestamp:Pe,content:oe,context:{notes:se,urls:et||[],selectedTextContexts:z}};b(""),j([]),l(Ce),x(!0),P(t_.DEFAULT);let Je=h,ir=await iVe();h.includes("@composer")&&ir!==""&&(Je=h+`
<output_format>
`+ir+`
</output_format>`);let{processedPrompt:ea,includedFiles:ta}=await lce(Je||"","",U.vault,U.workspace.getActiveFile()),xc=f==="copilot_plus"?await q.processUrls(h||""):{urlContext:"",imageUrls:[]},Cd=new Set(ta.map(_f=>_f.path)),qi=await K.processContextNotes(Cd,o,U.vault,se,I,ce,f),lp=K.processSelectedTextContexts(),yf=ea+xc.urlContext+qi+lp,bf=h;te&&(bf+=" "+te.join(`
`));let Sn={message:yf,originalMessage:bf,sender:Pi,isVisible:!1,timestamp:Pe,content:oe,context:{notes:se,urls:f==="copilot_plus"?[...et||[],...xc.imageUrls]:et||[],selectedTextContexts:z}};l(Sn),h&&n(h),a.autosaveChat&&Y(),await BBe(Sn,e,l,m,y,{debug:a.debug,updateLoadingMessage:P}),a.autosaveChat&&Y(),x(!1),P(t_.DEFAULT)},Y=(0,xr.useCallback)(async()=>{if(!U){console.error("App instance is not available.");return}let te=t.getMessages().filter(Pe=>Pe.isVisible);if(te.length===0){new pm.Notice("No messages to save.");return}let et=te[0].timestamp?.epoch||Date.now(),Re=te.map(Pe=>`**${Pe.sender}**: ${Pe.message}
[Timestamp: ${Pe.timestamp?.display}]`).join(`
`);try{U.vault.getAbstractFileByPath(a.defaultSaveFolder)||await U.vault.createFolder(a.defaultSaveFolder);let{fileName:oe}=Vl(new Date(et)),se=te.find(qi=>qi.sender===Pi),ce=se?se.message.split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|]/g,"").trim():"Untitled Chat",Ce=a.defaultConversationNoteName||"{$date}_{$time}__{$topic}";Ce=Ce.replace("{$topic}",ce.slice(0,100).replace(/\s+/g,"_")).replace("{$date}",oe.split("_")[0]).replace("{$time}",oe.split("_")[1]);let Je=Ce.replace(/[\\/:*?"<>|]/g,"_"),ir=Mc(),ea=ir?`${ir.id}__`:"",ta=`${a.defaultSaveFolder}/${ea}${Je}.md`,xc=`---
epoch: ${et}
modelKey: ${d}
${ir?`projectId: ${ir.id}`:""}
${ir?`projectName: ${ir.name}`:""}
tags:
- ${a.defaultConversationTag}
${ir?` - project-${ir.name}`:""}
---
${Re}`,Cd=U.vault.getAbstractFileByPath(ta);Cd instanceof pm.TFile?await U.vault.modify(Cd,xc):(await U.vault.create(ta,xc),new pm.Notice(`Chat saved as note: ${ta}`))}catch(Pe){console.error("Error saving chat as note:",ei(Pe)),new pm.Notice("Failed to save chat as note. Check console for details.")}},[U,t,d,a.defaultConversationTag,a.defaultSaveFolder,a.defaultConversationNoteName]),ae=(0,xr.useCallback)(te=>{g&&(a.debug&&console.log(`stopping generation..., reason: ${te}`),g.abort(te),x(!1),P(t_.DEFAULT))},[g,a.debug]),Oe=(0,xr.useCallback)(async te=>{let et=te-1;if(et<0||u[et].sender!==Pi){new pm.Notice("Cannot regenerate the first message or a user message.");return}let Re=u[et],Pe=u.slice(0,te);c(),Pe.forEach(l),e.memoryManager.clearChatMemory();for(let oe=0;oe<Pe.length;oe+=2){let se=Pe[oe],ce=Pe[oe+1];se&&ce&&await e.memoryManager.getMemory().saveContext({input:se.message},{output:ce.message})}x(!0);try{await e.runChain(Re,new AbortController,m,l,{debug:a.debug})&&a.debug&&console.log("Message regenerated successfully")}catch(oe){console.error("Error regenerating message:",oe),new pm.Notice("Failed to regenerate message. Please try again.")}finally{x(!1)}a.autosaveChat&&Y()},[l,e,u,c,a.debug,a.autosaveChat,Y]),le=(0,xr.useCallback)(async(te,et)=>{let Re=u[te].message;if(Re===et)return;let Pe=[...u];for(let oe=te;oe<Pe.length;oe++)Pe[oe].originalMessage===Re&&(Pe[oe].message=et,Pe[oe].originalMessage=et,Pe[oe].context={notes:[],urls:[]});c(),Pe.forEach(l),await _N(Pe,e.memoryManager),Pe[te].sender===Pi&&te<Pe.length-1&&Oe(te+1),a.autosaveChat&&Y()},[l,e.memoryManager,u,c,Oe,a.autosaveChat,Y]);(0,xr.useEffect)(((te,et)=>()=>{let Re=ue().debug,Pe=async oe=>{let ce={message:await et(oe.detail.selectedText,oe.detail.eventSubtype),sender:Pi,isVisible:Re,timestamp:Vl(new Date)};Re&&l(ce),x(!0),await BBe(ce,e,l,m,y,{debug:Re,ignoreSystemMessage:!0}),x(!1)};return s?.addEventListener(te,Pe),()=>{s?.removeEventListener(te,Pe)}})(Br.APPLY_ADHOC_PROMPT,async(te,et)=>et?(await lce(et,te,U.vault,U.workspace.getActiveFile())).processedPrompt:te),[]),(0,xr.useEffect)(()=>{r&&r(Y)},[r,Y]);let ze=(0,xr.useCallback)(async te=>{let et=[...u];et.splice(te,1),c(),et.forEach(l),await _N(et,e.memoryManager)},[l,e.memoryManager,u,c]),rt=(0,xr.useCallback)(te=>{let et=a.projectList||[];if(et.findIndex(se=>se.name===te.name)>=0)throw new Error(`Project "${te.name}" already exists, please use a different name`);let Pe=[...et,te];return dt("projectList",Pe),Mc()?.id===te.id?Jce().then(()=>{new pm.Notice(`${te.name} added and context loaded`)}).catch(se=>{console.error("Error loading project context:",se),new pm.Notice(`${te.name} added but context loading failed`)}):new pm.Notice(`${te.name} added successfully`),!0},[a.projectList]),cr=(0,xr.useCallback)((te,et)=>{let Re=a.projectList||[];if(!Re.find(ce=>ce.name===te.name))throw new Error(`Project "${te.name}" does not exist`);let oe=Re.map(ce=>ce.name===te.name?et:ce);return dt("projectList",oe),Mc()?.id===te.id?(UR(et),Jce().then(()=>{new pm.Notice(`${te.name} updated and context reloaded`)}).catch(ce=>{console.error("Error reloading project context:",ce),new pm.Notice(`${te.name} updated but context reload failed`)})):new pm.Notice(`${te.name} updated successfully`),!0},[a.projectList]),wn=(0,xr.useCallback)(te=>{b(et=>`${et} ${te} `)},[]),Le=(0,xr.useCallback)(te=>{t8e(te)},[]),pt=(0,xr.useCallback)(async()=>{ae("new-chat"),await i.handleNewChat(),m(""),A([]),r8e(),J!=="copilot_plus"?R(!1):R(a.includeActiveNoteAsContext)},[ae,i,a.includeActiveNoteAsContext,J]),mt=(0,xr.useCallback)(()=>{i.loadCopilotChatHistory()},[i]);(0,xr.useEffect)(()=>{let te=et=>{let Re=et.detail?.reason||"new-chat";ae(Re)};return s?.addEventListener(Dh.ABORT_STREAM,te),()=>{s?.removeEventListener(Dh.ABORT_STREAM,te)}},[s,ae]),(0,xr.useEffect)(()=>{a.includeActiveNoteAsContext!==void 0&&(J==="copilot_plus"?R(a.includeActiveNoteAsContext):R(!1))},[a.includeActiveNoteAsContext,J]);let ht=()=>xr.default.createElement(xr.default.Fragment,null,xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement(c9t,{currentVersion:i.manifest.version}),xr.default.createElement(l9t,{chatHistory:u,currentAiMessage:p,loading:S,loadingMessage:O,app:U,onRegenerate:Oe,onEdit:le,onDelete:ze,onInsertToChat:wn,onReplaceChat:b,showHelperComponents:J!=="project"}),xr.default.createElement(B6t,{onNewChat:pt,onSaveAsNote:()=>Y(),onLoadHistory:mt,onModeChange:te=>{Q(J),te==="project"&&k(!1)}}),xr.default.createElement(I5t,{ref:H,inputMessage:h,setInputMessage:b,handleSendMessage:W,isGenerating:S,onStopGenerating:()=>ae("user-stopped"),app:U,contextNotes:E,setContextNotes:A,includeActiveNote:I,setIncludeActiveNote:R,mention:q,selectedImages:N,onAddImage:te=>j(et=>[...et,...te]),setSelectedImages:j,disableModelSwitch:J==="project",selectedTextContexts:z,onRemoveSelectedText:Le})));return xr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},xr.default.createElement("div",{className:"tw-h-full"},xr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},J==="project"&&xr.default.createElement("div",{className:`${J==="project"?"tw-z-modal":""}`},xr.default.createElement($Be,{projects:a.projectList||[],defaultOpen:!0,app:U,hasMessages:!1,onProjectAdded:rt,onEditProject:cr,inputRef:H,onClose:()=>{V?(D(V),Q(null)):D(B?"copilot_plus":"llm_chain")},showChatUI:te=>k(te)})),(J!=="project"||J==="project"&&$)&&ht())))},OJt=gIn;$r();var PJt=require("obsidian"),kM=F(X()),EJt=F(Dc()),$M=class extends PJt.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.sharedState=n.sharedState,this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Es}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,EJt.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(kM.createElement(gde.Provider,{value:this.app},kM.createElement(_z.Provider,{value:this.eventTarget},kM.createElement(kM.StrictMode,null,kM.createElement(Gce,{delayDuration:0},kM.createElement(OJt,{sharedState:this.sharedState,chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r}))))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){this.sharedState.replaceMessages(this.plugin.projectManager.getCurrentChainManager().getChatMessages());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)}};Cn();var TJt=require("obsidian"),nfe=class extends TJt.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=Vl(new Date(a.epoch)):i=Vl(new Date(r.stat.ctime)),`${o} - ${i.display}`}onChooseItem(r,n){this.onChooseFile(r)}};$r();$r();function AJt(t){t.addItem(n=>{n.setTitle("Copilot: Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${Br.ADD_SELECTION_TO_CHAT_CONTEXT}`)})});let e=Gx();e.filter(n=>n.showInContextMenu).length>0&&t.addSeparator(),AW(e.filter(n=>n.showInContextMenu)).forEach(n=>{t.addItem(o=>{o.setTitle(`Copilot: ${n.title}`).onClick(()=>{app.commands.executeCommandById(`copilot:${JU(n.title)}`)})})})}BR();yo();nO();Ix();$r();nr();var oK=require("obsidian"),Eqe=F(X()),KYt=F(Dc());var ofe=class extends sd{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")}};ti();var R9=F(X());Tn();var IJt=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>R9.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:_e("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")},R9.default.createElement("div",{className:_e("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),R9.default.createElement("span",{className:_e("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)),MJt=({id:t,children:e,isSelected:r})=>r?R9.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:_e("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 hh=F(X()),RJt=(0,hh.createContext)(void 0),jJt=({children:t})=>{let[e,r]=(0,hh.useState)("basic"),[n,o]=(0,hh.useState)(null),i=(0,hh.useRef)(!1);return(0,hh.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),hh.default.createElement(RJt.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},Vz=()=>{let t=(0,hh.useContext)(RJt);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};nr();var it=F(X());ti();yn();var ql=F(X());Tn();var j9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},ql.createElement("table",{ref:r,className:_e("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));j9.displayName="Table";var N9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("thead",{ref:r,className:_e("[&_tr]:tw-border-b",t),...e}));N9.displayName="TableHeader";var D9=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tbody",{ref:r,className:t,...e}));D9.displayName="TableBody";var yIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tfoot",{ref:r,className:_e("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));yIn.displayName="TableFooter";var BM=ql.forwardRef(({className:t,...e},r)=>ql.createElement("tr",{ref:r,className:_e("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));BM.displayName="TableRow";var ap=ql.forwardRef(({className:t,...e},r)=>ql.createElement("th",{ref:r,className:_e("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}));ap.displayName="TableHead";var gf=ql.forwardRef(({className:t,...e},r)=>ql.createElement("td",{ref:r,className:_e("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));gf.displayName="TableCell";var bIn=ql.forwardRef(({className:t,...e},r)=>ql.createElement("caption",{ref:r,className:_e("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));bIn.displayName="TableCaption";var Kz=F(X());var gh=F(X(),1);var DJt=F(X(),1);function NJt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function UBe(...t){return e=>{let r=!1,n=t.map(o=>{let i=NJt(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():NJt(t[o],null)}}}}function LJt(...t){return DJt.useCallback(UBe(...t),t)}function zBe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var FJt=F(X(),1),xIn=F(ds(),1);var vd=F(X(),1);var Wz=F(ft(),1),VBe=vd.forwardRef((t,e)=>{let{children:r,...n}=t,o=vd.Children.toArray(r),i=o.find(vIn);if(i){let a=i.props.children,s=o.map(u=>u===i?vd.Children.count(a)>1?vd.Children.only(null):vd.isValidElement(a)?a.props.children:null:u);return(0,Wz.jsx)(HBe,{...n,ref:e,children:vd.isValidElement(a)?vd.cloneElement(a,void 0,s):null})}return(0,Wz.jsx)(HBe,{...n,ref:e,children:r})});VBe.displayName="Slot";var HBe=vd.forwardRef((t,e)=>{let{children:r,...n}=t;if(vd.isValidElement(r)){let o=SIn(r);return vd.cloneElement(r,{...wIn(n,r.props),ref:e?UBe(e,o):o})}return vd.Children.count(r)>1?vd.Children.only(null):null});HBe.displayName="SlotClone";var _In=({children:t})=>(0,Wz.jsx)(Wz.Fragment,{children:t});function vIn(t){return vd.isValidElement(t)&&t.type===_In}function wIn(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 SIn(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 kJt=F(ft(),1),CIn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],WBe=CIn.reduce((t,e)=>{let r=FJt.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?VBe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,kJt.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var UM=F(ft(),1),KBe="Checkbox",[OIn,Z_i]=Yi(KBe),[PIn,EIn]=OIn(KBe),$Jt=gh.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]=gh.useState(null),m=LJt(e,x=>p(x)),h=gh.useRef(!1),b=f?c||!!f.closest("form"):!0,[g=!1,y]=ud({prop:o,defaultProp:i,onChange:l}),S=gh.useRef(g);return gh.useEffect(()=>{let x=f?.form;if(x){let O=()=>y(S.current);return x.addEventListener("reset",O),()=>x.removeEventListener("reset",O)}},[f,y]),(0,UM.jsxs)(PIn,{scope:r,state:g,disabled:s,children:[(0,UM.jsx)(WBe.button,{type:"button",role:"checkbox","aria-checked":qM(g)?"mixed":g,"aria-required":a,"data-state":UJt(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:zBe(t.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:zBe(t.onClick,x=>{y(O=>qM(O)?!0:!O),b&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),b&&(0,UM.jsx)(TIn,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:qM(i)?!1:i})]})});$Jt.displayName=KBe;var BJt="CheckboxIndicator",qJt=gh.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=EIn(BJt,r);return(0,UM.jsx)(fd,{present:n||qM(i.state)||i.state===!0,children:(0,UM.jsx)(WBe.span,{"data-state":UJt(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});qJt.displayName=BJt;var TIn=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=gh.useRef(null),s=Lz(r),u=Xx(e);gh.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=qM(r),p.call(c,qM(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=gh.useRef(qM(r)?!1:r);return(0,UM.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 qM(t){return t==="indeterminate"}function UJt(t){return qM(t)?"indeterminate":t?"checked":"unchecked"}var GBe=$Jt,zJt=qJt;yn();Tn();var wd=Kz.forwardRef(({className:t,...e},r)=>Kz.createElement(GBe,{ref:r,className:_e("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},Kz.createElement(zJt,{className:_e("tw-flex tw-items-center tw-justify-center tw-text-current")},Kz.createElement(Jl,{className:"tw-size-4"}))));wd.displayName=GBe.displayName;var Ae=F(X()),wL=F(ds());var Ls=F(X());function VJt(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Ls.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var L9=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hL(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function ife(t){return"nodeType"in t}function sp(t){var e,r;return t?hL(t)?t:ife(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function afe(t){let{Document:e}=sp(t);return t instanceof e}function Gz(t){return hL(t)?!1:t instanceof sp(t).HTMLElement}function YBe(t){return t instanceof sp(t).SVGElement}function gL(t){return t?hL(t)?t.document:ife(t)?afe(t)?t:Gz(t)||YBe(t)?t.ownerDocument:document:document:document}var oy=L9?Ls.useLayoutEffect:Ls.useEffect;function sfe(t){let e=(0,Ls.useRef)(t);return oy(()=>{e.current=t}),(0,Ls.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 WJt(){let t=(0,Ls.useRef)(null),e=(0,Ls.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,Ls.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function Jz(t,e){e===void 0&&(e=[t]);let r=(0,Ls.useRef)(t);return oy(()=>{r.current!==t&&(r.current=t)},e),r}function Yz(t,e){let r=(0,Ls.useRef)();return(0,Ls.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function F9(t){let e=sfe(t),r=(0,Ls.useRef)(null),n=(0,Ls.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function ufe(t){let e=(0,Ls.useRef)();return(0,Ls.useEffect)(()=>{e.current=t},[t]),e.current}var JBe={};function yL(t,e){return(0,Ls.useMemo)(()=>{if(e)return e;let r=JBe[t]==null?0:JBe[t]+1;return JBe[t]=r,t+"-"+r},[t,e])}function KJt(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 bL=KJt(1),_L=KJt(-1);function IIn(t){return"clientX"in t&&"clientY"in t}function k9(t){if(!t)return!1;let{KeyboardEvent:e}=sp(t.target);return e&&t instanceof e}function MIn(t){if(!t)return!1;let{TouchEvent:e}=sp(t.target);return e&&t instanceof e}function lfe(t){if(MIn(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 IIn(t)?{x:t.clientX,y:t.clientY}:null}var Rb=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[Rb.Translate.toString(t),Rb.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),HJt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function GJt(t){return t.matches(HJt)?t:t.querySelector(HJt)}var vL=F(X()),RIn={display:"none"};function JJt(t){let{id:e,value:r}=t;return vL.default.createElement("div",{id:e,style:RIn},r)}function YJt(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 vL.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function ZJt(){let[t,e]=(0,vL.useState)("");return{announce:(0,vL.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var c7t=(0,Ae.createContext)(null);function jIn(t){let e=(0,Ae.useContext)(c7t);(0,Ae.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function NIn(){let[t]=(0,Ae.useState)(()=>new Set),e=(0,Ae.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Ae.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 DIn={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.
`},LIn={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 FIn(t){let{announcements:e=LIn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=DIn}=t,{announce:i,announcement:a}=ZJt(),s=yL("DndLiveRegion"),[u,l]=(0,Ae.useState)(!1);if((0,Ae.useEffect)(()=>{l(!0)},[]),jIn((0,Ae.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=Ae.default.createElement(Ae.default.Fragment,null,Ae.default.createElement(JJt,{id:n,value:o.draggable}),Ae.default.createElement(YJt,{id:s,announcement:a}));return r?(0,wL.createPortal)(c,r):c}var Ul;(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"})(Ul||(Ul={}));function dfe(){}function Zz(t,e){return(0,Ae.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function pfe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Ae.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var jb=Object.freeze({x:0,y:0});function d7t(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function f7t(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function kIn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function XJt(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 iqe(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function QJt(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 z9=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=QJt(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=d7t(QJt(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(f7t)},p7t=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=XJt(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=XJt(u),c=o.reduce((f,p,m)=>f+d7t(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(f7t)};function $In(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 BIn=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=$In(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(kIn)};function qIn(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function m7t(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:jb}function UIn(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 zIn=UIn(1);function HIn(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 VIn(t,e,r){let n=HIn(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 WIn={ignoreTransform:!1};function CL(t,e){e===void 0&&(e=WIn);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=sp(t).getComputedStyle(t);l&&(r=VIn(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 e7t(t){return CL(t,{ignoreTransform:!0})}function KIn(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function GIn(t,e){return e===void 0&&(e=sp(t).getComputedStyle(t)),e.position==="fixed"}function JIn(t,e){e===void 0&&(e=sp(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 H9(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(afe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!Gz(o)||YBe(o)||r.includes(o))return r;let i=sp(t).getComputedStyle(o);return o!==t&&JIn(o,i)&&r.push(o),GIn(o,i)?r:n(o.parentNode)}return t?n(t):r}function h7t(t){let[e]=H9(t,1);return e??null}function ZBe(t){return!L9||!t?null:hL(t)?t:ife(t)?afe(t)||t===gL(t).scrollingElement?window:Gz(t)?t:null:null}function g7t(t){return hL(t)?t.scrollX:t.scrollLeft}function y7t(t){return hL(t)?t.scrollY:t.scrollTop}function eqe(t){return{x:g7t(t),y:y7t(t)}}var Sc;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Sc||(Sc={}));function b7t(t){return!L9||!t?!1:t===document.scrollingElement}function _7t(t){let e={x:0,y:0},r=b7t(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 YIn={x:.2,y:.2};function ZIn(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=YIn);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=_7t(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=Sc.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Sc.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Sc.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Sc.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function XIn(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 v7t(t){return t.reduce((e,r)=>bL(e,eqe(r)),jb)}function QIn(t){return t.reduce((e,r)=>e+g7t(r),0)}function eMn(t){return t.reduce((e,r)=>e+y7t(r),0)}function tMn(t,e){if(e===void 0&&(e=CL),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);h7t(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var rMn=[["x",["left","right"],QIn],["y",["top","bottom"],eMn]],B9=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=H9(r),o=v7t(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of rMn)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})}},SL=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 nMn(t){let{EventTarget:e}=sp(t);return t instanceof e?t:gL(t)}function XBe(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 iy;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(iy||(iy={}));function t7t(t){t.preventDefault()}function oMn(t){t.stopPropagation()}var $n;(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"})($n||($n={}));var w7t={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter,$n.Tab]},iMn=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case $n.Right:return{...r,x:r.x+25};case $n.Left:return{...r,x:r.x-25};case $n.Down:return{...r,y:r.y+25};case $n.Up:return{...r,y:r.y-25}}},HM=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 SL(gL(r)),this.windowListeners=new SL(sp(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(iy.Resize,this.handleCancel),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(iy.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&tMn(n),r(jb)}handleKeyDown(e){if(k9(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=w7t,coordinateGetter:a=iMn,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}:jb;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=_L(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:S,isBottom:x,maxScroll:O,minScroll:P}=_7t(h),E=XIn(h),A={x:Math.min(b===$n.Right?E.right-E.width/2:E.right,Math.max(b===$n.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(b===$n.Down?E.bottom-E.height/2:E.bottom,Math.max(b===$n.Down?E.top:E.top+E.height/2,d.y))},I=b===$n.Right&&!y||b===$n.Left&&!S,R=b===$n.Down&&!x||b===$n.Up&&!g;if(I&&A.x!==d.x){let N=h.scrollLeft+f.x,j=b===$n.Right&&N<=O.x||b===$n.Left&&N>=P.x;if(j&&!f.y){h.scrollTo({left:N,behavior:s});return}j?p.x=h.scrollLeft-N:p.x=b===$n.Right?h.scrollLeft-O.x:h.scrollLeft-P.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===$n.Down&&N<=O.y||b===$n.Up&&N>=P.y;if(j&&!f.x){h.scrollTo({top:N,behavior:s});return}j?p.y=h.scrollTop-N:p.y=b===$n.Down?h.scrollTop-O.y:h.scrollTop-P.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,bL(_L(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()}};HM.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=w7t,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 r7t(t){return!!(t&&"distance"in t)}function n7t(t){return!!(t&&"delay"in t)}var q9=class{constructor(e,r,n){var o;n===void 0&&(n=nMn(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=gL(a),this.documentListeners=new SL(this.document),this.listeners=new SL(n),this.windowListeners=new SL(sp(a)),this.initialCoordinates=(o=lfe(i))!=null?o:jb,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(iy.Resize,this.handleCancel),this.windowListeners.add(iy.DragStart,t7t),this.windowListeners.add(iy.VisibilityChange,this.handleCancel),this.windowListeners.add(iy.ContextMenu,t7t),this.documentListeners.add(iy.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(n7t(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(r7t(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(iy.Click,oMn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(iy.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=lfe(e))!=null?r:jb,l=_L(o,u);if(!n&&s){if(r7t(s)){if(s.tolerance!=null&&XBe(l,s.tolerance))return this.handleCancel();if(XBe(l,s.distance))return this.handleStart()}if(n7t(s)&&XBe(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===$n.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},aMn={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},VM=class extends q9{constructor(e){let{event:r}=e,n=gL(r.target);super(e,aMn,n)}};VM.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 sMn={move:{name:"mousemove"},end:{name:"mouseup"}},tqe;(function(t){t[t.RightClick=2]="RightClick"})(tqe||(tqe={}));var rqe=class extends q9{constructor(e){super(e,sMn,gL(e.event.target))}};rqe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===tqe.RightClick?!1:(n?.({event:r}),!0)}}];var QBe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},nqe=class extends q9{constructor(e){super(e,QBe)}static setup(){return window.addEventListener(QBe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(QBe.move.name,e)};function e(){}}};nqe.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 $9;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})($9||($9={}));var ffe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ffe||(ffe={}));function uMn(t){let{acceleration:e,activator:r=$9.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=ffe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=cMn({delta:d,disabled:!i}),[m,h]=WJt(),b=(0,Ae.useRef)({x:0,y:0}),g=(0,Ae.useRef)({x:0,y:0}),y=(0,Ae.useMemo)(()=>{switch(r){case $9.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case $9.DraggableRect:return o}},[r,o,u]),S=(0,Ae.useRef)(null),x=(0,Ae.useCallback)(()=>{let P=S.current;if(!P)return;let E=b.current.x*g.current.x,A=b.current.y*g.current.y;P.scrollBy(E,A)},[]),O=(0,Ae.useMemo)(()=>s===ffe.TreeOrder?[...l].reverse():l,[s,l]);(0,Ae.useEffect)(()=>{if(!i||!l.length||!y){h();return}for(let P of O){if(n?.(P)===!1)continue;let E=l.indexOf(P),A=c[E];if(!A)continue;let{direction:I,speed:R}=ZIn(P,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(),S.current=P,m(x,a),b.current=R,g.current=I;return}}b.current={x:0,y:0},g.current={x:0,y:0},h()},[e,x,n,h,i,a,JSON.stringify(y),JSON.stringify(p),m,l,O,c,JSON.stringify(f)])}var lMn={x:{[Sc.Backward]:!1,[Sc.Forward]:!1},y:{[Sc.Backward]:!1,[Sc.Forward]:!1}};function cMn(t){let{delta:e,disabled:r}=t,n=ufe(e);return Yz(o=>{if(r||!n||!o)return lMn;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Sc.Backward]:o.x[Sc.Backward]||i.x===-1,[Sc.Forward]:o.x[Sc.Forward]||i.x===1},y:{[Sc.Backward]:o.y[Sc.Backward]||i.y===-1,[Sc.Forward]:o.y[Sc.Forward]||i.y===1}}},[r,e,n])}function dMn(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return Yz(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function fMn(t,e){return(0,Ae.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 U9;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(U9||(U9={}));var oqe;(function(t){t.Optimized="optimized"})(oqe||(oqe={}));var o7t=new Map;function pMn(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Ae.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Ae.useRef)(t),d=b(),f=Jz(d),p=(0,Ae.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(y=>y===null?g:y.concat(g.filter(S=>!y.includes(S))))},[f]),m=(0,Ae.useRef)(null),h=Yz(g=>{if(d&&!r)return o7t;if(!g||g===o7t||c.current!==t||i!=null){let y=new Map;for(let S of t){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){y.set(S.id,S.rect.current);continue}let x=S.node.current,O=x?new B9(u(x),x):null;S.rect.current=O,O&&y.set(S.id,O)}return y}return g},[t,i,r,d,u]);return(0,Ae.useEffect)(()=>{c.current=t},[t]),(0,Ae.useEffect)(()=>{d||p()},[r,d]),(0,Ae.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Ae.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 U9.Always:return!1;case U9.BeforeDragging:return r;default:return!r}}}function S7t(t,e){return Yz(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function mMn(t,e){return S7t(t,e)}function hMn(t){let{callback:e,disabled:r}=t,n=sfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function mfe(t){let{callback:e,disabled:r}=t,n=sfe(e),o=(0,Ae.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Ae.useEffect)(()=>()=>o?.disconnect(),[o]),o}function gMn(t){return new B9(CL(t),t)}function i7t(t,e,r){e===void 0&&(e=gMn);let[n,o]=(0,Ae.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=hMn({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=mfe({callback:i});return oy(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function yMn(t){let e=S7t(t);return m7t(t,e)}var a7t=[];function bMn(t){let e=(0,Ae.useRef)(t),r=Yz(n=>t?n&&n!==a7t&&t&&e.current&&t.parentNode===e.current.parentNode?n:H9(t):a7t,[t]);return(0,Ae.useEffect)(()=>{e.current=t},[t]),r}function _Mn(t){let[e,r]=(0,Ae.useState)(null),n=(0,Ae.useRef)(t),o=(0,Ae.useCallback)(i=>{let a=ZBe(i.target);a&&r(s=>s?(s.set(a,eqe(a)),new Map(s)):null)},[]);return(0,Ae.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=ZBe(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,eqe(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=ZBe(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Ae.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>bL(i,a),jb):v7t(t):jb,[t,e])}function s7t(t,e){e===void 0&&(e=[]);let r=(0,Ae.useRef)(null);return(0,Ae.useEffect)(()=>{r.current=null},e),(0,Ae.useEffect)(()=>{let n=t!==jb;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?_L(t,r.current):jb}function vMn(t){(0,Ae.useEffect)(()=>{if(!L9)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 wMn(t,e){return(0,Ae.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function x7t(t){return(0,Ae.useMemo)(()=>t?KIn(t):null,[t])}var u7t=[];function SMn(t,e){e===void 0&&(e=CL);let[r]=t,n=x7t(r?sp(r):null),[o,i]=(0,Ae.useState)(u7t);function a(){i(()=>t.length?t.map(u=>b7t(u)?n:new B9(e(u),u)):u7t)}let s=mfe({callback:a});return oy(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function xMn(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return Gz(e)?e:t}function CMn(t){let{measure:e}=t,[r,n]=(0,Ae.useState)(null),o=(0,Ae.useCallback)(l=>{for(let{target:c}of l)if(Gz(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=mfe({callback:o}),a=(0,Ae.useCallback)(l=>{let c=xMn(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=F9(a);return(0,Ae.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var OMn=[{sensor:VM,options:{}},{sensor:HM,options:{}}],PMn={current:{}},cfe={draggable:{measure:e7t},droppable:{measure:e7t,strategy:U9.WhileDragging,frequency:oqe.Optimized},dragOverlay:{measure:CL}},xL=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}},EMn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xL,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dfe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cfe,measureDroppableContainers:dfe,windowRect:null,measuringScheduled:!1},TMn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dfe,draggableNodes:new Map,over:null,measureDroppableContainers:dfe},hfe=(0,Ae.createContext)(TMn),C7t=(0,Ae.createContext)(EMn);function AMn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xL}}}function IMn(t,e){switch(e.type){case Ul.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ul.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 Ul.DragEnd:case Ul.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ul.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new xL(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Ul.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 xL(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Ul.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new xL(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function MMn(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Ae.useContext)(hfe),i=ufe(n),a=ufe(r?.id);return(0,Ae.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!k9(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=GJt(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function RMn(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function jMn(t){return(0,Ae.useMemo)(()=>({draggable:{...cfe.draggable,...t?.draggable},droppable:{...cfe.droppable,...t?.droppable},dragOverlay:{...cfe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function NMn(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Ae.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;oy(()=>{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=m7t(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=h7t(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var O7t=(0,Ae.createContext)({...jb,scaleX:1,scaleY:1}),zM;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(zM||(zM={}));var V9=(0,Ae.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=OMn,collisionDetection:d=BIn,measuring:f,modifiers:p,...m}=e,h=(0,Ae.useReducer)(IMn,void 0,AMn),[b,g]=h,[y,S]=NIn(),[x,O]=(0,Ae.useState)(zM.Uninitialized),P=x===zM.Initialized,{draggable:{active:E,nodes:A,translate:I},droppable:{containers:R}}=b,N=E!=null?A.get(E):null,j=(0,Ae.useRef)({initial:null,translated:null}),$=(0,Ae.useMemo)(()=>{var is;return E!=null?{id:E,data:(is=N?.data)!=null?is:PMn,rect:j}:null},[E,N]),k=(0,Ae.useRef)(null),[z,V]=(0,Ae.useState)(null),[Q,J]=(0,Ae.useState)(null),D=Jz(m,Object.values(m)),B=yL("DndDescribedBy",a),q=(0,Ae.useMemo)(()=>R.getEnabled(),[R]),K=jMn(f),{droppableRects:H,measureDroppableContainers:ee,measuringScheduled:U}=pMn(q,{dragging:P,dependencies:[I.x,I.y],config:K.droppable}),W=dMn(A,E),Y=(0,Ae.useMemo)(()=>Q?lfe(Q):null,[Q]),ae=kb(),Oe=mMn(W,K.draggable.measure);NMn({activeNode:E!=null?A.get(E):null,config:ae.layoutShiftCompensation,initialRect:Oe,measure:K.draggable.measure});let le=i7t(W,K.draggable.measure,Oe),Be=i7t(W?W.parentElement:null),ze=(0,Ae.useRef)({activatorEvent:null,active:null,activeNode:W,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),rt=R.getNodeFor((r=ze.current.over)==null?void 0:r.id),cr=CMn({measure:K.dragOverlay.measure}),wn=(n=cr.nodeRef.current)!=null?n:W,Le=P?(o=cr.rect)!=null?o:le:null,pt=!!(cr.nodeRef.current&&cr.rect),mt=yMn(pt?null:le),ht=x7t(wn?sp(wn):null),te=bMn(P?rt??W:null),et=SMn(te),Re=RMn(p,{transform:{x:I.x-mt.x,y:I.y-mt.y,scaleX:1,scaleY:1},activatorEvent:Q,active:$,activeNodeRect:le,containerNodeRect:Be,draggingNodeRect:Le,over:ze.current.over,overlayNodeRect:cr.rect,scrollableAncestors:te,scrollableAncestorRects:et,windowRect:ht}),Pe=Y?bL(Y,I):null,oe=_Mn(te),se=s7t(oe),ce=s7t(oe,[le]),Ce=bL(Re,se),Je=Le?zIn(Le,Re):null,ir=$&&Je?d({active:$,collisionRect:Je,droppableRects:H,droppableContainers:q,pointerCoordinates:Pe}):null,ea=iqe(ir,"id"),[ta,xc]=(0,Ae.useState)(null),Cd=pt?Re:bL(Re,ce),qi=qIn(Cd,(i=ta?.rect)!=null?i:null,le),lp=(0,Ae.useRef)(null),yf=(0,Ae.useCallback)((is,$s)=>{let{sensor:La,options:vf}=$s;if(k.current==null)return;let Od=A.get(k.current);if(!Od)return;let ws=is.nativeEvent,cp=new La({active:k.current,activeNode:Od,event:ws,options:vf,context:ze,onAbort(In){if(!A.get(In))return;let{onDragAbort:Sf}=D.current,mm={id:In};Sf?.(mm),y({type:"onDragAbort",event:mm})},onPending(In,Ye,Sf,mm){if(!A.get(In))return;let{onDragPending:uC}=D.current,En={id:In,constraint:Ye,initialCoordinates:Sf,offset:mm};uC?.(En),y({type:"onDragPending",event:En})},onStart(In){let Ye=k.current;if(Ye==null)return;let Sf=A.get(Ye);if(!Sf)return;let{onDragStart:mm}=D.current,vl={activatorEvent:ws,active:{id:Ye,data:Sf.data,rect:j}};(0,wL.unstable_batchedUpdates)(()=>{mm?.(vl),O(zM.Initializing),g({type:Ul.DragStart,initialCoordinates:In,active:Ye}),y({type:"onDragStart",event:vl}),V(lp.current),J(ws)})},onMove(In){g({type:Ul.DragMove,coordinates:In})},onEnd:wf(Ul.DragEnd),onCancel:wf(Ul.DragCancel)});lp.current=cp;function wf(In){return async function(){let{active:Sf,collisions:mm,over:vl,scrollAdjustedTranslate:uC}=ze.current,En=null;if(Sf&&uC){let{cancelDrop:uy}=D.current;En={activatorEvent:ws,active:Sf,collisions:mm,delta:uC,over:vl},In===Ul.DragEnd&&typeof uy=="function"&&await Promise.resolve(uy(En))&&(In=Ul.DragCancel)}k.current=null,(0,wL.unstable_batchedUpdates)(()=>{g({type:In}),O(zM.Uninitialized),xc(null),V(null),J(null),lp.current=null;let uy=In===Ul.DragEnd?"onDragEnd":"onDragCancel";if(En){let t2=D.current[uy];t2?.(En),y({type:uy,event:En})}})}}},[A]),bf=(0,Ae.useCallback)((is,$s)=>(La,vf)=>{let Od=La.nativeEvent,ws=A.get(vf);if(k.current!==null||!ws||Od.dndKit||Od.defaultPrevented)return;let cp={active:ws};is(La,$s.options,cp)===!0&&(Od.dndKit={capturedBy:$s.sensor},k.current=vf,yf(La,$s))},[A,yf]),Sn=fMn(c,bf);vMn(c),oy(()=>{le&&x===zM.Initializing&&O(zM.Initialized)},[le,x]),(0,Ae.useEffect)(()=>{let{onDragMove:is}=D.current,{active:$s,activatorEvent:La,collisions:vf,over:Od}=ze.current;if(!$s||!La)return;let ws={active:$s,activatorEvent:La,collisions:vf,delta:{x:Ce.x,y:Ce.y},over:Od};(0,wL.unstable_batchedUpdates)(()=>{is?.(ws),y({type:"onDragMove",event:ws})})},[Ce.x,Ce.y]),(0,Ae.useEffect)(()=>{let{active:is,activatorEvent:$s,collisions:La,droppableContainers:vf,scrollAdjustedTranslate:Od}=ze.current;if(!is||k.current==null||!$s||!Od)return;let{onDragOver:ws}=D.current,cp=vf.get(ea),wf=cp&&cp.rect.current?{id:cp.id,rect:cp.rect.current,data:cp.data,disabled:cp.disabled}:null,In={active:is,activatorEvent:$s,collisions:La,delta:{x:Od.x,y:Od.y},over:wf};(0,wL.unstable_batchedUpdates)(()=>{xc(wf),ws?.(In),y({type:"onDragOver",event:In})})},[ea]),oy(()=>{ze.current={activatorEvent:Q,active:$,activeNode:W,collisionRect:Je,collisions:ir,droppableRects:H,draggableNodes:A,draggingNode:wn,draggingNodeRect:Le,droppableContainers:R,over:ta,scrollableAncestors:te,scrollAdjustedTranslate:Ce},j.current={initial:Le,translated:Je}},[$,W,ir,Je,A,wn,Le,H,R,ta,te,Ce]),uMn({...ae,delta:I,draggingRect:Je,pointerCoordinates:Pe,scrollableAncestors:te,scrollableAncestorRects:et});let _f=(0,Ae.useMemo)(()=>({active:$,activeNode:W,activeNodeRect:le,activatorEvent:Q,collisions:ir,containerNodeRect:Be,dragOverlay:cr,draggableNodes:A,droppableContainers:R,droppableRects:H,over:ta,measureDroppableContainers:ee,scrollableAncestors:te,scrollableAncestorRects:et,measuringConfiguration:K,measuringScheduled:U,windowRect:ht}),[$,W,le,Q,ir,Be,cr,A,R,H,ta,ee,te,et,K,U,ht]),sC=(0,Ae.useMemo)(()=>({activatorEvent:Q,activators:Sn,active:$,activeNodeRect:le,ariaDescribedById:{draggable:B},dispatch:g,draggableNodes:A,over:ta,measureDroppableContainers:ee}),[Q,Sn,$,le,g,B,A,ta,ee]);return Ae.default.createElement(c7t.Provider,{value:S},Ae.default.createElement(hfe.Provider,{value:sC},Ae.default.createElement(C7t.Provider,{value:_f},Ae.default.createElement(O7t.Provider,{value:qi},l)),Ae.default.createElement(MMn,{disabled:s?.restoreFocus===!1})),Ae.default.createElement(FIn,{...s,hiddenTextDescribedById:B}));function kb(){let is=z?.autoScrollEnabled===!1,$s=typeof u=="object"?u.enabled===!1:u===!1,La=P&&!is&&!$s;return typeof u=="object"?{...u,enabled:La}:{enabled:La}}}),DMn=(0,Ae.createContext)(null),l7t="button",LMn="Draggable";function P7t(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=yL(LMn),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Ae.useContext)(hfe),{role:p=l7t,roleDescription:m="draggable",tabIndex:h=0}=o??{},b=u?.id===e,g=(0,Ae.useContext)(b?O7t:DMn),[y,S]=F9(),[x,O]=F9(),P=wMn(a,e),E=Jz(r);oy(()=>(d.set(e,{id:e,key:i,node:y,activatorNode:x,data:E}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let A=(0,Ae.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":b&&p===l7t?!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:P,node:y,over:f,setNodeRef:S,setActivatorNodeRef:O,transform:g}}function E7t(){return(0,Ae.useContext)(C7t)}var FMn="Droppable",kMn={timeout:25};function T7t(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=yL(FMn),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Ae.useContext)(hfe),c=(0,Ae.useRef)({disabled:r}),d=(0,Ae.useRef)(!1),f=(0,Ae.useRef)(null),p=(0,Ae.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:b}={...kMn,...o},g=Jz(h??n),y=(0,Ae.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]),S=mfe({callback:y,disabled:m||!a}),x=(0,Ae.useCallback)((A,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),A&&S.observe(A))},[S]),[O,P]=F9(x),E=Jz(e);return(0,Ae.useEffect)(()=>{!S||!O.current||(S.disconnect(),d.current=!1,S.observe(O.current))},[O,S]),(0,Ae.useEffect)(()=>(s({type:Ul.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:E}}),()=>s({type:Ul.UnregisterDroppable,key:i,id:n})),[n]),(0,Ae.useEffect)(()=>{r!==c.current.disabled&&(s({type:Ul.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:P}}var Fs=F(X());function _fe(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function $Mn(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function gfe(t){return t!==null&&t>=0}function BMn(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 qMn(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var A7t=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=_fe(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 yfe={scaleX:1,scaleY:1},W9=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,...yfe}:null}let u=UMn(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...yfe}:o<r&&o>=a?{x:0,y:s.height+u,...yfe}:{x:0,y:0,...yfe}};function UMn(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 I7t="Sortable",M7t=Fs.default.createContext({activeIndex:-1,containerId:I7t,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:A7t,disabled:{draggable:!1,droppable:!1}});function K9(t){let{children:e,id:r,items:n,strategy:o=A7t,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=E7t(),d=yL(I7t,r),f=s.rect!==null,p=(0,Fs.useMemo)(()=>n.map(P=>typeof P=="object"&&"id"in P?P.id:P),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,b=l?p.indexOf(l.id):-1,g=(0,Fs.useRef)(p),y=!BMn(p,g.current),S=b!==-1&&h===-1||y,x=qMn(i);oy(()=>{y&&m&&c(p)},[y,p,m,c]),(0,Fs.useEffect)(()=>{g.current=p},[p]);let O=(0,Fs.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:S,items:p,overIndex:b,useDragOverlay:f,sortedRects:$Mn(p,u),strategy:o}),[h,d,x.draggable,x.droppable,S,p,b,u,f,o]);return Fs.default.createElement(M7t.Provider,{value:O},e)}var zMn=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return _fe(r,n,o).indexOf(e)},HMn=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},VMn={duration:200,easing:"ease"},R7t="transform",WMn=Rb.Transition.toString({property:R7t,duration:0,easing:"linear"}),KMn={roleDescription:"sortable"};function GMn(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,Fs.useState)(null),s=(0,Fs.useRef)(r);return oy(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=CL(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,Fs.useEffect)(()=>{i&&a(null)},[i]),i}function G9(t){let{animateLayoutChanges:e=HMn,attributes:r,disabled:n,data:o,getNewIndex:i=zMn,id:a,strategy:s,resizeObserverConfig:u,transition:l=VMn}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:b,useDragOverlay:g,strategy:y}=(0,Fs.useContext)(M7t),S=JMn(n,p),x=c.indexOf(a),O=(0,Fs.useMemo)(()=>({sortable:{containerId:d,index:x,items:c},...o}),[d,o,x,c]),P=(0,Fs.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:A,isOver:I,setNodeRef:R}=T7t({id:a,data:O,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...u}}),{active:N,activatorEvent:j,activeNodeRect:$,attributes:k,setNodeRef:z,listeners:V,isDragging:Q,over:J,setActivatorNodeRef:D,transform:B}=P7t({id:a,data:O,attributes:{...KMn,...r},disabled:S.draggable}),q=VJt(R,z),K=!!N,H=K&&!m&&gfe(f)&&gfe(b),ee=!g&&Q,U=ee&&H?B:null,Y=H?U??(s??y)({rects:h,activeNodeRect:$,activeIndex:f,overIndex:b,index:x}):null,ae=gfe(f)&&gfe(b)?i({id:a,items:c,activeIndex:f,overIndex:b}):x,Oe=N?.id,le=(0,Fs.useRef)({activeId:Oe,items:c,newIndex:ae,containerId:d}),Be=c!==le.current.items,ze=e({active:N,containerId:d,isDragging:Q,isSorting:K,id:a,index:x,items:c,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),rt=GMn({disabled:!ze,index:x,node:A,rect:E});return(0,Fs.useEffect)(()=>{K&&le.current.newIndex!==ae&&(le.current.newIndex=ae),d!==le.current.containerId&&(le.current.containerId=d),c!==le.current.items&&(le.current.items=c)},[K,ae,d,c]),(0,Fs.useEffect)(()=>{if(Oe===le.current.activeId)return;if(Oe!=null&&le.current.activeId==null){le.current.activeId=Oe;return}let wn=setTimeout(()=>{le.current.activeId=Oe},50);return()=>clearTimeout(wn)},[Oe]),{active:N,activeIndex:f,attributes:k,data:O,rect:E,index:x,newIndex:ae,items:c,isOver:I,isSorting:K,isDragging:Q,listeners:V,node:A,overIndex:b,over:J,setNodeRef:q,setActivatorNodeRef:D,setDroppableNodeRef:R,setDraggableNodeRef:z,transform:rt??Y,transition:cr()};function cr(){if(rt||Be&&le.current.newIndex===x)return WMn;if(!(ee&&!k9(j)||!l)&&(K||ze))return Rb.Transition.toString({...l,property:R7t})}}function JMn(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 bfe(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 YMn=[$n.Down,$n.Right,$n.Up,$n.Left],vfe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(YMn.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 $n.Down:n.top<f.top&&u.push(d);break;case $n.Up:n.top>f.top&&u.push(d);break;case $n.Left:n.left>f.left&&u.push(d);break;case $n.Right:n.left<f.left&&u.push(d);break}});let l=p7t({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=iqe(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=H9(m).some((P,E)=>s[E]!==P),g=j7t(d,f),y=ZMn(d,f),S=b||!g?{x:0,y:0}:{x:y?n.width-p.width:0,y:y?n.height-p.height:0},x={x:p.left,y:p.top};return S.x&&S.y?x:_L(x,S)}}}};function j7t(t,e){return!bfe(t)||!bfe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function ZMn(t,e){return!bfe(t)||!bfe(e)||!j7t(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}Tn();nr();nr();d4();var wfe=F(X()),aqe=(0,wfe.createContext)(null),J9=()=>(0,wfe.useContext)(aqe);var tK=require("obsidian");var D7t=require("obsidian");ti();var Qo=F(X()),L7t=F(Dc());nr();Tn();yn();yo();var oC=F(X());function N7t(){return oC.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),oC.default.createElement("li",null,oC.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),oC.default.createElement("li",null,oC.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)."))}function XMn({commands:t,command:e,onConfirm:r,onCancel:n}){let i=Rn().activeModels.filter(f=>f.enabled).map(f=>({label:Xce(f),value:kr(f)})),[a,s]=(0,Qo.useState)(e),[u,l]=(0,Qo.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=GU(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 Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"title"},"Name"),Qo.default.createElement(mo,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"content"},"Prompt"),Qo.default.createElement(N7t,null),Qo.default.createElement(yE,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&Qo.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),Qo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Qo.default.createElement(ip,{htmlFor:"modelKey"},"Model (Optional)"),Qo.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},Qo.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:_e("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")},Qo.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Qo.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Qo.default.createElement("div",{className:_e("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")},Qo.default.createElement(Hi,{className:"tw-size-4"})))),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInContextMenu"},"Show in context menu")),Qo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qo.default.createElement(wd,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),Qo.default.createElement(ip,{htmlFor:"showInSlashMenu"},"Show in slash menu")),Qo.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Qo.default.createElement(ge,{variant:"secondary",onClick:n},"Cancel"),Qo.default.createElement(ge,{variant:"default",onClick:d},"Save")))}var Sfe=class extends D7t.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,L7t.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(Qo.default.createElement(XMn,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var va=F(X());Tn();var yh=F(X());Tn();yn();BR();yo();Cn();function iC({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,yh.useState)(!1),s=(0,yh.useRef)(null),u=(0,yh.useRef)(!0);return(0,yh.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await eo(t)}catch(c){fe("Failed to decrypt value:"+ei(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),yh.default.createElement("div",{className:_e("tw-relative",o)},yh.default.createElement(mo,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:_e("tw-w-full !tw-pr-7")}),yh.default.createElement("div",{onClick:()=>!n&&a(!i),className:_e("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?yh.default.createElement(y3,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):yh.default.createElement(QC,{className:_e("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}yn();var xd=F(X());var Qi=F(X(),1);function aC(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var k7t=F(X(),1);function F7t(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function sqe(...t){return e=>{let r=!1,n=t.map(o=>{let i=F7t(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():F7t(t[o],null)}}}}function _E(...t){return k7t.useCallback(sqe(...t),t)}var os=F(X(),1);var $7t=F(X(),1),B7t=F(ds(),1);var Sd=F(X(),1);var Xz=F(ft(),1),Y9=Sd.forwardRef((t,e)=>{let{children:r,...n}=t,o=Sd.Children.toArray(r),i=o.find(eRn);if(i){let a=i.props.children,s=o.map(u=>u===i?Sd.Children.count(a)>1?Sd.Children.only(null):Sd.isValidElement(a)?a.props.children:null:u);return(0,Xz.jsx)(uqe,{...n,ref:e,children:Sd.isValidElement(a)?Sd.cloneElement(a,void 0,s):null})}return(0,Xz.jsx)(uqe,{...n,ref:e,children:r})});Y9.displayName="Slot";var uqe=Sd.forwardRef((t,e)=>{let{children:r,...n}=t;if(Sd.isValidElement(r)){let o=rRn(r);return Sd.cloneElement(r,{...tRn(n,r.props),ref:e?sqe(e,o):o})}return Sd.Children.count(r)>1?Sd.Children.only(null):null});uqe.displayName="SlotClone";var QMn=({children:t})=>(0,Xz.jsx)(Xz.Fragment,{children:t});function eRn(t){return Sd.isValidElement(t)&&t.type===QMn}function tRn(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 rRn(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 q7t=F(ft(),1),nRn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],bh=nRn.reduce((t,e)=>{let r=$7t.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Y9:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,q7t.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function U7t(t,e){t&&B7t.flushSync(()=>t.dispatchEvent(e))}var cqe=F(ft(),1),oRn="DismissableLayer",lqe="dismissableLayer.update",iRn="dismissableLayer.pointerDownOutside",aRn="dismissableLayer.focusOutside",z7t,V7t=os.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dqe=os.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=os.useContext(V7t),[c,d]=os.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=os.useState({}),m=_E(e,E=>d(E)),h=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(b),y=c?h.indexOf(c):-1,S=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=g,O=lRn(E=>{let A=E.target,I=[...l.branches].some(R=>R.contains(A));!x||I||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),P=cRn(E=>{let A=E.target;[...l.branches].some(R=>R.contains(A))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return oM(E=>{y===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),os.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(z7t=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),H7t(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=z7t)}},[c,f,r,l]),os.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),H7t())},[c,l]),os.useEffect(()=>{let E=()=>p({});return document.addEventListener(lqe,E),()=>document.removeEventListener(lqe,E)},[]),(0,cqe.jsx)(bh.div,{...u,ref:m,style:{pointerEvents:S?x?"auto":"none":void 0,...t.style},onFocusCapture:aC(t.onFocusCapture,P.onFocusCapture),onBlurCapture:aC(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:aC(t.onPointerDownCapture,O.onPointerDownCapture)})});dqe.displayName=oRn;var sRn="DismissableLayerBranch",uRn=os.forwardRef((t,e)=>{let r=os.useContext(V7t),n=os.useRef(null),o=_E(e,n);return os.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,cqe.jsx)(bh.div,{...t,ref:o})});uRn.displayName=sRn;function lRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1),o=os.useRef(()=>{});return os.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){W7t(iRn,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 cRn(t,e=globalThis?.document){let r=Ur(t),n=os.useRef(!1);return os.useEffect(()=>{let o=i=>{i.target&&!n.current&&W7t(aRn,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 H7t(){let t=new CustomEvent(lqe);document.dispatchEvent(t)}function W7t(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?U7t(o,i):o.dispatchEvent(i)}var ay=F(X(),1);var Z7t=F(ft(),1),fqe="focusScope.autoFocusOnMount",pqe="focusScope.autoFocusOnUnmount",K7t={bubbles:!1,cancelable:!0},dRn="FocusScope",mqe=ay.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=ay.useState(null),l=Ur(o),c=Ur(i),d=ay.useRef(null),f=_E(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(P){if(p.paused||!s)return;let E=P.target;s.contains(E)?d.current=E:WM(d.current,{select:!0})},S=function(P){if(p.paused||!s)return;let E=P.relatedTarget;E!==null&&(s.contains(E)||WM(d.current,{select:!0}))},x=function(P){if(document.activeElement===document.body)for(let A of P)A.removedNodes.length>0&&WM(s)};var h=y,b=S,g=x;document.addEventListener("focusin",y),document.addEventListener("focusout",S);let O=new MutationObserver(x);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[n,s,p.paused]),ay.useEffect(()=>{if(s){J7t.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(fqe,K7t);s.addEventListener(fqe,l),s.dispatchEvent(g),g.defaultPrevented||(fRn(yRn(X7t(s)),{select:!0}),document.activeElement===h&&WM(s))}return()=>{s.removeEventListener(fqe,l),setTimeout(()=>{let g=new CustomEvent(pqe,K7t);s.addEventListener(pqe,c),s.dispatchEvent(g),g.defaultPrevented||WM(h??document.body,{select:!0}),s.removeEventListener(pqe,c),J7t.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,[S,x]=pRn(y);S&&x?!h.shiftKey&&g===x?(h.preventDefault(),r&&WM(S,{select:!0})):h.shiftKey&&g===S&&(h.preventDefault(),r&&WM(x,{select:!0})):g===y&&h.preventDefault()}},[r,n,p.paused]);return(0,Z7t.jsx)(bh.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});mqe.displayName=dRn;function fRn(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(WM(n,{select:e}),document.activeElement!==r)return}function pRn(t){let e=X7t(t),r=G7t(e,t),n=G7t(e.reverse(),t);return[r,n]}function X7t(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 G7t(t,e){for(let r of t)if(!mRn(r,{upTo:e}))return r}function mRn(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 hRn(t){return t instanceof HTMLInputElement&&"select"in t}function WM(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&hRn(t)&&e&&t.select()}}var J7t=gRn();function gRn(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Y7t(t,e),t.unshift(e)},remove(e){t=Y7t(t,e),t[0]?.resume()}}}function Y7t(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function yRn(t){return t.filter(e=>e.tagName!=="A")}var xfe=F(X(),1),Q7t=F(ds(),1);var eYt=F(ft(),1),bRn="Portal",hqe=xfe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=xfe.useState(!1);Jn(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Q7t.default.createPortal((0,eYt.jsx)(bh.div,{...n,ref:e}),a):null});hqe.displayName=bRn;var Ni=F(ft(),1),gqe="Dialog",[tYt,fwi]=Yi(gqe),[_Rn,Nb]=tYt(gqe),rYt=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=Qi.useRef(null),u=Qi.useRef(null),[l=!1,c]=ud({prop:n,defaultProp:o,onChange:i});return(0,Ni.jsx)(_Rn,{scope:e,triggerRef:s,contentRef:u,contentId:hl(),titleId:hl(),descriptionId:hl(),open:l,onOpenChange:c,onOpenToggle:Qi.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};rYt.displayName=gqe;var nYt="DialogTrigger",oYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(nYt,r),i=_E(e,o.triggerRef);return(0,Ni.jsx)(bh.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_qe(o.open),...n,ref:i,onClick:aC(t.onClick,o.onOpenToggle)})});oYt.displayName=nYt;var yqe="DialogPortal",[vRn,iYt]=tYt(yqe,{forceMount:void 0}),aYt=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=Nb(yqe,e);return(0,Ni.jsx)(vRn,{scope:e,forceMount:r,children:Qi.Children.map(n,a=>(0,Ni.jsx)(fd,{present:r||i.open,children:(0,Ni.jsx)(hqe,{asChild:!0,container:o,children:a})}))})};aYt.displayName=yqe;var Cfe="DialogOverlay",sYt=Qi.forwardRef((t,e)=>{let r=iYt(Cfe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(Cfe,t.__scopeDialog);return i.modal?(0,Ni.jsx)(fd,{present:n||i.open,children:(0,Ni.jsx)(wRn,{...o,ref:e})}):null});sYt.displayName=Cfe;var wRn=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(Cfe,r);return(0,Ni.jsx)(A9,{as:Y9,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Ni.jsx)(bh.div,{"data-state":_qe(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),OL="DialogContent",uYt=Qi.forwardRef((t,e)=>{let r=iYt(OL,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Nb(OL,t.__scopeDialog);return(0,Ni.jsx)(fd,{present:n||i.open,children:i.modal?(0,Ni.jsx)(SRn,{...o,ref:e}):(0,Ni.jsx)(xRn,{...o,ref:e})})});uYt.displayName=OL;var SRn=Qi.forwardRef((t,e)=>{let r=Nb(OL,t.__scopeDialog),n=Qi.useRef(null),o=_E(e,r.contentRef,n);return Qi.useEffect(()=>{let i=n.current;if(i)return bM(i)},[]),(0,Ni.jsx)(lYt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:aC(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:aC(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:aC(t.onFocusOutside,i=>i.preventDefault())})}),xRn=Qi.forwardRef((t,e)=>{let r=Nb(OL,t.__scopeDialog),n=Qi.useRef(!1),o=Qi.useRef(!1);return(0,Ni.jsx)(lYt,{...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()}})}),lYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=Nb(OL,r),u=Qi.useRef(null),l=_E(e,u);return iM(),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(mqe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Ni.jsx)(dqe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":_qe(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Ni.jsxs)(Ni.Fragment,{children:[(0,Ni.jsx)(CRn,{titleId:s.titleId}),(0,Ni.jsx)(PRn,{contentRef:u,descriptionId:s.descriptionId})]})]})}),bqe="DialogTitle",cYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(bqe,r);return(0,Ni.jsx)(bh.h2,{id:o.titleId,...n,ref:e})});cYt.displayName=bqe;var dYt="DialogDescription",fYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(dYt,r);return(0,Ni.jsx)(bh.p,{id:o.descriptionId,...n,ref:e})});fYt.displayName=dYt;var pYt="DialogClose",mYt=Qi.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Nb(pYt,r);return(0,Ni.jsx)(bh.button,{type:"button",...n,ref:e,onClick:aC(t.onClick,()=>o.onOpenChange(!1))})});mYt.displayName=pYt;function _qe(t){return t?"open":"closed"}var hYt="DialogTitleWarning",[pwi,gYt]=M3t(hYt,{contentName:OL,titleName:bqe,docsSlug:"dialog"}),CRn=({titleId:t})=>{let e=gYt(hYt),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 Qi.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},ORn="DialogDescriptionWarning",PRn=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gYt(ORn).contentName}}.`;return Qi.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},yYt=rYt,bYt=oYt,_Yt=aYt,vqe=sYt,wqe=uYt,Sqe=cYt,xqe=fYt,vYt=mYt;yn();Tn();var Ofe=yYt,wYt=bYt,TRn=_Yt;var SYt=xd.forwardRef(({className:t,...e},r)=>xd.createElement(vqe,{ref:r,className:_e("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}));SYt.displayName=vqe.displayName;var Z9=xd.forwardRef(({className:t,children:e,container:r,...n},o)=>xd.createElement(TRn,{container:r},xd.createElement(SYt,null),xd.createElement(wqe,{ref:o,className:_e("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,xd.createElement(vYt,{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"},xd.createElement(Vi,{className:"tw-size-4"}),xd.createElement("span",{className:"tw-sr-only"},"Close")))));Z9.displayName=wqe.displayName;var X9=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});X9.displayName="DialogHeader";var ARn=({className:t,...e})=>xd.createElement("div",{className:_e("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});ARn.displayName="DialogFooter";var Q9=xd.forwardRef(({className:t,...e},r)=>xd.createElement(Sqe,{ref:r,className:_e("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Q9.displayName=Sqe.displayName;var eK=xd.forwardRef(({className:t,...e},r)=>xd.createElement(xqe,{ref:r,className:_e("tw-text-sm tw-text-muted",t),...e}));eK.displayName=xqe.displayName;Cn();function hn(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=Vz(),a="onChange"in t?t.onChange:void 0,s=(0,va.useMemo)(()=>{if(a)return tJ(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return va.default.createElement(mo,{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 va.default.createElement(iC,{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 va.default.createElement(yE,{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 va.default.createElement(cz,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return va.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},va.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:_e("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&&va.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>va.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),va.default.createElement("div",{className:_e("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")},va.default.createElement(Hi,{className:"tw-size-4"})));case"slider":return va.default.createElement(nC,{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 va.default.createElement(Ofe,null,va.default.createElement(wYt,{asChild:!0},t.trigger),va.default.createElement(Z9,{container:i},(t.dialogTitle||t.dialogDescription)&&va.default.createElement(X9,null,t.dialogTitle&&va.default.createElement(Q9,null,t.dialogTitle),t.dialogDescription&&va.default.createElement(eK,null,t.dialogDescription)),t.children));case"custom":return t.children}};return va.default.createElement("div",{className:_e("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)},va.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},va.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&va.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),va.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}nr();function IRn(t){let r=`${QI()}/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[AD]=o.showInContextMenu,s[ID]=o.showInSlashMenu,s[MD]=o.order,s[RD]=o.modelKey,s[jD]=0})}))}async function xYt(){let t=ue().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Gx(),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=GU(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
Original name: ${a.title}
${a.content}`}):e.push(a)}await lm.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 ${QI()}.`;r.length>0&&(await IRn(r),i+=`
We found ${r.length} unsupported commands. They are saved in ${QI()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),dt("inlineEditCommands",[]),new sd(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function Cqe(){let t=Gx(),e=O3t.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];lm.getInstance().updateCommands(r)}async function CYt(){if(ue().suggestedDefaultCommands)return;Gx().length===0&&(new sd(app,()=>{Cqe()},"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(),dt("suggestedDefaultCommands",!0))}var MRn=({command:t,commands:e,onUpdate:r,onRemove:n})=>{let{attributes:o,listeners:i,setNodeRef:a,transform:s,transition:u,isDragging:l}=G9({id:t.title}),c={transform:Rb.Transform.toString(s),transition:u},d=()=>{n(t)};return it.default.createElement(BM,{ref:a,style:c,className:_e("tw-transition-colors",l&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},it.default.createElement(gf,{className:"tw-w-10"},it.default.createElement("div",{...o,...i,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},it.default.createElement(d_,{className:"tw-size-4"}))),it.default.createElement(gf,null,t.title),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInContextMenu,onCheckedChange:f=>{r({...t,showInContextMenu:f===!0},t.title)},className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement(wd,{checked:t.showInSlashMenu,onCheckedChange:f=>r({...t,showInSlashMenu:f===!0},t.title),className:"tw-mx-auto"})),it.default.createElement(gf,{className:"tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new Sfe(app,e,t,async p=>{await r(p,t.title)}).open()}},it.default.createElement(p_,{className:"tw-size-4"})),it.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new sd(app,d,`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()}},it.default.createElement(Rm,{className:"tw-size-4"})))))},OYt=()=>{let t=P3t(),e=(0,it.useMemo)(()=>AW([...t]),[t]),[r,n]=it.default.useState(""),o=Rn(),i=pfe(Zz(VM,{activationConstraint:{distance:8}}),Zz(HM,{coordinateGetter:vfe})),a=GU(r,e),s=!a&&r.trim()!=="",u=async()=>{if(s)try{await lm.getInstance().createCommand(r.trim(),""),n(""),new tK.Notice(`Command "${r.trim()}" created successfully!`)}catch(p){console.error("Failed to create command:",p),new tK.Notice("Failed to create command. Please try again.")}},l=async(p,m)=>{await lm.getInstance().updateCommand(p,m)},c=async p=>{try{await lm.getInstance().deleteCommand(p),new tK.Notice(`Command "${p.title}" deleted successfully!`)}catch(m){throw console.error("Failed to delete command:",m),new tK.Notice("Failed to delete command. Please try again."),m}},d=async p=>{let{active:m,over:h}=p;if(!h||m.id===h.id)return;let b=e.findIndex(x=>x.title===m.id),g=e.findIndex(x=>x.title===h.id);if(b===-1||g===-1)return;let y=[...e],[S]=y.splice(b,1);y.splice(g,0,S);for(let x=0;x<y.length;x++)y[x]={...y[x],order:x*10};await lm.getInstance().updateCommands(y)},f=J9();return it.default.createElement("div",{className:"tw-space-y-4"},it.default.createElement("section",null,it.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},it.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),it.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 ",it.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),it.default.createElement(hn,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:o.customPromptsFolder,onChange:p=>{dt("customPromptsFolder",p),uce()},placeholder:"copilot-custom-prompts"}),it.default.createElement(hn,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:o.enableCustomPromptTemplating,onCheckedChange:p=>{dt("enableCustomPromptTemplating",p)}}),it.default.createElement(hn,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:o.promptSortStrategy,onChange:p=>dt("promptSortStrategy",p),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),it.default.createElement("div",{className:"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"},it.default.createElement(eO,{className:"tw-size-5"})," ",it.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",it.default.createElement("strong",null,o.customPromptsFolder),". Modifying the files will also update the command settings.")),it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement(V9,{sensors:i,collisionDetection:z9,onDragEnd:d},it.default.createElement(j9,null,it.default.createElement(N9,null,it.default.createElement(BM,null,it.default.createElement(ap,{className:"tw-w-10"}),it.default.createElement(ap,null,"Name"),it.default.createElement(ap,{className:"tw-w-24 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{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."))))),it.default.createElement(ap,{className:"tw-w-28 tw-text-center"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",it.default.createElement(vo,null,it.default.createElement(Rt,null,it.default.createElement(jt,{asChild:!0},it.default.createElement(f_,{className:"tw-size-4"})),it.default.createElement(Mt,{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat."))))),it.default.createElement(ap,{className:"tw-w-32 tw-text-center"},"Actions"))),it.default.createElement(K9,{items:e.map(p=>p.title),strategy:W9},it.default.createElement(D9,null,e.length===0?it.default.createElement(BM,null,it.default.createElement(gf,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(p=>it.default.createElement(MRn,{key:p.title,command:p,commands:e,onUpdate:l,onRemove:c})))))),it.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between"},it.default.createElement("div",null,it.default.createElement(ge,{variant:"secondary",onClick:()=>new sd(app,Cqe,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default Commands")),it.default.createElement(mde,null,it.default.createElement(hde,{asChild:!0},it.default.createElement(ge,{variant:"default",className:"tw-gap-2"},it.default.createElement(Mm,{className:"tw-size-4"}),"Add Command")),it.default.createElement(p9,{container:f,className:"tw-w-80",align:"end"},it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement("div",{className:"tw-text-lg tw-font-medium tw-leading-none"},"Create New Command"),it.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Enter a name for your new custom command. A markdown file will be created in your custom prompts folder.")),it.default.createElement("div",{className:"tw-space-y-2"},it.default.createElement(mo,{placeholder:"Command name",value:r,onChange:p=>n(p.target.value),onKeyDown:p=>{p.key==="Enter"&&s&&u()}}),a&&it.default.createElement("p",{className:"tw-text-sm tw-text-error"},a)),it.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},it.default.createElement(O$e,{asChild:!0},it.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{n("")}},"Cancel")),it.default.createElement(O$e,{asChild:!0},it.default.createElement(ge,{size:"sm",onClick:u,disabled:!s},"Create"))))))))))};yn();var Bn=F(X());nr();var PL=F(X()),PYt=()=>{let t=Rn();return PL.default.createElement("div",{className:"tw-space-y-4"},PL.default.createElement("section",null,PL.default.createElement(hn,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>dt("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),PL.default.createElement("div",{className:"tw-space-y-4"},PL.default.createElement(hn,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{dt("enableEncryption",e)}}),PL.default.createElement(hn,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{dt("debug",e)}}))))};Fd();var Qz=class extends sd{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")}};ti();$r();nO();Ix();nr();var _l=F(X()),EYt=require("obsidian"),TYt=F(Dc());ti();nO();nr();yn();function RRn({onConfirm:t,onCancel:e}){let r=ue();return _l.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},_l.default.createElement("div",null,_l.default.createElement("p",null,"Thanks for purchasing ",_l.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!"),_l.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),_l.default.createElement("ul",{className:"tw-pl-4"},_l.default.createElement("li",null,"Default mode: ",_l.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),_l.default.createElement("li",null,"Chat model: ",_l.default.createElement("b",{className:"tw-text-accent"},zRe)),_l.default.createElement("li",null,_l.default.createElement("div",null,"Embedding model:"," ",_l.default.createElement("b",{className:"tw-text-accent"},HRe)),r.embeddingModelKey!==VRe&&_l.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},_l.default.createElement(Uf,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),_l.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},_l.default.createElement(ge,{variant:"ghost",onClick:e},"Apply Later"),_l.default.createElement(ge,{variant:"default",onClick:t},"Apply Now")))}var Pfe=class extends EYt.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,TYt.createRoot)(e);let r=()=>{p1t(),this.close()},n=()=>{this.close()};this.root.render(_l.default.createElement(RRn,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};ti();$r();nO();nr();yn();var ks=F(X());function AYt(){let t=Rn(),[e,r]=(0,ks.useState)(null),[n,o]=(0,ks.useState)(!1),i=Sq(),[a,s]=(0,ks.useState)(t.plusLicenseKey);return(0,ks.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),ks.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},ks.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},ks.default.createElement("span",null,"Copilot Plus (beta)"),i&&ks.default.createElement(cm,{variant:"outline",className:"tw-text-success"},"Active")),ks.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},ks.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."),ks.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!")),ks.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ks.default.createElement(iC,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),ks.default.createElement(ge,{disabled:n,onClick:async()=>{dt("plusLicenseKey",a),o(!0);let u=await iie();o(!1),u?(r(null),new Pfe(app).open()):r("Invalid license key")},className:"tw-min-w-20"},n?ks.default.createElement(Yl,{className:"tw-size-4 tw-animate-spin"}):"Apply"),ks.default.createElement(ge,{variant:"secondary",onClick:()=>p1(LC.SETTINGS)},"Join Now ",ks.default.createElement(s1,{className:"tw-size-4"}))),ks.default.createElement("div",{className:"tw-text-error"},e))}Cn();yn();var e2=require("obsidian"),Ge=F(X());ti();$r();BR();yo();nr();$r();var jRn={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"}))||[]},NRn=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})):[],DRn=t=>jRn[t]||NRn(t),IYt=(t,e)=>{let r=DRn(t);try{return r(e)}catch(n){return console.error(`Error parsing ${t} model data:`,n),[]}};Cn();yn();var Db=require("obsidian"),Ht=F(X()),MYt=F(Dc());function LRn({onClose:t}){let e=Rn(),[r,n]=(0,Ht.useState)(new Set),[o,i]=(0,Ht.useState)(new Set),[a,s]=(0,Ht.useState)(null),[u,l]=(0,Ht.useState)({}),[c,d]=(0,Ht.useState)(null),[f,p]=(0,Ht.useState)(null),[m,h]=(0,Ht.useState)(null),[b,g]=(0,Ht.useState)(!1),y=(0,Ht.useRef)(o);(0,Ht.useEffect)(()=>{y.current=o},[o]),(0,Ht.useEffect)(()=>(i(new Set),s(null),h(null),()=>{y.current.forEach(I=>{let R=Qb[I];dt(R,"")})}),[]);let S=I=>{let R=Qb[I];return e[R]??""},x=ege().map(I=>{let R=I,N=S(R);return{provider:R,apiKey:N,isVerified:!!N&&!o.has(R)}}),O=(I,R)=>{S(I)!==R&&(dt(Qb[I],R),i(j=>new Set(j).add(I)),l(j=>({...j,[I]:void 0})),p(j=>j===I?null:j))},P=async(I,R)=>{n(N=>new Set(N).add(I));try{ie(`Verifying ${I} API key`);let N=Xb(I).testModel;if(!N){new Db.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 ac.instance.getCurrentChainManager().chatModelManager.ping(j),new Db.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 Db.Notice("API key verification failed: "+ei(N),1e4)}finally{n(N=>{let j=new Set(N);return j.delete(I),j})}},E=async(I,R)=>{d(I),p(null);try{R=await eo(R);let N=Xb(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 J=new AbortController,D=setTimeout(()=>J.abort(),3e3);try{let B=await(Q?Us:fetch)(N,{headers:j,signal:J.signal,method:"GET"});if(!B.ok){let q=ei(await B.json());throw fe(q),new Error(`Failed to fetch models: ${B.statusText}
detail: `+q)}return B}finally{clearTimeout(D)}},k;try{k=await $(!1)}catch(Q){console.log("First fetch attempt failed, trying with safeFetch...");try{k=await $(!0)}catch(J){let D=`
without CORS Error: `+ei(Q)+`
with CORS Error: `+ei(J);throw new Error(D)}}let z=await k.json(),V=IYt(I,z);l(Q=>({...Q,[I]:V})),d(null)}catch(N){console.error(`Error fetching models for ${I}:`,N),p(I),d(null),new Db.Notice(`Failed to load models for ${kf(I)}: ${ei(N)}`,5e3)}},A=async()=>{if(!m){new Db.Notice("Please select a model first");return}g(!0);try{let I=S(m.provider),R={name:m.name,provider:m.provider,apiKey:I,enabled:!0};if(await ac.instance.getCurrentChainManager().chatModelManager.ping(R),e.activeModels.find(j=>j.name===m.name&&j.provider===m.provider))new Db.Notice(`Model ${m.name} verified successfully! It already exists in your models list.`);else{let j=[...e.activeModels,R];dt("activeModels",j),new Db.Notice(`Model ${m.name} verified successfully and added to your models list!`)}}catch(I){console.error("Model verification failed:",I),new Db.Notice("Model verification failed: "+ei(I),1e4)}finally{g(!1)}};return Ht.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},Ht.default.createElement("div",{className:"tw-mb-4"},Ht.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Ht.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Ht.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Ht.default.createElement("div",{className:"tw-space-y-4"},x.map(I=>Ht.default.createElement(Ht.default.Fragment,{key:I.provider},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Ht.default.createElement("div",{className:"tw-truncate"},kf(I.provider))),Ht.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(iC,{className:"tw-max-w-full",value:I.apiKey,onChange:R=>O(I.provider,R),disabled:r.has(I.provider)})),Ht.default.createElement("div",{className:"tw-w-[72px]"},I.isVerified?Ht.default.createElement("span",{className:"tw-flex tw-h-9 tw-items-center tw-justify-center tw-text-sm tw-text-success"},"Verified"):Ht.default.createElement(ge,{onClick:()=>P(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)?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Verify")),Ht.default.createElement("div",{className:""},Ht.default.createElement(ge,{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&&E(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?Ht.default.createElement(Ey,{className:"tw-ml-1 tw-size-4"}):Ht.default.createElement(Hi,{className:"tw-ml-1 tw-size-4"})))),Ht.default.createElement("div",null,Xb(I.provider).keyManagementURL&&Ht.default.createElement("a",{href:Xb(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 ",kf(I.provider)," Key"))),Ht.default.createElement(cE,{open:a===I.provider,className:"tw-mt-2"},Ht.default.createElement(dE,{className:"tw-rounded-md tw-p-3"},Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ht.default.createElement(Yn,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},Ht.default.createElement("div",null,Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement("div",{className:"tw-flex-1"},Ht.default.createElement(zde,{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&&E(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})),Ht.default.createElement("div",{className:"tw-w-[72px]"},Ht.default.createElement(ge,{onClick:A,disabled:!m||m.provider!==I.provider||b,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},b?Ht.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Ht.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},c===I.provider&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),f===I.provider&&Ht.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&&Ht.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&&Ht.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),Ht.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Ht.default.createElement(ge,{onClick:t},"Close")))}var Efe=class extends Db.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,MYt.createRoot)(e),this.root.render(Ht.default.createElement(LRn,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};Tn();var kRn={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus (beta)",project:"Projects (alpha)"},RYt=()=>{let t=Rn(),[e,r]=(0,Ge.useState)(!1),[n,o]=(0,Ge.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=async l=>{l!==t.embeddingModelKey&&new Qz(app,async()=>{dt("embeddingModelKey",l),await ma.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 e2.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 e2.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Vl(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]);dt("defaultConversationNoteName",l),o(l),new e2.Notice(`Format applied successfully! Example: ${b}`,4e3)}catch(l){new e2.Notice(`Error applying format: ${l.message}`,4e3)}finally{r(!1)}},s=!!t.activeModels.find(l=>l.enabled&&kr(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:QW(l),value:kr(l)}));return Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(AYt,null),Ge.default.createElement("section",null,Ge.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement("div",{className:"tw-space-y-4"},Ge.default.createElement(hn,{type:"custom",title:"API Keys",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),Ge.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.")))))},Ge.default.createElement(ge,{onClick:()=>{new Efe(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",Ge.default.createElement(P3,{className:"tw-size-4"})))),Ge.default.createElement(hn,{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&&kr(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=mF(c,t);if(!d&&f){new e2.Notice(f);return}dt("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Embedding Model",description:Ge.default.createElement("div",{className:"tw-space-y-2"},Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Core Feature: Powers Semantic Search & QA"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.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:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,"Require rebuilding your vault's vector index"),Ge.default.createElement("li",null,"Affect semantic search quality"),Ge.default.createElement("li",null,"Impact QA feature performance"))))))),value:t.embeddingModelKey,onChange:i,options:t.activeEmbeddingModels.map(l=>({label:QW(l),value:kr(l)})),placeholder:"Model"}),Ge.default.createElement(hn,{type:"select",title:"Default Mode",description:Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ge.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",Ge.default.createElement("i",null,"Free to use with your own API key.")),Ge.default.createElement("li",null,Ge.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"," ",Ge.default.createElement("a",{href:WRe(LC.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=>dt("defaultChainType",l),options:Object.entries(kRn).map(([l,c])=>({label:c,value:l}))}),Ge.default.createElement(hn,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>dt("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),Ge.default.createElement(hn,{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=>dt("defaultSaveFolder",l),placeholder:"copilot-conversations"}),Ge.default.createElement(hn,{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=>dt("defaultConversationTag",l),placeholder:"ai-conversations"}),Ge.default.createElement(hn,{type:"custom",title:"Conversation Filename Template",description:Ge.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},Ge.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),Ge.default.createElement(vo,{delayDuration:0},Ge.default.createElement(Rt,null,Ge.default.createElement(jt,{asChild:!0},Ge.default.createElement(di,{className:"tw-size-4"})),Ge.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),Ge.default.createElement("div",null,Ge.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),Ge.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),Ge.default.createElement("li",null,Ge.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),Ge.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]"))))))},Ge.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},Ge.default.createElement(mo,{type:"text",className:_e("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}),Ge.default.createElement(ge,{onClick:()=>a(),disabled:e,variant:"secondary"},e?Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),Ge.default.createElement(hn,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>dt("autosaveChat",l)}),Ge.default.createElement(hn,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>dt("showSuggestedPrompts",l)}),Ge.default.createElement(hn,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>dt("showRelevantNotes",l)}))))};ti();$r();Tn();nr();yn();var EL=require("obsidian"),Zn=F(X()),jYt=()=>{let t=Rn(),e=t.autocompleteAcceptKey||Nh.KEYBIND,[r,n]=(0,Zn.useState)(!1),o=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],i=u=>{dt("autocompleteAcceptKey",u),new EL.Notice(`Autocomplete accept key set to: ${u}`)},a=()=>{dt("autocompleteAcceptKey",Nh.KEYBIND),new EL.Notice(`Autocomplete accept key reset to: ${Nh.KEYBIND}`)},s=async()=>{if(!r){n(!0),new EL.Notice("Rebuilding word index...");try{let l=await TD.getInstance(app.vault).rescan(c=>{c.processedFiles===c.totalFiles&&new EL.Notice(`Word index complete! Found ${c.foundWords} words from ${c.processedFiles} files.`)});new EL.Notice(`Word index rebuilt successfully! ${l.wordCount} unique words indexed.`)}catch(u){console.error("Failed to refresh word index:",u),new EL.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Zn.default.createElement(cm,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Zn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Zn.default.createElement(hn,{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=>{dt("includeActiveNoteAsContext",u)}}),Zn.default.createElement(hn,{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=>{dt("passMarkdownImages",u)}}),Zn.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete"),Zn.default.createElement(hn,{type:"switch",title:"Sentence Autocomplete",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:u=>dt("enableAutocomplete",u)}),Zn.default.createElement(hn,{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=>{dt("enableWordCompletion",u)}}),Zn.default.createElement(hn,{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."},Zn.default.createElement(ge,{onClick:s,disabled:r,className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(m_,{className:_e("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),Zn.default.createElement(hn,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Zn.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),Zn.default.createElement(vo,{delayDuration:0},Zn.default.createElement(Rt,null,Zn.default.createElement(jt,{asChild:!0},Zn.default.createElement(di,{className:"tw-size-4"})),Zn.default.createElement(Mt,{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Zn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".')))))},Zn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Zn.default.createElement(zz,{value:e,onValueChange:i},Zn.default.createElement(dL,{className:"tw-w-[180px]"},Zn.default.createElement(Hz,{placeholder:"Select key"})),Zn.default.createElement(fL,null,o.map(u=>Zn.default.createElement(pL,{key:u.value,value:u.value},u.label)))),e&&e!==Nh.KEYBIND&&Zn.default.createElement(ge,{variant:"ghost",onClick:a,className:"tw-h-8 tw-text-xs"},"Reset to Default"))),Zn.default.createElement(hn,{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=>{dt("allowAdditionalContext",u)}}))))};$r();fN();yo();nr();var De=F(X());nr();$r();Cn();var rK=require("obsidian");ti();yn();var Oqe=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=Vz(),a=ue(),s=o?"openai":"openai",[u,l]=(0,De.useState)(null),[c,d]=(0,De.useState)(!1),[f,p]=(0,De.useState)(!1),[m,h]=(0,De.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1}),b=(D,B)=>{h(q=>({...q,[D]:B}))},g=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1})},y=()=>{let D=!0,B={...m};return B.name=!O.name,O.name||(D=!1),O.provider==="azure openai"&&(B.instanceName=!O.azureOpenAIApiInstanceName,B.apiVersion=!O.azureOpenAIApiVersion,o?(B.embeddingDeploymentName=!O.azureOpenAIApiEmbeddingDeploymentName,O.azureOpenAIApiEmbeddingDeploymentName||(D=!1)):(B.deploymentName=!O.azureOpenAIApiDeploymentName,O.azureOpenAIApiDeploymentName||(D=!1)),(!O.azureOpenAIApiInstanceName||!O.azureOpenAIApiVersion)&&(D=!1)),h(B),D},S=D=>a[Qb[D]]||"",x=(D=s)=>{let B={name:"",provider:D,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:S(D),isEmbeddingModel:o,capabilities:[]};return o?B:{...B,stream:!0}},[O,P]=(0,De.useState)(x()),E=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,De.useState)(Xb(s)),R=()=>!!(O.name&&O.provider),N=()=>f||!R(),j=()=>{if(!y()){new rK.Notice("Please fill in all required fields");return}let D=E(O);r(D),e(!1),P(x()),g()},$=D=>{I(Xb(D)),P({...O,provider:D,apiKey:S(D),...D==="openai"?{openAIOrgId:a.openAIOrgId}:{},...D==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{}})},k=D=>{D||(P(x()),g(),d(!1)),e(D)},z=async()=>{if(!y()){new rK.Notice("Please fill in all required fields");return}p(!0);try{let D=E(O);await n(D),new rK.Notice("Model verification successful!")}catch(D){console.error(D);let B=ei(D);new rK.Notice("Model verification failed: "+B)}finally{p(!1)}},V=()=>{let B=(()=>{switch(O.provider){case"openai":return De.default.createElement(Yn,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},De.default.createElement(mo,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:O.openAIOrgId||"",onChange:q=>P({...O,openAIOrgId:q.target.value})}));case"azure openai":return De.default.createElement(De.default.Fragment,null,De.default.createElement(Yn,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:O.azureOpenAIApiInstanceName||"",onChange:q=>{P({...O,azureOpenAIApiInstanceName:q.target.value}),b("instanceName",!1)}})),o?De.default.createElement(Yn,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:O.azureOpenAIApiEmbeddingDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiEmbeddingDeploymentName:q.target.value}),b("embeddingDeploymentName",!1)}})):De.default.createElement(Yn,{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."},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:O.azureOpenAIApiDeploymentName||"",onChange:q=>{P({...O,azureOpenAIApiDeploymentName:q.target.value}),b("deploymentName",!1)}})),De.default.createElement(Yn,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},De.default.createElement(mo,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:O.azureOpenAIApiVersion||"",onChange:q=>{P({...O,azureOpenAIApiVersion:q.target.value}),b("apiVersion",!1)}})));default:return null}})();return B?De.default.createElement(cE,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},De.default.createElement(ip,null,"Additional ",kf(O.provider)," Settings"),De.default.createElement(tL,{asChild:!0},De.default.createElement(ge,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},De.default.createElement(Hi,{className:"tw-size-4"}),De.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),De.default.createElement(dE,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},B)):null},Q=()=>{if(O.provider!=="azure openai")return A.host;let D=O.azureOpenAIApiInstanceName||"[instance]",B=o?O.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":O.azureOpenAIApiDeploymentName||"[deployment]",q=O.azureOpenAIApiVersion||"[api-version]";return`https://${D}.openai.azure.com/openai/deployments/${B}/${o?"embeddings":"chat/completions"}?api-version=${q}`},J=Object.entries(WE).map(([D,B])=>({id:D,label:D.charAt(0).toUpperCase()+D.slice(1),description:B}));return De.default.createElement(Ofe,{open:t,onOpenChange:k},De.default.createElement(Z9,{className:"sm:tw-max-w-[425px]",container:i,ref:D=>l(D)},De.default.createElement(X9,null,De.default.createElement(Q9,null,"Add Custom ",o?"Embedding":"Chat"," Model"),De.default.createElement(eK,null,"Add a new model to your collection.")),De.default.createElement("div",{className:"tw-space-y-3"},De.default.createElement(Yn,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},De.default.createElement(mo,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:O.name,onChange:D=>{P({...O,name:D.target.value}),b("name",!1)}})),De.default.createElement(Yn,{label:De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",{className:"tw-leading-none"},"Display Name"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},De.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),De.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),De.default.createElement("div",{className:"tw-text-[12px]"},"Example:",De.default.createElement("li",null,"Direct-Paid:Ds-r1"),De.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),De.default.createElement("li",null,"Perplexity-Paid:lg")))))))},De.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:O.displayName||"",onChange:D=>{P({...O,displayName:D.target.value})}})),De.default.createElement(Yn,{label:"Provider"},De.default.createElement(zz,{value:O.provider,onValueChange:$},De.default.createElement(dL,null,De.default.createElement(Hz,{placeholder:"Select provider"})),De.default.createElement(fL,{container:u},Object.values(o?u4(HE,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):u4(DC,["COPILOT_PLUS"])).map(D=>De.default.createElement(pL,{key:D,value:D},kf(D)))))),De.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},De.default.createElement(mo,{type:"text",placeholder:Q()||"https://api.example.com/v1",value:O.baseUrl||"",onChange:D=>P({...O,baseUrl:D.target.value})})),De.default.createElement(Yn,{label:"API Key"},De.default.createElement(iC,{placeholder:`Enter ${A.label} API Key`,value:O.apiKey||"",onChange:D=>P({...O,apiKey:D})}),A.keyManagementURL&&De.default.createElement("p",{className:"tw-text-xs tw-text-muted"},De.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),De.default.createElement(Yn,{label:De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},J.map(({id:D,label:B,description:q})=>De.default.createElement("div",{key:D,className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(wd,{id:D,checked:O.capabilities?.includes(D),onCheckedChange:K=>{let H=O.capabilities||[];P({...O,capabilities:K?[...H,D]:H.filter(ee=>ee!==D)})}}),De.default.createElement(ip,{htmlFor:D,className:"tw-text-sm"},De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement("span",null,B)),De.default.createElement(Mt,{side:"bottom"},q)))))))),V()),De.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-4"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},De.default.createElement(wd,{id:"enable-cors",checked:O.enableCors||!1,onCheckedChange:D=>P({...O,enableCors:D})}),De.default.createElement(ip,{htmlFor:"enable-cors",className:"tw-text-sm"},De.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},De.default.createElement("span",null,"Enable CORS"),De.default.createElement(vo,{delayDuration:0},De.default.createElement(Rt,null,De.default.createElement(jt,{asChild:!0},De.default.createElement(di,{className:"tw-size-4"})),De.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},De.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"))))))),De.default.createElement("div",{className:"tw-flex tw-gap-2"},De.default.createElement(ge,{variant:"secondary",onClick:j,disabled:N()},"Add Model"),De.default.createElement(ge,{variant:"secondary",onClick:z,disabled:N()},f?De.default.createElement(De.default.Fragment,null,De.default.createElement(Yl,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Verify"):"Verify")))))};$r();nr();Cn();yn();var NYt=require("obsidian"),Ie=F(X()),DYt=F(Dc()),$Rn=({model:t,onUpdate:e,onCancel:r,isEmbeddingModel:n})=>{let[o,i]=(0,Ie.useState)(t),[a,s]=(0,Ie.useState)(t),[u,l]=(0,Ie.useState)({}),c=ue(),d=y=>c[Qb[y]]||"";(0,Ie.useEffect)(()=>{i(t),s(t),t.provider&&l(Xb(t.provider))},[t]);let f=(0,Ie.useMemo)(()=>tJ((y,S)=>{e(n,y,S)},500),[n,e]),p=(0,Ie.useCallback)((y,S)=>{i(x=>{let O={...x,[y]:S};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]",S=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",x=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${y}.openai.azure.com/openai/deployments/${S}/${O}?api-version=${x}`},h=Object.entries(WE).map(([y,S])=>({id:y,label:y.charAt(0).toUpperCase()+y.slice(1),description:S})),b=o.apiKey||d(o.provider),g=!n&&o.provider!=="copilot-plus-jina";return Ie.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Ie.default.createElement("div",{className:"tw-mb-4"},Ie.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"Model Settings - ",o.name),Ie.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Customize model parameters")),Ie.default.createElement("div",{className:"tw-space-y-3"},Ie.default.createElement(Yn,{label:"Model Name",required:!0},Ie.default.createElement(mo,{type:"text",disabled:o.core,value:o.name,onChange:y=>p("name",y.target.value),placeholder:"Enter model name"})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ie.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ie.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ie.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ie.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ie.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ie.default.createElement("li",null,"Perplexity-Paid:lg")))))))},Ie.default.createElement(mo,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:y=>p("displayName",y.target.value)})),Ie.default.createElement(Yn,{label:"Provider"},Ie.default.createElement(mo,{type:"text",value:kf(o.provider),disabled:!0})),Ie.default.createElement(Yn,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ie.default.createElement(mo,{type:"text",placeholder:m(),value:o.baseUrl||"",onChange:y=>p("baseUrl",y.target.value)})),Ie.default.createElement(Yn,{label:"API Key"},Ie.default.createElement(iC,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:b,onChange:y=>p("apiKey",y)}),u.keyManagementURL&&Ie.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ie.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),g&&Ie.default.createElement(Ie.default.Fragment,null,Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ie.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4"})),Ie.default.createElement(Mt,{align:"start",className:"tw-max-w-96",side:"bottom"},Ie.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality")))))},Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},h.map(({id:y,label:S,description:x})=>Ie.default.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2"},Ie.default.createElement(wd,{id:y,checked:o.capabilities?.includes(y),onCheckedChange:O=>{let P=o.capabilities||[],E=O?[...P,y]:P.filter(A=>A!==y);p("capabilities",E)}}),Ie.default.createElement(ip,{htmlFor:y,className:"tw-text-sm"},Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement("span",null,S)),Ie.default.createElement(Mt,{side:"bottom"},x)))))))),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Token limit",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.default.createElement("p",null,"The maximum number of ",Ie.default.createElement("em",null,"output tokens")," to generate. Default is"," ",jh.MAX_TOKENS,"."),Ie.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))))))},Ie.default.createElement(nC,{value:o.maxTokens??c.maxTokens??jh.MAX_TOKENS,onChange:y=>p("maxTokens",y),min:0,max:65e3,step:100})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Temperature",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-max-w-[300px]"},"Default is ",jh.TEMPERATURE,". Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.")))))},Ie.default.createElement(nC,{value:o.temperature??c.temperature??jh.TEMPERATURE,onChange:y=>p("temperature",y),max:2,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Top-P",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.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")))))},Ie.default.createElement(nC,{value:o.topP??.9,onChange:y=>p("topP",y),max:1,min:0,step:.05})),Ie.default.createElement(Yn,{label:Ie.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},"Frequency Penalty",Ie.default.createElement(vo,{delayDuration:0},Ie.default.createElement(Rt,null,Ie.default.createElement(jt,{asChild:!0},Ie.default.createElement(di,{className:"tw-size-4 tw-text-muted"})),Ie.default.createElement(Mt,{side:"bottom"},Ie.default.createElement("div",{className:"tw-w-[300px]"},Ie.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."),Ie.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))))))},Ie.default.createElement(nC,{value:o.frequencyPenalty??0,onChange:y=>p("frequencyPenalty",y),max:2,min:0,step:.05})))))},Tfe=class extends NYt.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,DYt.createRoot)(r);let n=(i,a,s)=>{this.onUpdate(i,a,s)},o=()=>{this.close()};this.root.render(Ie.default.createElement($Rn,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:n,onCancel:o}))}onClose(){this.root.unmount()}};ti();$r();Tn();nr();Cn();yn();var Me=F(X());var BRn={reasoning:{icon:eO,color:"tw-text-model-capabilities-blue",tooltip:WE.reasoning},vision:{icon:QC,color:"tw-text-model-capabilities-green",tooltip:WE.vision},websearch:{icon:u1,color:"tw-text-model-capabilities-blue",tooltip:WE.websearch}},qRn=["reasoning","vision","websearch"],URn=t=>Me.default.createElement(vo,{delayDuration:0},Me.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},qRn.map(e=>{let r=BRn[e];if(!r)return Me.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Me.default.createElement(Rt,{key:e},Me.default.createElement(jt,{asChild:!0},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement(n,{className:_e("tw-size-4",r.color)}))),Me.default.createElement(Mt,{side:"bottom"},r.tooltip)):Me.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Me.default.createElement("div",{className:"tw-size-4"}))}))),zRn=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i})=>{let[a,s]=Me.default.useState(!1),u=J9(),{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:p,isDragging:m}=G9({id:i,disabled:t.core}),h={transform:Rb.Transform.toString(f),transition:p};return Me.default.createElement(h9,{ref:d,style:h,className:_e("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")},Me.default.createElement(g9,{className:"tw-p-3"},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},!t.core&&Me.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...l,...c},Me.default.createElement(d_,{className:"tw-size-4"})),Me.default.createElement("div",{className:"tw-flex-1 tw-cursor-pointer",onClick:()=>s(!a)},Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},a?Me.default.createElement(Hi,{className:"tw-size-3 tw-stroke-[7]"}):Me.default.createElement(ZC,{className:"tw-size-3 tw-stroke-[7]"})),Me.default.createElement("div",null,Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Me.default.createElement("span",{className:"tw-font-medium"},t.displayName||t.name),t.capabilities&&t.capabilities.length>0&&Me.default.createElement(Eke,{capabilities:t.capabilities,iconSize:14})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},kf(t.provider,t)))))),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(ok,{className:"tw-size-4"})),Me.default.createElement(JD,null,Me.default.createElement(YD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(XC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:u},e&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),e(t)}},Me.default.createElement(nk,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),r(t)}},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:b=>{b.stopPropagation(),n(kr(t))},className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete")))))),Me.default.createElement("div",{className:_e("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")},Me.default.createElement(y9,{className:"tw-p-3 tw-pt-0"},Me.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Me.default.createElement(wd,{checked:t.enabled,onCheckedChange:b=>o({...t,enabled:b})})),Me.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement("span",{className:"tw-text-sm"},"CORS"),Me.default.createElement(wd,{checked:t.enableCors,onCheckedChange:b=>o({...t,enableCors:b})}))))))},HRn=({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}=G9({id:kr(t),disabled:t.core}),f=J9(),p={transform:Rb.Transform.toString(l),transition:c},m=e||!t.core||r&&!t.core;return Me.default.createElement(BM,{ref:u,style:p,className:_e("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")},Me.default.createElement(gf,{className:"tw-w-6 tw-px-2"},!t.core&&Me.default.createElement(ge,{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},Me.default.createElement(d_,{className:"tw-size-4 tw-transition-colors"}))),Me.default.createElement(gf,{className:"tw-pl-0"},t.displayName||t.name),Me.default.createElement(gf,null,kf(t.provider,t)),Me.default.createElement(gf,null,URn(t)),!i&&Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement(wd,{id:`${kr(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Me.default.createElement(gf,{className:"tw-text-center"},Me.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Me.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Me.default.createElement(ok,{className:"tw-size-4"})),m&&Me.default.createElement(JD,null,Me.default.createElement(YD,{asChild:!0},Me.default.createElement(ge,{variant:"ghost",size:"icon"},Me.default.createElement(XC,{className:"tw-size-4"}))),Me.default.createElement(xb,{align:"end",container:f},e&&Me.default.createElement(Si,{onClick:()=>e(t)},Me.default.createElement(nk,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Me.default.createElement(Si,{onClick:()=>r(t)},Me.default.createElement(Ty,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Me.default.createElement(Si,{onClick:()=>n(kr(t)),className:"tw-text-error"},Me.default.createElement(Rm,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},Pqe=({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=pfe(Zz(VM),Zz(HM,{coordinateGetter:vfe})),d=t.findIndex(h=>!h.core),f=h=>b=>{let{transform:g,active:y,activeNodeRect:S,over:x}=b;if(!y||!S)return g;let O=t.findIndex(R=>kr(R)===y.id),P=t.filter(R=>!R.core).length,E=S.height,A=(d-O)*E,I=(d+P-1-O)*E;if(h&&x){let R=t.findIndex(j=>kr(j)===x.id);if(t[R].core||R<d)return{...g,x:0,y:O*E}}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(P=>kr(P)===b.id),S=t.findIndex(P=>kr(P)===g.id),x=t[S];if(S<d||x.core)return;let O=_fe(t,y,S);a?.(O)}},m=()=>Me.default.createElement("div",{className:"tw-relative md:tw-hidden"},Me.default.createElement(V9,{sensors:c,collisionDetection:z9,onDragEnd:p,modifiers:[f(!0)]},Me.default.createElement(K9,{items:t.map(h=>kr(h)),strategy:W9},Me.default.createElement("div",{className:"tw-relative tw-space-y-2"},t.map(h=>Me.default.createElement(zRn,{key:kr(h),id:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Me.default.createElement("div",{className:"tw-mb-4"},Me.default.createElement("div",{className:"tw-hidden md:tw-block"},Me.default.createElement(V9,{sensors:c,collisionDetection:z9,onDragEnd:p,modifiers:[f(!1)]},Me.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Me.default.createElement(j9,null,Me.default.createElement(N9,null,Me.default.createElement(BM,null,Me.default.createElement(ap,{className:"tw-w-6 tw-px-2"}),Me.default.createElement(ap,{className:"tw-pl-0"},"Model"),Me.default.createElement(ap,null,"Provider"),Me.default.createElement(ap,{className:"tw-text-center"},"Capabilities"),!l&&Me.default.createElement(ap,{className:"tw-text-center"},"Enable"),Me.default.createElement(ap,{className:"tw-text-center"},"CORS"),Me.default.createElement(ap,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Me.default.createElement(D9,{className:"tw-relative"},Me.default.createElement(K9,{items:t.map(h=>kr(h)),strategy:W9},t.map(h=>Me.default.createElement(HRn,{key:kr(h),model:h,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),m(),Me.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end tw-gap-2"},s&&Me.default.createElement(ge,{onClick:s,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(m_,{className:"tw-size-4"}),"Refresh Built-in Models"),Me.default.createElement(ge,{onClick:o,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Me.default.createElement(Mm,{className:"tw-size-4"}),"Add Custom Model")))};Cn();var Afe=require("obsidian"),up=F(X()),LYt=()=>{let t=Rn(),[e,r]=(0,up.useState)(!1),[n,o]=(0,up.useState)(!1),i=(h,b=!1)=>{let g={...u4(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},y=b?"activeEmbeddingModels":"activeModels";dt(y,[...t[y],g])},a=(h,b=!1)=>{dt(b?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[b,g]=h.split("|"),y=t.activeModels.filter(x=>!(x.name===b&&x.provider===g)),S=t.defaultModelKey;if(h===t.defaultModelKey){let x=y.find(O=>O.enabled);S=x?`${x.name}|${x.provider}`:""}zE({activeModels:y,defaultModelKey:S})},u=(h,b,g)=>{let y=h?"activeEmbeddingModels":"activeModels",S=t[y].findIndex(x=>x.name===b.name&&x.provider===b.provider);if(S!==-1){let x=[...t[y]];x[S]=g,dt(y,x)}else new Afe.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);dt("activeModels",b)},c=h=>{let[b,g]=h.split("|"),y=t.activeEmbeddingModels.filter(S=>!(S.name===b&&S.provider===g));dt("activeEmbeddingModels",y)},d=h=>{let b=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);dt("activeEmbeddingModels",b)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),b=[...Zb,...h];dt("activeModels",b),new Afe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),b=[...jR,...h];dt("activeEmbeddingModels",b),new Afe.Notice("Embedding models refreshed successfully")},m=(h,b=!1)=>{new Tfe(app,h,b,u).open()};return up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Chat Models"),up.default.createElement(Pqe,{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"}),up.default.createElement(Oqe,{open:e,onOpenChange:r,onAdd:h=>{let b=[...t.activeModels,h];dt("activeModels",b)},ping:h=>ac.instance.getCurrentChainManager().chatModelManager.ping(h)}),up.default.createElement("div",{className:"tw-space-y-4"},up.default.createElement(hn,{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=>dt("contextTurns",h),min:1,max:50,step:1}))),up.default.createElement("section",null,up.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Embedding Models"),up.default.createElement(Pqe,{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"}),up.default.createElement(Oqe,{open:n,onOpenChange:o,onAdd:h=>{let b=[...t.activeEmbeddingModels,h];dt("activeEmbeddingModels",b)},isEmbeddingModel:!0,ping:h=>Xs.getInstance().ping(h)})))};var qYt=require("obsidian");ti();var Pn=F(X()),UYt=F(Dc());_g();yn();var FYt=require("obsidian"),sy=F(X()),kYt=F(Dc());ti();function VRn({onConfirm:t,onCancel:e}){let[r,n]=(0,sy.useState)(""),[o,i]=(0,sy.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},sy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},sy.default.createElement(mo,{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&&sy.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),sy.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},sy.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),sy.default.createElement(ge,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Ife=class extends FYt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,kYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(sy.default.createElement(VRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var $Yt=require("obsidian"),Lb=F(X()),BYt=F(Dc());ti();function WRn({onConfirm:t,onCancel:e}){let[r,n]=(0,Lb.useState)("");return Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Lb.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"),Lb.default.createElement(mo,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),Lb.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Lb.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),Lb.default.createElement(ge,{variant:"default",onClick:()=>t(r)},"Confirm")))}var Mfe=class extends $Yt.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,BYt.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Lb.default.createElement(WRn,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Rfe({title:t,patterns:e,onRemove:r}){return Pn.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Pn.default.createElement("div",{className:"tw-font-bold"},t),Pn.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=>Pn.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"},Pn.default.createElement(TM,{className:"tw-flex-1"},n),Pn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Pn.default.createElement(Vi,{className:"tw-size-4"}))))))}function KRn({value:t,onUpdate:e,container:r}){let[n,o]=(0,Pn.useState)(t),i=bg(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=k8(i),c=f=>{let p=$8({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 Pn.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Pn.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&&Pn.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Pn.default.createElement(Rfe,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Pn.default.createElement(Rfe,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Pn.default.createElement(Rfe,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Pn.default.createElement(Rfe,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Pn.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Pn.default.createElement(JD,null,Pn.default.createElement(YD,{asChild:!0},Pn.default.createElement(ge,{variant:"secondary"},"Add...")),Pn.default.createElement(xb,{align:"start",container:r},Pn.default.createElement(Si,{onSelect:()=>{new Sz(app,f=>{let p=Xoe(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(d1,{className:"tw-size-4"}),"Tag")),Pn.default.createElement(Si,{onSelect:()=>{new wz(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Iy,{className:"tw-size-4"}),"Folder")),Pn.default.createElement(Si,{onSelect:()=>{new SM({app,onNoteSelect:f=>{let p=B8(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(Ay,{className:"tw-size-4"}),"Note")),Pn.default.createElement(Si,{onSelect:()=>{new Ife(app,f=>{let p=YRt(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(x3,{className:"tw-size-4"}),"Extension")),Pn.default.createElement(Si,{onSelect:()=>{new Mfe(app,f=>{let p=bg(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:b,notePatterns:g}=k8(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...b],notePatterns:[...l,...g]})}).open()}},Pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Pn.default.createElement(f1,{className:"tw-size-4"}),"Custom"))))))}var nK=class extends qYt.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,UYt.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Pn.default.createElement(KRn,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};ti();$r();Ix();nr();yn();var zr=F(X()),zYt=()=>{let t=Rn(),e=r=>{let n=parseInt(r);n!==t.numPartitions&&new Qz(app,async()=>{dt("numPartitions",n),await ma.getInstance().indexVaultToVectorStore(!0)}).open()};return zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement("section",null,zr.default.createElement("div",{className:"tw-space-y-4"},zr.default.createElement(hn,{type:"select",title:"Auto-Index Strategy",description:zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},zr.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),zr.default.createElement(vo,{delayDuration:0},zr.default.createElement(Rt,null,zr.default.createElement(jt,{asChild:!0},zr.default.createElement(di,{className:"tw-size-4"})),zr.default.createElement(Mt,null,zr.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},zr.default.createElement("div",{className:"tw-space-y-1"},zr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),zr.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),zr.default.createElement("span",null,"Manual indexing via command or refresh only"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),zr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),zr.default.createElement("li",null,zr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),zr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),zr.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=>{dt("indexVaultToVectorStore",r)},options:xVe.map(r=>({label:r,value:r})),placeholder:"Strategy"}),zr.default.createElement(hn,{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=>dt("maxSourceChunks",r)}),zr.default.createElement(hn,{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=>dt("embeddingRequestsPerMin",r)}),zr.default.createElement(hn,{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=>dt("embeddingBatchSize",r)}),zr.default.createElement(hn,{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}))}),zr.default.createElement(hn,{type:"custom",title:"Exclusions",description:zr.default.createElement(zr.default.Fragment,null,zr.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."))},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new nK(app,r=>dt("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),zr.default.createElement(hn,{type:"custom",title:"Inclusions",description:zr.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.")},zr.default.createElement(ge,{variant:"secondary",onClick:()=>new nK(app,r=>dt("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),zr.default.createElement(hn,{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=>dt("enableIndexSync",r)}),zr.default.createElement(hn,{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=>dt("disableIndexOnMobile",r)}))))};var VYt=["basic","model","QA","command","plus","advanced"],GRn={basic:Bn.default.createElement(p3,{className:"tw-size-5"}),model:Bn.default.createElement(m3,{className:"tw-size-5"}),QA:Bn.default.createElement(h3,{className:"tw-size-5"}),command:Bn.default.createElement(c_,{className:"tw-size-5"}),plus:Bn.default.createElement(Vh,{className:"tw-size-5"}),advanced:Bn.default.createElement(f1,{className:"tw-size-5"})},JRn={basic:()=>Bn.default.createElement(RYt,null),model:()=>Bn.default.createElement(LYt,null),QA:()=>Bn.default.createElement(zYt,null),command:()=>Bn.default.createElement(OYt,null),plus:()=>Bn.default.createElement(jYt,null),advanced:()=>Bn.default.createElement(PYt,null)},HYt=VYt.map(t=>({id:t,icon:GRn[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),YRn=()=>{let{selectedTab:t,setSelectedTab:e}=Vz();return Bn.default.createElement("div",{className:"tw-flex tw-flex-col"},Bn.default.createElement("div",{className:"tw-inline-flex tw-rounded-lg"},HYt.map((r,n)=>Bn.default.createElement(IJt,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===HYt.length-1}))),Bn.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Bn.default.createElement("div",null,VYt.map(r=>{let n=JRn[r];return Bn.default.createElement(MJt,{key:r,id:r,isSelected:t===r},Bn.default.createElement(n,null))})))},ZRn=({plugin:t})=>{let[e,r]=Bn.default.useState(0),{latestVersion:n,hasUpdate:o}=_de(t.manifest.version),i=async()=>{new ofe(app,async()=>{nVe(),r(s=>s+1)}).open()};return Bn.default.createElement(jJt,null,Bn.default.createElement("div",null,Bn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Bn.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Bn.default.createElement("span",null,"Copilot Settings"),Bn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Bn.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Bn.default.createElement(Bn.default.Fragment,null,o?Bn.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,")"):Bn.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Bn.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Bn.default.createElement(ge,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Bn.default.createElement(YRn,{key:e})))},WYt=ZRn;var jfe=class extends oK.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{this.app.workspace.getLeavesOfType(Es)[0]?.view&&ue().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 oK.Notice("Plugin reloaded successfully.")}catch(e){new oK.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,KYt.createRoot)(r).render(Eqe.default.createElement(aqe.Provider,{value:e},Eqe.default.createElement(WYt,{plugin:this.plugin})))}};nr();var vE=require("obsidian");Cl();ti();yo();Cn();qE();Sm();yn();var Fb=require("obsidian"),Et=F(X()),GYt=F(Dc());nr();function XRn(t){let[e]=(0,Et.useState)(new hW({returnMessages:!0,memoryKey:"history"})),[r,n]=(0,Et.useState)(null);return(0,Et.useEffect)(()=>{async function o(){let i=await PD.getInstance().createModelInstance(t),a=xp.fromMessages([BE.fromTemplate("You are a helpful assistant. You'll help the user with their content editing needs."),new Gb("history"),Jb.fromTemplate("{input}")]),s=bi.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 QRn({originalText:t,command:e,onInsert:r,onReplace:n}){let[o,i]=(0,Et.useState)(null),[a,s]=(0,Et.useState)(null),[u,l]=(0,Et.useState)(""),c=(0,Et.useRef)(null),d=(0,Et.useRef)(null),[f,p]=(0,Et.useState)(!0),[m]=wF(),h=Rn(),b=(0,Et.useMemo)(()=>eJ(e.modelKey||m,h.activeModels),[e.modelKey,m,h.activeModels]),{chatChain:g,chatMemory:y}=XRn(b),S=e.title,x=(0,Et.useCallback)(async(R,N)=>{if(!g)return console.error("Chat chain not initialized"),new Fb.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 z of k){if(N.signal.aborted)break;let V=typeof z.content=="string"?z.content:"";j+=V,i(j)}if(!N.signal.aborted){let z=j.trim();return s(z),p(!1),await y.saveContext({input:R},{output:z}),z}return null}catch(j){return fe("Error generating response:",j),p(!1),null}},[g,y]);(0,Et.useEffect)(()=>{let R=new AbortController;O.current=R;async function N(){if(g)try{let j=await iFe(e.content,t);await x(j,R)}catch(j){fe("Error in initial response:",j),p(!1)}}return N(),()=>{R.abort()}},[e.content,t,g,x]);let O=(0,Et.useRef)(null),P=async()=>{if(!u.trim()||!g){g||new Fb.Notice("Chat engine not ready. Please try again.");return}let R=new AbortController;O.current=R;let N=await iFe(u,t,!0);try{await x(N,R)&&l("")}finally{R.signal.aborted&&(p(!1),s(o??"")),O.current=null}},E=()=>{O.current&&(O.current.abort(),O.current=null,p(!1))},A=R=>{R.nativeEvent.isComposing||(!f&&a&&!I&&(R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&!R.shiftKey&&(R.preventDefault(),n(a)),R.key==="Enter"&&(Fb.Platform.isMacOS?R.metaKey:R.ctrlKey)&&R.shiftKey&&(R.preventDefault(),r(a))),I&&R.key==="Enter"&&!R.shiftKey&&!R.metaKey&&!R.ctrlKey&&(R.preventDefault(),P()))};(0,Et.useEffect)(()=>{if(c.current&&o&&f){let R=c.current;R.scrollTop=R.scrollHeight}},[o,f]);let I=!f&&u.trim().length>0;return Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:A},Et.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},S&&Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Et.default.createElement(p_,{className:"tw-size-4"}),S)),Et.default.createElement("div",{className:"tw-group tw-relative"},Et.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&&Et.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 Fb.Notice("Copied to clipboard")}},Et.default.createElement(Ty,{className:"tw-size-4 hover:tw-text-accent"}))),!f&&a&&Et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Et.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)})),Et.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Et.default.createElement(a1,{className:"tw-size-4"}),Xce(b)),Et.default.createElement("div",{className:"tw-flex tw-gap-2"},f?Et.default.createElement(ge,{variant:"secondary",onClick:E},"Stop"):I?Et.default.createElement(ge,{onClick:P,className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Submit"),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(ge,{onClick:()=>r(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Insert"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(YC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(YC,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})))),Et.default.createElement(ge,{onClick:()=>n(a??""),className:"tw-flex tw-items-center tw-gap-1"},Et.default.createElement("span",null,"Replace"),Et.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs tw-text-normal"},Fb.Platform.isMacOS?Et.default.createElement(Et.default.Fragment,null,Et.default.createElement(c_,{className:"tw-size-3"}),Et.default.createElement(Im,{className:"tw-size-3"})):Et.default.createElement(Et.default.Fragment,null,Et.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Et.default.createElement(Im,{className:"tw-size-3"}))))))))}var Nfe=class extends Fb.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,GYt.createRoot)(r);let{selectedText:n,command:o}=this.configs,i=s=>{l4(s),this.close()},a=s=>{l4(s,!0),this.close()};this.root.render(Et.default.createElement(QRn,{originalText:n,command:o,onInsert:i,onReplace:a}))}onClose(){this.root.unmount()}};var JYt=F(YRe());var Dfe=class{constructor(e,r){this.handleFileModify=(0,JYt.default)(async e=>{if(YU(e)){let r=await TW(e);this.registerCommand(r),EW(r,r.title)}},3e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(YU(e)){let r=await TW(e);this.registerCommand(r),ace(r.title)}};this.handleFileDeletion=async e=>{if(YU(e)){let r=JU(e.basename);this.plugin.removeCommand(r),PW(e.basename)}};this.handleFileRename=async(e,r)=>{let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=JU(n);this.plugin.removeCommand(o),PW(n)}if(YU(e)){let o=await TW(e);this.registerCommand(o),EW(o,o.title)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await uce(),this.registerCommands()}async registerCommands(){Gx().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=JU(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new Nfe(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),lm.getInstance().recordUsage(e)}})}};var Lfe=class extends vE.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=xa(async(r,n)=>{n.enableEncryption?await this.saveData(await VVe(n)):await this.saveData(n),nFe(this,r,n)}),this.addSettingTab(new jfe(this.app,this)),this.sharedState=new xJt(this),this.vectorStoreManager=ma.getInstance(),this.brevilabsClient=Fi.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),iie(),this.projectManager=ac.getInstance(this.app,this.vectorStoreManager,this),this.fileParserManager=new oI(this.brevilabsClient,this.app.vault),this.registerView(Es,r=>new $M(r,this)),this.registerView(s9,r=>new ude(r)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",r=>{this.activateView()}),nFe(this,void 0,ue()),IN.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",r=>AJt(r))),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{if(r&&r.view instanceof vE.MarkdownView&&r.view.file){let o=this.app.workspace.getLeavesOfType(Es).find(i=>i.view instanceof $M)?.view;if(o){let i=new CustomEvent(Dh.ACTIVE_LEAF_CHANGE);o.eventTarget.dispatchEvent(i)}}})),this.autocompleteService=tce.getInstance(this),this.customCommandRegister=new Dfe(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(xYt).then(CYt)})}async onunload(){this.vectorStoreManager&&this.vectorStoreManager.onunload(),this.projectManager&&this.projectManager.onunload(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),ie("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ue().autosaveChat){let r=this.app.workspace.getLeavesOfType(Es)[0]?.view;r&&r.sharedState.chatHistory.length>0&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Es).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Es).find(l=>l.view instanceof $M)?.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(Es).find(n=>n.view instanceof $M)?.view;if(r){let n=new CustomEvent(Dh.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Es&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(vE.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(Es).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Es);r.length===0?ue().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Es,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Es,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Es)}async loadSettings(){let r=await this.loadData(),n=oVe(r);zE(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=kr(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 vE.Notice("No chat history found.");return}new nfe(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ue().defaultSaveFolder);if(!(r instanceof vE.TFolder))return[];let o=(await this.app.vault.getMarkdownFiles()).filter(s=>s.path.startsWith(r.path)),a=Mc()?.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=x1t(n);this.sharedState.clearChatHistory(),o.forEach(a=>this.sharedState.addMessage(a)),await _N(o,this.projectManager.getCurrentChainManager().memoryManager);let i=this.app.workspace.getLeavesOfType(Es)[0];i?i.view.updateView():this.activateView()}async handleNewChat(){await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Es)[0];if(r){let n=r.view,o=new CustomEvent(Dh.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.sharedState.clearChatHistory(),this.projectManager.getCurrentChainManager().memoryManager.clearChatMemory(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){return(await new Rx({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
*)
@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 */