3351 lines
5.2 MiB
Plaintext
3351 lines
5.2 MiB
Plaintext
/*
|
||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||
if you want to view the source, please visit the github repository of this plugin
|
||
*/
|
||
|
||
// Polyfill for import.meta in CommonJS context
|
||
if (typeof import_meta === 'undefined') {
|
||
var import_meta = {
|
||
url: typeof __filename !== 'undefined' ? 'file://' + __filename : 'file:///obsidian-plugin'
|
||
};
|
||
}
|
||
|
||
var Hcn=Object.create;var IQ=Object.defineProperty;var Wcn=Object.getOwnPropertyDescriptor;var Jcn=Object.getOwnPropertyNames;var Kcn=Object.getPrototypeOf,Gcn=Object.prototype.hasOwnProperty;var lCt=t=>{throw TypeError(t)};var Xcn=(t,e,r)=>e in t?IQ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var v=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),En=(t,e)=>{for(var r in e)IQ(t,r,{get:e[r],enumerable:!0})},cCt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Jcn(e))!Gcn.call(t,o)&&o!==r&&IQ(t,o,{get:()=>e[o],enumerable:!(n=Wcn(e,o))||n.enumerable});return t};var $=(t,e,r)=>(r=t!=null?Hcn(Kcn(t)):{},cCt(e||!t||!t.__esModule?IQ(r,"default",{value:t,enumerable:!0}):r,t)),Bpe=t=>cCt(IQ({},"__esModule",{value:!0}),t);var x=(t,e,r)=>Xcn(t,typeof e!="symbol"?e+"":e,r),Zcn=(t,e,r)=>e.has(t)||lCt("Cannot "+r);var cBe=(t,e,r)=>e.has(t)?lCt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var dCt=(t,e,r)=>(Zcn(t,e,"access private method"),r);function dBe(){if(!zpe&&(zpe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!zpe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zpe(Ycn)}var zpe,Ycn,fCt=v(()=>{Ycn=new Uint8Array(16)});function pCt(t,e=0){return Sg[t[e+0]]+Sg[t[e+1]]+Sg[t[e+2]]+Sg[t[e+3]]+"-"+Sg[t[e+4]]+Sg[t[e+5]]+"-"+Sg[t[e+6]]+Sg[t[e+7]]+"-"+Sg[t[e+8]]+Sg[t[e+9]]+"-"+Sg[t[e+10]]+Sg[t[e+11]]+Sg[t[e+12]]+Sg[t[e+13]]+Sg[t[e+14]]+Sg[t[e+15]]}var Sg,mCt=v(()=>{Sg=[];for(let t=0;t<256;++t)Sg.push((t+256).toString(16).slice(1))});var Qcn,fBe,hCt=v(()=>{Qcn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fBe={randomUUID:Qcn}});function edn(t,e,r){if(fBe.randomUUID&&!e&&!t)return fBe.randomUUID();t=t||{};let n=t.random||(t.rng||dBe)();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 pCt(n)}var od,gCt=v(()=>{hCt();fCt();mCt();od=edn});var qN=v(()=>{gCt()});var tdn,$t,Jo=v(()=>{tdn=Object.defineProperty,$t=(t,e)=>{for(var r in e)tdn(t,r,{get:e[r],enumerable:!0})}});function AQ(t,e=Mz){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 rdn(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let r=0;function n(){for(;r<e.length&&/\s/.test(e[r]);)r+=1}function o(){if(e[r]!=='"')throw new Error(`Expected '"' at position ${r}, got '${e[r]}'`);r+=1;let c="",d=!1;for(;r<e.length;){let f=e[r];if(d){if(f==="n")c+=`
|
||
`;else if(f==="t")c+=" ";else if(f==="r")c+="\r";else if(f==="\\")c+="\\";else if(f==='"')c+='"';else if(f==="b")c+="\b";else if(f==="f")c+="\f";else if(f==="/")c+="/";else if(f==="u"){let p=e.substring(r+1,r+5);if(/^[0-9A-Fa-f]{0,4}$/.test(p))p.length===4?c+=String.fromCharCode(Number.parseInt(p,16)):c+=`u${p}`,r+=p.length;else throw new Error(`Invalid unicode escape sequence '\\u${p}' at position ${r}`)}else throw new Error(`Invalid escape sequence '\\${f}' at position ${r}`);d=!1}else if(f==="\\")d=!0;else{if(f==='"')return r+=1,c;c+=f}r+=1}return d&&(c+="\\"),c}function i(){let c=r,d="";if(e[r]==="-"&&(d+="-",r+=1),r<e.length&&e[r]==="0"&&(d+="0",r+=1,e[r]>="0"&&e[r]<="9"))throw new Error(`Invalid number at position ${c}`);if(r<e.length&&e[r]>="1"&&e[r]<="9")for(;r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(r<e.length&&e[r]===".")for(d+=".",r+=1;r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(r<e.length&&(e[r]==="e"||e[r]==="E"))for(d+=e[r],r+=1,r<e.length&&(e[r]==="+"||e[r]==="-")&&(d+=e[r],r+=1);r<e.length&&e[r]>="0"&&e[r]<="9";)d+=e[r],r+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw r=c,new Error(`Invalid number '${d}' at position ${c}`);return f}function a(){if(n(),r>=e.length)throw new Error(`Unexpected end of input at position ${r}`);let c=e[r];if(c==="{")return u();if(c==="[")return s();if(c==='"')return o();if("null".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),null;if("true".startsWith(e.substring(r,r+4)))return r+=Math.min(4,e.length-r),!0;if("false".startsWith(e.substring(r,r+5)))return r+=Math.min(5,e.length-r),!1;if(c==="-"||c>="0"&&c<="9")return i();throw new Error(`Unexpected character '${c}' at position ${r}`)}function s(){if(e[r]!=="[")throw new Error(`Expected '[' at position ${r}, got '${e[r]}'`);let c=[];if(r+=1,n(),r>=e.length)return c;if(e[r]==="]")return r+=1,c;for(;r<e.length;){if(n(),r>=e.length||(c.push(a()),n(),r>=e.length))return c;if(e[r]==="]")return r+=1,c;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or ']' at position ${r}, got '${e[r]}'`)}return c}function u(){if(e[r]!=="{")throw new Error(`Expected '{' at position ${r}, got '${e[r]}'`);let c={};if(r+=1,n(),r>=e.length)return c;if(e[r]==="}")return r+=1,c;for(;r<e.length;){if(n(),r>=e.length)return c;let d=o();if(n(),r>=e.length)return c;if(e[r]!==":")throw new Error(`Expected ':' at position ${r}, got '${e[r]}'`);if(r+=1,n(),r>=e.length||(c[d]=a(),n(),r>=e.length))return c;if(e[r]==="}")return r+=1,c;if(e[r]===","){r+=1;continue}throw new Error(`Expected ',' or '}' at position ${r}, got '${e[r]}'`)}return c}let l=a();if(n(),r<e.length)throw new Error(`Unexpected character '${e[r]}' at position ${r}`);return l}function Mz(t){try{return typeof t>"u"?null:rdn(t)}catch{return null}}var NQ=v(()=>{});function FL(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
|
||
`,t}var DQ=v(()=>{});var bCt=S((ZCi,yCt)=>{"use strict";yCt.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 TCt=S((YCi,pBe)=>{"use strict";var ndn=/[\p{Lu}]/u,odn=/[\p{Ll}]/u,_Ct=/^[\p{Lu}](?![\p{Lu}])/gu,SCt=/([\p{Alpha}\p{N}_]|$)/u,CCt=/[_.\- ]+/,idn=new RegExp("^"+CCt.source),vCt=new RegExp(CCt.source+SCt.source,"gu"),wCt=new RegExp("\\d+"+SCt.source,"gu"),adn=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&ndn.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&odn.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},sdn=(t,e)=>(_Ct.lastIndex=0,t.replace(_Ct,r=>e(r))),udn=(t,e)=>(vCt.lastIndex=0,wCt.lastIndex=0,t.replace(vCt,(r,n)=>e(n)).replace(wCt,r=>e(r))),xCt=(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=adn(t,r,n)),t=t.replace(idn,""),e.preserveConsecutiveUppercase?t=sdn(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),udn(t,n))};pBe.exports=xCt;pBe.exports.default=xCt});function ECt(t,e){return e?.[t]||(0,OCt.default)(t)}function PCt(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var OCt,ldn,MCt=v(()=>{OCt=$(bCt(),1),ldn=$(TCt(),1)});function cdn(t){return"lc"in t||Object.keys(t).length===1&&RCt in t}function ddn(t){return{[RCt]:t}}function fdn(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function pdn(t){let e;return t!==null&&typeof t=="object"?"lc_id"in t&&Array.isArray(t.lc_id)?e=t.lc_id:e=[t.constructor?.name??"Object"]:e=[typeof t],{lc:1,type:"not_implemented",id:e}}function Vpe(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return pdn(t);if(fdn(t))return t;e.add(t);let r=t;if(cdn(r))return e.delete(t),ddn(r);let n={};for(let[o,i]of Object.entries(r))n[o]=Vpe(i,e);return e.delete(t),n}return Array.isArray(t)?t.map(r=>Vpe(r,e)):t}var RCt,ICt=v(()=>{RCt="__lc_escaped__"});function ACt(t){return Array.isArray(t)?[...t]:{...t}}function hdn(t,e){let r=ACt(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]=ACt(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Hpe(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 mdn,Cg,kL=v(()=>{Jo();MCt();ICt();mdn={};$t(mdn,{Serializable:()=>Cg,get_lc_unique_name:()=>Hpe});Cg=class NCt{constructor(e,...r){x(this,"lc_serializable",!1);x(this,"lc_kwargs");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??{}}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Hpe(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof NCt||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((u,l)=>(u[l]=l in this?this[l]:this.lc_kwargs[l],u),{});for(let u=Object.getPrototypeOf(this);u;u=Object.getPrototypeOf(u))Object.assign(e,Reflect.get(u,"lc_aliases",this)),Object.assign(r,Reflect.get(u,"lc_secrets",this)),Object.assign(n,Reflect.get(u,"lc_attributes",this));Object.keys(r).forEach(u=>{let l=this,c=n,[d,...f]=u.split(".").reverse();for(let p of f.reverse()){if(!(p in l)||l[p]===void 0)return;(!(p in c)||c[p]===void 0)&&(typeof l[p]=="object"&&l[p]!=null?c[p]={}:Array.isArray(l[p])&&(c[p]=[])),l=l[p],c=c[p]}d in l&&l[d]!==void 0&&(c[d]=c[d]||l[d])});let o={},i=new WeakSet;i.add(this);for(let[u,l]of Object.entries(n))o[u]=Vpe(l,i);let a=Object.keys(r).length?hdn(o,r):o,s=PCt(a,ECt,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function qL(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function DCt(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 H6,Wpe=v(()=>{H6=class extends Error{constructor(e,r){super(e);x(this,"output");this.output=r}}});var jCt,UL,$Ct,BL,jQ=v(()=>{jCt=Symbol.for("ls:tracing_async_local_storage"),UL=Symbol.for("lc:context_variables"),$Ct=t=>{globalThis[jCt]=t},BL=()=>globalThis[jCt]});function Ph(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 W6(t){return Ph(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function J6(t){return Ph(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function LCt(t){return Ph(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Jpe(t){return Ph(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Kpe(t){if(Ph(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 $Q(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let a=i.split("=");if(a.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let s=a[0].trim(),u=a[1].trim();if(s==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[s]=u}return{type:r,subtype:n,parameters:o}}function Cy({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 GT(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 LQ=v(()=>{});function Ir(t,e){return wn(t)&&t.type===e}function wn(t){return typeof t=="object"&&t!==null}function xy(t){return Array.isArray(t)}function Tt(t){return typeof t=="string"}function Qv(t){return typeof t=="number"}function Gpe(t){return t instanceof Uint8Array}function mBe(t){try{return JSON.parse(t)}catch{return}}var UN,qC=v(()=>{UN=t=>t()});function gdn(t){if(t.type==="char_location"&&Tt(t.document_title)&&Qv(t.start_char_index)&&Qv(t.end_char_index)&&Tt(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="page_location"&&Tt(t.document_title)&&Qv(t.start_page_number)&&Qv(t.end_page_number)&&Tt(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="content_block_location"&&Tt(t.document_title)&&Qv(t.start_block_index)&&Qv(t.end_block_index)&&Tt(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:o}}if(t.type==="web_search_result_location"&&Tt(t.url)&&Tt(t.title)&&Tt(t.encrypted_index)&&Tt(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:o}}if(t.type==="search_result_location"&&Tt(t.source)&&Tt(t.title)&&Qv(t.start_block_index)&&Qv(t.end_block_index)&&Tt(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:o,cited_text:i,...a}=t;return{...a,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:o,citedText:i}}}function kCt(t){if(Ir(t,"document")&&wn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&Tt(t.source.media_type)&&Tt(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&Tt(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&Tt(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&Tt(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(Ir(t,"image")&&wn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&Tt(t.source.media_type)&&Tt(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&Tt(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&Tt(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function qCt(t){function*e(){for(let r of t){let n=kCt(r);n?yield n:yield r}}return Array.from(e())}function FCt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Ir(n,"text")&&Tt(n.text)){let{text:o,citations:i,...a}=n;if(xy(i)&&i.length){let s=i.reduce((u,l)=>{let c=gdn(l);return c?[...u,c]:u},[]);yield{...a,type:"text",text:o,annotations:s};continue}else{yield{...a,type:"text",text:o};continue}}else if(Ir(n,"thinking")&&Tt(n.thinking)){let{thinking:o,signature:i,...a}=n;yield{...a,type:"reasoning",reasoning:o,signature:i};continue}else if(Ir(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"tool_use")&&Tt(n.name)&&Tt(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(Ir(n,"input_json_delta")){if(ydn(t)&&t.tool_call_chunks?.length){let o=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:o.id,name:o.name,args:o.args,index:o.index};continue}}else if(Ir(n,"server_tool_use")&&Tt(n.name)&&Tt(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let a=UN(()=>{if(typeof n.input=="string")return n.input;if(wn(n.input)&&Tt(n.input.query))return n.input.query;if(Tt(n.partial_json)){let s=mBe(n.partial_json);if(s?.query)return s.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:a}};continue}else if(n.name==="code_execution"){let a=UN(()=>{if(typeof n.input=="string")return n.input;if(wn(n.input)&&Tt(n.input.code))return n.input.code;if(Tt(n.partial_json)){let s=mBe(n.partial_json);if(s?.code)return s.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:a}};continue}}else if(Ir(n,"web_search_tool_result")&&Tt(n.tool_use_id)&&xy(n.content)){let{content:o,tool_use_id:i}=n,a=o.reduce((s,u)=>Ir(u,"web_search_result")?[...s,u.url]:s,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:a}};continue}else if(Ir(n,"code_execution_tool_result")&&Tt(n.tool_use_id)&&wn(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(Ir(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(Ir(n,"mcp_tool_result")&&Tt(n.tool_use_id)&&wn(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(Ir(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(Ir(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(Ir(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=kCt(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}function ydn(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}var UCt,hBe=v(()=>{qC();UCt={translateContent:FCt,translateContentChunk:FCt}});function bdn(t){return W6(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:J6(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Jpe(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function BCt(t){return t.map(bdn)}function zCt(t){return!!(Ir(t,"image_url")&&wn(t.image_url)||Ir(t,"input_audio")&&wn(t.input_audio)||Ir(t,"file")&&wn(t.file))}function VCt(t){if(Ir(t,"image_url")&&wn(t.image_url)&&Tt(t.image_url.url)){let e=Cy({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(Ir(t,"input_audio")&&wn(t.input_audio)&&Tt(t.input_audio.data)&&Tt(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(Ir(t,"file")&&wn(t.file)&&Tt(t.file.data)){let e=Cy({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(Tt(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}var gBe=v(()=>{LQ();qC()});function _dn(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Xpe(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function vdn(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Xpe(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function Xpe(t){let e=[];for(let r of t)zCt(r)?e.push(VCt(r)):e.push(r);return e}function wdn(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:o}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function HCt(t){function*e(){wn(t.additional_kwargs?.reasoning)&&xy(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>wn(i)&&Tt(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(Ir(n,"text")){let{text:o,annotations:i,...a}=n;Array.isArray(i)?yield{...a,type:"text",text:String(o),annotations:i.map(wdn)}:yield{...a,type:"text",text:String(o)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(wn(t.additional_kwargs)&&xy(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(Ir(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(Ir(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(Ir(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"code_interpreter_call")){if(Tt(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),xy(n.outputs)){let o=UN(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let i of n.outputs)if(Ir(i,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:o??0,stderr:[0,void 0].includes(o)?void 0:String(i.logs),stdout:[0,void 0].includes(o)?String(i.logs):void 0}};continue}}continue}else if(Ir(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(Ir(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(Ir(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}wn(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function Sdn(t){function*e(){yield*HCt(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var WCt,yBe=v(()=>{qC();gBe();WCt={translateContent:t=>typeof t.content=="string"?_dn(t):HCt(t),translateContentChunk:t=>typeof t.content=="string"?vdn(t):Sdn(t)}});function Zpe(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var bBe=v(()=>{});function JCt(t,e="pretty"){return e==="pretty"?Cdn(t):JSON.stringify(t)}function Cdn(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),o="=".repeat(n),i=r.length%2===0?o:`${o}=`;if(e.push(`${o}${r}${i}`),t.type==="ai"){let a=t;if(a.tool_calls&&a.tool_calls.length>0){e.push("Tool Calls:");for(let s of a.tool_calls){e.push(` ${s.name} (${s.id})`),e.push(` Call ID: ${s.id}`),e.push(" Args:");for(let[u,l]of Object.entries(s.args))e.push(` ${u}: ${typeof l=="object"?JSON.stringify(l):l}`)}}}if(t.type==="tool"){let a=t;a.name&&e.push(`Name: ${a.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
|
||
`)}var KCt=v(()=>{});function Ty(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>Ph(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?Rz(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Ph(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function Ype(t,e){return t==="error"||e==="error"?"error":"success"}function xdn(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 XCt(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function Fl(t,e){if(t===void 0&&e===void 0)return;if(t===void 0||e===void 0)return 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;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="number")r[n]=r[n]+o;else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=Fl(r[n],o);else if(Array.isArray(r[n]))r[n]=Rz(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 Rz(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"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let a=typeof i=="object",s="index"in i&&i.index===n.index,u="id"in i&&"id"in n&&i?.id===n?.id,l=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return a&&s&&(u||l)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=Fl(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function Qpe(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)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 Rz(t,e);if(typeof t=="object"&&typeof e=="object")return Fl(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
|
||
Left ${t}
|
||
Right ${e}`)}}function eme(t){return typeof t.role=="string"}function xg(t){return typeof t?._getType=="function"}function K6(t){return Mb.isInstance(t)}var _Be,GCt,id,Mb,Oy=v(()=>{kL();LQ();hBe();gBe();yBe();bBe();KCt();_Be=Symbol.for("langchain.message");id=class extends Cg{constructor(e){let r=typeof e=="string"||Array.isArray(e)?{content:e}:e;r.additional_kwargs||(r.additional_kwargs={}),r.response_metadata||(r.response_metadata={});super(r);x(this,"lc_namespace",["langchain_core","messages"]);x(this,"lc_serializable",!0);x(this,GCt,!0);x(this,"id");x(this,"name");x(this,"content");x(this,"additional_kwargs");x(this,"response_metadata");this.name=r.name,r.content===void 0&&r.contentBlocks!==void 0?(this.content=r.contentBlocks,this.response_metadata={output_version:"v1",...r.response_metadata}):r.content!==void 0?(this.content=r.content??[],this.response_metadata=r.response_metadata):(this.content=[],this.response_metadata=r.response_metadata),this.additional_kwargs=r.additional_kwargs,this.id=r.id}get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}_getType(){return this.type}getType(){return this._getType()}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(""):""}get contentBlocks(){let e=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[BCt,Xpe,qCt].reduce((o,i)=>i(o),e)}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}}static isInstance(e){return typeof e=="object"&&e!==null&&_Be in e&&e[_Be]===!0&&Zpe(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[(GCt=_Be,Symbol.toStringTag)](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=xdn(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}toFormattedString(e="pretty"){return JCt(this,e)}};Mb=class ZCt extends id{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===ZCt.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}}});function FQ(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function kQ(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);e.push({name:o||"",args:i||{},id:n.id})}catch{r.push({name:o,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[e,r]}function qQ(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function vBe(t){return t._getType()==="tool"}var Tdn,Mh,_S,G6=v(()=>{Jo();Oy();Tdn={};$t(Tdn,{ToolMessage:()=>Mh,ToolMessageChunk:()=>_S,defaultToolCallParser:()=>kQ,isDirectToolOutput:()=>FQ,isToolMessage:()=>qQ,isToolMessageChunk:()=>vBe});Mh=class extends id{constructor(e,r,n){let o=typeof e=="string"||Array.isArray(e)?{content:e,name:n,tool_call_id:r}:e;super(o);x(this,"lc_direct_tool_output",!0);x(this,"type","tool");x(this,"status");x(this,"tool_call_id");x(this,"metadata");x(this,"artifact");this.tool_call_id=o.tool_call_id,this.artifact=o.artifact,this.status=o.status,this.metadata=o.metadata}static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},_S=class extends Mb{constructor(e){super(e);x(this,"type","tool");x(this,"tool_call_id");x(this,"status");x(this,"artifact");this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){let r=this.constructor;return new r({content:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:Fl(this.response_metadata,e.response_metadata),artifact:Qpe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Ype(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function QCt(t){return t._getType()==="generic"}function ext(t){return t._getType()==="generic"}var Td,ew,UQ=v(()=>{Oy();Td=class YCt extends id{constructor(r,n){(typeof r=="string"||Array.isArray(r))&&(r={content:r,role:n});super(r);x(this,"type","generic");x(this,"role");this.role=r.role}static lc_name(){return"ChatMessage"}static _chatMessageClass(){return YCt}static isInstance(r){return super.isInstance(r)&&r.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},ew=class extends Mb{constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r});super(e);x(this,"type","generic");x(this,"role");this.role=e.role}static lc_name(){return"ChatMessageChunk"}concat(e){let r=this.constructor;return new r({content:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:Fl(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}}});function txt(t){return t._getType()==="function"}function rxt(t){return t._getType()==="function"}var Iz,tw,tme=v(()=>{Oy();Iz=class extends id{constructor(e){super(e);x(this,"type","function");x(this,"name");this.name=e.name}static lc_name(){return"FunctionMessage"}},tw=class extends Mb{constructor(){super(...arguments);x(this,"type","function")}static lc_name(){return"FunctionMessageChunk"}concat(e){let r=this.constructor;return new r({content:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:Fl(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});function nxt(t){return t.getType()==="human"}function oxt(t){return t.getType()==="human"}var qs,rw,zL=v(()=>{Oy();qs=class extends id{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="human"}},rw=class extends Mb{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessageChunk"}concat(e){let r=this.constructor;return new r({content:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:Fl(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}}});var Az,rme=v(()=>{Oy();Az=class extends id{constructor(e){super({...e,content:[]});x(this,"type","remove");x(this,"id");this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&e.type==="remove"}}});function ixt(t){return t._getType()==="system"}function axt(t){return t._getType()==="system"}var Od,Rb,BQ=v(()=>{Oy();Od=class nme extends id{constructor(r){super(r);x(this,"type","system")}static lc_name(){return"SystemMessage"}concat(r){if(typeof r=="string")return new nme({...this,content:Ty(this.content,r)});if(nme.isInstance(r))return new nme({...this,additional_kwargs:{...this.additional_kwargs,...r.additional_kwargs},response_metadata:{...this.response_metadata,...r.response_metadata},content:Ty(this.content,r.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(r){return super.isInstance(r)&&r.type==="system"}},Rb=class extends Mb{constructor(e){super(e);x(this,"type","system")}static lc_name(){return"SystemMessageChunk"}concat(e){let r=this.constructor;return new r({content:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:Fl(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}}});function wBe(t){switch(t){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function Odn(t){if(wn(t.document)&&wn(t.document.source)){let e=wn(t.document)&&Tt(t.document.format)?t.document.format:"",r=wBe(e);if(wn(t.document.source)){if(wn(t.document.source.s3Location)&&Tt(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(Gpe(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(Tt(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(xy(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>wn(i)&&Tt(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function Edn(t){if(Ir(t,"image")&&wn(t.image)){let e=wn(t.image)&&Tt(t.image.format)?t.image.format:"",r=wBe(e);if(wn(t.image.source)){if(wn(t.image.source.s3Location)&&Tt(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(Gpe(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function Pdn(t){if(Ir(t,"video")&&wn(t.video)){let e=wn(t.video)&&Tt(t.video.format)?t.video.format:"",r=wBe(e);if(wn(t.video.source)){if(wn(t.video.source.s3Location)&&Tt(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(Gpe(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function sxt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Ir(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"citations_content")&&wn(n.citationsContent)){let o=xy(n.citationsContent.content)?n.citationsContent.content.reduce((a,s)=>wn(s)&&Tt(s.text)?a+s.text:a,""):"",i=xy(n.citationsContent.citations)?n.citationsContent.citations.reduce((a,s)=>{if(wn(s)){let u=xy(s.sourceContent)?s.sourceContent.reduce((c,d)=>wn(d)&&Tt(d.text)?c+d.text:c,""):"",l=UN(()=>{if(wn(s.location)){let c=s.location.documentChar||s.location.documentPage||s.location.documentChunk;if(wn(c))return{source:Qv(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:Qv(c.start)?c.start:void 0,endIndex:Qv(c.end)?c.end:void 0}}return{}});a.push({type:"citation",citedText:u,...l})}return a},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(Ir(n,"document")&&wn(n.document)){yield Odn(n);continue}else if(Ir(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"image")&&wn(n.image)){yield Edn(n);continue}else if(Ir(n,"reasoning_content")&&Tt(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(Ir(n,"text")&&Tt(n.text)){yield{type:"text",text:n.text};continue}else if(Ir(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(Ir(n,"tool_call"))continue;if(Ir(n,"video")&&wn(n.video)){yield Pdn(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var uxt,lxt=v(()=>{qC();uxt={translateContent:sxt,translateContentChunk:sxt}});function cxt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(Tt(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&Tt(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var dxt,fxt=v(()=>{qC();dxt={translateContent:cxt,translateContentChunk:cxt}});function pxt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Ir(n,"text")&&Tt(n.text)){yield{type:"text",text:n.text};continue}else if(Ir(n,"thinking")&&Tt(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(Ir(n,"inlineData")&&wn(n.inlineData)&&Tt(n.inlineData.mimeType)&&Tt(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(Ir(n,"functionCall")&&wn(n.functionCall)&&Tt(n.functionCall.name)&&wn(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(Ir(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"fileData")&&wn(n.fileData)&&Tt(n.fileData.mimeType)&&Tt(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(Ir(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(Ir(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var mxt,hxt=v(()=>{qC();mxt={translateContent:pxt,translateContentChunk:pxt}});function gxt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Ir(n,"reasoning")&&Tt(n.reasoning)){let o=UN(()=>{let i=r.indexOf(n);if(xy(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});Tt(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(Ir(n,"thinking")&&Tt(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(Ir(n,"text")&&Tt(n.text)){yield{type:"text",text:n.text};continue}else if(Ir(n,"image_url")){if(Tt(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(Ir(n,"media")&&Tt(n.mimeType)&&Tt(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var yxt,bxt=v(()=>{qC();yxt={translateContent:gxt,translateContentChunk:gxt}});function _xt(t){let e=[],r=t.additional_kwargs?.reasoning;if(Tt(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string"){let n=t.content,o=n.match(/<think>([\s\S]*?)<\/think>/);if(o){let i=o[1].trim();i.length>0&&e.push({type:"reasoning",reasoning:i}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&e.push({type:"text",text:n})}else for(let n of t.content)if(typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&Tt(n.text)){let o=n.text,i=o.match(/<think>([\s\S]*?)<\/think>/);if(i){let a=i[1].trim();a.length>0&&e.push({type:"reasoning",reasoning:a}),o=o.replace(/<think>[\s\S]*?<\/think>/,"").trim()}o.length>0&&e.push({type:"text",text:o})}for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var vxt,wxt=v(()=>{qC();vxt={translateContent:_xt,translateContentChunk:_xt}});function Sxt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(Tt(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&Tt(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var Cxt,xxt=v(()=>{qC();Cxt={translateContent:Sxt,translateContentChunk:Sxt}});function Txt(t){let e=[];if(wn(t.additional_kwargs?.reasoning)){let n=t.additional_kwargs.reasoning;if(xy(n.summary)){let o=n.summary.reduce((i,a)=>wn(a)&&Tt(a.text)?`${i}${a.text}`:i,"");o.length>0&&e.push({type:"reasoning",reasoning:o})}}let r=t.additional_kwargs?.reasoning_content;if(Tt(r)&&r.length>0&&e.push({type:"reasoning",reasoning:r}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let n of t.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&Tt(n.text)&&e.push({type:"text",text:n.text});for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}var Oxt,Ext=v(()=>{qC();Oxt={translateContent:Txt,translateContentChunk:Txt}});function SBe(t){return globalThis.lc_block_translators_registry.get(t)}var Pxt=v(()=>{hBe();yBe();lxt();fxt();hxt();bxt();wxt();xxt();Ext();globalThis.lc_block_translators_registry??(globalThis.lc_block_translators_registry=new Map([["anthropic",UCt],["bedrock-converse",uxt],["deepseek",dxt],["google-genai",mxt],["google-vertexai",yxt],["groq",vxt],["ollama",Cxt],["openai",WCt],["xai",Oxt]]))});function ome(t,e){return Fl(t,e)??{}}function Mxt(t,e){let r={};return(t?.audio!==void 0||e?.audio!==void 0)&&(r.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(r.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(r.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(r.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(r.text=(t?.text??0)+(e?.text??0)),r}function Mdn(t,e){let r={...Mxt(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(r.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(r.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),r}function Rdn(t,e){let r={...Mxt(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function X6(t,e){return{input_tokens:(t?.input_tokens??0)+(e?.input_tokens??0),output_tokens:(t?.output_tokens??0)+(e?.output_tokens??0),total_tokens:(t?.total_tokens??0)+(e?.total_tokens??0),input_token_details:Mdn(t?.input_token_details,e?.input_token_details),output_token_details:Rdn(t?.output_token_details,e?.output_token_details)}}var ime=v(()=>{Oy()});function kl(t){return t._getType()==="ai"}function zQ(t){return t._getType()==="ai"}var Pn,Er,vS=v(()=>{Oy();Pxt();ime();G6();UC();Pn=class extends id{constructor(e){let r;if(typeof e=="string"||Array.isArray(e))r={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{r=e;let n=r.additional_kwargs?.tool_calls,o=r.tool_calls;n!=null&&n.length>0&&(o===void 0||o.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., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(n!=null&&o===void 0){let[i,a]=kQ(n);r.tool_calls=i??[],r.invalid_tool_calls=a??[]}else r.tool_calls=r.tool_calls??[],r.invalid_tool_calls=r.invalid_tool_calls??[]}catch{r.tool_calls=[],r.invalid_tool_calls=[]}if(r.response_metadata!==void 0&&"output_version"in r.response_metadata&&r.response_metadata.output_version==="v1"&&(r.contentBlocks=r.content,r.content=void 0),r.contentBlocks!==void 0){r.tool_calls&&r.contentBlocks.push(...r.tool_calls.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args})));let i=r.contentBlocks.filter(a=>a.type==="tool_call").filter(a=>!r.tool_calls?.some(s=>s.id===a.id&&s.name===a.name));i.length>0&&(r.tool_calls=i.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args})))}}super(r);x(this,"type","ai");x(this,"tool_calls",[]);x(this,"invalid_tool_calls",[]);x(this,"usage_metadata");typeof r!="string"&&(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"}}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let r=SBe(this.response_metadata.model_provider);if(r)return r.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls){let r=this.tool_calls.filter(n=>!e.some(o=>o.id===n.id&&o.name===n.name));e.push(...r.map(n=>({type:"tool_call",id:n.id,name:n.name,args:n.args})))}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}};Er=class extends Mb{constructor(e){let r;if(typeof e=="string"||Array.isArray(e))r={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0||e.tool_call_chunks.length===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=ame(e.tool_call_chunks??[]);r={...e,tool_call_chunks:n.tool_call_chunks,tool_calls:n.tool_calls,invalid_tool_calls:n.invalid_tool_calls,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r);x(this,"type","ai");x(this,"tool_calls",[]);x(this,"invalid_tool_calls",[]);x(this,"tool_call_chunks",[]);x(this,"usage_metadata");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"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&this.response_metadata.output_version==="v1")return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&typeof this.response_metadata.model_provider=="string"){let r=SBe(this.response_metadata.model_provider);if(r)return r.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let r=this.content.filter(n=>n.type==="tool_call").map(n=>n.id);for(let n of this.tool_calls)n.id&&!r.includes(n.id)&&e.push({...n,type:"tool_call",id:n.id,name:n.name,args:n.args})}return e}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:Ty(this.content,e.content),additional_kwargs:Fl(this.additional_kwargs,e.additional_kwargs),response_metadata:ome(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 o=Rz(this.tool_call_chunks,e.tool_call_chunks);o!==void 0&&o.length>0&&(r.tool_call_chunks=o)}(this.usage_metadata!==void 0||e.usage_metadata!==void 0)&&(r.usage_metadata=X6(this.usage_metadata,e.usage_metadata));let n=this.constructor;return new n(r)}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}}});function Idn(t){return qL(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 Adn(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function CBe(t){let e,r;if(Adn(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 qs(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new Pn(r);let i=n.map(Idn);return new Pn({...o,tool_calls:i})}else{if(e==="system")return new Od(r);if(e==="developer")return new Od({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Mh({...r,content:r.content,tool_call_id:r.tool_call_id,name:r.name});if(e==="remove"&&"id"in r&&typeof r.id=="string")return new Az({...r,id:r.id});throw FL(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 wS(t){if(typeof t=="string")return new qs(t);if(xg(t))return t;if(Array.isArray(t)){let[e,r]=t;return CBe({type:e,content:r})}else if(eme(t)){let{role:e,...r}=t;return CBe({...r,type:e})}else return CBe(t)}function fl(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o.type==="human")i=e;else if(o.type==="ai")i=r;else if(o.type==="system")i="System";else if(o.type==="tool")i="Tool";else if(o.type==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o.type}`);let a=o.name?`${o.name}, `:"",s=o.text,u=`${i}: ${a}${s}`;if(o.type==="ai"){let l=o;l.tool_calls&&l.tool_calls.length>0?u+=JSON.stringify(l.tool_calls):l.additional_kwargs&&"function_call"in l.additional_kwargs&&(u+=JSON.stringify(l.additional_kwargs.function_call))}n.push(u)}return n.join(`
|
||
`)}function Ndn(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function VQ(t){let e=Ndn(t);switch(e.type){case"human":return new qs(e.data);case"ai":return new Pn(e.data);case"system":return new Od(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new Iz(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Mh(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new Td(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function Rxt(t){return t.map(VQ)}function Ixt(t){return t.map(e=>e.toDict())}function Nz(t){let e=t._getType();if(e==="human")return new rw({...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 Er({...r})}else{if(e==="system")return new Rb({...t});if(e==="function")return new tw({...t});if(Td.isInstance(t))return new ew({...t});throw new Error("Unknown message type.")}}function ame(t){let e=t.reduce((o,i)=>{let a=o.findIndex(([s])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===s.id&&i.index===s.index:"id"in i&&i.id?i.id===s.id:"index"in i&&i.index!==void 0?i.index===s.index:!1);return a!==-1?o[a].push(i):o.push([i]),o},[]),r=[],n=[];for(let o of e){let i=null,a=o[0]?.name??"",s=o.map(c=>c.args||"").join("").trim(),u=s.length?s:"{}",l=o[0]?.id;try{if(i=Mz(u),!l||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");r.push({name:a,args:i,id:l,type:"tool_call"})}catch{n.push({name:a,args:u,id:l,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:r,invalid_tool_calls:n}}var sme,UC=v(()=>{Oy();G6();DQ();Wpe();NQ();UQ();tme();zL();rme();BQ();vS();sme=t=>t()});function TBe(){return xBe===void 0&&(xBe={library:"langchain-js",runtime:lme()}),xBe}function Xr(t){try{return typeof process<"u"?process.env?.[t]:ume()?Deno?.env.get(t):void 0}catch{return}}var Ddn,Axt,Nxt,Dxt,ume,jxt,lme,xBe,au=v(()=>{Jo();Ddn={};$t(Ddn,{getEnv:()=>lme,getEnvironmentVariable:()=>Xr,getRuntimeEnvironment:()=>TBe,isBrowser:()=>Axt,isDeno:()=>ume,isJsDom:()=>Dxt,isNode:()=>jxt,isWebWorker:()=>Nxt});Axt=()=>typeof window<"u"&&typeof window.document<"u",Nxt=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Dxt=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),ume=()=>typeof Deno<"u",jxt=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!ume(),lme=()=>{let t;return Axt()?t="browser":jxt()?t="node":Nxt()?t="webworker":Dxt()?t="jsdom":ume()?t="deno":t="other",t}});var $xt,Lxt=v(()=>{$xt=/^(?:[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 jdn(t){return typeof t=="string"&&$xt.test(t)}var Z6,Fxt=v(()=>{Lxt();Z6=jdn});function dme(t,e=0){return(Tg[t[e+0]]+Tg[t[e+1]]+Tg[t[e+2]]+Tg[t[e+3]]+"-"+Tg[t[e+4]]+Tg[t[e+5]]+"-"+Tg[t[e+6]]+Tg[t[e+7]]+"-"+Tg[t[e+8]]+Tg[t[e+9]]+"-"+Tg[t[e+10]]+Tg[t[e+11]]+Tg[t[e+12]]+Tg[t[e+13]]+Tg[t[e+14]]+Tg[t[e+15]]).toLowerCase()}var Tg,cme,OBe=v(()=>{Tg=[];for(cme=0;cme<256;++cme)Tg.push((cme+256).toString(16).slice(1))});function HQ(){if(!fme&&(fme=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!fme))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fme($dn)}var fme,$dn,EBe=v(()=>{$dn=new Uint8Array(16)});var Ldn,PBe,kxt=v(()=>{Ldn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),PBe={randomUUID:Ldn}});function Fdn(t,e,r){if(PBe.randomUUID&&!e&&!t)return PBe.randomUUID();t=t||{};var n=t.random||(t.rng||HQ)();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 dme(n)}var WQ,qxt=v(()=>{kxt();EBe();OBe();WQ=Fdn});function kdn(t,e,r){t=t||{};var n=e&&r||0,o=e||new Uint8Array(16),i=t.random||(t.rng||HQ)(),a=t.msecs!==void 0?t.msecs:Date.now(),s=t.seq!==void 0?t.seq:null,u=Bxt,l=Uxt;return a>BC&&t.msecs===void 0&&(BC=a,s!==null&&(u=null,l=null)),s!==null&&(s>2147483647&&(s=2147483647),u=s>>>19&4095,l=s&524287),(u===null||l===null)&&(u=i[6]&127,u=u<<8|i[7],l=i[8]&63,l=l<<8|i[9],l=l<<5|i[10]>>>3),a+1e4>BC&&s===null?++l>524287&&(l=0,++u>4095&&(u=0,BC++)):BC=a,Bxt=u,Uxt=l,o[n++]=BC/1099511627776&255,o[n++]=BC/4294967296&255,o[n++]=BC/16777216&255,o[n++]=BC/65536&255,o[n++]=BC/256&255,o[n++]=BC&255,o[n++]=u>>>4&15|112,o[n++]=u&255,o[n++]=l>>>13&63|128,o[n++]=l>>>5&255,o[n++]=l<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||dme(o)}var Uxt,Bxt,BC,XT,zxt=v(()=>{EBe();OBe();Uxt=null,Bxt=null,BC=0;XT=kdn});var JQ=v(()=>{qxt();zxt();Fxt()});function KQ(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Udn,Bdn,Dz,MBe,GQ=v(()=>{Jo();kL();au();JQ();Udn={};$t(Udn,{BaseCallbackHandler:()=>Dz,callbackHandlerPrefersStreaming:()=>KQ,isBaseCallbackHandler:()=>MBe});Bdn=class{};Dz=class extends Bdn{constructor(e){super();x(this,"lc_serializable",!1);x(this,"lc_kwargs");x(this,"ignoreLLM",!1);x(this,"ignoreChain",!1);x(this,"ignoreAgent",!1);x(this,"ignoreRetriever",!1);x(this,"ignoreCustomEvent",!1);x(this,"raiseError",!1);x(this,"awaitHandlers",Xr("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))}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,Hpe(this.constructor)]}copy(){return new this.constructor(this)}toJSON(){return Cg.prototype.toJSON.call(this)}toJSONNotImplemented(){return Cg.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends Dz{constructor(){super();x(this,"name",XT());Object.assign(this,e)}}return new r}},MBe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});var Vxt,Hxt=v(()=>{Vxt=/^(?:[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 zdn(t){return typeof t=="string"&&Vxt.test(t)}var Wxt,Jxt=v(()=>{Hxt();Wxt=zdn});function Vdn(t){if(!Wxt(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var Kxt,Gxt=v(()=>{Jxt();Kxt=Vdn});function Y6(t,e=0){return(Og[t[e+0]]+Og[t[e+1]]+Og[t[e+2]]+Og[t[e+3]]+"-"+Og[t[e+4]]+Og[t[e+5]]+"-"+Og[t[e+6]]+Og[t[e+7]]+"-"+Og[t[e+8]]+Og[t[e+9]]+"-"+Og[t[e+10]]+Og[t[e+11]]+Og[t[e+12]]+Og[t[e+13]]+Og[t[e+14]]+Og[t[e+15]]).toLowerCase()}var Og,pme,mme=v(()=>{Og=[];for(pme=0;pme<256;++pme)Og.push((pme+256).toString(16).slice(1))});function XQ(){if(!hme&&(hme=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hme))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hme(Hdn)}var hme,Hdn,RBe=v(()=>{Hdn=new Uint8Array(16)});function Wdn(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function IBe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=Wdn(o)),typeof i=="string"&&(i=Kxt(i)),((u=i)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(i),l.set(o,i.length),l=r(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,a){s=s||0;for(var c=0;c<16;++c)a[s+c]=l[c];return a}return Y6(l)}try{n.name=t}catch{}return n.DNS=Jdn,n.URL=Kdn,n}var Jdn,Kdn,Xxt=v(()=>{mme();Gxt();Jdn="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Kdn="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var Gdn,ABe,Zxt=v(()=>{Gdn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ABe={randomUUID:Gdn}});function Xdn(t,e,r){if(ABe.randomUUID&&!e&&!t)return ABe.randomUUID();t=t||{};var n=t.random||(t.rng||XQ)();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 Y6(n)}var jz,Yxt=v(()=>{Zxt();RBe();mme();jz=Xdn});function Zdn(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function NBe(t,e){return t<<e|t>>>32-e}function Ydn(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var o=0;o<n.length;++o)t.push(n.charCodeAt(o))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var i=t.length/4+2,a=Math.ceil(i/16),s=new Array(a),u=0;u<a;++u){for(var l=new Uint32Array(16),c=0;c<16;++c)l[c]=t[u*64+c*4]<<24|t[u*64+c*4+1]<<16|t[u*64+c*4+2]<<8|t[u*64+c*4+3];s[u]=l}s[a-1][14]=(t.length-1)*8/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=(t.length-1)*8&4294967295;for(var d=0;d<a;++d){for(var f=new Uint32Array(80),p=0;p<16;++p)f[p]=s[d][p];for(var m=16;m<80;++m)f[m]=NBe(f[m-3]^f[m-8]^f[m-14]^f[m-16],1);for(var h=r[0],y=r[1],g=r[2],b=r[3],_=r[4],w=0;w<80;++w){var T=Math.floor(w/20),O=NBe(h,5)+Zdn(T,y,g,b)+_+e[T]+f[w]>>>0;_=b,b=g,g=NBe(y,30)>>>0,y=h,h=O}r[0]=r[0]+h>>>0,r[1]=r[1]+y>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+_>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Qxt,eTt=v(()=>{Qxt=Ydn});var Qdn,DBe,tTt=v(()=>{Xxt();eTt();Qdn=IBe("v5",80,Qxt),DBe=Qdn});function efn(t,e,r){t=t||{};var n=e&&r||0,o=e||new Uint8Array(16),i=t.random||(t.rng||XQ)(),a=t.msecs!==void 0?t.msecs:Date.now(),s=t.seq!==void 0?t.seq:null,u=nTt,l=rTt;return a>zC&&t.msecs===void 0&&(zC=a,s!==null&&(u=null,l=null)),s!==null&&(s>2147483647&&(s=2147483647),u=s>>>19&4095,l=s&524287),(u===null||l===null)&&(u=i[6]&127,u=u<<8|i[7],l=i[8]&63,l=l<<8|i[9],l=l<<5|i[10]>>>3),a+1e4>zC&&s===null?++l>524287&&(l=0,++u>4095&&(u=0,zC++)):zC=a,nTt=u,rTt=l,o[n++]=zC/1099511627776&255,o[n++]=zC/4294967296&255,o[n++]=zC/16777216&255,o[n++]=zC/65536&255,o[n++]=zC/256&255,o[n++]=zC&255,o[n++]=u>>>4&15|112,o[n++]=u&255,o[n++]=l>>>13&63|128,o[n++]=l>>>5&255,o[n++]=l<<3&255|i[10]&7,o[n++]=i[11],o[n++]=i[12],o[n++]=i[13],o[n++]=i[14],o[n++]=i[15],e||Y6(o)}var rTt,nTt,zC,jBe,oTt=v(()=>{RBe();mme();rTt=null,nTt=null,zC=0;jBe=efn});var gme=v(()=>{Yxt();tTt();oTt()});var iTt,aTt,$Be,sTt,LBe,FBe,kBe,uTt,lTt,cTt,dTt,fTt,pTt,mTt,hTt,gTt,yTt,bTt,_Tt,vTt,wTt,STt,CTt,xTt,TTt,OTt,ETt,PTt,MTt,RTt,qBe,ITt,ATt,NTt=v(()=>{iTt="gen_ai.operation.name",aTt="gen_ai.system",$Be="gen_ai.request.model",sTt="gen_ai.response.model",LBe="gen_ai.usage.input_tokens",FBe="gen_ai.usage.output_tokens",kBe="gen_ai.usage.total_tokens",uTt="gen_ai.request.max_tokens",lTt="gen_ai.request.temperature",cTt="gen_ai.request.top_p",dTt="gen_ai.request.frequency_penalty",fTt="gen_ai.request.presence_penalty",pTt="gen_ai.response.finish_reasons",mTt="gen_ai.prompt",hTt="gen_ai.completion",gTt="gen_ai.request.extra_query",yTt="gen_ai.request.extra_body",bTt="gen_ai.serialized.name",_Tt="gen_ai.serialized.signature",vTt="gen_ai.serialized.doc",wTt="gen_ai.response.id",STt="gen_ai.response.service_tier",CTt="gen_ai.response.system_fingerprint",xTt="gen_ai.usage.input_token_details",TTt="gen_ai.usage.output_token_details",OTt="langsmith.trace.session_id",ETt="langsmith.trace.session_name",PTt="langsmith.span.kind",MTt="langsmith.trace.name",RTt="langsmith.metadata",qBe="langsmith.span.tags",ITt="langsmith.request.streaming",ATt="langsmith.request.headers"});var nfn,ofn,DTt,jTt,$Tt,UBe=v(()=>{BN();nfn=(...t)=>fetch(...t),DTt=Symbol.for("ls:fetch_implementation"),jTt=()=>globalThis[DTt]===void 0?!0:ofn??!1,$Tt=t=>async(...e)=>{if(t||ad("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[DTt]??nfn)(...e);return(t||ad("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var ZQ,BBe=v(()=>{BN();ZQ=()=>ad("PROJECT")??nw("LANGCHAIN_SESSION")??"default"});function $z(t){LTt[t]||(console.warn(t),LTt[t]=!0)}var LTt,yme=v(()=>{LTt={}});function lfn(t){let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=parseInt(t.substring(r,r+2),16);return e}function Ju(t,e=0){return new Uint8Array(t.buffer,t.byteOffset+e,t.length-e)}function pl(t,e=0){return new DataView(t.buffer,t.byteOffset+e).getBigUint64(0,!0)}function Q6(t,e=0){return new DataView(t.buffer,t.byteOffset+e).getUint32(0,!0)}function zBe(t,e=0){return t[e]}function mfn(t,e){return(t<<e|t>>Qe(32)-e)&wme}function HTt(t,e,r){for(let n=0;n<VTt;n++){let o=pl(e,n*8),i=o^pl(r,n*8);t[n^1]+=o,t[n]+=pfn(i,i>>Qe(32))}return t}function FTt(t,e,r,n){for(let o=0;o<n;o++)HTt(t,Ju(e,o*zN),Ju(r,o*8));return t}function hfn(t,e){for(let r=0;r<VTt;r++){let n=pl(e,r*8),o=t[r];o=VBe(o,Qe(47)),o^=n,o*=UTt,t[r]=o&ii}return t}function _me(t,e){return WTt(t[0]^pl(e,0),t[1]^pl(e,cfn))}function kTt(t,e,r){let n=r;return n+=_me(t.slice(0),Ju(e,0*bme)),n+=_me(t.slice(2),Ju(e,4*bme)),n+=_me(t.slice(4),Ju(e,8*bme)),n+=_me(t.slice(6),Ju(e,12*bme)),YT(n&ii)}function gfn(t,e,r,n,o){let i=Math.floor((r.byteLength-zN)/8),a=zN*i,s=Math.floor((e.byteLength-1)/a);for(let u=0;u<s;u++)t=FTt(t,Ju(e,u*a),r,i),t=o(t,Ju(r,r.byteLength-zN));{let u=Math.floor((e.byteLength-1-a*s)/zN);t=FTt(t,Ju(e,s*a),r,u),t=n(t,Ju(e,e.byteLength-zN),Ju(r,r.byteLength-zN-7))}return t}function yfn(t,e,r){let n=new BigUint64Array([ifn,VL,Lz,zTt,WBe,BTt,afn,UTt]);tJ(t.length>128),n=gfn(n,t,e,HTt,hfn),tJ(n.length*8==64);{let o=kTt(n,Ju(e,11),Qe(t.byteLength)*VL&ii);return kTt(n,Ju(e,e.byteLength-zN-11),~(Qe(t.byteLength)*Lz)&ii)<<Qe(64)|o}}function WTt(t,e){let r=t*e&eJ;return r&ii^r>>Qe(64)}function qTt(t,e,r){return WTt((pl(t,0)^pl(e,0)+r)&ii,(pl(t,8)^pl(e,8)-r)&ii)}function vme(t,e,r,n,o){let i=t&ii,a=t>>Qe(64)ⅈreturn i+=qTt(e,n,o),i^=pl(r,0)+pl(r,8),i&=ii,a+=qTt(r,Ju(n,16),o),a^=pl(e,0)+pl(e,8),a&=ii,a<<Qe(64)|i}function YT(t){return t^=t>>Qe(37),t*=sfn,t&=ii,t^=t>>Qe(32),t}function Sme(t){return t^=t>>Qe(33),t*=Lz,t&=ii,t^=t>>Qe(29),t*=zTt,t&=ii,t^=t>>Qe(32),t}function bfn(t,e,r){let n=t.byteLength;tJ(n>0&&n<=3);let o=Qe(zBe(t,n-1))|Qe(n<<8)|Qe(zBe(t,0)<<16)|Qe(zBe(t,n>>1)<<24),i=(Qe(Q6(e,0))^Qe(Q6(e,4)))+r,a=(o^i)&ii,s=(Qe(Q6(e,8))^Qe(Q6(e,12)))-r,u=(mfn(ffn(o),Qe(13))^s)ⅈreturn(Sme(u)&ii)<<Qe(64)|Sme(a)}function VBe(t,e){return t^t>>e}function _fn(t,e,r){let n=t.byteLength;tJ(n>=4&&n<=8);{let o=Q6(t,0),i=Q6(t,n-4),a=Qe(o)|Qe(i)<<Qe(32),s=(pl(e,16)^pl(e,24))+r&ii,l=(a^s)*(VL+(Qe(n)<<Qe(2)))&eJ;return l+=(l&ii)<<Qe(65),l&=eJ,l^=l>>Qe(67),VBe(VBe(l&ii,Qe(35))*ufn&ii,Qe(28))|YT(l>>Qe(64))<<Qe(64)}}function vfn(t,e,r){let n=t.byteLength;tJ(n>=9&&n<=16);{let o=(pl(e,32)^pl(e,40))+r&ii,i=(pl(e,48)^pl(e,56))-r&ii,a=pl(t),s=pl(t,n-8),u=(a^s^o)*VL,l=(u&ii)+(Qe(n-1)<<Qe(54));u=u&(eJ^ii)|l,s^=i,u+=s+(s&wme)*(BTt-Qe(1))<<Qe(64),u&=eJ,u^=dfn(u>>Qe(64));let c=(u&ii)*Lz;return c+=(u>>Qe(64))*Lz<<Qe(64),c&=eJ,YT(c&ii)|YT(c>>Qe(64))<<Qe(64)}}function wfn(t,e){let r=t.byteLength;return tJ(r<=16),r>8?vfn(t,ZT,e):r>=4?_fn(t,ZT,e):r>0?bfn(t,ZT,e):Sme(e^pl(ZT,64)^pl(ZT,72))|Sme(e^pl(ZT,80)^pl(ZT,88))<<Qe(64)}function HBe(t){return~t+Qe(1)&ii}function Sfn(t,e,r){let n=Qe(t.byteLength)*VL&ii,o=Qe(t.byteLength-1)/Qe(32);for(;o>=0;){let s=Number(o);n=vme(n,Ju(t,16*s),Ju(t,t.byteLength-16*(s+1)),Ju(e,32*s),r),o--}let i=n+(n>>Qe(64))ⅈi=YT(i);let a=(n&ii)*VL+(n>>Qe(64))*WBe+(Qe(t.byteLength)-r&ii)*Lz;return a&=ii,a=HBe(YT(a)),i|a<<Qe(64)}function Cfn(t,e,r){let n=Qe(t.byteLength)*VLⅈfor(let a=32;a<160;a+=32)n=vme(n,Ju(t,a-32),Ju(t,a-16),Ju(e,a-32),r);n=YT(n&ii)|YT(n>>Qe(64))<<Qe(64);for(let a=160;a<=t.byteLength;a+=32)n=vme(n,Ju(t,a-32),Ju(t,a-16),Ju(e,3+a-160),r);n=vme(n,Ju(t,t.byteLength-16),Ju(t,t.byteLength-32),Ju(e,103),HBe(r));let o=n+(n>>Qe(64))ⅈo=YT(o);let i=(n&ii)*VL+(n>>Qe(64))*WBe+(Qe(t.byteLength)-r&ii)*Lz;return i&=ii,i=HBe(YT(i)),o|i<<Qe(64)}function JTt(t,e=Qe(0)){let r=t.byteLength;return r<=16?wfn(t,e):r<=128?Sfn(t,ZT,e):r<=240?Cfn(t,ZT,e):yfn(t,ZT,e)}function KTt(t){let e=new Uint8Array(16),r=new DataView(e.buffer),n=t&ii,o=t>>Qe(64);return r.setBigUint64(0,o,!1),r.setBigUint64(8,n,!1),e}var Qe,UTt,BTt,ifn,VL,Lz,zTt,WBe,afn,sfn,ufn,ZT,eJ,ii,wme,zN,VTt,cfn,bme,dfn,ffn,pfn,tJ,GTt=v(()=>{Qe=t=>BigInt(t),UTt=Qe("0x9E3779B1"),BTt=Qe("0x85EBCA77"),ifn=Qe("0xC2B2AE3D"),VL=Qe("0x9E3779B185EBCA87"),Lz=Qe("0xC2B2AE3D27D4EB4F"),zTt=Qe("0x165667B19E3779F9"),WBe=Qe("0x85EBCA77C2B2AE63"),afn=Qe("0x27D4EB2F165667C5"),sfn=Qe("0x165667919E3779F9"),ufn=Qe("0x9FB21C651E98DF25");ZT=lfn("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),eJ=(Qe(1)<<Qe(128))-Qe(1),ii=(Qe(1)<<Qe(64))-Qe(1),wme=(Qe(1)<<Qe(32))-Qe(1),zN=64,VTt=zN/8,cfn=8,bme=4;dfn=t=>(t&Qe(255))<<Qe(56)|(t&Qe(65280))<<Qe(40)|(t&Qe(16711680))<<Qe(24)|(t&Qe(4278190080))<<Qe(8)|(t&Qe(0xff00000000))>>Qe(8)|(t&Qe(0xff0000000000))>>Qe(24)|(t&Qe(0xff000000000000))>>Qe(40)|(t&Qe(0xff00000000000000))>>Qe(56),ffn=t=>(t=(t&Qe(65535))<<Qe(16)|(t&Qe(4294901760))>>Qe(16),t=(t&Qe(16711935))<<Qe(8)|(t&Qe(4278255360))>>Qe(8),t),pfn=(t,e)=>(t&wme)*(e&wme)&ii,tJ=t=>{if(!t)throw new Error("Assert failed")}});function Ao(t,e){if(!XTt.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function Cme(t){let e=typeof t=="string"?Date.parse(t):t;return jBe({msecs:e,seq:0})}function xfn(t){if(!XTt.test(t))return null;let e=t[14];return parseInt(e,16)}function Tfn(t){let e=t.replace(/-/g,""),r=new Uint8Array(16);for(let n=0;n<16;n++)r[n]=parseInt(e.slice(n*2,n*2+2),16);return r}function Ofn(t){let e=Array.from(t).map(r=>r.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function Pfn(t){let e=Efn.encode(t),r=JTt(e);return KTt(r)}function YQ(t,e){let r=`${t}:${e}`,n=Pfn(r),o=new Uint8Array(16);if(xfn(t)===7){let a=Tfn(t);o.set(a.slice(0,6),0)}else{let a=Date.now();o[0]=a/1099511627776&255,o[1]=a/4294967296&255,o[2]=a/16777216&255,o[3]=a/65536&255,o[4]=a/256&255,o[5]=a&255}return o[6]=112|n[0]&15,o[7]=n[1],o[8]=128|n[2]&63,o.set(n.slice(3,10),9),Ofn(o)}var XTt,Efn,xme=v(()=>{gme();yme();GTt();XTt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Efn=new TextEncoder});var ZTt=v(()=>{xme()});function YTt(t,e){throw new Error("dump() is not supported in browser environments.")}function QTt(t){throw new Error("load() is not supported in browser environments.")}var eOt=v(()=>{});function Mfn(t,e){return e===null?!1:Date.now()-t.createdAt>e*1e3}var Tme,Ome,JBe=v(()=>{eOt();Tme=class{constructor(e={}){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ttlSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshIntervalSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_metrics",{enumerable:!0,configurable:!0,writable:!0,value:{hits:0,misses:0,refreshes:0,refreshErrors:0}}),this.configure(e)}get metrics(){return{...this._metrics}}get totalRequests(){return this._metrics.hits+this._metrics.misses}get hitRate(){let e=this.totalRequests;return e>0?this._metrics.hits/e:0}resetMetrics(){this._metrics={hits:0,misses:0,refreshes:0,refreshErrors:0}}get(e,r){if(this.maxSize===0)return;let n=this.cache.get(e);if(!n){this._metrics.misses+=1;return}return this.cache.delete(e),this.cache.set(e,{...n,refreshFunc:r}),this._metrics.hits+=1,n.value}set(e,r,n){if(this.maxSize===0)return;if(this.refreshTimer===void 0&&this.startRefreshLoop(),!this.cache.has(e)&&this.cache.size>=this.maxSize){let i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}let o={value:r,createdAt:Date.now(),refreshFunc:n};this.cache.delete(e),this.cache.set(e,o)}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}stop(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=void 0)}dump(e){let r={};for(let[n,o]of this.cache.entries())r[n]=o.value;YTt(e,r)}load(e){let r=QTt(e);if(!r)return 0;let n=0,o=Date.now();for(let[i,a]of Object.entries(r)){if(this.cache.size>=this.maxSize)break;let s={value:a,createdAt:o};this.cache.set(i,s),n+=1}return n}startRefreshLoop(){this.stop(),this.ttlSeconds!==null&&(this.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(e=>{console.warn("Unexpected error in cache refresh loop:",e)})},this.refreshIntervalSeconds*1e3),this.refreshTimer.unref&&this.refreshTimer.unref())}getStaleEntries(){let e=[];for(let[r,n]of this.cache.entries())Mfn(n,this.ttlSeconds)&&e.push([r,n]);return e}async refreshStaleEntries(){let e=this.getStaleEntries();if(e.length!==0){for(let[r,n]of e)if(n.refreshFunc!==void 0)try{let o=await n.refreshFunc();this.set(r,o,n.refreshFunc),this._metrics.refreshes+=1}catch(o){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${r}:`,o)}}}configure(e){this.stop(),this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??5*60}},Ome=new Tme});var Eme,Pme=v(()=>{KBe();GBe();UBe();BBe();ZTt();JBe();Eme="0.5.4"});function Mme(){if(XBe===void 0){let t=YBe(),e=jfn();XBe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:Eme,...e}}return XBe}function QBe(){let t=Dfn(),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))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 Dfn(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,r]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&r!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof r=="string"?t[e]=r.slice(0,2)+"*".repeat(r.length-4)+r.slice(-2):t[e]=r)}catch{}return t}function nw(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function ad(t){return nw(`LANGSMITH_${t}`)||nw(`LANGCHAIN_${t}`)}function jfn(){if(ZBe!==void 0)return ZBe;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=nw(r);n!==void 0&&(e[r]=n)}return ZBe=e,e}function Rme(){return nw("OTEL_ENABLED")==="true"||ad("OTEL_ENABLED")==="true"}var QT,Rfn,Ifn,Afn,tOt,Nfn,YBe,XBe,ZBe,BN=v(()=>{Pme();Rfn=()=>typeof window<"u"&&typeof window.document<"u",Ifn=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Afn=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),tOt=()=>typeof Deno<"u",Nfn=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!tOt(),YBe=()=>QT||(typeof Bun<"u"?QT="bun":Rfn()?QT="browser":Nfn()?QT="node":Ifn()?QT="webworker":Afn()?QT="jsdom":tOt()?QT="deno":QT="other",QT)});function Ime(){return aze.getTraceInstance()}function nOt(){return aze.getContextInstance()}function oOt(){return aze.getDefaultOTLPTracerComponents()}var rze,nze,oze,eze,tze,rOt,$fn,Lfn,ize,aze,sze=v(()=>{BN();rze=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&Rme()&&(console.warn('You have enabled OTEL export via the `OTEL_ENABLED` or `LANGSMITH_OTEL_ENABLED` environment variable, but have not initialized the required OTEL instances. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0);let n;if(r.length===1&&typeof r[0]=="function"?n=r[0]:r.length===2&&typeof r[1]=="function"?n=r[1]:r.length===3&&typeof r[2]=="function"&&(n=r[2]),typeof n=="function")return n()}},nze=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new rze})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},oze=class{active(){return{}}with(e,r){return r()}},eze=Symbol.for("ls:otel_trace"),tze=Symbol.for("ls:otel_context"),rOt=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),$fn=new nze,Lfn=new oze,ize=class{getTraceInstance(){return globalThis[eze]??$fn}getContextInstance(){return globalThis[tze]??Lfn}initializeGlobalInstances(e){globalThis[eze]===void 0&&(globalThis[eze]=e.trace),globalThis[tze]===void 0&&(globalThis[tze]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[rOt]=e}getDefaultOTLPTracerComponents(){return globalThis[rOt]??void 0}},aze=new ize});function kfn(t){return Ffn[t]||t}var Ffn,Ame,iOt=v(()=>{NTt();sze();Ffn={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};Ame=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,r){for(let n of e)try{if(!n.run)continue;if(n.operation==="post"){let o=this.createSpanForRun(n,n.run,r.get(n.id));o&&!n.run.end_time&&this.spans.set(n.id,o)}else this.updateSpanForRun(n,n.run)}catch(o){console.error(`Error processing operation ${n.id}:`,o)}}createSpanForRun(e,r,n){let o=n&&Ime().getSpan(n);if(o)try{return this.finishSpanSetup(o,r,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,r,n){return this.setSpanAttributes(e,r,n),r.error?(e.setStatus({code:2}),e.recordException(new Error(r.error))):e.setStatus({code:1}),r.end_time&&e.end(new Date(r.end_time)),e}updateSpanForRun(e,r){try{let n=this.spans.get(e.id);if(!n){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(n,r,e),r.error?(n.setStatus({code:2}),n.recordException(new Error(r.error))):n.setStatus({code:1});let o=r.end_time;o&&(n.end(new Date(o)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){let r=e.extra.metadata;if(r.ls_model_name)return r.ls_model_name;if(r.invocation_params){let n=r.invocation_params;if(n.model)return n.model;if(n.model_name)return n.model_name}}}setSpanAttributes(e,r,n){if("run_type"in r&&r.run_type){e.setAttribute(PTt,r.run_type);let s=kfn(r.run_type||"chain");e.setAttribute(iTt,s)}"name"in r&&r.name&&e.setAttribute(MTt,r.name),"session_id"in r&&r.session_id&&e.setAttribute(OTt,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(ETt,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute($Be,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(LBe,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(FBe,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(kBe,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${RTt}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(qBe,a.join(", ")):a&&e.setAttribute(qBe,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(bTt,String(s.name)),s.signature&&e.setAttribute(_Tt,String(s.signature)),s.doc&&e.setAttribute(vTt,String(s.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,r){let n="langchain",o=this.extractModelName(r);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?n="anthropic":i.includes("bedrock")?n="aws.bedrock":i.includes("azure")&&i.includes("openai")?n="az.ai.openai":i.includes("azure")&&i.includes("inference")?n="az.ai.inference":i.includes("cohere")?n="cohere":i.includes("deepseek")?n="deepseek":i.includes("gemini")?n="gemini":i.includes("groq")?n="groq":i.includes("watson")||i.includes("ibm")?n="ibm.watsonx.ai":i.includes("mistral")?n="mistral_ai":i.includes("gpt")||i.includes("openai")?n="openai":i.includes("perplexity")||i.includes("sonar")?n="perplexity":i.includes("vertex")?n="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(n="xai")}e.setAttribute(aTt,n)}setInvocationParameters(e,r){if(!r.extra?.metadata?.invocation_params)return;let n=r.extra.metadata.invocation_params;n.max_tokens!==void 0&&e.setAttribute(uTt,n.max_tokens),n.temperature!==void 0&&e.setAttribute(lTt,n.temperature),n.top_p!==void 0&&e.setAttribute(cTt,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(dTt,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(fTt,n.presence_penalty)}setIOAttributes(e,r){if(r.run.inputs)try{let n=r.run.inputs;typeof n=="object"&&n!==null&&(n.model&&Array.isArray(n.messages)&&e.setAttribute($Be,n.model),n.stream!==void 0&&e.setAttribute(ITt,n.stream),n.extra_headers&&e.setAttribute(ATt,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(gTt,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(yTt,JSON.stringify(n.extra_body))),e.setAttribute(mTt,JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${r.id}`,n)}if(r.run.outputs)try{let n=r.run.outputs,o=this.getUnifiedRunTokens(n);if(o&&(e.setAttribute(LBe,o[0]),e.setAttribute(FBe,o[1]),e.setAttribute(kBe,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(sTt,String(n.model)),n.id&&e.setAttribute(wTt,n.id),n.choices&&Array.isArray(n.choices)){let i=n.choices.map(a=>a.finish_reason).filter(a=>a).map(String);i.length>0&&e.setAttribute(pTt,i.join(", "))}if(n.service_tier&&e.setAttribute(STt,n.service_tier),n.system_fingerprint&&e.setAttribute(CTt,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(xTt,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(TTt,JSON.stringify(i.output_token_details))}}e.setAttribute(hTt,JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${r.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let r=this.extractUnifiedRunTokens(e.usage_metadata);if(r)return r;let n=Object.keys(e);for(let a of n){let s=e[a];if(!(!s||typeof s!="object")&&(r=this.extractUnifiedRunTokens(s.usage_metadata),r||s.lc===1&&s.kwargs&&typeof s.kwargs=="object"&&(r=this.extractUnifiedRunTokens(s.kwargs.usage_metadata),r)))return r}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let a of i)if(typeof a=="object"&&a.message&&typeof a.message=="object"&&a.message.kwargs&&typeof a.message.kwargs=="object"&&(r=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),r))return r;return null}extractUnifiedRunTokens(e){return!e||typeof e!="object"||typeof e.input_tokens!="number"||typeof e.output_tokens!="number"?null:[e.input_tokens,e.output_tokens]}}});function uze(t){if(!(t&&Ufn(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:Bfn.has(r)}var qfn,Ufn,Bfn,aOt=v(()=>{qfn=Object.prototype.toString,Ufn=t=>qfn.call(t)==="[object Error]",Bfn=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"])});function zfn(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function Nme(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e<r)throw new TypeError(`Expected \`${t}\` to be \u2265 ${r}.`)}}function Vfn(t,e){let r=Math.max(1,t+1),n=e.randomize?Math.random()+1:1,o=Math.round(n*e.minTimeout*e.factor**(r-1));return o=Math.min(o,e.maxTimeout),o}function sOt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function Hfn({error:t,attemptNumber:e,retriesConsumed:r,startTime:n,options:o}){let i=t instanceof Error?t:new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(i instanceof lze)throw i.originalError;let a=Number.isFinite(o.retries)?Math.max(0,o.retries-r):o.retries,s=o.maxRetryTime??Number.POSITIVE_INFINITY,u=Object.freeze({error:i,attemptNumber:e,retriesLeft:a,retriesConsumed:r});if(await o.onFailedAttempt(u),sOt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=sOt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!uze(i)){if(l)throw i;return o.signal?.throwIfAborted(),!1}if(!await o.shouldRetry(u))throw i;if(!l)return o.signal?.throwIfAborted(),!1;let d=Vfn(r,o),f=Math.min(d,c);return f>0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(y),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},y=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&y.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function cze(t,e={}){if(e={...e},zfn(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??(e.retries=10),e.factor??(e.factor=2),e.minTimeout??(e.minTimeout=1e3),e.maxTimeout??(e.maxTimeout=Number.POSITIVE_INFINITY),e.maxRetryTime??(e.maxRetryTime=Number.POSITIVE_INFINITY),e.randomize??(e.randomize=!1),e.onFailedAttempt??(e.onFailedAttempt=()=>{}),e.shouldRetry??(e.shouldRetry=()=>!0),e.shouldConsumeRetry??(e.shouldConsumeRetry=()=>!0),Nme("factor",e.factor,{min:0,allowInfinity:!1}),Nme("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Nme("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Nme("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await Hfn({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var lze,uOt=v(()=>{aOt();lze=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}}});var fze=S((REi,dze)=>{"use strict";var Wfn=Object.prototype.hasOwnProperty,Ib="~";function QQ(){}Object.create&&(QQ.prototype=Object.create(null),new QQ().__proto__||(Ib=!1));function Jfn(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function lOt(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new Jfn(r,n||t,o),a=Ib?Ib+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 Dme(t,e){--t._eventsCount===0?t._events=new QQ:delete t._events[e]}function Ey(){this._events=new QQ,this._eventsCount=0}Ey.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Wfn.call(r,n)&&e.push(Ib?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Ey.prototype.listeners=function(e){var r=Ib?Ib+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};Ey.prototype.listenerCount=function(e){var r=Ib?Ib+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Ey.prototype.emit=function(e,r,n,o,i,a){var s=Ib?Ib+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};Ey.prototype.on=function(e,r,n){return lOt(this,e,r,n,!1)};Ey.prototype.once=function(e,r,n){return lOt(this,e,r,n,!0)};Ey.prototype.removeListener=function(e,r,n,o){var i=Ib?Ib+e:e;if(!this._events[i])return this;if(!r)return Dme(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&Dme(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:Dme(this,i)}return this};Ey.prototype.removeAllListeners=function(e){var r;return e?(r=Ib?Ib+e:e,this._events[r]&&Dme(this,r)):(this._events=new QQ,this._eventsCount=0),this};Ey.prototype.off=Ey.prototype.removeListener;Ey.prototype.addListener=Ey.prototype.on;Ey.prefixed=Ib;Ey.EventEmitter=Ey;typeof dze<"u"&&(dze.exports=Ey)});var pze=S((IEi,cOt)=>{"use strict";cOt.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 fOt=S((AEi,$me)=>{"use strict";var Kfn=pze(),jme=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},dOt=(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 jme(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);Kfn(t.then(n,o),()=>{clearTimeout(i)})});$me.exports=dOt;$me.exports.default=dOt;$me.exports.TimeoutError=jme});var pOt=S(mze=>{"use strict";Object.defineProperty(mze,"__esModule",{value:!0});function Gfn(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}mze.default=Gfn});var mOt=S(gze=>{"use strict";Object.defineProperty(gze,"__esModule",{value:!0});var Xfn=pOt(),hze=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=Xfn.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}};gze.default=hze});var gOt=S(bze=>{"use strict";Object.defineProperty(bze,"__esModule",{value:!0});var Zfn=fze(),hOt=fOt(),Yfn=mOt(),Lme=()=>{},Qfn=new hOt.TimeoutError,yze=class extends Zfn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Lme,this._resolveIdle=Lme,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Yfn.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=Lme,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Lme,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():hOt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Qfn)});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}};bze.default=yze});var Fme,yOt,bOt=v(()=>{Fme=$(gOt(),1),yOt="default"in Fme.default?Fme.default.default:Fme.default});var epn,eee,_Ot=v(()=>{uOt();bOt();epn=[408,425,429,500,502,503,504],eee=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,"maxQueueSizeBytes",{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,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,this.queue=new yOt({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){return this.callWithOptions({},e,...r)}callWithOptions(e,r,...n){let o=e.sizeBytes??0;if(this.maxQueueSizeBytes!==void 0&&o>0&&this.queueSizeBytes+o>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${o} bytes.`));o>0&&(this.queueSizeBytes+=o);let i=this.onFailedResponseHook,a=this.queue.add(()=>cze(()=>r(...n).catch(s=>{throw s instanceof Error?s:new Error(s)}),{async onFailedAttempt({error:s}){if(typeof s!="object"||s==null)throw s;let u="message"in s&&typeof s.message=="string"?s.message:void 0;if(u?.startsWith("Cancel")||u?.startsWith("TimeoutError")||u?.startsWith("AbortError")||"name"in s&&s.name==="TimeoutError"||"code"in s&&s.code==="ECONNABORTED")throw s;let l="response"in s?s.response:void 0;if(i&&await i(l))return;let c=l?.status??("status"in s?s.status:void 0);if(c!=null&&(typeof c=="number"||typeof c=="string")&&!epn.includes(+c))throw s},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(a=a.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([a,new Promise((s,u)=>{e.signal?.addEventListener("abort",()=>{u(new Error("AbortError"))})})]):a}}});function _ze(t){return typeof t?._getType=="function"}function vze(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 vOt=v(()=>{});var tee=S((UEi,wOt)=>{"use strict";var tpn="2.0.0",rpn=Number.MAX_SAFE_INTEGER||9007199254740991,npn=16,opn=250,ipn=["major","premajor","minor","preminor","patch","prepatch","prerelease"];wOt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:npn,MAX_SAFE_BUILD_LENGTH:opn,MAX_SAFE_INTEGER:rpn,RELEASE_TYPES:ipn,SEMVER_SPEC_VERSION:tpn,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ree=S((BEi,SOt)=>{"use strict";var apn=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};SOt.exports=apn});var rJ=S((eO,COt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:wze,MAX_SAFE_BUILD_LENGTH:spn,MAX_LENGTH:upn}=tee(),lpn=ree();eO=COt.exports={};var cpn=eO.re=[],dpn=eO.safeRe=[],wr=eO.src=[],fpn=eO.safeSrc=[],Sr=eO.t={},ppn=0,Sze="[a-zA-Z0-9-]",mpn=[["\\s",1],["\\d",upn],[Sze,spn]],hpn=t=>{for(let[e,r]of mpn)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Fo=(t,e,r)=>{let n=hpn(e),o=ppn++;lpn(t,o,e),Sr[t]=o,wr[o]=e,fpn[o]=n,cpn[o]=new RegExp(e,r?"g":void 0),dpn[o]=new RegExp(n,r?"g":void 0)};Fo("NUMERICIDENTIFIER","0|[1-9]\\d*");Fo("NUMERICIDENTIFIERLOOSE","\\d+");Fo("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Sze}*`);Fo("MAINVERSION",`(${wr[Sr.NUMERICIDENTIFIER]})\\.(${wr[Sr.NUMERICIDENTIFIER]})\\.(${wr[Sr.NUMERICIDENTIFIER]})`);Fo("MAINVERSIONLOOSE",`(${wr[Sr.NUMERICIDENTIFIERLOOSE]})\\.(${wr[Sr.NUMERICIDENTIFIERLOOSE]})\\.(${wr[Sr.NUMERICIDENTIFIERLOOSE]})`);Fo("PRERELEASEIDENTIFIER",`(?:${wr[Sr.NONNUMERICIDENTIFIER]}|${wr[Sr.NUMERICIDENTIFIER]})`);Fo("PRERELEASEIDENTIFIERLOOSE",`(?:${wr[Sr.NONNUMERICIDENTIFIER]}|${wr[Sr.NUMERICIDENTIFIERLOOSE]})`);Fo("PRERELEASE",`(?:-(${wr[Sr.PRERELEASEIDENTIFIER]}(?:\\.${wr[Sr.PRERELEASEIDENTIFIER]})*))`);Fo("PRERELEASELOOSE",`(?:-?(${wr[Sr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${wr[Sr.PRERELEASEIDENTIFIERLOOSE]})*))`);Fo("BUILDIDENTIFIER",`${Sze}+`);Fo("BUILD",`(?:\\+(${wr[Sr.BUILDIDENTIFIER]}(?:\\.${wr[Sr.BUILDIDENTIFIER]})*))`);Fo("FULLPLAIN",`v?${wr[Sr.MAINVERSION]}${wr[Sr.PRERELEASE]}?${wr[Sr.BUILD]}?`);Fo("FULL",`^${wr[Sr.FULLPLAIN]}$`);Fo("LOOSEPLAIN",`[v=\\s]*${wr[Sr.MAINVERSIONLOOSE]}${wr[Sr.PRERELEASELOOSE]}?${wr[Sr.BUILD]}?`);Fo("LOOSE",`^${wr[Sr.LOOSEPLAIN]}$`);Fo("GTLT","((?:<|>)?=?)");Fo("XRANGEIDENTIFIERLOOSE",`${wr[Sr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Fo("XRANGEIDENTIFIER",`${wr[Sr.NUMERICIDENTIFIER]}|x|X|\\*`);Fo("XRANGEPLAIN",`[v=\\s]*(${wr[Sr.XRANGEIDENTIFIER]})(?:\\.(${wr[Sr.XRANGEIDENTIFIER]})(?:\\.(${wr[Sr.XRANGEIDENTIFIER]})(?:${wr[Sr.PRERELEASE]})?${wr[Sr.BUILD]}?)?)?`);Fo("XRANGEPLAINLOOSE",`[v=\\s]*(${wr[Sr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wr[Sr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${wr[Sr.XRANGEIDENTIFIERLOOSE]})(?:${wr[Sr.PRERELEASELOOSE]})?${wr[Sr.BUILD]}?)?)?`);Fo("XRANGE",`^${wr[Sr.GTLT]}\\s*${wr[Sr.XRANGEPLAIN]}$`);Fo("XRANGELOOSE",`^${wr[Sr.GTLT]}\\s*${wr[Sr.XRANGEPLAINLOOSE]}$`);Fo("COERCEPLAIN",`(^|[^\\d])(\\d{1,${wze}})(?:\\.(\\d{1,${wze}}))?(?:\\.(\\d{1,${wze}}))?`);Fo("COERCE",`${wr[Sr.COERCEPLAIN]}(?:$|[^\\d])`);Fo("COERCEFULL",wr[Sr.COERCEPLAIN]+`(?:${wr[Sr.PRERELEASE]})?(?:${wr[Sr.BUILD]})?(?:$|[^\\d])`);Fo("COERCERTL",wr[Sr.COERCE],!0);Fo("COERCERTLFULL",wr[Sr.COERCEFULL],!0);Fo("LONETILDE","(?:~>?)");Fo("TILDETRIM",`(\\s*)${wr[Sr.LONETILDE]}\\s+`,!0);eO.tildeTrimReplace="$1~";Fo("TILDE",`^${wr[Sr.LONETILDE]}${wr[Sr.XRANGEPLAIN]}$`);Fo("TILDELOOSE",`^${wr[Sr.LONETILDE]}${wr[Sr.XRANGEPLAINLOOSE]}$`);Fo("LONECARET","(?:\\^)");Fo("CARETTRIM",`(\\s*)${wr[Sr.LONECARET]}\\s+`,!0);eO.caretTrimReplace="$1^";Fo("CARET",`^${wr[Sr.LONECARET]}${wr[Sr.XRANGEPLAIN]}$`);Fo("CARETLOOSE",`^${wr[Sr.LONECARET]}${wr[Sr.XRANGEPLAINLOOSE]}$`);Fo("COMPARATORLOOSE",`^${wr[Sr.GTLT]}\\s*(${wr[Sr.LOOSEPLAIN]})$|^$`);Fo("COMPARATOR",`^${wr[Sr.GTLT]}\\s*(${wr[Sr.FULLPLAIN]})$|^$`);Fo("COMPARATORTRIM",`(\\s*)${wr[Sr.GTLT]}\\s*(${wr[Sr.LOOSEPLAIN]}|${wr[Sr.XRANGEPLAIN]})`,!0);eO.comparatorTrimReplace="$1$2$3";Fo("HYPHENRANGE",`^\\s*(${wr[Sr.XRANGEPLAIN]})\\s+-\\s+(${wr[Sr.XRANGEPLAIN]})\\s*$`);Fo("HYPHENRANGELOOSE",`^\\s*(${wr[Sr.XRANGEPLAINLOOSE]})\\s+-\\s+(${wr[Sr.XRANGEPLAINLOOSE]})\\s*$`);Fo("STAR","(<|>)?=?\\s*\\*");Fo("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Fo("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var kme=S((zEi,xOt)=>{"use strict";var gpn=Object.freeze({loose:!0}),ypn=Object.freeze({}),bpn=t=>t?typeof t!="object"?gpn:t:ypn;xOt.exports=bpn});var Cze=S((VEi,EOt)=>{"use strict";var TOt=/^[0-9]+$/,OOt=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=TOt.test(t),n=TOt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},_pn=(t,e)=>OOt(e,t);EOt.exports={compareIdentifiers:OOt,rcompareIdentifiers:_pn}});var Py=S((HEi,MOt)=>{"use strict";var qme=ree(),{MAX_LENGTH:POt,MAX_SAFE_INTEGER:Ume}=tee(),{safeRe:Bme,t:zme}=rJ(),vpn=kme(),{compareIdentifiers:xze}=Cze(),Tze=class t{constructor(e,r){if(r=vpn(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>POt)throw new TypeError(`version is longer than ${POt} characters`);qme("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Bme[zme.LOOSE]:Bme[zme.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>Ume||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ume||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ume||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<Ume)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(qme("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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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(qme("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 xze(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(qme("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 xze(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Bme[zme.PRERELEASELOOSE]:Bme[zme.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}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"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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(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]),xze(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}};MOt.exports=Tze});var kz=S((WEi,IOt)=>{"use strict";var ROt=Py(),wpn=(t,e,r=!1)=>{if(t instanceof ROt)return t;try{return new ROt(t,e)}catch(n){if(!r)return null;throw n}};IOt.exports=wpn});var NOt=S((JEi,AOt)=>{"use strict";var Spn=kz(),Cpn=(t,e)=>{let r=Spn(t,e);return r?r.version:null};AOt.exports=Cpn});var jOt=S((KEi,DOt)=>{"use strict";var xpn=kz(),Tpn=(t,e)=>{let r=xpn(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};DOt.exports=Tpn});var FOt=S((GEi,LOt)=>{"use strict";var $Ot=Py(),Opn=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new $Ot(t instanceof $Ot?t.version:t,r).inc(e,n,o).version}catch{return null}};LOt.exports=Opn});var UOt=S((XEi,qOt)=>{"use strict";var kOt=kz(),Epn=(t,e)=>{let r=kOt(t,null,!0),n=kOt(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){if(!s.patch&&!s.minor)return"major";if(s.compareMain(a)===0)return s.minor&&!s.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"};qOt.exports=Epn});var zOt=S((ZEi,BOt)=>{"use strict";var Ppn=Py(),Mpn=(t,e)=>new Ppn(t,e).major;BOt.exports=Mpn});var HOt=S((YEi,VOt)=>{"use strict";var Rpn=Py(),Ipn=(t,e)=>new Rpn(t,e).minor;VOt.exports=Ipn});var JOt=S((QEi,WOt)=>{"use strict";var Apn=Py(),Npn=(t,e)=>new Apn(t,e).patch;WOt.exports=Npn});var GOt=S((ePi,KOt)=>{"use strict";var Dpn=kz(),jpn=(t,e)=>{let r=Dpn(t,e);return r&&r.prerelease.length?r.prerelease:null};KOt.exports=jpn});var SS=S((tPi,ZOt)=>{"use strict";var XOt=Py(),$pn=(t,e,r)=>new XOt(t,r).compare(new XOt(e,r));ZOt.exports=$pn});var QOt=S((rPi,YOt)=>{"use strict";var Lpn=SS(),Fpn=(t,e,r)=>Lpn(e,t,r);YOt.exports=Fpn});var tEt=S((nPi,eEt)=>{"use strict";var kpn=SS(),qpn=(t,e)=>kpn(t,e,!0);eEt.exports=qpn});var Vme=S((oPi,nEt)=>{"use strict";var rEt=Py(),Upn=(t,e,r)=>{let n=new rEt(t,r),o=new rEt(e,r);return n.compare(o)||n.compareBuild(o)};nEt.exports=Upn});var iEt=S((iPi,oEt)=>{"use strict";var Bpn=Vme(),zpn=(t,e)=>t.sort((r,n)=>Bpn(r,n,e));oEt.exports=zpn});var sEt=S((aPi,aEt)=>{"use strict";var Vpn=Vme(),Hpn=(t,e)=>t.sort((r,n)=>Vpn(n,r,e));aEt.exports=Hpn});var nee=S((sPi,uEt)=>{"use strict";var Wpn=SS(),Jpn=(t,e,r)=>Wpn(t,e,r)>0;uEt.exports=Jpn});var Hme=S((uPi,lEt)=>{"use strict";var Kpn=SS(),Gpn=(t,e,r)=>Kpn(t,e,r)<0;lEt.exports=Gpn});var Oze=S((lPi,cEt)=>{"use strict";var Xpn=SS(),Zpn=(t,e,r)=>Xpn(t,e,r)===0;cEt.exports=Zpn});var Eze=S((cPi,dEt)=>{"use strict";var Ypn=SS(),Qpn=(t,e,r)=>Ypn(t,e,r)!==0;dEt.exports=Qpn});var Wme=S((dPi,fEt)=>{"use strict";var emn=SS(),tmn=(t,e,r)=>emn(t,e,r)>=0;fEt.exports=tmn});var Jme=S((fPi,pEt)=>{"use strict";var rmn=SS(),nmn=(t,e,r)=>rmn(t,e,r)<=0;pEt.exports=nmn});var Pze=S((pPi,mEt)=>{"use strict";var omn=Oze(),imn=Eze(),amn=nee(),smn=Wme(),umn=Hme(),lmn=Jme(),cmn=(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 omn(t,r,n);case"!=":return imn(t,r,n);case">":return amn(t,r,n);case">=":return smn(t,r,n);case"<":return umn(t,r,n);case"<=":return lmn(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};mEt.exports=cmn});var gEt=S((mPi,hEt)=>{"use strict";var dmn=Py(),fmn=kz(),{safeRe:Kme,t:Gme}=rJ(),pmn=(t,e)=>{if(t instanceof dmn)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?Kme[Gme.COERCEFULL]:Kme[Gme.COERCE]);else{let u=e.includePrerelease?Kme[Gme.COERCERTLFULL]:Kme[Gme.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 fmn(`${n}.${o}.${i}${a}${s}`,e)};hEt.exports=pmn});var bEt=S((hPi,yEt)=>{"use strict";var Mze=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}};yEt.exports=Mze});var CS=S((gPi,SEt)=>{"use strict";var mmn=/\s+/g,Rze=class t{constructor(e,r){if(r=gmn(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Ize)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(mmn," "),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=>!vEt(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&&Cmn(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&&wmn)|(this.options.loose&&Smn))+":"+e,o=_Et.get(n);if(o)return o;let i=this.options.loose,a=i?Ab[My.HYPHENRANGELOOSE]:Ab[My.HYPHENRANGE];e=e.replace(a,Nmn(this.options.includePrerelease)),ml("hyphen replace",e),e=e.replace(Ab[My.COMPARATORTRIM],bmn),ml("comparator trim",e),e=e.replace(Ab[My.TILDETRIM],_mn),ml("tilde trim",e),e=e.replace(Ab[My.CARETTRIM],vmn),ml("caret trim",e);let s=e.split(" ").map(d=>xmn(d,this.options)).join(" ").split(/\s+/).map(d=>Amn(d,this.options));i&&(s=s.filter(d=>(ml("loose invalid filter",d,this.options),!!d.match(Ab[My.COMPARATORLOOSE])))),ml("range list",s);let u=new Map,l=s.map(d=>new Ize(d,this.options));for(let d of l){if(vEt(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return _Et.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>wEt(n,r)&&e.set.some(o=>wEt(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 ymn(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Dmn(this.set[r],e,this.options))return!0;return!1}};SEt.exports=Rze;var hmn=bEt(),_Et=new hmn,gmn=kme(),Ize=oee(),ml=ree(),ymn=Py(),{safeRe:Ab,t:My,comparatorTrimReplace:bmn,tildeTrimReplace:_mn,caretTrimReplace:vmn}=rJ(),{FLAG_INCLUDE_PRERELEASE:wmn,FLAG_LOOSE:Smn}=tee(),vEt=t=>t.value==="<0.0.0-0",Cmn=t=>t.value==="",wEt=(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},xmn=(t,e)=>(t=t.replace(Ab[My.BUILD],""),ml("comp",t,e),t=Emn(t,e),ml("caret",t),t=Tmn(t,e),ml("tildes",t),t=Mmn(t,e),ml("xrange",t),t=Imn(t,e),ml("stars",t),t),Nb=t=>!t||t.toLowerCase()==="x"||t==="*",Tmn=(t,e)=>t.trim().split(/\s+/).map(r=>Omn(r,e)).join(" "),Omn=(t,e)=>{let r=e.loose?Ab[My.TILDELOOSE]:Ab[My.TILDE];return t.replace(r,(n,o,i,a,s)=>{ml("tilde",t,n,o,i,a,s);let u;return Nb(o)?u="":Nb(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Nb(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(ml("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,ml("tilde return",u),u})},Emn=(t,e)=>t.trim().split(/\s+/).map(r=>Pmn(r,e)).join(" "),Pmn=(t,e)=>{ml("caret",t,e);let r=e.loose?Ab[My.CARETLOOSE]:Ab[My.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{ml("caret",t,o,i,a,s,u);let l;return Nb(i)?l="":Nb(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Nb(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(ml("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`):(ml("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`),ml("caret return",l),l})},Mmn=(t,e)=>(ml("replaceXRanges",t,e),t.split(/\s+/).map(r=>Rmn(r,e)).join(" ")),Rmn=(t,e)=>{t=t.trim();let r=e.loose?Ab[My.XRANGELOOSE]:Ab[My.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{ml("xRange",t,n,o,i,a,s,u);let l=Nb(i),c=l||Nb(a),d=c||Nb(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`),ml("xRange return",n),n})},Imn=(t,e)=>(ml("replaceStars",t,e),t.trim().replace(Ab[My.STAR],"")),Amn=(t,e)=>(ml("replaceGTE0",t,e),t.trim().replace(Ab[e.includePrerelease?My.GTE0PRE:My.GTE0],"")),Nmn=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Nb(n)?r="":Nb(o)?r=`>=${n}.0.0${t?"-0":""}`:Nb(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Nb(l)?u="":Nb(c)?u=`<${+l+1}.0.0-0`:Nb(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()),Dmn=(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(ml(t[n].semver),t[n].semver!==Ize.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 oee=S((yPi,PEt)=>{"use strict";var iee=Symbol("SemVer ANY"),Dze=class t{static get ANY(){return iee}constructor(e,r){if(r=CEt(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Nze("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===iee?this.value="":this.value=this.operator+this.semver.version,Nze("comp",this)}parse(e){let r=this.options.loose?xEt[TEt.COMPARATORLOOSE]:xEt[TEt.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 OEt(n[2],this.options.loose):this.semver=iee}toString(){return this.value}test(e){if(Nze("Comparator.test",e,this.options.loose),this.semver===iee||e===iee)return!0;if(typeof e=="string")try{e=new OEt(e,this.options)}catch{return!1}return Aze(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 EEt(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new EEt(this.value,r).test(e.semver):(r=CEt(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("=")||Aze(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Aze(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};PEt.exports=Dze;var CEt=kme(),{safeRe:xEt,t:TEt}=rJ(),Aze=Pze(),Nze=ree(),OEt=Py(),EEt=CS()});var aee=S((bPi,MEt)=>{"use strict";var jmn=CS(),$mn=(t,e,r)=>{try{e=new jmn(e,r)}catch{return!1}return e.test(t)};MEt.exports=$mn});var IEt=S((_Pi,REt)=>{"use strict";var Lmn=CS(),Fmn=(t,e)=>new Lmn(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));REt.exports=Fmn});var NEt=S((vPi,AEt)=>{"use strict";var kmn=Py(),qmn=CS(),Umn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new qmn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new kmn(n,r))}),n};AEt.exports=Umn});var jEt=S((wPi,DEt)=>{"use strict";var Bmn=Py(),zmn=CS(),Vmn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new zmn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new Bmn(n,r))}),n};DEt.exports=Vmn});var FEt=S((SPi,LEt)=>{"use strict";var jze=Py(),Hmn=CS(),$Et=nee(),Wmn=(t,e)=>{t=new Hmn(t,e);let r=new jze("0.0.0");if(t.test(r)||(r=new jze("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 jze(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||$Et(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||$Et(r,i))&&(r=i)}return r&&t.test(r)?r:null};LEt.exports=Wmn});var qEt=S((CPi,kEt)=>{"use strict";var Jmn=CS(),Kmn=(t,e)=>{try{return new Jmn(t,e).range||"*"}catch{return null}};kEt.exports=Kmn});var Xme=S((xPi,VEt)=>{"use strict";var Gmn=Py(),zEt=oee(),{ANY:Xmn}=zEt,Zmn=CS(),Ymn=aee(),UEt=nee(),BEt=Hme(),Qmn=Jme(),ehn=Wme(),thn=(t,e,r,n)=>{t=new Gmn(t,n),e=new Zmn(e,n);let o,i,a,s,u;switch(r){case">":o=UEt,i=Qmn,a=BEt,s=">",u=">=";break;case"<":o=BEt,i=ehn,a=UEt,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Ymn(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===Xmn&&(p=new zEt(">=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};VEt.exports=thn});var WEt=S((TPi,HEt)=>{"use strict";var rhn=Xme(),nhn=(t,e,r)=>rhn(t,e,">",r);HEt.exports=nhn});var KEt=S((OPi,JEt)=>{"use strict";var ohn=Xme(),ihn=(t,e,r)=>ohn(t,e,"<",r);JEt.exports=ihn});var ZEt=S((EPi,XEt)=>{"use strict";var GEt=CS(),ahn=(t,e,r)=>(t=new GEt(t,r),e=new GEt(e,r),t.intersects(e,r));XEt.exports=ahn});var QEt=S((PPi,YEt)=>{"use strict";var shn=aee(),uhn=SS();YEt.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>uhn(c,d,r));for(let c of a)shn(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 iPt=S((MPi,oPt)=>{"use strict";var ePt=CS(),Lze=oee(),{ANY:$ze}=Lze,see=aee(),Fze=SS(),lhn=(t,e,r={})=>{if(t===e)return!0;t=new ePt(t,r),e=new ePt(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=dhn(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},chn=[new Lze(">=0.0.0-0")],tPt=[new Lze(">=0.0.0")],dhn=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===$ze){if(e.length===1&&e[0].semver===$ze)return!0;r.includePrerelease?t=chn:t=tPt}if(e.length===1&&e[0].semver===$ze){if(r.includePrerelease)return!0;e=tPt}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=rPt(o,p,r):p.operator==="<"||p.operator==="<="?i=nPt(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=Fze(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&&!see(p,String(o),r)||i&&!see(p,String(i),r))return null;for(let m of e)if(!see(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=rPt(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!see(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=nPt(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!see(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)},rPt=(t,e,r)=>{if(!t)return e;let n=Fze(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},nPt=(t,e,r)=>{if(!t)return e;let n=Fze(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};oPt.exports=lhn});var lPt=S((RPi,uPt)=>{"use strict";var kze=rJ(),aPt=tee(),fhn=Py(),sPt=Cze(),phn=kz(),mhn=NOt(),hhn=jOt(),ghn=FOt(),yhn=UOt(),bhn=zOt(),_hn=HOt(),vhn=JOt(),whn=GOt(),Shn=SS(),Chn=QOt(),xhn=tEt(),Thn=Vme(),Ohn=iEt(),Ehn=sEt(),Phn=nee(),Mhn=Hme(),Rhn=Oze(),Ihn=Eze(),Ahn=Wme(),Nhn=Jme(),Dhn=Pze(),jhn=gEt(),$hn=oee(),Lhn=CS(),Fhn=aee(),khn=IEt(),qhn=NEt(),Uhn=jEt(),Bhn=FEt(),zhn=qEt(),Vhn=Xme(),Hhn=WEt(),Whn=KEt(),Jhn=ZEt(),Khn=QEt(),Ghn=iPt();uPt.exports={parse:phn,valid:mhn,clean:hhn,inc:ghn,diff:yhn,major:bhn,minor:_hn,patch:vhn,prerelease:whn,compare:Shn,rcompare:Chn,compareLoose:xhn,compareBuild:Thn,sort:Ohn,rsort:Ehn,gt:Phn,lt:Mhn,eq:Rhn,neq:Ihn,gte:Ahn,lte:Nhn,cmp:Dhn,coerce:jhn,Comparator:$hn,Range:Lhn,satisfies:Fhn,toComparators:khn,maxSatisfying:qhn,minSatisfying:Uhn,minVersion:Bhn,validRange:zhn,outside:Vhn,gtr:Hhn,ltr:Whn,intersects:Jhn,simplifyRange:Khn,subset:Ghn,SemVer:fhn,re:kze.re,src:kze.src,tokens:kze.t,SEMVER_SPEC_VERSION:aPt.SEMVER_SPEC_VERSION,RELEASE_TYPES:aPt.RELEASE_TYPES,compareIdentifiers:sPt.compareIdentifiers,rcompareIdentifiers:sPt.rcompareIdentifiers}});function VN(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 Xhn,cPt=v(()=>{Xhn=$(lPt(),1)});function Bze(t){return t!=null&&typeof t=="object"&&"name"in t&&t?.name==="LangSmithNotFoundError"}async function Ar(t,e,r){let n;if(t.ok){r&&(n=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(n="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let s=new Error(`${t.status} ${t.statusText}`);throw s.status=t?.status,s}if(n===void 0)try{n=await t.text()}catch{n=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${n}`;if(t.status===404)throw new Uze(o);if(t.status===409)throw new qze(o);let i=new Error(o);throw i.status=t.status,i}function fPt(t){return typeof t=="object"&&t!==null&&t.code===dPt}var qze,Uze,dPt,Zme,zze=v(()=>{qze=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}},Uze=class extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithNotFoundError",this.status=404}};dPt="ERR_CONFLICTING_ENDPOINTS",Zme=class extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:dPt}),this.name="ConflictingEndpointsError"}}});function Qhn(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Yme(t){return Yhn.encode(t)}function mPt(t){if(t&&typeof t=="object"&&t!==null){if(t instanceof Map)return Object.fromEntries(t);if(t instanceof Set)return Array.from(t);if(t instanceof Date)return t.toISOString();if(t instanceof RegExp)return t.toString();if(t instanceof Error)return{name:t.name,message:t.message}}else if(typeof t=="bigint")return t.toString();return t}function egn(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return mPt(r)}}function E_(t,e,r,n,o){try{let i=JSON.stringify(t,egn(r),n);return Yme(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
|
||
Context: ${e}`:""}`),Yme("[Unserializable]");ad("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
|
||
Context: ${e}`:""}`),typeof o>"u"&&(o=Qhn()),Hze(t,"",0,[],void 0,0,o);let a;try{nJ.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,tgn(r),n)}catch{return Yme("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Qme.length!==0;){let s=Qme.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return Yme(a)}}function Vze(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Qme.push([n,r,e,o])):nJ.push([e,r,t]):(n[r]=t,Qme.push([n,r,e]))}function Hze(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){Vze(Zhn,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Vze(pPt,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Vze(pPt,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Hze(t[s],s,s,n,t,i,a);else{t=mPt(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];Hze(t[l],l,s,n,t,i,a)}}n.pop()}}function tgn(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(nJ.length>0)for(var n=0;n<nJ.length;n++){var o=nJ[n];if(o[1]===e&&o[0]===r){r=o[2],nJ.splice(n,1);break}}return t.call(this,e,r)}}var pPt,Zhn,Qme,nJ,Yhn,hPt=v(()=>{BN();pPt="[...]",Zhn={result:"[Circular]"},Qme=[],nJ=[],Yhn=new TextEncoder});function gPt(t,e,r){if(r)return t;let n=Mme(),o=e??QBe(),i=t.extra??{},a=i.metadata;return t.extra={...i,runtime:{...n,...i?.runtime},metadata:{...o,...o.revision_id||"revision_id"in t&&t.revision_id?{revision_id:("revision_id"in t?t.revision_id:void 0)??o.revision_id}:{},...a}},t}async function ogn(t){let e=[];for await(let r of t)e.push(r);return e}function ehe(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function yPt(t){return typeof t=="number"?Number(t.toFixed(4)):t}function _Pt(t){return"dataset_id"in t||"dataset_name"in t}var rgn,ngn,ign,agn,vPt,sgn,ugn,bPt,Wze,Fz,KBe=v(()=>{gme();iOt();sze();_Ot();vOt();BN();Pme();xme();yme();cPt();zze();JBe();UBe();hPt();rgn=t=>{let e=t?.toString()??ad("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},ngn=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};ign=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(r=>setTimeout(r,e)),!0}return!1};agn=24*1024*1024,vPt=1024*1024*1024,sgn=1e4,ugn=100,bPt="https://api.smith.langchain.com",Wze=class{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??vPt}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=E_(e.item,`Serializing run with id: ${e.item.id}`).length;return this.sizeBytes+o>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${o} bytes.`),r(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:r,itemPromise:n,size:o}),this.sizeBytes+=o,n)}pop({upToSizeBytes:e,upToSize:r}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let n=[],o=0;for(;o+(this.peek()?.size??0)<e&&this.items.length>0&&n.length<r;){let i=this.items.shift();i&&(n.push(i),o+=i.size,this.sizeBytes-=i.size)}if(n.length===0&&this.items.length>0){let i=this.items.shift();n.push(i),o+=i.size,this.sizeBytes-=i.size}return[n.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>n.forEach(i=>i.itemPromiseResolve())]}},Fz=class t{get _fetch(){return this.fetchImplementation||$Tt(this.debug)}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,"workspaceId",{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,"omitTracedRuntimeInfo",{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:void 0}),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,"batchSizeLimit",{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:nw("LANGSMITH_TRACING_BACKGROUND")==="false"}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_promptCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_multipartDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_runCompressionDisabled",{enumerable:!0,configurable:!0,writable:!0,value:ad("DISABLE_RUN_COMPRESSION")==="true"}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:nw("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=rgn(e.tracingSamplingRate),this.apiUrl=ehe(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=ehe(e.apiKey??r.apiKey),this.webUrl=ehe(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=ehe(e.workspaceId??ad("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new eee({...e.callerOptions??{},maxRetries:4,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.fetchImplementation=e.fetchImplementation;let n=e.maxIngestMemoryBytes??vPt;this.batchIngestCaller=new eee({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:ign,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.omitTracedRuntimeInfo=e.omitTracedRuntimeInfo??!1,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new Wze(n),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,Rme()&&(this.langSmithToOTELTranslator=new Ame),this.cachedLSEnvVarsForMetadata=QBe(),e.cache!==void 0&&e.disablePromptCache&&$z("Both 'cache' and 'disablePromptCache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value."),e.cache!==void 0?($z("The 'cache' parameter is deprecated and will be removed in a future version. Use 'configureGlobalPromptCache()' to configure the global cache, or 'disablePromptCache: true' to disable caching for this client."),e.cache===!1?this._promptCache=void 0:e.cache===!0?this._promptCache=Ome:this._promptCache=e.cache):e.disablePromptCache||(this._promptCache=Ome)}static getDefaultClientConfig(){let e=ad("API_KEY"),r=ad("ENDPOINT")??bPt,n=ad("HIDE_INPUTS")==="true",o=ad("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:ngn(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/${Eme}`};return this.apiKey&&(e["x-api-key"]=`${this.apiKey}`),this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}_getPlatformEndpointPath(e){return this.apiUrl.slice(-3)!=="/v1"&&this.apiUrl.slice(-4)!=="/v1/"?`/v1/platform/${e}`:`/platform/${e}`}async processInputs(e){return this.hideInputs===!1?e:this.hideInputs===!0?{}:typeof this.hideInputs=="function"?this.hideInputs(e):e}async processOutputs(e){return this.hideOutputs===!1?e:this.hideOutputs===!0?{}:typeof this.hideOutputs=="function"?this.hideOutputs(e):e}async prepareRunCreateOrUpdateInputs(e){let r={...e};return r.inputs!==void 0&&(r.inputs=await this.processInputs(r.inputs)),r.outputs!==void 0&&(r.outputs=await this.processOutputs(r.outputs)),r}async _getResponse(e,r){let n=r?.toString()??"",o=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{let a=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(a,`fetch ${e}`),a})}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(async()=>{let l=await this._fetch(a,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(l,`fetch ${e}`),l}),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 a=JSON.stringify(i),u=await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(c,`fetch ${e}`),c})).json();if(!u||!u[o])break;yield u[o];let l=u.cursors;if(!l||!l.next)break;i.cursor=l.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()<this.tracingSampleRate}_filterForSampling(e,r=!1){if(this.tracingSampleRate===void 0)return e;if(r){let n=[];for(let o of e)this.filteredPostUuids.has(o.trace_id)?o.id===o.trace_id&&this.filteredPostUuids.delete(o.trace_id):n.push(o);return n}else{let n=[];for(let o of e){let i=o.trace_id??o.id;this.filteredPostUuids.has(i)||(o.id===i?this._shouldSample()?n.push(o):this.filteredPostUuids.add(i):n.push(o))}return n}}async _getBatchSizeLimitBytes(){let e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e?.batch_ingest_config?.size_limit_bytes??agn}async _getBatchSizeLimit(){let e=await this._ensureServerInfo();return this.batchSizeLimit??e?.batch_ingest_config?.size_limit??ugn}async _getDatasetExamplesMultiPartSupport(){return(await this._ensureServerInfo()).instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r}){let n=[];for(;this.autoBatchQueue.items.length>0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:r});if(!o.length){i();break}let a=o.reduce((l,c)=>{let d=c.apiUrl??this.apiUrl,f=c.apiKey??this.apiKey,m=c.apiKey===this.apiKey&&c.apiUrl===this.apiUrl?"default":`${d}|${f}`;return l[m]||(l[m]=[]),l[m].push(c),l},{}),s=[];for(let[l,c]of Object.entries(a)){let d=this._processBatch(c,{apiUrl:l==="default"?void 0:l.split("|")[0],apiKey:l==="default"?void 0:l.split("|")[1]});s.push(d)}let u=Promise.all(s).finally(i);n.push(u)}return Promise.all(n)}async _processBatch(e,r){if(!e.length)return;let n=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(s=>s.action==="create").map(s=>s.item),runUpdates:e.filter(s=>s.action==="update").map(s=>s.item)},i=await this._ensureServerInfo();if(!this._multipartDisabled&&(i?.batch_ingest_config?.use_multipart_endpoint??!0)){let s=!this._runCompressionDisabled&&i?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}catch(u){if(Bze(u))this._multipartDisabled=!0,await this.batchIngestRuns(o,{...r,sizeBytes:n});else throw u}}else await this.batchIngestRuns(o,{...r,sizeBytes:n})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let r=new Map,n=[];for(let o of e)o.item.id&&o.otelContext&&(r.set(o.item.id,o.otelContext),o.action==="create"?n.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):n.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(n,r)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=gPt(e.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);let r=this.autoBatchQueue.push(e);if(this.manualFlushMode)return r;let n=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),r}async _getServerInfo(){let r=await(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(sgn),...this.fetchOptions});return await Ar(n,"get server info"),n})).json();return this.debug&&console.log(`
|
||
=== LangSmith Server Configuration ===
|
||
`+JSON.stringify(r,null,2)+`
|
||
`),r}async _ensureServerInfo(){return this._getServerInfoPromise===void 0&&(this._getServerInfoPromise=(async()=>{if(this._serverInfo===void 0)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}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(),r=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:r})}_cloneCurrentOTELContext(){let e=Ime(),r=nOt();if(this.langSmithToOTELTranslator!==void 0){let n=e.getActiveSpan();if(n)return e.setSpan(r.active(),n)}}async createRun(e,r){if(!this._filterForSampling([e]).length)return;let n={...this.headers,"Content-Type":"application/json"},o=e.project_name;delete e.project_name;let i=await this.prepareRunCreateOrUpdateInputs({session_name:o,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&i.trace_id!==void 0&&i.dotted_order!==void 0){let u=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:u,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let a=gPt(i,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let s=E_(a,`Creating run with id: ${a.id}`);await this.caller.call(async()=>{let u=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Ar(u,"create run",!0),u})}async batchIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o=await Promise.all(e?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]),i=await Promise.all(r?.map(u=>this.prepareRunCreateOrUpdateInputs(u))??[]);if(o.length>0&&i.length>0){let u=o.reduce((c,d)=>(d.id&&(c[d.id]=d),c),{}),l=[];for(let c of i)c.id!==void 0&&u[c.id]?u[c.id]={...u[c.id],...c}:l.push(c);o=Object.values(u),i=l}let a={post:o,patch:i};if(!a.post.length&&!a.patch.length)return;let s={post:[],patch:[]};for(let u of["post","patch"]){let l=u,c=a[l].reverse(),d=c.pop();for(;d!==void 0;)s[l].push(d),d=c.pop()}if(s.post.length>0||s.patch.length>0){let u=s.post.map(l=>l.id).concat(s.patch.map(l=>l.id)).join(",");await this._postBatchIngestRuns(E_(s,`Ingesting runs with ids: ${u}`),n)}}async _postBatchIngestRuns(e,r){let n={...this.headers,"Content-Type":"application/json",Accept:"application/json"};r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let o=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await Ar(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:r},n){if(e===void 0&&r===void 0)return;let o={},i=[];for(let d of e??[]){let f=await this.prepareRunCreateOrUpdateInputs(d);f.id!==void 0&&f.attachments!==void 0&&(o[f.id]=f.attachments),delete f.attachments,i.push(f)}let a=[];for(let d of r??[])a.push(await this.prepareRunCreateOrUpdateInputs(d));if(i.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(a.find(d=>d.trace_id===void 0||d.dotted_order===void 0)!==void 0)throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of a)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),a=f}if(i.length===0&&a.length===0)return;let l=[],c=[];for(let[d,f]of[["post",i],["patch",a]])for(let p of f){let{inputs:m,outputs:h,events:y,extra:g,error:b,serialized:_,attachments:w,...T}=p,O={inputs:m,outputs:h,events:y,extra:g,error:b,serialized:_},E=E_(T,`Serializing for multipart ingestion of run with id: ${T.id}`);c.push({name:`${d}.${T.id}`,payload:new Blob([E],{type:`application/json; length=${E.length}`})});for(let[P,R]of Object.entries(O)){if(R===void 0)continue;let I=E_(R,`Serializing ${P} for multipart ingestion of run with id: ${T.id}`);c.push({name:`${d}.${T.id}.${P}`,payload:new Blob([I],{type:`application/json; length=${I.length}`})})}if(T.id!==void 0){let P=o[T.id];if(P){delete o[T.id];for(let[R,I]of Object.entries(P)){let N,z;if(Array.isArray(I)?[N,z]=I:(N=I.mimeType,z=I.data),R.includes(".")){console.warn(`Skipping attachment '${R}' for run ${T.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${T.id}.${R}`,payload:new Blob([z],{type:`${N}; length=${z.byteLength}`})})}}}l.push(`trace=${T.trace_id},id=${T.id}`)}await this._sendMultipartRequest(c,l.join("; "),n)}async _createNodeFetchBody(e,r){let n=[];for(let a of e)n.push(new Blob([`--${r}\r
|
||
`])),n.push(new Blob([`Content-Disposition: form-data; name="${a.name}"\r
|
||
`,`Content-Type: ${a.payload.type}\r
|
||
\r
|
||
`])),n.push(a.payload),n.push(new Blob([`\r
|
||
`]));return n.push(new Blob([`--${r}--\r
|
||
`])),await new Blob(n).arrayBuffer()}async _createMultipartStream(e,r){let n=new TextEncoder;return new ReadableStream({async start(i){let a=async s=>{typeof s=="string"?i.enqueue(n.encode(s)):i.enqueue(s)};for(let s of e){await a(`--${r}\r
|
||
`),await a(`Content-Disposition: form-data; name="${s.name}"\r
|
||
`),await a(`Content-Type: ${s.payload.type}\r
|
||
\r
|
||
`);let l=s.payload.stream().getReader();try{let c;for(;!(c=await l.read()).done;)i.enqueue(c.value)}finally{l.releaseLock()}await a(`\r
|
||
`)}await a(`--${r}--\r
|
||
`),i.close()}})}async _sendMultipartRequest(e,r,n){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=()=>this._createNodeFetchBody(e,o),a=()=>this._createMultipartStream(e,o),s=async u=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let l=await u(),c={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(c["x-api-key"]=n.apiKey);let d=l;n?.useGzip&&typeof l=="object"&&"pipeThrough"in l&&(d=l.pipeThrough(new CompressionStream("gzip")),c["Content-Encoding"]="gzip");let f=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:c,body:d,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(f,"Failed to send multipart request",!0),f});try{let u,l=!1;jTt()&&!this.multipartStreamingDisabled&&YBe()!=="bun"?(l=!0,u=await s(a)):u=await s(i),(!this.multipartStreamingDisabled||l)&&u.status===422&&(n?.apiUrl??this.apiUrl)!==bPt&&(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${r}".`),this.multipartStreamingDisabled=!0,u=await s(i))}catch(u){if(Bze(u))throw u;console.warn(`${u.message.trim()}
|
||
|
||
Context: ${r}`)}}async updateRun(e,r,n){Ao(e),r.inputs&&(r.inputs=await this.processInputs(r.inputs)),r.outputs&&(r.outputs=await this.processOutputs(r.outputs));let o={...r,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let s=this._cloneCurrentOTELContext();if(r.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:s,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};n?.apiKey!==void 0&&(i["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(i["x-tenant-id"]=n.workspaceId);let a=E_(r,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let s=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(s,"update run",!0),s})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Ao(e);let n=await this._get(`/runs/${e}`);return r&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:r,projectOpts:n}){if(r!==void 0){let o;r.session_id?o=r.session_id:n?.projectName?o=(await this.readProject({projectName:n?.projectName})).id:n?.projectId?o=n?.projectId:o=(await this.readProject({projectName:ad("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 ogn(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},o={};r.sort((i,a)=>(i?.dotted_order??"").localeCompare(a?.dotted_order??""));for(let i of r){if(i.parent_run_id===null||i.parent_run_id===void 0)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=n[e.id]||[];for(let i in n)i!==e.id&&(o[i].child_runs=n[i]);return e}async*listRuns(e){let{projectId:r,projectName:n,parentRunId:o,traceId:i,referenceExampleId:a,startTime:s,executionOrder:u,isRoot:l,runType:c,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:y,limit:g,select:b,order:_}=e,w=[];if(r&&(w=Array.isArray(r)?r:[r]),n){let P=Array.isArray(n)?n:[n],R=await Promise.all(P.map(I=>this.readProject({projectName:I}).then(N=>N.id)));w.push(...R)}let T=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],O={session:w.length?w:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:y,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:g,trace:i,select:b||T,is_root:l,order:_};O.select.includes("child_run_ids")&&$z("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let E=0;for await(let P of this._getCursorPaginatedList("/runs/query",O))if(g){if(E>=g)break;if(P.length+E>g){yield*P.slice(0,g-E);break}E+=P.length,yield*P}else yield*P}async*listGroupRuns(e){let{projectId:r,projectName:n,groupBy:o,filter:i,startTime:a,endTime:s,limit:u,offset:l}=e,d={session_id:r||(await this.readProject({projectName:n})).id,group_by:o,filter:i,start_time:a?a.toISOString():null,end_time:s?s.toISOString():null,limit:Number(u)||100},f=Number(l)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},y=Object.fromEntries(Object.entries(h).filter(([O,E])=>E!==void 0)),g=JSON.stringify(y),_=await(await this.caller.call(async()=>{let O=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:g});return await Ar(O,`Failed to fetch ${p}`),O})).json(),{groups:w,total:T}=_;if(w.length===0)break;for(let O of w)yield O;if(f+=w.length,f>=T)break}}async getRunStats({id:e,trace:r,parentRun:n,runType:o,projectNames:i,projectIds:a,referenceExampleIds:s,startTime:u,endTime:l,error:c,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:y}){let g=a||[];i&&(g=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(P=>P.id)))]);let _=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:g,reference_example:s,start_time:u,end_time:l,error:c,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:y}).filter(([E,P])=>P!==void 0)),w=JSON.stringify(_);return await(await this.caller.call(async()=>{let E=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:w});return await Ar(E,"get run stats"),E})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||jz()};Ao(e);let o=JSON.stringify(n),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Ar(s,"share run"),s})).json();if(a===null||!("share_token"in a))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${a.share_token}/r`}async unshareRun(e){Ao(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(r,"unshare run",!0),r})}async readRunSharedLink(e){Ao(e);let n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,"read run shared link"),o})).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 Ao(e),await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(a,"list shared runs"),a})).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),Ao(e);let o=await(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(i,"read dataset shared schema"),i})).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};Ao(e);let o=JSON.stringify(n),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await Ar(s,"share dataset"),s})).json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){Ao(e),await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(r,"unshare dataset",!0),r})}async readSharedDataset(e){return Ao(e),await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,"read shared dataset"),o})).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(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/examples?${o.toString()}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(s,"list shared examples"),s}),a=await i.json();if(!i.ok)throw"detail"in a?new Error(`Failed to list shared examples.
|
||
Status: ${i.status}
|
||
Message: ${Array.isArray(a.detail)?a.detail.join(`
|
||
`):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return a.map(s=>({...s,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:r=null,metadata:n=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:a=null}){let s=o?"?upsert=true":"",u=`${this.apiUrl}/sessions${s}`,l=i||{};n&&(l.metadata=n);let c={name:e,extra:l,description:r};a!==null&&(c.reference_dataset_id=a);let d=JSON.stringify(c);return await(await this.caller.call(async()=>{let m=await this._fetch(u,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await Ar(m,"create project"),m})).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=JSON.stringify({name:r,extra:u,description:n,end_time:a?new Date(a).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(s,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Ar(f,"update project"),f})).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)Ao(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(async()=>{let a=await this._fetch(`${this.apiUrl}${n}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(a,"has project"),a});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)Ao(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,includeStats:a,datasetVersion:s,referenceFree:u,metadata:l}={}){let c=new URLSearchParams;if(e!==void 0)for(let d of e)c.append("id",d);if(r!==void 0&&c.append("name",r),n!==void 0&&c.append("name_contains",n),o!==void 0)c.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});c.append("reference_dataset",d.id)}a!==void 0&&c.append("include_stats",a.toString()),s!==void 0&&c.append("dataset_version",s),u!==void 0&&c.append("reference_free",u.toString()),l!==void 0&&c.append("metadata",JSON.stringify(l));for await(let d of this._getPaginated("/sessions",c))yield*d}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,Ao(n),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,`delete session ${n} (${r})`,!0),o})}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,c=new Blob([e],{type:"text/csv"});return l.append("file",c,r),n.forEach(p=>{l.append("input_keys",p)}),o.forEach(p=>{l.append("output_keys",p)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s),await(await this.caller.call(async()=>{let p=await this._fetch(u,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Ar(p,"upload CSV"),p})).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=JSON.stringify(s);return await(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Ar(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:r}){let n="/datasets",o=new URLSearchParams({limit:"1"});if(e&&r)throw new Error("Must provide either datasetName or datasetId, not both");if(e)Ao(e),n+=`/${e}`;else if(r)o.append("name",r);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(n,o),a;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${r}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:r}){try{return await this.readDataset({datasetId:e,datasetName:r}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:r,fromVersion:n,toVersion:o}){let i=e;if(i===void 0&&r===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:r})).id);let a=new URLSearchParams({from_version:typeof n=="string"?n:n.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:r}){let n="/datasets";if(e===void 0)if(r!==void 0)e=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${n}/${e}/openai_ft`)).text()).trim().split(`
|
||
`).map(s=>JSON.parse(s))}async*listDatasets({limit:e=100,offset:r=0,datasetIds:n,datasetName:o,datasetNameContains:i,metadata:a}={}){let s="/datasets",u=new URLSearchParams({limit:e.toString(),offset:r.toString()});if(n!==void 0)for(let l of n)u.append("id",l);o!==void 0&&u.append("name",o),i!==void 0&&u.append("name_contains",i),a!==void 0&&u.append("metadata",JSON.stringify(a));for await(let l of this._getPaginated(s,u))yield*l}async updateDataset(e){let{datasetId:r,datasetName:n,...o}=e;if(!r&&!n)throw new Error("Must provide either datasetName or datasetId");let i=r??(await this.readDataset({datasetName:n})).id;Ao(i);let a=JSON.stringify(o);return await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(u,"update dataset"),u})).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;Ao(a);let s=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Ar(u,"update dataset tags",!0),u})}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)Ao(o),n+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(i,`delete ${n}`,!0),i})}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),Ao(o);let a=JSON.stringify({tag:n});await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${o}/index`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(u,"index dataset"),u})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),Ao(r);let a=JSON.stringify(i);return(await(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${r}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:a});return await Ar(l,"fetch similar examples"),l})).json()).examples}async createExample(e,r,n){if(_Pt(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;_Pt(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]??jz())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let b=e,_=b[0].dataset_id,w=b[0].dataset_name;if(_===void 0&&w===void 0)throw new Error("Must provide either datasetName or datasetId");if(_!==void 0&&w!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");_===void 0&&(_=(await this.readDataset({datasetName:w})).id);let T=await this._uploadExamplesMultipart(_,b);return await Promise.all(T.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((b,_)=>({dataset_id:p,inputs:b,outputs:n?.[_],metadata:o?.[_],split:i?.[_],id:c?.[_],attachments:l?.[_],source_run_id:a?.[_],use_source_run_io:s?.[_],use_source_run_attachments:u?.[_]})),y=await this._uploadExamplesMultipart(p,h);return await Promise.all(y.example_ids.map(b=>this.readExample(b)))}async createLLMExample(e,r,n){return this.createExample({input:e},{output:r},n)}async createChatExample(e,r,n){let o=e.map(a=>_ze(a)?vze(a):a),i=_ze(r)?vze(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Ao(e);let r=`/examples/${e}`,n=await this._get(r),{attachment_urls:o,...i}=n,a=i;return o&&(a.attachments=Object.entries(o).reduce((s,[u,l])=>(s[u.slice(11)]={presigned_url:l.presigned_url,mime_type:l.mime_type},s),{})),a}async*listExamples({datasetId:e,datasetName:r,exampleIds:n,asOf:o,splits:i,inlineS3Urls:a,metadata:s,limit:u,offset:l,filter:c,includeAttachments:d}={}){let f;if(e!==void 0&&r!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(r!==void 0)f=(await this.readDataset({datasetName:r})).id;else throw new Error("Must provide a datasetName or datasetId");let p=new URLSearchParams({dataset:f}),m=o?typeof o=="string"?o:o?.toISOString():void 0;m&&p.append("as_of",m);let h=a??!0;if(p.append("inline_s3_urls",h.toString()),n!==void 0)for(let g of n)p.append("id",g);if(i!==void 0)for(let g of i)p.append("splits",g);if(s!==void 0){let g=JSON.stringify(s);p.append("metadata",g)}u!==void 0&&p.append("limit",u.toString()),l!==void 0&&p.append("offset",l.toString()),c!==void 0&&p.append("filter",c),d===!0&&["attachment_urls","outputs","metadata"].forEach(g=>p.append("select",g));let y=0;for await(let g of this._getPaginated("/examples",p)){for(let b of g){let{attachment_urls:_,...w}=b,T=w;_&&(T.attachments=Object.entries(_).reduce((O,[E,P])=>(O[E.slice(11)]={presigned_url:P.presigned_url,mime_type:P.mime_type||void 0},O),{})),yield T,y++}if(u!==void 0&&y>=u)break}}async deleteExample(e){Ao(e);let r=`/examples/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,`delete ${r}`,!0),n})}async deleteExamples(e,r){if(e.forEach(n=>Ao(n)),r?.hardDelete){let n=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${n}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},body:JSON.stringify({example_ids:e,hard_delete:!0}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,"hard delete examples",!0),o})}else{let n=new URLSearchParams;e.forEach(o=>n.append("example_ids",o)),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/examples?${n.toString()}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,"delete examples",!0),o})}}async updateExample(e,r){let n;r?n=e:n=e.id,Ao(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,Ao(i),n&&o||!n&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let a=new URLSearchParams;return n!==void 0&&a.append("as_of",typeof n=="string"?n:n.toISOString()),o!==void 0&&a.append("tag",o),await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(u,"read dataset version"),u})).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,Ao(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,Ao(a);let s={split_name:n,examples:o.map(l=>(Ao(l),l)),remove:i},u=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Ar(l,"update dataset splits",!0),l})}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,sessionId:m,startTime:h}){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 y={type:u??"api",metadata:s??{}};l!==void 0&&y?.metadata!==void 0&&!y.metadata.__run&&(y.metadata.__run={run_id:l}),y?.metadata!==void 0&&y.metadata.__run?.run_id!==void 0&&Ao(y.metadata.__run.run_id);let g={id:c??jz(),run_id:e,key:r,score:yPt(n),value:o,correction:i,comment:a,feedback_source:y,comparative_experiment_id:p,feedbackConfig:d,session_id:m??f,start_time:h},b=JSON.stringify(g),_=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let w=await this._fetch(_,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:b});return await Ar(w,"create feedback",!0),w}),g}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=yPt(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Ao(e);let s=JSON.stringify(a);await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await Ar(u,"update feedback",!0),u})}async readFeedback(e){Ao(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Ao(e);let r=`/feedback/${e}`;await this.caller.call(async()=>{let n=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)Ao(i),o.append("run",i);if(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};n?typeof n=="string"?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};let a=JSON.stringify(i);return await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(u,"create presigned feedback token"),u})).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:{}};a&&(u.extra.metadata=a);let l=JSON.stringify(u);return(await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Ar(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){Ao(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",sessionId:r?.session_id,startTime:r?.start_time}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async createFeedbackConfig(e){let{feedbackKey:r,feedbackConfig:n,isLowerScoreBetter:o=!1}=e,i={feedback_key:r,feedback_config:n,is_lower_score_better:o};return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Ar(s,"create feedback config"),s})).json()}async*listFeedbackConfigs(e={}){let{feedbackKeys:r,nameContains:n,limit:o}=e,i=new URLSearchParams;r&&r.forEach(s=>{i.append("key",s)}),n&&i.append("name_contains",n),i.append("limit",(o!==void 0?Math.min(o,100):100).toString());let a=0;for await(let s of this._getPaginated("/feedback-configs",i))if(yield*s,a+=s.length,o!==void 0&&a>=o)break}async updateFeedbackConfig(e,r={}){let{feedbackConfig:n,isLowerScoreBetter:o}=r,i={feedback_key:e};return n!==void 0&&(i.feedback_config=n),o!==void 0&&(i.is_lower_score_better=o),(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await Ar(s,"update feedback config"),s})).json()}async deleteFeedbackConfig(e){let r=new URLSearchParams({feedback_key:e});await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/feedback-configs?${r}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,"delete feedback config",!0),n})}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{Ao(u,`queueIds[${l}]`),a.append("ids",u)}),n&&a.append("name",n),o&&a.append("name_contains",o),a.append("limit",(i!==void 0?Math.min(i,100):100).toString());let s=0;for await(let u of this._getPaginated("/annotation-queues",a))if(yield*u,s++,i!==void 0&&s>=i)break}async createAnnotationQueue(e){let{name:r,description:n,queueId:o,rubricInstructions:i,rubricItems:a}=e,s={name:r,description:n,id:o||jz(),rubric_instructions:i,rubric_items:a},u=JSON.stringify(Object.fromEntries(Object.entries(s).filter(([c,d])=>d!==void 0)));return(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Ar(c,"create annotation queue"),c})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i,rubricItems:a}=r,s={};n!==void 0&&(s.name=n),o!==void 0&&(s.description=o),i!==void 0&&(s.rubric_instructions=i),a!==void 0&&(s.rubric_items=a);let u=JSON.stringify(s);await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Ar(l,"update annotation queue",!0),l})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>Ao(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Ar(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Ao(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,r){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}/runs/${Ao(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${Ao(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(n,"get size from annotation queue"),n})).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 n=await(await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(o,"get latest commit hash"),o})).json();if(n.commits.length!==0)return n.commits[0].commit_hash}async _likeOrUnlikePrompt(e,r){let[n,o,i]=VN(e),a=JSON.stringify({like:r});return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/likes/${n}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(u,`${r?"like":"unlike"} prompt`),u})).json()}async _getPromptUrl(e){let[r,n,o]=VN(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]=VN(e),a=await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return s?.status===404?null:(await Ar(s,"get prompt"),s)}))?.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]=VN(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=JSON.stringify(s),l=await this.caller.call(async()=>{let d=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:u});return await Ar(d,"create prompt"),d}),{repo:c}=await l.json();return c}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]=VN(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=JSON.stringify(u),d=await(await this.caller.call(async()=>{let f=await this._fetch(`${this.apiUrl}/commits/${o}/${i}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Ar(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,r=[]){return this._updateExamplesMultipart(e,r)}async _updateExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())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,u={...a.metadata&&{metadata:a.metadata},...a.split&&{split:a.split}},l=E_(u,`Serializing body for example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=E_(a.inputs,`Serializing inputs for example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.inputs`,f)}if(a.outputs){let d=E_(a.outputs,`Serializing outputs whle updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.outputs`,f)}if(a.attachments)for(let[d,f]of Object.entries(a.attachments)){let p,m;Array.isArray(f)?[p,m]=f:(p=f.mimeType,m=f.data);let h=new Blob([m],{type:`${p}; length=${m.byteLength}`});n.append(`${s}.attachment.${d}`,h)}if(a.attachments_operations){let d=E_(a.attachments_operations,`Serializing attachments while updating example with id: ${s}`),f=new Blob([d],{type:"application/json"});n.append(`${s}.attachments_operations`,f)}}let o=e??r[0]?.dataset_id;return(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Ar(a,"update examples"),a})).json()}async uploadExamplesMultipart(e,r=[]){return this._uploadExamplesMultipart(e,r)}async _uploadExamplesMultipart(e,r=[]){if(!await this._getDatasetExamplesMultiPartSupport())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 i of r){let a=(i.id??jz()).toString(),s={created_at:i.created_at,...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split},...i.source_run_id&&{source_run_id:i.source_run_id},...i.use_source_run_io&&{use_source_run_io:i.use_source_run_io},...i.use_source_run_attachments&&{use_source_run_attachments:i.use_source_run_attachments}},u=E_(s,`Serializing body for uploaded example with id: ${a}`),l=new Blob([u],{type:"application/json"});if(n.append(a,l),i.inputs){let c=E_(i.inputs,`Serializing inputs for uploaded example with id: ${a}`),d=new Blob([c],{type:"application/json"});n.append(`${a}.inputs`,d)}if(i.outputs){let c=E_(i.outputs,`Serializing outputs for uploaded example with id: ${a}`),d=new Blob([c],{type:"application/json"});n.append(`${a}.outputs`,d)}if(i.attachments)for(let[c,d]of Object.entries(i.attachments)){let f,p;Array.isArray(d)?[f,p]=d:(f=d.mimeType,p=d.data);let m=new Blob([p],{type:`${f}; length=${p.byteLength}`});n.append(`${a}.attachment.${c}`,m)}}return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Ar(i,"upload examples"),i})).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]=VN(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=JSON.stringify(i);return(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/repos/${n}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Ar(u,"update prompt"),u})).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]=VN(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("delete a prompt",r);return(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${r}/${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(a,"delete prompt"),a})).json()}_getPromptCacheKey(e,r){return`${e}${r?":with_model":""}`}async _fetchPromptFromApi(e,r){let[n,o,i]=VN(e),s=await(await this.caller.call(async()=>{let u=await this._fetch(`${this.apiUrl}/commits/${n}/${o}/${i}${r?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Ar(u,"pull prompt commit"),u})).json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async pullPromptCommit(e,r){let n=this._fetchPromptFromApi.bind(this,e,r);if(!r?.skipCache&&this._promptCache){let o=this._getPromptCacheKey(e,r?.includeModel),i=this._promptCache.get(o,n);if(i)return i;let a=await n();return this._promptCache.set(o,a,n),a}return this._fetchPromptFromApi(e,r)}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel,skipCache:r?.skipCache});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 Ao(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}`)}}cleanup(){this._promptCache&&this._promptCache.stop()}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();await new Promise(e=>setTimeout(e,1)),await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await oOt()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var wPt,SPt=v(()=>{BN();wPt=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>ad(r)==="true")});var tO,ZPi,the,Jze=v(()=>{tO=Symbol.for("lc:context_variables"),ZPi=Symbol.for("lc:child_run_end_promises"),the=Symbol.for("langsmith:replica_trace_roots")});function Kze(t,e){if(tO in t)return t[tO][e]}function CPt(t,e,r){let n=tO in t?t[tO]:{};n[e]=r,t[tO]=n}var xPt=v(()=>{Jze()});function TPt(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return DBe(r,lgn)}function cgn(t){return t.replace(/[-:.]/g,"")}function EPt(t,e=1){let r=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${r}Z`}function Gze(t,e,r=1){let n=EPt(t,r);return{dottedOrder:cgn(n)+e,microsecondPrecisionDatestring:n}}function fgn(t){let e={};for(let r of Object.keys(t))dgn.has(r)&&(e[r]=t[r]);return e}function PPt(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function MPt(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function OPt(t){return Array.isArray(t)&&t.some(e=>MPt(e))}function pgn(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function mgn(t){let e=t?.callbacks;return t!=null&&typeof e=="object"&&(OPt(e?.handlers)||OPt(e))}function hgn(){let t=nw("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let r=[];for(let n of e){if(typeof n!="object"||n===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof n}`);continue}if(typeof n.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_url}`);continue}if(typeof n.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof n.api_key}`);continue}r.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key})}return r}else if(typeof e=="object"&&e!==null){ygn(e);let r=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/\/$/,"");if(typeof o=="string")r.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof o}`);continue}}return r}else return console.warn(`Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got ${typeof e}`),[]}catch(e){if(fPt(e))throw e;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS \u2013 must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}}function ggn(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):hgn()}function ygn(t){if(Object.keys(t).length>0&&ad("ENDPOINT"))throw new Zme}var uee,lgn,dgn,rhe,VC,GBe=v(()=>{KBe();SPt();zze();Jze();xPt();BN();BBe();BN();yme();xme();gme();uee=36,lgn="6ba7b810-9dad-11d1-80b4-00c04fd430c8";dgn=new Set(["projectName","updates","reroot"]);rhe=class t{constructor(e,r,n,o){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=r,this.project_name=n,this.replicas=o}static fromHeader(e){let r=e.split(","),n={},o=[],i,a;for(let s of r){let[u,l]=s.split("="),c=decodeURIComponent(l);u==="langsmith-metadata"?n=JSON.parse(c):u==="langsmith-tags"?o=c.split(","):u==="langsmith-project"?i=c:u==="langsmith-replicas"&&(a=JSON.parse(c).map(f=>Array.isArray(f)?f:fgn(f)))}return new t(n,o,i,a)}toHeader(){let e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}},VC=class t{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_awaitInputsOnPost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),PPt(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},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...r,...o,client:i}),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),this.dotted_order||(this._serialized_start_time=EPt(this.start_time,this.execution_order)),this.id||(this.id=Cme(this._serialized_start_time??this.start_time)),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=ggn(this.replicas),!this.dotted_order){let{dottedOrder:s}=Gze(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){let e=Date.now();return{run_type:"chain",project_name:ZQ(),child_runs:[],api_url:nw("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:nw("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new Fz),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=this.replicas?.map(c=>{let{reroot:d,...f}=c;return f}),o=e.replicas??n,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});tO in this&&(i[tO]=this[tO]);let a=Symbol.for("lc:child_config"),s=e.extra?.[a]??this.extra[a];if(mgn(s)){let c={...s},d=pgn(c.callbacks)?c.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(MPt)?.updateFromRunTree?.(i),c.callbacks=d),i.extra[a]=c}let u=new Set,l=this;for(;l!=null&&!u.has(l.id);)u.add(l.id),l.child_execution_order=Math.max(l.child_execution_order,r),l=l.parent_run;return this.child_runs.push(i),i}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),r))for(let[s,u]of Object.entries(r))o.runtime[s]||(o.runtime[s]=u);let i,a;return n?(a=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(s=>this._convertToCreate(s,r,n)),a=void 0),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:o,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:i,parent_run_id:a,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,r){if(r.dotted_order){let n=r.dotted_order.split("."),o=null;for(let i=0;i<n.length;i++)if(n[i].slice(-uee)===e){o=i;break}if(o!==null){let i=n.slice(o+1);r.dotted_order=i.join("."),i.length>0?r.trace_id=i[0].slice(-uee):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=Kze(this,the)??{};n[e]=r,CPt(this,the,n);for(let o of this.child_runs)o._setReplicaTraceRoot(e,r)}_remapForProject(e){let{projectName:r,runtimeEnv:n,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:a,apiUrl:s,apiKey:u,workspaceId:l}=e,c=this._convertToCreate(this,n,o);if(r===this.project_name)return{...c,session_name:r};if(i){if(a)this._sliceParentId(a,c);else if(c.parent_run_id=void 0,c.dotted_order){let b=c.dotted_order.split(".");b.length>0&&(c.dotted_order=b[b.length-1],c.trace_id=c.id)}let g=TPt({projectName:r,apiUrl:s,apiKey:u,workspaceId:l});this._setReplicaTraceRoot(g,c.id)}let d;if(!i){let g=Kze(this,the)??{},b=TPt({projectName:r,apiUrl:s,apiKey:u,workspaceId:l});if(d=g[b],d&&(c.trace_id=d,c.dotted_order)){let _=c.dotted_order.split("."),w=null;for(let T=0;T<_.length;T++)if(_[T].slice(-uee)===d){w=T;break}if(w!==null){let T=_.slice(w);c.dotted_order=T.join(".")}}}let f=c.id,p=YQ(f,r),m;c.trace_id?m=YQ(c.trace_id,r):m=p;let h;c.parent_run_id&&(h=YQ(c.parent_run_id,r));let y;return c.dotted_order&&(y=c.dotted_order.split(".").map(_=>{let w=_.slice(-uee),T=YQ(w,r);return _.slice(0,-uee)+T}).join(".")),{...c,id:p,trace_id:m,parent_run_id:h,dotted_order:y,session_name:r}}async postRun(e=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{let r=Mme();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:a,reroot:s}of this.replicas){let u=this._remapForProject({projectName:n??this.project_name,runtimeEnv:r,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:a});await this.client.createRun(u,{apiKey:o,apiUrl:i,workspaceId:a})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){$z("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let n of this.child_runs)await n.postRun(!1)}this.child_runs=[]}catch(r){console.error(`Error in postRun for run ${this.id}:`,r)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:n,apiUrl:o,workspaceId:i,updates:a,reroot:s}of this.replicas){let u=this._remapForProject({projectName:r??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:s,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:n,workspaceId:i}),l={id:u.id,name:u.name,run_type:u.run_type,start_time:u.start_time,outputs:u.outputs,error:u.error,parent_run_id:u.parent_run_id,session_name:u.session_name,reference_example_id:u.reference_example_id,end_time:u.end_time,dotted_order:u.dotted_order,trace_id:u.trace_id,events:u.events,tags:u.tags,extra:u.extra,attachments:this.attachments,...a};e?.excludeInputs||(l.inputs=u.inputs),await this.client.updateRun(u.id,l,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};e?.excludeInputs||(r.inputs=this.inputs),await this.client.updateRun(this.id,r)}catch(r){console.error(`Error in patchRun for run ${this.id}`,r)}this.child_runs=[]}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=wPt();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(c=>{let[d,f]=c.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),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 c=rhe.fromHeader(n.baggage);u.metadata=c.metadata,u.tags=c.tags,u.project_name=c.project_name,u.replicas=c.replicas}let l=new t(u);return l.distributedParentId=l.id,l}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new rhe(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[n,o]of Object.entries(r))e.set(n,o);return r}};Object.defineProperty(VC,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var nhe=v(()=>{GBe()});function Zze(t,e){if(t)return new VC({...t,start_time:t._serialized_start_time??t.start_time,parent_run:Zze(e),child_runs:t.child_runs.map(r=>Zze(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:TBe()},tracingEnabled:!1})}function Xze(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function qz(t){return typeof t._addRunToRunMap=="function"}var bgn,_gn,HC,Uz=v(()=>{Jo();au();GQ();nhe();bgn={};$t(bgn,{BaseTracer:()=>HC,isBaseTracer:()=>qz});_gn=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};HC=class extends Dz{constructor(e){super(...arguments);x(this,"runMap",new Map);x(this,"runTreeMap",new Map);x(this,"usesRunTreeMap",!1)}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?_gn(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`
|
||
|
||
${e.stack}`:""):typeof e=="string"?e:`${e}`}_addChildRun(e,r){e.child_runs.push(r)}_addRunToRunMap(e){let{dottedOrder:r,microsecondPrecisionDatestring:n}=Gze(new Date(e.start_time).getTime(),e.id,e.execution_order),o={...e},i=this.getRunById(o.parent_run_id);if(o.parent_run_id!==void 0?i?(this._addChildRun(i,o),i.child_execution_order=Math.max(i.child_execution_order,o.child_execution_order),o.trace_id=i.trace_id,i.dotted_order!==void 0&&(o.dotted_order=[i.dotted_order,r].join("."),o._serialized_start_time=n)):o.parent_run_id=void 0:(o.trace_id=o.id,o.dotted_order=r,o._serialized_start_time=n),this.usesRunTreeMap){let a=Zze(o,i);a!==void 0&&this.runTreeMap.set(o.id,a)}else this.runMap.set(o.id,o);return o}async _endTrace(e){let r=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);r?r.child_execution_order=Math.max(r.child_execution_order,e.child_execution_order):await this.persistRun(e),await this.onRunUpdate?.(e),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){let r=e!==void 0&&this.getRunById(e);return r?r.child_execution_order+1:1}_createRunForLLMStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{prompts:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForLLMStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}_createRunForChatModelStart(e,r,n,o,i,a,s,u){let l=this._getExecutionOrder(o),c=Date.now(),d=s?{...i,metadata:s}:i,f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{messages:r},execution_order:l,child_runs:[],child_execution_order:l,run_type:"llm",extra:d??{},tags:a||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChatModelStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onLLMStart?.(l),l}async handleLLMEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMEnd?.(a),await this._endTrace(a),a}async handleLLMError(e,r,n,o,i){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await this.onLLMError?.(a),await this._endTrace(a),a}_createRunForChainStart(e,r,n,o,i,a,s,u,l){let c=this._getExecutionOrder(o),d=Date.now(),f={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:d,serialized:e,events:[{name:"start",time:new Date(d).toISOString()}],inputs:r,execution_order:c,child_execution_order:c,run_type:s??"chain",child_runs:[],extra:a?{...l,metadata:a}:{...l},tags:i||[]};return this._addRunToRunMap(f)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.getRunById(n)??this._createRunForChainStart(e,r,n,o,i,a,s,u);return await this.onRunCreate?.(l),await this.onChainStart?.(l),l}async handleChainEnd(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=Xze(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Xze(i.inputs,"input")),await this.onChainEnd?.(a),await this._endTrace(a),a}async handleChainError(e,r,n,o,i){let a=this.getRunById(r);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Xze(i.inputs,"input")),await this.onChainError?.(a),await this._endTrace(a),a}_createRunForToolStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{input:r},execution_order:u,child_execution_order:u,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleToolStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForToolStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onToolStart?.(u),u}async handleToolEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onToolEnd?.(n),await this._endTrace(n),n}async handleToolError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="tool")throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onToolError?.(n),await this._endTrace(n),n}async handleAgentAction(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="chain")return;let o=n;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(n)}async handleAgentEnd(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(n))}_createRunForRetrieverStart(e,r,n,o,i,a,s){let u=this._getExecutionOrder(o),l=Date.now(),c={id:n,name:s??e.id[e.id.length-1],parent_run_id:o,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{query:r},execution_order:u,child_execution_order:u,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(c)}async handleRetrieverStart(e,r,n,o,i,a,s){let u=this.getRunById(n)??this._createRunForRetrieverStart(e,r,n,o,i,a,s);return await this.onRunCreate?.(u),await this.onRetrieverStart?.(u),u}async handleRetrieverEnd(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await this.onRetrieverEnd?.(n),await this._endTrace(n),n}async handleRetrieverError(e,r){let n=this.getRunById(r);if(!n||n?.run_type!=="retriever")throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await this.onRetrieverError?.(n),await this._endTrace(n),n}async handleText(e,r){let n=this.getRunById(r);!n||n?.run_type!=="chain"||(n.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(n))}async handleLLMNewToken(e,r,n,o,i,a){let s=this.getRunById(n);if(!s||s?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return s.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:r,chunk:a?.chunk}}),await this.onLLMNewToken?.(s,e,{chunk:a?.chunk}),s}}});var NPt=S((SMi,APt)=>{"use strict";var RPt=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,IPt=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function vgn(){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=RPt(),e.color.ansi16m=IPt(),e.bgColor.ansi256=RPt(10),e.bgColor.ansi16m=IPt(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(APt,"exports",{enumerable:!0,get:vgn})});function Db(t,e){return`${t.open}${e}${t.close}`}function xS(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function DPt(t){return typeof t=="string"?t.trim():t==null?t:xS(t,t.toString())}function HL(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 Yze,wgn,P_,ohe,jPt=v(()=>{Jo();Uz();Yze=$(NPt(),1),wgn={};$t(wgn,{ConsoleCallbackHandler:()=>ohe});({color:P_}=Yze.default),ohe=class extends HC{constructor(){super(...arguments);x(this,"name","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?Db(Yze.default.bold,s):s}).join(" > ");return Db(P_.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.green,"[chain/start]")} [${r}] Entering Chain run with input: ${xS(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.cyan,"[chain/end]")} [${r}] [${HL(e)}] Exiting Chain run with output: ${xS(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.red,"[chain/error]")} [${r}] [${HL(e)}] Chain run errored with error: ${xS(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(`${Db(P_.green,"[llm/start]")} [${r}] Entering LLM run with input: ${xS(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.cyan,"[llm/end]")} [${r}] [${HL(e)}] Exiting LLM run with output: ${xS(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.red,"[llm/error]")} [${r}] [${HL(e)}] LLM run errored with error: ${xS(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.green,"[tool/start]")} [${r}] Entering Tool run with input: "${DPt(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.cyan,"[tool/end]")} [${r}] [${HL(e)}] Exiting Tool run with output: "${DPt(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.red,"[tool/error]")} [${r}] [${HL(e)}] Tool run errored with error: ${xS(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${xS(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.cyan,"[retriever/end]")} [${r}] [${HL(e)}] Exiting Retriever run with output: ${xS(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Db(P_.red,"[retriever/error]")} [${r}] [${HL(e)}] Retriever run errored with error: ${xS(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Db(P_.blue,"[agent/action]")} [${n}] Agent selected action: ${xS(r.actions[r.actions.length-1],"[action]")}`)}}});var ihe=v(()=>{Pme()});var Qze,ahe,e4e=v(()=>{au();ihe();ahe=()=>{if(Qze===void 0){let t=Xr("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};Qze=new Fz(t)}return Qze}});function $Pt(t=!1){let e=Cgn.getInstance().getStore();if(!t&&e===void 0)throw new Error(`Could not get the current run tree.
|
||
|
||
Please make sure you are calling this method within a traceable function and that tracing is enabled.`);return e}function she(t){return typeof t=="function"&&"langsmith:traceable"in t}var r4e,t4e,Sgn,n4e,Cgn,NMi,LPt=v(()=>{r4e=class{getStore(){}run(e,r){return r()}},t4e=Symbol.for("ls:tracing_async_local_storage"),Sgn=new r4e,n4e=class{getInstance(){return globalThis[t4e]??Sgn}initializeGlobalInstance(e){globalThis[t4e]===void 0&&(globalThis[t4e]=e)}},Cgn=new n4e;NMi=Symbol.for("langsmith:traceable:root")});var o4e=v(()=>{LPt()});function Tgn(t){let e;for(let r of t)for(let n of r)Pn.isInstance(n.message)&&n.message.usage_metadata!==void 0&&(e=X6(e,n.message.usage_metadata));return e}var xgn,lee,kPt=v(()=>{Jo();ime();vS();Uz();e4e();o4e();nhe();ihe();xgn={};$t(xgn,{LangChainTracer:()=>lee});lee=class FPt extends HC{constructor(r={}){super(r);x(this,"name","langchain_tracer");x(this,"projectName");x(this,"exampleId");x(this,"client");x(this,"replicas");x(this,"usesRunTreeMap",!0);let{exampleId:n,projectName:o,client:i,replicas:a}=r;this.projectName=o??ZQ(),this.replicas=a,this.exampleId=n,this.client=i??ahe();let s=FPt.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(r){}async onRunCreate(r){r.extra?.lc_defers_inputs||await this.getRunTreeWithTracingConfig(r.id)?.postRun()}async onRunUpdate(r){let n=this.getRunTreeWithTracingConfig(r.id);r.extra?.lc_defers_inputs?await n?.postRun():await n?.patchRun()}onLLMEnd(r){let n=r.outputs;if(n?.generations){let o=Tgn(n.generations);if(o!==void 0){r.extra=r.extra??{};let i=r.extra.metadata??{};i.usage_metadata=o,r.extra.metadata=i}}}getRun(r){return this.runTreeMap.get(r)}updateFromRunTree(r){this.runTreeMap.set(r.id,r);let n=r,o=new Set;for(;n.parent_run&&!(o.has(n.id)||(o.add(n.id),!n.parent_run));)n=n.parent_run;o.clear();let i=[n];for(;i.length>0;){let a=i.shift();!a||o.has(a.id)||(o.add(a.id),this.runTreeMap.set(a.id,a),a.child_runs&&i.push(...a.child_runs))}this.client=r.client??this.client,this.replicas=r.replicas??this.replicas,this.projectName=r.project_name??this.projectName,this.exampleId=r.reference_example_id??this.exampleId}getRunTreeWithTracingConfig(r){let n=this.runTreeMap.get(r);if(n)return new VC({...n,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return $Pt(!0)}catch{return}}}});var UPt=S((JMi,lhe)=>{"use strict";var Ogn=pze(),uhe=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},qPt=(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 uhe(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);Ogn(t.then(n,o),()=>{clearTimeout(i)})});lhe.exports=qPt;lhe.exports.default=qPt;lhe.exports.TimeoutError=uhe});var BPt=S(i4e=>{"use strict";Object.defineProperty(i4e,"__esModule",{value:!0});function Egn(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}i4e.default=Egn});var zPt=S(s4e=>{"use strict";Object.defineProperty(s4e,"__esModule",{value:!0});var Pgn=BPt(),a4e=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=Pgn.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}};s4e.default=a4e});var c4e=S(l4e=>{"use strict";Object.defineProperty(l4e,"__esModule",{value:!0});var Mgn=fze(),VPt=UPt(),Rgn=zPt(),che=()=>{},Ign=new VPt.TimeoutError,u4e=class extends Mgn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=che,this._resolveIdle=che,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Rgn.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=che,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=che,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():VPt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Ign)});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}};l4e.default=u4e});function Agn(){let t="default"in dhe.default?dhe.default.default:dhe.default;return new t({autoStart:!0,concurrency:1})}function Ngn(){return typeof Bz>"u"&&(Bz=Agn()),Bz}async function Dc(t,e){if(e===!0){let r=BL();r!==void 0?await r.run(void 0,async()=>t()):await t()}else Bz=Ngn(),Bz.add(async()=>{let r=BL();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function HPt(){let t=ahe();await Promise.allSettled([typeof Bz<"u"?Bz.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var dhe,Bz,d4e=v(()=>{e4e();jQ();dhe=$(c4e(),1)});var Dgn,WPt=v(()=>{Jo();d4e();Dgn={};$t(Dgn,{awaitAllCallbacks:()=>HPt,consumeCallback:()=>Dc})});var JPt,KPt=v(()=>{au();JPt=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>Xr(r)==="true")});function f4e(t){let e=BL();return e===void 0?void 0:e.getStore()?.[UL]?.[t]}var jgn,GPt,XPt=v(()=>{jQ();nhe();jgn=Symbol("lc:configure_hooks"),GPt=()=>f4e(jgn)||[]});function HN(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function oJ(t){return"name"in t?t:Dz.fromMethods(t)}var $gn,ZPt,dee,YPt,p4e,QPt,eMt,mc,WL=v(()=>{Jo();UC();au();GQ();Uz();jPt();kPt();d4e();WPt();KPt();XPt();JQ();$gn={};$t($gn,{BaseCallbackManager:()=>ZPt,BaseRunManager:()=>dee,CallbackManager:()=>mc,CallbackManagerForChainRun:()=>QPt,CallbackManagerForLLMRun:()=>p4e,CallbackManagerForRetrieverRun:()=>YPt,CallbackManagerForToolRun:()=>eMt,ensureHandler:()=>oJ,parseCallbackConfigArg:()=>HN});ZPt=class{setHandler(t){return this.setHandlers([t])}},dee=class{constructor(t,e,r,n,o,i,a,s){this.runId=t,this.handlers=e,this.inheritableHandlers=r,this.tags=n,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=a,this._parentRunId=s}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleCustomEvent(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Dc(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}},YPt=class extends dee{getChild(t){let e=new mc(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleRetrieverEnd(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw r}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${r}`),e.raiseError)throw t}},e.awaitHandlers)))}},p4e=class extends dee{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(a=>Dc(async()=>{if(!a.ignoreLLM)try{await a.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(s){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleLLMNewToken: ${s}`),a.raiseError)throw s}},a.awaitHandlers)))}async handleLLMError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Dc(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleLLMEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Dc(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}},QPt=class extends dee{getChild(t){let e=new mc(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleChainError(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Dc(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleChainEnd(t,e,r,n,o){await Promise.all(this.handlers.map(i=>Dc(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${a}`),i.raiseError)throw a}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},eMt=class extends dee{getChild(t){let e=new mc(this.runId);return e.setHandlers(this.inheritableHandlers),e.addTags(this.inheritableTags),e.addMetadata(this.inheritableMetadata),t&&e.addTags([t],!1),e}async handleToolError(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>Dc(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(r){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${r}`),e.raiseError)throw r}},e.awaitHandlers)))}},mc=class cee extends ZPt{constructor(r,n){super();x(this,"handlers",[]);x(this,"inheritableHandlers",[]);x(this,"tags",[]);x(this,"inheritableTags",[]);x(this,"metadata",{});x(this,"inheritableMetadata",{});x(this,"name","callback_manager");x(this,"_parentRunId");this.handlers=n?.handlers??this.handlers,this.inheritableHandlers=n?.inheritableHandlers??this.inheritableHandlers,this.tags=n?.tags??this.tags,this.inheritableTags=n?.inheritableTags??this.inheritableTags,this.metadata=n?.metadata??this.metadata,this.inheritableMetadata=n?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=r}getParentRunId(){return this._parentRunId}async handleLLMStart(r,n,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0,l=void 0){return Promise.all(n.map(async(c,d)=>{let f=d===0&&o?o:XT();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return qz(p)&&p._createRunForLLMStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),Dc(async()=>{try{await p.handleLLMStart?.(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l)}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new p4e(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(r,n,o=void 0,i=void 0,a=void 0,s=void 0,u=void 0,l=void 0){return Promise.all(n.map(async(c,d)=>{let f=d===0&&o?o:XT();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return qz(p)&&p._createRunForChatModelStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),Dc(async()=>{try{if(p.handleChatModelStart)await p.handleChatModelStart?.(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l);else if(p.handleLLMStart){let m=fl(c);await p.handleLLMStart?.(r,[m],f,this._parentRunId,a,this.tags,this.metadata,l)}}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new p4e(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(r,n,o=XT(),i=void 0,a=void 0,s=void 0,u=void 0,l=void 0,c=void 0){return await Promise.all(this.handlers.map(d=>{if(!d.ignoreChain)return qz(d)&&d._createRunForChainStart(r,n,o,this._parentRunId,this.tags,this.metadata,i,u,c),Dc(async()=>{try{await d.handleChainStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,i,u,c)}catch(f){if((d.raiseError?console.error:console.warn)(`Error in handler ${d.constructor.name}, handleChainStart: ${f}`),d.raiseError)throw f}},d.awaitHandlers)})),new QPt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(r,n,o=XT(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreAgent)return qz(l)&&l._createRunForToolStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),Dc(async()=>{try{await l.handleToolStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,u)}catch(c){if((l.raiseError?console.error:console.warn)(`Error in handler ${l.constructor.name}, handleToolStart: ${c}`),l.raiseError)throw c}},l.awaitHandlers)})),new eMt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(r,n,o=XT(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreRetriever)return qz(l)&&l._createRunForRetrieverStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),Dc(async()=>{try{await l.handleRetrieverStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,u)}catch(c){if((l.raiseError?console.error:console.warn)(`Error in handler ${l.constructor.name}, handleRetrieverStart: ${c}`),l.raiseError)throw c}},l.awaitHandlers)})),new YPt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(r,n,o,i,a){await Promise.all(this.handlers.map(s=>Dc(async()=>{if(!s.ignoreCustomEvent)try{await s.handleCustomEvent?.(r,n,o,this.tags,this.metadata)}catch(u){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleCustomEvent: ${u}`),s.raiseError)throw u}},s.awaitHandlers)))}addHandler(r,n=!0){this.handlers.push(r),n&&this.inheritableHandlers.push(r)}removeHandler(r){this.handlers=this.handlers.filter(n=>n!==r),this.inheritableHandlers=this.inheritableHandlers.filter(n=>n!==r)}setHandlers(r,n=!0){this.handlers=[],this.inheritableHandlers=[];for(let o of r)this.addHandler(o,n)}addTags(r,n=!0){this.removeTags(r),this.tags.push(...r),n&&this.inheritableTags.push(...r)}removeTags(r){this.tags=this.tags.filter(n=>!r.includes(n)),this.inheritableTags=this.inheritableTags.filter(n=>!r.includes(n))}addMetadata(r,n=!0){this.metadata={...this.metadata,...r},n&&(this.inheritableMetadata={...this.inheritableMetadata,...r})}removeMetadata(r){for(let n of Object.keys(r))delete this.metadata[n],delete this.inheritableMetadata[n]}copy(r=[],n=!0){let o=new cee(this._parentRunId);for(let i of this.handlers){let a=this.inheritableHandlers.includes(i);o.addHandler(i,a)}for(let i of this.tags){let a=this.inheritableTags.includes(i);o.addTags([i],a)}for(let i of Object.keys(this.metadata)){let a=Object.keys(this.inheritableMetadata).includes(i);o.addMetadata({[i]:this.metadata[i]},a)}for(let i of r)o.handlers.filter(a=>a.name==="console_callback_handler").some(a=>a.name===i.name)||o.addHandler(i,n);return o}static fromHandlers(r){class n extends Dz{constructor(){super();x(this,"name",XT());Object.assign(this,r)}}let o=new this;return o.addHandler(new n),o}static configure(r,n,o,i,a,s,u){return this._configureSync(r,n,o,i,a,s,u)}static _configureSync(r,n,o,i,a,s,u){let l;(r||n)&&(Array.isArray(r)||!r?(l=new cee,l.setHandlers(r?.map(oJ)??[],!0)):l=r,l=l.copy(Array.isArray(n)?n.map(oJ):n?.handlers,!1));let c=Xr("LANGCHAIN_VERBOSE")==="true"||u?.verbose,d=lee.getTraceableRunTree()?.tracingEnabled||JPt(),f=d||(Xr("LANGCHAIN_TRACING")??!1);if(c||f){if(l||(l=new cee),c&&!l.handlers.some(p=>p.name===ohe.prototype.name)){let p=new ohe;l.addHandler(p,!0)}if(f&&!l.handlers.some(p=>p.name==="langchain_tracer")&&d){let p=new lee;l.addHandler(p,!0)}if(d){let p=lee.getTraceableRunTree();p&&l._parentRunId===void 0&&(l._parentRunId=p.id,l.handlers.find(h=>h.name==="langchain_tracer")?.updateFromRunTree(p))}}for(let{contextVar:p,inheritable:m=!0,handlerClass:h,envVar:y}of GPt()){let g=y&&Xr(y)==="true"&&h,b,_=p!==void 0?f4e(p):void 0;_&&MBe(_)?b=_:g&&(b=new h({})),b!==void 0&&(l||(l=new cee),l.handlers.some(w=>w.name===b.name)||l.addHandler(b,m))}return(o||i)&&l&&(l.addTags(o??[]),l.addTags(i??[],!1)),(a||s)&&l&&(l.addMetadata(a??{}),l.addMetadata(s??{},!1)),l}}});var m4e,Lgn,tMt,Fgn,Rh,zz=v(()=>{jQ();WL();ihe();m4e=class{getStore(){}run(t,e){return e()}enterWith(t){}},Lgn=new m4e,tMt=Symbol.for("lc:child_config"),Fgn=class{getInstance(){return BL()??Lgn}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[tMt]}runWithConfig(t,e,r){let n=mc._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),a=n?.getParentRunId(),s=n?.handlers?.find(l=>l?.name==="langchain_tracer"),u;return s&&a?u=s.getRunTreeWithTracingConfig(a):r||(u=new VC({name:"<runnable_lambda>",tracingEnabled:!1})),u&&(u.extra={...u.extra,[tMt]:t}),i!==void 0&&i[UL]!==void 0&&(u===void 0&&(u={}),u[UL]=i[UL]),o.run(u,e)}initializeGlobalInstance(t){BL()===void 0&&$Ct(t)}},Rh=new Fgn});var kgn,Vz=v(()=>{Jo();jQ();zz();kgn={};$t(kgn,{AsyncLocalStorageProviderSingleton:()=>Rh,MockAsyncLocalStorage:()=>m4e,_CONTEXT_VARIABLES_KEY:()=>UL})});async function Ry(t){return mc._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function Hz(...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(oJ(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(oJ(s),!0);e.callbacks=a}else e.callbacks=new mc(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 ai(t){let e=Rh.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))qgn.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=r.timeout,o=AbortSignal.timeout(n);r.metadata||(r.metadata={}),r.metadata.timeoutMs===void 0&&(r.metadata.timeoutMs=n),r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,o])):r.signal=o,delete r.timeout}return r}function Xs(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=ai(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 jb(t){if(t)return{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal,store:t.store}}var fhe,qgn,rO=v(()=>{WL();zz();Vz();fhe=25;qgn=new Set(["string","number","boolean"])});async function TS(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(JL(e))},e.addEventListener("abort",r),e.aborted&&o(JL(e))})]).finally(()=>e.removeEventListener("abort",r))}function JL(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var iJ=v(()=>{});function phe(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 Lb(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]=Lb(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function g4e(t,e,r,n,...o){let i=new KL({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Ugn,$b,KL,nO=v(()=>{Jo();zz();Vz();rO();iJ();Ugn={};$t(Ugn,{AsyncGeneratorWithSetup:()=>KL,IterableReadableStream:()=>$b,atee:()=>phe,concat:()=>Lb,pipeGeneratorWithSetup:()=>g4e});$b=class h4e extends ReadableStream{constructor(){super(...arguments);x(this,"reader")}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let r=await this.reader.read();return r.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:r.value}}catch(r){throw this.reader.releaseLock(),r}}async return(){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}return{done:!0,value:void 0}}async throw(r){if(this.ensureReader(),this.locked){let n=this.reader.cancel();this.reader.releaseLock(),await n}throw r}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(r){let n=r.getReader();return new h4e({start(o){return i();function i(){return n.read().then(({done:a,value:s})=>{if(a){o.close();return}return o.enqueue(s),i()})}},cancel(){n.releaseLock()}})}static fromAsyncGenerator(r){return new h4e({async pull(n){let{value:o,done:i}=await r.next();i&&n.close(),n.enqueue(o)},async cancel(n){await r.return(n)}})}};KL=class{constructor(t){x(this,"generator");x(this,"setup");x(this,"config");x(this,"signal");x(this,"firstResult");x(this,"firstResultUsed",!1);this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Rh.runWithConfig(jb(t.config),async()=>{this.firstResult=t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,r):this.firstResult.then(n=>e(void 0),r)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?Rh.runWithConfig(jb(this.config),this.signal?async()=>TS(this.generator.next(...t),this.signal):async()=>this.generator.next(...t),!0):(this.firstResultUsed=!0,this.firstResult)}async return(t){return this.generator.return(t)}async throw(t){return this.generator.throw(t)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}}});function hhe(t,e){return Bgn.call(t,e)}function ghe(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)hhe(t,r)&&e.push(r);return e}function Fb(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function yhe(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 WN(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function bhe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function mhe(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(mhe(t[r]))return!0}else if(typeof t=="object"){let r=ghe(t),n=r.length;for(var e=0;e<n;e++)if(mhe(t[r[e]]))return!0}}return!1}function rMt(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 Bgn,_he,vhe=v(()=>{Bgn=Object.prototype.hasOwnProperty;_he=class extends Error{constructor(t,e,r,n,o){super(rMt(t,{name:e,index:r,operation:n,tree:o})),this.name=e,this.index=r,this.operation=n,this.tree=o,Object.setPrototypeOf(this,new.target.prototype),this.message=rMt(t,{name:e,index:r,operation:n,tree:o})}}});function y4e(t){return Object.getOwnPropertyNames(Object.prototype).includes(t)}function whe(t,e){if(e=="")return t;var r={op:"_get",path:e};return Wz(t,r),r.value}function Wz(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):She(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=whe(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=fee(t,e.value),a.test===!1)throw new jc("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 jc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=Fb(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=She;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=bhe(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&&!yhe(f))throw new jc("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);yhe(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new jc("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=Vgn[e.op].call(e,u,f,t);if(m.test===!1)throw new jc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=aJ[e.op].call(e,u,f,t);if(m.test===!1)throw new jc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new jc("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function GL(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new jc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=Fb(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=Wz(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function Hgn(t,e,r){let n=Wz(t,e);if(n.test===!1)throw new jc("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function She(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new jc("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(aJ[t.op]){if(typeof t.path!="string")throw new jc("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new jc('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 jc("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 jc("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")&&mhe(t.value))throw new jc("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 jc("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 jc("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=nMt([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new jc("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new jc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function nMt(t,e,r){try{if(!Array.isArray(t))throw new jc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)GL(Fb(e),Fb(t),r||!0);else{r=r||She;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof jc)return o;throw o}}function fee(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(!fee(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],!fee(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var b4e,jc,zgn,aJ,Vgn,pee=v(()=>{Jo();vhe();b4e={};$t(b4e,{JsonPatchError:()=>jc,_areEquals:()=>fee,applyOperation:()=>Wz,applyPatch:()=>GL,applyReducer:()=>Hgn,deepClone:()=>zgn,getValueByPointer:()=>whe,validate:()=>nMt,validator:()=>She});jc=_he,zgn=Fb;aJ={add:function(t,e,r){if(y4e(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){if(y4e(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){if(y4e(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=whe(r,this.path);n&&(n=Fb(n));let o=Wz(r,{op:"remove",path:this.from}).removed;return Wz(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=whe(r,this.from);return Wz(r,{op:"add",path:this.path,value:Fb(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:fee(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Vgn={add:function(t,e,r){return yhe(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:aJ.move,copy:aJ.copy,test:aJ.test,_get:aJ._get}});function oMt(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=ghe(e),a=ghe(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(hhe(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)?oMt(d,f,r,n+"/"+WN(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+WN(c),value:Fb(d)}),r.push({op:"replace",path:n+"/"+WN(c),value:Fb(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+WN(c),value:Fb(d)}),r.push({op:"remove",path:n+"/"+WN(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];!hhe(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+WN(c),value:Fb(e[c])})}}}function sJ(t,e,r=!1){var n=[];return oMt(t,e,n,"",r),n}var mee=v(()=>{vhe();pee()});var gIi,_4e=v(()=>{vhe();pee();mee();gIi={...b4e,JsonPatchError:_he,deepClone:Fb,escapePathComponent:WN,unescapePathComponent:bhe}});async function iMt(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 aMt(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 Jgn(t){return t!==void 0&&t.message!==void 0}var Wgn,oO,Che,w4e,xhe,sMt=v(()=>{Jo();vS();pee();_4e();Uz();nO();Wgn={};$t(Wgn,{LogStreamCallbackHandler:()=>xhe,RunLog:()=>Che,RunLogPatch:()=>oO,isLogStreamHandler:()=>w4e});oO=class{constructor(t){x(this,"ops");this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=GL({},e);return new Che({ops:e,state:r[r.length-1].newDocument})}},Che=class v4e extends oO{constructor(r){super(r);x(this,"state");this.state=r.state}concat(r){let n=this.ops.concat(r.ops),o=GL(this.state,r.ops);return new v4e({ops:n,state:o[o.length-1].newDocument})}static fromRunLogPatch(r){let n=GL({},r.ops);return new v4e({ops:r.ops,state:n[n.length-1].newDocument})}},w4e=t=>t.name==="log_stream_tracer";xhe=class extends HC{constructor(e){super({_awaitHandler:!0,...e});x(this,"autoClose",!0);x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");x(this,"_schemaFormat","original");x(this,"rootId");x(this,"keyMapByRunId",{});x(this,"counterMapByRunName",{});x(this,"transformStream");x(this,"writer");x(this,"receiveStream");x(this,"name","log_stream_tracer");x(this,"lc_prefer_streaming",!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=$b.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 oO({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 oO({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 iMt(e,this._schemaFormat)),await this.writer.write(new oO({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 iMt(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await aMt(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 oO({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new oO({ops:[{op:"replace",path:"/final_output",value:await aMt(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?Jgn(n?.chunk)?a=n?.chunk:a=new Er({id:`run-${e.id}`,content:r}):a=r;let s=new oO({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 Kgn,JN,OS,si,Ed=v(()=>{Jo();Kgn={};$t(Kgn,{ChatGenerationChunk:()=>si,GenerationChunk:()=>OS,RUN_KEY:()=>JN});JN="__run",OS=class uMt{constructor(e){x(this,"text");x(this,"generationInfo");this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new uMt({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},si=class lMt extends OS{constructor(r){super(r);x(this,"message");this.message=r.message}concat(r){return new lMt({text:this.text+r.text,generationInfo:{...this.generationInfo,...r.generationInfo},message:this.message.concat(r.message)})}}});function The({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 cMt,dMt,fMt=v(()=>{vS();Uz();nO();Ed();cMt=t=>t.name==="event_stream_tracer",dMt=class extends HC{constructor(e){super({_awaitHandler:!0,...e});x(this,"autoClose",!0);x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");x(this,"runInfoMap",new Map);x(this,"tappedPromises",new Map);x(this,"transformStream");x(this,"writer");x(this,"receiveStream");x(this,"readableStreamClosed",!1);x(this,"name","event_stream_tracer");x(this,"lc_prefer_streaming",!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({flush:()=>{this.readableStreamClosed=!0}}),this.writer=this.transformStream.writable.getWriter(),this.receiveStream=$b.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 OS({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.readableStreamClosed||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=The(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 Er({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 OS({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=The(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=The(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=The(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()})}}});function pMt(t){if(!(t&&Xgn(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:n}=t;return r==="Load failed"?n===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:Zgn.has(r)}var Ggn,Xgn,Zgn,mMt=v(()=>{Ggn=Object.prototype.toString,Xgn=t=>Ggn.call(t)==="[object Error]",Zgn=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"])});function Ygn(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function Ohe(t,e,{min:r=0,allowInfinity:n=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${n?" or Infinity":""}.`);if(!n&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e<r)throw new TypeError(`Expected \`${t}\` to be \u2265 ${r}.`)}}function eyn(t,e){let r=Math.max(1,t+1),n=e.randomize?Math.random()+1:1,o=Math.round(n*e.minTimeout*e.factor**(r-1));return o=Math.min(o,e.maxTimeout),o}function hMt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function tyn({error:t,attemptNumber:e,retriesConsumed:r,startTime:n,options:o}){let i=t instanceof Error?t:new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(i instanceof Qgn)throw i.originalError;let a=Number.isFinite(o.retries)?Math.max(0,o.retries-r):o.retries,s=o.maxRetryTime??Number.POSITIVE_INFINITY,u=Object.freeze({error:i,attemptNumber:e,retriesLeft:a,retriesConsumed:r});if(await o.onFailedAttempt(u),hMt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=hMt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!pMt(i)){if(l)throw i;return o.signal?.throwIfAborted(),!1}if(!await o.shouldRetry(u))throw i;if(!l)return o.signal?.throwIfAborted(),!1;let d=eyn(r,o),f=Math.min(d,c);return f>0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(y),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},y=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&y.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function hee(t,e={}){if(e={...e},Ygn(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??(e.retries=10),e.factor??(e.factor=2),e.minTimeout??(e.minTimeout=1e3),e.maxTimeout??(e.maxTimeout=Number.POSITIVE_INFINITY),e.maxRetryTime??(e.maxRetryTime=Number.POSITIVE_INFINITY),e.randomize??(e.randomize=!1),e.onFailedAttempt??(e.onFailedAttempt=()=>{}),e.shouldRetry??(e.shouldRetry=()=>!0),e.shouldConsumeRetry??(e.shouldConsumeRetry=()=>!0),Ohe("factor",e.factor,{min:0,allowInfinity:!1}),Ohe("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Ohe("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Ohe("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,n=0,o=performance.now();for(;!Number.isFinite(e.retries)||n<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await tyn({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var Qgn,S4e=v(()=>{mMt();Qgn=class extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}});var Ehe,ryn,nyn,oyn,ES,Jz=v(()=>{Jo();iJ();S4e();Ehe=$(c4e(),1),ryn={};$t(ryn,{AsyncCaller:()=>ES});nyn=[400,401,402,403,404,405,406,407,409],oyn=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&&nyn.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},ES=class{constructor(t){x(this,"maxConcurrency");x(this,"maxRetries");x(this,"onFailedAttempt");x(this,"queue");this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??oyn;let e="default"in Ehe.default?Ehe.default.default:Ehe.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>hee(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:({error:r})=>this.onFailedAttempt?.(r),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){if(t.signal){let n;return Promise.race([this.call(e,...r),new Promise((o,i)=>{n=()=>{i(JL(t.signal))},t.signal?.addEventListener("abort",n)})]).finally(()=>{t.signal&&n&&t.signal.removeEventListener("abort",n)})}return this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}}});var C4e,gMt=v(()=>{Uz();C4e=class extends HC{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0});x(this,"name","RootListenersTracer");x(this,"rootId");x(this,"config");x(this,"argOnStart");x(this,"argOnEnd");x(this,"argOnError");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 gee(t){return t?t.lc_runnable:!1}var yMt,bMt,Phe=v(()=>{yMt=class{constructor(t){x(this,"includeNames");x(this,"includeTypes");x(this,"includeTags");x(this,"excludeNames");x(this,"excludeTypes");x(this,"excludeTags");this.includeNames=t.includeNames,this.includeTypes=t.includeTypes,this.includeTags=t.includeTags,this.excludeNames=t.excludeNames,this.excludeTypes=t.excludeTypes,this.excludeTags=t.excludeTags}includeEvent(t,e){let r=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,n=t.tags??[];return this.includeNames!==void 0&&(r=r||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e)),this.includeTags!==void 0&&(r=r||n.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}},bMt=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")});function xe(t,e,r){function n(s,u){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(t),e(s,u);for(let c in a.prototype)c in s||Object.defineProperty(s,c,{value:a.prototype[c].bind(s)});s._zod.constr=a,s._zod.def=u}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var u;let l=r?.Parent?new i:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function Pd(t){return t&&Object.assign(yee,t),yee}var x4e,T4e,iO,yee,uJ=v(()=>{x4e=Object.freeze({status:"aborted"});T4e=Symbol("zod_brand"),iO=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},yee={}});var Dt={};En(Dt,{BIGINT_FORMAT_RANGES:()=>j4e,Class:()=>E4e,NUMBER_FORMAT_RANGES:()=>D4e,aborted:()=>Gz,allowsEval:()=>I4e,assert:()=>lyn,assertEqual:()=>iyn,assertIs:()=>syn,assertNever:()=>uyn,assertNotEqual:()=>ayn,assignProp:()=>R4e,cached:()=>vee,captureStackTrace:()=>Mhe,cleanEnum:()=>Syn,cleanRegex:()=>wee,clone:()=>hc,createTransparentProxy:()=>hyn,defineLazy:()=>Us,esc:()=>Kz,escapeRegex:()=>KN,extend:()=>byn,finalizeIssue:()=>ow,floatSafeRemainder:()=>M4e,getElementAtPath:()=>cyn,getEnumValues:()=>_ee,getLengthableOrigin:()=>xee,getParsedType:()=>myn,getSizableOrigin:()=>Cee,isObject:()=>lJ,isPlainObject:()=>cJ,issue:()=>$4e,joinValues:()=>We,jsonStringifyReplacer:()=>P4e,merge:()=>_yn,normalizeParams:()=>vt,nullish:()=>XL,numKeys:()=>pyn,omit:()=>yyn,optionalKeys:()=>N4e,partial:()=>vyn,pick:()=>gyn,prefixIssues:()=>M_,primitiveTypes:()=>A4e,promiseAllObject:()=>dyn,propertyKeyTypes:()=>See,randomString:()=>fyn,required:()=>wyn,stringifyPrimitive:()=>Ut,unwrapMessage:()=>bee});function iyn(t){return t}function ayn(t){return t}function syn(t){}function uyn(t){throw new Error}function lyn(t){}function _ee(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function We(t,e="|"){return t.map(r=>Ut(r)).join(e)}function P4e(t,e){return typeof e=="bigint"?e.toString():e}function vee(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function XL(t){return t==null}function wee(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function M4e(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function Us(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function R4e(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function cyn(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function dyn(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function fyn(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Kz(t){return JSON.stringify(t)}function lJ(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function cJ(t){if(lJ(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(lJ(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pyn(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function KN(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hc(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function vt(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function hyn(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Ut(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function N4e(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function gyn(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return hc(t,{...t._zod.def,shape:r,checks:[]})}function yyn(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return hc(t,{...t._zod.def,shape:r,checks:[]})}function byn(t,e){if(!cJ(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return R4e(this,"shape",n),n},checks:[]};return hc(t,r)}function _yn(t,e){return hc(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return R4e(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function vyn(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=t?new t({type:"optional",innerType:n[i]}):n[i])}else for(let i in n)o[i]=t?new t({type:"optional",innerType:n[i]}):n[i];return hc(e,{...e._zod.def,shape:o,checks:[]})}function wyn(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)o[i]=new t({type:"nonoptional",innerType:n[i]});return hc(e,{...e._zod.def,shape:o,checks:[]})}function Gz(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function M_(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function bee(t){return typeof t=="string"?t:t?.message}function ow(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=bee(t.inst?._zod.def?.error?.(t))??bee(e?.error?.(t))??bee(r.customError?.(t))??bee(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Cee(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function xee(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function $4e(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Syn(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Mhe,I4e,myn,See,A4e,D4e,j4e,E4e,zn=v(()=>{Mhe=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};I4e=vee(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});myn=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},See=new Set(["string","number","symbol"]),A4e=new Set(["string","number","bigint","boolean","symbol","undefined"]);D4e={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},j4e={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};E4e=class{constructor(...e){}}});function Oee(t,e=r=>r.message){let r={},n=[];for(let o of t.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}}function Eee(t,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.errors.length)a.errors.map(s=>o({issues:s}));else if(a.code==="invalid_key")o({issues:a.issues});else if(a.code==="invalid_element")o({issues:a.issues});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(t),n}function L4e(t,e){let r=e||function(i){return i.message},n={errors:[]},o=(i,a=[])=>{var s,u;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>o({issues:c},l.path));else if(l.code==="invalid_key")o({issues:l.issues},l.path);else if(l.code==="invalid_element")o({issues:l.issues},l.path);else{let c=[...a,...l.path];if(c.length===0){n.errors.push(r(l));continue}let d=n,f=0;for(;f<c.length;){let p=c[f],m=f===c.length-1;typeof p=="string"?(d.properties??(d.properties={}),(s=d.properties)[p]??(s[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(u=d.items)[p]??(u[p]={errors:[]}),d=d.items[p]),m&&d.errors.push(r(l)),f++}}};return o(t),n}function vMt(t){let e=[];for(let r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function F4e(t){let e=[],r=[...t.issues].sort((n,o)=>n.path.length-o.path.length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${vMt(n.path)}`);return e.join(`
|
||
`)}var _Mt,Tee,dJ,k4e=v(()=>{uJ();zn();_Mt=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,P4e,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Tee=xe("$ZodError",_Mt),dJ=xe("$ZodError",_Mt,{Parent:Error})});var Rhe,aO,Ihe,Xz,Ahe,q4e,Nhe,U4e,Dhe=v(()=>{uJ();k4e();zn();Rhe=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new iO;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>ow(u,i,Pd())));throw Mhe(s,o?.callee),s}return a.value},aO=Rhe(dJ),Ihe=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>ow(u,i,Pd())));throw Mhe(s,o?.callee),s}return a.value},Xz=Ihe(dJ),Ahe=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new iO;return i.issues.length?{success:!1,error:new(t??Tee)(i.issues.map(a=>ow(a,o,Pd())))}:{success:!0,data:i.value}},q4e=Ahe(dJ),Nhe=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>ow(a,o,Pd())))}:{success:!0,data:i.value}},U4e=Nhe(dJ)});var Yz={};En(Yz,{_emoji:()=>wMt,base64:()=>r2e,base64url:()=>jhe,bigint:()=>l2e,boolean:()=>f2e,browserEmail:()=>Iyn,cidrv4:()=>e2e,cidrv6:()=>t2e,cuid:()=>B4e,cuid2:()=>z4e,date:()=>i2e,datetime:()=>s2e,domain:()=>Ayn,duration:()=>K4e,e164:()=>o2e,email:()=>X4e,emoji:()=>Z4e,extendedDuration:()=>xyn,guid:()=>G4e,hostname:()=>n2e,html5Email:()=>Pyn,integer:()=>c2e,ipv4:()=>Y4e,ipv6:()=>Q4e,ksuid:()=>W4e,lowercase:()=>h2e,nanoid:()=>J4e,null:()=>p2e,number:()=>d2e,rfc5322Email:()=>Myn,string:()=>u2e,time:()=>a2e,ulid:()=>V4e,undefined:()=>m2e,unicodeEmail:()=>Ryn,uppercase:()=>g2e,uuid:()=>Zz,uuid4:()=>Tyn,uuid6:()=>Oyn,uuid7:()=>Eyn,xid:()=>H4e});function Z4e(){return new RegExp(wMt,"u")}function CMt(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function a2e(t){return new RegExp(`^${CMt(t)}$`)}function s2e(t){let e=CMt({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${SMt}T(?:${n})$`)}var B4e,z4e,V4e,H4e,W4e,J4e,K4e,xyn,G4e,Zz,Tyn,Oyn,Eyn,X4e,Pyn,Myn,Ryn,Iyn,wMt,Y4e,Q4e,e2e,t2e,r2e,jhe,n2e,Ayn,o2e,SMt,i2e,u2e,l2e,c2e,d2e,f2e,p2e,m2e,h2e,g2e,$he=v(()=>{B4e=/^[cC][^\s-]{8,}$/,z4e=/^[0-9a-z]+$/,V4e=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,H4e=/^[0-9a-vA-V]{20}$/,W4e=/^[A-Za-z0-9]{27}$/,J4e=/^[a-zA-Z0-9_-]{21}$/,K4e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xyn=/^[-+]?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)?)??$/,G4e=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zz=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Tyn=Zz(4),Oyn=Zz(6),Eyn=Zz(7),X4e=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pyn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Myn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ryn=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Iyn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,wMt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Y4e=/^(?:(?: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])$/,Q4e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,e2e=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,t2e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,r2e=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jhe=/^[A-Za-z0-9_-]*$/,n2e=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Ayn=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,o2e=/^\+(?:[0-9]){6,14}[0-9]$/,SMt="(?:(?:\\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])))",i2e=new RegExp(`^${SMt}$`);u2e=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},l2e=/^\d+n?$/,c2e=/^\d+$/,d2e=/^-?\d+(?:\.\d+)?/i,f2e=/true|false/i,p2e=/null/i,m2e=/undefined/i,h2e=/^[^A-Z]*$/,g2e=/^[^a-z]*$/});function xMt(t,e,r){t.issues.length&&e.issues.push(...M_(r,t.issues))}var gc,TMt,Lhe,Fhe,y2e,b2e,_2e,v2e,w2e,S2e,C2e,x2e,T2e,fJ,O2e,E2e,P2e,M2e,R2e,I2e,A2e,N2e,D2e,khe=v(()=>{uJ();$he();zn();gc=xe("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),TMt={number:"number",bigint:"bigint",object:"date"},Lhe=xe("$ZodCheckLessThan",(t,e)=>{gc.init(t,e);let r=TMt[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Fhe=xe("$ZodCheckGreaterThan",(t,e)=>{gc.init(t,e);let r=TMt[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),y2e=xe("$ZodCheckMultipleOf",(t,e)=>{gc.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):M4e(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),b2e=xe("$ZodCheckNumberFormat",(t,e)=>{gc.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=D4e[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=c2e)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:t})}}),_2e=xe("$ZodCheckBigIntFormat",(t,e)=>{gc.init(t,e);let[r,n]=j4e[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),v2e=xe("$ZodCheckMaxSize",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Cee(o),code:"too_big",maximum:e.maximum,input:o,inst:t,continue:!e.abort})}}),w2e=xe("$ZodCheckMinSize",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Cee(o),code:"too_small",minimum:e.minimum,input:o,inst:t,continue:!e.abort})}}),S2e=xe("$ZodCheckSizeEquals",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Cee(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),C2e=xe("$ZodCheckMaxLength",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=xee(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),x2e=xe("$ZodCheckMinLength",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=xee(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),T2e=xe("$ZodCheckLengthEquals",(t,e)=>{var r;gc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!XL(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=xee(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),fJ=xe("$ZodCheckStringFormat",(t,e)=>{var r,n;gc.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),O2e=xe("$ZodCheckRegex",(t,e)=>{fJ.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),E2e=xe("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=h2e),fJ.init(t,e)}),P2e=xe("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=g2e),fJ.init(t,e)}),M2e=xe("$ZodCheckIncludes",(t,e)=>{gc.init(t,e);let r=KN(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),R2e=xe("$ZodCheckStartsWith",(t,e)=>{gc.init(t,e);let r=new RegExp(`^${KN(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),I2e=xe("$ZodCheckEndsWith",(t,e)=>{gc.init(t,e);let r=new RegExp(`.*${KN(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});A2e=xe("$ZodCheckProperty",(t,e)=>{gc.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>xMt(o,r,e.property));xMt(n,r,e.property)}}),N2e=xe("$ZodCheckMimeType",(t,e)=>{gc.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t})}}),D2e=xe("$ZodCheckOverwrite",(t,e)=>{gc.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var Pee,j2e=v(()=>{Pee=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
||
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
|
||
`))}}});var $2e,L2e=v(()=>{$2e={major:4,minor:0,patch:0}});function oVe(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function FMt(t){if(!jhe.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return oVe(r)}function kMt(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function EMt(t,e,r){t.issues.length&&e.issues.push(...M_(r,t.issues)),e.value[r]=t.value}function qhe(t,e,r){t.issues.length&&e.issues.push(...M_(r,t.issues)),e.value[r]=t.value}function PMt(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...M_(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function MMt(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(i=>ow(i,n,Pd())))}),e}function F2e(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(cJ(t)&&cJ(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=F2e(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=F2e(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function RMt(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Gz(t))return t;let n=F2e(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}function Uhe(t,e,r){t.issues.length&&e.issues.push(...M_(r,t.issues)),e.value[r]=t.value}function IMt(t,e,r,n,o,i,a){t.issues.length&&(See.has(typeof n)?r.issues.push(...M_(n,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:o,inst:i,issues:t.issues.map(s=>ow(s,a,Pd()))})),e.issues.length&&(See.has(typeof n)?r.issues.push(...M_(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>ow(s,a,Pd()))})),r.value.set(t.value,e.value)}function AMt(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function NMt(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function DMt(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function jMt(t,e,r){return Gz(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function $Mt(t){return t.value=Object.freeze(t.value),t}function LMt(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push($4e(o))}}var uo,Qz,Ru,k2e,q2e,U2e,B2e,z2e,V2e,H2e,W2e,J2e,K2e,G2e,X2e,Z2e,Y2e,Q2e,eVe,tVe,rVe,nVe,iVe,aVe,sVe,uVe,lVe,Bhe,cVe,Mee,zhe,dVe,fVe,pVe,mVe,hVe,ZL,Ree,gVe,yVe,Iee,bVe,Vhe,_Ve,vVe,e4,wVe,SVe,CVe,xVe,TVe,OVe,Aee,pJ,EVe,PVe,MVe,RVe,IVe,AVe,NVe,Nee,DVe,jVe,$Ve,LVe,FVe,Dee=v(()=>{khe();uJ();j2e();Dhe();$he();zn();L2e();zn();uo=xe("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=$2e;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,s)=>{let u=Gz(i),l;for(let c of a){if(c._zod.def.when){if(!c._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=c._zod.check(i);if(f instanceof Promise&&s?.async===!1)throw new iO;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=Gz(i,d)))});else{if(i.issues.length===d)continue;u||(u=Gz(i,d))}}return l?l.then(()=>i):i};t._zod.run=(i,a)=>{let s=t._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new iO;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=q4e(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return U4e(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),Qz=xe("$ZodString",(t,e)=>{uo.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??u2e(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Ru=xe("$ZodStringFormat",(t,e)=>{fJ.init(t,e),Qz.init(t,e)}),k2e=xe("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=G4e),Ru.init(t,e)}),q2e=xe("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Zz(n))}else e.pattern??(e.pattern=Zz());Ru.init(t,e)}),U2e=xe("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=X4e),Ru.init(t,e)}),B2e=xe("$ZodURL",(t,e)=>{Ru.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),i=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n2e.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),z2e=xe("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Z4e()),Ru.init(t,e)}),V2e=xe("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=J4e),Ru.init(t,e)}),H2e=xe("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=B4e),Ru.init(t,e)}),W2e=xe("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=z4e),Ru.init(t,e)}),J2e=xe("$ZodULID",(t,e)=>{e.pattern??(e.pattern=V4e),Ru.init(t,e)}),K2e=xe("$ZodXID",(t,e)=>{e.pattern??(e.pattern=H4e),Ru.init(t,e)}),G2e=xe("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=W4e),Ru.init(t,e)}),X2e=xe("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=s2e(e)),Ru.init(t,e)}),Z2e=xe("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=i2e),Ru.init(t,e)}),Y2e=xe("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=a2e(e)),Ru.init(t,e)}),Q2e=xe("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=K4e),Ru.init(t,e)}),eVe=xe("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Y4e),Ru.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),tVe=xe("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Q4e),Ru.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),rVe=xe("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=e2e),Ru.init(t,e)}),nVe=xe("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=t2e),Ru.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});iVe=xe("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=r2e),Ru.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{oVe(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});aVe=xe("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=jhe),Ru.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{FMt(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),sVe=xe("$ZodE164",(t,e)=>{e.pattern??(e.pattern=o2e),Ru.init(t,e)});uVe=xe("$ZodJWT",(t,e)=>{Ru.init(t,e),t._zod.check=r=>{kMt(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),lVe=xe("$ZodCustomStringFormat",(t,e)=>{Ru.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),Bhe=xe("$ZodNumber",(t,e)=>{uo.init(t,e),t._zod.pattern=t._zod.bag.pattern??d2e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),cVe=xe("$ZodNumber",(t,e)=>{b2e.init(t,e),Bhe.init(t,e)}),Mee=xe("$ZodBoolean",(t,e)=>{uo.init(t,e),t._zod.pattern=f2e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),zhe=xe("$ZodBigInt",(t,e)=>{uo.init(t,e),t._zod.pattern=l2e,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),dVe=xe("$ZodBigInt",(t,e)=>{_2e.init(t,e),zhe.init(t,e)}),fVe=xe("$ZodSymbol",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),pVe=xe("$ZodUndefined",(t,e)=>{uo.init(t,e),t._zod.pattern=m2e,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),mVe=xe("$ZodNull",(t,e)=>{uo.init(t,e),t._zod.pattern=p2e,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),hVe=xe("$ZodAny",(t,e)=>{uo.init(t,e),t._zod.parse=r=>r}),ZL=xe("$ZodUnknown",(t,e)=>{uo.init(t,e),t._zod.parse=r=>r}),Ree=xe("$ZodNever",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),gVe=xe("$ZodVoid",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),yVe=xe("$ZodDate",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});Iee=xe("$ZodArray",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],u=e.element._zod.run({value:s,issues:[]},n);u instanceof Promise?i.push(u.then(l=>EMt(l,r,a))):EMt(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});bVe=xe("$ZodObject",(t,e)=>{uo.init(t,e);let r=vee(()=>{let d=Object.keys(e.shape);for(let p of d)if(!(e.shape[p]instanceof uo))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);let f=N4e(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});Us(t._zod,"propValues",()=>{let d=e.shape,f={};for(let p in d){let m=d[p]._zod;if(m.values){f[p]??(f[p]=new Set);for(let h of m.values)f[p].add(h)}}return f});let n=d=>{let f=new Pee(["shape","payload","ctx"]),p=r.value,m=b=>{let _=Kz(b);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),y=0;for(let b of p.keys)h[b]=`key_${y++}`;f.write("const newResult = {}");for(let b of p.keys)if(p.optionalKeys.has(b)){let _=h[b];f.write(`const ${_} = ${m(b)};`);let w=Kz(b);f.write(`
|
||
if (${_}.issues.length) {
|
||
if (input[${w}] === undefined) {
|
||
if (${w} in input) {
|
||
newResult[${w}] = undefined;
|
||
}
|
||
} else {
|
||
payload.issues = payload.issues.concat(
|
||
${_}.issues.map((iss) => ({
|
||
...iss,
|
||
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
||
}))
|
||
);
|
||
}
|
||
} else if (${_}.value === undefined) {
|
||
if (${w} in input) newResult[${w}] = undefined;
|
||
} else {
|
||
newResult[${w}] = ${_}.value;
|
||
}
|
||
`)}else{let _=h[b];f.write(`const ${_} = ${m(b)};`),f.write(`
|
||
if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${Kz(b)}, ...iss.path] : [${Kz(b)}]
|
||
})));`),f.write(`newResult[${Kz(b)}] = ${_}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let g=f.compile();return(b,_)=>g(d,b,_)},o,i=lJ,a=!yee.jitless,u=a&&I4e.value,l=e.catchall,c;t._zod.parse=(d,f)=>{c??(c=r.value);let p=d.value;if(!i(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),d;let m=[];if(a&&u&&f?.async===!1&&f.jitless!==!0)o||(o=n(e.shape)),d=o(d,f);else{d.value={};let _=c.shape;for(let w of c.keys){let T=_[w],O=T._zod.run({value:p[w],issues:[]},f),E=T._zod.optin==="optional"&&T._zod.optout==="optional";O instanceof Promise?m.push(O.then(P=>E?PMt(P,d,w,p):qhe(P,d,w))):E?PMt(O,d,w,p):qhe(O,d,w)}}if(!l)return m.length?Promise.all(m).then(()=>d):d;let h=[],y=c.keySet,g=l._zod,b=g.def.type;for(let _ of Object.keys(p)){if(y.has(_))continue;if(b==="never"){h.push(_);continue}let w=g.run({value:p[_],issues:[]},f);w instanceof Promise?m.push(w.then(T=>qhe(T,d,_))):qhe(w,d,_)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:p,inst:t}),m.length?Promise.all(m).then(()=>d):d}});Vhe=xe("$ZodUnion",(t,e)=>{uo.init(t,e),Us(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Us(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Us(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Us(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>wee(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,i=[];for(let a of e.options){let s=a._zod.run({value:r.value,issues:[]},n);if(s instanceof Promise)i.push(s),o=!0;else{if(s.issues.length===0)return s;i.push(s)}}return o?Promise.all(i).then(a=>MMt(a,r,t,n)):MMt(i,r,t,n)}}),_Ve=xe("$ZodDiscriminatedUnion",(t,e)=>{Vhe.init(t,e);let r=t._zod.parse;Us(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,u]of Object.entries(a)){o[s]||(o[s]=new Set);for(let l of u)o[s].add(l)}}return o});let n=vee(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let u of s){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!lJ(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),o)}}),vVe=xe("$ZodIntersection",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>RMt(r,u,l)):RMt(r,i,a)}});e4=xe("$ZodTuple",(t,e)=>{uo.init(t,e);let r=e.items,n=r.length-[...r].reverse().findIndex(o=>o._zod.optin!=="optional");t._zod.parse=(o,i)=>{let a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:t,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[];if(!e.rest){let l=a.length>r.length,c=a.length<n-1;if(l||c)return o.issues.push({input:a,inst:t,origin:"array",...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),o}let u=-1;for(let l of r){if(u++,u>=a.length&&u>=n)continue;let c=l._zod.run({value:a[u],issues:[]},i);c instanceof Promise?s.push(c.then(d=>Uhe(d,o,u))):Uhe(c,o,u)}if(e.rest){let l=a.slice(r.length);for(let c of l){u++;let d=e.rest._zod.run({value:c,issues:[]},i);d instanceof Promise?s.push(d.then(f=>Uhe(f,o,u))):Uhe(d,o,u)}}return s.length?Promise.all(s).then(()=>o):o}});wVe=xe("$ZodRecord",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!cJ(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[];if(e.keyType._zod.values){let a=e.keyType._zod.values;r.value={};for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&r.issues.push(...M_(u,c.issues)),r.value[u]=c.value})):(l.issues.length&&r.issues.push(...M_(u,l.issues)),r.value[u]=l.value)}let s;for(let u in o)a.has(u)||(s=s??[],s.push(u));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:s})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let s=e.keyType._zod.run({value:a,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:s.issues.map(l=>ow(l,n,Pd())),input:a,path:[a],inst:t}),r.value[s.value]=s.value;continue}let u=e.valueType._zod.run({value:o[a],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...M_(a,l.issues)),r.value[s.value]=l.value})):(u.issues.length&&r.issues.push(...M_(a,u.issues)),r.value[s.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),SVe=xe("$ZodMap",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let u=e.keyType._zod.run({value:a,issues:[]},n),l=e.valueType._zod.run({value:s,issues:[]},n);u instanceof Promise||l instanceof Promise?i.push(Promise.all([u,l]).then(([c,d])=>{IMt(c,d,r,a,o,t,n)})):IMt(u,l,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});CVe=xe("$ZodSet",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(u=>AMt(u,r))):AMt(s,r)}return i.length?Promise.all(i).then(()=>r):r}});xVe=xe("$ZodEnum",(t,e)=>{uo.init(t,e);let r=_ee(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>See.has(typeof n)).map(n=>typeof n=="string"?KN(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),TVe=xe("$ZodLiteral",(t,e)=>{uo.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?KN(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}}),OVe=xe("$ZodFile",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),Aee=xe("$ZodTransform",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new iO;return r.value=o,r}}),pJ=xe("$ZodOptional",(t,e)=>{uo.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Us(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Us(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wee(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),EVe=xe("$ZodNullable",(t,e)=>{uo.init(t,e),Us(t._zod,"optin",()=>e.innerType._zod.optin),Us(t._zod,"optout",()=>e.innerType._zod.optout),Us(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wee(r.source)}|null)$`):void 0}),Us(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),PVe=xe("$ZodDefault",(t,e)=>{uo.init(t,e),t._zod.optin="optional",Us(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>NMt(i,e)):NMt(o,e)}});MVe=xe("$ZodPrefault",(t,e)=>{uo.init(t,e),t._zod.optin="optional",Us(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),RVe=xe("$ZodNonOptional",(t,e)=>{uo.init(t,e),Us(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>DMt(i,t)):DMt(o,t)}});IVe=xe("$ZodSuccess",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),AVe=xe("$ZodCatch",(t,e)=>{uo.init(t,e),t._zod.optin="optional",Us(t._zod,"optout",()=>e.innerType._zod.optout),Us(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>ow(a,n,Pd()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>ow(i,n,Pd()))},input:r.value}),r.issues=[]),r)}}),NVe=xe("$ZodNaN",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Nee=xe("$ZodPipe",(t,e)=>{uo.init(t,e),Us(t._zod,"values",()=>e.in._zod.values),Us(t._zod,"optin",()=>e.in._zod.optin),Us(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>jMt(i,e,n)):jMt(o,e,n)}});DVe=xe("$ZodReadonly",(t,e)=>{uo.init(t,e),Us(t._zod,"propValues",()=>e.innerType._zod.propValues),Us(t._zod,"values",()=>e.innerType._zod.values),Us(t._zod,"optin",()=>e.innerType._zod.optin),Us(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then($Mt):$Mt(o)}});jVe=xe("$ZodTemplateLiteral",(t,e)=>{uo.init(t,e);let r=[];for(let n of e.parts)if(n instanceof uo){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||A4e.has(typeof n))r.push(KN(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),n)}),$Ve=xe("$ZodPromise",(t,e)=>{uo.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),LVe=xe("$ZodLazy",(t,e)=>{uo.init(t,e),Us(t._zod,"innerType",()=>e.getter()),Us(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),Us(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),Us(t._zod,"optin",()=>t._zod.innerType._zod.optin),Us(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),FVe=xe("$ZodCustom",(t,e)=>{gc.init(t,e),uo.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>LMt(i,r,n,t));LMt(o,r,n,t)}})});function UMt(){return{localeError:Nyn()}}var Nyn,BMt=v(()=>{zn();Nyn=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return o=>{switch(o.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Ut(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${n[i.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${We(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}}});function zMt(){return{localeError:Dyn()}}var Dyn,VMt=v(()=>{zn();Dyn=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Ut(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[i.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${We(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}}});function HMt(t,e,r,n){let o=Math.abs(t),i=o%10,a=o%100;return a>=11&&a<=19?n:i===1?e:i>=2&&i<=4?r:n}function WMt(){return{localeError:jyn()}}var jyn,JMt=v(()=>{zn();jyn=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0456\u045E";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Ut(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=HMt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${o.maximum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);if(a){let s=Number(o.minimum),u=HMt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${i}${o.minimum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${We(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}}});function KMt(){return{localeError:$yn()}}var $yn,GMt=v(()=>{zn();$yn=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${o.expected}, s'ha rebut ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${Ut(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${We(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",a=e(o.origin);return a?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"com a m\xEDnim":"m\xE9s de",a=e(o.origin);return a?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}}});function XMt(){return{localeError:Lyn()}}var Lyn,ZMt=v(()=>{zn();Lyn=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(o))return"pole";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return o=>{switch(o.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o.expected}, obdr\u017Eeno ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Ut(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${n[i.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${We(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}}});function YMt(){return{localeError:Fyn()}}var Fyn,QMt=v(()=>{zn();Fyn=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"Zahl";case"object":{if(Array.isArray(o))return"Array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return o=>{switch(o.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${o.expected}, erhalten ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Ut(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ist`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${We(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}}});function Hhe(){return{localeError:qyn()}}var kyn,qyn,kVe=v(()=>{zn();kyn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},qyn=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${kyn(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Ut(n.values[0])}`:`Invalid option: expected one of ${We(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${We(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}}});function eRt(){return{localeError:Byn()}}var Uyn,Byn,tRt=v(()=>{zn();Uyn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Byn=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(n){return t[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${n.expected}, ricevi\u011Dis ${Uyn(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${Ut(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${We(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${We(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}}});function rRt(){return{localeError:zyn()}}var zyn,nRt=v(()=>{zn();zyn=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"arreglo";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype)return o.constructor.name}}return i},n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${o.expected}, recibido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: se esperaba ${Ut(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Demasiado grande: se esperaba que ${o.origin??"valor"} tuviera ${i}${o.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${o.origin??"valor"} fuera ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Demasiado peque\xF1o: se esperaba que ${o.origin} tuviera ${i}${o.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${o.origin} fuera ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${n[i.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Llave${o.keys.length>1?"s":""} desconocida${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o.origin}`;default:return"Entrada inv\xE1lida"}}}});function oRt(){return{localeError:Vyn()}}var Vyn,iRt=v(()=>{zn();Vyn=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0622\u0631\u0627\u06CC\u0647";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return o=>{switch(o.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(o.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Ut(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${We(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[i.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${We(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}}});function aRt(){return{localeError:Hyn()}}var Hyn,sRt=v(()=>{zn();Hyn=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return o=>{switch(o.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${o.expected}, oli ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Ut(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${n[i.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${We(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}}});function uRt(){return{localeError:Wyn()}}var Wyn,lRt=v(()=>{zn();Wyn=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombre";case"object":{if(Array.isArray(o))return"tableau";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : ${o.expected} attendu, ${r(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${Ut(o.values[0])} attendu`:`Option invalide : une valeur parmi ${We(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Trop grand : ${o.origin??"valeur"} doit ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Trop petit : ${o.origin} doit ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Trop petit : ${o.origin} doit \xEAtre ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${We(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}}});function cRt(){return{localeError:Jyn()}}var Jyn,dRt=v(()=>{zn();Jyn=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return o=>{switch(o.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${o.expected}, re\xE7u ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${Ut(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",a=e(o.origin);return a?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",a=e(o.origin);return a?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${o.origin} soit ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${n[i.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${We(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}}});function fRt(){return{localeError:Kyn()}}var Kyn,pRt=v(()=>{zn();Kyn=()=>{let t={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return o=>{switch(o.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${o.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${Ut(o.values[0])}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${o.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${o.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${o.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.minimum.toString()} ${a.unit}`:`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${o.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${i.prefix}"`:i.format==="ends_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${i.suffix}"`:i.format==="includes"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${i.includes}"`:i.format==="regex"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${i.pattern}`:`${n[i.format]??o.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${o.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${o.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${o.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${We(o.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}}});function mRt(){return{localeError:Gyn()}}var Gyn,hRt=v(()=>{zn();Gyn=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(o))return"t\xF6mb";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return o=>{switch(o.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o.expected}, a kapott \xE9rt\xE9k ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Ut(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[i.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}}});function gRt(){return{localeError:Xyn()}}var Xyn,yRt=v(()=>{zn();Xyn=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak valid: diharapkan ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${Ut(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${n[i.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}}});function bRt(){return{localeError:Zyn()}}var Zyn,_Rt=v(()=>{zn();Zyn=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numero";case"object":{if(Array.isArray(o))return"vettore";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input non valido: atteso ${o.expected}, ricevuto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${Ut(o.values[0])}`:`Opzione non valida: atteso uno tra ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${o.origin} deve essere ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${We(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}}});function vRt(){return{localeError:Yyn()}}var Yyn,wRt=v(()=>{zn();Yyn=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(o))return"\u914D\u5217";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Ut(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${We(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=e(o.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${a.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=e(o.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${a.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${We(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}}});function SRt(){return{localeError:Qyn()}}var Qyn,CRt=v(()=>{zn();Qyn=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(o))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(o===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return o=>{switch(o.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Ut(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${We(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}}});function xRt(){return{localeError:ebn()}}var ebn,TRt=v(()=>{zn();ebn=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return o=>{switch(o.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Ut(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${We(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(o.origin),u=s?.unit??"\uC694\uC18C";return s?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${u} ${i}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${a}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",s=e(o.origin),u=s?.unit??"\uC694\uC18C";return s?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${u} ${i}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${a}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[i.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${We(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}}});function ORt(){return{localeError:tbn()}}var tbn,ERt=v(()=>{zn();tbn=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(o))return"\u043D\u0438\u0437\u0430";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return o=>{switch(o.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${Ut(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${o.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${We(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}}});function PRt(){return{localeError:rbn()}}var rbn,MRt=v(()=>{zn();rbn=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"nombor";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Input tidak sah: dijangka ${o.expected}, diterima ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${Ut(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Terlalu besar: dijangka ${o.origin??"nilai"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Terlalu kecil: dijangka ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${n[i.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${We(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}}});function RRt(){return{localeError:nbn()}}var nbn,IRt=v(()=>{zn();nbn=()=>{let t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"getal";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return o=>{switch(o.code){case"invalid_type":return`Ongeldige invoer: verwacht ${o.expected}, ontving ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${Ut(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} ${a.unit??"elementen"} bevat`:`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Te kort: verwacht dat ${o.origin} ${i}${o.minimum.toString()} ${a.unit} bevat`:`Te kort: verwacht dat ${o.origin} ${i}${o.minimum.toString()} is`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${n[i.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}}});function ARt(){return{localeError:obn()}}var obn,NRt=v(()=>{zn();obn=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"tall";case"object":{if(Array.isArray(o))return"liste";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Ugyldig input: forventet ${o.expected}, fikk ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${Ut(o.values[0])}`:`Ugyldig valg: forventet en av ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${n[i.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${We(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}}});function DRt(){return{localeError:ibn()}}var ibn,jRt=v(()=>{zn();ibn=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"numara";case"object":{if(Array.isArray(o))return"saf";if(o===null)return"gayb";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return o=>{switch(o.code){case"invalid_type":return`F\xE2sit giren: umulan ${o.expected}, al\u0131nan ${r(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${Ut(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=o;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[i.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}}});function $Rt(){return{localeError:abn()}}var abn,LRt=v(()=>{zn();abn=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(o))return"\u0627\u0631\u06D0";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return o=>{switch(o.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(o.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Ut(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${We(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[i.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${We(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}}});function FRt(){return{localeError:sbn()}}var sbn,kRt=v(()=>{zn();sbn=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"liczba";case"object":{if(Array.isArray(o))return"tablica";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return o=>{switch(o.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o.expected}, otrzymano ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Ut(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[i.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}}});function qRt(){return{localeError:ubn()}}var ubn,URt=v(()=>{zn();ubn=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(o))return"array";if(o===null)return"nulo";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return o=>{switch(o.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${o.expected}, recebido ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${Ut(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${n[i.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${We(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}}});function BRt(t,e,r,n){let o=Math.abs(t),i=o%10,a=o%100;return a>=11&&a<=19?n:i===1?e:i>=2&&i<=4?r:n}function zRt(){return{localeError:lbn()}}var lbn,VRt=v(()=>{zn();lbn=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Ut(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=BRt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.maximum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);if(a){let s=Number(o.minimum),u=BRt(s,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${o.minimum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${We(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}}});function HRt(){return{localeError:cbn()}}var cbn,WRt=v(()=>{zn();cbn=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(o))return"tabela";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return o=>{switch(o.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${o.expected}, prejeto ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Ut(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${n[i.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${We(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}}});function JRt(){return{localeError:dbn()}}var dbn,KRt=v(()=>{zn();dbn=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"antal";case"object":{if(Array.isArray(o))return"lista";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return o=>{switch(o.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${o.expected}, fick ${r(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Ut(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${n[i.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${We(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}}});function GRt(){return{localeError:fbn()}}var fbn,XRt=v(()=>{zn();fbn=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(o))return"\u0B85\u0BA3\u0BBF";if(o===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Ut(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${We(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${i}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${We(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}}});function ZRt(){return{localeError:pbn()}}var pbn,YRt=v(()=>{zn();pbn=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(o))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(o===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return o=>{switch(o.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Ut(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=e(o.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=e(o.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[i.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${We(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}}});function QRt(){return{localeError:hbn()}}var mbn,hbn,eIt=v(()=>{zn();mbn=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},hbn=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(n){return t[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${n.expected}, al\u0131nan ${mbn(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Ut(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${We(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${We(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function tIt(){return{localeError:gbn()}}var gbn,rIt=v(()=>{zn();gbn=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(o))return"\u043C\u0430\u0441\u0438\u0432";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return o=>{switch(o.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Ut(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${We(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}}});function nIt(){return{localeError:ybn()}}var ybn,oIt=v(()=>{zn();ybn=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(o))return"\u0622\u0631\u06D2";if(o===null)return"\u0646\u0644";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return o=>{switch(o.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(o.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Ut(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${We(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${i}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${We(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}}});function iIt(){return{localeError:bbn()}}var bbn,aIt=v(()=>{zn();bbn=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(o))return"m\u1EA3ng";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return o=>{switch(o.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Ut(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${i}${o.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${a.verb} ${i}${o.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${n[i.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${We(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}}});function sIt(){return{localeError:_bn()}}var _bn,uIt=v(()=>{zn();_bn=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(o))return"\u6570\u7EC4";if(o===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Ut(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${n[i.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${We(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}}});function lIt(){return{localeError:vbn()}}var vbn,cIt=v(()=>{zn();vbn=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(o){return t[o]??null}let r=o=>{let i=typeof o;switch(i){case"number":return Number.isNaN(o)?"NaN":"number";case"object":{if(Array.isArray(o))return"array";if(o===null)return"null";if(Object.getPrototypeOf(o)!==Object.prototype&&o.constructor)return o.constructor.name}}return i},n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return o=>{switch(o.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o.expected}\uFF0C\u4F46\u6536\u5230 ${r(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Ut(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${We(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${n[i.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${We(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}}});var jee={};En(jee,{ar:()=>UMt,az:()=>zMt,be:()=>WMt,ca:()=>KMt,cs:()=>XMt,de:()=>YMt,en:()=>Hhe,eo:()=>eRt,es:()=>rRt,fa:()=>oRt,fi:()=>aRt,fr:()=>uRt,frCA:()=>cRt,he:()=>fRt,hu:()=>mRt,id:()=>gRt,it:()=>bRt,ja:()=>vRt,kh:()=>SRt,ko:()=>xRt,mk:()=>ORt,ms:()=>PRt,nl:()=>RRt,no:()=>ARt,ota:()=>DRt,pl:()=>FRt,ps:()=>$Rt,pt:()=>qRt,ru:()=>zRt,sl:()=>HRt,sv:()=>JRt,ta:()=>GRt,th:()=>ZRt,tr:()=>QRt,ua:()=>tIt,ur:()=>nIt,vi:()=>iIt,zhCN:()=>sIt,zhTW:()=>lIt});var qVe=v(()=>{BMt();VMt();JMt();GMt();ZMt();QMt();kVe();tRt();nRt();iRt();sRt();lRt();dRt();pRt();hRt();yRt();_Rt();wRt();CRt();TRt();ERt();MRt();IRt();NRt();jRt();LRt();kRt();URt();VRt();WRt();KRt();XRt();YRt();eIt();rIt();oIt();aIt();uIt();cIt()});function Whe(){return new mJ}var UVe,BVe,mJ,ql,zVe=v(()=>{UVe=Symbol("ZodOutput"),BVe=Symbol("ZodInput"),mJ=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};ql=Whe()});function VVe(t,e){return new t({type:"string",...vt(e)})}function HVe(t,e){return new t({type:"string",coerce:!0,...vt(e)})}function Jhe(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...vt(e)})}function $ee(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...vt(e)})}function Khe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...vt(e)})}function Ghe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...vt(e)})}function Xhe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...vt(e)})}function Zhe(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...vt(e)})}function Yhe(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...vt(e)})}function Qhe(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...vt(e)})}function ege(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...vt(e)})}function tge(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...vt(e)})}function rge(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...vt(e)})}function nge(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...vt(e)})}function oge(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...vt(e)})}function ige(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...vt(e)})}function age(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...vt(e)})}function sge(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...vt(e)})}function uge(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...vt(e)})}function lge(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...vt(e)})}function cge(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...vt(e)})}function dge(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...vt(e)})}function fge(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...vt(e)})}function pge(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...vt(e)})}function JVe(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...vt(e)})}function KVe(t,e){return new t({type:"string",format:"date",check:"string_format",...vt(e)})}function GVe(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...vt(e)})}function XVe(t,e){return new t({type:"string",format:"duration",check:"string_format",...vt(e)})}function ZVe(t,e){return new t({type:"number",checks:[],...vt(e)})}function YVe(t,e){return new t({type:"number",coerce:!0,checks:[],...vt(e)})}function QVe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...vt(e)})}function eHe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...vt(e)})}function tHe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...vt(e)})}function rHe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...vt(e)})}function nHe(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...vt(e)})}function oHe(t,e){return new t({type:"boolean",...vt(e)})}function iHe(t,e){return new t({type:"boolean",coerce:!0,...vt(e)})}function aHe(t,e){return new t({type:"bigint",...vt(e)})}function sHe(t,e){return new t({type:"bigint",coerce:!0,...vt(e)})}function uHe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...vt(e)})}function lHe(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...vt(e)})}function cHe(t,e){return new t({type:"symbol",...vt(e)})}function dHe(t,e){return new t({type:"undefined",...vt(e)})}function fHe(t,e){return new t({type:"null",...vt(e)})}function pHe(t){return new t({type:"any"})}function YL(t){return new t({type:"unknown"})}function Lee(t,e){return new t({type:"never",...vt(e)})}function mHe(t,e){return new t({type:"void",...vt(e)})}function hHe(t,e){return new t({type:"date",...vt(e)})}function gHe(t,e){return new t({type:"date",coerce:!0,...vt(e)})}function yHe(t,e){return new t({type:"nan",...vt(e)})}function GN(t,e){return new Lhe({check:"less_than",...vt(e),value:t,inclusive:!1})}function PS(t,e){return new Lhe({check:"less_than",...vt(e),value:t,inclusive:!0})}function XN(t,e){return new Fhe({check:"greater_than",...vt(e),value:t,inclusive:!1})}function R_(t,e){return new Fhe({check:"greater_than",...vt(e),value:t,inclusive:!0})}function bHe(t){return XN(0,t)}function _He(t){return GN(0,t)}function vHe(t){return PS(0,t)}function wHe(t){return R_(0,t)}function t4(t,e){return new y2e({check:"multiple_of",...vt(e),value:t})}function hJ(t,e){return new v2e({check:"max_size",...vt(e),maximum:t})}function r4(t,e){return new w2e({check:"min_size",...vt(e),minimum:t})}function Fee(t,e){return new S2e({check:"size_equals",...vt(e),size:t})}function gJ(t,e){return new C2e({check:"max_length",...vt(e),maximum:t})}function QL(t,e){return new x2e({check:"min_length",...vt(e),minimum:t})}function yJ(t,e){return new T2e({check:"length_equals",...vt(e),length:t})}function kee(t,e){return new O2e({check:"string_format",format:"regex",...vt(e),pattern:t})}function qee(t){return new E2e({check:"string_format",format:"lowercase",...vt(t)})}function Uee(t){return new P2e({check:"string_format",format:"uppercase",...vt(t)})}function Bee(t,e){return new M2e({check:"string_format",format:"includes",...vt(e),includes:t})}function zee(t,e){return new R2e({check:"string_format",format:"starts_with",...vt(e),prefix:t})}function Vee(t,e){return new I2e({check:"string_format",format:"ends_with",...vt(e),suffix:t})}function SHe(t,e,r){return new A2e({check:"property",property:t,schema:e,...vt(r)})}function Hee(t,e){return new N2e({check:"mime_type",mime:t,...vt(e)})}function ZN(t){return new D2e({check:"overwrite",tx:t})}function Wee(t){return ZN(e=>e.normalize(t))}function Jee(){return ZN(t=>t.trim())}function Kee(){return ZN(t=>t.toLowerCase())}function Gee(){return ZN(t=>t.toUpperCase())}function Xee(t,e,r){return new t({type:"array",element:e,...vt(r)})}function wbn(t,e,r){return new t({type:"union",options:e,...vt(r)})}function Sbn(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...vt(n)})}function Cbn(t,e,r){return new t({type:"intersection",left:e,right:r})}function CHe(t,e,r,n){let o=r instanceof uo,i=o?n:r,a=o?r:null;return new t({type:"tuple",items:e,rest:a,...vt(i)})}function xbn(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...vt(n)})}function Tbn(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...vt(n)})}function Obn(t,e,r){return new t({type:"set",valueType:e,...vt(r)})}function Ebn(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...vt(r)})}function Pbn(t,e,r){return new t({type:"enum",entries:e,...vt(r)})}function Mbn(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...vt(r)})}function xHe(t,e){return new t({type:"file",...vt(e)})}function Rbn(t,e){return new t({type:"transform",transform:e})}function Ibn(t,e){return new t({type:"optional",innerType:e})}function Abn(t,e){return new t({type:"nullable",innerType:e})}function Nbn(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function Dbn(t,e,r){return new t({type:"nonoptional",innerType:e,...vt(r)})}function jbn(t,e){return new t({type:"success",innerType:e})}function $bn(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function Lbn(t,e,r){return new t({type:"pipe",in:e,out:r})}function Fbn(t,e){return new t({type:"readonly",innerType:e})}function kbn(t,e,r){return new t({type:"template_literal",parts:e,...vt(r)})}function qbn(t,e){return new t({type:"lazy",getter:e})}function Ubn(t,e){return new t({type:"promise",innerType:e})}function THe(t,e,r){let n=vt(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function OHe(t,e,r){return new t({type:"custom",check:"custom",fn:e,...vt(r)})}function EHe(t,e){let r=vt(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=t.Pipe??Nee,u=t.Boolean??Mee,l=t.String??Qz,c=t.Transform??Aee,d=new c({type:"transform",transform:(m,h)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:d}),{})},error:r.error}),f=new s({type:"pipe",in:new l({type:"string",error:r.error}),out:d,error:r.error});return new s({type:"pipe",in:f,out:new u({type:"boolean",error:r.error}),error:r.error})}function PHe(t,e,r,n={}){let o=vt(n),i={...vt(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}var WVe,MHe=v(()=>{khe();Dee();zn();WVe={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function RHe(t){return new mge({type:"function",input:Array.isArray(t?.input)?CHe(e4,t?.input):t?.input??Xee(Iee,YL(ZL)),output:t?.output??YL(ZL)})}var mge,dIt=v(()=>{MHe();Dhe();Dee();Dee();mge=class{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw new Error("implement() must be called with a function");let r=(...n)=>{let o=this._def.input?aO(this._def.input,n,void 0,{callee:r}):n;if(!Array.isArray(o))throw new Error("Invalid arguments schema: not an array or tuple schema.");let i=e(...o);return this._def.output?aO(this._def.output,i,void 0,{callee:r}):i};return r}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");let r=async(...n)=>{let o=this._def.input?await Xz(this._def.input,n,void 0,{callee:r}):n;if(!Array.isArray(o))throw new Error("Invalid arguments schema: not an array or tuple schema.");let i=await e(...o);return this._def.output?Xz(this._def.output,i,void 0,{callee:r}):i};return r}input(...e){let r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new e4({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){let r=this.constructor;return new r({type:"function",input:this._def.input,output:e})}}});function eF(t,e){if(t instanceof mJ){let n=new Zee(e),o={};for(let s of t._idmap.entries()){let[u,l]=s;n.process(l)}let i={},a={registry:t,uri:e?.uri,defs:o};for(let s of t._idmap.entries()){let[u,l]=s;i[u]=n.emit(l,{...e,external:a})}if(Object.keys(o).length>0){let s=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[s]:o}}return{schemas:i}}let r=new Zee(e);return r.process(t),r.emit(t,e)}function Rm(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Rm(o.element,r);case"object":{for(let i in o.shape)if(Rm(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(Rm(i,r))return!0;return!1}case"intersection":return Rm(o.left,r)||Rm(o.right,r);case"tuple":{for(let i of o.items)if(Rm(i,r))return!0;return!!(o.rest&&Rm(o.rest,r))}case"record":return Rm(o.keyType,r)||Rm(o.valueType,r);case"map":return Rm(o.keyType,r)||Rm(o.valueType,r);case"set":return Rm(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Rm(o.innerType,r);case"lazy":return Rm(o.getter(),r);case"default":return Rm(o.innerType,r);case"prefault":return Rm(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Rm(o.in,r)||Rm(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Zee,fIt=v(()=>{zVe();zn();Zee=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??ql,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,s);let u=e._zod.toJSONSchema?.();if(u)s.schema=u;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},f=e._zod.parent;if(f)s.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=s.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:y,format:g,patterns:b,contentEncoding:_}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof y=="number"&&(m.maxLength=y),g&&(m.format=i[g]??g,m.format===""&&delete m.format),_&&(m.contentEncoding=_),b&&b.size>0){let w=[...b];w.length===1?m.pattern=w[0].source:w.length>1&&(s.schema.allOf=[...w.map(T=>({...this.target==="draft-7"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{let m=p,{minimum:h,maximum:y,format:g,multipleOf:b,exclusiveMaximum:_,exclusiveMinimum:w}=e._zod.bag;typeof g=="string"&&g.includes("int")?m.type="integer":m.type="number",typeof w=="number"&&(m.exclusiveMinimum=w),typeof h=="number"&&(m.minimum=h,typeof w=="number"&&(w>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof _=="number"&&(m.exclusiveMaximum=_),typeof y=="number"&&(m.maximum=y,typeof _=="number"&&(_<=y?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{let m=p;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{p.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=p,{minimum:h,maximum:y}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof y=="number"&&(m.maxItems=y),m.type="array",m.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let m=p;m.type="object",m.properties={};let h=o.shape;for(let b in h)m.properties[b]=this.process(h[b],{...d,path:[...d.path,"properties",b]});let y=new Set(Object.keys(h)),g=new Set([...y].filter(b=>{let _=o.shape[b]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));g.size>0&&(m.required=Array.from(g)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=p;m.anyOf=o.options.map((h,y)=>this.process(h,{...d,path:[...d.path,"anyOf",y]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),y=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),g=_=>"allOf"in _&&Object.keys(_).length===1,b=[...g(h)?h.allOf:[h],...g(y)?y.allOf:[y]];m.allOf=b;break}case"tuple":{let m=p;m.type="array";let h=o.items.map((b,_)=>this.process(b,{...d,path:[...d.path,"prefixItems",_]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){let b=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=b:m.additionalItems=b}o.rest&&(m.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:y,maximum:g}=e._zod.bag;typeof y=="number"&&(m.minItems=y),typeof g=="number"&&(m.maxItems=g);break}case"record":{let m=p;m.type="object",m.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=p,h=_ee(o.entries);h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let y of o.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(y))}else h.push(y);if(h.length!==0)if(h.length===1){let y=h[0];m.type=y===null?"null":typeof y,m.const=y}else h.every(y=>typeof y=="number")&&(m.type="number"),h.every(y=>typeof y=="string")&&(m.type="string"),h.every(y=>typeof y=="boolean")&&(m.type="string"),h.every(y=>y===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:g,mime:b}=e._zod.bag;y!==void 0&&(h.minLength=y),g!==void 0&&(h.maxLength=g),b?b.length===1?(h.contentMediaType=b[0],Object.assign(m,h)):m.anyOf=b.map(_=>({...h,contentMediaType:_})):Object.assign(m,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,d);p.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),s.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),s.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),s.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}p.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=p,h=e._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=h.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,d),s.ref=m;break}case"readonly":{this.process(o.innerType,d),s.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),s.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),s.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),s.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),this.io==="input"&&Rm(e)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(c[0])?.id,y=n.external.uri??(b=>b);if(h)return{ref:y(h)};let g=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=g,{defId:g,ref:`${y("__shared")}#/${d}/${g}`}}if(c[1]===o)return{ref:"#"};let p=`#/${d}/`,m=c[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},a=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:f,defId:p}=i(c);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(n.cycles==="throw")for(let c of this.seen.entries()){let d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
||
|
||
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){a(c);continue}if(n.external){let p=n.external.registry.get(c[0])?.id;if(e!==c[0]&&p){a(c);continue}}if(this.metadataRegistry.get(c[0])?.id){a(c);continue}if(d.cycle){a(c);continue}if(d.count>1&&n.reused==="ref"){a(c);continue}}let s=(c,d)=>{let f=this.seen.get(c),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){s(h,d);let y=this.seen.get(h).schema;y.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(y)):(Object.assign(p,y),Object.assign(p,m))}f.isParent||this.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(let c of[...this.seen.entries()].reverse())s(c[0],{target:this.target});let u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let c=n.external.registry.get(e)?.id;if(!c)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(c)}Object.assign(u,o.def);let l=n.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}n.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}});var pIt={};var mIt=v(()=>{});var YN={};En(YN,{$ZodAny:()=>hVe,$ZodArray:()=>Iee,$ZodAsyncError:()=>iO,$ZodBase64:()=>iVe,$ZodBase64URL:()=>aVe,$ZodBigInt:()=>zhe,$ZodBigIntFormat:()=>dVe,$ZodBoolean:()=>Mee,$ZodCIDRv4:()=>rVe,$ZodCIDRv6:()=>nVe,$ZodCUID:()=>H2e,$ZodCUID2:()=>W2e,$ZodCatch:()=>AVe,$ZodCheck:()=>gc,$ZodCheckBigIntFormat:()=>_2e,$ZodCheckEndsWith:()=>I2e,$ZodCheckGreaterThan:()=>Fhe,$ZodCheckIncludes:()=>M2e,$ZodCheckLengthEquals:()=>T2e,$ZodCheckLessThan:()=>Lhe,$ZodCheckLowerCase:()=>E2e,$ZodCheckMaxLength:()=>C2e,$ZodCheckMaxSize:()=>v2e,$ZodCheckMimeType:()=>N2e,$ZodCheckMinLength:()=>x2e,$ZodCheckMinSize:()=>w2e,$ZodCheckMultipleOf:()=>y2e,$ZodCheckNumberFormat:()=>b2e,$ZodCheckOverwrite:()=>D2e,$ZodCheckProperty:()=>A2e,$ZodCheckRegex:()=>O2e,$ZodCheckSizeEquals:()=>S2e,$ZodCheckStartsWith:()=>R2e,$ZodCheckStringFormat:()=>fJ,$ZodCheckUpperCase:()=>P2e,$ZodCustom:()=>FVe,$ZodCustomStringFormat:()=>lVe,$ZodDate:()=>yVe,$ZodDefault:()=>PVe,$ZodDiscriminatedUnion:()=>_Ve,$ZodE164:()=>sVe,$ZodEmail:()=>U2e,$ZodEmoji:()=>z2e,$ZodEnum:()=>xVe,$ZodError:()=>Tee,$ZodFile:()=>OVe,$ZodFunction:()=>mge,$ZodGUID:()=>k2e,$ZodIPv4:()=>eVe,$ZodIPv6:()=>tVe,$ZodISODate:()=>Z2e,$ZodISODateTime:()=>X2e,$ZodISODuration:()=>Q2e,$ZodISOTime:()=>Y2e,$ZodIntersection:()=>vVe,$ZodJWT:()=>uVe,$ZodKSUID:()=>G2e,$ZodLazy:()=>LVe,$ZodLiteral:()=>TVe,$ZodMap:()=>SVe,$ZodNaN:()=>NVe,$ZodNanoID:()=>V2e,$ZodNever:()=>Ree,$ZodNonOptional:()=>RVe,$ZodNull:()=>mVe,$ZodNullable:()=>EVe,$ZodNumber:()=>Bhe,$ZodNumberFormat:()=>cVe,$ZodObject:()=>bVe,$ZodOptional:()=>pJ,$ZodPipe:()=>Nee,$ZodPrefault:()=>MVe,$ZodPromise:()=>$Ve,$ZodReadonly:()=>DVe,$ZodRealError:()=>dJ,$ZodRecord:()=>wVe,$ZodRegistry:()=>mJ,$ZodSet:()=>CVe,$ZodString:()=>Qz,$ZodStringFormat:()=>Ru,$ZodSuccess:()=>IVe,$ZodSymbol:()=>fVe,$ZodTemplateLiteral:()=>jVe,$ZodTransform:()=>Aee,$ZodTuple:()=>e4,$ZodType:()=>uo,$ZodULID:()=>J2e,$ZodURL:()=>B2e,$ZodUUID:()=>q2e,$ZodUndefined:()=>pVe,$ZodUnion:()=>Vhe,$ZodUnknown:()=>ZL,$ZodVoid:()=>gVe,$ZodXID:()=>K2e,$brand:()=>T4e,$constructor:()=>xe,$input:()=>BVe,$output:()=>UVe,Doc:()=>Pee,JSONSchema:()=>pIt,JSONSchemaGenerator:()=>Zee,NEVER:()=>x4e,TimePrecision:()=>WVe,_any:()=>pHe,_array:()=>Xee,_base64:()=>cge,_base64url:()=>dge,_bigint:()=>aHe,_boolean:()=>oHe,_catch:()=>$bn,_cidrv4:()=>uge,_cidrv6:()=>lge,_coercedBigint:()=>sHe,_coercedBoolean:()=>iHe,_coercedDate:()=>gHe,_coercedNumber:()=>YVe,_coercedString:()=>HVe,_cuid:()=>tge,_cuid2:()=>rge,_custom:()=>THe,_date:()=>hHe,_default:()=>Nbn,_discriminatedUnion:()=>Sbn,_e164:()=>fge,_email:()=>Jhe,_emoji:()=>Qhe,_endsWith:()=>Vee,_enum:()=>Ebn,_file:()=>xHe,_float32:()=>eHe,_float64:()=>tHe,_gt:()=>XN,_gte:()=>R_,_guid:()=>$ee,_includes:()=>Bee,_int:()=>QVe,_int32:()=>rHe,_int64:()=>uHe,_intersection:()=>Cbn,_ipv4:()=>age,_ipv6:()=>sge,_isoDate:()=>KVe,_isoDateTime:()=>JVe,_isoDuration:()=>XVe,_isoTime:()=>GVe,_jwt:()=>pge,_ksuid:()=>ige,_lazy:()=>qbn,_length:()=>yJ,_literal:()=>Mbn,_lowercase:()=>qee,_lt:()=>GN,_lte:()=>PS,_map:()=>Tbn,_max:()=>PS,_maxLength:()=>gJ,_maxSize:()=>hJ,_mime:()=>Hee,_min:()=>R_,_minLength:()=>QL,_minSize:()=>r4,_multipleOf:()=>t4,_nan:()=>yHe,_nanoid:()=>ege,_nativeEnum:()=>Pbn,_negative:()=>_He,_never:()=>Lee,_nonnegative:()=>wHe,_nonoptional:()=>Dbn,_nonpositive:()=>vHe,_normalize:()=>Wee,_null:()=>fHe,_nullable:()=>Abn,_number:()=>ZVe,_optional:()=>Ibn,_overwrite:()=>ZN,_parse:()=>Rhe,_parseAsync:()=>Ihe,_pipe:()=>Lbn,_positive:()=>bHe,_promise:()=>Ubn,_property:()=>SHe,_readonly:()=>Fbn,_record:()=>xbn,_refine:()=>OHe,_regex:()=>kee,_safeParse:()=>Ahe,_safeParseAsync:()=>Nhe,_set:()=>Obn,_size:()=>Fee,_startsWith:()=>zee,_string:()=>VVe,_stringFormat:()=>PHe,_stringbool:()=>EHe,_success:()=>jbn,_symbol:()=>cHe,_templateLiteral:()=>kbn,_toLowerCase:()=>Kee,_toUpperCase:()=>Gee,_transform:()=>Rbn,_trim:()=>Jee,_tuple:()=>CHe,_uint32:()=>nHe,_uint64:()=>lHe,_ulid:()=>nge,_undefined:()=>dHe,_union:()=>wbn,_unknown:()=>YL,_uppercase:()=>Uee,_url:()=>Yhe,_uuid:()=>Khe,_uuidv4:()=>Ghe,_uuidv6:()=>Xhe,_uuidv7:()=>Zhe,_void:()=>mHe,_xid:()=>oge,clone:()=>hc,config:()=>Pd,flattenError:()=>Oee,formatError:()=>Eee,function:()=>RHe,globalConfig:()=>yee,globalRegistry:()=>ql,isValidBase64:()=>oVe,isValidBase64URL:()=>FMt,isValidJWT:()=>kMt,locales:()=>jee,parse:()=>aO,parseAsync:()=>Xz,prettifyError:()=>F4e,regexes:()=>Yz,registry:()=>Whe,safeParse:()=>q4e,safeParseAsync:()=>U4e,toDotPath:()=>vMt,toJSONSchema:()=>eF,treeifyError:()=>L4e,util:()=>Dt,version:()=>$2e});var Iy=v(()=>{uJ();Dhe();k4e();Dee();khe();L2e();zn();$he();qVe();zVe();j2e();dIt();MHe();fIt();mIt()});function Iu(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let r=e._zod;return typeof r=="object"&&r!==null&&"def"in r}function yc(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let r=e._def;return typeof r=="object"&&r!=null&&"typeName"in r}function hIt(t){return Iu(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),yc(t)}function Ii(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(Iu(t)||yc(t))}function IHe(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function AHe(t){return Iu(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="literal":!1}function gIt(t){return!!(IHe(t)||AHe(t))}async function tF(t,e){if(Iu(t))try{return{success:!0,data:await Xz(t,e)}}catch(r){return{success:!1,error:r}}if(yc(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function rF(t,e){if(Iu(t))return await Xz(t,e);if(yc(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function yIt(t,e){if(Iu(t))try{return{success:!0,data:aO(t,e)}}catch(r){return{success:!1,error:r}}if(yc(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function bIt(t,e){if(Iu(t))return aO(t,e);if(yc(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function nF(t){if(Iu(t))return ql.get(t)?.description;if(yc(t)||"description"in t&&typeof t.description=="string")return t.description}function _It(t){if(!Ii(t))return!1;if(yc(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(Iu(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function _J(t){return Ii(t)?yc(t)?t._def.typeName==="ZodString":Iu(t)?t._zod.def.type==="string":!1:!1}function yge(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function MS(t){return Iu(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="object":!1}function Yee(t){return Iu(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="array":!1}function NHe(t){return Iu(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="optional":!1}function DHe(t){return Iu(t)?typeof t=="object"&&t!==null&&"_zod"in t&&typeof t._zod=="object"&&t._zod!==null&&"def"in t._zod&&typeof t._zod.def=="object"&&t._zod.def!==null&&"type"in t._zod.def&&t._zod.def.type==="nullable":!1}function vIt(t){return!!(yge(t)||MS(t))}function hge(t){if(yc(t))return t.shape;if(Iu(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function wIt(t,e){if(yc(t))return t.extend(e);if(Iu(t))return Dt.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function SIt(t){if(yc(t))return t.partial();if(Iu(t))return Dt.partial(pJ,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function bJ(t,e=!1){if(yc(t))return t.strict();if(MS(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(MS(a)){let u=bJ(a,e);r[i]=u}else if(Yee(a)){let u=a._zod.def.element;MS(u)&&(u=bJ(u,e)),r[i]=hc(a,{...a._zod.def,element:u})}else r[i]=a;let s=ql.get(a);s&&ql.add(r[i],s)}let n=hc(t,{...t._zod.def,shape:r,catchall:Lee(Ree)}),o=ql.get(t);return o&&ql.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function gge(t,e=!1){if(yge(t))return t.passthrough();if(MS(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(MS(a)){let u=gge(a,e);r[i]=u}else if(Yee(a)){let u=a._zod.def.element;MS(u)&&(u=gge(u,e)),r[i]=hc(a,{...a._zod.def,element:u})}else r[i]=a;let s=ql.get(a);s&&ql.add(r[i],s)}let n=hc(t,{...t._zod.def,shape:r,catchall:YL(ZL)}),o=ql.get(t);return o&&ql.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function CIt(t){if(yc(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(Iu(t))try{let e=aO(t,void 0);return()=>e}catch{return}}function Bbn(t){return yc(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function zbn(t){return Iu(t)&&t._zod.def.type==="pipe"}function n4(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(yc(t))return Bbn(t)?n4(t._def.schema,e,r):t;if(Iu(t)){let o=t;if(zbn(t)&&(o=n4(t._zod.def.in,e,r)),e){if(MS(o)){let a={};for(let[s,u]of Object.entries(o._zod.def.shape))a[s]=n4(u,e,r);o=hc(o,{...o._zod.def,shape:a})}else if(Yee(o)){let a=n4(o._zod.def.element,e,r);o=hc(o,{...o._zod.def,element:a})}else if(NHe(o)){let a=n4(o._zod.def.innerType,e,r);o=hc(o,{...o._zod.def,innerType:a})}else if(DHe(o)){let a=n4(o._zod.def.innerType,e,r);o=hc(o,{...o._zod.def,innerType:a})}}let i=ql.get(t);return i&&ql.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function bge(t,e=!1){return n4(t,e,new WeakMap)}function xIt(t,e){if(yc(t)){let r=hge(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(Iu(t)){let r=hge(t),n={...t._zod.def.shape};for(let[a,s]of Object.entries(r))e(a,s)&&(n[a]=new pJ({type:"optional",innerType:s}));let o=hc(t,{...t._zod.def,shape:n}),i=ql.get(t);return i&&ql.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function _ge(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}var QN=v(()=>{Iy()});function jHe(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function Hbn(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
|
||
`;return e}function TIt(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 m="default",h={[m]:"{0}({1})"};n!==void 0&&(h[n]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[y,g]of Object.entries(t)){let b=g.name.split(":").pop()??"",w=Vbn.some(O=>b.startsWith(O)&&b.endsWith(O))?`<p>${b}</p>`:b;Object.keys(g.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([O,E])=>`${O} = ${E}`).join(`
|
||
`)}</em></small>`);let T=(h[y]??h[m]).replace("{0}",jHe(y)).replace("{1}",w);l+=` ${T}
|
||
`}}let c={};for(let m of e){let h=m.source.split(":"),y=m.target.split(":"),g=h.filter((b,_)=>b===y[_]).join(":");c[g]||(c[g]=[]),c[g].push(m)}let d=new Set;function f(m){return[...m].sort((h,y)=>h.split(":").length-y.split(":").length)}function p(m,h){let y=m.length===1&&m[0].source===m[0].target;if(h&&!y){let b=h.split(":").pop();if(d.has(h))throw new Error(`Found duplicate subgraph '${b}' at '${h} -- 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(h),l+=` subgraph ${b}
|
||
`}let g=f(Object.keys(c).filter(b=>b.startsWith(`${h}:`)&&b!==h&&b.split(":").length===h.split(":").length+1));for(let b of g)p(c[b],b);for(let b of m){let{source:_,target:w,data:T,conditional:O}=b,E="";if(T!==void 0){let P=T,R=P.split(" ");R.length>u&&(P=Array.from({length:Math.ceil(R.length/u)},(I,N)=>R.slice(N*u,(N+1)*u).join(" ")).join(" <br> ")),E=O?` -. ${P} .-> `:` -- ${P} --> `}else E=O?" -.-> ":" --> ";l+=` ${jHe(_)}${E}${jHe(w)};
|
||
`}h&&!y&&(l+=` end
|
||
`)}p(c[""]??[],"");for(let m in c)!m.includes(":")&&m!==""&&p(c[m],m);return a&&(l+=Hbn(i??{})),l}async function OIt(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=bMt(t);r!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(r)||(r=`!${r}`));let i=`https://mermaid.ink/img/${o}?bgColor=${r}&type=${n}`,a=await fetch(i);if(!a.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${a.status}`,`Status text: ${a.statusText}`].join(`
|
||
`));return await a.blob()}var Vbn,EIt=v(()=>{Phe();Vbn=["*","_","`"]});var MIt,PIt,RIt,vge=v(()=>{MIt=Symbol("Let zodToJsonSchema decide on which parser to use"),PIt={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},RIt=t=>typeof t=="string"?{...PIt,name:t}:{...PIt,...t}});var IIt,$He=v(()=>{vge();IIt=t=>{let e=RIt(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},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}]))}}});var wge,Sge=v(()=>{wge=(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("/")}});function Ul(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?wge(e,t.currentPath):e.join("/")}}var RS=v(()=>{Sge()});function LHe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Hi(t,e,r,n,o){t[e]=r,LHe(t,e,n,o)}var oF=v(()=>{});var Ai,FHe,cr,sO,Qee=v(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Ai||(Ai={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(FHe||(FHe={}));cr=Ai.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sO=t=>{switch(typeof t){case"undefined":return cr.undefined;case"string":return cr.string;case"number":return Number.isNaN(t)?cr.nan:cr.number;case"boolean":return cr.boolean;case"function":return cr.function;case"bigint":return cr.bigint;case"symbol":return cr.symbol;case"object":return Array.isArray(t)?cr.array:t===null?cr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?cr.promise:typeof Map<"u"&&t instanceof Map?cr.map:typeof Set<"u"&&t instanceof Set?cr.set:typeof Date<"u"&&t instanceof Date?cr.date:cr.object;default:return cr.unknown}}});var it,Wbn,I_,Cge=v(()=>{Qee();it=Ai.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"]),Wbn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),I_=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,Ai.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};I_.create=t=>new I_(t)});var Jbn,e1,kHe=v(()=>{Cge();Qee();Jbn=(t,e)=>{let r;switch(t.code){case it.invalid_type:t.received===cr.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case it.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ai.jsonStringifyReplacer)}`;break;case it.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ai.joinValues(t.keys,", ")}`;break;case it.invalid_union:r="Invalid input";break;case it.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ai.joinValues(t.options)}`;break;case it.invalid_enum_value:r=`Invalid enum value. Expected ${Ai.joinValues(t.options)}, received '${t.received}'`;break;case it.invalid_arguments:r="Invalid function arguments";break;case it.invalid_return_type:r="Invalid function return type";break;case it.invalid_date:r="Invalid date";break;case it.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}"`:Ai.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case it.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case it.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 it.custom:r="Invalid input";break;case it.invalid_intersection_types:r="Intersection results could not be merged";break;case it.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case it.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ai.assertNever(t)}return{message:r}},e1=Jbn});function Kbn(t){AIt=t}function vJ(){return AIt}var AIt,xge=v(()=>{kHe();AIt=e1});function Zt(t,e){let r=vJ(),n=ete({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===e1?void 0:e1].filter(o=>!!o)});t.common.issues.push(n)}var ete,Gbn,Eg,Mn,o4,Ay,Tge,Oge,iF,wJ,qHe=v(()=>{xge();kHe();ete=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}},Gbn=[];Eg=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 Mn;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 Mn;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}}},Mn=Object.freeze({status:"aborted"}),o4=t=>({status:"dirty",value:t}),Ay=t=>({status:"valid",value:t}),Tge=t=>t.status==="aborted",Oge=t=>t.status==="dirty",iF=t=>t.status==="valid",wJ=t=>typeof Promise<"u"&&t instanceof Promise});var NIt=v(()=>{});var Dr,DIt=v(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Dr||(Dr={}))});function Ko(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}function FIt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function f_n(t){return new RegExp(`^${FIt(t)}$`)}function kIt(t){let e=`${LIt}T${FIt(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 p_n(t,e){return!!((e==="v4"||!e)&&i_n.test(t)||(e==="v6"||!e)&&s_n.test(t))}function m_n(t,e){if(!t_n.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function h_n(t,e){return!!((e==="v4"||!e)&&a_n.test(t)||(e==="v6"||!e)&&u_n.test(t))}function g_n(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}function SJ(t){if(t instanceof A_){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=IS.create(SJ(n))}return new A_({...t._def,shape:()=>e})}else return t instanceof n1?new n1({...t._def,type:SJ(t.element)}):t instanceof IS?IS.create(SJ(t.unwrap())):t instanceof lO?lO.create(SJ(t.unwrap())):t instanceof uO?uO.create(t.items.map(e=>SJ(e))):t}function BHe(t,e){let r=sO(t),n=sO(e);if(t===e)return{valid:!0,data:t};if(r===cr.object&&n===cr.object){let o=Ai.objectKeys(e),i=Ai.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=BHe(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===cr.array&&n===cr.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=BHe(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===cr.date&&n===cr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function qIt(t,e){return new h4({values:t,typeName:Ae.ZodEnum,...Ko(e)})}function $It(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function UIt(t,e={},r){return t?sF.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=$It(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=$It(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):sF.create()}var AS,jIt,mi,Xbn,Zbn,Ybn,Qbn,e_n,t_n,r_n,n_n,o_n,UHe,i_n,a_n,s_n,u_n,l_n,c_n,LIt,d_n,aF,i4,a4,s4,u4,CJ,l4,c4,sF,r1,WC,xJ,n1,A_,d4,t1,Ege,f4,uO,Pge,TJ,OJ,Mge,p4,m4,h4,g4,uF,NS,IS,lO,y4,b4,EJ,y_n,tte,rte,_4,b_n,Ae,__n,BIt,zIt,v_n,w_n,VIt,S_n,C_n,x_n,T_n,O_n,E_n,P_n,M_n,R_n,I_n,A_n,N_n,D_n,j_n,$_n,L_n,F_n,k_n,q_n,U_n,B_n,z_n,V_n,H_n,W_n,J_n,K_n,G_n,X_n,Z_n,Y_n,Q_n,evn,tvn,HIt=v(()=>{Cge();xge();DIt();qHe();Qee();AS=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},jIt=(t,e)=>{if(iF(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 I_(t.common.issues);return this._error=r,this._error}}};mi=class{get description(){return this._def.description}_getType(e){return sO(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:sO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Eg,ctx:{common:e.parent.common,data:e.data,parsedType:sO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(wJ(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sO(e)},o=this._parseSync({data:e,path:n.path,parent:n});return jIt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sO(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return iF(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>iF(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sO(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(wJ(o)?o:Promise.resolve(o));return jIt(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:it.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 NS({schema:this,typeName:Ae.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 IS.create(this,this._def)}nullable(){return lO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return n1.create(this)}promise(){return uF.create(this,this._def)}or(e){return d4.create([this,e],this._def)}and(e){return f4.create(this,e,this._def)}transform(e){return new NS({...Ko(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new y4({...Ko(this._def),innerType:this,defaultValue:r,typeName:Ae.ZodDefault})}brand(){return new tte({typeName:Ae.ZodBranded,type:this,...Ko(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new b4({...Ko(this._def),innerType:this,catchValue:r,typeName:Ae.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return rte.create(this,e)}readonly(){return _4.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xbn=/^c[^\s-]{8,}$/i,Zbn=/^[0-9a-z]+$/,Ybn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qbn=/^[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,e_n=/^[a-z0-9_-]{21}$/i,t_n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,r_n=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,n_n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,o_n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",i_n=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,a_n=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,s_n=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,u_n=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,l_n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,c_n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,LIt="((\\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])))",d_n=new RegExp(`^${LIt}$`);aF=class t extends mi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==cr.string){let i=this._getOrReturnCtx(e);return Zt(i,{code:it.invalid_type,expected:cr.string,received:i.parsedType}),Mn}let n=new Eg,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.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),Zt(o,{code:it.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?Zt(o,{code:it.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&Zt(o,{code:it.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")n_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"email",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")UHe||(UHe=new RegExp(o_n,"u")),UHe.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"emoji",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Qbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"uuid",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")e_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"nanoid",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Xbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"cuid",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Zbn.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"cuid2",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ybn.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"ulid",code:it.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Zt(o,{validation:"url",code:it.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),Zt(o,{validation:"regex",code:it.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),Zt(o,{code:it.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),Zt(o,{code:it.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?kIt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?d_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?f_n(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?r_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"duration",code:it.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?p_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"ip",code:it.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?m_n(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"jwt",code:it.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?h_n(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"cidr",code:it.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?l_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"base64",code:it.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?c_n.test(e.data)||(o=this._getOrReturnCtx(e,o),Zt(o,{validation:"base64url",code:it.invalid_string,message:i.message}),n.dirty()):Ai.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:it.invalid_string,...Dr.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Dr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Dr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Dr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Dr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Dr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Dr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Dr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Dr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Dr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Dr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Dr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Dr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Dr.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Dr.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,...Dr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Dr.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Dr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Dr.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Dr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Dr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Dr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Dr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Dr.errToObj(r)})}nonempty(e){return this.min(1,Dr.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}};aF.create=t=>new aF({checks:[],typeName:Ae.ZodString,coerce:t?.coerce??!1,...Ko(t)});i4=class t extends mi{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)!==cr.number){let i=this._getOrReturnCtx(e);return Zt(i,{code:it.invalid_type,expected:cr.number,received:i.parsedType}),Mn}let n,o=new Eg;for(let i of this._def.checks)i.kind==="int"?Ai.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Zt(n,{code:it.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),Zt(n,{code:it.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),Zt(n,{code:it.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?g_n(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Zt(n,{code:it.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Zt(n,{code:it.not_finite,message:i.message}),o.dirty()):Ai.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Dr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Dr.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Dr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Dr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Dr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dr.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"&&Ai.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)}};i4.create=t=>new i4({checks:[],typeName:Ae.ZodNumber,coerce:t?.coerce||!1,...Ko(t)});a4=class t extends mi{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)!==cr.bigint)return this._getInvalidInput(e);let n,o=new Eg;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),Zt(n,{code:it.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),Zt(n,{code:it.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),Zt(n,{code:it.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Ai.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Zt(r,{code:it.invalid_type,expected:cr.bigint,received:r.parsedType}),Mn}gte(e,r){return this.setLimit("min",e,!0,Dr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Dr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Dr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Dr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Dr.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:Dr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Dr.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}};a4.create=t=>new a4({checks:[],typeName:Ae.ZodBigInt,coerce:t?.coerce??!1,...Ko(t)});s4=class extends mi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==cr.boolean){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.boolean,received:n.parsedType}),Mn}return Ay(e.data)}};s4.create=t=>new s4({typeName:Ae.ZodBoolean,coerce:t?.coerce||!1,...Ko(t)});u4=class t extends mi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==cr.date){let i=this._getOrReturnCtx(e);return Zt(i,{code:it.invalid_type,expected:cr.date,received:i.parsedType}),Mn}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Zt(i,{code:it.invalid_date}),Mn}let n=new Eg,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Zt(o,{code:it.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),Zt(o,{code:it.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Ai.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:Dr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Dr.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}};u4.create=t=>new u4({checks:[],coerce:t?.coerce||!1,typeName:Ae.ZodDate,...Ko(t)});CJ=class extends mi{_parse(e){if(this._getType(e)!==cr.symbol){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.symbol,received:n.parsedType}),Mn}return Ay(e.data)}};CJ.create=t=>new CJ({typeName:Ae.ZodSymbol,...Ko(t)});l4=class extends mi{_parse(e){if(this._getType(e)!==cr.undefined){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.undefined,received:n.parsedType}),Mn}return Ay(e.data)}};l4.create=t=>new l4({typeName:Ae.ZodUndefined,...Ko(t)});c4=class extends mi{_parse(e){if(this._getType(e)!==cr.null){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.null,received:n.parsedType}),Mn}return Ay(e.data)}};c4.create=t=>new c4({typeName:Ae.ZodNull,...Ko(t)});sF=class extends mi{constructor(){super(...arguments),this._any=!0}_parse(e){return Ay(e.data)}};sF.create=t=>new sF({typeName:Ae.ZodAny,...Ko(t)});r1=class extends mi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ay(e.data)}};r1.create=t=>new r1({typeName:Ae.ZodUnknown,...Ko(t)});WC=class extends mi{_parse(e){let r=this._getOrReturnCtx(e);return Zt(r,{code:it.invalid_type,expected:cr.never,received:r.parsedType}),Mn}};WC.create=t=>new WC({typeName:Ae.ZodNever,...Ko(t)});xJ=class extends mi{_parse(e){if(this._getType(e)!==cr.undefined){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.void,received:n.parsedType}),Mn}return Ay(e.data)}};xJ.create=t=>new xJ({typeName:Ae.ZodVoid,...Ko(t)});n1=class t extends mi{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==cr.array)return Zt(r,{code:it.invalid_type,expected:cr.array,received:r.parsedType}),Mn;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(Zt(r,{code:a?it.too_big:it.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&&(Zt(r,{code:it.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&&(Zt(r,{code:it.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 AS(r,a,r.path,s)))).then(a=>Eg.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new AS(r,a,r.path,s)));return Eg.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Dr.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Dr.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Dr.toString(r)}})}nonempty(e){return this.min(1,e)}};n1.create=(t,e)=>new n1({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...Ko(e)});A_=class t extends mi{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=Ai.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==cr.object){let l=this._getOrReturnCtx(e);return Zt(l,{code:it.invalid_type,expected:cr.object,received:l.parsedType}),Mn}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof WC&&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 AS(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof WC){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&&(Zt(o,{code:it.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 AS(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=>Eg.mergeObjectSync(n,l)):Eg.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Dr.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Dr.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ae.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Ai.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Ai.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return SJ(this)}partial(e){let r={};for(let n of Ai.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ai.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof IS;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return qIt(Ai.objectKeys(this.shape))}};A_.create=(t,e)=>new A_({shape:()=>t,unknownKeys:"strip",catchall:WC.create(),typeName:Ae.ZodObject,...Ko(e)});A_.strictCreate=(t,e)=>new A_({shape:()=>t,unknownKeys:"strict",catchall:WC.create(),typeName:Ae.ZodObject,...Ko(e)});A_.lazycreate=(t,e)=>new A_({shape:t,unknownKeys:"strip",catchall:WC.create(),typeName:Ae.ZodObject,...Ko(e)});d4=class extends mi{_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 I_(s.ctx.common.issues));return Zt(r,{code:it.invalid_union,unionErrors:a}),Mn}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 I_(u));return Zt(r,{code:it.invalid_union,unionErrors:s}),Mn}}get options(){return this._def.options}};d4.create=(t,e)=>new d4({options:t,typeName:Ae.ZodUnion,...Ko(e)});t1=t=>t instanceof p4?t1(t.schema):t instanceof NS?t1(t.innerType()):t instanceof m4?[t.value]:t instanceof h4?t.options:t instanceof g4?Ai.objectValues(t.enum):t instanceof y4?t1(t._def.innerType):t instanceof l4?[void 0]:t instanceof c4?[null]:t instanceof IS?[void 0,...t1(t.unwrap())]:t instanceof lO?[null,...t1(t.unwrap())]:t instanceof tte||t instanceof _4?t1(t.unwrap()):t instanceof b4?t1(t._def.innerType):[],Ege=class t extends mi{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.object)return Zt(r,{code:it.invalid_type,expected:cr.object,received:r.parsedType}),Mn;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}):(Zt(r,{code:it.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Mn)}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=t1(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:Ae.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Ko(n)})}};f4=class extends mi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Tge(i)||Tge(a))return Mn;let s=BHe(i.value,a.value);return s.valid?((Oge(i)||Oge(a))&&r.dirty(),{status:r.value,value:s.data}):(Zt(n,{code:it.invalid_intersection_types}),Mn)};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}))}};f4.create=(t,e,r)=>new f4({left:t,right:e,typeName:Ae.ZodIntersection,...Ko(r)});uO=class t extends mi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==cr.array)return Zt(n,{code:it.invalid_type,expected:cr.array,received:n.parsedType}),Mn;if(n.data.length<this._def.items.length)return Zt(n,{code:it.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Mn;!this._def.rest&&n.data.length>this._def.items.length&&(Zt(n,{code:it.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 AS(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Eg.mergeArray(r,a)):Eg.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};uO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new uO({items:t,typeName:Ae.ZodTuple,rest:null,...Ko(e)})};Pge=class t extends mi{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!==cr.object)return Zt(n,{code:it.invalid_type,expected:cr.object,received:n.parsedType}),Mn;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new AS(n,s,n.path,s)),value:a._parse(new AS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Eg.mergeObjectAsync(r,o):Eg.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof mi?new t({keyType:e,valueType:r,typeName:Ae.ZodRecord,...Ko(n)}):new t({keyType:aF.create(),valueType:e,typeName:Ae.ZodRecord,...Ko(r)})}},TJ=class extends mi{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!==cr.map)return Zt(n,{code:it.invalid_type,expected:cr.map,received:n.parsedType}),Mn;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new AS(n,s,n.path,[l,"key"])),value:i._parse(new AS(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 Mn;(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 Mn;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};TJ.create=(t,e,r)=>new TJ({valueType:e,keyType:t,typeName:Ae.ZodMap,...Ko(r)});OJ=class t extends mi{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==cr.set)return Zt(n,{code:it.invalid_type,expected:cr.set,received:n.parsedType}),Mn;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Zt(n,{code:it.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&&(Zt(n,{code:it.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 Mn;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 AS(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:Dr.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Dr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};OJ.create=(t,e)=>new OJ({valueType:t,minSize:null,maxSize:null,typeName:Ae.ZodSet,...Ko(e)});Mge=class t extends mi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.function)return Zt(r,{code:it.invalid_type,expected:cr.function,received:r.parsedType}),Mn;function n(s,u){return ete({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vJ(),e1].filter(l=>!!l),issueData:{code:it.invalid_arguments,argumentsError:u}})}function o(s,u){return ete({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,vJ(),e1].filter(l=>!!l),issueData:{code:it.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof uF){let s=this;return Ay(async function(...u){let l=new I_([]),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 Ay(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new I_([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new I_([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:uO.create(e).rest(r1.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||uO.create([]).rest(r1.create()),returns:r||r1.create(),typeName:Ae.ZodFunction,...Ko(n)})}},p4=class extends mi{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})}};p4.create=(t,e)=>new p4({getter:t,typeName:Ae.ZodLazy,...Ko(e)});m4=class extends mi{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Zt(r,{received:r.data,code:it.invalid_literal,expected:this._def.value}),Mn}return{status:"valid",value:e.data}}get value(){return this._def.value}};m4.create=(t,e)=>new m4({value:t,typeName:Ae.ZodLiteral,...Ko(e)});h4=class t extends mi{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Zt(r,{expected:Ai.joinValues(n),received:r.parsedType,code:it.invalid_type}),Mn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Zt(r,{received:r.data,code:it.invalid_enum_value,options:n}),Mn}return Ay(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})}};h4.create=qIt;g4=class extends mi{_parse(e){let r=Ai.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==cr.string&&n.parsedType!==cr.number){let o=Ai.objectValues(r);return Zt(n,{expected:Ai.joinValues(o),received:n.parsedType,code:it.invalid_type}),Mn}if(this._cache||(this._cache=new Set(Ai.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Ai.objectValues(r);return Zt(n,{received:n.data,code:it.invalid_enum_value,options:o}),Mn}return Ay(e.data)}get enum(){return this._def.values}};g4.create=(t,e)=>new g4({values:t,typeName:Ae.ZodNativeEnum,...Ko(e)});uF=class extends mi{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.promise&&r.common.async===!1)return Zt(r,{code:it.invalid_type,expected:cr.promise,received:r.parsedType}),Mn;let n=r.parsedType===cr.promise?r.data:Promise.resolve(r.data);return Ay(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};uF.create=(t,e)=>new uF({type:t,typeName:Ae.ZodPromise,...Ko(e)});NS=class extends mi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.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=>{Zt(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 Mn;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Mn:u.status==="dirty"?o4(u.value):r.value==="dirty"?o4(u.value):u});{if(r.value==="aborted")return Mn;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Mn:s.status==="dirty"?o4(s.value):r.value==="dirty"?o4(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"?Mn:(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"?Mn:(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(!iF(a))return Mn;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=>iF(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Mn);Ai.assertNever(o)}};NS.create=(t,e,r)=>new NS({schema:t,typeName:Ae.ZodEffects,effect:e,...Ko(r)});NS.createWithPreprocess=(t,e,r)=>new NS({schema:e,effect:{type:"preprocess",transform:t},typeName:Ae.ZodEffects,...Ko(r)});IS=class extends mi{_parse(e){return this._getType(e)===cr.undefined?Ay(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};IS.create=(t,e)=>new IS({innerType:t,typeName:Ae.ZodOptional,...Ko(e)});lO=class extends mi{_parse(e){return this._getType(e)===cr.null?Ay(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lO.create=(t,e)=>new lO({innerType:t,typeName:Ae.ZodNullable,...Ko(e)});y4=class extends mi{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===cr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};y4.create=(t,e)=>new y4({innerType:t,typeName:Ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ko(e)});b4=class extends mi{_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 wJ(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new I_(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new I_(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};b4.create=(t,e)=>new b4({innerType:t,typeName:Ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ko(e)});EJ=class extends mi{_parse(e){if(this._getType(e)!==cr.nan){let n=this._getOrReturnCtx(e);return Zt(n,{code:it.invalid_type,expected:cr.nan,received:n.parsedType}),Mn}return{status:"valid",value:e.data}}};EJ.create=t=>new EJ({typeName:Ae.ZodNaN,...Ko(t)});y_n=Symbol("zod_brand"),tte=class extends mi{_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}},rte=class t extends mi{_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"?Mn:i.status==="dirty"?(r.dirty(),o4(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"?Mn: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:Ae.ZodPipeline})}},_4=class extends mi{_parse(e){let r=this._def.innerType._parse(e),n=o=>(iF(o)&&(o.value=Object.freeze(o.value)),o);return wJ(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};_4.create=(t,e)=>new _4({innerType:t,typeName:Ae.ZodReadonly,...Ko(e)});b_n={object:A_.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"})(Ae||(Ae={}));__n=(t,e={message:`Input not instance of ${t.name}`})=>UIt(r=>r instanceof t,e),BIt=aF.create,zIt=i4.create,v_n=EJ.create,w_n=a4.create,VIt=s4.create,S_n=u4.create,C_n=CJ.create,x_n=l4.create,T_n=c4.create,O_n=sF.create,E_n=r1.create,P_n=WC.create,M_n=xJ.create,R_n=n1.create,I_n=A_.create,A_n=A_.strictCreate,N_n=d4.create,D_n=Ege.create,j_n=f4.create,$_n=uO.create,L_n=Pge.create,F_n=TJ.create,k_n=OJ.create,q_n=Mge.create,U_n=p4.create,B_n=m4.create,z_n=h4.create,V_n=g4.create,H_n=uF.create,W_n=NS.create,J_n=IS.create,K_n=lO.create,G_n=NS.createWithPreprocess,X_n=rte.create,Z_n=()=>BIt().optional(),Y_n=()=>zIt().optional(),Q_n=()=>VIt().optional(),evn={string:t=>aF.create({...t,coerce:!0}),number:t=>i4.create({...t,coerce:!0}),boolean:t=>s4.create({...t,coerce:!0}),bigint:t=>a4.create({...t,coerce:!0}),date:t=>u4.create({...t,coerce:!0})},tvn=Mn});var wt={};En(wt,{BRAND:()=>y_n,DIRTY:()=>o4,EMPTY_PATH:()=>Gbn,INVALID:()=>Mn,NEVER:()=>tvn,OK:()=>Ay,ParseStatus:()=>Eg,Schema:()=>mi,ZodAny:()=>sF,ZodArray:()=>n1,ZodBigInt:()=>a4,ZodBoolean:()=>s4,ZodBranded:()=>tte,ZodCatch:()=>b4,ZodDate:()=>u4,ZodDefault:()=>y4,ZodDiscriminatedUnion:()=>Ege,ZodEffects:()=>NS,ZodEnum:()=>h4,ZodError:()=>I_,ZodFirstPartyTypeKind:()=>Ae,ZodFunction:()=>Mge,ZodIntersection:()=>f4,ZodIssueCode:()=>it,ZodLazy:()=>p4,ZodLiteral:()=>m4,ZodMap:()=>TJ,ZodNaN:()=>EJ,ZodNativeEnum:()=>g4,ZodNever:()=>WC,ZodNull:()=>c4,ZodNullable:()=>lO,ZodNumber:()=>i4,ZodObject:()=>A_,ZodOptional:()=>IS,ZodParsedType:()=>cr,ZodPipeline:()=>rte,ZodPromise:()=>uF,ZodReadonly:()=>_4,ZodRecord:()=>Pge,ZodSchema:()=>mi,ZodSet:()=>OJ,ZodString:()=>aF,ZodSymbol:()=>CJ,ZodTransformer:()=>NS,ZodTuple:()=>uO,ZodType:()=>mi,ZodUndefined:()=>l4,ZodUnion:()=>d4,ZodUnknown:()=>r1,ZodVoid:()=>xJ,addIssueToContext:()=>Zt,any:()=>O_n,array:()=>R_n,bigint:()=>w_n,boolean:()=>VIt,coerce:()=>evn,custom:()=>UIt,date:()=>S_n,datetimeRegex:()=>kIt,defaultErrorMap:()=>e1,discriminatedUnion:()=>D_n,effect:()=>W_n,enum:()=>z_n,function:()=>q_n,getErrorMap:()=>vJ,getParsedType:()=>sO,instanceof:()=>__n,intersection:()=>j_n,isAborted:()=>Tge,isAsync:()=>wJ,isDirty:()=>Oge,isValid:()=>iF,late:()=>b_n,lazy:()=>U_n,literal:()=>B_n,makeIssue:()=>ete,map:()=>F_n,nan:()=>v_n,nativeEnum:()=>V_n,never:()=>P_n,null:()=>T_n,nullable:()=>K_n,number:()=>zIt,object:()=>I_n,objectUtil:()=>FHe,oboolean:()=>Q_n,onumber:()=>Y_n,optional:()=>J_n,ostring:()=>Z_n,pipeline:()=>X_n,preprocess:()=>G_n,promise:()=>H_n,quotelessJson:()=>Wbn,record:()=>L_n,set:()=>k_n,setErrorMap:()=>Kbn,strictObject:()=>A_n,string:()=>BIt,symbol:()=>C_n,transformer:()=>W_n,tuple:()=>$_n,undefined:()=>x_n,union:()=>N_n,unknown:()=>E_n,util:()=>Ai,void:()=>M_n});var nte=v(()=>{xge();qHe();NIt();Qee();HIt();Cge()});var cO=v(()=>{nte();nte()});function WIt(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Ae.ZodAny&&(r.items=kn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Hi(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Hi(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Hi(r,"minItems",t.exactLength.value,t.exactLength.message,e),Hi(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var zHe=v(()=>{oF();Md();cO()});function JIt(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?Hi(r,"minimum",n.value,n.message,e):Hi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Hi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Hi(r,"maximum",n.value,n.message,e):Hi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Hi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Hi(r,"multipleOf",n.value,n.message,e);break}return r}var VHe=v(()=>{oF()});function KIt(){return{type:"boolean"}}var HHe=v(()=>{});function Rge(t,e){return kn(t.type._def,e)}var Ige=v(()=>{Md()});var GIt,WHe=v(()=>{Md();GIt=(t,e)=>kn(t.innerType._def,e)});function JHe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>JHe(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 rvn(t,e)}}var rvn,KHe=v(()=>{oF();rvn=(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":Hi(r,"minimum",n.value,n.message,e);break;case"max":Hi(r,"maximum",n.value,n.message,e);break}return r}});function XIt(t,e){return{...kn(t.innerType._def,e),default:t.defaultValue()}}var GHe=v(()=>{Md()});function ZIt(t,e){return e.effectStrategy==="input"?kn(t.schema._def,e):Ul(e)}var XHe=v(()=>{RS();Md()});function YIt(t){return{type:"string",enum:Array.from(t.values)}}var ZHe=v(()=>{});function QIt(t,e){let r=[kn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),kn(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(nvn(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 nvn,YHe=v(()=>{Md();nvn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function eAt(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 QHe=v(()=>{});function Age(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Hi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Hi(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":KC(r,"email",n.message,e);break;case"format:idn-email":KC(r,"idn-email",n.message,e);break;case"pattern:zod":kb(r,JC.email,n.message,e);break}break;case"url":KC(r,"uri",n.message,e);break;case"uuid":KC(r,"uuid",n.message,e);break;case"regex":kb(r,n.regex,n.message,e);break;case"cuid":kb(r,JC.cuid,n.message,e);break;case"cuid2":kb(r,JC.cuid2,n.message,e);break;case"startsWith":kb(r,RegExp(`^${t3e(n.value,e)}`),n.message,e);break;case"endsWith":kb(r,RegExp(`${t3e(n.value,e)}$`),n.message,e);break;case"datetime":KC(r,"date-time",n.message,e);break;case"date":KC(r,"date",n.message,e);break;case"time":KC(r,"time",n.message,e);break;case"duration":KC(r,"duration",n.message,e);break;case"length":Hi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Hi(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":kb(r,RegExp(t3e(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&KC(r,"ipv4",n.message,e),n.version!=="v4"&&KC(r,"ipv6",n.message,e);break;case"base64url":kb(r,JC.base64url,n.message,e);break;case"jwt":kb(r,JC.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&kb(r,JC.ipv4Cidr,n.message,e),n.version!=="v4"&&kb(r,JC.ipv6Cidr,n.message,e);break;case"emoji":kb(r,JC.emoji(),n.message,e);break;case"ulid":kb(r,JC.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":KC(r,"binary",n.message,e);break;case"contentEncoding:base64":Hi(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":kb(r,JC.base64,n.message,e);break}break;case"nanoid":kb(r,JC.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function t3e(t,e){return e.patternStrategy==="escape"?ivn(t):t}function ivn(t){let e="";for(let r=0;r<t.length;r++)ovn.has(t[r])||(e+="\\"),e+=t[r];return e}function KC(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}}})):Hi(t,"format",e,r,n)}function kb(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:tAt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Hi(t,"pattern",tAt(e,n),r,n)}function tAt(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 e3e,JC,ovn,Nge=v(()=>{oF();JC={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:()=>(e3e===void 0&&(e3e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),e3e),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-_]*$/};ovn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function Dge(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===Ae.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:kn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??Ul(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:kn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ae.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Age(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===Ae.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===Ae.ZodBranded&&t.keyType._def.type._def.typeName===Ae.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Rge(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var jge=v(()=>{RS();Ige();Nge();Md();cO()});function rAt(t,e){if(e.mapStrategy==="record")return Dge(t,e);let r=kn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ul(e),n=kn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ul(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var r3e=v(()=>{RS();jge();Md()});function nAt(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 n3e=v(()=>{});function oAt(t){return t.target==="openAi"?void 0:{not:Ul({...t,currentPath:[...t.currentPath,"not"]})}}var o3e=v(()=>{RS()});function iAt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var i3e=v(()=>{});function sAt(t,e){if(e.target==="openApi3")return aAt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in ote&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=ote[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":return i._def.value===null?[...o,"null"]:o;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 aAt(t,e)}var ote,aAt,$ge=v(()=>{Md();ote={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};aAt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>kn(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 uAt(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:ote[t.innerType._def.typeName],nullable:!0}:{type:[ote[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=kn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=kn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var a3e=v(()=>{$ge();Md()});function lAt(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",LHe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Hi(r,"minimum",n.value,n.message,e):Hi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Hi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Hi(r,"maximum",n.value,n.message,e):Hi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Hi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Hi(r,"multipleOf",n.value,n.message,e);break}return r}var s3e=v(()=>{oF()});function cAt(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],i=t.shape();for(let s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;let l=svn(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=kn(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});c!==void 0&&(n.properties[s]=c,l||o.push(s))}o.length&&(n.required=o);let a=avn(t,e);return a!==void 0&&(n.additionalProperties=a),n}function avn(t,e){if(t.catchall._def.typeName!=="ZodNever")return kn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function svn(t){try{return t.isOptional()}catch{return!0}}var u3e=v(()=>{Md()});var dAt,l3e=v(()=>{RS();Md();dAt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return kn(t.innerType._def,e);let r=kn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ul(e)},r]}:Ul(e)}});var fAt,c3e=v(()=>{Md();fAt=(t,e)=>{if(e.pipeStrategy==="input")return kn(t.in._def,e);if(e.pipeStrategy==="output")return kn(t.out._def,e);let r=kn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=kn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function pAt(t,e){return kn(t.type._def,e)}var d3e=v(()=>{Md()});function mAt(t,e){let n={type:"array",uniqueItems:!0,items:kn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Hi(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Hi(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var f3e=v(()=>{oF();Md()});function hAt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>kn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:kn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>kn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var p3e=v(()=>{Md()});function gAt(t){return{not:Ul(t)}}var m3e=v(()=>{RS()});function yAt(t){return Ul(t)}var h3e=v(()=>{RS()});var bAt,g3e=v(()=>{Md();bAt=(t,e)=>kn(t.innerType._def,e)});var _At,y3e=v(()=>{RS();zHe();VHe();HHe();Ige();WHe();KHe();GHe();XHe();ZHe();YHe();QHe();Nge();jge();r3e();n3e();o3e();i3e();$ge();a3e();s3e();u3e();l3e();c3e();d3e();f3e();p3e();m3e();h3e();g3e();cO();_At=(t,e,r)=>{switch(e){case Ae.ZodString:return Age(t,r);case Ae.ZodNumber:return lAt(t,r);case Ae.ZodObject:return cAt(t,r);case Ae.ZodBigInt:return JIt(t,r);case Ae.ZodBoolean:return KIt();case Ae.ZodDate:return JHe(t,r);case Ae.ZodUndefined:return gAt(r);case Ae.ZodNull:return iAt(r);case Ae.ZodArray:return WIt(t,r);case Ae.ZodUnion:case Ae.ZodDiscriminatedUnion:return sAt(t,r);case Ae.ZodIntersection:return QIt(t,r);case Ae.ZodTuple:return hAt(t,r);case Ae.ZodRecord:return Dge(t,r);case Ae.ZodLiteral:return eAt(t,r);case Ae.ZodEnum:return YIt(t);case Ae.ZodNativeEnum:return nAt(t);case Ae.ZodNullable:return uAt(t,r);case Ae.ZodOptional:return dAt(t,r);case Ae.ZodMap:return rAt(t,r);case Ae.ZodSet:return mAt(t,r);case Ae.ZodLazy:return()=>t.getter()._def;case Ae.ZodPromise:return pAt(t,r);case Ae.ZodNaN:case Ae.ZodNever:return oAt(r);case Ae.ZodEffects:return ZIt(t,r);case Ae.ZodAny:return Ul(r);case Ae.ZodUnknown:return yAt(r);case Ae.ZodDefault:return XIt(t,r);case Ae.ZodBranded:return Rge(t,r);case Ae.ZodReadonly:return bAt(t,r);case Ae.ZodCatch:return GIt(t,r);case Ae.ZodPipeline:return fAt(t,r);case Ae.ZodFunction:case Ae.ZodVoid:case Ae.ZodSymbol:return;default:return(n=>{})(e)}}});function kn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let s=e.override?.(t,e,n,r);if(s!==MIt)return s}if(n&&!r){let s=uvn(n,e);if(s!==void 0)return s}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=_At(t,t.typeName,e),a=typeof i=="function"?kn(i(),e):i;if(a&&lvn(t,e,a),e.postProcess){let s=e.postProcess(a,t,e);return o.jsonSchema=a,s}return o.jsonSchema=a,a}var uvn,lvn,Md=v(()=>{vge();Sge();RS();y3e();uvn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:wge(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`),Ul(e)):e.$refStrategy==="seen"?Ul(e):void 0}},lvn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var vAt,b3e=v(()=>{$He();RS();Md();vAt=(t,e)=>{let r=IIt(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:kn(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Ul(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=kn(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??Ul(r),a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));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 wAt=v(()=>{vge();$He();oF();Sge();RS();zHe();VHe();HHe();Ige();WHe();KHe();GHe();XHe();ZHe();YHe();QHe();Nge();jge();r3e();n3e();o3e();i3e();$ge();a3e();s3e();u3e();l3e();c3e();d3e();f3e();p3e();m3e();h3e();g3e();y3e();Md();b3e()});function dO(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(!dO(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(!dO(t[a],e[a]))return!1;return!0}return t===e}var _3e=v(()=>{});function iw(t){return encodeURI(cvn(t))}function cvn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var Lge=v(()=>{});function GC(t,e=Object.create(null),r=mvn,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:GC(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(pvn[i])continue;let a=`${n}/${iw(i)}`,s=t[i];if(Array.isArray(s)){if(dvn[i]){let u=s.length;for(let l=0;l<u;l++)GC(s[l],e,r,`${a}/${l}`)}}else if(fvn[i])for(let u in s)GC(s[u],e,r,`${a}/${iw(u)}`);else GC(s,e,r,a)}return e}var dvn,fvn,pvn,mvn,Fge=v(()=>{Lge();dvn={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},fvn={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},pvn={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},mvn=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 N_(t){return t.test.bind(t)}function jvn(t){return t%4===0&&(t%100!==0||t%400===0)}function SAt(t){let e=t.match(hvn);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&jvn(r)?29:gvn[n])}function CAt(t,e){let r=e.match(yvn);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 Lvn(t){let e=t.split($vn);return e.length==2&&SAt(e[0])&&CAt(!0,e[1])}function qvn(t){return Fvn.test(t)&&kvn.test(t)}function Bvn(t){if(Uvn.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var hvn,gvn,yvn,bvn,_vn,vvn,wvn,Svn,Cvn,xvn,Tvn,Ovn,Evn,Pvn,Mvn,Rvn,Ivn,Avn,Nvn,Dvn,v3e,$vn,Fvn,kvn,Uvn,w3e=v(()=>{hvn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gvn=[0,31,28,31,30,31,30,31,31,30,31,30,31],yvn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,bvn=/^(?=.{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,_vn=/^(?:[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,vvn=/^(?:(?:[^\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,wvn=/^(?:(?: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,Svn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Cvn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,xvn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Tvn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ovn=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Evn=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Pvn=/^\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,Mvn=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,Rvn=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))},Ivn=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Avn=/^((([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,Nvn=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));Dvn={date:SAt,time:CAt.bind(void 0,!1),"date-time":Lvn,duration:Nvn,uri:qvn,"uri-reference":N_(_vn),"uri-template":N_(vvn),url:N_(wvn),email:Rvn,hostname:N_(bvn),ipv4:N_(Ivn),ipv6:N_(Avn),regex:Bvn,uuid:N_(Svn),"json-pointer":N_(Cvn),"json-pointer-uri-fragment":N_(xvn),"relative-json-pointer":N_(Tvn)},v3e={...Dvn,date:N_(Ovn),time:N_(Evn),"date-time":N_(Pvn),"uri-reference":N_(Mvn)};$vn=/t|\s/i;Fvn=/\/|:/,kvn=/^(?:[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;Uvn=/[^\\]\\Z/});var xAt,TAt=v(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(xAt||(xAt={}))});function OAt(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 S3e=v(()=>{});function Ku(t,e,r="2019-09",n=GC(e),o=!0,i=null,a="#",s="#",u=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof t,c;switch(l){case"boolean":case"number":case"string":c=l;break;case"object":t===null?c="null":Array.isArray(t)?c="array":c="object";break;default:throw new Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:y,required:g,not:b,anyOf:_,allOf:w,oneOf:T,if:O,then:E,else:P,format:R,properties:I,patternProperties:N,additionalProperties:z,unevaluatedProperties:V,minProperties:k,maxProperties:X,propertyNames:B,dependentRequired:Q,dependentSchemas:Y,dependencies:K,prefixItems:oe,items:ue,additionalItems:de,unevaluatedItems:L,contains:W,minContains:ie,maxContains:j,minItems:A,maxItems:U,uniqueItems:H,minimum:re,maximum:Z,exclusiveMinimum:le,exclusiveMaximum:Ce,multipleOf:He,minLength:lt,maxLength:qe,pattern:Nt,__absolute_ref__:mt,__absolute_recursive_ref__:Ot}=e,je=[];if(p===!0&&i===null&&(i=e),f==="#"){let ct=i===null?n[Ot]:i,ze=`${s}/$recursiveRef`,ht=Ku(t,i===null?e:i,r,n,o,ct,a,ze,u);ht.valid||je.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:ze,error:"A subschema had errors."},...ht.errors)}if(d!==void 0){let ze=n[mt||d];if(ze===void 0){let Ue=`Unresolved $ref "${d}".`;throw mt&&mt!==d&&(Ue+=` Absolute URI "${mt}".`),Ue+=`
|
||
Known schemas:
|
||
- ${Object.keys(n).join(`
|
||
- `)}`,new Error(Ue)}let ht=`${s}/$ref`,$e=Ku(t,ze,r,n,o,i,a,ht,u);if($e.valid||je.push({instanceLocation:a,keyword:"$ref",keywordLocation:ht,error:"A subschema had errors."},...$e.errors),r==="4"||r==="7")return{valid:je.length===0,errors:je}}if(Array.isArray(m)){let ct=m.length,ze=!1;for(let ht=0;ht<ct;ht++)if(c===m[ht]||m[ht]==="integer"&&c==="number"&&t%1===0&&t===t){ze=!0;break}ze||je.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)&&je.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&je.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?dO(t,h)||je.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&je.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),y!==void 0&&(c==="object"||c==="array"?y.some(ct=>dO(t,ct))||je.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`}):y.some(ct=>t===ct)||je.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})),b!==void 0){let ct=`${s}/not`;Ku(t,b,r,n,o,i,a,ct).valid&&je.push({instanceLocation:a,keyword:"not",keywordLocation:ct,error:'Instance matched "not" schema.'})}let Gr=[];if(_!==void 0){let ct=`${s}/anyOf`,ze=je.length,ht=!1;for(let $e=0;$e<_.length;$e++){let Ue=_[$e],Ve=Object.create(u),Kt=Ku(t,Ue,r,n,o,p===!0?i:null,a,`${ct}/${$e}`,Ve);je.push(...Kt.errors),ht=ht||Kt.valid,Kt.valid&&Gr.push(Ve)}ht?je.length=ze:je.splice(ze,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:ct,error:"Instance does not match any subschemas."})}if(w!==void 0){let ct=`${s}/allOf`,ze=je.length,ht=!0;for(let $e=0;$e<w.length;$e++){let Ue=w[$e],Ve=Object.create(u),Kt=Ku(t,Ue,r,n,o,p===!0?i:null,a,`${ct}/${$e}`,Ve);je.push(...Kt.errors),ht=ht&&Kt.valid,Kt.valid&&Gr.push(Ve)}ht?je.length=ze:je.splice(ze,0,{instanceLocation:a,keyword:"allOf",keywordLocation:ct,error:"Instance does not match every subschema."})}if(T!==void 0){let ct=`${s}/oneOf`,ze=je.length,ht=T.filter(($e,Ue)=>{let Ve=Object.create(u),Kt=Ku(t,$e,r,n,o,p===!0?i:null,a,`${ct}/${Ue}`,Ve);return je.push(...Kt.errors),Kt.valid&&Gr.push(Ve),Kt.valid}).length;ht===1?je.length=ze:je.splice(ze,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:ct,error:`Instance does not match exactly one subschema (${ht} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Gr),O!==void 0){let ct=`${s}/if`;if(Ku(t,O,r,n,o,i,a,ct,u).valid){if(E!==void 0){let ht=Ku(t,E,r,n,o,i,a,`${s}/then`,u);ht.valid||je.push({instanceLocation:a,keyword:"if",keywordLocation:ct,error:'Instance does not match "then" schema.'},...ht.errors)}}else if(P!==void 0){let ht=Ku(t,P,r,n,o,i,a,`${s}/else`,u);ht.valid||je.push({instanceLocation:a,keyword:"if",keywordLocation:ct,error:'Instance does not match "else" schema.'},...ht.errors)}}if(c==="object"){if(g!==void 0)for(let $e of g)$e in t||je.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${$e}".`});let ct=Object.keys(t);if(k!==void 0&&ct.length<k&&je.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${k} properties.`}),X!==void 0&&ct.length>X&&je.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${X} properties.`}),B!==void 0){let $e=`${s}/propertyNames`;for(let Ue in t){let Ve=`${a}/${iw(Ue)}`,Kt=Ku(Ue,B,r,n,o,i,Ve,$e);Kt.valid||je.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:$e,error:`Property name "${Ue}" does not match schema.`},...Kt.errors)}}if(Q!==void 0){let $e=`${s}/dependantRequired`;for(let Ue in Q)if(Ue in t){let Ve=Q[Ue];for(let Kt of Ve)Kt in t||je.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:$e,error:`Instance has "${Ue}" but does not have "${Kt}".`})}}if(Y!==void 0)for(let $e in Y){let Ue=`${s}/dependentSchemas`;if($e in t){let Ve=Ku(t,Y[$e],r,n,o,i,a,`${Ue}/${iw($e)}`,u);Ve.valid||je.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:Ue,error:`Instance has "${$e}" but does not match dependant schema.`},...Ve.errors)}}if(K!==void 0){let $e=`${s}/dependencies`;for(let Ue in K)if(Ue in t){let Ve=K[Ue];if(Array.isArray(Ve))for(let Kt of Ve)Kt in t||je.push({instanceLocation:a,keyword:"dependencies",keywordLocation:$e,error:`Instance has "${Ue}" but does not have "${Kt}".`});else{let Kt=Ku(t,Ve,r,n,o,i,a,`${$e}/${iw(Ue)}`);Kt.valid||je.push({instanceLocation:a,keyword:"dependencies",keywordLocation:$e,error:`Instance has "${Ue}" but does not match dependant schema.`},...Kt.errors)}}}let ze=Object.create(null),ht=!1;if(I!==void 0){let $e=`${s}/properties`;for(let Ue in I){if(!(Ue in t))continue;let Ve=`${a}/${iw(Ue)}`,Kt=Ku(t[Ue],I[Ue],r,n,o,i,Ve,`${$e}/${iw(Ue)}`);if(Kt.valid)u[Ue]=ze[Ue]=!0;else if(ht=o,je.push({instanceLocation:a,keyword:"properties",keywordLocation:$e,error:`Property "${Ue}" does not match schema.`},...Kt.errors),ht)break}}if(!ht&&N!==void 0){let $e=`${s}/patternProperties`;for(let Ue in N){let Ve=new RegExp(Ue,"u"),Kt=N[Ue];for(let so in t){if(!Ve.test(so))continue;let iu=`${a}/${iw(so)}`,An=Ku(t[so],Kt,r,n,o,i,iu,`${$e}/${iw(Ue)}`);An.valid?u[so]=ze[so]=!0:(ht=o,je.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:$e,error:`Property "${so}" matches pattern "${Ue}" but does not match associated schema.`},...An.errors))}}}if(!ht&&z!==void 0){let $e=`${s}/additionalProperties`;for(let Ue in t){if(ze[Ue])continue;let Ve=`${a}/${iw(Ue)}`,Kt=Ku(t[Ue],z,r,n,o,i,Ve,$e);Kt.valid?u[Ue]=!0:(ht=o,je.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:$e,error:`Property "${Ue}" does not match additional properties schema.`},...Kt.errors))}}else if(!ht&&V!==void 0){let $e=`${s}/unevaluatedProperties`;for(let Ue in t)if(!u[Ue]){let Ve=`${a}/${iw(Ue)}`,Kt=Ku(t[Ue],V,r,n,o,i,Ve,$e);Kt.valid?u[Ue]=!0:je.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:$e,error:`Property "${Ue}" does not match unevaluated properties schema.`},...Kt.errors)}}}else if(c==="array"){U!==void 0&&t.length>U&&je.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${U}).`}),A!==void 0&&t.length<A&&je.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${A}).`});let ct=t.length,ze=0,ht=!1;if(oe!==void 0){let $e=`${s}/prefixItems`,Ue=Math.min(oe.length,ct);for(;ze<Ue;ze++){let Ve=Ku(t[ze],oe[ze],r,n,o,i,`${a}/${ze}`,`${$e}/${ze}`);if(u[ze]=!0,!Ve.valid&&(ht=o,je.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:$e,error:"Items did not match schema."},...Ve.errors),ht))break}}if(ue!==void 0){let $e=`${s}/items`;if(Array.isArray(ue)){let Ue=Math.min(ue.length,ct);for(;ze<Ue;ze++){let Ve=Ku(t[ze],ue[ze],r,n,o,i,`${a}/${ze}`,`${$e}/${ze}`);if(u[ze]=!0,!Ve.valid&&(ht=o,je.push({instanceLocation:a,keyword:"items",keywordLocation:$e,error:"Items did not match schema."},...Ve.errors),ht))break}}else for(;ze<ct;ze++){let Ue=Ku(t[ze],ue,r,n,o,i,`${a}/${ze}`,$e);if(u[ze]=!0,!Ue.valid&&(ht=o,je.push({instanceLocation:a,keyword:"items",keywordLocation:$e,error:"Items did not match schema."},...Ue.errors),ht))break}if(!ht&&de!==void 0){let Ue=`${s}/additionalItems`;for(;ze<ct;ze++){let Ve=Ku(t[ze],de,r,n,o,i,`${a}/${ze}`,Ue);u[ze]=!0,Ve.valid||(ht=o,je.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:Ue,error:"Items did not match additional items schema."},...Ve.errors))}}}if(W!==void 0)if(ct===0&&ie===void 0)je.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(ie!==void 0&&ct<ie)je.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${ct}) than minContains (${ie}).`});else{let $e=`${s}/contains`,Ue=je.length,Ve=0;for(let Kt=0;Kt<ct;Kt++){let so=Ku(t[Kt],W,r,n,o,i,`${a}/${Kt}`,$e);so.valid?(u[Kt]=!0,Ve++):je.push(...so.errors)}Ve>=(ie||0)&&(je.length=Ue),ie===void 0&&j===void 0&&Ve===0?je.splice(Ue,0,{instanceLocation:a,keyword:"contains",keywordLocation:$e,error:"Array does not contain item matching schema."}):ie!==void 0&&Ve<ie?je.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${ie} items matching schema. Only ${Ve} items were found.`}):j!==void 0&&Ve>j&&je.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${j} items matching schema. ${Ve} items were found.`})}if(!ht&&L!==void 0){let $e=`${s}/unevaluatedItems`;for(ze;ze<ct;ze++){if(u[ze])continue;let Ue=Ku(t[ze],L,r,n,o,i,`${a}/${ze}`,$e);u[ze]=!0,Ue.valid||je.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:$e,error:"Items did not match unevaluated items schema."},...Ue.errors)}}if(H)for(let $e=0;$e<ct;$e++){let Ue=t[$e],Ve=typeof Ue=="object"&&Ue!==null;for(let Kt=0;Kt<ct;Kt++){if($e===Kt)continue;let so=t[Kt];(Ue===so||Ve&&(typeof so=="object"&&so!==null)&&dO(Ue,so))&&(je.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${$e} and ${Kt}.`}),$e=Number.MAX_SAFE_INTEGER,Kt=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(re!==void 0&&(le===!0&&t<=re||t<re)&&je.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${le?"or equal to ":""} ${re}.`}),Z!==void 0&&(Ce===!0&&t>=Z||t>Z)&&je.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ce?"or equal to ":""} ${Z}.`})):(re!==void 0&&t<re&&je.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${re}.`}),Z!==void 0&&t>Z&&je.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Z}.`}),le!==void 0&&t<=le&&je.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${le}.`}),Ce!==void 0&&t>=Ce&&je.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Ce}.`})),He!==void 0){let ct=t%He;Math.abs(0-ct)>=11920929e-14&&Math.abs(He-ct)>=11920929e-14&&je.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${He}.`})}}else if(c==="string"){let ct=lt===void 0&&qe===void 0?0:OAt(t);lt!==void 0&&ct<lt&&je.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${ct} < ${lt}).`}),qe!==void 0&&ct>qe&&je.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${ct} > ${qe}).`}),Nt!==void 0&&!new RegExp(Nt,"u").test(t)&&je.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),R!==void 0&&v3e[R]&&!v3e[R](t)&&je.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${R}".`})}return{valid:je.length===0,errors:je}}var C3e=v(()=>{_3e();Fge();w3e();Lge();S3e()});var kge,EAt=v(()=>{Fge();C3e();kge=class{constructor(e,r="2019-09",n=!0){x(this,"schema");x(this,"draft");x(this,"shortCircuit");x(this,"lookup");this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=GC(e)}validate(e){return Ku(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),GC(e,this.lookup)}}});var qge=v(()=>{_3e();Fge();w3e();Lge();TAt();S3e();C3e();EAt()});function Ci(t,e){if(Iu(t)){let r=bge(t,!0);if(MS(r)){let n=bJ(r,!0);return eF(n,e)}else return eF(t,e)}return yc(t)?vAt(t):t}function PJ(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=>PJ(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=>PJ(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=GC(t);return r[e]?PJ(r[e]):!1}return!1}var zvn,Ny=v(()=>{Jo();QN();b3e();wAt();Iy();qge();zvn={};$t(zvn,{Validator:()=>kge,deepCompareStrict:()=>dO,toJsonSchema:()=>Ci,validatesOnlyStrings:()=>PJ})});function Hvn(t,e){if(t!==void 0&&!Z6(t))return t;if(gee(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 Wvn(t){return gee(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Ci(t.data.schema),title:t.data.name}}}function PAt(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 MAt(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 Vvn,Uge,IAt=v(()=>{Jo();Phe();EIt();Ny();JQ();Vvn={};$t(Vvn,{Graph:()=>Uge});Uge=class RAt{constructor(e){x(this,"nodes",{});x(this,"edges",[]);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]=Z6(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...Wvn(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??WQ(),i={id:o,data:e,name:Hvn(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 PAt(this)}lastNode(){return MAt(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(Z6)&&(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&&PAt(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&MAt(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 Z6(o)&&r.get(i)===1?i:o};return new RAt({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 TIt(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 OIt(r,{backgroundColor:e?.backgroundColor})}}});function AAt(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 $b.fromReadableStream(r)}var NAt=v(()=>{nO()});function x3e(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function Bge(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*T3e(t,e){for(;;){let{value:r,done:n}=Rh.runWithConfig(jb(t),e.next.bind(e),!0);if(n)break;yield r}}async function*zge(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Rh.runWithConfig(jb(t),r.next.bind(e),!0);if(o)break;yield n}}var DAt,jAt=v(()=>{zz();Vz();rO();DAt=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Rd(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function Kvn(t){if(she(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function aw(t){if(typeof t=="function")return new D_({func:t});if(Go.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=aw(n);return new lF({steps:e})}else throw new Error(`Expected a Runnable, function or object.
|
||
Instead got an unsupported type.`)}function Gvn(t,e){let r=e.name??t.getName(),n=e.description??nF(e.schema);return _J(e.schema)?new Vge({name:r,description:n,schema:wt.object({input:wt.string()}).transform(o=>o.input),bound:t}):new Vge({name:r,description:n,schema:e.schema,bound:t})}var Go,DS,LAt,Hge,Bl,lF,Jvn,D_,BAt,O3e,ate,E3e,Vge,Pg=v(()=>{kL();Wpe();zz();Vz();rO();iJ();nO();sMt();fMt();S4e();Jz();gMt();Phe();QN();IAt();NAt();jAt();cO();JQ();o4e();Go=class extends Cg{constructor(){super(...arguments);x(this,"lc_runnable",!0);x(this,"name")}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}withRetry(e){return new Hge({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new DS({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new O3e({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(ai);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)=>ai(i===0?e:n))}return Array.from({length:r},()=>ai(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new ES({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=ai(r),o=new KL({generator:this._streamIterator(e,n),config:n});return await o.setup,$b.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=ai(e):r=ai({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=ai(n),a=await(await Ry(o))?.handleChainStart(this.toJSON(),Rd(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 TS(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(Rd(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Ry)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Rd(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 TS(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(Rd(u,"output")))),u}_concatOutputChunks(e,r){return Lb(e,r)}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=ai(n),l=await Ry(u),c=this;async function*d(){for await(let p of e){if(i)if(o===void 0)o=p;else try{o=c._concatOutputChunks(o,p)}catch{o=void 0,i=!1}yield p}}let f;try{let p=await g4e(r.bind(this),d(),async()=>l?.handleChainStart(this.toJSON(),{input:""},u.runId,u.runType,void 0,void 0,u.runName??this.getName(),void 0,{lc_defers_inputs:!0}),n?.signal,u);delete u.runId,f=p.setup;let m=f?.handlers.find(cMt),h=p.output;m!==void 0&&f!==void 0&&(h=m.tapOutputIterable(f.runId,h));let y=f?.handlers.find(w4e);y!==void 0&&f!==void 0&&(h=y.tapOutputIterable(f.runId,h));for await(let g of h)if(yield g,s)if(a===void 0)a=g;else try{a=this._concatOutputChunks(a,g)}catch{a=void 0,s=!1}}catch(p){throw await f?.handleChainError(p,void 0,void 0,void 0,{inputs:Rd(o,"input")}),p}await f?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:Rd(o,"input")})}getGraph(e){let r=new Uge,n=r.addNode({name:`${this.getName()}Input`,schema:wt.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:wt.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new Bl({first:this,last:aw(e)})}pick(e){return this.pipe(new E3e(e))}assign(e){return this.pipe(new ate(new lF({steps:e})))}async*transform(e,r){let n;for await(let o of e)n===void 0?n=o:n=this._concatOutputChunks(n,o);yield*this._streamIterator(n,ai(r))}async*streamLog(e,r,n){let o=new xhe({...n,autoClose:!1,_schemaFormat:"original"}),i=ai(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 oO({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"?AAt(o):$b.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new dMt({...n,autoClose:!1}),i=ai(r),a=i.runId??WQ();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[o];else if(Array.isArray(s))i.callbacks=s.concat(o);else{let m=s.copy();m.addHandler(o,!0),i.callbacks=m}let u=new AbortController,l=this;async function c(){let m,h=null;try{r?.signal?"any"in AbortSignal?m=AbortSignal.any([u.signal,r.signal]):(m=r.signal,h=()=>{u.abort()},r.signal.addEventListener("abort",h,{once:!0})):m=u.signal;let y=await l.stream(e,{...i,signal:m}),g=o.tapOutputIterable(a,y);for await(let b of g)if(u.signal.aborted)break}finally{await o.finish(),m&&h&&m.removeEventListener("abort",h)}}let d=c(),f=!1,p;try{for await(let m of o){if(!f){m.data.input=e,f=!0,p=m.run_id,yield m;continue}m.run_id===p&&m.event.endsWith("_end")&&m.data?.input&&delete m.data.input,yield m}}finally{u.abort(),await d}}async*_streamEventsV1(e,r,n){let o,i=!1,a=ai(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new xhe({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new yMt({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=Che.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 b={...o.state},_={run_id:b.id,event:`on_${b.type}_start`,name:l,tags:s,metadata:u,data:{input:e}};d.includeEvent(_,b.type)&&(yield _)}let h=m.ops.filter(b=>b.path.startsWith("/logs/")).map(b=>b.path.split("/")[2]),y=[...new Set(h)];for(let b of y){let _,w={},T=o.state.logs[b];if(T.end_time===void 0?T.streamed_output.length>0?_="stream":_="start":_="end",_==="start")T.inputs!==void 0&&(w.input=T.inputs);else if(_==="end")T.inputs!==void 0&&(w.input=T.inputs),w.output=T.final_output;else if(_==="stream"){let O=T.streamed_output.length;if(O!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${O} instead. Encountered in: "${T.name}"`);w={chunk:T.streamed_output[0]},T.streamed_output=[]}yield{event:`on_${T.type}_${_}`,name:T.name,run_id:T.id,tags:T.tags,metadata:T.metadata,data:w}}let{state:g}=o;if(g.streamed_output.length>0){let b=g.streamed_output.length;if(b!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${b} instead. Encountered in: "${g.name}"`);let _={chunk:g.streamed_output[0]};g.streamed_output=[];let w={event:`on_${g.type}_stream`,run_id:g.id,tags:s,metadata:u,name:l,data:_};d.includeEvent(w,g.type)&&(yield w)}}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 gee(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new DS({bound:this,config:{},configFactories:[o=>({callbacks:[new C4e({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return Gvn(this,e)}},DS=class $At extends Go{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"bound");x(this,"config");x(this,"kwargs");x(this,"configFactories");this.bound=r.bound,this.kwargs=r.kwargs,this.config=r.config,this.configFactories=r.configFactories}static lc_name(){return"RunnableBinding"}getName(r){return this.bound.getName(r)}async _mergeConfig(...r){let n=Hz(this.config,...r);return Hz(n,...this.configFactories?await Promise.all(this.configFactories.map(async o=>await o(n))):[])}withConfig(r){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...r}})}withRetry(r){return new Hge({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:r?.stopAfterAttempt,...r})}async invoke(r,n){return this.bound.invoke(r,await this._mergeConfig(n,this.kwargs))}async batch(r,n,o){let i=Array.isArray(n)?await Promise.all(n.map(async a=>this._mergeConfig(ai(a),this.kwargs))):await this._mergeConfig(ai(n),this.kwargs);return this.bound.batch(r,i,o)}_concatOutputChunks(r,n){return this.bound._concatOutputChunks(r,n)}async*_streamIterator(r,n){yield*this.bound._streamIterator(r,await this._mergeConfig(ai(n),this.kwargs))}async stream(r,n){return this.bound.stream(r,await this._mergeConfig(ai(n),this.kwargs))}async*transform(r,n){yield*this.bound.transform(r,await this._mergeConfig(ai(n),this.kwargs))}streamEvents(r,n,o){let i=this,a=async function*(){yield*i.bound.streamEvents(r,{...await i._mergeConfig(ai(n),i.kwargs),version:n.version},o)};return $b.fromAsyncGenerator(a())}static isRunnableBinding(r){return r.bound&&Go.isRunnable(r.bound)}withListeners({onStart:r,onEnd:n,onError:o}){return new $At({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new C4e({config:i,onStart:r,onEnd:n,onError:o})]})]})}},LAt=class FAt extends Go{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"bound");this.bound=r.bound}static lc_name(){return"RunnableEach"}async invoke(r,n){return this._callWithConfig(this._invoke.bind(this),r,n)}async _invoke(r,n,o){return this.bound.batch(r,Xs(n,{callbacks:o?.getChild()}))}withListeners({onStart:r,onEnd:n,onError:o}){return new FAt({bound:this.bound.withListeners({onStart:r,onEnd:n,onError:o})})}},Hge=class extends DS{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"maxAttemptNumber",3);x(this,"onFailedAttempt",()=>{});this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}static lc_name(){return"RunnableRetry"}_patchConfigForRetry(e,r,n){let o=e>1?`retry:attempt:${e}`:void 0;return Xs(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return hee(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:({error: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 hee(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:({error: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)}},Bl=class ite extends Go{constructor(r){super(r);x(this,"first");x(this,"middle",[]);x(this,"last");x(this,"omitSequenceTags",!1);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","runnables"]);this.first=r.first,this.middle=r.middle??this.middle,this.last=r.last,this.name=r.name,this.omitSequenceTags=r.omitSequenceTags??this.omitSequenceTags}static lc_name(){return"RunnableSequence"}get steps(){return[this.first,...this.middle,this.last]}async invoke(r,n){let o=ai(n),a=await(await Ry(o))?.handleChainStart(this.toJSON(),Rd(r,"input"),o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s=r,u;try{let l=[this.first,...this.middle];for(let c=0;c<l.length;c+=1){let f=l[c].invoke(s,Xs(o,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`)}));s=await TS(f,n?.signal)}if(n?.signal?.aborted)throw JL(n.signal);u=await this.last.invoke(s,Xs(o,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(l){throw await a?.handleChainError(l),l}return await a?.handleChainEnd(Rd(u,"output")),u}async batch(r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Ry)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),Rd(r[c],"input"),i[c].runId,void 0,void 0,void 0,i[c].runName);return delete i[c].runId,d})),u=r;try{for(let l=0;l<this.steps.length;l+=1){let d=this.steps[l].batch(u,s.map((f,p)=>{let m=f?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`);return Xs(i[p],{callbacks:m})}),o);u=await TS(d,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(Rd(u,"output")))),u}_concatOutputChunks(r,n){return this.last._concatOutputChunks(r,n)}async*_streamIterator(r,n){let o=await Ry(n),{runId:i,...a}=n??{},s=await o?.handleChainStart(this.toJSON(),Rd(r,"input"),i,void 0,void 0,void 0,a?.runName),u=[this.first,...this.middle,this.last],l=!0,c;async function*d(){yield r}try{let f=u[0].transform(d(),Xs(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let p=1;p<u.length;p+=1)f=await u[p].transform(f,Xs(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:`seq:step:${p+1}`)}));for await(let p of f)if(n?.signal?.throwIfAborted(),yield p,l)if(c===void 0)c=p;else try{c=this._concatOutputChunks(c,p)}catch{c=void 0,l=!1}}catch(f){throw await s?.handleChainError(f),f}await s?.handleChainEnd(Rd(c,"output"))}getGraph(r){let n=new Uge,o=null;return this.steps.forEach((i,a)=>{let s=i.getGraph(r);a!==0&&s.trimFirstNode(),a!==this.steps.length-1&&s.trimLastNode(),n.extend(s);let u=s.firstNode();if(!u)throw new Error(`Runnable ${i} has no first node`);o&&n.addEdge(o,u),o=s.lastNode()}),n}pipe(r){return ite.isRunnableSequence(r)?new ite({first:this.first,middle:this.middle.concat([this.last,r.first,...r.middle]),last:r.last,name:this.name??r.name}):new ite({first:this.first,middle:[...this.middle,this.last],last:aw(r),name:this.name})}static isRunnableSequence(r){return Array.isArray(r.middle)&&Go.isRunnable(r)}static from([r,...n],o){let i={};return typeof o=="string"?i.name=o:o!==void 0&&(i=o),new ite({...i,first:aw(r),middle:n.slice(0,-1).map(aw),last:aw(n[n.length-1])})}},lF=class kAt extends Go{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"steps");this.steps={};for(let[n,o]of Object.entries(r.steps))this.steps[n]=aw(o)}static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}static from(r){return new kAt({steps:r})}async invoke(r,n){let o=ai(n),a=await(await Ry(o))?.handleChainStart(this.toJSON(),{input:r},o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s={};try{let u=Object.entries(this.steps).map(async([l,c])=>{s[l]=await c.invoke(r,Xs(o,{callbacks:a?.getChild(`map:key:${l}`)}))});await TS(Promise.all(u),n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(s),s}async*_transform(r,n,o){let i={...this.steps},a=phe(r,Object.keys(i).length),s=new Map(Object.entries(i).map(([u,l],c)=>{let d=l.transform(a[c],Xs(o,{callbacks:n?.getChild(`map:key:${u}`)}));return[u,d.next().then(f=>({key:u,gen:d,result:f}))]}));for(;s.size;){let u=Promise.race(s.values()),{key:l,result:c,gen:d}=await TS(u,o?.signal);s.delete(l),c.done||(yield{[l]:c.value},s.set(l,d.next().then(f=>({key:l,gen:d,result:f}))))}}transform(r,n){return this._transformStreamWithConfig(r,this._transform.bind(this),n)}async stream(r,n){async function*o(){yield r}let i=ai(n),a=new KL({generator:this.transform(o(),i),config:i});return await a.setup,$b.fromAsyncGenerator(a)}},Jvn=class qAt extends Go{constructor(r){super(r);x(this,"lc_serializable",!1);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");if(!she(r.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=r.func}async invoke(r,n){let[o]=this._getOptionsList(n??{},1),i=await Ry(o),a=this.func(Xs(o,{callbacks:i}),r);return TS(a,o?.signal)}async*_streamIterator(r,n){let[o]=this._getOptionsList(n??{},1),i=await this.invoke(r,n);if(Bge(i)){for await(let a of i)o?.signal?.throwIfAborted(),yield a;return}if(DAt(i)){for(;;){o?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(r){return new qAt({func:r})}};D_=class UAt extends Go{constructor(r){if(she(r.func))return Jvn.from(r.func);super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");Kvn(r.func),this.func=r.func}static lc_name(){return"RunnableLambda"}static from(r){return new UAt({func:r})}async _invoke(r,n,o){return new Promise((i,a)=>{let s=Xs(n,{callbacks:o?.getChild(),recursionLimit:(n?.recursionLimit??fhe)-1});Rh.runWithConfig(jb(s),async()=>{try{let u=await this.func(r,{...s});if(u&&Go.isRunnable(u)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");u=await u.invoke(r,{...s,recursionLimit:(s.recursionLimit??fhe)-1})}else if(Bge(u)){let l;for await(let c of zge(s,u))if(n?.signal?.throwIfAborted(),l===void 0)l=c;else try{l=this._concatOutputChunks(l,c)}catch{l=c}u=l}else if(x3e(u)){let l;for(let c of T3e(s,u))if(n?.signal?.throwIfAborted(),l===void 0)l=c;else try{l=this._concatOutputChunks(l,c)}catch{l=c}u=l}i(u)}catch(u){a(u)}})})}async invoke(r,n){return this._callWithConfig(this._invoke.bind(this),r,n)}async*_transform(r,n,o){let i;for await(let u of r)if(i===void 0)i=u;else try{i=this._concatOutputChunks(i,u)}catch{i=u}let a=Xs(o,{callbacks:n?.getChild(),recursionLimit:(o?.recursionLimit??fhe)-1}),s=await new Promise((u,l)=>{Rh.runWithConfig(jb(a),async()=>{try{let c=await this.func(i,{...a,config:a});u(c)}catch(c){l(c)}})});if(s&&Go.isRunnable(s)){if(o?.recursionLimit===0)throw new Error("Recursion limit reached.");let u=await s.stream(i,a);for await(let l of u)yield l}else if(Bge(s))for await(let u of zge(a,s))o?.signal?.throwIfAborted(),yield u;else if(x3e(s))for(let u of T3e(a,s))o?.signal?.throwIfAborted(),yield u;else yield s}transform(r,n){return this._transformStreamWithConfig(r,this._transform.bind(this),n)}async stream(r,n){async function*o(){yield r}let i=ai(n),a=new KL({generator:this.transform(o(),i),config:i});return await a.setup,$b.fromAsyncGenerator(a)}},BAt=class extends lF{},O3e=class extends Go{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"runnable");x(this,"fallbacks");this.runnable=e.runnable,this.fallbacks=e.fallbacks}static lc_name(){return"RunnableWithFallbacks"}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,r){let n=ai(r),o=await Ry(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Rd(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Xs(a,{callbacks:s?.getChild()});return await Rh.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(Rd(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=ai(r),o=await Ry(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),Rd(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Xs(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=zge(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:this._concatOutputChunks(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(Rd(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=>Ry(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),Rd(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)=>Xs(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(Rd(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.")}};ate=class extends Go{constructor(e){e instanceof lF&&(e={mapper:e});super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"mapper");this.mapper=e.mapper}static lc_name(){return"RunnableAssign"}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]=phe(e),s=this.mapper.transform(a,Xs(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=ai(r),i=new KL({generator:this.transform(n(),o),config:o});return await i.setup,$b.fromAsyncGenerator(i)}},E3e=class extends Go{constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e});super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"keys");this.keys=e.keys}static lc_name(){return"RunnablePick"}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=ai(r),i=new KL({generator:this.transform(n(),o),config:o});return await i.setup,$b.fromAsyncGenerator(i)}},Vge=class extends DS{constructor(e){let r=Bl.from([D_.from(async n=>{let o;if(qL(n))try{o=await rF(this.schema,n.args)}catch{throw new H6("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??{}});x(this,"name");x(this,"description");x(this,"schema");this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var Au,Wge=v(()=>{rO();nO();Pg();Au=class extends Go{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"func");e&&(this.func=e.func)}static lc_name(){return"RunnablePassthrough"}async invoke(e,r){let n=ai(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=ai(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=Lb(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new ate(new lF({steps:e}))}}});var zAt,VAt=v(()=>{rO();Pg();zAt=class extends Go{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"runnables");this.runnables=e.runnables}static lc_name(){return"RouterRunnable"}async invoke(e,r){let{key:n,input:o}=e,i=this.runnables[n];if(i===void 0)throw new Error(`No runnable associated with key "${n}".`);return i.invoke(o,ai(r))}async batch(e,r,n){let o=e.map(f=>f.key),i=e.map(f=>f.input);if(o.find(f=>this.runnables[f]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=o.map(f=>this.runnables[f]),u=this._getOptionsList(r??{},e.length),l=u[0]?.maxConcurrency??n?.maxConcurrency,c=l&&l>0?l:e.length,d=[];for(let f=0;f<i.length;f+=c){let p=i.slice(f,f+c).map((h,y)=>s[y].invoke(h,u[y])),m=await Promise.all(p);d.push(m)}return d.flat()}async stream(e,r){let{key:n,input:o}=e,i=this.runnables[n];if(i===void 0)throw new Error(`No runnable associated with key "${n}".`);return i.stream(o,r)}}});var HAt,WAt=v(()=>{rO();nO();Pg();HAt=class extends Go{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"default");x(this,"branches");this.branches=e.branches,this.default=e.default}static lc_name(){return"RunnableBranch"}static from(e){if(e.length<1)throw new Error("RunnableBranch requires at least one branch");let n=e.slice(0,-1).map(([i,a])=>[aw(i),aw(a)]),o=aw(e[e.length-1]);return new this({branches:n,default:o})}async _invoke(e,r,n){let o;for(let i=0;i<this.branches.length;i+=1){let[a,s]=this.branches[i];if(await a.invoke(e,Xs(r,{callbacks:n?.getChild(`condition:${i+1}`)}))){o=await s.invoke(e,Xs(r,{callbacks:n?.getChild(`branch:${i+1}`)}));break}}return o||(o=await this.default.invoke(e,Xs(r,{callbacks:n?.getChild("branch:default")}))),o}async invoke(e,r={}){return this._callWithConfig(this._invoke,e,r)}async*_streamIterator(e,r){let o=await(await Ry(r))?.handleChainStart(this.toJSON(),Rd(e,"input"),r?.runId,void 0,void 0,void 0,r?.runName),i,a=!0,s;try{for(let u=0;u<this.branches.length;u+=1){let[l,c]=this.branches[u];if(await l.invoke(e,Xs(r,{callbacks:o?.getChild(`condition:${u+1}`)}))){s=await c.stream(e,Xs(r,{callbacks:o?.getChild(`branch:${u+1}`)}));for await(let f of s)if(yield f,a)if(i===void 0)i=f;else try{i=Lb(i,f)}catch{i=void 0,a=!1}break}}if(s===void 0){s=await this.default.stream(e,Xs(r,{callbacks:o?.getChild("branch:default")}));for await(let u of s)if(yield u,a)if(i===void 0)i=u;else try{i=Lb(i,u)}catch{i=void 0,a=!1}}}catch(u){throw await o?.handleChainError(u),u}await o?.handleChainEnd(i??{})}}});function ZAt(t,e){return Array.isArray(t)?JAt(t,e):D_.from(r=>JAt(r,t))}function JAt(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:a,excludeIds:s}=e,u=[];for(let l of t)if(!(n&&l.name&&n.includes(l.name))){{if(i&&Jge(l,i))continue;if(s&&l.id&&s.includes(l.id))continue}o||a||r?(r&&l.name&&r.some(c=>c===l.name)||o&&Jge(l,o)||a&&l.id&&a.some(c=>c===l.id))&&u.push(l):u.push(l)}return u}function YAt(t){return Array.isArray(t)?KAt(t):D_.from(KAt)}function KAt(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=Nz(o),a=Nz(n),s=i.concat(a);typeof i.content=="string"&&typeof a.content=="string"&&(s.content=`${i.content}
|
||
${a.content}`),e.push(Zvn(s))}}return e}function QAt(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return GAt(r,e)}else{let r=t;return D_.from(n=>GAt(n,r)).withConfig({runName:"trim_messages"})}}async function GAt(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:a,startOn:s,includeSystem:u=!1,textSplitter:l}=e;if(s&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let c;"getNumTokens"in n?c=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):c=async f=>n(f);let d=M3e;if(l&&("splitText"in l?d=l.splitText:d=async f=>l(f)),o==="first")return eNt(t,{maxTokens:r,tokenCounter:c,textSplitter:d,partialStrategy:i?"first":void 0,endOn:a});if(o==="last")return Xvn(t,{maxTokens:r,tokenCounter:c,textSplitter:d,allowPartial:i,includeSystem:u,startOn:s,endOn:a});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function eNt(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:a}=e,s=[...t],u=0;for(let l=0;l<s.length;l+=1){let c=l>0?s.slice(0,-l):s;if(await n(c)<=r){u=s.length-l;break}}if(u<s.length&&i){let l=!1;if(Array.isArray(s[u].content)){let c=s[u];if(typeof c.content=="string")throw new Error("Expected content to be an array.");let d=c.content.length,f=i==="last"?[...c.content].reverse():c.content;for(let p=1;p<=d;p+=1){let m=i==="first"?f.slice(0,p):f.slice(-p),h=Object.fromEntries(Object.entries(c).filter(([b])=>b!=="type"&&!b.startsWith("lc_"))),y=P3e(c.getType(),{...h,content:m}),g=[...s.slice(0,u),y];if(await n(g)<=r)s=g,u+=1,l=!0;else break}l&&i==="last"&&(c.content=[...f].reverse())}if(!l){let c=s[u],d;if(Array.isArray(c.content)&&c.content.some(f=>typeof f=="string"||f.type==="text")?d=c.content.find(p=>p.type==="text"&&p.text)?.text:typeof c.content=="string"&&(d=c.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m<p-1;m+=1)if(f.pop(),c.content=f.join(""),await n([...s.slice(0,u),c])<=r){i==="last"&&(c.content=[...f].reverse().join("")),s=[...s.slice(0,u),c],u+=1;break}}}}if(a){let l=Array.isArray(a)?a:[a];for(;u>0&&!Jge(s[u-1],l);)u-=1}return s.slice(0,u)}async function Xvn(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...a}=e,s=t.map(c=>{let d=Object.fromEntries(Object.entries(c).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return P3e(c.getType(),d,K6(c))});if(o){let c=Array.isArray(o)?o:[o];for(;s.length>0&&!Jge(s[s.length-1],c);)s=s.slice(0,-1)}let u=n&&s[0]?.getType()==="system",l=u?s.slice(0,1).concat(s.slice(1).reverse()):s.reverse();return l=await eNt(l,{...a,partialStrategy:r?"last":void 0,endOn:i}),u?[l[0],...l.slice(1).reverse()]:l.reverse()}function P3e(t,e,r){let n,o;switch(t){case"human":r?n=new rw(e):o=new qs(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(a=>({...a,type:"tool_call_chunk",index:void 0,args:JSON.stringify(a.args)}))}),n=new Er(i)}else o=new Pn(e);break;case"system":r?n=new Rb(e):o=new Od(e);break;case"developer":r?n=new Rb({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new Od({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new _S(e):o=new Mh(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new tw(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new Iz(e)}break;case"generic":if("role"in e)r?n=new ew(e):o=new Td(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function Zvn(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in XAt&&(r=P3e(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(XAt)}`);return r}function M3e(t){let e=t.split(`
|
||
`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r}
|
||
`),e[e.length-1]])}var Jge,XAt,tNt=v(()=>{Oy();G6();UQ();tme();zL();rme();BQ();UC();vS();Pg();Jge=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};XAt={human:{message:qs,messageChunk:rw},ai:{message:Pn,messageChunk:Er},system:{message:Od,messageChunk:Rb},developer:{message:Od,messageChunk:Rb},tool:{message:Mh,messageChunk:_S},function:{message:Iz,messageChunk:tw},generic:{message:Td,messageChunk:ew},remove:{message:Az,messageChunk:Az}}});var rNt,nNt=v(()=>{rNt=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"]});var oNt,iNt=v(()=>{oNt=["image","video","audio","text-plain","file"]});var aNt,sNt=v(()=>{nNt();iNt();aNt=["text","reasoning",...rNt,...oNt]});var Yvn,ta=v(()=>{Jo();LQ();bBe();Oy();ime();G6();UQ();tme();zL();rme();BQ();UC();vS();tNt();sNt();Yvn={};$t(Yvn,{AIMessage:()=>Pn,AIMessageChunk:()=>Er,BaseMessage:()=>id,BaseMessageChunk:()=>Mb,ChatMessage:()=>Td,ChatMessageChunk:()=>ew,FunctionMessage:()=>Iz,FunctionMessageChunk:()=>tw,HumanMessage:()=>qs,HumanMessageChunk:()=>rw,KNOWN_BLOCK_TYPES:()=>aNt,RemoveMessage:()=>Az,SystemMessage:()=>Od,SystemMessageChunk:()=>Rb,ToolMessage:()=>Mh,ToolMessageChunk:()=>_S,_isMessageFieldWithRole:()=>eme,_mergeDicts:()=>Fl,_mergeLists:()=>Rz,_mergeObj:()=>Qpe,_mergeStatus:()=>Ype,coerceMessageLikeToMessage:()=>wS,collapseToolCallChunks:()=>ame,convertToChunk:()=>Nz,convertToOpenAIImageBlock:()=>Kpe,convertToProviderContentBlock:()=>GT,defaultTextSplitter:()=>M3e,defaultToolCallParser:()=>kQ,filterMessages:()=>ZAt,getBufferString:()=>fl,iife:()=>sme,isAIMessage:()=>kl,isAIMessageChunk:()=>zQ,isBase64ContentBlock:()=>J6,isBaseMessage:()=>xg,isBaseMessageChunk:()=>K6,isChatMessage:()=>QCt,isChatMessageChunk:()=>ext,isDataContentBlock:()=>Ph,isDirectToolOutput:()=>FQ,isFunctionMessage:()=>txt,isFunctionMessageChunk:()=>rxt,isHumanMessage:()=>nxt,isHumanMessageChunk:()=>oxt,isIDContentBlock:()=>Jpe,isMessage:()=>Zpe,isOpenAIToolCallArray:()=>XCt,isPlainTextContentBlock:()=>LCt,isSystemMessage:()=>ixt,isSystemMessageChunk:()=>axt,isToolMessage:()=>qQ,isToolMessageChunk:()=>vBe,isURLContentBlock:()=>W6,mapChatMessagesToStoredMessages:()=>Ixt,mapStoredMessageToChatMessage:()=>VQ,mapStoredMessagesToChatMessages:()=>Rxt,mergeContent:()=>Ty,mergeMessageRuns:()=>YAt,mergeResponseMetadata:()=>ome,mergeUsageMetadata:()=>X6,parseBase64DataUrl:()=>Cy,parseMimeType:()=>$Q,trimMessages:()=>QAt})});var uNt,lNt=v(()=>{Oy();zL();vS();Pg();ta();Wge();uNt=class extends DS{constructor(e){let r=D_.from((a,s)=>this._enterHistory(a,s??{})).withConfig({runName:"loadHistory"}),n=e.historyMessagesKey??e.inputMessagesKey;n&&(r=Au.assign({[n]:r}).withConfig({runName:"insertHistory"}));let o=r.pipe(e.runnable.withListeners({onEnd:(a,s)=>this._exitHistory(a,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),i=e.config??{};super({...e,config:i,bound:o});x(this,"runnable");x(this,"inputMessagesKey");x(this,"outputMessagesKey");x(this,"historyMessagesKey");x(this,"getMessageHistory");this.runnable=e.runnable,this.getMessageHistory=e.getMessageHistory,this.inputMessagesKey=e.inputMessagesKey,this.outputMessagesKey=e.outputMessagesKey,this.historyMessagesKey=e.historyMessagesKey}_getInputMessages(e){let r;if(typeof e=="object"&&!Array.isArray(e)&&!xg(e)){let n;this.inputMessagesKey?n=this.inputMessagesKey:Object.keys(e).length===1?n=Object.keys(e)[0]:n="input",Array.isArray(e[n])&&Array.isArray(e[n][0])?r=e[n][0]:r=e[n]}else r=e;if(typeof r=="string")return[new qs(r)];if(Array.isArray(r))return r;if(xg(r))return[r];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages.
|
||
Got ${JSON.stringify(r,null,2)}`)}_getOutputMessages(e){let r;if(!Array.isArray(e)&&!xg(e)&&typeof e!="string"){let n;this.outputMessagesKey!==void 0?n=this.outputMessagesKey:Object.keys(e).length===1?n=Object.keys(e)[0]:n="output",e.generations!==void 0?r=e.generations[0][0].message:r=e[n]}else r=e;if(typeof r=="string")return[new Pn(r)];if(Array.isArray(r))return r;if(xg(r))return[r];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(r,null,2)}`)}async _enterHistory(e,r){let o=await(r?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?o.concat(this._getInputMessages(e)):o}async _exitHistory(e,r){let n=r.configurable?.messageHistory,o;Array.isArray(e.inputs)&&Array.isArray(e.inputs[0])?o=e.inputs[0]:o=e.inputs;let i=this._getInputMessages(o);if(this.historyMessagesKey===void 0){let u=await n.getMessages();i=i.slice(u.length)}let a=e.outputs;if(!a)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(e,null,2)}`);let s=this._getOutputMessages(a);await n.addMessages([...i,...s])}async _mergeConfig(...e){let r=await super._mergeConfig(...e);if(!r.configurable||!r.configurable.sessionId){let o={[this.inputMessagesKey??"input"]:"foo"},i={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream()
|
||
eg. chain.invoke(${JSON.stringify(o)}, ${JSON.stringify(i)})`)}let{sessionId:n}=r.configurable;return r.configurable.messageHistory=await this.getMessageHistory(n),r}}});var Qvn,sw=v(()=>{Jo();rO();iJ();Pg();Wge();VAt();WAt();lNt();Qvn={};$t(Qvn,{RouterRunnable:()=>zAt,Runnable:()=>Go,RunnableAssign:()=>ate,RunnableBinding:()=>DS,RunnableBranch:()=>HAt,RunnableEach:()=>LAt,RunnableLambda:()=>D_,RunnableMap:()=>lF,RunnableParallel:()=>BAt,RunnablePassthrough:()=>Au,RunnablePick:()=>E3e,RunnableRetry:()=>Hge,RunnableSequence:()=>Bl,RunnableToolLike:()=>Vge,RunnableWithFallbacks:()=>O3e,RunnableWithMessageHistory:()=>uNt,_coerceToRunnable:()=>aw,ensureConfig:()=>ai,getCallbackManagerForConfig:()=>Ry,mergeConfigs:()=>Hz,patchConfig:()=>Xs,pickRunnableConfigKeys:()=>jb,raceWithSignal:()=>TS})});var v4,o1,Ih,MJ=v(()=>{DQ();Pg();sw();v4=class extends Go{parseResultWithPrompt(t,e,r){return this.parseResult(t,r)}_baseMessageToString(t){return typeof t.content=="string"?t.content:this._baseMessageContentToString(t.content)}_baseMessageContentToString(t){return JSON.stringify(t)}async invoke(t,e){return typeof t=="string"?this._callWithConfig(async(r,n)=>this.parseResult([{text:r}],n?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(r,n)=>this.parseResult([{message:r,text:this._baseMessageToString(r)}],n?.callbacks),t,{...e,runType:"parser"})}},o1=class extends v4{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,r){return this.parse(t,r)}_type(){throw new Error("_type not implemented")}},Ih=class extends Error{constructor(e,r,n,o=!1){super(e);x(this,"llmOutput");x(this,"observation");x(this,"sendToLLM");if(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");FL(this,"OUTPUT_PARSING_FAILURE")}}});var i1,cF,dF=v(()=>{Oy();UC();Ed();MJ();qge();i1=class extends o1{async*_transform(t){for await(let e of t)typeof e=="string"?yield this.parseResult([{text:e}]):yield this.parseResult([{message:e,text:this._baseMessageToString(e)}])}async*transform(t,e){yield*this._transformStreamWithConfig(t,this._transform.bind(this),{...e,runType:"parser"})}},cF=class extends i1{constructor(e){super(e);x(this,"diff",!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(K6(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new si({message:o,text:o.content})}else if(xg(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new si({message:Nz(o),text:o.content})}else i=new OS({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!dO(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var cNt,dNt=v(()=>{dF();cNt=class extends i1{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","bytes"]);x(this,"lc_serializable",!0);x(this,"textEncoder",new TextEncoder)}static lc_name(){return"BytesOutputParser"}parse(e){return Promise.resolve(this.textEncoder.encode(e))}getFormatInstructions(){return""}}});var RJ,fNt,pNt,mNt,hNt,gNt=v(()=>{MJ();dF();RJ=class extends i1{constructor(){super(...arguments);x(this,"re")}async*_transform(e){let r="";for await(let n of e)if(typeof n=="string"?r+=n:r+=n.content,this.re){let o=[...r.matchAll(this.re)];if(o.length>1){let i=0;for(let a of o.slice(0,-1))yield[a[1]],i+=(a.index??0)+a[0].length;r=r.slice(i)}}else{let o=await this.parse(r);if(o.length>1){for(let i of o.slice(0,-1))yield[i];r=o[o.length-1]}}for(let n of await this.parse(r))yield[n]}},fNt=class extends RJ{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0)}static lc_name(){return"CommaSeparatedListOutputParser"}async parse(e){try{return e.trim().split(",").map(r=>r.trim())}catch{throw new Ih(`Could not parse output: ${e}`,e)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},pNt=class extends RJ{constructor({length:e,separator:r}){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"length");x(this,"separator");this.length=e,this.separator=r||","}async parse(e){try{let r=e.trim().split(this.separator).map(n=>n.trim());if(this.length!==void 0&&r.length!==this.length)throw new Ih(`Incorrect number of items. Expected ${this.length}, got ${r.length}.`);return r}catch(r){throw Object.getPrototypeOf(r)===Ih.prototype?r:new Ih(`Could not parse output: ${e}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},mNt=class extends RJ{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0);x(this,"re",/\d+\.\s([^\n]+)/g)}static lc_name(){return"NumberedListOutputParser"}getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
|
||
|
||
1. foo
|
||
|
||
2. bar
|
||
|
||
3. baz`}async parse(e){return[...e.matchAll(this.re)??[]].map(r=>r[1])}},hNt=class extends RJ{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0);x(this,"re",/^\s*[-*]\s([^\n]+)$/gm)}static lc_name(){return"NumberedListOutputParser"}getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
|
||
|
||
1. foo
|
||
|
||
2. bar
|
||
|
||
3. baz`}async parse(e){return[...e.matchAll(this.re)??[]].map(r=>r[1])}}});var Kge,yNt=v(()=>{dF();Kge=class extends i1{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","string"]);x(this,"lc_serializable",!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.')}_messageContentToString(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._messageContentToString(n),"")}}});var uw,R3e,bNt,_Nt=v(()=>{QN();Ny();MJ();cO();uw=class extends o1{constructor(e){super(e);x(this,"lc_namespace",["langchain","output_parsers","structured"]);this.schema=e}static lc_name(){return"StructuredOutputParser"}toJSON(){return this.toJSONNotImplemented()}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){let r=wt.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,wt.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(Ci(this.schema))}
|
||
\`\`\`
|
||
`}async parse(e){try{let r=e.trim(),o=(r.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||r.match(/```json\s*([\s\S]*?)```/)?.[1]||r).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(i,a)=>`"${a.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await rF(this.schema,JSON.parse(o))}catch(r){throw new Ih(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}},R3e=class extends uw{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like:
|
||
\`\`\`json
|
||
${this._schemaToInstruction(Ci(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))}
|
||
\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let s=r.type.findIndex(u=>u==="null");s!==-1&&(n=!0,r.type.splice(s,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let s=r.description?` // ${r.description}`:"";return`{
|
||
${Object.entries(r.properties).map(([l,c])=>{let d=r.required?.includes(l)?"":" (optional)";return`${" ".repeat(e)}"${l}": ${this._schemaToInstruction(c,e+2)}${d}`}).join(`
|
||
`)}
|
||
${" ".repeat(e-2)}}${s}`}if(r.type==="array"&&r.items){let s=r.description?` // ${r.description}`:"";return`array[
|
||
${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)}
|
||
${" ".repeat(e-2)}] ${s}`}let i=n?" (nullable)":"",a=r.description?` // ${r.description}`:"";return`${o}${a}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(`
|
||
${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=wt.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,wt.string().describe(n)])));return new this(e)}},bNt=class extends o1{constructor({inputSchema:e}){super(...arguments);x(this,"structuredInputParser");this.structuredInputParser=new R3e(e)}async parse(e){let r;try{r=await this.structuredInputParser.parse(e)}catch(n){throw new Ih(`Failed to parse. Text: "${e}". Error: ${n}`,e)}return this.outputProcessor(r)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}}});var ewn,I3e=v(()=>{Jo();pee();mee();_4e();ewn={};$t(ewn,{applyPatch:()=>GL,compare:()=>sJ})});var j_,A3e=v(()=>{NQ();mee();dF();I3e();j_=class extends cF{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers"]);x(this,"lc_serializable",!0)}static lc_name(){return"JsonOutputParser"}_concatOutputChunks(e,r){return this.diff?super._concatOutputChunks(e,r):r}_diff(e,r){if(r)return e?sJ(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return AQ(e[0].text)}async parse(e){return AQ(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}}});var twn,vNt,wNt=v(()=>{twn=function(){let t={};t.parser=function(j,A){return new r(j,A)},t.SAXParser=r,t.SAXStream=l,t.createStream=u,t.MAX_BUFFER_LENGTH=65536;let e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(j,A){if(!(this instanceof r))return new r(j,A);var U=this;o(U),U.q=U.c="",U.bufferCheckPosition=t.MAX_BUFFER_LENGTH,U.opt=A||{},U.opt.lowercase=U.opt.lowercase||U.opt.lowercasetags,U.looseCase=U.opt.lowercase?"toLowerCase":"toUpperCase",U.tags=[],U.closed=U.closedRoot=U.sawRoot=!1,U.tag=U.error=null,U.strict=!!j,U.noscript=!!(j||U.opt.noscript),U.state=P.BEGIN,U.strictEntities=U.opt.strictEntities,U.ENTITIES=U.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),U.attribList=[],U.opt.xmlns&&(U.ns=Object.create(m)),U.trackPosition=U.opt.position!==!1,U.trackPosition&&(U.position=U.line=U.column=0),I(U,"onready")}Object.create||(Object.create=function(j){function A(){}A.prototype=j;var U=new A;return U}),Object.keys||(Object.keys=function(j){var A=[];for(var U in j)j.hasOwnProperty(U)&&A.push(U);return A});function n(j){for(var A=Math.max(t.MAX_BUFFER_LENGTH,10),U=0,H=0,re=e.length;H<re;H++){var Z=j[e[H]].length;if(Z>A)switch(e[H]){case"textNode":z(j);break;case"cdata":N(j,"oncdata",j.cdata),j.cdata="";break;case"script":N(j,"onscript",j.script),j.script="";break;default:k(j,"Max buffer length exceeded: "+e[H])}U=Math.max(U,Z)}var le=t.MAX_BUFFER_LENGTH-U;j.bufferCheckPosition=le+j.position}function o(j){for(var A=0,U=e.length;A<U;A++)j[e[A]]=""}function i(j){z(j),j.cdata!==""&&(N(j,"oncdata",j.cdata),j.cdata=""),j.script!==""&&(N(j,"onscript",j.script),j.script="")}r.prototype={end:function(){X(this)},write:ie,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){i(this)}};var a=ReadableStream;a||(a=function(){});var s=t.EVENTS.filter(function(j){return j!=="error"&&j!=="end"});function u(j,A){return new l(j,A)}function l(j,A){if(!(this instanceof l))return new l(j,A);a.apply(this),this._parser=new r(j,A),this.writable=!0,this.readable=!0;var U=this;this._parser.onend=function(){U.emit("end")},this._parser.onerror=function(H){U.emit("error",H),U._parser.error=null},this._decoder=null,s.forEach(function(H){Object.defineProperty(U,"on"+H,{get:function(){return U._parser["on"+H]},set:function(re){if(!re)return U.removeAllListeners(H),U._parser["on"+H]=re,re;U.on(H,re)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(a.prototype,{constructor:{value:l}}),l.prototype.write=function(j){return this._parser.write(j.toString()),this.emit("data",j),!0},l.prototype.end=function(j){return j&&j.length&&this.write(j),this._parser.end(),!0},l.prototype.on=function(j,A){var U=this;return!U._parser["on"+j]&&s.indexOf(j)!==-1&&(U._parser["on"+j]=function(){var H=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);H.splice(0,0,j),U.emit.apply(U,H)}),a.prototype.on.call(U,j,A)};var c="[CDATA[",d="DOCTYPE",f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",m={xml:f,xmlns:p},h=/[:_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]/,y=/[:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_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]/,b=/[#:_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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function _(j){return j===" "||j===`
|
||
`||j==="\r"||j===" "}function w(j){return j==='"'||j==="'"}function T(j){return j===">"||_(j)}function O(j,A){return j.test(A)}function E(j,A){return!O(j,A)}var P=0;t.STATE={BEGIN:P++,BEGIN_WHITESPACE:P++,TEXT:P++,TEXT_ENTITY:P++,OPEN_WAKA:P++,SGML_DECL:P++,SGML_DECL_QUOTED:P++,DOCTYPE:P++,DOCTYPE_QUOTED:P++,DOCTYPE_DTD:P++,DOCTYPE_DTD_QUOTED:P++,COMMENT_STARTING:P++,COMMENT:P++,COMMENT_ENDING:P++,COMMENT_ENDED:P++,CDATA:P++,CDATA_ENDING:P++,CDATA_ENDING_2:P++,PROC_INST:P++,PROC_INST_BODY:P++,PROC_INST_ENDING:P++,OPEN_TAG:P++,OPEN_TAG_SLASH:P++,ATTRIB:P++,ATTRIB_NAME:P++,ATTRIB_NAME_SAW_WHITE:P++,ATTRIB_VALUE:P++,ATTRIB_VALUE_QUOTED:P++,ATTRIB_VALUE_CLOSED:P++,ATTRIB_VALUE_UNQUOTED:P++,ATTRIB_VALUE_ENTITY_Q:P++,ATTRIB_VALUE_ENTITY_U:P++,CLOSE_TAG:P++,CLOSE_TAG_SAW_WHITE:P++,SCRIPT:P++,SCRIPT_ENDING:P++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(j){var A=t.ENTITIES[j],U=typeof A=="number"?String.fromCharCode(A):A;t.ENTITIES[j]=U});for(var R in t.STATE)t.STATE[t.STATE[R]]=R;P=t.STATE;function I(j,A,U){j[A]&&j[A](U)}function N(j,A,U){j.textNode&&z(j),I(j,A,U)}function z(j){j.textNode=V(j.opt,j.textNode),j.textNode&&I(j,"ontext",j.textNode),j.textNode=""}function V(j,A){return j.trim&&(A=A.trim()),j.normalize&&(A=A.replace(/\s+/g," ")),A}function k(j,A){return z(j),j.trackPosition&&(A+=`
|
||
Line: `+j.line+`
|
||
Column: `+j.column+`
|
||
Char: `+j.c),A=new Error(A),j.error=A,I(j,"onerror",A),j}function X(j){return j.sawRoot&&!j.closedRoot&&B(j,"Unclosed root tag"),j.state!==P.BEGIN&&j.state!==P.BEGIN_WHITESPACE&&j.state!==P.TEXT&&k(j,"Unexpected end"),z(j),j.c="",j.closed=!0,I(j,"onend"),r.call(j,j.strict,j.opt),j}function B(j,A){if(typeof j!="object"||!(j instanceof r))throw new Error("bad call to strictFail");j.strict&&k(j,A)}function Q(j){j.strict||(j.tagName=j.tagName[j.looseCase]());var A=j.tags[j.tags.length-1]||j,U=j.tag={name:j.tagName,attributes:{}};j.opt.xmlns&&(U.ns=A.ns),j.attribList.length=0,N(j,"onopentagstart",U)}function Y(j,A){var U=j.indexOf(":"),H=U<0?["",j]:j.split(":"),re=H[0],Z=H[1];return A&&j==="xmlns"&&(re="xmlns",Z=""),{prefix:re,local:Z}}function K(j){if(j.strict||(j.attribName=j.attribName[j.looseCase]()),j.attribList.indexOf(j.attribName)!==-1||j.tag.attributes.hasOwnProperty(j.attribName)){j.attribName=j.attribValue="";return}if(j.opt.xmlns){var A=Y(j.attribName,!0),U=A.prefix,H=A.local;if(U==="xmlns")if(H==="xml"&&j.attribValue!==f)B(j,"xml: prefix must be bound to "+f+`
|
||
Actual: `+j.attribValue);else if(H==="xmlns"&&j.attribValue!==p)B(j,"xmlns: prefix must be bound to "+p+`
|
||
Actual: `+j.attribValue);else{var re=j.tag,Z=j.tags[j.tags.length-1]||j;re.ns===Z.ns&&(re.ns=Object.create(Z.ns)),re.ns[H]=j.attribValue}j.attribList.push([j.attribName,j.attribValue])}else j.tag.attributes[j.attribName]=j.attribValue,N(j,"onattribute",{name:j.attribName,value:j.attribValue});j.attribName=j.attribValue=""}function oe(j,A){if(j.opt.xmlns){var U=j.tag,H=Y(j.tagName);U.prefix=H.prefix,U.local=H.local,U.uri=U.ns[H.prefix]||"",U.prefix&&!U.uri&&(B(j,"Unbound namespace prefix: "+JSON.stringify(j.tagName)),U.uri=H.prefix);var re=j.tags[j.tags.length-1]||j;U.ns&&re.ns!==U.ns&&Object.keys(U.ns).forEach(function(Gr){N(j,"onopennamespace",{prefix:Gr,uri:U.ns[Gr]})});for(var Z=0,le=j.attribList.length;Z<le;Z++){var Ce=j.attribList[Z],He=Ce[0],lt=Ce[1],qe=Y(He,!0),Nt=qe.prefix,mt=qe.local,Ot=Nt===""?"":U.ns[Nt]||"",je={name:He,value:lt,prefix:Nt,local:mt,uri:Ot};Nt&&Nt!=="xmlns"&&!Ot&&(B(j,"Unbound namespace prefix: "+JSON.stringify(Nt)),je.uri=Nt),j.tag.attributes[He]=je,N(j,"onattribute",je)}j.attribList.length=0}j.tag.isSelfClosing=!!A,j.sawRoot=!0,j.tags.push(j.tag),N(j,"onopentag",j.tag),A||(!j.noscript&&j.tagName.toLowerCase()==="script"?j.state=P.SCRIPT:j.state=P.TEXT,j.tag=null,j.tagName=""),j.attribName=j.attribValue="",j.attribList.length=0}function ue(j){if(!j.tagName){B(j,"Weird empty close tag."),j.textNode+="</>",j.state=P.TEXT;return}if(j.script){if(j.tagName!=="script"){j.script+="</"+j.tagName+">",j.tagName="",j.state=P.SCRIPT;return}N(j,"onscript",j.script),j.script=""}var A=j.tags.length,U=j.tagName;j.strict||(U=U[j.looseCase]());for(var H=U;A--;){var re=j.tags[A];if(re.name!==H)B(j,"Unexpected close tag");else break}if(A<0){B(j,"Unmatched closing tag: "+j.tagName),j.textNode+="</"+j.tagName+">",j.state=P.TEXT;return}j.tagName=U;for(var Z=j.tags.length;Z-- >A;){var le=j.tag=j.tags.pop();j.tagName=j.tag.name,N(j,"onclosetag",j.tagName);var Ce={};for(var He in le.ns)Ce[He]=le.ns[He];var lt=j.tags[j.tags.length-1]||j;j.opt.xmlns&&le.ns!==lt.ns&&Object.keys(le.ns).forEach(function(qe){var Nt=le.ns[qe];N(j,"onclosenamespace",{prefix:qe,uri:Nt})})}A===0&&(j.closedRoot=!0),j.tagName=j.attribValue=j.attribName="",j.attribList.length=0,j.state=P.TEXT}function de(j){var A=j.entity,U=A.toLowerCase(),H,re="";return j.ENTITIES[A]?j.ENTITIES[A]:j.ENTITIES[U]?j.ENTITIES[U]:(A=U,A.charAt(0)==="#"&&(A.charAt(1)==="x"?(A=A.slice(2),H=parseInt(A,16),re=H.toString(16)):(A=A.slice(1),H=parseInt(A,10),re=H.toString(10))),A=A.replace(/^0+/,""),isNaN(H)||re.toLowerCase()!==A?(B(j,"Invalid character entity"),"&"+j.entity+";"):String.fromCodePoint(H))}function L(j,A){A==="<"?(j.state=P.OPEN_WAKA,j.startTagPosition=j.position):_(A)||(B(j,"Non-whitespace before first tag."),j.textNode=A,j.state=P.TEXT)}function W(j,A){var U="";return A<j.length&&(U=j.charAt(A)),U}function ie(j){var A=this;if(this.error)throw this.error;if(A.closed)return k(A,"Cannot write after close. Assign an onready handler.");if(j===null)return X(A);typeof j=="object"&&(j=j.toString());for(var U=0,H="";H=W(j,U++),A.c=H,!!H;)switch(A.trackPosition&&(A.position++,H===`
|
||
`?(A.line++,A.column=0):A.column++),A.state){case P.BEGIN:if(A.state=P.BEGIN_WHITESPACE,H==="\uFEFF")continue;L(A,H);continue;case P.BEGIN_WHITESPACE:L(A,H);continue;case P.TEXT:if(A.sawRoot&&!A.closedRoot){for(var re=U-1;H&&H!=="<"&&H!=="&";)H=W(j,U++),H&&A.trackPosition&&(A.position++,H===`
|
||
`?(A.line++,A.column=0):A.column++);A.textNode+=j.substring(re,U-1)}H==="<"&&!(A.sawRoot&&A.closedRoot&&!A.strict)?(A.state=P.OPEN_WAKA,A.startTagPosition=A.position):(!_(H)&&(!A.sawRoot||A.closedRoot)&&B(A,"Text data outside of root node."),H==="&"?A.state=P.TEXT_ENTITY:A.textNode+=H);continue;case P.SCRIPT:H==="<"?A.state=P.SCRIPT_ENDING:A.script+=H;continue;case P.SCRIPT_ENDING:H==="/"?A.state=P.CLOSE_TAG:(A.script+="<"+H,A.state=P.SCRIPT);continue;case P.OPEN_WAKA:if(H==="!")A.state=P.SGML_DECL,A.sgmlDecl="";else if(!_(H))if(O(h,H))A.state=P.OPEN_TAG,A.tagName=H;else if(H==="/")A.state=P.CLOSE_TAG,A.tagName="";else if(H==="?")A.state=P.PROC_INST,A.procInstName=A.procInstBody="";else{if(B(A,"Unencoded <"),A.startTagPosition+1<A.position){var Z=A.position-A.startTagPosition;H=new Array(Z).join(" ")+H}A.textNode+="<"+H,A.state=P.TEXT}continue;case P.SGML_DECL:(A.sgmlDecl+H).toUpperCase()===c?(N(A,"onopencdata"),A.state=P.CDATA,A.sgmlDecl="",A.cdata=""):A.sgmlDecl+H==="--"?(A.state=P.COMMENT,A.comment="",A.sgmlDecl=""):(A.sgmlDecl+H).toUpperCase()===d?(A.state=P.DOCTYPE,(A.doctype||A.sawRoot)&&B(A,"Inappropriately located doctype declaration"),A.doctype="",A.sgmlDecl=""):H===">"?(N(A,"onsgmldeclaration",A.sgmlDecl),A.sgmlDecl="",A.state=P.TEXT):(w(H)&&(A.state=P.SGML_DECL_QUOTED),A.sgmlDecl+=H);continue;case P.SGML_DECL_QUOTED:H===A.q&&(A.state=P.SGML_DECL,A.q=""),A.sgmlDecl+=H;continue;case P.DOCTYPE:H===">"?(A.state=P.TEXT,N(A,"ondoctype",A.doctype),A.doctype=!0):(A.doctype+=H,H==="["?A.state=P.DOCTYPE_DTD:w(H)&&(A.state=P.DOCTYPE_QUOTED,A.q=H));continue;case P.DOCTYPE_QUOTED:A.doctype+=H,H===A.q&&(A.q="",A.state=P.DOCTYPE);continue;case P.DOCTYPE_DTD:A.doctype+=H,H==="]"?A.state=P.DOCTYPE:w(H)&&(A.state=P.DOCTYPE_DTD_QUOTED,A.q=H);continue;case P.DOCTYPE_DTD_QUOTED:A.doctype+=H,H===A.q&&(A.state=P.DOCTYPE_DTD,A.q="");continue;case P.COMMENT:H==="-"?A.state=P.COMMENT_ENDING:A.comment+=H;continue;case P.COMMENT_ENDING:H==="-"?(A.state=P.COMMENT_ENDED,A.comment=V(A.opt,A.comment),A.comment&&N(A,"oncomment",A.comment),A.comment=""):(A.comment+="-"+H,A.state=P.COMMENT);continue;case P.COMMENT_ENDED:H!==">"?(B(A,"Malformed comment"),A.comment+="--"+H,A.state=P.COMMENT):A.state=P.TEXT;continue;case P.CDATA:H==="]"?A.state=P.CDATA_ENDING:A.cdata+=H;continue;case P.CDATA_ENDING:H==="]"?A.state=P.CDATA_ENDING_2:(A.cdata+="]"+H,A.state=P.CDATA);continue;case P.CDATA_ENDING_2:H===">"?(A.cdata&&N(A,"oncdata",A.cdata),N(A,"onclosecdata"),A.cdata="",A.state=P.TEXT):H==="]"?A.cdata+="]":(A.cdata+="]]"+H,A.state=P.CDATA);continue;case P.PROC_INST:H==="?"?A.state=P.PROC_INST_ENDING:_(H)?A.state=P.PROC_INST_BODY:A.procInstName+=H;continue;case P.PROC_INST_BODY:if(!A.procInstBody&&_(H))continue;H==="?"?A.state=P.PROC_INST_ENDING:A.procInstBody+=H;continue;case P.PROC_INST_ENDING:H===">"?(N(A,"onprocessinginstruction",{name:A.procInstName,body:A.procInstBody}),A.procInstName=A.procInstBody="",A.state=P.TEXT):(A.procInstBody+="?"+H,A.state=P.PROC_INST_BODY);continue;case P.OPEN_TAG:O(y,H)?A.tagName+=H:(Q(A),H===">"?oe(A):H==="/"?A.state=P.OPEN_TAG_SLASH:(_(H)||B(A,"Invalid character in tag name"),A.state=P.ATTRIB));continue;case P.OPEN_TAG_SLASH:H===">"?(oe(A,!0),ue(A)):(B(A,"Forward-slash in opening tag not followed by >"),A.state=P.ATTRIB);continue;case P.ATTRIB:if(_(H))continue;H===">"?oe(A):H==="/"?A.state=P.OPEN_TAG_SLASH:O(h,H)?(A.attribName=H,A.attribValue="",A.state=P.ATTRIB_NAME):B(A,"Invalid attribute name");continue;case P.ATTRIB_NAME:H==="="?A.state=P.ATTRIB_VALUE:H===">"?(B(A,"Attribute without value"),A.attribValue=A.attribName,K(A),oe(A)):_(H)?A.state=P.ATTRIB_NAME_SAW_WHITE:O(y,H)?A.attribName+=H:B(A,"Invalid attribute name");continue;case P.ATTRIB_NAME_SAW_WHITE:if(H==="=")A.state=P.ATTRIB_VALUE;else{if(_(H))continue;B(A,"Attribute without value"),A.tag.attributes[A.attribName]="",A.attribValue="",N(A,"onattribute",{name:A.attribName,value:""}),A.attribName="",H===">"?oe(A):O(h,H)?(A.attribName=H,A.state=P.ATTRIB_NAME):(B(A,"Invalid attribute name"),A.state=P.ATTRIB)}continue;case P.ATTRIB_VALUE:if(_(H))continue;w(H)?(A.q=H,A.state=P.ATTRIB_VALUE_QUOTED):(B(A,"Unquoted attribute value"),A.state=P.ATTRIB_VALUE_UNQUOTED,A.attribValue=H);continue;case P.ATTRIB_VALUE_QUOTED:if(H!==A.q){H==="&"?A.state=P.ATTRIB_VALUE_ENTITY_Q:A.attribValue+=H;continue}K(A),A.q="",A.state=P.ATTRIB_VALUE_CLOSED;continue;case P.ATTRIB_VALUE_CLOSED:_(H)?A.state=P.ATTRIB:H===">"?oe(A):H==="/"?A.state=P.OPEN_TAG_SLASH:O(h,H)?(B(A,"No whitespace between attributes"),A.attribName=H,A.attribValue="",A.state=P.ATTRIB_NAME):B(A,"Invalid attribute name");continue;case P.ATTRIB_VALUE_UNQUOTED:if(!T(H)){H==="&"?A.state=P.ATTRIB_VALUE_ENTITY_U:A.attribValue+=H;continue}K(A),H===">"?oe(A):A.state=P.ATTRIB;continue;case P.CLOSE_TAG:if(A.tagName)H===">"?ue(A):O(y,H)?A.tagName+=H:A.script?(A.script+="</"+A.tagName,A.tagName="",A.state=P.SCRIPT):(_(H)||B(A,"Invalid tagname in closing tag"),A.state=P.CLOSE_TAG_SAW_WHITE);else{if(_(H))continue;E(h,H)?A.script?(A.script+="</"+H,A.state=P.SCRIPT):B(A,"Invalid tagname in closing tag."):A.tagName=H}continue;case P.CLOSE_TAG_SAW_WHITE:if(_(H))continue;H===">"?ue(A):B(A,"Invalid characters in closing tag");continue;case P.TEXT_ENTITY:case P.ATTRIB_VALUE_ENTITY_Q:case P.ATTRIB_VALUE_ENTITY_U:var le,Ce;switch(A.state){case P.TEXT_ENTITY:le=P.TEXT,Ce="textNode";break;case P.ATTRIB_VALUE_ENTITY_Q:le=P.ATTRIB_VALUE_QUOTED,Ce="attribValue";break;case P.ATTRIB_VALUE_ENTITY_U:le=P.ATTRIB_VALUE_UNQUOTED,Ce="attribValue";break}if(H===";")if(A.opt.unparsedEntities){var He=de(A);A.entity="",A.state=le,A.write(He)}else A[Ce]+=de(A),A.entity="",A.state=le;else O(A.entity.length?b:g,H)?A.entity+=H:(B(A,"Invalid character in entity name"),A[Ce]+="&"+A.entity+H,A.entity="",A.state=le);continue;default:throw new Error(A,"Unknown state: "+A.state)}return A.position>=A.bufferCheckPosition&&n(A),A}return String.fromCodePoint||function(){var j=String.fromCharCode,A=Math.floor,U=function(){var H=16384,re=[],Z,le,Ce=-1,He=arguments.length;if(!He)return"";for(var lt="";++Ce<He;){var qe=Number(arguments[Ce]);if(!isFinite(qe)||qe<0||qe>1114111||A(qe)!==qe)throw RangeError("Invalid code point: "+qe);qe<=65535?re.push(qe):(qe-=65536,Z=(qe>>10)+55296,le=qe%1024+56320,re.push(Z,le)),(Ce+1===He||re.length>H)&&(lt+=j.apply(null,re),re.length=0)}return lt};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:U,configurable:!0,writable:!0}):String.fromCodePoint=U}(),t},vNt=twn()});function Xge(t){let e=rwn(t),r=vNt.parser(!0),n={},o=[];r.onopentag=s=>{let u={name:s.name,attributes:s.attributes,children:[],text:"",isSelfClosing:s.isSelfClosing};o.length>0?o[o.length-1].children.push(u):n=u,s.isSelfClosing||o.push(u)},r.onclosetag=()=>{if(o.length>0){let s=o.pop();o.length===0&&s&&(n=s)}},r.ontext=s=>{if(o.length>0){let u=o[o.length-1];u.text+=s}},r.onattribute=s=>{if(o.length>0){let u=o[o.length-1];u.attributes[s.name]=s.value}};let i=/```(xml)?(.*)```/s.exec(e),a=i?i[2]:e;return r.write(a).close(),n&&n.name==="?xml"&&(n=n.children[0]),CNt(n)}var Gge,SNt,rwn,CNt,xNt=v(()=>{mee();dF();I3e();wNt();Gge=`The output should be formatted as a XML file.
|
||
1. Output should conform to the tags below.
|
||
2. If tags are not given, make them on your own.
|
||
3. Remember to always open and close all the tags.
|
||
|
||
As an example, for the tags ["foo", "bar", "baz"]:
|
||
1. String "<foo>
|
||
<bar>
|
||
<baz></baz>
|
||
</bar>
|
||
</foo>" is a well-formatted instance of the schema.
|
||
2. String "<foo>
|
||
<bar>
|
||
</foo>" is a badly-formatted instance.
|
||
3. String "<foo>
|
||
<tag>
|
||
</tag>
|
||
</foo>" is a badly-formatted instance.
|
||
|
||
Here are the output tags:
|
||
\`\`\`
|
||
{tags}
|
||
\`\`\``,SNt=class extends cF{constructor(e){super(e);x(this,"tags");x(this,"lc_namespace",["langchain_core","output_parsers"]);x(this,"lc_serializable",!0);this.tags=e?.tags}static lc_name(){return"XMLOutputParser"}_diff(e,r){if(r)return e?sJ(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Xge(e[0].text)}async parse(e){return Xge(e)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?Gge.replace("{tags}",this.tags?.join(", ")??""):Gge}},rwn=t=>t.split(`
|
||
`).map(e=>e.replace(/^\s+/,"")).join(`
|
||
`).trim(),CNt=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(CNt),e):(e[t.name]=t.text??void 0,e)}});var nwn,fO=v(()=>{Jo();NQ();MJ();dF();dNt();gNt();yNt();_Nt();A3e();xNt();nwn={};$t(nwn,{AsymmetricStructuredOutputParser:()=>bNt,BaseCumulativeTransformOutputParser:()=>cF,BaseLLMOutputParser:()=>v4,BaseOutputParser:()=>o1,BaseTransformOutputParser:()=>i1,BytesOutputParser:()=>cNt,CommaSeparatedListOutputParser:()=>fNt,CustomListOutputParser:()=>pNt,JsonMarkdownStructuredOutputParser:()=>R3e,JsonOutputParser:()=>j_,ListOutputParser:()=>RJ,MarkdownListOutputParser:()=>hNt,NumberedListOutputParser:()=>mNt,OutputParserException:()=>Ih,StringOutputParser:()=>Kge,StructuredOutputParser:()=>uw,XMLOutputParser:()=>SNt,XML_FORMAT_INSTRUCTIONS:()=>Gge,parseJsonMarkdown:()=>AQ,parsePartialJson:()=>Mz,parseXMLMarkdown:()=>Xge})});var jS,IJ=v(()=>{Pg();jS=class extends Go{constructor(e){super(e);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","prompts",this._getPromptType()]);x(this,"inputVariables");x(this,"outputParser");x(this,"partialVariables");x(this,"metadata");x(this,"tags");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)}get lc_attributes(){return{partialVariables:void 0}}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"})}}});var own,Zge,ste,ute,N3e,lte=v(()=>{Jo();kL();zL();UC();own={};$t(own,{BasePromptValue:()=>Zge,ChatPromptValue:()=>ute,ImagePromptValue:()=>N3e,StringPromptValue:()=>ste});Zge=class extends Cg{},ste=class extends Zge{constructor(e){super({value:e});x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"value");this.value=e}static lc_name(){return"StringPromptValue"}toString(){return this.value}toChatMessages(){return[new qs(this.value)]}},ute=class extends Zge{constructor(e){Array.isArray(e)&&(e={messages:e});super(e);x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"messages");this.messages=e.messages}static lc_name(){return"ChatPromptValue"}toString(){return fl(this.messages)}toChatMessages(){return this.messages}},N3e=class extends Zge{constructor(e){"imageUrl"in e||(e={imageUrl:e});super(e);x(this,"lc_namespace",["langchain_core","prompt_values"]);x(this,"lc_serializable",!0);x(this,"imageUrl");x(this,"value");this.imageUrl=e.imageUrl}static lc_name(){return"ImagePromptValue"}toString(){return this.imageUrl.url}toChatMessages(){return[new qs({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var a1,cte=v(()=>{lte();IJ();a1=class extends jS{async formatPromptValue(t){let e=await this.format(t);return new ste(e)}}});function j3e(t){return typeof t=="function"}function awn(t){return NJ(t)?"array":typeof t}function D3e(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function TNt(t,e){return t!=null&&typeof t=="object"&&e in t}function swn(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function lwn(t,e){return uwn.call(t,e)}function dwn(t){return!lwn(cwn,t)}function pwn(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return fwn[r]})}function bwn(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(P){if(typeof P=="string"&&(P=P.split(hwn,2)),!NJ(P)||P.length!==2)throw new Error("Invalid tags: "+P);d=new RegExp(D3e(P[0])+"\\s*"),f=new RegExp("\\s*"+D3e(P[1])),p=new RegExp("\\s*"+D3e("}"+P[1]))}m(e||$S.tags);for(var h=new fte(t),y,g,b,_,w,T;!h.eos();){if(y=h.pos,b=h.scanUntil(d),b)for(var O=0,E=b.length;O<E;++O)_=b.charAt(O),dwn(_)?(i.push(o.length),u+=_):(s=!0,r=!0,u+=" "),o.push(["text",_,y,y+1]),y+=1,_===`
|
||
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,g=h.scan(ywn)||"name",h.scan(mwn),g==="="?(b=h.scanUntil(ONt),h.scan(ONt),h.scanUntil(f)):g==="{"?(b=h.scanUntil(p),h.scan(gwn),h.scanUntil(f),g="&"):b=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(g==">"?w=[g,b,y,h.pos,u,l,r]:w=[g,b,y,h.pos],l++,o.push(w),g==="#"||g==="^")n.push(w);else if(g==="/"){if(T=n.pop(),!T)throw new Error('Unopened section "'+b+'" at '+y);if(T[1]!==b)throw new Error('Unclosed section "'+T[1]+'" at '+y)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(b)}if(c(),T=n.pop(),T)throw new Error('Unclosed section "'+T[1]+'" at '+h.pos);return vwn(_wn(o))}function _wn(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 vwn(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 fte(t){this.string=t,this.tail=t,this.pos=0}function AJ(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function qb(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var iwn,NJ,uwn,cwn,fwn,mwn,hwn,ONt,gwn,ywn,$S,dte,Yge,ENt=v(()=>{iwn=Object.prototype.toString,NJ=Array.isArray||function(e){return iwn.call(e)==="[object Array]"};uwn=RegExp.prototype.test;cwn=/\S/;fwn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};mwn=/\s*/,hwn=/\s+/,ONt=/\s*=/,gwn=/\s*\}/,ywn=/#|\^|\/|>|\{|&|=|!/;fte.prototype.eos=function(){return this.tail===""};fte.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};fte.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};AJ.prototype.push=function(e){return new AJ(e,this)};AJ.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=TNt(i,a[s])||swn(i,a[s])),i=i[a[s++]];else i=o.view[e],u=TNt(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return j3e(n)&&(n=n.call(this.view)),n};qb.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};qb.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||$S.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=bwn(e,r),i&&n.set(o,a)),a};qb.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof AJ?r:new AJ(r,void 0);return this.renderTokens(a,s,n,e,o)};qb.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};qb.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(NJ(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(j3e(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}};qb.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||NJ(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};qb.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(`
|
||
`)};qb.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=j3e(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)}}};qb.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};qb.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||$S.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===$S.escape?String(i):o(i)};qb.prototype.rawValue=function(e){return e[1]};qb.prototype.getConfigTags=function(e){return NJ(e)?e:e&&typeof e=="object"?e.tags:void 0};qb.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!NJ(e))return e.escape};$S={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){dte.templateCache=t},get templateCache(){return dte.templateCache}},dte=new qb;$S.clearCache=function(){return dte.clearCache()};$S.parse=function(e,r){return dte.parse(e,r)};$S.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+awn(e)+'" was given as the first argument for mustache#render(template, view, partials)');return dte.render(e,r,n,o)};$S.escape=pwn;$S.Scanner=fte;$S.Context=AJ;$S.Writer=qb;Yge=$S});function PNt(){Yge.escape=t=>t}var w4,MNt,DJ,$3e,L3e,pte,F3e,Dy,S4,s1,C4=v(()=>{DQ();ENt();w4=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},MNt=(t,e=[])=>{let r=[];for(let n of t)if(n[0]==="name"){let o=n[1].includes(".")?n[1].split(".")[0]:n[1];r.push({type:"variable",name:o})}else if(["#","&","^",">"].includes(n[0])){if(r.push({type:"variable",name:n[1]}),n[0]==="#"&&n.length>4&&Array.isArray(n[4])){let o=[...e,n[1]],i=MNt(n[4],o);r.push(...i)}}else r.push({type:"literal",text:n[1]});return r},DJ=t=>{PNt();let e=Yge.parse(t);return MNt(e)},$3e=(t,e)=>w4(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},""),L3e=(t,e)=>(PNt(),Yge.render(t,e)),pte={"f-string":$3e,mustache:L3e},F3e={"f-string":w4,mustache:DJ},Dy=(t,e,r)=>{try{return pte[e](t,r)}catch(n){throw FL(n,"INVALID_PROMPT_INPUT")}},S4=(t,e)=>F3e[e](t),s1=(t,e,r)=>{if(!(e in pte)){let n=Object.keys(pte);throw new Error(`Invalid template format. Got \`${e}\`;
|
||
should be one of ${n}`)}try{let n=Object.fromEntries(r.map(o=>[o,"foo"]));Array.isArray(t)?t.forEach(o=>{if(o.type==="text"&&"text"in o&&typeof o.text=="string")Dy(o.text,e,n);else if(o.type==="image_url"){if(typeof o.image_url=="string")Dy(o.image_url,e,n);else if(typeof o.image_url=="object"&&o.image_url!==null&&"url"in o.image_url&&typeof o.image_url.url=="string"){let i=o.image_url.url;Dy(i,e,n)}}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Dy(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var mu,Qge=v(()=>{cte();C4();mu=class mte extends a1{constructor(r){super(r);x(this,"template");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);x(this,"additionalContentFields");if(r.templateFormat==="mustache"&&r.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,r),this.validateTemplate){if(this.templateFormat==="mustache")throw new Error("Mustache templates cannot be validated.");let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),s1(this.template,this.templateFormat,n)}}static lc_name(){return"PromptTemplate"}_getPromptType(){return"prompt"}async format(r){let n=await this.mergePartialAndUserVariables(r);return Dy(this.template,this.templateFormat,n)}static fromExamples(r,n,o,i=`
|
||
|
||
`,a=""){let s=[a,...r,n].join(i);return new mte({inputVariables:o,template:s})}static fromTemplate(r,n){let{templateFormat:o="f-string",...i}=n??{},a=new Set;return S4(r,o).forEach(s=>{s.type==="variable"&&a.add(s.name)}),new mte({inputVariables:[...a],templateFormat:o,template:r,...i})}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new mte(i)}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(r){if(!r.template)throw new Error("Prompt template must have a template");return new mte({inputVariables:r.input_variables,template:r.template,templateFormat:r.template_format})}}});var jJ,k3e=v(()=>{lte();IJ();C4();jJ=class RNt extends jS{constructor(r){super(r);x(this,"lc_namespace",["langchain_core","prompts","image"]);x(this,"template");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);x(this,"additionalContentFields");if(this.template=r.template,this.templateFormat=r.templateFormat??this.templateFormat,this.validateTemplate=r.validateTemplate??this.validateTemplate,this.additionalContentFields=r.additionalContentFields,this.validateTemplate){let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),s1([{type:"image_url",image_url:this.template}],this.templateFormat,n)}}static lc_name(){return"ImagePromptTemplate"}_getPromptType(){return"prompt"}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new RNt(i)}async format(r){let n={};for(let[s,u]of Object.entries(this.template))typeof u=="string"?n[s]=Dy(u,this.templateFormat,r):n[s]=u;let o=r.url||n.url,i=r.detail||n.detail;if(!o)throw new Error("Must provide either an image URL.");if(typeof o!="string")throw new Error("url must be a string.");let a={url:o};return i&&(a.detail=i),a}async formatPromptValue(r){let n=await this.format(r);return new N3e(n)}}});function q3e(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")S4(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?S4(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...q3e(o,e));else typeof n=="object"&&n!==null&&r.push(...q3e(n,e));return Array.from(new Set(r))}function U3e(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Dy(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Dy(s,r,e)):typeof s=="object"&&a.push(U3e(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=U3e(i,e,r):n[o]=i;return n}var hte,B3e=v(()=>{Pg();C4();hte=class extends Go{constructor(e){let r=e.templateFormat??"f-string",n=q3e(e.template,r);super({inputVariables:n,...e});x(this,"lc_namespace",["langchain_core","prompts","dict"]);x(this,"lc_serializable",!0);x(this,"template");x(this,"templateFormat");x(this,"inputVariables");this.template=e.template,this.templateFormat=r,this.inputVariables=n}static lc_name(){return"DictPromptTemplate"}async format(e){return U3e(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function wwn(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function Swn(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 Cwn(t){return typeof t.formatMessages=="function"}function xwn(t,e){if(Cwn(t)||xg(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 pO({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new pO({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=wS(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 $_.fromTemplate(n,e);if(r._getType()==="ai")return tye.fromTemplate(n,e);if(r._getType()==="system")return LS.fromTemplate(n,e);if(Td.isInstance(r))return V3e.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function Twn(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var gte,pO,z3e,yte,V3e,H3e,$_,tye,LS,Ah,bte=v(()=>{Oy();DQ();UQ();zL();BQ();UC();vS();Pg();ta();lte();IJ();cte();C4();Qge();k3e();B3e();gte=class extends Go{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","prompts","chat"]);x(this,"lc_serializable",!0)}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},pO=class extends gte{constructor(e){typeof e=="string"&&(e={variableName:e});super(e);x(this,"variableName");x(this,"optional");this.variableName=e.variableName,this.optional=e.optional??!1}static lc_name(){return"MessagesPlaceholder"}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(wS):n=[wS(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}},z3e=class extends gte{constructor(e){"prompt"in e||(e={prompt:e});super(e);x(this,"prompt");this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},yte=class extends jS{constructor(t){super(t)}async format(t){return(await this.formatPromptValue(t)).toString()}async formatPromptValue(t){let e=await this.formatMessages(t);return new ute(e)}},V3e=class extends z3e{constructor(e,r){"prompt"in e||(e={prompt:e,role:r});super(e);x(this,"role");this.role=e.role}static lc_name(){return"ChatMessagePromptTemplate"}async format(e){return new Td(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(mu.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};H3e=class extends gte{constructor(e,r){"prompt"in e||(e={prompt:e});super(e);x(this,"lc_namespace",["langchain_core","prompts","chat"]);x(this,"lc_serializable",!0);x(this,"inputVariables",[]);x(this,"additionalOptions",{});x(this,"prompt");x(this,"messageClass");x(this,"chatMessageClass");if(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}static _messageClass(){throw new Error("Can not invoke _messageClass from inside _StringImageMessagePromptTemplate")}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(mu.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(mu.fromTemplate(o,r));else if(o!==null)if(wwn(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(mu.fromTemplate(i,a))}else if(Swn(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=DJ(i):u=w4(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 jJ({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=DJ(i.url):u=w4(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new jJ({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 hte({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof a1){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 a1){let i=await n.format(o),a;"additionalContentFields"in n&&(a=n.additionalContentFields),i!==""&&r.push({...a,type:"text",text:i})}else if(n instanceof jJ){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 hte){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)]}},$_=class extends H3e{static _messageClass(){return qs}static lc_name(){return"HumanMessagePromptTemplate"}},tye=class extends H3e{static _messageClass(){return Pn}static lc_name(){return"AIMessagePromptTemplate"}},LS=class extends H3e{static _messageClass(){return Od}static lc_name(){return"SystemMessagePromptTemplate"}};Ah=class eye extends yte{constructor(r){super(r);x(this,"promptMessages");x(this,"validateTemplate",!0);x(this,"templateFormat","f-string");if(r.templateFormat==="mustache"&&r.validateTemplate===void 0&&(this.validateTemplate=!1),Object.assign(this,r),this.validateTemplate){let n=new Set;for(let u of this.promptMessages)if(!(u instanceof id))for(let l of u.inputVariables)n.add(l);let o=this.inputVariables,i=new Set(this.partialVariables?o.concat(Object.keys(this.partialVariables)):o),a=new Set([...i].filter(u=>!n.has(u)));if(a.size>0)throw new Error(`Input variables \`${[...a]}\` are not used in any of the prompt messages.`);let s=new Set([...n].filter(u=>!i.has(u)));if(s.size>0)throw new Error(`Input variables \`${[...s]}\` are used in prompt messages but not in the prompt template.`)}}static lc_name(){return"ChatPromptTemplate"}get lc_aliases(){return{promptMessages:"messages"}}_getPromptType(){return"chat"}async _parseImagePrompts(r,n){if(typeof r.content=="string")return r;let o=await Promise.all(r.content.map(async i=>{if(i.type!=="image_url")return i;let a="";typeof i.image_url=="string"?a=i.image_url:typeof i.image_url=="object"&&i.image_url!==null&&"url"in i.image_url&&typeof i.image_url.url=="string"&&(a=i.image_url.url);let u=await mu.fromTemplate(a,{templateFormat:this.templateFormat}).format(n);return typeof i.image_url=="object"&&i.image_url!==null&&"url"in i.image_url?i.image_url.url=u:i.image_url=u,i}));return r.content=o,r}async formatMessages(r){let n=await this.mergePartialAndUserVariables(r),o=[];for(let i of this.promptMessages)if(i instanceof id)o.push(await this._parseImagePrompts(i,n));else{let a;this.templateFormat==="mustache"?a={...n}:a=i.inputVariables.reduce((u,l)=>{if(!(l in n)&&!(Twn(i)&&i.optional))throw FL(new Error(`Missing value for input variable \`${l.toString()}\``),"INVALID_PROMPT_INPUT");return u[l]=n[l],u},{});let s=await i.formatMessages(a);o=o.concat(s)}return o}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new eye(i)}static fromTemplate(r,n){let o=mu.fromTemplate(r,n),i=new $_({prompt:o});return this.fromMessages([i])}static fromMessages(r,n){let o=r.reduce((s,u)=>s.concat(u instanceof eye?u.promptMessages:[xwn(u,n)]),[]),i=r.reduce((s,u)=>u instanceof eye?Object.assign(s,u.partialVariables):s,Object.create(null)),a=new Set;for(let s of o)if(!(s instanceof id))for(let u of s.inputVariables)u in i||a.add(u);return new this({...n,inputVariables:[...a],promptMessages:o,partialVariables:i,templateFormat:n?.templateFormat})}}});var INt,ANt,DNt=v(()=>{cte();C4();Qge();bte();INt=class W3e extends a1{constructor(r){super(r);x(this,"lc_serializable",!1);x(this,"examples");x(this,"exampleSelector");x(this,"examplePrompt");x(this,"suffix","");x(this,"exampleSeparator",`
|
||
|
||
`);x(this,"prefix","");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);if(Object.assign(this,r),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 n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),s1(this.prefix+this.suffix,this.templateFormat,n)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(r){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(r);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new W3e(i)}async format(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n),i=await Promise.all(o.map(s=>this.examplePrompt.format(s))),a=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return Dy(a,this.templateFormat,n)}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(r){let{example_prompt:n}=r;if(!n)throw new Error("Missing example prompt");let o=await mu.deserialize(n),i;if(Array.isArray(r.examples))i=r.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new W3e({inputVariables:r.input_variables,examplePrompt:o,examples:i,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}},ANt=class NNt extends yte{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"examples");x(this,"exampleSelector");x(this,"examplePrompt");x(this,"suffix","");x(this,"exampleSeparator",`
|
||
|
||
`);x(this,"prefix","");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);if(this.examples=r.examples,this.examplePrompt=r.examplePrompt,this.exampleSeparator=r.exampleSeparator??`
|
||
|
||
`,this.exampleSelector=r.exampleSelector,this.prefix=r.prefix??"",this.suffix=r.suffix??"",this.templateFormat=r.templateFormat??"f-string",this.validateTemplate=r.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 n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),s1(this.prefix+this.suffix,this.templateFormat,n)}}_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}async getExamples(r){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(r);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n);o=o.map(a=>{let s={};return this.examplePrompt.inputVariables.forEach(u=>{s[u]=a[u]}),s});let i=[];for(let a of o){let s=await this.examplePrompt.formatMessages(a);i.push(...s)}return i}async format(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n),a=(await Promise.all(o.map(u=>this.examplePrompt.formatMessages(u)))).flat().map(u=>u.content),s=[this.prefix,...a,this.suffix].join(this.exampleSeparator);return Dy(s,this.templateFormat,n)}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new NNt(i)}}});var jNt,$Nt=v(()=>{IJ();bte();jNt=class rye extends jS{constructor(r){super({...r,inputVariables:[]});x(this,"pipelinePrompts");x(this,"finalPrompt");this.pipelinePrompts=r.pipelinePrompts,this.finalPrompt=r.finalPrompt,this.inputVariables=this.computeInputValues()}static lc_name(){return"PipelinePromptTemplate"}computeInputValues(){let r=this.pipelinePrompts.map(o=>o.name),n=this.pipelinePrompts.map(o=>o.prompt.inputVariables.filter(i=>!r.includes(i))).flat();return[...new Set(n)]}static extractRequiredInputValues(r,n){return n.reduce((o,i)=>(o[i]=r[i],o),{})}async formatPipelinePrompts(r){let n=await this.mergePartialAndUserVariables(r);for(let{name:o,prompt:i}of this.pipelinePrompts){let a=rye.extractRequiredInputValues(n,i.inputVariables);i instanceof Ah?n[o]=await i.formatMessages(a):n[o]=await i.format(a)}return rye.extractRequiredInputValues(n,this.finalPrompt.inputVariables)}async formatPromptValue(r){return this.finalPrompt.formatPromptValue(await this.formatPipelinePrompts(r))}async format(r){return this.finalPrompt.format(await this.formatPipelinePrompts(r))}async partial(r){let n={...this};return n.inputVariables=this.inputVariables.filter(o=>!(o in r)),n.partialVariables={...this.partialVariables??{},...r},new rye(n)}serialize(){throw new Error("Not implemented.")}_getPromptType(){return"pipeline"}}});function LNt(t){return typeof t=="object"&&t!=null&&"withStructuredOutput"in t&&typeof t.withStructuredOutput=="function"}function Own(t){return typeof t=="object"&&t!=null&&"lc_id"in t&&Array.isArray(t.lc_id)&&t.lc_id.join("/")==="langchain_core/runnables/RunnableBinding"}var FNt,qNt=v(()=>{Pg();bte();FNt=class kNt extends Ah{constructor(r){super(r);x(this,"schema");x(this,"method");x(this,"lc_namespace",["langchain_core","prompts","structured"]);this.schema=r.schema,this.method=r.method}get lc_aliases(){return{...super.lc_aliases,schema:"schema_"}}pipe(r){if(LNt(r))return super.pipe(r.withStructuredOutput(this.schema));if(Own(r)&&LNt(r.bound))return super.pipe(new DS({bound:r.bound.withStructuredOutput(this.schema,...this.method?[{method:this.method}]:[]),kwargs:r.kwargs??{},config:r.config,configFactories:r.configFactories}));throw new Error('Structured prompts need to be piped to a language model that supports the "withStructuredOutput()" method.')}static fromMessagesAndSchema(r,n,o){return kNt.fromMessages(r,{schema:n,method:o})}}});var Ewn,FS=v(()=>{Jo();IJ();cte();C4();Qge();k3e();B3e();bte();DNt();$Nt();qNt();Ewn={};$t(Ewn,{AIMessagePromptTemplate:()=>tye,BaseChatPromptTemplate:()=>yte,BaseMessagePromptTemplate:()=>gte,BaseMessageStringPromptTemplate:()=>z3e,BasePromptTemplate:()=>jS,BaseStringPromptTemplate:()=>a1,ChatMessagePromptTemplate:()=>V3e,ChatPromptTemplate:()=>Ah,DEFAULT_FORMATTER_MAPPING:()=>pte,DEFAULT_PARSER_MAPPING:()=>F3e,DictPromptTemplate:()=>hte,FewShotChatMessagePromptTemplate:()=>ANt,FewShotPromptTemplate:()=>INt,HumanMessagePromptTemplate:()=>$_,ImagePromptTemplate:()=>jJ,MessagesPlaceholder:()=>pO,PipelinePromptTemplate:()=>jNt,PromptTemplate:()=>mu,StructuredPrompt:()=>FNt,SystemMessagePromptTemplate:()=>LS,checkValidTemplate:()=>s1,interpolateFString:()=>$3e,interpolateMustache:()=>L3e,parseFString:()=>w4,parseMustache:()=>DJ,parseTemplate:()=>S4,renderTemplate:()=>Dy})});var Pwn,$J,nye=v(()=>{Pwn=Object.defineProperty,$J=(t,e)=>{for(var r in e)Pwn(t,r,{get:e[r],enumerable:!0})}});var Mwn,_te,J3e=v(()=>{nye();Mwn={};$J(Mwn,{formatDocumentsAsString:()=>_te});_te=t=>t.map(e=>e.pageContent).join(`
|
||
|
||
`)});function bc(t,e){let r=`atom${++Rwn}`,n={toString(){return(zl.env?zl.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=Iwn,n.write=Awn),e&&(n.write=e),n}function Iwn(t){return t(this)}function Awn(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var zl,Rwn,UNt,K3e,G3e,iye,Z3e,Nwn,Dwn,Y3e,BNt,oye,HNt,zNt,LJ,X3e,jwn,$wn,VNt,fF,WNt,pF,vte,JNt,Q3e=v(()=>{zl={},Rwn=0;UNt=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,K3e=t=>"init"in t,G3e=t=>!!t.write,iye=new WeakMap,Z3e=t=>{var e;return Y3e(t)&&!((e=iye.get(t))!=null&&e[1])},Nwn=(t,e)=>{let r=iye.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((zl.env?zl.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Dwn=t=>{if(iye.has(t))return;let e=[new Set,!1];iye.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},Y3e=t=>typeof t?.then=="function",BNt=t=>"v"in t||"e"in t,oye=t=>{if("e"in t)throw t.e;if((zl.env?zl.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},HNt=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},zNt=(t,e,r,n,o)=>{var i;if((zl.env?zl.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),Z3e(r.v)&&HNt(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&jwn(t,n,e)},LJ=()=>[new Map,new Map,new Set],X3e=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},jwn=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},$wn=(t,e)=>t[0].get(e),VNt=(t,e)=>{t[2].add(e)},fF=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},WNt=(...[t,e,r,n])=>{let o;(zl.env?zl.env.MODE:void 0)!=="production"&&(o=new Set);let i=(_,w,T)=>{let O="v"in w,E=w.v,P=Z3e(w.v)?w.v:null;if(Y3e(T)){Dwn(T);for(let R of w.d.keys())HNt(_,T,t(R));w.v=T,delete w.e}else w.v=T,delete w.e;(!O||!Object.is(E,w.v))&&(++w.n,P&&Nwn(P,T))},a=(_,w,T)=>{var O;let E=t(w);if(BNt(E)&&(E.m&&!T?.has(w)||Array.from(E.d).every(([V,k])=>a(_,V,T).n===k)))return E;E.d.clear();let P=!0,R=V=>{if(UNt(w,V)){let X=t(V);if(!BNt(X))if(K3e(V))i(V,X,V.init);else throw new Error("no atom init");return oye(X)}let k=a(_,V,T);try{return oye(k)}finally{if(P)zNt(_,w,E,V,k);else{let X=LJ();zNt(X,w,E,V,k),p(X,w,E),fF(X)}}},I,N,z={get signal(){return I||(I=new AbortController),I.signal},get setSelf(){return(zl.env?zl.env.MODE:void 0)!=="production"&&!G3e(w)&&console.warn("setSelf function cannot be used with read-only atom"),!N&&G3e(w)&&(N=(...V)=>{if((zl.env?zl.env.MODE:void 0)!=="production"&&P&&console.warn("setSelf function cannot be called in sync"),!P)return f(w,...V)}),N}};try{let V=e(w,R,z);if(i(w,E,V),Y3e(V)){(O=V.onCancel)==null||O.call(V,()=>I?.abort());let k=()=>{if(E.m){let X=LJ();p(X,w,E),fF(X)}};V.then(k,k)}return E}catch(V){return delete E.v,E.e=V,++E.n,E}finally{P=!1}},s=_=>oye(a(void 0,_)),u=(_,w,T)=>{var O,E;let P=new Map;for(let R of((O=T.m)==null?void 0:O.t)||[])P.set(R,t(R));for(let R of T.p)P.set(R,t(R));return(E=$wn(_,w))==null||E.forEach(R=>{P.set(R,t(R))}),P};function l(_,w,T){let O=[],E=new Set,P=new Set,R=[[w,T]];for(;R.length>0;){let[I,N]=R[R.length-1];if(P.has(I)){R.pop();continue}if(E.has(I)){O.push([I,N,N.n]),P.add(I),R.pop();continue}E.add(I);for(let[z,V]of u(_,I,N))I!==z&&!E.has(z)&&R.push([z,V])}return[O,P]}let c=(_,w,T)=>{let[O,E]=l(_,w,T),P=new Set([w]);for(let R=O.length-1;R>=0;--R){let[I,N,z]=O[R],V=!1;for(let k of N.d.keys())if(k!==I&&P.has(k)){V=!0;break}V&&(a(_,I,E),p(_,I,N),z!==N.n&&(X3e(_,I,N),P.add(I))),E.delete(I)}},d=(_,w,...T)=>{let O=!0,E=R=>oye(a(_,R)),P=(R,...I)=>{let N=t(R);try{if(UNt(w,R)){if(!K3e(R))throw new Error("atom not writable");let z=N.n,V=I[0];i(R,N,V),p(_,R,N),z!==N.n&&(X3e(_,R,N),c(_,R,N));return}else return d(_,R,...I)}finally{O||fF(_)}};try{return r(w,E,P,...T)}finally{O=!1}},f=(_,...w)=>{let T=LJ();try{return d(T,_,...w)}finally{fF(T)}},p=(_,w,T)=>{if(T.m&&!Z3e(T.v)){for(let O of T.d.keys())T.m.d.has(O)||(m(_,O,t(O)).t.add(w),T.m.d.add(O));for(let O of T.m.d||[])if(!T.d.has(O)){T.m.d.delete(O);let E=h(_,O,t(O));E?.t.delete(w)}}},m=(_,w,T)=>{if(!T.m){a(_,w);for(let O of T.d.keys())m(_,O,t(O)).t.add(w);if(T.m={l:new Set,d:new Set(T.d.keys()),t:new Set},(zl.env?zl.env.MODE:void 0)!=="production"&&o.add(w),G3e(w)){let O=T.m,E,P=(R,I)=>{let N=!0;E=(...z)=>{try{return d(R,w,...z)}finally{N||fF(R)}};try{return I()}finally{N=!1}};VNt(_,()=>{let R=P(_,()=>n(w,(...I)=>E(...I)));R&&(O.u=I=>P(I,R))})}}return T.m},h=(_,w,T)=>{if(T.m&&!T.m.l.size&&!Array.from(T.m.t).some(O=>{var E;return(E=t(O).m)==null?void 0:E.d.has(w)})){let O=T.m.u;O&&VNt(_,()=>O(_)),delete T.m,(zl.env?zl.env.MODE:void 0)!=="production"&&o.delete(w);for(let E of T.d.keys()){let P=h(_,E,t(E));P?.t.delete(w)}return}return T.m},b={get:s,set:f,sub:(_,w)=>{let T=LJ(),O=t(_),P=m(T,_,O).l;return P.add(w),fF(T),()=>{P.delete(w);let R=LJ();h(R,_,O),fF(R)}},unstable_derive:_=>WNt(..._(t,e,r,n))};return(zl.env?zl.env.MODE:void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:w=>{let T=t(w);if(T.n!==0)return T}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:w=>{let T=LJ();for(let[O,E]of w)if(K3e(O)){let P=t(O),R=P.n;i(O,P,E),p(T,O,P),R!==P.n&&(X3e(T,O,P),c(T,O,P))}fF(T)}}),b},pF=()=>{let t=new WeakMap;return WNt(r=>{if((zl.env?zl.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)})},JNt=()=>(vte||(vte=pF(),(zl.env?zl.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=vte),globalThis.__JOTAI_DEFAULT_STORE__!==vte&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),vte)});var o1t=S($i=>{"use strict";var wte=Symbol.for("react.element"),Lwn=Symbol.for("react.portal"),Fwn=Symbol.for("react.fragment"),kwn=Symbol.for("react.strict_mode"),qwn=Symbol.for("react.profiler"),Uwn=Symbol.for("react.provider"),Bwn=Symbol.for("react.context"),zwn=Symbol.for("react.forward_ref"),Vwn=Symbol.for("react.suspense"),Hwn=Symbol.for("react.memo"),Wwn=Symbol.for("react.lazy"),KNt=Symbol.iterator;function Jwn(t){return t===null||typeof t!="object"?null:(t=KNt&&t[KNt]||t["@@iterator"],typeof t=="function"?t:null)}var ZNt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},YNt=Object.assign,QNt={};function FJ(t,e,r){this.props=t,this.context=e,this.refs=QNt,this.updater=r||ZNt}FJ.prototype.isReactComponent={};FJ.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")};FJ.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function e1t(){}e1t.prototype=FJ.prototype;function tWe(t,e,r){this.props=t,this.context=e,this.refs=QNt,this.updater=r||ZNt}var rWe=tWe.prototype=new e1t;rWe.constructor=tWe;YNt(rWe,FJ.prototype);rWe.isPureReactComponent=!0;var GNt=Array.isArray,t1t=Object.prototype.hasOwnProperty,nWe={current:null},r1t={key:!0,ref:!0,__self:!0,__source:!0};function n1t(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)t1t.call(e,n)&&!r1t.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:wte,type:t,key:i,ref:a,props:o,_owner:nWe.current}}function Kwn(t,e){return{$$typeof:wte,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function oWe(t){return typeof t=="object"&&t!==null&&t.$$typeof===wte}function Gwn(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var XNt=/\/+/g;function eWe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Gwn(""+t.key):e.toString(36)}function sye(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 wte:case Lwn:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+eWe(a,0):n,GNt(o)?(r="",t!=null&&(r=t.replace(XNt,"$&/")+"/"),sye(o,e,r,"",function(l){return l})):o!=null&&(oWe(o)&&(o=Kwn(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(XNt,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",GNt(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+eWe(i,s);a+=sye(i,e,r,u,o)}else if(u=Jwn(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+eWe(i,s++),a+=sye(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 aye(t,e,r){if(t==null)return t;var n=[],o=0;return sye(t,n,"","",function(i){return e.call(r,i,o++)}),n}function Xwn(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 Ub={current:null},uye={transition:null},Zwn={ReactCurrentDispatcher:Ub,ReactCurrentBatchConfig:uye,ReactCurrentOwner:nWe};$i.Children={map:aye,forEach:function(t,e,r){aye(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return aye(t,function(){e++}),e},toArray:function(t){return aye(t,function(e){return e})||[]},only:function(t){if(!oWe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};$i.Component=FJ;$i.Fragment=Fwn;$i.Profiler=qwn;$i.PureComponent=tWe;$i.StrictMode=kwn;$i.Suspense=Vwn;$i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zwn;$i.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=YNt({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=nWe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)t1t.call(e,u)&&!r1t.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:wte,type:t.type,key:o,ref:i,props:n,_owner:a}};$i.createContext=function(t){return t={$$typeof:Bwn,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Uwn,_context:t},t.Consumer=t};$i.createElement=n1t;$i.createFactory=function(t){var e=n1t.bind(null,t);return e.type=t,e};$i.createRef=function(){return{current:null}};$i.forwardRef=function(t){return{$$typeof:zwn,render:t}};$i.isValidElement=oWe;$i.lazy=function(t){return{$$typeof:Wwn,_payload:{_status:-1,_result:t},_init:Xwn}};$i.memo=function(t,e){return{$$typeof:Hwn,type:t,compare:e===void 0?null:e}};$i.startTransition=function(t){var e=uye.transition;uye.transition={};try{t()}finally{uye.transition=e}};$i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};$i.useCallback=function(t,e){return Ub.current.useCallback(t,e)};$i.useContext=function(t){return Ub.current.useContext(t)};$i.useDebugValue=function(){};$i.useDeferredValue=function(t){return Ub.current.useDeferredValue(t)};$i.useEffect=function(t,e){return Ub.current.useEffect(t,e)};$i.useId=function(){return Ub.current.useId()};$i.useImperativeHandle=function(t,e,r){return Ub.current.useImperativeHandle(t,e,r)};$i.useInsertionEffect=function(t,e){return Ub.current.useInsertionEffect(t,e)};$i.useLayoutEffect=function(t,e){return Ub.current.useLayoutEffect(t,e)};$i.useMemo=function(t,e){return Ub.current.useMemo(t,e)};$i.useReducer=function(t,e,r){return Ub.current.useReducer(t,e,r)};$i.useRef=function(t){return Ub.current.useRef(t)};$i.useState=function(t){return Ub.current.useState(t)};$i.useSyncExternalStore=function(t,e,r){return Ub.current.useSyncExternalStore(t,e,r)};$i.useTransition=function(){return Ub.current.useTransition()};$i.version="18.2.0"});var J=S((HBi,i1t)=>{"use strict";i1t.exports=o1t()});function L_(t,e){let r=s1t(e),[[n,o,i],a]=(0,jy.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,jy.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);aWe(c)&&u1t(a1t(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,jy.useDebugValue)(s),aWe(s)){let l=a1t(s);return Qwn(l)}return s}function l1t(t,e){let r=s1t(e);return(0,jy.useCallback)((...o)=>{if((lye.env?lye.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function u1(t,e){return[L_(t,e),l1t(t,e)]}var jy,lye,Ywn,s1t,aWe,u1t,Qwn,iWe,a1t,c1t=v(()=>{"use client";jy=$(J(),1);Q3e();lye={},Ywn=(0,jy.createContext)(void 0),s1t=t=>{let e=(0,jy.useContext)(Ywn);return t?.store||e||JNt()},aWe=t=>typeof t?.then=="function",u1t=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Qwn=jy.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(u1t(t),t)}),iWe=new WeakMap,a1t=t=>{let e=iWe.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((lye.env?lye.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");aWe(l)?(iWe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),iWe.set(t,e)),e}});var XC=v(()=>{Q3e();c1t()});function qJ(t){return typeof t=="string"&&eSn.includes(t)}function tSn(t){return typeof t=="string"?t.trim():""}function cye(t){if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t;if(typeof t=="string"){let e=Number(t);if(Number.isFinite(e)&&e>0)return e;let r=Date.parse(t);if(Number.isFinite(r))return r}return null}function rSn(t,e){let r=new Intl.Collator(void 0),n=u=>tSn(e.getName(u)),o=u=>{let l=e.getCreatedAtMs(u);return Number.isFinite(l)?l:0},i=u=>{let l=o(u);return cye(e.getLastUsedAtMs(u))??l},a=typeof e.getManualOrder=="function"?u=>{let l=e.getManualOrder?.(u);return typeof l=="number"&&Number.isFinite(l)?l:0}:null,s=t==="manual"&&!a?"name":t;return(u,l)=>{let c=n(u),d=n(l),f=o(u),p=o(l),m=i(u),h=i(l);if(s==="manual"){let _=a(u),w=a(l);if(_!==w)return _-w}else if(s==="name"){let _=r.compare(c,d);if(_!==0)return _}else if(s==="created"){let _=p-f;if(_!==0)return _}else{let _=h-m;if(_!==0)return _}let y=r.compare(c,d);if(y!==0)return y;let g=p-f;if(g!==0)return g;let b=h-m;return b!==0?b:0}}function mO(t,e,r){return[...t].sort(rSn(e,r))}var eSn,kJ,l1=v(()=>{eSn=["recent","created","name","manual"];kJ=class{constructor(e={}){this.lastTouchedAtMsByKey=new Map;this.lastPersistedAtMsByKey=new Map;this.revision=0;this.listeners=new Set;this.minIntervalMs=e.minIntervalMs??3e4,this.nowMs=e.nowMs??(()=>Date.now())}notifyChange(){this.revision+=1;for(let e of this.listeners)e()}getRevision(){return this.revision}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}touch(e){let r=this.nowMs();return this.lastTouchedAtMsByKey.set(e,r),this.notifyChange(),r}shouldPersist(e,r){let n=this.lastTouchedAtMsByKey.get(e);if(!n)return null;let o=cye(r),i=this.lastPersistedAtMsByKey.get(e),a=Math.max(o??0,i??0);return a===0?n:n-a<this.minIntervalMs?null:n}markPersisted(e,r){let n=cye(r);if(!n)return;let o=this.lastPersistedAtMsByKey.get(e)??0;this.lastPersistedAtMsByKey.set(e,Math.max(o,n))}getLastTouchedAt(e){return this.lastTouchedAtMsByKey.get(e)??null}getEffectiveLastUsedAt(e,r){let n=this.lastTouchedAtMsByKey.get(e),o=cye(r);return Math.max(n??0,o??0)}clear(e){if(e){this.lastTouchedAtMsByKey.delete(e),this.lastPersistedAtMsByKey.delete(e),this.notifyChange();return}this.lastTouchedAtMsByKey.clear(),this.lastPersistedAtMsByKey.clear(),this.notifyChange()}}});var x4={};En(x4,{getModelKeyFromModel:()=>no,getSettings:()=>te,resetSettings:()=>sWe,sanitizeQaExclusions:()=>f1t,sanitizeSettings:()=>uWe,setSettings:()=>F_,settingsAtom:()=>mF,settingsStore:()=>No,subscribeToSettingsChange:()=>hl,updateSetting:()=>Re,useSettingsValue:()=>Br});function nSn(t){let e=new Set((t.activeEmbeddingModels||[]).map(r=>no(r)));return t.embeddingModelKey&&e.has(t.embeddingModelKey)?t.embeddingModelKey:ko.embeddingModelKey}function F_(t){let e=oSn({...te(),...t});e.embeddingModelKey=nSn(e),No.set(mF,e)}function f1t(t){let r=(typeof t=="string"?t:lWe).split(",").map(o=>decodeURIComponent(o.trim())).filter(o=>o.length>0),n=new Map;return r.forEach(o=>{let i=o.replace(/\/+$/,""),a=i.length>0?i:o;if(a===ZC){n.set(ZC,ZC);return}if(!n.has(a)){let s=i.length>0&&o.endsWith("/")?`${i}/`:o;n.set(a,s)}}),n.set(ZC,ZC),Array.from(n.values()).map(o=>encodeURIComponent(o)).join(",")}function Re(t,e){let r=te();F_({...r,[t]:e})}function te(){return No.get(mF)}function sWe(){let t={...ko,activeModels:hO.map(e=>({...e,enabled:!0})),activeEmbeddingModels:T4.map(e=>({...e,enabled:!0}))};F_(t)}function hl(t){let e=te();return No.sub(mF,()=>{let r=te();t(e,r),e=r})}function Br(){return L_(mF,{store:No})}function uWe(t){let e=t||ko;e.userId||(e.userId=od()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(g=>({...g,provider:g.provider==="azure_openai"?"azure openai":g.provider})):e.activeEmbeddingModels=T4.map(g=>({...g,enabled:!0}));let r={...e},n=e;n.enableSelfHostedSearch!==void 0&&r.enableSelfHostMode===void 0&&(r.enableSelfHostMode=n.enableSelfHostedSearch),n.selfHostedSearchUrl!==void 0&&!r.selfHostUrl&&(r.selfHostUrl=n.selfHostedSearchUrl),n.selfHostedSearchApiKey!==void 0&&!r.selfHostApiKey&&(r.selfHostApiKey=n.selfHostedSearchApiKey);let o=Number(e.temperature);r.temperature=isNaN(o)?ko.temperature:o;let i=Number(e.maxTokens);r.maxTokens=isNaN(i)?ko.maxTokens:i;let a=Number(e.contextTurns);r.contextTurns=isNaN(a)?ko.contextTurns:a;let s=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(s)?ko.embeddingRequestsPerMin:s;let u=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(u)?ko.embeddingBatchSize:u;let l=Number(e.lexicalSearchRamLimit);if(isNaN(l)?r.lexicalSearchRamLimit=ko.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,l)),typeof r.autoAddActiveContentToContext!="boolean"){let g=e.includeActiveNoteAsContext;typeof g=="boolean"?r.autoAddActiveContentToContext=g:r.autoAddActiveContentToContext=ko.autoAddActiveContentToContext}typeof r.generateAIChatTitleOnSave!="boolean"&&(r.generateAIChatTitleOnSave=ko.generateAIChatTitleOnSave),typeof r.enableMiyo!="boolean"&&(r.enableMiyo=ko.enableMiyo),["firecrawl","perplexity"].includes(r.selfHostSearchProvider)||(r.selfHostSearchProvider=ko.selfHostSearchProvider),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=ko.passMarkdownImages),typeof r.enableInlineCitations!="boolean"&&(r.enableInlineCitations=ko.enableInlineCitations),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=ko.enableCustomPromptTemplating);let d=Number(e.autonomousAgentMaxIterations);isNaN(d)||d<4||d>dye?r.autonomousAgentMaxIterations=ko.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=d,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=ko.autonomousAgentEnabledToolIds),(!r.memoryFolderName||typeof r.memoryFolderName!="string")&&(r.memoryFolderName=ko.memoryFolderName),typeof r.enableRecentConversations!="boolean"&&(r.enableRecentConversations=ko.enableRecentConversations),typeof r.enableSavedMemory!="boolean"&&(r.enableSavedMemory=ko.enableSavedMemory);let f=Number(e.maxRecentConversations);isNaN(f)||f<10||f>50?r.maxRecentConversations=ko.maxRecentConversations:r.maxRecentConversations=f,typeof r.autosaveChat!="boolean"&&(r.autosaveChat=ko.autosaveChat);let p=Number(e.autoCompactThreshold);if(isNaN(p)?r.autoCompactThreshold=ko.autoCompactThreshold:r.autoCompactThreshold=Math.min(1e6,Math.max(64e3,p)),typeof r.quickCommandIncludeNoteContext!="boolean"&&(r.quickCommandIncludeNoteContext=ko.quickCommandIncludeNoteContext),e.quickCommandModelKey!==void 0&&typeof e.quickCommandModelKey!="string"&&(r.quickCommandModelKey=ko.quickCommandModelKey),typeof r.autoAddSelectionToContext!="boolean"){let g=e.autoIncludeTextSelection;typeof g=="boolean"?r.autoAddSelectionToContext=g:r.autoAddSelectionToContext=ko.autoAddSelectionToContext}typeof r.autoAcceptEdits!="boolean"&&(r.autoAcceptEdits=ko.autoAcceptEdits),Object.values(UJ).includes(r.defaultSendShortcut)||(r.defaultSendShortcut=ko.defaultSendShortcut);let m=(e.defaultSaveFolder||"").trim();r.defaultSaveFolder=m.length>0?m:ko.defaultSaveFolder;let h=(e.customPromptsFolder||"").trim();r.customPromptsFolder=h.length>0?h:ko.customPromptsFolder,(!qJ(r.chatHistorySortStrategy)||r.chatHistorySortStrategy==="manual")&&(r.chatHistorySortStrategy=ko.chatHistorySortStrategy),(!qJ(r.projectListSortStrategy)||r.projectListSortStrategy==="manual")&&(r.projectListSortStrategy=ko.projectListSortStrategy);let y=(e.userSystemPromptsFolder||"").trim();return r.userSystemPromptsFolder=y.length>0?y:ko.userSystemPromptsFolder,r.qaExclusions=f1t(e.qaExclusions),r}function oSn(t){return t.activeModels=d1t(t.activeModels,hO),t.activeEmbeddingModels=iSn(d1t(t.activeEmbeddingModels,T4)),t}function no(t){return`${t.name}|${t.provider}`}function d1t(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(no(n),{...n})}),t.forEach(n=>{let o=no(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())}function iSn(t){let e=new Set(Object.values(YC));return t.filter(r=>e.has(r.provider))}var No,mF,Ye=v(()=>{XC();qN();l1();mr();No=pF(),mF=bc(ko)});function zr(t,e=!1){try{if(t instanceof Error){let n=t?.cause instanceof Error?t.cause.message:t?.cause?String(t.cause):"",o=e&&t.stack?t.stack:"",i=[t.message];return n&&i.push(`more message: ${n}`),o&&i.push(o),i.join(`
|
||
`)}return JSON.stringify(t)??String(t)}catch{return String(t)}}var cWe=v(()=>{});var dWe,Im,O4=v(()=>{cWe();Bt();Ye();dWe=class t{constructor(){this.maxLines=500;this.maxLineChars=8e3;this.buffer=[];this.initialized=!1;this.flushing=!1}static getInstance(){return t.instance||(t.instance=new t),t.instance}getLogPath(){return"copilot/copilot-log.md"}async ensureInitialized(){this.initialized||(this.initialized=!0)}hasVault(){try{return typeof app<"u"&&!!app.vault?.adapter}catch{return!1}}sanitizeForSingleLine(e){if(e instanceof Error){let r=zr(e,!0);return this.escapeAngleBrackets(this.collapseToSingleLine(r))}if(typeof e=="string")return this.escapeAngleBrackets(this.collapseToSingleLine(e));try{let r=JSON.stringify(e);return this.escapeAngleBrackets(this.collapseToSingleLine(r??String(e)))}catch{return this.escapeAngleBrackets(this.collapseToSingleLine(String(e)))}}collapseToSingleLine(e){let r=e.replace(/[\r\n]+/g,"\\n").replace(/\t/g," ");return r.length<=this.maxLineChars?r:r.slice(0,this.maxLineChars)+` \u2026 [truncated ${r.length-this.maxLineChars} chars]`}async append(e,...r){await this.ensureInitialized();let n=new Date().toISOString(),o=r.map(a=>this.sanitizeForSingleLine(a)),i=`${n} ${e} ${o.join(" ")}`.trim();this.buffer.push(i),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}escapeAngleBrackets(e){return e.replace(/</g,"<").replace(/>/g,">")}async appendMarkdownBlock(e){if(await this.ensureInitialized(),!(!Array.isArray(e)||e.length===0))for(let r of e){let n=typeof r=="string"?r:String(r??"");this.buffer.push(n),this.buffer.length>this.maxLines&&this.buffer.splice(0,this.buffer.length-this.maxLines)}}async flush(){if(this.hasVault()&&!this.flushing){this.flushing=!0;try{let e=this.getLogPath();if(await app.vault.adapter.exists(e)){let r=this.buffer.join(`
|
||
`)+(this.buffer.length?`
|
||
`:"");await app.vault.adapter.write(e,r)}}catch{}finally{this.flushing=!1}}}async clear(){if(this.buffer=[],!!this.hasVault())try{let e=this.getLogPath();await app.vault.adapter.exists(e)&&await app.vault.adapter.remove(e)}catch{}}sanitizeSettingsForLog(){let e=te();return this.removeKeysRecursive(e)}removeKeysRecursive(e){if(e==null)return e;if(Array.isArray(e))return e.map(r=>this.removeKeysRecursive(r));if(typeof e=="object"&&e.constructor===Object){let r={},n=e;for(let[o,i]of Object.entries(n))/apiKey$/i.test(o)||/licenseKey$/i.test(o)||/_api_key$/i.test(o)||/_license_key$/i.test(o)||/orgId$/i.test(o)||/instanceName$/i.test(o)||/deploymentName$/i.test(o)||/apiVersion$/i.test(o)||(r[o]=this.removeKeysRecursive(i));return r}return e}async openLogFile(){if(!this.hasVault())return;let e=this.getLogPath(),r=[...this.buffer];try{let o=this.sanitizeSettingsForLog(),a=["","## Settings","```json",...JSON.stringify(o,null,2).split(`
|
||
`),"```"];r.push(...a)}catch{}try{let o=r.join(`
|
||
`)+(r.length?`
|
||
`:""),i=e.includes("/")?e.split("/").slice(0,-1).join("/"):"";i&&await $c(i),await app.vault.adapter.exists(e)?await app.vault.adapter.write(e,o):await app.vault.create(e,o)}catch{}let n=app.vault.getAbstractFileByPath(e);try{n&&await app.workspace.getLeaf(!0).openFile(n)}catch{}}},Im=dWe.getInstance()});function F(...t){te().debug&&console.log(...t),Im.append("INFO",...t)}function ne(...t){te().debug&&console.error(...t),Im.append("ERROR",...t)}function Te(...t){te().debug&&console.warn(...t),Im.append("WARN",...t)}function fye(t){Im.appendMarkdownBlock(t)}function p1t(t,e){if(te().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}F("Table:",JSON.stringify(t))}var Xe=v(()=>{Ye();O4()});var m1t=S((fWe,BJ)=>{(function(t,e){typeof fWe=="object"&&typeof BJ<"u"?BJ.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(fWe,function(){"use strict";var t;function e(){return t.apply(null,arguments)}function r(C){t=C}function n(C){return C instanceof Array||Object.prototype.toString.call(C)==="[object Array]"}function o(C){return C!=null&&Object.prototype.toString.call(C)==="[object Object]"}function i(C,M){return Object.prototype.hasOwnProperty.call(C,M)}function a(C){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(C).length===0;var M;for(M in C)if(i(C,M))return!1;return!0}function s(C){return C===void 0}function u(C){return typeof C=="number"||Object.prototype.toString.call(C)==="[object Number]"}function l(C){return C instanceof Date||Object.prototype.toString.call(C)==="[object Date]"}function c(C,M){var D=[],q,G=C.length;for(q=0;q<G;++q)D.push(M(C[q],q));return D}function d(C,M){for(var D in M)i(M,D)&&(C[D]=M[D]);return i(M,"toString")&&(C.toString=M.toString),i(M,"valueOf")&&(C.valueOf=M.valueOf),C}function f(C,M,D,q){return U0t(C,M,D,q,!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(C){return C._pf==null&&(C._pf=p()),C._pf}var h;Array.prototype.some?h=Array.prototype.some:h=function(C){var M=Object(this),D=M.length>>>0,q;for(q=0;q<D;q++)if(q in M&&C.call(this,M[q],q,M))return!0;return!1};function y(C){if(C._isValid==null){var M=m(C),D=h.call(M.parsedDateParts,function(G){return G!=null}),q=!isNaN(C._d.getTime())&&M.overflow<0&&!M.empty&&!M.invalidEra&&!M.invalidMonth&&!M.invalidWeekday&&!M.weekdayMismatch&&!M.nullInput&&!M.invalidFormat&&!M.userInvalidated&&(!M.meridiem||M.meridiem&&D);if(C._strict&&(q=q&&M.charsLeftOver===0&&M.unusedTokens.length===0&&M.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(C))C._isValid=q;else return q}return C._isValid}function g(C){var M=f(NaN);return C!=null?d(m(M),C):m(M).userInvalidated=!0,M}var b=e.momentProperties=[],_=!1;function w(C,M){var D,q,G,fe=b.length;if(s(M._isAMomentObject)||(C._isAMomentObject=M._isAMomentObject),s(M._i)||(C._i=M._i),s(M._f)||(C._f=M._f),s(M._l)||(C._l=M._l),s(M._strict)||(C._strict=M._strict),s(M._tzm)||(C._tzm=M._tzm),s(M._isUTC)||(C._isUTC=M._isUTC),s(M._offset)||(C._offset=M._offset),s(M._pf)||(C._pf=m(M)),s(M._locale)||(C._locale=M._locale),fe>0)for(D=0;D<fe;D++)q=b[D],G=M[q],s(G)||(C[q]=G);return C}function T(C){w(this,C),this._d=new Date(C._d!=null?C._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),_===!1&&(_=!0,e.updateOffset(this),_=!1)}function O(C){return C instanceof T||C!=null&&C._isAMomentObject!=null}function E(C){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+C)}function P(C,M){var D=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,C),D){var q=[],G,fe,De,sn=arguments.length;for(fe=0;fe<sn;fe++){if(G="",typeof arguments[fe]=="object"){G+=`
|
||
[`+fe+"] ";for(De in arguments[0])i(arguments[0],De)&&(G+=De+": "+arguments[0][De]+", ");G=G.slice(0,-2)}else G=arguments[fe];q.push(G)}E(C+`
|
||
Arguments: `+Array.prototype.slice.call(q).join("")+`
|
||
`+new Error().stack),D=!1}return M.apply(this,arguments)},M)}var R={};function I(C,M){e.deprecationHandler!=null&&e.deprecationHandler(C,M),R[C]||(E(M),R[C]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function N(C){return typeof Function<"u"&&C instanceof Function||Object.prototype.toString.call(C)==="[object Function]"}function z(C){var M,D;for(D in C)i(C,D)&&(M=C[D],N(M)?this[D]=M:this["_"+D]=M);this._config=C,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function V(C,M){var D=d({},C),q;for(q in M)i(M,q)&&(o(C[q])&&o(M[q])?(D[q]={},d(D[q],C[q]),d(D[q],M[q])):M[q]!=null?D[q]=M[q]:delete D[q]);for(q in C)i(C,q)&&!i(M,q)&&o(C[q])&&(D[q]=d({},D[q]));return D}function k(C){C!=null&&this.set(C)}var X;Object.keys?X=Object.keys:X=function(C){var M,D=[];for(M in C)i(C,M)&&D.push(M);return D};var B={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,M,D){var q=this._calendar[C]||this._calendar.sameElse;return N(q)?q.call(M,D):q}function Y(C,M,D){var q=""+Math.abs(C),G=M-q.length,fe=C>=0;return(fe?D?"+":"":"-")+Math.pow(10,Math.max(0,G)).toString().substr(1)+q}var K=/(\[[^\[]*\])|(\\)?([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,oe=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,ue={},de={};function L(C,M,D,q){var G=q;typeof q=="string"&&(G=function(){return this[q]()}),C&&(de[C]=G),M&&(de[M[0]]=function(){return Y(G.apply(this,arguments),M[1],M[2])}),D&&(de[D]=function(){return this.localeData().ordinal(G.apply(this,arguments),C)})}function W(C){return C.match(/\[[\s\S]/)?C.replace(/^\[|\]$/g,""):C.replace(/\\/g,"")}function ie(C){var M=C.match(K),D,q;for(D=0,q=M.length;D<q;D++)de[M[D]]?M[D]=de[M[D]]:M[D]=W(M[D]);return function(G){var fe="",De;for(De=0;De<q;De++)fe+=N(M[De])?M[De].call(G,C):M[De];return fe}}function j(C,M){return C.isValid()?(M=A(M,C.localeData()),ue[M]=ue[M]||ie(M),ue[M](C)):C.localeData().invalidDate()}function A(C,M){var D=5;function q(G){return M.longDateFormat(G)||G}for(oe.lastIndex=0;D>=0&&oe.test(C);)C=C.replace(oe,q),oe.lastIndex=0,D-=1;return C}var U={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 H(C){var M=this._longDateFormat[C],D=this._longDateFormat[C.toUpperCase()];return M||!D?M:(this._longDateFormat[C]=D.match(K).map(function(q){return q==="MMMM"||q==="MM"||q==="DD"||q==="dddd"?q.slice(1):q}).join(""),this._longDateFormat[C])}var re="Invalid date";function Z(){return this._invalidDate}var le="%d",Ce=/\d{1,2}/;function He(C){return this._ordinal.replace("%d",C)}var lt={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 qe(C,M,D,q){var G=this._relativeTime[D];return N(G)?G(C,M,D,q):G.replace(/%d/i,C)}function Nt(C,M){var D=this._relativeTime[C>0?"future":"past"];return N(D)?D(M):D.replace(/%s/i,M)}var mt={};function Ot(C,M){var D=C.toLowerCase();mt[D]=mt[D+"s"]=mt[M]=C}function je(C){return typeof C=="string"?mt[C]||mt[C.toLowerCase()]:void 0}function Gr(C){var M={},D,q;for(q in C)i(C,q)&&(D=je(q),D&&(M[D]=C[q]));return M}var ct={};function ze(C,M){ct[C]=M}function ht(C){var M=[],D;for(D in C)i(C,D)&&M.push({unit:D,priority:ct[D]});return M.sort(function(q,G){return q.priority-G.priority}),M}function $e(C){return C%4===0&&C%100!==0||C%400===0}function Ue(C){return C<0?Math.ceil(C)||0:Math.floor(C)}function Ve(C){var M=+C,D=0;return M!==0&&isFinite(M)&&(D=Ue(M)),D}function Kt(C,M){return function(D){return D!=null?(iu(this,C,D),e.updateOffset(this,M),this):so(this,C)}}function so(C,M){return C.isValid()?C._d["get"+(C._isUTC?"UTC":"")+M]():NaN}function iu(C,M,D){C.isValid()&&!isNaN(D)&&(M==="FullYear"&&$e(C.year())&&C.month()===1&&C.date()===29?(D=Ve(D),C._d["set"+(C._isUTC?"UTC":"")+M](D,C.month(),Rpe(D,C.month()))):C._d["set"+(C._isUTC?"UTC":"")+M](D))}function An(C){return C=je(C),N(this[C])?this[C]():this}function Si(C,M){if(typeof C=="object"){C=Gr(C);var D=ht(C),q,G=D.length;for(q=0;q<G;q++)this[D[q].unit](C[D[q].unit])}else if(C=je(C),N(this[C]))return this[C](M);return this}var Dl=/\d/,Vi=/\d\d/,O_=/\d{3}/,wg=/\d{4}/,yS=/[+-]?\d{6}/,ji=/\d\d?/,KT=/\d\d\d\d?/,LC=/\d\d\d\d\d\d?/,bS=/\d{1,3}/,Gs=/\d{1,4}/,jl=/[+-]?\d{1,6}/,Mu=/\d+/,Mm=/[+-]?\d+/,xd=/Z|[+-]\d\d:?\d\d/gi,ll=/Z|[+-]\d\d(?::?\d\d)?/gi,rt=/[+-]?\d+(\.\d{1,3})?/,Rr=/[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,Be;Be={};function Ee(C,M,D){Be[C]=N(M)?M:function(q,G){return q&&D?D:M}}function It(C,M){return i(Be,C)?Be[C](M._strict,M._locale):new RegExp(Qt(C))}function Qt(C){return Fn(C.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(M,D,q,G,fe){return D||q||G||fe}))}function Fn(C){return C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var cl={};function Ei(C,M){var D,q=M,G;for(typeof C=="string"&&(C=[C]),u(M)&&(q=function(fe,De){De[M]=Ve(fe)}),G=C.length,D=0;D<G;D++)cl[C[D]]=q}function Xv(C,M){Ei(C,function(D,q,G,fe){G._w=G._w||{},M(D,G._w,G,fe)})}function DL(C,M,D){M!=null&&i(cl,C)&&cl[C](M,D._a,D,C)}var Eh=0,FC=1,Zv=2,$l=3,Eb=4,Yv=5,NN=6,hsn=7,gsn=8;function ysn(C,M){return(C%M+M)%M}var nd;Array.prototype.indexOf?nd=Array.prototype.indexOf:nd=function(C){var M;for(M=0;M<this.length;++M)if(this[M]===C)return M;return-1};function Rpe(C,M){if(isNaN(C)||isNaN(M))return NaN;var D=ysn(M,12);return C+=(M-D)/12,D===1?$e(C)?29:28:31-D%7%2}L("M",["MM",2],"Mo",function(){return this.month()+1}),L("MMM",0,0,function(C){return this.localeData().monthsShort(this,C)}),L("MMMM",0,0,function(C){return this.localeData().months(this,C)}),Ot("month","M"),ze("month",8),Ee("M",ji),Ee("MM",ji,Vi),Ee("MMM",function(C,M){return M.monthsShortRegex(C)}),Ee("MMMM",function(C,M){return M.monthsRegex(C)}),Ei(["M","MM"],function(C,M){M[FC]=Ve(C)-1}),Ei(["MMM","MMMM"],function(C,M,D,q){var G=D._locale.monthsParse(C,q,D._strict);G!=null?M[FC]=G:m(D).invalidMonth=C});var bsn="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),O0t="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),E0t=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,_sn=Rr,vsn=Rr;function wsn(C,M){return C?n(this._months)?this._months[C.month()]:this._months[(this._months.isFormat||E0t).test(M)?"format":"standalone"][C.month()]:n(this._months)?this._months:this._months.standalone}function Ssn(C,M){return C?n(this._monthsShort)?this._monthsShort[C.month()]:this._monthsShort[E0t.test(M)?"format":"standalone"][C.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Csn(C,M,D){var q,G,fe,De=C.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],q=0;q<12;++q)fe=f([2e3,q]),this._shortMonthsParse[q]=this.monthsShort(fe,"").toLocaleLowerCase(),this._longMonthsParse[q]=this.months(fe,"").toLocaleLowerCase();return D?M==="MMM"?(G=nd.call(this._shortMonthsParse,De),G!==-1?G:null):(G=nd.call(this._longMonthsParse,De),G!==-1?G:null):M==="MMM"?(G=nd.call(this._shortMonthsParse,De),G!==-1?G:(G=nd.call(this._longMonthsParse,De),G!==-1?G:null)):(G=nd.call(this._longMonthsParse,De),G!==-1?G:(G=nd.call(this._shortMonthsParse,De),G!==-1?G:null))}function xsn(C,M,D){var q,G,fe;if(this._monthsParseExact)return Csn.call(this,C,M,D);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),q=0;q<12;q++){if(G=f([2e3,q]),D&&!this._longMonthsParse[q]&&(this._longMonthsParse[q]=new RegExp("^"+this.months(G,"").replace(".","")+"$","i"),this._shortMonthsParse[q]=new RegExp("^"+this.monthsShort(G,"").replace(".","")+"$","i")),!D&&!this._monthsParse[q]&&(fe="^"+this.months(G,"")+"|^"+this.monthsShort(G,""),this._monthsParse[q]=new RegExp(fe.replace(".",""),"i")),D&&M==="MMMM"&&this._longMonthsParse[q].test(C))return q;if(D&&M==="MMM"&&this._shortMonthsParse[q].test(C))return q;if(!D&&this._monthsParse[q].test(C))return q}}function P0t(C,M){var D;if(!C.isValid())return C;if(typeof M=="string"){if(/^\d+$/.test(M))M=Ve(M);else if(M=C.localeData().monthsParse(M),!u(M))return C}return D=Math.min(C.date(),Rpe(C.year(),M)),C._d["set"+(C._isUTC?"UTC":"")+"Month"](M,D),C}function M0t(C){return C!=null?(P0t(this,C),e.updateOffset(this,!0),this):so(this,"Month")}function Tsn(){return Rpe(this.year(),this.month())}function Osn(C){return this._monthsParseExact?(i(this,"_monthsRegex")||R0t.call(this),C?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=_sn),this._monthsShortStrictRegex&&C?this._monthsShortStrictRegex:this._monthsShortRegex)}function Esn(C){return this._monthsParseExact?(i(this,"_monthsRegex")||R0t.call(this),C?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=vsn),this._monthsStrictRegex&&C?this._monthsStrictRegex:this._monthsRegex)}function R0t(){function C(De,sn){return sn.length-De.length}var M=[],D=[],q=[],G,fe;for(G=0;G<12;G++)fe=f([2e3,G]),M.push(this.monthsShort(fe,"")),D.push(this.months(fe,"")),q.push(this.months(fe,"")),q.push(this.monthsShort(fe,""));for(M.sort(C),D.sort(C),q.sort(C),G=0;G<12;G++)M[G]=Fn(M[G]),D[G]=Fn(D[G]);for(G=0;G<24;G++)q[G]=Fn(q[G]);this._monthsRegex=new RegExp("^("+q.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+D.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+M.join("|")+")","i")}L("Y",0,0,function(){var C=this.year();return C<=9999?Y(C,4):"+"+C}),L(0,["YY",2],0,function(){return this.year()%100}),L(0,["YYYY",4],0,"year"),L(0,["YYYYY",5],0,"year"),L(0,["YYYYYY",6,!0],0,"year"),Ot("year","y"),ze("year",1),Ee("Y",Mm),Ee("YY",ji,Vi),Ee("YYYY",Gs,wg),Ee("YYYYY",jl,yS),Ee("YYYYYY",jl,yS),Ei(["YYYYY","YYYYYY"],Eh),Ei("YYYY",function(C,M){M[Eh]=C.length===2?e.parseTwoDigitYear(C):Ve(C)}),Ei("YY",function(C,M){M[Eh]=e.parseTwoDigitYear(C)}),Ei("Y",function(C,M){M[Eh]=parseInt(C,10)});function TQ(C){return $e(C)?366:365}e.parseTwoDigitYear=function(C){return Ve(C)+(Ve(C)>68?1900:2e3)};var I0t=Kt("FullYear",!0);function Psn(){return $e(this.year())}function Msn(C,M,D,q,G,fe,De){var sn;return C<100&&C>=0?(sn=new Date(C+400,M,D,q,G,fe,De),isFinite(sn.getFullYear())&&sn.setFullYear(C)):sn=new Date(C,M,D,q,G,fe,De),sn}function OQ(C){var M,D;return C<100&&C>=0?(D=Array.prototype.slice.call(arguments),D[0]=C+400,M=new Date(Date.UTC.apply(null,D)),isFinite(M.getUTCFullYear())&&M.setUTCFullYear(C)):M=new Date(Date.UTC.apply(null,arguments)),M}function Ipe(C,M,D){var q=7+M-D,G=(7+OQ(C,0,q).getUTCDay()-M)%7;return-G+q-1}function A0t(C,M,D,q,G){var fe=(7+D-q)%7,De=Ipe(C,q,G),sn=1+7*(M-1)+fe+De,pi,pu;return sn<=0?(pi=C-1,pu=TQ(pi)+sn):sn>TQ(C)?(pi=C+1,pu=sn-TQ(C)):(pi=C,pu=sn),{year:pi,dayOfYear:pu}}function EQ(C,M,D){var q=Ipe(C.year(),M,D),G=Math.floor((C.dayOfYear()-q-1)/7)+1,fe,De;return G<1?(De=C.year()-1,fe=G+DN(De,M,D)):G>DN(C.year(),M,D)?(fe=G-DN(C.year(),M,D),De=C.year()+1):(De=C.year(),fe=G),{week:fe,year:De}}function DN(C,M,D){var q=Ipe(C,M,D),G=Ipe(C+1,M,D);return(TQ(C)-q+G)/7}L("w",["ww",2],"wo","week"),L("W",["WW",2],"Wo","isoWeek"),Ot("week","w"),Ot("isoWeek","W"),ze("week",5),ze("isoWeek",5),Ee("w",ji),Ee("ww",ji,Vi),Ee("W",ji),Ee("WW",ji,Vi),Xv(["w","ww","W","WW"],function(C,M,D,q){M[q.substr(0,1)]=Ve(C)});function Rsn(C){return EQ(C,this._week.dow,this._week.doy).week}var Isn={dow:0,doy:6};function Asn(){return this._week.dow}function Nsn(){return this._week.doy}function Dsn(C){var M=this.localeData().week(this);return C==null?M:this.add((C-M)*7,"d")}function jsn(C){var M=EQ(this,1,4).week;return C==null?M:this.add((C-M)*7,"d")}L("d",0,"do","day"),L("dd",0,0,function(C){return this.localeData().weekdaysMin(this,C)}),L("ddd",0,0,function(C){return this.localeData().weekdaysShort(this,C)}),L("dddd",0,0,function(C){return this.localeData().weekdays(this,C)}),L("e",0,0,"weekday"),L("E",0,0,"isoWeekday"),Ot("day","d"),Ot("weekday","e"),Ot("isoWeekday","E"),ze("day",11),ze("weekday",11),ze("isoWeekday",11),Ee("d",ji),Ee("e",ji),Ee("E",ji),Ee("dd",function(C,M){return M.weekdaysMinRegex(C)}),Ee("ddd",function(C,M){return M.weekdaysShortRegex(C)}),Ee("dddd",function(C,M){return M.weekdaysRegex(C)}),Xv(["dd","ddd","dddd"],function(C,M,D,q){var G=D._locale.weekdaysParse(C,q,D._strict);G!=null?M.d=G:m(D).invalidWeekday=C}),Xv(["d","e","E"],function(C,M,D,q){M[q]=Ve(C)});function $sn(C,M){return typeof C!="string"?C:isNaN(C)?(C=M.weekdaysParse(C),typeof C=="number"?C:null):parseInt(C,10)}function Lsn(C,M){return typeof C=="string"?M.weekdaysParse(C)%7||7:isNaN(C)?null:C}function JUe(C,M){return C.slice(M,7).concat(C.slice(0,M))}var Fsn="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),N0t="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ksn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qsn=Rr,Usn=Rr,Bsn=Rr;function zsn(C,M){var D=n(this._weekdays)?this._weekdays:this._weekdays[C&&C!==!0&&this._weekdays.isFormat.test(M)?"format":"standalone"];return C===!0?JUe(D,this._week.dow):C?D[C.day()]:D}function Vsn(C){return C===!0?JUe(this._weekdaysShort,this._week.dow):C?this._weekdaysShort[C.day()]:this._weekdaysShort}function Hsn(C){return C===!0?JUe(this._weekdaysMin,this._week.dow):C?this._weekdaysMin[C.day()]:this._weekdaysMin}function Wsn(C,M,D){var q,G,fe,De=C.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],q=0;q<7;++q)fe=f([2e3,1]).day(q),this._minWeekdaysParse[q]=this.weekdaysMin(fe,"").toLocaleLowerCase(),this._shortWeekdaysParse[q]=this.weekdaysShort(fe,"").toLocaleLowerCase(),this._weekdaysParse[q]=this.weekdays(fe,"").toLocaleLowerCase();return D?M==="dddd"?(G=nd.call(this._weekdaysParse,De),G!==-1?G:null):M==="ddd"?(G=nd.call(this._shortWeekdaysParse,De),G!==-1?G:null):(G=nd.call(this._minWeekdaysParse,De),G!==-1?G:null):M==="dddd"?(G=nd.call(this._weekdaysParse,De),G!==-1||(G=nd.call(this._shortWeekdaysParse,De),G!==-1)?G:(G=nd.call(this._minWeekdaysParse,De),G!==-1?G:null)):M==="ddd"?(G=nd.call(this._shortWeekdaysParse,De),G!==-1||(G=nd.call(this._weekdaysParse,De),G!==-1)?G:(G=nd.call(this._minWeekdaysParse,De),G!==-1?G:null)):(G=nd.call(this._minWeekdaysParse,De),G!==-1||(G=nd.call(this._weekdaysParse,De),G!==-1)?G:(G=nd.call(this._shortWeekdaysParse,De),G!==-1?G:null))}function Jsn(C,M,D){var q,G,fe;if(this._weekdaysParseExact)return Wsn.call(this,C,M,D);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),q=0;q<7;q++){if(G=f([2e3,1]).day(q),D&&!this._fullWeekdaysParse[q]&&(this._fullWeekdaysParse[q]=new RegExp("^"+this.weekdays(G,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[q]=new RegExp("^"+this.weekdaysShort(G,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[q]=new RegExp("^"+this.weekdaysMin(G,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[q]||(fe="^"+this.weekdays(G,"")+"|^"+this.weekdaysShort(G,"")+"|^"+this.weekdaysMin(G,""),this._weekdaysParse[q]=new RegExp(fe.replace(".",""),"i")),D&&M==="dddd"&&this._fullWeekdaysParse[q].test(C))return q;if(D&&M==="ddd"&&this._shortWeekdaysParse[q].test(C))return q;if(D&&M==="dd"&&this._minWeekdaysParse[q].test(C))return q;if(!D&&this._weekdaysParse[q].test(C))return q}}function Ksn(C){if(!this.isValid())return C!=null?this:NaN;var M=this._isUTC?this._d.getUTCDay():this._d.getDay();return C!=null?(C=$sn(C,this.localeData()),this.add(C-M,"d")):M}function Gsn(C){if(!this.isValid())return C!=null?this:NaN;var M=(this.day()+7-this.localeData()._week.dow)%7;return C==null?M:this.add(C-M,"d")}function Xsn(C){if(!this.isValid())return C!=null?this:NaN;if(C!=null){var M=Lsn(C,this.localeData());return this.day(this.day()%7?M:M-7)}else return this.day()||7}function Zsn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||KUe.call(this),C?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=qsn),this._weekdaysStrictRegex&&C?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ysn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||KUe.call(this),C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Usn),this._weekdaysShortStrictRegex&&C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Qsn(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||KUe.call(this),C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Bsn),this._weekdaysMinStrictRegex&&C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function KUe(){function C(Pb,kN){return kN.length-Pb.length}var M=[],D=[],q=[],G=[],fe,De,sn,pi,pu;for(fe=0;fe<7;fe++)De=f([2e3,1]).day(fe),sn=Fn(this.weekdaysMin(De,"")),pi=Fn(this.weekdaysShort(De,"")),pu=Fn(this.weekdays(De,"")),M.push(sn),D.push(pi),q.push(pu),G.push(sn),G.push(pi),G.push(pu);M.sort(C),D.sort(C),q.sort(C),G.sort(C),this._weekdaysRegex=new RegExp("^("+G.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+q.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+D.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+M.join("|")+")","i")}function GUe(){return this.hours()%12||12}function eun(){return this.hours()||24}L("H",["HH",2],0,"hour"),L("h",["hh",2],0,GUe),L("k",["kk",2],0,eun),L("hmm",0,0,function(){return""+GUe.apply(this)+Y(this.minutes(),2)}),L("hmmss",0,0,function(){return""+GUe.apply(this)+Y(this.minutes(),2)+Y(this.seconds(),2)}),L("Hmm",0,0,function(){return""+this.hours()+Y(this.minutes(),2)}),L("Hmmss",0,0,function(){return""+this.hours()+Y(this.minutes(),2)+Y(this.seconds(),2)});function D0t(C,M){L(C,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),M)})}D0t("a",!0),D0t("A",!1),Ot("hour","h"),ze("hour",13);function j0t(C,M){return M._meridiemParse}Ee("a",j0t),Ee("A",j0t),Ee("H",ji),Ee("h",ji),Ee("k",ji),Ee("HH",ji,Vi),Ee("hh",ji,Vi),Ee("kk",ji,Vi),Ee("hmm",KT),Ee("hmmss",LC),Ee("Hmm",KT),Ee("Hmmss",LC),Ei(["H","HH"],$l),Ei(["k","kk"],function(C,M,D){var q=Ve(C);M[$l]=q===24?0:q}),Ei(["a","A"],function(C,M,D){D._isPm=D._locale.isPM(C),D._meridiem=C}),Ei(["h","hh"],function(C,M,D){M[$l]=Ve(C),m(D).bigHour=!0}),Ei("hmm",function(C,M,D){var q=C.length-2;M[$l]=Ve(C.substr(0,q)),M[Eb]=Ve(C.substr(q)),m(D).bigHour=!0}),Ei("hmmss",function(C,M,D){var q=C.length-4,G=C.length-2;M[$l]=Ve(C.substr(0,q)),M[Eb]=Ve(C.substr(q,2)),M[Yv]=Ve(C.substr(G)),m(D).bigHour=!0}),Ei("Hmm",function(C,M,D){var q=C.length-2;M[$l]=Ve(C.substr(0,q)),M[Eb]=Ve(C.substr(q))}),Ei("Hmmss",function(C,M,D){var q=C.length-4,G=C.length-2;M[$l]=Ve(C.substr(0,q)),M[Eb]=Ve(C.substr(q,2)),M[Yv]=Ve(C.substr(G))});function tun(C){return(C+"").toLowerCase().charAt(0)==="p"}var run=/[ap]\.?m?\.?/i,nun=Kt("Hours",!0);function oun(C,M,D){return C>11?D?"pm":"PM":D?"am":"AM"}var $0t={calendar:B,longDateFormat:U,invalidDate:re,ordinal:le,dayOfMonthOrdinalParse:Ce,relativeTime:lt,months:bsn,monthsShort:O0t,week:Isn,weekdays:Fsn,weekdaysMin:ksn,weekdaysShort:N0t,meridiemParse:run},Ll={},PQ={},MQ;function iun(C,M){var D,q=Math.min(C.length,M.length);for(D=0;D<q;D+=1)if(C[D]!==M[D])return D;return q}function L0t(C){return C&&C.toLowerCase().replace("_","-")}function aun(C){for(var M=0,D,q,G,fe;M<C.length;){for(fe=L0t(C[M]).split("-"),D=fe.length,q=L0t(C[M+1]),q=q?q.split("-"):null;D>0;){if(G=Ape(fe.slice(0,D).join("-")),G)return G;if(q&&q.length>=D&&iun(fe,q)>=D-1)break;D--}M++}return MQ}function sun(C){return C.match("^[^/\\\\]*$")!=null}function Ape(C){var M=null,D;if(Ll[C]===void 0&&typeof BJ<"u"&&BJ&&BJ.exports&&sun(C))try{M=MQ._abbr,D=require,D("./locale/"+C),jL(M)}catch{Ll[C]=null}return Ll[C]}function jL(C,M){var D;return C&&(s(M)?D=jN(C):D=XUe(C,M),D?MQ=D:typeof console<"u"&&console.warn&&console.warn("Locale "+C+" not found. Did you forget to load it?")),MQ._abbr}function XUe(C,M){if(M!==null){var D,q=$0t;if(M.abbr=C,Ll[C]!=null)I("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."),q=Ll[C]._config;else if(M.parentLocale!=null)if(Ll[M.parentLocale]!=null)q=Ll[M.parentLocale]._config;else if(D=Ape(M.parentLocale),D!=null)q=D._config;else return PQ[M.parentLocale]||(PQ[M.parentLocale]=[]),PQ[M.parentLocale].push({name:C,config:M}),null;return Ll[C]=new k(V(q,M)),PQ[C]&&PQ[C].forEach(function(G){XUe(G.name,G.config)}),jL(C),Ll[C]}else return delete Ll[C],null}function uun(C,M){if(M!=null){var D,q,G=$0t;Ll[C]!=null&&Ll[C].parentLocale!=null?Ll[C].set(V(Ll[C]._config,M)):(q=Ape(C),q!=null&&(G=q._config),M=V(G,M),q==null&&(M.abbr=C),D=new k(M),D.parentLocale=Ll[C],Ll[C]=D),jL(C)}else Ll[C]!=null&&(Ll[C].parentLocale!=null?(Ll[C]=Ll[C].parentLocale,C===jL()&&jL(C)):Ll[C]!=null&&delete Ll[C]);return Ll[C]}function jN(C){var M;if(C&&C._locale&&C._locale._abbr&&(C=C._locale._abbr),!C)return MQ;if(!n(C)){if(M=Ape(C),M)return M;C=[C]}return aun(C)}function lun(){return X(Ll)}function ZUe(C){var M,D=C._a;return D&&m(C).overflow===-2&&(M=D[FC]<0||D[FC]>11?FC:D[Zv]<1||D[Zv]>Rpe(D[Eh],D[FC])?Zv:D[$l]<0||D[$l]>24||D[$l]===24&&(D[Eb]!==0||D[Yv]!==0||D[NN]!==0)?$l:D[Eb]<0||D[Eb]>59?Eb:D[Yv]<0||D[Yv]>59?Yv:D[NN]<0||D[NN]>999?NN:-1,m(C)._overflowDayOfYear&&(M<Eh||M>Zv)&&(M=Zv),m(C)._overflowWeeks&&M===-1&&(M=hsn),m(C)._overflowWeekday&&M===-1&&(M=gsn),m(C).overflow=M),C}var cun=/^\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)?)?$/,dun=/^\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)?)?$/,fun=/Z|[+-]\d\d(?::?\d\d)?/,Npe=[["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]],YUe=[["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/]],pun=/^\/?Date\((-?\d+)/i,mun=/^(?:(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}))$/,hun={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 F0t(C){var M,D,q=C._i,G=cun.exec(q)||dun.exec(q),fe,De,sn,pi,pu=Npe.length,Pb=YUe.length;if(G){for(m(C).iso=!0,M=0,D=pu;M<D;M++)if(Npe[M][1].exec(G[1])){De=Npe[M][0],fe=Npe[M][2]!==!1;break}if(De==null){C._isValid=!1;return}if(G[3]){for(M=0,D=Pb;M<D;M++)if(YUe[M][1].exec(G[3])){sn=(G[2]||" ")+YUe[M][0];break}if(sn==null){C._isValid=!1;return}}if(!fe&&sn!=null){C._isValid=!1;return}if(G[4])if(fun.exec(G[4]))pi="Z";else{C._isValid=!1;return}C._f=De+(sn||"")+(pi||""),eBe(C)}else C._isValid=!1}function gun(C,M,D,q,G,fe){var De=[yun(C),O0t.indexOf(M),parseInt(D,10),parseInt(q,10),parseInt(G,10)];return fe&&De.push(parseInt(fe,10)),De}function yun(C){var M=parseInt(C,10);return M<=49?2e3+M:M<=999?1900+M:M}function bun(C){return C.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function _un(C,M,D){if(C){var q=N0t.indexOf(C),G=new Date(M[0],M[1],M[2]).getDay();if(q!==G)return m(D).weekdayMismatch=!0,D._isValid=!1,!1}return!0}function vun(C,M,D){if(C)return hun[C];if(M)return 0;var q=parseInt(D,10),G=q%100,fe=(q-G)/100;return fe*60+G}function k0t(C){var M=mun.exec(bun(C._i)),D;if(M){if(D=gun(M[4],M[3],M[2],M[5],M[6],M[7]),!_un(M[1],D,C))return;C._a=D,C._tzm=vun(M[8],M[9],M[10]),C._d=OQ.apply(null,C._a),C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),m(C).rfc2822=!0}else C._isValid=!1}function wun(C){var M=pun.exec(C._i);if(M!==null){C._d=new Date(+M[1]);return}if(F0t(C),C._isValid===!1)delete C._isValid;else return;if(k0t(C),C._isValid===!1)delete C._isValid;else return;C._strict?C._isValid=!1:e.createFromInputFallback(C)}e.createFromInputFallback=P("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(C){C._d=new Date(C._i+(C._useUTC?" UTC":""))});function q6(C,M,D){return C??M??D}function Sun(C){var M=new Date(e.now());return C._useUTC?[M.getUTCFullYear(),M.getUTCMonth(),M.getUTCDate()]:[M.getFullYear(),M.getMonth(),M.getDate()]}function QUe(C){var M,D,q=[],G,fe,De;if(!C._d){for(G=Sun(C),C._w&&C._a[Zv]==null&&C._a[FC]==null&&Cun(C),C._dayOfYear!=null&&(De=q6(C._a[Eh],G[Eh]),(C._dayOfYear>TQ(De)||C._dayOfYear===0)&&(m(C)._overflowDayOfYear=!0),D=OQ(De,0,C._dayOfYear),C._a[FC]=D.getUTCMonth(),C._a[Zv]=D.getUTCDate()),M=0;M<3&&C._a[M]==null;++M)C._a[M]=q[M]=G[M];for(;M<7;M++)C._a[M]=q[M]=C._a[M]==null?M===2?1:0:C._a[M];C._a[$l]===24&&C._a[Eb]===0&&C._a[Yv]===0&&C._a[NN]===0&&(C._nextDay=!0,C._a[$l]=0),C._d=(C._useUTC?OQ:Msn).apply(null,q),fe=C._useUTC?C._d.getUTCDay():C._d.getDay(),C._tzm!=null&&C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),C._nextDay&&(C._a[$l]=24),C._w&&typeof C._w.d<"u"&&C._w.d!==fe&&(m(C).weekdayMismatch=!0)}}function Cun(C){var M,D,q,G,fe,De,sn,pi,pu;M=C._w,M.GG!=null||M.W!=null||M.E!=null?(fe=1,De=4,D=q6(M.GG,C._a[Eh],EQ(dl(),1,4).year),q=q6(M.W,1),G=q6(M.E,1),(G<1||G>7)&&(pi=!0)):(fe=C._locale._week.dow,De=C._locale._week.doy,pu=EQ(dl(),fe,De),D=q6(M.gg,C._a[Eh],pu.year),q=q6(M.w,pu.week),M.d!=null?(G=M.d,(G<0||G>6)&&(pi=!0)):M.e!=null?(G=M.e+fe,(M.e<0||M.e>6)&&(pi=!0)):G=fe),q<1||q>DN(D,fe,De)?m(C)._overflowWeeks=!0:pi!=null?m(C)._overflowWeekday=!0:(sn=A0t(D,q,G,fe,De),C._a[Eh]=sn.year,C._dayOfYear=sn.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function eBe(C){if(C._f===e.ISO_8601){F0t(C);return}if(C._f===e.RFC_2822){k0t(C);return}C._a=[],m(C).empty=!0;var M=""+C._i,D,q,G,fe,De,sn=M.length,pi=0,pu,Pb;for(G=A(C._f,C._locale).match(K)||[],Pb=G.length,D=0;D<Pb;D++)fe=G[D],q=(M.match(It(fe,C))||[])[0],q&&(De=M.substr(0,M.indexOf(q)),De.length>0&&m(C).unusedInput.push(De),M=M.slice(M.indexOf(q)+q.length),pi+=q.length),de[fe]?(q?m(C).empty=!1:m(C).unusedTokens.push(fe),DL(fe,q,C)):C._strict&&!q&&m(C).unusedTokens.push(fe);m(C).charsLeftOver=sn-pi,M.length>0&&m(C).unusedInput.push(M),C._a[$l]<=12&&m(C).bigHour===!0&&C._a[$l]>0&&(m(C).bigHour=void 0),m(C).parsedDateParts=C._a.slice(0),m(C).meridiem=C._meridiem,C._a[$l]=xun(C._locale,C._a[$l],C._meridiem),pu=m(C).era,pu!==null&&(C._a[Eh]=C._locale.erasConvertYear(pu,C._a[Eh])),QUe(C),ZUe(C)}function xun(C,M,D){var q;return D==null?M:C.meridiemHour!=null?C.meridiemHour(M,D):(C.isPM!=null&&(q=C.isPM(D),q&&M<12&&(M+=12),!q&&M===12&&(M=0)),M)}function Tun(C){var M,D,q,G,fe,De,sn=!1,pi=C._f.length;if(pi===0){m(C).invalidFormat=!0,C._d=new Date(NaN);return}for(G=0;G<pi;G++)fe=0,De=!1,M=w({},C),C._useUTC!=null&&(M._useUTC=C._useUTC),M._f=C._f[G],eBe(M),y(M)&&(De=!0),fe+=m(M).charsLeftOver,fe+=m(M).unusedTokens.length*10,m(M).score=fe,sn?fe<q&&(q=fe,D=M):(q==null||fe<q||De)&&(q=fe,D=M,De&&(sn=!0));d(C,D||M)}function Oun(C){if(!C._d){var M=Gr(C._i),D=M.day===void 0?M.date:M.day;C._a=c([M.year,M.month,D,M.hour,M.minute,M.second,M.millisecond],function(q){return q&&parseInt(q,10)}),QUe(C)}}function Eun(C){var M=new T(ZUe(q0t(C)));return M._nextDay&&(M.add(1,"d"),M._nextDay=void 0),M}function q0t(C){var M=C._i,D=C._f;return C._locale=C._locale||jN(C._l),M===null||D===void 0&&M===""?g({nullInput:!0}):(typeof M=="string"&&(C._i=M=C._locale.preparse(M)),O(M)?new T(ZUe(M)):(l(M)?C._d=M:n(D)?Tun(C):D?eBe(C):Pun(C),y(C)||(C._d=null),C))}function Pun(C){var M=C._i;s(M)?C._d=new Date(e.now()):l(M)?C._d=new Date(M.valueOf()):typeof M=="string"?wun(C):n(M)?(C._a=c(M.slice(0),function(D){return parseInt(D,10)}),QUe(C)):o(M)?Oun(C):u(M)?C._d=new Date(M):e.createFromInputFallback(C)}function U0t(C,M,D,q,G){var fe={};return(M===!0||M===!1)&&(q=M,M=void 0),(D===!0||D===!1)&&(q=D,D=void 0),(o(C)&&a(C)||n(C)&&C.length===0)&&(C=void 0),fe._isAMomentObject=!0,fe._useUTC=fe._isUTC=G,fe._l=D,fe._i=C,fe._f=M,fe._strict=q,Eun(fe)}function dl(C,M,D,q){return U0t(C,M,D,q,!1)}var Mun=P("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=dl.apply(null,arguments);return this.isValid()&&C.isValid()?C<this?this:C:g()}),Run=P("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=dl.apply(null,arguments);return this.isValid()&&C.isValid()?C>this?this:C:g()});function B0t(C,M){var D,q;if(M.length===1&&n(M[0])&&(M=M[0]),!M.length)return dl();for(D=M[0],q=1;q<M.length;++q)(!M[q].isValid()||M[q][C](D))&&(D=M[q]);return D}function Iun(){var C=[].slice.call(arguments,0);return B0t("isBefore",C)}function Aun(){var C=[].slice.call(arguments,0);return B0t("isAfter",C)}var Nun=function(){return Date.now?Date.now():+new Date},RQ=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Dun(C){var M,D=!1,q,G=RQ.length;for(M in C)if(i(C,M)&&!(nd.call(RQ,M)!==-1&&(C[M]==null||!isNaN(C[M]))))return!1;for(q=0;q<G;++q)if(C[RQ[q]]){if(D)return!1;parseFloat(C[RQ[q]])!==Ve(C[RQ[q]])&&(D=!0)}return!0}function jun(){return this._isValid}function $un(){return kC(NaN)}function Dpe(C){var M=Gr(C),D=M.year||0,q=M.quarter||0,G=M.month||0,fe=M.week||M.isoWeek||0,De=M.day||0,sn=M.hour||0,pi=M.minute||0,pu=M.second||0,Pb=M.millisecond||0;this._isValid=Dun(M),this._milliseconds=+Pb+pu*1e3+pi*6e4+sn*1e3*60*60,this._days=+De+fe*7,this._months=+G+q*3+D*12,this._data={},this._locale=jN(),this._bubble()}function jpe(C){return C instanceof Dpe}function tBe(C){return C<0?Math.round(-1*C)*-1:Math.round(C)}function Lun(C,M,D){var q=Math.min(C.length,M.length),G=Math.abs(C.length-M.length),fe=0,De;for(De=0;De<q;De++)(D&&C[De]!==M[De]||!D&&Ve(C[De])!==Ve(M[De]))&&fe++;return fe+G}function z0t(C,M){L(C,0,0,function(){var D=this.utcOffset(),q="+";return D<0&&(D=-D,q="-"),q+Y(~~(D/60),2)+M+Y(~~D%60,2)})}z0t("Z",":"),z0t("ZZ",""),Ee("Z",ll),Ee("ZZ",ll),Ei(["Z","ZZ"],function(C,M,D){D._useUTC=!0,D._tzm=rBe(ll,C)});var Fun=/([\+\-]|\d\d)/gi;function rBe(C,M){var D=(M||"").match(C),q,G,fe;return D===null?null:(q=D[D.length-1]||[],G=(q+"").match(Fun)||["-",0,0],fe=+(G[1]*60)+Ve(G[2]),fe===0?0:G[0]==="+"?fe:-fe)}function nBe(C,M){var D,q;return M._isUTC?(D=M.clone(),q=(O(C)||l(C)?C.valueOf():dl(C).valueOf())-D.valueOf(),D._d.setTime(D._d.valueOf()+q),e.updateOffset(D,!1),D):dl(C).local()}function oBe(C){return-Math.round(C._d.getTimezoneOffset())}e.updateOffset=function(){};function kun(C,M,D){var q=this._offset||0,G;if(!this.isValid())return C!=null?this:NaN;if(C!=null){if(typeof C=="string"){if(C=rBe(ll,C),C===null)return this}else Math.abs(C)<16&&!D&&(C=C*60);return!this._isUTC&&M&&(G=oBe(this)),this._offset=C,this._isUTC=!0,G!=null&&this.add(G,"m"),q!==C&&(!M||this._changeInProgress?J0t(this,kC(C-q,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?q:oBe(this)}function qun(C,M){return C!=null?(typeof C!="string"&&(C=-C),this.utcOffset(C,M),this):-this.utcOffset()}function Uun(C){return this.utcOffset(0,C)}function zun(C){return this._isUTC&&(this.utcOffset(0,C),this._isUTC=!1,C&&this.subtract(oBe(this),"m")),this}function Vun(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var C=rBe(xd,this._i);C!=null?this.utcOffset(C):this.utcOffset(0,!0)}return this}function Hun(C){return this.isValid()?(C=C?dl(C).utcOffset():0,(this.utcOffset()-C)%60===0):!1}function Wun(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Jun(){if(!s(this._isDSTShifted))return this._isDSTShifted;var C={},M;return w(C,this),C=q0t(C),C._a?(M=C._isUTC?f(C._a):dl(C._a),this._isDSTShifted=this.isValid()&&Lun(C._a,M.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Kun(){return this.isValid()?!this._isUTC:!1}function Gun(){return this.isValid()?this._isUTC:!1}function V0t(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Xun=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Zun=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function kC(C,M){var D=C,q=null,G,fe,De;return jpe(C)?D={ms:C._milliseconds,d:C._days,M:C._months}:u(C)||!isNaN(+C)?(D={},M?D[M]=+C:D.milliseconds=+C):(q=Xun.exec(C))?(G=q[1]==="-"?-1:1,D={y:0,d:Ve(q[Zv])*G,h:Ve(q[$l])*G,m:Ve(q[Eb])*G,s:Ve(q[Yv])*G,ms:Ve(tBe(q[NN]*1e3))*G}):(q=Zun.exec(C))?(G=q[1]==="-"?-1:1,D={y:Ez(q[2],G),M:Ez(q[3],G),w:Ez(q[4],G),d:Ez(q[5],G),h:Ez(q[6],G),m:Ez(q[7],G),s:Ez(q[8],G)}):D==null?D={}:typeof D=="object"&&("from"in D||"to"in D)&&(De=Yun(dl(D.from),dl(D.to)),D={},D.ms=De.milliseconds,D.M=De.months),fe=new Dpe(D),jpe(C)&&i(C,"_locale")&&(fe._locale=C._locale),jpe(C)&&i(C,"_isValid")&&(fe._isValid=C._isValid),fe}kC.fn=Dpe.prototype,kC.invalid=$un;function Ez(C,M){var D=C&&parseFloat(C.replace(",","."));return(isNaN(D)?0:D)*M}function H0t(C,M){var D={};return D.months=M.month()-C.month()+(M.year()-C.year())*12,C.clone().add(D.months,"M").isAfter(M)&&--D.months,D.milliseconds=+M-+C.clone().add(D.months,"M"),D}function Yun(C,M){var D;return C.isValid()&&M.isValid()?(M=nBe(M,C),C.isBefore(M)?D=H0t(C,M):(D=H0t(M,C),D.milliseconds=-D.milliseconds,D.months=-D.months),D):{milliseconds:0,months:0}}function W0t(C,M){return function(D,q){var G,fe;return q!==null&&!isNaN(+q)&&(I(M,"moment()."+M+"(period, number) is deprecated. Please use moment()."+M+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),fe=D,D=q,q=fe),G=kC(D,q),J0t(this,G,C),this}}function J0t(C,M,D,q){var G=M._milliseconds,fe=tBe(M._days),De=tBe(M._months);C.isValid()&&(q=q??!0,De&&P0t(C,so(C,"Month")+De*D),fe&&iu(C,"Date",so(C,"Date")+fe*D),G&&C._d.setTime(C._d.valueOf()+G*D),q&&e.updateOffset(C,fe||De))}var Qun=W0t(1,"add"),eln=W0t(-1,"subtract");function K0t(C){return typeof C=="string"||C instanceof String}function tln(C){return O(C)||l(C)||K0t(C)||u(C)||nln(C)||rln(C)||C===null||C===void 0}function rln(C){var M=o(C)&&!a(C),D=!1,q=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],G,fe,De=q.length;for(G=0;G<De;G+=1)fe=q[G],D=D||i(C,fe);return M&&D}function nln(C){var M=n(C),D=!1;return M&&(D=C.filter(function(q){return!u(q)&&K0t(C)}).length===0),M&&D}function oln(C){var M=o(C)&&!a(C),D=!1,q=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],G,fe;for(G=0;G<q.length;G+=1)fe=q[G],D=D||i(C,fe);return M&&D}function iln(C,M){var D=C.diff(M,"days",!0);return D<-6?"sameElse":D<-1?"lastWeek":D<0?"lastDay":D<1?"sameDay":D<2?"nextDay":D<7?"nextWeek":"sameElse"}function aln(C,M){arguments.length===1&&(arguments[0]?tln(arguments[0])?(C=arguments[0],M=void 0):oln(arguments[0])&&(M=arguments[0],C=void 0):(C=void 0,M=void 0));var D=C||dl(),q=nBe(D,this).startOf("day"),G=e.calendarFormat(this,q)||"sameElse",fe=M&&(N(M[G])?M[G].call(this,D):M[G]);return this.format(fe||this.localeData().calendar(G,this,dl(D)))}function sln(){return new T(this)}function uln(C,M){var D=O(C)?C:dl(C);return this.isValid()&&D.isValid()?(M=je(M)||"millisecond",M==="millisecond"?this.valueOf()>D.valueOf():D.valueOf()<this.clone().startOf(M).valueOf()):!1}function lln(C,M){var D=O(C)?C:dl(C);return this.isValid()&&D.isValid()?(M=je(M)||"millisecond",M==="millisecond"?this.valueOf()<D.valueOf():this.clone().endOf(M).valueOf()<D.valueOf()):!1}function cln(C,M,D,q){var G=O(C)?C:dl(C),fe=O(M)?M:dl(M);return this.isValid()&&G.isValid()&&fe.isValid()?(q=q||"()",(q[0]==="("?this.isAfter(G,D):!this.isBefore(G,D))&&(q[1]===")"?this.isBefore(fe,D):!this.isAfter(fe,D))):!1}function dln(C,M){var D=O(C)?C:dl(C),q;return this.isValid()&&D.isValid()?(M=je(M)||"millisecond",M==="millisecond"?this.valueOf()===D.valueOf():(q=D.valueOf(),this.clone().startOf(M).valueOf()<=q&&q<=this.clone().endOf(M).valueOf())):!1}function fln(C,M){return this.isSame(C,M)||this.isAfter(C,M)}function pln(C,M){return this.isSame(C,M)||this.isBefore(C,M)}function mln(C,M,D){var q,G,fe;if(!this.isValid())return NaN;if(q=nBe(C,this),!q.isValid())return NaN;switch(G=(q.utcOffset()-this.utcOffset())*6e4,M=je(M),M){case"year":fe=$pe(this,q)/12;break;case"month":fe=$pe(this,q);break;case"quarter":fe=$pe(this,q)/3;break;case"second":fe=(this-q)/1e3;break;case"minute":fe=(this-q)/6e4;break;case"hour":fe=(this-q)/36e5;break;case"day":fe=(this-q-G)/864e5;break;case"week":fe=(this-q-G)/6048e5;break;default:fe=this-q}return D?fe:Ue(fe)}function $pe(C,M){if(C.date()<M.date())return-$pe(M,C);var D=(M.year()-C.year())*12+(M.month()-C.month()),q=C.clone().add(D,"months"),G,fe;return M-q<0?(G=C.clone().add(D-1,"months"),fe=(M-q)/(q-G)):(G=C.clone().add(D+1,"months"),fe=(M-q)/(G-q)),-(D+fe)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function hln(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function gln(C){if(!this.isValid())return null;var M=C!==!0,D=M?this.clone().utc():this;return D.year()<0||D.year()>9999?j(D,M?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):N(Date.prototype.toISOString)?M?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",j(D,"Z")):j(D,M?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function yln(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var C="moment",M="",D,q,G,fe;return this.isLocal()||(C=this.utcOffset()===0?"moment.utc":"moment.parseZone",M="Z"),D="["+C+'("]',q=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",G="-MM-DD[T]HH:mm:ss.SSS",fe=M+'[")]',this.format(D+q+G+fe)}function bln(C){C||(C=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var M=j(this,C);return this.localeData().postformat(M)}function _ln(C,M){return this.isValid()&&(O(C)&&C.isValid()||dl(C).isValid())?kC({to:this,from:C}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function vln(C){return this.from(dl(),C)}function wln(C,M){return this.isValid()&&(O(C)&&C.isValid()||dl(C).isValid())?kC({from:this,to:C}).locale(this.locale()).humanize(!M):this.localeData().invalidDate()}function Sln(C){return this.to(dl(),C)}function G0t(C){var M;return C===void 0?this._locale._abbr:(M=jN(C),M!=null&&(this._locale=M),this)}var X0t=P("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(C){return C===void 0?this.localeData():this.locale(C)});function Z0t(){return this._locale}var Lpe=1e3,U6=60*Lpe,Fpe=60*U6,Y0t=(365*400+97)*24*Fpe;function B6(C,M){return(C%M+M)%M}function Q0t(C,M,D){return C<100&&C>=0?new Date(C+400,M,D)-Y0t:new Date(C,M,D).valueOf()}function eCt(C,M,D){return C<100&&C>=0?Date.UTC(C+400,M,D)-Y0t:Date.UTC(C,M,D)}function Cln(C){var M,D;if(C=je(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(D=this._isUTC?eCt:Q0t,C){case"year":M=D(this.year(),0,1);break;case"quarter":M=D(this.year(),this.month()-this.month()%3,1);break;case"month":M=D(this.year(),this.month(),1);break;case"week":M=D(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":M=D(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":M=D(this.year(),this.month(),this.date());break;case"hour":M=this._d.valueOf(),M-=B6(M+(this._isUTC?0:this.utcOffset()*U6),Fpe);break;case"minute":M=this._d.valueOf(),M-=B6(M,U6);break;case"second":M=this._d.valueOf(),M-=B6(M,Lpe);break}return this._d.setTime(M),e.updateOffset(this,!0),this}function xln(C){var M,D;if(C=je(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(D=this._isUTC?eCt:Q0t,C){case"year":M=D(this.year()+1,0,1)-1;break;case"quarter":M=D(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":M=D(this.year(),this.month()+1,1)-1;break;case"week":M=D(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":M=D(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":M=D(this.year(),this.month(),this.date()+1)-1;break;case"hour":M=this._d.valueOf(),M+=Fpe-B6(M+(this._isUTC?0:this.utcOffset()*U6),Fpe)-1;break;case"minute":M=this._d.valueOf(),M+=U6-B6(M,U6)-1;break;case"second":M=this._d.valueOf(),M+=Lpe-B6(M,Lpe)-1;break}return this._d.setTime(M),e.updateOffset(this,!0),this}function Tln(){return this._d.valueOf()-(this._offset||0)*6e4}function Oln(){return Math.floor(this.valueOf()/1e3)}function Eln(){return new Date(this.valueOf())}function Pln(){var C=this;return[C.year(),C.month(),C.date(),C.hour(),C.minute(),C.second(),C.millisecond()]}function Mln(){var C=this;return{years:C.year(),months:C.month(),date:C.date(),hours:C.hours(),minutes:C.minutes(),seconds:C.seconds(),milliseconds:C.milliseconds()}}function Rln(){return this.isValid()?this.toISOString():null}function Iln(){return y(this)}function Aln(){return d({},m(this))}function Nln(){return m(this).overflow}function Dln(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}L("N",0,0,"eraAbbr"),L("NN",0,0,"eraAbbr"),L("NNN",0,0,"eraAbbr"),L("NNNN",0,0,"eraName"),L("NNNNN",0,0,"eraNarrow"),L("y",["y",1],"yo","eraYear"),L("y",["yy",2],0,"eraYear"),L("y",["yyy",3],0,"eraYear"),L("y",["yyyy",4],0,"eraYear"),Ee("N",iBe),Ee("NN",iBe),Ee("NNN",iBe),Ee("NNNN",Hln),Ee("NNNNN",Wln),Ei(["N","NN","NNN","NNNN","NNNNN"],function(C,M,D,q){var G=D._locale.erasParse(C,q,D._strict);G?m(D).era=G:m(D).invalidEra=C}),Ee("y",Mu),Ee("yy",Mu),Ee("yyy",Mu),Ee("yyyy",Mu),Ee("yo",Jln),Ei(["y","yy","yyy","yyyy"],Eh),Ei(["yo"],function(C,M,D,q){var G;D._locale._eraYearOrdinalRegex&&(G=C.match(D._locale._eraYearOrdinalRegex)),D._locale.eraYearOrdinalParse?M[Eh]=D._locale.eraYearOrdinalParse(C,G):M[Eh]=parseInt(C,10)});function jln(C,M){var D,q,G,fe=this._eras||jN("en")._eras;for(D=0,q=fe.length;D<q;++D){switch(typeof fe[D].since){case"string":G=e(fe[D].since).startOf("day"),fe[D].since=G.valueOf();break}switch(typeof fe[D].until){case"undefined":fe[D].until=1/0;break;case"string":G=e(fe[D].until).startOf("day").valueOf(),fe[D].until=G.valueOf();break}}return fe}function $ln(C,M,D){var q,G,fe=this.eras(),De,sn,pi;for(C=C.toUpperCase(),q=0,G=fe.length;q<G;++q)if(De=fe[q].name.toUpperCase(),sn=fe[q].abbr.toUpperCase(),pi=fe[q].narrow.toUpperCase(),D)switch(M){case"N":case"NN":case"NNN":if(sn===C)return fe[q];break;case"NNNN":if(De===C)return fe[q];break;case"NNNNN":if(pi===C)return fe[q];break}else if([De,sn,pi].indexOf(C)>=0)return fe[q]}function Lln(C,M){var D=C.since<=C.until?1:-1;return M===void 0?e(C.since).year():e(C.since).year()+(M-C.offset)*D}function Fln(){var C,M,D,q=this.localeData().eras();for(C=0,M=q.length;C<M;++C)if(D=this.clone().startOf("day").valueOf(),q[C].since<=D&&D<=q[C].until||q[C].until<=D&&D<=q[C].since)return q[C].name;return""}function kln(){var C,M,D,q=this.localeData().eras();for(C=0,M=q.length;C<M;++C)if(D=this.clone().startOf("day").valueOf(),q[C].since<=D&&D<=q[C].until||q[C].until<=D&&D<=q[C].since)return q[C].narrow;return""}function qln(){var C,M,D,q=this.localeData().eras();for(C=0,M=q.length;C<M;++C)if(D=this.clone().startOf("day").valueOf(),q[C].since<=D&&D<=q[C].until||q[C].until<=D&&D<=q[C].since)return q[C].abbr;return""}function Uln(){var C,M,D,q,G=this.localeData().eras();for(C=0,M=G.length;C<M;++C)if(D=G[C].since<=G[C].until?1:-1,q=this.clone().startOf("day").valueOf(),G[C].since<=q&&q<=G[C].until||G[C].until<=q&&q<=G[C].since)return(this.year()-e(G[C].since).year())*D+G[C].offset;return this.year()}function Bln(C){return i(this,"_erasNameRegex")||aBe.call(this),C?this._erasNameRegex:this._erasRegex}function zln(C){return i(this,"_erasAbbrRegex")||aBe.call(this),C?this._erasAbbrRegex:this._erasRegex}function Vln(C){return i(this,"_erasNarrowRegex")||aBe.call(this),C?this._erasNarrowRegex:this._erasRegex}function iBe(C,M){return M.erasAbbrRegex(C)}function Hln(C,M){return M.erasNameRegex(C)}function Wln(C,M){return M.erasNarrowRegex(C)}function Jln(C,M){return M._eraYearOrdinalRegex||Mu}function aBe(){var C=[],M=[],D=[],q=[],G,fe,De=this.eras();for(G=0,fe=De.length;G<fe;++G)M.push(Fn(De[G].name)),C.push(Fn(De[G].abbr)),D.push(Fn(De[G].narrow)),q.push(Fn(De[G].name)),q.push(Fn(De[G].abbr)),q.push(Fn(De[G].narrow));this._erasRegex=new RegExp("^("+q.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+M.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+C.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+D.join("|")+")","i")}L(0,["gg",2],0,function(){return this.weekYear()%100}),L(0,["GG",2],0,function(){return this.isoWeekYear()%100});function kpe(C,M){L(0,[C,C.length],0,M)}kpe("gggg","weekYear"),kpe("ggggg","weekYear"),kpe("GGGG","isoWeekYear"),kpe("GGGGG","isoWeekYear"),Ot("weekYear","gg"),Ot("isoWeekYear","GG"),ze("weekYear",1),ze("isoWeekYear",1),Ee("G",Mm),Ee("g",Mm),Ee("GG",ji,Vi),Ee("gg",ji,Vi),Ee("GGGG",Gs,wg),Ee("gggg",Gs,wg),Ee("GGGGG",jl,yS),Ee("ggggg",jl,yS),Xv(["gggg","ggggg","GGGG","GGGGG"],function(C,M,D,q){M[q.substr(0,2)]=Ve(C)}),Xv(["gg","GG"],function(C,M,D,q){M[q]=e.parseTwoDigitYear(C)});function Kln(C){return tCt.call(this,C,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Gln(C){return tCt.call(this,C,this.isoWeek(),this.isoWeekday(),1,4)}function Xln(){return DN(this.year(),1,4)}function Zln(){return DN(this.isoWeekYear(),1,4)}function Yln(){var C=this.localeData()._week;return DN(this.year(),C.dow,C.doy)}function Qln(){var C=this.localeData()._week;return DN(this.weekYear(),C.dow,C.doy)}function tCt(C,M,D,q,G){var fe;return C==null?EQ(this,q,G).year:(fe=DN(C,q,G),M>fe&&(M=fe),ecn.call(this,C,M,D,q,G))}function ecn(C,M,D,q,G){var fe=A0t(C,M,D,q,G),De=OQ(fe.year,0,fe.dayOfYear);return this.year(De.getUTCFullYear()),this.month(De.getUTCMonth()),this.date(De.getUTCDate()),this}L("Q",0,"Qo","quarter"),Ot("quarter","Q"),ze("quarter",7),Ee("Q",Dl),Ei("Q",function(C,M){M[FC]=(Ve(C)-1)*3});function tcn(C){return C==null?Math.ceil((this.month()+1)/3):this.month((C-1)*3+this.month()%3)}L("D",["DD",2],"Do","date"),Ot("date","D"),ze("date",9),Ee("D",ji),Ee("DD",ji,Vi),Ee("Do",function(C,M){return C?M._dayOfMonthOrdinalParse||M._ordinalParse:M._dayOfMonthOrdinalParseLenient}),Ei(["D","DD"],Zv),Ei("Do",function(C,M){M[Zv]=Ve(C.match(ji)[0])});var rCt=Kt("Date",!0);L("DDD",["DDDD",3],"DDDo","dayOfYear"),Ot("dayOfYear","DDD"),ze("dayOfYear",4),Ee("DDD",bS),Ee("DDDD",O_),Ei(["DDD","DDDD"],function(C,M,D){D._dayOfYear=Ve(C)});function rcn(C){var M=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return C==null?M:this.add(C-M,"d")}L("m",["mm",2],0,"minute"),Ot("minute","m"),ze("minute",14),Ee("m",ji),Ee("mm",ji,Vi),Ei(["m","mm"],Eb);var ncn=Kt("Minutes",!1);L("s",["ss",2],0,"second"),Ot("second","s"),ze("second",15),Ee("s",ji),Ee("ss",ji,Vi),Ei(["s","ss"],Yv);var ocn=Kt("Seconds",!1);L("S",0,0,function(){return~~(this.millisecond()/100)}),L(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),L(0,["SSS",3],0,"millisecond"),L(0,["SSSS",4],0,function(){return this.millisecond()*10}),L(0,["SSSSS",5],0,function(){return this.millisecond()*100}),L(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),L(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),L(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),L(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Ot("millisecond","ms"),ze("millisecond",16),Ee("S",bS,Dl),Ee("SS",bS,Vi),Ee("SSS",bS,O_);var $L,nCt;for($L="SSSS";$L.length<=9;$L+="S")Ee($L,Mu);function icn(C,M){M[NN]=Ve(("0."+C)*1e3)}for($L="S";$L.length<=9;$L+="S")Ei($L,icn);nCt=Kt("Milliseconds",!1),L("z",0,0,"zoneAbbr"),L("zz",0,0,"zoneName");function acn(){return this._isUTC?"UTC":""}function scn(){return this._isUTC?"Coordinated Universal Time":""}var dt=T.prototype;dt.add=Qun,dt.calendar=aln,dt.clone=sln,dt.diff=mln,dt.endOf=xln,dt.format=bln,dt.from=_ln,dt.fromNow=vln,dt.to=wln,dt.toNow=Sln,dt.get=An,dt.invalidAt=Nln,dt.isAfter=uln,dt.isBefore=lln,dt.isBetween=cln,dt.isSame=dln,dt.isSameOrAfter=fln,dt.isSameOrBefore=pln,dt.isValid=Iln,dt.lang=X0t,dt.locale=G0t,dt.localeData=Z0t,dt.max=Run,dt.min=Mun,dt.parsingFlags=Aln,dt.set=Si,dt.startOf=Cln,dt.subtract=eln,dt.toArray=Pln,dt.toObject=Mln,dt.toDate=Eln,dt.toISOString=gln,dt.inspect=yln,typeof Symbol<"u"&&Symbol.for!=null&&(dt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),dt.toJSON=Rln,dt.toString=hln,dt.unix=Oln,dt.valueOf=Tln,dt.creationData=Dln,dt.eraName=Fln,dt.eraNarrow=kln,dt.eraAbbr=qln,dt.eraYear=Uln,dt.year=I0t,dt.isLeapYear=Psn,dt.weekYear=Kln,dt.isoWeekYear=Gln,dt.quarter=dt.quarters=tcn,dt.month=M0t,dt.daysInMonth=Tsn,dt.week=dt.weeks=Dsn,dt.isoWeek=dt.isoWeeks=jsn,dt.weeksInYear=Yln,dt.weeksInWeekYear=Qln,dt.isoWeeksInYear=Xln,dt.isoWeeksInISOWeekYear=Zln,dt.date=rCt,dt.day=dt.days=Ksn,dt.weekday=Gsn,dt.isoWeekday=Xsn,dt.dayOfYear=rcn,dt.hour=dt.hours=nun,dt.minute=dt.minutes=ncn,dt.second=dt.seconds=ocn,dt.millisecond=dt.milliseconds=nCt,dt.utcOffset=kun,dt.utc=Uun,dt.local=zun,dt.parseZone=Vun,dt.hasAlignedHourOffset=Hun,dt.isDST=Wun,dt.isLocal=Kun,dt.isUtcOffset=Gun,dt.isUtc=V0t,dt.isUTC=V0t,dt.zoneAbbr=acn,dt.zoneName=scn,dt.dates=P("dates accessor is deprecated. Use date instead.",rCt),dt.months=P("months accessor is deprecated. Use month instead",M0t),dt.years=P("years accessor is deprecated. Use year instead",I0t),dt.zone=P("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",qun),dt.isDSTShifted=P("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Jun);function ucn(C){return dl(C*1e3)}function lcn(){return dl.apply(null,arguments).parseZone()}function oCt(C){return C}var ss=k.prototype;ss.calendar=Q,ss.longDateFormat=H,ss.invalidDate=Z,ss.ordinal=He,ss.preparse=oCt,ss.postformat=oCt,ss.relativeTime=qe,ss.pastFuture=Nt,ss.set=z,ss.eras=jln,ss.erasParse=$ln,ss.erasConvertYear=Lln,ss.erasAbbrRegex=zln,ss.erasNameRegex=Bln,ss.erasNarrowRegex=Vln,ss.months=wsn,ss.monthsShort=Ssn,ss.monthsParse=xsn,ss.monthsRegex=Esn,ss.monthsShortRegex=Osn,ss.week=Rsn,ss.firstDayOfYear=Nsn,ss.firstDayOfWeek=Asn,ss.weekdays=zsn,ss.weekdaysMin=Hsn,ss.weekdaysShort=Vsn,ss.weekdaysParse=Jsn,ss.weekdaysRegex=Zsn,ss.weekdaysShortRegex=Ysn,ss.weekdaysMinRegex=Qsn,ss.isPM=tun,ss.meridiem=oun;function qpe(C,M,D,q){var G=jN(),fe=f().set(q,M);return G[D](fe,C)}function iCt(C,M,D){if(u(C)&&(M=C,C=void 0),C=C||"",M!=null)return qpe(C,M,D,"month");var q,G=[];for(q=0;q<12;q++)G[q]=qpe(C,q,D,"month");return G}function sBe(C,M,D,q){typeof C=="boolean"?(u(M)&&(D=M,M=void 0),M=M||""):(M=C,D=M,C=!1,u(M)&&(D=M,M=void 0),M=M||"");var G=jN(),fe=C?G._week.dow:0,De,sn=[];if(D!=null)return qpe(M,(D+fe)%7,q,"day");for(De=0;De<7;De++)sn[De]=qpe(M,(De+fe)%7,q,"day");return sn}function ccn(C,M){return iCt(C,M,"months")}function dcn(C,M){return iCt(C,M,"monthsShort")}function fcn(C,M,D){return sBe(C,M,D,"weekdays")}function pcn(C,M,D){return sBe(C,M,D,"weekdaysShort")}function mcn(C,M,D){return sBe(C,M,D,"weekdaysMin")}jL("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(C){var M=C%10,D=Ve(C%100/10)===1?"th":M===1?"st":M===2?"nd":M===3?"rd":"th";return C+D}}),e.lang=P("moment.lang is deprecated. Use moment.locale instead.",jL),e.langData=P("moment.langData is deprecated. Use moment.localeData instead.",jN);var $N=Math.abs;function hcn(){var C=this._data;return this._milliseconds=$N(this._milliseconds),this._days=$N(this._days),this._months=$N(this._months),C.milliseconds=$N(C.milliseconds),C.seconds=$N(C.seconds),C.minutes=$N(C.minutes),C.hours=$N(C.hours),C.months=$N(C.months),C.years=$N(C.years),this}function aCt(C,M,D,q){var G=kC(M,D);return C._milliseconds+=q*G._milliseconds,C._days+=q*G._days,C._months+=q*G._months,C._bubble()}function gcn(C,M){return aCt(this,C,M,1)}function ycn(C,M){return aCt(this,C,M,-1)}function sCt(C){return C<0?Math.floor(C):Math.ceil(C)}function bcn(){var C=this._milliseconds,M=this._days,D=this._months,q=this._data,G,fe,De,sn,pi;return C>=0&&M>=0&&D>=0||C<=0&&M<=0&&D<=0||(C+=sCt(uBe(D)+M)*864e5,M=0,D=0),q.milliseconds=C%1e3,G=Ue(C/1e3),q.seconds=G%60,fe=Ue(G/60),q.minutes=fe%60,De=Ue(fe/60),q.hours=De%24,M+=Ue(De/24),pi=Ue(uCt(M)),D+=pi,M-=sCt(uBe(pi)),sn=Ue(D/12),D%=12,q.days=M,q.months=D,q.years=sn,this}function uCt(C){return C*4800/146097}function uBe(C){return C*146097/4800}function _cn(C){if(!this.isValid())return NaN;var M,D,q=this._milliseconds;if(C=je(C),C==="month"||C==="quarter"||C==="year")switch(M=this._days+q/864e5,D=this._months+uCt(M),C){case"month":return D;case"quarter":return D/3;case"year":return D/12}else switch(M=this._days+Math.round(uBe(this._months)),C){case"week":return M/7+q/6048e5;case"day":return M+q/864e5;case"hour":return M*24+q/36e5;case"minute":return M*1440+q/6e4;case"second":return M*86400+q/1e3;case"millisecond":return Math.floor(M*864e5)+q;default:throw new Error("Unknown unit "+C)}}function vcn(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Ve(this._months/12)*31536e6:NaN}function LN(C){return function(){return this.as(C)}}var wcn=LN("ms"),Scn=LN("s"),Ccn=LN("m"),xcn=LN("h"),Tcn=LN("d"),Ocn=LN("w"),Ecn=LN("M"),Pcn=LN("Q"),Mcn=LN("y");function Rcn(){return kC(this)}function Icn(C){return C=je(C),this.isValid()?this[C+"s"]():NaN}function Pz(C){return function(){return this.isValid()?this._data[C]:NaN}}var Acn=Pz("milliseconds"),Ncn=Pz("seconds"),Dcn=Pz("minutes"),jcn=Pz("hours"),$cn=Pz("days"),Lcn=Pz("months"),Fcn=Pz("years");function kcn(){return Ue(this.days()/7)}var FN=Math.round,z6={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function qcn(C,M,D,q,G){return G.relativeTime(M||1,!!D,C,q)}function Ucn(C,M,D,q){var G=kC(C).abs(),fe=FN(G.as("s")),De=FN(G.as("m")),sn=FN(G.as("h")),pi=FN(G.as("d")),pu=FN(G.as("M")),Pb=FN(G.as("w")),kN=FN(G.as("y")),LL=fe<=D.ss&&["s",fe]||fe<D.s&&["ss",fe]||De<=1&&["m"]||De<D.m&&["mm",De]||sn<=1&&["h"]||sn<D.h&&["hh",sn]||pi<=1&&["d"]||pi<D.d&&["dd",pi];return D.w!=null&&(LL=LL||Pb<=1&&["w"]||Pb<D.w&&["ww",Pb]),LL=LL||pu<=1&&["M"]||pu<D.M&&["MM",pu]||kN<=1&&["y"]||["yy",kN],LL[2]=M,LL[3]=+C>0,LL[4]=q,qcn.apply(null,LL)}function Bcn(C){return C===void 0?FN:typeof C=="function"?(FN=C,!0):!1}function zcn(C,M){return z6[C]===void 0?!1:M===void 0?z6[C]:(z6[C]=M,C==="s"&&(z6.ss=M-1),!0)}function Vcn(C,M){if(!this.isValid())return this.localeData().invalidDate();var D=!1,q=z6,G,fe;return typeof C=="object"&&(M=C,C=!1),typeof C=="boolean"&&(D=C),typeof M=="object"&&(q=Object.assign({},z6,M),M.s!=null&&M.ss==null&&(q.ss=M.s-1)),G=this.localeData(),fe=Ucn(this,!D,q,G),D&&(fe=G.pastFuture(+this,fe)),G.postformat(fe)}var lBe=Math.abs;function V6(C){return(C>0)-(C<0)||+C}function Upe(){if(!this.isValid())return this.localeData().invalidDate();var C=lBe(this._milliseconds)/1e3,M=lBe(this._days),D=lBe(this._months),q,G,fe,De,sn=this.asSeconds(),pi,pu,Pb,kN;return sn?(q=Ue(C/60),G=Ue(q/60),C%=60,q%=60,fe=Ue(D/12),D%=12,De=C?C.toFixed(3).replace(/\.?0+$/,""):"",pi=sn<0?"-":"",pu=V6(this._months)!==V6(sn)?"-":"",Pb=V6(this._days)!==V6(sn)?"-":"",kN=V6(this._milliseconds)!==V6(sn)?"-":"",pi+"P"+(fe?pu+fe+"Y":"")+(D?pu+D+"M":"")+(M?Pb+M+"D":"")+(G||q||C?"T":"")+(G?kN+G+"H":"")+(q?kN+q+"M":"")+(C?kN+De+"S":"")):"P0D"}var ea=Dpe.prototype;ea.isValid=jun,ea.abs=hcn,ea.add=gcn,ea.subtract=ycn,ea.as=_cn,ea.asMilliseconds=wcn,ea.asSeconds=Scn,ea.asMinutes=Ccn,ea.asHours=xcn,ea.asDays=Tcn,ea.asWeeks=Ocn,ea.asMonths=Ecn,ea.asQuarters=Pcn,ea.asYears=Mcn,ea.valueOf=vcn,ea._bubble=bcn,ea.clone=Rcn,ea.get=Icn,ea.milliseconds=Acn,ea.seconds=Ncn,ea.minutes=Dcn,ea.hours=jcn,ea.days=$cn,ea.weeks=kcn,ea.months=Lcn,ea.years=Fcn,ea.humanize=Vcn,ea.toISOString=Upe,ea.toString=Upe,ea.toJSON=Upe,ea.locale=G0t,ea.localeData=Z0t,ea.toIsoString=P("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Upe),ea.lang=X0t,L("X",0,0,"unix"),L("x",0,0,"valueOf"),Ee("x",Mm),Ee("X",rt),Ei("X",function(C,M,D){D._d=new Date(parseFloat(C)*1e3)}),Ei("x",function(C,M,D){D._d=new Date(Ve(C))});return e.version="2.29.4",r(dl),e.fn=dt,e.min=Iun,e.max=Aun,e.now=Nun,e.utc=f,e.unix=ucn,e.months=ccn,e.isDate=l,e.locale=jL,e.invalid=g,e.duration=kC,e.isMoment=O,e.weekdays=fcn,e.parseZone=lcn,e.localeData=jN,e.isDuration=jpe,e.monthsShort=dcn,e.weekdaysMin=mcn,e.defineLocale=XUe,e.updateLocale=uun,e.locales=lun,e.weekdaysShort=pcn,e.normalizeUnits=je,e.relativeTimeRounding=Bcn,e.relativeTimeThreshold=zcn,e.calendarFormat=iln,e.prototype=dt,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 h1t(t){return t in Ste}function Bb(t,e){let r=te();return e?.apiKey||r[Ste[t]]||""}function aSn(){return[{name:"copilot-plus-flash",provider:"copilot-plus"},{name:"google/gemini-2.5-flash",provider:"openrouterai"}]}function pye(t){return aSn().some(e=>e.name===t.name&&e.provider===t.provider)}var hF=v(()=>{mr();Ye()});var g1t={};En(g1t,{CustomError:()=>lo,MissingApiKeyError:()=>xte,MissingModelKeyError:()=>zJ,MissingPlusLicenseError:()=>E4,TimeoutError:()=>Cte});var lo,Cte,xte,E4,zJ,lw=v(()=>{lo=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},Cte=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}},xte=class t extends Error{constructor(e="API key is not configured."){super(e),this.name="MissingApiKeyError",Object.setPrototypeOf(this,t.prototype)}},E4=class t extends Error{constructor(e="Copilot Plus license key is not configured."){super(e),this.name="MissingPlusLicenseError",Object.setPrototypeOf(this,t.prototype)}},zJ=class t extends Error{constructor(e="No model key found. Please select a model in settings."){super(e),this.name="MissingModelKeyError",Object.setPrototypeOf(this,t.prototype)}}});function c1(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function b1t(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function uSn(t){let e=b1t(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function _1t(t){let e=b1t(t);return uSn(t)?mWe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:mWe.UNKNOWN_ERROR)}function VJ(t){return t.replace(/^#/,"").trim()}function HJ(t,e={}){let{trimStart:r=!0}=e;if(t.startsWith("---")){let n=t.indexOf("---",3);if(n!==-1){let o=t.slice(n+3);return r?o.trimStart():o.startsWith(`\r
|
||
`)?o.slice(2):o.startsWith(`
|
||
`)||o.startsWith("\r")?o.slice(1):o}}return t}function gO(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(VJ(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(VJ(i))}):typeof n=="string"&&o.add(VJ(n))),Array.from(o)}function mye(t,e,r){if(e.length===0)return[];e=e.map(i=>VJ(i));let n=r&&r.length>0?r:Ote(t,"/"),o=[];for(let i of n){let a=gO(i);e.some(s=>a.includes(s))&&o.push(i)}return o}async function $c(t){let e=(0,$y.normalizePath)(t).replace(/^\/+/,"").replace(/\/+$/,"");if(!e)return;let r=e.split("/").filter(Boolean),n="";for(let o of r){n=n?`${n}/${o}`:o;let i=app.vault.getAbstractFileByPath(n);if(i){if(i instanceof $y.TFile)throw new Error(`Path conflict: "${n}" exists as a file, expected folder.`);continue}await app.vault.adapter.mkdir(n)}}async function WJ(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function hye(t){return t.basename}function yO(t){return t?dSn.includes(t.extension):!1}function zb(t){return t==="copilot_plus"||t==="project"}function JJ(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:zb(e):!1}function w1t(t,e){return!t||!e?!1:t.includes(hWe)&&e.includes(hWe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function gye(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 S1t(t,e){let r=new Map;return t.forEach(n=>{let o=e.getAbstractFileByPath(n);if(o instanceof $y.TFile)r.set(o.path,o);else{let a=e.getMarkdownFiles().filter(s=>s.basename===n);a.length>0&&(fSn(n,e)?r.set(a[0].path,a[0]):console.warn(`Found multiple files with title "${n}". Expected a full path for duplicate titles.`))}}),Array.from(r.values())}function kS(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(2,-2));return S1t(o,e)}function C1t(t,e){let r=/\{\[\[(.*?)\]\]\}/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(3,-3));return S1t(o,e)}function fSn(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function x1t(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function T1t(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function gWe(t){if(!t||typeof t!="string")return{isValid:!1,error:"URL is required"};let e=t.trim();if(!e)return{isValid:!1,error:"URL cannot be empty"};let r=yWe(e);return r?/^[a-zA-Z0-9_-]{11}$/.test(r)?{isValid:!0,videoId:r}:{isValid:!1,error:"Invalid YouTube video ID"}:{isValid:!1,error:"Invalid YouTube URL format"}}function yWe(t){try{let e=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/,/youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/];for(let r of e){let n=t.match(r);if(n&&n[1])return n[1]}return null}catch{return null}}function O1t(t){return`https://www.youtube.com/watch?v=${t}`}function E1t(t){return gWe(t).isValid}function P1t(t){if(!t||typeof t!="string")return!1;try{let e=new URL(t.trim());return(e.hostname==="x.com"||e.hostname==="www.x.com"||e.hostname==="twitter.com"||e.hostname==="www.twitter.com")&&e.pathname.includes("/status/")}catch{return!1}}function M1t(t){let e=t.matchAll(new RegExp(pSn,"g"));return Array.from(e,r=>r[0])}async function gl(t,e={}){let{throwOnHttpError:r=!0}=e,n=new Headers(e.headers),o=Object.fromEntries(n.entries());delete o["content-length"],F("safeFetch request");let i=e.method?.toUpperCase()||"POST",s=await(0,$y.requestUrl)({url:t,contentType:"application/json",headers:o,method:i,...["POST","PUT","PATCH"].includes(i)&&{body:e.body?.toString()},throw:!1});if(r&&s.status>=400){let u;try{u=typeof s.json=="string"?JSON.parse(s.json):s.json}catch{try{u=typeof s.text=="string"?JSON.parse(s.text):s.text}catch{u=null}}let l=new Error(mWe.REQUEST_FAILED(s.status));if(l.json=u,u?.detail?.reason==="Invalid license key"||u?.reason==="Invalid license key")l.message="Invalid license key";else if(u?.detail?.message||u?.message){let c=u?.detail?.message||u?.message,d=u?.detail?.reason||u?.reason;l.message=d?`${c}: ${d}`:c}else u?.detail?l.message=JSON.stringify(u.detail):u&&(l.message+=". "+JSON.stringify(u));throw l}return{ok:s.status>=200&&s.status<300,status:s.status,statusText:s.status.toString(),headers:new Headers(s.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:mSn(s.text),bodyUsed:!0,json:()=>s.json,text:async()=>s.text,arrayBuffer:async()=>{if(s.arrayBuffer)return s.arrayBuffer;let u=s.text.replace(/^data:.*;base64,/,""),l=atob(u),c=new Uint8Array(l.length);for(let d=0;d<l.length;d++)c[d]=l.charCodeAt(d);return c.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function R1t(t,e={}){return gl(t,{...e,throwOnHttpError:!1})}function mSn(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function Ete(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function qS(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 d1(t){let e=QC[t];return{...e,label:e.label||t}}function Rg(t,e){let r=QC[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function f1(t){let e=t;return e=Rte(e),e=e.replace(/```xml\s*[\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?```/g,""),e=e.replace(/<writeToFile>[\s\S]*?<\/writeToFile>/g,""),e=e.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,""),e=e.replace(/<!--AGENT_REASONING:\w+:\d+:.*-->/g,""),e=e.replace(/\n{3,}/g,`
|
||
|
||
`),e=e.trim(),e}async function KJ(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new $y.Notice("No active leaf found.");return}if(r.view instanceof $y.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof $y.MarkdownView)){new $y.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=f1(t),s=a.split(`
|
||
`),u=(b,_)=>{let w=_.length-1;return w===0?{line:b.line,ch:b.ch+(_[0]?.length??0)}:{line:b.line+w,ch:_[_.length-1]?.length??0}},l=()=>{let b=e?o:i;n.replaceRange(a,b,i),n.setSelection(b,u(b,s))},c=()=>{n.focus(),new $y.Notice("Message inserted into the active note.")},d=n.cm;if(!(d?.state?.doc&&typeof d.dispatch=="function")){l(),c();return}let{from:p,to:m}=d.state.selection.main,h=e?p:m,y=d.state.toText(a),g=h+y.length;try{d.dispatch({changes:{from:h,to:m,insert:y},selection:{anchor:h,head:g}})}catch(b){Te("CM6 dispatch failed, falling back to Obsidian API",b),l()}c()}function yye(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function bye(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 I1t(){try{return{version:(await(0,$y.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 Pte(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 hSn(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function GJ(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=Pte(e),n=hSn(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4")||e.startsWith("claude-opus-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function Mte(t,e="system"){return Pte(t)?"human":e}function bWe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","github-copilot","copilot-plus","copilot-plus-jina"];return Object.keys(QC).filter(e=>!t.includes(e))}function XJ(t,e){if(t.provider==="amazon-bedrock")return t.apiKey||e.amazonBedrockApiKey?{hasApiKey:!0}:{hasApiKey:!1,errorNotice:"Amazon Bedrock API key is missing. Please add a key in Settings > API Keys or update the model configuration."};if(t.provider==="github-copilot")return!(t.apiKey||e.githubCopilotToken||e.githubCopilotAccessToken)?{hasApiKey:!1,errorNotice:"GitHub Copilot is not authenticated. Please connect it in Settings > Copilot > Basic Tab > Set Keys."}:{hasApiKey:!0};let r=!!bWe().find(o=>o===t.provider),n=!Bb(t.provider,t);return r&&n?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
|
||
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function M4(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function Rte(t){let r=M4(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function _ye(t){return M4(t).replace(/<errorChunk>[\s\S]*?<\/errorChunk>/g,"").trim()}function A1t(){return crypto.randomUUID()}async function Vb(t){let e=console.warn;try{return console.warn=function(...r){if(!(r[0]?.includes&&(r[0].includes("Failed to calculate number of tokens")||r[0].includes("Unknown model"))))return e.apply(console,r)},await t()}finally{console.warn=e}}async function N1t(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(lw(),g1t)),o=new AbortController,i=setTimeout(()=>{o.abort()},e);try{return await Promise.race([t(o.signal),new Promise((a,s)=>{o.signal.addEventListener("abort",()=>{s(new n(r,e))})})])}finally{clearTimeout(i)}}function Ite(){let t=app.workspace.getActiveViewOfType($y.MarkdownView);return t?t.getState().source===!0:!0}function P4(t){return new TextEncoder().encode(t).length}function Tte(t,e){if(e<=0)return"";let r=new TextEncoder;if(r.encode(t).length<=e)return t;let o=0,i=t.length,a="";for(;o<=i;){let s=Math.floor((o+i)/2),u=t.substring(0,s);r.encode(u).length<=e?(a=u,o=s+1):i=s-1}return a}function D1t(t){let e=t.split("/"),r=e[e.length-1];if(P4(r)<=pWe)return t;let n=r.lastIndexOf("."),o=n>=0?r.substring(n):"",i=n>=0?r.substring(0,n):r,a=P4(o),s=pWe-a;return s<=0?e[e.length-1]=Tte(r,pWe):e[e.length-1]=Tte(i,s)+o,e.join("/")}async function j1t(t,e=!0){let r=null;app.workspace.iterateAllLeaves(n=>{if(n.view.getViewType()==="markdown"||n.view.getViewType()==="pdf"||n.view.getViewType()==="canvas"){let o=n.view.file;o&&o.path===t.path&&(r=n)}}),r&&e?app.workspace.setActiveLeaf(r,{focus:!0}):r||await app.workspace.getLeaf("tab").openFile(t)}var y1t,$y,mWe,Ote,lSn,cSn,v1t,Mg,dSn,pSn,pWe,Bt=v(()=>{sd();mr();Xe();y1t=$(m1t()),$y=require("obsidian");hF();cWe();mWe={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}`};Ote=(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})};lSn=t=>t.last?.modelName||t.last?.model,cSn=t=>t.last?.retriever!==void 0,v1t=t=>lSn(t)||cSn(t),Mg=(t,e="local")=>{let r=(0,y1t.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};dSn=["md","pdf","canvas"];pSn=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;pWe=255});var ZJ,_We,Ate,sd=v(()=>{fO();FS();sw();J3e();Bt();ZJ=class ZJ{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.withConfig({signal:i?.signal}),s=Bl.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return ZJ.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=ZJ.instances.get("llm_chain");return r||(r=ZJ.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=mu.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=mu.fromTemplate(`{system_message}
|
||
|
||
Answer the question with as detailed as possible based only on the following context:
|
||
{context}
|
||
|
||
Question: {question}
|
||
`),d=y=>y.map(b=>`Human: ${b[0]}
|
||
Assistant: ${b[1]}`).join(`
|
||
`),f=Bl.from([{question:y=>(n&&console.log("Input Question: ",y.question),y.question),chat_history:y=>{let g=d(y.chat_history);return n&&console.log("Formatted Chat History: ",g),g}},u,o,new Kge,y=>{let g=Rte(y),b=_ye(g);return n&&console.log("Standalone Question: ",b),b}]),p=async y=>(r(y),_te(y)),m=Bl.from([{context:i.pipe(p),question:new Au,system_message:()=>a},c,o]);return f.pipe(m)}};ZJ.instances=new Map;_We=ZJ,Ate=_We});var Nte=v(()=>{});var vWe,p1,Nu,Zs,cw,ZC,gSn,ySn,bSn,_Sn,lWe,L1t,F1t,Dte,q_,wWe,jte,R4,$te,SWe,Lte,CWe,xWe,vye,TWe,Fte,wye,Sye,OWe,Cye,Ly,EWe,dye,dw,m1,Hb,k_,gF,hO,YC,T4,hWe,QC,Ste,k1t,UJ,Sn,xye,YJ,ko,US,mr=v(()=>{qN();sd();Nte();vWe="https://api.brevilabs.com/v1",p1="https://models.brevilabs.com/v1",Nu="copilot-chat-view",Zs="user",cw="ai",ZC="copilot",gSn=`${ZC}/copilot-conversations`,ySn=`${ZC}/copilot-custom-prompts`,bSn=`${ZC}/memory`,_Sn=`${ZC}/system-prompts`,lWe=ZC,L1t=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking.
|
||
1. Never mention that you do not have access to something. Always rely on the user provided context.
|
||
2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context.
|
||
3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note.
|
||
4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so.
|
||
5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query.
|
||
6. Always use $'s instead of \\[ etc. for LaTeX equations.
|
||
7. When showing note titles, use [[title]] format and do not wrap them in \` \`.
|
||
8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`.
|
||
9. When showing **web** image links, use  format and do not wrap them in \` \`.
|
||
10. When generating a table, format as github markdown tables, however, for table headings, immediately add ' |' after the table heading.
|
||
11. Always respond in the language of the user's query.
|
||
12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message.
|
||
13. If the user mentions "tags", it most likely means tags in Obsidian note properties.
|
||
14. YouTube URLs: If the user provides YouTube URLs in their message, transcriptions will be automatically fetched and provided to you. You don't need to do anything special - just use the transcription content if available.
|
||
15. For markdown lists, always use '- ' (hyphen followed by exactly one space) for bullet points, with no leading spaces before the hyphen. Never use '*' (asterisk) for bullets.`,F1t=`Return the new note content or canvas JSON in <writeToFile> tags.
|
||
|
||
# Steps to find the the target notes
|
||
1. Extract the target note information from user message and find out the note path from the context below.
|
||
2. If target note is not specified, use the <active_note> as the target note.
|
||
3. If still failed to find the target note or the note path, ask the user to specify the target note.
|
||
|
||
# Examples
|
||
|
||
Input: Add a new section to note A
|
||
Output:
|
||
<writeToFile>
|
||
<path>path/to/file.md</path>
|
||
<content>The FULL CONTENT of the note A with added section goes here</content>
|
||
</writeToFile>
|
||
|
||
Input: Create a new canvas with "Hello, world!"
|
||
Output:
|
||
<writeToFile>
|
||
<path>path/to/file.canvas</path>
|
||
<content>
|
||
{
|
||
"nodes": [
|
||
{
|
||
"id": "1",
|
||
"type": "text",
|
||
"text": "Hello, world!",
|
||
"x": 0,
|
||
"y": 0,
|
||
"width": 200,
|
||
"height": 50
|
||
}
|
||
],
|
||
"edges": []
|
||
}
|
||
</content>
|
||
</writeToFile>
|
||
|
||
Input: Create a canvas with a file node and a group
|
||
Output:
|
||
<writeToFile>
|
||
<path>path/to/file.canvas</path>
|
||
<content>
|
||
{
|
||
"nodes": [
|
||
{"id": "1", "type": "file", "file": "note.md", "subpath": "#heading", "x": 100, "y": 100, "width": 300, "height": 200, "color": "2"},
|
||
{"id": "2", "type": "group", "label": "My Group", "x": 50, "y": 50, "width": 400, "height": 300, "color": "1"},
|
||
{"id": "3", "type": "link", "url": "https://example.com", "x": 500, "y": 100, "width": 200, "height": 100, "color": "#FF5733"}
|
||
],
|
||
"edges": [
|
||
{"id": "e1-2", "fromNode": "1", "toNode": "3", "fromSide": "right", "toSide": "left", "fromEnd": "arrow", "toEnd": "none", "color": "3", "label": "references"}
|
||
]
|
||
}
|
||
</content>
|
||
</writeToFile>
|
||
|
||
# Canvas JSON Format (JSON Canvas spec 1.0)
|
||
Required node fields: id, type, x, y, width, height
|
||
Node types: "text" (needs text), "file" (needs file), "link" (needs url), "group" (optional label)
|
||
Optional node fields: color (hex #FF0000 or preset "1"-"6"), subpath (file nodes, starts with #)
|
||
Required edge fields: id, fromNode, toNode
|
||
Optional edge fields: fromSide/toSide ("top"/"right"/"bottom"/"left"), fromEnd/toEnd ("none"/"arrow"), color, label
|
||
All IDs must be unique. Edge nodes must reference existing node IDs.
|
||
Position nodes with reasonable spacing and logical visual flow.
|
||
`,Dte="note_context",q_="selected_text",wWe="web_selected_text",jte="variable",R4="variable_note",$te="embedded_pdf",SWe="embedded_note",Lte="dataview_block",CWe="retrieved_document",xWe="web_tab_context",vye="active_web_tab",TWe="youtube_video_context",Fte="{activeWebTab}",wye=6e3,Sye=.4,OWe=448e3,Cye=3e4,Ly=30,EWe=5*60*1e3,dye=16,dw={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree",COMPACTING:"Compacting"},m1={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Hb={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},k_=(g=>(g.OPENROUTERAI="openrouterai",g.OPENAI="openai",g.OPENAI_FORMAT="3rd party (openai-format)",g.ANTHROPIC="anthropic",g.GOOGLE="google",g.XAI="xai",g.AMAZON_BEDROCK="amazon-bedrock",g.AZURE_OPENAI="azure openai",g.GROQ="groq",g.OLLAMA="ollama",g.LM_STUDIO="lm-studio",g.COPILOT_PLUS="copilot-plus",g.MISTRAL="mistralai",g.DEEPSEEK="deepseek",g.COHEREAI="cohereai",g.SILICONFLOW="siliconflow",g.GITHUB_COPILOT="github-copilot",g))(k_||{}),gF={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},hO=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-3-flash-preview",provider:"openrouterai",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"google/gemini-3.1-pro-preview",provider:"openrouterai",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{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:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5.2",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5-mini",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"grok-4-1-fast",provider:"xai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"x-ai/grok-4.1-fast",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-5.2",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"claude-opus-4-6",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-sonnet-4-5-20250929",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3-flash-preview",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.1-pro-preview",provider:"google",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-pro",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]},{name:"deepseek-ai/DeepSeek-V3",provider:"siliconflow",enabled:!1,isBuiltIn:!1,baseUrl:"https://api.siliconflow.com/v1"},{name:"deepseek-ai/DeepSeek-R1",provider:"siliconflow",enabled:!1,isBuiltIn:!1,baseUrl:"https://api.siliconflow.com/v1",capabilities:["reasoning"]}],YC=(d=>(d.OPENAI="openai",d.OPENROUTERAI="openrouterai",d.COHEREAI="cohereai",d.GOOGLE="google",d.AZURE_OPENAI="azure openai",d.OLLAMA="ollama",d.LM_STUDIO="lm-studio",d.OPENAI_FORMAT="3rd party (openai-format)",d.COPILOT_PLUS="copilot-plus",d.COPILOT_PLUS_JINA="copilot-plus-jina",d.SILICONFLOW="siliconflow",d))(YC||{}),T4=[{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:"openai/text-embedding-3-small",provider:"openrouterai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"gemini-embedding-001",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"Qwen/Qwen3-Embedding-0.6B",provider:"siliconflow",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,baseUrl:"https://api.siliconflow.com/v1"}],hWe="nomic-embed-text",QC={openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",curlBaseURL:"https://openrouter.ai/api/v1",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/gpt-5-mini"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",curlBaseURL:"https://generativelanguage.googleapis.com/v1beta",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",curlBaseURL:"https://api.anthropic.com",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-sonnet-4-5-20250929"},openai:{label:"OpenAI",host:"https://api.openai.com",curlBaseURL:"https://api.openai.com/v1",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-5.2"},xai:{label:"XAI",host:"https://api.x.ai/v1",curlBaseURL:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-4-1-fast"},"azure openai":{label:"Azure OpenAI",host:"",curlBaseURL:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},groq:{label:"Groq",host:"https://api.groq.com/openai",curlBaseURL:"https://api.groq.com/openai/v1",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},cohereai:{label:"Cohere",host:"https://api.cohere.com",curlBaseURL:"https://api.cohere.com/v1",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},siliconflow:{label:"SiliconFlow",host:"https://api.siliconflow.com/v1",curlBaseURL:"https://api.siliconflow.com/v1",keyManagementURL:"https://cloud.siliconflow.com/me/account/ak",listModelURL:"https://api.siliconflow.com/v1/models",testModel:"deepseek-ai/DeepSeek-V3"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",curlBaseURL:"http://localhost:11434",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",curlBaseURL:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",curlBaseURL:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",curlBaseURL:"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/",curlBaseURL:"https://api.deepseek.com",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"amazon-bedrock":{label:"Amazon Bedrock",host:"https://bedrock-runtime.{region}.amazonaws.com",curlBaseURL:"https://bedrock-runtime.{region}.amazonaws.com",keyManagementURL:"https://console.aws.amazon.com/iam/home#/security_credentials",listModelURL:""},"copilot-plus":{label:"Copilot Plus",host:p1,curlBaseURL:p1,keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:p1,curlBaseURL:p1,keyManagementURL:"",listModelURL:""},"github-copilot":{label:"GitHub Copilot",host:"https://api.githubcopilot.com",curlBaseURL:"https://api.githubcopilot.com",keyManagementURL:"https://github.com/settings/apps/authorizations",listModelURL:""}},Ste={anthropic:"anthropicApiKey",openai:"openAIApiKey","azure openai":"azureOpenAIApiKey",google:"googleApiKey",groq:"groqApiKey",openrouterai:"openRouterAiApiKey",cohereai:"cohereApiKey",xai:"xaiApiKey","copilot-plus":"plusLicenseKey",mistralai:"mistralApiKey",deepseek:"deepseekApiKey","amazon-bedrock":"amazonBedrockApiKey",siliconflow:"siliconflowApiKey","github-copilot":"githubCopilotToken"},k1t=["NEVER","ON STARTUP","ON MODE SWITCH"],UJ=(r=>(r.ENTER="enter",r.SHIFT_ENTER="shift+enter",r))(UJ||{}),Sn={TRIGGER_QUICK_COMMAND:"trigger-quick-command",CLEAR_LOCAL_COPILOT_INDEX:"clear-local-copilot-index",CLEAR_COPILOT_CACHE:"clear-copilot-cache",COUNT_WORD_AND_TOKENS_SELECTION:"count-word-and-tokens-selection",COUNT_TOTAL_VAULT_TOKENS:"count-total-vault-tokens",DEBUG_WORD_COMPLETION:"debug-word-completion",FORCE_REINDEX_VAULT_TO_COPILOT_INDEX:"force-reindex-vault-to-copilot-index",GARBAGE_COLLECT_COPILOT_INDEX:"garbage-collect-copilot-index",INDEX_VAULT_TO_COPILOT_INDEX:"index-vault-to-copilot-index",INSPECT_COPILOT_INDEX_BY_NOTE_PATHS:"copilot-inspect-index-by-note-paths",LIST_INDEXED_FILES:"copilot-list-indexed-files",LOAD_COPILOT_CHAT_CONVERSATION:"load-copilot-chat-conversation",NEW_CHAT:"new-chat",OPEN_COPILOT_CHAT_WINDOW:"chat-open-window",REMOVE_FILES_FROM_COPILOT_INDEX:"remove-files-from-copilot-index",SEARCH_ORAMA_DB:"copilot-search-orama-db",TOGGLE_COPILOT_CHAT_WINDOW:"chat-toggle-window",ADD_SELECTION_TO_CHAT_CONTEXT:"add-selection-to-chat-context",ADD_WEB_SELECTION_TO_CHAT_CONTEXT:"add-web-selection-to-chat-context",ADD_CUSTOM_COMMAND:"add-custom-command",APPLY_CUSTOM_COMMAND:"apply-custom-command",OPEN_LOG_FILE:"open-log-file",CLEAR_LOG_FILE:"clear-log-file",DOWNLOAD_YOUTUBE_SCRIPT:"download-youtube-script",TRIGGER_QUICK_ASK:"trigger-quick-ask"},xye={[Sn.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[Sn.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[Sn.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[Sn.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[Sn.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[Sn.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[Sn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[Sn.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[Sn.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[Sn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[Sn.LIST_INDEXED_FILES]:"List all indexed files (debug)",[Sn.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[Sn.NEW_CHAT]:"New Copilot Chat",[Sn.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[Sn.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[Sn.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[Sn.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[Sn.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[Sn.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"Add web selection to chat context",[Sn.ADD_CUSTOM_COMMAND]:"Add new custom command",[Sn.APPLY_CUSTOM_COMMAND]:"Apply custom command",[Sn.OPEN_LOG_FILE]:"Create log file",[Sn.CLEAR_LOG_FILE]:"Clear log file",[Sn.DOWNLOAD_YOUTUBE_SCRIPT]:"Download YouTube Script (plus)",[Sn.TRIGGER_QUICK_ASK]:"Quick Ask"},YJ={NON_MARKDOWN_FILES_RESTRICTED:"Non-markdown files are only available in Copilot Plus mode. Please upgrade to access this file type.",URL_PROCESSING_RESTRICTED:"URL processing is only available in Copilot Plus mode. URLs will not be processed for context.",UNSUPPORTED_FILE_TYPE:t=>`${t.toUpperCase()} files are not supported in the current mode.`},ko={userId:od(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",amazonBedrockApiKey:"",amazonBedrockRegion:"",siliconflowApiKey:"",githubCopilotAccessToken:"",githubCopilotToken:"",githubCopilotTokenExpiresAt:0,defaultChainType:"llm_chain",defaultModelKey:"google/gemini-2.5-flash|openrouterai",embeddingModelKey:"openai/text-embedding-3-small|openrouterai",temperature:Hb.TEMPERATURE,maxTokens:Hb.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:gSn,defaultConversationTag:"copilot-conversation",autosaveChat:!0,generateAIChatTitleOnSave:!0,autoAddActiveContentToContext:!0,defaultOpenArea:"view",defaultSendShortcut:"enter",customPromptsFolder:ySn,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:lWe,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:Ly,enableInlineCitations:!0,groqApiKey:"",activeModels:hO,activeEmbeddingModels:T4,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",chatHistorySortStrategy:"recent",projectListSortStrategy:"recent",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!0,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableSelfHostMode:!1,enableMiyo:!1,selfHostModeValidatedAt:null,selfHostValidationCount:0,selfHostUrl:"",selfHostApiKey:"",selfHostSearchProvider:"firecrawl",firecrawlApiKey:"",perplexityApiKey:"",supadataApiKey:"",enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","readNote","webSearch","pomodoro","youtubeTranscription","writeToFile","replaceInFile","updateMemory"],reasoningEffort:Hb.REASONING_EFFORT,verbosity:Hb.VERBOSITY,memoryFolderName:bSn,enableRecentConversations:!0,maxRecentConversations:30,enableSavedMemory:!0,quickCommandModelKey:void 0,quickCommandIncludeNoteContext:!0,autoIncludeTextSelection:!1,autoAddSelectionToContext:!1,autoAcceptEdits:!1,diffViewMode:"split",userSystemPromptsFolder:_Sn,defaultSystemPromptTitle:"",autoCompactThreshold:128e3},US={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var MWe=S(Tye=>{"use strict";Tye.byteLength=wSn;Tye.toByteArray=CSn;Tye.fromByteArray=OSn;var bO=[],BS=[],vSn=typeof Uint8Array<"u"?Uint8Array:Array,PWe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(I4=0,q1t=PWe.length;I4<q1t;++I4)bO[I4]=PWe[I4],BS[PWe.charCodeAt(I4)]=I4;var I4,q1t;BS[45]=62;BS[95]=63;function U1t(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 wSn(t){var e=U1t(t),r=e[0],n=e[1];return(r+n)*3/4-n}function SSn(t,e,r){return(e+r)*3/4-r}function CSn(t){var e,r=U1t(t),n=r[0],o=r[1],i=new vSn(SSn(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=BS[t.charCodeAt(u)]<<18|BS[t.charCodeAt(u+1)]<<12|BS[t.charCodeAt(u+2)]<<6|BS[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=BS[t.charCodeAt(u)]<<2|BS[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=BS[t.charCodeAt(u)]<<10|BS[t.charCodeAt(u+1)]<<4|BS[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function xSn(t){return bO[t>>18&63]+bO[t>>12&63]+bO[t>>6&63]+bO[t&63]}function TSn(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(xSn(n));return o.join("")}function OSn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(TSn(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(bO[e>>2]+bO[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(bO[e>>10]+bO[e>>4&63]+bO[e<<2&63]+"=")),o.join("")}});var B1t=S(RWe=>{RWe.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)};RWe.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 zS=S(r5=>{"use strict";var IWe=MWe(),e5=B1t(),z1t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r5.Buffer=ke;r5.SlowBuffer=ASn;r5.INSPECT_MAX_BYTES=50;var Oye=2147483647;r5.kMaxLength=Oye;ke.TYPED_ARRAY_SUPPORT=ESn();!ke.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 ESn(){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(ke.prototype,"parent",{enumerable:!0,get:function(){if(ke.isBuffer(this))return this.buffer}});Object.defineProperty(ke.prototype,"offset",{enumerable:!0,get:function(){if(ke.isBuffer(this))return this.byteOffset}});function h1(t){if(t>Oye)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,ke.prototype),e}function ke(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 jWe(t)}return J1t(t,e,r)}ke.poolSize=8192;function J1t(t,e,r){if(typeof t=="string")return MSn(t,e);if(ArrayBuffer.isView(t))return RSn(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(_O(t,ArrayBuffer)||t&&_O(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_O(t,SharedArrayBuffer)||t&&_O(t.buffer,SharedArrayBuffer)))return NWe(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 ke.from(n,e,r);let o=ISn(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ke.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)}ke.from=function(t,e,r){return J1t(t,e,r)};Object.setPrototypeOf(ke.prototype,Uint8Array.prototype);Object.setPrototypeOf(ke,Uint8Array);function K1t(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 PSn(t,e,r){return K1t(t),t<=0?h1(t):e!==void 0?typeof r=="string"?h1(t).fill(e,r):h1(t).fill(e):h1(t)}ke.alloc=function(t,e,r){return PSn(t,e,r)};function jWe(t){return K1t(t),h1(t<0?0:$We(t)|0)}ke.allocUnsafe=function(t){return jWe(t)};ke.allocUnsafeSlow=function(t){return jWe(t)};function MSn(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ke.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=G1t(t,e)|0,n=h1(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function AWe(t){let e=t.length<0?0:$We(t.length)|0,r=h1(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function RSn(t){if(_O(t,Uint8Array)){let e=new Uint8Array(t);return NWe(e.buffer,e.byteOffset,e.byteLength)}return AWe(t)}function NWe(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,ke.prototype),n}function ISn(t){if(ke.isBuffer(t)){let e=$We(t.length)|0,r=h1(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||FWe(t.length)?h1(0):AWe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return AWe(t.data)}function $We(t){if(t>=Oye)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Oye.toString(16)+" bytes");return t|0}function ASn(t){return+t!=t&&(t=0),ke.alloc(+t)}ke.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ke.prototype};ke.compare=function(e,r){if(_O(e,Uint8Array)&&(e=ke.from(e,e.offset,e.byteLength)),_O(r,Uint8Array)&&(r=ke.from(r,r.offset,r.byteLength)),!ke.isBuffer(e)||!ke.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};ke.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}};ke.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ke.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=ke.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(_O(a,Uint8Array))i+a.length>o.length?(ke.isBuffer(a)||(a=ke.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(ke.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function G1t(t,e){if(ke.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||_O(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 DWe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return oDt(t).length;default:if(o)return n?-1:DWe(t).length;e=(""+e).toLowerCase(),o=!0}}ke.byteLength=G1t;function NSn(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 zSn(this,e,r);case"utf8":case"utf-8":return Z1t(this,e,r);case"ascii":return USn(this,e,r);case"latin1":case"binary":return BSn(this,e,r);case"base64":return kSn(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return VSn(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}ke.prototype._isBuffer=!0;function A4(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}ke.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)A4(this,r,r+1);return this};ke.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)A4(this,r,r+3),A4(this,r+1,r+2);return this};ke.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)A4(this,r,r+7),A4(this,r+1,r+6),A4(this,r+2,r+5),A4(this,r+3,r+4);return this};ke.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Z1t(this,0,e):NSn.apply(this,arguments)};ke.prototype.toLocaleString=ke.prototype.toString;ke.prototype.equals=function(e){if(!ke.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:ke.compare(this,e)===0};ke.prototype.inspect=function(){let e="",r=r5.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};z1t&&(ke.prototype[z1t]=ke.prototype.inspect);ke.prototype.compare=function(e,r,n,o,i){if(_O(e,Uint8Array)&&(e=ke.from(e,e.offset,e.byteLength)),!ke.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 X1t(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,FWe(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=ke.from(e,n)),ke.isBuffer(e))return e.length===0?-1:V1t(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):V1t(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function V1t(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}ke.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};ke.prototype.indexOf=function(e,r,n){return X1t(this,e,r,n,!0)};ke.prototype.lastIndexOf=function(e,r,n){return X1t(this,e,r,n,!1)};function DSn(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(FWe(s))return a;t[r+a]=s}return a}function jSn(t,e,r,n){return Eye(DWe(e,t.length-r),t,r,n)}function $Sn(t,e,r,n){return Eye(KSn(e),t,r,n)}function LSn(t,e,r,n){return Eye(oDt(e),t,r,n)}function FSn(t,e,r,n){return Eye(GSn(e,t.length-r),t,r,n)}ke.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 DSn(this,e,r,n);case"utf8":case"utf-8":return jSn(this,e,r,n);case"ascii":case"latin1":case"binary":return $Sn(this,e,r,n);case"base64":return LSn(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return FSn(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};ke.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kSn(t,e,r){return e===0&&r===t.length?IWe.fromByteArray(t):IWe.fromByteArray(t.slice(e,r))}function Z1t(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 qSn(n)}var H1t=4096;function qSn(t){let e=t.length;if(e<=H1t)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=H1t));return r}function USn(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 BSn(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 zSn(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+=XSn[t[i]];return o}function VSn(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}ke.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,ke.prototype),o};function Nh(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")}ke.prototype.readUintLE=ke.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nh(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};ke.prototype.readUintBE=ke.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nh(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};ke.prototype.readUint8=ke.prototype.readUInt8=function(e,r){return e=e>>>0,r||Nh(e,1,this.length),this[e]};ke.prototype.readUint16LE=ke.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Nh(e,2,this.length),this[e]|this[e+1]<<8};ke.prototype.readUint16BE=ke.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Nh(e,2,this.length),this[e]<<8|this[e+1]};ke.prototype.readUint32LE=ke.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ke.prototype.readUint32BE=ke.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ke.prototype.readBigUInt64LE=yF(function(e){e=e>>>0,t5(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&kte(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))});ke.prototype.readBigUInt64BE=yF(function(e){e=e>>>0,t5(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&kte(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)});ke.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nh(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};ke.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Nh(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};ke.prototype.readInt8=function(e,r){return e=e>>>0,r||Nh(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ke.prototype.readInt16LE=function(e,r){e=e>>>0,r||Nh(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};ke.prototype.readInt16BE=function(e,r){e=e>>>0,r||Nh(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};ke.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ke.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ke.prototype.readBigInt64LE=yF(function(e){e=e>>>0,t5(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&kte(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)});ke.prototype.readBigInt64BE=yF(function(e){e=e>>>0,t5(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&kte(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)});ke.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),e5.read(this,e,!0,23,4)};ke.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Nh(e,4,this.length),e5.read(this,e,!1,23,4)};ke.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Nh(e,8,this.length),e5.read(this,e,!0,52,8)};ke.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Nh(e,8,this.length),e5.read(this,e,!1,52,8)};function U_(t,e,r,n,o,i){if(!ke.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")}ke.prototype.writeUintLE=ke.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;U_(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};ke.prototype.writeUintBE=ke.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;U_(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};ke.prototype.writeUint8=ke.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,1,255,0),this[r]=e&255,r+1};ke.prototype.writeUint16LE=ke.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ke.prototype.writeUint16BE=ke.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ke.prototype.writeUint32LE=ke.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||U_(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};ke.prototype.writeUint32BE=ke.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||U_(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 Y1t(t,e,r,n,o){nDt(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 Q1t(t,e,r,n,o){nDt(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}ke.prototype.writeBigUInt64LE=yF(function(e,r=0){return Y1t(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ke.prototype.writeBigUInt64BE=yF(function(e,r=0){return Q1t(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ke.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);U_(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};ke.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);U_(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};ke.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ke.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ke.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||U_(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ke.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||U_(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};ke.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||U_(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};ke.prototype.writeBigInt64LE=yF(function(e,r=0){return Y1t(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ke.prototype.writeBigInt64BE=yF(function(e,r=0){return Q1t(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function eDt(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 tDt(t,e,r,n,o){return e=+e,r=r>>>0,o||eDt(t,e,r,4,34028234663852886e22,-34028234663852886e22),e5.write(t,e,r,n,23,4),r+4}ke.prototype.writeFloatLE=function(e,r,n){return tDt(this,e,r,!0,n)};ke.prototype.writeFloatBE=function(e,r,n){return tDt(this,e,r,!1,n)};function rDt(t,e,r,n,o){return e=+e,r=r>>>0,o||eDt(t,e,r,8,17976931348623157e292,-17976931348623157e292),e5.write(t,e,r,n,52,8),r+8}ke.prototype.writeDoubleLE=function(e,r,n){return rDt(this,e,r,!0,n)};ke.prototype.writeDoubleBE=function(e,r,n){return rDt(this,e,r,!1,n)};ke.prototype.copy=function(e,r,n,o){if(!ke.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};ke.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"&&!ke.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=ke.isBuffer(e)?e:ke.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 QJ={};function LWe(t,e,r){QJ[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}`}}}LWe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);LWe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);LWe("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=W1t(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=W1t(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function W1t(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 HSn(t,e,r){t5(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&kte(e,t.length-(r+1))}function nDt(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 QJ.ERR_OUT_OF_RANGE("value",s,t)}HSn(n,o,i)}function t5(t,e){if(typeof t!="number")throw new QJ.ERR_INVALID_ARG_TYPE(e,"number",t)}function kte(t,e,r){throw Math.floor(t)!==t?(t5(t,r),new QJ.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new QJ.ERR_BUFFER_OUT_OF_BOUNDS:new QJ.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var WSn=/[^+/0-9A-Za-z-_]/g;function JSn(t){if(t=t.split("=")[0],t=t.trim().replace(WSn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function DWe(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 KSn(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function GSn(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 oDt(t){return IWe.toByteArray(JSn(t))}function Eye(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 _O(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function FWe(t){return t!==t}var XSn=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 yF(t){return typeof BigInt>"u"?ZSn:t}function ZSn(){throw new Error("BigInt not supported")}});function qte(){return aDt.Platform.isDesktop&&Pye||(Pye=require("electron")?.remote?.safeStorage),Pye}async function zWe(){return await crypto.subtle.importKey("raw",YSn,Mye.name,!1,["encrypt","decrypt"])}async function sDt(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey"||n==="githubCopilotAccessToken"||n==="githubCopilotToken");for(let n of r){let o=t[n];e[n]=await kWe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await kWe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await kWe(n.apiKey||"")})))),e}async function kWe(t){if(!t||t.startsWith(VWe))return t;uDt(t)&&(t=t.replace(Rye,""));try{if(qte()?.isEncryptionAvailable()){let o=qte().encryptString(t);return UWe+o.toString("base64")}let e=await zWe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Mye,e,r);return BWe+e0n(n)}catch(e){return console.error("Encryption failed:",e),t}}async function oo(t){if(!t||QSn(t))return t;if(uDt(t))return t.replace(Rye,"");if(t.startsWith(UWe)){let r=t.replace(UWe,""),n=qWe.Buffer.from(r,"base64");return qte().decryptString(n)}if(t.startsWith(BWe)){let r=t.replace(BWe,""),n=await zWe(),o=iDt(r),i=await crypto.subtle.decrypt(Mye,n,o);return new TextDecoder().decode(i)}let e=t.replace(VWe,"");try{if(qte()?.isEncryptionAvailable())try{let i=qWe.Buffer.from(e,"base64");return qte().decryptString(i)}catch{}let r=await zWe(),n=iDt(e),o=await crypto.subtle.decrypt(Mye,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function QSn(t){return!t.startsWith(VWe)&&!t.startsWith(Rye)}function uDt(t){return t.startsWith(Rye)}function e0n(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 iDt(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 qWe,aDt,Pye,UWe,BWe,VWe,Rye,YSn,Mye,vO=v(()=>{qWe=$(zS()),aDt=require("obsidian"),Pye=null;UWe="enc_desk_",BWe="enc_web_",VWe="enc_",Rye="dec_",YSn=new TextEncoder().encode("obsidian-copilot-v1"),Mye={name:"AES-GCM",iv:new Uint8Array(12)}});function pDt(t){No.set(Aye,t)}function B_(){return No.get(Aye)}function mDt(t){return No.sub(Aye,t)}function bF(){return u1(Aye,{store:No})}function ex(){return No.get(Nye)}function N4(t){No.set(Nye,t)}function hDt(t){return No.sub(Nye,t)}function fw(){return u1(Nye,{store:No})}function D4(t){No.set(Iye,t)}function Gu(){return No.get(Iye)}function i5(t){return No.sub(Iye,()=>{t(No.get(Iye))})}function wO(t){No.set(fDt,t)}function Dye(){return u1(fDt,{store:No})}function a5(){return ex()==="project"}function SO(t){No.set(HWe,t)}function tx(){return No.get(HWe)}function gDt(t){let e=tx();SO(e.filter(r=>r.id!==t))}function yDt(){SO([])}function bDt(){return u1(HWe,{store:No})}function _Dt(t){No.set(Ute,t)}function CO(t,e){No.set(Ute,r=>({...r,[t]:e(r[t])}))}function s5(){return u1(Ute,{store:No})}function u5(){return No.get(Bte)}function WWe(t){No.set(Bte,t)}function Ig(t){No.set(Bte,e=>({...e,...t}))}function JWe(){VS!==null&&(clearTimeout(VS),VS=null),n5=0,o5=0,No.set(Bte,{isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"})}function vDt(t){o5=t;let e=Date.now();e-n5>=dDt?(n5=e,VS!==null&&(clearTimeout(VS),VS=null),Ig({indexedCount:o5})):VS===null&&(VS=setTimeout(()=>{n5=Date.now(),VS=null,Ig({indexedCount:o5})},dDt-(e-n5)))}function wDt(){VS!==null&&(clearTimeout(VS),VS=null),Ig({indexedCount:o5}),n5=0,o5=0}function l5(){return u1(Bte,{store:No})}var lDt,Aye,cDt,Nye,Iye,fDt,Ute,Bte,HWe,n5,o5,VS,dDt,ra=v(()=>{sd();Ye();XC();lDt=bc(null),Aye=bc(t=>{let e=t(lDt);return e!==null?e:t(mF).defaultModelKey},(t,e,r)=>{e(lDt,r)}),cDt=bc(null),Nye=bc(t=>{let e=t(cDt);return e!==null?e:t(mF).defaultChainType},(t,e,r)=>{e(cDt,r)}),Iye=bc(null),fDt=bc(!1),Ute=bc({success:[],failed:[],processingFiles:[],total:[]}),Bte=bc({isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"}),HWe=bc([]);n5=0,o5=0,VS=null,dDt=500});var IDt=S(Xu=>{"use strict";function ZWe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<jye(o,e))t[n]=e,t[r]=o,r=n;else break e}}function rx(t){return t.length===0?null:t[0]}function Lye(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>jye(s,r))u<o&&0>jye(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>jye(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function jye(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(SDt=performance,Xu.unstable_now=function(){return SDt.now()}):(KWe=Date,CDt=KWe.now(),Xu.unstable_now=function(){return KWe.now()-CDt});var SDt,KWe,CDt,xO=[],_F=[],t0n=1,HS=null,Fy=3,Fye=!1,j4=!1,Vte=!1,ODt=typeof setTimeout=="function"?setTimeout:null,EDt=typeof clearTimeout=="function"?clearTimeout:null,xDt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function YWe(t){for(var e=rx(_F);e!==null;){if(e.callback===null)Lye(_F);else if(e.startTime<=t)Lye(_F),e.sortIndex=e.expirationTime,ZWe(xO,e);else break;e=rx(_F)}}function QWe(t){if(Vte=!1,YWe(t),!j4)if(rx(xO)!==null)j4=!0,t6e(e6e);else{var e=rx(_F);e!==null&&r6e(QWe,e.startTime-t)}}function e6e(t,e){j4=!1,Vte&&(Vte=!1,EDt(Hte),Hte=-1),Fye=!0;var r=Fy;try{for(YWe(e),HS=rx(xO);HS!==null&&(!(HS.expirationTime>e)||t&&!RDt());){var n=HS.callback;if(typeof n=="function"){HS.callback=null,Fy=HS.priorityLevel;var o=n(HS.expirationTime<=e);e=Xu.unstable_now(),typeof o=="function"?HS.callback=o:HS===rx(xO)&&Lye(xO),YWe(e)}else Lye(xO);HS=rx(xO)}if(HS!==null)var i=!0;else{var a=rx(_F);a!==null&&r6e(QWe,a.startTime-e),i=!1}return i}finally{HS=null,Fy=r,Fye=!1}}var kye=!1,$ye=null,Hte=-1,PDt=5,MDt=-1;function RDt(){return!(Xu.unstable_now()-MDt<PDt)}function GWe(){if($ye!==null){var t=Xu.unstable_now();MDt=t;var e=!0;try{e=$ye(!0,t)}finally{e?zte():(kye=!1,$ye=null)}}else kye=!1}var zte;typeof xDt=="function"?zte=function(){xDt(GWe)}:typeof MessageChannel<"u"?(XWe=new MessageChannel,TDt=XWe.port2,XWe.port1.onmessage=GWe,zte=function(){TDt.postMessage(null)}):zte=function(){ODt(GWe,0)};var XWe,TDt;function t6e(t){$ye=t,kye||(kye=!0,zte())}function r6e(t,e){Hte=ODt(function(){t(Xu.unstable_now())},e)}Xu.unstable_IdlePriority=5;Xu.unstable_ImmediatePriority=1;Xu.unstable_LowPriority=4;Xu.unstable_NormalPriority=3;Xu.unstable_Profiling=null;Xu.unstable_UserBlockingPriority=2;Xu.unstable_cancelCallback=function(t){t.callback=null};Xu.unstable_continueExecution=function(){j4||Fye||(j4=!0,t6e(e6e))};Xu.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"):PDt=0<t?Math.floor(1e3/t):5};Xu.unstable_getCurrentPriorityLevel=function(){return Fy};Xu.unstable_getFirstCallbackNode=function(){return rx(xO)};Xu.unstable_next=function(t){switch(Fy){case 1:case 2:case 3:var e=3;break;default:e=Fy}var r=Fy;Fy=e;try{return t()}finally{Fy=r}};Xu.unstable_pauseExecution=function(){};Xu.unstable_requestPaint=function(){};Xu.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=Fy;Fy=t;try{return e()}finally{Fy=r}};Xu.unstable_scheduleCallback=function(t,e,r){var n=Xu.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:t0n++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,ZWe(_F,t),rx(xO)===null&&t===rx(_F)&&(Vte?(EDt(Hte),Hte=-1):Vte=!0,r6e(QWe,r-n))):(t.sortIndex=o,ZWe(xO,t),j4||Fye||(j4=!0,t6e(e6e))),t};Xu.unstable_shouldYield=RDt;Xu.unstable_wrapCallback=function(t){var e=Fy;return function(){var r=Fy;Fy=e;try{return t.apply(this,arguments)}finally{Fy=r}}}});var NDt=S((Kzi,ADt)=>{"use strict";ADt.exports=IDt()});var kLt=S(bw=>{"use strict";var qjt=J(),gw=NDt();function ut(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 Ujt=new Set,pre={};function K4(t,e){R5(t,e),R5(t+"Capture",e)}function R5(t,e){for(pre[t]=e,t=0;t<e.length;t++)Ujt.add(e[t])}var w1=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),T6e=Object.prototype.hasOwnProperty,r0n=/^[: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]*$/,DDt={},jDt={};function n0n(t){return T6e.call(jDt,t)?!0:T6e.call(DDt,t)?!1:r0n.test(t)?jDt[t]=!0:(DDt[t]=!0,!1)}function o0n(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 i0n(t,e,r,n){if(e===null||typeof e>"u"||o0n(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 Kb(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 Dg={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Dg[t]=new Kb(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Dg[e]=new Kb(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Dg[t]=new Kb(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Dg[t]=new Kb(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){Dg[t]=new Kb(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Dg[t]=new Kb(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Dg[t]=new Kb(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Dg[t]=new Kb(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Dg[t]=new Kb(t,5,!1,t.toLowerCase(),null,!1,!1)});var yJe=/[\-:]([a-z])/g;function bJe(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(yJe,bJe);Dg[e]=new Kb(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(yJe,bJe);Dg[e]=new Kb(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(yJe,bJe);Dg[e]=new Kb(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Dg[t]=new Kb(t,1,!1,t.toLowerCase(),null,!1,!1)});Dg.xlinkHref=new Kb("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Dg[t]=new Kb(t,1,!1,t.toLowerCase(),null,!0,!0)});function _Je(t,e,r,n){var o=Dg.hasOwnProperty(e)?Dg[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(i0n(e,r,o,n)&&(r=null),n||o===null?n0n(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 T1=qjt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,qye=Symbol.for("react.element"),f5=Symbol.for("react.portal"),p5=Symbol.for("react.fragment"),vJe=Symbol.for("react.strict_mode"),O6e=Symbol.for("react.profiler"),Bjt=Symbol.for("react.provider"),zjt=Symbol.for("react.context"),wJe=Symbol.for("react.forward_ref"),E6e=Symbol.for("react.suspense"),P6e=Symbol.for("react.suspense_list"),SJe=Symbol.for("react.memo"),wF=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var Vjt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var $Dt=Symbol.iterator;function Wte(t){return t===null||typeof t!="object"?null:(t=$Dt&&t[$Dt]||t["@@iterator"],typeof t=="function"?t:null)}var wc=Object.assign,n6e;function ere(t){if(n6e===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);n6e=e&&e[1]||""}return`
|
||
`+n6e+t}var o6e=!1;function i6e(t,e){if(!t||o6e)return"";o6e=!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{o6e=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?ere(t):""}function a0n(t){switch(t.tag){case 5:return ere(t.type);case 16:return ere("Lazy");case 13:return ere("Suspense");case 19:return ere("SuspenseList");case 0:case 2:case 15:return t=i6e(t.type,!1),t;case 11:return t=i6e(t.type.render,!1),t;case 1:return t=i6e(t.type,!0),t;default:return""}}function M6e(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 p5:return"Fragment";case f5:return"Portal";case O6e:return"Profiler";case vJe:return"StrictMode";case E6e:return"Suspense";case P6e:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case zjt:return(t.displayName||"Context")+".Consumer";case Bjt:return(t._context.displayName||"Context")+".Provider";case wJe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case SJe:return e=t.displayName||null,e!==null?e:M6e(t.type)||"Memo";case wF:e=t._payload,t=t._init;try{return M6e(t(e))}catch{}}return null}function s0n(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 M6e(e);case 8:return e===vJe?"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 jF(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Hjt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function u0n(t){var e=Hjt(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 Uye(t){t._valueTracker||(t._valueTracker=u0n(t))}function Wjt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=Hjt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function hbe(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 R6e(t,e){var r=e.checked;return wc({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function LDt(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=jF(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 Jjt(t,e){e=e.checked,e!=null&&_Je(t,"checked",e,!1)}function I6e(t,e){Jjt(t,e);var r=jF(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")?A6e(t,e.type,r):e.hasOwnProperty("defaultValue")&&A6e(t,e.type,jF(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function FDt(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 A6e(t,e,r){(e!=="number"||hbe(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var tre=Array.isArray;function x5(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=""+jF(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 N6e(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ut(91));return wc({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function kDt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(ut(92));if(tre(r)){if(1<r.length)throw Error(ut(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:jF(r)}}function Kjt(t,e){var r=jF(e.value),n=jF(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 qDt(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Gjt(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 D6e(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Gjt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Bye,Xjt=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(Bye=Bye||document.createElement("div"),Bye.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Bye.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function mre(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ore={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},l0n=["Webkit","ms","Moz","O"];Object.keys(ore).forEach(function(t){l0n.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ore[e]=ore[t]})});function Zjt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ore.hasOwnProperty(t)&&ore[t]?(""+e).trim():e+"px"}function Yjt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=Zjt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var c0n=wc({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 j6e(t,e){if(e){if(c0n[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ut(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ut(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ut(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ut(62))}}function $6e(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 L6e=null;function CJe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var F6e=null,T5=null,O5=null;function UDt(t){if(t=Are(t)){if(typeof F6e!="function")throw Error(ut(280));var e=t.stateNode;e&&(e=zbe(e),F6e(t.stateNode,t.type,e))}}function Qjt(t){T5?O5?O5.push(t):O5=[t]:T5=t}function e$t(){if(T5){var t=T5,e=O5;if(O5=T5=null,UDt(t),e)for(t=0;t<e.length;t++)UDt(e[t])}}function t$t(t,e){return t(e)}function r$t(){}var a6e=!1;function n$t(t,e,r){if(a6e)return t(e,r);a6e=!0;try{return t$t(t,e,r)}finally{a6e=!1,(T5!==null||O5!==null)&&(r$t(),e$t())}}function hre(t,e){var r=t.stateNode;if(r===null)return null;var n=zbe(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(ut(231,e,typeof r));return r}var k6e=!1;if(w1)try{c5={},Object.defineProperty(c5,"passive",{get:function(){k6e=!0}}),window.addEventListener("test",c5,c5),window.removeEventListener("test",c5,c5)}catch{k6e=!1}var c5;function d0n(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 ire=!1,gbe=null,ybe=!1,q6e=null,f0n={onError:function(t){ire=!0,gbe=t}};function p0n(t,e,r,n,o,i,a,s,u){ire=!1,gbe=null,d0n.apply(f0n,arguments)}function m0n(t,e,r,n,o,i,a,s,u){if(p0n.apply(this,arguments),ire){if(ire){var l=gbe;ire=!1,gbe=null}else throw Error(ut(198));ybe||(ybe=!0,q6e=l)}}function G4(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 o$t(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 BDt(t){if(G4(t)!==t)throw Error(ut(188))}function h0n(t){var e=t.alternate;if(!e){if(e=G4(t),e===null)throw Error(ut(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 BDt(o),t;if(i===n)return BDt(o),e;i=i.sibling}throw Error(ut(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(ut(189))}}if(r.alternate!==n)throw Error(ut(190))}if(r.tag!==3)throw Error(ut(188));return r.stateNode.current===r?t:e}function i$t(t){return t=h0n(t),t!==null?a$t(t):null}function a$t(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=a$t(t);if(e!==null)return e;t=t.sibling}return null}var s$t=gw.unstable_scheduleCallback,zDt=gw.unstable_cancelCallback,g0n=gw.unstable_shouldYield,y0n=gw.unstable_requestPaint,ud=gw.unstable_now,b0n=gw.unstable_getCurrentPriorityLevel,xJe=gw.unstable_ImmediatePriority,u$t=gw.unstable_UserBlockingPriority,bbe=gw.unstable_NormalPriority,_0n=gw.unstable_LowPriority,l$t=gw.unstable_IdlePriority,kbe=null,PO=null;function v0n(t){if(PO&&typeof PO.onCommitFiberRoot=="function")try{PO.onCommitFiberRoot(kbe,t,void 0,(t.current.flags&128)===128)}catch{}}var sx=Math.clz32?Math.clz32:C0n,w0n=Math.log,S0n=Math.LN2;function C0n(t){return t>>>=0,t===0?32:31-(w0n(t)/S0n|0)|0}var zye=64,Vye=4194304;function rre(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 _be(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=rre(s):(i&=a,i!==0&&(n=rre(i)))}else a=r&~o,a!==0?n=rre(a):i!==0&&(n=rre(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-sx(e),o=1<<r,n|=t[r],e&=~o;return n}function x0n(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 T0n(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-sx(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=x0n(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function U6e(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function c$t(){var t=zye;return zye<<=1,(zye&4194240)===0&&(zye=64),t}function s6e(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Rre(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-sx(e),t[e]=r}function O0n(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-sx(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function TJe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-sx(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var su=0;function d$t(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var f$t,OJe,p$t,m$t,h$t,B6e=!1,Hye=[],EF=null,PF=null,MF=null,gre=new Map,yre=new Map,CF=[],E0n="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 VDt(t,e){switch(t){case"focusin":case"focusout":EF=null;break;case"dragenter":case"dragleave":PF=null;break;case"mouseover":case"mouseout":MF=null;break;case"pointerover":case"pointerout":gre.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":yre.delete(e.pointerId)}}function Jte(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=Are(e),e!==null&&OJe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function P0n(t,e,r,n,o){switch(e){case"focusin":return EF=Jte(EF,t,e,r,n,o),!0;case"dragenter":return PF=Jte(PF,t,e,r,n,o),!0;case"mouseover":return MF=Jte(MF,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return gre.set(i,Jte(gre.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,yre.set(i,Jte(yre.get(i)||null,t,e,r,n,o)),!0}return!1}function g$t(t){var e=F4(t.target);if(e!==null){var r=G4(e);if(r!==null){if(e=r.tag,e===13){if(e=o$t(r),e!==null){t.blockedOn=e,h$t(t.priority,function(){p$t(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 ibe(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=z6e(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);L6e=n,r.target.dispatchEvent(n),L6e=null}else return e=Are(r),e!==null&&OJe(e),t.blockedOn=r,!1;e.shift()}return!0}function HDt(t,e,r){ibe(t)&&r.delete(e)}function M0n(){B6e=!1,EF!==null&&ibe(EF)&&(EF=null),PF!==null&&ibe(PF)&&(PF=null),MF!==null&&ibe(MF)&&(MF=null),gre.forEach(HDt),yre.forEach(HDt)}function Kte(t,e){t.blockedOn===e&&(t.blockedOn=null,B6e||(B6e=!0,gw.unstable_scheduleCallback(gw.unstable_NormalPriority,M0n)))}function bre(t){function e(o){return Kte(o,t)}if(0<Hye.length){Kte(Hye[0],t);for(var r=1;r<Hye.length;r++){var n=Hye[r];n.blockedOn===t&&(n.blockedOn=null)}}for(EF!==null&&Kte(EF,t),PF!==null&&Kte(PF,t),MF!==null&&Kte(MF,t),gre.forEach(e),yre.forEach(e),r=0;r<CF.length;r++)n=CF[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<CF.length&&(r=CF[0],r.blockedOn===null);)g$t(r),r.blockedOn===null&&CF.shift()}var E5=T1.ReactCurrentBatchConfig,vbe=!0;function R0n(t,e,r,n){var o=su,i=E5.transition;E5.transition=null;try{su=1,EJe(t,e,r,n)}finally{su=o,E5.transition=i}}function I0n(t,e,r,n){var o=su,i=E5.transition;E5.transition=null;try{su=4,EJe(t,e,r,n)}finally{su=o,E5.transition=i}}function EJe(t,e,r,n){if(vbe){var o=z6e(t,e,r,n);if(o===null)m6e(t,e,n,wbe,r),VDt(t,n);else if(P0n(o,t,e,r,n))n.stopPropagation();else if(VDt(t,n),e&4&&-1<E0n.indexOf(t)){for(;o!==null;){var i=Are(o);if(i!==null&&f$t(i),i=z6e(t,e,r,n),i===null&&m6e(t,e,n,wbe,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else m6e(t,e,n,null,r)}}var wbe=null;function z6e(t,e,r,n){if(wbe=null,t=CJe(n),t=F4(t),t!==null)if(e=G4(t),e===null)t=null;else if(r=e.tag,r===13){if(t=o$t(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 wbe=t,null}function y$t(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(b0n()){case xJe:return 1;case u$t:return 4;case bbe:case _0n:return 16;case l$t:return 536870912;default:return 16}default:return 16}}var TF=null,PJe=null,abe=null;function b$t(){if(abe)return abe;var t,e=PJe,r=e.length,n,o="value"in TF?TF.value:TF.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 abe=o.slice(t,1<n?1-n:void 0)}function sbe(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 Wye(){return!0}function WDt(){return!1}function yw(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)?Wye:WDt,this.isPropagationStopped=WDt,this}return wc(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=Wye)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Wye)},persist:function(){},isPersistent:Wye}),e}var L5={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},MJe=yw(L5),Ire=wc({},L5,{view:0,detail:0}),A0n=yw(Ire),u6e,l6e,Gte,qbe=wc({},Ire,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:RJe,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!==Gte&&(Gte&&t.type==="mousemove"?(u6e=t.screenX-Gte.screenX,l6e=t.screenY-Gte.screenY):l6e=u6e=0,Gte=t),u6e)},movementY:function(t){return"movementY"in t?t.movementY:l6e}}),JDt=yw(qbe),N0n=wc({},qbe,{dataTransfer:0}),D0n=yw(N0n),j0n=wc({},Ire,{relatedTarget:0}),c6e=yw(j0n),$0n=wc({},L5,{animationName:0,elapsedTime:0,pseudoElement:0}),L0n=yw($0n),F0n=wc({},L5,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),k0n=yw(F0n),q0n=wc({},L5,{data:0}),KDt=yw(q0n),U0n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},B0n={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"},z0n={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V0n(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=z0n[t])?!!e[t]:!1}function RJe(){return V0n}var H0n=wc({},Ire,{key:function(t){if(t.key){var e=U0n[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=sbe(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?B0n[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:RJe,charCode:function(t){return t.type==="keypress"?sbe(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?sbe(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),W0n=yw(H0n),J0n=wc({},qbe,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),GDt=yw(J0n),K0n=wc({},Ire,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:RJe}),G0n=yw(K0n),X0n=wc({},L5,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z0n=yw(X0n),Y0n=wc({},qbe,{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}),Q0n=yw(Y0n),eCn=[9,13,27,32],IJe=w1&&"CompositionEvent"in window,are=null;w1&&"documentMode"in document&&(are=document.documentMode);var tCn=w1&&"TextEvent"in window&&!are,_$t=w1&&(!IJe||are&&8<are&&11>=are),XDt=" ",ZDt=!1;function v$t(t,e){switch(t){case"keyup":return eCn.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function w$t(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var m5=!1;function rCn(t,e){switch(t){case"compositionend":return w$t(e);case"keypress":return e.which!==32?null:(ZDt=!0,XDt);case"textInput":return t=e.data,t===XDt&&ZDt?null:t;default:return null}}function nCn(t,e){if(m5)return t==="compositionend"||!IJe&&v$t(t,e)?(t=b$t(),abe=PJe=TF=null,m5=!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 _$t&&e.locale!=="ko"?null:e.data;default:return null}}var oCn={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 YDt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!oCn[t.type]:e==="textarea"}function S$t(t,e,r,n){Qjt(n),e=Sbe(e,"onChange"),0<e.length&&(r=new MJe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var sre=null,_re=null;function iCn(t){N$t(t,0)}function Ube(t){var e=y5(t);if(Wjt(e))return t}function aCn(t,e){if(t==="change")return e}var C$t=!1;w1&&(w1?(Kye="oninput"in document,Kye||(d6e=document.createElement("div"),d6e.setAttribute("oninput","return;"),Kye=typeof d6e.oninput=="function"),Jye=Kye):Jye=!1,C$t=Jye&&(!document.documentMode||9<document.documentMode));var Jye,Kye,d6e;function QDt(){sre&&(sre.detachEvent("onpropertychange",x$t),_re=sre=null)}function x$t(t){if(t.propertyName==="value"&&Ube(_re)){var e=[];S$t(e,_re,t,CJe(t)),n$t(iCn,e)}}function sCn(t,e,r){t==="focusin"?(QDt(),sre=e,_re=r,sre.attachEvent("onpropertychange",x$t)):t==="focusout"&&QDt()}function uCn(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ube(_re)}function lCn(t,e){if(t==="click")return Ube(e)}function cCn(t,e){if(t==="input"||t==="change")return Ube(e)}function dCn(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var lx=typeof Object.is=="function"?Object.is:dCn;function vre(t,e){if(lx(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(!T6e.call(e,o)||!lx(t[o],e[o]))return!1}return!0}function ejt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function tjt(t,e){var r=ejt(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=ejt(r)}}function T$t(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?T$t(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function O$t(){for(var t=window,e=hbe();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=hbe(t.document)}return e}function AJe(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 fCn(t){var e=O$t(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&T$t(r.ownerDocument.documentElement,r)){if(n!==null&&AJe(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=tjt(r,i);var a=tjt(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 pCn=w1&&"documentMode"in document&&11>=document.documentMode,h5=null,V6e=null,ure=null,H6e=!1;function rjt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;H6e||h5==null||h5!==hbe(n)||(n=h5,"selectionStart"in n&&AJe(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}),ure&&vre(ure,n)||(ure=n,n=Sbe(V6e,"onSelect"),0<n.length&&(e=new MJe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=h5)))}function Gye(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var g5={animationend:Gye("Animation","AnimationEnd"),animationiteration:Gye("Animation","AnimationIteration"),animationstart:Gye("Animation","AnimationStart"),transitionend:Gye("Transition","TransitionEnd")},f6e={},E$t={};w1&&(E$t=document.createElement("div").style,"AnimationEvent"in window||(delete g5.animationend.animation,delete g5.animationiteration.animation,delete g5.animationstart.animation),"TransitionEvent"in window||delete g5.transitionend.transition);function Bbe(t){if(f6e[t])return f6e[t];if(!g5[t])return t;var e=g5[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in E$t)return f6e[t]=e[r];return t}var P$t=Bbe("animationend"),M$t=Bbe("animationiteration"),R$t=Bbe("animationstart"),I$t=Bbe("transitionend"),A$t=new Map,njt="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 LF(t,e){A$t.set(t,e),K4(e,[t])}for(Xye=0;Xye<njt.length;Xye++)Zye=njt[Xye],ojt=Zye.toLowerCase(),ijt=Zye[0].toUpperCase()+Zye.slice(1),LF(ojt,"on"+ijt);var Zye,ojt,ijt,Xye;LF(P$t,"onAnimationEnd");LF(M$t,"onAnimationIteration");LF(R$t,"onAnimationStart");LF("dblclick","onDoubleClick");LF("focusin","onFocus");LF("focusout","onBlur");LF(I$t,"onTransitionEnd");R5("onMouseEnter",["mouseout","mouseover"]);R5("onMouseLeave",["mouseout","mouseover"]);R5("onPointerEnter",["pointerout","pointerover"]);R5("onPointerLeave",["pointerout","pointerover"]);K4("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));K4("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));K4("onBeforeInput",["compositionend","keypress","textInput","paste"]);K4("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));K4("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));K4("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nre="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(" "),mCn=new Set("cancel close invalid load scroll toggle".split(" ").concat(nre));function ajt(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,m0n(n,e,void 0,t),t.currentTarget=null}function N$t(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;ajt(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;ajt(o,s,l),i=u}}}if(ybe)throw t=q6e,ybe=!1,q6e=null,t}function yl(t,e){var r=e[X6e];r===void 0&&(r=e[X6e]=new Set);var n=t+"__bubble";r.has(n)||(D$t(e,t,2,!1),r.add(n))}function p6e(t,e,r){var n=0;e&&(n|=4),D$t(r,t,n,e)}var Yye="_reactListening"+Math.random().toString(36).slice(2);function wre(t){if(!t[Yye]){t[Yye]=!0,Ujt.forEach(function(r){r!=="selectionchange"&&(mCn.has(r)||p6e(r,!1,t),p6e(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Yye]||(e[Yye]=!0,p6e("selectionchange",!1,e))}}function D$t(t,e,r,n){switch(y$t(e)){case 1:var o=R0n;break;case 4:o=I0n;break;default:o=EJe}r=o.bind(null,e,r,t),o=void 0,!k6e||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 m6e(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=F4(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}n$t(function(){var l=i,c=CJe(r),d=[];e:{var f=A$t.get(t);if(f!==void 0){var p=MJe,m=t;switch(t){case"keypress":if(sbe(r)===0)break e;case"keydown":case"keyup":p=W0n;break;case"focusin":m="focus",p=c6e;break;case"focusout":m="blur",p=c6e;break;case"beforeblur":case"afterblur":p=c6e;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=JDt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=D0n;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=G0n;break;case P$t:case M$t:case R$t:p=L0n;break;case I$t:p=Z0n;break;case"scroll":p=A0n;break;case"wheel":p=Q0n;break;case"copy":case"cut":case"paste":p=k0n;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=GDt}var h=(e&4)!==0,y=!h&&t==="scroll",g=h?f!==null?f+"Capture":null:f;h=[];for(var b=l,_;b!==null;){_=b;var w=_.stateNode;if(_.tag===5&&w!==null&&(_=w,g!==null&&(w=hre(b,g),w!=null&&h.push(Sre(b,w,_)))),y)break;b=b.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!==L6e&&(m=r.relatedTarget||r.fromElement)&&(F4(m)||m[S1]))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?F4(m):null,m!==null&&(y=G4(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=JDt,w="onMouseLeave",g="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(h=GDt,w="onPointerLeave",g="onPointerEnter",b="pointer"),y=p==null?f:y5(p),_=m==null?f:y5(m),f=new h(w,b+"leave",p,r,c),f.target=y,f.relatedTarget=_,w=null,F4(c)===l&&(h=new h(g,b+"enter",m,r,c),h.target=_,h.relatedTarget=y,w=h),y=w,p&&m)t:{for(h=p,g=m,b=0,_=h;_;_=d5(_))b++;for(_=0,w=g;w;w=d5(w))_++;for(;0<b-_;)h=d5(h),b--;for(;0<_-b;)g=d5(g),_--;for(;b--;){if(h===g||g!==null&&h===g.alternate)break t;h=d5(h),g=d5(g)}h=null}else h=null;p!==null&&sjt(d,f,p,h,!1),m!==null&&y!==null&&sjt(d,y,m,h,!0)}}e:{if(f=l?y5(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var T=aCn;else if(YDt(f))if(C$t)T=cCn;else{T=uCn;var O=sCn}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(T=lCn);if(T&&(T=T(t,l))){S$t(d,T,r,c);break e}O&&O(t,f,l),t==="focusout"&&(O=f._wrapperState)&&O.controlled&&f.type==="number"&&A6e(f,"number",f.value)}switch(O=l?y5(l):window,t){case"focusin":(YDt(O)||O.contentEditable==="true")&&(h5=O,V6e=l,ure=null);break;case"focusout":ure=V6e=h5=null;break;case"mousedown":H6e=!0;break;case"contextmenu":case"mouseup":case"dragend":H6e=!1,rjt(d,r,c);break;case"selectionchange":if(pCn)break;case"keydown":case"keyup":rjt(d,r,c)}var E;if(IJe)e:{switch(t){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else m5?v$t(t,r)&&(P="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(P="onCompositionStart");P&&(_$t&&r.locale!=="ko"&&(m5||P!=="onCompositionStart"?P==="onCompositionEnd"&&m5&&(E=b$t()):(TF=c,PJe="value"in TF?TF.value:TF.textContent,m5=!0)),O=Sbe(l,P),0<O.length&&(P=new KDt(P,t,null,r,c),d.push({event:P,listeners:O}),E?P.data=E:(E=w$t(r),E!==null&&(P.data=E)))),(E=tCn?rCn(t,r):nCn(t,r))&&(l=Sbe(l,"onBeforeInput"),0<l.length&&(c=new KDt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}N$t(d,e)})}function Sre(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Sbe(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=hre(t,r),i!=null&&n.unshift(Sre(t,i,o)),i=hre(t,e),i!=null&&n.push(Sre(t,i,o))),t=t.return}return n}function d5(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function sjt(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=hre(r,i),u!=null&&a.unshift(Sre(r,u,s))):o||(u=hre(r,i),u!=null&&a.push(Sre(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var hCn=/\r\n?/g,gCn=/\u0000|\uFFFD/g;function ujt(t){return(typeof t=="string"?t:""+t).replace(hCn,`
|
||
`).replace(gCn,"")}function Qye(t,e,r){if(e=ujt(e),ujt(t)!==e&&r)throw Error(ut(425))}function Cbe(){}var W6e=null,J6e=null;function K6e(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 G6e=typeof setTimeout=="function"?setTimeout:void 0,yCn=typeof clearTimeout=="function"?clearTimeout:void 0,ljt=typeof Promise=="function"?Promise:void 0,bCn=typeof queueMicrotask=="function"?queueMicrotask:typeof ljt<"u"?function(t){return ljt.resolve(null).then(t).catch(_Cn)}:G6e;function _Cn(t){setTimeout(function(){throw t})}function h6e(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),bre(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);bre(e)}function RF(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 cjt(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 F5=Math.random().toString(36).slice(2),EO="__reactFiber$"+F5,Cre="__reactProps$"+F5,S1="__reactContainer$"+F5,X6e="__reactEvents$"+F5,vCn="__reactListeners$"+F5,wCn="__reactHandles$"+F5;function F4(t){var e=t[EO];if(e)return e;for(var r=t.parentNode;r;){if(e=r[S1]||r[EO]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=cjt(t);t!==null;){if(r=t[EO])return r;t=cjt(t)}return e}t=r,r=t.parentNode}return null}function Are(t){return t=t[EO]||t[S1],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function y5(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(ut(33))}function zbe(t){return t[Cre]||null}var Z6e=[],b5=-1;function FF(t){return{current:t}}function bl(t){0>b5||(t.current=Z6e[b5],Z6e[b5]=null,b5--)}function Zu(t,e){b5++,Z6e[b5]=t.current,t.current=e}var $F={},By=FF($F),H_=FF(!1),z4=$F;function I5(t,e){var r=t.type.contextTypes;if(!r)return $F;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 W_(t){return t=t.childContextTypes,t!=null}function xbe(){bl(H_),bl(By)}function djt(t,e,r){if(By.current!==$F)throw Error(ut(168));Zu(By,e),Zu(H_,r)}function j$t(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(ut(108,s0n(t)||"Unknown",o));return wc({},r,n)}function Tbe(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||$F,z4=By.current,Zu(By,t),Zu(H_,H_.current),!0}function fjt(t,e,r){var n=t.stateNode;if(!n)throw Error(ut(169));r?(t=j$t(t,e,z4),n.__reactInternalMemoizedMergedChildContext=t,bl(H_),bl(By),Zu(By,t)):bl(H_),Zu(H_,r)}var y1=null,Vbe=!1,g6e=!1;function $$t(t){y1===null?y1=[t]:y1.push(t)}function SCn(t){Vbe=!0,$$t(t)}function kF(){if(!g6e&&y1!==null){g6e=!0;var t=0,e=su;try{var r=y1;for(su=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}y1=null,Vbe=!1}catch(o){throw y1!==null&&(y1=y1.slice(t+1)),s$t(xJe,kF),o}finally{su=e,g6e=!1}}return null}var _5=[],v5=0,Obe=null,Ebe=0,WS=[],JS=0,V4=null,b1=1,_1="";function $4(t,e){_5[v5++]=Ebe,_5[v5++]=Obe,Obe=t,Ebe=e}function L$t(t,e,r){WS[JS++]=b1,WS[JS++]=_1,WS[JS++]=V4,V4=t;var n=b1;t=_1;var o=32-sx(n)-1;n&=~(1<<o),r+=1;var i=32-sx(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,b1=1<<32-sx(e)+o|r<<o|n,_1=i+t}else b1=1<<i|r<<o|n,_1=t}function NJe(t){t.return!==null&&($4(t,1),L$t(t,1,0))}function DJe(t){for(;t===Obe;)Obe=_5[--v5],_5[v5]=null,Ebe=_5[--v5],_5[v5]=null;for(;t===V4;)V4=WS[--JS],WS[JS]=null,_1=WS[--JS],WS[JS]=null,b1=WS[--JS],WS[JS]=null}var hw=null,mw=null,Vl=!1,ax=null;function F$t(t,e){var r=KS(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 pjt(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,hw=t,mw=RF(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,hw=t,mw=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=V4!==null?{id:b1,overflow:_1}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=KS(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,hw=t,mw=null,!0):!1;default:return!1}}function Y6e(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Q6e(t){if(Vl){var e=mw;if(e){var r=e;if(!pjt(t,e)){if(Y6e(t))throw Error(ut(418));e=RF(r.nextSibling);var n=hw;e&&pjt(t,e)?F$t(n,r):(t.flags=t.flags&-4097|2,Vl=!1,hw=t)}}else{if(Y6e(t))throw Error(ut(418));t.flags=t.flags&-4097|2,Vl=!1,hw=t}}}function mjt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;hw=t}function ebe(t){if(t!==hw)return!1;if(!Vl)return mjt(t),Vl=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!K6e(t.type,t.memoizedProps)),e&&(e=mw)){if(Y6e(t))throw k$t(),Error(ut(418));for(;e;)F$t(t,e),e=RF(e.nextSibling)}if(mjt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ut(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){mw=RF(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}mw=null}}else mw=hw?RF(t.stateNode.nextSibling):null;return!0}function k$t(){for(var t=mw;t;)t=RF(t.nextSibling)}function A5(){mw=hw=null,Vl=!1}function jJe(t){ax===null?ax=[t]:ax.push(t)}var CCn=T1.ReactCurrentBatchConfig;function ox(t,e){if(t&&t.defaultProps){e=wc({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var Pbe=FF(null),Mbe=null,w5=null,$Je=null;function LJe(){$Je=w5=Mbe=null}function FJe(t){var e=Pbe.current;bl(Pbe),t._currentValue=e}function eJe(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 P5(t,e){Mbe=t,$Je=w5=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(V_=!0),t.firstContext=null)}function XS(t){var e=t._currentValue;if($Je!==t)if(t={context:t,memoizedValue:e,next:null},w5===null){if(Mbe===null)throw Error(ut(308));w5=t,Mbe.dependencies={lanes:0,firstContext:t}}else w5=w5.next=t;return e}var k4=null;function kJe(t){k4===null?k4=[t]:k4.push(t)}function q$t(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,kJe(e)):(r.next=o.next,o.next=r),e.interleaved=r,C1(t,n)}function C1(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 SF=!1;function qJe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function U$t(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 v1(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function IF(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(ns&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,C1(t,r)}return o=n.interleaved,o===null?(e.next=e,kJe(n)):(e.next=o.next,o.next=e),n.interleaved=e,C1(t,r)}function ube(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,TJe(t,r)}}function hjt(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 Rbe(t,e,r,n){var o=t.updateQueue;SF=!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=wc({},d,f);break e;case 2:SF=!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);W4|=a,t.lanes=a,t.memoizedState=d}}function gjt(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(ut(191,o));o.call(n)}}}var B$t=new qjt.Component().refs;function tJe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:wc({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Hbe={isMounted:function(t){return(t=t._reactInternals)?G4(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=Jb(),o=NF(t),i=v1(n,o);i.payload=e,r!=null&&(i.callback=r),e=IF(t,i,o),e!==null&&(ux(e,t,o,n),ube(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=Jb(),o=NF(t),i=v1(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=IF(t,i,o),e!==null&&(ux(e,t,o,n),ube(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=Jb(),n=NF(t),o=v1(r,n);o.tag=2,e!=null&&(o.callback=e),e=IF(t,o,n),e!==null&&(ux(e,t,n,r),ube(e,t,n))}};function yjt(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?!vre(r,n)||!vre(o,i):!0}function z$t(t,e,r){var n=!1,o=$F,i=e.contextType;return typeof i=="object"&&i!==null?i=XS(i):(o=W_(e)?z4:By.current,n=e.contextTypes,i=(n=n!=null)?I5(t,o):$F),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Hbe,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function bjt(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&&Hbe.enqueueReplaceState(e,e.state,null)}function rJe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=B$t,qJe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=XS(i):(i=W_(e)?z4:By.current,o.context=I5(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(tJe(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&&Hbe.enqueueReplaceState(o,o.state,null),Rbe(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function Xte(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(ut(309));var n=r.stateNode}if(!n)throw Error(ut(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===B$t&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(ut(284));if(!r._owner)throw Error(ut(290,t))}return t}function tbe(t,e){throw t=Object.prototype.toString.call(e),Error(ut(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function _jt(t){var e=t._init;return e(t._payload)}function V$t(t){function e(g,b){if(t){var _=g.deletions;_===null?(g.deletions=[b],g.flags|=16):_.push(b)}}function r(g,b){if(!t)return null;for(;b!==null;)e(g,b),b=b.sibling;return null}function n(g,b){for(g=new Map;b!==null;)b.key!==null?g.set(b.key,b):g.set(b.index,b),b=b.sibling;return g}function o(g,b){return g=DF(g,b),g.index=0,g.sibling=null,g}function i(g,b,_){return g.index=_,t?(_=g.alternate,_!==null?(_=_.index,_<b?(g.flags|=2,b):_):(g.flags|=2,b)):(g.flags|=1048576,b)}function a(g){return t&&g.alternate===null&&(g.flags|=2),g}function s(g,b,_,w){return b===null||b.tag!==6?(b=C6e(_,g.mode,w),b.return=g,b):(b=o(b,_),b.return=g,b)}function u(g,b,_,w){var T=_.type;return T===p5?c(g,b,_.props.children,w,_.key):b!==null&&(b.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===wF&&_jt(T)===b.type)?(w=o(b,_.props),w.ref=Xte(g,b,_),w.return=g,w):(w=mbe(_.type,_.key,_.props,null,g.mode,w),w.ref=Xte(g,b,_),w.return=g,w)}function l(g,b,_,w){return b===null||b.tag!==4||b.stateNode.containerInfo!==_.containerInfo||b.stateNode.implementation!==_.implementation?(b=x6e(_,g.mode,w),b.return=g,b):(b=o(b,_.children||[]),b.return=g,b)}function c(g,b,_,w,T){return b===null||b.tag!==7?(b=B4(_,g.mode,w,T),b.return=g,b):(b=o(b,_),b.return=g,b)}function d(g,b,_){if(typeof b=="string"&&b!==""||typeof b=="number")return b=C6e(""+b,g.mode,_),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case qye:return _=mbe(b.type,b.key,b.props,null,g.mode,_),_.ref=Xte(g,null,b),_.return=g,_;case f5:return b=x6e(b,g.mode,_),b.return=g,b;case wF:var w=b._init;return d(g,w(b._payload),_)}if(tre(b)||Wte(b))return b=B4(b,g.mode,_,null),b.return=g,b;tbe(g,b)}return null}function f(g,b,_,w){var T=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return T!==null?null:s(g,b,""+_,w);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case qye:return _.key===T?u(g,b,_,w):null;case f5:return _.key===T?l(g,b,_,w):null;case wF:return T=_._init,f(g,b,T(_._payload),w)}if(tre(_)||Wte(_))return T!==null?null:c(g,b,_,w,null);tbe(g,_)}return null}function p(g,b,_,w,T){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(_)||null,s(b,g,""+w,T);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case qye:return g=g.get(w.key===null?_:w.key)||null,u(b,g,w,T);case f5:return g=g.get(w.key===null?_:w.key)||null,l(b,g,w,T);case wF:var O=w._init;return p(g,b,_,O(w._payload),T)}if(tre(w)||Wte(w))return g=g.get(_)||null,c(b,g,w,T,null);tbe(b,w)}return null}function m(g,b,_,w){for(var T=null,O=null,E=b,P=b=0,R=null;E!==null&&P<_.length;P++){E.index>P?(R=E,E=null):R=E.sibling;var I=f(g,E,_[P],w);if(I===null){E===null&&(E=R);break}t&&E&&I.alternate===null&&e(g,E),b=i(I,b,P),O===null?T=I:O.sibling=I,O=I,E=R}if(P===_.length)return r(g,E),Vl&&$4(g,P),T;if(E===null){for(;P<_.length;P++)E=d(g,_[P],w),E!==null&&(b=i(E,b,P),O===null?T=E:O.sibling=E,O=E);return Vl&&$4(g,P),T}for(E=n(g,E);P<_.length;P++)R=p(E,g,P,_[P],w),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?P:R.key),b=i(R,b,P),O===null?T=R:O.sibling=R,O=R);return t&&E.forEach(function(N){return e(g,N)}),Vl&&$4(g,P),T}function h(g,b,_,w){var T=Wte(_);if(typeof T!="function")throw Error(ut(150));if(_=T.call(_),_==null)throw Error(ut(151));for(var O=T=null,E=b,P=b=0,R=null,I=_.next();E!==null&&!I.done;P++,I=_.next()){E.index>P?(R=E,E=null):R=E.sibling;var N=f(g,E,I.value,w);if(N===null){E===null&&(E=R);break}t&&E&&N.alternate===null&&e(g,E),b=i(N,b,P),O===null?T=N:O.sibling=N,O=N,E=R}if(I.done)return r(g,E),Vl&&$4(g,P),T;if(E===null){for(;!I.done;P++,I=_.next())I=d(g,I.value,w),I!==null&&(b=i(I,b,P),O===null?T=I:O.sibling=I,O=I);return Vl&&$4(g,P),T}for(E=n(g,E);!I.done;P++,I=_.next())I=p(E,g,P,I.value,w),I!==null&&(t&&I.alternate!==null&&E.delete(I.key===null?P:I.key),b=i(I,b,P),O===null?T=I:O.sibling=I,O=I);return t&&E.forEach(function(z){return e(g,z)}),Vl&&$4(g,P),T}function y(g,b,_,w){if(typeof _=="object"&&_!==null&&_.type===p5&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case qye:e:{for(var T=_.key,O=b;O!==null;){if(O.key===T){if(T=_.type,T===p5){if(O.tag===7){r(g,O.sibling),b=o(O,_.props.children),b.return=g,g=b;break e}}else if(O.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===wF&&_jt(T)===O.type){r(g,O.sibling),b=o(O,_.props),b.ref=Xte(g,O,_),b.return=g,g=b;break e}r(g,O);break}else e(g,O);O=O.sibling}_.type===p5?(b=B4(_.props.children,g.mode,w,_.key),b.return=g,g=b):(w=mbe(_.type,_.key,_.props,null,g.mode,w),w.ref=Xte(g,b,_),w.return=g,g=w)}return a(g);case f5:e:{for(O=_.key;b!==null;){if(b.key===O)if(b.tag===4&&b.stateNode.containerInfo===_.containerInfo&&b.stateNode.implementation===_.implementation){r(g,b.sibling),b=o(b,_.children||[]),b.return=g,g=b;break e}else{r(g,b);break}else e(g,b);b=b.sibling}b=x6e(_,g.mode,w),b.return=g,g=b}return a(g);case wF:return O=_._init,y(g,b,O(_._payload),w)}if(tre(_))return m(g,b,_,w);if(Wte(_))return h(g,b,_,w);tbe(g,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,b!==null&&b.tag===6?(r(g,b.sibling),b=o(b,_),b.return=g,g=b):(r(g,b),b=C6e(_,g.mode,w),b.return=g,g=b),a(g)):r(g,b)}return y}var N5=V$t(!0),H$t=V$t(!1),Nre={},MO=FF(Nre),xre=FF(Nre),Tre=FF(Nre);function q4(t){if(t===Nre)throw Error(ut(174));return t}function UJe(t,e){switch(Zu(Tre,e),Zu(xre,t),Zu(MO,Nre),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:D6e(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=D6e(e,t)}bl(MO),Zu(MO,e)}function D5(){bl(MO),bl(xre),bl(Tre)}function W$t(t){q4(Tre.current);var e=q4(MO.current),r=D6e(e,t.type);e!==r&&(Zu(xre,t),Zu(MO,r))}function BJe(t){xre.current===t&&(bl(MO),bl(xre))}var _c=FF(0);function Ibe(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 y6e=[];function zJe(){for(var t=0;t<y6e.length;t++)y6e[t]._workInProgressVersionPrimary=null;y6e.length=0}var lbe=T1.ReactCurrentDispatcher,b6e=T1.ReactCurrentBatchConfig,H4=0,vc=null,Nm=null,Dh=null,Abe=!1,lre=!1,Ore=0,xCn=0;function ky(){throw Error(ut(321))}function VJe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!lx(t[r],e[r]))return!1;return!0}function HJe(t,e,r,n,o,i){if(H4=i,vc=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,lbe.current=t===null||t.memoizedState===null?PCn:MCn,t=r(n,o),lre){i=0;do{if(lre=!1,Ore=0,25<=i)throw Error(ut(301));i+=1,Dh=Nm=null,e.updateQueue=null,lbe.current=RCn,t=r(n,o)}while(lre)}if(lbe.current=Nbe,e=Nm!==null&&Nm.next!==null,H4=0,Dh=Nm=vc=null,Abe=!1,e)throw Error(ut(300));return t}function WJe(){var t=Ore!==0;return Ore=0,t}function OO(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dh===null?vc.memoizedState=Dh=t:Dh=Dh.next=t,Dh}function ZS(){if(Nm===null){var t=vc.alternate;t=t!==null?t.memoizedState:null}else t=Nm.next;var e=Dh===null?vc.memoizedState:Dh.next;if(e!==null)Dh=e,Nm=t;else{if(t===null)throw Error(ut(310));Nm=t,t={memoizedState:Nm.memoizedState,baseState:Nm.baseState,baseQueue:Nm.baseQueue,queue:Nm.queue,next:null},Dh===null?vc.memoizedState=Dh=t:Dh=Dh.next=t}return Dh}function Ere(t,e){return typeof e=="function"?e(t):e}function _6e(t){var e=ZS(),r=e.queue;if(r===null)throw Error(ut(311));r.lastRenderedReducer=t;var n=Nm,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((H4&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,vc.lanes|=c,W4|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,lx(n,e.memoizedState)||(V_=!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,vc.lanes|=i,W4|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function v6e(t){var e=ZS(),r=e.queue;if(r===null)throw Error(ut(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);lx(i,e.memoizedState)||(V_=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function J$t(){}function K$t(t,e){var r=vc,n=ZS(),o=e(),i=!lx(n.memoizedState,o);if(i&&(n.memoizedState=o,V_=!0),n=n.queue,JJe(Z$t.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||Dh!==null&&Dh.memoizedState.tag&1){if(r.flags|=2048,Pre(9,X$t.bind(null,r,n,o,e),void 0,null),jh===null)throw Error(ut(349));(H4&30)!==0||G$t(r,e,o)}return o}function G$t(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=vc.updateQueue,e===null?(e={lastEffect:null,stores:null},vc.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function X$t(t,e,r,n){e.value=r,e.getSnapshot=n,Y$t(e)&&Q$t(t)}function Z$t(t,e,r){return r(function(){Y$t(e)&&Q$t(t)})}function Y$t(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!lx(t,r)}catch{return!0}}function Q$t(t){var e=C1(t,1);e!==null&&ux(e,t,1,-1)}function vjt(t){var e=OO();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ere,lastRenderedState:t},e.queue=t,t=t.dispatch=ECn.bind(null,vc,t),[e.memoizedState,t]}function Pre(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=vc.updateQueue,e===null?(e={lastEffect:null,stores:null},vc.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 eLt(){return ZS().memoizedState}function cbe(t,e,r,n){var o=OO();vc.flags|=t,o.memoizedState=Pre(1|e,r,void 0,n===void 0?null:n)}function Wbe(t,e,r,n){var o=ZS();n=n===void 0?null:n;var i=void 0;if(Nm!==null){var a=Nm.memoizedState;if(i=a.destroy,n!==null&&VJe(n,a.deps)){o.memoizedState=Pre(e,r,i,n);return}}vc.flags|=t,o.memoizedState=Pre(1|e,r,i,n)}function wjt(t,e){return cbe(8390656,8,t,e)}function JJe(t,e){return Wbe(2048,8,t,e)}function tLt(t,e){return Wbe(4,2,t,e)}function rLt(t,e){return Wbe(4,4,t,e)}function nLt(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 oLt(t,e,r){return r=r!=null?r.concat([t]):null,Wbe(4,4,nLt.bind(null,e,t),r)}function KJe(){}function iLt(t,e){var r=ZS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&VJe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function aLt(t,e){var r=ZS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&VJe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function sLt(t,e,r){return(H4&21)===0?(t.baseState&&(t.baseState=!1,V_=!0),t.memoizedState=r):(lx(r,e)||(r=c$t(),vc.lanes|=r,W4|=r,t.baseState=!0),e)}function TCn(t,e){var r=su;su=r!==0&&4>r?r:4,t(!0);var n=b6e.transition;b6e.transition={};try{t(!1),e()}finally{su=r,b6e.transition=n}}function uLt(){return ZS().memoizedState}function OCn(t,e,r){var n=NF(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},lLt(t))cLt(e,r);else if(r=q$t(t,e,r,n),r!==null){var o=Jb();ux(r,t,n,o),dLt(r,e,n)}}function ECn(t,e,r){var n=NF(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(lLt(t))cLt(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,lx(s,a)){var u=e.interleaved;u===null?(o.next=o,kJe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=q$t(t,e,o,n),r!==null&&(o=Jb(),ux(r,t,n,o),dLt(r,e,n))}}function lLt(t){var e=t.alternate;return t===vc||e!==null&&e===vc}function cLt(t,e){lre=Abe=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function dLt(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,TJe(t,r)}}var Nbe={readContext:XS,useCallback:ky,useContext:ky,useEffect:ky,useImperativeHandle:ky,useInsertionEffect:ky,useLayoutEffect:ky,useMemo:ky,useReducer:ky,useRef:ky,useState:ky,useDebugValue:ky,useDeferredValue:ky,useTransition:ky,useMutableSource:ky,useSyncExternalStore:ky,useId:ky,unstable_isNewReconciler:!1},PCn={readContext:XS,useCallback:function(t,e){return OO().memoizedState=[t,e===void 0?null:e],t},useContext:XS,useEffect:wjt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,cbe(4194308,4,nLt.bind(null,e,t),r)},useLayoutEffect:function(t,e){return cbe(4194308,4,t,e)},useInsertionEffect:function(t,e){return cbe(4,2,t,e)},useMemo:function(t,e){var r=OO();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=OO();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=OCn.bind(null,vc,t),[n.memoizedState,t]},useRef:function(t){var e=OO();return t={current:t},e.memoizedState=t},useState:vjt,useDebugValue:KJe,useDeferredValue:function(t){return OO().memoizedState=t},useTransition:function(){var t=vjt(!1),e=t[0];return t=TCn.bind(null,t[1]),OO().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=vc,o=OO();if(Vl){if(r===void 0)throw Error(ut(407));r=r()}else{if(r=e(),jh===null)throw Error(ut(349));(H4&30)!==0||G$t(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,wjt(Z$t.bind(null,n,i,t),[t]),n.flags|=2048,Pre(9,X$t.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=OO(),e=jh.identifierPrefix;if(Vl){var r=_1,n=b1;r=(n&~(1<<32-sx(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ore++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=xCn++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},MCn={readContext:XS,useCallback:iLt,useContext:XS,useEffect:JJe,useImperativeHandle:oLt,useInsertionEffect:tLt,useLayoutEffect:rLt,useMemo:aLt,useReducer:_6e,useRef:eLt,useState:function(){return _6e(Ere)},useDebugValue:KJe,useDeferredValue:function(t){var e=ZS();return sLt(e,Nm.memoizedState,t)},useTransition:function(){var t=_6e(Ere)[0],e=ZS().memoizedState;return[t,e]},useMutableSource:J$t,useSyncExternalStore:K$t,useId:uLt,unstable_isNewReconciler:!1},RCn={readContext:XS,useCallback:iLt,useContext:XS,useEffect:JJe,useImperativeHandle:oLt,useInsertionEffect:tLt,useLayoutEffect:rLt,useMemo:aLt,useReducer:v6e,useRef:eLt,useState:function(){return v6e(Ere)},useDebugValue:KJe,useDeferredValue:function(t){var e=ZS();return Nm===null?e.memoizedState=t:sLt(e,Nm.memoizedState,t)},useTransition:function(){var t=v6e(Ere)[0],e=ZS().memoizedState;return[t,e]},useMutableSource:J$t,useSyncExternalStore:K$t,useId:uLt,unstable_isNewReconciler:!1};function j5(t,e){try{var r="",n=e;do r+=a0n(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 w6e(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function nJe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var ICn=typeof WeakMap=="function"?WeakMap:Map;function fLt(t,e,r){r=v1(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){jbe||(jbe=!0,pJe=n),nJe(t,e)},r}function pLt(t,e,r){r=v1(-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(){nJe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){nJe(t,e),typeof n!="function"&&(AF===null?AF=new Set([this]):AF.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function Sjt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new ICn;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=HCn.bind(null,t,e,r),e.then(t,t))}function Cjt(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 xjt(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=v1(-1,1),e.tag=2,IF(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var ACn=T1.ReactCurrentOwner,V_=!1;function Wb(t,e,r,n){e.child=t===null?H$t(e,null,r,n):N5(e,t.child,r,n)}function Tjt(t,e,r,n,o){r=r.render;var i=e.ref;return P5(e,o),n=HJe(t,e,r,n,i,o),r=WJe(),t!==null&&!V_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,x1(t,e,o)):(Vl&&r&&NJe(e),e.flags|=1,Wb(t,e,n,o),e.child)}function Ojt(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!r5e(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,mLt(t,e,i,n,o)):(t=mbe(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:vre,r(a,n)&&t.ref===e.ref)return x1(t,e,o)}return e.flags|=1,t=DF(i,n),t.ref=e.ref,t.return=e,e.child=t}function mLt(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(vre(i,n)&&t.ref===e.ref)if(V_=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(V_=!0);else return e.lanes=t.lanes,x1(t,e,o)}return oJe(t,e,r,n,o)}function hLt(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},Zu(C5,pw),pw|=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,Zu(C5,pw),pw|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Zu(C5,pw),pw|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,Zu(C5,pw),pw|=n;return Wb(t,e,o,r),e.child}function gLt(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function oJe(t,e,r,n,o){var i=W_(r)?z4:By.current;return i=I5(e,i),P5(e,o),r=HJe(t,e,r,n,i,o),n=WJe(),t!==null&&!V_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,x1(t,e,o)):(Vl&&n&&NJe(e),e.flags|=1,Wb(t,e,r,o),e.child)}function Ejt(t,e,r,n,o){if(W_(r)){var i=!0;Tbe(e)}else i=!1;if(P5(e,o),e.stateNode===null)dbe(t,e),z$t(e,r,n),rJe(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=XS(l):(l=W_(r)?z4:By.current,l=I5(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)&&bjt(e,a,n,l),SF=!1;var f=e.memoizedState;a.state=f,Rbe(e,n,a,o),u=e.memoizedState,s!==n||f!==u||H_.current||SF?(typeof c=="function"&&(tJe(e,r,c,n),u=e.memoizedState),(s=SF||yjt(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,U$t(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:ox(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=XS(u):(u=W_(r)?z4:By.current,u=I5(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)&&bjt(e,a,n,u),SF=!1,f=e.memoizedState,a.state=f,Rbe(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||H_.current||SF?(typeof p=="function"&&(tJe(e,r,p,n),m=e.memoizedState),(l=SF||yjt(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 iJe(t,e,r,n,i,o)}function iJe(t,e,r,n,o,i){gLt(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&fjt(e,r,!1),x1(t,e,i);n=e.stateNode,ACn.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=N5(e,t.child,null,i),e.child=N5(e,null,s,i)):Wb(t,e,s,i),e.memoizedState=n.state,o&&fjt(e,r,!0),e.child}function yLt(t){var e=t.stateNode;e.pendingContext?djt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&djt(t,e.context,!1),UJe(t,e.containerInfo)}function Pjt(t,e,r,n,o){return A5(),jJe(o),e.flags|=256,Wb(t,e,r,n),e.child}var aJe={dehydrated:null,treeContext:null,retryLane:0};function sJe(t){return{baseLanes:t,cachePool:null,transitions:null}}function bLt(t,e,r){var n=e.pendingProps,o=_c.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),Zu(_c,o&1),t===null)return Q6e(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=Gbe(a,n,0,null),t=B4(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=sJe(r),e.memoizedState=aJe,t):GJe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return NCn(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=DF(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=DF(s,i):(i=B4(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?sJe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=aJe,n}return i=t.child,t=i.sibling,n=DF(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 GJe(t,e){return e=Gbe({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function rbe(t,e,r,n){return n!==null&&jJe(n),N5(e,t.child,null,r),t=GJe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function NCn(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=w6e(Error(ut(422))),rbe(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=Gbe({mode:"visible",children:n.children},o,0,null),i=B4(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&N5(e,t.child,null,a),e.child.memoizedState=sJe(a),e.memoizedState=aJe,i);if((e.mode&1)===0)return rbe(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(ut(419)),n=w6e(i,n,void 0),rbe(t,e,a,n)}if(s=(a&t.childLanes)!==0,V_||s){if(n=jh,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,C1(t,o),ux(n,t,o,-1))}return t5e(),n=w6e(Error(ut(421))),rbe(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=WCn.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,mw=RF(o.nextSibling),hw=e,Vl=!0,ax=null,t!==null&&(WS[JS++]=b1,WS[JS++]=_1,WS[JS++]=V4,b1=t.id,_1=t.overflow,V4=e),e=GJe(e,n.children),e.flags|=4096,e)}function Mjt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),eJe(t.return,e,r)}function S6e(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 _Lt(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(Wb(t,e,n.children,r),n=_c.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&&Mjt(t,r,e);else if(t.tag===19)Mjt(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(Zu(_c,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&&Ibe(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),S6e(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&&Ibe(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}S6e(e,!0,r,null,i);break;case"together":S6e(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function dbe(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function x1(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),W4|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(ut(153));if(e.child!==null){for(t=e.child,r=DF(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=DF(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function DCn(t,e,r){switch(e.tag){case 3:yLt(e),A5();break;case 5:W$t(e);break;case 1:W_(e.type)&&Tbe(e);break;case 4:UJe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;Zu(Pbe,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Zu(_c,_c.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?bLt(t,e,r):(Zu(_c,_c.current&1),t=x1(t,e,r),t!==null?t.sibling:null);Zu(_c,_c.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return _Lt(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Zu(_c,_c.current),n)break;return null;case 22:case 23:return e.lanes=0,hLt(t,e,r)}return x1(t,e,r)}var vLt,uJe,wLt,SLt;vLt=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}};uJe=function(){};wLt=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,q4(MO.current);var i=null;switch(r){case"input":o=R6e(t,o),n=R6e(t,n),i=[];break;case"select":o=wc({},o,{value:void 0}),n=wc({},n,{value:void 0}),i=[];break;case"textarea":o=N6e(t,o),n=N6e(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Cbe)}j6e(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"&&(pre.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"&&(pre.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&yl("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)}};SLt=function(t,e,r,n){r!==n&&(e.flags|=4)};function Zte(t,e){if(!Vl)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 qy(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 jCn(t,e,r){var n=e.pendingProps;switch(DJe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qy(e),null;case 1:return W_(e.type)&&xbe(),qy(e),null;case 3:return n=e.stateNode,D5(),bl(H_),bl(By),zJe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(ebe(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,ax!==null&&(gJe(ax),ax=null))),uJe(t,e),qy(e),null;case 5:BJe(e);var o=q4(Tre.current);if(r=e.type,t!==null&&e.stateNode!=null)wLt(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(ut(166));return qy(e),null}if(t=q4(MO.current),ebe(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[EO]=e,n[Cre]=i,t=(e.mode&1)!==0,r){case"dialog":yl("cancel",n),yl("close",n);break;case"iframe":case"object":case"embed":yl("load",n);break;case"video":case"audio":for(o=0;o<nre.length;o++)yl(nre[o],n);break;case"source":yl("error",n);break;case"img":case"image":case"link":yl("error",n),yl("load",n);break;case"details":yl("toggle",n);break;case"input":LDt(n,i),yl("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},yl("invalid",n);break;case"textarea":kDt(n,i),yl("invalid",n)}j6e(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&&Qye(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&Qye(n.textContent,s,t),o=["children",""+s]):pre.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&yl("scroll",n)}switch(r){case"input":Uye(n),FDt(n,i,!0);break;case"textarea":Uye(n),qDt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Cbe)}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=Gjt(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[EO]=e,t[Cre]=n,vLt(t,e,!1,!1),e.stateNode=t;e:{switch(a=$6e(r,n),r){case"dialog":yl("cancel",t),yl("close",t),o=n;break;case"iframe":case"object":case"embed":yl("load",t),o=n;break;case"video":case"audio":for(o=0;o<nre.length;o++)yl(nre[o],t);o=n;break;case"source":yl("error",t),o=n;break;case"img":case"image":case"link":yl("error",t),yl("load",t),o=n;break;case"details":yl("toggle",t),o=n;break;case"input":LDt(t,n),o=R6e(t,n),yl("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=wc({},n,{value:void 0}),yl("invalid",t);break;case"textarea":kDt(t,n),o=N6e(t,n),yl("invalid",t);break;default:o=n}j6e(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?Yjt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Xjt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&mre(t,u):typeof u=="number"&&mre(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(pre.hasOwnProperty(i)?u!=null&&i==="onScroll"&&yl("scroll",t):u!=null&&_Je(t,i,u,a))}switch(r){case"input":Uye(t),FDt(t,n,!1);break;case"textarea":Uye(t),qDt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+jF(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?x5(t,!!n.multiple,i,!1):n.defaultValue!=null&&x5(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Cbe)}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 qy(e),null;case 6:if(t&&e.stateNode!=null)SLt(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(ut(166));if(r=q4(Tre.current),q4(MO.current),ebe(e)){if(n=e.stateNode,r=e.memoizedProps,n[EO]=e,(i=n.nodeValue!==r)&&(t=hw,t!==null))switch(t.tag){case 3:Qye(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Qye(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[EO]=e,e.stateNode=n}return qy(e),null;case 13:if(bl(_c),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Vl&&mw!==null&&(e.mode&1)!==0&&(e.flags&128)===0)k$t(),A5(),e.flags|=98560,i=!1;else if(i=ebe(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(ut(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ut(317));i[EO]=e}else A5(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;qy(e),i=!1}else ax!==null&&(gJe(ax),ax=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||(_c.current&1)!==0?Dm===0&&(Dm=3):t5e())),e.updateQueue!==null&&(e.flags|=4),qy(e),null);case 4:return D5(),uJe(t,e),t===null&&wre(e.stateNode.containerInfo),qy(e),null;case 10:return FJe(e.type._context),qy(e),null;case 17:return W_(e.type)&&xbe(),qy(e),null;case 19:if(bl(_c),i=e.memoizedState,i===null)return qy(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)Zte(i,!1);else{if(Dm!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=Ibe(t),a!==null){for(e.flags|=128,Zte(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 Zu(_c,_c.current&1|2),e.child}t=t.sibling}i.tail!==null&&ud()>$5&&(e.flags|=128,n=!0,Zte(i,!1),e.lanes=4194304)}else{if(!n)if(t=Ibe(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Zte(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Vl)return qy(e),null}else 2*ud()-i.renderingStartTime>$5&&r!==1073741824&&(e.flags|=128,n=!0,Zte(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=ud(),e.sibling=null,r=_c.current,Zu(_c,n?r&1|2:r&1),e):(qy(e),null);case 22:case 23:return e5e(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(pw&1073741824)!==0&&(qy(e),e.subtreeFlags&6&&(e.flags|=8192)):qy(e),null;case 24:return null;case 25:return null}throw Error(ut(156,e.tag))}function $Cn(t,e){switch(DJe(e),e.tag){case 1:return W_(e.type)&&xbe(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return D5(),bl(H_),bl(By),zJe(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return BJe(e),null;case 13:if(bl(_c),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ut(340));A5()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return bl(_c),null;case 4:return D5(),null;case 10:return FJe(e.type._context),null;case 22:case 23:return e5e(),null;case 24:return null;default:return null}}var nbe=!1,Uy=!1,LCn=typeof WeakSet=="function"?WeakSet:Set,Tr=null;function S5(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Lc(t,e,n)}else r.current=null}function lJe(t,e,r){try{r()}catch(n){Lc(t,e,n)}}var Rjt=!1;function FCn(t,e){if(W6e=vbe,t=O$t(),AJe(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(J6e={focusedElem:t,selectionRange:r},vbe=!1,Tr=e;Tr!==null;)if(e=Tr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Tr=t;else for(;Tr!==null;){e=Tr;try{var m=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var h=m.memoizedProps,y=m.memoizedState,g=e.stateNode,b=g.getSnapshotBeforeUpdate(e.elementType===e.type?h:ox(e.type,h),y);g.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ut(163))}}catch(w){Lc(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,Tr=t;break}Tr=e.return}return m=Rjt,Rjt=!1,m}function cre(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&&lJe(e,r,i)}o=o.next}while(o!==n)}}function Jbe(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 cJe(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 CLt(t){var e=t.alternate;e!==null&&(t.alternate=null,CLt(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[EO],delete e[Cre],delete e[X6e],delete e[vCn],delete e[wCn])),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 xLt(t){return t.tag===5||t.tag===3||t.tag===4}function Ijt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||xLt(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 dJe(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=Cbe));else if(n!==4&&(t=t.child,t!==null))for(dJe(t,e,r),t=t.sibling;t!==null;)dJe(t,e,r),t=t.sibling}function fJe(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(fJe(t,e,r),t=t.sibling;t!==null;)fJe(t,e,r),t=t.sibling}var Ag=null,ix=!1;function vF(t,e,r){for(r=r.child;r!==null;)TLt(t,e,r),r=r.sibling}function TLt(t,e,r){if(PO&&typeof PO.onCommitFiberUnmount=="function")try{PO.onCommitFiberUnmount(kbe,r)}catch{}switch(r.tag){case 5:Uy||S5(r,e);case 6:var n=Ag,o=ix;Ag=null,vF(t,e,r),Ag=n,ix=o,Ag!==null&&(ix?(t=Ag,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Ag.removeChild(r.stateNode));break;case 18:Ag!==null&&(ix?(t=Ag,r=r.stateNode,t.nodeType===8?h6e(t.parentNode,r):t.nodeType===1&&h6e(t,r),bre(t)):h6e(Ag,r.stateNode));break;case 4:n=Ag,o=ix,Ag=r.stateNode.containerInfo,ix=!0,vF(t,e,r),Ag=n,ix=o;break;case 0:case 11:case 14:case 15:if(!Uy&&(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)&&lJe(r,e,a),o=o.next}while(o!==n)}vF(t,e,r);break;case 1:if(!Uy&&(S5(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Lc(r,e,s)}vF(t,e,r);break;case 21:vF(t,e,r);break;case 22:r.mode&1?(Uy=(n=Uy)||r.memoizedState!==null,vF(t,e,r),Uy=n):vF(t,e,r);break;default:vF(t,e,r)}}function Ajt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new LCn),e.forEach(function(n){var o=JCn.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function nx(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:Ag=s.stateNode,ix=!1;break e;case 3:Ag=s.stateNode.containerInfo,ix=!0;break e;case 4:Ag=s.stateNode.containerInfo,ix=!0;break e}s=s.return}if(Ag===null)throw Error(ut(160));TLt(i,a,o),Ag=null,ix=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Lc(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)OLt(e,t),e=e.sibling}function OLt(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(nx(e,t),TO(t),n&4){try{cre(3,t,t.return),Jbe(3,t)}catch(h){Lc(t,t.return,h)}try{cre(5,t,t.return)}catch(h){Lc(t,t.return,h)}}break;case 1:nx(e,t),TO(t),n&512&&r!==null&&S5(r,r.return);break;case 5:if(nx(e,t),TO(t),n&512&&r!==null&&S5(r,r.return),t.flags&32){var o=t.stateNode;try{mre(o,"")}catch(h){Lc(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&&Jjt(o,i),$6e(s,a);var l=$6e(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?Yjt(o,d):c==="dangerouslySetInnerHTML"?Xjt(o,d):c==="children"?mre(o,d):_Je(o,c,d,l)}switch(s){case"input":I6e(o,i);break;case"textarea":Kjt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?x5(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?x5(o,!!i.multiple,i.defaultValue,!0):x5(o,!!i.multiple,i.multiple?[]:"",!1))}o[Cre]=i}catch(h){Lc(t,t.return,h)}}break;case 6:if(nx(e,t),TO(t),n&4){if(t.stateNode===null)throw Error(ut(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Lc(t,t.return,h)}}break;case 3:if(nx(e,t),TO(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{bre(e.containerInfo)}catch(h){Lc(t,t.return,h)}break;case 4:nx(e,t),TO(t);break;case 13:nx(e,t),TO(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(YJe=ud())),n&4&&Ajt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(Uy=(l=Uy)||c,nx(e,t),Uy=l):nx(e,t),TO(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(Tr=t,c=t.child;c!==null;){for(d=Tr=c;Tr!==null;){switch(f=Tr,p=f.child,f.tag){case 0:case 11:case 14:case 15:cre(4,f,f.return);break;case 1:S5(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){Lc(n,r,h)}}break;case 5:S5(f,f.return);break;case 22:if(f.memoizedState!==null){Djt(d);continue}}p!==null?(p.return=f,Tr=p):Djt(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=Zjt("display",a))}catch(h){Lc(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Lc(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:nx(e,t),TO(t),n&4&&Ajt(t);break;case 21:break;default:nx(e,t),TO(t)}}function TO(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(xLt(r)){var n=r;break e}r=r.return}throw Error(ut(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(mre(o,""),n.flags&=-33);var i=Ijt(t);fJe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=Ijt(t);dJe(t,s,a);break;default:throw Error(ut(161))}}catch(u){Lc(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kCn(t,e,r){Tr=t,ELt(t,e,r)}function ELt(t,e,r){for(var n=(t.mode&1)!==0;Tr!==null;){var o=Tr,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||nbe;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||Uy;s=nbe;var l=Uy;if(nbe=a,(Uy=u)&&!l)for(Tr=o;Tr!==null;)a=Tr,u=a.child,a.tag===22&&a.memoizedState!==null?jjt(o):u!==null?(u.return=a,Tr=u):jjt(o);for(;i!==null;)Tr=i,ELt(i,e,r),i=i.sibling;Tr=o,nbe=s,Uy=l}Njt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,Tr=i):Njt(t,e,r)}}function Njt(t){for(;Tr!==null;){var e=Tr;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:Uy||Jbe(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Uy)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:ox(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&gjt(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}gjt(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&&bre(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ut(163))}Uy||e.flags&512&&cJe(e)}catch(f){Lc(e,e.return,f)}}if(e===t){Tr=null;break}if(r=e.sibling,r!==null){r.return=e.return,Tr=r;break}Tr=e.return}}function Djt(t){for(;Tr!==null;){var e=Tr;if(e===t){Tr=null;break}var r=e.sibling;if(r!==null){r.return=e.return,Tr=r;break}Tr=e.return}}function jjt(t){for(;Tr!==null;){var e=Tr;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Jbe(4,e)}catch(u){Lc(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Lc(e,o,u)}}var i=e.return;try{cJe(e)}catch(u){Lc(e,i,u)}break;case 5:var a=e.return;try{cJe(e)}catch(u){Lc(e,a,u)}}}catch(u){Lc(e,e.return,u)}if(e===t){Tr=null;break}var s=e.sibling;if(s!==null){s.return=e.return,Tr=s;break}Tr=e.return}}var qCn=Math.ceil,Dbe=T1.ReactCurrentDispatcher,XJe=T1.ReactCurrentOwner,GS=T1.ReactCurrentBatchConfig,ns=0,jh=null,Id=null,Ng=0,pw=0,C5=FF(0),Dm=0,Mre=null,W4=0,Kbe=0,ZJe=0,dre=null,z_=null,YJe=0,$5=1/0,g1=null,jbe=!1,pJe=null,AF=null,obe=!1,OF=null,$be=0,fre=0,mJe=null,fbe=-1,pbe=0;function Jb(){return(ns&6)!==0?ud():fbe!==-1?fbe:fbe=ud()}function NF(t){return(t.mode&1)===0?1:(ns&2)!==0&&Ng!==0?Ng&-Ng:CCn.transition!==null?(pbe===0&&(pbe=c$t()),pbe):(t=su,t!==0||(t=window.event,t=t===void 0?16:y$t(t.type)),t)}function ux(t,e,r,n){if(50<fre)throw fre=0,mJe=null,Error(ut(185));Rre(t,r,n),((ns&2)===0||t!==jh)&&(t===jh&&((ns&2)===0&&(Kbe|=r),Dm===4&&xF(t,Ng)),J_(t,n),r===1&&ns===0&&(e.mode&1)===0&&($5=ud()+500,Vbe&&kF()))}function J_(t,e){var r=t.callbackNode;T0n(t,e);var n=_be(t,t===jh?Ng:0);if(n===0)r!==null&&zDt(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&zDt(r),e===1)t.tag===0?SCn($jt.bind(null,t)):$$t($jt.bind(null,t)),bCn(function(){(ns&6)===0&&kF()}),r=null;else{switch(d$t(n)){case 1:r=xJe;break;case 4:r=u$t;break;case 16:r=bbe;break;case 536870912:r=l$t;break;default:r=bbe}r=jLt(r,PLt.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function PLt(t,e){if(fbe=-1,pbe=0,(ns&6)!==0)throw Error(ut(327));var r=t.callbackNode;if(M5()&&t.callbackNode!==r)return null;var n=_be(t,t===jh?Ng:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=Lbe(t,n);else{e=n;var o=ns;ns|=2;var i=RLt();(jh!==t||Ng!==e)&&(g1=null,$5=ud()+500,U4(t,e));do try{zCn();break}catch(s){MLt(t,s)}while(!0);LJe(),Dbe.current=i,ns=o,Id!==null?e=0:(jh=null,Ng=0,e=Dm)}if(e!==0){if(e===2&&(o=U6e(t),o!==0&&(n=o,e=hJe(t,o))),e===1)throw r=Mre,U4(t,0),xF(t,n),J_(t,ud()),r;if(e===6)xF(t,n);else{if(o=t.current.alternate,(n&30)===0&&!UCn(o)&&(e=Lbe(t,n),e===2&&(i=U6e(t),i!==0&&(n=i,e=hJe(t,i))),e===1))throw r=Mre,U4(t,0),xF(t,n),J_(t,ud()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(ut(345));case 2:L4(t,z_,g1);break;case 3:if(xF(t,n),(n&130023424)===n&&(e=YJe+500-ud(),10<e)){if(_be(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Jb(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=G6e(L4.bind(null,t,z_,g1),e);break}L4(t,z_,g1);break;case 4:if(xF(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-sx(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=ud()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*qCn(n/1960))-n,10<n){t.timeoutHandle=G6e(L4.bind(null,t,z_,g1),n);break}L4(t,z_,g1);break;case 5:L4(t,z_,g1);break;default:throw Error(ut(329))}}}return J_(t,ud()),t.callbackNode===r?PLt.bind(null,t):null}function hJe(t,e){var r=dre;return t.current.memoizedState.isDehydrated&&(U4(t,e).flags|=256),t=Lbe(t,e),t!==2&&(e=z_,z_=r,e!==null&&gJe(e)),t}function gJe(t){z_===null?z_=t:z_.push.apply(z_,t)}function UCn(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(!lx(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 xF(t,e){for(e&=~ZJe,e&=~Kbe,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-sx(e),n=1<<r;t[r]=-1,e&=~n}}function $jt(t){if((ns&6)!==0)throw Error(ut(327));M5();var e=_be(t,0);if((e&1)===0)return J_(t,ud()),null;var r=Lbe(t,e);if(t.tag!==0&&r===2){var n=U6e(t);n!==0&&(e=n,r=hJe(t,n))}if(r===1)throw r=Mre,U4(t,0),xF(t,e),J_(t,ud()),r;if(r===6)throw Error(ut(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,L4(t,z_,g1),J_(t,ud()),null}function QJe(t,e){var r=ns;ns|=1;try{return t(e)}finally{ns=r,ns===0&&($5=ud()+500,Vbe&&kF())}}function J4(t){OF!==null&&OF.tag===0&&(ns&6)===0&&M5();var e=ns;ns|=1;var r=GS.transition,n=su;try{if(GS.transition=null,su=1,t)return t()}finally{su=n,GS.transition=r,ns=e,(ns&6)===0&&kF()}}function e5e(){pw=C5.current,bl(C5)}function U4(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,yCn(r)),Id!==null)for(r=Id.return;r!==null;){var n=r;switch(DJe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&xbe();break;case 3:D5(),bl(H_),bl(By),zJe();break;case 5:BJe(n);break;case 4:D5();break;case 13:bl(_c);break;case 19:bl(_c);break;case 10:FJe(n.type._context);break;case 22:case 23:e5e()}r=r.return}if(jh=t,Id=t=DF(t.current,null),Ng=pw=e,Dm=0,Mre=null,ZJe=Kbe=W4=0,z_=dre=null,k4!==null){for(e=0;e<k4.length;e++)if(r=k4[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}k4=null}return t}function MLt(t,e){do{var r=Id;try{if(LJe(),lbe.current=Nbe,Abe){for(var n=vc.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Abe=!1}if(H4=0,Dh=Nm=vc=null,lre=!1,Ore=0,XJe.current=null,r===null||r.return===null){Dm=1,Mre=e,Id=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Ng,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=Cjt(a);if(p!==null){p.flags&=-257,xjt(p,a,s,i,e),p.mode&1&&Sjt(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){Sjt(i,l,e),t5e();break e}u=Error(ut(426))}}else if(Vl&&s.mode&1){var y=Cjt(a);if(y!==null){(y.flags&65536)===0&&(y.flags|=256),xjt(y,a,s,i,e),jJe(j5(u,s));break e}}i=u=j5(u,s),Dm!==4&&(Dm=2),dre===null?dre=[i]:dre.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=fLt(i,u,e);hjt(i,g);break e;case 1:s=u;var b=i.type,_=i.stateNode;if((i.flags&128)===0&&(typeof b.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(AF===null||!AF.has(_)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=pLt(i,s,e);hjt(i,w);break e}}i=i.return}while(i!==null)}ALt(r)}catch(T){e=T,Id===r&&r!==null&&(Id=r=r.return);continue}break}while(!0)}function RLt(){var t=Dbe.current;return Dbe.current=Nbe,t===null?Nbe:t}function t5e(){(Dm===0||Dm===3||Dm===2)&&(Dm=4),jh===null||(W4&268435455)===0&&(Kbe&268435455)===0||xF(jh,Ng)}function Lbe(t,e){var r=ns;ns|=2;var n=RLt();(jh!==t||Ng!==e)&&(g1=null,U4(t,e));do try{BCn();break}catch(o){MLt(t,o)}while(!0);if(LJe(),ns=r,Dbe.current=n,Id!==null)throw Error(ut(261));return jh=null,Ng=0,Dm}function BCn(){for(;Id!==null;)ILt(Id)}function zCn(){for(;Id!==null&&!g0n();)ILt(Id)}function ILt(t){var e=DLt(t.alternate,t,pw);t.memoizedProps=t.pendingProps,e===null?ALt(t):Id=e,XJe.current=null}function ALt(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=jCn(r,e,pw),r!==null){Id=r;return}}else{if(r=$Cn(r,e),r!==null){r.flags&=32767,Id=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Dm=6,Id=null;return}}if(e=e.sibling,e!==null){Id=e;return}Id=e=t}while(e!==null);Dm===0&&(Dm=5)}function L4(t,e,r){var n=su,o=GS.transition;try{GS.transition=null,su=1,VCn(t,e,r,n)}finally{GS.transition=o,su=n}return null}function VCn(t,e,r,n){do M5();while(OF!==null);if((ns&6)!==0)throw Error(ut(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(ut(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(O0n(t,i),t===jh&&(Id=jh=null,Ng=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||obe||(obe=!0,jLt(bbe,function(){return M5(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=GS.transition,GS.transition=null;var a=su;su=1;var s=ns;ns|=4,XJe.current=null,FCn(t,r),OLt(r,t),fCn(J6e),vbe=!!W6e,J6e=W6e=null,t.current=r,kCn(r,t,o),y0n(),ns=s,su=a,GS.transition=i}else t.current=r;if(obe&&(obe=!1,OF=t,$be=o),i=t.pendingLanes,i===0&&(AF=null),v0n(r.stateNode,n),J_(t,ud()),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(jbe)throw jbe=!1,t=pJe,pJe=null,t;return($be&1)!==0&&t.tag!==0&&M5(),i=t.pendingLanes,(i&1)!==0?t===mJe?fre++:(fre=0,mJe=t):fre=0,kF(),null}function M5(){if(OF!==null){var t=d$t($be),e=GS.transition,r=su;try{if(GS.transition=null,su=16>t?16:t,OF===null)var n=!1;else{if(t=OF,OF=null,$be=0,(ns&6)!==0)throw Error(ut(331));var o=ns;for(ns|=4,Tr=t.current;Tr!==null;){var i=Tr,a=i.child;if((Tr.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(Tr=l;Tr!==null;){var c=Tr;switch(c.tag){case 0:case 11:case 15:cre(8,c,i)}var d=c.child;if(d!==null)d.return=c,Tr=d;else for(;Tr!==null;){c=Tr;var f=c.sibling,p=c.return;if(CLt(c),c===l){Tr=null;break}if(f!==null){f.return=p,Tr=f;break}Tr=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var y=h.sibling;h.sibling=null,h=y}while(h!==null)}}Tr=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,Tr=a;else e:for(;Tr!==null;){if(i=Tr,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:cre(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Tr=g;break e}Tr=i.return}}var b=t.current;for(Tr=b;Tr!==null;){a=Tr;var _=a.child;if((a.subtreeFlags&2064)!==0&&_!==null)_.return=a,Tr=_;else e:for(a=b;Tr!==null;){if(s=Tr,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:Jbe(9,s)}}catch(T){Lc(s,s.return,T)}if(s===a){Tr=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,Tr=w;break e}Tr=s.return}}if(ns=o,kF(),PO&&typeof PO.onPostCommitFiberRoot=="function")try{PO.onPostCommitFiberRoot(kbe,t)}catch{}n=!0}return n}finally{su=r,GS.transition=e}}return!1}function Ljt(t,e,r){e=j5(r,e),e=fLt(t,e,1),t=IF(t,e,1),e=Jb(),t!==null&&(Rre(t,1,e),J_(t,e))}function Lc(t,e,r){if(t.tag===3)Ljt(t,t,r);else for(;e!==null;){if(e.tag===3){Ljt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(AF===null||!AF.has(n))){t=j5(r,t),t=pLt(e,t,1),e=IF(e,t,1),t=Jb(),e!==null&&(Rre(e,1,t),J_(e,t));break}}e=e.return}}function HCn(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=Jb(),t.pingedLanes|=t.suspendedLanes&r,jh===t&&(Ng&r)===r&&(Dm===4||Dm===3&&(Ng&130023424)===Ng&&500>ud()-YJe?U4(t,0):ZJe|=r),J_(t,e)}function NLt(t,e){e===0&&((t.mode&1)===0?e=1:(e=Vye,Vye<<=1,(Vye&130023424)===0&&(Vye=4194304)));var r=Jb();t=C1(t,e),t!==null&&(Rre(t,e,r),J_(t,r))}function WCn(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),NLt(t,r)}function JCn(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(ut(314))}n!==null&&n.delete(e),NLt(t,r)}var DLt;DLt=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||H_.current)V_=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return V_=!1,DCn(t,e,r);V_=(t.flags&131072)!==0}else V_=!1,Vl&&(e.flags&1048576)!==0&&L$t(e,Ebe,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;dbe(t,e),t=e.pendingProps;var o=I5(e,By.current);P5(e,r),o=HJe(null,e,n,t,o,r);var i=WJe();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,W_(n)?(i=!0,Tbe(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,qJe(e),o.updater=Hbe,e.stateNode=o,o._reactInternals=e,rJe(e,n,t,r),e=iJe(null,e,n,!0,i,r)):(e.tag=0,Vl&&i&&NJe(e),Wb(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(dbe(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=GCn(n),t=ox(n,t),o){case 0:e=oJe(null,e,n,t,r);break e;case 1:e=Ejt(null,e,n,t,r);break e;case 11:e=Tjt(null,e,n,t,r);break e;case 14:e=Ojt(null,e,n,ox(n.type,t),r);break e}throw Error(ut(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ox(n,o),oJe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ox(n,o),Ejt(t,e,n,o,r);case 3:e:{if(yLt(e),t===null)throw Error(ut(387));n=e.pendingProps,i=e.memoizedState,o=i.element,U$t(t,e),Rbe(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=j5(Error(ut(423)),e),e=Pjt(t,e,n,r,o);break e}else if(n!==o){o=j5(Error(ut(424)),e),e=Pjt(t,e,n,r,o);break e}else for(mw=RF(e.stateNode.containerInfo.firstChild),hw=e,Vl=!0,ax=null,r=H$t(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(A5(),n===o){e=x1(t,e,r);break e}Wb(t,e,n,r)}e=e.child}return e;case 5:return W$t(e),t===null&&Q6e(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,K6e(n,o)?a=null:i!==null&&K6e(n,i)&&(e.flags|=32),gLt(t,e),Wb(t,e,a,r),e.child;case 6:return t===null&&Q6e(e),null;case 13:return bLt(t,e,r);case 4:return UJe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=N5(e,null,n,r):Wb(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ox(n,o),Tjt(t,e,n,o,r);case 7:return Wb(t,e,e.pendingProps,r),e.child;case 8:return Wb(t,e,e.pendingProps.children,r),e.child;case 12:return Wb(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,Zu(Pbe,n._currentValue),n._currentValue=a,i!==null)if(lx(i.value,a)){if(i.children===o.children&&!H_.current){e=x1(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=v1(-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),eJe(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(ut(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),eJe(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}Wb(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,P5(e,r),o=XS(o),n=n(o),e.flags|=1,Wb(t,e,n,r),e.child;case 14:return n=e.type,o=ox(n,e.pendingProps),o=ox(n.type,o),Ojt(t,e,n,o,r);case 15:return mLt(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:ox(n,o),dbe(t,e),e.tag=1,W_(n)?(t=!0,Tbe(e)):t=!1,P5(e,r),z$t(e,n,o),rJe(e,n,o,r),iJe(null,e,n,!0,t,r);case 19:return _Lt(t,e,r);case 22:return hLt(t,e,r)}throw Error(ut(156,e.tag))};function jLt(t,e){return s$t(t,e)}function KCn(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 KS(t,e,r,n){return new KCn(t,e,r,n)}function r5e(t){return t=t.prototype,!(!t||!t.isReactComponent)}function GCn(t){if(typeof t=="function")return r5e(t)?1:0;if(t!=null){if(t=t.$$typeof,t===wJe)return 11;if(t===SJe)return 14}return 2}function DF(t,e){var r=t.alternate;return r===null?(r=KS(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 mbe(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")r5e(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case p5:return B4(r.children,o,i,e);case vJe:a=8,o|=8;break;case O6e:return t=KS(12,r,e,o|2),t.elementType=O6e,t.lanes=i,t;case E6e:return t=KS(13,r,e,o),t.elementType=E6e,t.lanes=i,t;case P6e:return t=KS(19,r,e,o),t.elementType=P6e,t.lanes=i,t;case Vjt:return Gbe(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Bjt:a=10;break e;case zjt:a=9;break e;case wJe:a=11;break e;case SJe:a=14;break e;case wF:a=16,n=null;break e}throw Error(ut(130,t==null?t:typeof t,""))}return e=KS(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function B4(t,e,r,n){return t=KS(7,t,n,e),t.lanes=r,t}function Gbe(t,e,r,n){return t=KS(22,t,n,e),t.elementType=Vjt,t.lanes=r,t.stateNode={isHidden:!1},t}function C6e(t,e,r){return t=KS(6,t,null,e),t.lanes=r,t}function x6e(t,e,r){return e=KS(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function XCn(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=s6e(0),this.expirationTimes=s6e(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=s6e(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function n5e(t,e,r,n,o,i,a,s,u){return t=new XCn(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=KS(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},qJe(i),t}function ZCn(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f5,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function $Lt(t){if(!t)return $F;t=t._reactInternals;e:{if(G4(t)!==t||t.tag!==1)throw Error(ut(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(W_(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ut(171))}if(t.tag===1){var r=t.type;if(W_(r))return j$t(t,r,e)}return e}function LLt(t,e,r,n,o,i,a,s,u){return t=n5e(r,n,!0,t,o,i,a,s,u),t.context=$Lt(null),r=t.current,n=Jb(),o=NF(r),i=v1(n,o),i.callback=e??null,IF(r,i,o),t.current.lanes=o,Rre(t,o,n),J_(t,n),t}function Xbe(t,e,r,n){var o=e.current,i=Jb(),a=NF(o);return r=$Lt(r),e.context===null?e.context=r:e.pendingContext=r,e=v1(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=IF(o,e,a),t!==null&&(ux(t,o,a,i),ube(t,o,a)),a}function Fbe(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 Fjt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function o5e(t,e){Fjt(t,e),(t=t.alternate)&&Fjt(t,e)}function YCn(){return null}var FLt=typeof reportError=="function"?reportError:function(t){console.error(t)};function i5e(t){this._internalRoot=t}Zbe.prototype.render=i5e.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ut(409));Xbe(t,e,null,null)};Zbe.prototype.unmount=i5e.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;J4(function(){Xbe(null,t,null,null)}),e[S1]=null}};function Zbe(t){this._internalRoot=t}Zbe.prototype.unstable_scheduleHydration=function(t){if(t){var e=m$t();t={blockedOn:null,target:t,priority:e};for(var r=0;r<CF.length&&e!==0&&e<CF[r].priority;r++);CF.splice(r,0,t),r===0&&g$t(t)}};function a5e(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ybe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function kjt(){}function QCn(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=Fbe(a);i.call(l)}}var a=LLt(e,n,t,0,null,!1,!1,"",kjt);return t._reactRootContainer=a,t[S1]=a.current,wre(t.nodeType===8?t.parentNode:t),J4(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=Fbe(u);s.call(l)}}var u=n5e(t,0,!1,null,null,!1,!1,"",kjt);return t._reactRootContainer=u,t[S1]=u.current,wre(t.nodeType===8?t.parentNode:t),J4(function(){Xbe(e,u,r,n)}),u}function Qbe(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=Fbe(a);s.call(u)}}Xbe(e,a,t,o)}else a=QCn(r,e,t,o,n);return Fbe(a)}f$t=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=rre(e.pendingLanes);r!==0&&(TJe(e,r|1),J_(e,ud()),(ns&6)===0&&($5=ud()+500,kF()))}break;case 13:J4(function(){var n=C1(t,1);if(n!==null){var o=Jb();ux(n,t,1,o)}}),o5e(t,1)}};OJe=function(t){if(t.tag===13){var e=C1(t,134217728);if(e!==null){var r=Jb();ux(e,t,134217728,r)}o5e(t,134217728)}};p$t=function(t){if(t.tag===13){var e=NF(t),r=C1(t,e);if(r!==null){var n=Jb();ux(r,t,e,n)}o5e(t,e)}};m$t=function(){return su};h$t=function(t,e){var r=su;try{return su=t,e()}finally{su=r}};F6e=function(t,e,r){switch(e){case"input":if(I6e(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=zbe(n);if(!o)throw Error(ut(90));Wjt(n),I6e(n,o)}}}break;case"textarea":Kjt(t,r);break;case"select":e=r.value,e!=null&&x5(t,!!r.multiple,e,!1)}};t$t=QJe;r$t=J4;var exn={usingClientEntryPoint:!1,Events:[Are,y5,zbe,Qjt,e$t,QJe]},Yte={findFiberByHostInstance:F4,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},txn={bundleType:Yte.bundleType,version:Yte.version,rendererPackageName:Yte.rendererPackageName,rendererConfig:Yte.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T1.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=i$t(t),t===null?null:t.stateNode},findFiberByHostInstance:Yte.findFiberByHostInstance||YCn,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Qte=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Qte.isDisabled&&Qte.supportsFiber))try{kbe=Qte.inject(txn),PO=Qte}catch{}var Qte;bw.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=exn;bw.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!a5e(e))throw Error(ut(200));return ZCn(t,e,null,r)};bw.createRoot=function(t,e){if(!a5e(t))throw Error(ut(299));var r=!1,n="",o=FLt;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=n5e(t,1,!1,null,null,r,!1,n,o),t[S1]=e.current,wre(t.nodeType===8?t.parentNode:t),new i5e(e)};bw.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(ut(188)):(t=Object.keys(t).join(","),Error(ut(268,t)));return t=i$t(e),t=t===null?null:t.stateNode,t};bw.flushSync=function(t){return J4(t)};bw.hydrate=function(t,e,r){if(!Ybe(e))throw Error(ut(200));return Qbe(null,t,e,!0,r)};bw.hydrateRoot=function(t,e,r){if(!a5e(t))throw Error(ut(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=FLt;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=LLt(e,null,t,1,r??null,o,!1,i,a),t[S1]=e.current,wre(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 Zbe(e)};bw.render=function(t,e,r){if(!Ybe(e))throw Error(ut(200));return Qbe(null,t,e,!1,r)};bw.unmountComponentAtNode=function(t){if(!Ybe(t))throw Error(ut(40));return t._reactRootContainer?(J4(function(){Qbe(null,null,t,!1,function(){t._reactRootContainer=null,t[S1]=null})}),!0):!1};bw.unstable_batchedUpdates=QJe;bw.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!Ybe(r))throw Error(ut(200));if(t==null||t._reactInternals===void 0)throw Error(ut(38));return Qbe(t,e,r,!1,n)};bw.version="18.2.0-next-9e3b772b8-20220608"});var hu=S((Xzi,ULt)=>{"use strict";function qLt(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qLt)}catch(t){console.error(t)}}qLt(),ULt.exports=kLt()});var jm=S(s5e=>{"use strict";var BLt=hu();s5e.createRoot=BLt.createRoot,s5e.hydrateRoot=BLt.hydrateRoot;var Zzi});function zLt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function VLt(...t){return e=>{let r=!1,n=t.map(o=>{let i=zLt(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():zLt(t[o],null)}}}}var rxn,HLt=v(()=>{rxn=$(J(),1)});var JLt=S(e_e=>{"use strict";var nxn=J(),oxn=Symbol.for("react.element"),ixn=Symbol.for("react.fragment"),axn=Object.prototype.hasOwnProperty,sxn=nxn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,uxn={key:!0,ref:!0,__self:!0,__source:!0};function WLt(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)axn.call(e,n)&&!uxn.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:oxn,type:t,key:i,ref:a,props:o,_owner:sxn.current}}e_e.Fragment=ixn;e_e.jsx=WLt;e_e.jsxs=WLt});var St=S((t4i,KLt)=>{"use strict";KLt.exports=JLt()});function cxn(t){return typeof t=="object"&&t!==null&&"then"in t}function GLt(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===lxn&&"_payload"in t&&cxn(t._payload)}function dxn(t){let e=fxn(t),r=Ad.forwardRef((n,o)=>{let{children:i,...a}=n;GLt(i)&&typeof r_e=="function"&&(i=r_e(i._payload));let s=Ad.Children.toArray(i),u=s.find(mxn);if(u){let l=u.props.children,c=s.map(d=>d===u?Ad.Children.count(l)>1?Ad.Children.only(null):Ad.isValidElement(l)?l.props.children:null:d);return(0,t_e.jsx)(e,{...a,ref:o,children:Ad.isValidElement(l)?Ad.cloneElement(l,void 0,c):null})}return(0,t_e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function fxn(t){let e=Ad.forwardRef((r,n)=>{let{children:o,...i}=r;if(GLt(o)&&typeof r_e=="function"&&(o=r_e(o._payload)),Ad.isValidElement(o)){let a=gxn(o),s=hxn(i,o.props);return o.type!==Ad.Fragment&&(s.ref=n?VLt(n,a):a),Ad.cloneElement(o,s)}return Ad.Children.count(o)>1?Ad.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function mxn(t){return Ad.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===pxn}function hxn(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 gxn(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 Ad,t_e,lxn,r_e,XLt,pxn,ZLt=v(()=>{Ad=$(J(),1);HLt();t_e=$(St(),1),lxn=Symbol.for("react.lazy"),r_e=Ad[" use ".trim().toString()];XLt=dxn("Slot");pxn=Symbol("radix.slottable")});function YLt(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=YLt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function n_e(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=YLt(t))&&(n&&(n+=" "),n+=e);return n}var u5e=v(()=>{});var QLt,eFt,k5,o_e=v(()=>{u5e();QLt=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eFt=n_e,k5=(t,e)=>r=>{var n;if(e?.variants==null)return eFt(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=QLt(c)||QLt(d);return o[l][f]}),s=r&&Object.entries(r).reduce((l,c)=>{let[d,f]=c;return f===void 0||(l[d]=f),l},{}),u=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:d,className:f,...p}=c;return Object.entries(p).every(m=>{let[h,y]=m;return Array.isArray(y)?y.includes({...i,...s}[h]):{...i,...s}[h]===y})?[...l,d,f]:l},[]);return eFt(t,a,u,r?.class,r?.className)}});function Pxn(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=sFt(e))&&(n&&(n+=" "),n+=r);return n}function nFt(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=Txn(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=Exn(u,r);return o(u,c),c}return function(){return i(Pxn.apply(null,arguments))}}var d5e,yxn,iFt,tFt,bxn,_xn,c5e,rFt,vxn,wxn,Sxn,aFt,Cxn,xxn,Txn,Oxn,Exn,sFt,_l,uFt,Mxn,Rxn,Ixn,Axn,Nxn,Dxn,jxn,O1,qF,q5,l5e,Dre,$xn,ui,UF,Lxn,Fxn,kxn,qxn,Uxn,Bxn,jre,U5,zxn,lFt,Vxn,Hxn,oFt,Wxn,$re,Jxn,Kxn,cFt,dFt=v(()=>{d5e="-",yxn=t=>{let e=_xn(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(d5e);return s[0]===""&&s.length!==1&&s.shift(),iFt(s,e)||bxn(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},iFt=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?iFt(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(d5e);return e.validators.find(({validator:a})=>a(i))?.classGroupId},tFt=/^\[(.+)\]$/,bxn=t=>{if(tFt.test(t)){let e=tFt.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},_xn=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return wxn(Object.entries(t.classGroups),r).forEach(([i,a])=>{c5e(a,n,i,e)}),n},c5e=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:rFt(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(vxn(o)){c5e(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{c5e(a,rFt(e,i),r,n)})})},rFt=(t,e)=>{let r=t;return e.split(d5e).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},vxn=t=>t.isThemeGetter,wxn=(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,Sxn=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)}}},aFt="!",Cxn=t=>{let{separator:e,experimentalParseClassName:r}=t,n=e.length===1,o=e[0],i=e.length,a=s=>{let u=[],l=0,c=0,d;for(let y=0;y<s.length;y++){let g=s[y];if(l===0){if(g===o&&(n||s.slice(y,y+i)===e)){u.push(s.slice(c,y)),c=y+i;continue}if(g==="/"){d=y;continue}}g==="["?l++:g==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(aFt),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},xxn=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},Txn=t=>({cache:Sxn(t.cacheSize),parseClassName:Cxn(t),...yxn(t)}),Oxn=/\s+/,Exn=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(Oxn),s="";for(let u=a.length-1;u>=0;u-=1){let l=a[u],{modifiers:c,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=r(l),m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){s=l+(s.length>0?" "+s:s);continue}if(h=n(f),!h){s=l+(s.length>0?" "+s:s);continue}m=!1}let y=xxn(c).join(":"),g=d?y+aFt:y,b=g+h;if(i.includes(b))continue;i.push(b);let _=o(h,m);for(let w=0;w<_.length;++w){let T=_[w];i.push(g+T)}s=l+(s.length>0?" "+s:s)}return s};sFt=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=sFt(t[n]))&&(r&&(r+=" "),r+=e);return r};_l=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},uFt=/^\[(?:([a-z-]+):)?(.+)\]$/i,Mxn=/^\d+\/\d+$/,Rxn=new Set(["px","full","screen"]),Ixn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Axn=/\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$/,Nxn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Dxn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jxn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,O1=t=>q5(t)||Rxn.has(t)||Mxn.test(t),qF=t=>U5(t,"length",zxn),q5=t=>!!t&&!Number.isNaN(Number(t)),l5e=t=>U5(t,"number",q5),Dre=t=>!!t&&Number.isInteger(Number(t)),$xn=t=>t.endsWith("%")&&q5(t.slice(0,-1)),ui=t=>uFt.test(t),UF=t=>Ixn.test(t),Lxn=new Set(["length","size","percentage"]),Fxn=t=>U5(t,Lxn,lFt),kxn=t=>U5(t,"position",lFt),qxn=new Set(["image","url"]),Uxn=t=>U5(t,qxn,Hxn),Bxn=t=>U5(t,"",Vxn),jre=()=>!0,U5=(t,e,r)=>{let n=uFt.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},zxn=t=>Axn.test(t)&&!Nxn.test(t),lFt=()=>!1,Vxn=t=>Dxn.test(t),Hxn=t=>jxn.test(t),oFt=()=>{let t=_l("colors"),e=_l("spacing"),r=_l("blur"),n=_l("brightness"),o=_l("borderColor"),i=_l("borderRadius"),a=_l("borderSpacing"),s=_l("borderWidth"),u=_l("contrast"),l=_l("grayscale"),c=_l("hueRotate"),d=_l("invert"),f=_l("gap"),p=_l("gradientColorStops"),m=_l("gradientColorStopPositions"),h=_l("inset"),y=_l("margin"),g=_l("opacity"),b=_l("padding"),_=_l("saturate"),w=_l("scale"),T=_l("sepia"),O=_l("skew"),E=_l("space"),P=_l("translate"),R=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",ui,e],z=()=>[ui,e],V=()=>["",O1,qF],k=()=>["auto",q5,ui],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["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"],Y=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",ui],oe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[q5,ui];return{cacheSize:500,separator:":",theme:{colors:[jre],spacing:[O1,qF],blur:["none","",UF,ui],brightness:ue(),borderColor:[t],borderRadius:["none","","full",UF,ui],borderSpacing:z(),borderWidth:V(),contrast:ue(),grayscale:K(),hueRotate:ue(),invert:K(),gap:z(),gradientColorStops:[t],gradientColorStopPositions:[$xn,qF],inset:N(),margin:N(),opacity:ue(),padding:z(),saturate:ue(),scale:ue(),sepia:K(),skew:ue(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",ui]}],container:["container"],columns:[{columns:[UF]}],"break-after":[{"break-after":oe()}],"break-before":[{"break-before":oe()}],"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:[...X(),ui]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],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",Dre,ui]}],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",ui]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",Dre,ui]}],"grid-cols":[{"grid-cols":[jre]}],"col-start-end":[{col:["auto",{span:["full",Dre,ui]},ui]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[jre]}],"row-start-end":[{row:["auto",{span:[Dre,ui]},ui]}],"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",ui]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ui]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[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",ui,e]}],"min-w":[{"min-w":[ui,e,"min","max","fit"]}],"max-w":[{"max-w":[ui,e,"none","full","min","max","fit","prose",{screen:[UF]},UF]}],h:[{h:[ui,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ui,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ui,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ui,e,"auto","min","max","fit"]}],"font-size":[{text:["base",UF,qF]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",l5e]}],"font-family":[{font:[jre]}],"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",ui]}],"line-clamp":[{"line-clamp":["none",q5,l5e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",O1,ui]}],"list-image":[{"list-image":["none",ui]}],"list-style-type":[{list:["none","disc","decimal",ui]}],"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:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",O1,qF]}],"underline-offset":[{"underline-offset":["auto",O1,ui]}],"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:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ui]}],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",ui]}],"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:[...X(),kxn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Fxn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Uxn]}],"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:[...B(),"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:B()}],"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:["",...B()]}],"outline-offset":[{"outline-offset":[O1,ui]}],"outline-w":[{outline:[O1,qF]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[O1,qF]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",UF,Bxn]}],"shadow-color":[{shadow:[jre]}],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",UF,ui]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[T]}],"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":[_]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"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",ui]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",ui]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",ui]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Dre,ui]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ui]}],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",ui]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",ui]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[O1,qF,l5e]}],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"]}}},Wxn=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{$re(t,"cacheSize",e),$re(t,"prefix",r),$re(t,"separator",n),$re(t,"experimentalParseClassName",o);for(let s in a)Jxn(t[s],a[s]);for(let s in i)Kxn(t[s],i[s]);return t},$re=(t,e,r)=>{r!==void 0&&(t[e]=r)},Jxn=(t,e)=>{if(e)for(let r in e)$re(t,r,e[r])},Kxn=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},cFt=(t,...e)=>typeof t=="function"?nFt(oFt,t,...e):nFt(()=>Wxn(oFt(),t),...e)});function we(...t){return Gxn(n_e(t))}var Gxn,$r=v(()=>{u5e();dFt();Gxn=cFt({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 i_e,Xxn,pe,Cn=v(()=>{i_e=$(J());ZLt();o_e();$r();Xxn=k5("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"}}),pe=i_e.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>i_e.createElement(n?XLt:"button",{className:we(Xxn({variant:e,size:r,className:t})),ref:i,...o}));pe.displayName="Button"});var fFt,a_e,f5e=v(()=>{fFt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a_e=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var pFt,mFt=v(()=>{pFt={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 Lre,hFt,gFt=v(()=>{Lre=$(J());mFt();f5e();hFt=(0,Lre.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,Lre.createElement)("svg",{ref:u,...pFt,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:a_e("lucide",o),...s},[...a.map(([l,c])=>(0,Lre.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var s_e,Me,zt=v(()=>{s_e=$(J());f5e();gFt();Me=(t,e)=>{let r=(0,s_e.forwardRef)(({className:n,...o},i)=>(0,s_e.createElement)(hFt,{ref:i,iconNode:e,className:a_e(`lucide-${fFt(t)}`,n),...o}));return r.displayName=`${t}`,r}});var Fre,yFt=v(()=>{zt();Fre=Me("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var E1,bFt=v(()=>{zt();E1=Me("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])});var B5,_Ft=v(()=>{zt();B5=Me("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])});var Yu,vFt=v(()=>{zt();Yu=Me("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Wi,wFt=v(()=>{zt();Wi=Me("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var ld,SFt=v(()=>{zt();ld=Me("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var jg,CFt=v(()=>{zt();jg=Me("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var Gb,xFt=v(()=>{zt();Gb=Me("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])});var K_,TFt=v(()=>{zt();K_=Me("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])});var BF,OFt=v(()=>{zt();BF=Me("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])});var P1,EFt=v(()=>{zt();P1=Me("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]])});var zF,PFt=v(()=>{zt();zF=Me("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 _w,MFt=v(()=>{zt();_w=Me("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var VF,RFt=v(()=>{zt();VF=Me("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var RO,IFt=v(()=>{zt();RO=Me("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 kre,AFt=v(()=>{zt();kre=Me("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var qre,NFt=v(()=>{zt();qre=Me("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]])});var Ure,DFt=v(()=>{zt();Ure=Me("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 Bre,jFt=v(()=>{zt();Bre=Me("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]])});var zre,$Ft=v(()=>{zt();zre=Me("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 $g,LFt=v(()=>{zt();$g=Me("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 Vre,FFt=v(()=>{zt();Vre=Me("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var Hre,kFt=v(()=>{zt();Hre=Me("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 cx,qFt=v(()=>{zt();cx=Me("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 Wre,UFt=v(()=>{zt();Wre=Me("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 IO,BFt=v(()=>{zt();IO=Me("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 HF,zFt=v(()=>{zt();HF=Me("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 M1,VFt=v(()=>{zt();M1=Me("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 Jre,HFt=v(()=>{zt();Jre=Me("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 dx,WFt=v(()=>{zt();dx=Me("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 Kre,JFt=v(()=>{zt();Kre=Me("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 R1,KFt=v(()=>{zt();R1=Me("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]])});var Gre,GFt=v(()=>{zt();Gre=Me("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 Xre,XFt=v(()=>{zt();Xre=Me("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 Zre,ZFt=v(()=>{zt();Zre=Me("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 Du,YFt=v(()=>{zt();Du=Me("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 Yre,QFt=v(()=>{zt();Yre=Me("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 $m,ekt=v(()=>{zt();$m=Me("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 vl,tkt=v(()=>{zt();vl=Me("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 fx,rkt=v(()=>{zt();fx=Me("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 WF,nkt=v(()=>{zt();WF=Me("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]])});var Qre,okt=v(()=>{zt();Qre=Me("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 ene,ikt=v(()=>{zt();ene=Me("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 tne,akt=v(()=>{zt();tne=Me("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 rne,skt=v(()=>{zt();rne=Me("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 X4,ukt=v(()=>{zt();X4=Me("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 px,lkt=v(()=>{zt();px=Me("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 Bs,ckt=v(()=>{zt();Bs=Me("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var nne,dkt=v(()=>{zt();nne=Me("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 z5,fkt=v(()=>{zt();z5=Me("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])});var one,pkt=v(()=>{zt();one=Me("MessageSquareX",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]])});var V5,mkt=v(()=>{zt();V5=Me("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 H5,hkt=v(()=>{zt();H5=Me("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])});var YS,gkt=v(()=>{zt();YS=Me("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 Xb,ykt=v(()=>{zt();Xb=Me("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 W5,bkt=v(()=>{zt();W5=Me("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 JF,_kt=v(()=>{zt();JF=Me("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 ine,vkt=v(()=>{zt();ine=Me("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])});var Zb,wkt=v(()=>{zt();Zb=Me("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var ane,Skt=v(()=>{zt();ane=Me("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 KF,Ckt=v(()=>{zt();KF=Me("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 sne,xkt=v(()=>{zt();sne=Me("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]])});var Z4,Tkt=v(()=>{zt();Z4=Me("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])});var une,Okt=v(()=>{zt();une=Me("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 Y4,Ekt=v(()=>{zt();Y4=Me("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var Q4,Pkt=v(()=>{zt();Q4=Me("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])});var lne,Mkt=v(()=>{zt();lne=Me("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])});var zy,Rkt=v(()=>{zt();zy=Me("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 I1,Ikt=v(()=>{zt();I1=Me("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 G_,Akt=v(()=>{zt();G_=Me("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 e2,Nkt=v(()=>{zt();e2=Me("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])});var A1,Dkt=v(()=>{zt();A1=Me("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 cne,jkt=v(()=>{zt();cne=Me("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 Vy,$kt=v(()=>{zt();Vy=Me("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 Lg,Lkt=v(()=>{zt();Lg=Me("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 vw,Fkt=v(()=>{zt();vw=Me("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 qo,kkt=v(()=>{zt();qo=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var dne,qkt=v(()=>{zt();dne=Me("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])});var fne,Ukt=v(()=>{zt();fne=Me("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])});var Or=v(()=>{xFt();TFt();OFt();PFt();MFt();RFt();IFt();BFt();zFt();ckt();gkt();ykt();Rkt();Ikt();Akt();Lkt();yFt();bFt();_Ft();vFt();wFt();SFt();CFt();EFt();AFt();NFt();DFt();jFt();$Ft();LFt();FFt();kFt();qFt();UFt();VFt();HFt();WFt();JFt();KFt();GFt();XFt();ZFt();YFt();QFt();ekt();tkt();rkt();nkt();okt();ikt();akt();skt();ukt();lkt();dkt();fkt();pkt();mkt();hkt();bkt();_kt();vkt();wkt();Skt();Ckt();xkt();Tkt();Okt();Ekt();Pkt();Mkt();Nkt();Dkt();jkt();$kt();Fkt();kkt();qkt();Ukt();});function Zxn({onCancel:t}){let e=te(),r=p5e(e.defaultModelKey)&&p5e(e.embeddingModelKey);return AO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},AO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},AO.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&AO.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.")),AO.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},AO.default.createElement(pe,{variant:"ghost",onClick:t},"Close"),AO.default.createElement(pe,{variant:"default",onClick:()=>{t2(m1.EXPIRED_MODAL)}},"Renew Now ",AO.default.createElement(M1,{className:"tw-size-4"}))))}var AO,Bkt,zkt,u_e,Vkt=v(()=>{AO=$(J()),Bkt=require("obsidian"),zkt=$(jm());Cn();Fc();mr();Or();Ye();u_e=class extends Bkt.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,zkt.createRoot)(e);let r=()=>{this.close()};this.root.render(AO.default.createElement(Zxn,{onCancel:r}))}onClose(){this.root.unmount()}}});var Wkt=S(Hkt=>{"use strict";Object.defineProperty(Hkt,"__esModule",{value:!0})});var Jkt=S(l_e=>{"use strict";Object.defineProperty(l_e,"__esModule",{value:!0});l_e.V2ChatStreamRequestSafetyMode=void 0;l_e.V2ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var Kkt=S(c_e=>{"use strict";Object.defineProperty(c_e,"__esModule",{value:!0});c_e.V2ChatStreamRequestToolChoice=void 0;c_e.V2ChatStreamRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var Xkt=S(Gkt=>{"use strict";Object.defineProperty(Gkt,"__esModule",{value:!0})});var Ykt=S(Zkt=>{"use strict";Object.defineProperty(Zkt,"__esModule",{value:!0})});var Qkt=S(d_e=>{"use strict";Object.defineProperty(d_e,"__esModule",{value:!0});d_e.V2ChatRequestSafetyMode=void 0;d_e.V2ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var eqt=S(f_e=>{"use strict";Object.defineProperty(f_e,"__esModule",{value:!0});f_e.V2ChatRequestToolChoice=void 0;f_e.V2ChatRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var rqt=S(tqt=>{"use strict";Object.defineProperty(tqt,"__esModule",{value:!0})});var nqt=S(p_e=>{"use strict";Object.defineProperty(p_e,"__esModule",{value:!0});p_e.V2EmbedRequestTruncate=void 0;p_e.V2EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var iqt=S(oqt=>{"use strict";Object.defineProperty(oqt,"__esModule",{value:!0})});var sqt=S(aqt=>{"use strict";Object.defineProperty(aqt,"__esModule",{value:!0})});var m5e=S(Fg=>{"use strict";var Yxn=Fg&&Fg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mx=Fg&&Fg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Yxn(e,t,r)};Object.defineProperty(Fg,"__esModule",{value:!0});mx(Wkt(),Fg);mx(Jkt(),Fg);mx(Kkt(),Fg);mx(Xkt(),Fg);mx(Ykt(),Fg);mx(Qkt(),Fg);mx(eqt(),Fg);mx(rqt(),Fg);mx(nqt(),Fg);mx(iqt(),Fg);mx(sqt(),Fg)});var h5e=S(uqt=>{"use strict";Object.defineProperty(uqt,"__esModule",{value:!0})});var lqt=S(r2=>{"use strict";var Qxn=r2&&r2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eTn=r2&&r2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qxn(e,t,r)};Object.defineProperty(r2,"__esModule",{value:!0});eTn(h5e(),r2)});var dqt=S(GF=>{"use strict";var tTn=GF&&GF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cqt=GF&&GF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tTn(e,t,r)};Object.defineProperty(GF,"__esModule",{value:!0});cqt(m5e(),GF);cqt(lqt(),GF)});var fqt=S(m_e=>{"use strict";Object.defineProperty(m_e,"__esModule",{value:!0});m_e.CreateEmbedJobRequestTruncate=void 0;m_e.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var g5e=S(n2=>{"use strict";var rTn=n2&&n2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nTn=n2&&n2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rTn(e,t,r)};Object.defineProperty(n2,"__esModule",{value:!0});nTn(fqt(),n2)});var y5e=S(pqt=>{"use strict";Object.defineProperty(pqt,"__esModule",{value:!0})});var mqt=S(o2=>{"use strict";var oTn=o2&&o2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iTn=o2&&o2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oTn(e,t,r)};Object.defineProperty(o2,"__esModule",{value:!0});iTn(y5e(),o2)});var gqt=S(XF=>{"use strict";var aTn=XF&&XF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hqt=XF&&XF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aTn(e,t,r)};Object.defineProperty(XF,"__esModule",{value:!0});hqt(g5e(),XF);hqt(mqt(),XF)});var bqt=S(yqt=>{"use strict";Object.defineProperty(yqt,"__esModule",{value:!0})});var vqt=S(_qt=>{"use strict";Object.defineProperty(_qt,"__esModule",{value:!0})});var Sqt=S(wqt=>{"use strict";Object.defineProperty(wqt,"__esModule",{value:!0})});var xqt=S(Cqt=>{"use strict";Object.defineProperty(Cqt,"__esModule",{value:!0})});var b5e=S(NO=>{"use strict";var sTn=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]}),h_e=NO&&NO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sTn(e,t,r)};Object.defineProperty(NO,"__esModule",{value:!0});h_e(bqt(),NO);h_e(vqt(),NO);h_e(Sqt(),NO);h_e(xqt(),NO)});var _5e=S(Tqt=>{"use strict";Object.defineProperty(Tqt,"__esModule",{value:!0})});var Oqt=S(i2=>{"use strict";var uTn=i2&&i2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lTn=i2&&i2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uTn(e,t,r)};Object.defineProperty(i2,"__esModule",{value:!0});lTn(_5e(),i2)});var Pqt=S(ZF=>{"use strict";var cTn=ZF&&ZF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eqt=ZF&&ZF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cTn(e,t,r)};Object.defineProperty(ZF,"__esModule",{value:!0});Eqt(b5e(),ZF);Eqt(Oqt(),ZF)});var Mqt=S(g_e=>{"use strict";Object.defineProperty(g_e,"__esModule",{value:!0});g_e.BaseType=void 0;g_e.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var Rqt=S(y_e=>{"use strict";Object.defineProperty(y_e,"__esModule",{value:!0});y_e.Strategy=void 0;y_e.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var Aqt=S(Iqt=>{"use strict";Object.defineProperty(Iqt,"__esModule",{value:!0})});var Nqt=S(b_e=>{"use strict";Object.defineProperty(b_e,"__esModule",{value:!0});b_e.LoraTargetModules=void 0;b_e.LoraTargetModules={LoraTargetModulesUnspecified:"LORA_TARGET_MODULES_UNSPECIFIED",LoraTargetModulesQv:"LORA_TARGET_MODULES_QV",LoraTargetModulesQkvo:"LORA_TARGET_MODULES_QKVO",LoraTargetModulesQkvoFfn:"LORA_TARGET_MODULES_QKVO_FFN"}});var jqt=S(Dqt=>{"use strict";Object.defineProperty(Dqt,"__esModule",{value:!0})});var Lqt=S($qt=>{"use strict";Object.defineProperty($qt,"__esModule",{value:!0})});var kqt=S(Fqt=>{"use strict";Object.defineProperty(Fqt,"__esModule",{value:!0})});var qqt=S(__e=>{"use strict";Object.defineProperty(__e,"__esModule",{value:!0});__e.Status=void 0;__e.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 Bqt=S(Uqt=>{"use strict";Object.defineProperty(Uqt,"__esModule",{value:!0})});var Vqt=S(zqt=>{"use strict";Object.defineProperty(zqt,"__esModule",{value:!0})});var Wqt=S(Hqt=>{"use strict";Object.defineProperty(Hqt,"__esModule",{value:!0})});var Kqt=S(Jqt=>{"use strict";Object.defineProperty(Jqt,"__esModule",{value:!0})});var Xqt=S(Gqt=>{"use strict";Object.defineProperty(Gqt,"__esModule",{value:!0})});var Yqt=S(Zqt=>{"use strict";Object.defineProperty(Zqt,"__esModule",{value:!0})});var eUt=S(Qqt=>{"use strict";Object.defineProperty(Qqt,"__esModule",{value:!0})});var rUt=S(tUt=>{"use strict";Object.defineProperty(tUt,"__esModule",{value:!0})});var oUt=S(nUt=>{"use strict";Object.defineProperty(nUt,"__esModule",{value:!0})});var aUt=S(iUt=>{"use strict";Object.defineProperty(iUt,"__esModule",{value:!0})});var v5e=S(Hl=>{"use strict";var dTn=Hl&&Hl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$h=Hl&&Hl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dTn(e,t,r)};Object.defineProperty(Hl,"__esModule",{value:!0});$h(Mqt(),Hl);$h(Rqt(),Hl);$h(Aqt(),Hl);$h(Nqt(),Hl);$h(jqt(),Hl);$h(Lqt(),Hl);$h(kqt(),Hl);$h(qqt(),Hl);$h(Bqt(),Hl);$h(Vqt(),Hl);$h(Wqt(),Hl);$h(Kqt(),Hl);$h(Xqt(),Hl);$h(Yqt(),Hl);$h(eUt(),Hl);$h(rUt(),Hl);$h(oUt(),Hl);$h(aUt(),Hl)});var sUt=S(a2=>{"use strict";var fTn=a2&&a2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pTn=a2&&a2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fTn(e,t,r)};Object.defineProperty(a2,"__esModule",{value:!0});pTn(v5e(),a2)});var lUt=S(ww=>{"use strict";var uUt=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]}),mTn=ww&&ww.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hTn=ww&&ww.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uUt(r,e,n[o]);return mTn(r,e),r}}(),gTn=ww&&ww.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uUt(e,t,r)};Object.defineProperty(ww,"__esModule",{value:!0});ww.finetuning=void 0;ww.finetuning=hTn(sUt());gTn(v5e(),ww)});var w5e=S(cUt=>{"use strict";Object.defineProperty(cUt,"__esModule",{value:!0})});var dUt=S(s2=>{"use strict";var yTn=s2&&s2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bTn=s2&&s2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yTn(e,t,r)};Object.defineProperty(s2,"__esModule",{value:!0});bTn(w5e(),s2)});var pUt=S(YF=>{"use strict";var _Tn=YF&&YF.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fUt=YF&&YF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_Tn(e,t,r)};Object.defineProperty(YF,"__esModule",{value:!0});fUt(lUt(),YF);fUt(dUt(),YF)});var S5e=S(mUt=>{"use strict";Object.defineProperty(mUt,"__esModule",{value:!0})});var hUt=S(u2=>{"use strict";var vTn=u2&&u2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wTn=u2&&u2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vTn(e,t,r)};Object.defineProperty(u2,"__esModule",{value:!0});wTn(S5e(),u2)});var gUt=S(l2=>{"use strict";var STn=l2&&l2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CTn=l2&&l2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&STn(e,t,r)};Object.defineProperty(l2,"__esModule",{value:!0});CTn(hUt(),l2)});var C5e=S(yUt=>{"use strict";Object.defineProperty(yUt,"__esModule",{value:!0})});var bUt=S(c2=>{"use strict";var xTn=c2&&c2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TTn=c2&&c2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xTn(e,t,r)};Object.defineProperty(c2,"__esModule",{value:!0});TTn(C5e(),c2)});var _Ut=S(d2=>{"use strict";var OTn=d2&&d2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ETn=d2&&d2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OTn(e,t,r)};Object.defineProperty(d2,"__esModule",{value:!0});ETn(bUt(),d2)});var wUt=S(zs=>{"use strict";var vUt=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]}),PTn=zs&&zs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5=zs&&zs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vUt(r,e,n[o]);return PTn(r,e),r}}(),N1=zs&&zs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vUt(e,t,r)};Object.defineProperty(zs,"__esModule",{value:!0});zs.models=zs.connectors=zs.finetuning=zs.datasets=zs.embedJobs=zs.v2=void 0;zs.v2=J5(dqt());N1(m5e(),zs);zs.embedJobs=J5(gqt());N1(g5e(),zs);zs.datasets=J5(Pqt());N1(b5e(),zs);zs.finetuning=J5(pUt());zs.connectors=J5(gUt());zs.models=J5(_Ut());N1(h5e(),zs);N1(y5e(),zs);N1(_5e(),zs);N1(S5e(),zs);N1(C5e(),zs);N1(w5e(),zs)});var SUt=S(v_e=>{"use strict";Object.defineProperty(v_e,"__esModule",{value:!0});v_e.ChatStreamRequestPromptTruncation=void 0;v_e.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var CUt=S(w_e=>{"use strict";Object.defineProperty(w_e,"__esModule",{value:!0});w_e.ChatStreamRequestCitationQuality=void 0;w_e.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var xUt=S(S_e=>{"use strict";Object.defineProperty(S_e,"__esModule",{value:!0});S_e.ChatStreamRequestSafetyMode=void 0;S_e.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var OUt=S(TUt=>{"use strict";Object.defineProperty(TUt,"__esModule",{value:!0})});var EUt=S(C_e=>{"use strict";Object.defineProperty(C_e,"__esModule",{value:!0});C_e.ChatRequestPromptTruncation=void 0;C_e.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var PUt=S(x_e=>{"use strict";Object.defineProperty(x_e,"__esModule",{value:!0});x_e.ChatRequestCitationQuality=void 0;x_e.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var MUt=S(T_e=>{"use strict";Object.defineProperty(T_e,"__esModule",{value:!0});T_e.ChatRequestSafetyMode=void 0;T_e.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var IUt=S(RUt=>{"use strict";Object.defineProperty(RUt,"__esModule",{value:!0})});var AUt=S(O_e=>{"use strict";Object.defineProperty(O_e,"__esModule",{value:!0});O_e.GenerateStreamRequestTruncate=void 0;O_e.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var NUt=S(E_e=>{"use strict";Object.defineProperty(E_e,"__esModule",{value:!0});E_e.GenerateStreamRequestReturnLikelihoods=void 0;E_e.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var jUt=S(DUt=>{"use strict";Object.defineProperty(DUt,"__esModule",{value:!0})});var $Ut=S(P_e=>{"use strict";Object.defineProperty(P_e,"__esModule",{value:!0});P_e.GenerateRequestTruncate=void 0;P_e.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var LUt=S(M_e=>{"use strict";Object.defineProperty(M_e,"__esModule",{value:!0});M_e.GenerateRequestReturnLikelihoods=void 0;M_e.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var kUt=S(FUt=>{"use strict";Object.defineProperty(FUt,"__esModule",{value:!0})});var qUt=S(R_e=>{"use strict";Object.defineProperty(R_e,"__esModule",{value:!0});R_e.EmbedRequestTruncate=void 0;R_e.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var BUt=S(UUt=>{"use strict";Object.defineProperty(UUt,"__esModule",{value:!0})});var VUt=S(zUt=>{"use strict";Object.defineProperty(zUt,"__esModule",{value:!0})});var WUt=S(HUt=>{"use strict";Object.defineProperty(HUt,"__esModule",{value:!0})});var KUt=S(JUt=>{"use strict";Object.defineProperty(JUt,"__esModule",{value:!0})});var XUt=S(GUt=>{"use strict";Object.defineProperty(GUt,"__esModule",{value:!0})});var ZUt=S(I_e=>{"use strict";Object.defineProperty(I_e,"__esModule",{value:!0});I_e.ClassifyRequestTruncate=void 0;I_e.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var QUt=S(YUt=>{"use strict";Object.defineProperty(YUt,"__esModule",{value:!0})});var eBt=S(A_e=>{"use strict";Object.defineProperty(A_e,"__esModule",{value:!0});A_e.ClassifyResponseClassificationsItemClassificationType=void 0;A_e.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var rBt=S(tBt=>{"use strict";Object.defineProperty(tBt,"__esModule",{value:!0})});var oBt=S(nBt=>{"use strict";Object.defineProperty(nBt,"__esModule",{value:!0})});var iBt=S(N_e=>{"use strict";Object.defineProperty(N_e,"__esModule",{value:!0});N_e.SummarizeRequestLength=void 0;N_e.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var aBt=S(D_e=>{"use strict";Object.defineProperty(D_e,"__esModule",{value:!0});D_e.SummarizeRequestFormat=void 0;D_e.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var sBt=S(j_e=>{"use strict";Object.defineProperty(j_e,"__esModule",{value:!0});j_e.SummarizeRequestExtractiveness=void 0;j_e.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var lBt=S(uBt=>{"use strict";Object.defineProperty(uBt,"__esModule",{value:!0})});var dBt=S(cBt=>{"use strict";Object.defineProperty(cBt,"__esModule",{value:!0})});var pBt=S(fBt=>{"use strict";Object.defineProperty(fBt,"__esModule",{value:!0})});var hBt=S(mBt=>{"use strict";Object.defineProperty(mBt,"__esModule",{value:!0})});var yBt=S(gBt=>{"use strict";Object.defineProperty(gBt,"__esModule",{value:!0})});var _Bt=S(bBt=>{"use strict";Object.defineProperty(bBt,"__esModule",{value:!0})});var wBt=S(vBt=>{"use strict";Object.defineProperty(vBt,"__esModule",{value:!0})});var CBt=S(SBt=>{"use strict";Object.defineProperty(SBt,"__esModule",{value:!0})});var TBt=S(xBt=>{"use strict";Object.defineProperty(xBt,"__esModule",{value:!0})});var EBt=S(OBt=>{"use strict";Object.defineProperty(OBt,"__esModule",{value:!0})});var MBt=S(PBt=>{"use strict";Object.defineProperty(PBt,"__esModule",{value:!0})});var IBt=S(RBt=>{"use strict";Object.defineProperty(RBt,"__esModule",{value:!0})});var NBt=S(ABt=>{"use strict";Object.defineProperty(ABt,"__esModule",{value:!0})});var jBt=S(DBt=>{"use strict";Object.defineProperty(DBt,"__esModule",{value:!0})});var LBt=S($Bt=>{"use strict";Object.defineProperty($Bt,"__esModule",{value:!0})});var kBt=S(FBt=>{"use strict";Object.defineProperty(FBt,"__esModule",{value:!0})});var qBt=S($_e=>{"use strict";Object.defineProperty($_e,"__esModule",{value:!0});$_e.ChatCitationType=void 0;$_e.ChatCitationType={TextContent:"TEXT_CONTENT",Plan:"PLAN"}});var BBt=S(UBt=>{"use strict";Object.defineProperty(UBt,"__esModule",{value:!0})});var VBt=S(zBt=>{"use strict";Object.defineProperty(zBt,"__esModule",{value:!0})});var WBt=S(HBt=>{"use strict";Object.defineProperty(HBt,"__esModule",{value:!0})});var KBt=S(JBt=>{"use strict";Object.defineProperty(JBt,"__esModule",{value:!0})});var GBt=S(L_e=>{"use strict";Object.defineProperty(L_e,"__esModule",{value:!0});L_e.FinishReason=void 0;L_e.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var ZBt=S(XBt=>{"use strict";Object.defineProperty(XBt,"__esModule",{value:!0})});var QBt=S(YBt=>{"use strict";Object.defineProperty(YBt,"__esModule",{value:!0})});var tzt=S(ezt=>{"use strict";Object.defineProperty(ezt,"__esModule",{value:!0})});var nzt=S(rzt=>{"use strict";Object.defineProperty(rzt,"__esModule",{value:!0})});var izt=S(ozt=>{"use strict";Object.defineProperty(ozt,"__esModule",{value:!0})});var szt=S(azt=>{"use strict";Object.defineProperty(azt,"__esModule",{value:!0})});var lzt=S(uzt=>{"use strict";Object.defineProperty(uzt,"__esModule",{value:!0})});var dzt=S(czt=>{"use strict";Object.defineProperty(czt,"__esModule",{value:!0})});var pzt=S(fzt=>{"use strict";Object.defineProperty(fzt,"__esModule",{value:!0})});var hzt=S(mzt=>{"use strict";Object.defineProperty(mzt,"__esModule",{value:!0})});var yzt=S(gzt=>{"use strict";Object.defineProperty(gzt,"__esModule",{value:!0})});var bzt=S(F_e=>{"use strict";Object.defineProperty(F_e,"__esModule",{value:!0});F_e.ChatStreamEndEventFinishReason=void 0;F_e.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var vzt=S(_zt=>{"use strict";Object.defineProperty(_zt,"__esModule",{value:!0})});var Szt=S(wzt=>{"use strict";Object.defineProperty(wzt,"__esModule",{value:!0})});var xzt=S(Czt=>{"use strict";Object.defineProperty(Czt,"__esModule",{value:!0})});var Ozt=S(Tzt=>{"use strict";Object.defineProperty(Tzt,"__esModule",{value:!0})});var Pzt=S(Ezt=>{"use strict";Object.defineProperty(Ezt,"__esModule",{value:!0})});var Mzt=S(k_e=>{"use strict";Object.defineProperty(k_e,"__esModule",{value:!0});k_e.ImageUrlDetail=void 0;k_e.ImageUrlDetail={Auto:"auto",Low:"low",High:"high"}});var Izt=S(Rzt=>{"use strict";Object.defineProperty(Rzt,"__esModule",{value:!0})});var Nzt=S(Azt=>{"use strict";Object.defineProperty(Azt,"__esModule",{value:!0})});var jzt=S(Dzt=>{"use strict";Object.defineProperty(Dzt,"__esModule",{value:!0})});var Lzt=S($zt=>{"use strict";Object.defineProperty($zt,"__esModule",{value:!0})});var kzt=S(Fzt=>{"use strict";Object.defineProperty(Fzt,"__esModule",{value:!0})});var Uzt=S(qzt=>{"use strict";Object.defineProperty(qzt,"__esModule",{value:!0})});var zzt=S(Bzt=>{"use strict";Object.defineProperty(Bzt,"__esModule",{value:!0})});var Hzt=S(Vzt=>{"use strict";Object.defineProperty(Vzt,"__esModule",{value:!0})});var Jzt=S(Wzt=>{"use strict";Object.defineProperty(Wzt,"__esModule",{value:!0})});var Gzt=S(Kzt=>{"use strict";Object.defineProperty(Kzt,"__esModule",{value:!0})});var Zzt=S(Xzt=>{"use strict";Object.defineProperty(Xzt,"__esModule",{value:!0})});var Yzt=S(q_e=>{"use strict";Object.defineProperty(q_e,"__esModule",{value:!0});q_e.CitationType=void 0;q_e.CitationType={TextContent:"TEXT_CONTENT",ThinkingContent:"THINKING_CONTENT",Plan:"PLAN"}});var e4t=S(Qzt=>{"use strict";Object.defineProperty(Qzt,"__esModule",{value:!0})});var r4t=S(t4t=>{"use strict";Object.defineProperty(t4t,"__esModule",{value:!0})});var o4t=S(n4t=>{"use strict";Object.defineProperty(n4t,"__esModule",{value:!0})});var a4t=S(i4t=>{"use strict";Object.defineProperty(i4t,"__esModule",{value:!0})});var u4t=S(s4t=>{"use strict";Object.defineProperty(s4t,"__esModule",{value:!0})});var c4t=S(l4t=>{"use strict";Object.defineProperty(l4t,"__esModule",{value:!0})});var f4t=S(d4t=>{"use strict";Object.defineProperty(d4t,"__esModule",{value:!0})});var m4t=S(p4t=>{"use strict";Object.defineProperty(p4t,"__esModule",{value:!0})});var g4t=S(h4t=>{"use strict";Object.defineProperty(h4t,"__esModule",{value:!0})});var b4t=S(y4t=>{"use strict";Object.defineProperty(y4t,"__esModule",{value:!0})});var v4t=S(_4t=>{"use strict";Object.defineProperty(_4t,"__esModule",{value:!0})});var S4t=S(w4t=>{"use strict";Object.defineProperty(w4t,"__esModule",{value:!0})});var x4t=S(C4t=>{"use strict";Object.defineProperty(C4t,"__esModule",{value:!0})});var O4t=S(T4t=>{"use strict";Object.defineProperty(T4t,"__esModule",{value:!0})});var P4t=S(E4t=>{"use strict";Object.defineProperty(E4t,"__esModule",{value:!0})});var R4t=S(M4t=>{"use strict";Object.defineProperty(M4t,"__esModule",{value:!0})});var I4t=S(U_e=>{"use strict";Object.defineProperty(U_e,"__esModule",{value:!0});U_e.CitationOptionsMode=void 0;U_e.CitationOptionsMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var N4t=S(A4t=>{"use strict";Object.defineProperty(A4t,"__esModule",{value:!0})});var j4t=S(D4t=>{"use strict";Object.defineProperty(D4t,"__esModule",{value:!0})});var L4t=S($4t=>{"use strict";Object.defineProperty($4t,"__esModule",{value:!0})});var k4t=S(F4t=>{"use strict";Object.defineProperty(F4t,"__esModule",{value:!0})});var q4t=S(B_e=>{"use strict";Object.defineProperty(B_e,"__esModule",{value:!0});B_e.ThinkingType=void 0;B_e.ThinkingType={Enabled:"enabled",Disabled:"disabled"}});var B4t=S(U4t=>{"use strict";Object.defineProperty(U4t,"__esModule",{value:!0})});var z4t=S(z_e=>{"use strict";Object.defineProperty(z_e,"__esModule",{value:!0});z_e.ChatFinishReason=void 0;z_e.ChatFinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",MaxTokens:"MAX_TOKENS",ToolCall:"TOOL_CALL",Error:"ERROR"}});var H4t=S(V4t=>{"use strict";Object.defineProperty(V4t,"__esModule",{value:!0})});var J4t=S(W4t=>{"use strict";Object.defineProperty(W4t,"__esModule",{value:!0})});var G4t=S(K4t=>{"use strict";Object.defineProperty(K4t,"__esModule",{value:!0})});var Z4t=S(X4t=>{"use strict";Object.defineProperty(X4t,"__esModule",{value:!0})});var Q4t=S(Y4t=>{"use strict";Object.defineProperty(Y4t,"__esModule",{value:!0})});var t2t=S(e2t=>{"use strict";Object.defineProperty(e2t,"__esModule",{value:!0})});var n2t=S(r2t=>{"use strict";Object.defineProperty(r2t,"__esModule",{value:!0})});var i2t=S(o2t=>{"use strict";Object.defineProperty(o2t,"__esModule",{value:!0})});var s2t=S(a2t=>{"use strict";Object.defineProperty(a2t,"__esModule",{value:!0})});var l2t=S(u2t=>{"use strict";Object.defineProperty(u2t,"__esModule",{value:!0})});var c2t=S(V_e=>{"use strict";Object.defineProperty(V_e,"__esModule",{value:!0});V_e.ChatContentStartEventDeltaMessageContentType=void 0;V_e.ChatContentStartEventDeltaMessageContentType={Text:"text",Thinking:"thinking"}});var f2t=S(d2t=>{"use strict";Object.defineProperty(d2t,"__esModule",{value:!0})});var m2t=S(p2t=>{"use strict";Object.defineProperty(p2t,"__esModule",{value:!0})});var g2t=S(h2t=>{"use strict";Object.defineProperty(h2t,"__esModule",{value:!0})});var b2t=S(y2t=>{"use strict";Object.defineProperty(y2t,"__esModule",{value:!0})});var v2t=S(_2t=>{"use strict";Object.defineProperty(_2t,"__esModule",{value:!0})});var S2t=S(w2t=>{"use strict";Object.defineProperty(w2t,"__esModule",{value:!0})});var x2t=S(C2t=>{"use strict";Object.defineProperty(C2t,"__esModule",{value:!0})});var O2t=S(T2t=>{"use strict";Object.defineProperty(T2t,"__esModule",{value:!0})});var P2t=S(E2t=>{"use strict";Object.defineProperty(E2t,"__esModule",{value:!0})});var R2t=S(M2t=>{"use strict";Object.defineProperty(M2t,"__esModule",{value:!0})});var A2t=S(I2t=>{"use strict";Object.defineProperty(I2t,"__esModule",{value:!0})});var D2t=S(N2t=>{"use strict";Object.defineProperty(N2t,"__esModule",{value:!0})});var $2t=S(j2t=>{"use strict";Object.defineProperty(j2t,"__esModule",{value:!0})});var F2t=S(L2t=>{"use strict";Object.defineProperty(L2t,"__esModule",{value:!0})});var q2t=S(k2t=>{"use strict";Object.defineProperty(k2t,"__esModule",{value:!0})});var B2t=S(U2t=>{"use strict";Object.defineProperty(U2t,"__esModule",{value:!0})});var V2t=S(z2t=>{"use strict";Object.defineProperty(z2t,"__esModule",{value:!0})});var W2t=S(H2t=>{"use strict";Object.defineProperty(H2t,"__esModule",{value:!0})});var K2t=S(J2t=>{"use strict";Object.defineProperty(J2t,"__esModule",{value:!0})});var X2t=S(G2t=>{"use strict";Object.defineProperty(G2t,"__esModule",{value:!0})});var Y2t=S(Z2t=>{"use strict";Object.defineProperty(Z2t,"__esModule",{value:!0})});var eVt=S(Q2t=>{"use strict";Object.defineProperty(Q2t,"__esModule",{value:!0})});var rVt=S(tVt=>{"use strict";Object.defineProperty(tVt,"__esModule",{value:!0})});var oVt=S(nVt=>{"use strict";Object.defineProperty(nVt,"__esModule",{value:!0})});var aVt=S(iVt=>{"use strict";Object.defineProperty(iVt,"__esModule",{value:!0})});var uVt=S(sVt=>{"use strict";Object.defineProperty(sVt,"__esModule",{value:!0})});var cVt=S(lVt=>{"use strict";Object.defineProperty(lVt,"__esModule",{value:!0})});var fVt=S(dVt=>{"use strict";Object.defineProperty(dVt,"__esModule",{value:!0})});var mVt=S(pVt=>{"use strict";Object.defineProperty(pVt,"__esModule",{value:!0})});var gVt=S(hVt=>{"use strict";Object.defineProperty(hVt,"__esModule",{value:!0})});var bVt=S(yVt=>{"use strict";Object.defineProperty(yVt,"__esModule",{value:!0})});var vVt=S(_Vt=>{"use strict";Object.defineProperty(_Vt,"__esModule",{value:!0})});var SVt=S(wVt=>{"use strict";Object.defineProperty(wVt,"__esModule",{value:!0})});var xVt=S(CVt=>{"use strict";Object.defineProperty(CVt,"__esModule",{value:!0})});var OVt=S(TVt=>{"use strict";Object.defineProperty(TVt,"__esModule",{value:!0})});var EVt=S(H_e=>{"use strict";Object.defineProperty(H_e,"__esModule",{value:!0});H_e.EmbedInputType=void 0;H_e.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering",Image:"image"}});var PVt=S(W_e=>{"use strict";Object.defineProperty(W_e,"__esModule",{value:!0});W_e.EmbeddingType=void 0;W_e.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary",Base64:"base64"}});var RVt=S(MVt=>{"use strict";Object.defineProperty(MVt,"__esModule",{value:!0})});var AVt=S(IVt=>{"use strict";Object.defineProperty(IVt,"__esModule",{value:!0})});var DVt=S(NVt=>{"use strict";Object.defineProperty(NVt,"__esModule",{value:!0})});var $Vt=S(jVt=>{"use strict";Object.defineProperty(jVt,"__esModule",{value:!0})});var FVt=S(LVt=>{"use strict";Object.defineProperty(LVt,"__esModule",{value:!0})});var qVt=S(kVt=>{"use strict";Object.defineProperty(kVt,"__esModule",{value:!0})});var BVt=S(UVt=>{"use strict";Object.defineProperty(UVt,"__esModule",{value:!0})});var VVt=S(zVt=>{"use strict";Object.defineProperty(zVt,"__esModule",{value:!0})});var WVt=S(HVt=>{"use strict";Object.defineProperty(HVt,"__esModule",{value:!0})});var JVt=S(J_e=>{"use strict";Object.defineProperty(J_e,"__esModule",{value:!0});J_e.EmbedJobStatus=void 0;J_e.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var KVt=S(K_e=>{"use strict";Object.defineProperty(K_e,"__esModule",{value:!0});K_e.EmbedJobTruncate=void 0;K_e.EmbedJobTruncate={Start:"START",End:"END"}});var XVt=S(GVt=>{"use strict";Object.defineProperty(GVt,"__esModule",{value:!0})});var YVt=S(ZVt=>{"use strict";Object.defineProperty(ZVt,"__esModule",{value:!0})});var eHt=S(QVt=>{"use strict";Object.defineProperty(QVt,"__esModule",{value:!0})});var rHt=S(tHt=>{"use strict";Object.defineProperty(tHt,"__esModule",{value:!0})});var oHt=S(nHt=>{"use strict";Object.defineProperty(nHt,"__esModule",{value:!0})});var iHt=S(G_e=>{"use strict";Object.defineProperty(G_e,"__esModule",{value:!0});G_e.DatasetValidationStatus=void 0;G_e.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var aHt=S(X_e=>{"use strict";Object.defineProperty(X_e,"__esModule",{value:!0});X_e.DatasetType=void 0;X_e.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 uHt=S(sHt=>{"use strict";Object.defineProperty(sHt,"__esModule",{value:!0})});var cHt=S(lHt=>{"use strict";Object.defineProperty(lHt,"__esModule",{value:!0})});var fHt=S(dHt=>{"use strict";Object.defineProperty(dHt,"__esModule",{value:!0})});var mHt=S(pHt=>{"use strict";Object.defineProperty(pHt,"__esModule",{value:!0})});var gHt=S(hHt=>{"use strict";Object.defineProperty(hHt,"__esModule",{value:!0})});var bHt=S(yHt=>{"use strict";Object.defineProperty(yHt,"__esModule",{value:!0})});var vHt=S(_Ht=>{"use strict";Object.defineProperty(_Ht,"__esModule",{value:!0})});var SHt=S(wHt=>{"use strict";Object.defineProperty(wHt,"__esModule",{value:!0})});var xHt=S(CHt=>{"use strict";Object.defineProperty(CHt,"__esModule",{value:!0})});var OHt=S(THt=>{"use strict";Object.defineProperty(THt,"__esModule",{value:!0})});var EHt=S(Z_e=>{"use strict";Object.defineProperty(Z_e,"__esModule",{value:!0});Z_e.ConnectorAuthStatus=void 0;Z_e.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var MHt=S(PHt=>{"use strict";Object.defineProperty(PHt,"__esModule",{value:!0})});var IHt=S(RHt=>{"use strict";Object.defineProperty(RHt,"__esModule",{value:!0})});var NHt=S(AHt=>{"use strict";Object.defineProperty(AHt,"__esModule",{value:!0})});var DHt=S(Y_e=>{"use strict";Object.defineProperty(Y_e,"__esModule",{value:!0});Y_e.AuthTokenType=void 0;Y_e.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var $Ht=S(jHt=>{"use strict";Object.defineProperty(jHt,"__esModule",{value:!0})});var FHt=S(LHt=>{"use strict";Object.defineProperty(LHt,"__esModule",{value:!0})});var qHt=S(kHt=>{"use strict";Object.defineProperty(kHt,"__esModule",{value:!0})});var BHt=S(UHt=>{"use strict";Object.defineProperty(UHt,"__esModule",{value:!0})});var VHt=S(zHt=>{"use strict";Object.defineProperty(zHt,"__esModule",{value:!0})});var WHt=S(HHt=>{"use strict";Object.defineProperty(HHt,"__esModule",{value:!0})});var JHt=S(Q_e=>{"use strict";Object.defineProperty(Q_e,"__esModule",{value:!0});Q_e.CompatibleEndpoint=void 0;Q_e.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var GHt=S(KHt=>{"use strict";Object.defineProperty(KHt,"__esModule",{value:!0})});var ZHt=S(XHt=>{"use strict";Object.defineProperty(XHt,"__esModule",{value:!0})});var YHt=S(me=>{"use strict";var MTn=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]}),be=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&MTn(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});be(SUt(),me);be(CUt(),me);be(xUt(),me);be(OUt(),me);be(EUt(),me);be(PUt(),me);be(MUt(),me);be(IUt(),me);be(AUt(),me);be(NUt(),me);be(jUt(),me);be($Ut(),me);be(LUt(),me);be(kUt(),me);be(qUt(),me);be(BUt(),me);be(VUt(),me);be(WUt(),me);be(KUt(),me);be(XUt(),me);be(ZUt(),me);be(QUt(),me);be(eBt(),me);be(rBt(),me);be(oBt(),me);be(iBt(),me);be(aBt(),me);be(sBt(),me);be(lBt(),me);be(dBt(),me);be(pBt(),me);be(hBt(),me);be(yBt(),me);be(_Bt(),me);be(wBt(),me);be(CBt(),me);be(TBt(),me);be(EBt(),me);be(MBt(),me);be(IBt(),me);be(NBt(),me);be(jBt(),me);be(LBt(),me);be(kBt(),me);be(qBt(),me);be(BBt(),me);be(VBt(),me);be(WBt(),me);be(KBt(),me);be(GBt(),me);be(ZBt(),me);be(QBt(),me);be(tzt(),me);be(nzt(),me);be(izt(),me);be(szt(),me);be(lzt(),me);be(dzt(),me);be(pzt(),me);be(hzt(),me);be(yzt(),me);be(bzt(),me);be(vzt(),me);be(Szt(),me);be(xzt(),me);be(Ozt(),me);be(Pzt(),me);be(Mzt(),me);be(Izt(),me);be(Nzt(),me);be(jzt(),me);be(Lzt(),me);be(kzt(),me);be(Uzt(),me);be(zzt(),me);be(Hzt(),me);be(Jzt(),me);be(Gzt(),me);be(Zzt(),me);be(Yzt(),me);be(e4t(),me);be(r4t(),me);be(o4t(),me);be(a4t(),me);be(u4t(),me);be(c4t(),me);be(f4t(),me);be(m4t(),me);be(g4t(),me);be(b4t(),me);be(v4t(),me);be(S4t(),me);be(x4t(),me);be(O4t(),me);be(P4t(),me);be(R4t(),me);be(I4t(),me);be(N4t(),me);be(j4t(),me);be(L4t(),me);be(k4t(),me);be(q4t(),me);be(B4t(),me);be(z4t(),me);be(H4t(),me);be(J4t(),me);be(G4t(),me);be(Z4t(),me);be(Q4t(),me);be(t2t(),me);be(n2t(),me);be(i2t(),me);be(s2t(),me);be(l2t(),me);be(c2t(),me);be(f2t(),me);be(m2t(),me);be(g2t(),me);be(b2t(),me);be(v2t(),me);be(S2t(),me);be(x2t(),me);be(O2t(),me);be(P2t(),me);be(R2t(),me);be(A2t(),me);be(D2t(),me);be($2t(),me);be(F2t(),me);be(q2t(),me);be(B2t(),me);be(V2t(),me);be(W2t(),me);be(K2t(),me);be(X2t(),me);be(Y2t(),me);be(eVt(),me);be(rVt(),me);be(oVt(),me);be(aVt(),me);be(uVt(),me);be(cVt(),me);be(fVt(),me);be(mVt(),me);be(gVt(),me);be(bVt(),me);be(vVt(),me);be(SVt(),me);be(xVt(),me);be(OVt(),me);be(EVt(),me);be(PVt(),me);be(RVt(),me);be(AVt(),me);be(DVt(),me);be($Vt(),me);be(FVt(),me);be(qVt(),me);be(BVt(),me);be(VVt(),me);be(WVt(),me);be(JVt(),me);be(KVt(),me);be(XVt(),me);be(YVt(),me);be(eHt(),me);be(rHt(),me);be(oHt(),me);be(iHt(),me);be(aHt(),me);be(uHt(),me);be(cHt(),me);be(fHt(),me);be(mHt(),me);be(gHt(),me);be(bHt(),me);be(vHt(),me);be(SHt(),me);be(xHt(),me);be(OHt(),me);be(EHt(),me);be(MHt(),me);be(IHt(),me);be(NHt(),me);be(DHt(),me);be($Ht(),me);be(FHt(),me);be(qHt(),me);be(BHt(),me);be(VHt(),me);be(WHt(),me);be(JHt(),me);be(GHt(),me);be(ZHt(),me)});var eve=S(pne=>{"use strict";Object.defineProperty(pne,"__esModule",{value:!0});pne.toJson=void 0;pne.fromJson=ITn;var RTn=(t,e,r)=>JSON.stringify(t,e,r);pne.toJson=RTn;function ITn(t,e){return JSON.parse(t,e)}});var QHt=S(tve=>{"use strict";Object.defineProperty(tve,"__esModule",{value:!0});tve.CohereError=void 0;var ATn=eve(),x5e=class t extends Error{constructor({message:e,statusCode:r,body:n,rawResponse:o}){super(NTn({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),this.statusCode=r,this.body=n,this.rawResponse=o}};tve.CohereError=x5e;function NTn({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: ${(0,ATn.toJson)(r,void 0,2)}`),n.join(`
|
||
`)}});var e3t=S(rve=>{"use strict";Object.defineProperty(rve,"__esModule",{value:!0});rve.CohereTimeoutError=void 0;var T5e=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};rve.CohereTimeoutError=T5e});var kc=S(K5=>{"use strict";Object.defineProperty(K5,"__esModule",{value:!0});K5.CohereTimeoutError=K5.CohereError=void 0;var DTn=QHt();Object.defineProperty(K5,"CohereError",{enumerable:!0,get:function(){return DTn.CohereError}});var jTn=e3t();Object.defineProperty(K5,"CohereTimeoutError",{enumerable:!0,get:function(){return jTn.CohereTimeoutError}})});var t3t=S(DO=>{"use strict";var $Tn=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]}),LTn=DO&&DO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FTn=DO&&DO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Tn(r,e,n[o]);return LTn(r,e),r}}();Object.defineProperty(DO,"__esModule",{value:!0});DO.BadRequestError=void 0;var kTn=FTn(kc()),O5e=class t extends kTn.CohereError{constructor(e,r){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};DO.BadRequestError=O5e});var r3t=S(jO=>{"use strict";var qTn=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]}),UTn=jO&&jO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BTn=jO&&jO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qTn(r,e,n[o]);return UTn(r,e),r}}();Object.defineProperty(jO,"__esModule",{value:!0});jO.UnauthorizedError=void 0;var zTn=BTn(kc()),E5e=class t extends zTn.CohereError{constructor(e,r){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};jO.UnauthorizedError=E5e});var n3t=S($O=>{"use strict";var VTn=$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]}),HTn=$O&&$O.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WTn=$O&&$O.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VTn(r,e,n[o]);return HTn(r,e),r}}();Object.defineProperty($O,"__esModule",{value:!0});$O.ForbiddenError=void 0;var JTn=WTn(kc()),P5e=class t extends JTn.CohereError{constructor(e,r){super({message:"ForbiddenError",statusCode:403,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};$O.ForbiddenError=P5e});var o3t=S(LO=>{"use strict";var KTn=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]}),GTn=LO&&LO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XTn=LO&&LO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KTn(r,e,n[o]);return GTn(r,e),r}}();Object.defineProperty(LO,"__esModule",{value:!0});LO.NotFoundError=void 0;var ZTn=XTn(kc()),M5e=class t extends ZTn.CohereError{constructor(e,r){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};LO.NotFoundError=M5e});var i3t=S(FO=>{"use strict";var YTn=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]}),QTn=FO&&FO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eOn=FO&&FO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&YTn(r,e,n[o]);return QTn(r,e),r}}();Object.defineProperty(FO,"__esModule",{value:!0});FO.UnprocessableEntityError=void 0;var tOn=eOn(kc()),R5e=class t extends tOn.CohereError{constructor(e,r){super({message:"UnprocessableEntityError",statusCode:422,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};FO.UnprocessableEntityError=R5e});var a3t=S(kO=>{"use strict";var rOn=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]}),nOn=kO&&kO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oOn=kO&&kO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rOn(r,e,n[o]);return nOn(r,e),r}}();Object.defineProperty(kO,"__esModule",{value:!0});kO.TooManyRequestsError=void 0;var iOn=oOn(kc()),I5e=class t extends iOn.CohereError{constructor(e,r){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};kO.TooManyRequestsError=I5e});var s3t=S(qO=>{"use strict";var aOn=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]}),sOn=qO&&qO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uOn=qO&&qO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aOn(r,e,n[o]);return sOn(r,e),r}}();Object.defineProperty(qO,"__esModule",{value:!0});qO.InvalidTokenError=void 0;var lOn=uOn(kc()),A5e=class t extends lOn.CohereError{constructor(e,r){super({message:"InvalidTokenError",statusCode:498,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};qO.InvalidTokenError=A5e});var u3t=S(UO=>{"use strict";var cOn=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]}),dOn=UO&&UO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fOn=UO&&UO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cOn(r,e,n[o]);return dOn(r,e),r}}();Object.defineProperty(UO,"__esModule",{value:!0});UO.ClientClosedRequestError=void 0;var pOn=fOn(kc()),N5e=class t extends pOn.CohereError{constructor(e,r){super({message:"ClientClosedRequestError",statusCode:499,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};UO.ClientClosedRequestError=N5e});var l3t=S(BO=>{"use strict";var mOn=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]}),hOn=BO&&BO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gOn=BO&&BO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mOn(r,e,n[o]);return hOn(r,e),r}}();Object.defineProperty(BO,"__esModule",{value:!0});BO.InternalServerError=void 0;var yOn=gOn(kc()),D5e=class t extends yOn.CohereError{constructor(e,r){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};BO.InternalServerError=D5e});var c3t=S(zO=>{"use strict";var bOn=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]}),_On=zO&&zO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vOn=zO&&zO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bOn(r,e,n[o]);return _On(r,e),r}}();Object.defineProperty(zO,"__esModule",{value:!0});zO.NotImplementedError=void 0;var wOn=vOn(kc()),j5e=class t extends wOn.CohereError{constructor(e,r){super({message:"NotImplementedError",statusCode:501,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};zO.NotImplementedError=j5e});var d3t=S(VO=>{"use strict";var SOn=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]}),COn=VO&&VO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xOn=VO&&VO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SOn(r,e,n[o]);return COn(r,e),r}}();Object.defineProperty(VO,"__esModule",{value:!0});VO.ServiceUnavailableError=void 0;var TOn=xOn(kc()),$5e=class t extends TOn.CohereError{constructor(e,r){super({message:"ServiceUnavailableError",statusCode:503,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};VO.ServiceUnavailableError=$5e});var f3t=S(HO=>{"use strict";var OOn=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]}),EOn=HO&&HO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),POn=HO&&HO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OOn(r,e,n[o]);return EOn(r,e),r}}();Object.defineProperty(HO,"__esModule",{value:!0});HO.GatewayTimeoutError=void 0;var MOn=POn(kc()),L5e=class t extends MOn.CohereError{constructor(e,r){super({message:"GatewayTimeoutError",statusCode:504,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};HO.GatewayTimeoutError=L5e});var p3t=S(Lh=>{"use strict";var ROn=Lh&&Lh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QS=Lh&&Lh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ROn(e,t,r)};Object.defineProperty(Lh,"__esModule",{value:!0});QS(t3t(),Lh);QS(r3t(),Lh);QS(n3t(),Lh);QS(o3t(),Lh);QS(i3t(),Lh);QS(a3t(),Lh);QS(s3t(),Lh);QS(u3t(),Lh);QS(l3t(),Lh);QS(c3t(),Lh);QS(d3t(),Lh);QS(f3t(),Lh)});var h3t=S(m3t=>{"use strict";Object.defineProperty(m3t,"__esModule",{value:!0})});var g3t=S(f2=>{"use strict";var IOn=f2&&f2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AOn=f2&&f2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&IOn(e,t,r)};Object.defineProperty(f2,"__esModule",{value:!0});AOn(h3t(),f2)});var D1=S(WO=>{"use strict";var NOn=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]}),nve=WO&&WO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&NOn(e,t,r)};Object.defineProperty(WO,"__esModule",{value:!0});nve(wUt(),WO);nve(YHt(),WO);nve(p3t(),WO);nve(g3t(),WO)});var q5e={};En(q5e,{__addDisposableResource:()=>L3t,__assign:()=>ove,__asyncDelegator:()=>M3t,__asyncGenerator:()=>P3t,__asyncValues:()=>R3t,__await:()=>G5,__awaiter:()=>S3t,__classPrivateFieldGet:()=>D3t,__classPrivateFieldIn:()=>$3t,__classPrivateFieldSet:()=>j3t,__createBinding:()=>ave,__decorate:()=>_3t,__disposeResources:()=>F3t,__esDecorate:()=>DOn,__exportStar:()=>x3t,__extends:()=>y3t,__generator:()=>C3t,__importDefault:()=>N3t,__importStar:()=>A3t,__makeTemplateObject:()=>I3t,__metadata:()=>w3t,__param:()=>v3t,__propKey:()=>$On,__read:()=>k5e,__rest:()=>b3t,__runInitializers:()=>jOn,__setFunctionName:()=>LOn,__spread:()=>T3t,__spreadArray:()=>E3t,__spreadArrays:()=>O3t,__values:()=>ive,default:()=>qOn});function y3t(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");F5e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function b3t(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 _3t(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 v3t(t,e){return function(r,n){e(r,n,t)}}function DOn(t,e,r,n,o,i){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,c=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var m={};for(var h in n)m[h]=h==="access"?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(g||null))};var y=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(c.get=d),(d=a(y.set))&&(c.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function jOn(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 $On(t){return typeof t=="symbol"?t:"".concat(t)}function LOn(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 w3t(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S3t(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 C3t(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 x3t(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ave(e,t,r)}function ive(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 k5e(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 T3t(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k5e(arguments[e]));return t}function O3t(){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 E3t(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 G5(t){return this instanceof G5?(this.v=t,this):new G5(t)}function P3t(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof G5?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 M3t(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:G5(t[o](a)),done:!1}:i?i(a):a}:i}}function R3t(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 ive=="function"?ive(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 I3t(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function A3t(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ave(e,t,r);return FOn(e,t),e}function N3t(t){return t&&t.__esModule?t:{default:t}}function D3t(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 j3t(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 $3t(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 L3t(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 F3t(t){function e(i){t.error=t.hasError?new kOn(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 F5e,ove,ave,FOn,kOn,qOn,U5e=v(()=>{F5e=function(t,e){return F5e=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])},F5e(t,e)};ove=function(){return ove=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},ove.apply(this,arguments)};ave=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};FOn=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};kOn=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};qOn={__extends:y3t,__assign:ove,__rest:b3t,__decorate:_3t,__param:v3t,__metadata:w3t,__awaiter:S3t,__generator:C3t,__createBinding:ave,__exportStar:x3t,__values:ive,__read:k5e,__spread:T3t,__spreadArrays:O3t,__spreadArray:E3t,__await:G5,__asyncGenerator:P3t,__asyncDelegator:M3t,__asyncValues:R3t,__makeTemplateObject:I3t,__importStar:A3t,__importDefault:N3t,__classPrivateFieldGet:D3t,__classPrivateFieldSet:j3t,__classPrivateFieldIn:$3t,__addDisposableResource:L3t,__disposeResources:F3t}});var B5e=S(e0=>{"use strict";Object.defineProperty(e0,"__esModule",{value:!0});e0.MAX_HASHABLE_LENGTH=e0.INIT=e0.KEY=e0.DIGEST_LENGTH=e0.BLOCK_SIZE=void 0;e0.BLOCK_SIZE=64;e0.DIGEST_LENGTH=32;e0.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]);e0.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];e0.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var k3t=S(sve=>{"use strict";Object.defineProperty(sve,"__esModule",{value:!0});sve.RawSha256=void 0;var t0=B5e(),UOn=function(){function t(){this.state=Int32Array.from(t0.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>t0.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===t0.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%t0.BLOCK_SIZE>=t0.BLOCK_SIZE-8){for(var o=this.bufferLength;o<t0.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<t0.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(t0.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(t0.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(t0.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<t0.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(r[f*4]&255)<<24|(r[f*4+1]&255)<<16|(r[f*4+2]&255)<<8|r[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var y=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(t0.KEY[f]+this.temp[f]|0)|0)|0,g=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&i^o&a^i&a)|0;d=c,c=l,l=u,u=s+y|0,s=a,a=i,i=o,o=y+g|0}n[0]+=o,n[1]+=i,n[2]+=a,n[3]+=s,n[4]+=u,n[5]+=l,n[6]+=c,n[7]+=d},t}();sve.RawSha256=UOn});var B3t=S((o8i,U3t)=>{var uve=Object.defineProperty,BOn=Object.getOwnPropertyDescriptor,zOn=Object.getOwnPropertyNames,VOn=Object.prototype.hasOwnProperty,HOn=(t,e)=>uve(t,"name",{value:e,configurable:!0}),WOn=(t,e)=>{for(var r in e)uve(t,r,{get:e[r],enumerable:!0})},JOn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zOn(e))!VOn.call(t,o)&&o!==r&&uve(t,o,{get:()=>e[o],enumerable:!(n=BOn(e,o))||n.enumerable});return t},KOn=t=>JOn(uve({},"__esModule",{value:!0}),t),q3t={};WOn(q3t,{isArrayBuffer:()=>GOn});U3t.exports=KOn(q3t);var GOn=HOn(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var W3t=S((i8i,H3t)=>{var lve=Object.defineProperty,XOn=Object.getOwnPropertyDescriptor,ZOn=Object.getOwnPropertyNames,YOn=Object.prototype.hasOwnProperty,z3t=(t,e)=>lve(t,"name",{value:e,configurable:!0}),QOn=(t,e)=>{for(var r in e)lve(t,r,{get:e[r],enumerable:!0})},eEn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ZOn(e))!YOn.call(t,o)&&o!==r&&lve(t,o,{get:()=>e[o],enumerable:!(n=XOn(e,o))||n.enumerable});return t},tEn=t=>eEn(lve({},"__esModule",{value:!0}),t),V3t={};QOn(V3t,{fromArrayBuffer:()=>nEn,fromString:()=>oEn});H3t.exports=tEn(V3t);var rEn=B3t(),z5e=zS(),nEn=z3t((t,e=0,r=t.byteLength-e)=>{if(!(0,rEn.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return z5e.Buffer.from(t,e,r)},"fromArrayBuffer"),oEn=z3t((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?z5e.Buffer.from(t,e):z5e.Buffer.from(t)},"fromString")});var Z3t=S((a8i,X3t)=>{var cve=Object.defineProperty,iEn=Object.getOwnPropertyDescriptor,aEn=Object.getOwnPropertyNames,sEn=Object.prototype.hasOwnProperty,V5e=(t,e)=>cve(t,"name",{value:e,configurable:!0}),uEn=(t,e)=>{for(var r in e)cve(t,r,{get:e[r],enumerable:!0})},lEn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of aEn(e))!sEn.call(t,o)&&o!==r&&cve(t,o,{get:()=>e[o],enumerable:!(n=iEn(e,o))||n.enumerable});return t},cEn=t=>lEn(cve({},"__esModule",{value:!0}),t),J3t={};uEn(J3t,{fromUtf8:()=>G3t,toUint8Array:()=>dEn,toUtf8:()=>fEn});X3t.exports=cEn(J3t);var K3t=W3t(),G3t=V5e(t=>{let e=(0,K3t.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),dEn=V5e(t=>typeof t=="string"?G3t(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),fEn=V5e(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,K3t.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var Y3t=S(dve=>{"use strict";Object.defineProperty(dve,"__esModule",{value:!0});dve.convertToBuffer=void 0;var pEn=Z3t(),mEn=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:pEn.fromUtf8;function hEn(t){return t instanceof Uint8Array?t:typeof t=="string"?mEn(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}dve.convertToBuffer=hEn});var Q3t=S(fve=>{"use strict";Object.defineProperty(fve,"__esModule",{value:!0});fve.isEmptyData=void 0;function gEn(t){return typeof t=="string"?t.length===0:t.byteLength===0}fve.isEmptyData=gEn});var eWt=S(pve=>{"use strict";Object.defineProperty(pve,"__esModule",{value:!0});pve.numToUint8=void 0;function yEn(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}pve.numToUint8=yEn});var tWt=S(mve=>{"use strict";Object.defineProperty(mve,"__esModule",{value:!0});mve.uint32ArrayFrom=void 0;function bEn(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)}mve.uint32ArrayFrom=bEn});var hve=S(JO=>{"use strict";Object.defineProperty(JO,"__esModule",{value:!0});JO.uint32ArrayFrom=JO.numToUint8=JO.isEmptyData=JO.convertToBuffer=void 0;var _En=Y3t();Object.defineProperty(JO,"convertToBuffer",{enumerable:!0,get:function(){return _En.convertToBuffer}});var vEn=Q3t();Object.defineProperty(JO,"isEmptyData",{enumerable:!0,get:function(){return vEn.isEmptyData}});var wEn=eWt();Object.defineProperty(JO,"numToUint8",{enumerable:!0,get:function(){return wEn.numToUint8}});var SEn=tWt();Object.defineProperty(JO,"uint32ArrayFrom",{enumerable:!0,get:function(){return SEn.uint32ArrayFrom}})});var nWt=S(bve=>{"use strict";Object.defineProperty(bve,"__esModule",{value:!0});bve.Sha256=void 0;var rWt=(U5e(),Bpe(q5e)),yve=B5e(),gve=k3t(),H5e=hve(),CEn=function(){function t(e){this.secret=e,this.hash=new gve.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,H5e.isEmptyData)(e)||this.error))try{this.hash.update((0,H5e.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 rWt.__awaiter(this,void 0,void 0,function(){return rWt.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new gve.RawSha256,this.secret){this.outer=new gve.RawSha256;var e=xEn(this.secret),r=new Uint8Array(yve.BLOCK_SIZE);r.set(e);for(var n=0;n<yve.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}();bve.Sha256=CEn;function xEn(t){var e=(0,H5e.convertToBuffer)(t);if(e.byteLength>yve.BLOCK_SIZE){var r=new gve.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(yve.BLOCK_SIZE);return n.set(e),n}});var J5e=S(W5e=>{"use strict";Object.defineProperty(W5e,"__esModule",{value:!0});var TEn=(U5e(),Bpe(q5e));TEn.__exportStar(nWt(),W5e)});var oWt=v(()=>{});var iWt=v(()=>{});var aWt=v(()=>{});var _ve,K5e=v(()=>{_ve=class t extends Error{constructor(r,n=!0){let o,i=!0;typeof n=="boolean"?(o=void 0,i=n):n!=null&&typeof n=="object"&&(o=n.logger,i=n.tryNextLink??!0);super(r);x(this,"name","ProviderError");x(this,"tryNextLink");this.tryNextLink=i,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${i?"->":"(!)"} ${r}`)}static from(r,n=!0){return Object.assign(new this(r.message,n),r)}}});var Lm,sWt=v(()=>{K5e();Lm=class t extends _ve{constructor(r,n=!0){super(r,n);x(this,"name","CredentialsProviderError");Object.setPrototypeOf(this,t.prototype)}}});var uWt=v(()=>{});var lWt=v(()=>{});var cWt=v(()=>{});var dWt,fWt=v(()=>{dWt=(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 QF=v(()=>{sWt();K5e();uWt();lWt();cWt();fWt()});function vve(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 G5e=v(()=>{});var pWt=v(()=>{});var mWt=v(()=>{pWt()});var X5=S(ju=>{"use strict";ju.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(ju.HttpAuthLocation||(ju.HttpAuthLocation={}));ju.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(ju.HttpApiKeyAuthLocation||(ju.HttpApiKeyAuthLocation={}));ju.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(ju.EndpointURLScheme||(ju.EndpointURLScheme={}));ju.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(ju.AlgorithmId||(ju.AlgorithmId={}));var OEn=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>ju.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>ju.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},EEn=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},PEn=t=>OEn(t),MEn=t=>EEn(t);ju.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(ju.FieldPosition||(ju.FieldPosition={}));var REn="__smithy_context";ju.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(ju.IniSectionType||(ju.IniSectionType={}));ju.RequestHandlerProtocol=void 0;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(ju.RequestHandlerProtocol||(ju.RequestHandlerProtocol={}));ju.SMITHY_CONTEXT_KEY=REn;ju.getDefaultClientConfiguration=PEn;ju.resolveDefaultRuntimeConfig=MEn});var hWt=v(()=>{});var gWt=v(()=>{});var yWt=v(()=>{});function IEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var wve,bWt=v(()=>{wve=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=IEn(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 _Wt=v(()=>{});var vWt=v(()=>{});var wWt=v(()=>{});var SWt=v(()=>{mWt();hWt();gWt();yWt();bWt();_Wt();vWt();wWt()});var AEn,NEn,Sve,X5e=v(()=>{SWt();AEn=t=>e=>async r=>{if(!wve.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)},NEn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Sve=t=>({applyToStack:e=>{e.add(AEn(t),NEn)}})});var DEn,jEn,Cve,CWt=v(()=>{DEn=()=>(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}},jEn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Cve=t=>({applyToStack:e=>{e.add(DEn(),jEn)}})});var Z5e=v(()=>{CWt()});var xWt,TWt=v(()=>{xWt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var OWt,Y5e=v(()=>{OWt=()=>t=>async e=>t(e)});var xve,EWt=v(()=>{TWt();Y5e();xve=t=>({applyToStack:e=>{e.add(OWt(),xWt)}})});var Q5e=v(()=>{EWt();Y5e()});var PWt=v(()=>{});var r0=S(eKe=>{"use strict";var MWt=X5(),$En=t=>t[MWt.SMITHY_CONTEXT_KEY]||(t[MWt.SMITHY_CONTEXT_KEY]={}),LEn=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};eKe.getSmithyContext=$En;eKe.normalizeProvider=LEn});var RWt,IWt=v(()=>{RWt=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let n of e)for(let o of t)o.schemeId.split("#")[1]===n&&r.push(o);for(let n of t)r.find(({schemeId:o})=>o===n.schemeId)||r.push(n);return r}});function FEn(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var AWt,NWt,tKe=v(()=>{AWt=$(r0());IWt();NWt=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=t.authSchemePreference?await t.authSchemePreference():[],s=RWt(i,a),u=FEn(t.httpAuthSchemes),l=(0,AWt.getSmithyContext)(n),c=[];for(let d of s){let f=u.get(d.schemeId);if(!f){c.push(`HttpAuthScheme \`${d.schemeId}\` was not enabled for this service.`);continue}let p=f.identityProvider(await e.identityProviderConfigProvider(t));if(!p){c.push(`HttpAuthScheme \`${d.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:m={},signingProperties:h={}}=d.propertiesExtractor?.(t,n)||{};d.identityProperties=Object.assign(d.identityProperties||{},m),d.signingProperties=Object.assign(d.signingProperties||{},h),l.selectedHttpAuthScheme={httpAuthOption:d,identity:await p(d.identityProperties),signer:f.signer};break}if(!l.selectedHttpAuthScheme)throw new Error(c.join(`
|
||
`));return r(o)}});var kEn,Tve,DWt=v(()=>{tKe();kEn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},Tve=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(NWt(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),kEn)}})});var jWt=v(()=>{});var $Wt=v(()=>{});var Ove,LWt=v(()=>{Ove={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var rKe=v(()=>{jWt();LWt();$Wt()});var PGi,FWt=v(()=>{rKe();PGi={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Ove.name}});var kWt=v(()=>{tKe();DWt();FWt()});var qWt=v(()=>{});var UWt=v(()=>{qWt()});var BWt=v(()=>{});var zWt=v(()=>{});var VWt=v(()=>{});function qEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var ek,HWt=v(()=>{ek=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=qEn(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 Z5,WWt=v(()=>{Z5=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 JWt=v(()=>{});var KWt=v(()=>{});var mne=v(()=>{UWt();BWt();zWt();VWt();HWt();WWt();JWt();KWt()});var GWt,UEn,BEn,XWt,nKe=v(()=>{mne();GWt=$(r0()),UEn=t=>e=>{throw e},BEn=(t,e)=>{},XWt=t=>(e,r)=>async n=>{if(!ek.isInstance(n.request))return e(n);let i=(0,GWt.getSmithyContext)(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||UEn)(a));return(u.successHandler||BEn)(l.response,a),l}});var zEn,Eve,ZWt=v(()=>{nKe();zEn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Eve=t=>({applyToStack:e=>{e.addRelativeTo(XWt(t),zEn)}})});var YWt=v(()=>{nKe();ZWt()});var j1,QWt=v(()=>{j1=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function oKe(t,e,r,n,o){return async function*(a,s,...u){let l=s,c=a.startingToken??l[r],d=!0,f;for(;d;){if(l[r]=c,o&&(l[o]=l[o]??a.pageSize),a.client instanceof t)f=await VEn(e,a.client,s,a.withCommand,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield f;let p=c;c=HEn(f,n),d=!!(c&&(!a.stopOnSameToken||c!==p))}return void 0}}var VEn,HEn,e6t=v(()=>{VEn=async(t,e,r,n=i=>i,...o)=>{let i=new t(r);return i=n(i)??i,await e.send(i,...o)};HEn=(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 t6t,iKe,r6t,tk,p2,n6t,aKe=v(()=>{t6t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",iKe=Object.entries(t6t).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),r6t=t6t.split(""),tk=6,p2=8,n6t=63});var Sw,o6t=v(()=>{aKe();Sw=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 iKe))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=iKe[t[l]]<<(c-l)*tk,a+=tk}else i>>=tk;let s=o/4*3;i>>=a%p2;let u=Math.floor(a/p2);for(let l=0;l<u;l++){let c=(u-l-1)*p2;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var i6t,a6t=v(()=>{i6t=t=>new TextEncoder().encode(t)});var s6t=v(()=>{});var u6t=v(()=>{});var l6t=v(()=>{a6t();s6t();u6t()});function Cw(t){let e;typeof t=="string"?e=i6t(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)*p2,s+=p2;let u=Math.ceil(s/tk);a<<=u*tk-s;for(let l=1;l<=u;l++){let c=(u-l)*tk;o+=r6t[(a&n6t<<c)>>c]}o+="==".slice(0,4-u)}return o}var c6t=v(()=>{l6t();aKe()});var KO=v(()=>{o6t();c6t()});var d6t,f6t=v(()=>{d6t=t=>new TextEncoder().encode(t)});var p6t=v(()=>{});var Pve,m6t=v(()=>{Pve=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 sKe=v(()=>{f6t();p6t();m6t()});var Y5,h6t=v(()=>{KO();sKe();Y5=class t extends Uint8Array{static fromString(e,r="utf-8"){if(typeof e=="string")return r==="base64"?t.mutate(Sw(e)):t.mutate(d6t(e));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 e==="base64"?Cw(this):Pve(this)}}});var g6t=v(()=>{});var uKe,y6t=v(()=>{uKe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var b6t=v(()=>{});var _6t=v(()=>{});var v6t=v(()=>{});var w6t=v(()=>{});var S6t=v(()=>{});var C6t=v(()=>{S6t()});var x6t=v(()=>{});var T6t=v(()=>{});var O6t=v(()=>{});var E6t=v(()=>{});var hne,P6t=v(()=>{hne=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 M6t=v(()=>{});var R6t=v(()=>{});var I6t=v(()=>{C6t();x6t();T6t();O6t();E6t();P6t();M6t();R6t()});var gne=S(lKe=>{"use strict";var A6t=t=>encodeURIComponent(t).replace(/[!'()*]/g,WEn),WEn=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,JEn=t=>t.split("/").map(A6t).join("/");lKe.escapeUri=A6t;lKe.escapeUriPath=JEn});function N6t(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=(0,Mve.escapeUri)(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${(0,Mve.escapeUri)(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${(0,Mve.escapeUri)(n)}`),e.push(o)}}return e.join("&")}var Mve,D6t=v(()=>{Mve=$(gne())});function cKe(t,e){return new Request(t,e)}var j6t=v(()=>{});function $6t(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 L6t=v(()=>{});var dKe,rk,F6t=v(()=>{I6t();D6t();j6t();L6t();dKe={supported:void 0},rk=class t{constructor(e){x(this,"config");x(this,"configProvider");typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),dKe.supported===void 0&&(dKe.supported=typeof Request<"u"&&"keepalive"in cKe("https://[::1]"))}static create(e){return typeof e?.handle=="function"?e:new t(e)}destroy(){}async handle(e,{abortSignal:r,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);let o=n??this.config.requestTimeout,i=this.config.keepAlive===!0,a=this.config.credentials;if(r?.aborted){let b=new Error("Request aborted");return b.name="AbortError",Promise.reject(b)}let s=e.path,u=N6t(e.query||{});u&&(s+=`?${u}`),e.fragment&&(s+=`#${e.fragment}`);let l="";if(e.username!=null||e.password!=null){let b=e.username??"",_=e.password??"";l=`${b}:${_}@`}let{port:c,method:d}=e,f=`${e.protocol}//${l}${e.hostname}${c?`:${c}`:""}${s}`,p=d==="GET"||d==="HEAD"?void 0:e.body,m={body:p,headers:new Headers(e.headers),method:d,credentials:a};this.config?.cache&&(m.cache=this.config.cache),p&&(m.duplex="half"),typeof AbortController<"u"&&(m.signal=r),dKe.supported&&(m.keepalive=i),typeof this.config.requestInit=="function"&&Object.assign(m,this.config.requestInit(e));let h=()=>{},y=cKe(f,m),g=[fetch(y).then(b=>{let _=b.headers,w={};for(let O of _.entries())w[O[0]]=O[1];return b.body!=null?{response:new hne({headers:w,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(O=>({response:new hne({headers:w,reason:b.statusText,statusCode:b.status,body:O})}))}),$6t(o)];return r&&g.push(new Promise((b,_)=>{let w=()=>{let T=new Error("Request aborted");T.name="AbortError",_(T)};if(typeof r.addEventListener=="function"){let T=r;T.addEventListener("abort",w,{once:!0}),h=()=>T.removeEventListener("abort",w)}else r.onabort=w})),Promise.race(g).finally(h)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function KEn(t){let e=await XEn(t),r=Sw(e);return new Uint8Array(r)}async function GEn(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 XEn(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 Q5,k6t=v(()=>{KO();Q5=async t=>typeof Blob=="function"&&t instanceof Blob||t.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):KEn(t):GEn(t)});var yne=v(()=>{F6t();k6t()});function U6t(t){let e="";for(let r=0;r<t.byteLength;r++)e+=q6t[t[r]];return e}var q6t,ZEn,B6t=v(()=>{q6t={},ZEn={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),q6t[t]=e,ZEn[e]=t}});var z6t,H6t,V6t,W6t=v(()=>{yne();KO();B6t();sKe();y6t();z6t="The stream has already been transformed.",H6t=t=>{if(!V6t(t)&&!uKe(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(z6t);return e=!0,await Q5(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 Cw(i);if(o==="hex")return U6t(i);if(o===void 0||o==="utf8"||o==="utf-8")return Pve(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(z6t);if(e=!0,V6t(t))return n(t);if(uKe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},V6t=t=>typeof Blob=="function"&&t instanceof Blob});var J6t=v(()=>{});var fKe=v(()=>{h6t();g6t();b6t();_6t();v6t();w6t();W6t();J6t()});var $1,pKe=v(()=>{fKe();$1=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return Y5.mutate(t);if(!t)return Y5.mutate(new Uint8Array);let r=e.streamCollector(t);return Y5.mutate(await r)}});function mKe(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var K6t=v(()=>{});var nk,hKe=v(()=>{nk=t=>typeof t=="function"?t():t});var Rve,Ive=v(()=>{Rve=(t,e,r,n,o)=>({name:e,namespace:t,traits:r,input:n,output:o})});var G6t,X6t,gKe,Z6t=v(()=>{mne();G6t=$(r0());Ive();X6t=t=>(e,r)=>async n=>{let{response:o}=await e(n),{operationSchema:i}=(0,G6t.getSmithyContext)(r),[,a,s,u,l,c]=i??[];try{let d=await t.protocol.deserializeResponse(Rve(a,s,u,l,c),{...t,...r},o);return{response:o,output:d}}catch(d){if(Object.defineProperty(d,"$response",{value:o,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in d)){let f="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{d.message+=`
|
||
`+f}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(f):r.logger?.warn?.(f)}typeof d.$responseBodyText<"u"&&d.$response&&(d.$response.body=d.$responseBodyText);try{if(Z5.isInstance(o)){let{headers:p={}}=o,m=Object.entries(p);d.$metadata={httpStatusCode:o.statusCode,requestId:gKe(/^x-[\w-]+-request-?id$/,m),extendedRequestId:gKe(/^x-[\w-]+-id-2$/,m),cfId:gKe(/^x-[\w-]+-cf-id$/,m)}}}catch{}}throw d}},gKe=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var Y6t,Q6t,eJt=v(()=>{Y6t=$(r0());Ive();Q6t=t=>(e,r)=>async n=>{let{operationSchema:o}=(0,Y6t.getSmithyContext)(r),[,i,a,s,u,l]=o??[],c=r.endpointV2?.url&&t.urlParser?async()=>t.urlParser(r.endpointV2.url):t.endpoint,d=await t.protocol.serializeRequest(Rve(i,a,s,u,l),n.input,{...t,...r,endpoint:c});return e({...n,request:d})}});function Ave(t){return{applyToStack:e=>{e.add(Q6t(t),QEn),e.add(X6t(t),YEn),t.protocol.setSerdeContext(t)}}}var YEn,QEn,tJt=v(()=>{Z6t();eJt();YEn={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},QEn={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var n0,m2=v(()=>{n0=class{constructor(){x(this,"name");x(this,"namespace");x(this,"traits")}static assign(e,r){return Object.assign(e,r)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}getName(){return this.namespace+"#"+this.name}}});var Nve,rJt,nJt=v(()=>{m2();Nve=class Nve extends n0{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"valueSchema");x(this,"symbol",Nve.symbol)}};x(Nve,"symbol",Symbol.for("@smithy/lis"));rJt=Nve});var Dve,oJt,iJt=v(()=>{m2();Dve=class Dve extends n0{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"keySchema");x(this,"valueSchema");x(this,"symbol",Dve.symbol)}};x(Dve,"symbol",Symbol.for("@smithy/map"));oJt=Dve});var jve,aJt,sJt=v(()=>{m2();jve=class jve extends n0{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"input");x(this,"output");x(this,"symbol",jve.symbol)}};x(jve,"symbol",Symbol.for("@smithy/ope"));aJt=jve});var Lve,$ve,yKe=v(()=>{m2();Lve=class Lve extends n0{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"memberNames");x(this,"memberList");x(this,"symbol",Lve.symbol)}};x(Lve,"symbol",Symbol.for("@smithy/str"));$ve=Lve});var Fve,uJt,lJt=v(()=>{yKe();Fve=class Fve extends $ve{constructor(){super(...arguments);x(this,"ctor");x(this,"symbol",Fve.symbol)}};x(Fve,"symbol",Symbol.for("@smithy/err"));uJt=Fve});function h2(t){if(typeof t=="object")return t;t=t|0;let e={},r=0;for(let n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[n]=1);return e}var bKe=v(()=>{});function bne(t,e){if(t instanceof na)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=na;return new r(t,e)}var ok,na,_Ke,ePn,cJt=v(()=>{hKe();bKe();ok=class ok{constructor(e,r){x(this,"ref");x(this,"memberName");x(this,"symbol",ok.symbol);x(this,"name");x(this,"schema");x(this,"_isMemberSchema");x(this,"traits");x(this,"memberTraits");x(this,"normalizedTraits");this.ref=e,this.memberName=r;let n=[],o=e,i=e;for(this._isMemberSchema=!1;_Ke(o);)n.push(o[1]),o=o[0],i=nk(o),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let a=n.length-1;a>=0;--a){let s=n[a];Object.assign(this.memberTraits,h2(s))}}else this.memberTraits=0;if(i instanceof ok){let a=this.memberTraits;Object.assign(this,i),this.memberTraits=Object.assign({},a,i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??i.memberName;return}if(this.schema=nk(i),ePn(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(i),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=nk(e);if(r instanceof ok)return r;if(_Ke(r)){let[n,o]=r;if(n instanceof ok)return Object.assign(n.getMergedTraits(),h2(o)),n;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new ok(r)}getSchema(){let e=this.schema;return e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let r=this.getSchema()[0];return r===3||r===-3||r===4}isUnionSchema(){return this.getSchema()[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){let e=i=>(i&4)===4||!!i?.idempotencyToken,{normalizedTraits:r,traits:n,memberTraits:o}=this;return e(r)||e(n)||e(o)}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return h2(this.memberTraits)}getOwnTraits(){return h2(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let n=this.getSchema(),o=e?15:n[4]??0;return bne([o,0],"key")}getValueSchema(){let e=this.getSchema(),[r,n,o]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],i=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||o)?e[3+e[0]]:r?15:void 0;if(i!=null)return bne([i,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let n=r[4].indexOf(e),o=r[5][n];return bne(_Ke(o)?o:[o,0],e)}if(this.isDocumentSchema())return bne([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,n]of this.structIterator())e[r]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema();for(let r=0;r<e[4].length;++r)yield[e[4][r],bne([e[5][r],0],e[4][r])]}};x(ok,"symbol",Symbol.for("@smithy/nor"));na=ok;_Ke=t=>Array.isArray(t)&&t.length===2,ePn=t=>Array.isArray(t)&&t.length>=5});var kve,dJt,fJt=v(()=>{m2();kve=class kve extends n0{constructor(){super(...arguments);x(this,"name");x(this,"schemaRef");x(this,"traits");x(this,"symbol",kve.symbol)}};x(kve,"symbol",Symbol.for("@smithy/sim"));dJt=kve});var pJt=v(()=>{});var GO,Vs,mJt=v(()=>{GO=class GO{constructor(e,r=new Map,n=new Map){x(this,"namespace");x(this,"schemas");x(this,"exceptions");this.namespace=e,this.schemas=r,this.exceptions=n}static for(e){return GO.registries.has(e)||GO.registries.set(e,new GO(e)),GO.registries.get(e)}register(e,r){let n=this.normalizeShapeId(e);GO.for(n.split("#")[0]).schemas.set(n,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r))throw new Error(`@smithy/core/schema - schema not found for ${r}`);return this.schemas.get(r)}registerError(e,r){let n=e,o=GO.for(n[1]);o.schemas.set(n[1]+"#"+n[2],n),o.exceptions.set(n,r)}getErrorCtor(e){let r=e;return GO.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,n]=e,o=r+"#"+n;if(o.startsWith("smithy.ts.sdk.synthetic.")&&o.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};x(GO,"registries",new Map);Vs=GO});var kg=v(()=>{hKe();tJt();nJt();iJt();sJt();Ive();lJt();cJt();m2();fJt();yKe();pJt();bKe();mJt()});var hJt=v(()=>{});var vKe,tPn,gJt,rPn,yJt,bJt,_Jt,nPn,vJt,wJt,oPn,qve,eK,SJt,iPn,aPn,wKe=v(()=>{vKe=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&aPn.warn(iPn(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},tPn=Math.ceil(34028234663852886e22),gJt=t=>{let e=vKe(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>tPn)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},rPn=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},yJt=t=>_Jt(t,16),bJt=t=>_Jt(t,8),_Jt=(t,e)=>{let r=rPn(t);if(r!==void 0&&nPn(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},nPn=(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]}},vJt=t=>vKe(typeof t=="string"?qve(t):t),wJt=t=>gJt(typeof t=="string"?qve(t):t),oPn=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,qve=t=>{let e=t.match(oPn);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},eK=t=>yJt(typeof t=="string"?qve(t):t),SJt=t=>bJt(typeof t=="string"?qve(t):t),iPn=t=>String(new TypeError(t).stack||t).split(`
|
||
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
|
||
`),aPn={warn:console.warn}});function Uve(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),n=t.getUTCDay(),o=t.getUTCDate(),i=t.getUTCHours(),a=t.getUTCMinutes(),s=t.getUTCSeconds(),u=o<10?`0${o}`:`${o}`,l=i<10?`0${i}`:`${i}`,c=a<10?`0${a}`:`${a}`,d=s<10?`0${s}`:`${s}`;return`${sPn[n]}, ${u} ${CKe[r]} ${e} ${l}:${c}:${d} GMT`}var sPn,CKe,uPn,CJt,lPn,xJt,cPn,dPn,fPn,TJt,OJt,_ne,pPn,mPn,hPn,SKe,gPn,yPn,bPn,XO,_Pn,vPn,tK,EJt=v(()=>{wKe();sPn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],CKe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];uPn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),CJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=uPn.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=eK(tK(n)),d=XO(o,"month",1,12),f=XO(i,"day",1,31);return _ne(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},lPn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),xJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=lPn.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=eK(tK(n)),f=XO(o,"month",1,12),p=XO(i,"day",1,31),m=_ne(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-vPn(c)),m},cPn=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$/),dPn=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$/),fPn=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})$/),TJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=cPn.exec(t);if(e){let[r,n,o,i,a,s,u,l]=e;return _ne(eK(tK(i)),SKe(o),XO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})}if(e=dPn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return hPn(_ne(pPn(i),SKe(o),XO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l}))}if(e=fPn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return _ne(eK(tK(l)),SKe(n),XO(o.trimLeft(),"day",1,31),{hours:i,minutes:a,seconds:s,fractionalMilliseconds:u})}throw new TypeError("Invalid RFC-7231 date-time value")},OJt=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=vJt(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))},_ne=(t,e,r,n)=>{let o=e-1;return yPn(t,o,r),new Date(Date.UTC(t,o,r,XO(n.hours,"hour",0,23),XO(n.minutes,"minute",0,59),XO(n.seconds,"seconds",0,60),_Pn(n.fractionalMilliseconds)))},pPn=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+eK(tK(t));return r<e?r+100:r},mPn=50*365*24*60*60*1e3,hPn=t=>t.getTime()-new Date().getTime()>mPn?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,SKe=t=>{let e=CKe.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},gPn=[31,28,31,30,31,30,31,31,30,31,30,31],yPn=(t,e,r)=>{let n=gPn[e];if(e===1&&bPn(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${CKe[e]} in ${t}: ${r}`)},bPn=t=>t%4===0&&(t%100!==0||t%400===0),XO=(t,e,r,n)=>{let o=SJt(tK(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},_Pn=t=>t==null?0:wJt("0."+t)*1e3,vPn=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},tK=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var xKe,PJt=v(()=>{xKe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)});var Hy,g2,MJt=v(()=>{PJt();Hy=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),g2=()=>{if(xKe)return xKe();let t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,Hy[t[0]]+Hy[t[1]]+Hy[t[2]]+Hy[t[3]]+"-"+Hy[t[4]]+Hy[t[5]]+"-"+Hy[t[6]]+Hy[t[7]]+"-"+Hy[t[8]]+Hy[t[9]]+"-"+Hy[t[10]]+Hy[t[11]]+Hy[t[12]]+Hy[t[13]]+Hy[t[14]]+Hy[t[15]]}});var TKe=v(()=>{MJt()});var RJt=v(()=>{TKe()});var o0,IJt=v(()=>{o0=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};o0.from=t=>t&&typeof t=="object"&&(t instanceof o0||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?o0(String(t)):o0(JSON.stringify(t));o0.fromObject=o0.from});var AJt=v(()=>{});function L1(t,e,r){let n=Number(t);if(n<e||n>r)throw new Error(`Value ${n} out of range [${e}, ${r}]`)}var OKe,EKe,PKe,NJt,DJt,wPn,SPn,CPn,xPn,TPn,jJt,$Jt,LJt,FJt=v(()=>{OKe="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",EKe="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",PKe="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",NJt="(\\d?\\d)",DJt="(\\d{4})",wPn=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),SPn=new RegExp(`^${OKe}, ${NJt} ${EKe} ${DJt} ${PKe} GMT$`),CPn=new RegExp(`^${OKe}, ${NJt}-${EKe}-(\\d\\d) ${PKe} GMT$`),xPn=new RegExp(`^${OKe} ${EKe} ( [1-9]|\\d\\d) ${PKe} ${DJt}$`),TPn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],jJt=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},$Jt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=wPn.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,n,o,i,a,s,,u,l]=e;L1(n,1,12),L1(o,1,31),L1(i,0,23),L1(a,0,59),L1(s,0,60);let c=new Date(Date.UTC(Number(r),Number(n)-1,Number(o),Number(i),Number(a),Number(s),Number(u)?Math.round(parseFloat(`0.${u}`)*1e3):0));if(c.setUTCFullYear(Number(r)),l.toUpperCase()!="Z"){let[,d,f,p]=/([+-])(\d\d):(\d\d)/.exec(l)||[void 0,"+",0,0],m=d==="-"?1:-1;c.setTime(c.getTime()+m*(Number(f)*60*60*1e3+Number(p)*60*1e3))}return c},LJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,n,o,i,a,s,u;if((u=SPn.exec(t))?[,e,r,n,o,i,a,s]=u:(u=CPn.exec(t))?([,e,r,n,o,i,a,s]=u,n=(Number(n)+1900).toString()):(u=xPn.exec(t))&&([,r,e,o,i,a,s,n]=u),n&&a){let l=Date.UTC(Number(n),TPn.indexOf(r),Number(e),Number(o),Number(i),Number(a),s?Math.round(parseFloat(`0.${s}`)*1e3):0);L1(e,1,31),L1(o,0,23),L1(i,0,59),L1(a,0,60);let c=new Date(l);return c.setUTCFullYear(Number(n)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});var kJt=v(()=>{});var qJt,UJt=v(()=>{qJt=t=>{let e=t.length,r=[],n=!1,o,i=0;for(let a=0;a<e;++a){let s=t[a];switch(s){case'"':o!=="\\"&&(n=!n);break;case",":n||(r.push(t.slice(i,a)),i=a+1);break;default:}o=s}return r.push(t.slice(i)),r.map(a=>{a=a.trim();let s=a.length;return s<2?a:(a[0]==='"'&&a[s-1]==='"'&&(a=a.slice(1,s-1)),a.replace(/\\"/g,'"'))})}});var BJt,Fh,zJt=v(()=>{BJt=/^-?\d*(\.\d+)?$/,Fh=class t{constructor(e,r){x(this,"string");x(this,"type");if(this.string=e,this.type=r,!BJt.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&BJt.test(r.string)}}});var ik=v(()=>{hJt();EJt();RJt();IJt();wKe();AJt();FJt();kJt();UJt();zJt()});var rK,Bve=v(()=>{rK=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});var VJt,HJt=v(()=>{VJt=t=>new TextEncoder().encode(t)});var WJt=v(()=>{});var zve,JJt=v(()=>{zve=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 MKe=v(()=>{HJt();WJt();JJt()});var RKe,KJt=v(()=>{MKe();RKe=class{constructor({marshaller:e,serializer:r,deserializer:n,serdeContext:o,defaultContentType:i}){x(this,"marshaller");x(this,"serializer");x(this,"deserializer");x(this,"serdeContext");x(this,"defaultContentType");this.marshaller=e,this.serializer=r,this.deserializer=n,this.serdeContext=o,this.defaultContentType=i}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){let o=this.marshaller,i=r.getEventStreamMember(),a=r.getMemberSchema(i),s=this.serializer,u=this.defaultContentType,l=Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(n){let d={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:u}};s.write(r,n);let f=s.flush();yield{[l]:!0,headers:d,body:f}}for await(let d of e)yield d}};return o.serialize(c,d=>{if(d[l])return{headers:d.headers,body:d.body};let f=Object.keys(d).find(b=>b!=="__type")??"",{additionalHeaders:p,body:m,eventType:h,explicitPayloadContentType:y}=this.writeEventBody(f,a,d);return{headers:{":event-type":{type:"string",value:h},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:y??u},...p},body:m}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){let o=this.marshaller,i=r.getEventStreamMember(),s=r.getMemberSchema(i).getMemberSchemas(),u=Symbol("initialResponseMarker"),l=o.deserialize(e.body,async f=>{let p=Object.keys(f).find(h=>h!=="__type")??"",m=f[p].body;if(p==="initial-response"){let h=await this.deserializer.read(r,m);return delete h[i],{[u]:!0,...h}}else if(p in s){let h=s[p];if(h.isStructSchema()){let y={},g=!1;for(let[b,_]of h.structIterator()){let{eventHeader:w,eventPayload:T}=_.getMergedTraits();if(g=g||!!(w||T),T)_.isBlobSchema()?y[b]=m:_.isStringSchema()?y[b]=(this.serdeContext?.utf8Encoder??zve)(m):_.isStructSchema()&&(y[b]=await this.deserializer.read(_,m));else if(w){let O=f[p].headers[b]?.value;O!=null&&(_.isNumericSchema()?O&&typeof O=="object"&&"bytes"in O?y[b]=BigInt(O.toString()):y[b]=Number(O):y[b]=O)}}if(g)return{[p]:y}}return{[p]:await this.deserializer.read(h,m)}}else return{$unknown:f}}),c=l[Symbol.asyncIterator](),d=await c.next();if(d.done)return l;if(d.value?.[u]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let[f,p]of Object.entries(d.value))n[f]=p}return{async*[Symbol.asyncIterator](){for(d?.value?.[u]||(yield d.value);;){let{done:f,value:p}=await c.next();if(f)break;yield p}}}}writeEventBody(e,r,n){let o=this.serializer,i=e,a=null,s,u=r.getSchema()[4].includes(e),l={};if(u){let f=r.getMemberSchema(e);if(f.isStructSchema()){for(let[p,m]of f.structIterator()){let{eventHeader:h,eventPayload:y}=m.getMergedTraits();if(y)a=p;else if(h){let g=n[e][p],b="binary";m.isNumericSchema()?(-2)**31<=g&&g<=2**31-1?b="integer":b="long":m.isTimestampSchema()?b="timestamp":m.isStringSchema()?b="string":m.isBooleanSchema()&&(b="boolean"),g!=null&&(l[p]={type:b,value:g},delete n[e][p])}}if(a!==null){let p=f.getMemberSchema(a);p.isBlobSchema()?s="application/octet-stream":p.isStringSchema()&&(s="text/plain"),o.write(p,n[e][a])}else o.write(f,n[e])}else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[f,p]=n[e];i=f,o.write(15,p)}let c=o.flush();return{body:typeof c=="string"?(this.serdeContext?.utf8Decoder??VJt)(c):c,eventType:i,explicitPayloadContentType:s,additionalHeaders:l}}}});var GJt={};En(GJt,{EventStreamSerde:()=>RKe});var XJt=v(()=>{KJt()});var Vve,IKe=v(()=>{kg();mne();Bve();Vve=class extends rK{constructor(r){super();x(this,"options");this.options=r}getRequestType(){return ek}getResponseType(){return Z5}setSerdeContext(r){this.serdeContext=r,this.serializer.setSerdeContext(r),this.deserializer.setSerdeContext(r),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(r)}updateServiceEndpoint(r,n){if("url"in n){r.protocol=n.url.protocol,r.hostname=n.url.hostname,r.port=n.url.port?Number(n.url.port):void 0,r.path=n.url.pathname,r.fragment=n.url.hash||void 0,r.username=n.url.username||void 0,r.password=n.url.password||void 0,r.query||(r.query={});for(let[o,i]of n.url.searchParams.entries())r.query[o]=i;return r}else return r.protocol=n.protocol,r.hostname=n.hostname,r.port=n.port?Number(n.port):void 0,r.path=n.path,r.query={...n.query},r}setHostPrefix(r,n,o){if(this.serdeContext?.disableHostPrefix)return;let i=na.of(n.input),a=h2(n.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){let u=[...i.structIterator()].filter(([,l])=>l.getMergedTraits().hostLabel);for(let[l]of u){let c=o[l];if(typeof c!="string")throw new Error(`@smithy/core/schema - ${l} in input must be a string as hostLabel.`);s=s.replace(`{${l}}`,c)}r.hostname=s+r.hostname}}}deserializeMetadata(r){return{httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:r,requestSchema:n,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:r,requestSchema:n,initialRequest:o})}async deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:r,responseSchema:n,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:r}=await Promise.resolve().then(()=>(XJt(),GJt));return new r({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(r,n,o,i,a){return[]}getEventStreamMarshaller(){let r=this.serdeContext;if(!r.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return r.eventStreamMarshaller}}});var ZJt=v(()=>{});var nK,YJt=v(()=>{kg();mne();pKe();IKe();nK=class extends Vve{async serializeRequest(e,r,n){let o=this.serializer,i={},a={},s=await n.endpoint(),u=na.of(e?.input),l=u.getSchema(),c,d=new ek({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:a,body:void 0});s&&(this.updateServiceEndpoint(d,s),this.setHostPrefix(d,e,r));let f={...r};if(r){let p=u.getEventStreamMember();if(p){if(f[p]){let m={};for(let[h,y]of u.structIterator())h!==p&&f[h]&&(o.write(y,f[h]),m[h]=o.flush());c=await this.serializeEventStream({eventStream:f[p],requestSchema:u,initialRequest:m})}}else o.write(l,f),c=o.flush()}return d.headers=a,d.query=i,d.body=c,d.method="POST",d}async deserializeResponse(e,r,n){let o=this.deserializer,i=na.of(e.output),a={};if(n.statusCode>=300){let u=await $1(n.body,r);throw u.byteLength>0&&Object.assign(a,await o.read(15,u)),await this.handleError(e,r,n,a,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let u in n.headers){let l=n.headers[u];delete n.headers[u],n.headers[u.toLowerCase()]=l}let s=i.getEventStreamMember();if(s)a[s]=await this.deserializeEventStream({response:n,responseSchema:i,initialResponseContainer:a});else{let u=await $1(n.body,r);u.byteLength>0&&Object.assign(a,await o.read(i,u))}return a.$metadata=this.deserializeMetadata(n),a}}});var QJt=v(()=>{});var e5t=v(()=>{});function ak(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:n,httpHeader:o,httpQuery:i}=t.getMergedTraits();return(e.httpBindings?typeof n=="string"||o?6:i||r?5:void 0:void 0)??e.timestampFormat.default}var AKe=v(()=>{});var Hve,t5t=v(()=>{kg();ik();KO();MKe();Bve();AKe();Hve=class extends rK{constructor(r){super();x(this,"settings");this.settings=r}read(r,n){let o=na.of(r);if(o.isListSchema())return qJt(n).map(i=>this.read(o.getValueSchema(),i));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??Sw)(n);if(o.isTimestampSchema())switch(ak(o,this.settings)){case 5:return $Jt(n);case 6:return LJt(n);case 7:return jJt(n);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",n),new Date(n)}if(o.isStringSchema()){let i=o.getMergedTraits().mediaType,a=n;if(i)return o.getMergedTraits().httpHeader&&(a=this.base64ToUtf8(a)),(i==="application/json"||i.endsWith("+json"))&&(a=o0.from(a)),a}return o.isNumericSchema()?Number(n):o.isBigIntegerSchema()?BigInt(n):o.isBigDecimalSchema()?new Fh(n,"bigDecimal"):o.isBooleanSchema()?String(n).toLowerCase()==="true":n}base64ToUtf8(r){return(this.serdeContext?.utf8Encoder??zve)((this.serdeContext?.base64Decoder??Sw)(r))}}});var r5t=v(()=>{});var n5t=v(()=>{});var o5t=v(()=>{});var sk=v(()=>{pKe();K6t();ZJt();IKe();YJt();e5t();QJt();t5t();r5t();o5t();n5t();AKe();Bve()});var i5t=v(()=>{});function a5t(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var s5t=v(()=>{});var oK,u5t=v(()=>{oK=class{constructor(e){x(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 l5t=v(()=>{});var c5t=v(()=>{});var iK,d5t=v(()=>{iK=class{async sign(e,r,n){return e}}});var f5t=v(()=>{l5t();c5t();d5t()});var OPn,p5t,NKe,m5t,h5t=v(()=>{OPn=t=>function(r){return NKe(r)&&r.expiration.getTime()-Date.now()<t},p5t=OPn(3e5),NKe=t=>t.expiration!==void 0,m5t=(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 g5t=v(()=>{u5t();f5t();h5t()});var ZO=v(()=>{PWt();kWt();YWt();QWt();e6t();i5t();s5t();g5t()});function PPn(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function Wve(t){let e=j1(t.userAgentAppId??EPn),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let n=await e();if(!PPn(n)){let o=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof n!="string"?o?.warn("userAgentAppId must be a string or undefined."):n.length>50&&o?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}var EPn,y5t=v(()=>{ZO();EPn=void 0});var aK,b5t=v(()=>{aK=class{constructor({size:e,params:r}){x(this,"capacity");x(this,"data",new Map);x(this,"parameters",[]);this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let n=this.hash(e);if(n===!1)return r();if(!this.data.has(n)){if(this.data.size>this.capacity+10){let o=this.data.keys(),i=0;for(;;){let{value:a,done:s}=o.next();if(this.data.delete(a),s||++i>10)break}}this.data.set(n,r())}return this.data.get(n)}size(){return this.data.size}hash(e){let r="",{parameters:n}=this;if(n.length===0)return!1;for(let o of n){let i=String(e[o]??"");if(i.includes("|;"))return!1;r+=i+"|;"}return r}}});var MPn,vne,DKe=v(()=>{MPn=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}$"),vne=t=>MPn.test(t)||t.startsWith("[")&&t.endsWith("]")});var RPn,y2,jKe=v(()=>{RPn=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),y2=(t,e=!1)=>{if(!e)return RPn.test(t);let r=t.split(".");for(let n of r)if(!y2(n))return!1;return!0}});var F1,Jve=v(()=>{F1={}});var k1,_5t=v(()=>{k1="endpoints"});function i0(t){return typeof t!="object"||t==null?t:"ref"in t?`$${i0(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(i0).join(", ")})`:JSON.stringify(t,null,2)}var v5t=v(()=>{});var wne=v(()=>{_5t();v5t()});var wl,w5t=v(()=>{wl=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var S5t=v(()=>{});var C5t=v(()=>{});var x5t=v(()=>{});var T5t=v(()=>{});var O5t=v(()=>{});var E5t=v(()=>{});var a0=v(()=>{w5t();S5t();C5t();x5t();T5t();O5t();E5t()});var P5t,M5t=v(()=>{P5t=(t,e)=>t===e});var R5t,I5t=v(()=>{a0();R5t=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 wl(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new wl(`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 Kve,A5t=v(()=>{a0();I5t();Kve=(t,e)=>R5t(e).reduce((r,n)=>{if(typeof r!="object")throw new wl(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var N5t,D5t=v(()=>{N5t=t=>t!=null});var j5t,$5t=v(()=>{j5t=t=>!t});var Gve,$Ke,L5t,F5t=v(()=>{Gve=$(X5());DKe();$Ke={[Gve.EndpointURLScheme.HTTP]:80,[Gve.EndpointURLScheme.HTTPS]:443},L5t=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:f,port:p,protocol:m="",path:h="",query:y={}}=t,g=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return g.search=Object.entries(y).map(([b,_])=>`${b}=${_}`).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(Gve.EndpointURLScheme).includes(u))return null;let l=vne(o),c=r.includes(`${n}:${$Ke[u]}`)||typeof t=="string"&&t.includes(`${n}:${$Ke[u]}`),d=`${n}${c?`:${$Ke[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var k5t,q5t=v(()=>{k5t=(t,e)=>t===e});var U5t,B5t=v(()=>{U5t=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var z5t,V5t=v(()=>{z5t=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var LKe=v(()=>{M5t();A5t();D5t();jKe();$5t();F5t();q5t();B5t();V5t()});var H5t,W5t=v(()=>{LKe();H5t={booleanEquals:P5t,getAttr:Kve,isSet:N5t,isValidHostLabel:y2,not:j5t,parseURL:L5t,stringEquals:k5t,substring:U5t,uriEncode:z5t}});var Xve,FKe=v(()=>{LKe();Xve=(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(Kve(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var J5t,K5t=v(()=>{J5t=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var b2,Zve,G5t,Sne=v(()=>{a0();Jve();W5t();FKe();K5t();b2=(t,e,r)=>{if(typeof t=="string")return Xve(t,r);if(t.fn)return G5t.callFunction(t,r);if(t.ref)return J5t(t,r);throw new wl(`'${e}': ${String(t)} is not a string, function or reference.`)},Zve=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:G5t.evaluateExpression(i,"arg",r)),o=t.split(".");return o[0]in F1&&o[1]!=null?F1[o[0]][o[1]](...n):H5t[t](...n)},G5t={evaluateExpression:b2,callFunction:Zve}});var X5t=v(()=>{Sne()});var Z5t,Y5t=v(()=>{wne();a0();X5t();Z5t=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new wl(`'${t}' is already defined in Reference Record.`);let n=Zve(e,r);return r.logger?.debug?.(`${k1} evaluateCondition: ${i0(e)} = ${i0(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var sK,Yve=v(()=>{wne();Y5t();sK=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=Z5t(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${k1} assign: ${i.name} := ${i0(i.value)}`))}return{result:!0,referenceRecord:r}}});var Q5t,eKt=v(()=>{a0();Sne();Q5t=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=b2(i,"Header value entry",e);if(typeof a!="string")throw new wl(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var kKe,tKt,rKt,nKt=v(()=>{a0();FKe();kKe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:rKt.getEndpointProperty(o,e)}),{}),tKt=(t,e)=>{if(Array.isArray(t))return t.map(r=>tKt(r,e));switch(typeof t){case"string":return Xve(t,e);case"object":if(t===null)throw new wl(`Unexpected endpoint property: ${t}`);return rKt.getEndpointProperties(t,e);case"boolean":return t;default:throw new wl(`Unexpected endpoint property type: ${typeof t}`)}},rKt={getEndpointProperty:tKt,getEndpointProperties:kKe}});var oKt,iKt=v(()=>{a0();Sne();oKt=(t,e)=>{let r=b2(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 wl(`Endpoint URL must be a string, got ${typeof r}`)}});var aKt,sKt=v(()=>{wne();Yve();eKt();nKt();iKt();aKt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=sK(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${k1} Resolving endpoint from template: ${i0(n)}`),{...l!=null&&{headers:Q5t(l,a)},...u!=null&&{properties:kKe(u,a)},url:oKt(s,a)}}});var uKt,lKt=v(()=>{a0();Yve();Sne();uKt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=sK(r,e);if(o)throw new wl(b2(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var qKe,IPn,cKt,dKt=v(()=>{a0();Yve();sKt();lKt();qKe=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=aKt(r,e);if(n)return n}else if(r.type==="error")uKt(r,e);else if(r.type==="tree"){let n=cKt.evaluateTreeRule(r,e);if(n)return n}else throw new wl(`Unknown endpoint rule: ${r}`);throw new wl("Rules evaluation failed")},IPn=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=sK(r,e);if(o)return cKt.evaluateRules(n,{...e,referenceRecord:{...e.referenceRecord,...i}})},cKt={evaluateRules:qKe,evaluateTreeRule:IPn}});var fKt=v(()=>{Jve();dKt()});var Qve,pKt=v(()=>{wne();a0();fKt();Qve=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${k1} Initial EndpointParams: ${i0(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 wl(`Missing required parameter: '${l}'`);let u=qKe(i,{endpointParams:r,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${k1} Resolved endpoint: ${i0(u)}`),u}});var _2=v(()=>{b5t();DKe();jKe();Jve();pKt();a0()});var UKe=v(()=>{_2()});var BKe,mKt=v(()=>{_2();UKe();BKe=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!BKe(r))return!1;return!0}return!(!y2(t)||t.length<3||t.length>63||t!==t.toLowerCase()||vne(t))}});var hKt,APn,gKt,yKt=v(()=>{hKt=":",APn="/",gKt=t=>{let e=t.split(hKt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(hKt)==="")return null;let u=s.map(l=>l.split(APn)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var _Kt,bKt=v(()=>{_Kt={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-east-2":{description:"Asia Pacific (Taipei)"},"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)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws 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)"},"mx-central-1":{description:"Mexico (Central)"},"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-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"EU (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso 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:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{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-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"}});var DPn,jPn,vKt,wKt,zKe=v(()=>{bKt();DPn=_Kt,jPn="",vKt=t=>{let{partitions:e}=DPn;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}},wKt=()=>jPn});var Cne,SKt=v(()=>{_2();mKt();yKt();zKe();Cne={isVirtualHostableS3Bucket:BKe,parseArn:gKt,partition:vKt};F1.aws=Cne});function CKt(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 xKt=v(()=>{});var uk,ewe=v(()=>{xKt();uk=t=>{if(typeof t=="string")return uk(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=CKt(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var TKt=v(()=>{});var OKt=v(()=>{});var EKt=v(()=>{});var PKt=v(()=>{});var MKt=v(()=>{});var RKt=v(()=>{});var IKt=v(()=>{});var AKt=v(()=>{});var NKt=v(()=>{EKt();PKt();MKt();RKt();IKt();AKt()});var twe=v(()=>{SKt();zKe();UKe();TKt();OKt();NKt()});var DKt=v(()=>{});var jKt=v(()=>{DKt()});var $Kt=v(()=>{});var LKt=v(()=>{});var FKt=v(()=>{});function $Pn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var rwe,kKt=v(()=>{rwe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=$Pn(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 qKt=v(()=>{});var UKt=v(()=>{});var BKt=v(()=>{});var zKt=v(()=>{jKt();$Kt();LKt();FKt();kKt();qKt();UKt();BKt()});var VKt=v(()=>{});function uK(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var HKt=v(()=>{});function hx(t,e,r){t.__aws_sdk_context?t.__aws_sdk_context.features||(t.__aws_sdk_context.features={}):t.__aws_sdk_context={features:{}},t.__aws_sdk_context.features[e]=r}var WKt=v(()=>{});var JKt=v(()=>{});var nwe=v(()=>{VKt();HKt();WKt();JKt()});var KKt=v(()=>{});var GKt=v(()=>{KKt()});var XKt=v(()=>{});var ZKt=v(()=>{});var YKt=v(()=>{});function LPn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var lk,QKt=v(()=>{lk=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=LPn(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 owe,e8t=v(()=>{owe=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 t8t=v(()=>{});var r8t=v(()=>{});var xne=v(()=>{GKt();XKt();ZKt();YKt();QKt();e8t();t8t();r8t()});var VKe,n8t=v(()=>{xne();VKe=t=>owe.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var iwe,HKe=v(()=>{iwe=t=>new Date(Date.now()+t)});var o8t,i8t=v(()=>{HKe();o8t=(t,e)=>Math.abs(iwe(e).getTime()-t)>=3e5});var WKe,a8t=v(()=>{i8t();WKe=(t,e)=>{let r=Date.parse(t);return o8t(r,e)?r-Date.now():e}});var s8t=v(()=>{n8t();HKe();a8t()});var Tne,u8t,v2,l8t=v(()=>{xne();s8t();Tne=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},u8t=async t=>{let e=Tne("context",t.context),r=Tne("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await Tne("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},v2=class{async sign(e,r,n){if(!lk.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await u8t(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:iwe(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??VKe(r.$response);if(n){let o=Tne("config",e.config),i=o.systemClockOffset;o.systemClockOffset=WKe(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=VKe(e);if(n){let o=Tne("config",r.config);o.systemClockOffset=WKe(n,o.systemClockOffset)}}}});var c8t=v(()=>{});var d8t=v(()=>{});var f8t=v(()=>{});function m8t(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 JKe)e[r/2]=JKe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function s0(t){let e="";for(let r=0;r<t.byteLength;r++)e+=p8t[t[r]];return e}var p8t,JKe,lK=v(()=>{p8t={},JKe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),p8t[t]=e,JKe[e]=t}});var One,KKe=v(()=>{One=t=>new TextEncoder().encode(t)});var q1,h8t=v(()=>{KKe();q1=t=>typeof t=="string"?One(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var awe,g8t=v(()=>{awe=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 ck=v(()=>{KKe();h8t();g8t()});var y8t,b8t,GKe,_8t,v8t,XKe,ZKe,YKe,QKe,FPn,w8t,S8t,Ene,C8t,x8t,T8t,O8t,swe,E8t,P8t,M8t,e8e,R8t,dk=v(()=>{y8t="X-Amz-Algorithm",b8t="X-Amz-Credential",GKe="X-Amz-Date",_8t="X-Amz-SignedHeaders",v8t="X-Amz-Expires",XKe="X-Amz-Signature",ZKe="X-Amz-Security-Token",YKe="authorization",QKe=GKe.toLowerCase(),FPn="date",w8t=[YKe,QKe,FPn],S8t=XKe.toLowerCase(),Ene="x-amz-content-sha256",C8t=ZKe.toLowerCase(),x8t={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},T8t=/^proxy-/,O8t=/^sec-/,swe="AWS4-HMAC-SHA256",E8t="AWS4-HMAC-SHA256-PAYLOAD",P8t="UNSIGNED-PAYLOAD",M8t=50,e8e="aws4_request",R8t=60*60*24*7});var uwe,t8e,lwe,A8t,I8t,r8e=v(()=>{lK();ck();dk();uwe={},t8e=[],lwe=(t,e,r)=>`${t}/${e}/${r}/${e8e}`,A8t=async(t,e,r,n,o)=>{let i=await I8t(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${s0(i)}:${e.sessionToken}`;if(a in uwe)return uwe[a];for(t8e.push(a);t8e.length>M8t;)delete uwe[t8e.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,e8e])s=await I8t(t,s,u);return uwe[a]=s},I8t=(t,e,r)=>{let n=new t(e);return n.update(q1(r)),n.digest()}});var n8e,N8t=v(()=>{dk();n8e=({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 x8t||e?.has(i)||T8t.test(i)||O8t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var D8t,j8t=v(()=>{D8t=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var cwe,$8t=v(()=>{j8t();lK();ck();dk();cwe=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===Ene)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||D8t(e)){let n=new r;return n.update(q1(e)),s0(await n.digest())}return P8t}});function F8t(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var dwe,L8t,kPn,o8e,k8t=v(()=>{lK();ck();dwe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=One(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=One(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(o8e.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!kPn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(m8t(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"})(L8t||(L8t={}));kPn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,o8e=class t{constructor(e){x(this,"bytes");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&&F8t(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&F8t(e),parseInt(s0(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var q8t,U8t=v(()=>{q8t=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var B8t,z8t=v(()=>{xne();B8t=(t,e={})=>{let{headers:r,query:n={}}=lk.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)||e.hoistableHeaders?.has(i))&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var i8e,V8t=v(()=>{xne();dk();i8e=t=>{t=lk.clone(t);for(let e of Object.keys(t.headers))w8t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var fwe,H8t,W8t=v(()=>{fwe=$(gne());dk();H8t=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===S8t)continue;let o=(0,fwe.escapeUri)(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${(0,fwe.escapeUri)(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${(0,fwe.escapeUri)(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")}});var J8t,qPn,K8t=v(()=>{J8t=t=>qPn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),qPn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var a8e,G8t,pwe,X8t=v(()=>{lK();a8e=$(r0()),G8t=$(gne());ck();W8t();K8t();pwe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){x(this,"service");x(this,"regionProvider");x(this,"credentialProvider");x(this,"sha256");x(this,"uriEscapePath");x(this,"applyChecksum");this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=(0,a8e.normalizeProvider)(n),this.credentialProvider=(0,a8e.normalizeProvider)(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${H8t(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(q1(n));let a=await i.digest();return`${o}
|
||
${e}
|
||
${r}
|
||
${s0(a)}`}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(0,G8t.escapeUri)(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=J8t(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}});var Pne,Z8t=v(()=>{lK();ck();dk();r8e();N8t();$8t();k8t();U8t();z8t();V8t();X8t();Pne=class extends pwe{constructor({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s});x(this,"headerFormatter",new dwe)}async presign(r,n={}){let{signingDate:o=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:u,hoistableHeaders:l,signingRegion:c,signingService:d}=n,f=await this.credentialProvider();this.validateResolvedCredentials(f);let p=c??await this.regionProvider(),{longDate:m,shortDate:h}=this.formatDate(o);if(i>R8t)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=lwe(h,p,d??this.service),g=B8t(i8e(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[ZKe]=f.sessionToken),g.query[y8t]=swe,g.query[b8t]=`${f.accessKeyId}/${y}`,g.query[GKe]=m,g.query[v8t]=i.toString(10);let b=n8e(g,a,u);return g.query[_8t]=this.getCanonicalHeaderList(b),g.query[XKe]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await cwe(r,this.sha256))),g}async sign(r,n){return typeof r=="string"?this.signString(r,n):r.headers&&r.payload?this.signEvent(r,n):r.message?this.signMessage(r,n):this.signRequest(r,n)}async signEvent({headers:r,payload:n},{signingDate:o=new Date,priorSignature:i,signingRegion:a,signingService:s}){let u=a??await this.regionProvider(),{shortDate:l,longDate:c}=this.formatDate(o),d=lwe(l,u,s??this.service),f=await cwe({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=s0(await p.digest()),h=[E8t,c,d,i,m,f].join(`
|
||
`);return this.signString(h,{signingDate:o,signingRegion:u,signingService:s})}async signMessage(r,{signingDate:n=new Date,signingRegion:o,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:n,signingRegion:o,signingService:i,priorSignature:r.priorSignature}).then(s=>({message:r.message,signature:s}))}async signString(r,{signingDate:n=new Date,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let s=o??await this.regionProvider(),{shortDate:u}=this.formatDate(n),l=new this.sha256(await this.getSigningKey(a,s,u,i));return l.update(q1(r)),s0(await l.digest())}async signRequest(r,{signingDate:n=new Date,signableHeaders:o,unsignableHeaders:i,signingRegion:a,signingService:s}={}){let u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=a??await this.regionProvider(),c=i8e(r),{longDate:d,shortDate:f}=this.formatDate(n),p=lwe(f,l,s??this.service);c.headers[QKe]=d,u.sessionToken&&(c.headers[C8t]=u.sessionToken);let m=await cwe(c,this.sha256);!q8t(Ene,c.headers)&&this.applyChecksum&&(c.headers[Ene]=m);let h=n8e(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[YKe]=`${swe} Credential=${u.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${y}`,c}async getSignature(r,n,o,i){let a=await this.createStringToSign(r,n,i,swe),s=new this.sha256(await o);return s.update(q1(a)),s0(await s.digest())}getSigningKey(r,n,o,i){return A8t(this.sha256,r,o,n,i||this.service)}}});var Y8t=v(()=>{});var Q8t=v(()=>{Z8t();dk();r8e();Y8t()});function UPn(t,{credentials:e,credentialDefaultProvider:r}){let n;return e?e?.memoized?n=e:n=m5t(e,p5t,NKe):r?n=j1(r(Object.assign({},t,{parentClientConfig:t}))):n=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},n.memoized=!0,n}function BPn(t,e){if(e.configBound)return e;let r=async n=>e({...n,callerClientConfig:t});return r.memoized=e.memoized,r.configBound=!0,r}var mwe,eGt=v(()=>{nwe();ZO();Q8t();mwe=t=>{let e=t.credentials,r=!!t.credentials,n;Object.defineProperty(t,"credentials",{set(l){l&&l!==e&&l!==n&&(r=!0),e=l;let c=UPn(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),d=BPn(t,c);if(r&&!d.attributed){let f=typeof e=="object"&&e!==null;n=async p=>{let h=await d(p);return f&&(!h.$source||Object.keys(h.$source).length===0)?uK(h,"CREDENTIALS_CODE","e"):h},n.memoized=d.memoized,n.configBound=d.configBound,n.attributed=!0}else n=d},get(){return n},enumerable:!0,configurable:!0}),t.credentials=e;let{signingEscapePath:o=!0,systemClockOffset:i=t.systemClockOffset||0,sha256:a}=t,s;return t.signer?s=j1(t.signer):t.regionInfoProvider?s=()=>j1(t.region)().then(async l=>[await t.regionInfoProvider(l,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},l]).then(([l,c])=>{let{signingRegion:d,signingService:f}=l;t.signingRegion=t.signingRegion||d||c,t.signingName=t.signingName||f||t.serviceId;let p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:a,uriEscapePath:o},m=t.signerConstructor||Pne;return new m(p)}):s=async l=>{l=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await j1(t.region)(),properties:{}},l);let c=l.signingRegion,d=l.signingName;t.signingRegion=t.signingRegion||c,t.signingName=t.signingName||d||t.serviceId;let f={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:a,uriEscapePath:o},p=t.signerConstructor||Pne;return new p(f)},Object.assign(t,{systemClockOffset:i,signingEscapePath:o,signer:s})}});var tGt=v(()=>{l8t();d8t();f8t();eGt()});var rGt=v(()=>{tGt();c8t()});var nGt,hwe,oGt=v(()=>{nGt=typeof TextEncoder=="function"?new TextEncoder:null,hwe=t=>{if(typeof t=="string"){if(nGt)return nGt.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 s8e=v(()=>{oGt()});var w2,fk,cK,iGt,aGt,sGt=v(()=>{w2=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},fk=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,cK=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>iGt[p.step]-iGt[f.step]||aGt[p.priority||"normal"]-aGt[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=w2(m.name,m.aliases);if(h.includes(d)){f=!0;for(let y of h)n.delete(y);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},a=d=>{let f=!1,p=m=>{if(m.middleware===d){f=!0;for(let h of w2(m.name,m.aliases))n.delete(h);return!1}return!0};return t=t.filter(p),e=e.filter(p),f},s=d=>(t.forEach(f=>{d.add(f.middleware,{...f})}),e.forEach(f=>{d.addRelativeTo(f.middleware,{...f})}),d.identifyOnResolve?.(c.identifyOnResolve()),d),u=d=>{let f=[];return d.before.forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f.push(d),d.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?f.push(p):f.push(...u(p))}),f},l=(d=!1)=>{let f=[],p=[],m={};return t.forEach(y=>{let g={...y,before:[],after:[]};for(let b of w2(g.name,g.aliases))m[b]=g;f.push(g)}),e.forEach(y=>{let g={...y,before:[],after:[]};for(let b of w2(g.name,g.aliases))m[b]=g;p.push(g)}),p.forEach(y=>{if(y.toMiddleware){let g=m[y.toMiddleware];if(g===void 0){if(d)return;throw new Error(`${y.toMiddleware} is not found when adding ${fk(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&g.after.push(y),y.relation==="before"&&g.before.push(y)}}),o(f).map(u).reduce((y,g)=>(y.push(...g),y),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,y={step:"initialize",priority:"normal",middleware:d,...f},g=w2(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${fk(p,h)}'`);for(let b of g){let _=t.findIndex(T=>T.name===b||T.aliases?.some(O=>O===b));if(_===-1)continue;let w=t[_];if(w.step!==y.step||y.priority!==w.priority)throw new Error(`"${fk(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${fk(p,h)}" middleware with ${y.priority} priority in ${y.step} step.`);t.splice(_,1)}}for(let b of g)n.add(b)}t.push(y)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,y={middleware:d,...f},g=w2(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${fk(p,h)}'`);for(let b of g){let _=e.findIndex(T=>T.name===b||T.aliases?.some(O=>O===b));if(_===-1)continue;let w=e[_];if(w.toMiddleware!==y.toMiddleware||w.relation!==y.relation)throw new Error(`"${fk(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${fk(p,h)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(_,1)}}for(let b of g)n.add(b)}e.push(y)},clone:()=>s(cK()),use:d=>{d.applyToStack(c)},remove:d=>typeof d=="string"?i(d):a(d),removeByTag:d=>{let f=!1,p=m=>{let{tags:h,name:y,aliases:g}=m;if(h&&h.includes(d)){let b=w2(y,g);for(let _ of b)n.delete(_);return f=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),f},concat:d=>{let f=s(cK());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 fk(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},iGt={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},aGt={high:3,normal:2,low:1}});var u8e=v(()=>{sGt()});var S2,uGt=v(()=>{u8e();S2=class{constructor(e){x(this,"config");x(this,"middlewareStack",cK());x(this,"initConfig");x(this,"handlers");this.config=e;let{protocol:r,protocolSettings:n}=e;n&&typeof r=="function"&&(e.protocol=new r(n))}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=o===void 0&&this.config.cacheMiddleware===!0,s;if(a){this.handlers||(this.handlers=new WeakMap);let u=this.handlers;u.has(e.constructor)?s=u.get(e.constructor):(s=e.resolveMiddleware(this.middlewareStack,this.config,o),u.set(e.constructor,s))}else delete this.handlers,s=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)s(e).then(u=>i(null,u.output),u=>i(u)).catch(()=>{});else return s(e).then(u=>u.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}});var lGt=v(()=>{sk()});function gwe(t,e){if(e==null)return e;let r=na.of(t);if(r.getMergedTraits().sensitive)return l8e;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return l8e}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return l8e}else if(r.isStructSchema()&&typeof e=="object"){let n=e,o={};for(let[i,a]of r.structIterator())n[i]!=null&&(o[i]=gwe(a,n[i]));return o}return e}var l8e,cGt=v(()=>{kg();l8e="***SensitiveInformation***"});var dGt,cn,c8e,fGt=v(()=>{u8e();dGt=$(X5());cGt();cn=class{constructor(){x(this,"middlewareStack",cK());x(this,"schema")}static classBuilder(){return new c8e}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let y of o.bind(this)(d,e,r,n))this.middlewareStack.use(y);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[dGt.SMITHY_CONTEXT_KEY]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(y=>h.handle(y.request,n||{}),m)}},c8e=class{constructor(){x(this,"_init",()=>{});x(this,"_ep",{});x(this,"_middlewareFn",()=>[]);x(this,"_commandName","");x(this,"_clientName","");x(this,"_additionalContext",{});x(this,"_smithyContext",{});x(this,"_inputFilterSensitiveLog");x(this,"_outputFilterSensitiveLog");x(this,"_serializer",null);x(this,"_deserializer",null);x(this,"_operationSchema")}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}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends cn{constructor(...[o]){super();x(this,"input");x(this,"serialize",e._serializer);x(this,"deserialize",e._deserializer);this.input=o??{},e._init(this),this.schema=e._operationSchema}static getEndpointParameterInstructions(){return e._ep}resolveMiddleware(o,i,a){let s=e._operationSchema,u=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(o,i,a,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?gwe.bind(null,u):c=>c),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?gwe.bind(null,l):c=>c),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var pGt=v(()=>{});var ywe,mGt=v(()=>{ywe=(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 dK,d8e,hGt=v(()=>{dK=class t extends Error{constructor(r){super(r.message);x(this,"$fault");x(this,"$response");x(this,"$retryable");x(this,"$metadata");Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=r.name,this.$fault=r.$fault,this.$metadata=r.$metadata}static isInstance(r){if(!r)return!1;let n=r;return t.prototype.isPrototypeOf(n)||!!n.$fault&&!!n.$metadata&&(n.$fault==="client"||n.$fault==="server")}static[Symbol.hasInstance](r){if(!r)return!1;let n=r;return this===t?t.isInstance(r):t.isInstance(r)?n.name&&this.name?this.prototype.isPrototypeOf(r)||n.name===this.name:this.prototype.isPrototypeOf(r):!1}},d8e=(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 gGt=v(()=>{});var bwe,yGt=v(()=>{bwe=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 bGt=v(()=>{});var _Gt=v(()=>{});var f8e,vGt,wGt,SGt=v(()=>{f8e=$(X5()),vGt=t=>{let e=[];for(let r in f8e.AlgorithmId){let n=f8e.AlgorithmId[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},wGt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var CGt,xGt,TGt=v(()=>{CGt=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),xGt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var _we,vwe,OGt=v(()=>{SGt();TGt();_we=t=>Object.assign(vGt(t),CGt(t)),vwe=t=>Object.assign(wGt(t),xGt(t))});var EGt=v(()=>{OGt()});var PGt=v(()=>{});var p8e,MGt=v(()=>{p8e=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]=p8e(t[r]));return t}});var RGt=v(()=>{});var pk,IGt=v(()=>{pk=class{trace(){}debug(){}info(){}warn(){}error(){}}});var AGt=v(()=>{});var NGt=v(()=>{});var DGt=v(()=>{});var jGt=v(()=>{});var Lo=v(()=>{uGt();lGt();fGt();pGt();mGt();gGt();yGt();bGt();hGt();_Gt();EGt();PGt();MGt();RGt();IGt();AGt();NGt();DGt();jGt();ik()});var fK,m8e=v(()=>{kg();Lo();fK=class{constructor(e=!1){x(this,"queryCompat");this.queryCompat=e}resolveRestContentType(e,r){let n=r.getMemberSchemas(),o=Object.values(n).find(i=>!!i.getMergedTraits().httpPayload);if(o){let i=o.getMergedTraits().mediaType;return i||(o.isStringSchema()?"text/plain":o.isBlobSchema()?"application/octet-stream":e)}else if(!r.isUnitSchema()&&Object.values(n).find(a=>{let{httpQuery:s,httpQueryParams:u,httpHeader:l,httpLabel:c,httpPrefixHeaders:d}=a.getMergedTraits();return!s&&!u&&!l&&!c&&d===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,r,n,o,i,a){let s=r,u=e;e.includes("#")&&([s,u]=e.split("#"));let l={$metadata:i,$fault:n.statusCode<500?"client":"server"},c=Vs.for(s);try{return{errorSchema:a?.(c,u)??c.getSchema(e),errorMetadata:l}}catch{o.message=o.message??o.Message??"UnknownError";let f=Vs.for("smithy.ts.sdk.synthetic."+s),p=f.getBaseException();if(p){let m=f.getErrorCtor(p)??Error;throw this.decorateServiceException(Object.assign(new m({name:u}),l),o)}throw this.decorateServiceException(Object.assign(new Error(u),l),o)}}decorateServiceException(e,r={}){if(this.queryCompat){let n=e.Message??r.Message,o=d8e(e,r);n&&(o.message=n),o.Error={...o.Error,Type:o.Error.Type,Code:o.Error.Code,Message:o.Error.message??o.Error.Message??n};let i=o.$metadata.requestId;return i&&(o.RequestId=i),o}return d8e(e,r)}setQueryCompatError(e,r){let n=r.headers?.["x-amzn-query-error"];if(e!==void 0&&n!=null){let[o,i]=n.split(";"),a=Object.entries(e),s={Code:o,Type:i};Object.assign(e,s);for(let[u,l]of a)s[u==="message"?"Message":u]=l;delete s.__type,e.Error=s}}queryCompatOutput(e,r){e.Error&&(r.Error=e.Error),e.Type&&(r.Type=e.Type),e.Code&&(r.Code=e.Code)}findQueryCompatibleError(e,r){try{return e.getSchema(r)}catch{return e.find(o=>na.of(o).getMergedTraits().awsQueryError?.[0]===r)}}}});var $Gt=v(()=>{});var LGt=v(()=>{});var u0,pK=v(()=>{u0=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});function*wwe(t,e){if(t.isUnitSchema())return;let r=t.getSchema();for(let n=0;n<r[4].length;++n){let o=r[4][n],i=r[5][n],a=new na([i,0],o);!(o in e)&&!a.isIdempotencyToken()||(yield[o,a])}}function*FGt(t,e,r){if(t.isUnitSchema())return;let n=t.getSchema(),o=Object.keys(e).filter(i=>i!=="__type").length;for(let i=0;i<n[4].length&&o!==0;++i){let a=n[4][i],s=n[5][i],u=new na([s,0],a),l=a;r&&(l=u.getMergedTraits()[r]??a),l in e&&(yield[a,u],o-=1)}}var Swe=v(()=>{kg()});var mK,h8e=v(()=>{mK=class{constructor(e,r){x(this,"from");x(this,"to");x(this,"keys");this.from=e,this.to=r,this.keys=new Set(Object.keys(this.from).filter(n=>n!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}}});function kGt(t,e,r){if(r?.source){let n=r.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||n!==String(e)))return n.includes(".")?new Fh(n,"bigDecimal"):BigInt(n)}return e}var qGt=v(()=>{ik()});var UGt,BGt=v(()=>{Lo();ck();UGt=(t,e)=>$1(t,e).then(r=>(e?.utf8Encoder??awe)(r))});var zGt,VGt,Cwe=v(()=>{BGt();zGt=(t,e)=>UGt(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{}}),VGt=(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&&typeof e=="object"){let i=r(e,"code");if(i&&e[i]!==void 0)return n(e[i]);if(e.__type!==void 0)return n(e.__type)}}});var xwe,g8e=v(()=>{sk();kg();ik();KO();pK();Swe();h8e();qGt();Cwe();xwe=class extends u0{constructor(r){super();x(this,"settings");this.settings=r}async read(r,n){return this._read(r,typeof n=="string"?JSON.parse(n,kGt):await zGt(n,this.serdeContext))}readObject(r,n){return this._read(r,n)}_read(r,n){let o=n!==null&&typeof n=="object",i=na.of(r);if(o){if(i.isStructSchema()){let s=i.isUnionSchema(),u={},l;s&&(l=new mK(n,u));for(let[c,d]of FGt(i,n,this.settings.jsonName?"jsonName":!1)){let f=this.settings.jsonName?d.getMergedTraits().jsonName??c:c;s&&l.mark(f),n[f]!=null&&(u[c]=this._read(d,n[f]))}return s&&l.writeUnknown(),u}if(Array.isArray(n)&&i.isListSchema()){let s=i.getValueSchema(),u=[],l=!!i.getMergedTraits().sparse;for(let c of n)(l||c!=null)&&u.push(this._read(s,c));return u}if(i.isMapSchema()){let s=i.getValueSchema(),u={},l=!!i.getMergedTraits().sparse;for(let[c,d]of Object.entries(n))(l||d!=null)&&(u[c]=this._read(s,d));return u}}if(i.isBlobSchema()&&typeof n=="string")return Sw(n);let a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof n=="string"&&a)return a==="application/json"||a.endsWith("+json")?o0.from(n):n;if(i.isTimestampSchema()&&n!=null)switch(ak(i,this.settings)){case 5:return xJt(n);case 6:return TJt(n);case 7:return OJt(n);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",n),new Date(n)}if(i.isBigIntegerSchema()&&(typeof n=="number"||typeof n=="string"))return BigInt(n);if(i.isBigDecimalSchema()&&n!=null){if(n instanceof Fh)return n;let s=n;return s.type==="bigDecimal"&&"string"in s?new Fh(s.string,s.type):new Fh(String(n),"bigDecimal")}if(i.isNumericSchema()&&typeof n=="string"){switch(n){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return n}if(i.isDocumentSchema())if(o){let s=Array.isArray(n)?[]:{};for(let[u,l]of Object.entries(n))l instanceof Fh?s[u]=l:s[u]=this._read(i,l);return s}else return structuredClone(n);return n}}});var HGt,Twe,WGt=v(()=>{ik();HGt="\u039D",Twe=class{constructor(){x(this,"values",new Map);x(this,"counter",0);x(this,"stage",0)}createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,r)=>{if(r instanceof Fh){let n=`${HGt+"nv"+this.counter++}_`+r.string;return this.values.set(`"${n}"`,r.string),n}if(typeof r=="bigint"){let n=r.toString(),o=`${HGt+"b"+this.counter++}_`+n;return this.values.set(`"${o}"`,n),o}return r}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[r,n]of this.values)e=e.replace(r,n);return e}}});var Owe,y8e=v(()=>{sk();kg();ik();KO();pK();Swe();WGt();Owe=class extends u0{constructor(r){super();x(this,"settings");x(this,"buffer");x(this,"useReplacer",!1);x(this,"rootSchema");this.settings=r}write(r,n){this.rootSchema=na.of(r),this.buffer=this._write(this.rootSchema,n)}writeDiscriminatedDocument(r,n){this.write(r,n),typeof this.buffer=="object"&&(this.buffer.__type=na.of(r).getName(!0))}flush(){let{rootSchema:r,useReplacer:n}=this;if(this.rootSchema=void 0,this.useReplacer=!1,r?.isStructSchema()||r?.isDocumentSchema()){if(!n)return JSON.stringify(this.buffer);let o=new Twe;return o.replaceInJson(JSON.stringify(this.buffer,o.createReplacer(),0))}return this.buffer}_write(r,n,o){let i=n!==null&&typeof n=="object",a=na.of(r);if(i){if(a.isStructSchema()){let s={};for(let[u,l]of wwe(a,n)){let c=this._write(l,n[u],a);if(c!==void 0){let d=l.getMergedTraits().jsonName,f=this.settings.jsonName?d??u:u;s[f]=c}}if(a.isUnionSchema()&&Object.keys(s).length===0){let{$unknown:u}=n;if(Array.isArray(u)){let[l,c]=u;s[l]=this._write(15,c)}}return s}if(Array.isArray(n)&&a.isListSchema()){let s=a.getValueSchema(),u=[],l=!!a.getMergedTraits().sparse;for(let c of n)(l||c!=null)&&u.push(this._write(s,c));return u}if(a.isMapSchema()){let s=a.getValueSchema(),u={},l=!!a.getMergedTraits().sparse;for(let[c,d]of Object.entries(n))(l||d!=null)&&(u[c]=this._write(s,d));return u}if(n instanceof Uint8Array&&(a.isBlobSchema()||a.isDocumentSchema()))return a===this.rootSchema?n:(this.serdeContext?.base64Encoder??Cw)(n);if(n instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(ak(a,this.settings)){case 5:return n.toISOString().replace(".000Z","Z");case 6:return Uve(n);case 7:return n.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",n),n.getTime()/1e3}n instanceof Fh&&(this.useReplacer=!0)}if(!(n===null&&o?.isStructSchema())){if(a.isStringSchema()){if(typeof n>"u"&&a.isIdempotencyToken())return g2();let s=a.getMergedTraits().mediaType;return n!=null&&s&&(s==="application/json"||s.endsWith("+json"))?o0.from(n):n}if(typeof n=="number"&&a.isNumericSchema())return Math.abs(n)===1/0||isNaN(n)?String(n):n;if(typeof n=="string"&&a.isBlobSchema())return a===this.rootSchema?n:(this.serdeContext?.base64Encoder??Cw)(n);if(typeof n=="bigint"&&(this.useReplacer=!0),a.isDocumentSchema())if(i){let s=Array.isArray(n)?[]:{};for(let[u,l]of Object.entries(n))l instanceof Fh?(this.useReplacer=!0,s[u]=l):s[u]=this._write(a,l);return s}else return structuredClone(n);return n}}}});var Ewe,b8e=v(()=>{pK();g8e();y8e();Ewe=class extends u0{constructor(r){super();x(this,"settings");this.settings=r}createSerializer(){let r=new Owe(this.settings);return r.setSerdeContext(this.serdeContext),r}createDeserializer(){let r=new xwe(this.settings);return r.setSerdeContext(this.serdeContext),r}}});var Pwe,_8e=v(()=>{sk();kg();m8e();b8e();Cwe();Pwe=class extends nK{constructor({defaultNamespace:r,serviceTarget:n,awsQueryCompatible:o,jsonCodec:i}){super({defaultNamespace:r});x(this,"serializer");x(this,"deserializer");x(this,"serviceTarget");x(this,"codec");x(this,"mixin");x(this,"awsQueryCompatible");this.serviceTarget=n,this.codec=i??new Ewe({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!o,this.mixin=new fK(this.awsQueryCompatible)}async serializeRequest(r,n,o){let i=await super.serializeRequest(r,n,o);return i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${r.name}`}),this.awsQueryCompatible&&(i.headers["x-amzn-query-mode"]="true"),(nk(r.input)==="unit"||!i.body)&&(i.body="{}"),i}getPayloadCodec(){return this.codec}async handleError(r,n,o,i,a){this.awsQueryCompatible&&this.mixin.setQueryCompatError(i,o);let s=VGt(o,i)??"Unknown",{errorSchema:u,errorMetadata:l}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,o,i,a,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),c=na.of(u),d=i.message??i.Message??"Unknown",f=Vs.for(u[1]).getErrorCtor(u)??Error,p=new f(d),m={};for(let[h,y]of c.structIterator())i[h]!=null&&(m[h]=this.codec.createDeserializer().readObject(y,i[h]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(i,m),this.mixin.decorateServiceException(Object.assign(p,l,{$fault:c.getMergedTraits().error,message:d},m),i)}}});var JGt=v(()=>{});var Mwe,KGt=v(()=>{_8e();Mwe=class extends Pwe{constructor({defaultNamespace:e,serviceTarget:r,awsQueryCompatible:n,jsonCodec:o}){super({defaultNamespace:e,serviceTarget:r,awsQueryCompatible:n,jsonCodec:o})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}});var GGt=v(()=>{});var XGt=v(()=>{});var ZGt=v(()=>{});var YGt=v(()=>{});function w8e(t){v8e||(v8e=new DOMParser);let e=v8e.parseFromString(t,"application/xml");if(e.getElementsByTagName("parsererror").length>0)throw new Error("DOMParser XML parsing error.");let r=n=>{if(n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())return n.textContent;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(o.attributes.length===0&&o.childNodes.length===0)return"";let i={},a=Array.from(o.attributes);for(let u of a)i[`${u.name}`]=u.value;let s=Array.from(o.childNodes);for(let u of s){let l=r(u);if(l!=null){let c=u.nodeName;if(s.length===1&&a.length===0&&c==="#text")return l;i[c]?Array.isArray(i[c])?i[c].push(l):i[c]=[i[c],l]:i[c]=l}else if(s.length===1&&a.length===0)return o.textContent}return i}return null};return{[e.documentElement.nodeName]:r(e.documentElement)}}var v8e,QGt=v(()=>{});var e9t=v(()=>{YGt();ZGt();QGt()});var Rwe,S8e=v(()=>{e9t();sk();kg();Lo();ck();pK();h8e();Rwe=class extends u0{constructor(r){super();x(this,"settings");x(this,"stringDeserializer");this.settings=r,this.stringDeserializer=new Hve(r)}setSerdeContext(r){this.serdeContext=r,this.stringDeserializer.setSerdeContext(r)}read(r,n,o){let i=na.of(r),a=i.getMemberSchemas();if(i.isStructSchema()&&i.isMemberSchema()&&!!Object.values(a).find(c=>!!c.getMemberTraits().eventPayload)){let c={},d=Object.keys(a)[0];return a[d].isBlobSchema()?c[d]=n:c[d]=this.read(a[d],n),c}let u=(this.serdeContext?.utf8Encoder??awe)(n),l=this.parseXml(u);return this.readSchema(r,o?l[o]:l)}readSchema(r,n){let o=na.of(r);if(o.isUnitSchema())return;let i=o.getMergedTraits();if(o.isListSchema()&&!Array.isArray(n))return this.readSchema(o,[n]);if(n==null)return n;if(typeof n=="object"){let a=!!i.sparse,s=!!i.xmlFlattened;if(o.isListSchema()){let l=o.getValueSchema(),c=[],d=l.getMergedTraits().xmlName??"member",f=s?n:(n[0]??n)[d],p=Array.isArray(f)?f:[f];for(let m of p)(m!=null||a)&&c.push(this.readSchema(l,m));return c}let u={};if(o.isMapSchema()){let l=o.getKeySchema(),c=o.getValueSchema(),d;s?d=Array.isArray(n)?n:[n]:d=Array.isArray(n.entry)?n.entry:[n.entry];let f=l.getMergedTraits().xmlName??"key",p=c.getMergedTraits().xmlName??"value";for(let m of d){let h=m[f],y=m[p];(y!=null||a)&&(u[h]=this.readSchema(c,y))}return u}if(o.isStructSchema()){let l=o.isUnionSchema(),c;l&&(c=new mK(n,u));for(let[d,f]of o.structIterator()){let p=f.getMergedTraits(),m=p.httpPayload?p.xmlName??f.getName():f.getMemberTraits().xmlName??d;l&&c.mark(m),n[m]!=null&&(u[d]=this.readSchema(f,n[m]))}return l&&c.writeUnknown(),u}if(o.isDocumentSchema())return n;throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${o.getName(!0)}`)}return o.isListSchema()?[]:o.isMapSchema()||o.isStructSchema()?{}:this.stringDeserializer.read(o,n)}parseXml(r){if(r.length){let n;try{n=w8e(r)}catch(s){throw s&&typeof s=="object"&&Object.defineProperty(s,"$responseBodyText",{value:r}),s}let o="#text",i=Object.keys(n)[0],a=n[i];return a[o]&&(a[i]=a[o],delete a[o]),p8e(a)}return{}}}});var Iwe,t9t=v(()=>{sk();kg();ik();Lo();KO();pK();Swe();Iwe=class extends u0{constructor(r){super();x(this,"settings");x(this,"buffer");this.settings=r}write(r,n,o=""){this.buffer===void 0&&(this.buffer="");let i=na.of(r);if(o&&!o.endsWith(".")&&(o+="."),i.isBlobSchema())(typeof n=="string"||n instanceof Uint8Array)&&(this.writeKey(o),this.writeValue((this.serdeContext?.base64Encoder??Cw)(n)));else if(i.isBooleanSchema()||i.isNumericSchema()||i.isStringSchema())n!=null?(this.writeKey(o),this.writeValue(String(n))):i.isIdempotencyToken()&&(this.writeKey(o),this.writeValue(g2()));else if(i.isBigIntegerSchema())n!=null&&(this.writeKey(o),this.writeValue(String(n)));else if(i.isBigDecimalSchema())n!=null&&(this.writeKey(o),this.writeValue(n instanceof Fh?n.string:String(n)));else if(i.isTimestampSchema()){if(n instanceof Date)switch(this.writeKey(o),ak(i,this.settings)){case 5:this.writeValue(n.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(Uve(n));break;case 7:this.writeValue(String(n.getTime()/1e3));break}}else if(i.isDocumentSchema())Array.isArray(n)?this.write(79,n,o):n instanceof Date?this.write(4,n,o):n instanceof Uint8Array?this.write(21,n,o):n&&typeof n=="object"?this.write(143,n,o):(this.writeKey(o),this.writeValue(String(n)));else if(i.isListSchema()){if(Array.isArray(n))if(n.length===0)this.settings.serializeEmptyLists&&(this.writeKey(o),this.writeValue(""));else{let a=i.getValueSchema(),s=this.settings.flattenLists||i.getMergedTraits().xmlFlattened,u=1;for(let l of n){if(l==null)continue;let c=this.getKey("member",a.getMergedTraits().xmlName),d=s?`${o}${u}`:`${o}${c}.${u}`;this.write(a,l,d),++u}}}else if(i.isMapSchema()){if(n&&typeof n=="object"){let a=i.getKeySchema(),s=i.getValueSchema(),u=i.getMergedTraits().xmlFlattened,l=1;for(let[c,d]of Object.entries(n)){if(d==null)continue;let f=this.getKey("key",a.getMergedTraits().xmlName),p=u?`${o}${l}.${f}`:`${o}entry.${l}.${f}`,m=this.getKey("value",s.getMergedTraits().xmlName),h=u?`${o}${l}.${m}`:`${o}entry.${l}.${m}`;this.write(a,c,p),this.write(s,d,h),++l}}}else if(i.isStructSchema()){if(n&&typeof n=="object"){let a=!1;for(let[s,u]of wwe(i,n)){if(n[s]==null&&!u.isIdempotencyToken())continue;let l=this.getKey(s,u.getMergedTraits().xmlName),c=`${o}${l}`;this.write(u,n[s],c),a=!0}if(!a&&i.isUnionSchema()){let{$unknown:s}=n;if(Array.isArray(s)){let[u,l]=s,c=`${o}${u}`;this.write(15,l,c)}}}}else if(!i.isUnitSchema())throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${i.getName(!0)}`)}flush(){if(this.buffer===void 0)throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");let r=this.buffer;return delete this.buffer,r}getKey(r,n){let o=n??r;return this.settings.capitalizeKeys?o[0].toUpperCase()+o.slice(1):o}writeKey(r){r.endsWith(".")&&(r=r.slice(0,r.length-1)),this.buffer+=`&${mKe(r)}=`}writeValue(r){this.buffer+=mKe(r)}}});var Awe,r9t=v(()=>{sk();kg();m8e();S8e();t9t();Awe=class extends nK{constructor(r){super({defaultNamespace:r.defaultNamespace});x(this,"options");x(this,"serializer");x(this,"deserializer");x(this,"mixin",new fK);this.options=r;let n={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:r.xmlNamespace,serviceNamespace:r.defaultNamespace,serializeEmptyLists:!0};this.serializer=new Iwe(n),this.deserializer=new Rwe(n)}getShapeId(){return"aws.protocols#awsQuery"}setSerdeContext(r){this.serializer.setSerdeContext(r),this.deserializer.setSerdeContext(r)}getPayloadCodec(){throw new Error("AWSQuery protocol has no payload codec.")}async serializeRequest(r,n,o){let i=await super.serializeRequest(r,n,o);i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":"application/x-www-form-urlencoded"}),(nk(r.input)==="unit"||!i.body)&&(i.body="");let a=r.name.split("#")[1]??r.name;return i.body=`Action=${a}&Version=${this.options.version}`+i.body,i.body.endsWith("&")&&(i.body=i.body.slice(-1)),i}async deserializeResponse(r,n,o){let i=this.deserializer,a=na.of(r.output),s={};if(o.statusCode>=300){let f=await $1(o.body,n);f.byteLength>0&&Object.assign(s,await i.read(15,f)),await this.handleError(r,n,o,s,this.deserializeMetadata(o))}for(let f in o.headers){let p=o.headers[f];delete o.headers[f],o.headers[f.toLowerCase()]=p}let u=r.name.split("#")[1]??r.name,l=a.isStructSchema()&&this.useNestedResult()?u+"Result":void 0,c=await $1(o.body,n);return c.byteLength>0&&Object.assign(s,await i.read(a,c,l)),{$metadata:this.deserializeMetadata(o),...s}}useNestedResult(){return!0}async handleError(r,n,o,i,a){let s=this.loadQueryErrorCode(o,i)??"Unknown",u=this.loadQueryError(i),l=this.loadQueryErrorMessage(i);u.message=l,u.Error={Type:u.Type,Code:u.Code,Message:l};let{errorSchema:c,errorMetadata:d}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,o,u,a,this.mixin.findQueryCompatibleError),f=na.of(c),p=Vs.for(c[1]).getErrorCtor(c)??Error,m=new p(l),h={Type:u.Error.Type,Code:u.Error.Code,Error:u.Error};for(let[y,g]of f.structIterator()){let b=g.getMergedTraits().xmlName??y,_=u[b]??i[b];h[y]=this.deserializer.readSchema(g,_)}throw this.mixin.decorateServiceException(Object.assign(m,d,{$fault:f.getMergedTraits().error,message:l},h),i)}loadQueryErrorCode(r,n){let o=(n.Errors?.[0]?.Error??n.Errors?.Error??n.Error)?.Code;if(o!==void 0)return o;if(r.statusCode==404)return"NotFound"}loadQueryError(r){return r.Errors?.[0]?.Error??r.Errors?.Error??r.Error}loadQueryErrorMessage(r){let n=this.loadQueryError(r);return n?.message??n?.Message??r.message??r.Message??"Unknown"}getDefaultContentType(){return"application/x-www-form-urlencoded"}}});var n9t=v(()=>{});var o9t=v(()=>{});var i9t=v(()=>{});var a9t=v(()=>{});var s9t=v(()=>{});var Nwe=v(()=>{$Gt();LGt();JGt();KGt();_8e();GGt();b8e();g8e();y8e();XGt();Cwe();n9t();r9t();s9t();a9t();S8e();i9t();o9t()});var hK=v(()=>{nwe();rGt();Nwe()});async function u9t(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&hx(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let i=await e.retryStrategy();typeof i.acquireInitialRetryToken=="function"?i.constructor?.name?.includes("Adaptive")?hx(t,"RETRY_MODE_ADAPTIVE","F"):hx(t,"RETRY_MODE_STANDARD","E"):hx(t,"RETRY_MODE_LEGACY","D")}if(typeof e.accountIdEndpointMode=="function"){let i=t.endpointV2;switch(String(i?.url?.hostname).match(zPn)&&hx(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":hx(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":hx(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":hx(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let o=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(o?.$source){let i=o;i.accountId&&hx(t,"RESOLVED_ACCOUNT_ID","T");for(let[a,s]of Object.entries(i.$source??{}))hx(t,a,s)}}var zPn,l9t=v(()=>{hK();zPn=/\d{12}\.ddb/});var C8e,Dwe,x8e,jwe,c9t,d9t,T8e,f9t=v(()=>{C8e="user-agent",Dwe="x-amz-user-agent",x8e=" ",jwe="/",c9t=/[^!$%&'*+\-.^_`|~\w]/g,d9t=/[^!$%&'*+\-.^_`|~\w#]/g,T8e="-"});function p9t(t){let e="";for(let r in t){let n=t[r];if(e.length+n.length+1<=1024){e.length?e+=","+n:e+=n;continue}break}return e}var m9t=v(()=>{});var VPn,$we,HPn,Lwe,h9t=v(()=>{twe();zKt();l9t();f9t();m9t();VPn=t=>(e,r)=>async n=>{let{request:o}=n;if(!rwe.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map($we)||[],s=(await t.defaultUserAgentProvider()).map($we);await u9t(r,t,n);let u=r;s.push(`m/${p9t(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);let l=t?.customUserAgent?.map($we)||[],c=await t.userAgentAppId();c&&s.push($we(["app",`${c}`]));let d=wKt(),f=(d?[d]:[]).concat([...s,...a,...l]).join(x8e),p=[...s.filter(m=>m.startsWith("aws-sdk-")),...l].join(x8e);return t.runtime!=="browser"?(p&&(i[Dwe]=i[Dwe]?`${i[C8e]} ${p}`:p),i[C8e]=f):i[Dwe]=f,e({...n,request:o})},$we=t=>{let e=t[0].split(jwe).map(a=>a.replace(c9t,T8e)).join(jwe),r=t[1]?.replace(d9t,T8e),n=e.indexOf(jwe),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}`}},"")},HPn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Lwe=t=>({applyToStack:e=>{e.add(VPn(t),HPn)}})});var O8e=v(()=>{y5t();h9t()});var Fwe,g9t=v(()=>{Fwe=!1});var kwe,y9t=v(()=>{kwe=!1});var b9t=v(()=>{});var _9t=v(()=>{});var v9t=v(()=>{g9t();y9t();b9t();_9t()});var w9t=v(()=>{});var S9t,C9t,x9t=v(()=>{_2();S9t=new Set,C9t=(t,e=y2)=>{if(!S9t.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);else S9t.add(t)}});var qwe,E8e=v(()=>{qwe=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var T9t,O9t=v(()=>{E8e();T9t=t=>qwe(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var Uwe,E9t=v(()=>{x9t();O9t();E8e();Uwe=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let n=typeof e=="function"?await e():e,o=T9t(n);return C9t(o),o},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return qwe(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})}});var P9t=v(()=>{w9t();E9t()});var M9t=v(()=>{});var R9t=v(()=>{});var I9t=v(()=>{});var A9t=v(()=>{M9t();R9t();I9t()});var Mne=v(()=>{v9t();P9t();A9t()});var N9t=v(()=>{});var D9t=v(()=>{N9t()});var j9t=v(()=>{});var $9t=v(()=>{});var L9t=v(()=>{});function WPn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Bwe,F9t=v(()=>{Bwe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=WPn(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 k9t=v(()=>{});var q9t=v(()=>{});var U9t=v(()=>{});var B9t=v(()=>{D9t();j9t();$9t();L9t();F9t();k9t();q9t();U9t()});function JPn(t){return e=>async r=>{let n=r.request;if(Bwe.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(z9t)===-1)try{let a=t(o);n.headers={...n.headers,[z9t]:String(a)}}catch{}}return e({...r,request:n})}}var z9t,KPn,zwe,P8e=v(()=>{B9t();z9t="content-length";KPn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},zwe=t=>({applyToStack:e=>{e.add(JPn(t.bodyLengthChecker),KPn)}})});var V9t,GPn,XPn,ZPn,YPn,QPn,H9t=v(()=>{V9t=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),QPn(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!YPn(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},GPn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,XPn=/(\d+\.){3}\d+/,ZPn=/\.\./,YPn=t=>GPn.test(t)&&!XPn.test(t)&&!ZPn.test(t),QPn=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 W9t=v(()=>{H9t()});var J9t,K9t=v(()=>{J9t=(t,e,r,n=!1)=>{let o=async()=>{let i;return n?i=r.clientContextParams?.[t]??r[t]??r[e]:i=r[t]??r[e],typeof i=="function"?i():i};return t==="credentialScope"||e==="CredentialScope"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.credentialScope??i?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.accountId??i?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let i=await o();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){let{protocol:a,hostname:s,port:u,path:l}=i;return`${a}//${s}${u?":"+u:""}${l}`}}return i}:o}});var Vwe,M8e=v(()=>{Vwe=async t=>{}});var Hwe,Wwe=v(()=>{ewe();Hwe=t=>typeof t=="object"?"url"in t?uk(t.url):t:uk(t)});var G9t,eMn,R8e=v(()=>{W9t();K9t();M8e();Wwe();G9t=async(t,e,r,n)=>{if(!r.isCustomEndpoint){let a;r.serviceConfiguredEndpoint?a=await r.serviceConfiguredEndpoint():a=await Vwe(r.serviceId),a&&(r.endpoint=()=>Promise.resolve(Hwe(a)),r.isCustomEndpoint=!0)}let o=await eMn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},eMn=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 J9t(a.name,i,r,a.type!=="builtInParams")();break;case"operationContextParams":n[i]=a.get(t);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 V9t(n),n}});var X9t=v(()=>{R8e();Wwe()});var Z9t,Y9t,I8e=v(()=>{ZO();Z9t=$(r0());R8e();Y9t=({config:t,instructions:e})=>(r,n)=>async o=>{t.isCustomEndpoint&&a5t(n,"ENDPOINT_OVERRIDE","N");let i=await G9t(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=(0,Z9t.getSmithyContext)(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 tMn,Nn,Q9t=v(()=>{rKe();I8e();tMn={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Ove.name},Nn=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Y9t({config:t,instructions:e}),tMn)}})});var Jwe,Kwe,e7t=v(()=>{Jwe=$(r0());M8e();Wwe();Kwe=t=>{let e=t.tls??!0,{endpoint:r,useDualstackEndpoint:n,useFipsEndpoint:o}=t,i=r!=null?async()=>Hwe(await(0,Jwe.normalizeProvider)(r)()):void 0,s=Object.assign(t,{endpoint:i,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:(0,Jwe.normalizeProvider)(n??!1),useFipsEndpoint:(0,Jwe.normalizeProvider)(o??!1)}),u;return s.serviceConfiguredEndpoint=async()=>(t.serviceId&&!u&&(u=Vwe(t.serviceId)),u),s}});var t7t=v(()=>{});var r7t=v(()=>{});var gu=v(()=>{X9t();I8e();Q9t();e7t();t7t();r7t()});var U1,B1,Rne,Gwe=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(U1||(U1={}));B1=3,Rne=U1.STANDARD});var n7t,o7t,i7t,a7t,s7t,u7t=v(()=>{n7t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],o7t=["TimeoutError","RequestTimeout","RequestTimeoutException"],i7t=[500,502,503,504],a7t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],s7t=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"]});var rMn,nMn,oMn,Xwe,Zwe,l7t,A8e=v(()=>{u7t();rMn=t=>t?.$retryable!==void 0,nMn=t=>t.$metadata?.clockSkewCorrected,oMn=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},Xwe=t=>t.$metadata?.httpStatusCode===429||n7t.includes(t.name)||t.$retryable?.throttling==!0,Zwe=(t,e=0)=>rMn(t)||nMn(t)||o7t.includes(t.name)||a7t.includes(t?.code||"")||s7t.includes(t?.code||"")||i7t.includes(t.$metadata?.httpStatusCode||0)||oMn(t)||t.cause!==void 0&&e<=10&&Zwe(t.cause,e+1),l7t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Zwe(t)}return!1}});var Qwe,Ywe,N8e=v(()=>{A8e();Qwe=class Qwe{constructor(e){x(this,"beta");x(this,"minCapacity");x(this,"minFillRate");x(this,"scaleConstant");x(this,"smooth");x(this,"currentCapacity",0);x(this,"enabled",!1);x(this,"lastMaxRate",0);x(this,"measuredTxRate",0);x(this,"requestCount",0);x(this,"fillRate");x(this,"lastThrottleTime");x(this,"lastTimestamp",0);x(this,"lastTxRateBucket");x(this,"maxCapacity");x(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=>Qwe.setTimeoutFn(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(),Xwe(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))}};x(Qwe,"setTimeoutFn",setTimeout);Ywe=Qwe});var c7t,d7t,f7t=v(()=>{c7t="amz-sdk-invocation-id",d7t="amz-sdk-request"});var m7t,h7t=v(()=>{m7t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var D8e,g7t=v(()=>{D8e=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var gK,j8e=v(()=>{Gwe();h7t();g7t();gK=class{constructor(e){x(this,"maxAttempts");x(this,"mode",U1.STANDARD);x(this,"capacity",500);x(this,"retryBackoffStrategy",m7t());x(this,"maxAttemptsProvider");this.maxAttempts=e,this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return D8e({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,D8e({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 ${B1}`),B1}}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 eSe,y7t=v(()=>{Gwe();N8e();j8e();eSe=class{constructor(e,r){x(this,"maxAttemptsProvider");x(this,"rateLimiter");x(this,"standardRetryStrategy");x(this,"mode",U1.ADAPTIVE);this.maxAttemptsProvider=e;let{rateLimiter:n}=r??{};this.rateLimiter=n??new Ywe,this.standardRetryStrategy=new gK(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 b7t=v(()=>{});var _7t=v(()=>{});var Ine=v(()=>{y7t();b7t();N8e();j8e();Gwe();f7t();_7t()});var v7t=v(()=>{});var w7t=v(()=>{v7t()});var S7t=v(()=>{});var C7t=v(()=>{});var x7t=v(()=>{});function sMn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var tSe,T7t=v(()=>{tSe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=sMn(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 rSe,O7t=v(()=>{rSe=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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 E7t=v(()=>{});var P7t=v(()=>{});var M7t=v(()=>{w7t();S7t();C7t();x7t();T7t();O7t();E7t();P7t()});var R7t=v(()=>{});var I7t=v(()=>{});var A7t,N7t=v(()=>{A7t=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 D7t=v(()=>{});var j7t=v(()=>{});var $8e,nSe,$7t=v(()=>{$8e=$(r0());Ine();nSe=t=>{let{retryStrategy:e,retryMode:r,maxAttempts:n}=t,o=(0,$8e.normalizeProvider)(n??B1);return Object.assign(t,{maxAttempts:o,retryStrategy:async()=>e||(await(0,$8e.normalizeProvider)(r)()===U1.ADAPTIVE?new eSe(o):new gK(o))})}});var L7t=v(()=>{});var F7t,k7t=v(()=>{F7t=t=>t?.body instanceof ReadableStream});var uMn,lMn,cMn,dMn,fMn,oSe,pMn,q7t=v(()=>{M7t();A8e();Lo();Ine();TKe();k7t();N7t();uMn=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(lMn(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=tSe.isInstance(c);for(d&&(c.headers[c7t]=g2());;)try{d&&(c.headers[d7t]=`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=cMn(f);if(s=A7t(f),d&&F7t(c))throw(r.logger instanceof pk?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)},lMn=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",cMn=t=>{let e={error:t,errorType:dMn(t)},r=pMn(t.$response);return r&&(e.retryAfterHint=r),e},dMn=t=>Xwe(t)?"THROTTLING":Zwe(t)?"TRANSIENT":l7t(t)?"SERVER_ERROR":"CLIENT_ERROR",fMn={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},oSe=t=>({applyToStack:e=>{e.add(uMn(t),fMn)}}),pMn=t=>{if(!rSe.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 L8e=v(()=>{j7t();D7t();$7t();R7t();L7t();I7t();q7t()});function mMn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function iSe(t){return{schemeId:"smithy.api#noAuth"}}var Ane,U7t,B7t,z7t,F8e=v(()=>{hK();Ane=$(r0()),U7t=async(t,e,r)=>({operation:(0,Ane.getSmithyContext)(e).operation,region:await(0,Ane.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});B7t=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(iSe(t));break}case"GetId":{e.push(iSe(t));break}case"GetOpenIdToken":{e.push(iSe(t));break}case"UnlinkIdentity":{e.push(iSe(t));break}default:e.push(mMn(t))}return e},z7t=t=>{let e=mwe(t);return Object.assign(e,{authSchemePreference:(0,Ane.normalizeProvider)(t.authSchemePreference??[])})}});var V7t,co,Sl=v(()=>{V7t=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),co={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var W7t,H7t=v(()=>{W7t={name:"@aws-sdk/client-cognito-identity",description:"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",version:"3.968.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"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":"yarn g:vitest run -c vitest.config.e2e.mts --mode development","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},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/core":"3.968.0","@aws-sdk/credential-provider-node":"3.968.0","@aws-sdk/middleware-host-header":"3.968.0","@aws-sdk/middleware-logger":"3.968.0","@aws-sdk/middleware-recursion-detection":"3.968.0","@aws-sdk/middleware-user-agent":"3.968.0","@aws-sdk/region-config-resolver":"3.968.0","@aws-sdk/types":"3.968.0","@aws-sdk/util-endpoints":"3.968.0","@aws-sdk/util-user-agent-browser":"3.968.0","@aws-sdk/util-user-agent-node":"3.968.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.3","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.4","@smithy/middleware-retry":"^4.4.20","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.5","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.19","@smithy/util-defaults-mode-node":"^4.2.22","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/client-iam":"3.968.0","@tsconfig/node20":"20.1.8","@types/chai":"^4.2.11","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},engines:{node:">=20.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 k8e,q8e,J7t,K7t=v(()=>{k8e={name:"SHA-256"},q8e={name:"HMAC",hash:k8e},J7t=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 yK(){return typeof window<"u"?window:typeof self<"u"?self:gMn}var gMn,U8e=v(()=>{gMn={}});var bK,B8e,z8e=v(()=>{bK=$(hve());K7t();U8e();B8e=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,bK.isEmptyData)(e)){var r=(0,bK.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 yK().crypto.subtle.sign(q8e,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,bK.isEmptyData)(this.toHash)?Promise.resolve(J7t):Promise.resolve().then(function(){return yK().crypto.subtle.digest(k8e,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){yK().crypto.subtle.importKey("raw",(0,bK.convertToBuffer)(e.secret),q8e,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function G7t(t){if(bMn(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return _Mn(e)}return!1}function bMn(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function _Mn(t){return t&&yMn.every(function(e){return typeof t[e]=="function"})}var yMn,X7t=v(()=>{yMn=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var Z7t=v(()=>{X7t()});var Y7t,Q7t,aSe,eXt=v(()=>{z8e();Y7t=$(J5e());Z7t();U8e();Q7t=$(hve()),aSe=function(){function t(e){G7t(yK())?this.hash=new B8e(e):this.hash=new Y7t.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,Q7t.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var V8e=v(()=>{eXt();z8e()});var sSe,tXt,H8e=v(()=>{sSe=({serviceId:t,clientVersion:e})=>async r=>{let n=typeof window<"u"?window.navigator:void 0,o=n?.userAgent??"",i=n?.userAgentData?.platform??tXt.os(o)??"other",a=void 0,s=n?.userAgentData?.brands??[],u=s[s.length-1],l=u?.brand??tXt.browser(o)??"unknown",c=u?.version??"unknown",d=[["aws-sdk-js",e],["ua","2.1"],[`os/${i}`,a],["lang/js"],["md/browser",`${l}_${c}`]];t&&d.push([`api/${t}`,e]);let f=await r?.userAgentAppId?.();return f&&d.push([`app/${f}`]),d},tXt={os(t){if(/iPhone|iPad|iPod/.test(t))return"iOS";if(/Macintosh|Mac OS X/.test(t))return"macOS";if(/Windows NT/.test(t))return"Windows";if(/Android/.test(t))return"Android";if(/Linux/.test(t))return"Linux"},browser(t){if(/EdgiOS|EdgA|Edg\//.test(t))return"Microsoft Edge";if(/Firefox\//.test(t))return"Firefox";if(/Chrome\//.test(t))return"Chrome";if(/Safari\//.test(t))return"Safari"}}});var rXt=v(()=>{});var uSe,nXt=v(()=>{uSe=t=>()=>Promise.reject(t)});var W8e=v(()=>{rXt();nXt()});var oXt,iXt=v(()=>{oXt=["in-region","cross-region","mobile","standard","legacy"]});var lSe,vMn,aXt=v(()=>{QF();iXt();lSe=({defaultsMode:t}={})=>dWt(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(vMn()?"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 ${oXt.join(", ")}, got ${e}`)}}),vMn=()=>{let t=window?.navigator;if(t?.connection){let{effectiveType:e,rtt:r,downlink:n}=t?.connection;if(typeof e=="string"&&e!=="4g"||Number(r)>100||Number(n)<10)return!0}return t?.userAgentData?.mobile||typeof t?.maxTouchPoints=="number"&&t?.maxTouchPoints>1}});var J8e=v(()=>{aXt()});var sXt,uXt=v(()=>{sXt=t=>new TextEncoder().encode(t)});var lXt=v(()=>{});var cXt,dXt=v(()=>{cXt=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 fXt=v(()=>{uXt();lXt();dXt()});var SXt,Wy,Jy,vK,pXt,jne,_K,YO,z1,K8e,G8e,Nne,mXt,hXt,gXt,CXt,xXt,Nd,Dne,yXt,TXt,bXt,_Xt,vXt,wXt,wMn,OXt,EXt=v(()=>{SXt="required",Wy="fn",Jy="argv",vK="ref",pXt="isSet",jne="booleanEquals",_K="error",YO="endpoint",z1="tree",K8e="PartitionResult",G8e="getAttr",Nne="stringEquals",mXt={[SXt]:!1,type:"string"},hXt={[SXt]:!0,default:!1,type:"boolean"},gXt={[vK]:"Endpoint"},CXt={[Wy]:jne,[Jy]:[{[vK]:"UseFIPS"},!0]},xXt={[Wy]:jne,[Jy]:[{[vK]:"UseDualStack"},!0]},Nd={},Dne={[vK]:"Region"},yXt={[Wy]:G8e,[Jy]:[{[vK]:K8e},"supportsFIPS"]},TXt={[vK]:K8e},bXt={[Wy]:jne,[Jy]:[!0,{[Wy]:G8e,[Jy]:[TXt,"supportsDualStack"]}]},_Xt=[CXt],vXt=[xXt],wXt=[Dne],wMn={version:"1.0",parameters:{Region:mXt,UseDualStack:hXt,UseFIPS:hXt,Endpoint:mXt},rules:[{conditions:[{[Wy]:pXt,[Jy]:[gXt]}],rules:[{conditions:_Xt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:_K},{conditions:vXt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:_K},{endpoint:{url:gXt,properties:Nd,headers:Nd},type:YO}],type:z1},{conditions:[{[Wy]:pXt,[Jy]:wXt}],rules:[{conditions:[{[Wy]:"aws.partition",[Jy]:wXt,assign:K8e}],rules:[{conditions:[CXt,xXt],rules:[{conditions:[{[Wy]:jne,[Jy]:[!0,yXt]},bXt],rules:[{conditions:[{[Wy]:Nne,[Jy]:[Dne,"us-east-1"]}],endpoint:{url:"https://cognito-identity-fips.us-east-1.amazonaws.com",properties:Nd,headers:Nd},type:YO},{conditions:[{[Wy]:Nne,[Jy]:[Dne,"us-east-2"]}],endpoint:{url:"https://cognito-identity-fips.us-east-2.amazonaws.com",properties:Nd,headers:Nd},type:YO},{conditions:[{[Wy]:Nne,[Jy]:[Dne,"us-west-1"]}],endpoint:{url:"https://cognito-identity-fips.us-west-1.amazonaws.com",properties:Nd,headers:Nd},type:YO},{conditions:[{[Wy]:Nne,[Jy]:[Dne,"us-west-2"]}],endpoint:{url:"https://cognito-identity-fips.us-west-2.amazonaws.com",properties:Nd,headers:Nd},type:YO},{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Nd,headers:Nd},type:YO}],type:z1},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:_K}],type:z1},{conditions:_Xt,rules:[{conditions:[{[Wy]:jne,[Jy]:[yXt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Nd,headers:Nd},type:YO}],type:z1},{error:"FIPS is enabled but this partition does not support FIPS",type:_K}],type:z1},{conditions:vXt,rules:[{conditions:[bXt],rules:[{conditions:[{[Wy]:Nne,[Jy]:["aws",{[Wy]:G8e,[Jy]:[TXt,"name"]}]}],endpoint:{url:"https://cognito-identity.{Region}.amazonaws.com",properties:Nd,headers:Nd},type:YO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Nd,headers:Nd},type:YO}],type:z1},{error:"DualStack is enabled but this partition does not support DualStack",type:_K}],type:z1},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:Nd,headers:Nd},type:YO}],type:z1}],type:z1},{error:"Invalid Configuration: Missing Region",type:_K}]},OXt=wMn});var SMn,PXt,MXt=v(()=>{twe();_2();EXt();SMn=new aK({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),PXt=(t,e={})=>SMn.get(t,()=>Qve(OXt,{endpointParams:t,logger:e.logger}));F1.aws=Cne});var RXt,IXt=v(()=>{hK();Nwe();ZO();Lo();ewe();KO();fXt();F8e();MXt();RXt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??Sw,base64Encoder:t?.base64Encoder??Cw,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??PXt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??B7t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new v2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new iK}],logger:t?.logger??new pk,protocol:t?.protocol??Mwe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.cognitoidentity",xmlNamespace:"http://cognito-identity.amazonaws.com/doc/2014-06-30/",version:"2014-06-30",serviceTarget:"AWSCognitoIdentityService"},serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??uk,utf8Decoder:t?.utf8Decoder??sXt,utf8Encoder:t?.utf8Encoder??cXt})});var AXt,NXt=v(()=>{H7t();V8e();H8e();Mne();yne();W8e();Lo();s8e();J8e();Ine();IXt();AXt=t=>{let e=lSe(t),r=()=>e().then(bwe),n=RXt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??hwe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??sSe({serviceId:n.serviceId,clientVersion:W7t.version}),maxAttempts:t?.maxAttempts??B1,region:t?.region??uSe("Region is missing"),requestHandler:rk.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Rne),sha256:t?.sha256??aSe,streamCollector:t?.streamCollector??Q5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Fwe)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(kwe))}}});var cSe,dSe,DXt=v(()=>{cSe=t=>({setRegion(e){t.region=e},region(){return t.region}}),dSe=t=>({region:t.region()})});var jXt=v(()=>{});function $Xt(){return async()=>"us-east-1"}var LXt=v(()=>{});var fSe=v(()=>{DXt();jXt();LXt()});var FXt,kXt,qXt=v(()=>{FXt=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),kXt=t=>({httpHandler:t.httpHandler()})});var UXt=v(()=>{qXt()});var BXt=v(()=>{});var zXt=v(()=>{});var VXt=v(()=>{});var HXt=v(()=>{});var WXt=v(()=>{});var JXt=v(()=>{});var KXt=v(()=>{});var GXt=v(()=>{UXt();BXt();zXt();VXt();HXt();WXt();JXt();KXt()});var XXt,ZXt,YXt=v(()=>{XXt=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}}},ZXt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var QXt,eZt=v(()=>{fSe();GXt();Lo();YXt();QXt=(t,e)=>{let r=Object.assign(cSe(t),_we(t),FXt(t),XXt(t));return e.forEach(n=>n.configure(r)),Object.assign(t,dSe(r),vwe(r),kXt(r),ZXt(r))}});var mk,pSe=v(()=>{X5e();Z5e();Q5e();O8e();Mne();ZO();kg();P8e();gu();L8e();Lo();F8e();Sl();NXt();eZt();mk=class extends S2{constructor(...[r]){let n=AXt(r||{});super(n);x(this,"config");this.initConfig=n;let o=V7t(n),i=Wve(o),a=nSe(i),s=Uwe(a),u=s,l=Kwe(u),c=z7t(l),d=QXt(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(Ave(this.config)),this.middlewareStack.use(Lwe(this.config)),this.middlewareStack.use(oSe(this.config)),this.middlewareStack.use(zwe(this.config)),this.middlewareStack.use(Sve(this.config)),this.middlewareStack.use(Cve(this.config)),this.middlewareStack.use(xve(this.config)),this.middlewareStack.use(Tve(this.config,{httpAuthSchemeParametersProvider:U7t,identityProviderConfigProvider:async f=>new oK({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Eve(this.config))}destroy(){super.destroy()}}});var Ky,X8e=v(()=>{Lo();Ky=class t extends dK{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var mSe,hSe,gSe,ySe,bSe,_Se,vSe,wSe,SSe,CSe,xSe,Z8e=v(()=>{X8e();mSe=class t extends Ky{constructor(r){super({name:"InternalErrorException",$fault:"server",...r});x(this,"name","InternalErrorException");x(this,"$fault","server");Object.setPrototypeOf(this,t.prototype)}},hSe=class t extends Ky{constructor(r){super({name:"InvalidParameterException",$fault:"client",...r});x(this,"name","InvalidParameterException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},gSe=class t extends Ky{constructor(r){super({name:"LimitExceededException",$fault:"client",...r});x(this,"name","LimitExceededException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},ySe=class t extends Ky{constructor(r){super({name:"NotAuthorizedException",$fault:"client",...r});x(this,"name","NotAuthorizedException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},bSe=class t extends Ky{constructor(r){super({name:"ResourceConflictException",$fault:"client",...r});x(this,"name","ResourceConflictException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},_Se=class t extends Ky{constructor(r){super({name:"TooManyRequestsException",$fault:"client",...r});x(this,"name","TooManyRequestsException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},vSe=class t extends Ky{constructor(r){super({name:"ResourceNotFoundException",$fault:"client",...r});x(this,"name","ResourceNotFoundException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},wSe=class t extends Ky{constructor(r){super({name:"ExternalServiceException",$fault:"client",...r});x(this,"name","ExternalServiceException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},SSe=class t extends Ky{constructor(r){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...r});x(this,"name","InvalidIdentityPoolConfigurationException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},CSe=class t extends Ky{constructor(r){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...r});x(this,"name","DeveloperUserAlreadyRegisteredException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},xSe=class t extends Ky{constructor(r){super({name:"ConcurrentModificationException",$fault:"client",...r});x(this,"name","ConcurrentModificationException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var tZt,xMn,TMn,OMn,rZt,nZt,EMn,PMn,MMn,RMn,IMn,oZt,AMn,NMn,DMn,jMn,$Mn,LMn,FMn,kMn,qMn,UMn,BMn,zMn,VMn,OSe,HMn,iZt,WMn,JMn,KMn,GMn,XMn,ZMn,YMn,QMn,eRn,tRn,rRn,nRn,oRn,iRn,aRn,sRn,uRn,lRn,cRn,dRn,fRn,pRn,mRn,hRn,gRn,yRn,bRn,Yb,_Rn,vRn,wRn,SRn,CRn,kh,xRn,Y8e,ESe,TRn,ORn,aZt,ERn,wK,PRn,MRn,RRn,IRn,ARn,NRn,DRn,jRn,$Rn,LRn,FRn,kRn,qRn,URn,BRn,zRn,VRn,HRn,WRn,Q8e,JRn,KRn,GRn,XRn,SK,sZt,ZRn,YRn,PSe,uZt,eGe,QRn,eIn,tIn,rIn,lZt,nIn,oIn,iIn,aIn,sIn,uIn,lIn,cIn,cZt,dZt,dIn,fIn,pIn,mIn,hIn,gIn,fZt,yIn,bIn,_In,vIn,wIn,SIn,pZt,CIn,tGe,xIn,TIn,OIn,EIn,PIn,MIn,RIn,IIn,AIn,NIn,DIn,jIn,QO,gx,eE,yx,$In,mZt,tt,LIn,hZt,FIn,kIn,qIn,UIn,BIn,zIn,VIn,HIn,WIn,JIn,KIn,GIn,XIn,ZIn,YIn,QIn,eAn,tAn,rAn,nAn,oAn,iAn,aAn,sAn,gZt,TSe,uAn,lAn,cAn,dAn,fAn,pAn,mAn,hAn,gAn,yAn,bAn,_An,vAn,wAn,SAn,CAn,xAn,TAn,OAn,EAn,PAn,MAn,RAn,IAn,AAn,NAn,DAn,jAn,$An,LAn,FAn,kAn,MSe,qAn,yZt,UAn,BAn,zAn,VAn,$ne,bZt,_Zt,vZt,wZt,SZt,CZt,xZt,TZt,OZt,EZt,PZt,MZt,RZt,IZt,AZt,NZt,DZt,jZt,$Zt,LZt,FZt,kZt,qZt,UZt,Cl=v(()=>{kg();X8e();Z8e();tZt="AllowClassicFlow",xMn="AccountId",TMn="AccessKeyId",OMn="AmbiguousRoleResolution",rZt="AllowUnauthenticatedIdentities",nZt="Credentials",EMn="CreationDate",PMn="ClientId",MMn="CognitoIdentityProvider",RMn="CreateIdentityPoolInput",IMn="CognitoIdentityProviderList",oZt="CognitoIdentityProviders",AMn="CreateIdentityPool",NMn="ConcurrentModificationException",DMn="CustomRoleArn",jMn="Claim",$Mn="DeleteIdentities",LMn="DeleteIdentitiesInput",FMn="DescribeIdentityInput",kMn="DeleteIdentityPool",qMn="DeleteIdentityPoolInput",UMn="DescribeIdentityPoolInput",BMn="DescribeIdentityPool",zMn="DeleteIdentitiesResponse",VMn="DescribeIdentity",OSe="DeveloperProviderName",HMn="DeveloperUserAlreadyRegisteredException",iZt="DeveloperUserIdentifier",WMn="DeveloperUserIdentifierList",JMn="DestinationUserIdentifier",KMn="Expiration",GMn="ErrorCode",XMn="ExternalServiceException",ZMn="GetCredentialsForIdentity",YMn="GetCredentialsForIdentityInput",QMn="GetCredentialsForIdentityResponse",eRn="GetId",tRn="GetIdInput",rRn="GetIdentityPoolRoles",nRn="GetIdentityPoolRolesInput",oRn="GetIdentityPoolRolesResponse",iRn="GetIdResponse",aRn="GetOpenIdToken",sRn="GetOpenIdTokenForDeveloperIdentity",uRn="GetOpenIdTokenForDeveloperIdentityInput",lRn="GetOpenIdTokenForDeveloperIdentityResponse",cRn="GetOpenIdTokenInput",dRn="GetOpenIdTokenResponse",fRn="GetPrincipalTagAttributeMap",pRn="GetPrincipalTagAttributeMapInput",mRn="GetPrincipalTagAttributeMapResponse",hRn="HideDisabled",gRn="Identities",yRn="IdentityDescription",bRn="InternalErrorException",Yb="IdentityId",_Rn="InvalidIdentityPoolConfigurationException",vRn="IdentityIdsToDelete",wRn="IdentitiesList",SRn="IdentityPool",CRn="InvalidParameterException",kh="IdentityPoolId",xRn="IdentityPoolsList",Y8e="IdentityPoolName",ESe="IdentityProviderName",TRn="IdentityPoolShortDescription",ORn="IdentityProviderToken",aZt="IdentityPoolTags",ERn="IdentityPools",wK="Logins",PRn="LookupDeveloperIdentity",MRn="LookupDeveloperIdentityInput",RRn="LookupDeveloperIdentityResponse",IRn="LimitExceededException",ARn="ListIdentities",NRn="ListIdentitiesInput",DRn="ListIdentityPools",jRn="ListIdentityPoolsInput",$Rn="ListIdentityPoolsResponse",LRn="ListIdentitiesResponse",FRn="LoginsMap",kRn="LastModifiedDate",qRn="ListTagsForResource",URn="ListTagsForResourceInput",BRn="ListTagsForResourceResponse",zRn="LoginsToRemove",VRn="MergeDeveloperIdentities",HRn="MergeDeveloperIdentitiesInput",WRn="MergeDeveloperIdentitiesResponse",Q8e="MaxResults",JRn="MappingRulesList",KRn="MappingRule",GRn="MatchType",XRn="NotAuthorizedException",SK="NextToken",sZt="OpenIdConnectProviderARNs",ZRn="OIDCToken",YRn="ProviderName",PSe="PrincipalTags",uZt="Roles",eGe="ResourceArn",QRn="RoleARN",eIn="RulesConfiguration",tIn="ResourceConflictException",rIn="RulesConfigurationType",lZt="RoleMappings",nIn="RoleMappingMap",oIn="RoleMapping",iIn="ResourceNotFoundException",aIn="Rules",sIn="SetIdentityPoolRoles",uIn="SetIdentityPoolRolesInput",lIn="SecretKey",cIn="SecretKeyString",cZt="SupportedLoginProviders",dZt="SamlProviderARNs",dIn="SetPrincipalTagAttributeMap",fIn="SetPrincipalTagAttributeMapInput",pIn="SetPrincipalTagAttributeMapResponse",mIn="ServerSideTokenCheck",hIn="SessionToken",gIn="SourceUserIdentifier",fZt="Token",yIn="TokenDuration",bIn="TagKeys",_In="TooManyRequestsException",vIn="TagResource",wIn="TagResourceInput",SIn="TagResourceResponse",pZt="Tags",CIn="Type",tGe="UseDefaults",xIn="UnlinkDeveloperIdentity",TIn="UnlinkDeveloperIdentityInput",OIn="UnlinkIdentity",EIn="UnprocessedIdentityIds",PIn="UnprocessedIdentityIdList",MIn="UnlinkIdentityInput",RIn="UnprocessedIdentityId",IIn="UpdateIdentityPool",AIn="UntagResource",NIn="UntagResourceInput",DIn="UntagResourceResponse",jIn="Value",QO="client",gx="error",eE="httpError",yx="message",$In="server",mZt="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentity",tt="com.amazonaws.cognitoidentity",LIn=[0,tt,ORn,8,0],hZt=[0,tt,ZRn,8,0],FIn=[0,tt,cIn,8,0],kIn=[3,tt,MMn,0,[YRn,PMn,mIn],[0,0,2]],qIn=[-3,tt,NMn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(qIn,xSe);UIn=[3,tt,RMn,0,[Y8e,rZt,tZt,cZt,OSe,sZt,oZt,dZt,aZt],[0,2,2,128,0,64,()=>yZt,64,128]],BIn=[3,tt,nZt,0,[TMn,lIn,hIn,KMn],[0,[()=>FIn,0],0,4]],zIn=[3,tt,LMn,0,[vRn],[64]],VIn=[3,tt,zMn,0,[EIn],[()=>VAn]],HIn=[3,tt,qMn,0,[kh],[0]],WIn=[3,tt,FMn,0,[Yb],[0]],JIn=[3,tt,UMn,0,[kh],[0]],KIn=[-3,tt,HMn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(KIn,CSe);GIn=[-3,tt,XMn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(GIn,wSe);XIn=[3,tt,YMn,0,[Yb,wK,DMn],[0,[()=>$ne,0],0]],ZIn=[3,tt,QMn,0,[Yb,nZt],[0,[()=>BIn,0]]],YIn=[3,tt,nRn,0,[kh],[0]],QIn=[3,tt,oRn,0,[kh,uZt,lZt],[0,128,()=>bZt]],eAn=[3,tt,tRn,0,[xMn,kh,wK],[0,0,[()=>$ne,0]]],tAn=[3,tt,iRn,0,[Yb],[0]],rAn=[3,tt,uRn,0,[kh,Yb,wK,PSe,yIn],[0,0,[()=>$ne,0],128,1]],nAn=[3,tt,lRn,0,[Yb,fZt],[0,[()=>hZt,0]]],oAn=[3,tt,cRn,0,[Yb,wK],[0,[()=>$ne,0]]],iAn=[3,tt,dRn,0,[Yb,fZt],[0,[()=>hZt,0]]],aAn=[3,tt,pRn,0,[kh,ESe],[0,0]],sAn=[3,tt,mRn,0,[kh,ESe,tGe,PSe],[0,0,2,128]],gZt=[3,tt,yRn,0,[Yb,wK,EMn,kRn],[0,64,4,4]],TSe=[3,tt,SRn,0,[kh,Y8e,rZt,tZt,cZt,OSe,sZt,oZt,dZt,aZt],[0,0,2,2,128,0,64,()=>yZt,64,128]],uAn=[3,tt,TRn,0,[kh,Y8e],[0,0]],lAn=[-3,tt,bRn,{[gx]:$In},[yx],[0]];Vs.for(tt).registerError(lAn,mSe);cAn=[-3,tt,_Rn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(cAn,SSe);dAn=[-3,tt,CRn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(dAn,hSe);fAn=[-3,tt,IRn,{[gx]:QO,[eE]:400},[yx],[0]];Vs.for(tt).registerError(fAn,gSe);pAn=[3,tt,NRn,0,[kh,Q8e,SK,hRn],[0,1,0,2]],mAn=[3,tt,LRn,0,[kh,gRn,SK],[0,()=>UAn,0]],hAn=[3,tt,jRn,0,[Q8e,SK],[1,0]],gAn=[3,tt,$Rn,0,[ERn,SK],[()=>BAn,0]],yAn=[3,tt,URn,0,[eGe],[0]],bAn=[3,tt,BRn,0,[pZt],[128]],_An=[3,tt,MRn,0,[kh,Yb,iZt,Q8e,SK],[0,0,0,1,0]],vAn=[3,tt,RRn,0,[Yb,WMn,SK],[0,64,0]],wAn=[3,tt,KRn,0,[jMn,GRn,jIn,QRn],[0,0,0,0]],SAn=[3,tt,HRn,0,[gIn,JMn,OSe,kh],[0,0,0,0]],CAn=[3,tt,WRn,0,[Yb],[0]],xAn=[-3,tt,XRn,{[gx]:QO,[eE]:403},[yx],[0]];Vs.for(tt).registerError(xAn,ySe);TAn=[-3,tt,tIn,{[gx]:QO,[eE]:409},[yx],[0]];Vs.for(tt).registerError(TAn,bSe);OAn=[-3,tt,iIn,{[gx]:QO,[eE]:404},[yx],[0]];Vs.for(tt).registerError(OAn,vSe);EAn=[3,tt,oIn,0,[CIn,OMn,eIn],[0,0,()=>PAn]],PAn=[3,tt,rIn,0,[aIn],[()=>zAn]],MAn=[3,tt,uIn,0,[kh,uZt,lZt],[0,128,()=>bZt]],RAn=[3,tt,fIn,0,[kh,ESe,tGe,PSe],[0,0,2,128]],IAn=[3,tt,pIn,0,[kh,ESe,tGe,PSe],[0,0,2,128]],AAn=[3,tt,wIn,0,[eGe,pZt],[0,128]],NAn=[3,tt,SIn,0,[],[]],DAn=[-3,tt,_In,{[gx]:QO,[eE]:429},[yx],[0]];Vs.for(tt).registerError(DAn,_Se);jAn=[3,tt,TIn,0,[Yb,kh,OSe,iZt],[0,0,0,0]],$An=[3,tt,MIn,0,[Yb,wK,zRn],[0,[()=>$ne,0],64]],LAn=[3,tt,RIn,0,[Yb,GMn],[0,0]],FAn=[3,tt,NIn,0,[eGe,bIn],[0,64]],kAn=[3,tt,DIn,0,[],[]],MSe="unit",qAn=[-3,mZt,"CognitoIdentityServiceException",0,[],[]];Vs.for(mZt).registerError(qAn,Ky);yZt=[1,tt,IMn,0,()=>kIn],UAn=[1,tt,wRn,0,()=>gZt],BAn=[1,tt,xRn,0,()=>uAn],zAn=[1,tt,JRn,0,()=>wAn],VAn=[1,tt,PIn,0,()=>LAn],$ne=[2,tt,FRn,0,[0,0],[()=>LIn,0]],bZt=[2,tt,nIn,0,0,()=>EAn],_Zt=[9,tt,AMn,0,()=>UIn,()=>TSe],vZt=[9,tt,$Mn,0,()=>zIn,()=>VIn],wZt=[9,tt,kMn,0,()=>HIn,()=>MSe],SZt=[9,tt,VMn,0,()=>WIn,()=>gZt],CZt=[9,tt,BMn,0,()=>JIn,()=>TSe],xZt=[9,tt,ZMn,0,()=>XIn,()=>ZIn],TZt=[9,tt,eRn,0,()=>eAn,()=>tAn],OZt=[9,tt,rRn,0,()=>YIn,()=>QIn],EZt=[9,tt,aRn,0,()=>oAn,()=>iAn],PZt=[9,tt,sRn,0,()=>rAn,()=>nAn],MZt=[9,tt,fRn,0,()=>aAn,()=>sAn],RZt=[9,tt,ARn,0,()=>pAn,()=>mAn],IZt=[9,tt,DRn,0,()=>hAn,()=>gAn],AZt=[9,tt,qRn,0,()=>yAn,()=>bAn],NZt=[9,tt,PRn,0,()=>_An,()=>vAn],DZt=[9,tt,VRn,0,()=>SAn,()=>CAn],jZt=[9,tt,sIn,0,()=>MAn,()=>MSe],$Zt=[9,tt,dIn,0,()=>RAn,()=>IAn],LZt=[9,tt,vIn,0,()=>AAn,()=>NAn],FZt=[9,tt,xIn,0,()=>jAn,()=>MSe],kZt=[9,tt,OIn,0,()=>$An,()=>MSe],qZt=[9,tt,AIn,0,()=>FAn,()=>kAn],UZt=[9,tt,IIn,0,()=>TSe,()=>TSe]});var RSe,rGe=v(()=>{gu();Lo();Sl();Cl();RSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").sc(_Zt).build(){}});var ISe,nGe=v(()=>{gu();Lo();Sl();Cl();ISe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").sc(vZt).build(){}});var ASe,oGe=v(()=>{gu();Lo();Sl();Cl();ASe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").sc(wZt).build(){}});var NSe,iGe=v(()=>{gu();Lo();Sl();Cl();NSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").sc(SZt).build(){}});var DSe,aGe=v(()=>{gu();Lo();Sl();Cl();DSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").sc(CZt).build(){}});var CK,sGe=v(()=>{gu();Lo();Sl();Cl();CK=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").sc(xZt).build(){}});var xK,uGe=v(()=>{gu();Lo();Sl();Cl();xK=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").sc(TZt).build(){}});var jSe,lGe=v(()=>{gu();Lo();Sl();Cl();jSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").sc(OZt).build(){}});var $Se,cGe=v(()=>{gu();Lo();Sl();Cl();$Se=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").sc(EZt).build(){}});var LSe,dGe=v(()=>{gu();Lo();Sl();Cl();LSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").sc(PZt).build(){}});var FSe,fGe=v(()=>{gu();Lo();Sl();Cl();FSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").sc(MZt).build(){}});var kSe,pGe=v(()=>{gu();Lo();Sl();Cl();kSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").sc(RZt).build(){}});var TK,qSe=v(()=>{gu();Lo();Sl();Cl();TK=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").sc(IZt).build(){}});var USe,mGe=v(()=>{gu();Lo();Sl();Cl();USe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").sc(AZt).build(){}});var BSe,hGe=v(()=>{gu();Lo();Sl();Cl();BSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").sc(NZt).build(){}});var zSe,gGe=v(()=>{gu();Lo();Sl();Cl();zSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").sc(DZt).build(){}});var VSe,yGe=v(()=>{gu();Lo();Sl();Cl();VSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").sc(jZt).build(){}});var HSe,bGe=v(()=>{gu();Lo();Sl();Cl();HSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").sc($Zt).build(){}});var WSe,_Ge=v(()=>{gu();Lo();Sl();Cl();WSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").sc(LZt).build(){}});var JSe,vGe=v(()=>{gu();Lo();Sl();Cl();JSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").sc(FZt).build(){}});var KSe,wGe=v(()=>{gu();Lo();Sl();Cl();KSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").sc(kZt).build(){}});var GSe,SGe=v(()=>{gu();Lo();Sl();Cl();GSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").sc(qZt).build(){}});var XSe,CGe=v(()=>{gu();Lo();Sl();Cl();XSe=class extends cn.classBuilder().ep(co).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").sc(UZt).build(){}});var HAn,xGe,BZt=v(()=>{Lo();pSe();rGe();nGe();oGe();iGe();aGe();sGe();uGe();lGe();cGe();dGe();fGe();pGe();qSe();mGe();hGe();gGe();yGe();bGe();_Ge();vGe();wGe();SGe();CGe();HAn={CreateIdentityPoolCommand:RSe,DeleteIdentitiesCommand:ISe,DeleteIdentityPoolCommand:ASe,DescribeIdentityCommand:NSe,DescribeIdentityPoolCommand:DSe,GetCredentialsForIdentityCommand:CK,GetIdCommand:xK,GetIdentityPoolRolesCommand:jSe,GetOpenIdTokenCommand:$Se,GetOpenIdTokenForDeveloperIdentityCommand:LSe,GetPrincipalTagAttributeMapCommand:FSe,ListIdentitiesCommand:kSe,ListIdentityPoolsCommand:TK,ListTagsForResourceCommand:USe,LookupDeveloperIdentityCommand:BSe,MergeDeveloperIdentitiesCommand:zSe,SetIdentityPoolRolesCommand:VSe,SetPrincipalTagAttributeMapCommand:HSe,TagResourceCommand:WSe,UnlinkDeveloperIdentityCommand:JSe,UnlinkIdentityCommand:KSe,UntagResourceCommand:GSe,UpdateIdentityPoolCommand:XSe},xGe=class extends mk{};ywe(HAn,xGe)});var zZt=v(()=>{rGe();nGe();oGe();iGe();aGe();sGe();uGe();lGe();cGe();dGe();fGe();pGe();qSe();mGe();hGe();gGe();yGe();bGe();_Ge();vGe();wGe();SGe();CGe()});var VZt=v(()=>{});var mga,HZt=v(()=>{ZO();pSe();qSe();mga=oKe(mk,TK,"NextToken","NextToken","MaxResults")});var WZt=v(()=>{VZt();HZt()});var JZt=v(()=>{});var KZt=v(()=>{});var GZt=v(()=>{pSe();BZt();zZt();Cl();WZt();JZt();Z8e();KZt()});var TGe={};En(TGe,{CognitoIdentityClient:()=>mk,GetCredentialsForIdentityCommand:()=>CK,GetIdCommand:()=>xK});var OGe=v(()=>{GZt()});function ZSe(t){return async e=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:r,CognitoIdentityClient:n}=await Promise.resolve().then(()=>(OGe(),TGe)),o=l=>t.clientConfig?.[l]??t.parentClientConfig?.[l]??e?.callerClientConfig?.[l],{Credentials:{AccessKeyId:i=WAn(t.logger),Expiration:a,SecretKey:s=KAn(t.logger),SessionToken:u}=JAn(t.logger)}=await(t.client??new n(Object.assign({},t.clientConfig??{},{region:o("region"),profile:o("profile"),userAgentAppId:o("userAgentAppId")}))).send(new r({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await vve(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:i,secretAccessKey:s,sessionToken:u,expiration:a}}}function WAn(t){throw new Lm("Response from Amazon Cognito contained no access key ID",{logger:t})}function JAn(t){throw new Lm("Response from Amazon Cognito contained no credentials",{logger:t})}function KAn(t){throw new Lm("Response from Amazon Cognito contained no secret key",{logger:t})}var EGe=v(()=>{QF();G5e()});var PGe,YSe,XZt=v(()=>{PGe="IdentityIds",YSe=class{constructor(e="aws:cognito-identity-ids"){x(this,"dbName");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(PGe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(PGe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(PGe)))}).catch(i=>{throw n.close(),i})})}}});var QSe,ZZt=v(()=>{QSe=class{constructor(e={}){x(this,"store");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 YZt(){return typeof self=="object"&&self.indexedDB?new YSe:typeof window=="object"&&window.localStorage?window.localStorage:GAn}var GAn,QZt=v(()=>{XZt();ZZt();GAn=new QSe});function eYt({accountId:t,cache:e=YZt(),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 f=>{let{GetIdCommand:p,CognitoIdentityClient:m}=await Promise.resolve().then(()=>(OGe(),TGe)),h=b=>n?.[b]??l?.[b]??f?.callerClientConfig?.[b],y=r??new m(Object.assign({},n??{},{region:h("region"),profile:h("profile"),userAgentAppId:h("userAgentAppId")})),g=c&&await e.getItem(c);if(!g){let{IdentityId:b=XAn(u)}=await y.send(new p({AccountId:t,IdentityPoolId:i,Logins:a?await vve(a):void 0}));g=b,c&&Promise.resolve(e.setItem(c,g)).catch(()=>{})}return d=ZSe({client:y,customRoleArn:o,logins:a,identityId:g}),d(f)};return f=>d(f).catch(async p=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),p})}function XAn(t){throw new Lm("Response from Amazon Cognito contained no identity ID",{logger:t})}var tYt=v(()=>{QF();EGe();QZt();G5e()});var MGe=v(()=>{oWt();iWt();aWt();EGe();tYt()});var ZAn,rYt=v(()=>{MGe();ZAn=t=>ZSe({...t})});var YAn,nYt=v(()=>{MGe();YAn=t=>eYt({...t})});var QAn,eNn,tNn,oYt,iYt=v(()=>{QF();QAn="169.254.170.2",eNn="169.254.170.23",tNn="[fd00:ec2::23]",oYt=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===QAn||t.hostname===eNn||t.hostname===tNn)){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 Lm(`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 aYt=v(()=>{});var sYt=v(()=>{aYt()});var uYt=v(()=>{});var lYt=v(()=>{});var cYt=v(()=>{});function rNn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var e0e,dYt=v(()=>{e0e=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=rNn(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 fYt=v(()=>{});var pYt=v(()=>{});var mYt=v(()=>{});var hYt=v(()=>{sYt();uYt();lYt();cYt();dYt();fYt();pYt();mYt()});function gYt(t){return new e0e({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 yYt(t,e){let n=await H6t(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 Lm("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:CJt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Lm(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Lm(`Server responded with status: ${t.statusCode}`,{logger:e})}var bYt=v(()=>{QF();hYt();Lo();fKe()});var _Yt,vYt=v(()=>{_Yt=(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 RGe,wYt=v(()=>{yne();QF();iYt();bYt();vYt();RGe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Lm("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);oYt(n,t.logger);let o=new rk;return _Yt(async()=>{let i=gYt(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return yYt(a.response)},t.maxRetries??3,t.timeout??1e3)}});var SYt=v(()=>{wYt()});function nNn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function oNn(t){return{schemeId:"smithy.api#noAuth"}}var Lne,CYt,xYt,iNn,TYt,IGe=v(()=>{hK();Lne=$(r0());Fne();CYt=async(t,e,r)=>({operation:(0,Lne.getSmithyContext)(e).operation,region:await(0,Lne.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});xYt=t=>{let e=[];switch(t.operation){case"AssumeRoleWithWebIdentity":{e.push(oNn(t));break}default:e.push(nNn(t))}return e},iNn=t=>Object.assign(t,{stsClientCtor:l0}),TYt=t=>{let e=iNn(t),r=mwe(e);return Object.assign(r,{authSchemePreference:(0,Lne.normalizeProvider)(t.authSchemePreference??[])})}});var OYt,t0e,r0e=v(()=>{OYt=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),t0e={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 PYt,EYt=v(()=>{PYt={name:"@aws-sdk/nested-clients",version:"3.968.0",description:"Nested clients for AWS SDK packages.",main:"./dist-cjs/index.js",module:"./dist-es/index.js",types:"./dist-types/index.d.ts",scripts:{build:"yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo",lint:"node ../../scripts/validation/submodules-linter.js --pkg nested-clients",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},engines:{node:">=20.0.0"},sideEffects:!1,author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.968.0","@aws-sdk/middleware-host-header":"3.968.0","@aws-sdk/middleware-logger":"3.968.0","@aws-sdk/middleware-recursion-detection":"3.968.0","@aws-sdk/middleware-user-agent":"3.968.0","@aws-sdk/region-config-resolver":"3.968.0","@aws-sdk/types":"3.968.0","@aws-sdk/util-endpoints":"3.968.0","@aws-sdk/util-user-agent-browser":"3.968.0","@aws-sdk/util-user-agent-node":"3.968.0","@smithy/config-resolver":"^4.4.5","@smithy/core":"^3.20.3","@smithy/fetch-http-handler":"^5.3.8","@smithy/hash-node":"^4.2.7","@smithy/invalid-dependency":"^4.2.7","@smithy/middleware-content-length":"^4.2.7","@smithy/middleware-endpoint":"^4.4.4","@smithy/middleware-retry":"^4.4.20","@smithy/middleware-serde":"^4.2.8","@smithy/middleware-stack":"^4.2.7","@smithy/node-config-provider":"^4.3.7","@smithy/node-http-handler":"^4.4.7","@smithy/protocol-http":"^5.3.7","@smithy/smithy-client":"^4.10.5","@smithy/types":"^4.11.0","@smithy/url-parser":"^4.2.7","@smithy/util-base64":"^4.3.0","@smithy/util-body-length-browser":"^4.2.0","@smithy/util-body-length-node":"^4.2.1","@smithy/util-defaults-mode-browser":"^4.3.19","@smithy/util-defaults-mode-node":"^4.2.22","@smithy/util-endpoints":"^3.2.7","@smithy/util-middleware":"^4.2.7","@smithy/util-retry":"^4.2.7","@smithy/util-utf8":"^4.2.0",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"5.0.10",typescript:"~5.8.3"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sts.d.ts","./sts.js","dist-*/**"],browser:{"./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"}}}});var MYt,RYt=v(()=>{MYt=t=>new TextEncoder().encode(t)});var IYt=v(()=>{});var AYt,NYt=v(()=>{AYt=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 DYt=v(()=>{RYt();IYt();NYt()});var HYt,li,us,ls,gk,hk,qg,WYt,JYt,KYt,Wl,jYt,tE,OK,NGe,$Yt,AGe,GYt,LYt,Ug,FYt,XYt,ZYt,Gy,xw,kYt,YYt,QYt,qYt,eQt,UYt,BYt,zYt,VYt,sNn,tQt,rQt=v(()=>{HYt="required",li="type",us="fn",ls="argv",gk="ref",hk="booleanEquals",qg="stringEquals",WYt="sigv4",JYt="sts",KYt="us-east-1",Wl="endpoint",jYt="https://sts.{Region}.{PartitionResult#dnsSuffix}",tE="tree",OK="error",NGe="getAttr",$Yt={[HYt]:!1,[li]:"string"},AGe={[HYt]:!0,default:!1,[li]:"boolean"},GYt={[gk]:"Endpoint"},LYt={[us]:"isSet",[ls]:[{[gk]:"Region"}]},Ug={[gk]:"Region"},FYt={[us]:"aws.partition",[ls]:[Ug],assign:"PartitionResult"},XYt={[gk]:"UseFIPS"},ZYt={[gk]:"UseDualStack"},Gy={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:WYt,signingName:JYt,signingRegion:KYt}]},headers:{}},xw={},kYt={conditions:[{[us]:qg,[ls]:[Ug,"aws-global"]}],[Wl]:Gy,[li]:Wl},YYt={[us]:hk,[ls]:[XYt,!0]},QYt={[us]:hk,[ls]:[ZYt,!0]},qYt={[us]:NGe,[ls]:[{[gk]:"PartitionResult"},"supportsFIPS"]},eQt={[gk]:"PartitionResult"},UYt={[us]:hk,[ls]:[!0,{[us]:NGe,[ls]:[eQt,"supportsDualStack"]}]},BYt=[{[us]:"isSet",[ls]:[GYt]}],zYt=[YYt],VYt=[QYt],sNn={version:"1.0",parameters:{Region:$Yt,UseDualStack:AGe,UseFIPS:AGe,Endpoint:$Yt,UseGlobalEndpoint:AGe},rules:[{conditions:[{[us]:hk,[ls]:[{[gk]:"UseGlobalEndpoint"},!0]},{[us]:"not",[ls]:BYt},LYt,FYt,{[us]:hk,[ls]:[XYt,!1]},{[us]:hk,[ls]:[ZYt,!1]}],rules:[{conditions:[{[us]:qg,[ls]:[Ug,"ap-northeast-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"ap-south-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"ap-southeast-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"ap-southeast-2"]}],endpoint:Gy,[li]:Wl},kYt,{conditions:[{[us]:qg,[ls]:[Ug,"ca-central-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"eu-central-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"eu-north-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"eu-west-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"eu-west-2"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"eu-west-3"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"sa-east-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,KYt]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"us-east-2"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"us-west-1"]}],endpoint:Gy,[li]:Wl},{conditions:[{[us]:qg,[ls]:[Ug,"us-west-2"]}],endpoint:Gy,[li]:Wl},{endpoint:{url:jYt,properties:{authSchemes:[{name:WYt,signingName:JYt,signingRegion:"{Region}"}]},headers:xw},[li]:Wl}],[li]:tE},{conditions:BYt,rules:[{conditions:zYt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[li]:OK},{conditions:VYt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[li]:OK},{endpoint:{url:GYt,properties:xw,headers:xw},[li]:Wl}],[li]:tE},{conditions:[LYt],rules:[{conditions:[FYt],rules:[{conditions:[YYt,QYt],rules:[{conditions:[{[us]:hk,[ls]:[!0,qYt]},UYt],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:xw,headers:xw},[li]:Wl}],[li]:tE},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[li]:OK}],[li]:tE},{conditions:zYt,rules:[{conditions:[{[us]:hk,[ls]:[qYt,!0]}],rules:[{conditions:[{[us]:qg,[ls]:[{[us]:NGe,[ls]:[eQt,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:xw,headers:xw},[li]:Wl},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:xw,headers:xw},[li]:Wl}],[li]:tE},{error:"FIPS is enabled but this partition does not support FIPS",[li]:OK}],[li]:tE},{conditions:VYt,rules:[{conditions:[UYt],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:xw,headers:xw},[li]:Wl}],[li]:tE},{error:"DualStack is enabled but this partition does not support DualStack",[li]:OK}],[li]:tE},kYt,{endpoint:{url:jYt,properties:xw,headers:xw},[li]:Wl}],[li]:tE}],[li]:tE},{error:"Invalid Configuration: Missing Region",[li]:OK}]},tQt=sNn});var uNn,nQt,oQt=v(()=>{twe();_2();rQt();uNn=new aK({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),nQt=(t,e={})=>uNn.get(t,()=>Qve(tQt,{endpointParams:t,logger:e.logger}));F1.aws=Cne});var iQt,aQt=v(()=>{hK();Nwe();ZO();Lo();ewe();KO();DYt();IGe();oQt();iQt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Sw,base64Encoder:t?.base64Encoder??Cw,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??nQt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??xYt,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new v2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new iK}],logger:t?.logger??new pk,protocol:t?.protocol??Awe,protocolSettings:t?.protocolSettings??{defaultNamespace:"com.amazonaws.sts",xmlNamespace:"https://sts.amazonaws.com/doc/2011-06-15/",version:"2011-06-15",serviceTarget:"AWSSecurityTokenServiceV20110615"},serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??uk,utf8Decoder:t?.utf8Decoder??MYt,utf8Encoder:t?.utf8Encoder??AYt})});var sQt,uQt=v(()=>{EYt();V8e();H8e();Mne();yne();W8e();Lo();s8e();J8e();Ine();aQt();sQt=t=>{let e=lSe(t),r=()=>e().then(bwe),n=iQt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??hwe,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??sSe({serviceId:n.serviceId,clientVersion:PYt.version}),maxAttempts:t?.maxAttempts??B1,region:t?.region??uSe("Region is missing"),requestHandler:rk.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Rne),sha256:t?.sha256??aSe,streamCollector:t?.streamCollector??Q5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Fwe)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(kwe))}}});var lQt,cQt,dQt=v(()=>{lQt=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),cQt=t=>({httpHandler:t.httpHandler()})});var fQt=v(()=>{dQt()});var pQt=v(()=>{});var mQt=v(()=>{});var hQt=v(()=>{});var gQt=v(()=>{});var yQt=v(()=>{});var bQt=v(()=>{});var _Qt=v(()=>{});var vQt=v(()=>{fQt();pQt();mQt();hQt();gQt();yQt();bQt();_Qt()});var wQt,SQt,CQt=v(()=>{wQt=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}}},SQt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var xQt,TQt=v(()=>{fSe();vQt();Lo();CQt();xQt=(t,e)=>{let r=Object.assign(cSe(t),_we(t),lQt(t),wQt(t));return e.forEach(n=>n.configure(r)),Object.assign(t,dSe(r),vwe(r),cQt(r),SQt(r))}});var l0,Fne=v(()=>{X5e();Z5e();Q5e();O8e();Mne();ZO();kg();P8e();gu();L8e();Lo();IGe();r0e();uQt();TQt();l0=class extends S2{constructor(...[r]){let n=sQt(r||{});super(n);x(this,"config");this.initConfig=n;let o=OYt(n),i=Wve(o),a=nSe(i),s=Uwe(a),u=s,l=Kwe(u),c=TYt(l),d=xQt(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(Ave(this.config)),this.middlewareStack.use(Lwe(this.config)),this.middlewareStack.use(oSe(this.config)),this.middlewareStack.use(zwe(this.config)),this.middlewareStack.use(Sve(this.config)),this.middlewareStack.use(Cve(this.config)),this.middlewareStack.use(xve(this.config)),this.middlewareStack.use(Tve(this.config,{httpAuthSchemeParametersProvider:CYt,identityProviderConfigProvider:async f=>new oK({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Eve(this.config))}destroy(){super.destroy()}}});var X_,n0e=v(()=>{Lo();X_=class t extends dK{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var kne,qne,Une,Bne,zne,Vne,Hne,DGe=v(()=>{n0e();kne=class t extends X_{constructor(r){super({name:"ExpiredTokenException",$fault:"client",...r});x(this,"name","ExpiredTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},qne=class t extends X_{constructor(r){super({name:"MalformedPolicyDocumentException",$fault:"client",...r});x(this,"name","MalformedPolicyDocumentException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Une=class t extends X_{constructor(r){super({name:"PackedPolicyTooLargeException",$fault:"client",...r});x(this,"name","PackedPolicyTooLargeException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Bne=class t extends X_{constructor(r){super({name:"RegionDisabledException",$fault:"client",...r});x(this,"name","RegionDisabledException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},zne=class t extends X_{constructor(r){super({name:"IDPRejectedClaimException",$fault:"client",...r});x(this,"name","IDPRejectedClaimException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Vne=class t extends X_{constructor(r){super({name:"InvalidIdentityTokenException",$fault:"client",...r});x(this,"name","InvalidIdentityTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Hne=class t extends X_{constructor(r){super({name:"IDPCommunicationErrorException",$fault:"client",...r});x(this,"name","IDPCommunicationErrorException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var lNn,cNn,dNn,fNn,pNn,mNn,jGe,hNn,gNn,yNn,bNn,$Ge,_Nn,OQt,vNn,wNn,SNn,CNn,xNn,TNn,ONn,ENn,EQt,PQt,PNn,MNn,RNn,INn,ANn,NNn,MQt,DNn,jNn,RQt,$Nn,IQt,LNn,FNn,LGe,kNn,qNn,UNn,BNn,zNn,VNn,HNn,WNn,JNn,KNn,C2,x2,GNn,T2,O2,E2,XNn,AQt,ZNn,Ys,YNn,QNn,FGe,NQt,DQt,jQt,$Qt,kGe,LQt,FQt,kQt,qQt,UQt,BQt,zQt,VQt,HQt,WQt,JQt,KQt,e1n,t1n,qGe,UGe,o0e=v(()=>{kg();DGe();n0e();lNn="Arn",cNn="AccessKeyId",dNn="AssumeRole",fNn="AssumedRoleId",pNn="AssumeRoleRequest",mNn="AssumeRoleResponse",jGe="AssumedRoleUser",hNn="AssumeRoleWithWebIdentity",gNn="AssumeRoleWithWebIdentityRequest",yNn="AssumeRoleWithWebIdentityResponse",bNn="Audience",$Ge="Credentials",_Nn="ContextAssertion",OQt="DurationSeconds",vNn="Expiration",wNn="ExternalId",SNn="ExpiredTokenException",CNn="IDPCommunicationErrorException",xNn="IDPRejectedClaimException",TNn="InvalidIdentityTokenException",ONn="Key",ENn="MalformedPolicyDocumentException",EQt="Policy",PQt="PolicyArns",PNn="ProviderArn",MNn="ProvidedContexts",RNn="ProvidedContextsListType",INn="ProvidedContext",ANn="PolicyDescriptorType",NNn="ProviderId",MQt="PackedPolicySize",DNn="PackedPolicyTooLargeException",jNn="Provider",RQt="RoleArn",$Nn="RegionDisabledException",IQt="RoleSessionName",LNn="SecretAccessKey",FNn="SubjectFromWebIdentityToken",LGe="SourceIdentity",kNn="SerialNumber",qNn="SessionToken",UNn="Tags",BNn="TokenCode",zNn="TransitiveTagKeys",VNn="Tag",HNn="Value",WNn="WebIdentityToken",JNn="arn",KNn="accessKeySecretType",C2="awsQueryError",x2="client",GNn="clientTokenType",T2="error",O2="httpError",E2="message",XNn="policyDescriptorListType",AQt="smithy.ts.sdk.synthetic.com.amazonaws.sts",ZNn="tagListType",Ys="com.amazonaws.sts",YNn=[0,Ys,KNn,8,0],QNn=[0,Ys,GNn,8,0],FGe=[3,Ys,jGe,0,[fNn,lNn],[0,0]],NQt=[3,Ys,pNn,0,[RQt,IQt,PQt,EQt,OQt,UNn,zNn,wNn,kNn,BNn,LGe,MNn],[0,0,()=>KQt,0,1,()=>t1n,64,0,0,0,0,()=>e1n]],DQt=[3,Ys,mNn,0,[$Ge,jGe,MQt,LGe],[[()=>kGe,0],()=>FGe,1,0]],jQt=[3,Ys,gNn,0,[RQt,IQt,WNn,NNn,PQt,EQt,OQt],[0,0,[()=>QNn,0],0,()=>KQt,0,1]],$Qt=[3,Ys,yNn,0,[$Ge,FNn,jGe,MQt,jNn,bNn,LGe],[[()=>kGe,0],0,()=>FGe,1,0,0,0]],kGe=[3,Ys,$Ge,0,[cNn,LNn,qNn,vNn],[0,[()=>YNn,0],0,4]],LQt=[-3,Ys,SNn,{[C2]:["ExpiredTokenException",400],[T2]:x2,[O2]:400},[E2],[0]];Vs.for(Ys).registerError(LQt,kne);FQt=[-3,Ys,CNn,{[C2]:["IDPCommunicationError",400],[T2]:x2,[O2]:400},[E2],[0]];Vs.for(Ys).registerError(FQt,Hne);kQt=[-3,Ys,xNn,{[C2]:["IDPRejectedClaim",403],[T2]:x2,[O2]:403},[E2],[0]];Vs.for(Ys).registerError(kQt,zne);qQt=[-3,Ys,TNn,{[C2]:["InvalidIdentityToken",400],[T2]:x2,[O2]:400},[E2],[0]];Vs.for(Ys).registerError(qQt,Vne);UQt=[-3,Ys,ENn,{[C2]:["MalformedPolicyDocument",400],[T2]:x2,[O2]:400},[E2],[0]];Vs.for(Ys).registerError(UQt,qne);BQt=[-3,Ys,DNn,{[C2]:["PackedPolicyTooLarge",400],[T2]:x2,[O2]:400},[E2],[0]];Vs.for(Ys).registerError(BQt,Une);zQt=[3,Ys,ANn,0,[JNn],[0]],VQt=[3,Ys,INn,0,[PNn,_Nn],[0,0]],HQt=[-3,Ys,$Nn,{[C2]:["RegionDisabledException",403],[T2]:x2,[O2]:403},[E2],[0]];Vs.for(Ys).registerError(HQt,Bne);WQt=[3,Ys,VNn,0,[ONn,HNn],[0,0]],JQt=[-3,AQt,"STSServiceException",0,[],[]];Vs.for(AQt).registerError(JQt,X_);KQt=[1,Ys,XNn,0,()=>zQt],e1n=[1,Ys,RNn,0,()=>VQt],t1n=[1,Ys,ZNn,0,()=>WQt],qGe=[9,Ys,dNn,0,()=>NQt,()=>DQt],UGe=[9,Ys,hNn,0,()=>jQt,()=>$Qt]});var V1,i0e=v(()=>{gu();Lo();r0e();o0e();V1=class extends cn.classBuilder().ep(t0e).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(qGe).build(){}});var P2,a0e=v(()=>{gu();Lo();r0e();o0e();P2=class extends cn.classBuilder().ep(t0e).m(function(e,r,n,o){return[Nn(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(UGe).build(){}});var r1n,s0e,GQt=v(()=>{Lo();i0e();a0e();Fne();r1n={AssumeRoleCommand:V1,AssumeRoleWithWebIdentityCommand:P2},s0e=class extends l0{};ywe(r1n,s0e)});var XQt=v(()=>{i0e();a0e()});var ZQt=v(()=>{});var YQt,QQt,eer,ter,rer,ner=v(()=>{nwe();fSe();i0e();a0e();YQt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},QQt=async(t,e,r,n={})=>{let o=typeof t=="function"?await t():t,i=typeof e=="function"?await e():e,a="",s=o??i??(a=await $Xt(n)());return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${o} (credential provider clientConfig)`,`${i} (contextual client)`,`${a} (STS default: AWS_REGION, profile region, or us-east-1)`),s},eer=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:c=t?.parentClientConfig?.logger,profile:d=t?.parentClientConfig?.profile,region:f,requestHandler:p=t?.parentClientConfig?.requestHandler,credentialProviderLogger:m,userAgentAppId:h=t?.parentClientConfig?.userAgentAppId}=t,y=await QQt(f,t?.parentClientConfig?.region,m,{logger:c,profile:d}),g=!rer(p);r=new e({...t,userAgentAppId:h,profile:d,credentialDefaultProvider:()=>async()=>n,region:y,requestHandler:g?p:void 0,logger:c})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new V1(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=YQt(s),l={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}};return uK(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}},ter=(t,e)=>{let r;return async n=>{if(!r){let{logger:u=t?.parentClientConfig?.logger,profile:l=t?.parentClientConfig?.profile,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f,userAgentAppId:p=t?.parentClientConfig?.userAgentAppId}=t,m=await QQt(c,t?.parentClientConfig?.region,f,{logger:u,profile:l}),h=!rer(d);r=new e({...t,userAgentAppId:p,profile:l,region:m,requestHandler:h?d:void 0,logger:u})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new P2(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=YQt(i),s={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};return a&&uK(s,"RESOLVED_ACCOUNT_ID","T"),uK(s,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),s}},rer=t=>t?.metadata?.handlerProtocol==="h2"});var oer,ier,aer,n1n,ser=v(()=>{ner();Fne();oer=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,ier=(t={},e)=>eer(t,oer(l0,e)),aer=(t={},e)=>ter(t,oer(l0,e)),n1n=t=>e=>t({roleAssumer:ier(e),roleAssumerWithWebIdentity:aer(e),...e})});var uer={};En(uer,{$Command:()=>cn,AssumeRole$:()=>qGe,AssumeRoleCommand:()=>V1,AssumeRoleRequest$:()=>NQt,AssumeRoleResponse$:()=>DQt,AssumeRoleWithWebIdentity$:()=>UGe,AssumeRoleWithWebIdentityCommand:()=>P2,AssumeRoleWithWebIdentityRequest$:()=>jQt,AssumeRoleWithWebIdentityResponse$:()=>$Qt,AssumedRoleUser$:()=>FGe,Credentials$:()=>kGe,ExpiredTokenException:()=>kne,ExpiredTokenException$:()=>LQt,IDPCommunicationErrorException:()=>Hne,IDPCommunicationErrorException$:()=>FQt,IDPRejectedClaimException:()=>zne,IDPRejectedClaimException$:()=>kQt,InvalidIdentityTokenException:()=>Vne,InvalidIdentityTokenException$:()=>qQt,MalformedPolicyDocumentException:()=>qne,MalformedPolicyDocumentException$:()=>UQt,PackedPolicyTooLargeException:()=>Une,PackedPolicyTooLargeException$:()=>BQt,PolicyDescriptorType$:()=>zQt,ProvidedContext$:()=>VQt,RegionDisabledException:()=>Bne,RegionDisabledException$:()=>HQt,STS:()=>s0e,STSClient:()=>l0,STSServiceException:()=>X_,STSServiceException$:()=>JQt,Tag$:()=>WQt,__Client:()=>S2,decorateDefaultCredentialProvider:()=>n1n,getDefaultRoleAssumer:()=>ier,getDefaultRoleAssumerWithWebIdentity:()=>aer});var BGe=v(()=>{Fne();GQt();XQt();o0e();DGe();ZQt();ser();n0e()});var ler={};En(ler,{AssumeRoleCommand:()=>V1,STSClient:()=>l0});var cer=v(()=>{BGe()});var o1n,fer,der,u0e,per=v(()=>{ZO();QF();o1n="us-east-1",fer=(t,e,r)=>{let n;return async(o={})=>{let{callerClientConfig:i}=o,a=t.clientConfig?.profile??i?.profile,s=t.logger??i?.logger;s?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let u={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(u?.SerialNumber){if(!t.mfaCodeProvider)throw new Lm("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:s});u.TokenCode=await t.mfaCodeProvider(u?.SerialNumber)}let{AssumeRoleCommand:l,STSClient:c}=await Promise.resolve().then(()=>(cer(),ler));if(!n){let f=typeof e=="function"?e():void 0,p=[t.masterCredentials,t.clientConfig?.credentials,void i?.credentials,i?.credentialDefaultProvider?.(),f],m="STS client default credentials";if(p[0])m="options.masterCredentials";else if(p[1])m="options.clientConfig.credentials";else{if(p[2])throw m="caller client's credentials",new Error("fromTemporaryCredentials recursion in callerClientConfig.credentials");p[3]?m="caller client's credentialDefaultProvider":p[4]&&(m="AWS SDK default credentials")}let h=[t.clientConfig?.region,i?.region,await r?.({profile:a}),o1n],y="default partition's default region";h[0]?y="options.clientConfig.region":h[1]?y="caller client's region":h[2]&&(y="file or env region");let g=[der(t.clientConfig?.requestHandler),der(i?.requestHandler)],b="STS default requestHandler";g[0]?b="options.clientConfig.requestHandler":g[1]&&(b="caller client's requestHandler"),s?.debug?.(`@aws-sdk/credential-providers - fromTemporaryCredentials STS client init with ${y}=${await j1(u0e(h))()}, ${m}, ${b}.`),n=new c({userAgentAppId:i?.userAgentAppId,...t.clientConfig,credentials:u0e(p),logger:s,profile:a,region:u0e(h),requestHandler:u0e(g)})}if(t.clientPlugins)for(let f of t.clientPlugins)n.middlewareStack.use(f);let{Credentials:d}=await n.send(new l(u));if(!d||!d.AccessKeyId||!d.SecretAccessKey)throw new Lm(`Invalid response from STS.assumeRole call with role ${u.RoleArn}`,{logger:s});return{accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,sessionToken:d.SessionToken,expiration:d.Expiration,credentialScope:d.CredentialScope}}},der=t=>t?.metadata?.handlerProtocol==="h2"?void 0:t,u0e=t=>{for(let e of t)if(e!==void 0)return e}});var mer=v(()=>{per()});var her=v(()=>{});var ger,yer=v(()=>{ger=t=>async e=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:r,roleSessionName:n,webIdentityToken:o,providerId:i,policyArns:a,policy:s,durationSeconds:u}=t,{roleAssumerWithWebIdentity:l}=t;if(!l){let{getDefaultRoleAssumerWithWebIdentity:c}=await Promise.resolve().then(()=>(BGe(),uer));l=c({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...e?.callerClientConfig,...t.parentClientConfig}},t.clientPlugins)}return l({RoleArn:r,RoleSessionName:n??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:o,ProviderId:i,PolicyArns:a,Policy:s,DurationSeconds:u})}});var ber=v(()=>{her();yer()});var i1n,_er=v(()=>{ber();i1n=t=>ger({...t})});var ver={};En(ver,{fromCognitoIdentity:()=>ZAn,fromCognitoIdentityPool:()=>YAn,fromHttp:()=>RGe,fromTemporaryCredentials:()=>fer,fromWebToken:()=>i1n});var wer=v(()=>{rYt();nYt();SYt();mer();_er()});var JGe=S(yk=>{"use strict";var a1n=X5(),s1n=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),u1n=t=>({httpHandler:t.httpHandler()}),zGe=class{constructor({name:e,kind:r=a1n.FieldPosition.HEADER,values:n=[]}){x(this,"name");x(this,"kind");x(this,"values");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}},VGe=class{constructor({fields:e=[],encoding:r="utf-8"}){x(this,"entries",{});x(this,"encoding");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)}},HGe=class t{constructor(e){x(this,"method");x(this,"protocol");x(this,"hostname");x(this,"port");x(this,"path");x(this,"query");x(this,"headers");x(this,"username");x(this,"password");x(this,"fragment");x(this,"body");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=l1n(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)}};function l1n(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var WGe=class{constructor(e){x(this,"statusCode");x(this,"reason");x(this,"headers");x(this,"body");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"}};function c1n(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}yk.Field=zGe;yk.Fields=VGe;yk.HttpRequest=HGe;yk.HttpResponse=WGe;yk.getHttpHandlerExtensionConfiguration=s1n;yk.isValidHostname=c1n;yk.resolveHttpHandlerRuntimeConfig=u1n});var Cer=S(GGe=>{"use strict";var Ser={},KGe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),Ser[t]=e,KGe[e]=t}function d1n(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 KGe)e[r/2]=KGe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function f1n(t){let e="";for(let r=0;r<t.byteLength;r++)e+=Ser[t[r]];return e}GGe.fromHex=d1n;GGe.toHex=f1n});var Ter=S(xer=>{"use strict";var p1n=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";xer.isArrayBuffer=p1n});var Oer=S(ZGe=>{"use strict";var m1n=Ter(),XGe=zS(),h1n=(t,e=0,r=t.byteLength-e)=>{if(!m1n.isArrayBuffer(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return XGe.Buffer.from(t,e,r)},g1n=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?XGe.Buffer.from(t,e):XGe.Buffer.from(t)};ZGe.fromArrayBuffer=h1n;ZGe.fromString=g1n});var Mer=S(l0e=>{"use strict";var Eer=Oer(),Per=t=>{let e=Eer.fromString(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},y1n=t=>typeof t=="string"?Per(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),b1n=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 Eer.fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};l0e.fromUtf8=Per;l0e.toUint8Array=y1n;l0e.toUtf8=b1n});var Ier=S(Rer=>{"use strict";var _1n=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";Rer.isArrayBuffer=_1n});var ttr=S(hi=>{"use strict";var bk=Cer(),M2=Mer(),v1n=Ier(),jer=JGe(),Aer=r0(),c0e=gne(),$er="X-Amz-Algorithm",Ler="X-Amz-Credential",n9e="X-Amz-Date",Fer="X-Amz-SignedHeaders",ker="X-Amz-Expires",o9e="X-Amz-Signature",i9e="X-Amz-Security-Token",w1n="X-Amz-Region-Set",a9e="authorization",s9e=n9e.toLowerCase(),qer="date",Uer=[a9e,s9e,qer],Ber=o9e.toLowerCase(),h0e="x-amz-content-sha256",zer=i9e.toLowerCase(),S1n="host",Ver={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},Her=/^proxy-/,Wer=/^sec-/,C1n=[/^proxy-/i,/^sec-/i],d0e="AWS4-HMAC-SHA256",x1n="AWS4-ECDSA-P256-SHA256",Jer="AWS4-HMAC-SHA256-PAYLOAD",Ker="UNSIGNED-PAYLOAD",Ger=50,u9e="aws4_request",Xer=60*60*24*7,EK={},f0e=[],p0e=(t,e,r)=>`${t}/${e}/${r}/${u9e}`,Zer=async(t,e,r,n,o)=>{let i=await Ner(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${bk.toHex(i)}:${e.sessionToken}`;if(a in EK)return EK[a];for(f0e.push(a);f0e.length>Ger;)delete EK[f0e.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,u9e])s=await Ner(t,s,u);return EK[a]=s},T1n=()=>{f0e.length=0,Object.keys(EK).forEach(t=>{delete EK[t]})},Ner=(t,e,r)=>{let n=new t(e);return n.update(M2.toUint8Array(r)),n.digest()},YGe=({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 Ver||e?.has(i)||Her.test(i)||Wer.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n},m0e=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===h0e)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||v1n.isArrayBuffer(e)){let n=new r;return n.update(M2.toUint8Array(e)),bk.toHex(await n.digest())}return Ker},QGe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=M2.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=M2.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(e9e.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!O1n.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(bk.fromHex(e.value.replace(/\-/g,"")),1),d}}},O1n=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,e9e=class t{constructor(e){x(this,"bytes");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&&Der(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&Der(e),parseInt(bk.toHex(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function Der(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var Yer=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},Qer=(t,e={})=>{let{headers:r,query:n={}}=jer.HttpRequest.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();(i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)||e.hoistableHeaders?.has(i))&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}},t9e=t=>{t=jer.HttpRequest.clone(t);for(let e of Object.keys(t.headers))Uer.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},etr=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===Ber)continue;let o=c0e.escapeUri(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${c0e.escapeUri(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${c0e.escapeUri(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")},E1n=t=>P1n(t).toISOString().replace(/\.\d{3}Z$/,"Z"),P1n=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,g0e=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){x(this,"service");x(this,"regionProvider");x(this,"credentialProvider");x(this,"sha256");x(this,"uriEscapePath");x(this,"applyChecksum");this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Aer.normalizeProvider(n),this.credentialProvider=Aer.normalizeProvider(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${etr(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(M2.toUint8Array(n));let a=await i.digest();return`${o}
|
||
${e}
|
||
${r}
|
||
${bk.toHex(a)}`}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 c0e.escapeUri(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=E1n(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},r9e=class extends g0e{constructor({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:r,credentials:n,region:o,service:i,sha256:a,uriEscapePath:s});x(this,"headerFormatter",new QGe)}async presign(r,n={}){let{signingDate:o=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:u,hoistableHeaders:l,signingRegion:c,signingService:d}=n,f=await this.credentialProvider();this.validateResolvedCredentials(f);let p=c??await this.regionProvider(),{longDate:m,shortDate:h}=this.formatDate(o);if(i>Xer)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=p0e(h,p,d??this.service),g=Qer(t9e(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[i9e]=f.sessionToken),g.query[$er]=d0e,g.query[Ler]=`${f.accessKeyId}/${y}`,g.query[n9e]=m,g.query[ker]=i.toString(10);let b=YGe(g,a,u);return g.query[Fer]=this.getCanonicalHeaderList(b),g.query[o9e]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await m0e(r,this.sha256))),g}async sign(r,n){return typeof r=="string"?this.signString(r,n):r.headers&&r.payload?this.signEvent(r,n):r.message?this.signMessage(r,n):this.signRequest(r,n)}async signEvent({headers:r,payload:n},{signingDate:o=new Date,priorSignature:i,signingRegion:a,signingService:s}){let u=a??await this.regionProvider(),{shortDate:l,longDate:c}=this.formatDate(o),d=p0e(l,u,s??this.service),f=await m0e({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=bk.toHex(await p.digest()),h=[Jer,c,d,i,m,f].join(`
|
||
`);return this.signString(h,{signingDate:o,signingRegion:u,signingService:s})}async signMessage(r,{signingDate:n=new Date,signingRegion:o,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:n,signingRegion:o,signingService:i,priorSignature:r.priorSignature}).then(s=>({message:r.message,signature:s}))}async signString(r,{signingDate:n=new Date,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let s=o??await this.regionProvider(),{shortDate:u}=this.formatDate(n),l=new this.sha256(await this.getSigningKey(a,s,u,i));return l.update(M2.toUint8Array(r)),bk.toHex(await l.digest())}async signRequest(r,{signingDate:n=new Date,signableHeaders:o,unsignableHeaders:i,signingRegion:a,signingService:s}={}){let u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=a??await this.regionProvider(),c=t9e(r),{longDate:d,shortDate:f}=this.formatDate(n),p=p0e(f,l,s??this.service);c.headers[s9e]=d,u.sessionToken&&(c.headers[zer]=u.sessionToken);let m=await m0e(c,this.sha256);!Yer(h0e,c.headers)&&this.applyChecksum&&(c.headers[h0e]=m);let h=YGe(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[a9e]=`${d0e} Credential=${u.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${y}`,c}async getSignature(r,n,o,i){let a=await this.createStringToSign(r,n,i,d0e),s=new this.sha256(await o);return s.update(M2.toUint8Array(a)),bk.toHex(await s.digest())}getSigningKey(r,n,o,i){return Zer(this.sha256,r,o,n,i||this.service)}},M1n={SignatureV4a:null};hi.ALGORITHM_IDENTIFIER=d0e;hi.ALGORITHM_IDENTIFIER_V4A=x1n;hi.ALGORITHM_QUERY_PARAM=$er;hi.ALWAYS_UNSIGNABLE_HEADERS=Ver;hi.AMZ_DATE_HEADER=s9e;hi.AMZ_DATE_QUERY_PARAM=n9e;hi.AUTH_HEADER=a9e;hi.CREDENTIAL_QUERY_PARAM=Ler;hi.DATE_HEADER=qer;hi.EVENT_ALGORITHM_IDENTIFIER=Jer;hi.EXPIRES_QUERY_PARAM=ker;hi.GENERATED_HEADERS=Uer;hi.HOST_HEADER=S1n;hi.KEY_TYPE_IDENTIFIER=u9e;hi.MAX_CACHE_SIZE=Ger;hi.MAX_PRESIGNED_TTL=Xer;hi.PROXY_HEADER_PATTERN=Her;hi.REGION_SET_PARAM=w1n;hi.SEC_HEADER_PATTERN=Wer;hi.SHA256_HEADER=h0e;hi.SIGNATURE_HEADER=Ber;hi.SIGNATURE_QUERY_PARAM=o9e;hi.SIGNED_HEADERS_QUERY_PARAM=Fer;hi.SignatureV4=r9e;hi.SignatureV4Base=g0e;hi.TOKEN_HEADER=zer;hi.TOKEN_QUERY_PARAM=i9e;hi.UNSIGNABLE_PATTERNS=C1n;hi.UNSIGNED_PAYLOAD=Ker;hi.clearCredentialCache=T1n;hi.createScope=p0e;hi.getCanonicalHeaders=YGe;hi.getCanonicalQuery=etr;hi.getPayloadHash=m0e;hi.getSigningKey=Zer;hi.hasHeader=Yer;hi.moveHeadersToQuery=Qer;hi.prepareRequest=t9e;hi.signatureV4aContainer=M1n});var Sc=S((Mva,rtr)=>{"use strict";rtr.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 PK=S((Rva,y0e)=>{"use strict";var{AbortController:ntr,AbortSignal:R1n}=typeof self<"u"?self:typeof window<"u"?window:void 0;y0e.exports=ntr;y0e.exports.AbortSignal=R1n;y0e.exports.default=ntr});var Wne=S((Iva,l9e)=>{"use strict";var MK=typeof Reflect=="object"?Reflect:null,otr=MK&&typeof MK.apply=="function"?MK.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},b0e;MK&&typeof MK.ownKeys=="function"?b0e=MK.ownKeys:Object.getOwnPropertySymbols?b0e=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:b0e=function(e){return Object.getOwnPropertyNames(e)};function I1n(t){console&&console.warn&&console.warn(t)}var atr=Number.isNaN||function(e){return e!==e};function yu(){yu.init.call(this)}l9e.exports=yu;l9e.exports.once=j1n;yu.EventEmitter=yu;yu.prototype._events=void 0;yu.prototype._eventsCount=0;yu.prototype._maxListeners=void 0;var itr=10;function _0e(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(yu,"defaultMaxListeners",{enumerable:!0,get:function(){return itr},set:function(t){if(typeof t!="number"||t<0||atr(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");itr=t}});yu.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};yu.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||atr(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 str(t){return t._maxListeners===void 0?yu.defaultMaxListeners:t._maxListeners}yu.prototype.getMaxListeners=function(){return str(this)};yu.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")otr(u,this,r);else for(var l=u.length,c=ftr(u,l),n=0;n<l;++n)otr(c[n],this,r);return!0};function utr(t,e,r,n){var o,i,a;if(_0e(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=str(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,I1n(s)}return t}yu.prototype.addListener=function(e,r){return utr(this,e,r,!1)};yu.prototype.on=yu.prototype.addListener;yu.prototype.prependListener=function(e,r){return utr(this,e,r,!0)};function A1n(){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 ltr(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=A1n.bind(n);return o.listener=r,n.wrapFn=o,o}yu.prototype.once=function(e,r){return _0e(r),this.on(e,ltr(this,e,r)),this};yu.prototype.prependOnceListener=function(e,r){return _0e(r),this.prependListener(e,ltr(this,e,r)),this};yu.prototype.removeListener=function(e,r){var n,o,i,a,s;if(_0e(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():N1n(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};yu.prototype.off=yu.prototype.removeListener;yu.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 ctr(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?D1n(o):ftr(o,o.length)}yu.prototype.listeners=function(e){return ctr(this,e,!0)};yu.prototype.rawListeners=function(e){return ctr(this,e,!1)};yu.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dtr.call(t,e)};yu.prototype.listenerCount=dtr;function dtr(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}yu.prototype.eventNames=function(){return this._eventsCount>0?b0e(this._events):[]};function ftr(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function N1n(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function D1n(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function j1n(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))}ptr(t,e,i,{once:!0}),e!=="error"&&$1n(t,o,{once:!0})})}function $1n(t,e,r){typeof t.on=="function"&&ptr(t,"error",e,r)}function ptr(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 Xy=S((Ava,d9e)=>{"use strict";var L1n=zS(),{kResistStopPropagation:F1n,SymbolDispose:k1n}=Sc(),q1n=globalThis.AbortSignal||PK().AbortSignal,U1n=globalThis.AbortController||PK().AbortController,B1n=Object.getPrototypeOf(async function(){}).constructor,mtr=globalThis.Blob||L1n.Blob,z1n=typeof mtr<"u"?function(e){return e instanceof mtr}:function(e){return!1},htr=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},V1n=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},c9e=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}};d9e.exports={AggregateError:c9e,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 B1n},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:z1n,deprecate(t,e){return t},addAbortListener:Wne().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);htr(e,"signal"),V1n(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[F1n]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[k1n](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:q1n.any||function(e){if(e.length===1)return e[0];let r=new U1n,n=()=>r.abort();return e.forEach(o=>{htr(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};d9e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Qb=S((Nva,btr)=>{"use strict";var{format:H1n,inspect:v0e,AggregateError:W1n}=Xy(),J1n=globalThis.AggregateError||W1n,K1n=Symbol("kIsNodeError"),G1n=["string","function","number","object","Function","Object","boolean","bigint","symbol"],X1n=/^([A-Z][a-z0-9]*)+$/,Z1n="__node_internal_",w0e={};function R2(t,e){if(!t)throw new w0e.ERR_INTERNAL_ASSERTION(e)}function gtr(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 Y1n(t,e,r){if(typeof e=="function")return R2(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 R2(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:H1n(e,...r)}function Bg(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(Y1n(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[K1n]=!0,w0e[t]=n}function ytr(t){let e=Z1n+t.name;return Object.defineProperty(t,"name",{value:e}),t}function Q1n(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new J1n([e,t],e.message);return r.code=e.code,r}return t||e}var f9e=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new w0e.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Bg("ERR_ASSERTION","%s",Error);Bg("ERR_INVALID_ARG_TYPE",(t,e,r)=>{R2(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)R2(typeof u=="string","All expected entries have to be of type string"),G1n.includes(u)?o.push(u.toLowerCase()):X1n.test(u)?i.push(u):(R2(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=v0e(r,{depth:-1});n+=`. Received ${u}`}}else{let u=v0e(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Bg("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=v0e(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Bg("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);Bg("ERR_MISSING_ARGS",(...t)=>{R2(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);Bg("ERR_OUT_OF_RANGE",(t,e,r)=>{R2(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=gtr(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=gtr(n)),n+="n"):n=v0e(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Bg("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Bg("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Bg("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Bg("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Bg("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Bg("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Bg("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Bg("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Bg("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Bg("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Bg("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);btr.exports={AbortError:f9e,aggregateTwoErrors:ytr(Q1n),hideStackFrames:ytr,codes:w0e}});var IK=S((Dva,Ptr)=>{"use strict";var{ArrayIsArray:m9e,ArrayPrototypeIncludes:Str,ArrayPrototypeJoin:Ctr,ArrayPrototypeMap:eDn,NumberIsInteger:h9e,NumberIsNaN:tDn,NumberMAX_SAFE_INTEGER:rDn,NumberMIN_SAFE_INTEGER:nDn,NumberParseInt:oDn,ObjectPrototypeHasOwnProperty:iDn,RegExpPrototypeExec:xtr,String:aDn,StringPrototypeToUpperCase:sDn,StringPrototypeTrim:uDn}=Sc(),{hideStackFrames:c0,codes:{ERR_SOCKET_BAD_PORT:lDn,ERR_INVALID_ARG_TYPE:Zy,ERR_INVALID_ARG_VALUE:RK,ERR_OUT_OF_RANGE:I2,ERR_UNKNOWN_SIGNAL:_tr}}=Qb(),{normalizeEncoding:cDn}=Xy(),{isAsyncFunction:dDn,isArrayBufferView:fDn}=Xy().types,vtr={};function pDn(t){return t===(t|0)}function mDn(t){return t===t>>>0}var hDn=/^[0-7]+$/,gDn="must be a 32-bit unsigned integer or an octal string";function yDn(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(xtr(hDn,t)===null)throw new RK(e,t,gDn);t=oDn(t,8)}return Ttr(t,e),t}var bDn=c0((t,e,r=nDn,n=rDn)=>{if(typeof t!="number")throw new Zy(e,"number",t);if(!h9e(t))throw new I2(e,"an integer",t);if(t<r||t>n)throw new I2(e,`>= ${r} && <= ${n}`,t)}),_Dn=c0((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Zy(e,"number",t);if(!h9e(t))throw new I2(e,"an integer",t);if(t<r||t>n)throw new I2(e,`>= ${r} && <= ${n}`,t)}),Ttr=c0((t,e,r=!1)=>{if(typeof t!="number")throw new Zy(e,"number",t);if(!h9e(t))throw new I2(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new I2(e,`>= ${n} && <= ${o}`,t)});function g9e(t,e){if(typeof t!="string")throw new Zy(e,"string",t)}function vDn(t,e,r=void 0,n){if(typeof t!="number")throw new Zy(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&tDn(t))throw new I2(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var wDn=c0((t,e,r)=>{if(!Str(r,t)){let o="must be one of: "+Ctr(eDn(r,i=>typeof i=="string"?`'${i}'`:aDn(i)),", ");throw new RK(e,t,o)}});function Otr(t,e){if(typeof t!="boolean")throw new Zy(e,"boolean",t)}function p9e(t,e,r){return t==null||!iDn(t,e)?r:t[e]}var SDn=c0((t,e,r=null)=>{let n=p9e(r,"allowArray",!1),o=p9e(r,"allowFunction",!1);if(!p9e(r,"nullable",!1)&&t===null||!n&&m9e(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new Zy(e,"Object",t)}),CDn=c0((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Zy(e,"a dictionary",t)}),S0e=c0((t,e,r=0)=>{if(!m9e(t))throw new Zy(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new RK(e,t,n)}});function xDn(t,e){S0e(t,e);for(let r=0;r<t.length;r++)g9e(t[r],`${e}[${r}]`)}function TDn(t,e){S0e(t,e);for(let r=0;r<t.length;r++)Otr(t[r],`${e}[${r}]`)}function ODn(t,e){S0e(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new Zy(o,"AbortSignal",n);Etr(n,o)}}function EDn(t,e="signal"){if(g9e(t,e),vtr[t]===void 0)throw vtr[sDn(t)]!==void 0?new _tr(t+" (signals must use all capital letters)"):new _tr(t)}var PDn=c0((t,e="buffer")=>{if(!fDn(t))throw new Zy(e,["Buffer","TypedArray","DataView"],t)});function MDn(t,e){let r=cDn(e),n=t.length;if(r==="hex"&&n%2!==0)throw new RK("encoding",e,`is invalid for data of length ${n}`)}function RDn(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&uDn(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new lDn(e,t,r);return t|0}var Etr=c0((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Zy(e,"AbortSignal",t)}),IDn=c0((t,e)=>{if(typeof t!="function")throw new Zy(e,"Function",t)}),ADn=c0((t,e)=>{if(typeof t!="function"||dDn(t))throw new Zy(e,"Function",t)}),NDn=c0((t,e)=>{if(t!==void 0)throw new Zy(e,"undefined",t)});function DDn(t,e,r){if(!Str(r,t))throw new Zy(e,`('${Ctr(r,"|")}')`,t)}var jDn=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function wtr(t,e){if(typeof t>"u"||!xtr(jDn,t))throw new RK(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function $Dn(t){if(typeof t=="string")return wtr(t,"hints"),t;if(m9e(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];wtr(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new RK("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ptr.exports={isInt32:pDn,isUint32:mDn,parseFileMode:yDn,validateArray:S0e,validateStringArray:xDn,validateBooleanArray:TDn,validateAbortSignalArray:ODn,validateBoolean:Otr,validateBuffer:PDn,validateDictionary:CDn,validateEncoding:MDn,validateFunction:IDn,validateInt32:_Dn,validateInteger:bDn,validateNumber:vDn,validateObject:SDn,validateOneOf:wDn,validatePlainFunction:ADn,validatePort:RDn,validateSignalName:EDn,validateString:g9e,validateUint32:Ttr,validateUndefined:NDn,validateUnion:DDn,validateAbortSignal:Etr,validateLinkHeaderValue:$Dn}});var _k=S((jva,Atr)=>{var cd=Atr.exports={},rE,nE;function y9e(){throw new Error("setTimeout has not been defined")}function b9e(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?rE=setTimeout:rE=y9e}catch{rE=y9e}try{typeof clearTimeout=="function"?nE=clearTimeout:nE=b9e}catch{nE=b9e}})();function Mtr(t){if(rE===setTimeout)return setTimeout(t,0);if((rE===y9e||!rE)&&setTimeout)return rE=setTimeout,setTimeout(t,0);try{return rE(t,0)}catch{try{return rE.call(null,t,0)}catch{return rE.call(this,t,0)}}}function LDn(t){if(nE===clearTimeout)return clearTimeout(t);if((nE===b9e||!nE)&&clearTimeout)return nE=clearTimeout,clearTimeout(t);try{return nE(t)}catch{try{return nE.call(null,t)}catch{return nE.call(this,t)}}}var H1=[],AK=!1,A2,C0e=-1;function FDn(){!AK||!A2||(AK=!1,A2.length?H1=A2.concat(H1):C0e=-1,H1.length&&Rtr())}function Rtr(){if(!AK){var t=Mtr(FDn);AK=!0;for(var e=H1.length;e;){for(A2=H1,H1=[];++C0e<e;)A2&&A2[C0e].run();C0e=-1,e=H1.length}A2=null,AK=!1,LDn(t)}}cd.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];H1.push(new Itr(t,e)),H1.length===1&&!AK&&Mtr(Rtr)};function Itr(t,e){this.fun=t,this.array=e}Itr.prototype.run=function(){this.fun.apply(null,this.array)};cd.title="browser";cd.browser=!0;cd.env={};cd.argv=[];cd.version="";cd.versions={};function W1(){}cd.on=W1;cd.addListener=W1;cd.once=W1;cd.off=W1;cd.removeListener=W1;cd.removeAllListeners=W1;cd.emit=W1;cd.prependListener=W1;cd.prependOnceListener=W1;cd.listeners=function(t){return[]};cd.binding=function(t){throw new Error("process.binding is not supported")};cd.cwd=function(){return"/"};cd.chdir=function(t){throw new Error("process.chdir is not supported")};cd.umask=function(){return 0}});var iE=S(($va,Jtr)=>{"use strict";var{SymbolAsyncIterator:Ntr,SymbolIterator:Dtr,SymbolFor:N2}=Sc(),jtr=N2("nodejs.stream.destroyed"),$tr=N2("nodejs.stream.errored"),_9e=N2("nodejs.stream.readable"),v9e=N2("nodejs.stream.writable"),Ltr=N2("nodejs.stream.disturbed"),kDn=N2("nodejs.webstream.isClosedPromise"),qDn=N2("nodejs.webstream.controllerErrorFunction");function x0e(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 T0e(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 UDn(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function oE(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ftr(t){return!!(t&&!oE(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ktr(t){return!!(t&&!oE(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function qtr(t){return!!(t&&!oE(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function BDn(t){return Ftr(t)||ktr(t)||qtr(t)}function zDn(t,e){return t==null?!1:e===!0?typeof t[Ntr]=="function":e===!1?typeof t[Dtr]=="function":typeof t[Ntr]=="function"||typeof t[Dtr]=="function"}function O0e(t){if(!oE(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[jtr]||n!=null&&n.destroyed)}function Utr(t){if(!T0e(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 VDn(t,e){if(!T0e(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 HDn(t){if(!x0e(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 Btr(t,e){if(!x0e(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 ztr(t){return t&&t[_9e]!=null?t[_9e]:typeof t?.readable!="boolean"?null:O0e(t)?!1:x0e(t)&&t.readable&&!Btr(t)}function Vtr(t){return t&&t[v9e]!=null?t[v9e]:typeof t?.writable!="boolean"?null:O0e(t)?!1:T0e(t)&&t.writable&&!Utr(t)}function WDn(t,e){return oE(t)?O0e(t)?!0:!(e?.readable!==!1&&ztr(t)||e?.writable!==!1&&Vtr(t)):null}function JDn(t){var e,r;return oE(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 KDn(t){var e,r;return oE(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 GDn(t){if(!oE(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"&&Htr(t)?t._closed:null}function Htr(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Wtr(t){return typeof t._sent100=="boolean"&&Htr(t)}function XDn(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 ZDn(t){if(!oE(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Wtr(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function YDn(t){var e;return!!(t&&((e=t[Ltr])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function QDn(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[$tr])!==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))}Jtr.exports={isDestroyed:O0e,kIsDestroyed:jtr,isDisturbed:YDn,kIsDisturbed:Ltr,isErrored:QDn,kIsErrored:$tr,isReadable:ztr,kIsReadable:_9e,kIsClosedPromise:kDn,kControllerErrorFunction:qDn,kIsWritable:v9e,isClosed:GDn,isDuplexNodeStream:UDn,isFinished:WDn,isIterable:zDn,isReadableNodeStream:x0e,isReadableStream:Ftr,isReadableEnded:HDn,isReadableFinished:Btr,isReadableErrored:KDn,isNodeStream:oE,isWebStream:BDn,isWritable:Vtr,isWritableNodeStream:T0e,isWritableStream:ktr,isWritableEnded:Utr,isWritableFinished:VDn,isWritableErrored:JDn,isServerRequest:XDn,isServerResponse:Wtr,willEmitClose:ZDn,isTransformStream:qtr}});var J1=S((Lva,T9e)=>{var vk=_k(),{AbortError:rrr,codes:ejn}=Qb(),{ERR_INVALID_ARG_TYPE:tjn,ERR_STREAM_PREMATURE_CLOSE:Ktr}=ejn,{kEmptyObject:S9e,once:C9e}=Xy(),{validateAbortSignal:rjn,validateFunction:njn,validateObject:ojn,validateBoolean:ijn}=IK(),{Promise:ajn,PromisePrototypeThen:sjn,SymbolDispose:nrr}=Sc(),{isClosed:ujn,isReadable:Gtr,isReadableNodeStream:w9e,isReadableStream:ljn,isReadableFinished:Xtr,isReadableErrored:Ztr,isWritable:Ytr,isWritableNodeStream:Qtr,isWritableStream:cjn,isWritableFinished:err,isWritableErrored:trr,isNodeStream:djn,willEmitClose:fjn,kIsClosedPromise:pjn}=iE(),NK;function mjn(t){return t.setHeader&&typeof t.abort=="function"}var x9e=()=>{};function orr(t,e,r){var n,o;if(arguments.length===2?(r=e,e=S9e):e==null?e=S9e:ojn(e,"options"),njn(r,"callback"),rjn(e.signal,"options.signal"),r=C9e(r),ljn(t)||cjn(t))return hjn(t,e,r);if(!djn(t))throw new tjn("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:w9e(t),a=(o=e.writable)!==null&&o!==void 0?o:Qtr(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=fjn(t)&&w9e(t)===i&&Qtr(t)===a,d=err(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=Xtr(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=T=>{r.call(t,T)},y=ujn(t),g=()=>{y=!0;let T=trr(t)||Ztr(t);if(T&&typeof T!="boolean")return r.call(t,T);if(i&&!p&&w9e(t,!0)&&!Xtr(t,!1))return r.call(t,new Ktr);if(a&&!d&&!err(t,!1))return r.call(t,new Ktr);r.call(t)},b=()=>{y=!0;let T=trr(t)||Ztr(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},_=()=>{t.req.on("finish",f)};mjn(t)?(t.on("complete",f),c||t.on("abort",g),t.req?_():t.on("request",_)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",g),y?vk.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||vk.nextTick(b):(!i&&(!c||Gtr(t))&&(d||Ytr(t)===!1)||!a&&(!c||Ytr(t))&&(p||Gtr(t)===!1)||u&&t.req&&t.aborted)&&vk.nextTick(b);let w=()=>{r=x9e,t.removeListener("aborted",g),t.removeListener("complete",f),t.removeListener("abort",g),t.removeListener("request",_),t.req&&t.req.removeListener("finish",f),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",f),t.removeListener("end",m),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!y){let T=()=>{let O=r;w(),O.call(t,new rrr(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)vk.nextTick(T);else{NK=NK||Xy().addAbortListener;let O=NK(e.signal,T),E=r;r=C9e((...P)=>{O[nrr](),E.apply(t,P)})}}return w}function hjn(t,e,r){let n=!1,o=x9e;if(e.signal)if(o=()=>{n=!0,r.call(t,new rrr(void 0,{cause:e.signal.reason}))},e.signal.aborted)vk.nextTick(o);else{NK=NK||Xy().addAbortListener;let a=NK(e.signal,o),s=r;r=C9e((...u)=>{a[nrr](),s.apply(t,u)})}let i=(...a)=>{n||vk.nextTick(()=>r.apply(t,a))};return sjn(t[pjn].promise,i,i),x9e}function gjn(t,e){var r;let n=!1;return e===null&&(e=S9e),(r=e)!==null&&r!==void 0&&r.cleanup&&(ijn(e.cleanup,"cleanup"),n=e.cleanup),new ajn((o,i)=>{let a=orr(t,e,s=>{n&&a(),s?i(s):o()})})}T9e.exports=orr;T9e.exports.finished=gjn});var D2=S((Fva,frr)=>{"use strict";var aE=_k(),{aggregateTwoErrors:yjn,codes:{ERR_MULTIPLE_CALLBACK:bjn},AbortError:_jn}=Qb(),{Symbol:srr}=Sc(),{kIsDestroyed:vjn,isDestroyed:wjn,isFinished:Sjn,isServerRequest:Cjn}=iE(),urr=srr("kDestroy"),O9e=srr("kConstruct");function lrr(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function xjn(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):(lrr(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?irr(this,t,e):this.once(urr,function(i){irr(this,yjn(i,t),e)}),this)}function irr(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;lrr(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?aE.nextTick(Tjn,t,i):aE.nextTick(crr,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function Tjn(t,e){E9e(t,e),crr(t)}function crr(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 E9e(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 Ojn(){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 P9e(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?aE.nextTick(E9e,t,e):E9e(t,e))}function Ejn(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(O9e,e),!(t.listenerCount(O9e)>1)&&aE.nextTick(Pjn,t)}function Pjn(t){let e=!1;function r(n){if(e){P9e(t,n??new bjn);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(urr,n):n?P9e(t,n,!0):aE.nextTick(Mjn,t)}try{t._construct(n=>{aE.nextTick(r,n)})}catch(n){aE.nextTick(r,n)}}function Mjn(t){t.emit(O9e)}function arr(t){return t?.setHeader&&typeof t.abort=="function"}function drr(t){t.emit("close")}function Rjn(t,e){t.emit("error",e),aE.nextTick(drr,t)}function Ijn(t,e){!t||wjn(t)||(!e&&!Sjn(t)&&(e=new _jn),Cjn(t)?(t.socket=null,t.destroy(e)):arr(t)?t.abort():arr(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?aE.nextTick(Rjn,t,e):aE.nextTick(drr,t),t.destroyed||(t[vjn]=!0))}frr.exports={construct:Ejn,destroyer:Ijn,destroy:xjn,undestroy:Ojn,errorOrDestroy:P9e}});var M0e=S((kva,mrr)=>{"use strict";var{ArrayIsArray:Ajn,ObjectSetPrototypeOf:prr}=Sc(),{EventEmitter:E0e}=Wne();function P0e(t){E0e.call(this,t)}prr(P0e.prototype,E0e.prototype);prr(P0e,E0e);P0e.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(),E0e.listenerCount(this,"error")===0&&this.emit("error",c)}M9e(r,"error",u),M9e(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 M9e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Ajn(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}mrr.exports={Stream:P0e,prependListener:M9e}});var Jne=S((qva,R0e)=>{"use strict";var{SymbolDispose:Njn}=Sc(),{AbortError:hrr,codes:Djn}=Qb(),{isNodeStream:grr,isWebStream:jjn,kControllerErrorFunction:$jn}=iE(),Ljn=J1(),{ERR_INVALID_ARG_TYPE:yrr}=Djn,R9e,Fjn=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new yrr(e,"AbortSignal",t)};R0e.exports.addAbortSignal=function(e,r){if(Fjn(e,"signal"),!grr(r)&&!jjn(r))throw new yrr("stream",["ReadableStream","WritableStream","Stream"],r);return R0e.exports.addAbortSignalNoValidate(e,r)};R0e.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=grr(e)?()=>{e.destroy(new hrr(void 0,{cause:t.reason}))}:()=>{e[$jn](new hrr(void 0,{cause:t.reason}))};if(t.aborted)r();else{R9e=R9e||Xy().addAbortListener;let n=R9e(t,r);Ljn(e,n[Njn])}return e}});var vrr=S((Bva,_rr)=>{"use strict";var{StringPrototypeSlice:brr,SymbolIterator:kjn,TypedArrayPrototypeSet:I0e,Uint8Array:qjn}=Sc(),{Buffer:I9e}=zS(),{inspect:Ujn}=Xy();_rr.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 I9e.alloc(0);let r=I9e.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)I0e(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}*[kjn](){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+=brr(i,0,e),this.head=n,n.data=brr(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=I9e.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)I0e(r,a,n-e),e-=a.length;else{e===a.length?(I0e(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(I0e(r,new qjn(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 Ujn(this,{...r,depth:0,customInspect:!1})}}});var Kne=S((zva,xrr)=>{"use strict";var{MathFloor:Bjn,NumberIsInteger:zjn}=Sc(),{validateInteger:Vjn}=IK(),{ERR_INVALID_ARG_VALUE:Hjn}=Qb().codes,wrr=16*1024,Srr=16;function Wjn(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Crr(t){return t?Srr:wrr}function Jjn(t,e){Vjn(e,"value",0),t?Srr=e:wrr=e}function Kjn(t,e,r,n){let o=Wjn(e,n,r);if(o!=null){if(!zjn(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new Hjn(i,o)}return Bjn(o)}return Crr(t.objectMode)}xrr.exports={getHighWaterMark:Kjn,getDefaultHighWaterMark:Crr,setDefaultHighWaterMark:Jjn}});var Err=S((A9e,Orr)=>{var A0e=zS(),sE=A0e.Buffer;function Trr(t,e){for(var r in t)e[r]=t[r]}sE.from&&sE.alloc&&sE.allocUnsafe&&sE.allocUnsafeSlow?Orr.exports=A0e:(Trr(A0e,A9e),A9e.Buffer=j2);function j2(t,e,r){return sE(t,e,r)}j2.prototype=Object.create(sE.prototype);Trr(sE,j2);j2.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return sE(t,e,r)};j2.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=sE(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};j2.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sE(t)};j2.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return A0e.SlowBuffer(t)}});var Rrr=S(Mrr=>{"use strict";var D9e=Err().Buffer,Prr=D9e.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 Gjn(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 Xjn(t){var e=Gjn(t);if(typeof e!="string"&&(D9e.isEncoding===Prr||!Prr(t)))throw new Error("Unknown encoding: "+t);return e||t}Mrr.StringDecoder=Gne;function Gne(t){this.encoding=Xjn(t);var e;switch(this.encoding){case"utf16le":this.text=r$n,this.end=n$n,e=4;break;case"utf8":this.fillLast=Qjn,e=4;break;case"base64":this.text=o$n,this.end=i$n,e=3;break;default:this.write=a$n,this.end=s$n;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=D9e.allocUnsafe(e)}Gne.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||""};Gne.prototype.end=t$n;Gne.prototype.text=e$n;Gne.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 N9e(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Zjn(t,e,r){var n=e.length-1;if(n<r)return 0;var o=N9e(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=N9e(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=N9e(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function Yjn(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 Qjn(t){var e=this.lastTotal-this.lastNeed,r=Yjn(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 e$n(t,e){var r=Zjn(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 t$n(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function r$n(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 n$n(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 o$n(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 i$n(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function a$n(t){return t.toString(this.encoding)}function s$n(t){return t&&t.length?this.write(t):""}});var j9e=S((Hva,Drr)=>{"use strict";var Irr=_k(),{PromisePrototypeThen:u$n,SymbolAsyncIterator:Arr,SymbolIterator:Nrr}=Sc(),{Buffer:l$n}=zS(),{ERR_INVALID_ARG_TYPE:c$n,ERR_STREAM_NULL_VALUES:d$n}=Qb().codes;function f$n(t,e,r){let n;if(typeof e=="string"||e instanceof l$n)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[Arr])o=!0,n=e[Arr]();else if(e&&e[Nrr])o=!1,n=e[Nrr]();else throw new c$n("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){u$n(s(l),()=>Irr.nextTick(c,l),d=>Irr.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 d$n;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}Drr.exports=f$n});var Zne=S((Wva,Yrr)=>{var bx=_k(),{ArrayPrototypeIndexOf:p$n,NumberIsInteger:m$n,NumberIsNaN:h$n,NumberParseInt:g$n,ObjectDefineProperties:z9e,ObjectKeys:y$n,ObjectSetPrototypeOf:Lrr,Promise:Frr,SafeSet:b$n,SymbolAsyncDispose:_$n,SymbolAsyncIterator:v$n,Symbol:w$n}=Sc();Yrr.exports=gi;gi.ReadableState=$0e;var{EventEmitter:S$n}=Wne(),{Stream:wk,prependListener:C$n}=M0e(),{Buffer:$9e}=zS(),{addAbortSignal:x$n}=Jne(),krr=J1(),Li=Xy().debuglog("stream",t=>{Li=t}),T$n=vrr(),$K=D2(),{getHighWaterMark:O$n,getDefaultHighWaterMark:E$n}=Kne(),{aggregateTwoErrors:jrr,codes:{ERR_INVALID_ARG_TYPE:P$n,ERR_METHOD_NOT_IMPLEMENTED:M$n,ERR_OUT_OF_RANGE:R$n,ERR_STREAM_PUSH_AFTER_EOF:I$n,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A$n},AbortError:N$n}=Qb(),{validateObject:D$n}=IK(),$2=w$n("kPaused"),{StringDecoder:qrr}=Rrr(),j$n=j9e();Lrr(gi.prototype,wk.prototype);Lrr(gi,wk);var L9e=()=>{},{errorOrDestroy:DK}=$K,jK=1,$$n=2,Urr=4,Xne=8,Brr=16,N0e=32,D0e=64,zrr=128,L$n=256,F$n=512,k$n=1024,U9e=2048,B9e=4096,q$n=8192,U$n=16384,B$n=32768,Vrr=65536,z$n=1<<17,V$n=1<<18;function Fm(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}z9e($0e.prototype,{objectMode:Fm(jK),ended:Fm($$n),endEmitted:Fm(Urr),reading:Fm(Xne),constructed:Fm(Brr),sync:Fm(N0e),needReadable:Fm(D0e),emittedReadable:Fm(zrr),readableListening:Fm(L$n),resumeScheduled:Fm(F$n),errorEmitted:Fm(k$n),emitClose:Fm(U9e),autoDestroy:Fm(B9e),destroyed:Fm(q$n),closed:Fm(U$n),closeEmitted:Fm(B$n),multiAwaitDrain:Fm(Vrr),readingMore:Fm(z$n),dataEmitted:Fm(V$n)});function $0e(t,e,r){typeof r!="boolean"&&(r=e instanceof uE()),this.state=U9e|B9e|Brr|N0e,t&&t.objectMode&&(this.state|=jK),r&&t&&t.readableObjectMode&&(this.state|=jK),this.highWaterMark=t?O$n(this,t,"readableHighWaterMark",r):E$n(!1),this.buffer=new T$n,this.length=0,this.pipes=[],this.flowing=null,this[$2]=null,t&&t.emitClose===!1&&(this.state&=~U9e),t&&t.autoDestroy===!1&&(this.state&=~B9e),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new qrr(t.encoding),this.encoding=t.encoding)}function gi(t){if(!(this instanceof gi))return new gi(t);let e=this instanceof uE();this._readableState=new $0e(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&&x$n(t.signal,this)),wk.call(this,t),$K.construct(this,()=>{this._readableState.needReadable&&j0e(this,this._readableState)})}gi.prototype.destroy=$K.destroy;gi.prototype._undestroy=$K.undestroy;gi.prototype._destroy=function(t,e){e(t)};gi.prototype[S$n.captureRejectionSymbol]=function(t){this.destroy(t)};gi.prototype[_$n]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new N$n,this.destroy(t)),new Frr((e,r)=>krr(this,n=>n&&n!==t?r(n):e(null)))};gi.prototype.push=function(t,e){return Hrr(this,t,e,!1)};gi.prototype.unshift=function(t,e){return Hrr(this,t,e,!0)};function Hrr(t,e,r,n){Li("readableAddChunk",e);let o=t._readableState,i;if((o.state&jK)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=$9e.from(e,r).toString(o.encoding):(e=$9e.from(e,r),r=""))):e instanceof $9e?r="":wk._isUint8Array(e)?(e=wk._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new P$n("chunk",["string","Buffer","Uint8Array"],e))),i)DK(t,i);else if(e===null)o.state&=~Xne,J$n(t,o);else if((o.state&jK)!==0||e&&e.length>0)if(n)if((o.state&Urr)!==0)DK(t,new A$n);else{if(o.destroyed||o.errored)return!1;F9e(t,o,e,!0)}else if(o.ended)DK(t,new I$n);else{if(o.destroyed||o.errored)return!1;o.state&=~Xne,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?F9e(t,o,e,!1):j0e(t,o)):F9e(t,o,e,!1)}else n||(o.state&=~Xne,j0e(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function F9e(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Vrr)!==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&D0e)!==0&&L0e(t)),j0e(t,e)}gi.prototype.isPaused=function(){let t=this._readableState;return t[$2]===!0||t.flowing===!1};gi.prototype.setEncoding=function(t){let e=new qrr(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 H$n=1073741824;function W$n(t){if(t>H$n)throw new R$n("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function $rr(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&jK)!==0?1:h$n(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}gi.prototype.read=function(t){Li("read",t),t===void 0?t=NaN:m$n(t)||(t=g$n(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=W$n(t)),t!==0&&(e.state&=~zrr),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Li("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?k9e(this):L0e(this),null;if(t=$rr(t,e),t===0&&e.ended)return e.length===0&&k9e(this),null;let n=(e.state&D0e)!==0;if(Li("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Li("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Li("reading, ended or constructing",n);else if(n){Li("do read"),e.state|=Xne|N0e,e.length===0&&(e.state|=D0e);try{this._read(e.highWaterMark)}catch(i){DK(this,i)}e.state&=~N0e,e.reading||(t=$rr(r,e))}let o;return t>0?o=Xrr(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&&k9e(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function J$n(t,e){if(Li("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?L0e(t):(e.needReadable=!1,e.emittedReadable=!0,Wrr(t))}}function L0e(t){let e=t._readableState;Li("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Li("emitReadable",e.flowing),e.emittedReadable=!0,bx.nextTick(Wrr,t))}function Wrr(t){let e=t._readableState;Li("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,Krr(t)}function j0e(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,bx.nextTick(K$n,t,e))}function K$n(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Li("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}gi.prototype._read=function(t){throw new M$n("_read()")};gi.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new b$n(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Li("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==bx.stdout&&t!==bx.stderr?s:y;n.endEmitted?bx.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,b){Li("onunpipe"),g===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function s(){Li("onend"),t.end()}let u,l=!1;function c(){Li("cleanup"),t.removeListener("close",m),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),r.removeListener("end",s),r.removeListener("end",y),r.removeListener("data",f),l=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function d(){l||(n.pipes.length===1&&n.pipes[0]===t?(Li("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Li("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=G$n(r,t),t.on("drain",u))}r.on("data",f);function f(g){Li("ondata");let b=t.write(g);Li("dest.write",b),b===!1&&d()}function p(g){if(Li("onerror",g),y(),t.removeListener("error",p),t.listenerCount("error")===0){let b=t._writableState||t._readableState;b&&!b.errorEmitted?DK(t,g):t.emit("error",g)}}C$n(t,"error",p);function m(){t.removeListener("finish",h),y()}t.once("close",m);function h(){Li("onfinish"),t.removeListener("close",m),y()}t.once("finish",h);function y(){Li("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Li("pipe resume"),r.resume()),t};function G$n(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Li("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Li("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}gi.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=p$n(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};gi.prototype.on=function(t,e){let r=wk.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,Li("on readable",n.length,n.reading),n.length?L0e(this):n.reading||bx.nextTick(X$n,this)),r};gi.prototype.addListener=gi.prototype.on;gi.prototype.removeListener=function(t,e){let r=wk.prototype.removeListener.call(this,t,e);return t==="readable"&&bx.nextTick(Jrr,this),r};gi.prototype.off=gi.prototype.removeListener;gi.prototype.removeAllListeners=function(t){let e=wk.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&bx.nextTick(Jrr,this),e};function Jrr(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[$2]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function X$n(t){Li("readable nexttick read 0"),t.read(0)}gi.prototype.resume=function(){let t=this._readableState;return t.flowing||(Li("resume"),t.flowing=!t.readableListening,Z$n(this,t)),t[$2]=!1,this};function Z$n(t,e){e.resumeScheduled||(e.resumeScheduled=!0,bx.nextTick(Y$n,t,e))}function Y$n(t,e){Li("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Krr(t),e.flowing&&!e.reading&&t.read(0)}gi.prototype.pause=function(){return Li("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Li("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[$2]=!0,this};function Krr(t){let e=t._readableState;for(Li("flow",e.flowing);e.flowing&&t.read()!==null;);}gi.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=>{DK(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=y$n(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};gi.prototype[v$n]=function(){return Grr(this)};gi.prototype.iterator=function(t){return t!==void 0&&D$n(t,"options"),Grr(this,t)};function Grr(t,e){typeof t.read!="function"&&(t=gi.wrap(t,{objectMode:!0}));let r=Q$n(t,e);return r.stream=t,r}async function*Q$n(t,e){let r=L9e;function n(a){this===t?(r(),r=L9e):r=a}t.on("readable",n);let o,i=krr(t,{writable:!1},a=>{o=a?jrr(o,a):null,r(),r=L9e});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 Frr(n)}}}catch(a){throw o=jrr(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?$K.destroyer(t,null):(t.off("readable",n),i())}}z9e(gi.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}}});z9e($0e.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[$2]!==!1},set(t){this[$2]=!!t}}});gi._fromList=Xrr;function Xrr(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 k9e(t){let e=t._readableState;Li("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,bx.nextTick(eLn,e,t))}function eLn(t,e){if(Li("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)bx.nextTick(tLn,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function tLn(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}gi.from=function(t,e){return j$n(gi,t,e)};var q9e;function Zrr(){return q9e===void 0&&(q9e={}),q9e}gi.fromWeb=function(t,e){return Zrr().newStreamReadableFromReadableStream(t,e)};gi.toWeb=function(t,e){return Zrr().newReadableStreamFromStreamReadable(t,e)};gi.wrap=function(t,e){var r,n;return new gi({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){$K.destroyer(t,o),i(o)}}).wrap(t)}});var B0e=S((Jva,cnr)=>{var L2=_k(),{ArrayPrototypeSlice:tnr,Error:rLn,FunctionPrototypeSymbolHasInstance:rnr,ObjectDefineProperty:nnr,ObjectDefineProperties:nLn,ObjectSetPrototypeOf:onr,StringPrototypeToLowerCase:oLn,Symbol:iLn,SymbolHasInstance:aLn}=Sc();cnr.exports=Cc;Cc.WritableState=eoe;var{EventEmitter:sLn}=Wne(),Yne=M0e().Stream,{Buffer:F0e}=zS(),U0e=D2(),{addAbortSignal:uLn}=Jne(),{getHighWaterMark:lLn,getDefaultHighWaterMark:cLn}=Kne(),{ERR_INVALID_ARG_TYPE:dLn,ERR_METHOD_NOT_IMPLEMENTED:fLn,ERR_MULTIPLE_CALLBACK:inr,ERR_STREAM_CANNOT_PIPE:pLn,ERR_STREAM_DESTROYED:Qne,ERR_STREAM_ALREADY_FINISHED:mLn,ERR_STREAM_NULL_VALUES:hLn,ERR_STREAM_WRITE_AFTER_END:gLn,ERR_UNKNOWN_ENCODING:anr}=Qb().codes,{errorOrDestroy:LK}=U0e;onr(Cc.prototype,Yne.prototype);onr(Cc,Yne);function W9e(){}var FK=iLn("kOnFinished");function eoe(t,e,r){typeof r!="boolean"&&(r=e instanceof uE()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?lLn(this,t,"writableHighWaterMark",r):cLn(!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=bLn.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,q0e(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[FK]=[]}function q0e(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}eoe.prototype.getBuffer=function(){return tnr(this.buffered,this.bufferedIndex)};nnr(eoe.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Cc(t){let e=this instanceof uE();if(!e&&!rnr(Cc,this))return new Cc(t);this._writableState=new eoe(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&&uLn(t.signal,this)),Yne.call(this,t),U0e.construct(this,()=>{let r=this._writableState;r.writing||K9e(this,r),G9e(this,r)})}nnr(Cc,aLn,{__proto__:null,value:function(t){return rnr(this,t)?!0:this!==Cc?!1:t&&t._writableState instanceof eoe}});Cc.prototype.pipe=function(){LK(this,new pLn)};function snr(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"&&!F0e.isEncoding(r))throw new anr(r);typeof n!="function"&&(n=W9e)}if(e===null)throw new hLn;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=F0e.from(e,r),r="buffer");else if(e instanceof F0e)r="buffer";else if(Yne._isUint8Array(e))e=Yne._uint8ArrayToBuffer(e),r="buffer";else throw new dLn("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new gLn:o.destroyed&&(i=new Qne("write")),i?(L2.nextTick(n,i),LK(t,i,!0),i):(o.pendingcb++,yLn(t,o,e,r,n))}Cc.prototype.write=function(t,e,r){return snr(this,t,e,r)===!0};Cc.prototype.cork=function(){this._writableState.corked++};Cc.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||K9e(this,t))};Cc.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=oLn(e)),!F0e.isEncoding(e))throw new anr(e);return this._writableState.defaultEncoding=e,this};function yLn(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!==W9e&&(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 Qrr(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Qne("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function enr(t,e,r,n){--e.pendingcb,n(r),J9e(e),LK(t,r)}function bLn(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){LK(t,new inr);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?L2.nextTick(enr,t,r,e,o):enr(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&K9e(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},L2.nextTick(_Ln,r.afterWriteTickInfo)):unr(t,r,1,o))}function _Ln({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,unr(t,e,r,n)}function unr(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&&J9e(e),G9e(t,e)}function J9e(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 Qne("write"))}let r=t[FK].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new Qne("end"))}q0e(t)}function K9e(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?W9e:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:tnr(r,a);u.allBuffers=e.allBuffers,Qrr(t,e,!0,e.length,u,"",s),q0e(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;Qrr(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?q0e(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}Cc.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new fLn("_write()")};Cc.prototype._writev=null;Cc.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=snr(this,t,e);i instanceof rLn&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,G9e(this,n,!0),n.ended=!0):n.finished?o=new mLn("end"):n.destroyed&&(o=new Qne("end"))),typeof r=="function"&&(o||n.finished?L2.nextTick(r,o):n[FK].push(r)),this};function k0e(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 vLn(t,e){let r=!1;function n(o){if(r){LK(t,o??inr());return}if(r=!0,e.pendingcb--,o){let i=e[FK].splice(0);for(let a=0;a<i.length;a++)i[a](o);LK(t,o,e.sync)}else k0e(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,L2.nextTick(H9e,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function wLn(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,vLn(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function G9e(t,e,r){k0e(e)&&(wLn(t,e),e.pendingcb===0&&(r?(e.pendingcb++,L2.nextTick((n,o)=>{k0e(o)?H9e(n,o):o.pendingcb--},t,e)):k0e(e)&&(e.pendingcb++,H9e(t,e))))}function H9e(t,e){e.pendingcb--,e.finished=!0;let r=e[FK].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()}}nLn(Cc.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 SLn=U0e.destroy;Cc.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[FK].length)&&L2.nextTick(J9e,r),SLn.call(this,t,e),this};Cc.prototype._undestroy=U0e.undestroy;Cc.prototype._destroy=function(t,e){e(t)};Cc.prototype[sLn.captureRejectionSymbol]=function(t){this.destroy(t)};var V9e;function lnr(){return V9e===void 0&&(V9e={}),V9e}Cc.fromWeb=function(t,e){return lnr().newStreamWritableFromWritableStream(t,e)};Cc.toWeb=function(t){return lnr().newWritableStreamFromStreamWritable(t)}});var Tnr=S((Kva,xnr)=>{var X9e=_k(),CLn=zS(),{isReadable:xLn,isWritable:TLn,isIterable:dnr,isNodeStream:OLn,isReadableNodeStream:fnr,isWritableNodeStream:pnr,isDuplexNodeStream:ELn,isReadableStream:mnr,isWritableStream:hnr}=iE(),gnr=J1(),{AbortError:Snr,codes:{ERR_INVALID_ARG_TYPE:PLn,ERR_INVALID_RETURN_VALUE:ynr}}=Qb(),{destroyer:qK}=D2(),MLn=uE(),Cnr=Zne(),RLn=B0e(),{createDeferredPromise:bnr}=Xy(),_nr=j9e(),vnr=globalThis.Blob||CLn.Blob,ILn=typeof vnr<"u"?function(e){return e instanceof vnr}:function(e){return!1},ALn=globalThis.AbortController||PK().AbortController,{FunctionPrototypeCall:wnr}=Sc(),Sk=class extends MLn{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)}};xnr.exports=function t(e,r){if(ELn(e))return e;if(fnr(e))return kK({readable:e});if(pnr(e))return kK({writable:e});if(OLn(e))return kK({writable:!1,readable:!1});if(mnr(e))return kK({readable:Cnr.fromWeb(e)});if(hnr(e))return kK({writable:RLn.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=NLn(e);if(dnr(o))return _nr(Sk,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=wnr(u,o,d=>{if(d!=null)throw new ynr("nully","body",d)},d=>{qK(l,d)});return l=new Sk({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,X9e.nextTick(d,null)}catch(f){X9e.nextTick(d,f)}})},destroy:s})}throw new ynr("Iterable, AsyncIterable or AsyncFunction",r,o)}if(ILn(e))return t(e.arrayBuffer());if(dnr(e))return _nr(Sk,e,{objectMode:!0,writable:!1});if(mnr(e?.readable)&&hnr(e?.writable))return Sk.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?fnr(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?pnr(e?.writable)?e?.writable:t(e.writable):void 0;return kK({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return wnr(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{qK(o,i)}),o=new Sk({objectMode:!0,writable:!1,read(){}})}throw new PLn(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function NLn(t){let{promise:e,resolve:r}=bnr(),n=new ALn,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(X9e.nextTick(l),u)return;if(o.aborted)throw new Snr(void 0,{cause:o.reason});({promise:e,resolve:r}=bnr()),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 kK(t){let e=t.readable&&typeof t.readable.read!="function"?Cnr.wrap(t.readable):t.readable,r=t.writable,n=!!xLn(e),o=!!TLn(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new Sk({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(gnr(r,d=>{o=!1,d&&qK(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&&(gnr(e,d=>{n=!1,d&&qK(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 Snr),s=null,i=null,a=null,u===null?f(d):(u=f,qK(r,d),qK(e,d))},l}});var uE=S((Gva,Pnr)=>{"use strict";var{ObjectDefineProperties:DLn,ObjectGetOwnPropertyDescriptor:K1,ObjectKeys:jLn,ObjectSetPrototypeOf:Onr}=Sc();Pnr.exports=_x;var Q9e=Zne(),d0=B0e();Onr(_x.prototype,Q9e.prototype);Onr(_x,Q9e);{let t=jLn(d0.prototype);for(let e=0;e<t.length;e++){let r=t[e];_x.prototype[r]||(_x.prototype[r]=d0.prototype[r])}}function _x(t){if(!(this instanceof _x))return new _x(t);Q9e.call(this,t),d0.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}DLn(_x.prototype,{writable:{__proto__:null,...K1(d0.prototype,"writable")},writableHighWaterMark:{__proto__:null,...K1(d0.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...K1(d0.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...K1(d0.prototype,"writableBuffer")},writableLength:{__proto__:null,...K1(d0.prototype,"writableLength")},writableFinished:{__proto__:null,...K1(d0.prototype,"writableFinished")},writableCorked:{__proto__:null,...K1(d0.prototype,"writableCorked")},writableEnded:{__proto__:null,...K1(d0.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...K1(d0.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 Z9e;function Enr(){return Z9e===void 0&&(Z9e={}),Z9e}_x.fromWeb=function(t,e){return Enr().newStreamDuplexFromReadableWritablePair(t,e)};_x.toWeb=function(t){return Enr().newReadableWritablePairFromDuplex(t)};var Y9e;_x.from=function(t){return Y9e||(Y9e=Tnr()),Y9e(t,"body")}});var r7e=S((Xva,Rnr)=>{"use strict";var{ObjectSetPrototypeOf:Mnr,Symbol:$Ln}=Sc();Rnr.exports=G1;var{ERR_METHOD_NOT_IMPLEMENTED:LLn}=Qb().codes,t7e=uE(),{getHighWaterMark:FLn}=Kne();Mnr(G1.prototype,t7e.prototype);Mnr(G1,t7e);var toe=$Ln("kCallback");function G1(t){if(!(this instanceof G1))return new G1(t);let e=t?FLn(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),t7e.call(this,t),this._readableState.sync=!1,this[toe]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",kLn)}function e7e(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 kLn(){this._final!==e7e&&e7e.call(this)}G1.prototype._final=e7e;G1.prototype._transform=function(t,e,r){throw new LLn("_transform()")};G1.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[toe]=r})};G1.prototype._read=function(){if(this[toe]){let t=this[toe];this[toe]=null,t()}}});var o7e=S((Zva,Anr)=>{"use strict";var{ObjectSetPrototypeOf:Inr}=Sc();Anr.exports=UK;var n7e=r7e();Inr(UK.prototype,n7e.prototype);Inr(UK,n7e);function UK(t){if(!(this instanceof UK))return new UK(t);n7e.call(this,t)}UK.prototype._transform=function(t,e,r){r(null,t)}});var W0e=S((Yva,Lnr)=>{var roe=_k(),{ArrayIsArray:qLn,Promise:ULn,SymbolAsyncIterator:BLn,SymbolDispose:zLn}=Sc(),H0e=J1(),{once:VLn}=Xy(),HLn=D2(),Nnr=uE(),{aggregateTwoErrors:WLn,codes:{ERR_INVALID_ARG_TYPE:p7e,ERR_INVALID_RETURN_VALUE:i7e,ERR_MISSING_ARGS:JLn,ERR_STREAM_DESTROYED:KLn,ERR_STREAM_PREMATURE_CLOSE:GLn},AbortError:XLn}=Qb(),{validateFunction:ZLn,validateAbortSignal:YLn}=IK(),{isIterable:F2,isReadable:a7e,isReadableNodeStream:V0e,isNodeStream:Dnr,isTransformStream:BK,isWebStream:QLn,isReadableStream:s7e,isReadableFinished:eFn}=iE(),tFn=globalThis.AbortController||PK().AbortController,u7e,l7e,c7e;function jnr(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=H0e(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,HLn.destroyer(t,i||new KLn("pipe")))},cleanup:o}}function rFn(t){return ZLn(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function d7e(t){if(F2(t))return t;if(V0e(t))return nFn(t);throw new p7e("val",["Readable","Iterable","AsyncIterable"],t)}async function*nFn(t){l7e||(l7e=Zne()),yield*l7e.prototype[BLn].call(t)}async function z0e(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new ULn((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=H0e(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?WLn(o,l):l)}finally{u(),e.off("drain",a)}}async function f7e(t,e,r,{end:n}){BK(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 oFn(...t){return $nr(t,VLn(rFn(t)))}function $nr(t,e,r){if(t.length===1&&qLn(t[0])&&(t=t[0]),t.length<2)throw new JLn("streams");let n=new tFn,o=n.signal,i=r?.signal,a=[];YLn(i,"options.signal");function s(){m(new XLn)}c7e=c7e||Xy().addAbortListener;let u;i&&(u=c7e(i,s));let l,c,d=[],f=0;function p(_){m(_,--f===0)}function m(_,w){var T;if(_&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=_),!(!l&&!w)){for(;d.length;)d.shift()(l);(T=u)===null||T===void 0||T[zLn](),n.abort(),w&&(l||a.forEach(O=>O()),roe.nextTick(e,l,c))}}let h;for(let _=0;_<t.length;_++){let w=t[_],T=_<t.length-1,O=_>0,E=T||r?.end!==!1,P=_===t.length-1;if(Dnr(w)){let R=function(I){I&&I.name!=="AbortError"&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(I)};var b=R;if(E){let{destroy:I,cleanup:N}=jnr(w,T,O);d.push(I),a7e(w)&&P&&a.push(N)}w.on("error",R),a7e(w)&&P&&a.push(()=>{w.removeListener("error",R)})}if(_===0)if(typeof w=="function"){if(h=w({signal:o}),!F2(h))throw new i7e("Iterable, AsyncIterable or Stream","source",h)}else F2(w)||V0e(w)||BK(w)?h=w:h=Nnr.from(w);else if(typeof w=="function"){if(BK(h)){var y;h=d7e((y=h)===null||y===void 0?void 0:y.readable)}else h=d7e(h);if(h=w(h,{signal:o}),T){if(!F2(h,!0))throw new i7e("AsyncIterable",`transform[${_-1}]`,h)}else{var g;u7e||(u7e=o7e());let R=new u7e({objectMode:!0}),I=(g=h)===null||g===void 0?void 0:g.then;if(typeof I=="function")f++,I.call(h,V=>{c=V,V!=null&&R.write(V),E&&R.end(),roe.nextTick(p)},V=>{R.destroy(V),roe.nextTick(p,V)});else if(F2(h,!0))f++,z0e(h,R,p,{end:E});else if(s7e(h)||BK(h)){let V=h.readable||h;f++,z0e(V,R,p,{end:E})}else throw new i7e("AsyncIterable or Promise","destination",h);h=R;let{destroy:N,cleanup:z}=jnr(h,!1,!0);d.push(N),P&&a.push(z)}}else if(Dnr(w)){if(V0e(h)){f+=2;let R=iFn(h,w,p,{end:E});a7e(w)&&P&&a.push(R)}else if(BK(h)||s7e(h)){let R=h.readable||h;f++,z0e(R,w,p,{end:E})}else if(F2(h))f++,z0e(h,w,p,{end:E});else throw new p7e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else if(QLn(w)){if(V0e(h))f++,f7e(d7e(h),w,p,{end:E});else if(s7e(h)||F2(h))f++,f7e(h,w,p,{end:E});else if(BK(h))f++,f7e(h.readable,w,p,{end:E});else throw new p7e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else h=Nnr.from(w)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&roe.nextTick(s),h}function iFn(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new GLn)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;eFn(t)?roe.nextTick(a):t.once("end",a)}else r();return H0e(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)}),H0e(e,{readable:!1,writable:!0},r)}Lnr.exports={pipelineImpl:$nr,pipeline:oFn}});var h7e=S((Qva,znr)=>{"use strict";var{pipeline:aFn}=W0e(),J0e=uE(),{destroyer:sFn}=D2(),{isNodeStream:K0e,isReadable:Fnr,isWritable:knr,isWebStream:m7e,isTransformStream:k2,isWritableStream:qnr,isReadableStream:Unr}=iE(),{AbortError:uFn,codes:{ERR_INVALID_ARG_VALUE:Bnr,ERR_MISSING_ARGS:lFn}}=Qb(),cFn=J1();znr.exports=function(...e){if(e.length===0)throw new lFn("streams");if(e.length===1)return J0e.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=J0e.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=J0e.from(e[p])}for(let p=0;p<e.length;++p)if(!(!K0e(e[p])&&!m7e(e[p]))){if(p<e.length-1&&!(Fnr(e[p])||Unr(e[p])||k2(e[p])))throw new Bnr(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(knr(e[p])||qnr(e[p])||k2(e[p])))throw new Bnr(`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=aFn(e,u),d=!!(knr(l)||qnr(l)||k2(l)),f=!!(Fnr(c)||Unr(c)||k2(c));if(s=new J0e({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(K0e(l))s._write=function(m,h,y){l.write(m,h)?y():n=y},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(m7e(l)){let h=(k2(l)?l.writable:l).getWriter();s._write=async function(y,g,b){try{await h.ready,h.write(y).catch(()=>{}),b()}catch(_){b(_)}},s._final=async function(y){try{await h.ready,h.close().catch(()=>{}),o=y}catch(g){y(g)}}}let p=k2(c)?c.readable:c;cFn(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(K0e(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(m7e(c)){let m=(k2(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:y}=await m.read();if(!s.push(h))return;if(y){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new uFn),i=null,n=null,o=null,a===null?m(p):(a=m,K0e(c)&&sFn(c,p))},s}});var Qnr=S((ewa,b7e)=>{"use strict";var dFn=globalThis.AbortController||PK().AbortController,{codes:{ERR_INVALID_ARG_VALUE:fFn,ERR_INVALID_ARG_TYPE:noe,ERR_MISSING_ARGS:pFn,ERR_OUT_OF_RANGE:mFn},AbortError:lE}=Qb(),{validateAbortSignal:q2,validateInteger:Vnr,validateObject:U2}=IK(),hFn=Sc().Symbol("kWeak"),gFn=Sc().Symbol("kResistStopPropagation"),{finished:yFn}=J1(),bFn=h7e(),{addAbortSignalNoValidate:_Fn}=Jne(),{isWritable:vFn,isNodeStream:wFn}=iE(),{deprecate:SFn}=Xy(),{ArrayPrototypePush:CFn,Boolean:xFn,MathFloor:Hnr,Number:TFn,NumberIsNaN:OFn,Promise:Wnr,PromiseReject:Jnr,PromiseResolve:EFn,PromisePrototypeThen:Knr,Symbol:Xnr}=Sc(),G0e=Xnr("kEmpty"),Gnr=Xnr("kEof");function PFn(t,e){if(e!=null&&U2(e,"options"),e?.signal!=null&&q2(e.signal,"options.signal"),wFn(t)&&!vFn(t))throw new fFn("stream",t,"must be writable");let r=bFn(this,t);return e!=null&&e.signal&&_Fn(e.signal,r),r}function X0e(t,e){if(typeof t!="function")throw new noe("fn",["Function","AsyncFunction"],t);e!=null&&U2(e,"options"),e?.signal!=null&&q2(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Hnr(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Hnr(e.highWaterMark)),Vnr(r,"options.concurrency",1),Vnr(n,"options.highWaterMark",0),n+=r,async function*(){let i=Xy().AbortSignalAny([e?.signal].filter(xFn)),a=this,s=[],u={signal:i},l,c,d=!1,f=0;function p(){d=!0,m()}function m(){f-=1,h()}function h(){c&&!d&&f<r&&s.length<n&&(c(),c=null)}async function y(){try{for await(let g of a){if(d)return;if(i.aborted)throw new lE;try{if(g=t(g,u),g===G0e)continue;g=EFn(g)}catch(b){g=Jnr(b)}f+=1,Knr(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new Wnr(b=>{c=b})}s.push(Gnr)}catch(g){let b=Jnr(g);Knr(b,m,p),s.push(b)}finally{d=!0,l&&(l(),l=null)}}y();try{for(;;){for(;s.length>0;){let g=await s[0];if(g===Gnr)return;if(i.aborted)throw new lE;g!==G0e&&(yield g),s.shift(),h()}await new Wnr(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function MFn(t=void 0){return t!=null&&U2(t,"options"),t?.signal!=null&&q2(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 lE({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Znr(t,e=void 0){for await(let r of y7e.call(this,t,e))return!0;return!1}async function RFn(t,e=void 0){if(typeof t!="function")throw new noe("fn",["Function","AsyncFunction"],t);return!await Znr.call(this,async(...r)=>!await t(...r),e)}async function IFn(t,e){for await(let r of y7e.call(this,t,e))return r}async function AFn(t,e){if(typeof t!="function")throw new noe("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),G0e}for await(let n of X0e.call(this,r,e));}function y7e(t,e){if(typeof t!="function")throw new noe("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:G0e}return X0e.call(this,r,e)}var g7e=class extends pFn{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function NFn(t,e,r){var n;if(typeof t!="function")throw new noe("reducer",["Function","AsyncFunction"],t);r!=null&&U2(r,"options"),r?.signal!=null&&q2(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new lE(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await yFn(this.destroy(l)),l}let i=new dFn,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[hFn]:this,[gFn]:!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 lE;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new g7e}finally{i.abort()}return e}async function DFn(t){t!=null&&U2(t,"options"),t?.signal!=null&&q2(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 lE(void 0,{cause:t.signal.reason});CFn(e,n)}return e}function jFn(t,e){let r=X0e.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function Ynr(t){if(t=TFn(t),OFn(t))return 0;if(t<0)throw new mFn("number",">= 0",t);return t}function $Fn(t,e=void 0){return e!=null&&U2(e,"options"),e?.signal!=null&&q2(e.signal,"options.signal"),t=Ynr(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lE;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new lE;t--<=0&&(yield i)}}.call(this)}function LFn(t,e=void 0){return e!=null&&U2(e,"options"),e?.signal!=null&&q2(e.signal,"options.signal"),t=Ynr(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lE;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new lE;if(t-- >0&&(yield i),t<=0)return}}.call(this)}b7e.exports.streamReturningOperators={asIndexedPairs:SFn(MFn,"readable.asIndexedPairs will be removed in a future version."),drop:$Fn,filter:y7e,flatMap:jFn,map:X0e,take:LFn,compose:PFn};b7e.exports.promiseReturningOperators={every:RFn,forEach:AFn,reduce:NFn,toArray:DFn,some:Znr,find:IFn}});var _7e=S((twa,eor)=>{"use strict";var{ArrayPrototypePop:FFn,Promise:kFn}=Sc(),{isIterable:qFn,isNodeStream:UFn,isWebStream:BFn}=iE(),{pipelineImpl:zFn}=W0e(),{finished:VFn}=J1();v7e();function HFn(...t){return new kFn((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!UFn(i)&&!qFn(i)&&!BFn(i)){let a=FFn(t);n=a.signal,o=a.end}zFn(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}eor.exports={finished:VFn,pipeline:HFn}});var v7e=S((rwa,lor)=>{var{Buffer:WFn}=zS(),{ObjectDefineProperty:X1,ObjectKeys:nor,ReflectApply:oor}=Sc(),{promisify:{custom:ior}}=Xy(),{streamReturningOperators:tor,promiseReturningOperators:ror}=Qnr(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:aor}}=Qb(),JFn=h7e(),{setDefaultHighWaterMark:KFn,getDefaultHighWaterMark:GFn}=Kne(),{pipeline:sor}=W0e(),{destroyer:XFn}=D2(),uor=J1(),w7e=_7e(),ooe=iE(),xl=lor.exports=M0e().Stream;xl.isDestroyed=ooe.isDestroyed;xl.isDisturbed=ooe.isDisturbed;xl.isErrored=ooe.isErrored;xl.isReadable=ooe.isReadable;xl.isWritable=ooe.isWritable;xl.Readable=Zne();for(let t of nor(tor)){let r=function(...n){if(new.target)throw aor();return xl.Readable.from(oor(e,this,n))};S7e=r;let e=tor[t];X1(r,"name",{__proto__:null,value:e.name}),X1(r,"length",{__proto__:null,value:e.length}),X1(xl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var S7e;for(let t of nor(ror)){let r=function(...o){if(new.target)throw aor();return oor(e,this,o)};S7e=r;let e=ror[t];X1(r,"name",{__proto__:null,value:e.name}),X1(r,"length",{__proto__:null,value:e.length}),X1(xl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var S7e;xl.Writable=B0e();xl.Duplex=uE();xl.Transform=r7e();xl.PassThrough=o7e();xl.pipeline=sor;var{addAbortSignal:ZFn}=Jne();xl.addAbortSignal=ZFn;xl.finished=uor;xl.destroy=XFn;xl.compose=JFn;xl.setDefaultHighWaterMark=KFn;xl.getDefaultHighWaterMark=GFn;X1(xl,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return w7e}});X1(sor,ior,{__proto__:null,enumerable:!0,get(){return w7e.pipeline}});X1(uor,ior,{__proto__:null,enumerable:!0,get(){return w7e.finished}});xl.Stream=xl;xl._isUint8Array=function(e){return e instanceof Uint8Array};xl._uint8ArrayToBuffer=function(e){return WFn.from(e.buffer,e.byteOffset,e.byteLength)}});var ioe=S((nwa,dd)=>{"use strict";var km=v7e(),YFn=_7e(),QFn=km.Readable.destroy;dd.exports=km.Readable;dd.exports._uint8ArrayToBuffer=km._uint8ArrayToBuffer;dd.exports._isUint8Array=km._isUint8Array;dd.exports.isDisturbed=km.isDisturbed;dd.exports.isErrored=km.isErrored;dd.exports.isReadable=km.isReadable;dd.exports.Readable=km.Readable;dd.exports.Writable=km.Writable;dd.exports.Duplex=km.Duplex;dd.exports.Transform=km.Transform;dd.exports.PassThrough=km.PassThrough;dd.exports.addAbortSignal=km.addAbortSignal;dd.exports.finished=km.finished;dd.exports.destroy=km.destroy;dd.exports.destroy=QFn;dd.exports.pipeline=km.pipeline;dd.exports.compose=km.compose;Object.defineProperty(km,"promises",{configurable:!0,enumerable:!0,get(){return YFn}});dd.exports.Stream=km.Stream;dd.exports.default=dd.exports});var por=S(aoe=>{"use strict";Object.defineProperty(aoe,"__esModule",{value:!0});aoe.Headers=void 0;var cor;typeof globalThis.Headers<"u"?aoe.Headers=cor=globalThis.Headers:aoe.Headers=cor=class dor{constructor(e){if(this.headers=new Map,e)if(e instanceof dor)e.forEach((r,n)=>this.append(n,r));else if(Array.isArray(e))for(let[r,n]of e)if(typeof r=="string"&&typeof n=="string")this.append(r,n);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,n]of Object.entries(e))if(typeof n=="string")this.append(r,n);else throw new TypeError("Header values must be strings")}append(e,r){let n=e.toLowerCase(),o=this.headers.get(n)||[];this.headers.set(n,[...o,r])}delete(e){let r=e.toLowerCase();this.headers.delete(r)}get(e){let r=e.toLowerCase(),n=this.headers.get(r);return n?n.join(", "):null}has(e){let r=e.toLowerCase();return this.headers.has(r)}set(e,r){let n=e.toLowerCase();this.headers.set(n,[r])}forEach(e,r){let n=r?e.bind(r):e;this.headers.forEach((o,i)=>n(o.join(", "),i,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[e,r]of this.headers.entries())yield[e,r.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let e of this.headers.values())yield e.join(", ")}[Symbol.iterator](){return this.entries()}}});var C7e=S(B2=>{"use strict";Object.defineProperty(B2,"__esModule",{value:!0});B2.unknownRawResponse=B2.abortRawResponse=void 0;B2.toRawResponse=ekn;var mor=por();B2.abortRawResponse={headers:new mor.Headers,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""};B2.unknownRawResponse={headers:new mor.Headers,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function ekn(t){return{headers:t.headers,redirected:t.redirected,status:t.status,statusText:t.statusText,type:t.type,url:t.url}}});var z2=S((awa,hor)=>{"use strict";hor.exports=TypeError});var gor=S(()=>{});var coe=S((lwa,$or)=>{var N7e=typeof Map=="function"&&Map.prototype,x7e=Object.getOwnPropertyDescriptor&&N7e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Y0e=N7e&&x7e&&typeof x7e.get=="function"?x7e.get:null,yor=N7e&&Map.prototype.forEach,D7e=typeof Set=="function"&&Set.prototype,T7e=Object.getOwnPropertyDescriptor&&D7e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Q0e=D7e&&T7e&&typeof T7e.get=="function"?T7e.get:null,bor=D7e&&Set.prototype.forEach,tkn=typeof WeakMap=="function"&&WeakMap.prototype,uoe=tkn?WeakMap.prototype.has:null,rkn=typeof WeakSet=="function"&&WeakSet.prototype,loe=rkn?WeakSet.prototype.has:null,nkn=typeof WeakRef=="function"&&WeakRef.prototype,_or=nkn?WeakRef.prototype.deref:null,okn=Boolean.prototype.valueOf,ikn=Object.prototype.toString,akn=Function.prototype.toString,skn=String.prototype.match,j7e=String.prototype.slice,Ck=String.prototype.replace,ukn=String.prototype.toUpperCase,vor=String.prototype.toLowerCase,Mor=RegExp.prototype.test,wor=Array.prototype.concat,cE=Array.prototype.join,lkn=Array.prototype.slice,Sor=Math.floor,P7e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,O7e=Object.getOwnPropertySymbols,M7e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,zK=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Yy=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===zK||!0)?Symbol.toStringTag:null,Ror=Object.prototype.propertyIsEnumerable,Cor=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function xor(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Mor.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Sor(-t):Sor(t);if(n!==t){var o=String(n),i=j7e.call(e,o.length+1);return Ck.call(o,r,"$&_")+"."+Ck.call(Ck.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ck.call(e,r,"$&_")}var R7e=gor(),Tor=R7e.custom,Oor=Nor(Tor)?Tor:null,Ior={__proto__:null,double:'"',single:"'"},ckn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};$or.exports=function t(e,r,n,o){var i=r||{};if(Z1(i,"quoteStyle")&&!Z1(Ior,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Z1(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=Z1(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(Z1(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(Z1(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 jor(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?xor(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?xor(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 I7e(e)?"[Array]":"[Object]";var d=Pkn(i,n);if(typeof o>"u")o=[];else if(Dor(o,e)>=0)return"[Circular]";function f(V,k,X){if(k&&(o=lkn.call(o),o.push(k)),X){var B={depth:i.depth};return Z1(i,"quoteStyle")&&(B.quoteStyle=i.quoteStyle),t(V,B,n+1,o)}return t(V,i,n+1,o)}if(typeof e=="function"&&!Eor(e)){var p=_kn(e),m=Z0e(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+cE.call(m,", ")+" }":"")}if(Nor(e)){var h=zK?Ck.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):M7e.call(e);return typeof e=="object"&&!zK?soe(h):h}if(Tkn(e)){for(var y="<"+vor.call(String(e.nodeName)),g=e.attributes||[],b=0;b<g.length;b++)y+=" "+g[b].name+"="+Aor(dkn(g[b].value),"double",i);return y+=">",e.childNodes&&e.childNodes.length&&(y+="..."),y+="</"+vor.call(String(e.nodeName))+">",y}if(I7e(e)){if(e.length===0)return"[]";var _=Z0e(e,f);return d&&!Ekn(_)?"["+A7e(_,d)+"]":"[ "+cE.call(_,", ")+" ]"}if(pkn(e)){var w=Z0e(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Ror.call(e,"cause")?"{ ["+String(e)+"] "+cE.call(wor.call("[cause]: "+f(e.cause),w),", ")+" }":w.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+cE.call(w,", ")+" }"}if(typeof e=="object"&&a){if(Oor&&typeof e[Oor]=="function"&&R7e)return R7e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(vkn(e)){var T=[];return yor&&yor.call(e,function(V,k){T.push(f(k,e,!0)+" => "+f(V,e))}),Por("Map",Y0e.call(e),T,d)}if(Ckn(e)){var O=[];return bor&&bor.call(e,function(V){O.push(f(V,e))}),Por("Set",Q0e.call(e),O,d)}if(wkn(e))return E7e("WeakMap");if(xkn(e))return E7e("WeakSet");if(Skn(e))return E7e("WeakRef");if(hkn(e))return soe(f(Number(e)));if(ykn(e))return soe(f(P7e.call(e)));if(gkn(e))return soe(okn.call(e));if(mkn(e))return soe(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(!fkn(e)&&!Eor(e)){var E=Z0e(e,f),P=Cor?Cor(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",I=!P&&Yy&&Object(e)===e&&Yy in e?j7e.call(xk(e),8,-1):R?"Object":"",N=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",z=N+(I||R?"["+cE.call(wor.call([],I||[],R||[]),": ")+"] ":"");return E.length===0?z+"{}":d?z+"{"+A7e(E,d)+"}":z+"{ "+cE.call(E,", ")+" }"}return String(e)};function Aor(t,e,r){var n=r.quoteStyle||e,o=Ior[n];return o+t+o}function dkn(t){return Ck.call(String(t),/"/g,""")}function I7e(t){return xk(t)==="[object Array]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function fkn(t){return xk(t)==="[object Date]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function Eor(t){return xk(t)==="[object RegExp]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function pkn(t){return xk(t)==="[object Error]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function mkn(t){return xk(t)==="[object String]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function hkn(t){return xk(t)==="[object Number]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function gkn(t){return xk(t)==="[object Boolean]"&&(!Yy||!(typeof t=="object"&&Yy in t))}function Nor(t){if(zK)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!M7e)return!1;try{return M7e.call(t),!0}catch{}return!1}function ykn(t){if(!t||typeof t!="object"||!P7e)return!1;try{return P7e.call(t),!0}catch{}return!1}var bkn=Object.prototype.hasOwnProperty||function(t){return t in this};function Z1(t,e){return bkn.call(t,e)}function xk(t){return ikn.call(t)}function _kn(t){if(t.name)return t.name;var e=skn.call(akn.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Dor(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 vkn(t){if(!Y0e||!t||typeof t!="object")return!1;try{Y0e.call(t);try{Q0e.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function wkn(t){if(!uoe||!t||typeof t!="object")return!1;try{uoe.call(t,uoe);try{loe.call(t,loe)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Skn(t){if(!_or||!t||typeof t!="object")return!1;try{return _or.call(t),!0}catch{}return!1}function Ckn(t){if(!Q0e||!t||typeof t!="object")return!1;try{Q0e.call(t);try{Y0e.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function xkn(t){if(!loe||!t||typeof t!="object")return!1;try{loe.call(t,loe);try{uoe.call(t,uoe)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Tkn(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function jor(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return jor(j7e.call(t,0,e.maxStringLength),e)+n}var o=ckn[e.quoteStyle||"single"];o.lastIndex=0;var i=Ck.call(Ck.call(t,o,"\\$1"),/[\x00-\x1f]/g,Okn);return Aor(i,"single",e)}function Okn(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":"")+ukn.call(e.toString(16))}function soe(t){return"Object("+t+")"}function E7e(t){return t+" { ? }"}function Por(t,e,r,n){var o=n?A7e(r,n):cE.call(r,", ");return t+" ("+e+") {"+o+"}"}function Ekn(t){for(var e=0;e<t.length;e++)if(Dor(t[e],`
|
||
`)>=0)return!1;return!0}function Pkn(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=cE.call(Array(t.indent+1)," ");else return null;return{base:r,prev:cE.call(Array(e+1),r)}}function A7e(t,e){if(t.length===0)return"";var r=`
|
||
`+e.prev+e.base;return r+cE.call(t,","+r)+`
|
||
`+e.prev}function Z0e(t,e){var r=I7e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=Z1(t,o)?e(t[o],t):""}var i=typeof O7e=="function"?O7e(t):[],a;if(zK){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)Z1(t,u)&&(r&&String(Number(u))===u&&u<t.length||zK&&a["$"+u]instanceof Symbol||(Mor.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof O7e=="function")for(var l=0;l<i.length;l++)Ror.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var For=S((cwa,Lor)=>{"use strict";var Mkn=coe(),Rkn=z2(),eCe=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},Ikn=function(t,e){if(t){var r=eCe(t,e);return r&&r.value}},Akn=function(t,e,r){var n=eCe(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Nkn=function(t,e){return t?!!eCe(t,e):!1},Dkn=function(t,e){if(t)return eCe(t,e,!0)};Lor.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Rkn("Side channel does not contain "+Mkn(n))},delete:function(n){var o=e&&e.next,i=Dkn(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return Ikn(e,n)},has:function(n){return Nkn(e,n)},set:function(n,o){e||(e={next:void 0}),Akn(e,n,o)}};return r}});var $7e=S((dwa,kor)=>{"use strict";kor.exports=Object});var Uor=S((fwa,qor)=>{"use strict";qor.exports=Error});var zor=S((pwa,Bor)=>{"use strict";Bor.exports=EvalError});var Hor=S((mwa,Vor)=>{"use strict";Vor.exports=RangeError});var Jor=S((hwa,Wor)=>{"use strict";Wor.exports=ReferenceError});var Gor=S((gwa,Kor)=>{"use strict";Kor.exports=SyntaxError});var Zor=S((ywa,Xor)=>{"use strict";Xor.exports=URIError});var Qor=S((bwa,Yor)=>{"use strict";Yor.exports=Math.abs});var tir=S((_wa,eir)=>{"use strict";eir.exports=Math.floor});var nir=S((vwa,rir)=>{"use strict";rir.exports=Math.max});var iir=S((wwa,oir)=>{"use strict";oir.exports=Math.min});var sir=S((Swa,air)=>{"use strict";air.exports=Math.pow});var lir=S((Cwa,uir)=>{"use strict";uir.exports=Math.round});var dir=S((xwa,cir)=>{"use strict";cir.exports=Number.isNaN||function(e){return e!==e}});var pir=S((Twa,fir)=>{"use strict";var jkn=dir();fir.exports=function(e){return jkn(e)||e===0?e:e<0?-1:1}});var hir=S((Owa,mir)=>{"use strict";mir.exports=Object.getOwnPropertyDescriptor});var L7e=S((Ewa,gir)=>{"use strict";var tCe=hir();if(tCe)try{tCe([],"length")}catch{tCe=null}gir.exports=tCe});var bir=S((Pwa,yir)=>{"use strict";var rCe=Object.defineProperty||!1;if(rCe)try{rCe({},"a",{value:1})}catch{rCe=!1}yir.exports=rCe});var vir=S((Mwa,_ir)=>{"use strict";_ir.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 Cir=S((Rwa,Sir)=>{"use strict";var wir=typeof Symbol<"u"&&Symbol,$kn=vir();Sir.exports=function(){return typeof wir!="function"||typeof Symbol!="function"||typeof wir("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:$kn()}});var F7e=S((Iwa,xir)=>{"use strict";xir.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var k7e=S((Awa,Tir)=>{"use strict";var Lkn=$7e();Tir.exports=Lkn.getPrototypeOf||null});var Pir=S((Nwa,Eir)=>{"use strict";var Fkn="Function.prototype.bind called on incompatible ",kkn=Object.prototype.toString,qkn=Math.max,Ukn="[object Function]",Oir=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},Bkn=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},zkn=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};Eir.exports=function(e){var r=this;if(typeof r!="function"||kkn.apply(r)!==Ukn)throw new TypeError(Fkn+r);for(var n=Bkn(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,Oir(n,arguments));return Object(c)===c?c:this}return r.apply(e,Oir(n,arguments))},a=qkn(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+zkn(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 doe=S((Dwa,Mir)=>{"use strict";var Vkn=Pir();Mir.exports=Function.prototype.bind||Vkn});var nCe=S((jwa,Rir)=>{"use strict";Rir.exports=Function.prototype.call});var q7e=S(($wa,Iir)=>{"use strict";Iir.exports=Function.prototype.apply});var Nir=S((Lwa,Air)=>{"use strict";Air.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var jir=S((Fwa,Dir)=>{"use strict";var Hkn=doe(),Wkn=q7e(),Jkn=nCe(),Kkn=Nir();Dir.exports=Kkn||Hkn.call(Jkn,Wkn)});var U7e=S((kwa,$ir)=>{"use strict";var Gkn=doe(),Xkn=z2(),Zkn=nCe(),Ykn=jir();$ir.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new Xkn("a function is required");return Ykn(Gkn,Zkn,e)}});var Bir=S((qwa,Uir)=>{"use strict";var Qkn=U7e(),Lir=L7e(),kir;try{kir=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var B7e=!!kir&&Lir&&Lir(Object.prototype,"__proto__"),qir=Object,Fir=qir.getPrototypeOf;Uir.exports=B7e&&typeof B7e.get=="function"?Qkn([B7e.get]):typeof Fir=="function"?function(e){return Fir(e==null?e:qir(e))}:!1});var Jir=S((Uwa,Wir)=>{"use strict";var zir=F7e(),Vir=k7e(),Hir=Bir();Wir.exports=zir?function(e){return zir(e)}:Vir?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Vir(e)}:Hir?function(e){return Hir(e)}:null});var Gir=S((Bwa,Kir)=>{"use strict";var eqn=Function.prototype.call,tqn=Object.prototype.hasOwnProperty,rqn=doe();Kir.exports=rqn.call(eqn,tqn)});var aCe=S((zwa,tar)=>{"use strict";var Fi,nqn=$7e(),oqn=Uor(),iqn=zor(),aqn=Hor(),sqn=Jor(),JK=Gor(),WK=z2(),uqn=Zor(),lqn=Qor(),cqn=tir(),dqn=nir(),fqn=iir(),pqn=sir(),mqn=lir(),hqn=pir(),Qir=Function,z7e=function(t){try{return Qir('"use strict"; return ('+t+").constructor;")()}catch{}},foe=L7e(),gqn=bir(),V7e=function(){throw new WK},yqn=foe?function(){try{return arguments.callee,V7e}catch{try{return foe(arguments,"callee").get}catch{return V7e}}}():V7e,VK=Cir()(),qh=Jir(),bqn=k7e(),_qn=F7e(),ear=q7e(),poe=nCe(),HK={},vqn=typeof Uint8Array>"u"||!qh?Fi:qh(Uint8Array),V2={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Fi:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fi:ArrayBuffer,"%ArrayIteratorPrototype%":VK&&qh?qh([][Symbol.iterator]()):Fi,"%AsyncFromSyncIteratorPrototype%":Fi,"%AsyncFunction%":HK,"%AsyncGenerator%":HK,"%AsyncGeneratorFunction%":HK,"%AsyncIteratorPrototype%":HK,"%Atomics%":typeof Atomics>"u"?Fi:Atomics,"%BigInt%":typeof BigInt>"u"?Fi:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Fi:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Fi:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fi:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":oqn,"%eval%":eval,"%EvalError%":iqn,"%Float32Array%":typeof Float32Array>"u"?Fi:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fi:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fi:FinalizationRegistry,"%Function%":Qir,"%GeneratorFunction%":HK,"%Int8Array%":typeof Int8Array>"u"?Fi:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fi:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fi:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":VK&&qh?qh(qh([][Symbol.iterator]())):Fi,"%JSON%":typeof JSON=="object"?JSON:Fi,"%Map%":typeof Map>"u"?Fi:Map,"%MapIteratorPrototype%":typeof Map>"u"||!VK||!qh?Fi:qh(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":nqn,"%Object.getOwnPropertyDescriptor%":foe,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fi:Promise,"%Proxy%":typeof Proxy>"u"?Fi:Proxy,"%RangeError%":aqn,"%ReferenceError%":sqn,"%Reflect%":typeof Reflect>"u"?Fi:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fi:Set,"%SetIteratorPrototype%":typeof Set>"u"||!VK||!qh?Fi:qh(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fi:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":VK&&qh?qh(""[Symbol.iterator]()):Fi,"%Symbol%":VK?Symbol:Fi,"%SyntaxError%":JK,"%ThrowTypeError%":yqn,"%TypedArray%":vqn,"%TypeError%":WK,"%Uint8Array%":typeof Uint8Array>"u"?Fi:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fi:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fi:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fi:Uint32Array,"%URIError%":uqn,"%WeakMap%":typeof WeakMap>"u"?Fi:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fi:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fi:WeakSet,"%Function.prototype.call%":poe,"%Function.prototype.apply%":ear,"%Object.defineProperty%":gqn,"%Object.getPrototypeOf%":bqn,"%Math.abs%":lqn,"%Math.floor%":cqn,"%Math.max%":dqn,"%Math.min%":fqn,"%Math.pow%":pqn,"%Math.round%":mqn,"%Math.sign%":hqn,"%Reflect.getPrototypeOf%":_qn};if(qh)try{null.error}catch(t){Xir=qh(qh(t)),V2["%Error.prototype%"]=Xir}var Xir,wqn=function t(e){var r;if(e==="%AsyncFunction%")r=z7e("async function () {}");else if(e==="%GeneratorFunction%")r=z7e("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=z7e("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&qh&&(r=qh(o.prototype))}return V2[e]=r,r},Zir={__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"]},moe=doe(),oCe=Gir(),Sqn=moe.call(poe,Array.prototype.concat),Cqn=moe.call(ear,Array.prototype.splice),Yir=moe.call(poe,String.prototype.replace),iCe=moe.call(poe,String.prototype.slice),xqn=moe.call(poe,RegExp.prototype.exec),Tqn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Oqn=/\\(\\)?/g,Eqn=function(e){var r=iCe(e,0,1),n=iCe(e,-1);if(r==="%"&&n!=="%")throw new JK("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new JK("invalid intrinsic syntax, expected opening `%`");var o=[];return Yir(e,Tqn,function(i,a,s,u){o[o.length]=s?Yir(u,Oqn,"$1"):a||i}),o},Pqn=function(e,r){var n=e,o;if(oCe(Zir,n)&&(o=Zir[n],n="%"+o[0]+"%"),oCe(V2,n)){var i=V2[n];if(i===HK&&(i=wqn(n)),typeof i>"u"&&!r)throw new WK("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new JK("intrinsic "+e+" does not exist!")};tar.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new WK("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new WK('"allowMissing" argument must be a boolean');if(xqn(/^%?[^%]*%?$/,e)===null)throw new JK("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Eqn(e),o=n.length>0?n[0]:"",i=Pqn("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],Cqn(n,Sqn([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=iCe(f,0,1),m=iCe(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new JK("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",oCe(V2,a))s=V2[a];else if(s!=null){if(!(f in s)){if(!r)throw new WK("base intrinsic for "+e+" exists, but the property is not available.");return}if(foe&&c+1>=n.length){var h=foe(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=oCe(s,f),s=s[f];d&&!u&&(V2[a]=s)}}return s}});var H7e=S((Vwa,oar)=>{"use strict";var rar=aCe(),nar=U7e(),Mqn=nar([rar("%String.prototype.indexOf%")]);oar.exports=function(e,r){var n=rar(e,!!r);return typeof n=="function"&&Mqn(e,".prototype.")>-1?nar([n]):n}});var W7e=S((Hwa,aar)=>{"use strict";var Rqn=aCe(),hoe=H7e(),Iqn=coe(),Aqn=z2(),iar=Rqn("%Map%",!0),Nqn=hoe("Map.prototype.get",!0),Dqn=hoe("Map.prototype.set",!0),jqn=hoe("Map.prototype.has",!0),$qn=hoe("Map.prototype.delete",!0),Lqn=hoe("Map.prototype.size",!0);aar.exports=!!iar&&function(){var e,r={assert:function(n){if(!r.has(n))throw new Aqn("Side channel does not contain "+Iqn(n))},delete:function(n){if(e){var o=$qn(e,n);return Lqn(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return Nqn(e,n)},has:function(n){return e?jqn(e,n):!1},set:function(n,o){e||(e=new iar),Dqn(e,n,o)}};return r}});var uar=S((Wwa,sar)=>{"use strict";var Fqn=aCe(),uCe=H7e(),kqn=coe(),sCe=W7e(),qqn=z2(),KK=Fqn("%WeakMap%",!0),Uqn=uCe("WeakMap.prototype.get",!0),Bqn=uCe("WeakMap.prototype.set",!0),zqn=uCe("WeakMap.prototype.has",!0),Vqn=uCe("WeakMap.prototype.delete",!0);sar.exports=KK?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new qqn("Side channel does not contain "+kqn(o))},delete:function(o){if(KK&&o&&(typeof o=="object"||typeof o=="function")){if(e)return Vqn(e,o)}else if(sCe&&r)return r.delete(o);return!1},get:function(o){return KK&&o&&(typeof o=="object"||typeof o=="function")&&e?Uqn(e,o):r&&r.get(o)},has:function(o){return KK&&o&&(typeof o=="object"||typeof o=="function")&&e?zqn(e,o):!!r&&r.has(o)},set:function(o,i){KK&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new KK),Bqn(e,o,i)):sCe&&(r||(r=sCe()),r.set(o,i))}};return n}:sCe});var J7e=S((Jwa,lar)=>{"use strict";var Hqn=z2(),Wqn=coe(),Jqn=For(),Kqn=W7e(),Gqn=uar(),Xqn=Gqn||Kqn||Jqn;lar.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new Hqn("Side channel does not contain "+Wqn(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=Xqn()),e.set(n,o)}};return r}});var lCe=S((Kwa,car)=>{"use strict";var Zqn=String.prototype.replace,Yqn=/%20/g,K7e={RFC1738:"RFC1738",RFC3986:"RFC3986"};car.exports={default:K7e.RFC3986,formatters:{RFC1738:function(t){return Zqn.call(t,Yqn,"+")},RFC3986:function(t){return String(t)}},RFC1738:K7e.RFC1738,RFC3986:K7e.RFC3986}});var Q7e=S((Gwa,par)=>{"use strict";var Qqn=lCe(),eUn=J7e(),G7e=Object.prototype.hasOwnProperty,H2=Array.isArray,dCe=eUn(),dar=function(e,r){return dCe.set(e,r),e},cCe=function(e){return dCe.has(e)},Z7e=function(e){return dCe.get(e)},far=function(e,r){dCe.set(e,r)},dE=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),tUn=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(H2(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Y7e=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},o=0;o<e.length;++o)typeof e[o]<"u"&&(n[o]=e[o]);return n},rUn=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(H2(e))e.push(r);else if(e&&typeof e=="object")if(cCe(e)){var o=Z7e(e)+1;e[o]=r,far(e,o)}else(n&&(n.plainObjects||n.allowPrototypes)||!G7e.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object"){if(cCe(r)){for(var i=Object.keys(r),a=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},s=0;s<i.length;s++){var u=parseInt(i[s],10);a[u+1]=r[i[s]]}return dar(a,Z7e(r)+1)}return[e].concat(r)}var l=e;return H2(e)&&!H2(r)&&(l=Y7e(e,n)),H2(e)&&H2(r)?(r.forEach(function(c,d){if(G7e.call(e,d)){var f=e[d];f&&typeof f=="object"&&c&&typeof c=="object"?e[d]=t(f,c,n):e.push(c)}else e[d]=c}),e):Object.keys(r).reduce(function(c,d){var f=r[d];return G7e.call(c,d)?c[d]=t(c[d],f,n):c[d]=f,c},l)},nUn=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},oUn=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}},X7e=1024,iUn=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(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});for(var s="",u=0;u<a.length;u+=X7e){for(var l=a.length>=X7e?a.slice(u,u+X7e):a,c=[],d=0;d<l.length;++d){var f=l.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===Qqn.RFC1738&&(f===40||f===41)){c[c.length]=l.charAt(d);continue}if(f<128){c[c.length]=dE[f];continue}if(f<2048){c[c.length]=dE[192|f>>6]+dE[128|f&63];continue}if(f<55296||f>=57344){c[c.length]=dE[224|f>>12]+dE[128|f>>6&63]+dE[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=dE[240|f>>18]+dE[128|f>>12&63]+dE[128|f>>6&63]+dE[128|f&63]}s+=c.join("")}return s},aUn=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 tUn(r),e},sUn=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},uUn=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},lUn=function(e,r,n,o){if(cCe(e)){var i=Z7e(e)+1;return e[i]=r,far(e,i),e}var a=[].concat(e,r);return a.length>n?dar(Y7e(a,{plainObjects:o}),a.length-1):a},cUn=function(e,r){if(H2(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};par.exports={arrayToObject:Y7e,assign:nUn,combine:lUn,compact:aUn,decode:oUn,encode:iUn,isBuffer:uUn,isOverflow:cCe,isRegExp:sUn,maybeMap:cUn,merge:rUn}});var _ar=S((Xwa,bar)=>{"use strict";var har=J7e(),fCe=Q7e(),goe=lCe(),dUn=Object.prototype.hasOwnProperty,gar={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},fE=Array.isArray,fUn=Array.prototype.push,yar=function(t,e){fUn.apply(t,fE(e)?e:[e])},pUn=Date.prototype.toISOString,mar=goe.default,qm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:fCe.encode,encodeValuesOnly:!1,filter:void 0,format:mar,formatter:goe.formatters[mar],indices:!1,serializeDate:function(e){return pUn.call(e)},skipNulls:!1,strictNullHandling:!1},mUn=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},eXe={},hUn=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g,b){for(var _=e,w=b,T=0,O=!1;(w=w.get(eXe))!==void 0&&!O;){var E=w.get(e);if(T+=1,typeof E<"u"){if(E===T)throw new RangeError("Cyclic object value");O=!0}typeof w.get(eXe)>"u"&&(T=0)}if(typeof c=="function"?_=c(r,_):_ instanceof Date?_=p(_):n==="comma"&&fE(_)&&(_=fCe.maybeMap(_,function(oe){return oe instanceof Date?p(oe):oe})),_===null){if(a)return l&&!y?l(r,qm.encoder,g,"key",m):r;_=""}if(mUn(_)||fCe.isBuffer(_)){if(l){var P=y?r:l(r,qm.encoder,g,"key",m);return[h(P)+"="+h(l(_,qm.encoder,g,"value",m))]}return[h(r)+"="+h(String(_))]}var R=[];if(typeof _>"u")return R;var I;if(n==="comma"&&fE(_))y&&l&&(_=fCe.maybeMap(_,l)),I=[{value:_.length>0?_.join(",")||null:void 0}];else if(fE(c))I=c;else{var N=Object.keys(_);I=d?N.sort(d):N}var z=u?String(r).replace(/\./g,"%2E"):String(r),V=o&&fE(_)&&_.length===1?z+"[]":z;if(i&&fE(_)&&_.length===0)return V+"[]";for(var k=0;k<I.length;++k){var X=I[k],B=typeof X=="object"&&X&&typeof X.value<"u"?X.value:_[X];if(!(s&&B===null)){var Q=f&&u?String(X).replace(/\./g,"%2E"):String(X),Y=fE(_)?typeof n=="function"?n(V,Q):V:V+(f?"."+Q:"["+Q+"]");b.set(e,T);var K=har();K.set(eXe,b),yar(R,t(B,Y,n,o,i,a,s,u,n==="comma"&&y&&fE(_)?null:l,c,d,f,p,m,h,y,g,K))}}return R},gUn=function(e){if(!e)return qm;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");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||qm.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=goe.default;if(typeof e.format<"u"){if(!dUn.call(goe.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=goe.formatters[n],i=qm.filter;(typeof e.filter=="function"||fE(e.filter))&&(i=e.filter);var a;if(e.arrayFormat in gar?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=qm.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var s=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:qm.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:qm.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:qm.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:qm.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?qm.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:qm.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:qm.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:qm.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:qm.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:qm.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:qm.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:qm.strictNullHandling}};bar.exports=function(t,e){var r=t,n=gUn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):fE(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s=gar[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var l=har(),c=0;c<o.length;++c){var d=o[c],f=r[d];n.skipNulls&&f===null||yar(a,hUn(f,d,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))}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 xar=S((Zwa,Car)=>{"use strict";var Tk=Q7e(),pCe=Object.prototype.hasOwnProperty,war=Array.isArray,qc={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:Tk.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},yUn=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Sar=function(t,e,r){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},bUn="utf8=%26%2310003%3B",_Un="utf8=%E2%9C%93",vUn=function(e,r){var n={__proto__:null},o=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=r.parameterLimit===1/0?void 0:r.parameterLimit,a=o.split(r.delimiter,r.throwOnLimitExceeded?i+1:i);if(r.throwOnLimitExceeded&&a.length>i)throw new RangeError("Parameter limit exceeded. Only "+i+" parameter"+(i===1?"":"s")+" allowed.");var s=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u<a.length;++u)a[u].indexOf("utf8=")===0&&(a[u]===_Un?l="utf-8":a[u]===bUn&&(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;if(f===-1?(p=r.decoder(c,qc.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),qc.decoder,l,"key"),p!==null&&(m=Tk.maybeMap(Sar(c.slice(f+1),r,war(n[p])?n[p].length:0),function(y){return r.decoder(y,qc.decoder,l,"value")}))),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=yUn(String(m))),c.indexOf("[]=")>-1&&(m=war(m)?[m]:m),p!==null){var h=pCe.call(n,p);h&&r.duplicates==="combine"?n[p]=Tk.combine(n[p],m,r.arrayLimit,r.plainObjects):(!h||r.duplicates==="last")&&(n[p]=m)}}return n},wUn=function(t,e,r,n){var o=0;if(t.length>0&&t[t.length-1]==="[]"){var i=t.slice(0,-1).join("");o=Array.isArray(e)&&e[i]?e[i].length:0}for(var a=n?e:Sar(e,r,o),s=t.length-1;s>=0;--s){var u,l=t[s];if(l==="[]"&&r.parseArrays)Tk.isOverflow(a)?u=a:u=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:Tk.combine([],a,r.arrayLimit,r.plainObjects);else{u=r.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,f=parseInt(d,10);!r.parseArrays&&d===""?u={0:a}:!isNaN(f)&&l!==d&&String(f)===d&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(u=[],u[f]=a):d!=="__proto__"&&(u[d]=a)}a=u}return a},SUn=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&pCe.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var o=/(\[[^[\]]*])/,i=/(\[[^[\]]*])/g,a=o.exec(n),s=a?n.slice(0,a.index):n,u=[];if(s){if(!r.plainObjects&&pCe.call(Object.prototype,s)&&!r.allowPrototypes)return;u.push(s)}for(var l=0;(a=i.exec(n))!==null&&l<r.depth;){l+=1;var c=a[1].slice(1,-1);if(!r.plainObjects&&pCe.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(a[1])}if(a){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");u.push("["+n.slice(a.index)+"]")}return u},CUn=function(e,r,n,o){if(e){var i=SUn(e,n);if(i)return wUn(i,r,n,o)}},xUn=function(e){if(!e)return qc;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&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");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?qc.charset:e.charset,n=typeof e.duplicates>"u"?qc.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:qc.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:qc.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:qc.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:qc.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:qc.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:qc.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:qc.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:qc.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:qc.decoder,delimiter:typeof e.delimiter=="string"||Tk.isRegExp(e.delimiter)?e.delimiter:qc.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:qc.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:qc.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:qc.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:qc.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:qc.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:qc.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Car.exports=function(t,e){var r=xUn(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?vUn(t,r):t,o=r.plainObjects?{__proto__:null}:{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=CUn(s,n[s],r,typeof t=="string");o=Tk.merge(o,u,r)}return r.allowSparse===!0?o:Tk.compact(o)}});var tXe=S((Ywa,Tar)=>{"use strict";var TUn=_ar(),OUn=xar(),EUn=lCe();Tar.exports={formats:EUn,parse:OUn,stringify:TUn}});var Oar=S(yoe=>{"use strict";var PUn=yoe&&yoe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yoe,"__esModule",{value:!0});yoe.createRequestUrl=RUn;var MUn=PUn(tXe());function RUn(t,e){return Object.keys(e??{}).length>0?`${t}?${MUn.default.stringify(e,{arrayFormat:"repeat"})}`:t}});var Ear=S(mCe=>{"use strict";Object.defineProperty(mCe,"__esModule",{value:!0});mCe.RUNTIME=void 0;mCe.RUNTIME=IUn();function IUn(){var t,e,r,n,o;return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&((t=globalThis?.navigator)===null||t===void 0?void 0:t.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(((e=self.constructor)===null||e===void 0?void 0:e.name)==="DedicatedWorkerGlobalScope"||((r=self.constructor)===null||r===void 0?void 0:r.name)==="ServiceWorkerGlobalScope"||((n=self.constructor)===null||n===void 0?void 0:n.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!(!((o=process.versions)===null||o===void 0)&&o.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}});var GK=S(hCe=>{"use strict";Object.defineProperty(hCe,"__esModule",{value:!0});hCe.RUNTIME=void 0;var AUn=Ear();Object.defineProperty(hCe,"RUNTIME",{enumerable:!0,get:function(){return AUn.RUNTIME}})});var rXe=S((XK,Par)=>{"use strict";var NUn=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},W2=NUn();Par.exports=XK=W2.fetch;W2.fetch&&(XK.default=W2.fetch.bind(W2));XK.Headers=W2.Headers;XK.Request=W2.Request;XK.Response=W2.Response});var Rar=S(vx=>{"use strict";var DUn=vx&&vx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jUn=vx&&vx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mar=vx&&vx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DUn(r,e,n[o]);return jUn(r,e),r}}(),$Un=vx&&vx.__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(vx,"__esModule",{value:!0});vx.getFetchFn=LUn;var gCe=GK();function LUn(){return $Un(this,void 0,void 0,function*(){return gCe.RUNTIME.type==="node"&&gCe.RUNTIME.parsedVersion!=null&&gCe.RUNTIME.parsedVersion>=18?fetch:gCe.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>Mar(rXe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Mar(rXe()))).default})}});var Iar=S(boe=>{"use strict";var FUn=boe&&boe.__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(boe,"__esModule",{value:!0});boe.getRequestBody=qUn;var kUn=eve();function qUn(t){return FUn(this,arguments,void 0,function*({body:e,type:r}){return r.includes("json")?(0,kUn.toJson)(e):e})}});var Aar=S(ZK=>{"use strict";var wx=ZK&&ZK.__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(ZK,"__esModule",{value:!0});ZK.Node18UniversalStreamWrapper=void 0;var nXe=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=>wx(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",()=>wx(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>wx(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=>wx(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",()=>wx(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>wx(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 wx(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 wx(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 wx(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 wx(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:()=>wx(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}}}};ZK.Node18UniversalStreamWrapper=nXe});var Nar=S(YK=>{"use strict";var _oe=YK&&YK.__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(YK,"__esModule",{value:!0});YK.UndiciStreamWrapper=void 0;var oXe=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 _oe(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 _oe(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 _oe(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 _oe(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:()=>_oe(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}}}};YK.UndiciStreamWrapper=oXe});var Dar=S(Ok=>{"use strict";var yCe=Ok&&Ok.__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())})},UUn=Ok&&Ok.__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(Ok,"__esModule",{value:!0});Ok.NodePre18StreamWrapper=void 0;var iXe=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 yCe(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(){return yCe(this,void 0,void 0,function*(){var e,r,n,o;let i=[],a=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");try{for(var s=!0,u=UUn(this.readableStream),l;l=yield u.next(),e=l.done,!e;s=!0){o=l.value,s=!1;let d=o;i.push(a.encode(d))}}catch(d){r={error:d}}finally{try{!s&&!e&&(n=u.return)&&(yield n.call(u))}finally{if(r)throw r.error}}return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(i))})}json(){return yCe(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 yCe(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};Ok.NodePre18StreamWrapper=iXe});var jar=S(Sx=>{"use strict";var BUn=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]}),zUn=Sx&&Sx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aXe=Sx&&Sx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BUn(r,e,n[o]);return zUn(r,e),r}}(),VUn=Sx&&Sx.__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(Sx,"__esModule",{value:!0});Sx.chooseStreamWrapper=HUn;var bCe=GK();function HUn(t){return VUn(this,void 0,void 0,function*(){return bCe.RUNTIME.type==="node"&&bCe.RUNTIME.parsedVersion!=null&&bCe.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>aXe(Aar()))).Node18UniversalStreamWrapper(t):bCe.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>aXe(Nar()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>aXe(Dar()))).NodePre18StreamWrapper(t)})}});var $ar=S(voe=>{"use strict";var WUn=voe&&voe.__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(voe,"__esModule",{value:!0});voe.getResponseBody=KUn;var JUn=jar();function KUn(t,e){return WUn(this,void 0,void 0,function*(){if(t.body!=null&&e==="blob")return yield t.blob();if(t.body!=null&&e==="arrayBuffer")return yield t.arrayBuffer();if(t.body!=null&&e==="sse")return t.body;if(t.body!=null&&e==="streaming")return(0,JUn.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}})}});var Lar=S(_Ce=>{"use strict";Object.defineProperty(_Ce,"__esModule",{value:!0});_Ce.getTimeoutSignal=XUn;_Ce.anySignal=ZUn;var GUn="timeout";function XUn(t){let e=new AbortController,r=setTimeout(()=>e.abort(GUn),t);return{signal:e.signal,abortId:r}}function ZUn(...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}});var kar=S(QK=>{"use strict";var YUn=QK&&QK.__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(QK,"__esModule",{value:!0});QK.makeRequest=void 0;var Far=Lar(),QUn=(t,e,r,n,o,i,a,s,u)=>YUn(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,Far.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,Far.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});QK.makeRequest=QUn});var qar=S(woe=>{"use strict";var eBn=woe&&woe.__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(woe,"__esModule",{value:!0});woe.requestWithRetries=aBn;var tBn=1e3,rBn=6e4,nBn=2,oBn=.2;function iBn(t){let e=1+(Math.random()*2-1)*oBn;return t*e}function aBn(t){return eBn(this,arguments,void 0,function*(e,r=nBn){let n=yield e();for(let o=0;o<r&&([408,429].includes(n.status)||n.status>=500);++o){let i=Math.min(tBn*Math.pow(2,o),rBn),a=iBn(i);yield new Promise(s=>setTimeout(s,a)),n=yield e()}return n})}});var zar=S(J2=>{"use strict";var Uar=J2&&J2.__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(J2,"__esModule",{value:!0});J2.fetcher=void 0;J2.fetcherImpl=Bar;var sBn=eve(),e8=C7e(),uBn=Oar(),lBn=Rar(),cBn=Iar(),dBn=$ar(),fBn=kar(),pBn=qar();function Bar(t){return Uar(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,uBn.createRequestUrl)(t.url,t.queryParameters),n=yield(0,cBn.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,lBn.getFetchFn)();try{let i=yield(0,pBn.requestWithRetries)(()=>Uar(this,void 0,void 0,function*(){return(0,fBn.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,dBn.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers,rawResponse:(0,e8.toRawResponse)(i)}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a},rawResponse:(0,e8.toRawResponse)(i)}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:e8.abortRawResponse}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:e8.abortRawResponse}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message},rawResponse:e8.unknownRawResponse}:{ok:!1,error:{reason:"unknown",errorMessage:(0,sBn.toJson)(i)},rawResponse:e8.unknownRawResponse}}})}J2.fetcher=Bar});var Var=S(sXe=>{"use strict";Object.defineProperty(sXe,"__esModule",{value:!0});sXe.getHeader=mBn;function mBn(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}});var Har=S(t8=>{"use strict";var hBn=t8&&t8.__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(t8,"__esModule",{value:!0});t8.Supplier=void 0;t8.Supplier={get:t=>hBn(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var War=S(r8=>{"use strict";var gBn=r8&&r8.__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(r8,"__esModule",{value:!0});r8.HttpResponsePromise=void 0;var uXe=class t extends Promise{constructor(e){super(r=>{r(void 0)}),this.innerPromise=e}static fromFunction(e,...r){return new t(e(...r))}static interceptFunction(e){return(...r)=>t.fromPromise(e(...r))}static fromPromise(e){return new t(e)}static fromExecutor(e){let r=new Promise(e);return new t(r)}static fromResult(e){let r=Promise.resolve(e);return new t(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:e})=>e)),this.unwrappedPromise}then(e,r){return this.unwrap().then(e,r)}catch(e){return this.unwrap().catch(e)}finally(e){return this.unwrap().finally(e)}withRawResponse(){return gBn(this,void 0,void 0,function*(){return yield this.innerPromise})}};r8.HttpResponsePromise=uXe});var Jar=S(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});Qy.HttpResponsePromise=Qy.unknownRawResponse=Qy.toRawResponse=Qy.abortRawResponse=Qy.Supplier=Qy.getHeader=Qy.fetcher=void 0;var yBn=zar();Object.defineProperty(Qy,"fetcher",{enumerable:!0,get:function(){return yBn.fetcher}});var bBn=Var();Object.defineProperty(Qy,"getHeader",{enumerable:!0,get:function(){return bBn.getHeader}});var _Bn=Har();Object.defineProperty(Qy,"Supplier",{enumerable:!0,get:function(){return _Bn.Supplier}});var lXe=C7e();Object.defineProperty(Qy,"abortRawResponse",{enumerable:!0,get:function(){return lXe.abortRawResponse}});Object.defineProperty(Qy,"toRawResponse",{enumerable:!0,get:function(){return lXe.toRawResponse}});Object.defineProperty(Qy,"unknownRawResponse",{enumerable:!0,get:function(){return lXe.unknownRawResponse}});var vBn=War();Object.defineProperty(Qy,"HttpResponsePromise",{enumerable:!0,get:function(){return vBn.HttpResponsePromise}})});var Kar=S((cXe,dXe)=>{(function(t,e){typeof cXe=="object"&&typeof dXe<"u"?dXe.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:cXe,function(){"use strict";var t="3.7.7",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=function(L){var W={};return L.forEach(function(ie,j){return W[ie]=j}),W}(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,l=String.fromCharCode.bind(String),c=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(L){return new Uint8Array(Array.prototype.slice.call(L,0))},d=function(L){return L.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},f=function(L){return L.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function(L){for(var W,ie,j,A,U="",H=L.length%3,re=0;re<L.length;){if((ie=L.charCodeAt(re++))>255||(j=L.charCodeAt(re++))>255||(A=L.charCodeAt(re++))>255)throw new TypeError("invalid character found");W=ie<<16|j<<8|A,U+=a[W>>18&63]+a[W>>12&63]+a[W>>6&63]+a[W&63]}return H?U.slice(0,H-3)+"===".substring(H):U},m=typeof btoa=="function"?function(L){return btoa(L)}:r?function(L){return Buffer.from(L,"binary").toString("base64")}:p,h=r?function(L){return Buffer.from(L).toString("base64")}:function(L){for(var W=4096,ie=[],j=0,A=L.length;j<A;j+=W)ie.push(l.apply(null,L.subarray(j,j+W)));return m(ie.join(""))},y=function(L,W){return W===void 0&&(W=!1),W?d(h(L)):h(L)},g=function(L){if(L.length<2){var W=L.charCodeAt(0);return W<128?L:W<2048?l(192|W>>>6)+l(128|W&63):l(224|W>>>12&15)+l(128|W>>>6&63)+l(128|W&63)}else{var W=65536+(L.charCodeAt(0)-55296)*1024+(L.charCodeAt(1)-56320);return l(240|W>>>18&7)+l(128|W>>>12&63)+l(128|W>>>6&63)+l(128|W&63)}},b=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function(L){return L.replace(b,g)},w=r?function(L){return Buffer.from(L,"utf8").toString("base64")}:o?function(L){return h(o.encode(L))}:function(L){return m(_(L))},T=function(L,W){return W===void 0&&(W=!1),W?d(w(L)):w(L)},O=function(L){return T(L,!0)},E=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,P=function(L){switch(L.length){case 4:var W=(7&L.charCodeAt(0))<<18|(63&L.charCodeAt(1))<<12|(63&L.charCodeAt(2))<<6|63&L.charCodeAt(3),ie=W-65536;return l((ie>>>10)+55296)+l((ie&1023)+56320);case 3:return l((15&L.charCodeAt(0))<<12|(63&L.charCodeAt(1))<<6|63&L.charCodeAt(2));default:return l((31&L.charCodeAt(0))<<6|63&L.charCodeAt(1))}},R=function(L){return L.replace(E,P)},I=function(L){if(L=L.replace(/\s+/g,""),!u.test(L))throw new TypeError("malformed base64.");L+="==".slice(2-(L.length&3));for(var W,ie="",j,A,U=0;U<L.length;)W=s[L.charAt(U++)]<<18|s[L.charAt(U++)]<<12|(j=s[L.charAt(U++)])<<6|(A=s[L.charAt(U++)]),ie+=j===64?l(W>>16&255):A===64?l(W>>16&255,W>>8&255):l(W>>16&255,W>>8&255,W&255);return ie},N=typeof atob=="function"?function(L){return atob(f(L))}:r?function(L){return Buffer.from(L,"base64").toString("binary")}:I,z=r?function(L){return c(Buffer.from(L,"base64"))}:function(L){return c(N(L).split("").map(function(W){return W.charCodeAt(0)}))},V=function(L){return z(X(L))},k=r?function(L){return Buffer.from(L,"base64").toString("utf8")}:n?function(L){return n.decode(z(L))}:function(L){return R(N(L))},X=function(L){return f(L.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},B=function(L){return k(X(L))},Q=function(L){if(typeof L!="string")return!1;var W=L.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},Y=function(L){return{value:L,enumerable:!1,writable:!0,configurable:!0}},K=function(){var L=function(W,ie){return Object.defineProperty(String.prototype,W,Y(ie))};L("fromBase64",function(){return B(this)}),L("toBase64",function(W){return T(this,W)}),L("toBase64URI",function(){return T(this,!0)}),L("toBase64URL",function(){return T(this,!0)}),L("toUint8Array",function(){return V(this)})},oe=function(){var L=function(W,ie){return Object.defineProperty(Uint8Array.prototype,W,Y(ie))};L("toBase64",function(W){return y(this,W)}),L("toBase64URI",function(){return y(this,!0)}),L("toBase64URL",function(){return y(this,!0)})},ue=function(){K(),oe()},de={version:t,VERSION:e,atob:N,atobPolyfill:I,btoa:m,btoaPolyfill:p,fromBase64:B,toBase64:T,encode:T,encodeURI:O,encodeURL:O,utob:_,btou:R,decode:B,isValid:Q,fromUint8Array:y,toUint8Array:V,extendString:K,extendUint8Array:oe,extendBuiltins:ue};return de.Base64={},Object.keys(de).forEach(function(L){return de.Base64[L]=de[L]}),de})});var Xar=S(vCe=>{"use strict";Object.defineProperty(vCe,"__esModule",{value:!0});vCe.BasicAuth=void 0;var Gar=Kar(),wBn=/^Basic /i;vCe.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${Gar.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(wBn,""),r=Gar.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 Zar=S(wCe=>{"use strict";Object.defineProperty(wCe,"__esModule",{value:!0});wCe.BearerToken=void 0;var SBn=/^Bearer /i;wCe.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(SBn,"").trim()}});var Yar=S(n8=>{"use strict";Object.defineProperty(n8,"__esModule",{value:!0});n8.BearerToken=n8.BasicAuth=void 0;var CBn=Xar();Object.defineProperty(n8,"BasicAuth",{enumerable:!0,get:function(){return CBn.BasicAuth}});var xBn=Zar();Object.defineProperty(n8,"BearerToken",{enumerable:!0,get:function(){return xBn.BearerToken}})});var pXe=S(Tw=>{"use strict";var Qar=Tw&&Tw.__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())})},esr=Tw&&Tw.__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)}},Cx=Tw&&Tw.__await||function(t){return this instanceof Cx?(this.v=t,this):new Cx(t)},tsr=Tw&&Tw.__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=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof Cx?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])}};Object.defineProperty(Tw,"__esModule",{value:!0});Tw.Stream=void 0;Tw.readableStreamAsyncIterable=rsr;var TBn=GK(),OBn="data:",fXe=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=OBn,this.messageTerminator=`
|
||
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return tsr(this,arguments,function*(){var r,n,o,i;this.controller.signal;let a=rsr(this.stream),s="",u=!1;try{for(var l=!0,c=esr(a),d;d=yield Cx(c.next()),r=d.done,!r;l=!0){i=d.value,l=!1;let f=i;s+=this.decodeChunk(f);let p;for(;(p=s.indexOf(this.messageTerminator))>=0;){let m=s.slice(0,p+1);if(s=s.slice(p+this.messageTerminator.length),!m.trim())continue;if(!u&&this.prefix!=null){let y=m.indexOf(this.prefix);if(y===-1)continue;u=!0,m=m.slice(y+this.prefix.length)}if(this.streamTerminator!=null&&m.includes(this.streamTerminator))return yield Cx(void 0);let h=yield Cx(this.parse(JSON.parse(m)));yield yield Cx(h),u=!1}}}catch(f){n={error:f}}finally{try{!l&&!r&&(o=c.return)&&(yield Cx(o.call(c)))}finally{if(n)throw n.error}}})}[Symbol.asyncIterator](){return tsr(this,arguments,function*(){var r,n,o,i;try{for(var a=!0,s=esr(this.iterMessages()),u;u=yield Cx(s.next()),r=u.done,!r;a=!0)i=u.value,a=!1,yield yield Cx(i)}catch(l){n={error:l}}finally{try{!a&&!r&&(o=s.return)&&(yield Cx(o.call(s)))}finally{if(n)throw n.error}}})}decodeChunk(e){let r="";if(typeof TextDecoder<"u"){let n=new TextDecoder("utf8");r+=n.decode(e)}else TBn.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Tw.Stream=fXe;function rsr(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Qar(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 Qar(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}});var nsr=S(SCe=>{"use strict";Object.defineProperty(SCe,"__esModule",{value:!0});SCe.Stream=void 0;var EBn=pXe();Object.defineProperty(SCe,"Stream",{enumerable:!0,get:function(){return EBn.Stream}})});var osr=S(Soe=>{"use strict";var PBn=Soe&&Soe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Soe,"__esModule",{value:!0});Soe.encodeAsFormParameter=RBn;var MBn=PBn(tXe());function RBn(t){let r=MBn.default.stringify(t,{encode:!1}).split("&").map(n=>{let[o,i]=n.split("=");return[o,i]});return Object.fromEntries(r)}});var ssr=S((CSa,asr)=>{"use strict";var mXe=Object.defineProperty,IBn=Object.getOwnPropertyDescriptor,ABn=Object.getOwnPropertyNames,NBn=Object.prototype.hasOwnProperty,DBn=(t,e)=>{for(var r in e)mXe(t,r,{get:e[r],enumerable:!0})},jBn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ABn(e))!NBn.call(t,o)&&o!==r&&mXe(t,o,{get:()=>e[o],enumerable:!(n=IBn(e,o))||n.enumerable});return t},$Bn=t=>jBn(mXe({},"__esModule",{value:!0}),t),isr={};DBn(isr,{Blob:()=>kBn,File:()=>qBn,FormData:()=>FBn});asr.exports=$Bn(isr);var LBn=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:FBn,Blob:kBn,File:qBn}=LBn});var vsr=S((xSa,_sr)=>{"use strict";var yXe=Object.defineProperty,UBn=Object.getOwnPropertyDescriptor,BBn=Object.getOwnPropertyNames,zBn=Object.prototype.hasOwnProperty,VBn=(t,e)=>{for(var r in e)yXe(t,r,{get:e[r],enumerable:!0})},HBn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of BBn(e))!zBn.call(t,o)&&o!==r&&yXe(t,o,{get:()=>e[o],enumerable:!(n=UBn(e,o))||n.enumerable});return t},WBn=t=>HBn(yXe({},"__esModule",{value:!0}),t),bXe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Uc=(t,e,r)=>(bXe(t,e,"read from private field"),r?r.call(t):e.get(t)),pE=(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)},Coe=(t,e,r,n)=>(bXe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),hXe=(t,e,r)=>(bXe(t,e,"access private method"),r),msr={};VBn(msr,{FormDataEncoder:()=>ezn,isFile:()=>G2,isFormData:()=>ysr});_sr.exports=WBn(msr);var Y1=t=>typeof t=="function",JBn=t=>Y1(t[Symbol.asyncIterator]),usr=65536;function*hsr(t){if(t.byteLength<=usr){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,usr),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*KBn(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*lsr(t){for await(let e of t)yield*hsr(e)}var GBn=t=>{if(JBn(t))return lsr(t);if(Y1(t.getReader))return lsr(KBn(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},csr="abcdefghijklmnopqrstuvwxyz0123456789";function XBn(){let t=16,e="";for(;t--;)e+=csr[Math.random()*csr.length<<0];return e}var gsr=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
|
||
`||e===`
|
||
`&&n[r-1]!=="\r"?`\r
|
||
`:e),ZBn=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function dsr(t){if(ZBn(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function fsr(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var YBn=t=>new Proxy(t,{get:(e,r)=>fsr(e,r),has:(e,r)=>fsr(e,r)!==void 0}),ysr=t=>!!(t&&Y1(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&Y1(t.append)&&Y1(t.getAll)&&Y1(t.entries)&&Y1(t[Symbol.iterator])),psr=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),G2=t=>!!(t&&typeof t=="object"&&Y1(t.constructor)&&t[Symbol.toStringTag]==="File"&&Y1(t.stream)&&t.name!=null),QBn={enableAdditionalHeaders:!1},CCe={writable:!1,configurable:!1},Ek,xoe,xCe,Toe,K2,Ooe,Eoe,TCe,OCe,_Xe,gXe,bsr,ezn=class{constructor(t,e,r){if(pE(this,OCe),pE(this,gXe),pE(this,Ek,`\r
|
||
`),pE(this,xoe,void 0),pE(this,xCe,void 0),pE(this,Toe,"-".repeat(2)),pE(this,K2,new TextEncoder),pE(this,Ooe,void 0),pE(this,Eoe,void 0),pE(this,TCe,void 0),!ysr(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(dsr(e)?r=e:n=e,n||(n=XBn()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!dsr(r))throw new TypeError("Expected options argument to be an object.");Coe(this,Eoe,Array.from(t.entries())),Coe(this,TCe,{...QBn,...r}),Coe(this,xoe,Uc(this,K2).encode(Uc(this,Ek))),Coe(this,xCe,Uc(this,xoe).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,Coe(this,Ooe,Uc(this,K2).encode(`${Uc(this,Toe)}${this.boundary}${Uc(this,Toe)}${Uc(this,Ek).repeat(2)}`));let o={"Content-Type":this.contentType},i=hXe(this,gXe,bsr).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=YBn(Object.freeze(o)),Object.defineProperties(this,{boundary:CCe,contentType:CCe,contentLength:CCe,headers:CCe})}*values(){for(let[t,e]of Uc(this,Eoe)){let r=G2(e)?e:Uc(this,K2).encode(gsr(e));yield hXe(this,OCe,_Xe).call(this,t,r),yield r,yield Uc(this,xoe)}yield Uc(this,Ooe)}async*encode(){for(let t of this.values())G2(t)?yield*GBn(t.stream()):yield*hsr(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};Ek=new WeakMap;xoe=new WeakMap;xCe=new WeakMap;Toe=new WeakMap;K2=new WeakMap;Ooe=new WeakMap;Eoe=new WeakMap;TCe=new WeakMap;OCe=new WeakSet;_Xe=function(t,e){let r="";if(r+=`${Uc(this,Toe)}${this.boundary}${Uc(this,Ek)}`,r+=`Content-Disposition: form-data; name="${psr(t)}"`,G2(e)&&(r+=`; filename="${psr(e.name)}"${Uc(this,Ek)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Uc(this,TCe).enableAdditionalHeaders===!0){let n=G2(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Uc(this,Ek)}Content-Length: ${n}`)}return Uc(this,K2).encode(`${r}${Uc(this,Ek).repeat(2)}`)};gXe=new WeakSet;bsr=function(){let t=0;for(let[e,r]of Uc(this,Eoe)){let n=G2(r)?r:Uc(this,K2).encode(gsr(r)),o=G2(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=hXe(this,OCe,_Xe).call(this,e,n).byteLength,t+=o,t+=Uc(this,xCe)}return String(t+Uc(this,Ooe).byteLength)}});var Ssr=S((OSa,wsr)=>{"use strict";wsr.exports=typeof self=="object"?self.FormData:window.FormData});var Csr=S(zg=>{"use strict";var tzn=zg&&zg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rzn=zg&&zg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o8=zg&&zg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tzn(r,e,n[o]);return rzn(r,e),r}}(),Pk=zg&&zg.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(zg,"__esModule",{value:!0});zg.WebFormData=zg.Node16FormData=zg.Node18FormData=void 0;zg.newFormData=nzn;var ECe=GK();function vXe(t){return typeof t=="object"&&t!=null&&"name"in t}function nzn(){return Pk(this,void 0,void 0,function*(){let t;return ECe.RUNTIME.type==="node"&&ECe.RUNTIME.parsedVersion!=null&&ECe.RUNTIME.parsedVersion>=18?t=new PCe:ECe.RUNTIME.type==="node"?t=new MCe:t=new RCe,yield t.setup(),t})}var PCe=class{setup(){return Pk(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>o8(ssr()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return Pk(this,void 0,void 0,function*(){var o,i;n==null&&vXe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>o8(ioe()))).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 Pk(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>o8(vsr()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>o8(ioe()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};zg.Node18FormData=PCe;var MCe=class{setup(){return Pk(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>o8(Ssr()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return Pk(this,void 0,void 0,function*(){var o,i;n==null&&vXe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>o8(ioe()))).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():{}}}};zg.Node16FormData=MCe;var RCe=class{setup(){return Pk(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){return Pk(this,void 0,void 0,function*(){var o;n==null&&vXe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};zg.WebFormData=RCe});var xsr=S(Q1=>{"use strict";var ozn=Q1&&Q1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),izn=Q1&&Q1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ozn(e,t,r)};Object.defineProperty(Q1,"__esModule",{value:!0});Q1.encodeAsFormParameter=void 0;var azn=osr();Object.defineProperty(Q1,"encodeAsFormParameter",{enumerable:!0,get:function(){return azn.encodeAsFormParameter}});izn(Csr(),Q1)});var Uh=S(ICe=>{"use strict";Object.defineProperty(ICe,"__esModule",{value:!0});ICe.SchemaType=void 0;ICe.SchemaType={BIGINT:"bigint",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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"}});var e_=S(wXe=>{"use strict";Object.defineProperty(wXe,"__esModule",{value:!0});wXe.getErrorMessageForIncorrectType=szn;function szn(t,e){return`Expected ${e}. Received ${uzn(t)}.`}function uzn(t){if(Array.isArray(t))return"list";if(t===null)return"null";if(t instanceof BigInt)return"BigInt";switch(typeof t){case"string":return`"${t}"`;case"bigint":case"number":case"boolean":case"undefined":return`${t}`}return typeof t}});var mE=S(SXe=>{"use strict";Object.defineProperty(SXe,"__esModule",{value:!0});SXe.maybeSkipValidation=lzn;function lzn(t){return Object.assign(Object.assign({},t),{json:Tsr(t.json),parse:Tsr(t.parse)})}function Tsr(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 xXe=S(CXe=>{"use strict";Object.defineProperty(CXe,"__esModule",{value:!0});CXe.stringifyValidationError=czn;function czn(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}});var OXe=S(ACe=>{"use strict";Object.defineProperty(ACe,"__esModule",{value:!0});ACe.JsonError=void 0;var dzn=xXe(),TXe=class t extends Error{constructor(e){super(e.map(dzn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};ACe.JsonError=TXe});var PXe=S(NCe=>{"use strict";Object.defineProperty(NCe,"__esModule",{value:!0});NCe.ParseError=void 0;var fzn=xXe(),EXe=class t extends Error{constructor(e){super(e.map(fzn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};NCe.ParseError=EXe});var Rsr=S(X2=>{"use strict";Object.defineProperty(X2,"__esModule",{value:!0});X2.getSchemaUtils=Poe;X2.nullable=Osr;X2.optional=Esr;X2.optionalNullable=Psr;X2.transform=Msr;var MXe=Uh(),pzn=OXe(),mzn=PXe();function Poe(t){return{nullable:()=>Osr(t),optional:()=>Esr(t),optionalNullable:()=>Psr(t),transform:e=>Msr(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new mzn.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new pzn.JsonError(n.errors)}}}function Osr(t){let e={parse:(r,n)=>r==null?{ok:!0,value:null}:t.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:t.json(r,n),getType:()=>MXe.SchemaType.NULLABLE};return Object.assign(Object.assign({},e),Poe(e))}function Esr(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:()=>MXe.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),Poe(e))}function Psr(t){let e={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:t.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:t.json(r,n),getType:()=>MXe.SchemaType.OPTIONAL_NULLABLE};return Object.assign(Object.assign({},e),Poe(e))}function Msr(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),Poe(r))}});var Z_=S(f0=>{"use strict";Object.defineProperty(f0,"__esModule",{value:!0});f0.ParseError=f0.JsonError=f0.transform=f0.optional=f0.getSchemaUtils=void 0;var RXe=Rsr();Object.defineProperty(f0,"getSchemaUtils",{enumerable:!0,get:function(){return RXe.getSchemaUtils}});Object.defineProperty(f0,"optional",{enumerable:!0,get:function(){return RXe.optional}});Object.defineProperty(f0,"transform",{enumerable:!0,get:function(){return RXe.transform}});var hzn=OXe();Object.defineProperty(f0,"JsonError",{enumerable:!0,get:function(){return hzn.JsonError}});var gzn=PXe();Object.defineProperty(f0,"ParseError",{enumerable:!0,get:function(){return gzn.ParseError}})});var Asr=S(IXe=>{"use strict";Object.defineProperty(IXe,"__esModule",{value:!0});IXe.bigint=vzn;var yzn=Uh(),Isr=e_(),bzn=mE(),_zn=Z_();function vzn(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e=="bigint"?{ok:!0,value:e}:typeof e=="number"?{ok:!0,value:BigInt(e)}:{ok:!1,errors:[{path:r,message:(0,Isr.getErrorMessageForIncorrectType)(e,"bigint | number")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="bigint"?{ok:!1,errors:[{path:r,message:(0,Isr.getErrorMessageForIncorrectType)(e,"bigint")}]}:{ok:!0,value:e},getType:()=>yzn.SchemaType.BIGINT};return Object.assign(Object.assign({},(0,bzn.maybeSkipValidation)(t)),(0,_zn.getSchemaUtils)(t))}});var Nsr=S(DCe=>{"use strict";Object.defineProperty(DCe,"__esModule",{value:!0});DCe.bigint=void 0;var wzn=Asr();Object.defineProperty(DCe,"bigint",{enumerable:!0,get:function(){return wzn.bigint}})});var Dsr=S(NXe=>{"use strict";Object.defineProperty(NXe,"__esModule",{value:!0});NXe.date=Ozn;var Szn=Uh(),AXe=e_(),Czn=mE(),xzn=Z_(),Tzn=/^([+-]?\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 Ozn(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,AXe.getErrorMessageForIncorrectType)(e,"string")}]}:Tzn.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,AXe.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,AXe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>Szn.SchemaType.DATE};return Object.assign(Object.assign({},(0,Czn.maybeSkipValidation)(t)),(0,xzn.getSchemaUtils)(t))}});var jsr=S(jCe=>{"use strict";Object.defineProperty(jCe,"__esModule",{value:!0});jCe.date=void 0;var Ezn=Dsr();Object.defineProperty(jCe,"date",{enumerable:!0,get:function(){return Ezn.date}})});var eD=S(DXe=>{"use strict";Object.defineProperty(DXe,"__esModule",{value:!0});DXe.createIdentitySchemaCreator=Rzn;var Pzn=Z_(),Mzn=mE();function Rzn(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,Mzn.maybeSkipValidation)(r)),(0,Pzn.getSchemaUtils)(r))}}});var Lsr=S(jXe=>{"use strict";Object.defineProperty(jXe,"__esModule",{value:!0});jXe.enum_=Nzn;var Izn=Uh(),Azn=eD(),$sr=e_();function Nzn(t){let e=new Set(t);return(0,Azn.createIdentitySchemaCreator)(Izn.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,$sr.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,$sr.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}});var $Xe=S($Ce=>{"use strict";Object.defineProperty($Ce,"__esModule",{value:!0});$Ce.enum_=void 0;var Dzn=Lsr();Object.defineProperty($Ce,"enum_",{enumerable:!0,get:function(){return Dzn.enum_}})});var LXe=S(Moe=>{"use strict";Object.defineProperty(Moe,"__esModule",{value:!0});Moe.lazy=$zn;Moe.constructLazyBaseSchema=Fsr;Moe.getMemoizedSchema=LCe;var jzn=Z_();function $zn(t){let e=Fsr(t);return Object.assign(Object.assign({},e),(0,jzn.getSchemaUtils)(e))}function Fsr(t){return{parse:(e,r)=>LCe(t).parse(e,r),json:(e,r)=>LCe(t).json(e,r),getType:()=>LCe(t).getType()}}function LCe(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}});var kXe=S(FXe=>{"use strict";Object.defineProperty(FXe,"__esModule",{value:!0});FXe.entries=Lzn;function Lzn(t){return Object.entries(t)}});var UXe=S(qXe=>{"use strict";Object.defineProperty(qXe,"__esModule",{value:!0});qXe.filterObject=Fzn;function Fzn(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}});var Roe=S(BXe=>{"use strict";Object.defineProperty(BXe,"__esModule",{value:!0});BXe.isPlainObject=kzn;function kzn(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}});var VXe=S(zXe=>{"use strict";Object.defineProperty(zXe,"__esModule",{value:!0});zXe.keys=qzn;function qzn(t){return Object.keys(t)}});var ksr=S(HXe=>{"use strict";Object.defineProperty(HXe,"__esModule",{value:!0});HXe.partition=Uzn;function Uzn(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}});var Bsr=S(FCe=>{"use strict";Object.defineProperty(FCe,"__esModule",{value:!0});FCe.getObjectLikeUtils=qsr;FCe.withParsedProperties=Usr;var Bzn=UXe(),zzn=e_(),Vzn=Roe(),Hzn=Z_();function qsr(t){return{withParsedProperties:e=>Usr(t,e)}}function Usr(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,Vzn.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,zzn.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,Bzn.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,Hzn.getSchemaUtils)(r)),qsr(r))}});var Ioe=S(i8=>{"use strict";Object.defineProperty(i8,"__esModule",{value:!0});i8.withParsedProperties=i8.getObjectLikeUtils=void 0;var zsr=Bsr();Object.defineProperty(i8,"getObjectLikeUtils",{enumerable:!0,get:function(){return zsr.getObjectLikeUtils}});Object.defineProperty(i8,"withParsedProperties",{enumerable:!0,get:function(){return zsr.withParsedProperties}})});var WXe=S(kCe=>{"use strict";Object.defineProperty(kCe,"__esModule",{value:!0});kCe.property=Wzn;kCe.isProperty=Jzn;function Wzn(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}function Jzn(t){return t.isProperty}});var GXe=S(UCe=>{"use strict";Object.defineProperty(UCe,"__esModule",{value:!0});UCe.object=Yzn;UCe.getObjectUtils=qCe;var Z2=Uh(),Vsr=kXe(),Hsr=UXe(),Kzn=e_(),Gzn=Roe(),Gsr=VXe(),Xzn=mE(),Zzn=ksr(),JXe=Ioe(),KXe=Z_(),Aoe=WXe();function Yzn(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,Aoe.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,Gsr.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,Vsr.entries)(t)){let u=(0,Aoe.isProperty)(s)?s.rawKey:a,l=(0,Aoe.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,Ksr(l)&&i.push(u)}return Wsr({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,Vsr.entries)(t)){let s=(0,Aoe.isProperty)(a)?a.valueSchema:a;Ksr(s)&&o.push(i)}return Wsr({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,Aoe.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:()=>Z2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,Xzn.maybeSkipValidation)(e)),(0,KXe.getSchemaUtils)(e)),(0,JXe.getObjectLikeUtils)(e)),qCe(e))}function Wsr({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,Gzn.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,Kzn.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 qCe(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>Jsr({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>Jsr({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>Z2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,KXe.getSchemaUtils)(r)),(0,JXe.getObjectLikeUtils)(r)),qCe(r))},passthrough:()=>{let e={_getParsedProperties:()=>t._getParsedProperties(),_getRawProperties:()=>t._getRawProperties(),parse:(r,n)=>{let o=t.parse(r,Object.assign(Object.assign({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:Object.assign(Object.assign({},r),o.value)}:o},json:(r,n)=>{let o=t.json(r,Object.assign(Object.assign({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:Object.assign(Object.assign({},r),o.value)}:o},getType:()=>Z2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,KXe.getSchemaUtils)(e)),(0,JXe.getObjectLikeUtils)(e)),qCe(e))}}}function Jsr({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,Zzn.partition)((0,Gsr.keys)(e),l=>o.has(l)),s=r((0,Hsr.filterObject)(e,a)),u=n((0,Hsr.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 Ksr(t){return!Qzn(t)}function Qzn(t){switch(t.getType()){case Z2.SchemaType.ANY:case Z2.SchemaType.UNKNOWN:case Z2.SchemaType.OPTIONAL:case Z2.SchemaType.OPTIONAL_NULLABLE:return!0;default:return!1}}});var Xsr=S(XXe=>{"use strict";Object.defineProperty(XXe,"__esModule",{value:!0});XXe.objectWithoutOptionalProperties=t4n;var e4n=GXe();function t4n(t){return(0,e4n.object)(t)}});var ZXe=S(p0=>{"use strict";Object.defineProperty(p0,"__esModule",{value:!0});p0.property=p0.isProperty=p0.objectWithoutOptionalProperties=p0.object=p0.getObjectUtils=void 0;var Zsr=GXe();Object.defineProperty(p0,"getObjectUtils",{enumerable:!0,get:function(){return Zsr.getObjectUtils}});Object.defineProperty(p0,"object",{enumerable:!0,get:function(){return Zsr.object}});var r4n=Xsr();Object.defineProperty(p0,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return r4n.objectWithoutOptionalProperties}});var Ysr=WXe();Object.defineProperty(p0,"isProperty",{enumerable:!0,get:function(){return Ysr.isProperty}});Object.defineProperty(p0,"property",{enumerable:!0,get:function(){return Ysr.property}})});var Qsr=S(QXe=>{"use strict";Object.defineProperty(QXe,"__esModule",{value:!0});QXe.lazyObject=a4n;var n4n=ZXe(),o4n=Ioe(),i4n=Z_(),YXe=LXe();function a4n(t){let e=Object.assign(Object.assign({},(0,YXe.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,YXe.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,YXe.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,i4n.getSchemaUtils)(e)),(0,o4n.getObjectLikeUtils)(e)),(0,n4n.getObjectUtils)(e))}});var eur=S(a8=>{"use strict";Object.defineProperty(a8,"__esModule",{value:!0});a8.lazyObject=a8.lazy=void 0;var s4n=LXe();Object.defineProperty(a8,"lazy",{enumerable:!0,get:function(){return s4n.lazy}});var u4n=Qsr();Object.defineProperty(a8,"lazyObject",{enumerable:!0,get:function(){return u4n.lazyObject}})});var rur=S(eZe=>{"use strict";Object.defineProperty(eZe,"__esModule",{value:!0});eZe.list=p4n;var l4n=Uh(),c4n=e_(),d4n=mE(),f4n=Z_();function p4n(t){let e={parse:(r,n)=>tur(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)=>tur(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:()=>l4n.SchemaType.LIST};return Object.assign(Object.assign({},(0,d4n.maybeSkipValidation)(e)),(0,f4n.getSchemaUtils)(e))}function tur(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,c4n.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var tZe=S(BCe=>{"use strict";Object.defineProperty(BCe,"__esModule",{value:!0});BCe.list=void 0;var m4n=rur();Object.defineProperty(BCe,"list",{enumerable:!0,get:function(){return m4n.list}})});var nur=S(rZe=>{"use strict";Object.defineProperty(rZe,"__esModule",{value:!0});rZe.stringLiteral=b4n;var h4n=Uh(),g4n=eD(),y4n=e_();function b4n(t){return(0,g4n.createIdentitySchemaCreator)(h4n.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,y4n.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}});var our=S(nZe=>{"use strict";Object.defineProperty(nZe,"__esModule",{value:!0});nZe.booleanLiteral=S4n;var _4n=Uh(),v4n=eD(),w4n=e_();function S4n(t){return(0,v4n.createIdentitySchemaCreator)(_4n.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,w4n.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}});var iur=S(s8=>{"use strict";Object.defineProperty(s8,"__esModule",{value:!0});s8.booleanLiteral=s8.stringLiteral=void 0;var C4n=nur();Object.defineProperty(s8,"stringLiteral",{enumerable:!0,get:function(){return C4n.stringLiteral}});var x4n=our();Object.defineProperty(s8,"booleanLiteral",{enumerable:!0,get:function(){return x4n.booleanLiteral}})});var aur=S(zCe=>{"use strict";Object.defineProperty(zCe,"__esModule",{value:!0});zCe.any=void 0;var T4n=Uh(),O4n=eD();zCe.any=(0,O4n.createIdentitySchemaCreator)(T4n.SchemaType.ANY,t=>({ok:!0,value:t}))});var sur=S(VCe=>{"use strict";Object.defineProperty(VCe,"__esModule",{value:!0});VCe.boolean=void 0;var E4n=Uh(),P4n=eD(),M4n=e_();VCe.boolean=(0,P4n.createIdentitySchemaCreator)(E4n.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,M4n.getErrorMessageForIncorrectType)(t,"boolean")}]})});var uur=S(HCe=>{"use strict";Object.defineProperty(HCe,"__esModule",{value:!0});HCe.number=void 0;var R4n=Uh(),I4n=eD(),A4n=e_();HCe.number=(0,I4n.createIdentitySchemaCreator)(R4n.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,A4n.getErrorMessageForIncorrectType)(t,"number")}]})});var lur=S(WCe=>{"use strict";Object.defineProperty(WCe,"__esModule",{value:!0});WCe.string=void 0;var N4n=Uh(),D4n=eD(),j4n=e_();WCe.string=(0,D4n.createIdentitySchemaCreator)(N4n.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,j4n.getErrorMessageForIncorrectType)(t,"string")}]})});var cur=S(JCe=>{"use strict";Object.defineProperty(JCe,"__esModule",{value:!0});JCe.unknown=void 0;var $4n=Uh(),L4n=eD();JCe.unknown=(0,L4n.createIdentitySchemaCreator)($4n.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var dur=S(m0=>{"use strict";Object.defineProperty(m0,"__esModule",{value:!0});m0.unknown=m0.string=m0.number=m0.boolean=m0.any=void 0;var F4n=aur();Object.defineProperty(m0,"any",{enumerable:!0,get:function(){return F4n.any}});var k4n=sur();Object.defineProperty(m0,"boolean",{enumerable:!0,get:function(){return k4n.boolean}});var q4n=uur();Object.defineProperty(m0,"number",{enumerable:!0,get:function(){return q4n.number}});var U4n=lur();Object.defineProperty(m0,"string",{enumerable:!0,get:function(){return U4n.string}});var B4n=cur();Object.defineProperty(m0,"unknown",{enumerable:!0,get:function(){return B4n.unknown}})});var pur=S(iZe=>{"use strict";Object.defineProperty(iZe,"__esModule",{value:!0});iZe.record=K4n;var oZe=Uh(),z4n=kXe(),V4n=e_(),H4n=Roe(),W4n=mE(),J4n=Z_();function K4n(t,e){let r={parse:(n,o)=>fur({value:n,isKeyNumeric:t.getType()===oZe.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)=>fur({value:n,isKeyNumeric:t.getType()===oZe.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:()=>oZe.SchemaType.RECORD};return Object.assign(Object.assign({},(0,W4n.maybeSkipValidation)(r)),(0,J4n.getSchemaUtils)(r))}function fur({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,H4n.isPlainObject)(t)?(0,z4n.entries)(t).reduce((i,[a,s])=>{if(s===void 0)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,V4n.getErrorMessageForIncorrectType)(t,"object")}]}}});var mur=S(KCe=>{"use strict";Object.defineProperty(KCe,"__esModule",{value:!0});KCe.record=void 0;var G4n=pur();Object.defineProperty(KCe,"record",{enumerable:!0,get:function(){return G4n.record}})});var hur=S(aZe=>{"use strict";Object.defineProperty(aZe,"__esModule",{value:!0});aZe.set=t2n;var X4n=Uh(),Z4n=e_(),Y4n=mE(),Q4n=tZe(),e2n=Z_();function t2n(t){let e=(0,Q4n.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,Z4n.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>X4n.SchemaType.SET};return Object.assign(Object.assign({},(0,Y4n.maybeSkipValidation)(r)),(0,e2n.getSchemaUtils)(r))}});var gur=S(GCe=>{"use strict";Object.defineProperty(GCe,"__esModule",{value:!0});GCe.set=void 0;var r2n=hur();Object.defineProperty(GCe,"set",{enumerable:!0,get:function(){return r2n.set}})});var bur=S(sZe=>{"use strict";Object.defineProperty(sZe,"__esModule",{value:!0});sZe.undiscriminatedUnion=a2n;var n2n=Uh(),o2n=mE(),i2n=Z_();function a2n(t){let e={parse:(r,n)=>yur((o,i)=>o.parse(r,i),t,n),json:(r,n)=>yur((o,i)=>o.json(r,i),t,n),getType:()=>n2n.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,o2n.maybeSkipValidation)(e)),(0,i2n.getSchemaUtils)(e))}function yur(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 _ur=S(XCe=>{"use strict";Object.defineProperty(XCe,"__esModule",{value:!0});XCe.undiscriminatedUnion=void 0;var s2n=bur();Object.defineProperty(XCe,"undiscriminatedUnion",{enumerable:!0,get:function(){return s2n.undiscriminatedUnion}})});var vur=S(uZe=>{"use strict";Object.defineProperty(uZe,"__esModule",{value:!0});uZe.discriminant=u2n;function u2n(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}});var Sur=S(Noe=>{"use strict";var l2n=Noe&&Noe.__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(Noe,"__esModule",{value:!0});Noe.union=b2n;var c2n=Uh(),d2n=e_(),f2n=Roe(),p2n=VXe(),m2n=mE(),h2n=$Xe(),g2n=Ioe(),y2n=Z_();function b2n(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,h2n.enum_)((0,p2n.keys)(e)),i={parse:(a,s)=>wur({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)=>wur({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:()=>c2n.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,m2n.maybeSkipValidation)(i)),(0,y2n.getSchemaUtils)(i)),(0,g2n.getObjectLikeUtils)(i))}function wur({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,f2n.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,d2n.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=l2n(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 Cur=S(u8=>{"use strict";Object.defineProperty(u8,"__esModule",{value:!0});u8.union=u8.discriminant=void 0;var _2n=vur();Object.defineProperty(u8,"discriminant",{enumerable:!0,get:function(){return _2n.discriminant}});var v2n=Sur();Object.defineProperty(u8,"union",{enumerable:!0,get:function(){return v2n.union}})});var xur=S(Dd=>{"use strict";var w2n=Dd&&Dd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y_=Dd&&Dd.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&w2n(e,t,r)};Object.defineProperty(Dd,"__esModule",{value:!0});Y_(Nsr(),Dd);Y_(jsr(),Dd);Y_($Xe(),Dd);Y_(eur(),Dd);Y_(tZe(),Dd);Y_(iur(),Dd);Y_(ZXe(),Dd);Y_(Ioe(),Dd);Y_(dur(),Dd);Y_(mur(),Dd);Y_(Z_(),Dd);Y_(gur(),Dd);Y_(_ur(),Dd);Y_(Cur(),Dd)});var Tur=S(Y2=>{"use strict";var S2n=Y2&&Y2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C2n=Y2&&Y2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&S2n(e,t,r)};Object.defineProperty(Y2,"__esModule",{value:!0});C2n(xur(),Y2)});var se=S(Vg=>{"use strict";var Our=Vg&&Vg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x2n=Vg&&Vg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Doe=Vg&&Vg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Our(e,t,r)},T2n=Vg&&Vg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Our(r,e,n[o]);return x2n(r,e),r}}();Object.defineProperty(Vg,"__esModule",{value:!0});Vg.serialization=void 0;Doe(Jar(),Vg);Doe(GK(),Vg);Doe(Yar(),Vg);Doe(nsr(),Vg);Doe(xsr(),Vg);Vg.serialization=T2n(Tur())});var Pur=S(Hg=>{"use strict";var joe=Hg&&Hg.__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())})},$oe=Hg&&Hg.__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)}},Jl=Hg&&Hg.__await||function(t){return this instanceof Jl?(this.v=t,this):new Jl(t)},Loe=Hg&&Hg.__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=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(h){return new Promise(function(y,g){i.push([p,h,y,g])>1||u(p,h)})},m&&(o[p]=m(o[p])))}function u(p,m){try{l(n[p](m))}catch(h){f(i[0][3],h)}}function l(p){p.value instanceof Jl?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])}};Object.defineProperty(Hg,"__esModule",{value:!0});Hg.LineDecoder=Hg.StreamUtils=void 0;Hg._iterSSEMessages=Eur;Hg._decodeChunks=P2n;Hg.readableStreamAsyncIterable=dZe;var l8=kc(),lZe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return Loe(this,arguments,function*(){var a,s,u,l;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let c=!1;try{try{for(var d=!0,f=$oe(Eur(e,r)),p;p=yield Jl(f.next()),a=p.done,!a;d=!0){l=p.value,d=!1;let m=l;if(!c){if(m.data.startsWith("[DONE]")){c=!0;continue}if(m.event===null){let h;try{h=JSON.parse(m.data)}catch(y){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),y}if(h&&h.error)throw new l8.CohereError({message:`Error: ${h.error}`});yield yield Jl(h)}else{let h;try{h=JSON.parse(m.data)}catch(y){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),y}if(m.event=="error")throw new l8.CohereError({message:`Error: ${h.message}, ${h.error}`});yield yield Jl({event:m.event,data:h})}}}}catch(m){s={error:m}}finally{try{!d&&!a&&(u=f.return)&&(yield Jl(u.call(f)))}finally{if(s)throw s.error}}c=!0}catch(m){if(m instanceof Error&&m.name==="AbortError")return yield Jl(void 0);throw m}finally{c||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return Loe(this,arguments,function*(){var s,u,l,c;let d=new Mk,f=dZe(e);try{for(var p=!0,m=$oe(f),h;h=yield Jl(m.next()),s=h.done,!s;p=!0){c=h.value,p=!1;let y=c;for(let g of d.decode(y))yield yield Jl(g)}}catch(y){u={error:y}}finally{try{!p&&!s&&(l=m.return)&&(yield Jl(l.call(m)))}finally{if(u)throw u.error}}for(let y of d.flush())yield yield Jl(y)})}function i(){return Loe(this,arguments,function*(){var s,u,l,c;if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let d=!1;try{try{for(var f=!0,p=$oe(o()),m;m=yield Jl(p.next()),s=m.done,!s;f=!0){c=m.value,f=!1;let h=c;d||h&&(yield yield Jl(JSON.parse(h)))}}catch(h){u={error:h}}finally{try{!f&&!s&&(l=p.return)&&(yield Jl(l.call(p)))}finally{if(u)throw u.error}}d=!0}catch(h){if(h instanceof Error&&h.name==="AbortError")return yield Jl(void 0);throw h}finally{d||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 joe(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return joe(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(){return joe(this,void 0,void 0,function*(){var o;yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};Hg.StreamUtils=lZe;function Eur(t,e){return Loe(this,arguments,function*(){var n,o,i,a;if(!t.body)throw e?.abort(),new l8.CohereError({message:"Attempted to iterate over a response with no body"});let s=new cZe,u=new Mk,l=dZe(t.body);try{for(var c=!0,d=$oe(O2n(l)),f;f=yield Jl(d.next()),n=f.done,!n;c=!0){a=f.value,c=!1;let p=a;for(let m of u.decode(p)){let h=s.decode(m);h&&(yield yield Jl(h))}}}catch(p){o={error:p}}finally{try{!c&&!n&&(i=d.return)&&(yield Jl(i.call(d)))}finally{if(o)throw o.error}}for(let p of u.flush()){let m=s.decode(p);m&&(yield yield Jl(m))}})}function O2n(t){return Loe(this,arguments,function*(){var r,n,o,i;let a=new Uint8Array;try{for(var s=!0,u=$oe(t),l;l=yield Jl(u.next()),r=l.done,!r;s=!0){i=l.value,s=!1;let c=i;if(c==null)continue;let d=c instanceof ArrayBuffer?new Uint8Array(c):typeof c=="string"?new TextEncoder().encode(c):c,f=new Uint8Array(a.length+d.length);f.set(a),f.set(d,a.length),a=f;let p;for(;(p=E2n(a))!==-1;)yield yield Jl(a.slice(0,p)),a=a.slice(p)}}catch(c){n={error:c}}finally{try{!s&&!r&&(o=u.return)&&(yield Jl(o.call(u)))}finally{if(n)throw n.error}}a.length>0&&(yield yield Jl(a))})}function E2n(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 cZe=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]=M2n(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},Mk=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 l8.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 l8.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new l8.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}};Hg.LineDecoder=Mk;Mk.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);Mk.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function P2n(t){let e=new Mk,r=[];for(let n of t)r.push(...e.decode(n));return r}function M2n(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function dZe(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return joe(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 joe(this,void 0,void 0,function*(){let r=e.cancel();return e.releaseLock(),yield r,{done:!0,value:void 0}})},[Symbol.asyncIterator](){return this}}}});var koe=S(hE=>{"use strict";var R2n=hE&&hE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),I2n=hE&&hE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A2n=hE&&hE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&R2n(r,e,n[o]);return I2n(r,e),r}}();Object.defineProperty(hE,"__esModule",{value:!0});hE.Document=void 0;var Foe=A2n(se());hE.Document=Foe.serialization.object({data:Foe.serialization.record(Foe.serialization.string(),Foe.serialization.unknown()),id:Foe.serialization.string().optional()})});var fZe=S(gE=>{"use strict";var N2n=gE&&gE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D2n=gE&&gE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j2n=gE&&gE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N2n(r,e,n[o]);return D2n(r,e),r}}();Object.defineProperty(gE,"__esModule",{value:!0});gE.V2ChatStreamRequestDocumentsItem=void 0;var Mur=j2n(se()),$2n=koe();gE.V2ChatStreamRequestDocumentsItem=Mur.serialization.undiscriminatedUnion([Mur.serialization.string(),$2n.Document])});var pZe=S(yE=>{"use strict";var L2n=yE&&yE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F2n=yE&&yE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k2n=yE&&yE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L2n(r,e,n[o]);return F2n(r,e),r}}();Object.defineProperty(yE,"__esModule",{value:!0});yE.V2ChatStreamRequestSafetyMode=void 0;var q2n=k2n(se());yE.V2ChatStreamRequestSafetyMode=q2n.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var mZe=S(bE=>{"use strict";var U2n=bE&&bE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B2n=bE&&bE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z2n=bE&&bE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U2n(r,e,n[o]);return B2n(r,e),r}}();Object.defineProperty(bE,"__esModule",{value:!0});bE.V2ChatStreamRequestToolChoice=void 0;var V2n=z2n(se());bE.V2ChatStreamRequestToolChoice=V2n.serialization.enum_(["REQUIRED","NONE"])});var hZe=S(_E=>{"use strict";var H2n=_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]}),W2n=_E&&_E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J2n=_E&&_E.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&H2n(r,e,n[o]);return W2n(r,e),r}}();Object.defineProperty(_E,"__esModule",{value:!0});_E.ChatMessageStartEventDeltaMessage=void 0;var Rur=J2n(se());_E.ChatMessageStartEventDeltaMessage=Rur.serialization.object({role:Rur.serialization.stringLiteral("assistant").optional()})});var gZe=S(vE=>{"use strict";var K2n=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]}),G2n=vE&&vE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X2n=vE&&vE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&K2n(r,e,n[o]);return G2n(r,e),r}}();Object.defineProperty(vE,"__esModule",{value:!0});vE.ChatMessageStartEventDelta=void 0;var Z2n=X2n(se()),Y2n=hZe();vE.ChatMessageStartEventDelta=Z2n.serialization.object({message:Y2n.ChatMessageStartEventDeltaMessage.optional()})});var Ow=S(wE=>{"use strict";var Q2n=wE&&wE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eVn=wE&&wE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tVn=wE&&wE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q2n(r,e,n[o]);return eVn(r,e),r}}();Object.defineProperty(wE,"__esModule",{value:!0});wE.ChatStreamEventType=void 0;var rVn=tVn(se());wE.ChatStreamEventType=rVn.serialization.object({})});var yZe=S(SE=>{"use strict";var nVn=SE&&SE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oVn=SE&&SE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iVn=SE&&SE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nVn(r,e,n[o]);return oVn(r,e),r}}();Object.defineProperty(SE,"__esModule",{value:!0});SE.ChatMessageStartEvent=void 0;var Iur=iVn(se()),aVn=gZe(),sVn=Ow();SE.ChatMessageStartEvent=Iur.serialization.object({id:Iur.serialization.string().optional(),delta:aVn.ChatMessageStartEventDelta.optional()}).extend(sVn.ChatStreamEventType)});var bZe=S(CE=>{"use strict";var uVn=CE&&CE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lVn=CE&&CE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cVn=CE&&CE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uVn(r,e,n[o]);return lVn(r,e),r}}();Object.defineProperty(CE,"__esModule",{value:!0});CE.ChatContentStartEventDeltaMessageContentType=void 0;var dVn=cVn(se());CE.ChatContentStartEventDeltaMessageContentType=dVn.serialization.enum_(["text","thinking"])});var vZe=S(xE=>{"use strict";var fVn=xE&&xE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pVn=xE&&xE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mVn=xE&&xE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fVn(r,e,n[o]);return pVn(r,e),r}}();Object.defineProperty(xE,"__esModule",{value:!0});xE.ChatContentStartEventDeltaMessageContent=void 0;var _Ze=mVn(se()),hVn=bZe();xE.ChatContentStartEventDeltaMessageContent=_Ze.serialization.object({thinking:_Ze.serialization.string().optional(),text:_Ze.serialization.string().optional(),type:hVn.ChatContentStartEventDeltaMessageContentType.optional()})});var wZe=S(TE=>{"use strict";var gVn=TE&&TE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yVn=TE&&TE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bVn=TE&&TE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gVn(r,e,n[o]);return yVn(r,e),r}}();Object.defineProperty(TE,"__esModule",{value:!0});TE.ChatContentStartEventDeltaMessage=void 0;var _Vn=bVn(se()),vVn=vZe();TE.ChatContentStartEventDeltaMessage=_Vn.serialization.object({content:vVn.ChatContentStartEventDeltaMessageContent.optional()})});var SZe=S(OE=>{"use strict";var wVn=OE&&OE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SVn=OE&&OE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CVn=OE&&OE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wVn(r,e,n[o]);return SVn(r,e),r}}();Object.defineProperty(OE,"__esModule",{value:!0});OE.ChatContentStartEventDelta=void 0;var xVn=CVn(se()),TVn=wZe();OE.ChatContentStartEventDelta=xVn.serialization.object({message:TVn.ChatContentStartEventDeltaMessage.optional()})});var CZe=S(EE=>{"use strict";var OVn=EE&&EE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EVn=EE&&EE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PVn=EE&&EE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OVn(r,e,n[o]);return EVn(r,e),r}}();Object.defineProperty(EE,"__esModule",{value:!0});EE.ChatContentStartEvent=void 0;var Aur=PVn(se()),MVn=SZe(),RVn=Ow();EE.ChatContentStartEvent=Aur.serialization.object({index:Aur.serialization.number().optional(),delta:MVn.ChatContentStartEventDelta.optional()}).extend(RVn.ChatStreamEventType)});var TZe=S(PE=>{"use strict";var IVn=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]}),AVn=PE&&PE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NVn=PE&&PE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IVn(r,e,n[o]);return AVn(r,e),r}}();Object.defineProperty(PE,"__esModule",{value:!0});PE.ChatContentDeltaEventDeltaMessageContent=void 0;var xZe=NVn(se());PE.ChatContentDeltaEventDeltaMessageContent=xZe.serialization.object({thinking:xZe.serialization.string().optional(),text:xZe.serialization.string().optional()})});var OZe=S(ME=>{"use strict";var DVn=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]}),jVn=ME&&ME.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Vn=ME&&ME.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DVn(r,e,n[o]);return jVn(r,e),r}}();Object.defineProperty(ME,"__esModule",{value:!0});ME.ChatContentDeltaEventDeltaMessage=void 0;var LVn=$Vn(se()),FVn=TZe();ME.ChatContentDeltaEventDeltaMessage=LVn.serialization.object({content:FVn.ChatContentDeltaEventDeltaMessageContent.optional()})});var EZe=S(RE=>{"use strict";var kVn=RE&&RE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qVn=RE&&RE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UVn=RE&&RE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kVn(r,e,n[o]);return qVn(r,e),r}}();Object.defineProperty(RE,"__esModule",{value:!0});RE.ChatContentDeltaEventDelta=void 0;var BVn=UVn(se()),zVn=OZe();RE.ChatContentDeltaEventDelta=BVn.serialization.object({message:zVn.ChatContentDeltaEventDeltaMessage.optional()})});var ZCe=S(IE=>{"use strict";var VVn=IE&&IE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HVn=IE&&IE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WVn=IE&&IE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VVn(r,e,n[o]);return HVn(r,e),r}}();Object.defineProperty(IE,"__esModule",{value:!0});IE.LogprobItem=void 0;var Q2=WVn(se());IE.LogprobItem=Q2.serialization.object({text:Q2.serialization.string().optional(),tokenIds:Q2.serialization.property("token_ids",Q2.serialization.list(Q2.serialization.number())),logprobs:Q2.serialization.list(Q2.serialization.number()).optional()})});var PZe=S(AE=>{"use strict";var JVn=AE&&AE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=AE&&AE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GVn=AE&&AE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JVn(r,e,n[o]);return KVn(r,e),r}}();Object.defineProperty(AE,"__esModule",{value:!0});AE.ChatContentDeltaEvent=void 0;var Nur=GVn(se()),XVn=EZe(),ZVn=ZCe(),YVn=Ow();AE.ChatContentDeltaEvent=Nur.serialization.object({index:Nur.serialization.number().optional(),delta:XVn.ChatContentDeltaEventDelta.optional(),logprobs:ZVn.LogprobItem.optional()}).extend(YVn.ChatStreamEventType)});var MZe=S(NE=>{"use strict";var QVn=NE&&NE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eHn=NE&&NE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tHn=NE&&NE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QVn(r,e,n[o]);return eHn(r,e),r}}();Object.defineProperty(NE,"__esModule",{value:!0});NE.ChatContentEndEvent=void 0;var Dur=tHn(se()),rHn=Ow();NE.ChatContentEndEvent=Dur.serialization.object({index:Dur.serialization.number().optional()}).extend(rHn.ChatStreamEventType)});var IZe=S(DE=>{"use strict";var nHn=DE&&DE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oHn=DE&&DE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iHn=DE&&DE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nHn(r,e,n[o]);return oHn(r,e),r}}();Object.defineProperty(DE,"__esModule",{value:!0});DE.ChatToolPlanDeltaEventDeltaMessage=void 0;var RZe=iHn(se());DE.ChatToolPlanDeltaEventDeltaMessage=RZe.serialization.object({toolPlan:RZe.serialization.property("tool_plan",RZe.serialization.string().optional())})});var AZe=S(jE=>{"use strict";var aHn=jE&&jE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sHn=jE&&jE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uHn=jE&&jE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aHn(r,e,n[o]);return sHn(r,e),r}}();Object.defineProperty(jE,"__esModule",{value:!0});jE.ChatToolPlanDeltaEventDelta=void 0;var lHn=uHn(se()),cHn=IZe();jE.ChatToolPlanDeltaEventDelta=lHn.serialization.object({message:cHn.ChatToolPlanDeltaEventDeltaMessage.optional()})});var NZe=S($E=>{"use strict";var dHn=$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]}),fHn=$E&&$E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pHn=$E&&$E.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dHn(r,e,n[o]);return fHn(r,e),r}}();Object.defineProperty($E,"__esModule",{value:!0});$E.ChatToolPlanDeltaEvent=void 0;var mHn=pHn(se()),hHn=AZe(),gHn=Ow();$E.ChatToolPlanDeltaEvent=mHn.serialization.object({delta:hHn.ChatToolPlanDeltaEventDelta.optional()}).extend(gHn.ChatStreamEventType)});var jZe=S(LE=>{"use strict";var yHn=LE&&LE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bHn=LE&&LE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Hn=LE&&LE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yHn(r,e,n[o]);return bHn(r,e),r}}();Object.defineProperty(LE,"__esModule",{value:!0});LE.ToolCallV2Function=void 0;var DZe=_Hn(se());LE.ToolCallV2Function=DZe.serialization.object({name:DZe.serialization.string().optional(),arguments:DZe.serialization.string().optional()})});var qoe=S(FE=>{"use strict";var vHn=FE&&FE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wHn=FE&&FE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SHn=FE&&FE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vHn(r,e,n[o]);return wHn(r,e),r}}();Object.defineProperty(FE,"__esModule",{value:!0});FE.ToolCallV2=void 0;var $Ze=SHn(se()),CHn=jZe();FE.ToolCallV2=$Ze.serialization.object({id:$Ze.serialization.string().optional(),type:$Ze.serialization.stringLiteral("function").optional(),function:CHn.ToolCallV2Function.optional()})});var LZe=S(kE=>{"use strict";var xHn=kE&&kE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),THn=kE&&kE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OHn=kE&&kE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xHn(r,e,n[o]);return THn(r,e),r}}();Object.defineProperty(kE,"__esModule",{value:!0});kE.ChatToolCallStartEventDeltaMessage=void 0;var jur=OHn(se()),EHn=qoe();kE.ChatToolCallStartEventDeltaMessage=jur.serialization.object({toolCalls:jur.serialization.property("tool_calls",EHn.ToolCallV2.optional())})});var FZe=S(qE=>{"use strict";var PHn=qE&&qE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MHn=qE&&qE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RHn=qE&&qE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PHn(r,e,n[o]);return MHn(r,e),r}}();Object.defineProperty(qE,"__esModule",{value:!0});qE.ChatToolCallStartEventDelta=void 0;var IHn=RHn(se()),AHn=LZe();qE.ChatToolCallStartEventDelta=IHn.serialization.object({message:AHn.ChatToolCallStartEventDeltaMessage.optional()})});var kZe=S(UE=>{"use strict";var NHn=UE&&UE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DHn=UE&&UE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jHn=UE&&UE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NHn(r,e,n[o]);return DHn(r,e),r}}();Object.defineProperty(UE,"__esModule",{value:!0});UE.ChatToolCallStartEvent=void 0;var $ur=jHn(se()),$Hn=FZe(),LHn=Ow();UE.ChatToolCallStartEvent=$ur.serialization.object({index:$ur.serialization.number().optional(),delta:$Hn.ChatToolCallStartEventDelta.optional()}).extend(LHn.ChatStreamEventType)});var qZe=S(BE=>{"use strict";var FHn=BE&&BE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kHn=BE&&BE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qHn=BE&&BE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FHn(r,e,n[o]);return kHn(r,e),r}}();Object.defineProperty(BE,"__esModule",{value:!0});BE.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=void 0;var Lur=qHn(se());BE.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=Lur.serialization.object({arguments:Lur.serialization.string().optional()})});var UZe=S(zE=>{"use strict";var UHn=zE&&zE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BHn=zE&&zE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zHn=zE&&zE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UHn(r,e,n[o]);return BHn(r,e),r}}();Object.defineProperty(zE,"__esModule",{value:!0});zE.ChatToolCallDeltaEventDeltaMessageToolCalls=void 0;var VHn=zHn(se()),HHn=qZe();zE.ChatToolCallDeltaEventDeltaMessageToolCalls=VHn.serialization.object({function:HHn.ChatToolCallDeltaEventDeltaMessageToolCallsFunction.optional()})});var BZe=S(VE=>{"use strict";var WHn=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]}),JHn=VE&&VE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KHn=VE&&VE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WHn(r,e,n[o]);return JHn(r,e),r}}();Object.defineProperty(VE,"__esModule",{value:!0});VE.ChatToolCallDeltaEventDeltaMessage=void 0;var Fur=KHn(se()),GHn=UZe();VE.ChatToolCallDeltaEventDeltaMessage=Fur.serialization.object({toolCalls:Fur.serialization.property("tool_calls",GHn.ChatToolCallDeltaEventDeltaMessageToolCalls.optional())})});var zZe=S(HE=>{"use strict";var XHn=HE&&HE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZHn=HE&&HE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YHn=HE&&HE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XHn(r,e,n[o]);return ZHn(r,e),r}}();Object.defineProperty(HE,"__esModule",{value:!0});HE.ChatToolCallDeltaEventDelta=void 0;var QHn=YHn(se()),e3n=BZe();HE.ChatToolCallDeltaEventDelta=QHn.serialization.object({message:e3n.ChatToolCallDeltaEventDeltaMessage.optional()})});var VZe=S(WE=>{"use strict";var t3n=WE&&WE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r3n=WE&&WE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n3n=WE&&WE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&t3n(r,e,n[o]);return r3n(r,e),r}}();Object.defineProperty(WE,"__esModule",{value:!0});WE.ChatToolCallDeltaEvent=void 0;var kur=n3n(se()),o3n=zZe(),i3n=Ow();WE.ChatToolCallDeltaEvent=kur.serialization.object({index:kur.serialization.number().optional(),delta:o3n.ChatToolCallDeltaEventDelta.optional()}).extend(i3n.ChatStreamEventType)});var HZe=S(JE=>{"use strict";var a3n=JE&&JE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s3n=JE&&JE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u3n=JE&&JE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a3n(r,e,n[o]);return s3n(r,e),r}}();Object.defineProperty(JE,"__esModule",{value:!0});JE.ChatToolCallEndEvent=void 0;var qur=u3n(se()),l3n=Ow();JE.ChatToolCallEndEvent=qur.serialization.object({index:qur.serialization.number().optional()}).extend(l3n.ChatStreamEventType)});var WZe=S(KE=>{"use strict";var c3n=KE&&KE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),d3n=KE&&KE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f3n=KE&&KE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&c3n(r,e,n[o]);return d3n(r,e),r}}();Object.defineProperty(KE,"__esModule",{value:!0});KE.ChatToolSource=void 0;var c8=f3n(se());KE.ChatToolSource=c8.serialization.object({id:c8.serialization.string().optional(),toolOutput:c8.serialization.property("tool_output",c8.serialization.record(c8.serialization.string(),c8.serialization.unknown()).optional())})});var JZe=S(GE=>{"use strict";var p3n=GE&&GE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m3n=GE&&GE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h3n=GE&&GE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p3n(r,e,n[o]);return m3n(r,e),r}}();Object.defineProperty(GE,"__esModule",{value:!0});GE.ChatDocumentSource=void 0;var Uoe=h3n(se());GE.ChatDocumentSource=Uoe.serialization.object({id:Uoe.serialization.string().optional(),document:Uoe.serialization.record(Uoe.serialization.string(),Uoe.serialization.unknown()).optional()})});var KZe=S(XE=>{"use strict";var g3n=XE&&XE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y3n=XE&&XE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b3n=XE&&XE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g3n(r,e,n[o]);return y3n(r,e),r}}();Object.defineProperty(XE,"__esModule",{value:!0});XE.Source=void 0;var _3n=b3n(se()),v3n=WZe(),w3n=JZe();XE.Source=_3n.serialization.union("type",{tool:v3n.ChatToolSource,document:w3n.ChatDocumentSource}).transform({transform:t=>t,untransform:t=>t})});var GZe=S(ZE=>{"use strict";var S3n=ZE&&ZE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C3n=ZE&&ZE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x3n=ZE&&ZE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S3n(r,e,n[o]);return C3n(r,e),r}}();Object.defineProperty(ZE,"__esModule",{value:!0});ZE.CitationType=void 0;var T3n=x3n(se());ZE.CitationType=T3n.serialization.enum_(["TEXT_CONTENT","THINKING_CONTENT","PLAN"])});var Boe=S(YE=>{"use strict";var O3n=YE&&YE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E3n=YE&&YE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P3n=YE&&YE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&O3n(r,e,n[o]);return E3n(r,e),r}}();Object.defineProperty(YE,"__esModule",{value:!0});YE.Citation=void 0;var eV=P3n(se()),M3n=KZe(),R3n=GZe();YE.Citation=eV.serialization.object({start:eV.serialization.number().optional(),end:eV.serialization.number().optional(),text:eV.serialization.string().optional(),sources:eV.serialization.list(M3n.Source).optional(),contentIndex:eV.serialization.property("content_index",eV.serialization.number().optional()),type:R3n.CitationType.optional()})});var XZe=S(QE=>{"use strict";var I3n=QE&&QE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A3n=QE&&QE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N3n=QE&&QE.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I3n(r,e,n[o]);return A3n(r,e),r}}();Object.defineProperty(QE,"__esModule",{value:!0});QE.CitationStartEventDeltaMessage=void 0;var D3n=N3n(se()),j3n=Boe();QE.CitationStartEventDeltaMessage=D3n.serialization.object({citations:j3n.Citation.optional()})});var ZZe=S(eP=>{"use strict";var $3n=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]}),L3n=eP&&eP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F3n=eP&&eP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$3n(r,e,n[o]);return L3n(r,e),r}}();Object.defineProperty(eP,"__esModule",{value:!0});eP.CitationStartEventDelta=void 0;var k3n=F3n(se()),q3n=XZe();eP.CitationStartEventDelta=k3n.serialization.object({message:q3n.CitationStartEventDeltaMessage.optional()})});var YZe=S(tP=>{"use strict";var U3n=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]}),B3n=tP&&tP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z3n=tP&&tP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U3n(r,e,n[o]);return B3n(r,e),r}}();Object.defineProperty(tP,"__esModule",{value:!0});tP.CitationStartEvent=void 0;var Uur=z3n(se()),V3n=ZZe(),H3n=Ow();tP.CitationStartEvent=Uur.serialization.object({index:Uur.serialization.number().optional(),delta:V3n.CitationStartEventDelta.optional()}).extend(H3n.ChatStreamEventType)});var QZe=S(rP=>{"use strict";var W3n=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]}),J3n=rP&&rP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K3n=rP&&rP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&W3n(r,e,n[o]);return J3n(r,e),r}}();Object.defineProperty(rP,"__esModule",{value:!0});rP.CitationEndEvent=void 0;var Bur=K3n(se()),G3n=Ow();rP.CitationEndEvent=Bur.serialization.object({index:Bur.serialization.number().optional()}).extend(G3n.ChatStreamEventType)});var YCe=S(nP=>{"use strict";var X3n=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]}),Z3n=nP&&nP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y3n=nP&&nP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X3n(r,e,n[o]);return Z3n(r,e),r}}();Object.defineProperty(nP,"__esModule",{value:!0});nP.ChatFinishReason=void 0;var Q3n=Y3n(se());nP.ChatFinishReason=Q3n.serialization.enum_(["COMPLETE","STOP_SEQUENCE","MAX_TOKENS","TOOL_CALL","ERROR"])});var eYe=S(oP=>{"use strict";var eWn=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]}),tWn=oP&&oP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rWn=oP&&oP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eWn(r,e,n[o]);return tWn(r,e),r}}();Object.defineProperty(oP,"__esModule",{value:!0});oP.UsageBilledUnits=void 0;var Rk=rWn(se());oP.UsageBilledUnits=Rk.serialization.object({inputTokens:Rk.serialization.property("input_tokens",Rk.serialization.number().optional()),outputTokens:Rk.serialization.property("output_tokens",Rk.serialization.number().optional()),searchUnits:Rk.serialization.property("search_units",Rk.serialization.number().optional()),classifications:Rk.serialization.number().optional()})});var tYe=S(iP=>{"use strict";var nWn=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]}),oWn=iP&&iP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iWn=iP&&iP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nWn(r,e,n[o]);return oWn(r,e),r}}();Object.defineProperty(iP,"__esModule",{value:!0});iP.UsageTokens=void 0;var zoe=iWn(se());iP.UsageTokens=zoe.serialization.object({inputTokens:zoe.serialization.property("input_tokens",zoe.serialization.number().optional()),outputTokens:zoe.serialization.property("output_tokens",zoe.serialization.number().optional())})});var QCe=S(aP=>{"use strict";var aWn=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]}),sWn=aP&&aP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uWn=aP&&aP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aWn(r,e,n[o]);return sWn(r,e),r}}();Object.defineProperty(aP,"__esModule",{value:!0});aP.Usage=void 0;var zur=uWn(se()),lWn=eYe(),cWn=tYe();aP.Usage=zur.serialization.object({billedUnits:zur.serialization.property("billed_units",lWn.UsageBilledUnits.optional()),tokens:cWn.UsageTokens.optional()})});var nYe=S(sP=>{"use strict";var dWn=sP&&sP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fWn=sP&&sP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pWn=sP&&sP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dWn(r,e,n[o]);return fWn(r,e),r}}();Object.defineProperty(sP,"__esModule",{value:!0});sP.ChatMessageEndEventDelta=void 0;var rYe=pWn(se()),mWn=YCe(),hWn=QCe();sP.ChatMessageEndEventDelta=rYe.serialization.object({error:rYe.serialization.string().optional(),finishReason:rYe.serialization.property("finish_reason",mWn.ChatFinishReason.optional()),usage:hWn.Usage.optional()})});var oYe=S(uP=>{"use strict";var gWn=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]}),yWn=uP&&uP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bWn=uP&&uP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gWn(r,e,n[o]);return yWn(r,e),r}}();Object.defineProperty(uP,"__esModule",{value:!0});uP.ChatMessageEndEvent=void 0;var Vur=bWn(se()),_Wn=nYe(),vWn=Ow();uP.ChatMessageEndEvent=Vur.serialization.object({id:Vur.serialization.string().optional(),delta:_Wn.ChatMessageEndEventDelta.optional()}).extend(vWn.ChatStreamEventType)});var xx=S(lP=>{"use strict";var wWn=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]}),SWn=lP&&lP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CWn=lP&&lP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wWn(r,e,n[o]);return SWn(r,e),r}}();Object.defineProperty(lP,"__esModule",{value:!0});lP.ChatStreamEvent=void 0;var xWn=CWn(se());lP.ChatStreamEvent=xWn.serialization.object({})});var exe=S(cP=>{"use strict";var TWn=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]}),OWn=cP&&cP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EWn=cP&&cP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TWn(r,e,n[o]);return OWn(r,e),r}}();Object.defineProperty(cP,"__esModule",{value:!0});cP.ChatDebugEvent=void 0;var Hur=EWn(se()),PWn=xx();cP.ChatDebugEvent=Hur.serialization.object({prompt:Hur.serialization.string().optional()}).extend(PWn.ChatStreamEvent)});var Wur=S(dP=>{"use strict";var MWn=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]}),RWn=dP&&dP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IWn=dP&&dP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MWn(r,e,n[o]);return RWn(r,e),r}}();Object.defineProperty(dP,"__esModule",{value:!0});dP.V2ChatStreamResponse=void 0;var AWn=IWn(se()),NWn=yZe(),DWn=CZe(),jWn=PZe(),$Wn=MZe(),LWn=NZe(),FWn=kZe(),kWn=VZe(),qWn=HZe(),UWn=YZe(),BWn=QZe(),zWn=oYe(),VWn=exe();dP.V2ChatStreamResponse=AWn.serialization.union("type",{"message-start":NWn.ChatMessageStartEvent,"content-start":DWn.ChatContentStartEvent,"content-delta":jWn.ChatContentDeltaEvent,"content-end":$Wn.ChatContentEndEvent,"tool-plan-delta":LWn.ChatToolPlanDeltaEvent,"tool-call-start":FWn.ChatToolCallStartEvent,"tool-call-delta":kWn.ChatToolCallDeltaEvent,"tool-call-end":qWn.ChatToolCallEndEvent,"citation-start":UWn.CitationStartEvent,"citation-end":BWn.CitationEndEvent,"message-end":zWn.ChatMessageEndEvent,debug:VWn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var iYe=S(fP=>{"use strict";var HWn=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]}),WWn=fP&&fP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JWn=fP&&fP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HWn(r,e,n[o]);return WWn(r,e),r}}();Object.defineProperty(fP,"__esModule",{value:!0});fP.V2ChatRequestDocumentsItem=void 0;var Jur=JWn(se()),KWn=koe();fP.V2ChatRequestDocumentsItem=Jur.serialization.undiscriminatedUnion([Jur.serialization.string(),KWn.Document])});var aYe=S(pP=>{"use strict";var GWn=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]}),XWn=pP&&pP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZWn=pP&&pP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GWn(r,e,n[o]);return XWn(r,e),r}}();Object.defineProperty(pP,"__esModule",{value:!0});pP.V2ChatRequestSafetyMode=void 0;var YWn=ZWn(se());pP.V2ChatRequestSafetyMode=YWn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var sYe=S(mP=>{"use strict";var QWn=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]}),e6n=mP&&mP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t6n=mP&&mP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QWn(r,e,n[o]);return e6n(r,e),r}}();Object.defineProperty(mP,"__esModule",{value:!0});mP.V2ChatRequestToolChoice=void 0;var r6n=t6n(se());mP.V2ChatRequestToolChoice=r6n.serialization.enum_(["REQUIRED","NONE"])});var tV=S(hP=>{"use strict";var n6n=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]}),o6n=hP&&hP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i6n=hP&&hP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n6n(r,e,n[o]);return o6n(r,e),r}}();Object.defineProperty(hP,"__esModule",{value:!0});hP.ChatTextContent=void 0;var Kur=i6n(se());hP.ChatTextContent=Kur.serialization.object({text:Kur.serialization.string()})});var txe=S(gP=>{"use strict";var a6n=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]}),s6n=gP&&gP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u6n=gP&&gP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a6n(r,e,n[o]);return s6n(r,e),r}}();Object.defineProperty(gP,"__esModule",{value:!0});gP.ChatThinkingContent=void 0;var Gur=u6n(se());gP.ChatThinkingContent=Gur.serialization.object({thinking:Gur.serialization.string()})});var uYe=S(yP=>{"use strict";var l6n=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]}),c6n=yP&&yP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d6n=yP&&yP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l6n(r,e,n[o]);return c6n(r,e),r}}();Object.defineProperty(yP,"__esModule",{value:!0});yP.AssistantMessageResponseContentItem=void 0;var f6n=d6n(se()),p6n=tV(),m6n=txe();yP.AssistantMessageResponseContentItem=f6n.serialization.union("type",{text:p6n.ChatTextContent,thinking:m6n.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var lYe=S(bP=>{"use strict";var h6n=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]}),g6n=bP&&bP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y6n=bP&&bP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&h6n(r,e,n[o]);return g6n(r,e),r}}();Object.defineProperty(bP,"__esModule",{value:!0});bP.AssistantMessageResponse=void 0;var Ik=y6n(se()),b6n=qoe(),_6n=uYe(),v6n=Boe();bP.AssistantMessageResponse=Ik.serialization.object({role:Ik.serialization.stringLiteral("assistant"),toolCalls:Ik.serialization.property("tool_calls",Ik.serialization.list(b6n.ToolCallV2).optional()),toolPlan:Ik.serialization.property("tool_plan",Ik.serialization.string().optional()),content:Ik.serialization.list(_6n.AssistantMessageResponseContentItem).optional(),citations:Ik.serialization.list(v6n.Citation).optional()})});var Xur=S(_P=>{"use strict";var w6n=_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]}),S6n=_P&&_P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C6n=_P&&_P.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w6n(r,e,n[o]);return S6n(r,e),r}}();Object.defineProperty(_P,"__esModule",{value:!0});_P.V2ChatResponse=void 0;var rxe=C6n(se()),x6n=YCe(),T6n=lYe(),O6n=QCe(),E6n=ZCe();_P.V2ChatResponse=rxe.serialization.object({id:rxe.serialization.string(),finishReason:rxe.serialization.property("finish_reason",x6n.ChatFinishReason),message:T6n.AssistantMessageResponse,usage:O6n.Usage.optional(),logprobs:rxe.serialization.list(E6n.LogprobItem).optional()})});var cYe=S(vP=>{"use strict";var P6n=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]}),M6n=vP&&vP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R6n=vP&&vP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P6n(r,e,n[o]);return M6n(r,e),r}}();Object.defineProperty(vP,"__esModule",{value:!0});vP.V2EmbedRequestTruncate=void 0;var I6n=R6n(se());vP.V2EmbedRequestTruncate=I6n.serialization.enum_(["NONE","START","END"])});var dYe=S(wP=>{"use strict";var A6n=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]}),N6n=wP&&wP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D6n=wP&&wP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A6n(r,e,n[o]);return N6n(r,e),r}}();Object.defineProperty(wP,"__esModule",{value:!0});wP.V2RerankResponseResultsItem=void 0;var nxe=D6n(se());wP.V2RerankResponseResultsItem=nxe.serialization.object({index:nxe.serialization.number(),relevanceScore:nxe.serialization.property("relevance_score",nxe.serialization.number())})});var fYe=S(SP=>{"use strict";var j6n=SP&&SP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$6n=SP&&SP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L6n=SP&&SP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j6n(r,e,n[o]);return $6n(r,e),r}}();Object.defineProperty(SP,"__esModule",{value:!0});SP.ApiMetaApiVersion=void 0;var d8=L6n(se());SP.ApiMetaApiVersion=d8.serialization.object({version:d8.serialization.string(),isDeprecated:d8.serialization.property("is_deprecated",d8.serialization.boolean().optional()),isExperimental:d8.serialization.property("is_experimental",d8.serialization.boolean().optional())})});var pYe=S(CP=>{"use strict";var F6n=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]}),k6n=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q6n=CP&&CP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F6n(r,e,n[o]);return k6n(r,e),r}}();Object.defineProperty(CP,"__esModule",{value:!0});CP.ApiMetaBilledUnits=void 0;var tD=q6n(se());CP.ApiMetaBilledUnits=tD.serialization.object({images:tD.serialization.number().optional(),inputTokens:tD.serialization.property("input_tokens",tD.serialization.number().optional()),outputTokens:tD.serialization.property("output_tokens",tD.serialization.number().optional()),searchUnits:tD.serialization.property("search_units",tD.serialization.number().optional()),classifications:tD.serialization.number().optional()})});var mYe=S(xP=>{"use strict";var U6n=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]}),B6n=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z6n=xP&&xP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U6n(r,e,n[o]);return B6n(r,e),r}}();Object.defineProperty(xP,"__esModule",{value:!0});xP.ApiMetaTokens=void 0;var Voe=z6n(se());xP.ApiMetaTokens=Voe.serialization.object({inputTokens:Voe.serialization.property("input_tokens",Voe.serialization.number().optional()),outputTokens:Voe.serialization.property("output_tokens",Voe.serialization.number().optional())})});var Q_=S(TP=>{"use strict";var V6n=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]}),H6n=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W6n=TP&&TP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V6n(r,e,n[o]);return H6n(r,e),r}}();Object.defineProperty(TP,"__esModule",{value:!0});TP.ApiMeta=void 0;var Hoe=W6n(se()),J6n=fYe(),K6n=pYe(),G6n=mYe();TP.ApiMeta=Hoe.serialization.object({apiVersion:Hoe.serialization.property("api_version",J6n.ApiMetaApiVersion.optional()),billedUnits:Hoe.serialization.property("billed_units",K6n.ApiMetaBilledUnits.optional()),tokens:G6n.ApiMetaTokens.optional(),warnings:Hoe.serialization.list(Hoe.serialization.string()).optional()})});var Zur=S(OP=>{"use strict";var X6n=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]}),Z6n=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y6n=OP&&OP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X6n(r,e,n[o]);return Z6n(r,e),r}}();Object.defineProperty(OP,"__esModule",{value:!0});OP.V2RerankResponse=void 0;var hYe=Y6n(se()),Q6n=dYe(),eJn=Q_();OP.V2RerankResponse=hYe.serialization.object({id:hYe.serialization.string().optional(),results:hYe.serialization.list(Q6n.V2RerankResponseResultsItem),meta:eJn.ApiMeta.optional()})});var gYe=S(Wg=>{"use strict";var tJn=Wg&&Wg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Tx=Wg&&Wg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tJn(e,t,r)};Object.defineProperty(Wg,"__esModule",{value:!0});Tx(fZe(),Wg);Tx(pZe(),Wg);Tx(mZe(),Wg);Tx(Wur(),Wg);Tx(iYe(),Wg);Tx(aYe(),Wg);Tx(sYe(),Wg);Tx(Xur(),Wg);Tx(cYe(),Wg);Tx(dYe(),Wg);Tx(Zur(),Wg)});var yYe=S(EP=>{"use strict";var rJn=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]}),nJn=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oJn=EP&&EP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rJn(r,e,n[o]);return nJn(r,e),r}}();Object.defineProperty(EP,"__esModule",{value:!0});EP.ImageUrlDetail=void 0;var iJn=oJn(se());EP.ImageUrlDetail=iJn.serialization.enum_(["auto","low","high"])});var bYe=S(PP=>{"use strict";var aJn=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]}),sJn=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uJn=PP&&PP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aJn(r,e,n[o]);return sJn(r,e),r}}();Object.defineProperty(PP,"__esModule",{value:!0});PP.ImageUrl=void 0;var Yur=uJn(se()),lJn=yYe();PP.ImageUrl=Yur.serialization.object({url:Yur.serialization.string(),detail:lJn.ImageUrlDetail.optional()})});var _Ye=S(MP=>{"use strict";var cJn=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]}),dJn=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fJn=MP&&MP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cJn(r,e,n[o]);return dJn(r,e),r}}();Object.defineProperty(MP,"__esModule",{value:!0});MP.ImageContent=void 0;var Qur=fJn(se()),pJn=bYe();MP.ImageContent=Qur.serialization.object({imageUrl:Qur.serialization.property("image_url",pJn.ImageUrl)})});var vYe=S(RP=>{"use strict";var mJn=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]}),hJn=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gJn=RP&&RP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mJn(r,e,n[o]);return hJn(r,e),r}}();Object.defineProperty(RP,"__esModule",{value:!0});RP.Content=void 0;var yJn=gJn(se()),bJn=tV(),_Jn=_Ye();RP.Content=yJn.serialization.union("type",{text:bJn.ChatTextContent,image_url:_Jn.ImageContent}).transform({transform:t=>t,untransform:t=>t})});var SYe=S(IP=>{"use strict";var vJn=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]}),wJn=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SJn=IP&&IP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vJn(r,e,n[o]);return wJn(r,e),r}}();Object.defineProperty(IP,"__esModule",{value:!0});IP.UserMessageV2Content=void 0;var wYe=SJn(se()),CJn=vYe();IP.UserMessageV2Content=wYe.serialization.undiscriminatedUnion([wYe.serialization.string(),wYe.serialization.list(CJn.Content)])});var CYe=S(AP=>{"use strict";var xJn=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]}),TJn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OJn=AP&&AP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xJn(r,e,n[o]);return TJn(r,e),r}}();Object.defineProperty(AP,"__esModule",{value:!0});AP.UserMessageV2=void 0;var EJn=OJn(se()),PJn=SYe();AP.UserMessageV2=EJn.serialization.object({content:PJn.UserMessageV2Content})});var xYe=S(NP=>{"use strict";var MJn=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]}),RJn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IJn=NP&&NP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MJn(r,e,n[o]);return RJn(r,e),r}}();Object.defineProperty(NP,"__esModule",{value:!0});NP.AssistantMessageV2ContentItem=void 0;var AJn=IJn(se()),NJn=tV(),DJn=txe();NP.AssistantMessageV2ContentItem=AJn.serialization.union("type",{text:NJn.ChatTextContent,thinking:DJn.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var OYe=S(DP=>{"use strict";var jJn=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]}),$Jn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LJn=DP&&DP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jJn(r,e,n[o]);return $Jn(r,e),r}}();Object.defineProperty(DP,"__esModule",{value:!0});DP.AssistantMessageV2Content=void 0;var TYe=LJn(se()),FJn=xYe();DP.AssistantMessageV2Content=TYe.serialization.undiscriminatedUnion([TYe.serialization.string(),TYe.serialization.list(FJn.AssistantMessageV2ContentItem)])});var EYe=S(jP=>{"use strict";var kJn=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]}),qJn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UJn=jP&&jP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kJn(r,e,n[o]);return qJn(r,e),r}}();Object.defineProperty(jP,"__esModule",{value:!0});jP.AssistantMessage=void 0;var f8=UJn(se()),BJn=qoe(),zJn=OYe(),VJn=Boe();jP.AssistantMessage=f8.serialization.object({toolCalls:f8.serialization.property("tool_calls",f8.serialization.list(BJn.ToolCallV2).optional()),toolPlan:f8.serialization.property("tool_plan",f8.serialization.string().optional()),content:zJn.AssistantMessageV2Content.optional(),citations:f8.serialization.list(VJn.Citation).optional()})});var PYe=S($P=>{"use strict";var HJn=$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]}),WJn=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JJn=$P&&$P.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HJn(r,e,n[o]);return WJn(r,e),r}}();Object.defineProperty($P,"__esModule",{value:!0});$P.SystemMessageV2ContentItem=void 0;var KJn=JJn(se()),GJn=tV();$P.SystemMessageV2ContentItem=KJn.serialization.union("type",{text:GJn.ChatTextContent}).transform({transform:t=>t,untransform:t=>t})});var RYe=S(LP=>{"use strict";var XJn=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]}),ZJn=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YJn=LP&&LP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XJn(r,e,n[o]);return ZJn(r,e),r}}();Object.defineProperty(LP,"__esModule",{value:!0});LP.SystemMessageV2Content=void 0;var MYe=YJn(se()),QJn=PYe();LP.SystemMessageV2Content=MYe.serialization.undiscriminatedUnion([MYe.serialization.string(),MYe.serialization.list(QJn.SystemMessageV2ContentItem)])});var IYe=S(FP=>{"use strict";var e5n=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]}),t5n=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r5n=FP&&FP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&e5n(r,e,n[o]);return t5n(r,e),r}}();Object.defineProperty(FP,"__esModule",{value:!0});FP.SystemMessageV2=void 0;var n5n=r5n(se()),o5n=RYe();FP.SystemMessageV2=n5n.serialization.object({content:o5n.SystemMessageV2Content})});var AYe=S(kP=>{"use strict";var i5n=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]}),a5n=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s5n=kP&&kP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i5n(r,e,n[o]);return a5n(r,e),r}}();Object.defineProperty(kP,"__esModule",{value:!0});kP.DocumentContent=void 0;var u5n=s5n(se()),l5n=koe();kP.DocumentContent=u5n.serialization.object({document:l5n.Document})});var NYe=S(qP=>{"use strict";var c5n=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]}),d5n=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f5n=qP&&qP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&c5n(r,e,n[o]);return d5n(r,e),r}}();Object.defineProperty(qP,"__esModule",{value:!0});qP.ToolContent=void 0;var p5n=f5n(se()),m5n=tV(),h5n=AYe();qP.ToolContent=p5n.serialization.union("type",{text:m5n.ChatTextContent,document:h5n.DocumentContent}).transform({transform:t=>t,untransform:t=>t})});var jYe=S(UP=>{"use strict";var g5n=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]}),y5n=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b5n=UP&&UP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g5n(r,e,n[o]);return y5n(r,e),r}}();Object.defineProperty(UP,"__esModule",{value:!0});UP.ToolMessageV2Content=void 0;var DYe=b5n(se()),_5n=NYe();UP.ToolMessageV2Content=DYe.serialization.undiscriminatedUnion([DYe.serialization.string(),DYe.serialization.list(_5n.ToolContent)])});var LYe=S(BP=>{"use strict";var v5n=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]}),w5n=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S5n=BP&&BP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v5n(r,e,n[o]);return w5n(r,e),r}}();Object.defineProperty(BP,"__esModule",{value:!0});BP.ToolMessageV2=void 0;var $Ye=S5n(se()),C5n=jYe();BP.ToolMessageV2=$Ye.serialization.object({toolCallId:$Ye.serialization.property("tool_call_id",$Ye.serialization.string()),content:C5n.ToolMessageV2Content})});var FYe=S(zP=>{"use strict";var x5n=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]}),T5n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O5n=zP&&zP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x5n(r,e,n[o]);return T5n(r,e),r}}();Object.defineProperty(zP,"__esModule",{value:!0});zP.ChatMessageV2=void 0;var E5n=O5n(se()),P5n=CYe(),M5n=EYe(),R5n=IYe(),I5n=LYe();zP.ChatMessageV2=E5n.serialization.union("role",{user:P5n.UserMessageV2,assistant:M5n.AssistantMessage,system:R5n.SystemMessageV2,tool:I5n.ToolMessageV2}).transform({transform:t=>t,untransform:t=>t})});var oxe=S(VP=>{"use strict";var A5n=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]}),N5n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D5n=VP&&VP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A5n(r,e,n[o]);return N5n(r,e),r}}();Object.defineProperty(VP,"__esModule",{value:!0});VP.ChatMessages=void 0;var j5n=D5n(se()),$5n=FYe();VP.ChatMessages=j5n.serialization.list($5n.ChatMessageV2)});var kYe=S(HP=>{"use strict";var L5n=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]}),F5n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k5n=HP&&HP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L5n(r,e,n[o]);return F5n(r,e),r}}();Object.defineProperty(HP,"__esModule",{value:!0});HP.ToolV2Function=void 0;var p8=k5n(se());HP.ToolV2Function=p8.serialization.object({name:p8.serialization.string(),description:p8.serialization.string().optional(),parameters:p8.serialization.record(p8.serialization.string(),p8.serialization.unknown())})});var ixe=S(WP=>{"use strict";var q5n=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]}),U5n=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5n=WP&&WP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&q5n(r,e,n[o]);return U5n(r,e),r}}();Object.defineProperty(WP,"__esModule",{value:!0});WP.ToolV2=void 0;var elr=B5n(se()),z5n=kYe();WP.ToolV2=elr.serialization.object({type:elr.serialization.stringLiteral("function").optional(),function:z5n.ToolV2Function.optional()})});var qYe=S(JP=>{"use strict";var V5n=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]}),H5n=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W5n=JP&&JP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V5n(r,e,n[o]);return H5n(r,e),r}}();Object.defineProperty(JP,"__esModule",{value:!0});JP.CitationOptionsMode=void 0;var J5n=W5n(se());JP.CitationOptionsMode=J5n.serialization.enum_(["FAST","ACCURATE","OFF"])});var axe=S(KP=>{"use strict";var K5n=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]}),G5n=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X5n=KP&&KP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&K5n(r,e,n[o]);return G5n(r,e),r}}();Object.defineProperty(KP,"__esModule",{value:!0});KP.CitationOptions=void 0;var Z5n=X5n(se()),Y5n=qYe();KP.CitationOptions=Z5n.serialization.object({mode:Y5n.CitationOptionsMode.optional()})});var UYe=S(GP=>{"use strict";var Q5n=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]}),eKn=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tKn=GP&&GP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q5n(r,e,n[o]);return eKn(r,e),r}}();Object.defineProperty(GP,"__esModule",{value:!0});GP.ChatTextResponseFormatV2=void 0;var rKn=tKn(se());GP.ChatTextResponseFormatV2=rKn.serialization.object({})});var BYe=S(XP=>{"use strict";var nKn=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]}),oKn=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iKn=XP&&XP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nKn(r,e,n[o]);return oKn(r,e),r}}();Object.defineProperty(XP,"__esModule",{value:!0});XP.JsonResponseFormatV2=void 0;var Woe=iKn(se());XP.JsonResponseFormatV2=Woe.serialization.object({jsonSchema:Woe.serialization.property("json_schema",Woe.serialization.record(Woe.serialization.string(),Woe.serialization.unknown()).optional())})});var sxe=S(ZP=>{"use strict";var aKn=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]}),sKn=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uKn=ZP&&ZP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aKn(r,e,n[o]);return sKn(r,e),r}}();Object.defineProperty(ZP,"__esModule",{value:!0});ZP.ResponseFormatV2=void 0;var lKn=uKn(se()),cKn=UYe(),dKn=BYe();ZP.ResponseFormatV2=lKn.serialization.union("type",{text:cKn.ChatTextResponseFormatV2,json_object:dKn.JsonResponseFormatV2}).transform({transform:t=>t,untransform:t=>t})});var zYe=S(YP=>{"use strict";var fKn=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]}),pKn=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mKn=YP&&YP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fKn(r,e,n[o]);return pKn(r,e),r}}();Object.defineProperty(YP,"__esModule",{value:!0});YP.ThinkingType=void 0;var hKn=mKn(se());YP.ThinkingType=hKn.serialization.enum_(["enabled","disabled"])});var uxe=S(QP=>{"use strict";var gKn=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]}),yKn=QP&&QP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bKn=QP&&QP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gKn(r,e,n[o]);return yKn(r,e),r}}();Object.defineProperty(QP,"__esModule",{value:!0});QP.Thinking=void 0;var VYe=bKn(se()),_Kn=zYe();QP.Thinking=VYe.serialization.object({type:_Kn.ThinkingType,tokenBudget:VYe.serialization.property("token_budget",VYe.serialization.number().optional())})});var tlr=S(eM=>{"use strict";var vKn=eM&&eM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wKn=eM&&eM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SKn=eM&&eM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vKn(r,e,n[o]);return wKn(r,e),r}}();Object.defineProperty(eM,"__esModule",{value:!0});eM.V2ChatStreamRequest=void 0;var Kl=SKn(se()),CKn=oxe(),xKn=ixe(),TKn=fZe(),OKn=axe(),EKn=sxe(),PKn=pZe(),MKn=mZe(),RKn=uxe();eM.V2ChatStreamRequest=Kl.serialization.object({model:Kl.serialization.string(),messages:CKn.ChatMessages,tools:Kl.serialization.list(xKn.ToolV2).optional(),strictTools:Kl.serialization.property("strict_tools",Kl.serialization.boolean().optional()),documents:Kl.serialization.list(TKn.V2ChatStreamRequestDocumentsItem).optional(),citationOptions:Kl.serialization.property("citation_options",OKn.CitationOptions.optional()),responseFormat:Kl.serialization.property("response_format",EKn.ResponseFormatV2.optional()),safetyMode:Kl.serialization.property("safety_mode",PKn.V2ChatStreamRequestSafetyMode.optional()),maxTokens:Kl.serialization.property("max_tokens",Kl.serialization.number().optional()),stopSequences:Kl.serialization.property("stop_sequences",Kl.serialization.list(Kl.serialization.string()).optional()),temperature:Kl.serialization.number().optional(),seed:Kl.serialization.number().optional(),frequencyPenalty:Kl.serialization.property("frequency_penalty",Kl.serialization.number().optional()),presencePenalty:Kl.serialization.property("presence_penalty",Kl.serialization.number().optional()),k:Kl.serialization.number().optional(),p:Kl.serialization.number().optional(),logprobs:Kl.serialization.boolean().optional(),toolChoice:Kl.serialization.property("tool_choice",MKn.V2ChatStreamRequestToolChoice.optional()),thinking:RKn.Thinking.optional()})});var rlr=S(tM=>{"use strict";var IKn=tM&&tM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AKn=tM&&tM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NKn=tM&&tM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IKn(r,e,n[o]);return AKn(r,e),r}}();Object.defineProperty(tM,"__esModule",{value:!0});tM.V2ChatRequest=void 0;var Gl=NKn(se()),DKn=oxe(),jKn=ixe(),$Kn=iYe(),LKn=axe(),FKn=sxe(),kKn=aYe(),qKn=sYe(),UKn=uxe();tM.V2ChatRequest=Gl.serialization.object({model:Gl.serialization.string(),messages:DKn.ChatMessages,tools:Gl.serialization.list(jKn.ToolV2).optional(),strictTools:Gl.serialization.property("strict_tools",Gl.serialization.boolean().optional()),documents:Gl.serialization.list($Kn.V2ChatRequestDocumentsItem).optional(),citationOptions:Gl.serialization.property("citation_options",LKn.CitationOptions.optional()),responseFormat:Gl.serialization.property("response_format",FKn.ResponseFormatV2.optional()),safetyMode:Gl.serialization.property("safety_mode",kKn.V2ChatRequestSafetyMode.optional()),maxTokens:Gl.serialization.property("max_tokens",Gl.serialization.number().optional()),stopSequences:Gl.serialization.property("stop_sequences",Gl.serialization.list(Gl.serialization.string()).optional()),temperature:Gl.serialization.number().optional(),seed:Gl.serialization.number().optional(),frequencyPenalty:Gl.serialization.property("frequency_penalty",Gl.serialization.number().optional()),presencePenalty:Gl.serialization.property("presence_penalty",Gl.serialization.number().optional()),k:Gl.serialization.number().optional(),p:Gl.serialization.number().optional(),logprobs:Gl.serialization.boolean().optional(),toolChoice:Gl.serialization.property("tool_choice",qKn.V2ChatRequestToolChoice.optional()),thinking:UKn.Thinking.optional()})});var Joe=S(rM=>{"use strict";var BKn=rM&&rM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zKn=rM&&rM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VKn=rM&&rM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BKn(r,e,n[o]);return zKn(r,e),r}}();Object.defineProperty(rM,"__esModule",{value:!0});rM.EmbedInputType=void 0;var HKn=VKn(se());rM.EmbedInputType=HKn.serialization.enum_(["search_document","search_query","classification","clustering","image"])});var HYe=S(nM=>{"use strict";var WKn=nM&&nM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JKn=nM&&nM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KKn=nM&&nM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WKn(r,e,n[o]);return JKn(r,e),r}}();Object.defineProperty(nM,"__esModule",{value:!0});nM.EmbedImageUrl=void 0;var nlr=KKn(se());nM.EmbedImageUrl=nlr.serialization.object({url:nlr.serialization.string()})});var WYe=S(oM=>{"use strict";var GKn=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]}),XKn=oM&&oM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZKn=oM&&oM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GKn(r,e,n[o]);return XKn(r,e),r}}();Object.defineProperty(oM,"__esModule",{value:!0});oM.EmbedImage=void 0;var olr=ZKn(se()),YKn=HYe();oM.EmbedImage=olr.serialization.object({imageUrl:olr.serialization.property("image_url",YKn.EmbedImageUrl.optional())})});var JYe=S(iM=>{"use strict";var QKn=iM&&iM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e8n=iM&&iM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t8n=iM&&iM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QKn(r,e,n[o]);return e8n(r,e),r}}();Object.defineProperty(iM,"__esModule",{value:!0});iM.EmbedText=void 0;var ilr=t8n(se());iM.EmbedText=ilr.serialization.object({text:ilr.serialization.string().optional()})});var KYe=S(aM=>{"use strict";var r8n=aM&&aM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n8n=aM&&aM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o8n=aM&&aM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r8n(r,e,n[o]);return n8n(r,e),r}}();Object.defineProperty(aM,"__esModule",{value:!0});aM.EmbedContent=void 0;var i8n=o8n(se()),a8n=WYe(),s8n=JYe();aM.EmbedContent=i8n.serialization.union("type",{image_url:a8n.EmbedImage,text:s8n.EmbedText}).transform({transform:t=>t,untransform:t=>t})});var GYe=S(sM=>{"use strict";var u8n=sM&&sM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l8n=sM&&sM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c8n=sM&&sM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u8n(r,e,n[o]);return l8n(r,e),r}}();Object.defineProperty(sM,"__esModule",{value:!0});sM.EmbedInput=void 0;var alr=c8n(se()),d8n=KYe();sM.EmbedInput=alr.serialization.object({content:alr.serialization.list(d8n.EmbedContent)})});var Koe=S(uM=>{"use strict";var f8n=uM&&uM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p8n=uM&&uM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m8n=uM&&uM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f8n(r,e,n[o]);return p8n(r,e),r}}();Object.defineProperty(uM,"__esModule",{value:!0});uM.EmbeddingType=void 0;var h8n=m8n(se());uM.EmbeddingType=h8n.serialization.enum_(["float","int8","uint8","binary","ubinary","base64"])});var slr=S(lM=>{"use strict";var g8n=lM&&lM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y8n=lM&&lM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b8n=lM&&lM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g8n(r,e,n[o]);return y8n(r,e),r}}();Object.defineProperty(lM,"__esModule",{value:!0});lM.V2EmbedRequest=void 0;var ev=b8n(se()),_8n=Joe(),v8n=GYe(),w8n=Koe(),S8n=cYe();lM.V2EmbedRequest=ev.serialization.object({texts:ev.serialization.list(ev.serialization.string()).optional(),images:ev.serialization.list(ev.serialization.string()).optional(),model:ev.serialization.string(),inputType:ev.serialization.property("input_type",_8n.EmbedInputType),inputs:ev.serialization.list(v8n.EmbedInput).optional(),maxTokens:ev.serialization.property("max_tokens",ev.serialization.number().optional()),outputDimension:ev.serialization.property("output_dimension",ev.serialization.number().optional()),embeddingTypes:ev.serialization.property("embedding_types",ev.serialization.list(w8n.EmbeddingType).optional()),truncate:S8n.V2EmbedRequestTruncate.optional()})});var ulr=S(cM=>{"use strict";var C8n=cM&&cM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x8n=cM&&cM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T8n=cM&&cM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&C8n(r,e,n[o]);return x8n(r,e),r}}();Object.defineProperty(cM,"__esModule",{value:!0});cM.V2RerankRequest=void 0;var rD=T8n(se());cM.V2RerankRequest=rD.serialization.object({model:rD.serialization.string(),query:rD.serialization.string(),documents:rD.serialization.list(rD.serialization.string()),topN:rD.serialization.property("top_n",rD.serialization.number().optional()),maxTokensPerDoc:rD.serialization.property("max_tokens_per_doc",rD.serialization.number().optional())})});var XYe=S(dM=>{"use strict";Object.defineProperty(dM,"__esModule",{value:!0});dM.V2RerankRequest=dM.V2EmbedRequest=dM.V2ChatRequest=dM.V2ChatStreamRequest=void 0;var O8n=tlr();Object.defineProperty(dM,"V2ChatStreamRequest",{enumerable:!0,get:function(){return O8n.V2ChatStreamRequest}});var E8n=rlr();Object.defineProperty(dM,"V2ChatRequest",{enumerable:!0,get:function(){return E8n.V2ChatRequest}});var P8n=slr();Object.defineProperty(dM,"V2EmbedRequest",{enumerable:!0,get:function(){return P8n.V2EmbedRequest}});var M8n=ulr();Object.defineProperty(dM,"V2RerankRequest",{enumerable:!0,get:function(){return M8n.V2RerankRequest}})});var llr=S(rV=>{"use strict";var R8n=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]}),I8n=rV&&rV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&R8n(e,t,r)};Object.defineProperty(rV,"__esModule",{value:!0});I8n(XYe(),rV)});var dlr=S(Ak=>{"use strict";var A8n=Ak&&Ak.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Ak&&Ak.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A8n(e,t,r)};Object.defineProperty(Ak,"__esModule",{value:!0});clr(gYe(),Ak);clr(llr(),Ak)});var ZYe=S(fM=>{"use strict";var N8n=fM&&fM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),D8n=fM&&fM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j8n=fM&&fM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N8n(r,e,n[o]);return D8n(r,e),r}}();Object.defineProperty(fM,"__esModule",{value:!0});fM.CreateEmbedJobRequestTruncate=void 0;var $8n=j8n(se());fM.CreateEmbedJobRequestTruncate=$8n.serialization.enum_(["START","END"])});var YYe=S(nV=>{"use strict";var L8n=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]}),F8n=nV&&nV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&L8n(e,t,r)};Object.defineProperty(nV,"__esModule",{value:!0});F8n(ZYe(),nV)});var flr=S(pM=>{"use strict";var k8n=pM&&pM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q8n=pM&&pM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U8n=pM&&pM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k8n(r,e,n[o]);return q8n(r,e),r}}();Object.defineProperty(pM,"__esModule",{value:!0});pM.CreateEmbedJobRequest=void 0;var Nk=U8n(se()),B8n=Joe(),z8n=Koe(),V8n=ZYe();pM.CreateEmbedJobRequest=Nk.serialization.object({model:Nk.serialization.string(),datasetId:Nk.serialization.property("dataset_id",Nk.serialization.string()),inputType:Nk.serialization.property("input_type",B8n.EmbedInputType),name:Nk.serialization.string().optional(),embeddingTypes:Nk.serialization.property("embedding_types",Nk.serialization.list(z8n.EmbeddingType).optional()),truncate:V8n.CreateEmbedJobRequestTruncate.optional()})});var QYe=S(lxe=>{"use strict";Object.defineProperty(lxe,"__esModule",{value:!0});lxe.CreateEmbedJobRequest=void 0;var H8n=flr();Object.defineProperty(lxe,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return H8n.CreateEmbedJobRequest}})});var plr=S(oV=>{"use strict";var W8n=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]}),J8n=oV&&oV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&W8n(e,t,r)};Object.defineProperty(oV,"__esModule",{value:!0});J8n(QYe(),oV)});var hlr=S(Dk=>{"use strict";var K8n=Dk&&Dk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Dk&&Dk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&K8n(e,t,r)};Object.defineProperty(Dk,"__esModule",{value:!0});mlr(YYe(),Dk);mlr(plr(),Dk)});var eQe=S(mM=>{"use strict";var G8n=mM&&mM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X8n=mM&&mM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z8n=mM&&mM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G8n(r,e,n[o]);return X8n(r,e),r}}();Object.defineProperty(mM,"__esModule",{value:!0});mM.DatasetType=void 0;var Y8n=Z8n(se());mM.DatasetType=Y8n.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 tQe=S(hM=>{"use strict";var Q8n=hM&&hM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eGn=hM&&hM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tGn=hM&&hM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q8n(r,e,n[o]);return eGn(r,e),r}}();Object.defineProperty(hM,"__esModule",{value:!0});hM.DatasetValidationStatus=void 0;var rGn=tGn(se());hM.DatasetValidationStatus=rGn.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var rQe=S(gM=>{"use strict";var nGn=gM&&gM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oGn=gM&&gM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iGn=gM&&gM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nGn(r,e,n[o]);return oGn(r,e),r}}();Object.defineProperty(gM,"__esModule",{value:!0});gM.DatasetPart=void 0;var Ew=iGn(se());gM.DatasetPart=Ew.serialization.object({id:Ew.serialization.string(),name:Ew.serialization.string(),url:Ew.serialization.string().optional(),index:Ew.serialization.number().optional(),sizeBytes:Ew.serialization.property("size_bytes",Ew.serialization.number().optional()),numRows:Ew.serialization.property("num_rows",Ew.serialization.number().optional()),originalUrl:Ew.serialization.property("original_url",Ew.serialization.string().optional()),samples:Ew.serialization.list(Ew.serialization.string()).optional()})});var cxe=S(yM=>{"use strict";var aGn=yM&&yM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sGn=yM&&yM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uGn=yM&&yM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aGn(r,e,n[o]);return sGn(r,e),r}}();Object.defineProperty(yM,"__esModule",{value:!0});yM.Dataset=void 0;var xc=uGn(se()),lGn=eQe(),cGn=tQe(),dGn=rQe();yM.Dataset=xc.serialization.object({id:xc.serialization.string(),name:xc.serialization.string(),createdAt:xc.serialization.property("created_at",xc.serialization.date()),updatedAt:xc.serialization.property("updated_at",xc.serialization.date()),datasetType:xc.serialization.property("dataset_type",lGn.DatasetType),validationStatus:xc.serialization.property("validation_status",cGn.DatasetValidationStatus),validationError:xc.serialization.property("validation_error",xc.serialization.string().optional()),schema:xc.serialization.string().optional(),requiredFields:xc.serialization.property("required_fields",xc.serialization.list(xc.serialization.string()).optional()),preserveFields:xc.serialization.property("preserve_fields",xc.serialization.list(xc.serialization.string()).optional()),datasetParts:xc.serialization.property("dataset_parts",xc.serialization.list(dGn.DatasetPart).optional()),validationWarnings:xc.serialization.property("validation_warnings",xc.serialization.list(xc.serialization.string()).optional())})});var ylr=S(bM=>{"use strict";var fGn=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]}),pGn=bM&&bM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mGn=bM&&bM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fGn(r,e,n[o]);return pGn(r,e),r}}();Object.defineProperty(bM,"__esModule",{value:!0});bM.DatasetsListResponse=void 0;var glr=mGn(se()),hGn=cxe();bM.DatasetsListResponse=glr.serialization.object({datasets:glr.serialization.list(hGn.Dataset).optional()})});var _lr=S(_M=>{"use strict";var gGn=_M&&_M.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yGn=_M&&_M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bGn=_M&&_M.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gGn(r,e,n[o]);return yGn(r,e),r}}();Object.defineProperty(_M,"__esModule",{value:!0});_M.DatasetsCreateResponse=void 0;var blr=bGn(se());_M.DatasetsCreateResponse=blr.serialization.object({id:blr.serialization.string().optional()})});var vlr=S(vM=>{"use strict";var _Gn=vM&&vM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vGn=vM&&vM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wGn=vM&&vM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Gn(r,e,n[o]);return vGn(r,e),r}}();Object.defineProperty(vM,"__esModule",{value:!0});vM.DatasetsGetUsageResponse=void 0;var nQe=wGn(se());vM.DatasetsGetUsageResponse=nQe.serialization.object({organizationUsage:nQe.serialization.property("organization_usage",nQe.serialization.number().optional())})});var wlr=S(wM=>{"use strict";var SGn=wM&&wM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CGn=wM&&wM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xGn=wM&&wM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SGn(r,e,n[o]);return CGn(r,e),r}}();Object.defineProperty(wM,"__esModule",{value:!0});wM.DatasetsGetResponse=void 0;var TGn=xGn(se()),OGn=cxe();wM.DatasetsGetResponse=TGn.serialization.object({dataset:OGn.Dataset})});var oQe=S(SM=>{"use strict";var EGn=SM&&SM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dxe=SM&&SM.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EGn(e,t,r)};Object.defineProperty(SM,"__esModule",{value:!0});dxe(ylr(),SM);dxe(_lr(),SM);dxe(vlr(),SM);dxe(wlr(),SM)});var Slr=S(CM=>{"use strict";var PGn=CM&&CM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MGn=CM&&CM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RGn=CM&&CM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PGn(r,e,n[o]);return MGn(r,e),r}}();Object.defineProperty(CM,"__esModule",{value:!0});CM.Response=void 0;var iQe=RGn(se());CM.Response=iQe.serialization.record(iQe.serialization.string(),iQe.serialization.unknown())});var Clr=S(xM=>{"use strict";var IGn=xM&&xM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AGn=xM&&xM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NGn=xM&&xM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IGn(r,e,n[o]);return AGn(r,e),r}}();Object.defineProperty(xM,"__esModule",{value:!0});xM.delete=void 0;xM.delete=NGn(Slr())});var Tlr=S(jk=>{"use strict";var DGn=jk&&jk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xlr=jk&&jk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DGn(e,t,r)};Object.defineProperty(jk,"__esModule",{value:!0});xlr(oQe(),jk);xlr(Clr(),jk)});var aQe=S(TM=>{"use strict";var jGn=TM&&TM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=TM&&TM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LGn=TM&&TM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jGn(r,e,n[o]);return $Gn(r,e),r}}();Object.defineProperty(TM,"__esModule",{value:!0});TM.BaseType=void 0;var FGn=LGn(se());TM.BaseType=FGn.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var sQe=S(OM=>{"use strict";var kGn=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]}),qGn=OM&&OM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UGn=OM&&OM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kGn(r,e,n[o]);return qGn(r,e),r}}();Object.defineProperty(OM,"__esModule",{value:!0});OM.Strategy=void 0;var BGn=UGn(se());OM.Strategy=BGn.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var uQe=S(EM=>{"use strict";var zGn=EM&&EM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VGn=EM&&EM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HGn=EM&&EM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zGn(r,e,n[o]);return VGn(r,e),r}}();Object.defineProperty(EM,"__esModule",{value:!0});EM.BaseModel=void 0;var fxe=HGn(se()),WGn=aQe(),JGn=sQe();EM.BaseModel=fxe.serialization.object({name:fxe.serialization.string().optional(),version:fxe.serialization.string().optional(),baseType:fxe.serialization.property("base_type",WGn.BaseType),strategy:JGn.Strategy.optional()})});var lQe=S(PM=>{"use strict";var KGn=PM&&PM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GGn=PM&&PM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XGn=PM&&PM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KGn(r,e,n[o]);return GGn(r,e),r}}();Object.defineProperty(PM,"__esModule",{value:!0});PM.LoraTargetModules=void 0;var ZGn=XGn(se());PM.LoraTargetModules=ZGn.serialization.enum_(["LORA_TARGET_MODULES_UNSPECIFIED","LORA_TARGET_MODULES_QV","LORA_TARGET_MODULES_QKVO","LORA_TARGET_MODULES_QKVO_FFN"])});var cQe=S(MM=>{"use strict";var YGn=MM&&MM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QGn=MM&&MM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e9n=MM&&MM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&YGn(r,e,n[o]);return QGn(r,e),r}}();Object.defineProperty(MM,"__esModule",{value:!0});MM.Hyperparameters=void 0;var eb=e9n(se()),t9n=lQe();MM.Hyperparameters=eb.serialization.object({earlyStoppingPatience:eb.serialization.property("early_stopping_patience",eb.serialization.number().optional()),earlyStoppingThreshold:eb.serialization.property("early_stopping_threshold",eb.serialization.number().optional()),trainBatchSize:eb.serialization.property("train_batch_size",eb.serialization.number().optional()),trainEpochs:eb.serialization.property("train_epochs",eb.serialization.number().optional()),learningRate:eb.serialization.property("learning_rate",eb.serialization.number().optional()),loraAlpha:eb.serialization.property("lora_alpha",eb.serialization.number().optional()),loraRank:eb.serialization.property("lora_rank",eb.serialization.number().optional()),loraTargetModules:eb.serialization.property("lora_target_modules",t9n.LoraTargetModules.optional())})});var dQe=S(RM=>{"use strict";var r9n=RM&&RM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n9n=RM&&RM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o9n=RM&&RM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r9n(r,e,n[o]);return n9n(r,e),r}}();Object.defineProperty(RM,"__esModule",{value:!0});RM.WandbConfig=void 0;var Goe=o9n(se());RM.WandbConfig=Goe.serialization.object({project:Goe.serialization.string(),apiKey:Goe.serialization.property("api_key",Goe.serialization.string()),entity:Goe.serialization.string().optional()})});var pxe=S(IM=>{"use strict";var i9n=IM&&IM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a9n=IM&&IM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s9n=IM&&IM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i9n(r,e,n[o]);return a9n(r,e),r}}();Object.defineProperty(IM,"__esModule",{value:!0});IM.Settings=void 0;var m8=s9n(se()),u9n=uQe(),l9n=cQe(),c9n=dQe();IM.Settings=m8.serialization.object({baseModel:m8.serialization.property("base_model",u9n.BaseModel),datasetId:m8.serialization.property("dataset_id",m8.serialization.string()),hyperparameters:l9n.Hyperparameters.optional(),multiLabel:m8.serialization.property("multi_label",m8.serialization.boolean().optional()),wandb:c9n.WandbConfig.optional()})});var Xoe=S(AM=>{"use strict";var d9n=AM&&AM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f9n=AM&&AM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p9n=AM&&AM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d9n(r,e,n[o]);return f9n(r,e),r}}();Object.defineProperty(AM,"__esModule",{value:!0});AM.Status=void 0;var m9n=p9n(se());AM.Status=m9n.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var h8=S(NM=>{"use strict";var h9n=NM&&NM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g9n=NM&&NM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y9n=NM&&NM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&h9n(r,e,n[o]);return g9n(r,e),r}}();Object.defineProperty(NM,"__esModule",{value:!0});NM.FinetunedModel=void 0;var t_=y9n(se()),b9n=pxe(),_9n=Xoe();NM.FinetunedModel=t_.serialization.object({id:t_.serialization.string().optional(),name:t_.serialization.string(),creatorId:t_.serialization.property("creator_id",t_.serialization.string().optional()),organizationId:t_.serialization.property("organization_id",t_.serialization.string().optional()),settings:b9n.Settings,status:_9n.Status.optional(),createdAt:t_.serialization.property("created_at",t_.serialization.date().optional()),updatedAt:t_.serialization.property("updated_at",t_.serialization.date().optional()),completedAt:t_.serialization.property("completed_at",t_.serialization.date().optional()),lastUsed:t_.serialization.property("last_used",t_.serialization.date().optional())})});var Olr=S(DM=>{"use strict";var v9n=DM&&DM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w9n=DM&&DM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S9n=DM&&DM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v9n(r,e,n[o]);return w9n(r,e),r}}();Object.defineProperty(DM,"__esModule",{value:!0});DM.ListFinetunedModelsResponse=void 0;var iV=S9n(se()),C9n=h8();DM.ListFinetunedModelsResponse=iV.serialization.object({finetunedModels:iV.serialization.property("finetuned_models",iV.serialization.list(C9n.FinetunedModel).optional()),nextPageToken:iV.serialization.property("next_page_token",iV.serialization.string().optional()),totalSize:iV.serialization.property("total_size",iV.serialization.number().optional())})});var Plr=S(jM=>{"use strict";var x9n=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]}),T9n=jM&&jM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O9n=jM&&jM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x9n(r,e,n[o]);return T9n(r,e),r}}();Object.defineProperty(jM,"__esModule",{value:!0});jM.CreateFinetunedModelResponse=void 0;var Elr=O9n(se()),E9n=h8();jM.CreateFinetunedModelResponse=Elr.serialization.object({finetunedModel:Elr.serialization.property("finetuned_model",E9n.FinetunedModel.optional())})});var Rlr=S($M=>{"use strict";var P9n=$M&&$M.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9n=$M&&$M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R9n=$M&&$M.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P9n(r,e,n[o]);return M9n(r,e),r}}();Object.defineProperty($M,"__esModule",{value:!0});$M.GetFinetunedModelResponse=void 0;var Mlr=R9n(se()),I9n=h8();$M.GetFinetunedModelResponse=Mlr.serialization.object({finetunedModel:Mlr.serialization.property("finetuned_model",I9n.FinetunedModel.optional())})});var Ilr=S(LM=>{"use strict";var A9n=LM&&LM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N9n=LM&&LM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D9n=LM&&LM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A9n(r,e,n[o]);return N9n(r,e),r}}();Object.defineProperty(LM,"__esModule",{value:!0});LM.DeleteFinetunedModelResponse=void 0;var fQe=D9n(se());LM.DeleteFinetunedModelResponse=fQe.serialization.record(fQe.serialization.string(),fQe.serialization.unknown())});var Nlr=S(FM=>{"use strict";var j9n=FM&&FM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$9n=FM&&FM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L9n=FM&&FM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j9n(r,e,n[o]);return $9n(r,e),r}}();Object.defineProperty(FM,"__esModule",{value:!0});FM.UpdateFinetunedModelResponse=void 0;var Alr=L9n(se()),F9n=h8();FM.UpdateFinetunedModelResponse=Alr.serialization.object({finetunedModel:Alr.serialization.property("finetuned_model",F9n.FinetunedModel.optional())})});var pQe=S(kM=>{"use strict";var k9n=kM&&kM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q9n=kM&&kM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U9n=kM&&kM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k9n(r,e,n[o]);return q9n(r,e),r}}();Object.defineProperty(kM,"__esModule",{value:!0});kM.Event=void 0;var Zoe=U9n(se()),B9n=Xoe();kM.Event=Zoe.serialization.object({userId:Zoe.serialization.property("user_id",Zoe.serialization.string().optional()),status:B9n.Status.optional(),createdAt:Zoe.serialization.property("created_at",Zoe.serialization.date().optional())})});var Dlr=S(qM=>{"use strict";var z9n=qM&&qM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V9n=qM&&qM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H9n=qM&&qM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z9n(r,e,n[o]);return V9n(r,e),r}}();Object.defineProperty(qM,"__esModule",{value:!0});qM.ListEventsResponse=void 0;var g8=H9n(se()),W9n=pQe();qM.ListEventsResponse=g8.serialization.object({events:g8.serialization.list(W9n.Event).optional(),nextPageToken:g8.serialization.property("next_page_token",g8.serialization.string().optional()),totalSize:g8.serialization.property("total_size",g8.serialization.number().optional())})});var mQe=S(UM=>{"use strict";var J9n=UM&&UM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K9n=UM&&UM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G9n=UM&&UM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J9n(r,e,n[o]);return K9n(r,e),r}}();Object.defineProperty(UM,"__esModule",{value:!0});UM.TrainingStepMetrics=void 0;var $k=G9n(se());UM.TrainingStepMetrics=$k.serialization.object({createdAt:$k.serialization.property("created_at",$k.serialization.date().optional()),stepNumber:$k.serialization.property("step_number",$k.serialization.number().optional()),metrics:$k.serialization.record($k.serialization.string(),$k.serialization.number()).optional()})});var jlr=S(BM=>{"use strict";var X9n=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]}),Z9n=BM&&BM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y9n=BM&&BM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X9n(r,e,n[o]);return Z9n(r,e),r}}();Object.defineProperty(BM,"__esModule",{value:!0});BM.ListTrainingStepMetricsResponse=void 0;var Yoe=Y9n(se()),Q9n=mQe();BM.ListTrainingStepMetricsResponse=Yoe.serialization.object({stepMetrics:Yoe.serialization.property("step_metrics",Yoe.serialization.list(Q9n.TrainingStepMetrics).optional()),nextPageToken:Yoe.serialization.property("next_page_token",Yoe.serialization.string().optional())})});var hQe=S(Xl=>{"use strict";var e7n=Xl&&Xl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bh=Xl&&Xl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e7n(e,t,r)};Object.defineProperty(Xl,"__esModule",{value:!0});Bh(aQe(),Xl);Bh(sQe(),Xl);Bh(uQe(),Xl);Bh(lQe(),Xl);Bh(cQe(),Xl);Bh(dQe(),Xl);Bh(pxe(),Xl);Bh(Xoe(),Xl);Bh(h8(),Xl);Bh(Olr(),Xl);Bh(Plr(),Xl);Bh(Rlr(),Xl);Bh(Ilr(),Xl);Bh(Nlr(),Xl);Bh(pQe(),Xl);Bh(Dlr(),Xl);Bh(mQe(),Xl);Bh(jlr(),Xl)});var $lr=S(aV=>{"use strict";var t7n=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]}),r7n=aV&&aV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&t7n(e,t,r)};Object.defineProperty(aV,"__esModule",{value:!0});r7n(hQe(),aV)});var Flr=S(Pw=>{"use strict";var Llr=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]}),n7n=Pw&&Pw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o7n=Pw&&Pw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Llr(r,e,n[o]);return n7n(r,e),r}}(),i7n=Pw&&Pw.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Llr(e,t,r)};Object.defineProperty(Pw,"__esModule",{value:!0});Pw.finetuning=void 0;Pw.finetuning=o7n($lr());i7n(hQe(),Pw)});var qlr=S(zM=>{"use strict";var a7n=zM&&zM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),s7n=zM&&zM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u7n=zM&&zM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&a7n(r,e,n[o]);return s7n(r,e),r}}();Object.defineProperty(zM,"__esModule",{value:!0});zM.FinetuningUpdateFinetunedModelRequest=void 0;var klr=u7n(se()),l7n=pxe(),c7n=Xoe();zM.FinetuningUpdateFinetunedModelRequest=klr.serialization.object({name:klr.serialization.string(),settings:l7n.Settings,status:c7n.Status.optional()})});var gQe=S(mxe=>{"use strict";Object.defineProperty(mxe,"__esModule",{value:!0});mxe.FinetuningUpdateFinetunedModelRequest=void 0;var d7n=qlr();Object.defineProperty(mxe,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return d7n.FinetuningUpdateFinetunedModelRequest}})});var Ulr=S(sV=>{"use strict";var f7n=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]}),p7n=sV&&sV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f7n(e,t,r)};Object.defineProperty(sV,"__esModule",{value:!0});p7n(gQe(),sV)});var zlr=S(Lk=>{"use strict";var m7n=Lk&&Lk.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Blr=Lk&&Lk.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m7n(e,t,r)};Object.defineProperty(Lk,"__esModule",{value:!0});Blr(Flr(),Lk);Blr(Ulr(),Lk)});var hxe=S(HM=>{"use strict";var h7n=HM&&HM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g7n=HM&&HM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y7n=HM&&HM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&h7n(r,e,n[o]);return g7n(r,e),r}}();Object.defineProperty(HM,"__esModule",{value:!0});HM.CreateConnectorOAuth=void 0;var VM=y7n(se());HM.CreateConnectorOAuth=VM.serialization.object({clientId:VM.serialization.property("client_id",VM.serialization.string().optional()),clientSecret:VM.serialization.property("client_secret",VM.serialization.string().optional()),authorizeUrl:VM.serialization.property("authorize_url",VM.serialization.string().optional()),tokenUrl:VM.serialization.property("token_url",VM.serialization.string().optional()),scope:VM.serialization.string().optional()})});var yQe=S(WM=>{"use strict";var b7n=WM&&WM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_7n=WM&&WM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v7n=WM&&WM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b7n(r,e,n[o]);return _7n(r,e),r}}();Object.defineProperty(WM,"__esModule",{value:!0});WM.AuthTokenType=void 0;var w7n=v7n(se());WM.AuthTokenType=w7n.serialization.enum_(["bearer","basic","noscheme"])});var gxe=S(JM=>{"use strict";var S7n=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]}),C7n=JM&&JM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x7n=JM&&JM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S7n(r,e,n[o]);return C7n(r,e),r}}();Object.defineProperty(JM,"__esModule",{value:!0});JM.CreateConnectorServiceAuth=void 0;var Vlr=x7n(se()),T7n=yQe();JM.CreateConnectorServiceAuth=Vlr.serialization.object({type:T7n.AuthTokenType,token:Vlr.serialization.string()})});var Hlr=S(GM=>{"use strict";var O7n=GM&&GM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E7n=GM&&GM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P7n=GM&&GM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&O7n(r,e,n[o]);return E7n(r,e),r}}();Object.defineProperty(GM,"__esModule",{value:!0});GM.CreateConnectorRequest=void 0;var KM=P7n(se()),M7n=hxe(),R7n=gxe();GM.CreateConnectorRequest=KM.serialization.object({name:KM.serialization.string(),description:KM.serialization.string().optional(),url:KM.serialization.string(),excludes:KM.serialization.list(KM.serialization.string()).optional(),oauth:M7n.CreateConnectorOAuth.optional(),active:KM.serialization.boolean().optional(),continueOnFailure:KM.serialization.property("continue_on_failure",KM.serialization.boolean().optional()),serviceAuth:KM.serialization.property("service_auth",R7n.CreateConnectorServiceAuth.optional())})});var Wlr=S(XM=>{"use strict";var I7n=XM&&XM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),A7n=XM&&XM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N7n=XM&&XM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I7n(r,e,n[o]);return A7n(r,e),r}}();Object.defineProperty(XM,"__esModule",{value:!0});XM.UpdateConnectorRequest=void 0;var nD=N7n(se()),D7n=hxe(),j7n=gxe();XM.UpdateConnectorRequest=nD.serialization.object({name:nD.serialization.string().optional(),url:nD.serialization.string().optional(),excludes:nD.serialization.list(nD.serialization.string()).optional(),oauth:D7n.CreateConnectorOAuth.optional(),active:nD.serialization.boolean().optional(),continueOnFailure:nD.serialization.property("continue_on_failure",nD.serialization.boolean().optional()),serviceAuth:nD.serialization.property("service_auth",j7n.CreateConnectorServiceAuth.optional())})});var bQe=S(y8=>{"use strict";Object.defineProperty(y8,"__esModule",{value:!0});y8.UpdateConnectorRequest=y8.CreateConnectorRequest=void 0;var $7n=Hlr();Object.defineProperty(y8,"CreateConnectorRequest",{enumerable:!0,get:function(){return $7n.CreateConnectorRequest}});var L7n=Wlr();Object.defineProperty(y8,"UpdateConnectorRequest",{enumerable:!0,get:function(){return L7n.UpdateConnectorRequest}})});var Jlr=S(uV=>{"use strict";var F7n=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]}),k7n=uV&&uV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F7n(e,t,r)};Object.defineProperty(uV,"__esModule",{value:!0});k7n(bQe(),uV)});var Klr=S(lV=>{"use strict";var q7n=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]}),U7n=lV&&lV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&q7n(e,t,r)};Object.defineProperty(lV,"__esModule",{value:!0});U7n(Jlr(),lV)});var Xlr=S($u=>{"use strict";var Glr=$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]}),B7n=$u&&$u.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qoe=$u&&$u.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Glr(r,e,n[o]);return B7n(r,e),r}}(),cV=$u&&$u.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Glr(e,t,r)};Object.defineProperty($u,"__esModule",{value:!0});$u.connectors=$u.finetuning=$u.datasets=$u.embedJobs=$u.v2=void 0;$u.v2=Qoe(dlr());cV(gYe(),$u);$u.embedJobs=Qoe(hlr());cV(YYe(),$u);$u.datasets=Qoe(Tlr());cV(oQe(),$u);$u.finetuning=Qoe(zlr());cV(XYe(),$u);cV(QYe(),$u);$u.connectors=Qoe(Klr());cV(bQe(),$u);cV(gQe(),$u)});var _Qe=S(ZM=>{"use strict";var z7n=ZM&&ZM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V7n=ZM&&ZM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H7n=ZM&&ZM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z7n(r,e,n[o]);return V7n(r,e),r}}();Object.defineProperty(ZM,"__esModule",{value:!0});ZM.ChatStreamRequestPromptTruncation=void 0;var W7n=H7n(se());ZM.ChatStreamRequestPromptTruncation=W7n.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var vQe=S(YM=>{"use strict";var J7n=YM&&YM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K7n=YM&&YM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G7n=YM&&YM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J7n(r,e,n[o]);return K7n(r,e),r}}();Object.defineProperty(YM,"__esModule",{value:!0});YM.ChatStreamRequestCitationQuality=void 0;var X7n=G7n(se());YM.ChatStreamRequestCitationQuality=X7n.serialization.enum_(["fast","accurate","off"])});var wQe=S(QM=>{"use strict";var Z7n=QM&&QM.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y7n=QM&&QM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q7n=QM&&QM.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Z7n(r,e,n[o]);return Y7n(r,e),r}}();Object.defineProperty(QM,"__esModule",{value:!0});QM.ChatStreamRequestSafetyMode=void 0;var eXn=Q7n(se());QM.ChatStreamRequestSafetyMode=eXn.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var CQe=S(eR=>{"use strict";var tXn=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]}),rXn=eR&&eR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nXn=eR&&eR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tXn(r,e,n[o]);return rXn(r,e),r}}();Object.defineProperty(eR,"__esModule",{value:!0});eR.ChatStreamStartEvent=void 0;var SQe=nXn(se()),oXn=xx();eR.ChatStreamStartEvent=SQe.serialization.object({generationId:SQe.serialization.property("generation_id",SQe.serialization.string())}).extend(oXn.ChatStreamEvent)});var eie=S(tR=>{"use strict";var iXn=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]}),aXn=tR&&tR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sXn=tR&&tR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iXn(r,e,n[o]);return aXn(r,e),r}}();Object.defineProperty(tR,"__esModule",{value:!0});tR.ChatSearchQuery=void 0;var yxe=sXn(se());tR.ChatSearchQuery=yxe.serialization.object({text:yxe.serialization.string(),generationId:yxe.serialization.property("generation_id",yxe.serialization.string())})});var TQe=S(rR=>{"use strict";var uXn=rR&&rR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lXn=rR&&rR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cXn=rR&&rR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uXn(r,e,n[o]);return lXn(r,e),r}}();Object.defineProperty(rR,"__esModule",{value:!0});rR.ChatSearchQueriesGenerationEvent=void 0;var xQe=cXn(se()),dXn=eie(),fXn=xx();rR.ChatSearchQueriesGenerationEvent=xQe.serialization.object({searchQueries:xQe.serialization.property("search_queries",xQe.serialization.list(dXn.ChatSearchQuery))}).extend(fXn.ChatStreamEvent)});var OQe=S(nR=>{"use strict";var pXn=nR&&nR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mXn=nR&&nR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hXn=nR&&nR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pXn(r,e,n[o]);return mXn(r,e),r}}();Object.defineProperty(nR,"__esModule",{value:!0});nR.ChatSearchResultConnector=void 0;var Zlr=hXn(se());nR.ChatSearchResultConnector=Zlr.serialization.object({id:Zlr.serialization.string()})});var bxe=S(oR=>{"use strict";var gXn=oR&&oR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yXn=oR&&oR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bXn=oR&&oR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gXn(r,e,n[o]);return yXn(r,e),r}}();Object.defineProperty(oR,"__esModule",{value:!0});oR.ChatSearchResult=void 0;var oD=bXn(se()),_Xn=eie(),vXn=OQe();oR.ChatSearchResult=oD.serialization.object({searchQuery:oD.serialization.property("search_query",_Xn.ChatSearchQuery.optional()),connector:vXn.ChatSearchResultConnector,documentIds:oD.serialization.property("document_ids",oD.serialization.list(oD.serialization.string())),errorMessage:oD.serialization.property("error_message",oD.serialization.string().optional()),continueOnFailure:oD.serialization.property("continue_on_failure",oD.serialization.boolean().optional())})});var b8=S(iR=>{"use strict";var wXn=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]}),SXn=iR&&iR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CXn=iR&&iR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wXn(r,e,n[o]);return SXn(r,e),r}}();Object.defineProperty(iR,"__esModule",{value:!0});iR.ChatDocument=void 0;var EQe=CXn(se());iR.ChatDocument=EQe.serialization.record(EQe.serialization.string(),EQe.serialization.string())});var PQe=S(aR=>{"use strict";var xXn=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]}),TXn=aR&&aR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OXn=aR&&aR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xXn(r,e,n[o]);return TXn(r,e),r}}();Object.defineProperty(aR,"__esModule",{value:!0});aR.ChatSearchResultsEvent=void 0;var _xe=OXn(se()),EXn=bxe(),PXn=b8(),MXn=xx();aR.ChatSearchResultsEvent=_xe.serialization.object({searchResults:_xe.serialization.property("search_results",_xe.serialization.list(EXn.ChatSearchResult).optional()),documents:_xe.serialization.list(PXn.ChatDocument).optional()}).extend(MXn.ChatStreamEvent)});var MQe=S(sR=>{"use strict";var RXn=sR&&sR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IXn=sR&&sR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AXn=sR&&sR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RXn(r,e,n[o]);return IXn(r,e),r}}();Object.defineProperty(sR,"__esModule",{value:!0});sR.ChatTextGenerationEvent=void 0;var Ylr=AXn(se()),NXn=xx();sR.ChatTextGenerationEvent=Ylr.serialization.object({text:Ylr.serialization.string()}).extend(NXn.ChatStreamEvent)});var RQe=S(uR=>{"use strict";var DXn=uR&&uR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jXn=uR&&uR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Xn=uR&&uR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DXn(r,e,n[o]);return jXn(r,e),r}}();Object.defineProperty(uR,"__esModule",{value:!0});uR.ChatCitationType=void 0;var LXn=$Xn(se());uR.ChatCitationType=LXn.serialization.enum_(["TEXT_CONTENT","PLAN"])});var vxe=S(lR=>{"use strict";var FXn=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]}),kXn=lR&&lR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qXn=lR&&lR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FXn(r,e,n[o]);return kXn(r,e),r}}();Object.defineProperty(lR,"__esModule",{value:!0});lR.ChatCitation=void 0;var dV=qXn(se()),UXn=RQe();lR.ChatCitation=dV.serialization.object({start:dV.serialization.number(),end:dV.serialization.number(),text:dV.serialization.string(),documentIds:dV.serialization.property("document_ids",dV.serialization.list(dV.serialization.string())),type:UXn.ChatCitationType.optional()})});var IQe=S(cR=>{"use strict";var BXn=cR&&cR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zXn=cR&&cR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VXn=cR&&cR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BXn(r,e,n[o]);return zXn(r,e),r}}();Object.defineProperty(cR,"__esModule",{value:!0});cR.ChatCitationGenerationEvent=void 0;var Qlr=VXn(se()),HXn=vxe(),WXn=xx();cR.ChatCitationGenerationEvent=Qlr.serialization.object({citations:Qlr.serialization.list(HXn.ChatCitation)}).extend(WXn.ChatStreamEvent)});var _8=S(dR=>{"use strict";var JXn=dR&&dR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KXn=dR&&dR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GXn=dR&&dR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JXn(r,e,n[o]);return KXn(r,e),r}}();Object.defineProperty(dR,"__esModule",{value:!0});dR.ToolCall=void 0;var tie=GXn(se());dR.ToolCall=tie.serialization.object({name:tie.serialization.string(),parameters:tie.serialization.record(tie.serialization.string(),tie.serialization.unknown())})});var AQe=S(fR=>{"use strict";var XXn=fR&&fR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZXn=fR&&fR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YXn=fR&&fR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XXn(r,e,n[o]);return ZXn(r,e),r}}();Object.defineProperty(fR,"__esModule",{value:!0});fR.ChatToolCallsGenerationEvent=void 0;var wxe=YXn(se()),QXn=_8(),eZn=xx();fR.ChatToolCallsGenerationEvent=wxe.serialization.object({text:wxe.serialization.string().optional(),toolCalls:wxe.serialization.property("tool_calls",wxe.serialization.list(QXn.ToolCall))}).extend(eZn.ChatStreamEvent)});var NQe=S(pR=>{"use strict";var tZn=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]}),rZn=pR&&pR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nZn=pR&&pR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tZn(r,e,n[o]);return rZn(r,e),r}}();Object.defineProperty(pR,"__esModule",{value:!0});pR.ChatStreamEndEventFinishReason=void 0;var oZn=nZn(se());pR.ChatStreamEndEventFinishReason=oZn.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var v8=S(mR=>{"use strict";var iZn=mR&&mR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aZn=mR&&mR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sZn=mR&&mR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iZn(r,e,n[o]);return aZn(r,e),r}}();Object.defineProperty(mR,"__esModule",{value:!0});mR.FinishReason=void 0;var uZn=sZn(se());mR.FinishReason=uZn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var DQe=S(hR=>{"use strict";var lZn=hR&&hR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cZn=hR&&hR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dZn=hR&&hR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lZn(r,e,n[o]);return cZn(r,e),r}}();Object.defineProperty(hR,"__esModule",{value:!0});hR.ChatMessage=void 0;var Sxe=dZn(se()),fZn=_8();hR.ChatMessage=Sxe.serialization.object({message:Sxe.serialization.string(),toolCalls:Sxe.serialization.property("tool_calls",Sxe.serialization.list(fZn.ToolCall).optional())})});var nie=S(gR=>{"use strict";var pZn=gR&&gR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mZn=gR&&gR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hZn=gR&&gR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pZn(r,e,n[o]);return mZn(r,e),r}}();Object.defineProperty(gR,"__esModule",{value:!0});gR.ToolResult=void 0;var rie=hZn(se()),gZn=_8();gR.ToolResult=rie.serialization.object({call:gZn.ToolCall,outputs:rie.serialization.list(rie.serialization.record(rie.serialization.string(),rie.serialization.unknown()))})});var $Qe=S(yR=>{"use strict";var yZn=yR&&yR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZn=yR&&yR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Zn=yR&&yR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yZn(r,e,n[o]);return bZn(r,e),r}}();Object.defineProperty(yR,"__esModule",{value:!0});yR.ChatToolMessage=void 0;var jQe=_Zn(se()),vZn=nie();yR.ChatToolMessage=jQe.serialization.object({toolResults:jQe.serialization.property("tool_results",jQe.serialization.list(vZn.ToolResult).optional())})});var oie=S(bR=>{"use strict";var wZn=bR&&bR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SZn=bR&&bR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CZn=bR&&bR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wZn(r,e,n[o]);return SZn(r,e),r}}();Object.defineProperty(bR,"__esModule",{value:!0});bR.Message=void 0;var xZn=CZn(se()),LQe=DQe(),TZn=$Qe();bR.Message=xZn.serialization.union("role",{CHATBOT:LQe.ChatMessage,SYSTEM:LQe.ChatMessage,USER:LQe.ChatMessage,TOOL:TZn.ChatToolMessage}).transform({transform:t=>t,untransform:t=>t})});var FQe=S(_R=>{"use strict";var OZn=_R&&_R.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EZn=_R&&_R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PZn=_R&&_R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OZn(r,e,n[o]);return EZn(r,e),r}}();Object.defineProperty(_R,"__esModule",{value:!0});_R.NonStreamedChatResponse=void 0;var Um=PZn(se()),MZn=vxe(),RZn=b8(),IZn=eie(),AZn=bxe(),NZn=v8(),DZn=_8(),jZn=oie(),$Zn=Q_();_R.NonStreamedChatResponse=Um.serialization.object({text:Um.serialization.string(),generationId:Um.serialization.property("generation_id",Um.serialization.string().optional()),responseId:Um.serialization.property("response_id",Um.serialization.string().optional()),citations:Um.serialization.list(MZn.ChatCitation).optional(),documents:Um.serialization.list(RZn.ChatDocument).optional(),isSearchRequired:Um.serialization.property("is_search_required",Um.serialization.boolean().optional()),searchQueries:Um.serialization.property("search_queries",Um.serialization.list(IZn.ChatSearchQuery).optional()),searchResults:Um.serialization.property("search_results",Um.serialization.list(AZn.ChatSearchResult).optional()),finishReason:Um.serialization.property("finish_reason",NZn.FinishReason.optional()),toolCalls:Um.serialization.property("tool_calls",Um.serialization.list(DZn.ToolCall).optional()),chatHistory:Um.serialization.property("chat_history",Um.serialization.list(jZn.Message).optional()),meta:$Zn.ApiMeta.optional()})});var kQe=S(vR=>{"use strict";var LZn=vR&&vR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FZn=vR&&vR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kZn=vR&&vR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LZn(r,e,n[o]);return FZn(r,e),r}}();Object.defineProperty(vR,"__esModule",{value:!0});vR.ChatStreamEndEvent=void 0;var ecr=kZn(se()),qZn=NQe(),UZn=FQe(),BZn=xx();vR.ChatStreamEndEvent=ecr.serialization.object({finishReason:ecr.serialization.property("finish_reason",qZn.ChatStreamEndEventFinishReason),response:UZn.NonStreamedChatResponse}).extend(BZn.ChatStreamEvent)});var qQe=S(wR=>{"use strict";var zZn=wR&&wR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VZn=wR&&wR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HZn=wR&&wR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zZn(r,e,n[o]);return VZn(r,e),r}}();Object.defineProperty(wR,"__esModule",{value:!0});wR.ToolCallDelta=void 0;var iie=HZn(se());wR.ToolCallDelta=iie.serialization.object({name:iie.serialization.string().optional(),index:iie.serialization.number().optional(),parameters:iie.serialization.string().optional(),text:iie.serialization.string().optional()})});var BQe=S(SR=>{"use strict";var WZn=SR&&SR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),JZn=SR&&SR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KZn=SR&&SR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WZn(r,e,n[o]);return JZn(r,e),r}}();Object.defineProperty(SR,"__esModule",{value:!0});SR.ChatToolCallsChunkEvent=void 0;var UQe=KZn(se()),GZn=qQe(),XZn=xx();SR.ChatToolCallsChunkEvent=UQe.serialization.object({toolCallDelta:UQe.serialization.property("tool_call_delta",GZn.ToolCallDelta),text:UQe.serialization.string().optional()}).extend(XZn.ChatStreamEvent)});var rcr=S(CR=>{"use strict";var ZZn=CR&&CR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YZn=CR&&CR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QZn=CR&&CR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZZn(r,e,n[o]);return YZn(r,e),r}}();Object.defineProperty(CR,"__esModule",{value:!0});CR.StreamedChatResponse=void 0;var tcr=QZn(se()),eYn=CQe(),tYn=TQe(),rYn=PQe(),nYn=MQe(),oYn=IQe(),iYn=AQe(),aYn=kQe(),sYn=BQe(),uYn=exe();CR.StreamedChatResponse=tcr.serialization.union(tcr.serialization.discriminant("eventType","event_type"),{"stream-start":eYn.ChatStreamStartEvent,"search-queries-generation":tYn.ChatSearchQueriesGenerationEvent,"search-results":rYn.ChatSearchResultsEvent,"text-generation":nYn.ChatTextGenerationEvent,"citation-generation":oYn.ChatCitationGenerationEvent,"tool-calls-generation":iYn.ChatToolCallsGenerationEvent,"stream-end":aYn.ChatStreamEndEvent,"tool-calls-chunk":sYn.ChatToolCallsChunkEvent,debug:uYn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var zQe=S(xR=>{"use strict";var lYn=xR&&xR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cYn=xR&&xR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dYn=xR&&xR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lYn(r,e,n[o]);return cYn(r,e),r}}();Object.defineProperty(xR,"__esModule",{value:!0});xR.ChatRequestPromptTruncation=void 0;var fYn=dYn(se());xR.ChatRequestPromptTruncation=fYn.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var VQe=S(TR=>{"use strict";var pYn=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]}),mYn=TR&&TR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hYn=TR&&TR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pYn(r,e,n[o]);return mYn(r,e),r}}();Object.defineProperty(TR,"__esModule",{value:!0});TR.ChatRequestCitationQuality=void 0;var gYn=hYn(se());TR.ChatRequestCitationQuality=gYn.serialization.enum_(["fast","accurate","off"])});var HQe=S(OR=>{"use strict";var yYn=OR&&OR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bYn=OR&&OR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Yn=OR&&OR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yYn(r,e,n[o]);return bYn(r,e),r}}();Object.defineProperty(OR,"__esModule",{value:!0});OR.ChatRequestSafetyMode=void 0;var vYn=_Yn(se());OR.ChatRequestSafetyMode=vYn.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var WQe=S(ER=>{"use strict";var wYn=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]}),SYn=ER&&ER.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CYn=ER&&ER.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wYn(r,e,n[o]);return SYn(r,e),r}}();Object.defineProperty(ER,"__esModule",{value:!0});ER.GenerateStreamRequestTruncate=void 0;var xYn=CYn(se());ER.GenerateStreamRequestTruncate=xYn.serialization.enum_(["NONE","START","END"])});var JQe=S(PR=>{"use strict";var TYn=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]}),OYn=PR&&PR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EYn=PR&&PR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TYn(r,e,n[o]);return OYn(r,e),r}}();Object.defineProperty(PR,"__esModule",{value:!0});PR.GenerateStreamRequestReturnLikelihoods=void 0;var PYn=EYn(se());PR.GenerateStreamRequestReturnLikelihoods=PYn.serialization.enum_(["GENERATION","ALL","NONE"])});var aie=S(MR=>{"use strict";var MYn=MR&&MR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RYn=MR&&MR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IYn=MR&&MR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MYn(r,e,n[o]);return RYn(r,e),r}}();Object.defineProperty(MR,"__esModule",{value:!0});MR.GenerateStreamEvent=void 0;var AYn=IYn(se());MR.GenerateStreamEvent=AYn.serialization.object({})});var KQe=S(RR=>{"use strict";var NYn=RR&&RR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DYn=RR&&RR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jYn=RR&&RR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NYn(r,e,n[o]);return DYn(r,e),r}}();Object.defineProperty(RR,"__esModule",{value:!0});RR.GenerateStreamText=void 0;var sie=jYn(se()),$Yn=aie();RR.GenerateStreamText=sie.serialization.object({text:sie.serialization.string(),index:sie.serialization.number().optional(),isFinished:sie.serialization.property("is_finished",sie.serialization.boolean())}).extend($Yn.GenerateStreamEvent)});var GQe=S(IR=>{"use strict";var LYn=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]}),FYn=IR&&IR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kYn=IR&&IR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LYn(r,e,n[o]);return FYn(r,e),r}}();Object.defineProperty(IR,"__esModule",{value:!0});IR.SingleGenerationInStream=void 0;var uie=kYn(se()),qYn=v8();IR.SingleGenerationInStream=uie.serialization.object({id:uie.serialization.string(),text:uie.serialization.string(),index:uie.serialization.number().optional(),finishReason:uie.serialization.property("finish_reason",qYn.FinishReason)})});var XQe=S(AR=>{"use strict";var UYn=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]}),BYn=AR&&AR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zYn=AR&&AR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UYn(r,e,n[o]);return BYn(r,e),r}}();Object.defineProperty(AR,"__esModule",{value:!0});AR.GenerateStreamEndResponse=void 0;var Cxe=zYn(se()),VYn=GQe();AR.GenerateStreamEndResponse=Cxe.serialization.object({id:Cxe.serialization.string(),prompt:Cxe.serialization.string().optional(),generations:Cxe.serialization.list(VYn.SingleGenerationInStream).optional()})});var ZQe=S(NR=>{"use strict";var HYn=NR&&NR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WYn=NR&&NR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JYn=NR&&NR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HYn(r,e,n[o]);return WYn(r,e),r}}();Object.defineProperty(NR,"__esModule",{value:!0});NR.GenerateStreamEnd=void 0;var xxe=JYn(se()),KYn=v8(),GYn=XQe(),XYn=aie();NR.GenerateStreamEnd=xxe.serialization.object({isFinished:xxe.serialization.property("is_finished",xxe.serialization.boolean()),finishReason:xxe.serialization.property("finish_reason",KYn.FinishReason.optional()),response:GYn.GenerateStreamEndResponse}).extend(XYn.GenerateStreamEvent)});var YQe=S(DR=>{"use strict";var ZYn=DR&&DR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YYn=DR&&DR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QYn=DR&&DR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZYn(r,e,n[o]);return YYn(r,e),r}}();Object.defineProperty(DR,"__esModule",{value:!0});DR.GenerateStreamError=void 0;var w8=QYn(se()),eQn=v8(),tQn=aie();DR.GenerateStreamError=w8.serialization.object({index:w8.serialization.number().optional(),isFinished:w8.serialization.property("is_finished",w8.serialization.boolean()),finishReason:w8.serialization.property("finish_reason",eQn.FinishReason),err:w8.serialization.string()}).extend(tQn.GenerateStreamEvent)});var ocr=S(jR=>{"use strict";var rQn=jR&&jR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nQn=jR&&jR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oQn=jR&&jR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rQn(r,e,n[o]);return nQn(r,e),r}}();Object.defineProperty(jR,"__esModule",{value:!0});jR.GenerateStreamedResponse=void 0;var ncr=oQn(se()),iQn=KQe(),aQn=ZQe(),sQn=YQe();jR.GenerateStreamedResponse=ncr.serialization.union(ncr.serialization.discriminant("eventType","event_type"),{"text-generation":iQn.GenerateStreamText,"stream-end":aQn.GenerateStreamEnd,"stream-error":sQn.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var QQe=S($R=>{"use strict";var uQn=$R&&$R.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lQn=$R&&$R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cQn=$R&&$R.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uQn(r,e,n[o]);return lQn(r,e),r}}();Object.defineProperty($R,"__esModule",{value:!0});$R.GenerateRequestTruncate=void 0;var dQn=cQn(se());$R.GenerateRequestTruncate=dQn.serialization.enum_(["NONE","START","END"])});var eet=S(LR=>{"use strict";var fQn=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]}),pQn=LR&&LR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mQn=LR&&LR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fQn(r,e,n[o]);return pQn(r,e),r}}();Object.defineProperty(LR,"__esModule",{value:!0});LR.GenerateRequestReturnLikelihoods=void 0;var hQn=mQn(se());LR.GenerateRequestReturnLikelihoods=hQn.serialization.enum_(["GENERATION","ALL","NONE"])});var ret=S(FR=>{"use strict";var gQn=FR&&FR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yQn=FR&&FR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bQn=FR&&FR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gQn(r,e,n[o]);return yQn(r,e),r}}();Object.defineProperty(FR,"__esModule",{value:!0});FR.SingleGenerationTokenLikelihoodsItem=void 0;var tet=bQn(se());FR.SingleGenerationTokenLikelihoodsItem=tet.serialization.object({token:tet.serialization.string(),likelihood:tet.serialization.number()})});var net=S(kR=>{"use strict";var _Qn=kR&&kR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vQn=kR&&kR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wQn=kR&&kR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Qn(r,e,n[o]);return vQn(r,e),r}}();Object.defineProperty(kR,"__esModule",{value:!0});kR.SingleGeneration=void 0;var fV=wQn(se()),SQn=ret();kR.SingleGeneration=fV.serialization.object({id:fV.serialization.string(),text:fV.serialization.string(),index:fV.serialization.number().optional(),likelihood:fV.serialization.number().optional(),tokenLikelihoods:fV.serialization.property("token_likelihoods",fV.serialization.list(SQn.SingleGenerationTokenLikelihoodsItem).optional())})});var icr=S(qR=>{"use strict";var CQn=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]}),xQn=qR&&qR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TQn=qR&&qR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CQn(r,e,n[o]);return xQn(r,e),r}}();Object.defineProperty(qR,"__esModule",{value:!0});qR.Generation=void 0;var Txe=TQn(se()),OQn=net(),EQn=Q_();qR.Generation=Txe.serialization.object({id:Txe.serialization.string(),prompt:Txe.serialization.string().optional(),generations:Txe.serialization.list(OQn.SingleGeneration),meta:EQn.ApiMeta.optional()})});var oet=S(UR=>{"use strict";var PQn=UR&&UR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MQn=UR&&UR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RQn=UR&&UR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PQn(r,e,n[o]);return MQn(r,e),r}}();Object.defineProperty(UR,"__esModule",{value:!0});UR.EmbedRequestTruncate=void 0;var IQn=RQn(se());UR.EmbedRequestTruncate=IQn.serialization.enum_(["NONE","START","END"])});var Oxe=S(BR=>{"use strict";var AQn=BR&&BR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NQn=BR&&BR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DQn=BR&&BR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&AQn(r,e,n[o]);return NQn(r,e),r}}();Object.defineProperty(BR,"__esModule",{value:!0});BR.Image=void 0;var S8=DQn(se());BR.Image=S8.serialization.object({width:S8.serialization.number(),height:S8.serialization.number(),format:S8.serialization.string(),bitDepth:S8.serialization.property("bit_depth",S8.serialization.number())})});var iet=S(zR=>{"use strict";var jQn=zR&&zR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Qn=zR&&zR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LQn=zR&&zR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jQn(r,e,n[o]);return $Qn(r,e),r}}();Object.defineProperty(zR,"__esModule",{value:!0});zR.EmbedFloatsResponse=void 0;var Fk=LQn(se()),FQn=Oxe(),kQn=Q_();zR.EmbedFloatsResponse=Fk.serialization.object({id:Fk.serialization.string(),embeddings:Fk.serialization.list(Fk.serialization.list(Fk.serialization.number())),texts:Fk.serialization.list(Fk.serialization.string()),images:Fk.serialization.list(FQn.Image).optional(),meta:kQn.ApiMeta.optional()})});var aet=S(VR=>{"use strict";var qQn=VR&&VR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UQn=VR&&VR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BQn=VR&&VR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qQn(r,e,n[o]);return UQn(r,e),r}}();Object.defineProperty(VR,"__esModule",{value:!0});VR.EmbedByTypeResponseEmbeddings=void 0;var zh=BQn(se());VR.EmbedByTypeResponseEmbeddings=zh.serialization.object({float:zh.serialization.list(zh.serialization.list(zh.serialization.number())).optional(),int8:zh.serialization.list(zh.serialization.list(zh.serialization.number())).optional(),uint8:zh.serialization.list(zh.serialization.list(zh.serialization.number())).optional(),binary:zh.serialization.list(zh.serialization.list(zh.serialization.number())).optional(),ubinary:zh.serialization.list(zh.serialization.list(zh.serialization.number())).optional(),base64:zh.serialization.list(zh.serialization.string()).optional()})});var set=S(HR=>{"use strict";var zQn=HR&&HR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VQn=HR&&HR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HQn=HR&&HR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zQn(r,e,n[o]);return VQn(r,e),r}}();Object.defineProperty(HR,"__esModule",{value:!0});HR.EmbedByTypeResponse=void 0;var lie=HQn(se()),WQn=aet(),JQn=Oxe(),KQn=Q_();HR.EmbedByTypeResponse=lie.serialization.object({id:lie.serialization.string(),embeddings:WQn.EmbedByTypeResponseEmbeddings,texts:lie.serialization.list(lie.serialization.string()).optional(),images:lie.serialization.list(JQn.Image).optional(),meta:KQn.ApiMeta.optional()})});var scr=S(WR=>{"use strict";var GQn=WR&&WR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XQn=WR&&WR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZQn=WR&&WR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GQn(r,e,n[o]);return XQn(r,e),r}}();Object.defineProperty(WR,"__esModule",{value:!0});WR.EmbedResponse=void 0;var acr=ZQn(se()),YQn=iet(),QQn=set();WR.EmbedResponse=acr.serialization.union(acr.serialization.discriminant("responseType","response_type"),{embeddings_floats:YQn.EmbedFloatsResponse,embeddings_by_type:QQn.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var cet=S(JR=>{"use strict";var eeo=JR&&JR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),teo=JR&&JR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),reo=JR&&JR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eeo(r,e,n[o]);return teo(r,e),r}}();Object.defineProperty(JR,"__esModule",{value:!0});JR.RerankDocument=void 0;var uet=reo(se());JR.RerankDocument=uet.serialization.record(uet.serialization.string(),uet.serialization.string())});var det=S(KR=>{"use strict";var neo=KR&&KR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oeo=KR&&KR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ieo=KR&&KR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&neo(r,e,n[o]);return oeo(r,e),r}}();Object.defineProperty(KR,"__esModule",{value:!0});KR.RerankRequestDocumentsItem=void 0;var ucr=ieo(se()),aeo=cet();KR.RerankRequestDocumentsItem=ucr.serialization.undiscriminatedUnion([ucr.serialization.string(),aeo.RerankDocument])});var fet=S(GR=>{"use strict";var seo=GR&&GR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ueo=GR&&GR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),leo=GR&&GR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&seo(r,e,n[o]);return ueo(r,e),r}}();Object.defineProperty(GR,"__esModule",{value:!0});GR.RerankResponseResultsItemDocument=void 0;var lcr=leo(se());GR.RerankResponseResultsItemDocument=lcr.serialization.object({text:lcr.serialization.string()})});var pet=S(XR=>{"use strict";var ceo=XR&&XR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),deo=XR&&XR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),feo=XR&&XR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ceo(r,e,n[o]);return deo(r,e),r}}();Object.defineProperty(XR,"__esModule",{value:!0});XR.RerankResponseResultsItem=void 0;var Exe=feo(se()),peo=fet();XR.RerankResponseResultsItem=Exe.serialization.object({document:peo.RerankResponseResultsItemDocument.optional(),index:Exe.serialization.number(),relevanceScore:Exe.serialization.property("relevance_score",Exe.serialization.number())})});var ccr=S(ZR=>{"use strict";var meo=ZR&&ZR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),heo=ZR&&ZR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),geo=ZR&&ZR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&meo(r,e,n[o]);return heo(r,e),r}}();Object.defineProperty(ZR,"__esModule",{value:!0});ZR.RerankResponse=void 0;var met=geo(se()),yeo=pet(),beo=Q_();ZR.RerankResponse=met.serialization.object({id:met.serialization.string().optional(),results:met.serialization.list(yeo.RerankResponseResultsItem),meta:beo.ApiMeta.optional()})});var het=S(YR=>{"use strict";var _eo=YR&&YR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),veo=YR&&YR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),weo=YR&&YR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_eo(r,e,n[o]);return veo(r,e),r}}();Object.defineProperty(YR,"__esModule",{value:!0});YR.ClassifyRequestTruncate=void 0;var Seo=weo(se());YR.ClassifyRequestTruncate=Seo.serialization.enum_(["NONE","START","END"])});var get=S(QR=>{"use strict";var Ceo=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]}),xeo=QR&&QR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Teo=QR&&QR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ceo(r,e,n[o]);return xeo(r,e),r}}();Object.defineProperty(QR,"__esModule",{value:!0});QR.ClassifyResponseClassificationsItemLabelsValue=void 0;var dcr=Teo(se());QR.ClassifyResponseClassificationsItemLabelsValue=dcr.serialization.object({confidence:dcr.serialization.number().optional()})});var yet=S(eI=>{"use strict";var Oeo=eI&&eI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eeo=eI&&eI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Peo=eI&&eI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Oeo(r,e,n[o]);return Eeo(r,e),r}}();Object.defineProperty(eI,"__esModule",{value:!0});eI.ClassifyResponseClassificationsItemClassificationType=void 0;var Meo=Peo(se());eI.ClassifyResponseClassificationsItemClassificationType=Meo.serialization.enum_(["single-label","multi-label"])});var bet=S(tI=>{"use strict";var Reo=tI&&tI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ieo=tI&&tI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aeo=tI&&tI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Reo(r,e,n[o]);return Ieo(r,e),r}}();Object.defineProperty(tI,"__esModule",{value:!0});tI.ClassifyResponseClassificationsItem=void 0;var h0=Aeo(se()),Neo=get(),Deo=yet();tI.ClassifyResponseClassificationsItem=h0.serialization.object({id:h0.serialization.string(),input:h0.serialization.string().optional(),prediction:h0.serialization.string().optional(),predictions:h0.serialization.list(h0.serialization.string()),confidence:h0.serialization.number().optional(),confidences:h0.serialization.list(h0.serialization.number()),labels:h0.serialization.record(h0.serialization.string(),Neo.ClassifyResponseClassificationsItemLabelsValue),classificationType:h0.serialization.property("classification_type",Deo.ClassifyResponseClassificationsItemClassificationType)})});var fcr=S(rI=>{"use strict";var jeo=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]}),$eo=rI&&rI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Leo=rI&&rI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jeo(r,e,n[o]);return $eo(r,e),r}}();Object.defineProperty(rI,"__esModule",{value:!0});rI.ClassifyResponse=void 0;var _et=Leo(se()),Feo=bet(),keo=Q_();rI.ClassifyResponse=_et.serialization.object({id:_et.serialization.string(),classifications:_et.serialization.list(Feo.ClassifyResponseClassificationsItem),meta:keo.ApiMeta.optional()})});var vet=S(nI=>{"use strict";var qeo=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]}),Ueo=nI&&nI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Beo=nI&&nI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qeo(r,e,n[o]);return Ueo(r,e),r}}();Object.defineProperty(nI,"__esModule",{value:!0});nI.SummarizeRequestLength=void 0;var zeo=Beo(se());nI.SummarizeRequestLength=zeo.serialization.enum_(["short","medium","long"])});var wet=S(oI=>{"use strict";var Veo=oI&&oI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Heo=oI&&oI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Weo=oI&&oI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Veo(r,e,n[o]);return Heo(r,e),r}}();Object.defineProperty(oI,"__esModule",{value:!0});oI.SummarizeRequestFormat=void 0;var Jeo=Weo(se());oI.SummarizeRequestFormat=Jeo.serialization.enum_(["paragraph","bullets"])});var Cet=S(iI=>{"use strict";var Keo=iI&&iI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Geo=iI&&iI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xeo=iI&&iI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Keo(r,e,n[o]);return Geo(r,e),r}}();Object.defineProperty(iI,"__esModule",{value:!0});iI.SummarizeRequestExtractiveness=void 0;var Zeo=Xeo(se());iI.SummarizeRequestExtractiveness=Zeo.serialization.enum_(["low","medium","high"])});var pcr=S(aI=>{"use strict";var Yeo=aI&&aI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qeo=aI&&aI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eto=aI&&aI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Yeo(r,e,n[o]);return Qeo(r,e),r}}();Object.defineProperty(aI,"__esModule",{value:!0});aI.SummarizeResponse=void 0;var xet=eto(se()),tto=Q_();aI.SummarizeResponse=xet.serialization.object({id:xet.serialization.string().optional(),summary:xet.serialization.string().optional(),meta:tto.ApiMeta.optional()})});var mcr=S(sI=>{"use strict";var rto=sI&&sI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nto=sI&&sI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oto=sI&&sI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rto(r,e,n[o]);return nto(r,e),r}}();Object.defineProperty(sI,"__esModule",{value:!0});sI.TokenizeResponse=void 0;var C8=oto(se()),ito=Q_();sI.TokenizeResponse=C8.serialization.object({tokens:C8.serialization.list(C8.serialization.number()),tokenStrings:C8.serialization.property("token_strings",C8.serialization.list(C8.serialization.string())),meta:ito.ApiMeta.optional()})});var gcr=S(uI=>{"use strict";var ato=uI&&uI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sto=uI&&uI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uto=uI&&uI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ato(r,e,n[o]);return sto(r,e),r}}();Object.defineProperty(uI,"__esModule",{value:!0});uI.DetokenizeResponse=void 0;var hcr=uto(se()),lto=Q_();uI.DetokenizeResponse=hcr.serialization.object({text:hcr.serialization.string(),meta:lto.ApiMeta.optional()})});var ycr=S(lI=>{"use strict";var cto=lI&&lI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dto=lI&&lI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fto=lI&&lI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cto(r,e,n[o]);return dto(r,e),r}}();Object.defineProperty(lI,"__esModule",{value:!0});lI.CheckApiKeyResponse=void 0;var x8=fto(se());lI.CheckApiKeyResponse=x8.serialization.object({valid:x8.serialization.boolean(),organizationId:x8.serialization.property("organization_id",x8.serialization.string().optional()),ownerId:x8.serialization.property("owner_id",x8.serialization.string().optional())})});var Pxe=S(cI=>{"use strict";var pto=cI&&cI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mto=cI&&cI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hto=cI&&cI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pto(r,e,n[o]);return mto(r,e),r}}();Object.defineProperty(cI,"__esModule",{value:!0});cI.ChatConnector=void 0;var iD=hto(se());cI.ChatConnector=iD.serialization.object({id:iD.serialization.string(),userAccessToken:iD.serialization.property("user_access_token",iD.serialization.string().optional()),continueOnFailure:iD.serialization.property("continue_on_failure",iD.serialization.boolean().optional()),options:iD.serialization.record(iD.serialization.string(),iD.serialization.unknown()).optional()})});var Tet=S(dI=>{"use strict";var gto=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]}),yto=dI&&dI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bto=dI&&dI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&>o(r,e,n[o]);return yto(r,e),r}}();Object.defineProperty(dI,"__esModule",{value:!0});dI.ToolParameterDefinitionsValue=void 0;var Mxe=bto(se());dI.ToolParameterDefinitionsValue=Mxe.serialization.object({description:Mxe.serialization.string().optional(),type:Mxe.serialization.string(),required:Mxe.serialization.boolean().optional()})});var Rxe=S(fI=>{"use strict";var _to=fI&&fI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vto=fI&&fI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wto=fI&&fI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_to(r,e,n[o]);return vto(r,e),r}}();Object.defineProperty(fI,"__esModule",{value:!0});fI.Tool=void 0;var T8=wto(se()),Sto=Tet();fI.Tool=T8.serialization.object({name:T8.serialization.string(),description:T8.serialization.string(),parameterDefinitions:T8.serialization.property("parameter_definitions",T8.serialization.record(T8.serialization.string(),Sto.ToolParameterDefinitionsValue).optional())})});var Oet=S(pI=>{"use strict";var Cto=pI&&pI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xto=pI&&pI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tto=pI&&pI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cto(r,e,n[o]);return xto(r,e),r}}();Object.defineProperty(pI,"__esModule",{value:!0});pI.ChatTextResponseFormat=void 0;var Oto=Tto(se());pI.ChatTextResponseFormat=Oto.serialization.object({})});var Eet=S(mI=>{"use strict";var Eto=mI&&mI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pto=mI&&mI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mto=mI&&mI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Eto(r,e,n[o]);return Pto(r,e),r}}();Object.defineProperty(mI,"__esModule",{value:!0});mI.JsonResponseFormat=void 0;var Ixe=Mto(se());mI.JsonResponseFormat=Ixe.serialization.object({schema:Ixe.serialization.record(Ixe.serialization.string(),Ixe.serialization.unknown()).optional()})});var Axe=S(hI=>{"use strict";var Rto=hI&&hI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ito=hI&&hI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ato=hI&&hI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rto(r,e,n[o]);return Ito(r,e),r}}();Object.defineProperty(hI,"__esModule",{value:!0});hI.ResponseFormat=void 0;var Nto=Ato(se()),Dto=Oet(),jto=Eet();hI.ResponseFormat=Nto.serialization.union("type",{text:Dto.ChatTextResponseFormat,json_object:jto.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var Pet=S(gI=>{"use strict";var $to=gI&&gI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lto=gI&&gI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fto=gI&&gI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$to(r,e,n[o]);return Lto(r,e),r}}();Object.defineProperty(gI,"__esModule",{value:!0});gI.EmbedJobStatus=void 0;var kto=Fto(se());gI.EmbedJobStatus=kto.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var Met=S(yI=>{"use strict";var qto=yI&&yI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uto=yI&&yI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bto=yI&&yI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qto(r,e,n[o]);return Uto(r,e),r}}();Object.defineProperty(yI,"__esModule",{value:!0});yI.EmbedJobTruncate=void 0;var zto=Bto(se());yI.EmbedJobTruncate=zto.serialization.enum_(["START","END"])});var Ret=S(bI=>{"use strict";var Vto=bI&&bI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hto=bI&&bI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wto=bI&&bI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vto(r,e,n[o]);return Hto(r,e),r}}();Object.defineProperty(bI,"__esModule",{value:!0});bI.EmbedJob=void 0;var Ox=Wto(se()),Jto=Pet(),Kto=Met(),Gto=Q_();bI.EmbedJob=Ox.serialization.object({jobId:Ox.serialization.property("job_id",Ox.serialization.string()),name:Ox.serialization.string().optional(),status:Jto.EmbedJobStatus,createdAt:Ox.serialization.property("created_at",Ox.serialization.date()),inputDatasetId:Ox.serialization.property("input_dataset_id",Ox.serialization.string()),outputDatasetId:Ox.serialization.property("output_dataset_id",Ox.serialization.string().optional()),model:Ox.serialization.string(),truncate:Kto.EmbedJobTruncate,meta:Gto.ApiMeta.optional()})});var bcr=S(_I=>{"use strict";var Xto=_I&&_I.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zto=_I&&_I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yto=_I&&_I.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xto(r,e,n[o]);return Zto(r,e),r}}();Object.defineProperty(_I,"__esModule",{value:!0});_I.ListEmbedJobResponse=void 0;var Iet=Yto(se()),Qto=Ret();_I.ListEmbedJobResponse=Iet.serialization.object({embedJobs:Iet.serialization.property("embed_jobs",Iet.serialization.list(Qto.EmbedJob).optional())})});var _cr=S(vI=>{"use strict";var ero=vI&&vI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tro=vI&&vI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rro=vI&&vI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ero(r,e,n[o]);return tro(r,e),r}}();Object.defineProperty(vI,"__esModule",{value:!0});vI.CreateEmbedJobResponse=void 0;var Aet=rro(se()),nro=Q_();vI.CreateEmbedJobResponse=Aet.serialization.object({jobId:Aet.serialization.property("job_id",Aet.serialization.string()),meta:nro.ApiMeta.optional()})});var Det=S(wI=>{"use strict";var oro=wI&&wI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iro=wI&&wI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aro=wI&&wI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oro(r,e,n[o]);return iro(r,e),r}}();Object.defineProperty(wI,"__esModule",{value:!0});wI.ClassifyExample=void 0;var Net=aro(se());wI.ClassifyExample=Net.serialization.object({text:Net.serialization.string().optional(),label:Net.serialization.string().optional()})});var vcr=S(SI=>{"use strict";var sro=SI&&SI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uro=SI&&SI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lro=SI&&SI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sro(r,e,n[o]);return uro(r,e),r}}();Object.defineProperty(SI,"__esModule",{value:!0});SI.ParseInfo=void 0;var jet=lro(se());SI.ParseInfo=jet.serialization.object({separator:jet.serialization.string().optional(),delimiter:jet.serialization.string().optional()})});var wcr=S(CI=>{"use strict";var cro=CI&&CI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dro=CI&&CI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fro=CI&&CI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cro(r,e,n[o]);return dro(r,e),r}}();Object.defineProperty(CI,"__esModule",{value:!0});CI.RerankerDataMetrics=void 0;var Mw=fro(se());CI.RerankerDataMetrics=Mw.serialization.object({numTrainQueries:Mw.serialization.property("num_train_queries",Mw.serialization.number().optional()),numTrainRelevantPassages:Mw.serialization.property("num_train_relevant_passages",Mw.serialization.number().optional()),numTrainHardNegatives:Mw.serialization.property("num_train_hard_negatives",Mw.serialization.number().optional()),numEvalQueries:Mw.serialization.property("num_eval_queries",Mw.serialization.number().optional()),numEvalRelevantPassages:Mw.serialization.property("num_eval_relevant_passages",Mw.serialization.number().optional()),numEvalHardNegatives:Mw.serialization.property("num_eval_hard_negatives",Mw.serialization.number().optional())})});var Scr=S(xI=>{"use strict";var pro=xI&&xI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mro=xI&&xI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hro=xI&&xI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pro(r,e,n[o]);return mro(r,e),r}}();Object.defineProperty(xI,"__esModule",{value:!0});xI.ChatDataMetrics=void 0;var O8=hro(se());xI.ChatDataMetrics=O8.serialization.object({numTrainTurns:O8.serialization.property("num_train_turns",O8.serialization.number().optional()),numEvalTurns:O8.serialization.property("num_eval_turns",O8.serialization.number().optional()),preamble:O8.serialization.string().optional()})});var $et=S(TI=>{"use strict";var gro=TI&&TI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yro=TI&&TI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bro=TI&&TI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gro(r,e,n[o]);return yro(r,e),r}}();Object.defineProperty(TI,"__esModule",{value:!0});TI.LabelMetric=void 0;var E8=bro(se());TI.LabelMetric=E8.serialization.object({totalExamples:E8.serialization.property("total_examples",E8.serialization.number().optional()),label:E8.serialization.string().optional(),samples:E8.serialization.list(E8.serialization.string()).optional()})});var Ccr=S(OI=>{"use strict";var _ro=OI&&OI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vro=OI&&OI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wro=OI&&OI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_ro(r,e,n[o]);return vro(r,e),r}}();Object.defineProperty(OI,"__esModule",{value:!0});OI.ClassifyDataMetrics=void 0;var Let=wro(se()),Sro=$et();OI.ClassifyDataMetrics=Let.serialization.object({labelMetrics:Let.serialization.property("label_metrics",Let.serialization.list(Sro.LabelMetric).optional())})});var Fet=S(EI=>{"use strict";var Cro=EI&&EI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xro=EI&&EI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tro=EI&&EI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cro(r,e,n[o]);return xro(r,e),r}}();Object.defineProperty(EI,"__esModule",{value:!0});EI.FinetuneDatasetMetrics=void 0;var Rw=Tro(se());EI.FinetuneDatasetMetrics=Rw.serialization.object({trainableTokenCount:Rw.serialization.property("trainable_token_count",Rw.serialization.number().optional()),totalExamples:Rw.serialization.property("total_examples",Rw.serialization.number().optional()),trainExamples:Rw.serialization.property("train_examples",Rw.serialization.number().optional()),trainSizeBytes:Rw.serialization.property("train_size_bytes",Rw.serialization.number().optional()),evalExamples:Rw.serialization.property("eval_examples",Rw.serialization.number().optional()),evalSizeBytes:Rw.serialization.property("eval_size_bytes",Rw.serialization.number().optional())})});var Tcr=S(PI=>{"use strict";var Oro=PI&&PI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ero=PI&&PI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pro=PI&&PI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Oro(r,e,n[o]);return Ero(r,e),r}}();Object.defineProperty(PI,"__esModule",{value:!0});PI.Metrics=void 0;var xcr=Pro(se()),Mro=Fet();PI.Metrics=xcr.serialization.object({finetuneDatasetMetrics:xcr.serialization.property("finetune_dataset_metrics",Mro.FinetuneDatasetMetrics.optional())})});var ket=S(RI=>{"use strict";var Rro=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]}),Iro=RI&&RI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aro=RI&&RI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rro(r,e,n[o]);return Iro(r,e),r}}();Object.defineProperty(RI,"__esModule",{value:!0});RI.ConnectorOAuth=void 0;var MI=Aro(se());RI.ConnectorOAuth=MI.serialization.object({clientId:MI.serialization.property("client_id",MI.serialization.string().optional()),clientSecret:MI.serialization.property("client_secret",MI.serialization.string().optional()),authorizeUrl:MI.serialization.property("authorize_url",MI.serialization.string()),tokenUrl:MI.serialization.property("token_url",MI.serialization.string()),scope:MI.serialization.string().optional()})});var qet=S(II=>{"use strict";var Nro=II&&II.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dro=II&&II.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jro=II&&II.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Nro(r,e,n[o]);return Dro(r,e),r}}();Object.defineProperty(II,"__esModule",{value:!0});II.ConnectorAuthStatus=void 0;var $ro=jro(se());II.ConnectorAuthStatus=$ro.serialization.enum_(["valid","expired"])});var P8=S(AI=>{"use strict";var Lro=AI&&AI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fro=AI&&AI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kro=AI&&AI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Lro(r,e,n[o]);return Fro(r,e),r}}();Object.defineProperty(AI,"__esModule",{value:!0});AI.Connector=void 0;var Bm=kro(se()),qro=ket(),Uro=qet();AI.Connector=Bm.serialization.object({id:Bm.serialization.string(),organizationId:Bm.serialization.property("organization_id",Bm.serialization.string().optional()),name:Bm.serialization.string(),description:Bm.serialization.string().optional(),url:Bm.serialization.string().optional(),createdAt:Bm.serialization.property("created_at",Bm.serialization.date()),updatedAt:Bm.serialization.property("updated_at",Bm.serialization.date()),excludes:Bm.serialization.list(Bm.serialization.string()).optional(),authType:Bm.serialization.property("auth_type",Bm.serialization.string().optional()),oauth:qro.ConnectorOAuth.optional(),authStatus:Bm.serialization.property("auth_status",Uro.ConnectorAuthStatus.optional()),active:Bm.serialization.boolean().optional(),continueOnFailure:Bm.serialization.property("continue_on_failure",Bm.serialization.boolean().optional())})});var Ocr=S(NI=>{"use strict";var Bro=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]}),zro=NI&&NI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vro=NI&&NI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Bro(r,e,n[o]);return zro(r,e),r}}();Object.defineProperty(NI,"__esModule",{value:!0});NI.ListConnectorsResponse=void 0;var Nxe=Vro(se()),Hro=P8();NI.ListConnectorsResponse=Nxe.serialization.object({connectors:Nxe.serialization.list(Hro.Connector),totalCount:Nxe.serialization.property("total_count",Nxe.serialization.number().optional())})});var Ecr=S(DI=>{"use strict";var Wro=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]}),Jro=DI&&DI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kro=DI&&DI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wro(r,e,n[o]);return Jro(r,e),r}}();Object.defineProperty(DI,"__esModule",{value:!0});DI.CreateConnectorResponse=void 0;var Gro=Kro(se()),Xro=P8();DI.CreateConnectorResponse=Gro.serialization.object({connector:Xro.Connector})});var Pcr=S(jI=>{"use strict";var Zro=jI&&jI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yro=jI&&jI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qro=jI&&jI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zro(r,e,n[o]);return Yro(r,e),r}}();Object.defineProperty(jI,"__esModule",{value:!0});jI.GetConnectorResponse=void 0;var eno=Qro(se()),tno=P8();jI.GetConnectorResponse=eno.serialization.object({connector:tno.Connector})});var Mcr=S($I=>{"use strict";var rno=$I&&$I.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),nno=$I&&$I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ono=$I&&$I.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rno(r,e,n[o]);return nno(r,e),r}}();Object.defineProperty($I,"__esModule",{value:!0});$I.DeleteConnectorResponse=void 0;var Uet=ono(se());$I.DeleteConnectorResponse=Uet.serialization.record(Uet.serialization.string(),Uet.serialization.unknown())});var Rcr=S(LI=>{"use strict";var ino=LI&&LI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ano=LI&&LI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sno=LI&&LI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ino(r,e,n[o]);return ano(r,e),r}}();Object.defineProperty(LI,"__esModule",{value:!0});LI.UpdateConnectorResponse=void 0;var uno=sno(se()),lno=P8();LI.UpdateConnectorResponse=uno.serialization.object({connector:lno.Connector})});var Icr=S(FI=>{"use strict";var cno=FI&&FI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dno=FI&&FI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fno=FI&&FI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cno(r,e,n[o]);return dno(r,e),r}}();Object.defineProperty(FI,"__esModule",{value:!0});FI.OAuthAuthorizeResponse=void 0;var Bet=fno(se());FI.OAuthAuthorizeResponse=Bet.serialization.object({redirectUrl:Bet.serialization.property("redirect_url",Bet.serialization.string().optional())})});var zet=S(kI=>{"use strict";var pno=kI&&kI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mno=kI&&kI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hno=kI&&kI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pno(r,e,n[o]);return mno(r,e),r}}();Object.defineProperty(kI,"__esModule",{value:!0});kI.CompatibleEndpoint=void 0;var gno=hno(se());kI.CompatibleEndpoint=gno.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var Vet=S(qI=>{"use strict";var yno=qI&&qI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bno=qI&&qI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_no=qI&&qI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yno(r,e,n[o]);return bno(r,e),r}}();Object.defineProperty(qI,"__esModule",{value:!0});qI.GetModelResponse=void 0;var tb=_no(se()),Acr=zet();qI.GetModelResponse=tb.serialization.object({name:tb.serialization.string().optional(),isDeprecated:tb.serialization.property("is_deprecated",tb.serialization.boolean().optional()),endpoints:tb.serialization.list(Acr.CompatibleEndpoint).optional(),finetuned:tb.serialization.boolean().optional(),contextLength:tb.serialization.property("context_length",tb.serialization.number().optional()),tokenizerUrl:tb.serialization.property("tokenizer_url",tb.serialization.string().optional()),supportsVision:tb.serialization.property("supports_vision",tb.serialization.boolean().optional()),defaultEndpoints:tb.serialization.property("default_endpoints",tb.serialization.list(Acr.CompatibleEndpoint).optional()),features:tb.serialization.list(tb.serialization.string()).optional()})});var Ncr=S(UI=>{"use strict";var vno=UI&&UI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wno=UI&&UI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sno=UI&&UI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vno(r,e,n[o]);return wno(r,e),r}}();Object.defineProperty(UI,"__esModule",{value:!0});UI.ListModelsResponse=void 0;var Dxe=Sno(se()),Cno=Vet();UI.ListModelsResponse=Dxe.serialization.object({models:Dxe.serialization.list(Cno.GetModelResponse),nextPageToken:Dxe.serialization.property("next_page_token",Dxe.serialization.string().optional())})});var Dcr=S(he=>{"use strict";var xno=he&&he.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_e=he&&he.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xno(e,t,r)};Object.defineProperty(he,"__esModule",{value:!0});_e(_Qe(),he);_e(vQe(),he);_e(wQe(),he);_e(rcr(),he);_e(zQe(),he);_e(VQe(),he);_e(HQe(),he);_e(FQe(),he);_e(WQe(),he);_e(JQe(),he);_e(ocr(),he);_e(QQe(),he);_e(eet(),he);_e(icr(),he);_e(oet(),he);_e(scr(),he);_e(det(),he);_e(fet(),he);_e(pet(),he);_e(ccr(),he);_e(het(),he);_e(get(),he);_e(yet(),he);_e(bet(),he);_e(fcr(),he);_e(vet(),he);_e(wet(),he);_e(Cet(),he);_e(pcr(),he);_e(mcr(),he);_e(gcr(),he);_e(ycr(),he);_e(_8(),he);_e(DQe(),he);_e(nie(),he);_e($Qe(),he);_e(oie(),he);_e(Pxe(),he);_e(b8(),he);_e(Tet(),he);_e(Rxe(),he);_e(Oet(),he);_e(Eet(),he);_e(Axe(),he);_e(RQe(),he);_e(vxe(),he);_e(eie(),he);_e(OQe(),he);_e(bxe(),he);_e(v8(),he);_e(fYe(),he);_e(pYe(),he);_e(mYe(),he);_e(Q_(),he);_e(xx(),he);_e(CQe(),he);_e(TQe(),he);_e(PQe(),he);_e(MQe(),he);_e(IQe(),he);_e(AQe(),he);_e(NQe(),he);_e(kQe(),he);_e(qQe(),he);_e(BQe(),he);_e(exe(),he);_e(tV(),he);_e(yYe(),he);_e(bYe(),he);_e(_Ye(),he);_e(vYe(),he);_e(SYe(),he);_e(CYe(),he);_e(jZe(),he);_e(qoe(),he);_e(txe(),he);_e(WZe(),he);_e(JZe(),he);_e(KZe(),he);_e(GZe(),he);_e(Boe(),he);_e(xYe(),he);_e(OYe(),he);_e(EYe(),he);_e(PYe(),he);_e(RYe(),he);_e(IYe(),he);_e(koe(),he);_e(AYe(),he);_e(NYe(),he);_e(jYe(),he);_e(LYe(),he);_e(FYe(),he);_e(oxe(),he);_e(kYe(),he);_e(ixe(),he);_e(qYe(),he);_e(axe(),he);_e(UYe(),he);_e(BYe(),he);_e(sxe(),he);_e(zYe(),he);_e(uxe(),he);_e(YCe(),he);_e(uYe(),he);_e(lYe(),he);_e(eYe(),he);_e(tYe(),he);_e(QCe(),he);_e(ZCe(),he);_e(Ow(),he);_e(hZe(),he);_e(gZe(),he);_e(yZe(),he);_e(bZe(),he);_e(vZe(),he);_e(wZe(),he);_e(SZe(),he);_e(CZe(),he);_e(TZe(),he);_e(OZe(),he);_e(EZe(),he);_e(PZe(),he);_e(MZe(),he);_e(IZe(),he);_e(AZe(),he);_e(NZe(),he);_e(LZe(),he);_e(FZe(),he);_e(kZe(),he);_e(qZe(),he);_e(UZe(),he);_e(BZe(),he);_e(zZe(),he);_e(VZe(),he);_e(HZe(),he);_e(XZe(),he);_e(ZZe(),he);_e(YZe(),he);_e(QZe(),he);_e(nYe(),he);_e(oYe(),he);_e(ret(),he);_e(net(),he);_e(aie(),he);_e(KQe(),he);_e(GQe(),he);_e(XQe(),he);_e(ZQe(),he);_e(YQe(),he);_e(Joe(),he);_e(Koe(),he);_e(Oxe(),he);_e(iet(),he);_e(aet(),he);_e(set(),he);_e(HYe(),he);_e(WYe(),he);_e(JYe(),he);_e(KYe(),he);_e(GYe(),he);_e(Pet(),he);_e(Met(),he);_e(Ret(),he);_e(bcr(),he);_e(_cr(),he);_e(cet(),he);_e(Det(),he);_e(tQe(),he);_e(eQe(),he);_e(rQe(),he);_e(vcr(),he);_e(wcr(),he);_e(Scr(),he);_e($et(),he);_e(Ccr(),he);_e(Fet(),he);_e(Tcr(),he);_e(cxe(),he);_e(ket(),he);_e(qet(),he);_e(P8(),he);_e(Ocr(),he);_e(hxe(),he);_e(yQe(),he);_e(gxe(),he);_e(Ecr(),he);_e(Pcr(),he);_e(Mcr(),he);_e(Rcr(),he);_e(Icr(),he);_e(zet(),he);_e(Vet(),he);_e(Ncr(),he)});var jcr=S(BI=>{"use strict";var Tno=BI&&BI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ono=BI&&BI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eno=BI&&BI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Tno(r,e,n[o]);return Ono(r,e),r}}();Object.defineProperty(BI,"__esModule",{value:!0});BI.ChatStreamRequest=void 0;var Pi=Eno(se()),Pno=oie(),Mno=_Qe(),Rno=Pxe(),Ino=b8(),Ano=vQe(),Nno=Rxe(),Dno=nie(),jno=Axe(),$no=wQe();BI.ChatStreamRequest=Pi.serialization.object({message:Pi.serialization.string(),model:Pi.serialization.string().optional(),preamble:Pi.serialization.string().optional(),chatHistory:Pi.serialization.property("chat_history",Pi.serialization.list(Pno.Message).optional()),conversationId:Pi.serialization.property("conversation_id",Pi.serialization.string().optional()),promptTruncation:Pi.serialization.property("prompt_truncation",Mno.ChatStreamRequestPromptTruncation.optional()),connectors:Pi.serialization.list(Rno.ChatConnector).optional(),searchQueriesOnly:Pi.serialization.property("search_queries_only",Pi.serialization.boolean().optional()),documents:Pi.serialization.list(Ino.ChatDocument).optional(),citationQuality:Pi.serialization.property("citation_quality",Ano.ChatStreamRequestCitationQuality.optional()),temperature:Pi.serialization.number().optional(),maxTokens:Pi.serialization.property("max_tokens",Pi.serialization.number().optional()),maxInputTokens:Pi.serialization.property("max_input_tokens",Pi.serialization.number().optional()),k:Pi.serialization.number().optional(),p:Pi.serialization.number().optional(),seed:Pi.serialization.number().optional(),stopSequences:Pi.serialization.property("stop_sequences",Pi.serialization.list(Pi.serialization.string()).optional()),frequencyPenalty:Pi.serialization.property("frequency_penalty",Pi.serialization.number().optional()),presencePenalty:Pi.serialization.property("presence_penalty",Pi.serialization.number().optional()),rawPrompting:Pi.serialization.property("raw_prompting",Pi.serialization.boolean().optional()),tools:Pi.serialization.list(Nno.Tool).optional(),toolResults:Pi.serialization.property("tool_results",Pi.serialization.list(Dno.ToolResult).optional()),forceSingleStep:Pi.serialization.property("force_single_step",Pi.serialization.boolean().optional()),responseFormat:Pi.serialization.property("response_format",jno.ResponseFormat.optional()),safetyMode:Pi.serialization.property("safety_mode",$no.ChatStreamRequestSafetyMode.optional())})});var $cr=S(zI=>{"use strict";var Lno=zI&&zI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fno=zI&&zI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kno=zI&&zI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Lno(r,e,n[o]);return Fno(r,e),r}}();Object.defineProperty(zI,"__esModule",{value:!0});zI.ChatRequest=void 0;var Mi=kno(se()),qno=oie(),Uno=zQe(),Bno=Pxe(),zno=b8(),Vno=VQe(),Hno=Rxe(),Wno=nie(),Jno=Axe(),Kno=HQe();zI.ChatRequest=Mi.serialization.object({message:Mi.serialization.string(),model:Mi.serialization.string().optional(),preamble:Mi.serialization.string().optional(),chatHistory:Mi.serialization.property("chat_history",Mi.serialization.list(qno.Message).optional()),conversationId:Mi.serialization.property("conversation_id",Mi.serialization.string().optional()),promptTruncation:Mi.serialization.property("prompt_truncation",Uno.ChatRequestPromptTruncation.optional()),connectors:Mi.serialization.list(Bno.ChatConnector).optional(),searchQueriesOnly:Mi.serialization.property("search_queries_only",Mi.serialization.boolean().optional()),documents:Mi.serialization.list(zno.ChatDocument).optional(),citationQuality:Mi.serialization.property("citation_quality",Vno.ChatRequestCitationQuality.optional()),temperature:Mi.serialization.number().optional(),maxTokens:Mi.serialization.property("max_tokens",Mi.serialization.number().optional()),maxInputTokens:Mi.serialization.property("max_input_tokens",Mi.serialization.number().optional()),k:Mi.serialization.number().optional(),p:Mi.serialization.number().optional(),seed:Mi.serialization.number().optional(),stopSequences:Mi.serialization.property("stop_sequences",Mi.serialization.list(Mi.serialization.string()).optional()),frequencyPenalty:Mi.serialization.property("frequency_penalty",Mi.serialization.number().optional()),presencePenalty:Mi.serialization.property("presence_penalty",Mi.serialization.number().optional()),rawPrompting:Mi.serialization.property("raw_prompting",Mi.serialization.boolean().optional()),tools:Mi.serialization.list(Hno.Tool).optional(),toolResults:Mi.serialization.property("tool_results",Mi.serialization.list(Wno.ToolResult).optional()),forceSingleStep:Mi.serialization.property("force_single_step",Mi.serialization.boolean().optional()),responseFormat:Mi.serialization.property("response_format",Jno.ResponseFormat.optional()),safetyMode:Mi.serialization.property("safety_mode",Kno.ChatRequestSafetyMode.optional())})});var Lcr=S(VI=>{"use strict";var Gno=VI&&VI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xno=VI&&VI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zno=VI&&VI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Gno(r,e,n[o]);return Xno(r,e),r}}();Object.defineProperty(VI,"__esModule",{value:!0});VI.GenerateStreamRequest=void 0;var Tl=Zno(se()),Yno=WQe(),Qno=JQe();VI.GenerateStreamRequest=Tl.serialization.object({prompt:Tl.serialization.string(),model:Tl.serialization.string().optional(),numGenerations:Tl.serialization.property("num_generations",Tl.serialization.number().optional()),maxTokens:Tl.serialization.property("max_tokens",Tl.serialization.number().optional()),truncate:Yno.GenerateStreamRequestTruncate.optional(),temperature:Tl.serialization.number().optional(),seed:Tl.serialization.number().optional(),preset:Tl.serialization.string().optional(),endSequences:Tl.serialization.property("end_sequences",Tl.serialization.list(Tl.serialization.string()).optional()),stopSequences:Tl.serialization.property("stop_sequences",Tl.serialization.list(Tl.serialization.string()).optional()),k:Tl.serialization.number().optional(),p:Tl.serialization.number().optional(),frequencyPenalty:Tl.serialization.property("frequency_penalty",Tl.serialization.number().optional()),presencePenalty:Tl.serialization.property("presence_penalty",Tl.serialization.number().optional()),returnLikelihoods:Tl.serialization.property("return_likelihoods",Qno.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:Tl.serialization.property("raw_prompting",Tl.serialization.boolean().optional())})});var Fcr=S(HI=>{"use strict";var eoo=HI&&HI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),too=HI&&HI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),roo=HI&&HI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eoo(r,e,n[o]);return too(r,e),r}}();Object.defineProperty(HI,"__esModule",{value:!0});HI.GenerateRequest=void 0;var Ol=roo(se()),noo=QQe(),ooo=eet();HI.GenerateRequest=Ol.serialization.object({prompt:Ol.serialization.string(),model:Ol.serialization.string().optional(),numGenerations:Ol.serialization.property("num_generations",Ol.serialization.number().optional()),maxTokens:Ol.serialization.property("max_tokens",Ol.serialization.number().optional()),truncate:noo.GenerateRequestTruncate.optional(),temperature:Ol.serialization.number().optional(),seed:Ol.serialization.number().optional(),preset:Ol.serialization.string().optional(),endSequences:Ol.serialization.property("end_sequences",Ol.serialization.list(Ol.serialization.string()).optional()),stopSequences:Ol.serialization.property("stop_sequences",Ol.serialization.list(Ol.serialization.string()).optional()),k:Ol.serialization.number().optional(),p:Ol.serialization.number().optional(),frequencyPenalty:Ol.serialization.property("frequency_penalty",Ol.serialization.number().optional()),presencePenalty:Ol.serialization.property("presence_penalty",Ol.serialization.number().optional()),returnLikelihoods:Ol.serialization.property("return_likelihoods",ooo.GenerateRequestReturnLikelihoods.optional()),rawPrompting:Ol.serialization.property("raw_prompting",Ol.serialization.boolean().optional())})});var kcr=S(WI=>{"use strict";var ioo=WI&&WI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aoo=WI&&WI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),soo=WI&&WI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ioo(r,e,n[o]);return aoo(r,e),r}}();Object.defineProperty(WI,"__esModule",{value:!0});WI.EmbedRequest=void 0;var aD=soo(se()),uoo=Joe(),loo=Koe(),coo=oet();WI.EmbedRequest=aD.serialization.object({texts:aD.serialization.list(aD.serialization.string()).optional(),images:aD.serialization.list(aD.serialization.string()).optional(),model:aD.serialization.string().optional(),inputType:aD.serialization.property("input_type",uoo.EmbedInputType.optional()),embeddingTypes:aD.serialization.property("embedding_types",aD.serialization.list(loo.EmbeddingType).optional()),truncate:coo.EmbedRequestTruncate.optional()})});var qcr=S(JI=>{"use strict";var doo=JI&&JI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),foo=JI&&JI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),poo=JI&&JI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&doo(r,e,n[o]);return foo(r,e),r}}();Object.defineProperty(JI,"__esModule",{value:!0});JI.RerankRequest=void 0;var Iw=poo(se()),moo=det();JI.RerankRequest=Iw.serialization.object({model:Iw.serialization.string().optional(),query:Iw.serialization.string(),documents:Iw.serialization.list(moo.RerankRequestDocumentsItem),topN:Iw.serialization.property("top_n",Iw.serialization.number().optional()),rankFields:Iw.serialization.property("rank_fields",Iw.serialization.list(Iw.serialization.string()).optional()),returnDocuments:Iw.serialization.property("return_documents",Iw.serialization.boolean().optional()),maxChunksPerDoc:Iw.serialization.property("max_chunks_per_doc",Iw.serialization.number().optional())})});var Ucr=S(KI=>{"use strict";var hoo=KI&&KI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),goo=KI&&KI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yoo=KI&&KI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hoo(r,e,n[o]);return goo(r,e),r}}();Object.defineProperty(KI,"__esModule",{value:!0});KI.ClassifyRequest=void 0;var M8=yoo(se()),boo=Det(),_oo=het();KI.ClassifyRequest=M8.serialization.object({inputs:M8.serialization.list(M8.serialization.string()),examples:M8.serialization.list(boo.ClassifyExample).optional(),model:M8.serialization.string().optional(),preset:M8.serialization.string().optional(),truncate:_oo.ClassifyRequestTruncate.optional()})});var Bcr=S(GI=>{"use strict";var voo=GI&&GI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),woo=GI&&GI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Soo=GI&&GI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&voo(r,e,n[o]);return woo(r,e),r}}();Object.defineProperty(GI,"__esModule",{value:!0});GI.SummarizeRequest=void 0;var R8=Soo(se()),Coo=vet(),xoo=wet(),Too=Cet();GI.SummarizeRequest=R8.serialization.object({text:R8.serialization.string(),length:Coo.SummarizeRequestLength.optional(),format:xoo.SummarizeRequestFormat.optional(),model:R8.serialization.string().optional(),extractiveness:Too.SummarizeRequestExtractiveness.optional(),temperature:R8.serialization.number().optional(),additionalCommand:R8.serialization.property("additional_command",R8.serialization.string().optional())})});var zcr=S(XI=>{"use strict";var Ooo=XI&&XI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eoo=XI&&XI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Poo=XI&&XI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ooo(r,e,n[o]);return Eoo(r,e),r}}();Object.defineProperty(XI,"__esModule",{value:!0});XI.TokenizeRequest=void 0;var Het=Poo(se());XI.TokenizeRequest=Het.serialization.object({text:Het.serialization.string(),model:Het.serialization.string()})});var Vcr=S(ZI=>{"use strict";var Moo=ZI&&ZI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Roo=ZI&&ZI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ioo=ZI&&ZI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Moo(r,e,n[o]);return Roo(r,e),r}}();Object.defineProperty(ZI,"__esModule",{value:!0});ZI.DetokenizeRequest=void 0;var jxe=Ioo(se());ZI.DetokenizeRequest=jxe.serialization.object({tokens:jxe.serialization.list(jxe.serialization.number()),model:jxe.serialization.string()})});var Hcr=S(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});Bc.DetokenizeRequest=Bc.TokenizeRequest=Bc.SummarizeRequest=Bc.ClassifyRequest=Bc.RerankRequest=Bc.EmbedRequest=Bc.GenerateRequest=Bc.GenerateStreamRequest=Bc.ChatRequest=Bc.ChatStreamRequest=void 0;var Aoo=jcr();Object.defineProperty(Bc,"ChatStreamRequest",{enumerable:!0,get:function(){return Aoo.ChatStreamRequest}});var Noo=$cr();Object.defineProperty(Bc,"ChatRequest",{enumerable:!0,get:function(){return Noo.ChatRequest}});var Doo=Lcr();Object.defineProperty(Bc,"GenerateStreamRequest",{enumerable:!0,get:function(){return Doo.GenerateStreamRequest}});var joo=Fcr();Object.defineProperty(Bc,"GenerateRequest",{enumerable:!0,get:function(){return joo.GenerateRequest}});var $oo=kcr();Object.defineProperty(Bc,"EmbedRequest",{enumerable:!0,get:function(){return $oo.EmbedRequest}});var Loo=qcr();Object.defineProperty(Bc,"RerankRequest",{enumerable:!0,get:function(){return Loo.RerankRequest}});var Foo=Ucr();Object.defineProperty(Bc,"ClassifyRequest",{enumerable:!0,get:function(){return Foo.ClassifyRequest}});var koo=Bcr();Object.defineProperty(Bc,"SummarizeRequest",{enumerable:!0,get:function(){return koo.SummarizeRequest}});var qoo=zcr();Object.defineProperty(Bc,"TokenizeRequest",{enumerable:!0,get:function(){return qoo.TokenizeRequest}});var Uoo=Vcr();Object.defineProperty(Bc,"DetokenizeRequest",{enumerable:!0,get:function(){return Uoo.DetokenizeRequest}})});var Wcr=S(pV=>{"use strict";var Boo=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]}),zoo=pV&&pV.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Boo(e,t,r)};Object.defineProperty(pV,"__esModule",{value:!0});zoo(Hcr(),pV)});var uD=S(sD=>{"use strict";var Voo=sD&&sD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wet=sD&&sD.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Voo(e,t,r)};Object.defineProperty(sD,"__esModule",{value:!0});Wet(Xlr(),sD);Wet(Dcr(),sD);Wet(Wcr(),sD)});var Jet=S(uu=>{"use strict";var Hoo=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]}),Woo=uu&&uu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Joo=uu&&uu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hoo(r,e,n[o]);return Woo(r,e),r}}(),$xe=uu&&uu.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Koo=uu&&uu.__asyncValues||function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(l){i({value:l,done:s})},a)}};Object.defineProperty(uu,"__esModule",{value:!0});uu.fetchOverride=uu.parseAWSEvent=uu.getAuthHeaders=uu.getUrl=uu.mapResponseFromBedrock=void 0;var Goo=J5e(),Xoo=(wer(),Bpe(ver)),Zoo=JGe(),Yoo=ttr(),Qoo=ioe(),eio=se(),tio=pXe(),rio=Pur(),g0=Joo(uD()),nio=(t,e)=>$xe(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),oio={1:{chat:g0.StreamedChatResponse,generate:g0.GenerateStreamedResponse},2:{chat:g0.V2ChatStreamResponse,generate:g0.GenerateStreamedResponse}},iio={1:{chat:g0.NonStreamedChatResponse,embed:g0.EmbedResponse,generate:g0.Generation,rerank:g0.RerankResponse},2:{chat:g0.V2ChatResponse,embed:g0.EmbedByTypeResponse,generate:g0.Generation,rerank:g0.V2RerankResponse}},aio=(t,e,r,n)=>$xe(void 0,void 0,void 0,function*(){let o=t?oio[r][e]:iio[r][e],i={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},a=yield o.parseOrThrow(n,i);return o.jsonOrThrow(a,i)});uu.mapResponseFromBedrock=aio;var sio=(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]};uu.getUrl=sio;var uio=(t,e,r,n,o,i)=>$xe(void 0,void 0,void 0,function*(){let a=(0,Xoo.fromNodeProviderChain)(),s=yield nio(()=>{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 Yoo.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:Goo.Sha256});delete r.connection,r.host=t.hostname;let l=new Zoo.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});uu.getAuthHeaders=uio;var lio=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}}};uu.parseAWSEvent=lio;var cio=t=>({v1:1,v2:2})[t]||1,dio=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>$xe(void 0,void 0,void 0,function*(){var a,s,u,l;let c=i.url.split("/"),d=c.pop(),f=cio(c.pop()),p=i.body;console.assert(p.model,"model is required");let m=!!p.stream,h=(0,uu.getUrl)(t,e,p.model,m);d==="rerank"&&(p.api_version=f),delete p.stream,delete p.model,delete i.headers.Authorization,i.headers.Host=new URL(h).hostname;let y=yield(0,uu.getAuthHeaders)(new URL(h),i.method,i.headers,JSON.stringify(p),t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o});i.url=h,i.headers=y;let g=yield(0,eio.fetcher)(i);if(!g.ok)return g;try{if(m){let T=(0,tio.readableStreamAsyncIterable)(g.body),O=new rio.LineDecoder,E=new Qoo.PassThrough;try{for(var b=!0,_=Koo(T),w;w=yield _.next(),a=w.done,!a;b=!0){l=w.value,b=!1;let P=l;for(let R of O.decode(P)){let I=(0,uu.parseAWSEvent)(R);if(I){let N=yield(0,uu.mapResponseFromBedrock)(m,d,f,I);E.push(JSON.stringify(N)+`
|
||
`)}}}}catch(P){s={error:P}}finally{try{!b&&!a&&(u=_.return)&&(yield u.call(_))}finally{if(s)throw s.error}}for(let P of O.flush()){let R=(0,uu.parseAWSEvent)(P);if(R){let I=yield(0,uu.mapResponseFromBedrock)(m,d,f,R);E.push(JSON.stringify(I)+`
|
||
`)}}return E.end(),{ok:!0,body:E,rawResponse:g.rawResponse}}else{let T=yield g.body;return{ok:!0,body:yield(0,uu.mapResponseFromBedrock)(m,d,f,T),rawResponse:g.rawResponse}}}catch(T){throw T}});uu.fetchOverride=dio});var lD=S(Lxe=>{"use strict";Object.defineProperty(Lxe,"__esModule",{value:!0});Lxe.CohereEnvironment=void 0;Lxe.CohereEnvironment={Production:"https://api.cohere.com"}});var kk=S((Jcr,Fxe)=>{(function(t,e,r){typeof Fxe<"u"&&Fxe.exports?Fxe.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",Jcr,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 Get=S(tv=>{"use strict";var fio=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]}),pio=tv&&tv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cie=tv&&tv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fio(r,e,n[o]);return pio(r,e),r}}(),I8=tv&&tv.__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())})},mio=tv&&tv.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tv,"__esModule",{value:!0});tv.V2=void 0;var kxe=cie(lD()),oa=cie(se()),Vn=cie(D1()),qk=cie(uD()),qxe=mio(kk()),Jg=cie(kc()),Ket=class{constructor(e={}){this._options=e}chatStream(e,r){return oa.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return I8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:oa.fetcher)({url:(0,qxe.default)((i=(o=yield oa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield oa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kxe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield oa.Supplier.get(this._options.clientName))!=null?yield oa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":oa.RUNTIME.type,"X-Fern-Runtime-Version":oa.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qk.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(a.ok)return{data:new oa.Stream({stream:a.body,parse:s=>I8(this,void 0,void 0,function*(){return qk.V2ChatStreamResponse.parseOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"sse",streamTerminator:"[DONE]"}}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new Jg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}chat(e,r){return oa.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return I8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:oa.fetcher)({url:(0,qxe.default)((i=(o=yield oa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield oa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kxe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield oa.Supplier.get(this._options.clientName))!=null?yield oa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":oa.RUNTIME.type,"X-Fern-Runtime-Version":oa.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qk.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(a.ok)return{data:qk.V2ChatResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new Jg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e,r){return oa.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(e,r){return I8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:oa.fetcher)({url:(0,qxe.default)((i=(o=yield oa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield oa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kxe.CohereEnvironment.Production,"v2/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield oa.Supplier.get(this._options.clientName))!=null?yield oa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":oa.RUNTIME.type,"X-Fern-Runtime-Version":oa.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:qk.V2EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:qk.EmbedByTypeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jg.CohereTimeoutError("Timeout exceeded when calling POST /v2/embed.");case"unknown":throw new Jg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return oa.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return I8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:oa.fetcher)({url:(0,qxe.default)((i=(o=yield oa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield oa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:kxe.CohereEnvironment.Production,"v2/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield oa.Supplier.get(this._options.clientName))!=null?yield oa.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":oa.RUNTIME.type,"X-Fern-Runtime-Version":oa.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:qk.V2RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:qk.V2RerankResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Vn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Vn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Vn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Vn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Vn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Vn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Vn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Vn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Vn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Vn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Vn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Vn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jg.CohereTimeoutError("Timeout exceeded when calling POST /v2/rerank.");case"unknown":throw new Jg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return I8(this,void 0,void 0,function*(){var e;let r=(e=yield oa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Jg.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};tv.V2=Ket});var Kcr=S(rv=>{"use strict";var hio=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]}),gio=rv&&rv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fie=rv&&rv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hio(r,e,n[o]);return gio(r,e),r}}(),die=rv&&rv.__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())})},yio=rv&&rv.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rv,"__esModule",{value:!0});rv.EmbedJobs=void 0;var Uxe=fie(lD()),os=fie(se()),Hn=fie(D1()),Bxe=yio(kk()),zxe=fie(uD()),Kg=fie(kc()),Xet=class{constructor(e={}){this._options=e}list(e){return os.HttpResponsePromise.fromPromise(this.__list(e))}__list(e){return die(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:os.fetcher)({url:(0,Bxe.default)((o=(n=yield os.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield os.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Uxe.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield os.Supplier.get(this._options.clientName))!=null?yield os.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":os.RUNTIME.type,"X-Fern-Runtime-Version":os.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:zxe.ListEmbedJobResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Hn.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Hn.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Hn.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Hn.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Hn.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Hn.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Hn.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Hn.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Hn.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Hn.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Hn.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Hn.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Kg.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Kg.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Kg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs.");case"unknown":throw new Kg.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}create(e,r){return os.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return die(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:os.fetcher)({url:(0,Bxe.default)((i=(o=yield os.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield os.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Uxe.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield os.Supplier.get(this._options.clientName))!=null?yield os.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":os.RUNTIME.type,"X-Fern-Runtime-Version":os.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:zxe.CreateEmbedJobRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:zxe.CreateEmbedJobResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Kg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs.");case"unknown":throw new Kg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return os.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return die(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:os.fetcher)({url:(0,Bxe.default)((i=(o=yield os.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield os.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Uxe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield os.Supplier.get(this._options.clientName))!=null?yield os.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":os.RUNTIME.type,"X-Fern-Runtime-Version":os.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:zxe.EmbedJob.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Kg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs/{id}.");case"unknown":throw new Kg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}cancel(e,r){return os.HttpResponsePromise.fromPromise(this.__cancel(e,r))}__cancel(e,r){return die(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:os.fetcher)({url:(0,Bxe.default)((i=(o=yield os.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield os.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Uxe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield os.Supplier.get(this._options.clientName))!=null?yield os.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":os.RUNTIME.type,"X-Fern-Runtime-Version":os.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:void 0,rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Hn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Hn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Hn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Hn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Hn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Hn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Hn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Hn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Hn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Hn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Hn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Hn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Kg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Kg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs/{id}/cancel.");case"unknown":throw new Kg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return die(this,void 0,void 0,function*(){var e;let r=(e=yield os.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Kg.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};rv.EmbedJobs=Xet});var Gcr=S(nv=>{"use strict";var bio=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]}),_io=nv&&nv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hie=nv&&nv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bio(r,e,n[o]);return _io(r,e),r}}(),A8=nv&&nv.__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())})},vio=nv&&nv.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nv,"__esModule",{value:!0});nv.Datasets=void 0;var pie=hie(lD()),Xo=hie(se()),Lr=hie(D1()),mV=hie(uD()),mie=vio(kk()),fd=hie(kc()),Zet=class{constructor(e={}){this._options=e}list(e={},r){return Xo.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return A8(this,arguments,void 0,function*(e={},r){var n,o,i;let{datasetType:a,before:s,after:u,limit:l,offset:c,validationStatus:d}=e,f={};a!=null&&(f.datasetType=a),s!=null&&(f.before=s.toISOString()),u!=null&&(f.after=u.toISOString()),l!=null&&(f.limit=l.toString()),c!=null&&(f.offset=c.toString()),d!=null&&(f.validationStatus=mV.DatasetValidationStatus.jsonOrThrow(d,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}));let p=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xo.fetcher)({url:(0,mie.default)((i=(o=yield Xo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:pie.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xo.Supplier.get(this._options.clientName))!=null?yield Xo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xo.RUNTIME.type,"X-Fern-Runtime-Version":Xo.RUNTIME.version},r?.headers),contentType:"application/json",queryParameters:f,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(p.ok)return{data:mV.DatasetsListResponse.parseOrThrow(p.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new Lr.BadRequestError(p.error.body,p.rawResponse);case 401:throw new Lr.UnauthorizedError(p.error.body,p.rawResponse);case 403:throw new Lr.ForbiddenError(p.error.body,p.rawResponse);case 404:throw new Lr.NotFoundError(p.error.body,p.rawResponse);case 422:throw new Lr.UnprocessableEntityError(p.error.body,p.rawResponse);case 429:throw new Lr.TooManyRequestsError(p.error.body,p.rawResponse);case 498:throw new Lr.InvalidTokenError(p.error.body,p.rawResponse);case 499:throw new Lr.ClientClosedRequestError(p.error.body,p.rawResponse);case 500:throw new Lr.InternalServerError(p.error.body,p.rawResponse);case 501:throw new Lr.NotImplementedError(p.error.body,p.rawResponse);case 503:throw new Lr.ServiceUnavailableError(p.error.body,p.rawResponse);case 504:throw new Lr.GatewayTimeoutError(p.error.body,p.rawResponse);default:throw new fd.CohereError({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new fd.CohereError({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new fd.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets.");case"unknown":throw new fd.CohereError({message:p.error.errorMessage,rawResponse:p.rawResponse})}})}create(e,r,n,o){return Xo.HttpResponsePromise.fromPromise(this.__create(e,r,n,o))}__create(e,r,n,o){return A8(this,void 0,void 0,function*(){var i,a,s;let u={};u.name=n.name,u.type=mV.DatasetType.jsonOrThrow(n.type,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),n.keepOriginalFile!=null&&(u.keep_original_file=n.keepOriginalFile.toString()),n.skipMalformedInput!=null&&(u.skip_malformed_input=n.skipMalformedInput.toString()),n.keepFields!=null&&(Array.isArray(n.keepFields)?u.keep_fields=n.keepFields.map(f=>f):u.keep_fields=n.keepFields),n.optionalFields!=null&&(Array.isArray(n.optionalFields)?u.optional_fields=n.optionalFields.map(f=>f):u.optional_fields=n.optionalFields),n.textSeparator!=null&&(u.text_separator=n.textSeparator),n.csvDelimiter!=null&&(u.csv_delimiter=n.csvDelimiter);let l=yield Xo.newFormData();yield l.appendFile("data",e),r!=null&&(yield l.appendFile("eval_data",r));let c=yield l.getRequest(),d=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Xo.fetcher)({url:(0,mie.default)((s=(a=yield Xo.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Xo.Supplier.get(this._options.environment))!==null&&s!==void 0?s:pie.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign(Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xo.Supplier.get(this._options.clientName))!=null?yield Xo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xo.RUNTIME.type,"X-Fern-Runtime-Version":Xo.RUNTIME.version},c.headers),o?.headers),queryParameters:u,requestType:"file",duplex:c.duplex,body:c.body,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(d.ok)return{data:mV.DatasetsCreateResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new Lr.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Lr.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Lr.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Lr.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Lr.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Lr.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Lr.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Lr.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Lr.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Lr.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Lr.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Lr.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new fd.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new fd.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new fd.CohereTimeoutError("Timeout exceeded when calling POST /v1/datasets.");case"unknown":throw new fd.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getUsage(e){return Xo.HttpResponsePromise.fromPromise(this.__getUsage(e))}__getUsage(e){return A8(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Xo.fetcher)({url:(0,mie.default)((o=(n=yield Xo.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Xo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:pie.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xo.Supplier.get(this._options.clientName))!=null?yield Xo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xo.RUNTIME.type,"X-Fern-Runtime-Version":Xo.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:mV.DatasetsGetUsageResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Lr.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Lr.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Lr.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Lr.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Lr.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Lr.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Lr.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Lr.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Lr.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Lr.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Lr.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Lr.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new fd.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new fd.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new fd.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/usage.");case"unknown":throw new fd.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}get(e,r){return Xo.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return A8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xo.fetcher)({url:(0,mie.default)((i=(o=yield Xo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:pie.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xo.Supplier.get(this._options.clientName))!=null?yield Xo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xo.RUNTIME.type,"X-Fern-Runtime-Version":Xo.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:mV.DatasetsGetResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new fd.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new fd.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new fd.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/{id}.");case"unknown":throw new fd.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return Xo.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return A8(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xo.fetcher)({url:(0,mie.default)((i=(o=yield Xo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:pie.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xo.Supplier.get(this._options.clientName))!=null?yield Xo.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Xo.RUNTIME.type,"X-Fern-Runtime-Version":Xo.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:mV.datasets.delete.Response.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new fd.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new fd.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new fd.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/datasets/{id}.");case"unknown":throw new fd.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return A8(this,void 0,void 0,function*(){var e;let r=(e=yield Xo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new fd.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};nv.Datasets=Zet});var Xcr=S(ov=>{"use strict";var wio=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]}),Sio=ov&&ov.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gie=ov&&ov.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wio(r,e,n[o]);return Sio(r,e),r}}(),hV=ov&&ov.__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())})},Cio=ov&&ov.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ov,"__esModule",{value:!0});ov.Connectors=void 0;var N8=gie(lD()),qn=gie(se()),lr=gie(D1()),D8=Cio(kk()),Uk=gie(uD()),El=gie(kc()),Yet=class{constructor(e={}){this._options=e}list(e={},r){return qn.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return hV(this,arguments,void 0,function*(e={},r){var n,o,i;let{limit:a,offset:s}=e,u={};a!=null&&(u.limit=a.toString()),s!=null&&(u.offset=s.toString());let l=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,D8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:N8.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),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{data:Uk.ListConnectorsResponse.parseOrThrow(l.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 400:throw new lr.BadRequestError(l.error.body,l.rawResponse);case 401:throw new lr.UnauthorizedError(l.error.body,l.rawResponse);case 403:throw new lr.ForbiddenError(l.error.body,l.rawResponse);case 404:throw new lr.NotFoundError(l.error.body,l.rawResponse);case 422:throw new lr.UnprocessableEntityError(l.error.body,l.rawResponse);case 429:throw new lr.TooManyRequestsError(l.error.body,l.rawResponse);case 498:throw new lr.InvalidTokenError(l.error.body,l.rawResponse);case 499:throw new lr.ClientClosedRequestError(l.error.body,l.rawResponse);case 500:throw new lr.InternalServerError(l.error.body,l.rawResponse);case 501:throw new lr.NotImplementedError(l.error.body,l.rawResponse);case 503:throw new lr.ServiceUnavailableError(l.error.body,l.rawResponse);case 504:throw new lr.GatewayTimeoutError(l.error.body,l.rawResponse);default:throw new El.CohereError({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new El.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors.");case"unknown":throw new El.CohereError({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}create(e,r){return qn.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return hV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,D8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:N8.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Uk.CreateConnectorRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Uk.CreateConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors.");case"unknown":throw new El.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return qn.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return hV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,D8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:N8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Uk.GetConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors/{id}.");case"unknown":throw new El.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return qn.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return hV(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:qn.fetcher)({url:(0,D8.default)((i=(o=yield qn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield qn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:N8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:Uk.DeleteConnectorResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new lr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new lr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new lr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new lr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new lr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new lr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new lr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new lr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new lr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new lr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new lr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new lr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new El.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/connectors/{id}.");case"unknown":throw new El.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}update(e,r={},n){return qn.HttpResponsePromise.fromPromise(this.__update(e,r,n))}__update(e){return hV(this,arguments,void 0,function*(r,n={},o){var i,a,s;let u=yield((i=this._options.fetcher)!==null&&i!==void 0?i:qn.fetcher)({url:(0,D8.default)((s=(a=yield qn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield qn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:N8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},o?.headers),contentType:"application/json",requestType:"json",body:Uk.UpdateConnectorRequest.jsonOrThrow(n,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(u.ok)return{data:Uk.UpdateConnectorResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new lr.BadRequestError(u.error.body,u.rawResponse);case 401:throw new lr.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new lr.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new lr.NotFoundError(u.error.body,u.rawResponse);case 422:throw new lr.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new lr.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new lr.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new lr.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new lr.InternalServerError(u.error.body,u.rawResponse);case 501:throw new lr.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new lr.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new lr.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new El.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new El.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/connectors/{id}.");case"unknown":throw new El.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}oAuthAuthorize(e,r={},n){return qn.HttpResponsePromise.fromPromise(this.__oAuthAuthorize(e,r,n))}__oAuthAuthorize(e){return hV(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{afterTokenRedirect:u}=n,l={};u!=null&&(l.after_token_redirect=u);let c=yield((i=this._options.fetcher)!==null&&i!==void 0?i:qn.fetcher)({url:(0,D8.default)((s=(a=yield qn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield qn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:N8.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}/oauth/authorize`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield qn.Supplier.get(this._options.clientName))!=null?yield qn.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":qn.RUNTIME.type,"X-Fern-Runtime-Version":qn.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:l,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(c.ok)return{data:Uk.OAuthAuthorizeResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new lr.BadRequestError(c.error.body,c.rawResponse);case 401:throw new lr.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new lr.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new lr.NotFoundError(c.error.body,c.rawResponse);case 422:throw new lr.UnprocessableEntityError(c.error.body,c.rawResponse);case 429:throw new lr.TooManyRequestsError(c.error.body,c.rawResponse);case 498:throw new lr.InvalidTokenError(c.error.body,c.rawResponse);case 499:throw new lr.ClientClosedRequestError(c.error.body,c.rawResponse);case 500:throw new lr.InternalServerError(c.error.body,c.rawResponse);case 501:throw new lr.NotImplementedError(c.error.body,c.rawResponse);case 503:throw new lr.ServiceUnavailableError(c.error.body,c.rawResponse);case 504:throw new lr.GatewayTimeoutError(c.error.body,c.rawResponse);default:throw new El.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new El.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new El.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize.");case"unknown":throw new El.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return hV(this,void 0,void 0,function*(){var e;let r=(e=yield qn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new El.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};ov.Connectors=Yet});var Qcr=S(iv=>{"use strict";var xio=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]}),Tio=iv&&iv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yie=iv&&iv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xio(r,e,n[o]);return Tio(r,e),r}}(),Qet=iv&&iv.__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())})},Oio=iv&&iv.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(iv,"__esModule",{value:!0});iv.Models=void 0;var Zcr=yie(lD()),Gg=yie(se()),Zl=yie(D1()),Ycr=Oio(kk()),ett=yie(uD()),cD=yie(kc()),ttt=class{constructor(e={}){this._options=e}get(e,r){return Gg.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return Qet(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gg.fetcher)({url:(0,Ycr.default)((i=(o=yield Gg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Zcr.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gg.Supplier.get(this._options.clientName))!=null?yield Gg.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Gg.RUNTIME.type,"X-Fern-Runtime-Version":Gg.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:ett.GetModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Zl.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Zl.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Zl.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Zl.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Zl.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Zl.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Zl.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Zl.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Zl.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Zl.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Zl.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Zl.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new cD.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new cD.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new cD.CohereTimeoutError("Timeout exceeded when calling GET /v1/models/{model}.");case"unknown":throw new cD.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}list(e={},r){return Gg.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return Qet(this,arguments,void 0,function*(e={},r){var n,o,i;let{pageSize:a,pageToken:s,endpoint:u,defaultOnly:l}=e,c={};a!=null&&(c.page_size=a.toString()),s!=null&&(c.page_token=s),u!=null&&(c.endpoint=ett.CompatibleEndpoint.jsonOrThrow(u,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),l!=null&&(c.default_only=l.toString());let d=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gg.fetcher)({url:(0,Ycr.default)((i=(o=yield Gg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Zcr.CohereEnvironment.Production,"v1/models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gg.Supplier.get(this._options.clientName))!=null?yield Gg.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Gg.RUNTIME.type,"X-Fern-Runtime-Version":Gg.RUNTIME.version},r?.headers),contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(d.ok)return{data:ett.ListModelsResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new Zl.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Zl.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Zl.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Zl.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Zl.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Zl.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Zl.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Zl.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Zl.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Zl.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Zl.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Zl.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new cD.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new cD.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new cD.CohereTimeoutError("Timeout exceeded when calling GET /v1/models.");case"unknown":throw new cD.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return Qet(this,void 0,void 0,function*(){var e;let r=(e=yield Gg.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new cD.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};iv.Models=ttt});var edr=S(av=>{"use strict";var Eio=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]}),Pio=av&&av.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bie=av&&av.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Eio(r,e,n[o]);return Pio(r,e),r}}(),Bk=av&&av.__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())})},Mio=av&&av.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(av,"__esModule",{value:!0});av.Finetuning=void 0;var gV=bie(lD()),Jr=bie(se()),Zo=bie(D1()),yV=Mio(kk()),dD=bie(uD()),lu=bie(kc()),rtt=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){return Jr.HttpResponsePromise.fromPromise(this.__listFinetunedModels(e,r))}__listFinetunedModels(){return Bk(this,arguments,void 0,function*(e={},r){var n,o,i;let{pageSize:a,pageToken:s,orderBy:u}=e,l={};a!=null&&(l.page_size=a.toString()),s!=null&&(l.page_token=s),u!=null&&(l.order_by=u);let c=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jr.fetcher)({url:(0,yV.default)((i=(o=yield Jr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Jr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gV.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},r?.headers),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{data:dD.finetuning.ListFinetunedModelsResponse.parseOrThrow(c.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new Zo.BadRequestError(c.error.body,c.rawResponse);case 401:throw new Zo.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new Zo.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new Zo.NotFoundError(c.error.body,c.rawResponse);case 500:throw new Zo.InternalServerError(c.error.body,c.rawResponse);case 503:throw new Zo.ServiceUnavailableError(c.error.body,c.rawResponse);default:throw new lu.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new lu.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models.");case"unknown":throw new lu.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}createFinetunedModel(e,r){return Jr.HttpResponsePromise.fromPromise(this.__createFinetunedModel(e,r))}__createFinetunedModel(e,r){return Bk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jr.fetcher)({url:(0,yV.default)((i=(o=yield Jr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Jr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gV.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:dD.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(a.ok)return{data:dD.finetuning.CreateFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Zo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Zo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Zo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Zo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Zo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Zo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling POST /v1/finetuning/finetuned-models.");case"unknown":throw new lu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}getFinetunedModel(e,r){return Jr.HttpResponsePromise.fromPromise(this.__getFinetunedModel(e,r))}__getFinetunedModel(e,r){return Bk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jr.fetcher)({url:(0,yV.default)((i=(o=yield Jr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Jr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:dD.finetuning.GetFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Zo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Zo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Zo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Zo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Zo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Zo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new lu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}deleteFinetunedModel(e,r){return Jr.HttpResponsePromise.fromPromise(this.__deleteFinetunedModel(e,r))}__deleteFinetunedModel(e,r){return Bk(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Jr.fetcher)({url:(0,yV.default)((i=(o=yield Jr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Jr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:gV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:dD.finetuning.DeleteFinetunedModelResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Zo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Zo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Zo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Zo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Zo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Zo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new lu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new lu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}updateFinetunedModel(e,r,n){return Jr.HttpResponsePromise.fromPromise(this.__updateFinetunedModel(e,r,n))}__updateFinetunedModel(e,r,n){return Bk(this,void 0,void 0,function*(){var o,i,a;let s=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Jr.fetcher)({url:(0,yV.default)((a=(i=yield Jr.Supplier.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Jr.Supplier.get(this._options.environment))!==null&&a!==void 0?a:gV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},n?.headers),contentType:"application/json",requestType:"json",body:dD.FinetuningUpdateFinetunedModelRequest.jsonOrThrow(r,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:3e5,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(s.ok)return{data:dD.finetuning.UpdateFinetunedModelResponse.parseOrThrow(s.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new Zo.BadRequestError(s.error.body,s.rawResponse);case 401:throw new Zo.UnauthorizedError(s.error.body,s.rawResponse);case 403:throw new Zo.ForbiddenError(s.error.body,s.rawResponse);case 404:throw new Zo.NotFoundError(s.error.body,s.rawResponse);case 500:throw new Zo.InternalServerError(s.error.body,s.rawResponse);case 503:throw new Zo.ServiceUnavailableError(s.error.body,s.rawResponse);default:throw new lu.CohereError({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new lu.CohereError({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new lu.CohereError({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}listEvents(e,r={},n){return Jr.HttpResponsePromise.fromPromise(this.__listEvents(e,r,n))}__listEvents(e){return Bk(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{pageSize:u,pageToken:l,orderBy:c}=n,d={};u!=null&&(d.page_size=u.toString()),l!=null&&(d.page_token=l),c!=null&&(d.order_by=c);let f=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Jr.fetcher)({url:(0,yV.default)((s=(a=yield Jr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Jr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:gV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/events`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:d,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(f.ok)return{data:dD.finetuning.ListEventsResponse.parseOrThrow(f.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new Zo.BadRequestError(f.error.body,f.rawResponse);case 401:throw new Zo.UnauthorizedError(f.error.body,f.rawResponse);case 403:throw new Zo.ForbiddenError(f.error.body,f.rawResponse);case 404:throw new Zo.NotFoundError(f.error.body,f.rawResponse);case 500:throw new Zo.InternalServerError(f.error.body,f.rawResponse);case 503:throw new Zo.ServiceUnavailableError(f.error.body,f.rawResponse);default:throw new lu.CohereError({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new lu.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events.");case"unknown":throw new lu.CohereError({message:f.error.errorMessage,rawResponse:f.rawResponse})}})}listTrainingStepMetrics(e,r={},n){return Jr.HttpResponsePromise.fromPromise(this.__listTrainingStepMetrics(e,r,n))}__listTrainingStepMetrics(e){return Bk(this,arguments,void 0,function*(r,n={},o){var i,a,s;let{pageSize:u,pageToken:l}=n,c={};u!=null&&(c.page_size=u.toString()),l!=null&&(c.page_token=l);let d=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Jr.fetcher)({url:(0,yV.default)((s=(a=yield Jr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Jr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:gV.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/training-step-metrics`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Jr.Supplier.get(this._options.clientName))!=null?yield Jr.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":Jr.RUNTIME.type,"X-Fern-Runtime-Version":Jr.RUNTIME.version},o?.headers),contentType:"application/json",queryParameters:c,requestType:"json",timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:3e5,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(d.ok)return{data:dD.finetuning.ListTrainingStepMetricsResponse.parseOrThrow(d.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new Zo.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Zo.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Zo.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Zo.NotFoundError(d.error.body,d.rawResponse);case 500:throw new Zo.InternalServerError(d.error.body,d.rawResponse);case 503:throw new Zo.ServiceUnavailableError(d.error.body,d.rawResponse);default:throw new lu.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new lu.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new lu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics.");case"unknown":throw new lu.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return Bk(this,void 0,void 0,function*(){var e;let r=(e=yield Jr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new lu.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};av.Finetuning=rtt});var Vxe=S(rb=>{"use strict";var Rio=rb&&rb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Iio=rb&&rb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_ie=rb&&rb.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rio(r,e,n[o]);return Iio(r,e),r}}(),sv=rb&&rb.__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())})},tdr=rb&&rb.__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},Aio=rb&&rb.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rb,"__esModule",{value:!0});rb.CohereClient=void 0;var Ex=_ie(lD()),ft=_ie(se()),Ne=_ie(D1()),pd=_ie(uD()),Px=Aio(kk()),Do=_ie(kc()),Nio=Get(),Dio=Kcr(),jio=Gcr(),$io=Xcr(),Lio=Qcr(),Fio=edr(),ntt=class{constructor(e={}){this._options=e}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new Nio.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new Dio.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new jio.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new $io.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new Lio.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new Fio.Finetuning(this._options)}chatStream(e,r){return ft.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=tdr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pd.ChatStreamRequest.jsonOrThrow(s,{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(u.ok)return{data:new ft.Stream({stream:u.body,parse:l=>sv(this,void 0,void 0,function*(){return pd.StreamedChatResponse.parseOrThrow(l,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
|
||
`}}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new Ne.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Ne.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Ne.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Ne.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Ne.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Ne.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Ne.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Ne.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Ne.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Ne.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Ne.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Ne.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Do.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Do.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Do.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}chat(e,r){return ft.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=tdr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pd.ChatRequest.jsonOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0})),{stream:!1}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:pd.NonStreamedChatResponse.parseOrThrow(u.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 400:throw new Ne.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Ne.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Ne.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Ne.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Ne.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Ne.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Ne.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Ne.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Ne.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Ne.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Ne.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Ne.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Do.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Do.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Do.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}generateStream(e,r){return ft.HttpResponsePromise.fromPromise(this.__generateStream(e,r))}__generateStream(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pd.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(a.ok)return{data:new ft.Stream({stream:a.body,parse:s=>sv(this,void 0,void 0,function*(){return pd.GenerateStreamedResponse.parseOrThrow(s,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]})}),signal:r?.abortSignal,eventShape:{type:"json",messageTerminator:`
|
||
`}}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}generate(e,r){return ft.HttpResponsePromise.fromPromise(this.__generate(e,r))}__generate(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},pd.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(a.ok)return{data:pd.Generation.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e={},r){return ft.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(){return sv(this,arguments,void 0,function*(e={},r){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.EmbedRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.EmbedResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return ft.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.RerankRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.RerankResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/rerank.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}classify(e,r){return ft.HttpResponsePromise.fromPromise(this.__classify(e,r))}__classify(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.ClassifyRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.ClassifyResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/classify.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}summarize(e,r){return ft.HttpResponsePromise.fromPromise(this.__summarize(e,r))}__summarize(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.SummarizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.SummarizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/summarize.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}tokenize(e,r){return ft.HttpResponsePromise.fromPromise(this.__tokenize(e,r))}__tokenize(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.TokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.TokenizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/tokenize.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}detokenize(e,r){return ft.HttpResponsePromise.fromPromise(this.__detokenize(e,r))}__detokenize(e,r){return sv(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ft.fetcher)({url:(0,Px.default)((i=(o=yield ft.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ft.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Ex.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:pd.DetokenizeRequest.jsonOrThrow(e,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:3e5,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(a.ok)return{data:pd.DetokenizeResponse.parseOrThrow(a.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:a.rawResponse};if(a.error.reason==="status-code")switch(a.error.statusCode){case 400:throw new Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Do.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/detokenize.");case"unknown":throw new Do.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}checkApiKey(e){return ft.HttpResponsePromise.fromPromise(this.__checkApiKey(e))}__checkApiKey(e){return sv(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:ft.fetcher)({url:(0,Px.default)((o=(n=yield ft.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield ft.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Ex.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ft.Supplier.get(this._options.clientName))!=null?yield ft.Supplier.get(this._options.clientName):void 0,"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"cohere-ai","X-Fern-SDK-Version":"7.19.0","User-Agent":"cohere-ai/7.19.0","X-Fern-Runtime":ft.RUNTIME.type,"X-Fern-Runtime-Version":ft.RUNTIME.version},e?.headers),contentType:"application/json",requestType:"json",timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:3e5,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(i.ok)return{data:pd.CheckApiKeyResponse.parseOrThrow(i.body,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]}),rawResponse:i.rawResponse};if(i.error.reason==="status-code")switch(i.error.statusCode){case 400:throw new Ne.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Ne.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Ne.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Ne.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Ne.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Ne.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Ne.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Ne.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Ne.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Ne.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Ne.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Ne.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Do.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Do.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Do.CohereTimeoutError("Timeout exceeded when calling POST /v1/check-api-key.");case"unknown":throw new Do.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}_getAuthorizationHeader(){return sv(this,void 0,void 0,function*(){var e;let r=(e=yield ft.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Do.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};rb.CohereClient=ntt});var itt=S(Hxe=>{"use strict";Object.defineProperty(Hxe,"__esModule",{value:!0});Hxe.CohereClientV2=void 0;var kio=Get(),qio=Vxe(),ott=class{constructor(e){this._options=e,this.client=new qio.CohereClient(this._options),this.clientV2=new kio.V2(this._options),this.chat=this.clientV2.chat.bind(this.clientV2),this.chatStream=this.clientV2.chatStream.bind(this.clientV2),this.embed=this.clientV2.embed.bind(this.clientV2),this.rerank=this.clientV2.rerank.bind(this.clientV2),this.generateStream=this.client.generateStream.bind(this.clientV2),this.generate=this.client.generate.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}};Hxe.CohereClientV2=ott});var utt=S(j8=>{"use strict";Object.defineProperty(j8,"__esModule",{value:!0});j8.AwsClientV2=j8.AwsClient=void 0;var Uio=Vxe(),Bio=itt(),att=class extends Uio.CohereClient{constructor(e){e.token="n/a",super(e)}};j8.AwsClient=att;var stt=class extends Bio.CohereClientV2{constructor(e){e.token="n/a",super(e)}};j8.AwsClientV2=stt});var odr=S($8=>{"use strict";Object.defineProperty($8,"__esModule",{value:!0});$8.BedrockClientV2=$8.BedrockClient=void 0;var rdr=Jet(),ndr=utt(),ltt=class extends ndr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rdr.fetchOverride)("bedrock",e)}))}};$8.BedrockClient=ltt;var ctt=class extends ndr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rdr.fetchOverride)("bedrock",e)}))}};$8.BedrockClientV2=ctt});var idr=S(Wxe=>{"use strict";Object.defineProperty(Wxe,"__esModule",{value:!0});Wxe.CustomClient=void 0;var zio=Vxe(),dtt=class extends zio.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}};Wxe.CustomClient=dtt});var udr=S(L8=>{"use strict";Object.defineProperty(L8,"__esModule",{value:!0});L8.SagemakerClientV2=L8.SagemakerClient=void 0;var adr=utt(),sdr=Jet(),ftt=class extends adr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,sdr.fetchOverride)("sagemaker",e)}))}};L8.SagemakerClient=ftt;var ptt=class extends adr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,sdr.fetchOverride)("sagemaker",e)}))}};L8.SagemakerClientV2=ptt});var fdr=S(bu=>{"use strict";var Vio=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]}),Hio=bu&&bu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wio=bu&&bu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vio(r,e,n[o]);return Hio(r,e),r}}();Object.defineProperty(bu,"__esModule",{value:!0});bu.SagemakerClientV2=bu.SagemakerClient=bu.CohereTimeoutError=bu.CohereError=bu.CohereEnvironment=bu.CohereClient=bu.CohereClientV2=bu.BedrockClientV2=bu.BedrockClient=bu.Cohere=void 0;bu.Cohere=Wio(D1());var ldr=odr();Object.defineProperty(bu,"BedrockClient",{enumerable:!0,get:function(){return ldr.BedrockClient}});Object.defineProperty(bu,"BedrockClientV2",{enumerable:!0,get:function(){return ldr.BedrockClientV2}});var Jio=itt();Object.defineProperty(bu,"CohereClientV2",{enumerable:!0,get:function(){return Jio.CohereClientV2}});var Kio=idr();Object.defineProperty(bu,"CohereClient",{enumerable:!0,get:function(){return Kio.CustomClient}});var Gio=lD();Object.defineProperty(bu,"CohereEnvironment",{enumerable:!0,get:function(){return Gio.CohereEnvironment}});var cdr=kc();Object.defineProperty(bu,"CohereError",{enumerable:!0,get:function(){return cdr.CohereError}});Object.defineProperty(bu,"CohereTimeoutError",{enumerable:!0,get:function(){return cdr.CohereTimeoutError}});var ddr=udr();Object.defineProperty(bu,"SagemakerClient",{enumerable:!0,get:function(){return ddr.SagemakerClient}});Object.defineProperty(bu,"SagemakerClientV2",{enumerable:!0,get:function(){return ddr.SagemakerClientV2}})});function F8(t){if(t?.client)return t.client;let e=t?.apiKey??Xr("COHERE_API_KEY");if(!e)throw new Error("COHERE_API_KEY must be set");return new pdr.CohereClient({token:e})}var pdr,vie=v(()=>{pdr=$(fdr(),1);au()});function Rx(t,e){e?(Vh[0]=Vh[16]=Vh[1]=Vh[2]=Vh[3]=Vh[4]=Vh[5]=Vh[6]=Vh[7]=Vh[8]=Vh[9]=Vh[10]=Vh[11]=Vh[12]=Vh[13]=Vh[14]=Vh[15]=0,this.blocks=Vh):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}var Pr,Xio,Mx,Jxe,Vh,Kxe,mtt=v(()=>{Pr="0123456789abcdef".split(""),Xio=[-2147483648,8388608,32768,128],Mx=[24,16,8,0],Jxe=[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],Vh=[];Rx.prototype.update=function(t){if(!this.finalized){var e,r=typeof t;if(r!=="string"){if(r==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);e=!0}for(var n,o=0,i,a=t.length,s=this.blocks;o<a;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)for(i=this.start;o<a&&i<64;++o)s[i>>>2]|=t[o]<<Mx[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<Mx[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<Mx[i++&3],s[i>>>2]|=(128|n&63)<<Mx[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<Mx[i++&3],s[i>>>2]|=(128|n>>>6&63)<<Mx[i++&3],s[i>>>2]|=(128|n&63)<<Mx[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<Mx[i++&3],s[i>>>2]|=(128|n>>>12&63)<<Mx[i++&3],s[i>>>2]|=(128|n>>>6&63)<<Mx[i++&3],s[i>>>2]|=(128|n&63)<<Mx[i++&3]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}};Rx.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=Xio[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()}};Rx.prototype.hash=function(){var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=this.blocks,l,c,d,f,p,m,h,y,g,b,_;for(l=16;l<64;++l)p=u[l-15],c=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=u[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,u[l]=u[l-16]+c+u[l-7]+d<<0;for(_=e&r,l=0;l<64;l+=4)this.first?(this.is224?(y=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(y=704751109,p=u[0]-210244248,s=p-1521486534<<0,n=p+143694565<<0),this.first=!1):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),y=t&e,f=y^t&r^_,h=o&i^~o&a,p=s+d+h+Jxe[l]+u[l],m=c+f,s=n+p<<0,n=p+m<<0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),g=n&t,f=g^n&e^y,h=a&s^~a&o,p=i+d+h+Jxe[l+1]+u[l+1],m=c+f,a=r+p<<0,r=p+m<<0,c=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),b=r&n,f=b^r&t^g,h=i&a^~i&s,p=o+d+h+Jxe[l+2]+u[l+2],m=c+f,i=e+p<<0,e=p+m<<0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_=e&r,f=_^e&n^b,h=i&a^~i&s,p=o+d+h+Jxe[l+3]+u[l+3],m=c+f,o=t+p<<0,t=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+r<<0,this.h3=this.h3+n<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+a<<0,this.h7=this.h7+s<<0};Rx.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=Pr[t>>>28&15]+Pr[t>>>24&15]+Pr[t>>>20&15]+Pr[t>>>16&15]+Pr[t>>>12&15]+Pr[t>>>8&15]+Pr[t>>>4&15]+Pr[t&15]+Pr[e>>>28&15]+Pr[e>>>24&15]+Pr[e>>>20&15]+Pr[e>>>16&15]+Pr[e>>>12&15]+Pr[e>>>8&15]+Pr[e>>>4&15]+Pr[e&15]+Pr[r>>>28&15]+Pr[r>>>24&15]+Pr[r>>>20&15]+Pr[r>>>16&15]+Pr[r>>>12&15]+Pr[r>>>8&15]+Pr[r>>>4&15]+Pr[r&15]+Pr[n>>>28&15]+Pr[n>>>24&15]+Pr[n>>>20&15]+Pr[n>>>16&15]+Pr[n>>>12&15]+Pr[n>>>8&15]+Pr[n>>>4&15]+Pr[n&15]+Pr[o>>>28&15]+Pr[o>>>24&15]+Pr[o>>>20&15]+Pr[o>>>16&15]+Pr[o>>>12&15]+Pr[o>>>8&15]+Pr[o>>>4&15]+Pr[o&15]+Pr[i>>>28&15]+Pr[i>>>24&15]+Pr[i>>>20&15]+Pr[i>>>16&15]+Pr[i>>>12&15]+Pr[i>>>8&15]+Pr[i>>>4&15]+Pr[i&15]+Pr[a>>>28&15]+Pr[a>>>24&15]+Pr[a>>>20&15]+Pr[a>>>16&15]+Pr[a>>>12&15]+Pr[a>>>8&15]+Pr[a>>>4&15]+Pr[a&15];return this.is224||(u+=Pr[s>>>28&15]+Pr[s>>>24&15]+Pr[s>>>20&15]+Pr[s>>>16&15]+Pr[s>>>12&15]+Pr[s>>>8&15]+Pr[s>>>4&15]+Pr[s&15]),u};Rx.prototype.toString=Rx.prototype.hex;Rx.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,r=this.h2,n=this.h3,o=this.h4,i=this.h5,a=this.h6,s=this.h7,u=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255];return this.is224||u.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),u};Rx.prototype.array=Rx.prototype.digest;Rx.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};Kxe=(...t)=>new Rx(!1,!0).update(t.join("")).hex()});var Zio,mdr=v(()=>{Jo();mtt();Zio={};$t(Zio,{sha256:()=>Kxe})});function Qio(t){return t.message!==void 0?{text:t.text,message:VQ(t.message)}:{text:t.text}}function eao(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var Yio,hdr,gdr,tao,htt,bdr=v(()=>{Jo();UC();mtt();mdr();Yio={};$t(Yio,{BaseCache:()=>gdr,InMemoryCache:()=>htt,defaultHashKeyEncoder:()=>hdr,deserializeStoredGeneration:()=>Qio,serializeGeneration:()=>eao});hdr=(...t)=>Kxe(t.join("_"));gdr=class{constructor(){x(this,"keyEncoder",hdr)}makeDefaultKeyEncoder(t){this.keyEncoder=t}},tao=new Map,htt=class ydr extends gdr{constructor(r){super();x(this,"cache");this.cache=r??new Map}lookup(r,n){return Promise.resolve(this.cache.get(this.keyEncoder(r,n))??null)}async update(r,n,o){this.cache.set(this.keyEncoder(r,n),o)}static global(){return new ydr(tao)}}});function iao(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 aao(t,e){return t.length===1?[e.get(t.join(","))]:iao(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function sao(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function ytt(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 _dr,rao,nao,oao,gtt,Gxe,vdr=v(()=>{_dr=$(MWe(),1),rao=Object.defineProperty,nao=(t,e,r)=>e in t?rao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oao=(t,e,r)=>(nao(t,typeof e!="symbol"?e+"":e,r),r);gtt=class{constructor(t,e){x(this,"specialTokens");x(this,"inverseSpecialTokens");x(this,"patStr");x(this,"textEncoder",new TextEncoder);x(this,"textDecoder",new TextDecoder("utf-8"));x(this,"rankMap",new Map);x(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=_dr.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=gtt.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=gtt.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(...aao(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)}},Gxe=gtt;oao(Gxe,"specialTokenRegex",t=>new RegExp(t.map(e=>sao(e)).join("|"),"g"))});var wdr=v(()=>{vdr()});async function btt(t){return t in Xxe||(Xxe[t]=lao.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new Gxe(e)).catch(e=>{throw delete Xxe[t],e})),await Xxe[t]}async function Zxe(t){return btt(ytt(t))}var uao,Xxe,lao,_tt=v(()=>{Jo();Jz();wdr();uao={};$t(uao,{encodingForModel:()=>Zxe,getEncoding:()=>btt});Xxe={},lao=new ES({})});function Aw(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 cao,Yxe,dao,Sdr,Cdr,fao,k8,bV,Nw=v(()=>{Jo();UC();Jz();Pg();lte();bdr();_tt();cao={};$t(cao,{BaseLangChain:()=>k8,BaseLanguageModel:()=>bV,calculateMaxTokens:()=>Cdr,getEmbeddingContextSize:()=>dao,getModelContextSize:()=>Sdr,getModelNameForTiktoken:()=>Yxe,isOpenAITool:()=>Aw});Yxe=t=>t.startsWith("gpt-5")?"gpt-5":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,dao=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},Sdr=t=>{switch(Yxe(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};Cdr=async({prompt:t,modelName:e})=>{let r;try{r=(await Zxe(Yxe(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return Sdr(e)-r},fao=()=>!1,k8=class extends Go{constructor(e){super(e);x(this,"verbose");x(this,"callbacks");x(this,"tags");x(this,"metadata");this.verbose=e.verbose??fao(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}get lc_attributes(){return{callbacks:void 0,verbose:void 0}}},bV=class extends k8{constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i});x(this,"caller");x(this,"cache");x(this,"_encoding");typeof o=="object"?this.cache=o:o?this.cache=htt.global():this.cache=void 0,this.caller=new ES(n??{})}get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}async getNumTokens(e){let r;typeof e=="string"?r=e:r=e.map(o=>typeof o=="string"?o:o.type==="text"&&"text"in o?o.text:"").join("");let n=Math.ceil(r.length/4);if(!this._encoding)try{this._encoding=await Zxe("modelName"in this?Yxe(this.modelName):"gpt2")}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}if(this._encoding)try{n=this._encoding.encode(r).length}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}return n}static _convertInputToPromptValue(e){return typeof e=="string"?new ste(e):Array.isArray(e)?new ute(e.map(wS)):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")}get profile(){return{}}}});function wie(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function Sie(t){return t!==void 0&&Go.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Cie(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Ii(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 Xg(t){return Cie(t)||Sie(t)||wie(t)}var vtt=v(()=>{QN();Pg()});function xdr(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Ci(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function fD(t,e){let r=typeof e=="number"?void 0:e,n;return Xg(t)?n={type:"function",function:xdr(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var pao,pD=v(()=>{Jo();Ny();vtt();pao={};$t(pao,{convertToOpenAIFunction:()=>xdr,convertToOpenAITool:()=>fD,isLangChainTool:()=>Xg,isRunnableToolLike:()=>Sie,isStructuredTool:()=>wie,isStructuredToolParams:()=>Cie})});function Qxe(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var Tdr,Odr=v(()=>{Tdr=t=>t()});function wtt(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];(W6(i)||J6(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),Kpe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var mao,jd,hao,YI=v(()=>{Jo();LQ();Oy();UC();vS();au();GQ();WL();nO();Ed();QN();Ny();Pg();ta();Nw();Wge();Odr();mao={};$t(mao,{BaseChatModel:()=>jd,SimpleChatModel:()=>hao});jd=class _V extends bV{constructor(r){super(r);x(this,"lc_namespace",["langchain","chat_models",this._llmType()]);x(this,"disableStreaming",!1);x(this,"outputVersion");this.outputVersion=Tdr(()=>{let n=r.outputVersion??Xr("LC_OUTPUT_VERSION");return n&&["v0","v1"].includes(n)?n:"v0"})}get callKeys(){return[...super.callKeys,"outputVersion"]}_separateRunnableConfigFromCallOptionsCompat(r){let[n,o]=super._separateRunnableConfigFromCallOptions(r);return o.signal=n.signal,[n,o]}async invoke(r,n){let o=_V._convertInputToPromptValue(r);return(await this.generatePrompt([o],n,n?.callbacks)).generations[0][0].message}async*_streamResponseChunks(r,n,o){throw new Error("Not implemented.")}async*_streamIterator(r,n){if(this._streamResponseChunks===_V.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(r,n);else{let i=_V._convertInputToPromptValue(r).toChatMessages(),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(n),u={...a.metadata,...this.getLsParams(s)},l=await mc.configure(a.callbacks,this.callbacks,a.tags,this.tags,u,this.metadata,{verbose:this.verbose}),c={options:s,invocation_params:this?.invocationParams(s),batch_size:1},d=s.outputVersion??this.outputVersion,f=await l?.handleChatModelStart(this.toJSON(),[wtt(i)],a.runId,void 0,c,void 0,void 0,a.runName),p,m;try{for await(let h of this._streamResponseChunks(i,s,f?.[0])){if(h.message.id==null){let y=f?.at(0)?.runId;y!=null&&h.message._updateId(`run-${y}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata},d==="v1"?yield Qxe(h.message):yield h.message,p?p=p.concat(h):p=h,zQ(h.message)&&h.message.usage_metadata!==void 0&&(m={tokenUsage:{promptTokens:h.message.usage_metadata.input_tokens,completionTokens:h.message.usage_metadata.output_tokens,totalTokens:h.message.usage_metadata.total_tokens}})}}catch(h){throw await Promise.all((f??[]).map(y=>y?.handleLLMError(h))),h}await Promise.all((f??[]).map(h=>h?.handleLLMEnd({generations:[[p]],llmOutput:m})))}}getLsParams(r){let n=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:r.stop,ls_provider:n}}async _generateUncached(r,n,o,i){let a=r.map(p=>p.map(wS)),s;if(i!==void 0&&i.length===a.length)s=i;else{let p={...o.metadata,...this.getLsParams(n)},m=await mc.configure(o.callbacks,this.callbacks,o.tags,this.tags,p,this.metadata,{verbose:this.verbose}),h={options:n,invocation_params:this?.invocationParams(n),batch_size:1};s=await m?.handleChatModelStart(this.toJSON(),a.map(wtt),o.runId,void 0,h,void 0,void 0,o.runName)}let u=n.outputVersion??this.outputVersion,l=[],c=[];if(!!s?.[0].handlers.find(KQ)&&!this.disableStreaming&&a.length===1&&this._streamResponseChunks!==_V.prototype._streamResponseChunks)try{let p=await this._streamResponseChunks(a[0],n,s?.[0]),m,h;for await(let y of p){if(y.message.id==null){let g=s?.at(0)?.runId;g!=null&&y.message._updateId(`run-${g}`)}m===void 0?m=y:m=Lb(m,y),zQ(y.message)&&y.message.usage_metadata!==void 0&&(h={tokenUsage:{promptTokens:y.message.usage_metadata.input_tokens,completionTokens:y.message.usage_metadata.output_tokens,totalTokens:y.message.usage_metadata.total_tokens}})}if(m===void 0)throw new Error("Received empty response from chat model call.");l.push([m]),await s?.[0].handleLLMEnd({generations:l,llmOutput:h})}catch(p){throw await s?.[0].handleLLMError(p),p}else{let p=await Promise.allSettled(a.map(async(m,h)=>{let y=await this._generate(m,{...n,promptIndex:h},s?.[h]);if(u==="v1")for(let g of y.generations)g.message=Qxe(g.message);return y}));await Promise.all(p.map(async(m,h)=>{if(m.status==="fulfilled"){let y=m.value;for(let g of y.generations){if(g.message.id==null){let b=s?.at(0)?.runId;b!=null&&g.message._updateId(`run-${b}`)}g.message.response_metadata={...g.generationInfo,...g.message.response_metadata}}return y.generations.length===1&&(y.generations[0].message.response_metadata={...y.llmOutput,...y.generations[0].message.response_metadata}),l[h]=y.generations,c[h]=y.llmOutput,s?.[h]?.handleLLMEnd({generations:[y.generations],llmOutput:y.llmOutput})}else return await s?.[h]?.handleLLMError(m.reason),Promise.reject(m.reason)}))}let f={generations:l,llmOutput:c.length?this._combineLLMOutput?.(...c):void 0};return Object.defineProperty(f,JN,{value:s?{runIds:s?.map(p=>p.runId)}:void 0,configurable:!0}),f}async _generateCached({messages:r,cache:n,llmStringKey:o,parsedOptions:i,handledOptions:a}){let s=r.map(b=>b.map(wS)),u={...a.metadata,...this.getLsParams(i)},l=await mc.configure(a.callbacks,this.callbacks,a.tags,this.tags,u,this.metadata,{verbose:this.verbose}),c={options:i,invocation_params:this?.invocationParams(i),batch_size:1},d=await l?.handleChatModelStart(this.toJSON(),s.map(wtt),a.runId,void 0,c,void 0,void 0,a.runName),f=[],m=(await Promise.allSettled(s.map(async(b,_)=>{let w=_V._convertInputToPromptValue(b).toString(),T=await n.lookup(w,o);return T==null&&f.push(_),T}))).map((b,_)=>({result:b,runManager:d?.[_]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),h=i.outputVersion??this.outputVersion,y=[];await Promise.all(m.map(async({result:b,runManager:_},w)=>{if(b.status==="fulfilled"){let T=b.value;return y[w]=T.map(O=>("message"in O&&xg(O.message)&&kl(O.message)&&(O.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},h==="v1"&&(O.message=Qxe(O.message))),O.generationInfo={...O.generationInfo,tokenUsage:{}},O)),T.length&&await _?.handleLLMNewToken(T[0].text),_?.handleLLMEnd({generations:[T]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let g={generations:y,missingPromptIndices:f,startedRunManagers:d};return Object.defineProperty(g,JN,{value:d?{runIds:d?.map(b=>b.runId)}:void 0,configurable:!0}),g}async generate(r,n,o){let i;Array.isArray(n)?i={stop:n}:i=n;let a=r.map(h=>h.map(wS)),[s,u]=this._separateRunnableConfigFromCallOptionsCompat(i);if(s.callbacks=s.callbacks??o,!this.cache)return this._generateUncached(a,u,s);let{cache:l}=this,c=this._getSerializedCacheKeyParametersForCall(u),{generations:d,missingPromptIndices:f,startedRunManagers:p}=await this._generateCached({messages:a,cache:l,llmStringKey:c,parsedOptions:u,handledOptions:s}),m={};if(f.length>0){let h=await this._generateUncached(f.map(y=>a[y]),u,s,p!==void 0?f.map(y=>p?.[y]):void 0);await Promise.all(h.generations.map(async(y,g)=>{let b=f[g];d[b]=y;let _=_V._convertInputToPromptValue(a[b]).toString();return l.update(_,c,y)})),m=h.llmOutput??{}}return{generations:d,llmOutput:m}}invocationParams(r){return{}}_modelType(){return"base_chat_model"}async generatePrompt(r,n,o){let i=r.map(a=>a.toChatMessages());return this.generate(i,n,o)}withStructuredOutput(r,n){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(n?.strict)throw new Error('"strict" mode is not supported for this model by default.');let o=r,i=n?.name,a=nF(o)??"A function available to call.",s=n?.method,u=n?.includeRaw;if(s==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let l=i??"extract",c;Ii(o)?c=[{type:"function",function:{name:l,description:a,parameters:Ci(o)}}]:("name"in o&&(l=o.name),c=[{type:"function",function:{name:l,description:a,parameters:o}}]);let d=this.bindTools(c),f=D_.from(y=>{if(!Er.isInstance(y))throw new Error("Input is not an AIMessageChunk.");if(!y.tool_calls||y.tool_calls.length===0)throw new Error("No tool calls found in the response.");let g=y.tool_calls.find(b=>b.name===l);if(!g)throw new Error(`No tool call found with name ${l}.`);return g.args});if(!u)return d.pipe(f).withConfig({runName:"StructuredOutput"});let p=Au.assign({parsed:(y,g)=>f.invoke(y.raw,g)}),m=Au.assign({parsed:()=>null}),h=p.withFallbacks({fallbacks:[m]});return Bl.from([{raw:d},h]).withConfig({runName:"StructuredOutputRunnable"})}},hao=class extends jd{async _generate(t,e,r){let n=await this._call(t,e,r),o=new Pn(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}}});function Edr(t,e=0){return(Zg[t[e+0]]+Zg[t[e+1]]+Zg[t[e+2]]+Zg[t[e+3]]+"-"+Zg[t[e+4]]+Zg[t[e+5]]+"-"+Zg[t[e+6]]+Zg[t[e+7]]+"-"+Zg[t[e+8]]+Zg[t[e+9]]+"-"+Zg[t[e+10]]+Zg[t[e+11]]+Zg[t[e+12]]+Zg[t[e+13]]+Zg[t[e+14]]+Zg[t[e+15]]).toLowerCase()}var Zg,eTe,Pdr=v(()=>{Zg=[];for(eTe=0;eTe<256;++eTe)Zg.push((eTe+256).toString(16).slice(1))});function Stt(){if(!tTe&&(tTe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!tTe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tTe(gao)}var tTe,gao,Mdr=v(()=>{gao=new Uint8Array(16)});var yao,Ctt,Rdr=v(()=>{yao=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ctt={randomUUID:yao}});function bao(t,e,r){if(Ctt.randomUUID&&!e&&!t)return Ctt.randomUUID();t=t||{};var n=t.random||(t.rng||Stt)();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 Edr(n)}var xtt,Idr=v(()=>{Rdr();Mdr();Pdr();xtt=bao});var Adr=v(()=>{Idr()});var vao,uv=v(()=>{Jo();QN();vao={};$t(vao,{extendInteropZodObject:()=>wIt,getInteropZodDefaultGetter:()=>CIt,getInteropZodObjectShape:()=>hge,getSchemaDescription:()=>nF,interopParse:()=>bIt,interopParseAsync:()=>rF,interopSafeParse:()=>yIt,interopSafeParseAsync:()=>tF,interopZodObjectMakeFieldsOptional:()=>xIt,interopZodObjectPartial:()=>SIt,interopZodObjectPassthrough:()=>gge,interopZodObjectStrict:()=>bJ,interopZodTransformInputSchema:()=>bge,isInteropZodError:()=>_ge,isInteropZodLiteral:()=>gIt,isInteropZodObject:()=>vIt,isInteropZodSchema:()=>Ii,isShapelessZodSchema:()=>_It,isSimpleStringZodSchema:()=>_J,isZodArrayV4:()=>Yee,isZodLiteralV3:()=>IHe,isZodLiteralV4:()=>AHe,isZodNullableV4:()=>DHe,isZodObjectV3:()=>yge,isZodObjectV4:()=>MS,isZodOptionalV4:()=>NHe,isZodSchema:()=>hIt,isZodSchemaV3:()=>yc,isZodSchemaV4:()=>Iu})});function Ndr(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 rTe(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=>kl(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 wao(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Ddr(t){return t._getType()==="tool"}function jdr(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 Sao(t){if(t){if(t.every(wao))return t;if(t.every(Aw))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:jdr(e.function.parameters)}));if(t.every(Xg))return t.map(e=>{let r=Ii(e.schema)?Ci(e.schema):e.schema;return{name:e.name,description:e.description??"",parameterDefinitions:jdr(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var Ttt,$dr=v(()=>{vie();ta();Nw();pD();YI();Ed();Adr();uv();Ny();Ttt=class extends jd{constructor(e){super(e??{});x(this,"lc_serializable",!0);x(this,"client");x(this,"model","command-r-plus");x(this,"temperature",.3);x(this,"streaming",!1);x(this,"streamUsage",!0);this.client=F8(e),this.model=e?.model??this.model,this.temperature=e?.temperature??this.temperature,this.streaming=e?.streaming??this.streaming,this.streamUsage=e?.streamUsage??this.streamUsage}static lc_name(){return"ChatCohere"}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.withConfig({tools:Sao(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(!(kl(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=rTe(c,s);i.push(d),s=[]}}else i.push(rTe(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=rTe(c,s);i.push(d),s=[]}}else i.push(rTe(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(Ddr(o)){let i=o,a=n.filter(s=>kl(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:Ndr(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Ddr(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>kl(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:Ndr(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:xtt().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 Pn({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 si({text:a.text,message:new Er({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new si({text:"",message:new Er({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 si({text:"",message:new Er({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 Cao,Ott,nTe,Tie=v(()=>{Jo();GQ();WL();nO();Ed();Nw();Cao={};$t(Cao,{BaseLLM:()=>Ott,LLM:()=>nTe});Ott=class xie extends bV{constructor(){super(...arguments);x(this,"lc_namespace",["langchain","llms",this._llmType()])}async invoke(r,n){let o=xie._convertInputToPromptValue(r);return(await this.generatePrompt([o],n,n?.callbacks)).generations[0][0].text}async*_streamResponseChunks(r,n,o){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(r){let[n,o]=super._separateRunnableConfigFromCallOptions(r);return o.signal=n.signal,[n,o]}async*_streamIterator(r,n){if(this._streamResponseChunks===xie.prototype._streamResponseChunks)yield this.invoke(r,n);else{let o=xie._convertInputToPromptValue(r),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(n),s=await mc.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),u={options:a,invocation_params:this?.invocationParams(a),batch_size:1},l=await s?.handleLLMStart(this.toJSON(),[o.toString()],i.runId,void 0,u,void 0,void 0,i.runName),c=new OS({text:""});try{for await(let d of this._streamResponseChunks(o.toString(),a,l?.[0]))c?c=c.concat(d):c=d,typeof d.text=="string"&&(yield d.text)}catch(d){throw await Promise.all((l??[]).map(f=>f?.handleLLMError(d))),d}await Promise.all((l??[]).map(d=>d?.handleLLMEnd({generations:[[c]]})))}}async generatePrompt(r,n,o){let i=r.map(a=>a.toString());return this.generate(i,n,o)}invocationParams(r){return{}}_flattenLLMResult(r){let n=[];for(let o=0;o<r.generations.length;o+=1){let i=r.generations[o];if(o===0)n.push({generations:[i],llmOutput:r.llmOutput});else{let a=r.llmOutput?{...r.llmOutput,tokenUsage:{}}:void 0;n.push({generations:[i],llmOutput:a})}}return n}async _generateUncached(r,n,o,i){let a;if(i!==void 0&&i.length===r.length)a=i;else{let c=await mc.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),d={options:n,invocation_params:this?.invocationParams(n),batch_size:r.length};a=await c?.handleLLMStart(this.toJSON(),r,o.runId,void 0,d,void 0,void 0,o?.runName)}let s=!!a?.[0].handlers.find(KQ),u;if(s&&r.length===1&&this._streamResponseChunks!==xie.prototype._streamResponseChunks)try{let c=await this._streamResponseChunks(r[0],n,a?.[0]),d;for await(let f of c)d===void 0?d=f:d=Lb(d,f);if(d===void 0)throw new Error("Received empty response from chat model call.");u={generations:[[d]],llmOutput:{}},await a?.[0].handleLLMEnd(u)}catch(c){throw await a?.[0].handleLLMError(c),c}else{try{u=await this._generate(r,n,a?.[0])}catch(d){throw await Promise.all((a??[]).map(f=>f?.handleLLMError(d))),d}let c=this._flattenLLMResult(u);await Promise.all((a??[]).map((d,f)=>d?.handleLLMEnd(c[f])))}let l=a?.map(c=>c.runId)||void 0;return Object.defineProperty(u,JN,{value:l?{runIds:l}:void 0,configurable:!0}),u}async _generateCached({prompts:r,cache:n,llmStringKey:o,parsedOptions:i,handledOptions:a,runId:s}){let u=await mc.configure(a.callbacks,this.callbacks,a.tags,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),l={options:i,invocation_params:this?.invocationParams(i),batch_size:r.length},c=await u?.handleLLMStart(this.toJSON(),r,s,void 0,l,void 0,void 0,a?.runName),d=[],p=(await Promise.allSettled(r.map(async(y,g)=>{let b=await n.lookup(y,o);return b==null&&d.push(g),b}))).map((y,g)=>({result:y,runManager:c?.[g]})).filter(({result:y})=>y.status==="fulfilled"&&y.value!=null||y.status==="rejected"),m=[];await Promise.all(p.map(async({result:y,runManager:g},b)=>{if(y.status==="fulfilled"){let _=y.value;return m[b]=_.map(w=>(w.generationInfo={...w.generationInfo,tokenUsage:{}},w)),_.length&&await g?.handleLLMNewToken(_[0].text),g?.handleLLMEnd({generations:[_]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(y.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(y.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,JN,{value:c?{runIds:c?.map(y=>y.runId)}:void 0,configurable:!0}),h}async generate(r,n,o){if(!Array.isArray(r))throw new Error("Argument 'prompts' is expected to be a string[]");let i;Array.isArray(n)?i={stop:n}:i=n;let[a,s]=this._separateRunnableConfigFromCallOptionsCompat(i);if(a.callbacks=a.callbacks??o,!this.cache)return this._generateUncached(r,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({prompts:r,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a,runId:a.runId}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>r[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,y)=>{let g=d[y];return c[g]=h,u.update(r[g],l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},nTe=class extends Ott{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(a=>[{text:a}])))}}}});var Ldr=v(()=>{vie();Tie()});var xao,y0,vV=v(()=>{Jo();Jz();xao={};$t(xao,{Embeddings:()=>y0});y0=class{constructor(t){x(this,"caller");this.caller=new ES(t??{})}}});var Tao,b0,zk=v(()=>{Jo();Tao={};$t(Tao,{chunkArray:()=>b0});b0=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var Ett,Fdr=v(()=>{vie();vV();zk();Ett=class extends y0{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model");x(this,"batchSize",48);x(this,"embeddingTypes",["float"]);x(this,"client");if(this.client=F8(r),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=b0(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 Oao,kdr,qdr=v(()=>{Jo();Oao={};$t(Oao,{BaseDocumentCompressor:()=>kdr});kdr=class{static isBaseDocumentCompressor(t){return t?.compressDocuments!==void 0}}});var Udr=v(()=>{vie();qdr()});var Ptt=v(()=>{$dr();Ldr();Fdr();Udr()});function mD(t){if(typeof t=="object"&&t!==null){let e={...t};"additionalProperties"in e&&delete e.additionalProperties,"$schema"in e&&delete e.$schema,"strict"in e&&delete e.strict;for(let r in e)r in e&&(Array.isArray(e[r])?e[r]=e[r].map(mD):typeof e[r]=="object"&&e[r]!==null&&(e[r]=mD(e[r])));return e}return t}function Oie(t){let e=mD(Ii(t)?Ci(t):t),{$schema:r,...n}=e;return n}function Bdr(t){let e=mD(t),{$schema:r,...n}=e;return n}var oTe=v(()=>{uv();Ny()});function zdr(t,e=0){return(Yg[t[e+0]]+Yg[t[e+1]]+Yg[t[e+2]]+Yg[t[e+3]]+"-"+Yg[t[e+4]]+Yg[t[e+5]]+"-"+Yg[t[e+6]]+Yg[t[e+7]]+"-"+Yg[t[e+8]]+Yg[t[e+9]]+"-"+Yg[t[e+10]]+Yg[t[e+11]]+Yg[t[e+12]]+Yg[t[e+13]]+Yg[t[e+14]]+Yg[t[e+15]]).toLowerCase()}var Yg,Vdr=v(()=>{Yg=[];for(let t=0;t<256;++t)Yg.push((t+256).toString(16).slice(1))});function Rtt(){if(!Mtt){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Mtt=crypto.getRandomValues.bind(crypto)}return Mtt(Eao)}var Mtt,Eao,Hdr=v(()=>{Eao=new Uint8Array(16)});var Pao,Itt,Wdr=v(()=>{Pao=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Itt={randomUUID:Pao}});function Mao(t,e,r){if(Itt.randomUUID&&!e&&!t)return Itt.randomUUID();t=t||{};let n=t.random??t.rng?.()??Rtt();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)e[r+o]=n[o];return e}return zdr(n)}var iTe,Jdr=v(()=>{Wdr();Hdr();Vdr();iTe=Mao});var Kdr=v(()=>{Jdr()});function Aao(t){let e=t._getType();return Td.isInstance(t)?t.role:e==="tool"?e:t.name??e}function Nao(t){switch(t){case"supervisor":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 Dao(t){if("mimeType"in t&&"data"in t)return{inlineData:{mimeType:t.mimeType,data:t.data}};if("mimeType"in t&&"fileUri"in t)return{fileData:{mimeType:t.mimeType,fileUri:t.fileUri}};throw new Error("Invalid media content")}function jao(t,e){return e.map(r=>kl(r)?r.tool_calls??[]:[]).flat().find(r=>r.id===t.tool_call_id)?.name}function $ao(t){return{providerName:"Google Gemini",fromStandardTextBlock(r){return{text:r.text}},fromStandardImageBlock(r){if(!t)throw new Error("This model does not support images");if(r.source_type==="url"){let n=Cy({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)},fromStandardAudioBlock(r){if(!t)throw new Error("This model does not support audio");if(r.source_type==="url"){let n=Cy({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)},fromStandardFileBlock(r){if(!t)throw new Error("This model does not support files");if(r.source_type==="text")return{text:r.text};if(r.source_type==="url"){let n=Cy({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)}}}function Gdr(t,e){if(Ph(t))return GT(t,$ao(e));if(t.type==="text")return{text:t.text};if(t.type==="executableCode")return{executableCode:t.executableCode};if(t.type==="codeExecutionResult")return{codeExecutionResult:t.codeExecutionResult};if(t.type==="image_url"){if(!e)throw new Error("This model does not support images");let r;if(typeof t.image_url=="string")r=t.image_url;else if(typeof t.image_url=="object"&&"url"in t.image_url)r=t.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[n,o]=r.split(",");if(!n.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[i,a]=n.replace(/^data:/,"").split(";");if(a!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:o,mimeType:i}}}else{if(t.type==="media")return Dao(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};if(t.type?.includes("/")&&t.type.split("/").length===2&&"data"in t&&typeof t.data=="string")return{inlineData:{mimeType:t.type,data:t.data}};if("functionCall"in t)return;throw"type"in t?new Error(`Unknown content type ${t.type}`):new Error(`Unknown content ${JSON.stringify(t)}`)}}function Lao(t,e,r,n){if(qQ(t)){let s=t.name??jao(t,r);if(s===void 0)throw new Error(`Google requires a tool name for each tool call response, and we could not infer a called tool name for ToolMessage "${t.id}" from your passed messages. Please populate a "name" field on that ToolMessage explicitly.`);let u=Array.isArray(t.content)?t.content.map(l=>Gdr(l,e)).filter(l=>l!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:s,response:{error:{details:u}}}}]:[{functionResponse:{name:s,response:{result:u}}}]}let o=[],i=[];typeof t.content=="string"&&t.content&&i.push({text:t.content}),Array.isArray(t.content)&&i.push(...t.content.map(s=>Gdr(s,e)).filter(s=>s!==void 0));let a=t.additional_kwargs?.[Att];return kl(t)&&t.tool_calls?.length&&(o=t.tool_calls.map(s=>{let u=Iao(()=>{if(s.id){let l=a?.[s.id];if(l)return l}return n?.includes("gemini-3")?Rao:""});return{functionCall:{name:s.name,args:s.args},...u?{thoughtSignature:u}:{}}})),[...i,...o]}function Ntt(t,e,r=!1,n){return t.reduce((o,i,a)=>{if(!xg(i))throw new Error("Unsupported message input");let s=Aao(i);if(s==="system"&&a!==0)throw new Error("System message should be the first one");let u=Nao(s),l=o.content[o.content.length];if(!o.mergeWithPreviousContent&&l&&l.role===u)throw new Error("Google Generative AI requires alternate messages between authors");let c=Lao(i,e,t.slice(0,a),n);if(o.mergeWithPreviousContent){let p=o.content[o.content.length-1];if(!p)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return p.parts.push(...c),{mergeWithPreviousContent:!1,content:o.content}}let d=u;(d==="function"||d==="system"&&!r)&&(d="user");let f={role:d,parts:c};return{mergeWithPreviousContent:s==="system"&&!r,content:[...o.content,f]}},{content:[],mergeWithPreviousContent:!1}).content}function Xdr(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let[r]=t.candidates,{content:n,...o}=r,i=n.parts.reduce((c,d)=>("functionCall"in d&&d.functionCall&&c.push({...d,id:"id"in d.functionCall&&typeof d.functionCall.id=="string"?d.functionCall.id:iTe()}),c),[]),a;Array.isArray(n?.parts)&&n.parts.length===1&&n.parts[0].text?a=n.parts[0].text:Array.isArray(n?.parts)&&n.parts.length>0?a=n.parts.map(c=>"text"in c?{type:"text",text:c.text}:"inlineData"in c?{type:"inlineData",inlineData:c.inlineData}:"functionCall"in c?{type:"functionCall",functionCall:c.functionCall}:"functionResponse"in c?{type:"functionResponse",functionResponse:c.functionResponse}:"fileData"in c?{type:"fileData",fileData:c.fileData}:"executableCode"in c?{type:"executableCode",executableCode:c.executableCode}:"codeExecutionResult"in c?{type:"codeExecutionResult",codeExecutionResult:c.codeExecutionResult}:c):a=[];let s=i?.reduce((c,d)=>("thoughtSignature"in d&&typeof d.thoughtSignature=="string"&&(c[d.id]=d.thoughtSignature),c),{}),u="";return typeof a=="string"?u=a:Array.isArray(a)&&a.length>0&&(u=a.find(d=>"text"in d)?.text??u),{generations:[{text:u,message:new Pn({content:a??"",tool_calls:i?.map(c=>({type:"tool_call",id:c.id,name:c.functionCall.name,args:c.functionCall.args})),additional_kwargs:{...o,[Att]:s},usage_metadata:e?.usageMetadata}),generationInfo:o}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function Zdr(t,e){if(!t.candidates||t.candidates.length===0)return null;let[r]=t.candidates,{content:n,...o}=r,i=n.parts.reduce((c,d)=>("functionCall"in d&&d.functionCall&&c.push({...d,id:"id"in d.functionCall&&typeof d.functionCall.id=="string"?d.functionCall.id:iTe()}),c),[]),a;Array.isArray(n?.parts)&&n.parts.every(c=>"text"in c)?a=n.parts.map(c=>c.text).join(""):Array.isArray(n?.parts)?a=n.parts.map(c=>"text"in c?{type:"text",text:c.text}:"inlineData"in c?{type:"inlineData",inlineData:c.inlineData}:"functionCall"in c?{type:"functionCall",functionCall:c.functionCall}:"functionResponse"in c?{type:"functionResponse",functionResponse:c.functionResponse}:"fileData"in c?{type:"fileData",fileData:c.fileData}:"executableCode"in c?{type:"executableCode",executableCode:c.executableCode}:"codeExecutionResult"in c?{type:"codeExecutionResult",codeExecutionResult:c.codeExecutionResult}:c):a=[];let s="";a&&typeof a=="string"?s=a:Array.isArray(a)&&(s=a.find(d=>"text"in d)?.text??"");let u=[];i&&u.push(...i.map(c=>({...c,args:JSON.stringify(c.functionCall.args),index:e.index,type:"tool_call_chunk"})));let l=i?.reduce((c,d)=>("thoughtSignature"in d&&typeof d.thoughtSignature=="string"&&(c[d.id]=d.thoughtSignature),c),{});return new si({text:s,message:new Er({content:a||"",name:n?n.role:void 0,tool_call_chunks:u,additional_kwargs:{[Att]:l},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:o})}function Ydr(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(Xg(e)){let r=Oie(e.schema);return r.type==="object"&&"properties"in r&&Object.keys(r.properties).length===0?{name:e.name,description:e.description}:{name:e.name,description:e.description,parameters:r}}return Aw(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:Bdr(e.function.parameters)}:e})}]}var Att,Rao,Iao,Dtt=v(()=>{oTe();ta();Ed();pD();Nw();Kdr();Att="__gemini_function_call_thought_signatures__",Rao="ErYCCrMCAdHtim9kOoOkrPiCNVsmlpMIKd7ZMxgiFbVQOkgp7nlLcDMzVsZwIzvuT7nQROivoXA72ccC2lSDvR0Gh7dkWaGuj7ctv6t7ZceHnecx0QYa+ix8tYpRfjhyWozQ49lWiws6+YGjCt10KRTyWsZ2h6O7iHTYJwKIRwGUHRKy/qK/6kFxJm5ML00gLq4D8s5Z6DBpp2ZlR+uF4G8jJgeWQgyHWVdx2wGYElaceVAc66tZdPQRdOHpWtgYSI1YdaXgVI8KHY3/EfNc2YqqMIulvkDBAnuMhkAjV9xmBa54Tq+ih3Im4+r3DzqhGqYdsSkhS0kZMwte4Hjs65dZzCw9lANxIqYi1DJ639WNPYihp/DCJCos7o+/EeSPJaio5sgWDyUnMGkY1atsJZ+m7pj7DD5tvQ==",Iao=t=>t()});var jtt,Qdr=v(()=>{uv();fO();jtt=class extends v4{constructor(e){super(e);x(this,"lc_namespace",["langchain","google_genai","output_parsers"]);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"GoogleGenerativeAIToolsOutputParser"}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await tF(this.zodSchema,e);if(r.success)return r.data;throw new Ih(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error.issues)}`,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 Bao(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${Uao}/${qao}`),e.join(" ")}async function zao(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",Bao(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 QI(`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 QI(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new QI(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function Vao(t,e,r,n,o,i){let a=new $tt(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},Kao(i)),{method:"POST",headers:await zao(a),body:o})}}async function Rie(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await Vao(t,e,r,n,o,i);return Hao(s,u,a)}async function Hao(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){Wao(o,t)}return n.ok||await Jao(n,t),n}function Wao(t,e){let r=t;throw r.name==="AbortError"?(r=new uTe(`Request aborted when fetching ${e.toString()}: ${t.message}`),r.stack=t.stack):t instanceof sTe||t instanceof QI||(r=new Hh(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function Jao(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 sTe(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function Kao(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 Ftt(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.`),aTe(t.candidates[0]))throw new Vk(`${Hk(t)}`,t);return Gao(t)}else if(t.promptFeedback)throw new Vk(`Text not available. ${Hk(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.`),aTe(t.candidates[0]))throw new Vk(`${Hk(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),ufr(t)[0]}else if(t.promptFeedback)throw new Vk(`Function call not available. ${Hk(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.`),aTe(t.candidates[0]))throw new Vk(`${Hk(t)}`,t);return ufr(t)}else if(t.promptFeedback)throw new Vk(`Function call not available. ${Hk(t)}`,t)},t}function Gao(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 ufr(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 aTe(t){return!!t.finishReason&&Xao.includes(t.finishReason)}function Hk(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];aTe(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function Pie(t){return this instanceof Pie?(this.v=t,this):new Pie(t)}function Zao(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 Pie?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 Yao(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=tso(e),[n,o]=r.tee();return{stream:eso(n),response:Qao(o)}}async function Qao(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return Ftt(rso(e));e.push(o)}}function eso(t){return Zao(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield Pie(r.read());if(o)break;yield yield Pie(Ftt(n))}})}function tso(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 Hh("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(lfr),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new Hh(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(lfr)}return i()}).catch(a=>{let s=a;throw s.stack=a.stack,s.name==="AbortError"?s=new uTe("Request aborted when reading from the stream"):s=new Hh("Error reading from the stream"),s})}}})}function rso(t){let e=t[t.length-1],r={promptFeedback:e?.promptFeedback};for(let n of t){if(n.candidates){let o=0;for(let i of n.candidates)if(r.candidates||(r.candidates=[]),r.candidates[o]||(r.candidates[o]={index:o}),r.candidates[o].citationMetadata=i.citationMetadata,r.candidates[o].groundingMetadata=i.groundingMetadata,r.candidates[o].finishReason=i.finishReason,r.candidates[o].finishMessage=i.finishMessage,r.candidates[o].safetyRatings=i.safetyRatings,i.content&&i.content.parts){r.candidates[o].content||(r.candidates[o].content={role:i.content.role||"user",parts:[]});let a={};for(let s of i.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[o].content.parts.push(a)}o++}n.usageMetadata&&(r.usageMetadata=n.usageMetadata)}return r}async function mfr(t,e,r,n){let o=await Rie(e,xV.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return Yao(o)}async function hfr(t,e,r,n){let i=await(await Rie(e,xV.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:Ftt(i)}}function gfr(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 Mie(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 nso(e)}function nso(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 Hh("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 Hh("No content is provided for sending chat message.");return n?e:r}function oso(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 QI("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=Mie(t);n.contents=[i]}return{generateContentRequest:n}}function cfr(t){let e;return t.contents?e=t:e={contents:[Mie(t)]},t.systemInstruction&&(e.systemInstruction=gfr(t.systemInstruction)),e}function iso(t){return typeof t=="string"||Array.isArray(t)?{content:Mie(t)}:t}function sso(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new Hh(`First content should be with role 'user', got ${n}`);if(!nfr.includes(n))throw new Hh(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(nfr)}`);if(!Array.isArray(o))throw new Hh("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Hh("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 dfr)u in s&&(i[u]+=1);let a=aso[n];for(let s of dfr)if(!a.includes(s)&&i[s]>0)throw new Hh(`Content with role '${n}' can't contain '${s}' part`);e=!0}}function ffr(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;let r=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(r===void 0||r.parts===void 0||r.parts.length===0)return!1;for(let n of r.parts)if(n===void 0||Object.keys(n).length===0||n.text!==void 0&&n.text==="")return!1;return!0}async function uso(t,e,r,n){return(await Rie(e,xV.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function lso(t,e,r,n){return(await Rie(e,xV.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function cso(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await Rie(e,xV.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var efr,tfr,rfr,nfr,wV,SV,ofr,ifr,Eie,afr,CV,sfr,Hh,Vk,sTe,QI,uTe,Fao,kao,qao,Uao,xV,$tt,Xao,lfr,dfr,aso,pfr,Ltt,lTe,TV,Iie=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(efr||(efr={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(tfr||(tfr={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(rfr||(rfr={}));nfr=["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",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(wV||(wV={}));(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"})(SV||(SV={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(ofr||(ofr={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(ifr||(ifr={}));(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.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(Eie||(Eie={}));(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"})(afr||(afr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(CV||(CV={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(sfr||(sfr={}));Hh=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},Vk=class extends Hh{constructor(e,r){super(e),this.response=r}},sTe=class extends Hh{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},QI=class extends Hh{},uTe=class extends Hh{};Fao="https://generativelanguage.googleapis.com",kao="v1beta",qao="0.24.1",Uao="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"})(xV||(xV={}));$tt=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)||kao,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||Fao}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};Xao=[Eie.RECITATION,Eie.SAFETY,Eie.LANGUAGE];lfr=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;dfr=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],aso={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};pfr="SILENT_ERROR",Ltt=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&&(sso(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=Mie(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(()=>hfr(this._apiKey,this.model,c,d)).then(p=>{var m;if(ffr(p.response)){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=Hk(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}).catch(p=>{throw this._sendPromise=Promise.resolve(),p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=Mie(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=mfr(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(pfr)}).then(p=>p.response).then(p=>{if(ffr(p)){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=Hk(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==pfr&&console.error(p)}),f}};lTe=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=gfr(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=cfr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return hfr(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=cfr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return mfr(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 Ltt(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=oso(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 uso(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=iso(e),o=Object.assign(Object.assign({},this._requestOptions),r);return lso(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return cso(this.apiKey,this.model,e,n)}};TV=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new Hh("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new lTe(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new QI("Cached content must contain a `name` field.");if(!e.model)throw new QI("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 QI(`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 lTe(this.apiKey,i,n)}}});function ktt(t,e){let r=dso(t),n=pso(r,e);return{tools:r,toolConfig:n}}function dso(t){let e=[],r=[];return t.forEach(o=>{if(Xg(o)){let[i]=Ydr([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Aw(o)){let{functionDeclarations:i}=fso(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 fso(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:mD(t.function.parameters)}]}}function pso(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:CV.ANY,auto:CV.AUTO,none:CV.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:CV.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var yfr=v(()=>{oTe();Dtt();Iie();pD();Nw()});var mso,bfr,_fr=v(()=>{mso={"gemini-embedding-001":{maxInputTokens:2048,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-image":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-preview-05-20":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-flash-lite-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-flash-latest":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-05-06":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.0-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash-preview-native-audio":{maxInputTokens:131072,imageInputs:!1,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.0-flash":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-lite":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-pro-preview-06-05":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-live-2.5-flash":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-lite-preview-06-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-image-preview":{maxInputTokens:32768,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!0,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-flash-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-2.5-flash-preview-04-17":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-pro-preview-tts":{maxInputTokens:8e3,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16e3,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!0,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"gemini-2.5-pro":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-flash":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-1.5-flash-8b":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemini-2.5-flash-lite-preview-09-2025":{maxInputTokens:1048576,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"gemini-1.5-pro":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!1,videoInputs:!0,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1}},bfr=mso});var qtt,vfr=v(()=>{oTe();Dtt();Qdr();yfr();_fr();Iie();au();YI();sw();uv();fO();qtt=class extends jd{constructor(e){super(e);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","google_genai"]);x(this,"model");x(this,"temperature");x(this,"maxOutputTokens");x(this,"topP");x(this,"topK");x(this,"stopSequences",[]);x(this,"safetySettings");x(this,"apiKey");x(this,"streaming",!1);x(this,"json");x(this,"streamUsage",!0);x(this,"convertSystemMessageToHumanContent");x(this,"client");if(this.model=e.model.replace(/^models\//,""),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>2))throw new Error("`temperature` must be in the range of [0.0,2.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??Xr("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.json=e.json,this.client=new TV(this.apiKey).getGenerativeModel({model:this.model,safetySettings:this.safetySettings,generationConfig:{stopSequences:this.stopSequences,maxOutputTokens:this.maxOutputTokens,temperature:this.temperature,topP:this.topP,topK:this.topK,...this.json?{responseMimeType:"application/json"}:{}}},{apiVersion:e.apiVersion,baseUrl:e.baseUrl}),this.streamUsage=e.streamUsage??this.streamUsage}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")||this.model.startsWith("gemma-3-")&&!this.model.startsWith("gemma-3-1b")||this.model.startsWith("gemini-3")}useCachedContent(e,r,n){this.apiKey&&(this.client=new TV(this.apiKey).getGenerativeModelFromCachedContent(e,r,n))}get useSystemInstruction(){return typeof this.convertSystemMessageToHumanContent=="boolean"?!this.convertSystemMessageToHumanContent:this.computeUseSystemInstruction}get computeUseSystemInstruction(){return this.model==="gemini-1.0-pro-001"||this.model.startsWith("gemini-pro-vision")||this.model.startsWith("gemini-1.0-pro-vision")?!1:this.model!=="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.withConfig({tools:ktt(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?ktt(e.tools,{toolChoice:e.tool_choice,allowedFunctionNames:e.allowedFunctionNames}):void 0;return e?.responseSchema?(this.client.generationConfig.responseSchema=e.responseSchema,this.client.generationConfig.responseMimeType="application/json"):(this.client.generationConfig.responseSchema=void 0,this.client.generationConfig.responseMimeType=this.json?"application/json":void 0),{...r?.tools?{tools:r.tools}:{},...r?.toolConfig?{toolConfig:r.toolConfig}:{}}}async _generate(e,r,n){let o=Ntt(e,this._isMultimodalModel,this.useSystemInstruction,this.model),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=Xdr(s.response,{usageMetadata:u});return l.generations?.length>0&&await n?.handleLLMNewToken(l.generations[0]?.text??""),l}async*_streamResponseChunks(e,r,n){let o=Ntt(e,this._isMultimodalModel,this.useSystemInstruction,this.model),i=o;if(o[0].role==="system"){let[m]=o;this.client.systemInstruction=m,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:m}=await this.client.generateContentStream(s);return m}),l,c=0,d=0,f=0,p=0;for await(let m of u){if("usageMetadata"in m&&m.usageMetadata!==void 0&&this.streamUsage!==!1&&r.streamUsage!==!1){l={input_tokens:m.usageMetadata.promptTokenCount??0,output_tokens:m.usageMetadata.candidatesTokenCount??0,total_tokens:m.usageMetadata.totalTokenCount??0};let y=m.usageMetadata.promptTokenCount??0;l.input_tokens=Math.max(0,y-c),c=y;let g=m.usageMetadata.candidatesTokenCount??0;l.output_tokens=Math.max(0,g-d),d=g;let b=m.usageMetadata.totalTokenCount??0;l.total_tokens=Math.max(0,b-f),f=b}let h=Zdr(m,{usageMetadata:l,index:p});p+=1,h&&(yield h,await n?.handleLLMNewToken(h.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}})}get profile(){return bfr[this.model]??{}}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let s,u;if(i==="functionCalling"){let f=o??"extract",p;if(Ii(n)){let m=Oie(n);p=[{functionDeclarations:[{name:f,description:m.description??"A function available to call.",parameters:m}]}],u=new jtt({returnSingle:!0,keyName:f,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,m.parameters=mD(n.parameters),f=n.name):m={name:f,description:n.description??"",parameters:mD(n)},p=[{functionDeclarations:[m]}],u=new jtt({returnSingle:!0,keyName:f})}s=this.bindTools(p).withConfig({allowedFunctionNames:[f]})}else{let f=Oie(n);s=this.withConfig({responseSchema:f}),u=new j_}if(!a)return s.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let l=Au.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Au.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Bl.from([{raw:s},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var Utt,wfr=v(()=>{Iie();au();vV();zk();Utt=class extends y0{constructor(e){super(e??{});x(this,"apiKey");x(this,"modelName","embedding-001");x(this,"model","embedding-001");x(this,"taskType");x(this,"title");x(this,"stripNewLines",!0);x(this,"maxBatchSize",100);x(this,"client");if(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??Xr("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 TV(this.apiKey).getGenerativeModel({model:this.model},{baseUrl:e?.baseUrl})}_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=b0(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 Btt=v(()=>{vfr();wfr()});function Sfr(t,e=0){return(Qg[t[e+0]]+Qg[t[e+1]]+Qg[t[e+2]]+Qg[t[e+3]]+"-"+Qg[t[e+4]]+Qg[t[e+5]]+"-"+Qg[t[e+6]]+Qg[t[e+7]]+"-"+Qg[t[e+8]]+Qg[t[e+9]]+"-"+Qg[t[e+10]]+Qg[t[e+11]]+Qg[t[e+12]]+Qg[t[e+13]]+Qg[t[e+14]]+Qg[t[e+15]]).toLowerCase()}var Qg,cTe,Cfr=v(()=>{Qg=[];for(cTe=0;cTe<256;++cTe)Qg.push((cTe+256).toString(16).slice(1))});function ztt(){if(!dTe&&(dTe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!dTe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return dTe(hso)}var dTe,hso,xfr=v(()=>{hso=new Uint8Array(16)});var gso,Vtt,Tfr=v(()=>{gso=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vtt={randomUUID:gso}});function yso(t,e,r){if(Vtt.randomUUID&&!e&&!t)return Vtt.randomUUID();t=t||{};var n=t.random||(t.rng||ztt)();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 Sfr(n)}var Htt,Ofr=v(()=>{Tfr();xfr();Cfr();Htt=yso});var Efr=v(()=>{Ofr()});function Mfr(t,e){return new Er({content:t.content??"",additional_kwargs:t.thinking&&t.thinking!==""?{reasoning_content:t.thinking}:{},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:Htt()})),response_metadata:{...e?.responseMetadata,model_provider:"ollama"},usage_metadata:e?.usageMetadata})}function Pfr(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function bso(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 _so(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:[Pfr(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[Pfr(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function vso(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 wso(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function Rfr(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return _so(e);if(e._getType()==="ai")return bso(e);if(e._getType()==="system")return vso(e);if(e._getType()==="tool")return wso(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var Ifr=v(()=>{ta();Efr()});function Sso(t){return t&&DataView.prototype.isPrototypeOf(t)}function q8(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 Jtt(t){return typeof t!="string"&&(t=String(t)),t}function Ktt(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return r_.iterable&&(e[Symbol.iterator]=function(){return e}),e}function zm(t){this.map={},t instanceof zm?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 Wtt(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function jfr(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Cso(t){var e=new FileReader,r=jfr(e);return e.readAsArrayBuffer(t),r}function xso(t){var e=new FileReader,r=jfr(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function Tso(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 Nfr(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function $fr(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:r_.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r_.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r_.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r_.arrayBuffer&&r_.blob&&Sso(t)?(this._bodyArrayBuffer=Nfr(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r_.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Dfr(t))?this._bodyArrayBuffer=Nfr(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):r_.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r_.blob&&(this.blob=function(){var t=Wtt(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=Wtt(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(r_.blob)return this.blob().then(Cso);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=Wtt(this);if(t)return t;if(this._bodyBlob)return xso(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Tso(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r_.formData&&(this.formData=function(){return this.text().then(Pso)}),this.json=function(){return this.text().then(JSON.parse)},this}function Eso(t){var e=t.toUpperCase();return Oso.indexOf(e)>-1?e:t}function EV(t,e){if(!(this instanceof EV))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 EV){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new zm(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 zm(e.headers)),this.method=Eso(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in ey){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 Pso(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 Mso(t){var e=new zm,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 eA(t,e){if(!(this instanceof eA))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 zm(e.headers),this.url=e.url||"",this._initBody(t)}function Lfr(t,e){return new Promise(function(r,n){var o=new EV(t,e);if(o.signal&&o.signal.aborted)return n(new OV("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:Mso(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 eA(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 OV("Aborted","AbortError"))},0)};function s(l){try{return l===""&&ey.location.href?ey.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&&(r_.blob?i.responseType="blob":r_.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof zm||ey.Headers&&e.headers instanceof ey.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(q8(l)),i.setRequestHeader(l,Jtt(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 ey,r_,Afr,Dfr,Oso,Rso,OV,Ffr=v(()=>{ey=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},r_={searchParams:"URLSearchParams"in ey,iterable:"Symbol"in ey&&"iterator"in Symbol,blob:"FileReader"in ey&&"Blob"in ey&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in ey,arrayBuffer:"ArrayBuffer"in ey};r_.arrayBuffer&&(Afr=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Dfr=ArrayBuffer.isView||function(t){return t&&Afr.indexOf(Object.prototype.toString.call(t))>-1});zm.prototype.append=function(t,e){t=q8(t),e=Jtt(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};zm.prototype.delete=function(t){delete this.map[q8(t)]};zm.prototype.get=function(t){return t=q8(t),this.has(t)?this.map[t]:null};zm.prototype.has=function(t){return this.map.hasOwnProperty(q8(t))};zm.prototype.set=function(t,e){this.map[q8(t)]=Jtt(e)};zm.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};zm.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),Ktt(t)};zm.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),Ktt(t)};zm.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),Ktt(t)};r_.iterable&&(zm.prototype[Symbol.iterator]=zm.prototype.entries);Oso=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];EV.prototype.clone=function(){return new EV(this,{body:this._bodyInit})};$fr.call(EV.prototype);$fr.call(eA.prototype);eA.prototype.clone=function(){return new eA(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new zm(this.headers),url:this.url})};eA.error=function(){var t=new eA(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};Rso=[301,302,303,307,308];eA.redirect=function(t,e){if(Rso.indexOf(e)===-1)throw new RangeError("Invalid status code");return new eA(null,{status:e,headers:{location:t}})};OV=ey.DOMException;try{new OV}catch{OV=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},OV.prototype=Object.create(Error.prototype),OV.prototype.constructor=OV}Lfr.polyfill=!0;ey.fetch||(ey.fetch=Lfr,ey.Headers=zm,ey.Request=EV,ey.Response=eA)});function Dso(){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 jso(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 kfr,qfr,Iso,Aso,Nso,Gtt,Ytt,Qtt,ert,$so,trt,Xtt,Wk,Lso,Fso,kso,qso,Uso,Ztt,U8,CIa,fTe=v(()=>{Ffr();kfr="11434",qfr=`http://127.0.0.1:${kfr}`,Iso="0.6.3",Aso=Object.defineProperty,Nso=(t,e,r)=>e in t?Aso(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gtt=(t,e,r)=>(Nso(t,typeof e!="symbol"?e+"":e,r),r),Ytt=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)}},Qtt=class{constructor(e,r,n){Gtt(this,"abortController"),Gtt(this,"itr"),Gtt(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.")}},ert=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 Ytt(e,t.status)};$so=(t,e)=>t[e],trt=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${Iso} (${Dso()})`};r.headers=jso(r.headers);try{let i=new URL(e);if(i.protocol==="https:"&&i.hostname==="ollama.com"){let a=typeof process=="object"&&process!==null&&typeof process.env=="object"&&process.env!==null?$so(process.env,"OLLAMA_API_KEY"):void 0;!(r.headers.authorization||r.headers.Authorization)&&a&&(r.headers.Authorization=`Bearer ${a}`)}}catch(i){console.error("error parsing url",i)}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)},Xtt=async(t,e,r)=>{let n=await trt(t,e,{headers:r?.headers});return await ert(n),n},Wk=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await trt(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await ert(a),a},Lso=async(t,e,r,n)=>{let o=await trt(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await ert(o),o},Fso=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,{stream:!0});let a=r.split(`
|
||
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}r+=e.decode();for(let o of r.split(`
|
||
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},kso=t=>{if(!t)return qfr;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=kfr);let o="";r.username&&(o=r.username,r.password&&(o+=`:${r.password}`),o+="@");let i=`${r.protocol}//${o}${r.hostname}:${n}${r.pathname}`;return i.endsWith("/")&&(i=i.slice(0,-1)),i},qso=Object.defineProperty,Uso=(t,e,r)=>e in t?qso(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ztt=(t,e,r)=>(Uso(t,typeof e!="symbol"?e+"":e,r),r),U8=class{constructor(e){Ztt(this,"config"),Ztt(this,"fetch"),Ztt(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=kso(e?.host??qfr)),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 Wk(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Fso(a.body),u=new Qtt(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await Wk(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 Lso(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await Wk(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await Xtt(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await Wk(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await Wk(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await Wk(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await Xtt(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}async version(){return await(await Xtt(this.fetch,`${this.config.host}/api/version`,{headers:this.config.headers})).json()}async webSearch(e){if(!e.query||e.query.length===0)throw new Error("Query is required");return await(await Wk(this.fetch,"https://ollama.com/api/web_search",{...e},{headers:this.config.headers})).json()}async webFetch(e){if(!e.url||e.url.length===0)throw new Error("URL is required");return await(await Wk(this.fetch,"https://ollama.com/api/web_fetch",{...e},{headers:this.config.headers})).json()}},CIa=new U8});function Ix(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=Mz(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new Ih([`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 Jk(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 _0(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var rrt,lv,Ufr=v(()=>{NQ();vS();QN();MJ();dF();A3e();rrt=class extends cF{constructor(e){super(e);x(this,"returnId",!1);x(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);x(this,"lc_serializable",!0);this.returnId=e?.returnId??this.returnId}static lc_name(){return"JsonOutputToolsParser"}_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(kl(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=>Ix(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}},lv=class extends rrt{constructor(e){super(e);x(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);x(this,"lc_serializable",!0);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"JsonOutputKeyToolsParser"}async _validateResult(e){if(this.zodSchema===void 0)return e;let r=await tF(this.zodSchema,e);if(r.success)return r.data;throw new Ih(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}}});var Bso,PV=v(()=>{Jo();Ufr();Bso={};$t(Bso,{JsonOutputKeyToolsParser:()=>lv,JsonOutputToolsParser:()=>rrt,convertLangChainToolCallToOpenAI:()=>Jk,makeInvalidToolCall:()=>_0,parseToolCall:()=>Ix})});var nrt,Bfr=v(()=>{Ifr();ta();YI();fTe();Ed();sw();pD();nO();fO();PV();au();uv();Ny();nrt=class extends jd{constructor(e){super(e??{});x(this,"model","llama3");x(this,"numa");x(this,"numCtx");x(this,"numBatch");x(this,"numGpu");x(this,"mainGpu");x(this,"lowVram");x(this,"f16Kv");x(this,"logitsAll");x(this,"vocabOnly");x(this,"useMmap");x(this,"useMlock");x(this,"embeddingOnly");x(this,"numThread");x(this,"numKeep");x(this,"seed");x(this,"numPredict");x(this,"topK");x(this,"topP");x(this,"tfsZ");x(this,"typicalP");x(this,"repeatLastN");x(this,"temperature");x(this,"repeatPenalty");x(this,"presencePenalty");x(this,"frequencyPenalty");x(this,"mirostat");x(this,"mirostatTau");x(this,"mirostatEta");x(this,"penalizeNewline");x(this,"streaming");x(this,"format");x(this,"keepAlive");x(this,"client");x(this,"checkOrPullModel",!1);x(this,"baseUrl","http://127.0.0.1:11434");x(this,"think");this.baseUrl=e?.baseUrl??Xr("OLLAMA_BASE_URL")??this.baseUrl,this.client=new U8({fetch:e?.fetch,host:this.baseUrl,headers:e?.headers}),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.think=e?.think,this.checkOrPullModel=e?.checkOrPullModel??this.checkOrPullModel}static lc_name(){return"ChatOllama"}_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.withConfig({tools:e.map(n=>fD(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){return{model:this.model,format:e?.format??this.format,keep_alive:this.keepAlive,think:this.think,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=>fD(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){r.signal?.throwIfAborted(),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=Lb(o,a.message):o=a.message;let i=new Pn({id:o?.id,content:o?.content??"",additional_kwargs:o?.additional_kwargs,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=Rfr(e),a={input_tokens:0,output_tokens:0,total_tokens:0},s=await this.client.chat({...o,messages:i,stream:!0}),u;for await(let l of s){if(r.signal?.aborted){this.client.abort();return}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;let f=this.think?c.thinking??c.content??"":c.content??"",p=new si({text:f,message:Mfr(c)});yield p,await n?.handleLLMNewToken(f,void 0,void 0,void 0,void 0,{chunk:p})}yield new si({text:"",message:new Er({content:"",response_metadata:{...u,model_provider:"ollama"},usage_metadata:a})})}withStructuredOutput(e,r){let n,o,{schema:i,name:a,includeRaw:s}={...r,schema:e},u=r?.method??"jsonSchema";if(u==="functionCalling"){let f=a??"extract";if(Ii(i)){let p=Ci(i);n=this.bindTools([{type:"function",function:{name:f,description:p.description,parameters:p}}]).withConfig({ls_structured_output_format:{kwargs:{method:u},schema:p}}),o=new lv({returnSingle:!0,keyName:f,zodSchema:i})}else{let p;typeof i.name=="string"&&typeof i.parameters=="object"&&i.parameters!=null?(p=i,f=i.name):p={name:f,description:i.description??"",parameters:i},n=this.bindTools([{type:"function",function:p}]).withConfig({ls_structured_output_format:{kwargs:{method:u},schema:i}}),o=new lv({returnSingle:!0,keyName:f})}}else if(u==="jsonMode"){o=Ii(i)?uw.fromZodSchema(i):new j_;let f=Ci(i);n=this.withConfig({format:"json",ls_structured_output_format:{kwargs:{method:u},schema:f}})}else if(u==="jsonSchema"){o=Ii(i)?uw.fromZodSchema(i):new j_;let f=Ci(i);n=this.withConfig({format:f,ls_structured_output_format:{kwargs:{method:u},schema:f}})}else throw new TypeError(`Unrecognized structured output method '${u}'. Expected one of 'functionCalling', 'jsonMode', or 'jsonSchema'`);if(!s)return n.pipe(o).withConfig({runName:"ChatOllamaStructuredOutput"});let l=Au.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=Au.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Bl.from([{raw:n},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var ort,zfr=v(()=>{fTe();au();vV();ort=class extends y0{constructor(e){super({maxConcurrency:1,...e});x(this,"model","mxbai-embed-large");x(this,"baseUrl","http://localhost:11434");x(this,"dimensions");x(this,"keepAlive");x(this,"requestOptions");x(this,"client");x(this,"truncate",!1);this.baseUrl=e?.baseUrl??Xr("OLLAMA_BASE_URL")??this.baseUrl,this.client=new U8({fetch:e?.fetch,host:this.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.model=e?.model??this.model,this.dimensions=e?.dimensions,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,dimensions:this.dimensions,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}}});var Vfr=v(()=>{fTe();Ed();au();Tie()});var irt=v(()=>{Bfr();zfr();Vfr()});function Aie(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
|
||
`,t}var Hfr=v(()=>{});function Kr(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 Pe(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var v0=v(()=>{});var art,srt=v(()=>{art=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return art=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function Nie(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Die,pTe=v(()=>{Die=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var Gt,Vm,zc,Kk,tA,B8,z8,V8,H8,W8,J8,K8,G8,X8,Z8,rA,nA=v(()=>{pTe();Gt=class extends Error{},Vm=class t extends Gt{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new Kk({message:n,cause:Die(r)});let i=r?.error;return e===400?new B8(e,i,n,o):e===401?new z8(e,i,n,o):e===403?new V8(e,i,n,o):e===404?new H8(e,i,n,o):e===409?new W8(e,i,n,o):e===422?new J8(e,i,n,o):e===429?new K8(e,i,n,o):e>=500?new G8(e,i,n,o):new t(e,i,n,o)}},zc=class extends Vm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Kk=class extends Vm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},tA=class extends Kk{constructor({message:e}={}){super({message:e??"Request timed out."})}},B8=class extends Vm{},z8=class extends Vm{},V8=class extends Vm{},H8=class extends Vm{},W8=class extends Vm{},J8=class extends Vm{},K8=class extends Vm{},G8=class extends Vm{},X8=class extends Gt{constructor(){super("Could not parse response content as the length limit was reached")}},Z8=class extends Gt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},rA=class extends Error{constructor(e){super(e)}}});function lrt(t){return typeof t!="object"?{}:t??{}}function Jfr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Kfr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Y8(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Vso,Wfr,nb,urt,Gfr,Xfr,hD=v(()=>{nA();Vso=/^[a-z][a-z0-9+.-]*:/i,Wfr=t=>Vso.test(t),nb=t=>(nb=Array.isArray,nb(t)),urt=nb;Gfr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Gt(`${t} must be an integer`);if(e<0)throw new Gt(`${t} must be a positive integer`);return e},Xfr=t=>{try{return JSON.parse(t)}catch{return}}});var oA,Q8=v(()=>{oA=t=>new Promise(e=>setTimeout(e,t))});var Gk,crt=v(()=>{Gk="6.16.0"});function Hso(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function Jso(){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 epr,Wso,Zfr,Yfr,Qfr,tpr,drt=v(()=>{crt();epr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";Wso=()=>{let t=Hso();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Gk,"X-Stainless-OS":Yfr(Deno.build.os),"X-Stainless-Arch":Zfr(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":Gk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Gk,"X-Stainless-OS":Yfr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zfr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Jso();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Gk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Gk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Zfr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Yfr=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"),tpr=()=>Qfr??(Qfr=Wso())});function rpr(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function frt(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function mTe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return frt({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function prt(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function npr(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var jie=v(()=>{});var opr,ipr=v(()=>{opr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var hTe,mrt,gTe,hrt,yTe=v(()=>{hTe="RFC3986",mrt=t=>String(t),gTe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:mrt},hrt="RFC1738"});function spr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function yrt(t,e){if(nb(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var bTe,iA,grt,apr,upr=v(()=>{yTe();hD();bTe=(t,e)=>(bTe=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),bTe(t,e)),iA=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),grt=1024,apr=(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+=grt){let u=i.length>=grt?i.slice(s,s+grt):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===hrt&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=iA[d];continue}if(d<2048){l[l.length]=iA[192|d>>6]+iA[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=iA[224|d>>12]+iA[128|d>>6&63]+iA[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=iA[240|d>>18]+iA[128|d>>12&63]+iA[128|d>>6&63]+iA[128|d&63]}a+=l.join("")}return a}});function Xso(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function fpr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,T=!1;for(;(_=_.get(brt))!==void 0&&!T;){let I=_.get(t);if(w+=1,typeof I<"u"){if(I===w)throw new RangeError("Cyclic object value");T=!0}typeof _.get(brt)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&nb(b)&&(b=yrt(b,function(I){return I instanceof Date?f?.(I):I})),b===null){if(i)return u&&!h?u(e,Hm.encoder,y,"key",p):e;b=""}if(Xso(b)||spr(b)){if(u){let I=h?e:u(e,Hm.encoder,y,"key",p);return[m?.(I)+"="+m?.(u(b,Hm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&nb(b))h&&u&&(b=yrt(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(nb(l))E=l;else{let I=Object.keys(b);E=c?I.sort(c):I}let P=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&nb(b)&&b.length===1?P+"[]":P;if(o&&nb(b)&&b.length===0)return R+"[]";for(let I=0;I<E.length;++I){let N=E[I],z=typeof N=="object"&&typeof N.value<"u"?N.value:b[N];if(a&&z===null)continue;let V=d&&s?N.replace(/\./g,"%2E"):N,k=nb(b)?typeof r=="function"?r(R,V):R:R+(d?"."+V:"["+V+"]");g.set(t,w);let X=new WeakMap;X.set(brt,g),dpr(O,fpr(z,k,r,n,o,i,a,s,r==="comma"&&h&&nb(b)?null:u,l,c,d,f,p,m,h,y,X))}return O}function Zso(t=Hm){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||Hm.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=hTe;if(typeof t.format<"u"){if(!bTe(gTe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=gTe[r],o=Hm.filter;(typeof t.filter=="function"||nb(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in cpr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Hm.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:Hm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Hm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Hm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Hm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Hm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Hm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Hm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Hm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Hm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Hm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Hm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Hm.strictNullHandling}}function _rt(t,e={}){let r=t,n=Zso(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):nb(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=cpr[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||dpr(a,fpr(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 cpr,dpr,lpr,Hm,brt,ppr=v(()=>{upr();yTe();hD();cpr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},dpr=function(t,e){Array.prototype.push.apply(t,nb(e)?e:[e])},Hm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:apr,encodeValuesOnly:!1,format:hTe,formatter:mrt,indices:!1,serializeDate(t){return(lpr??(lpr=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};brt={}});var mpr=v(()=>{yTe();ppr()});function ypr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function eG(t){let e;return(hpr??(e=new globalThis.TextEncoder,hpr=e.encode.bind(e)))(t)}function vrt(t){let e;return(gpr??(e=new globalThis.TextDecoder,gpr=e.decode.bind(e)))(t)}var hpr,gpr,_Te=v(()=>{});function Qso(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 bpr(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 Dw,jw,MV,_pr=v(()=>{v0();_Te();MV=class{constructor(){Dw.set(this,void 0),jw.set(this,void 0),Kr(this,Dw,new Uint8Array,"f"),Kr(this,jw,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?eG(e):e;Kr(this,Dw,ypr([Pe(this,Dw,"f"),r]),"f");let n=[],o;for(;(o=Qso(Pe(this,Dw,"f"),Pe(this,jw,"f")))!=null;){if(o.carriage&&Pe(this,jw,"f")==null){Kr(this,jw,o.index,"f");continue}if(Pe(this,jw,"f")!=null&&(o.index!==Pe(this,jw,"f")+1||o.carriage)){n.push(vrt(Pe(this,Dw,"f").subarray(0,Pe(this,jw,"f")-1))),Kr(this,Dw,Pe(this,Dw,"f").subarray(Pe(this,jw,"f")),"f"),Kr(this,jw,null,"f");continue}let i=Pe(this,jw,"f")!==null?o.preceding-1:o.preceding,a=vrt(Pe(this,Dw,"f").subarray(0,i));n.push(a),Kr(this,Dw,Pe(this,Dw,"f").subarray(o.index),"f"),Kr(this,jw,null,"f")}return n}flush(){return Pe(this,Dw,"f").length?this.decode(`
|
||
`):[]}};Dw=new WeakMap,jw=new WeakMap;MV.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);MV.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function $ie(){}function vTe(t,e,r){return!e||wTe[t]>wTe[r]?$ie:e[t].bind(e)}function md(t){let e=t.logger,r=t.logLevel??"off";if(!e)return euo;let n=vpr.get(e);if(n&&n[0]===r)return n[1];let o={error:vTe("error",e,r),warn:vTe("warn",e,r),info:vTe("info",e,r),debug:vTe("debug",e,r)};return vpr.set(e,[r,o]),o}var wTe,wrt,euo,vpr,gD,Lie=v(()=>{hD();wTe={off:0,error:200,warn:300,info:400,debug:500},wrt=(t,e,r)=>{if(t){if(Kfr(wTe,t))return t;md(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(wTe))}`)}};euo={error:$ie,warn:$ie,info:$ie,debug:$ie},vpr=new WeakMap;gD=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*tuo(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Gt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Gt("Attempted to iterate over a response with no body");let r=new Srt,n=new MV,o=prt(t.body);for await(let i of ruo(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*ruo(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"?eG(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=bpr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function nuo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Fie,aA,Srt,Crt=v(()=>{v0();nA();jie();_pr();jie();pTe();_Te();Lie();nA();aA=class t{constructor(e,r,n){this.iterator=e,Fie.set(this,void 0),this.controller=r,Kr(this,Fie,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?md(n):console;async function*a(){if(o)throw new Gt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of tuo(e,r))if(!s){if(u.data.startsWith("[DONE]")){s=!0;continue}if(u.event===null||!u.event.startsWith("thread.")){let l;try{l=JSON.parse(u.data)}catch(c){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),c}if(l&&l.error)throw new Vm(void 0,l.error,void 0,e.headers);yield l}else{let l;try{l=JSON.parse(u.data)}catch(c){throw console.error("Could not parse message into JSON:",u.data),console.error("From chunk:",u.raw),c}if(u.event=="error")throw new Vm(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(Nie(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new MV,u=prt(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new Gt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(Nie(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Fie=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,Pe(this,Fie,"f")),new t(()=>o(r),this.controller,Pe(this,Fie,"f"))]}toReadableStream(){let e=this,r;return frt({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=eG(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};Srt=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]=nuo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function STe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return md(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):aA.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return xrt(d,r)}return await r.text()})();return md(t).debug(`[${n}] response parsed`,gD({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function xrt(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var Trt=v(()=>{Crt();Lie()});var kie,RV,CTe=v(()=>{v0();Trt();RV=class t extends Promise{constructor(e,r,n=STe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,kie.set(this,void 0),Kr(this,kie,e,"f")}_thenUnwrap(e){return new t(Pe(this,kie,"f"),this.responsePromise,async(r,n)=>xrt(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(Pe(this,kie,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};kie=new WeakMap});var xTe,qie,Uie,sA,ci,yD,Lu=v(()=>{v0();nA();Trt();CTe();hD();qie=class{constructor(e,r,n,o){xTe.set(this,void 0),Kr(this,xTe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new Gt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Pe(this,xTe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(xTe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Uie=class extends RV{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await STe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},sA=class extends qie{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},ci=class extends qie{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...lrt(this.options.query),after:r}}:null}},yD=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.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...lrt(this.options.query),after:e}}:null}}});function tG(t,e,r){return Prt(),new File(t,e??"unknown_file",r)}function Bie(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function iuo(t){let e=typeof t=="function"?t:t.fetch,r=wpr.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return wpr.set(e,n),n}var Prt,TTe,Mrt,$w,wpr,Spr,Cpr,auo,Ort,Ert,uA=v(()=>{jie();Prt=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};TTe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Mrt=async(t,e)=>Ort(t.body)?{...t,body:await Spr(t.body,e)}:t,$w=async(t,e)=>({...t,body:await Spr(t.body,e)}),wpr=new WeakMap;Spr=async(t,e)=>{if(!await iuo(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>Ert(r,n,o))),r},Cpr=t=>t instanceof Blob&&"name"in t,auo=t=>typeof t=="object"&&t!==null&&(t instanceof Response||TTe(t)||Cpr(t)),Ort=t=>{if(auo(t))return!0;if(Array.isArray(t))return t.some(Ort);if(t&&typeof t=="object"){for(let e in t)if(Ort(t[e]))return!0}return!1},Ert=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,tG([await r.blob()],Bie(r)));else if(TTe(r))t.append(e,tG([await new Response(mTe(r)).blob()],Bie(r)));else if(Cpr(r))t.append(e,r,Bie(r));else if(Array.isArray(r))await Promise.all(r.map(n=>Ert(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Ert(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 zie(t,e,r){if(Prt(),t=await t,suo(t))return t instanceof File?t:tG([await t.arrayBuffer()],t.name);if(uuo(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),tG(await Rrt(o),e,r)}let n=await Rrt(t);if(e||(e=Bie(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return tG(n,e,r)}async function Rrt(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(xpr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(TTe(t))for await(let r of t)e.push(...await Rrt(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${luo(t)}`)}return e}function luo(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var xpr,suo,uuo,Tpr=v(()=>{uA();uA();xpr=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",suo=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&xpr(t),uuo=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var Irt=v(()=>{Tpr()});var Je,Vr=v(()=>{Je=class{constructor(e){this._client=e}}});function Epr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Opr,duo,Le,is=v(()=>{nA();Opr=Object.freeze(Object.create(null)),duo=(t=Epr)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??Opr)??Opr)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new Gt(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},Le=duo(Epr)});var IV,OTe=v(()=>{Vr();Lu();is();IV=class extends Je{list(e,r={},n){return this._client.getAPIList(Le`/chat/completions/${e}/messages`,ci,{query:r,...n})}}});var Ax=v(()=>{nA()});function Vie(t){return t!==void 0&&"function"in t&&t.function!==void 0}function Ppr(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Hie(t){return t?.$brand==="auto-parseable-response-format"}function AV(t){return t?.$brand==="auto-parseable-tool"}function Mpr(t,e){return!e||!Art(e)?{...t,choices:t.choices.map(r=>(Ipr(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:Wie(t,e)}function Wie(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new X8;if(n.finish_reason==="content_filter")throw new Z8;return Ipr(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>huo(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?muo(e,n.message.content):null}}});return{...t,choices:r}}function muo(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 huo(t,e){let r=t.tools?.find(n=>Vie(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:AV(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Rpr(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>Vie(n)&&n.function?.name===e.function.name);return Vie(r)&&(AV(r)||r?.function.strict||!1)}function Art(t){return Hie(t.response_format)?!0:t.tools?.some(e=>AV(e)||e.type==="function"&&e.function.strict===!0)??!1}function Ipr(t){for(let e of t||[])if(e.type!=="function")throw new Gt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function Apr(t){for(let e of t??[]){if(e.type!=="function")throw new Gt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Gt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var rG=v(()=>{Ax()});var nG,Nrt,Drt=v(()=>{nG=t=>t?.role==="assistant",Nrt=t=>t?.role==="tool"});var jrt,ETe,PTe,Jie,Kie,MTe,Gie,bD,Xie,RTe,ITe,oG,Npr,Xk,ATe=v(()=>{v0();Ax();Xk=class{constructor(){jrt.add(this),this.controller=new AbortController,ETe.set(this,void 0),PTe.set(this,()=>{}),Jie.set(this,()=>{}),Kie.set(this,void 0),MTe.set(this,()=>{}),Gie.set(this,()=>{}),bD.set(this,{}),Xie.set(this,!1),RTe.set(this,!1),ITe.set(this,!1),oG.set(this,!1),Kr(this,ETe,new Promise((e,r)=>{Kr(this,PTe,e,"f"),Kr(this,Jie,r,"f")}),"f"),Kr(this,Kie,new Promise((e,r)=>{Kr(this,MTe,e,"f"),Kr(this,Gie,r,"f")}),"f"),Pe(this,ETe,"f").catch(()=>{}),Pe(this,Kie,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Pe(this,jrt,"m",Npr).bind(this))},0)}_connected(){this.ended||(Pe(this,PTe,"f").call(this),this._emit("connect"))}get ended(){return Pe(this,Xie,"f")}get errored(){return Pe(this,RTe,"f")}get aborted(){return Pe(this,ITe,"f")}abort(){this.controller.abort()}on(e,r){return(Pe(this,bD,"f")[e]||(Pe(this,bD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Pe(this,bD,"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(Pe(this,bD,"f")[e]||(Pe(this,bD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Kr(this,oG,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Kr(this,oG,!0,"f"),await Pe(this,Kie,"f")}_emit(e,...r){if(Pe(this,Xie,"f"))return;e==="end"&&(Kr(this,Xie,!0,"f"),Pe(this,MTe,"f").call(this));let n=Pe(this,bD,"f")[e];if(n&&(Pe(this,bD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Pe(this,oG,"f")&&!n?.length&&Promise.reject(o),Pe(this,Jie,"f").call(this,o),Pe(this,Gie,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Pe(this,oG,"f")&&!n?.length&&Promise.reject(o),Pe(this,Jie,"f").call(this,o),Pe(this,Gie,"f").call(this,o),this._emit("end")}}_emitFinal(){}};ETe=new WeakMap,PTe=new WeakMap,Jie=new WeakMap,Kie=new WeakMap,MTe=new WeakMap,Gie=new WeakMap,bD=new WeakMap,Xie=new WeakMap,RTe=new WeakMap,ITe=new WeakMap,oG=new WeakMap,jrt=new WeakSet,Npr=function(e){if(Kr(this,RTe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new zc),e instanceof zc)return Kr(this,ITe,!0,"f"),this._emit("abort",e);if(e instanceof Gt)return this._emit("error",e);if(e instanceof Error){let r=new Gt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Gt(String(e)))}});function Dpr(t){return typeof t.parse=="function"}var $rt=v(()=>{});var n_,Lrt,NTe,Frt,krt,qrt,jpr,$pr,guo,iG,Urt=v(()=>{v0();Ax();rG();Drt();ATe();$rt();guo=10,iG=class extends Xk{constructor(){super(...arguments),n_.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),Nrt(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(nG(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new Gt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Pe(this,n_,"m",Lrt).call(this)}async finalMessage(){return await this.done(),Pe(this,n_,"m",NTe).call(this)}async finalFunctionToolCall(){return await this.done(),Pe(this,n_,"m",Frt).call(this)}async finalFunctionToolCallResult(){return await this.done(),Pe(this,n_,"m",krt).call(this)}async totalUsage(){return await this.done(),Pe(this,n_,"m",qrt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Pe(this,n_,"m",NTe).call(this);r&&this._emit("finalMessage",r);let n=Pe(this,n_,"m",Lrt).call(this);n&&this._emit("finalContent",n);let o=Pe(this,n_,"m",Frt).call(this);o&&this._emit("finalFunctionToolCall",o);let i=Pe(this,n_,"m",krt).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Pe(this,n_,"m",qrt).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Pe(this,n_,"m",jpr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(Wie(i,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:i="auto",stream:a,...s}=r,u=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:l=guo}=n||{},c=r.tools.map(p=>{if(AV(p)){if(!p.$callback)throw new Gt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new Gt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:b,arguments:_}=y.function,w=d[b];if(w){if(u&&u!==b){let P=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}}else{let P=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}let T;try{T=Dpr(w)?await w.parse(_):_}catch(P){let R=P instanceof Error?P.message:String(P);this._addMessage({role:o,tool_call_id:g,content:R});continue}let O=await w.function(T,this),E=Pe(this,n_,"m",$pr).call(this,O);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};n_=new WeakSet,Lrt=function(){return Pe(this,n_,"m",NTe).call(this).content??null},NTe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(nG(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new Gt("stream ended without producing a ChatCompletionMessage with role=assistant")},Frt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(nG(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},krt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Nrt(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}},qrt=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},jpr=function(e){if(e.n!=null&&e.n>1)throw new Gt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},$pr=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var Zie,Brt=v(()=>{Urt();Drt();Zie=class t extends iG{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),nG(e)&&e.content&&this._emit("content",e.content)}}});function yuo(t,e=Wh.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return buo(t.trim(),e)}var Wh,zrt,Vrt,buo,Hrt,Lpr=v(()=>{Wh={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},zrt=class extends Error{},Vrt=class extends Error{};buo=(t,e)=>{let r=t.length,n=0,o=f=>{throw new zrt(`${f} at position ${n}`)},i=f=>{throw new Vrt(`${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"||Wh.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Wh.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Wh.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Wh.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Wh.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Wh.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(Wh.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&&Wh.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(Wh.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Wh.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(Wh.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Wh.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Wh.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&&!(Wh.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Wh.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()},Hrt=t=>yuo(t,Wh.ALL^Wh.NUM)});var Wrt=v(()=>{Crt()});function _uo(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new Gt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,b=l.role;if(!b)throw new Gt(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new Gt(`missing function_call.arguments for choice ${d}`);if(!w)throw new Gt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:_,name:w},role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:b,content:m,refusal:l.refusal??null,tool_calls:y.map((_,w)=>{let{function:T,type:O,id:E,...P}=_,{arguments:R,name:I,...N}=T||{};if(E==null)throw new Gt(`missing choices[${d}].tool_calls[${w}].id
|
||
${$Te(t)}`);if(O==null)throw new Gt(`missing choices[${d}].tool_calls[${w}].type
|
||
${$Te(t)}`);if(I==null)throw new Gt(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${$Te(t)}`);if(R==null)throw new Gt(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${$Te(t)}`);return{...P,id:E,type:O,function:{...N,name:I,arguments:R}}})}}:{...p,message:{...g,content:m,role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return Mpr(u,e)}function $Te(t){return JSON.stringify(t)}var Wm,_D,aG,Zk,Jrt,DTe,Krt,Grt,Xrt,jTe,Zrt,Fpr,NV,LTe=v(()=>{v0();Lpr();Ax();rG();Wrt();Urt();NV=class t extends iG{constructor(e){super(),Wm.add(this),_D.set(this,void 0),aG.set(this,void 0),Zk.set(this,void 0),Kr(this,_D,e,"f"),Kr(this,aG,[],"f")}get currentChatCompletionSnapshot(){return Pe(this,Zk,"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())),Pe(this,Wm,"m",Jrt).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)Pe(this,Wm,"m",Krt).call(this,a);if(i.controller.signal?.aborted)throw new zc;return this._addChatCompletion(Pe(this,Wm,"m",jTe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),Pe(this,Wm,"m",Jrt).call(this),this._connected();let o=aA.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(Pe(this,Wm,"m",jTe).call(this)),Pe(this,Wm,"m",Krt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new zc;return this._addChatCompletion(Pe(this,Wm,"m",jTe).call(this))}[(_D=new WeakMap,aG=new WeakMap,Zk=new WeakMap,Wm=new WeakSet,Jrt=function(){this.ended||Kr(this,Zk,void 0,"f")},DTe=function(r){let n=Pe(this,aG,"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},Pe(this,aG,"f")[r.index]=n,n)},Krt=function(r){if(this.ended)return;let n=Pe(this,Wm,"m",Fpr).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=Pe(this,Wm,"m",DTe).call(this,i);i.finish_reason&&(Pe(this,Wm,"m",Xrt).call(this,i),a.current_tool_call_index!=null&&Pe(this,Wm,"m",Grt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(Pe(this,Wm,"m",Xrt).call(this,i),a.current_tool_call_index!=null&&Pe(this,Wm,"m",Grt).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))}}},Grt=function(r,n){if(Pe(this,Wm,"m",DTe).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=Pe(this,_D,"f")?.tools?.find(s=>Vie(s)&&s.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:n,arguments:i.function.arguments,parsed_arguments:AV(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Xrt=function(r){let n=Pe(this,Wm,"m",DTe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=Pe(this,Wm,"m",Zrt).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}))},jTe=function(){if(this.ended)throw new Gt("stream has ended, this shouldn't happen");let r=Pe(this,Zk,"f");if(!r)throw new Gt("request ended without sending any chunks");return Kr(this,Zk,void 0,"f"),Kr(this,aG,[],"f"),_uo(r,Pe(this,_D,"f"))},Zrt=function(){let r=Pe(this,_D,"f")?.response_format;return Hie(r)?r:null},Fpr=function(r){var n,o,i,a;let s=Pe(this,Zk,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Kr(this,Zk,{...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:O,refusal:E,...P}=p;Object.assign(h.logprobs,P),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,Pe(this,_D,"f")&&Art(Pe(this,_D,"f")))){if(d==="length")throw new X8;if(d==="content_filter")throw new Z8}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...T}=c;if(Object.assign(h.message,T),g&&(h.message.refusal=(h.message.refusal||"")+g),_&&(h.message.role=_),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&Pe(this,Wm,"m",Zrt).call(this)&&(h.message.parsed=Hrt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:P,function:R,...I}of w){let N=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(N,I),E&&(N.id=E),P&&(N.type=P),R&&(N.function??(N.function={name:R.name??"",arguments:""})),R?.name&&(N.function.name=R.name),R?.arguments&&(N.function.arguments+=R.arguments,Rpr(Pe(this,_D,"f"),N)&&(N.function.parsed_arguments=Hrt(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 aA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Yie,Yrt=v(()=>{LTe();Yie=class t extends NV{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),i={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,i)),o}}});var vD,Qie=v(()=>{Vr();OTe();OTe();Lu();is();Brt();Yrt();LTe();rG();Yrt();$rt();LTe();Brt();vD=class extends Je{constructor(){super(...arguments),this.messages=new IV(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1})}retrieve(e,r){return this._client.get(Le`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(Le`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ci,{query:e,...r})}delete(e,r){return this._client.delete(Le`/chat/completions/${e}`,r)}parse(e,r){return Apr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>Wie(n,e))}runTools(e,r){return e.stream?Yie.runTools(this._client,e,r):Zie.runTools(this._client,e,r)}stream(e,r){return NV.createChatCompletion(this._client,e,r)}};vD.Messages=IV});var Yk,Qrt=v(()=>{Vr();Qie();Qie();Yk=class extends Je{constructor(){super(...arguments),this.completions=new vD(this._client)}};Yk.Completions=vD});var kpr=v(()=>{Qie();Qie();OTe()});var qpr=v(()=>{Qrt();kpr()});var Upr=v(()=>{});function*wuo(t){if(!t)return;if(Bpr in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():urt(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=urt(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var Bpr,gt,Yl=v(()=>{hD();Bpr=Symbol("brand.privateNullableHeaders");gt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of wuo(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[Bpr]:!0,values:e,nulls:r}}});var sG,ent=v(()=>{Vr();Yl();sG=class extends Je{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:gt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var uG,tnt=v(()=>{Vr();uA();uG=class extends Je{create(e,r){return this._client.post("/audio/transcriptions",$w({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var lG,rnt=v(()=>{Vr();uA();lG=class extends Je{create(e,r){return this._client.post("/audio/translations",$w({body:e,...r,__metadata:{model:e.model}},this._client))}}});var lA,nnt=v(()=>{Vr();ent();ent();tnt();tnt();rnt();rnt();lA=class extends Je{constructor(){super(...arguments),this.transcriptions=new uG(this._client),this.translations=new lG(this._client),this.speech=new sG(this._client)}};lA.Transcriptions=uG;lA.Translations=lG;lA.Speech=sG});var DV,ont=v(()=>{Vr();Lu();is();DV=class extends Je{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ci,{query:e,...r})}cancel(e,r){return this._client.post(Le`/batches/${e}/cancel`,r)}}});var cG,int=v(()=>{Vr();Lu();Yl();is();cG=class extends Je{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/assistants/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/assistants/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ci,{query:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/assistants/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var dG,ant=v(()=>{Vr();Yl();dG=class extends Je{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var fG,snt=v(()=>{Vr();Yl();fG=class extends Je{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var Qk,unt=v(()=>{Vr();ant();ant();snt();snt();Qk=class extends Je{constructor(){super(...arguments),this.sessions=new dG(this._client),this.transcriptionSessions=new fG(this._client)}};Qk.Sessions=dG;Qk.TranscriptionSessions=fG});var pG,lnt=v(()=>{Vr();Yl();is();pG=class extends Je{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(Le`/chatkit/sessions/${e}/cancel`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}}});var mG,cnt=v(()=>{Vr();Lu();Yl();is();mG=class extends Je{retrieve(e,r){return this._client.get(Le`/chatkit/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",yD,{query:e,...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(Le`/chatkit/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(Le`/chatkit/threads/${e}/items`,yD,{query:r,...n,headers:gt([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}}});var eq,dnt=v(()=>{Vr();lnt();lnt();cnt();cnt();eq=class extends Je{constructor(){super(...arguments),this.sessions=new pG(this._client),this.threads=new mG(this._client)}};eq.Sessions=pG;eq.Threads=mG});var hG,fnt=v(()=>{Vr();Lu();Yl();is();hG=class extends Je{create(e,r,n){return this._client.post(Le`/threads/${e}/messages`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(Le`/threads/${o}/messages/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/messages/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/messages`,ci,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(Le`/threads/${o}/messages/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var gG,pnt=v(()=>{Vr();Lu();Yl();is();gG=class extends Je{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(Le`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(Le`/threads/${o}/runs/${e}/steps`,ci,{query:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var zpr,Vpr=v(()=>{nA();_Te();zpr=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 Nx,mnt=v(()=>{Nx=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var eae=v(()=>{hD();Vpr();mnt();Lie();srt();Q8()});var ty,$V,hnt,cA,FTe,Dx,LV,yG,jV,UTe,Lw,kTe,qTe,nae,tae,rae,Hpr,Wpr,Jpr,Kpr,Gpr,Xpr,Zpr,wD,gnt=v(()=>{v0();Wrt();Ax();ATe();eae();wD=class extends Xk{constructor(){super(...arguments),ty.add(this),hnt.set(this,[]),cA.set(this,{}),FTe.set(this,{}),Dx.set(this,void 0),LV.set(this,void 0),yG.set(this,void 0),jV.set(this,void 0),UTe.set(this,void 0),Lw.set(this,void 0),kTe.set(this,void 0),qTe.set(this,void 0),nae.set(this,void 0)}[(hnt=new WeakMap,cA=new WeakMap,FTe=new WeakMap,Dx=new WeakMap,LV=new WeakMap,yG=new WeakMap,jV=new WeakMap,UTe=new WeakMap,Lw=new WeakMap,kTe=new WeakMap,qTe=new WeakMap,nae=new WeakMap,ty=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 $V;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=aA.fromReadableStream(e,this.controller);for await(let i of o)Pe(this,ty,"m",tae).call(this,i);if(o.controller.signal?.aborted)throw new zc;return this._addRun(Pe(this,ty,"m",rae).call(this))}toReadableStream(){return new aA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new $V;return i._run(()=>i._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,r,n,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...n,stream:!0},s=await e.submitToolOutputs(r,a,{...o,signal:this.controller.signal});this._connected();for await(let u of s)Pe(this,ty,"m",tae).call(this,u);if(s.controller.signal?.aborted)throw new zc;return this._addRun(Pe(this,ty,"m",rae).call(this))}static createThreadAssistantStream(e,r,n){let o=new $V;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 $V;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return Pe(this,kTe,"f")}currentRun(){return Pe(this,qTe,"f")}currentMessageSnapshot(){return Pe(this,Dx,"f")}currentRunStepSnapshot(){return Pe(this,nae,"f")}async finalRunSteps(){return await this.done(),Object.values(Pe(this,cA,"f"))}async finalMessages(){return await this.done(),Object.values(Pe(this,FTe,"f"))}async finalRun(){if(await this.done(),!Pe(this,LV,"f"))throw Error("Final run was not received.");return Pe(this,LV,"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)Pe(this,ty,"m",tae).call(this,s);if(a.controller.signal?.aborted)throw new zc;return this._addRun(Pe(this,ty,"m",rae).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)Pe(this,ty,"m",tae).call(this,u);if(s.controller.signal?.aborted)throw new zc;return this._addRun(Pe(this,ty,"m",rae).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(Y8(i)&&Y8(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(!Y8(a))throw new Error(`Expected array delta entry to be an object but got: ${a}`);let s=a.index;if(s==null)throw console.error(a),new Error("Expected array delta entry to have an `index` property");if(typeof s!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${s}`);let u=i[s];u==null?i.push(a):i[s]=this.accumulateDelta(u,a)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${i}`);e[n]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};$V=wD,tae=function(e){if(!this.ended)switch(Kr(this,kTe,e,"f"),Pe(this,ty,"m",Jpr).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":Pe(this,ty,"m",Zpr).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":Pe(this,ty,"m",Wpr).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":Pe(this,ty,"m",Hpr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},rae=function(){if(this.ended)throw new Gt("stream has ended, this shouldn't happen");if(!Pe(this,LV,"f"))throw Error("Final run has not been received");return Pe(this,LV,"f")},Hpr=function(e){let[r,n]=Pe(this,ty,"m",Gpr).call(this,e,Pe(this,Dx,"f"));Kr(this,Dx,r,"f"),Pe(this,FTe,"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!=Pe(this,yG,"f")){if(Pe(this,jV,"f"))switch(Pe(this,jV,"f").type){case"text":this._emit("textDone",Pe(this,jV,"f").text,Pe(this,Dx,"f"));break;case"image_file":this._emit("imageFileDone",Pe(this,jV,"f").image_file,Pe(this,Dx,"f"));break}Kr(this,yG,o.index,"f")}Kr(this,jV,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Pe(this,yG,"f")!==void 0){let o=e.data.content[Pe(this,yG,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Pe(this,Dx,"f"));break;case"text":this._emit("textDone",o.text,Pe(this,Dx,"f"));break}}Pe(this,Dx,"f")&&this._emit("messageDone",e.data),Kr(this,Dx,void 0,"f")}},Wpr=function(e){let r=Pe(this,ty,"m",Kpr).call(this,e);switch(Kr(this,nae,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==Pe(this,UTe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Pe(this,Lw,"f")&&this._emit("toolCallDone",Pe(this,Lw,"f")),Kr(this,UTe,i.index,"f"),Kr(this,Lw,r.step_details.tool_calls[i.index],"f"),Pe(this,Lw,"f")&&this._emit("toolCallCreated",Pe(this,Lw,"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":Kr(this,nae,void 0,"f"),e.data.step_details.type=="tool_calls"&&Pe(this,Lw,"f")&&(this._emit("toolCallDone",Pe(this,Lw,"f")),Kr(this,Lw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},Jpr=function(e){Pe(this,hnt,"f").push(e),this._emit("event",e)},Kpr=function(e){switch(e.event){case"thread.run.step.created":return Pe(this,cA,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Pe(this,cA,"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=$V.accumulateDelta(r,n.delta);Pe(this,cA,"f")[e.data.id]=o}return Pe(this,cA,"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":Pe(this,cA,"f")[e.data.id]=e.data;break}if(Pe(this,cA,"f")[e.data.id])return Pe(this,cA,"f")[e.data.id];throw new Error("No snapshot available")},Gpr=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]=Pe(this,ty,"m",Xpr).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")},Xpr=function(e,r){return $V.accumulateDelta(r,e)},Zpr=function(e){switch(Kr(this,qTe,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":Kr(this,LV,e.data,"f"),Pe(this,Lw,"f")&&(this._emit("toolCallDone",Pe(this,Lw,"f")),Kr(this,Lw,void 0,"f"));break;case"thread.run.cancelling":break}}});var FV,ynt=v(()=>{Vr();pnt();pnt();Lu();Yl();gnt();Q8();is();FV=class extends Je{constructor(){super(...arguments),this.steps=new gG(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(Le`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(Le`/threads/${o}/runs/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/runs/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/threads/${e}/runs`,ci,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(Le`/threads/${o}/runs/${e}/cancel`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return wD.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await oA(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return wD.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(Le`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return wD.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};FV.Steps=gG});var tq,bnt=v(()=>{Vr();fnt();fnt();ynt();ynt();Yl();gnt();is();tq=class extends Je{constructor(){super(...arguments),this.runs=new FV(this._client),this.messages=new hG(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/threads/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(Le`/threads/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return wD.createThreadAssistantStream(e,this._client.beta.threads,r)}};tq.Runs=FV;tq.Messages=hG});var jx,_nt=v(()=>{Vr();int();int();unt();unt();dnt();dnt();bnt();bnt();jx=class extends Je{constructor(){super(...arguments),this.realtime=new Qk(this._client),this.chatkit=new eq(this._client),this.assistants=new cG(this._client),this.threads=new tq(this._client)}};jx.Realtime=Qk;jx.ChatKit=eq;jx.Assistants=cG;jx.Threads=tq});var kV,vnt=v(()=>{Vr();kV=class extends Je{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var bG,wnt=v(()=>{Vr();Yl();is();bG=class extends Je{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}/content`,{...n,headers:gt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var qV,Snt=v(()=>{Vr();wnt();wnt();Lu();Yl();uA();is();qV=class extends Je{constructor(){super(...arguments),this.content=new bG(this._client)}create(e,r,n){return this._client.post(Le`/containers/${e}/files`,$w({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(Le`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/containers/${e}/files`,ci,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(Le`/containers/${o}/files/${e}`,{...n,headers:gt([{Accept:"*/*"},n?.headers])})}};qV.Content=bG});var rq,Cnt=v(()=>{Vr();Snt();Snt();Lu();Yl();is();rq=class extends Je{constructor(){super(...arguments),this.files=new qV(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ci,{query:e,...r})}delete(e,r){return this._client.delete(Le`/containers/${e}`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}};rq.Files=qV});var _G,xnt=v(()=>{Vr();Lu();is();_G=class extends Je{create(e,r,n){let{include:o,...i}=r;return this._client.post(Le`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(Le`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(Le`/conversations/${e}/items`,yD,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(Le`/conversations/${o}/items/${e}`,n)}}});var nq,Tnt=v(()=>{Vr();xnt();xnt();is();nq=class extends Je{constructor(){super(...arguments),this.items=new _G(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/conversations/${e}`,r)}update(e,r,n){return this._client.post(Le`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(Le`/conversations/${e}`,r)}};nq.Items=_G});var UV,Ont=v(()=>{Vr();eae();UV=class extends Je{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&md(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(md(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=zpr(u)}),a)))}}});var vG,Ent=v(()=>{Vr();Lu();is();vG=class extends Je{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(Le`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(Le`/evals/${o}/runs/${e}/output_items`,ci,{query:i,...n})}}});var BV,Pnt=v(()=>{Vr();Ent();Ent();Lu();is();BV=class extends Je{constructor(){super(...arguments),this.outputItems=new vG(this._client)}create(e,r,n){return this._client.post(Le`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(Le`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(Le`/evals/${e}/runs`,ci,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(Le`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(Le`/evals/${o}/runs/${e}`,n)}};BV.OutputItems=vG});var oq,Mnt=v(()=>{Vr();Pnt();Pnt();Lu();is();oq=class extends Je{constructor(){super(...arguments),this.runs=new BV(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/evals/${e}`,r)}update(e,r,n){return this._client.post(Le`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ci,{query:e,...r})}delete(e,r){return this._client.delete(Le`/evals/${e}`,r)}};oq.Runs=BV});var zV,Rnt=v(()=>{Vr();Lu();Yl();Q8();Ax();uA();is();zV=class extends Je{create(e,r){return this._client.post("/files",$w({body:e,...r},this._client))}retrieve(e,r){return this._client.get(Le`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ci,{query:e,...r})}delete(e,r){return this._client.delete(Le`/files/${e}`,r)}content(e,r){return this._client.get(Le`/files/${e}/content`,{...r,headers:gt([{Accept:"application/binary"},r?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!o.has(a.status);)if(await oA(r),a=await this.retrieve(e),Date.now()-i>n)throw new tA({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var wG,Int=v(()=>{Vr();wG=class extends Je{}});var SG,Ant=v(()=>{Vr();SG=class extends Je{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r})}}});var VV,Nnt=v(()=>{Vr();Ant();Ant();VV=class extends Je{constructor(){super(...arguments),this.graders=new SG(this._client)}};VV.Graders=SG});var CG,Dnt=v(()=>{Vr();Lu();is();CG=class extends Je{create(e,r,n){return this._client.getAPIList(Le`/fine_tuning/checkpoints/${e}/permissions`,sA,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(Le`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(Le`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var HV,jnt=v(()=>{Vr();Dnt();Dnt();HV=class extends Je{constructor(){super(...arguments),this.permissions=new CG(this._client)}};HV.Permissions=CG});var xG,$nt=v(()=>{Vr();Lu();is();xG=class extends Je{list(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/checkpoints`,ci,{query:r,...n})}}});var WV,Lnt=v(()=>{Vr();$nt();$nt();Lu();is();WV=class extends Je{constructor(){super(...arguments),this.checkpoints=new xG(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(Le`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ci,{query:e,...r})}cancel(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(Le`/fine_tuning/jobs/${e}/events`,ci,{query:r,...n})}pause(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(Le`/fine_tuning/jobs/${e}/resume`,r)}};WV.Checkpoints=xG});var $x,Fnt=v(()=>{Vr();Int();Int();Nnt();Nnt();jnt();jnt();Lnt();Lnt();$x=class extends Je{constructor(){super(...arguments),this.methods=new wG(this._client),this.jobs=new WV(this._client),this.checkpoints=new HV(this._client),this.alpha=new VV(this._client)}};$x.Methods=wG;$x.Jobs=WV;$x.Checkpoints=HV;$x.Alpha=VV});var TG,knt=v(()=>{Vr();TG=class extends Je{}});var iq,qnt=v(()=>{Vr();knt();knt();iq=class extends Je{constructor(){super(...arguments),this.graderModels=new TG(this._client)}};iq.GraderModels=TG});var JV,Unt=v(()=>{Vr();uA();JV=class extends Je{createVariation(e,r){return this._client.post("/images/variations",$w({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",$w({body:e,...r,stream:e.stream??!1},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1})}}});var KV,Bnt=v(()=>{Vr();Lu();is();KV=class extends Je{retrieve(e,r){return this._client.get(Le`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",sA,e)}delete(e,r){return this._client.delete(Le`/models/${e}`,r)}}});var GV,znt=v(()=>{Vr();GV=class extends Je{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});var OG,Vnt=v(()=>{Vr();Yl();is();OG=class extends Je{accept(e,r,n){return this._client.post(Le`/realtime/calls/${e}/accept`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(Le`/realtime/calls/${e}/hangup`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(Le`/realtime/calls/${e}/refer`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(Le`/realtime/calls/${e}/reject`,{body:r,...n,headers:gt([{Accept:"*/*"},n?.headers])})}}});var EG,Hnt=v(()=>{Vr();EG=class extends Je{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}}});var SD,Wnt=v(()=>{Vr();Vnt();Vnt();Hnt();Hnt();SD=class extends Je{constructor(){super(...arguments),this.clientSecrets=new EG(this._client),this.calls=new OG(this._client)}};SD.ClientSecrets=EG;SD.Calls=OG});function Ypr(t,e){return!e||!Yuo(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)}:Jnt(t,e)}function Jnt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:tlo(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:Zuo(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||BTe(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 Zuo(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Yuo(t){return!!Hie(t.text?.format)}function Quo(t){return t?.$brand==="auto-parseable-tool"}function elo(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function tlo(t,e){let r=elo(t.tools??[],e.name);return{...e,...e,parsed_arguments:Quo(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function BTe(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 zTe=v(()=>{Ax();rG()});function rlo(t,e){return Ypr(t,e)}var PG,VTe,aq,HTe,Qpr,emr,tmr,rmr,WTe,nmr=v(()=>{v0();Ax();ATe();zTe();WTe=class t extends Xk{constructor(e){super(),PG.add(this),VTe.set(this,void 0),aq.set(this,void 0),HTe.set(this,void 0),Kr(this,VTe,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Pe(this,PG,"m",Qpr).call(this);let i,a=null;"response_id"in r?(i=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=r.starting_after??null):i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let s of i)Pe(this,PG,"m",emr).call(this,s,a);if(i.controller.signal?.aborted)throw new zc;return Pe(this,PG,"m",tmr).call(this)}[(VTe=new WeakMap,aq=new WeakMap,HTe=new WeakMap,PG=new WeakSet,Qpr=function(){this.ended||Kr(this,aq,void 0,"f")},emr=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=Pe(this,PG,"m",rmr).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let a=i.output[r.output_index];if(!a)throw new Gt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new Gt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new Gt(`expected content to be 'output_text', got ${s.type}`);o("response.output_text.delta",{...r,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let a=i.output[r.output_index];if(!a)throw new Gt(`missing output at index ${r.output_index}`);a.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:a.arguments});break}default:o(r.type,r);break}},tmr=function(){if(this.ended)throw new Gt("stream has ended, this shouldn't happen");let r=Pe(this,aq,"f");if(!r)throw new Gt("request ended without sending any events");Kr(this,aq,void 0,"f");let n=rlo(r,Pe(this,VTe,"f"));return Kr(this,HTe,n,"f"),n},rmr=function(r){let n=Pe(this,aq,"f");if(!n){if(r.type!=="response.created")throw new Gt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Kr(this,aq,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new Gt(`missing output at index ${r.output_index}`);let i=o.type,a=r.part;i==="message"&&a.type!=="reasoning_text"?o.content.push(a):i==="reasoning"&&a.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(a));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new Gt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Gt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Gt(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new Gt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new Gt(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new Gt(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new Gt(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{Kr(this,aq,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=Pe(this,HTe,"f");if(!e)throw new Gt("stream ended without producing a ChatCompletion");return e}}});var MG,Knt=v(()=>{Vr();Lu();is();MG=class extends Je{list(e,r={},n){return this._client.getAPIList(Le`/responses/${e}/input_items`,ci,{query:r,...n})}}});var RG,Gnt=v(()=>{Vr();RG=class extends Je{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}}});var CD,Xnt=v(()=>{zTe();nmr();Vr();Knt();Knt();Gnt();Gnt();Yl();is();CD=class extends Je{constructor(){super(...arguments),this.inputItems=new MG(this._client),this.inputTokens=new RG(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"&&BTe(n),n))}retrieve(e,r={},n){return this._client.get(Le`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&BTe(o),o))}delete(e,r){return this._client.delete(Le`/responses/${e}`,{...r,headers:gt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Jnt(n,e))}stream(e,r){return WTe.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(Le`/responses/${e}/cancel`,r)}compact(e,r){return this._client.post("/responses/compact",{body:e,...r})}};CD.InputItems=MG;CD.InputTokens=RG});var IG,Znt=v(()=>{Vr();uA();is();IG=class extends Je{create(e,r,n){return this._client.post(Le`/uploads/${e}/parts`,$w({body:r,...n},this._client))}}});var sq,Ynt=v(()=>{Vr();Znt();Znt();is();sq=class extends Je{constructor(){super(...arguments),this.parts=new IG(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(Le`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(Le`/uploads/${e}/complete`,{body:r,...n})}};sq.Parts=IG});var omr,imr=v(()=>{omr=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 AG,Qnt=v(()=>{Vr();Lu();Yl();Q8();imr();is();AG=class extends Je{create(e,r,n){return this._client.post(Le`/vector_stores/${e}/file_batches`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(Le`/vector_stores/${o}/file_batches/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(Le`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...i}=r;return this._client.getAPIList(Le`/vector_stores/${o}/file_batches/${e}/files`,ci,{query:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(i.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=a.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await oA(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 omr(d),await this.createAndPoll(e,{file_ids:l})}}});var NG,eot=v(()=>{Vr();Lu();Yl();eae();is();NG=class extends Je{create(e,r,n){return this._client.post(Le`/vector_stores/${e}/files`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(Le`/vector_stores/${o}/files/${e}`,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(Le`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(Le`/vector_stores/${e}/files`,ci,{query:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(Le`/vector_stores/${o}/files/${e}`,{...n,headers:gt([{"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=gt([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),a=i.data;switch(a.status){case"in_progress":let s=5e3;if(n?.pollIntervalMs)s=n.pollIntervalMs;else{let u=i.response.headers.get("openai-poll-after-ms");if(u){let l=parseInt(u);isNaN(l)||(s=l)}}await oA(s);break;case"failed":case"completed":return a}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(Le`/vector_stores/${o}/files/${e}/content`,sA,{...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var xD,tot=v(()=>{Vr();Qnt();Qnt();eot();eot();Lu();Yl();is();xD=class extends Je{constructor(){super(...arguments),this.files=new NG(this._client),this.fileBatches=new AG(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(Le`/vector_stores/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(Le`/vector_stores/${e}`,{body:r,...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ci,{query:e,...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(Le`/vector_stores/${e}`,{...r,headers:gt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(Le`/vector_stores/${e}/search`,sA,{body:r,method:"post",...n,headers:gt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};xD.Files=NG;xD.FileBatches=AG});var XV,rot=v(()=>{Vr();Lu();Yl();uA();is();XV=class extends Je{create(e,r){return this._client.post("/videos",Mrt({body:e,...r},this._client))}retrieve(e,r){return this._client.get(Le`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",yD,{query:e,...r})}delete(e,r){return this._client.delete(Le`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(Le`/videos/${e}/content`,{query:r,...n,headers:gt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(Le`/videos/${e}/remix`,Mrt({body:r,...n},this._client))}}});var DG,amr,JTe,ZV,not=v(()=>{v0();Ax();Vr();Yl();ZV=class extends Je{constructor(){super(...arguments),DG.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");Pe(this,DG,"m",amr).call(this,n);let i=gt([r]).values,a=Pe(this,DG,"m",JTe).call(this,i,"webhook-signature"),s=Pe(this,DG,"m",JTe).call(this,i,"webhook-timestamp"),u=Pe(this,DG,"m",JTe).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new rA("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new rA("Webhook timestamp is too old");if(l>c+o)throw new rA("Webhook timestamp is too new");let d=a.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),p=u?`${u}.${s}.${e}`:`${s}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let y=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,y,new TextEncoder().encode(p)))return}catch{continue}throw new rA("The given webhook signature does not match the expected signature")}};DG=new WeakSet,amr=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},JTe=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n}});var smr=v(()=>{qpr();Upr();nnt();ont();_nt();vnt();Cnt();Tnt();Ont();Mnt();Rnt();Fnt();qnt();Unt();Bnt();znt();Wnt();Xnt();Ynt();tot();rot();not()});var oot,iot,KTe,umr,xn,GTe=v(()=>{v0();srt();hD();Q8();pTe();drt();jie();ipr();mpr();crt();nA();Lu();Irt();smr();CTe();ont();vnt();Ont();Rnt();Unt();Bnt();znt();rot();not();nnt();_nt();Qrt();Cnt();Tnt();Mnt();Fnt();qnt();Wnt();Xnt();Ynt();tot();drt();Yl();mnt();Lie();hD();xn=class{constructor({baseURL:e=Nx("OPENAI_BASE_URL"),apiKey:r=Nx("OPENAI_API_KEY"),organization:n=Nx("OPENAI_ORG_ID")??null,project:o=Nx("OPENAI_PROJECT_ID")??null,webhookSecret:i=Nx("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(oot.add(this),KTe.set(this,void 0),this.completions=new kV(this),this.chat=new Yk(this),this.embeddings=new UV(this),this.files=new zV(this),this.images=new JV(this),this.audio=new lA(this),this.moderations=new GV(this),this.models=new KV(this),this.fineTuning=new $x(this),this.graders=new iq(this),this.vectorStores=new xD(this),this.webhooks=new ZV(this),this.beta=new jx(this),this.batches=new DV(this),this.uploads=new sq(this),this.responses=new CD(this),this.realtime=new SD(this),this.conversations=new nq(this),this.evals=new oq(this),this.containers=new rq(this),this.videos=new XV(this),r===void 0)throw new Gt("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let s={apiKey:r,organization:n,project:o,webhookSecret:i,...a,baseURL:e||"https://api.openai.com/v1"};if(!s.dangerouslyAllowBrowser&&epr())throw new Gt(`It looks like you're running in a browser-like environment.
|
||
|
||
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
||
If you understand the risks and have appropriate mitigations in place,
|
||
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
||
|
||
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
||
|
||
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
||
`);this.baseURL=s.baseURL,this.timeout=s.timeout??iot.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=wrt(s.logLevel,"ClientOptions.logLevel",this)??wrt(Nx("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??rpr(),Kr(this,KTe,opr,"f"),this._options=s,this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=o,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return gt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return _rt(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${Gk}`}defaultIdempotencyKey(){return`stainless-node-retry-${art()}`}makeStatusError(e,r,n,o){return Vm.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof Gt?n:new Gt(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new Gt(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!Pe(this,oot,"m",umr).call(this)&&n||this.baseURL,i=Wfr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return Jfr(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new RV(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(md(this).debug(`[${l}] sending request`,gD({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new zc;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(Die),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new zc;let b=Nie(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return md(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),md(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,gD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw md(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),md(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,gD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new tA:new Kk({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="x-request-id").map(([g,b])=>", "+g+": "+JSON.stringify(b)).join(""),y=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let E=`retrying, ${r} attempts remaining`;return await npr(p.body),md(this).info(`${y} - ${E}`),md(this).debug(`[${l}] response error (${E})`,gD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=g?"error; no more retries left":"error; not retryable";md(this).info(`${y} - ${b}`);let _=await p.text().catch(E=>Die(E).message),w=Xfr(_),T=w?void 0:_;throw md(this).debug(`[${l}] response error (${b})`,gD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,T,p.headers)}return md(this).info(y),md(this).debug(`[${l}] response start`,gD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new Uie(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await oA(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&Gfr("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=gt([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...tpr(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=gt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:mTe(e)}:Pe(this,KTe,"f").call(this,{body:e,headers:n})}};iot=xn,KTe=new WeakMap,oot=new WeakSet,umr=function(){return this.baseURL!=="https://api.openai.com/v1"};xn.OpenAI=iot;xn.DEFAULT_TIMEOUT=6e5;xn.OpenAIError=Gt;xn.APIError=Vm;xn.APIConnectionError=Kk;xn.APIConnectionTimeoutError=tA;xn.APIUserAbortError=zc;xn.NotFoundError=H8;xn.ConflictError=W8;xn.RateLimitError=K8;xn.BadRequestError=B8;xn.AuthenticationError=z8;xn.InternalServerError=G8;xn.PermissionDeniedError=V8;xn.UnprocessableEntityError=J8;xn.InvalidWebhookSignatureError=rA;xn.toFile=zie;xn.Completions=kV;xn.Chat=Yk;xn.Embeddings=UV;xn.Files=zV;xn.Images=JV;xn.Audio=lA;xn.Moderations=GV;xn.Models=KV;xn.FineTuning=$x;xn.Graders=iq;xn.VectorStores=xD;xn.Webhooks=ZV;xn.Beta=jx;xn.Batches=DV;xn.Uploads=sq;xn.Responses=CD;xn.Realtime=SD;xn.Conversations=nq;xn.Evals=oq;xn.Containers=rq;xn.Videos=XV});var YV,llo,lmr=v(()=>{Yl();Ax();eae();GTe();YV=class extends xn{constructor({baseURL:e=Nx("OPENAI_BASE_URL"),apiKey:r=Nx("AZURE_OPENAI_API_KEY"),apiVersion:n=Nx("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new Gt("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new Gt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new Gt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new Gt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new Gt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:a??r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this.apiVersion=n,this.deploymentName=i}async buildRequest(e,r={}){if(llo.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!Y8(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 authHeaders(e){return typeof this._options.apiKey=="string"?gt([{"api-key":this.apiKey}]):super.authHeaders(e)}},llo=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"])});var dA=v(()=>{GTe();Irt();CTe();GTe();Lu();nA();lmr()});function w0(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===tA.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===zc.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="AbortError"):"status"in t&&t.status===400&&"message"in t&&typeof t.message=="string"&&t.message.includes("tool_calls")?e=Aie(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=Aie(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=Aie(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=Aie(t,"MODEL_NOT_FOUND"):e=t,e}var uq=v(()=>{Hfr();dA()});function OD(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function clo(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 jG(t){let e=t.metadata?.filename??t.metadata?.name??t.metadata?.title;if(!e)throw new Error("a filename or name or title is needed via meta-data for OpenAI when working with multimodal blocks");return e}function ED(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(!Td.isInstance(t))throw new Error("Invalid generic chat message");return clo(t);default:throw new Error(`Unknown message type: ${e}`)}}function cmr(t){return t.includes("gpt-5.2-pro")}var TD,lq=v(()=>{ta();TD=t=>t()});function fA(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}function aot(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function dmr(t){let e=TD(()=>{if(aot(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&aot(t.values))return t.values;if(typeof t=="object"&&t!==null){let r=Object.entries(t).filter(([,n])=>typeof n=="string").map(([n,o])=>[n,o]);return new Headers(r)}return new Headers});return Object.fromEntries(e.entries())}function fmr(){let t=lme();return(t==="node"||t==="deno")&&(t=`(${t}/${process.version}; ${process.platform}; ${process.arch})`),t}function pA(t,e=!1,r="1.0.0"){let n=dmr(t),o=fmr(),i=`langchainjs${e?"-azure":""}-openai`;return{...n,"User-Agent":n["User-Agent"]?`${i}/${r} (${o})${n["User-Agent"]}`:`${i}/${r} (${o})`}}var cq=v(()=>{lq();au()});function pmr(t,e){let r;return Xg(t)?r=fD(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function dlo(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function mmr(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(hmr(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function hmr(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}: ${XTe(o,e)},`):r.push(`${n}?: ${XTe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function XTe(t,e){if(dlo(t))return t.anyOf.map(r=>XTe(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["{",hmr(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${XTe(t.items,e)}[]`:"any[]";default:return""}}function ZTe(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 $G(t){return"type"in t&&t.type!=="function"}function gmr(t){return typeof t=="object"&&t!==null&&"extras"in t&&typeof t.extras=="object"&&t.extras!==null&&"providerToolDefinition"in t.extras&&typeof t.extras.providerToolDefinition=="object"&&t.extras.providerToolDefinition!==null}function ymr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function QV(t){return typeof t=="object"&&t!==null&&"metadata"in t&&typeof t.metadata=="object"&&t.metadata!==null&&"customTool"in t.metadata&&typeof t.metadata.customTool=="object"&&t.metadata.customTool!==null}function YTe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function bmr(t){if(t.type==="custom_tool_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:t.name,isCustomTool:!0,args:{input:t.input}}}function _mr(t){if(t.type==="computer_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:"computer_use",isComputerTool:!0,args:{action:t.action}}}function vmr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isComputerTool"in t&&t.isComputerTool===!0}function wmr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function Smr(t){let e=()=>{if(t.custom.format){if(t.custom.format.type==="grammar")return{type:"grammar",definition:t.custom.format.grammar.definition,syntax:t.custom.format.grammar.syntax};if(t.custom.format.type==="text")return{type:"text"}}};return{type:"custom",name:t.custom.name,description:t.custom.description,format:e()}}function Cmr(t){let e=()=>{if(t.format){if(t.format.type==="grammar")return{type:"grammar",grammar:{definition:t.format.definition,syntax:t.format.syntax}};if(t.format.type==="text")return{type:"text"}}};return{type:"custom",custom:{name:t.name,description:t.description,format:e()}}}var LG=v(()=>{pD();uv();Ny()});var sot=v(()=>{Iy()});var nOe={};En(nOe,{ZodISODate:()=>eOe,ZodISODateTime:()=>QTe,ZodISODuration:()=>rOe,ZodISOTime:()=>tOe,date:()=>lot,datetime:()=>uot,duration:()=>dot,time:()=>cot});function uot(t){return JVe(QTe,t)}function lot(t){return KVe(eOe,t)}function cot(t){return GVe(tOe,t)}function dot(t){return XVe(rOe,t)}var QTe,eOe,tOe,rOe,oOe=v(()=>{Iy();iOe();QTe=xe("ZodISODateTime",(t,e)=>{X2e.init(t,e),Qu.init(t,e)});eOe=xe("ZodISODate",(t,e)=>{Z2e.init(t,e),Qu.init(t,e)});tOe=xe("ZodISOTime",(t,e)=>{Y2e.init(t,e),Qu.init(t,e)});rOe=xe("ZodISODuration",(t,e)=>{Q2e.init(t,e),Qu.init(t,e)})});var Tmr,plo,FG,fot=v(()=>{Iy();Iy();Tmr=(t,e)=>{Tee.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Eee(t,r)},flatten:{value:r=>Oee(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},plo=xe("ZodError",Tmr),FG=xe("ZodError",Tmr,{Parent:Error})});var pot,mot,hot,got,yot=v(()=>{Iy();fot();pot=Rhe(FG),mot=Ihe(FG),hot=Ahe(FG),got=Nhe(FG)});function bot(t){return VVe(iae,t)}function hlo(t){return Jhe(wot,t)}function glo(t){return $ee(aOe,t)}function ylo(t){return Khe(PD,t)}function blo(t){return Ghe(PD,t)}function _lo(t){return Xhe(PD,t)}function vlo(t){return Zhe(PD,t)}function wlo(t){return Yhe(Sot,t)}function Slo(t){return Qhe(Cot,t)}function Clo(t){return ege(xot,t)}function xlo(t){return tge(Tot,t)}function Tlo(t){return rge(Oot,t)}function Olo(t){return nge(Eot,t)}function Elo(t){return oge(Pot,t)}function Plo(t){return ige(Mot,t)}function Mlo(t){return age(Rot,t)}function Rlo(t){return sge(Iot,t)}function Ilo(t){return uge(Aot,t)}function Alo(t){return lge(Not,t)}function Nlo(t){return cge(Dot,t)}function Dlo(t){return dge(jot,t)}function jlo(t){return fge($ot,t)}function $lo(t){return pge(Lot,t)}function Llo(t,e,r={}){return PHe(Omr,t,e,r)}function Emr(t){return ZVe(aae,t)}function _ot(t){return QVe(kG,t)}function Flo(t){return eHe(kG,t)}function klo(t){return tHe(kG,t)}function qlo(t){return rHe(kG,t)}function Ulo(t){return nHe(kG,t)}function Pmr(t){return oHe(sae,t)}function Blo(t){return aHe(uae,t)}function zlo(t){return uHe(Fot,t)}function Vlo(t){return lHe(Fot,t)}function Hlo(t){return cHe(Mmr,t)}function Wlo(t){return dHe(Rmr,t)}function Amr(t){return fHe(Imr,t)}function Jlo(){return pHe(Nmr)}function sOe(){return YL(Dmr)}function dOe(t){return Lee(jmr,t)}function Klo(t){return mHe($mr,t)}function Glo(t){return hHe(fOe,t)}function kot(t,e){return Xee(Lmr,t,e)}function Xlo(t){let e=t._zod.def.shape;return Jmr(Object.keys(e))}function Zlo(t,e){let r={type:"object",get shape(){return Dt.assignProp(this,"shape",{...t}),this.shape},...Dt.normalizeParams(e)};return new pOe(r)}function Ylo(t,e){return new pOe({type:"object",get shape(){return Dt.assignProp(this,"shape",{...t}),this.shape},catchall:dOe(),...Dt.normalizeParams(e)})}function Qlo(t,e){return new pOe({type:"object",get shape(){return Dt.assignProp(this,"shape",{...t}),this.shape},catchall:sOe(),...Dt.normalizeParams(e)})}function mOe(t,e){return new qot({type:"union",options:t,...Dt.normalizeParams(e)})}function eco(t,e,r){return new Fmr({type:"union",options:e,discriminator:t,...Dt.normalizeParams(r)})}function qmr(t,e){return new kmr({type:"intersection",left:t,right:e})}function tco(t,e,r){let n=e instanceof uo,o=n?r:e,i=n?e:null;return new Umr({type:"tuple",items:t,rest:i,...Dt.normalizeParams(o)})}function Bmr(t,e,r){return new Uot({type:"record",keyType:t,valueType:e,...Dt.normalizeParams(r)})}function rco(t,e,r){return new Uot({type:"record",keyType:mOe([t,dOe()]),valueType:e,...Dt.normalizeParams(r)})}function nco(t,e,r){return new zmr({type:"map",keyType:t,valueType:e,...Dt.normalizeParams(r)})}function oco(t,e){return new Vmr({type:"set",valueType:t,...Dt.normalizeParams(e)})}function Hmr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new oae({type:"enum",entries:r,...Dt.normalizeParams(e)})}function ico(t,e){return new oae({type:"enum",entries:t,...Dt.normalizeParams(e)})}function Jmr(t,e){return new Wmr({type:"literal",values:Array.isArray(t)?t:[t],...Dt.normalizeParams(e)})}function aco(t){return xHe(Kmr,t)}function zot(t){return new Bot({type:"transform",transform:t})}function uOe(t){return new Vot({type:"optional",innerType:t})}function lOe(t){return new Gmr({type:"nullable",innerType:t})}function sco(t){return uOe(lOe(t))}function Zmr(t,e){return new Xmr({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Qmr(t,e){return new Ymr({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function ehr(t,e){return new Hot({type:"nonoptional",innerType:t,...Dt.normalizeParams(e)})}function uco(t){return new thr({type:"success",innerType:t})}function nhr(t,e){return new rhr({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function lco(t){return yHe(ohr,t)}function cOe(t,e){return new Wot({type:"pipe",in:t,out:e})}function ahr(t){return new ihr({type:"readonly",innerType:t})}function cco(t,e){return new shr({type:"template_literal",parts:t,...Dt.normalizeParams(e)})}function lhr(t){return new uhr({type:"lazy",getter:t})}function dco(t){return new chr({type:"promise",innerType:t})}function dhr(t){let e=new gc({check:"custom"});return e._zod.check=t,e}function fco(t,e){return THe(hOe,t??(()=>!0),e)}function fhr(t,e={}){return OHe(hOe,t,e)}function phr(t){let e=dhr(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Dt.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Dt.issue(o))}},t(r.value,r)));return e}function pco(t,e={error:`Input not instance of ${t.name}`}){let r=new hOe({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...Dt.normalizeParams(e)});return r._zod.bag.Class=t,r}function hco(t){let e=lhr(()=>mOe([bot(t),Emr(),Pmr(),Amr(),kot(e),Bmr(bot(),e)]));return e}function gco(t,e){return cOe(zot(t),e)}var xi,vot,iae,Qu,wot,aOe,PD,Sot,Cot,xot,Tot,Oot,Eot,Pot,Mot,Rot,Iot,Aot,Not,Dot,jot,$ot,Lot,Omr,aae,kG,sae,uae,Fot,Mmr,Rmr,Imr,Nmr,Dmr,jmr,$mr,fOe,Lmr,pOe,qot,Fmr,kmr,Umr,Uot,zmr,Vmr,oae,Wmr,Kmr,Bot,Vot,Gmr,Xmr,Ymr,Hot,thr,rhr,ohr,Wot,ihr,shr,uhr,chr,hOe,mco,iOe=v(()=>{Iy();Iy();sot();oOe();yot();xi=xe("ZodType",(t,e)=>(uo.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>hc(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>pot(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>hot(t,r,n),t.parseAsync=async(r,n)=>mot(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>got(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(fhr(r,n)),t.superRefine=r=>t.check(phr(r)),t.overwrite=r=>t.check(ZN(r)),t.optional=()=>uOe(t),t.nullable=()=>lOe(t),t.nullish=()=>uOe(lOe(t)),t.nonoptional=r=>ehr(t,r),t.array=()=>kot(t),t.or=r=>mOe([t,r]),t.and=r=>qmr(t,r),t.transform=r=>cOe(t,zot(r)),t.default=r=>Zmr(t,r),t.prefault=r=>Qmr(t,r),t.catch=r=>nhr(t,r),t.pipe=r=>cOe(t,r),t.readonly=()=>ahr(t),t.describe=r=>{let n=t.clone();return ql.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return ql.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ql.get(t);let n=t.clone();return ql.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),vot=xe("_ZodString",(t,e)=>{Qz.init(t,e),xi.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(kee(...n)),t.includes=(...n)=>t.check(Bee(...n)),t.startsWith=(...n)=>t.check(zee(...n)),t.endsWith=(...n)=>t.check(Vee(...n)),t.min=(...n)=>t.check(QL(...n)),t.max=(...n)=>t.check(gJ(...n)),t.length=(...n)=>t.check(yJ(...n)),t.nonempty=(...n)=>t.check(QL(1,...n)),t.lowercase=n=>t.check(qee(n)),t.uppercase=n=>t.check(Uee(n)),t.trim=()=>t.check(Jee()),t.normalize=(...n)=>t.check(Wee(...n)),t.toLowerCase=()=>t.check(Kee()),t.toUpperCase=()=>t.check(Gee())}),iae=xe("ZodString",(t,e)=>{Qz.init(t,e),vot.init(t,e),t.email=r=>t.check(Jhe(wot,r)),t.url=r=>t.check(Yhe(Sot,r)),t.jwt=r=>t.check(pge(Lot,r)),t.emoji=r=>t.check(Qhe(Cot,r)),t.guid=r=>t.check($ee(aOe,r)),t.uuid=r=>t.check(Khe(PD,r)),t.uuidv4=r=>t.check(Ghe(PD,r)),t.uuidv6=r=>t.check(Xhe(PD,r)),t.uuidv7=r=>t.check(Zhe(PD,r)),t.nanoid=r=>t.check(ege(xot,r)),t.guid=r=>t.check($ee(aOe,r)),t.cuid=r=>t.check(tge(Tot,r)),t.cuid2=r=>t.check(rge(Oot,r)),t.ulid=r=>t.check(nge(Eot,r)),t.base64=r=>t.check(cge(Dot,r)),t.base64url=r=>t.check(dge(jot,r)),t.xid=r=>t.check(oge(Pot,r)),t.ksuid=r=>t.check(ige(Mot,r)),t.ipv4=r=>t.check(age(Rot,r)),t.ipv6=r=>t.check(sge(Iot,r)),t.cidrv4=r=>t.check(uge(Aot,r)),t.cidrv6=r=>t.check(lge(Not,r)),t.e164=r=>t.check(fge($ot,r)),t.datetime=r=>t.check(uot(r)),t.date=r=>t.check(lot(r)),t.time=r=>t.check(cot(r)),t.duration=r=>t.check(dot(r))});Qu=xe("ZodStringFormat",(t,e)=>{Ru.init(t,e),vot.init(t,e)}),wot=xe("ZodEmail",(t,e)=>{U2e.init(t,e),Qu.init(t,e)});aOe=xe("ZodGUID",(t,e)=>{k2e.init(t,e),Qu.init(t,e)});PD=xe("ZodUUID",(t,e)=>{q2e.init(t,e),Qu.init(t,e)});Sot=xe("ZodURL",(t,e)=>{B2e.init(t,e),Qu.init(t,e)});Cot=xe("ZodEmoji",(t,e)=>{z2e.init(t,e),Qu.init(t,e)});xot=xe("ZodNanoID",(t,e)=>{V2e.init(t,e),Qu.init(t,e)});Tot=xe("ZodCUID",(t,e)=>{H2e.init(t,e),Qu.init(t,e)});Oot=xe("ZodCUID2",(t,e)=>{W2e.init(t,e),Qu.init(t,e)});Eot=xe("ZodULID",(t,e)=>{J2e.init(t,e),Qu.init(t,e)});Pot=xe("ZodXID",(t,e)=>{K2e.init(t,e),Qu.init(t,e)});Mot=xe("ZodKSUID",(t,e)=>{G2e.init(t,e),Qu.init(t,e)});Rot=xe("ZodIPv4",(t,e)=>{eVe.init(t,e),Qu.init(t,e)});Iot=xe("ZodIPv6",(t,e)=>{tVe.init(t,e),Qu.init(t,e)});Aot=xe("ZodCIDRv4",(t,e)=>{rVe.init(t,e),Qu.init(t,e)});Not=xe("ZodCIDRv6",(t,e)=>{nVe.init(t,e),Qu.init(t,e)});Dot=xe("ZodBase64",(t,e)=>{iVe.init(t,e),Qu.init(t,e)});jot=xe("ZodBase64URL",(t,e)=>{aVe.init(t,e),Qu.init(t,e)});$ot=xe("ZodE164",(t,e)=>{sVe.init(t,e),Qu.init(t,e)});Lot=xe("ZodJWT",(t,e)=>{uVe.init(t,e),Qu.init(t,e)});Omr=xe("ZodCustomStringFormat",(t,e)=>{lVe.init(t,e),Qu.init(t,e)});aae=xe("ZodNumber",(t,e)=>{Bhe.init(t,e),xi.init(t,e),t.gt=(n,o)=>t.check(XN(n,o)),t.gte=(n,o)=>t.check(R_(n,o)),t.min=(n,o)=>t.check(R_(n,o)),t.lt=(n,o)=>t.check(GN(n,o)),t.lte=(n,o)=>t.check(PS(n,o)),t.max=(n,o)=>t.check(PS(n,o)),t.int=n=>t.check(_ot(n)),t.safe=n=>t.check(_ot(n)),t.positive=n=>t.check(XN(0,n)),t.nonnegative=n=>t.check(R_(0,n)),t.negative=n=>t.check(GN(0,n)),t.nonpositive=n=>t.check(PS(0,n)),t.multipleOf=(n,o)=>t.check(t4(n,o)),t.step=(n,o)=>t.check(t4(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});kG=xe("ZodNumberFormat",(t,e)=>{cVe.init(t,e),aae.init(t,e)});sae=xe("ZodBoolean",(t,e)=>{Mee.init(t,e),xi.init(t,e)});uae=xe("ZodBigInt",(t,e)=>{zhe.init(t,e),xi.init(t,e),t.gte=(n,o)=>t.check(R_(n,o)),t.min=(n,o)=>t.check(R_(n,o)),t.gt=(n,o)=>t.check(XN(n,o)),t.gte=(n,o)=>t.check(R_(n,o)),t.min=(n,o)=>t.check(R_(n,o)),t.lt=(n,o)=>t.check(GN(n,o)),t.lte=(n,o)=>t.check(PS(n,o)),t.max=(n,o)=>t.check(PS(n,o)),t.positive=n=>t.check(XN(BigInt(0),n)),t.negative=n=>t.check(GN(BigInt(0),n)),t.nonpositive=n=>t.check(PS(BigInt(0),n)),t.nonnegative=n=>t.check(R_(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(t4(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Fot=xe("ZodBigIntFormat",(t,e)=>{dVe.init(t,e),uae.init(t,e)});Mmr=xe("ZodSymbol",(t,e)=>{fVe.init(t,e),xi.init(t,e)});Rmr=xe("ZodUndefined",(t,e)=>{pVe.init(t,e),xi.init(t,e)});Imr=xe("ZodNull",(t,e)=>{mVe.init(t,e),xi.init(t,e)});Nmr=xe("ZodAny",(t,e)=>{hVe.init(t,e),xi.init(t,e)});Dmr=xe("ZodUnknown",(t,e)=>{ZL.init(t,e),xi.init(t,e)});jmr=xe("ZodNever",(t,e)=>{Ree.init(t,e),xi.init(t,e)});$mr=xe("ZodVoid",(t,e)=>{gVe.init(t,e),xi.init(t,e)});fOe=xe("ZodDate",(t,e)=>{yVe.init(t,e),xi.init(t,e),t.min=(n,o)=>t.check(R_(n,o)),t.max=(n,o)=>t.check(PS(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});Lmr=xe("ZodArray",(t,e)=>{Iee.init(t,e),xi.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(QL(r,n)),t.nonempty=r=>t.check(QL(1,r)),t.max=(r,n)=>t.check(gJ(r,n)),t.length=(r,n)=>t.check(yJ(r,n)),t.unwrap=()=>t.element});pOe=xe("ZodObject",(t,e)=>{bVe.init(t,e),xi.init(t,e),Dt.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Hmr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:sOe()}),t.loose=()=>t.clone({...t._zod.def,catchall:sOe()}),t.strict=()=>t.clone({...t._zod.def,catchall:dOe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Dt.extend(t,r),t.merge=r=>Dt.merge(t,r),t.pick=r=>Dt.pick(t,r),t.omit=r=>Dt.omit(t,r),t.partial=(...r)=>Dt.partial(Vot,t,r[0]),t.required=(...r)=>Dt.required(Hot,t,r[0])});qot=xe("ZodUnion",(t,e)=>{Vhe.init(t,e),xi.init(t,e),t.options=e.options});Fmr=xe("ZodDiscriminatedUnion",(t,e)=>{qot.init(t,e),_Ve.init(t,e)});kmr=xe("ZodIntersection",(t,e)=>{vVe.init(t,e),xi.init(t,e)});Umr=xe("ZodTuple",(t,e)=>{e4.init(t,e),xi.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});Uot=xe("ZodRecord",(t,e)=>{wVe.init(t,e),xi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});zmr=xe("ZodMap",(t,e)=>{SVe.init(t,e),xi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});Vmr=xe("ZodSet",(t,e)=>{CVe.init(t,e),xi.init(t,e),t.min=(...r)=>t.check(r4(...r)),t.nonempty=r=>t.check(r4(1,r)),t.max=(...r)=>t.check(hJ(...r)),t.size=(...r)=>t.check(Fee(...r))});oae=xe("ZodEnum",(t,e)=>{xVe.init(t,e),xi.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new oae({...e,checks:[],...Dt.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new oae({...e,checks:[],...Dt.normalizeParams(o),entries:i})}});Wmr=xe("ZodLiteral",(t,e)=>{TVe.init(t,e),xi.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});Kmr=xe("ZodFile",(t,e)=>{OVe.init(t,e),xi.init(t,e),t.min=(r,n)=>t.check(r4(r,n)),t.max=(r,n)=>t.check(hJ(r,n)),t.mime=(r,n)=>t.check(Hee(Array.isArray(r)?r:[r],n))});Bot=xe("ZodTransform",(t,e)=>{Aee.init(t,e),xi.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(Dt.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(Dt.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Vot=xe("ZodOptional",(t,e)=>{pJ.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Gmr=xe("ZodNullable",(t,e)=>{EVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Xmr=xe("ZodDefault",(t,e)=>{PVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});Ymr=xe("ZodPrefault",(t,e)=>{MVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Hot=xe("ZodNonOptional",(t,e)=>{RVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});thr=xe("ZodSuccess",(t,e)=>{IVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});rhr=xe("ZodCatch",(t,e)=>{AVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});ohr=xe("ZodNaN",(t,e)=>{NVe.init(t,e),xi.init(t,e)});Wot=xe("ZodPipe",(t,e)=>{Nee.init(t,e),xi.init(t,e),t.in=e.in,t.out=e.out});ihr=xe("ZodReadonly",(t,e)=>{DVe.init(t,e),xi.init(t,e)});shr=xe("ZodTemplateLiteral",(t,e)=>{jVe.init(t,e),xi.init(t,e)});uhr=xe("ZodLazy",(t,e)=>{LVe.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.getter()});chr=xe("ZodPromise",(t,e)=>{$Ve.init(t,e),xi.init(t,e),t.unwrap=()=>t._zod.def.innerType});hOe=xe("ZodCustom",(t,e)=>{FVe.init(t,e),xi.init(t,e)});mco=(...t)=>EHe({Pipe:Wot,Boolean:sae,String:iae,Transform:Bot},...t)});function bco(t){Pd({customError:t})}function _co(){return Pd().customError}var yco,mhr=v(()=>{Iy();yco={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"}});var Jot={};En(Jot,{bigint:()=>Cco,boolean:()=>Sco,date:()=>xco,number:()=>wco,string:()=>vco});function vco(t){return HVe(iae,t)}function wco(t){return YVe(aae,t)}function Sco(t){return iHe(sae,t)}function Cco(t){return sHe(uae,t)}function xco(t){return gHe(fOe,t)}var hhr=v(()=>{Iy();iOe()});var Yt={};En(Yt,{$brand:()=>T4e,$input:()=>BVe,$output:()=>UVe,NEVER:()=>x4e,TimePrecision:()=>WVe,ZodAny:()=>Nmr,ZodArray:()=>Lmr,ZodBase64:()=>Dot,ZodBase64URL:()=>jot,ZodBigInt:()=>uae,ZodBigIntFormat:()=>Fot,ZodBoolean:()=>sae,ZodCIDRv4:()=>Aot,ZodCIDRv6:()=>Not,ZodCUID:()=>Tot,ZodCUID2:()=>Oot,ZodCatch:()=>rhr,ZodCustom:()=>hOe,ZodCustomStringFormat:()=>Omr,ZodDate:()=>fOe,ZodDefault:()=>Xmr,ZodDiscriminatedUnion:()=>Fmr,ZodE164:()=>$ot,ZodEmail:()=>wot,ZodEmoji:()=>Cot,ZodEnum:()=>oae,ZodError:()=>plo,ZodFile:()=>Kmr,ZodGUID:()=>aOe,ZodIPv4:()=>Rot,ZodIPv6:()=>Iot,ZodISODate:()=>eOe,ZodISODateTime:()=>QTe,ZodISODuration:()=>rOe,ZodISOTime:()=>tOe,ZodIntersection:()=>kmr,ZodIssueCode:()=>yco,ZodJWT:()=>Lot,ZodKSUID:()=>Mot,ZodLazy:()=>uhr,ZodLiteral:()=>Wmr,ZodMap:()=>zmr,ZodNaN:()=>ohr,ZodNanoID:()=>xot,ZodNever:()=>jmr,ZodNonOptional:()=>Hot,ZodNull:()=>Imr,ZodNullable:()=>Gmr,ZodNumber:()=>aae,ZodNumberFormat:()=>kG,ZodObject:()=>pOe,ZodOptional:()=>Vot,ZodPipe:()=>Wot,ZodPrefault:()=>Ymr,ZodPromise:()=>chr,ZodReadonly:()=>ihr,ZodRealError:()=>FG,ZodRecord:()=>Uot,ZodSet:()=>Vmr,ZodString:()=>iae,ZodStringFormat:()=>Qu,ZodSuccess:()=>thr,ZodSymbol:()=>Mmr,ZodTemplateLiteral:()=>shr,ZodTransform:()=>Bot,ZodTuple:()=>Umr,ZodType:()=>xi,ZodULID:()=>Eot,ZodURL:()=>Sot,ZodUUID:()=>PD,ZodUndefined:()=>Rmr,ZodUnion:()=>qot,ZodUnknown:()=>Dmr,ZodVoid:()=>$mr,ZodXID:()=>Pot,_ZodString:()=>vot,_default:()=>Zmr,any:()=>Jlo,array:()=>kot,base64:()=>Nlo,base64url:()=>Dlo,bigint:()=>Blo,boolean:()=>Pmr,catch:()=>nhr,check:()=>dhr,cidrv4:()=>Ilo,cidrv6:()=>Alo,clone:()=>hc,coerce:()=>Jot,config:()=>Pd,core:()=>YN,cuid:()=>xlo,cuid2:()=>Tlo,custom:()=>fco,date:()=>Glo,discriminatedUnion:()=>eco,e164:()=>jlo,email:()=>hlo,emoji:()=>Slo,endsWith:()=>Vee,enum:()=>Hmr,file:()=>aco,flattenError:()=>Oee,float32:()=>Flo,float64:()=>klo,formatError:()=>Eee,function:()=>RHe,getErrorMap:()=>_co,globalRegistry:()=>ql,gt:()=>XN,gte:()=>R_,guid:()=>glo,includes:()=>Bee,instanceof:()=>pco,int:()=>_ot,int32:()=>qlo,int64:()=>zlo,intersection:()=>qmr,ipv4:()=>Mlo,ipv6:()=>Rlo,iso:()=>nOe,json:()=>hco,jwt:()=>$lo,keyof:()=>Xlo,ksuid:()=>Plo,lazy:()=>lhr,length:()=>yJ,literal:()=>Jmr,locales:()=>jee,looseObject:()=>Qlo,lowercase:()=>qee,lt:()=>GN,lte:()=>PS,map:()=>nco,maxLength:()=>gJ,maxSize:()=>hJ,mime:()=>Hee,minLength:()=>QL,minSize:()=>r4,multipleOf:()=>t4,nan:()=>lco,nanoid:()=>Clo,nativeEnum:()=>ico,negative:()=>_He,never:()=>dOe,nonnegative:()=>wHe,nonoptional:()=>ehr,nonpositive:()=>vHe,normalize:()=>Wee,null:()=>Amr,nullable:()=>lOe,nullish:()=>sco,number:()=>Emr,object:()=>Zlo,optional:()=>uOe,overwrite:()=>ZN,parse:()=>pot,parseAsync:()=>mot,partialRecord:()=>rco,pipe:()=>cOe,positive:()=>bHe,prefault:()=>Qmr,preprocess:()=>gco,prettifyError:()=>F4e,promise:()=>dco,property:()=>SHe,readonly:()=>ahr,record:()=>Bmr,refine:()=>fhr,regex:()=>kee,regexes:()=>Yz,registry:()=>Whe,safeParse:()=>hot,safeParseAsync:()=>got,set:()=>oco,setErrorMap:()=>bco,size:()=>Fee,startsWith:()=>zee,strictObject:()=>Ylo,string:()=>bot,stringFormat:()=>Llo,stringbool:()=>mco,success:()=>uco,superRefine:()=>phr,symbol:()=>Hlo,templateLiteral:()=>cco,toJSONSchema:()=>eF,toLowerCase:()=>Kee,toUpperCase:()=>Gee,transform:()=>zot,treeifyError:()=>L4e,trim:()=>Jee,tuple:()=>tco,uint32:()=>Ulo,uint64:()=>Vlo,ulid:()=>Olo,undefined:()=>Wlo,union:()=>mOe,unknown:()=>sOe,uppercase:()=>Uee,url:()=>wlo,uuid:()=>ylo,uuidv4:()=>blo,uuidv6:()=>_lo,uuidv7:()=>vlo,void:()=>Klo,xid:()=>Elo});var Kot=v(()=>{Iy();iOe();sot();fot();yot();mhr();Iy();kVe();Iy();qVe();oOe();oOe();hhr();Pd(Hhe())});var ghr=v(()=>{Kot();Kot()});var eH=v(()=>{ghr()});var bhr,yhr,_hr,gOe=v(()=>{bhr=Symbol("Let zodToJsonSchema decide on which parser to use"),yhr={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"},_hr=t=>typeof t=="string"?{...yhr,basePath:["#"],definitions:{},name:t}:{...yhr,basePath:["#"],definitions:{},...t}});function vhr(t){if(!t)return!0;for(let e in t)return!1;return!0}var lae,Got=v(()=>{lae=t=>"_def"in t?t._def:t});var whr,Xot=v(()=>{gOe();Got();whr=t=>{let e=_hr(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])=>[lae(o),{def:lae(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function Zot(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ji(t,e,r,n,o){t[e]=r,Zot(t,e,n,o)}var dq=v(()=>{});function Shr(){return{}}var Yot=v(()=>{});function Chr(t,e){let r={type:"array"};return t.type?._def?.typeName!==Ae.ZodAny&&(r.items=Dn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ji(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ji(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ji(r,"minItems",t.exactLength.value,t.exactLength.message,e),Ji(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var Qot=v(()=>{cO();dq();$d()});function xhr(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?Ji(r,"minimum",n.value,n.message,e):Ji(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ji(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ji(r,"maximum",n.value,n.message,e):Ji(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ji(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ji(r,"multipleOf",n.value,n.message,e);break}return r}var eit=v(()=>{dq()});function Thr(){return{type:"boolean"}}var tit=v(()=>{});function Ohr(t,e){return Dn(t.type._def,e)}var rit=v(()=>{$d()});var Ehr,nit=v(()=>{$d();Ehr=(t,e)=>Dn(t.innerType._def,e)});function oit(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>oit(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 Oco(t,e)}}var Oco,iit=v(()=>{dq();Oco=(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":Ji(r,"minimum",n.value,n.message,e);break;case"max":Ji(r,"maximum",n.value,n.message,e);break}return r}});function Phr(t,e){return{...Dn(t.innerType._def,e),default:t.defaultValue()}}var ait=v(()=>{$d()});function Mhr(t,e,r){return e.effectStrategy==="input"?Dn(t.schema._def,e,r):{}}var sit=v(()=>{$d()});function Rhr(t){return{type:"string",enum:[...t.values]}}var uit=v(()=>{});function Ihr(t,e){let r=[Dn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Dn(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(Eco(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 Eco,lit=v(()=>{$d();Eco=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function Ahr(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 cit=v(()=>{});function yOe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Pco(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Ji(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Ji(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":Lx(r,"email",o.message,e);break;case"format:idn-email":Lx(r,"idn-email",o.message,e);break;case"pattern:zod":Fx(r,tH.email,o.message,e);break}break;case"url":Lx(r,"uri",o.message,e);break;case"uuid":Lx(r,"uuid",o.message,e);break;case"regex":Fx(r,o.regex,o.message,e);break;case"cuid":Fx(r,tH.cuid,o.message,e);break;case"cuid2":Fx(r,tH.cuid2,o.message,e);break;case"startsWith":Fx(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":Fx(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Lx(r,"date-time",o.message,e);break;case"date":Lx(r,"date",o.message,e);break;case"time":Lx(r,"time",o.message,e);break;case"duration":Lx(r,"duration",o.message,e);break;case"length":Ji(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Ji(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{Fx(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Lx(r,"ipv4",o.message,e),o.version!=="v4"&&Lx(r,"ipv6",o.message,e);break}case"emoji":Fx(r,tH.emoji,o.message,e);break;case"ulid":{Fx(r,tH.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Lx(r,"binary",o.message,e);break}case"contentEncoding:base64":{Ji(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Fx(r,tH.base64,o.message,e);break}}break}case"nanoid":Fx(r,tH.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var dit,tH,Pco,Lx,Fx,Nhr,bOe=v(()=>{dq();tH={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:()=>(dit===void 0&&(dit=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),dit),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}$/};Pco=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Lx=(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}}})):Ji(t,"format",e,r,n)},Fx=(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:Nhr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Ji(t,"pattern",Nhr(e,n),r,n)},Nhr=(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 _Oe(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===Ae.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ae.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(yOe(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===Ae.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var vOe=v(()=>{cO();$d();bOe()});function Dhr(t,e){if(e.mapStrategy==="record")return _Oe(t,e);let r=Dn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Dn(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 fit=v(()=>{$d();vOe()});function jhr(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 pit=v(()=>{});function $hr(){return{not:{}}}var mit=v(()=>{});function Lhr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var hit=v(()=>{});function khr(t,e){if(e.target==="openApi3")return Fhr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in cae&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=cae[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 Fhr(t,e)}var cae,Fhr,wOe=v(()=>{$d();cae={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Fhr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Dn(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 qhr(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:cae[t.innerType._def.typeName],nullable:!0}:{type:[cae[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var git=v(()=>{$d();wOe()});function Uhr(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",Zot(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Ji(r,"minimum",n.value,n.message,e):Ji(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Ji(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Ji(r,"maximum",n.value,n.message,e):Ji(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Ji(r,"maximum",n.value,n.message,e));break;case"multipleOf":Ji(r,"multipleOf",n.value,n.message,e);break}return r}var yit=v(()=>{dq()});function Mco(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Dn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Dn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Bhr(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=Dn(i._def,{...e,currentPath:a,propertyPath:a});if(s===void 0)return n;if(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&typeof i._def?.defaultValue>"u")throw new Error(`Zod field at \`${a.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);return{properties:{...n.properties,[o]:s},required:i.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:Mco(t,e)};return r.required.length||delete r.required,r}var bit=v(()=>{$d()});var zhr,_it=v(()=>{$d();zhr=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Dn(t.innerType._def,{...e,currentPath:e.currentPath});let r=Dn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var Vhr,vit=v(()=>{$d();Vhr=(t,e)=>{if(e.pipeStrategy==="input")return Dn(t.in._def,e);if(e.pipeStrategy==="output")return Dn(t.out._def,e);let r=Dn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Dn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function Hhr(t,e){return Dn(t.type._def,e)}var wit=v(()=>{$d()});function Whr(t,e){let n={type:"array",uniqueItems:!0,items:Dn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Ji(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ji(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var Sit=v(()=>{dq();$d()});function Jhr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Dn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Dn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Dn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var Cit=v(()=>{$d()});function Khr(){return{not:{}}}var xit=v(()=>{});function Ghr(){return{}}var Tit=v(()=>{});var Xhr,Oit=v(()=>{$d();Xhr=(t,e)=>Dn(t.innerType._def,e)});function Dn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==bhr)return a}if(n&&!r){let a=Rco(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=Aco(t,t.typeName,e,r);return i&&Nco(t,e,i),o.jsonSchema=i,i}var Rco,Ico,Aco,Nco,$d=v(()=>{cO();Yot();Qot();eit();tit();rit();nit();iit();ait();sit();uit();lit();cit();fit();pit();mit();hit();git();yit();bit();_it();vit();wit();vOe();Sit();bOe();Cit();xit();wOe();Tit();Oit();gOe();Rco=(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:Ico(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}},Ico=(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("/")},Aco=(t,e,r,n)=>{switch(e){case Ae.ZodString:return yOe(t,r);case Ae.ZodNumber:return Uhr(t,r);case Ae.ZodObject:return Bhr(t,r);case Ae.ZodBigInt:return xhr(t,r);case Ae.ZodBoolean:return Thr();case Ae.ZodDate:return oit(t,r);case Ae.ZodUndefined:return Khr();case Ae.ZodNull:return Lhr(r);case Ae.ZodArray:return Chr(t,r);case Ae.ZodUnion:case Ae.ZodDiscriminatedUnion:return khr(t,r);case Ae.ZodIntersection:return Ihr(t,r);case Ae.ZodTuple:return Jhr(t,r);case Ae.ZodRecord:return _Oe(t,r);case Ae.ZodLiteral:return Ahr(t,r);case Ae.ZodEnum:return Rhr(t);case Ae.ZodNativeEnum:return jhr(t);case Ae.ZodNullable:return qhr(t,r);case Ae.ZodOptional:return zhr(t,r);case Ae.ZodMap:return Dhr(t,r);case Ae.ZodSet:return Whr(t,r);case Ae.ZodLazy:return Dn(t.getter()._def,r);case Ae.ZodPromise:return Hhr(t,r);case Ae.ZodNaN:case Ae.ZodNever:return $hr();case Ae.ZodEffects:return Mhr(t,r,n);case Ae.ZodAny:return Shr();case Ae.ZodUnknown:return Ghr();case Ae.ZodDefault:return Phr(t,r);case Ae.ZodBranded:return Ohr(t,r);case Ae.ZodReadonly:return Xhr(t,r);case Ae.ZodCatch:return Ehr(t,r);case Ae.ZodPipeline:return Vhr(t,r);case Ae.ZodFunction:case Ae.ZodVoid:case Ae.ZodSymbol:return;default:return(o=>{})(e)}},Nco=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Eit,Pit=v(()=>{$d();Xot();Got();Eit=(t,e)=>{let r=whr(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Dn(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(vhr(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]=Dn(lae(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 Zhr=v(()=>{gOe();Xot();dq();$d();Yot();Qot();eit();tit();rit();nit();iit();ait();sit();uit();lit();cit();fit();pit();mit();hit();git();yit();bit();_it();vit();wit();Oit();vOe();Sit();bOe();Cit();xit();wOe();Tit();Pit();Pit()});function Yhr(t){if(t.type!=="object")throw new Error(`Root schema must have type: 'object' but got type: ${t.type?`'${t.type}'`:"undefined"}`);let e=structuredClone(t);return MD(e,[],e)}function Mit(t){if(typeof t=="boolean")return!1;if(t.type==="null")return!0;for(let e of t.oneOf??[])if(Mit(e))return!0;for(let e of t.anyOf??[])if(Mit(e))return!0;return!1}function MD(t,e,r){if(typeof t=="boolean")throw new TypeError(`Expected object schema but got boolean; path=${e.join("/")}`);if(!rH(t))throw new TypeError(`Expected ${JSON.stringify(t)} to be an object; path=${e.join("/")}`);let n=t.$defs;if(rH(n))for(let[f,p]of Object.entries(n))MD(p,[...e,"$defs",f],r);let o=t.definitions;if(rH(o))for(let[f,p]of Object.entries(o))MD(p,[...e,"definitions",f],r);t.type==="object"&&!("additionalProperties"in t)&&(t.additionalProperties=!1);let a=t.required??[],s=t.properties;if(rH(s)){for(let[f,p]of Object.entries(s))if(!Mit(p)&&!a.includes(f))throw new Error(`Zod field at \`${[...e,"properties",f].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`);t.required=Object.keys(s),t.properties=Object.fromEntries(Object.entries(s).map(([f,p])=>[f,MD(p,[...e,"properties",f],r)]))}let u=t.items;rH(u)&&(t.items=MD(u,[...e,"items"],r));let l=t.anyOf;Array.isArray(l)&&(t.anyOf=l.map((f,p)=>MD(f,[...e,"anyOf",String(p)],r)));let c=t.allOf;if(Array.isArray(c))if(c.length===1){let f=MD(c[0],[...e,"allOf","0"],r);Object.assign(t,f),delete t.allOf}else t.allOf=c.map((f,p)=>MD(f,[...e,"allOf",String(p)],r));t.default===null&&delete t.default;let d=t.$ref;if(d&&jco(t,1)){if(typeof d!="string")throw new TypeError(`Received non-string $ref - ${d}; path=${e.join("/")}`);let f=Dco(r,d);if(typeof f=="boolean")throw new Error(`Expected \`$ref: ${d}\` to resolve to an object schema but got boolean`);if(!rH(f))throw new Error(`Expected \`$ref: ${d}\` to resolve to an object but got ${JSON.stringify(f)}`);return Object.assign(t,{...f,...t}),delete t.$ref,MD(t,e,r)}return t}function Dco(t,e){if(!e.startsWith("#/"))throw new Error(`Unexpected $ref format ${JSON.stringify(e)}; Does not start with #/`);let r=e.slice(2).split("/"),n=t;for(let o of r){if(!rH(n))throw new Error(`encountered non-object entry while resolving ${e} - ${JSON.stringify(n)}`);let i=n[o];if(i===void 0)throw new Error(`Key ${o} not found while resolving ${e}`);n=i}return n}function rH(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function jco(t,e){let r=0;for(let n in t)if(r++,r>e)return!0;return!1}var Qhr=v(()=>{});function $co(t,e){return Eit(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Lco(t){return Yhr(eF(t,{target:"draft-7"}))}function Fco(t){return"_zod"in t}function egr(t,e,r){return Ppr({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Fco(t)?Lco(t):$co(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var tgr=v(()=>{eH();rG();Zhr();zTe();Qhr()});function ngr(t,e){if(typeof e<"u"&&!rgr.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${rgr.join(", ")}`);let r=!t.startsWith("gpt-3")&&!t.startsWith("gpt-4-")&&t!=="gpt-4";if(r&&!e)return"jsonSchema";if(!r&&e==="jsonSchema")throw new Error(`JSON Schema is not supported for model "${t}". Please use a different method, e.g. "functionCalling" or "jsonMode".`);return e??"functionCalling"}function kco(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function ogr(t,e,r){if(yc(t))return egr(t,e,r);if(Iu(t))return kco({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Ci(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>aO(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}function igr(t,e){if(e&&typeof e=="object"&&"images"in e&&Array.isArray(e.images)){let r=e.images.filter(n=>typeof n?.image_url?.url=="string").map(n=>({type:"image",url:n.image_url.url}));return[{type:"text",text:t},...r]}return t}var rgr,Rit=v(()=>{uv();Ny();Iy();tgr();rgr=["jsonSchema","functionCalling","jsonMode"]});var qco,agr,sgr=v(()=>{qco={"gpt-4.1-nano":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-3-small":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-05-13":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-08-06":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1-mini":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-3.5-turbo":{maxInputTokens:16385,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1,imageUrlInputs:!1,pdfToolMessage:!1,imageToolMessage:!1,toolChoice:!0},"text-embedding-3-large":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4-turbo":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-preview":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-mini":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"codex-mini-latest":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-nano":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o1:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-mini":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-mini":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-ada-002":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-11-20":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o3:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-chat-latest":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-mini":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-pro":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:272e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0}},agr=qco});var nH,dae=v(()=>{uq();LG();lq();cq();Rit();sgr();dA();uv();Ny();au();YI();Nw();sw();fO();PV();nH=class extends jd{constructor(e){super(e??{});x(this,"temperature");x(this,"topP");x(this,"frequencyPenalty");x(this,"presencePenalty");x(this,"n");x(this,"logitBias");x(this,"model","gpt-3.5-turbo");x(this,"modelKwargs");x(this,"stop");x(this,"stopSequences");x(this,"user");x(this,"timeout");x(this,"streaming",!1);x(this,"streamUsage",!0);x(this,"maxTokens");x(this,"logprobs");x(this,"topLogprobs");x(this,"apiKey");x(this,"organization");x(this,"__includeRawResponse");x(this,"client");x(this,"clientConfig");x(this,"supportsStrictToolCalling");x(this,"audio");x(this,"modalities");x(this,"reasoning");x(this,"zdrEnabled");x(this,"service_tier");x(this,"promptCacheKey");x(this,"promptCacheRetention");x(this,"verbosity");x(this,"defaultOptions");x(this,"lc_serializable",!0);let r=typeof e?.configuration?.apiKey=="string"||typeof e?.configuration?.apiKey=="function"?e?.configuration?.apiKey:void 0;this.apiKey=e?.apiKey??r??Xr("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??Xr("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelKwargs=e?.modelKwargs??{},this.timeout=e?.timeout,this.temperature=e?.temperature??this.temperature,this.topP=e?.topP??this.topP,this.frequencyPenalty=e?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=e?.presencePenalty??this.presencePenalty,this.logprobs=e?.logprobs,this.topLogprobs=e?.topLogprobs,this.n=e?.n??this.n,this.logitBias=e?.logitBias,this.stop=e?.stopSequences??e?.stop,this.stopSequences=this.stop,this.user=e?.user,this.__includeRawResponse=e?.__includeRawResponse,this.audio=e?.audio,this.modalities=e?.modalities,this.reasoning=e?.reasoning,this.maxTokens=e?.maxCompletionTokens??e?.maxTokens,this.promptCacheKey=e?.promptCacheKey??this.promptCacheKey,this.promptCacheRetention=e?.promptCacheRetention??this.promptCacheRetention,this.verbosity=e?.verbosity??this.verbosity,this.disableStreaming=e?.disableStreaming===!0,this.streaming=e?.streaming===!0,this.disableStreaming&&(this.streaming=!1),e?.streaming===!1&&(this.disableStreaming=!0),this.streamUsage=e?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration},e?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=e.supportsStrictToolCalling),e?.service_tier!==void 0&&(this.service_tier=e.service_tier),this.zdrEnabled=e?.zdrEnabled??!1}_llmType(){return"openai"}static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning","service_tier"]}get lc_secrets(){return{apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{apiKey:"openai_api_key",modelName:"model"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","model","modelName","modelKwargs","stop","stopSequences","timeout","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming","zdrEnabled","reasoning","promptCacheKey","promptCacheRetention","verbosity"]}getLsParams(e){let r=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:r.temperature??void 0,ls_max_tokens:r.max_tokens??void 0,ls_stop:e.stop}}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}identifyingParams(){return this._identifyingParams()}_getReasoningParams(e){if(!OD(this.model))return;let r;return this.reasoning!==void 0&&(r={...r,...this.reasoning}),e?.reasoning!==void 0&&(r={...r,...e.reasoning}),r}_getResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&Ii(e.json_schema.schema)?ogr(e.json_schema.schema,e.json_schema.name,{description:e.json_schema.description}):e}_combineCallOptions(e){return{...this.defaultOptions,...e??{}}}_getClientOptions(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=fA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=pA(i.defaultHeaders),this.client=new xn(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return QV(e)?Cmr(e.metadata.customTool):Aw(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:pmr(e,r)}bindTools(e,r){let n;return r?.strict!==void 0?n=r.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling),this.withConfig({tools:e.map(o=>$G(o)||QV(o)?o:gmr(o)?o.extras.providerToolDefinition:this._convertChatOpenAIToolToCompletionsTool(o,{strict:n})),...r})}async stream(e,r){return super.stream(e,this._combineCallOptions(r))}async invoke(e,r){return super.invoke(e,this._combineCallOptions(r))}_combineLLMOutput(...e){return e.reduce((r,n)=>(n&&n.tokenUsage&&(r.tokenUsage.completionTokens+=n.tokenUsage.completionTokens??0,r.tokenUsage.promptTokens+=n.tokenUsage.promptTokens??0,r.tokenUsage.totalTokens+=n.tokenUsage.totalTokens??0),r),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}async getNumTokensFromMessages(e){let r=0,n=0,o=0;this.model==="gpt-3.5-turbo-0301"?(n=4,o=-1):(n=3,o=1);let i=await Promise.all(e.map(async a=>{let s=await this.getNumTokens(a.content),u=await this.getNumTokens(ED(a)),l=a.name!==void 0?o+await this.getNumTokens(a.name):0,c=s+n+u+l,d=a;if(d._getType()==="function"&&(c-=2),d.additional_kwargs?.function_call&&(c+=3),d?.additional_kwargs.function_call?.name&&(c+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{c+=await this.getNumTokens(JSON.stringify(JSON.parse(d.additional_kwargs.function_call?.arguments)))}catch(f){console.error("Error parsing function arguments",f,JSON.stringify(d.additional_kwargs.function_call)),c+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return r+=c,c}));return r+=3,{totalCount:r,countPerMessage:i}}async _getNumTokensFromGenerations(e){return(await Promise.all(e.map(async n=>n.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([n.message])).countPerMessage[0]:await this.getNumTokens(n.message.content)))).reduce((n,o)=>n+o,0)}async _getEstimatedTokenCountFromPrompt(e,r,n){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(r&&n!=="auto"){let i=mmr(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 moderateContent(e,r){let n=this._getClientOptions(r?.options),o=r?.model??"omni-moderation-latest",i={input:e,model:o};return this.caller.call(async()=>{try{return await this.client.moderations.create(i,n)}catch(a){throw w0(a)}})}get profile(){return agr[this.model]??{}}_getStructuredOutputMethod(e){let r={...e};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(r?.method===void 0)return"jsonSchema"}else r.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return r.method}withStructuredOutput(e,r){let n,o,{schema:i,name:a,includeRaw:s}={...r,schema:e};if(r?.strict!==void 0&&r.method==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");let u=ngr(this.model,r?.method);if(u==="jsonMode"){Ii(i)?o=uw.fromZodSchema(i):o=new j_;let f=Ci(i);n=this.withConfig({outputVersion:"v0",response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:a??"extract",...f}}})}else if(u==="jsonSchema"){let f={name:a??"extract",description:nF(i),schema:i,strict:r?.strict},p=Ci(f.schema);if(n=this.withConfig({outputVersion:"v0",response_format:{type:"json_schema",json_schema:f},ls_structured_output_format:{kwargs:{method:"json_schema"},schema:{title:f.name,description:f.description,...p}}}),Ii(i)){let m=uw.fromZodSchema(i);o=D_.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else o=new j_}else{let f=a??"extract";if(Ii(i)){let p=Ci(i);n=this.withConfig({outputVersion:"v0",tools:[{type:"function",function:{name:f,description:p.description,parameters:p}}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...p}},...r?.strict!==void 0?{strict:r.strict}:{}}),o=new lv({returnSingle:!0,keyName:f,zodSchema:i})}else{let p;typeof i.name=="string"&&typeof i.parameters=="object"&&i.parameters!=null?(p=i,f=i.name):(f=i.title??f,p={name:f,description:i.description??"",parameters:i});let m=Ci(i);n=this.withConfig({outputVersion:"v0",tools:[{type:"function",function:p}],tool_choice:{type:"function",function:{name:f}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:f,...m}},...r?.strict!==void 0?{strict:r.strict}:{}}),o=new lv({returnSingle:!0,keyName:f})}}if(!s)return n.pipe(o);let l=Au.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=Au.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Bl.from([{raw:n},d])}}});var SOe,Iit,Ait,ugr,lgr,fae,qG=v(()=>{lq();Rit();ta();PV();SOe={providerName:"ChatOpenAI",fromStandardTextBlock(t){return{type:"text",text:t.text}},fromStandardImageBlock(t){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};if(t.source_type==="base64")return{type:"image_url",image_url:{url:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};throw new Error(`Image content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(t){if(t.source_type==="url"){let e=Cy({dataUrl:t.url});if(!e)throw new Error(`URL audio blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);let r=e.mime_type||t.mime_type||"",n;try{n=$Q(r)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(n.type!=="audio"||n.subtype!=="wav"&&n.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:n.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=$Q(t.mime_type??"")}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(e.type!=="audio"||e.subtype!=="wav"&&e.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:e.subtype,data:t.data}}}throw new Error(`Audio content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(t){if(t.source_type==="url"){let e=Cy({dataUrl:t.url}),r=jG(t);if(!e)throw new Error(`URL file blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:t.url,...t.metadata?.filename||t.metadata?.name?{filename:r}:{}}}}if(t.source_type==="base64"){let e=jG(t);return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.filename||t.metadata?.name||t.metadata?.title?{filename:e}:{}}}}if(t.source_type==="id")return{type:"file",file:{file_id:t.id}};throw new Error(`File content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)}},Iit=({message:t,rawResponse:e,includeRawResponse:r})=>{let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let l of n??[])try{o.push(Ix(l,{returnId:!0}))}catch(c){i.push(_0(l,c.message))}let a={function_call:t.function_call,tool_calls:n};r!==void 0&&(a.__raw_response=e);let s={model_provider:"openai",model_name:e.model,...e.system_fingerprint?{usage:{...e.usage},system_fingerprint:e.system_fingerprint}:{}};t.audio&&(a.audio=t.audio);let u=igr(t.content||"",e.choices?.[0]?.message);return new Pn({content:u,tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:e.id})}default:return new Td(t.content||"",t.role??"unknown")}},Ait=({delta:t,rawResponse:e,includeRawResponse:r,defaultRole:n})=>{let o=t.role??n,i=t.content??"",a;t.function_call?a={function_call:t.function_call}:t.tool_calls?a={tool_calls:t.tool_calls}:a={},r&&(a.__raw_response=e),t.audio&&(a.audio={...t.audio,index:e.choices[0].index});let s={model_provider:"openai",usage:{...e.usage}};if(o==="user")return new rw({content:i,response_metadata:s});if(o==="assistant"){let u=[];if(Array.isArray(t.tool_calls))for(let l of t.tool_calls)u.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new Er({content:i,tool_call_chunks:u,additional_kwargs:a,id:e.id,response_metadata:s})}else return o==="system"?new Rb({content:i,response_metadata:s}):o==="developer"?new Rb({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new tw({content:i,additional_kwargs:a,name:t.name,response_metadata:s}):o==="tool"?new _S({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:s}):new ew({content:i,role:o,response_metadata:s})},ugr=t=>{if(t.type==="image"){if(t.url)return{type:"image_url",image_url:{url:t.url}};if(t.data)return{type:"image_url",image_url:{url:`data:${t.mimeType};base64,${t.data}`}}}if(t.type==="audio"&&t.data){let e=sme(()=>{let[,r]=t.mimeType.split("/");return r==="wav"||r==="mp3"?r:"wav"});return{type:"input_audio",input_audio:{data:t.data.toString(),format:e}}}if(t.type==="file"){if(t.data){let e=jG(t);return{type:"file",file:{file_data:`data:${t.mimeType};base64,${t.data}`,filename:e}}}if(t.fileId)return{type:"file",file:{file_id:t.fileId}}}},lgr=({message:t,model:e})=>{let r=ED(t);if(r==="system"&&OD(e)&&(r="developer"),r==="developer")return{role:"developer",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="system")return{role:"system",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="assistant")return{role:"assistant",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="tool"&&Mh.isInstance(t))return{role:"tool",tool_call_id:t.tool_call_id,content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="function")return{role:"function",name:t.name??"",content:t.contentBlocks.filter(o=>o.type==="text").join("")};function*n(o){for(let i of o){i.type==="text"&&(yield{type:"text",text:i.text});let a=ugr(i);a&&(yield a)}}return{role:"user",content:Array.from(n(t.contentBlocks))}},fae=({messages:t,model:e})=>t.flatMap(r=>{if("output_version"in r.response_metadata&&r.response_metadata?.output_version==="v1")return lgr({message:r});let n=ED(r);n==="system"&&OD(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Ph(a)?GT(a,SOe):a),i={role:n,content:o};if(r.name!=null&&(i.name=r.name),r.additional_kwargs.function_call!=null&&(i.function_call=r.additional_kwargs.function_call),Pn.isInstance(r)&&r.tool_calls?.length?i.tool_calls=r.tool_calls.map(Jk):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),Mh.isInstance(r)&&r.tool_call_id!=null&&(i.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio){let a={role:"assistant",audio:{id:r.additional_kwargs.audio.id}};return[i,a]}return i})});var fq,COe=v(()=>{uq();LG();lq();dae();qG();ta();Ed();fq=class extends nH{invocationParams(t,e){let r;t?.strict!==void 0?r=t.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling);let n={};t?.stream_options!==void 0?n={stream_options:t.stream_options}:this.streamUsage&&(this.streaming||e?.streaming)&&(n={stream_options:{include_usage:!0}});let o={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:t?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:t?.functions,function_call:t?.function_call,tools:t?.tools?.length?t.tools.map(a=>this._convertChatOpenAIToolToCompletionsTool(a,{strict:r})):void 0,tool_choice:ZTe(t?.tool_choice),response_format:this._getResponseFormat(t?.response_format),seed:t?.seed,...n,parallel_tool_calls:t?.parallel_tool_calls,...this.audio||t?.audio?{audio:this.audio||t?.audio}:{},...this.modalities||t?.modalities?{modalities:this.modalities||t?.modalities}:{},...this.modelKwargs,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,verbosity:t?.verbosity??this.verbosity};t?.prediction!==void 0&&(o.prediction=t.prediction),this.service_tier!==void 0&&(o.service_tier=this.service_tier),t?.service_tier!==void 0&&(o.service_tier=t.service_tier);let i=this._getReasoningParams(t);return i!==void 0&&i.effort!==void 0&&(o.reasoning_effort=i.effort),OD(o.model)?o.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:o.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,o}async _generate(t,e,r){let n={},o=this.invocationParams(e),i=fae({messages:t,model:this.model});if(o.stream){let a=this._streamResponseChunks(t,e,r),s={};for await(let p of a){p.message.response_metadata={...p.generationInfo,...p.message.response_metadata};let m=p.generationInfo?.completion??0;s[m]===void 0?s[m]=p:s[m]=s[m].concat(p)}let u=Object.entries(s).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),{functions:l,function_call:c}=this.invocationParams(e),d=await this._getEstimatedTokenCountFromPrompt(t,l,c),f=await this._getNumTokensFromGenerations(u);return n.input_tokens=d,n.output_tokens=f,n.total_tokens=d+f,{generations:u,llmOutput:{estimatedTokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}else{let a=await this.completionWithRetry({...o,stream:!1,messages:i},{signal:e?.signal,...e?.options}),{completion_tokens:s,prompt_tokens:u,total_tokens:l,prompt_tokens_details:c,completion_tokens_details:d}=a?.usage??{};s&&(n.output_tokens=(n.output_tokens??0)+s),u&&(n.input_tokens=(n.input_tokens??0)+u),l&&(n.total_tokens=(n.total_tokens??0)+l),(c?.audio_tokens!==null||c?.cached_tokens!==null)&&(n.input_token_details={...c?.audio_tokens!==null&&{audio:c?.audio_tokens},...c?.cached_tokens!==null&&{cache_read:c?.cached_tokens}}),(d?.audio_tokens!==null||d?.reasoning_tokens!==null)&&(n.output_token_details={...d?.audio_tokens!==null&&{audio:d?.audio_tokens},...d?.reasoning_tokens!==null&&{reasoning:d?.reasoning_tokens}});let f=[];for(let p of a?.choices??[]){let h={text:p.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(p.message??{role:"assistant"},a)};h.generationInfo={...p.finish_reason?{finish_reason:p.finish_reason}:{},...p.logprobs?{logprobs:p.logprobs}:{}},kl(h.message)&&(h.message.usage_metadata=n),h.message=new Pn(Object.fromEntries(Object.entries(h.message).filter(([y])=>!y.startsWith("lc_")))),f.push(h)}return{generations:f,llmOutput:{tokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}}async*_streamResponseChunks(t,e,r){let n=fae({messages:t,model:this.model}),o={...this.invocationParams(e,{streaming:!0}),messages:n,stream:!0},i,a=await this.completionWithRetry(o,e),s;for await(let u of a){let l=u?.choices?.[0];if(u.usage&&(s=u.usage),!l)continue;let{delta:c}=l;if(!c)continue;let d=this._convertCompletionsDeltaToBaseMessageChunk(c,u,i);i=c.role??i;let f={prompt:e.promptIndex??0,completion:l.index??0};if(typeof d.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let p={...f};l.finish_reason!=null&&(p.finish_reason=l.finish_reason,p.system_fingerprint=u.system_fingerprint,p.model_name=u.model,p.service_tier=u.service_tier),this.logprobs&&(p.logprobs=l.logprobs);let m=new si({message:d,text:d.content,generationInfo:p});yield m,await r?.handleLLMNewToken(m.text??"",f,void 0,void 0,void 0,{chunk:m})}if(s){let u={...s.prompt_tokens_details?.audio_tokens!==null&&{audio:s.prompt_tokens_details?.audio_tokens},...s.prompt_tokens_details?.cached_tokens!==null&&{cache_read:s.prompt_tokens_details?.cached_tokens}},l={...s.completion_tokens_details?.audio_tokens!==null&&{audio:s.completion_tokens_details?.audio_tokens},...s.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:s.completion_tokens_details?.reasoning_tokens}};yield new si({message:new Er({content:"",response_metadata:{usage:{...s}},usage_metadata:{input_tokens:s.prompt_tokens,output_tokens:s.completion_tokens,total_tokens:s.total_tokens,...Object.keys(u).length>0&&{input_token_details:u},...Object.keys(l).length>0&&{output_token_details:l}}}),text:""})}if(e.signal?.aborted)throw new Error("AbortError")}async completionWithRetry(t,e){let r=this._getClientOptions(e),n=t.response_format&&t.response_format.type==="json_schema";return this.caller.call(async()=>{try{return n&&!t.stream?await this.client.chat.completions.parse(t,r):await this.client.chat.completions.create(t,r)}catch(o){throw w0(o)}})}_convertCompletionsDeltaToBaseMessageChunk(t,e,r){return Ait({delta:t,rawResponse:e,includeRawResponse:this.__includeRawResponse,defaultRole:r})}_convertCompletionsMessageToBaseMessage(t,e){return Iit({message:t,rawResponse:e,includeRawResponse:this.__includeRawResponse})}}});var xOe=v(()=>{cq();dA();au()});var Nit=v(()=>{COe();xOe()});var UG,Dit,TOe,hgr,jit,ggr,OOe,EOe=v(()=>{LG();lq();qG();ta();Ed();PV();UG="__openai_function_call_ids__",Dit=t=>{let e={...t?.input_tokens_details?.cached_tokens!=null&&{cache_read:t?.input_tokens_details?.cached_tokens}},r={...t?.output_tokens_details?.reasoning_tokens!=null&&{reasoning:t?.output_tokens_details?.reasoning_tokens}};return{input_tokens:t?.input_tokens??0,output_tokens:t?.output_tokens??0,total_tokens:t?.total_tokens??0,input_token_details:e,output_token_details:r}},TOe=t=>{if(t.error){let s=new Error(t.error.message);throw s.name=t.error.code,s}let e,r=[],n=[],o=[],i={model_provider:"openai",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,service_tier:t.service_tier,model_name:t.model},a={};for(let s of t.output)if(s.type==="message")e=s.id,r.push(...s.content.flatMap(u=>u.type==="output_text"?("parsed"in u&&u.parsed!=null&&(a.parsed=u.parsed),{type:"text",text:u.text,annotations:u.annotations}):u.type==="refusal"?(a.refusal=u.refusal,[]):u));else if(s.type==="function_call"){let u={function:{name:s.name,arguments:s.arguments},id:s.call_id};try{n.push(Ix(u,{returnId:!0}))}catch(l){let c;typeof l=="object"&&l!=null&&"message"in l&&typeof l.message=="string"&&(c=l.message),o.push(_0(u,c))}a[UG]??(a[UG]={}),s.id&&(a[UG][s.call_id]=s.id)}else if(s.type==="reasoning")a.reasoning=s;else if(s.type==="custom_tool_call"){let u=bmr(s);u?n.push(u):o.push(_0(s,"Malformed custom tool call"))}else if(s.type==="computer_call"){let u=_mr(s);u?n.push(u):o.push(_0(s,"Malformed computer call"))}else a.tool_outputs??(a.tool_outputs=[]),a.tool_outputs.push(s);return new Pn({id:e,content:r,tool_calls:n,invalid_tool_calls:o,usage_metadata:Dit(t.usage),additional_kwargs:a,response_metadata:i})},hgr=t=>{let e=(t.summary.length>1?t.summary.reduce((r,n)=>{let o=r[r.length-1];return o.index===n.index?o.text+=n.text:r.push(n),r},[{...t.summary[0]}]):t.summary).map(r=>Object.fromEntries(Object.entries(r).filter(([n])=>n!=="index")));return{...t,summary:e}},jit=t=>{let e=[],r={},n,o=[],i={model_provider:"openai"},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.call_id,index:t.output_index}),a[UG]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&t.item.type==="computer_call")o.push({type:"tool_call_chunk",name:"computer_use",args:JSON.stringify({action:t.item.action}),id:t.item.call_id,index:t.output_index}),a.tool_outputs=[t.item];else if(t.type==="response.output_item.done"&&["web_search_call","file_search_call","code_interpreter_call","mcp_call","mcp_list_tools","mcp_approval_request","image_generation_call","custom_tool_call"].includes(t.item.type))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=TOe(t.response);n=Dit(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"||t.type==="response.custom_tool_call_input.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 if(t.type==="response.output_item.added"&&"item"in t&&t.item.type==="reasoning"){let u=t.item.summary?t.item.summary.map((l,c)=>({...l,index:c})):void 0;a.reasoning={id:t.item.id,type:t.item.type,...u?{summary:u}:{}}}else if(t.type==="response.reasoning_summary_part.added")a.reasoning={type:"reasoning",summary:[{...t.part,index:t.summary_index}]};else if(t.type==="response.reasoning_summary_text.delta")a.reasoning={type:"reasoning",summary:[{text:t.delta,type:"summary_text",index:t.summary_index}]};else return t.type==="response.image_generation_call.partial_image",null;return new si({text:e.map(u=>u.text).join(""),message:new Er({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})},ggr=t=>{let e=Pn.isInstance(t)&&t.response_metadata?.model_provider==="openai";function*r(){let n=TD(()=>{try{let g=ED(t);return g==="system"||g==="developer"||g==="assistant"||g==="user"?g:"assistant"}catch{return"assistant"}}),o,i=new Set,a=new Set,s=new Map,u=new Map;function*l(){if(!o)return;let g=o.content;(typeof g=="string"&&g.length>0||Array.isArray(g)&&g.length>0)&&(yield o),o=void 0}let c=g=>{o||(o={type:"message",role:n,content:[]}),typeof o.content=="string"?o.content=o.content.length>0?[{type:"input_text",text:o.content},...g]:[...g]:o.content.push(...g)},d=g=>{if(typeof g=="string")return g;try{return JSON.stringify(g??{})}catch{return"{}"}},f=g=>{let b=TD(()=>{let _=g.metadata?.detail;return _==="low"||_==="high"||_==="auto"?_:"auto"});if(g.fileId)return{type:"input_image",detail:b,file_id:g.fileId};if(g.url)return{type:"input_image",detail:b,image_url:g.url};if(g.data){let _=typeof g.data=="string"?g.data:Buffer.from(g.data).toString("base64"),w=g.mimeType??"image/png";return{type:"input_image",detail:b,image_url:`data:${w};base64,${_}`}}},p=g=>{let b=jG(g);if(g.fileId&&typeof b=="string")return{type:"input_file",file_id:g.fileId,...b?{filename:b}:{}};if(g.url&&typeof b=="string")return{type:"input_file",file_url:g.url,...b?{filename:b}:{}};if(g.data&&typeof b=="string"){let _=typeof g.data=="string"?g.data:Buffer.from(g.data).toString("base64");return{type:"input_file",file_data:`data:${g.mimeType??"application/octet-stream"};base64,${_}`,...b?{filename:b}:{}}}},m=g=>{let b=TD(()=>{if(Array.isArray(g.summary)){let O=g.summary?.map(E=>E?.text).filter(E=>typeof E=="string")??[];if(O.length>0)return O}return g.reasoning?[g.reasoning]:[]}),_=b.length>0?b.map(T=>({type:"summary_text",text:T})):[{type:"summary_text",text:""}],w={type:"reasoning",id:g.id??"",summary:_};return g.reasoning&&(w.content=[{type:"reasoning_text",text:g.reasoning}]),w},h=g=>({type:"function_call",name:g.name??"",call_id:g.id??"",arguments:d(g.args)}),y=g=>{let b=d(g.output),_=g.status==="success"?"completed":g.status==="error"?"incomplete":void 0;return{type:"function_call_output",call_id:g.toolCallId??"",output:b,..._?{status:_}:{}}};for(let g of t.contentBlocks)if(g.type==="text")c([{type:"input_text",text:g.text}]);else if(g.type!=="invalid_tool_call"){if(g.type==="reasoning")yield*l(),yield m(g);else if(g.type==="tool_call"){yield*l();let b=g.id??"";b&&(i.add(b),s.delete(b)),yield h(g)}else if(g.type==="tool_call_chunk"){if(g.id){let b=s.get(g.id)??{name:g.name,args:[]};g.name&&(b.name=g.name),g.args&&b.args.push(g.args),s.set(g.id,b)}}else if(g.type==="server_tool_call"){yield*l();let b=g.id??"";b&&(a.add(b),u.delete(b)),yield h(g)}else if(g.type==="server_tool_call_chunk"){if(g.id){let b=u.get(g.id)??{name:g.name,args:[]};g.name&&(b.name=g.name),g.args&&b.args.push(g.args),u.set(g.id,b)}}else if(g.type==="server_tool_call_result")yield*l(),yield y(g);else if(g.type!=="audio")if(g.type==="file"){let b=p(g);b&&c([b])}else if(g.type==="image"){let b=f(g);b&&c([b])}else if(g.type==="video"){let b=p(g);b&&c([b])}else g.type==="text-plain"?g.text&&c([{type:"input_text",text:g.text}]):g.type==="non_standard"&&e&&(yield*l(),yield g.value)}yield*l();for(let[g,b]of s){if(!g||i.has(g))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:g,name:b.name??"",arguments:_})}for(let[g,b]of u){if(!g||a.has(g))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:g,name:b.name??"",arguments:_})}}return Array.from(r())},OOe=({messages:t,zdrEnabled:e,model:r})=>t.flatMap(n=>{let o=n.response_metadata;if(o?.output_version==="v1")return ggr(n);let i=n.additional_kwargs,a=ED(n);if(a==="system"&&OD(r)&&(a="developer"),a==="function")throw new Error("Function messages are not supported in Responses API");if(a==="tool"){let s=n;if(i?.type==="computer_call_output")return{type:"computer_call_output",output:(()=>{if(typeof s.content=="string")return{type:"input_image",image_url:s.content};if(Array.isArray(s.content)){let c=s.content.find(p=>p.type==="input_image");if(c)return c;let d=s.content.find(p=>p.type==="computer_screenshot");if(d)return d;let f=s.content.find(p=>p.type==="image_url");if(f)return{type:"input_image",image_url:typeof f.image_url=="string"?f.image_url:f.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:s.tool_call_id};if(s.additional_kwargs?.customTool)return{type:"custom_tool_call_output",call_id:s.tool_call_id,output:s.content};let u=Array.isArray(s.content)&&s.content.every(l=>typeof l=="object"&&l!==null&&"type"in l&&(l.type==="input_file"||l.type==="input_image"||l.type==="input_text"));return{type:"function_call_output",call_id:s.tool_call_id,id:s.id?.startsWith("fc_")?s.id:void 0,output:u?s.content:typeof s.content!="string"?JSON.stringify(s.content):s.content}}if(a==="assistant"){if(!e&&o?.output!=null&&Array.isArray(o?.output)&&o?.output.length>0&&o?.output.every(f=>"type"in f))return o?.output;let s=[];if(i?.reasoning&&!e){let f=hgr(i.reasoning);s.push(f)}let{content:u}=n;i?.refusal&&(typeof u=="string"&&(u=[{type:"output_text",text:u,annotations:[]}]),u=[...u,{type:"refusal",refusal:i.refusal}]),(typeof u=="string"||u.length>0)&&s.push({type:"message",role:"assistant",...n.id&&!e&&n.id.startsWith("msg_")?{id:n.id}:{},content:TD(()=>typeof u=="string"?u:u.flatMap(f=>f.type==="text"?{type:"output_text",text:f.text,annotations:f.annotations??[]}:f.type==="output_text"||f.type==="refusal"?f:[]))});let l=i?.[UG];Pn.isInstance(n)&&n.tool_calls?.length?s.push(...n.tool_calls.map(f=>wmr(f)?{type:"custom_tool_call",id:f.call_id,call_id:f.id??"",input:f.args.input,name:f.name}:vmr(f)?{type:"computer_call",id:f.call_id,call_id:f.id??"",action:f.args.action}:{type:"function_call",name:f.name,arguments:JSON.stringify(f.args),call_id:f.id,...e?{}:{id:l?.[f.id]}})):i?.tool_calls&&s.push(...i.tool_calls.map(f=>({type:"function_call",name:f.function.name,call_id:f.id,arguments:f.function.arguments,...e?{}:{id:l?.[f.id]}})));let c=o?.output?.length?o?.output:i.tool_outputs,d=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(c!=null){let p=c?.filter(m=>d.includes(m.type));p.length>0&&s.push(...p)}return s}if(a==="user"||a==="system"||a==="developer"){if(typeof n.content=="string")return{type:"message",role:a,content:n.content};let s=[],u=n.content.flatMap(l=>{if(l.type==="mcp_approval_response"&&s.push({type:"mcp_approval_response",approval_request_id:l.approval_request_id,approve:l.approve}),Ph(l))return GT(l,SOe);if(l.type==="text")return{type:"input_text",text:l.text};if(l.type==="image_url"){let c=TD(()=>{if(typeof l.image_url=="string")return l.image_url;if(typeof l.image_url=="object"&&l.image_url!==null&&"url"in l.image_url)return l.image_url.url}),d=TD(()=>{if(typeof l.image_url=="string")return"auto";if(typeof l.image_url=="object"&&l.image_url!==null&&"detail"in l.image_url)return l.image_url.detail});return{type:"input_image",image_url:c,detail:d}}return l.type==="input_text"||l.type==="input_image"||l.type==="input_file"?l:[]});return u.length>0&&s.push({type:"message",role:a,content:u}),s}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${a}`),[]})});var POe,MOe=v(()=>{uq();LG();dae();EOe();Nw();POe=class extends nH{invocationParams(t){let e;t?.strict!==void 0&&(e=t.strict),e===void 0&&this.supportsStrictToolCalling!==void 0&&(e=this.supportsStrictToolCalling);let r={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,stream:this.streaming,previous_response_id:t?.previous_response_id,truncation:t?.truncation,include:t?.include,tools:t?.tools?.length?this._reduceChatOpenAITools(t.tools,{stream:this.streaming,strict:e}):void 0,tool_choice:ymr(t?.tool_choice)?t?.tool_choice:(()=>{let o=ZTe(t?.tool_choice);if(typeof o=="object"&&"type"in o){if(o.type==="function")return{type:"function",name:o.function.name};if(o.type==="allowed_tools")return{type:"allowed_tools",mode:o.allowed_tools.mode,tools:o.allowed_tools.tools};if(o.type==="custom")return{type:"custom",name:o.custom.name}}})(),text:(()=>{if(t?.text)return t.text;let o=this._getResponseFormat(t?.response_format);return o?.type==="json_schema"?o.json_schema.schema!=null?{format:{type:"json_schema",schema:o.json_schema.schema,description:o.json_schema.description,name:o.json_schema.name,strict:o.json_schema.strict},verbosity:t?.verbosity}:void 0:{format:o,verbosity:t?.verbosity}})(),parallel_tool_calls:t?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},n=this._getReasoningParams(t);return n!==void 0&&(r.reasoning=n),r}async _generate(t,e,r){let n=this.invocationParams(e);if(n.stream){let o=this._streamResponseChunks(t,e,r),i;for await(let a of o)a.message.response_metadata={...a.generationInfo,...a.message.response_metadata},i=i?.concat(a)??a;return{generations:i?[i]:[],llmOutput:{estimatedTokenUsage:i?.message?.usage_metadata}}}else{let o=await this.completionWithRetry({input:OOe({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),...n,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:TOe(o)}],llmOutput:{id:o.id,estimatedTokenUsage:o.usage?{promptTokens:o.usage.input_tokens,completionTokens:o.usage.output_tokens,totalTokens:o.usage.total_tokens}:void 0}}}}async*_streamResponseChunks(t,e,r){let n=await this.completionWithRetry({...this.invocationParams(e),input:OOe({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),stream:!0},e);for await(let o of n){let i=jit(o);i!=null&&(yield i,await r?.handleLLMNewToken(i.text||"",{prompt:e.promptIndex??0,completion:0},void 0,void 0,void 0,{chunk:i}))}}async completionWithRetry(t,e){return this.caller.call(async()=>{let r=this._getClientOptions(e);try{return t.text?.format?.type==="json_schema"&&!t.stream?await this.client.responses.parse(t,r):await this.client.responses.create(t,r)}catch(n){throw w0(n)}})}_reduceChatOpenAITools(t,e){let r=[];for(let n of t)if($G(n))n.type==="image_generation"&&e?.stream&&(n.partial_images=1),r.push(n);else if(QV(n)){let o=n.metadata.customTool;r.push({type:"custom",name:o.name,description:o.description,format:o.format})}else Aw(n)?r.push({type:"function",name:n.function.name,parameters:n.function.parameters,description:n.function.description,strict:e?.strict??null}):YTe(n)&&r.push(Smr(n));return r}}});var $it=v(()=>{xOe();MOe()});var RD,Lit=v(()=>{LG();lq();dae();COe();MOe();RD=class ygr extends nH{constructor(r){super(r);x(this,"useResponsesApi",!1);x(this,"responses");x(this,"completions");this.fields=r,this.useResponsesApi=r?.useResponsesApi??!1,this.responses=r?.responses??new POe(r),this.completions=r?.completions??new fq(r)}get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}_useResponsesApi(r){let n=r?.tools?.some($G),o=r?.previous_response_id!=null||r?.text!=null||r?.truncation!=null||r?.include!=null||r?.reasoning?.summary!=null||this.reasoning?.summary!=null,i=r?.tools?.some(YTe)||r?.tools?.some(QV);return this.useResponsesApi||n||o||i||cmr(this.model)}getLsParams(r){let n=this._combineCallOptions(r);return this._useResponsesApi(r)?this.responses.getLsParams(n):this.completions.getLsParams(n)}invocationParams(r){let n=this._combineCallOptions(r);return this._useResponsesApi(r)?this.responses.invocationParams(n):this.completions.invocationParams(n)}async _generate(r,n,o){return this._useResponsesApi(n)?this.responses._generate(r,n):this.completions._generate(r,n,o)}async*_streamResponseChunks(r,n,o){if(this._useResponsesApi(n)){yield*this.responses._streamResponseChunks(r,this._combineCallOptions(n),o);return}yield*this.completions._streamResponseChunks(r,this._combineCallOptions(n),o)}withConfig(r){let n=new ygr(this.fields);return n.defaultOptions={...this.defaultOptions,...r},n}}});var bgr=v(()=>{xOe();Nit();$it();Lit()});var Fit=v(()=>{uq();cq();dA();Ed();au();Nw();Tie();zk()});var _gr=v(()=>{cq();Fit();dA();au()});var pq,kit=v(()=>{uq();cq();dA();au();zk();vV();pq=class extends y0{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model","text-embedding-ada-002");x(this,"modelName");x(this,"batchSize",512);x(this,"stripNewLines",!0);x(this,"dimensions");x(this,"timeout");x(this,"organization");x(this,"encodingFormat");x(this,"client");x(this,"clientConfig");x(this,"apiKey");let n=r?.apiKey??r?.openAIApiKey??Xr("OPENAI_API_KEY");this.organization=r?.configuration?.organization??Xr("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.encodingFormat=r?.encodingFormat,this.clientConfig={apiKey:n,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let r=b0(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.encodingFormat&&(s.encoding_format=this.encodingFormat),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),this.encodingFormat&&(r.encoding_format=this.encodingFormat);let{data:n}=await this.embeddingWithRetry(r);return n[0].embedding}async embeddingWithRetry(e){if(!this.client){let n={baseURL:this.clientConfig.baseURL},o=fA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=pA(i.defaultHeaders),this.client=new xn(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw w0(n)}})}}});var qit,vgr=v(()=>{uq();cq();kit();dA();au();qit=class extends pq{constructor(e){super(e);x(this,"azureOpenAIApiVersion");x(this,"azureOpenAIApiKey");x(this,"azureADTokenProvider");x(this,"azureOpenAIApiInstanceName");x(this,"azureOpenAIApiDeploymentName");x(this,"azureOpenAIBasePath");this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??(typeof e?.apiKey=="string"?e?.apiKey:void 0)??Xr("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??Xr("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??Xr("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??Xr("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(Xr("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||Xr("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=fA(n),{apiKey:i,...a}=this.clientConfig,s={...a,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(s.apiKey=n.azureOpenAIApiKey),s.baseURL||delete s.baseURL,s.defaultHeaders=pA(s.defaultHeaders,!0,"2.0.0"),this.client=new YV({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...s})}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 w0(n)}})}}});function oH(t,e){let r=_J(e.schema),n=PJ(e.schema);if(!e.schema||r||n)return new zit({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Xs(u,{callbacks:s?.getChild()});Rh.runWithConfig(jb(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 wgr({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{let d,f=()=>{u?.signal&&d&&u.signal.removeEventListener("abort",d)};u?.signal&&(d=()=>{f(),c(JL(u.signal))},u.signal.addEventListener("abort",d));let p=Xs(u,{callbacks:s?.getChild()});Rh.runWithConfig(jb(p),async()=>{try{let m=await t(a,p);if(u?.signal?.aborted){f();return}f(),l(m)}catch(m){f(),c(m)}})})})}function Jco(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!FQ(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Mh({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Mh({status:"success",content:Kco(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function Kco(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var Hco,Uit,Bit,zit,wgr,Wco,mq=v(()=>{Jo();G6();Wpe();WL();zz();Vz();rO();iJ();QN();Ny();Nw();vtt();cO();qge();eH();Hco={};$t(Hco,{BaseToolkit:()=>Wco,DynamicStructuredTool:()=>wgr,DynamicTool:()=>zit,StructuredTool:()=>Uit,Tool:()=>Bit,ToolInputParsingException:()=>H6,isLangChainTool:()=>Xg,isRunnableToolLike:()=>Sie,isStructuredTool:()=>wie,isStructuredToolParams:()=>Cie,tool:()=>oH});Uit=class extends k8{constructor(e){super(e??{});x(this,"extras");x(this,"returnDirect",!1);x(this,"verboseParsingErrors",!1);x(this,"responseFormat","content");x(this,"defaultConfig");this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}get lc_namespace(){return["langchain","tools"]}async invoke(e,r){let n,o=ai(Hz(this.defaultConfig,r));return qL(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=qL(e)?e.args:e,i;if(Ii(this.schema))try{i=await rF(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.message}`),_ge(m)&&(h=`${h}
|
||
|
||
${Yt.prettifyError(m)}`),new H6(h,JSON.stringify(e))}else{let m=Ku(o,this.schema);if(!m.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.errors.map(y=>`${y.keywordLocation}: ${y.error}`).join(`
|
||
`)}`),new H6(h,JSON.stringify(e))}i=o}let a=HN(r),u=await mc.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;qL(e)&&(f=e.id),!f&&DCt(a)&&(f=a.toolCall.id);let p=Jco({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},Bit=class extends Uit{constructor(e){super(e);x(this,"schema",wt.object({input:wt.string().optional()}).transform(e=>e.input))}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},zit=class extends Bit{constructor(e){super(e);x(this,"name");x(this,"description");x(this,"func");this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect}static lc_name(){return"DynamicTool"}async call(e,r){let n=HN(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)}},wgr=class extends Uit{constructor(e){super(e);x(this,"description");x(this,"func");x(this,"schema");this.name=e.name,this.description=e.description,this.func=e.func,this.returnDirect=e.returnDirect??this.returnDirect,this.schema=e.schema}static lc_name(){return"DynamicStructuredTool"}async call(e,r,n){let o=HN(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)}},Wco=class{getTools(){return this.tools}}});var Vit=v(()=>{dA();au();mq()});var Sgr=v(()=>{});var Cgr=v(()=>{});var xgr=v(()=>{});var Tgr=v(()=>{});var Ogr=v(()=>{});var Gco,Xco,Zco,Yco,Qco,edo,tdo,rdo,ndo,odo,Z4a,Egr=v(()=>{ta();mq();eH();Gco=Yt.object({type:Yt.literal("screenshot")}),Xco=Yt.object({type:Yt.literal("click"),x:Yt.number(),y:Yt.number(),button:Yt.enum(["left","right","wheel","back","forward"]).default("left")}),Zco=Yt.object({type:Yt.literal("double_click"),x:Yt.number(),y:Yt.number(),button:Yt.enum(["left","right","wheel","back","forward"]).default("left")}),Yco=Yt.object({type:Yt.literal("drag"),path:Yt.array(Yt.object({x:Yt.number(),y:Yt.number()}))}),Qco=Yt.object({type:Yt.literal("keypress"),keys:Yt.array(Yt.string())}),edo=Yt.object({type:Yt.literal("move"),x:Yt.number(),y:Yt.number()}),tdo=Yt.object({type:Yt.literal("scroll"),x:Yt.number(),y:Yt.number(),scroll_x:Yt.number(),scroll_y:Yt.number()}),rdo=Yt.object({type:Yt.literal("type"),text:Yt.string()}),ndo=Yt.object({type:Yt.literal("wait"),duration:Yt.number().optional()}),odo=Yt.discriminatedUnion("type",[Gco,Xco,Zco,Yco,Qco,edo,tdo,rdo,ndo]),Z4a=Yt.object({action:odo})});var ido,t2a,Pgr=v(()=>{mq();eH();ido=Yt.object({type:Yt.literal("exec"),command:Yt.array(Yt.string()),env:Yt.record(Yt.string(),Yt.string()).optional(),working_directory:Yt.string().optional(),timeout_ms:Yt.number().optional(),user:Yt.string().optional()}),t2a=Yt.discriminatedUnion("type",[ido])});var i2a,Mgr=v(()=>{mq();eH();i2a=Yt.object({commands:Yt.array(Yt.string()).describe("Array of shell commands to execute"),timeout_ms:Yt.number().optional().describe("Optional timeout in milliseconds for the commands"),max_output_length:Yt.number().optional().describe("Optional maximum number of characters to return from each command")})});var ado,sdo,udo,l2a,Rgr=v(()=>{mq();eH();ado=Yt.object({type:Yt.literal("create_file"),path:Yt.string(),diff:Yt.string()}),sdo=Yt.object({type:Yt.literal("update_file"),path:Yt.string(),diff:Yt.string()}),udo=Yt.object({type:Yt.literal("delete_file"),path:Yt.string()}),l2a=Yt.discriminatedUnion("type",[ado,sdo,udo])});var Igr=v(()=>{Vit();Sgr();Cgr();xgr();Tgr();Ogr();Egr();Pgr();Mgr();Rgr()});var Agr=v(()=>{sw();mq();Vz()});var Ngr=v(()=>{qG()});var Dgr=v(()=>{qG();EOe()});var iH=v(()=>{uq();lq();cq();dae();qG();COe();Nit();EOe();MOe();$it();Lit();bgr();Fit();_gr();kit();vgr();Vit();Igr();Agr();Ngr();Dgr();dA()});var $gr=S((EVa,jgr)=>{jgr.exports={createRequire:function(t){return typeof require<"u"?require:function(r){throw new Error('Dynamic require of "'+r+'" is not supported in this environment')}}}});var ldo,cdo,Lgr,Fgr=v(()=>{ldo=$($gr(),1),cdo=Object.defineProperty,Lgr=(t,e)=>{for(var r in e)cdo(t,r,{get:e[r],enumerable:!0})}});var ddo,Hit,kgr=v(()=>{Fgr();au();vV();zk();ddo={};Lgr(ddo,{JinaEmbeddings:()=>Hit});Hit=class extends y0{constructor(e){let r={maxConcurrency:2,...e};super(r);x(this,"model","jina-clip-v2");x(this,"batchSize",24);x(this,"baseUrl","https://api.jina.ai/v1/embeddings");x(this,"stripNewLines",!0);x(this,"dimensions",1024);x(this,"apiKey");x(this,"normalized",!0);let n=r?.apiKey||Xr("JINA_API_KEY")||Xr("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=b0(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 ROe,qgr=v(()=>{kgr();ROe=class extends Hit{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var aH,Ugr=v(()=>{iH();aH=class extends pq{constructor(e){super(e),this.customConfig=e}async embedQuery(e){return(await this.callEmbeddingAPI([e]))[0]}async embedDocuments(e){return await this.callEmbeddingAPI(e)}async callEmbeddingAPI(e){let r={model:this.customConfig.modelName,input:e,encoding_format:"float"},o=`${this.customConfig.configuration?.baseURL||"https://api.openai.com/v1"}/embeddings`,i=this.customConfig.apiKey,s=await(this.customConfig.configuration?.fetch||fetch)(o,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",...this.customConfig.headers||{}},body:JSON.stringify(r)});if(!s.ok){let l=await s.text();throw new Error(`Embedding API request failed: ${s.status} ${s.statusText} - ${l}`)}let u=await s.json();if(!u.data||!Array.isArray(u.data))throw new Error("Invalid API response format: missing or invalid data array");return u.data.map(l=>{if(!l.embedding||!Array.isArray(l.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return l.embedding})}}});var IOe,fdo,hd,sH=v(()=>{mr();vO();lw();Ye();Bt();Ptt();Btt();irt();iH();IOe=require("obsidian");mA();qgr();Ugr();fdo={"copilot-plus":aH,"copilot-plus-jina":ROe,openai:pq,cohereai:Ett,google:Utt,"azure openai":qit,ollama:ort,"lm-studio":aH,"3rd party (openai-format)":pq,siliconflow:aH,openrouterai:aH},hd=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>te().plusLicenseKey,"copilot-plus-jina":()=>te().plusLicenseKey,openai:()=>te().openAIApiKey,cohereai:()=>te().cohereApiKey,google:()=>te().googleApiKey,"azure openai":()=>te().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key",siliconflow:()=>te().siliconflowApiKey,openrouterai:()=>te().openRouterAiApiKey};this.initialize(),hl(()=>this.initialize())}initialize(){let e=te().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=fdo[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(YC).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=no(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=no(r);return e===n})[0]}async getEmbeddingsAPI(){let r=te().embeddingModelKey;if(!t.modelMap.hasOwnProperty(r))throw new lo(`No embedding model found for: ${r}`);let n=this.getCustomModel(r);if(n.plusExclusive&&!te().isPlusUser)throw new IOe.Notice("Plus-only model, please consider upgrading to Plus to access it."),new lo("Plus-only model selected but user is not on Plus plan");if(n.believerExclusive){let s=await Ql.getInstance().validateLicenseKey();if(!s.plan||s.plan.toLowerCase()!=="believer")throw new IOe.Notice("Believer-only model, please consider upgrading to Believer to access it."),new lo("Believer-only model selected but user is not on Believer plan")}let o=t.modelMap[r];if(!o.hasApiKey)throw new lo(`API key is not provided for the embedding model: ${r}`);let i=await this.getEmbeddingConfig(n);try{return t.embeddingModel=new o.EmbeddingConstructor(i),t.embeddingModel}catch(a){throw new lo(`Error creating embedding model: ${r}. ${a.message}`)}}async getEmbeddingConfig(e){let r=te(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await oo(r.plusLicenseKey),timeout:1e4,batchSize:te().embeddingBatchSize,configuration:{baseURL:p1,fetch:e.enableCors?gl:void 0}},"copilot-plus-jina":{model:n,apiKey:await oo(r.plusLicenseKey),timeout:1e4,batchSize:te().embeddingBatchSize,dimensions:e.dimensions,baseUrl:p1+"/embeddings",configuration:{fetch:e.enableCors?gl:void 0}},openai:{modelName:n,apiKey:await oo(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:te().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?gl:void 0}},cohereai:{model:n,apiKey:await oo(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await oo(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await oo(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 oo(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await oo(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?gl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await oo(e.apiKey||""),batchSize:te().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?gl:void 0,dangerouslyAllowBrowser:!0}},siliconflow:{modelName:n,apiKey:await oo(e.apiKey||r.siliconflowApiKey),batchSize:te().embeddingBatchSize,configuration:{baseURL:e.baseUrl||QC.siliconflow.host,fetch:e.enableCors?gl:void 0}},openrouterai:{modelName:n,apiKey:await oo(e.apiKey||r.openRouterAiApiKey),batchSize:te().embeddingBatchSize,configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?gl:void 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 IOe.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: `+zr(n)+`
|
||
with CORS Error: `+zr(o);throw new Error(i)}}}}});var Bgr,AOe,zgr=v(()=>{Xe();Ye();Bt();Bgr=require("obsidian"),AOe=class t{constructor(){this.cachedBaseUrl=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}async resolveBaseUrl(e={}){let r=(e.overrideUrl||"").trim();if(r.length>0)return this.normalizeBaseUrl(r);if(this.cachedBaseUrl&&!e.forceRefresh)return this.cachedBaseUrl;if(!Bgr.Platform.isDesktopApp)return null;let n=await this.readServiceConfig();if(!n)return this.cachedBaseUrl=null,null;let o=this.normalizeBaseUrl(`http://${n.host}:${n.port}`);return this.cachedBaseUrl=o,o}normalizeBaseUrl(e){return e.trim().replace(/\/+$/,"")}getServiceFilePath(){let e=this.getNodeRequire();if(!e)return null;let r=e("os");return e("path").join(r.homedir(),"Library","Application Support","Miyo","service.json")}async readServiceConfig(){let e=this.getServiceFilePath();if(!e)return null;try{let r=this.getNodeRequire();if(!r)return null;let o=await r("fs").promises.readFile(e,"utf8"),i=JSON.parse(o);return!i.host||typeof i.host!="string"?(Te("Miyo service discovery missing host"),null):typeof i.port!="number"||Number.isNaN(i.port)?(Te("Miyo service discovery missing port"),null):(te().debug&&F(`Miyo service discovery resolved host=${i.host} port=${i.port}`),i)}catch(r){return te().debug&&Te(`Miyo service discovery failed: ${zr(r)}`),null}}getNodeRequire(){let e=globalThis?.require;return typeof e=="function"?e:null}}});var Vgr,S0,BG=v(()=>{Xe();Ye();Bt();Vgr=require("obsidian");zgr();S0=class{constructor(){this.discovery=AOe.getInstance()}async resolveBaseUrl(e){let r=await this.discovery.resolveBaseUrl({overrideUrl:e});if(!r)throw new Error("Miyo base URL not available");return r}async isBackendAvailable(e){try{let r=await this.resolveBaseUrl(e);return(await this.requestJson(r,"/v0/health",{method:"GET"}))?.status==="ok"}catch(r){return te().debug&&Te(`Miyo backend availability check failed: ${zr(r)}`),!1}}async upsertDocuments(e,r,n){let o={vault:r,documents:n};return(await this.requestJson(e,"/v0/index/upsert",{method:"POST",body:o}))?.upserted??0}async deleteByPath(e,r,n){let o={vault:r,path:n};return(await this.requestJson(e,"/v0/index/by_path",{method:"DELETE",body:o}))?.deleted??0}async clearIndex(e,r){let n={vault:r};await this.requestJson(e,"/v0/index/clear",{method:"POST",body:n})}async listFiles(e,r,n,o){return this.requestJson(e,"/v0/index/files",{method:"GET",query:{vault:r,offset:n,limit:o}})}async getStats(e,r){return this.requestJson(e,"/v0/index/stats",{method:"GET",query:{vault:r}})}async getDocumentsByPath(e,r,n){return this.requestJson(e,"/v0/index/documents",{method:"GET",query:{vault:r,path:n}})}async search(e,r,n,o,i){let a={query:n,vault:r,limit:o,...i&&i.length>0?{filters:i}:{}};return te().debug&&F("Miyo search request:",{baseUrl:e,payload:a}),this.requestJson(e,"/v0/search",{method:"POST",body:a})}async searchRelated(e,r,n){let o={file_path:r,...n?.sourceId?{vault:n.sourceId}:{},...typeof n?.limit=="number"?{limit:n.limit}:{},...n?.filters&&n.filters.length>0?{filters:n.filters}:{}};return te().debug&&F("Miyo related search request:",{baseUrl:e,payload:o}),this.requestJson(e,"/v0/search/related",{method:"POST",body:o})}async parseDoc(e,r){return this.requestJson(e,"/v0/parse-doc",{method:"POST",body:{path:r}})}buildHeaders(){let e=te().selfHostApiKey,r={};return e&&(r.Authorization=`Bearer ${e}`,r["X-API-Key"]=e),r}async requestJson(e,r,n){let o=new URL(r,e);n.query&&Object.entries(n.query).forEach(([u,l])=>{l!=null&&o.searchParams.set(u,String(l))});let i=n.body?JSON.stringify(n.body):void 0;F("Miyo request:",{method:n.method,url:o.toString(),hasBody:!!i,...te().debug&&n.method==="POST"?{postBody:n.body}:{}});let a=await(0,Vgr.requestUrl)({url:o.toString(),method:n.method,headers:this.buildHeaders(),contentType:i?"application/json":void 0,body:i,throw:!1});if(a.status>=400){let u=a.text?a.text:"";throw Te(`Miyo request failed (${a.status}): ${u}`),new Error(`Miyo request failed with status ${a.status}`)}let s=this.parseResponseJson(a.json,a.text);return te().debug&&F(`Miyo request ${n.method} ${o.toString()} succeeded`),s}parseResponseJson(e,r){if(typeof e=="string")try{return JSON.parse(e)}catch(n){return ne(`Failed to parse Miyo JSON response: ${zr(n)}`),{}}if(e!=null)return e;if(r)try{return JSON.parse(r)}catch(n){return ne(`Failed to parse Miyo text response: ${zr(n)}`),{}}return{}}}});function zG(t){let e=pdo(t);return e||t.vault.getName()}function pdo(t){let e=t.vault.adapter;if(e instanceof Hgr.FileSystemAdapter)return e.getBasePath();let r=e;if(typeof r.getBasePath=="function")return r.getBasePath();if(typeof r.basePath=="string")return r.basePath}var Hgr,NOe=v(()=>{Hgr=require("obsidian")});var Ggr={};En(Ggr,{categorizePatterns:()=>uH,createPatternSettingsValue:()=>hq,extractAppIgnoreSettings:()=>Git,getAllQAMarkdownContent:()=>Kit,getDecodedPatterns:()=>hA,getExtensionPattern:()=>Xit,getFilePattern:()=>VG,getInternalExcludePaths:()=>Jgr,getMatchingPatterns:()=>el,getTagPattern:()=>pae,getVectorLength:()=>Jit,isInternalExcludedFile:()=>mae,isInternalExcludedPath:()=>Kgr,previewPatternValue:()=>gdo,shouldIndexFile:()=>Hs});async function Jit(t){if(!t)throw new lo("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new lo("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${hd.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new lo("Failed to determine embedding vector length. Please check your Copilot settings to make sure you have a working embedding model.")}}async function Kit(t){let e="",{inclusions:r,exclusions:n}=el(),o=t.vault.getMarkdownFiles().filter(i=>Hs(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function hA(t){let e=[];return e.push(...t.split(",").map(r=>{let n=r.trim();try{return decodeURIComponent(n)}catch{return n}}).filter(r=>r.length>0)),e}function mdo(){return te().qaExclusions?hA(te().qaExclusions):[]}function hdo(){return te().qaInclusions?hA(te().qaInclusions):[]}function el(t){let e=t?.inclusions?hA(t.inclusions):t?.isProject?[]:hdo(),r=t?.exclusions?hA(t.exclusions):t?.isProject?[]:mdo();return{inclusions:e.length>0?uH(e):null,exclusions:r.length>0?uH(r):null}}function Hs(t,e,r,n){return!(mae(t)||r&&Wgr(t.path,r)||e&&!Wgr(t.path,e)||n&&!e)}function uH(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 gdo(t){return hA(t).join(", ")}function hq({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function ydo(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof Wit.TFile){let n=gO(r);if(e.some(o=>n.some(i=>i.toLowerCase()===VJ(o).toLowerCase())))return!0}return!1}function bdo(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 _do(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 vdo(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof Wit.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function Wgr(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return ydo(t,r??[])||bdo(t,n??[])||_do(t,o??[])||vdo(t,i??[])}function Git(t){let e=[];try{if(typeof t.vault.getConfig=="function"){let r=t.vault.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(n=>{typeof n=="string"&&e.push(n.endsWith("/")?n.slice(0,-1):n)})}}catch(r){console.warn("Error getting userIgnoreFilters from Obsidian config",r)}return e}function pae(t){return`#${t}`}function VG(t){return`[[${t.basename}]]`}function Xit(t){return`*.${t}`}function Jgr(){return[Im.getLogPath()]}function Kgr(t){return new Set(Jgr()).has(t)}function mae(t){return Kgr(t.path)}var Wit,ob=v(()=>{lw();sH();Ye();O4();Bt();Wit=require("obsidian")});var Xgr,DOe,Zgr=v(()=>{Xgr=require("obsidian");lw();Xe();BG();NOe();ob();Ye();DOe=class{constructor(e){this.app=e;this.filesMissingEmbeddings=new Set;this.client=new S0}async initialize(e){try{let r=await this.getBaseUrl();await this.client.getStats(r,this.getSourceId())}catch(r){Te(`Miyo backend initialization failed: ${r}`),new Xgr.Notice("Failed to initialize Miyo backend. Check Miyo service discovery or URL.")}}async clearIndex(e){let r=await this.getBaseUrl();await this.client.clearIndex(r,this.getSourceId())}requiresEmbeddings(){return!1}async upsert(e){return await this.upsertBatch([e])>0?e:void 0}async upsertBatch(e){if(e.length===0)return 0;let r=await this.getBaseUrl(),n=this.getSourceId();this.logUpsertBatchRequested(e,r,n);let o=e.map(a=>this.toMiyoDocument(a)),i=await this.client.upsertDocuments(r,n,o);return this.logUpsertBatchResult(e.length,i),i}async removeByPath(e){let r=await this.getBaseUrl();await this.client.deleteByPath(r,this.getSourceId(),e)}async getIndexedFiles(){let e=await this.getBaseUrl(),r=this.getSourceId(),n=200,o=0,i=null,a=new Set;do{let s=await this.client.listFiles(e,r,o,n),u=s.files??[];if(u.forEach(l=>a.add(l.path)),i===null&&(i=s.total??u.length),o+=u.length,u.length===0)break}while(o<i);return Array.from(a).sort()}async getLatestFileMtime(){return(await this.getStatsSafely())?.latest_mtime??0}async isIndexEmpty(){let e=await this.getStatsSafely();return e?(e.total_chunks??0)===0:!0}async hasIndex(e){return(await this.getDocumentsByPath(e)).length>0}async getDocumentsByPath(e){let r=await this.getBaseUrl();return((await this.client.getDocumentsByPath(r,this.getSourceId(),e)).documents??[]).map(i=>this.fromMiyoDocument(e,i))}async checkAndHandleEmbeddingModelChange(e){return!1}async save(){}async checkIndexIntegrity(){}async garbageCollect(){try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(d=>d.path)),{inclusions:n,exclusions:o}=el(),i=new Set(e.filter(d=>Hs(d,n,o)).map(d=>d.path)),s=(await this.getIndexedFiles()).filter(d=>!r.has(d)||!i.has(d));if(s.length===0)return 0;F("Miyo index: Paths to remove during garbage collection:",s.join(", "));let u=await this.getBaseUrl(),l=this.getSourceId(),c=0;for(let d of s)c+=await this.client.deleteByPath(u,l,d);return c}catch(e){throw ne("Error garbage collecting the Miyo index:",e),new lo("Failed to garbage collect the Copilot index.")}}markFileMissingEmbeddings(e){this.filesMissingEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesMissingEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesMissingEmbeddings)}markUnsavedChanges(){}onunload(){}async getBaseUrl(){let e=te().selfHostUrl;return this.client.resolveBaseUrl(e)}getSourceId(){return zG(this.app)}logUpsertBatchRequested(e,r,n){F(`Miyo upsert batch: ${e.length} documents`,{baseUrl:r,sourceId:n}),e.forEach(o=>{let i=o.metadata?.chunkId,a=typeof i=="string"&&i.length>0?` (chunkId: ${i})`:"";F(`Miyo upsert document ${o.id} @ ${o.path}${a}`)})}logUpsertBatchResult(e,r){if(r===e){F(`Miyo upsert batch completed: ${r}/${e} documents`);return}Te(`Miyo upsert batch returned ${r}/${e} documents`)}async getStatsSafely(){try{let e=await this.getBaseUrl();return await this.client.getStats(e,this.getSourceId())}catch(e){return ne(`Failed to fetch Miyo index stats: ${e}`),null}}toMiyoDocument(e){return{id:e.id,path:e.path,title:e.title,content:e.content,created_at:e.created_at,ctime:e.ctime,mtime:e.mtime,tags:e.tags,extension:e.extension,nchars:e.nchars,metadata:e.metadata??{}}}fromMiyoDocument(e,r){let n=r.chunk_text??"",o={...r.metadata??{}};return!o.chunkId&&r.chunk_index!==void 0&&(o.chunkId=`${r.path||e}#${r.chunk_index}`),r.chunk_index!==void 0&&o.chunkIndex===void 0&&(o.chunkIndex=r.chunk_index),{id:r.id,title:r.title??"",content:n,embedding:[],path:r.path??e,embeddingModel:r.embedding_model??"",created_at:r.created_at??0,ctime:r.ctime??0,mtime:r.mtime??0,tags:r.tags??[],extension:r.extension??"",nchars:r.nchars??n.length,metadata:o}}}});function eyr(t){return t!==void 0&&hae.includes(t)?Ygr[t]:void 0}var Ygr,Qgr,hae,jOe=v(()=>{Ygr={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"},Qgr={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},hae=Object.keys(Ygr)});function Fu(t,e){if(e.length<Zit)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=Zit)Array.prototype.push.apply(t,e.slice(n,n+Zit))}}function iyr(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 Cdo(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function xdo(){return typeof process<"u"&&process.release&&process.release.name==="node"}function oyr(){return BigInt(Math.floor(performance.now()*1e6))}function lH(t){return typeof t=="number"&&(t=BigInt(t)),t<tyr?`${t}ns`:t<ryr?`${t/tyr}\u03BCs`:t<nyr?`${t/ryr}ms`:`${t/nyr}s`}function kx(){return Cdo()?oyr():xdo()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?oyr():BigInt(0)}function gae(){return`${wdo}-${Sdo++}`}function HG(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 ayr(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function WG(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 $Oe(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 JG(t,e){return $Oe(t,[e])[e]}function Yit(t,e){let r=Tdo[e];if(r===void 0)throw new Error(Ur("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function LOe(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 Ld(t){return t?.constructor?.name==="AsyncFunction"}var wdo,Sdo,tyr,ryr,nyr,Zit,Tdo,gd=v(()=>{Jh();wdo=Date.now().toString().slice(5),Sdo=0,tyr=BigInt(1e3),ryr=BigInt(1e6),nyr=BigInt(1e9),Zit=65535;Tdo={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Ur(t,...e){let r=new Error(iyr(Edo[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var Odo,Edo,Jh=v(()=>{jOe();gd();Odo=hae.join(`
|
||
- `),Edo={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:
|
||
- ${Odo}`,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 syr(t){return{raw:Number(t),formatted:lH(t)}}function uyr(t){if(t.id){if(typeof t.id!="string")throw Ur("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return gae()}function Qit(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(ID(n)){let i=tat(n);if(!Array.isArray(o)||o.length!==i)throw Ur("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(KG(n)){if(!Array.isArray(o))return r;let i=eat(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=Qit(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function lyr(t){return t==="geopoint"}function ID(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function KG(t){return typeof t=="string"&&Pdo[t]}function eat(t){return Mdo[t]}function tat(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Ur("INVALID_VECTOR_VALUE",t);case e<=0:throw Ur("INVALID_VECTOR_SIZE",t);default:return e}}var Pdo,Mdo,yae=v(()=>{Jh();gd();gd();Pdo={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Mdo={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function cyr(){return{idToInternalId:new Map,internalIdToId:[],save:Rdo,load:Ido}}function Rdo(t){return{internalIdToId:t.internalIdToId}}function Ido(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 cu(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?cu(t,e.toString()):e}function C0(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var x0=v(()=>{});function Ndo(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Ddo(t,e){let r=cu(t.sharedInternalDocumentStore,e);return t.docs[r]}function jdo(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=cu(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function $do(t){return t.docs}function Ldo(t,e,r){let n=cu(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function Fdo(t,e){let r=cu(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function kdo(t){return t.count}function qdo(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Udo(t){return{docs:t.docs,count:t.count}}function dyr(){return{create:Ndo,get:Ddo,getMultiple:jdo,getAll:$do,store:Ldo,remove:Fdo,count:kdo,load:qdo,save:Udo}}var rat=v(()=>{x0()});function pyr(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),Ur("PLUGIN_CRASHED")}return r}var fyr,myr=v(()=>{Jh();fyr=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function qx(t,e,r,n){if(t.some(Ld))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function cH(t,e,r){if(t.some(Ld))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function GG(t,e,r,n,o){if(t.some(Ld))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function XG(t,e,r,n){if(t.some(Ld))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function gyr(t,e){if(t.some(Ld))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var hyr,nat,gq=v(()=>{gd();hyr=["tokenizer","index","documentsStore","sorter"],nat=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function oat(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(T0(t.l),T0(t.r))+1,e.h=Math.max(T0(e.l),T0(e.r))+1,e}function iat(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(T0(t.l),T0(t.r))+1,e.h=Math.max(T0(e.l),T0(e.r))+1,e}function byr(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&Fu(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function aat(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&&Fu(n,i.v),!r&&i.k>e&&Fu(n,i.v),o.push(i.r),o.push(i.l))}return n}function sat(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&&Fu(n,i.v),!r&&i.k<e&&Fu(n,i.v),o.push(i.r),o.push(i.l))}return n}function _yr(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 vyr(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function wyr(t,e,r,n=500){function o(i,a,s){if(i===null)return yyr++,{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 yyr%n===0?zdo(i,a):i}t.root=o(t.root,e,r)}function zdo(t,e){t.h=1+Math.max(T0(t.l),T0(t.r));let r=T0(t.l)-T0(t.r);return r>1&&e<t.l.k?iat(t):r<-1&&e>t.r.k?oat(t):r>1&&e>t.l.k?(t.l=oat(t.l),iat(t)):r<-1&&e<t.r.k?(t.r=iat(t.r),oat(t)):t}function T0(t){return t!==null?t.h:-1}function Syr(t,e){let r=_yr(t.root,e);return r===null?null:r.v}function Vdo(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 Cyr(t,e,r){let n=_yr(t.root,r);if(n){if(n.v.length===1){Vdo(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var yyr,xyr=v(()=>{gd();yyr=0});function Tyr(){return{numberToDocumentId:new Map}}function Oyr(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function Eyr(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 Pyr(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&&Fu(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&&Fu(i,u)}return i}}throw new Error("Invalid operation")}function Myr(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 WG(i)}}throw new Error("Invalid operation")}var Ryr=v(()=>{gd()});function Hdo(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 uat(t,e,r){let n=Hdo(t,e,r);return{distance:n,isBounded:n>=0}}var lat=v(()=>{});function ZG(t,e){t.w=e.w+t.s}function FOe(t,e){t.d.push(e)}function Wdo(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function dat(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(HG(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&uat(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),HG(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))dat(t.c[i],e,r,n,o);return e}function Iyr(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 dH(t=!1,e="",r=""){return new cat(r,e,t)}function Ayr(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=Iyr(u,a),d=c.length;if(u===a){FOe(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=dH(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,ZG(p,t),ZG(m,p),FOe(p,r);return}if(d<l&&d<a.length){let p=dH(!1,c,i);p.c[f]=s,t.c[i]=p;let m=p.c[f];m.s=u.substring(d),m.k=f;let h=a[d],y=dH(!0,e.substring(o+d),h);FOe(y,r),p.c[h]=y,ZG(p,t),ZG(y,p),ZG(m,p);return}o+=l-1,t=s}else{let u=dH(!0,a,i);FOe(u,r),t.c[i]=u,ZG(u,t);return}}}function bae(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){dat(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(uat(e,a,o).isBounded&&(i[a]=[]),HG(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&&bae(t.c[e[r]],e,r+1,n,o,i),bae(t,e,r+1,n-1,o,i);for(let a in t.c)bae(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&bae(t.c[a],e,r+1,n-1,o,i)}}}function fat(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,bae(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=Iyr(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 dat(t,i,e,r,n),i}}function Nyr(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||Wdo(t,r)}else return!1}return!0}var cat,Dyr=v(()=>{lat();gd();cat=class{constructor(e,r,n){x(this,"k");x(this,"s");x(this,"c",{});x(this,"d",[]);x(this,"e");x(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 jyr(){return{root:null}}function $yr(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 Lyr(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 Fyr(t,e,r,n=!0,o="asc",i=!1){let a=i?Uyr:qyr,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 kyr(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=Kdo(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=Jdo(e);if(n){let u=o?Uyr:qyr;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 Jdo(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 Kdo(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 qyr(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 Uyr(t,e){let n=.0033528106647474805,o=(1-n)*6378137,i=Math.PI/180,a=t.lat*i,s=e.lat*i,u=(e.lon-t.lon)*i,l=Math.atan((1-n)*Math.tan(a)),c=Math.atan((1-n)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(c),m=Math.cos(c),h=u,y,g=1e3,b,_,w,T,O;do{let z=Math.sin(h),V=Math.cos(h);w=Math.sqrt(m*z*(m*z)+(f*p-d*m*V)*(f*p-d*m*V)),T=d*p+f*m*V,O=Math.atan2(w,T),b=f*m*z/w,_=1-b*b;let k=T-2*d*p/_,X=n/16*_*(4+n*(4-3*_));y=h,h=u+(1-X)*n*b*(O+X*w*(k+X*T*(-1+2*k*k)))}while(Math.abs(h-y)>1e-12&&--g>0);let E=_*(6378137*6378137-o*o)/(o*o),P=1+E/16384*(4096+E*(-768+E*(320-175*E))),R=E/1024*(256+E*(-128+E*(74-47*E))),I=R*w*(T-2*d*p/_+R/4*(T*(-1+2*w*w)-R/6*O*(-3+4*w*w)*(-3+4*O*O)));return o*P*(O-I)}var Byr=v(()=>{});function kOe(t,e,r=0,n){if(e===0)throw Ur("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let y=t[h],g=y.length;for(let b=0;b<g;b++){let[_,w]=y[b],T=w*e,O=o.get(_)?.[0];O!==void 0?o.set(_,[O*1.5+T,(o?.get(_)?.[1]||0)+1]):o.set(_,[T,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,y)=>y[1]-h[1]);if(r===1)return s;let u=s.length,l=[];for(let h of o.entries())l.push([h[0],h[1][0],h[1][1]]);let c=l.sort((h,y)=>h[2]>y[2]?-1:h[2]<y[2]?1:h[1]>y[1]?-1:h[1]<y[1]?1:0),d;for(let h=0;h<u&&c[h][2]===n;h++)d=h;if(typeof d>"u"){if(r===0)return[];d=0}let f=c.length,p=new Array(f);for(let h=0;h<f;h++)p[h]=[c[h][0],c[h][1]];if(r===0)return p.slice(0,d+1);let m=d+Math.ceil(r*100*(u-d)/100);return p.slice(0,u+m)}function pat(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 _ae=v(()=>{Jh()});function mat(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function qOe(t,e,r,n=.8){let o=mat(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 UOe=v(()=>{});function Gdo(t,e,r,n,o){let i=cu(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 Xdo(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=cu(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 Zdo(t,e,r,n){let o=cu(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 Ydo(t,e,r){t.tokenOccurrences[e][r]--}function Qdo(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=cu(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,y=pat(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,y])}return d}function Vyr(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)){Vyr(t,e,a,n,s);continue}if(ID(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:tat(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:vyr(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:dH(),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:Tyr(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:jyr(),isArray:u};break;default:throw Ur("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function efo(t,e,r,n,o,i,a,s){return u=>{let l=cu(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;wyr(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),Ayr(d,p,l);break}case"Flat":{Oyr(d,u,l);break}case"BKD":{$yr(d,u,[l]);break}}}}function tfo(t,e,r,n,o,i,a,s,u,l){if(ID(i))return rfo(e,r,o,n);let c=efo(t,e,r,n,a,s,u,l);if(!KG(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function rfo(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=mat(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function zyr(t,e,r,n,o,i,a,s,u){let l=cu(e.sharedInternalDocumentStore,n);if(ID(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return Cyr(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),Nyr(d,p,l);return!0}case"Flat":return Eyr(d,l,o),!0;case"BKD":return Lyr(d,o,l),!1}}function nfo(t,e,r,n,o,i,a,s,u){if(!KG(i))return zyr(t,e,r,n,o,i,a,s,u);let l=eat(i),c=o,d=c.length;for(let f=0;f<d;f++)zyr(t,e,r,n,c[f],l,a,s,u);return!0}function ofo(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Ur("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=fat(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(HG(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function ifo(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 Ur("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];Fu(o[i],f);continue}if(u==="BKD"){let d;if("radius"in a)d="radius";else if("polygon"in a)d="polygon";else throw new Error(`Invalid operation ${a}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:y=!1}=a[d],g=Yit(f,m),b=Fyr(s.root,p,g,h,void 0,y);Fu(o[i],b.flatMap(({docIDs:_})=>_))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=kyr(s.root,f,p,void 0,m);Fu(o[i],h.flatMap(({docIDs:y})=>y))}continue}if(u==="Radix"&&(typeof a=="string"||Array.isArray(a))){for(let d of[a].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=fat(s,{term:p,exact:!0});Fu(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Ur("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?Myr:Pyr;Fu(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=aat(s,f,!1);break}case"gte":{p=aat(s,f,!0);break}case"lt":{p=sat(s,f,!1);break}case"lte":{p=sat(s,f,!0);break}case"eq":{p=Syr(s,f)??[];break}case"between":{let[m,h]=f;p=byr(s,m,h);break}}Fu(o[i],p)}}return WG(Object.values(o))}function afo(t){return t.searchableProperties}function sfo(t){return t.searchablePropertiesWithTypes}function Hyr(t){let e=dH(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]=Hyr(t.c[r]);return e}function ufo(t){return{numberToDocumentId:new Map(t)}}function lfo(t){return Array.from(t.numberToDocumentId.entries())}function cfo(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:Hyr(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:ufo(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 dfo(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:lfo(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function Wyr(){return{create:Vyr,insert:tfo,remove:nfo,insertDocumentScoreParameters:Gdo,insertTokenScoreParameters:Xdo,removeDocumentScoreParameters:Zdo,removeTokenScoreParameters:Ydo,calculateResultScores:Qdo,search:ofo,searchByWhereClause:ifo,getSearchableProperties:afo,getSearchablePropertiesWithTypes:sfo,load:cfo,save:dfo}}var hat=v(()=>{Jh();xyr();Ryr();Dyr();Byr();gd();_ae();UOe();yae();x0()});function Jyr(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=Jyr(t,e,s,n,u);Fu(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!ID(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 Ur("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function pfo(t,e,r,n){return n?.enabled!==!1?Jyr(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function mfo(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=cu(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&gat(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function Kyr(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)bfo(t,r);t.isSorted=!0}function hfo(t,e,r){return e[1].localeCompare(r[1],eyr(t))}function gfo(t,e){return t[1]-e[1]}function yfo(t,e){return e[1]?-1:1}function bfo(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=hfo.bind(null,t.language);break;case"number":n=gfo.bind(null);break;case"boolean":n=yfo.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 _fo(t){let e=Object.keys(t.sorts);for(let r of e)gat(t,r)}function gat(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 vfo(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=cu(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function wfo(t,e,r){if(!t.enabled)throw Ur("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Ur("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return gat(t,n),Kyr(t),e.sort((a,s)=>{let u=i.docs.get(cu(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(cu(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 Sfo(t){return t.enabled?t.sortableProperties:[]}function Cfo(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function xfo(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 Tfo(t){if(!t.enabled)return{enabled:!1};_fo(t),Kyr(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 Gyr(){return{create:pfo,insert:mfo,remove:vfo,save:Tfo,load:xfo,sortBy:wfo,getSortableProperties:Sfo,getSortablePropertiesWithTypes:Cfo}}var yat=v(()=>{Jh();yae();x0();gd();jOe()});function Pfo(t){return t<192||t>383?t:Efo[t-192]||t}function Xyr(t){let e=[];for(let r=0;r<t.length;r++)e[r]=Pfo(t.charCodeAt(r));return String.fromCharCode(...e)}var Efo,Zyr=v(()=>{Efo=[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 Qyr(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(bat),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(Yyr),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+gA+zOe+"[^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(Yyr),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(bat),e&&n.test(e)&&(t=e+Mfo[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(bat),e&&n.test(e)&&(t=e+Rfo[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(BOe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(BOe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(BOe),o=new RegExp(Afo),i=new RegExp("^"+gA+zOe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(BOe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Mfo,Rfo,Ifo,zOe,gA,vae,bat,Afo,BOe,Yyr,ebr=v(()=>{Mfo={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"},Rfo={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Ifo="[^aeiou]",zOe="[aeiouy]",gA=Ifo+"[^aeiouy]*",vae=zOe+"[aeiou]*",bat="^("+gA+")?"+vae+gA,Afo="^("+gA+")?"+vae+gA+"("+vae+")?$",BOe="^("+gA+")?"+vae+gA+vae+gA,Yyr="^("+gA+")?"+zOe});function _at(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=Xyr(e),this.normalizationCache.set(r,e),e)}function Nfo(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function tbr(t,e,r){if(e&&e!==this.language)throw Ur("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=Qgr[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Nfo(n);return this.allowDuplicates?o:Array.from(new Set(o))}function vat(t={}){if(!t.language)t.language="english";else if(!hae.includes(t.language))throw Ur("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Ur("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=Qyr;else throw Ur("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 Ur("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Ur("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Ur("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:tbr,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:_at,normalizationCache:new Map};return n.tokenize=tbr.bind(n),n.normalizeToken=_at,n}var VOe=v(()=>{Jh();Zyr();jOe();ebr()});function jfo(t){let e={formatElapsedTime:syr,getDocumentIndexId:uyr,getDocumentProperties:$Oe,validateSchema:Qit};for(let r of nat){let n=r;if(t[n]){if(typeof t[n]!="function")throw Ur("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!hyr.includes(r)&&!nat.includes(r))throw Ur("UNSUPPORTED_COMPONENT",r)}function YG({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=gae());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=vat(a):a=vat({language:r??"english"}),n.tokenizer&&r)throw Ur("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=cyr();s||(s=Wyr()),l||(l=Gyr()),u||(u=dyr()),jfo(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:$fo()};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 fyr)h[g]=(h[g]??[]).concat(pyr(h,g));let y=h.afterCreate;return y&&gyr(y,h),h}function $fo(){return"{{VERSION}}"}var rbr=v(()=>{yae();rat();myr();gq();hat();x0();yat();VOe();Jh();gd()});var nbr=v(()=>{});var wat=v(()=>{yae();rat();hat();VOe();yat();x0()});var HOe,Sat,Cat,xat=v(()=>{HOe="fulltext",Sat="hybrid",Cat="vector"});var yq,bq,Tat=v(()=>{xat();yq=Symbol("orama.insertions"),bq=Symbol("orama.removals")});function Oat(t){typeof t[yq]!="number"&&(queueMicrotask(()=>{t[yq]=void 0}),t[yq]=0),t[yq]>1e3?(obr("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[yq]=-1):t[yq]>=0&&t[yq]++}function Eat(t){typeof t[bq]!="number"&&(queueMicrotask(()=>{t[bq]=void 0}),t[bq]=0),t[bq]>1e3?(obr("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[bq]=-1):t[bq]>=0&&t[bq]++}var obr,Pat=v(()=>{Tat();obr=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function wae(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Ur("SCHEMA_VALIDATION_FAILURE",i);return Ld(t.index.beforeInsert)||Ld(t.index.insert)||Ld(t.index.afterInsert)?qfo(t,e,r,n,o):Ufo(t,e,r,n,o)}async function qfo(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Ur("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Ur("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await qx(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];ibr(m,h,f,p)}return await Bfo(t,s,l,d,u,r,e,o),n||await qx(t.afterInsert,t,s,e),Oat(t),s}function Ufo(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Ur("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Ur("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||qx(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];ibr(m,h,f,p)}return zfo(t,s,l,d,u,r,e,o),n||qx(t.afterInsert,t,s,e),Oat(t),s}function ibr(t,e,r,n){if(!(lyr(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(ID(e)&&Array.isArray(n))&&!(KG(e)&&Array.isArray(n))&&!(Ffo.has(e)&&kfo.has(t))&&t!==e)throw Ur("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Bfo(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 zfo(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 Ffo,kfo,Mat=v(()=>{wat();gd();gq();Pat();Jh();Ffo=new Set(["enum","enum[]"]),kfo=new Set(["string","number"])});function fH(t,e,r,n){return Ld(t.index.beforeRemove)||Ld(t.index.remove)||Ld(t.index.afterRemove)?Vfo(t,e,r,n):Hfo(t,e,r,n)}async function Vfo(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=C0(t.internalDocumentIDStore,cu(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await qx(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let y=f[h];if(typeof y>"u")continue;let g=d[h];await t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||await qx(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),Eat(t),o}function Hfo(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=C0(t.internalDocumentIDStore,cu(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||qx(t.beforeRemove,t,u);let c=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(s,c);for(let h of c){let y=f[h];if(typeof y>"u")continue;let g=d[h];t.index.beforeRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,y,g,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,y,g,r,t.tokenizer,l)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(s,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return n||qx(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),Eat(t),o}function Sae(t,e,r,n,o){return Ld(t.index.beforeRemove)||Ld(t.index.remove)||Ld(t.index.afterRemove)||Ld(t.beforeRemoveMultiple)||Ld(t.afterRemoveMultiple)?Wfo(t,e,r,n,o):Jfo(t,e,r,n,o)}async function Wfo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>C0(t.internalDocumentIDStore,cu(t.internalDocumentIDStore,s)));return o||await cH(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 fH(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await cH(t.afterRemoveMultiple,t,a),i}function Jfo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>C0(t.internalDocumentIDStore,cu(t.internalDocumentIDStore,l)));o||cH(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)fH(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||cH(t.afterRemoveMultiple,t,a),i}var Rat=v(()=>{gq();x0();Pat();gd()});function Kfo(t,e){return t[1]-e[1]}function Gfo(t,e){return e[1]-t[1]}function Xfo(t="desc"){return t.toLowerCase()==="asc"?Kfo:Gfo}function QG(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(".")?JG(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;abr(h,m)(f);break}case"number[]":{let h=new Set,y=r[d].ranges,g=abr(y,m,h);for(let b of f)g(b);break}case"boolean":case"enum":case"string":{sbr(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=sbr(m,p==="boolean[]"?"boolean":"string",new Set);for(let b of f)g(b);break}default:throw Ur("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=Xfo(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function abr(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 sbr(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 WOe=v(()=>{Jh();gd()});function e9(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 JOe=v(()=>{});function t9(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 b=n[g];if(typeof i[b]>"u")throw Ur("UNKNOWN_GROUP_BY_PROPERTY",b);if(!ubr.includes(i[b]))throw Ur("INVALID_GROUP_BY_PROPERTY",b,ubr.join(", "),i[b])}let a=e.map(([g])=>C0(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 b=n[g],_={property:b,perValue:{}},w=new Set;for(let T=0;T<u;T++){let O=s[T],E=JG(O,b);if(typeof E>"u")continue;let P=typeof E!="boolean"?E:""+E,R=_.perValue[P]??{indexes:[],count:0};R.count>=l||(R.indexes.push(T),R.count++,_.perValue[P]=R,w.add(E))}c.push(Array.from(w)),d[b]=_}let f=lbr(c),p=f.length,m=[];for(let g=0;g<p;g++){let b=f[g],_=b.length,w={values:[],indexes:[]},T=[];for(let O=0;O<_;O++){let E=b[O],P=n[O];T.push(d[P].perValue[typeof E!="boolean"?E:""+E].indexes),w.values.push(E)}w.indexes=WG(T).sort((O,E)=>O-E),w.indexes.length!==0&&m.push(w)}let h=m.length,y=Array.from({length:h});for(let g=0;g<h;g++){let b=m[g],_=r.reduce||Zfo,w=b.indexes.map(P=>({id:a[P],score:e[P][1],document:s[P]})),T=_.reducer.bind(null,b.values),O=_.getInitialValue(b.indexes.length),E=w.reduce(T,O);y[g]={values:b.values,result:E}}return y}function lbr(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=lbr(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];Fu(s,a),o.push(s)}return o}var Zfo,ubr,KOe=v(()=>{Jh();gd();x0();Zfo={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},ubr=["string","number","boolean"]});function cbr(t,e,r){let n=kx(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(GOe,e.relevance??{});let s=Object.keys(t.data.index.vectorIndexes),u=e.facets&&Object.keys(e.facets).length>0,{limit:l=10,offset:c=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,y=e.preflight===!0,{index:g,docs:b}=t.data,_=t.tokenizer.tokenize(d??"",r),w=t.caches.propertiesToSearch;if(!w){let z=t.index.getSearchablePropertiesWithTypes(g);w=t.index.getSearchableProperties(g),w=w.filter(V=>z[V].startsWith("string")),t.caches.propertiesToSearch=w}if(f&&f!=="*"){for(let z of f)if(!w.includes(z))throw Ur("UNKNOWN_INDEX",z,w.join(", "));w=w.filter(z=>f.includes(z))}let T=pH(t.tokenizer,t.index,t.documentsStore,r,e,w,_,t.documentsStore.count(b),n),O=Object.keys(e.where??{}).length>0,E=[];O&&(E=t.index.searchByWhereClause(T,g,e.where));let P=_.length;if(P||f?.length){let z=w.length;for(let V=0;V<z;V++){let k=w[V],X=T.indexMap[k];if(P!==0)for(let K=0;K<P;K++){let oe=_[K],ue=t.index.search(T,g,k,oe);Fu(X[oe],ue)}else{X[""]=[];let K=t.index.search(T,g,k,"");Fu(X[""],K)}let B=Object.values(X);T.docsIntersection[k]=kOe(B,e?.boost?.[k]??1,p,P);let Q=T.docsIntersection[k],Y=Q.length;for(let K=0;K<Y;K++){let[oe,ue]=Q[K],de=T.uniqueDocsIDs[oe];de?T.uniqueDocsIDs[oe]=de+ue+.5:T.uniqueDocsIDs[oe]=ue}}}else _.length===0&&d?T.uniqueDocsIDs={}:T.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(z=>[z,0]));let R=Object.entries(T.uniqueDocsIDs).map(([z,V])=>[+z,V]);if(O&&(R=e9(E,R)),e.sortBy)if(typeof e.sortBy=="function"){let z=R.map(([X])=>X),k=t.documentsStore.getMultiple(t.data.docs,z).map((X,B)=>[R[B][0],R[B][1],X]);k.sort(e.sortBy),R=k.map(([X,B])=>[X,B])}else R=t.sorter.sortBy(t.data.sorting,R,e.sortBy).map(([z,V])=>[cu(t.internalDocumentIDStore,z),V]);else R=R.sort(ayr);let I;y||(I=m?fbr(t,R,c,l,m):XOe(t,R,c,l));let N={elapsed:{formatted:"",raw:0},hits:[],count:R.length};if(typeof I<"u"&&(N.hits=I.filter(Boolean),h||LOe(N,s)),u){let z=QG(t,R,e.facets);N.facets=z}return e.groupBy&&(N.groups=t9(t,R,e.groupBy)),N.elapsed=t.formatElapsedTime(kx()-T.timeStart),N}async function a(){t.beforeSearch&&await XG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await GG(t.afterSearch,t,e,r,s),s}return o?a():i()}var dbr=v(()=>{_ae();WOe();JOe();KOe();gq();x0();Jh();gd();mH()});function Iat(t,e,r="english"){let n=kx(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Ur("INVALID_VECTOR_INPUT",Object.keys(s).join(", "));let{limit:u=10,offset:l=0,includeVectors:c=!1}=e,d=t.data.index.vectorIndexes[s.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:y,docs:g}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?Ur("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Ur("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let b=qOe(s.value,p,f,e.similarity).map(([z,V])=>[cu(t.internalDocumentIDStore,z),V]),_=t.caches.propertiesToSearch;if(!_){let z=t.index.getSearchablePropertiesWithTypes(y);_=t.index.getSearchableProperties(y),_=_.filter(V=>z[V].startsWith("string")),t.caches.propertiesToSearch=_}let w=[],T=pH(t.tokenizer,t.index,t.documentsStore,r,e,_,w,t.documentsStore.count(g),n),O=[];h&&(O=t.index.searchByWhereClause(T,y,e.where),b=e9(O,b));let E=[];m&&(E=QG(t,b,e.facets));let P=Array.from({length:u});for(let z=0;z<u;z++){let V=b[z+l];if(!V)break;let k=t.data.docs.docs[V[0]];if(k){c||(k[s.property]=null);let X={id:C0(t.internalDocumentIDStore,V[0]),score:V[1],document:k};P[z]=X}}let R=[];e.groupBy&&(R=t9(t,b,e.groupBy));let N=kx()-n;return{count:b.length,hits:P.filter(Boolean),elapsed:{raw:Number(N),formatted:lH(N)},...E?{facets:E}:{},...R?{groups:R}:{}}}async function a(){t.beforeSearch&&await XG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await GG(t.afterSearch,t,e,r,s),s}return o?a():i()}var Aat=v(()=>{mH();gd();WOe();Jh();UOe();JOe();KOe();x0();gq()});function mbr(t,e,r){let n=kx(),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=Yfo(t,e,r),f=Qfo(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,y=tpo(d,f,e.term??"",h),g=t.tokenizer.tokenize(e.term??"",r),b=t.caches.propertiesToSearch;if(!b){let N=t.index.getSearchablePropertiesWithTypes(p);b=t.index.getSearchableProperties(p),b=b.filter(z=>N[z].startsWith("string")),t.caches.propertiesToSearch=b}if(e.properties&&e.properties!=="*"){for(let N of e.properties)if(!b.includes(N))throw Ur("UNKNOWN_INDEX",N,b.join(", "));b=b.filter(N=>e.properties.includes(N))}let _=pH(t.tokenizer,t.index,t.documentsStore,r,e,b,g,t.documentsStore.count(m),n),w=Object.keys(e.where??{}).length>0,T=[];w&&(T=t.index.searchByWhereClause(_,p,e.where),y=e9(T,y));let O;c&&(O=QG(t,y,e.facets));let E;e.groupBy&&(E=t9(t,y,e.groupBy));let P=XOe(t,y,s,u).filter(Boolean),R=kx(),I={count:y.length,elapsed:{raw:Number(R-n),formatted:lH(R-n)},hits:P,...O?{facets:O}:{},...E?{groups:E}:{}};if(!l){let N=Object.keys(t.data.index.vectorIndexes);LOe(I,N)}return I}async function a(){t.beforeSearch&&await XG(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await GG(t.afterSearch,t,e,r,s),s}return o?a():i()}function Yfo(t,e,r){let n=kx();e.relevance=Object.assign(GOe,e.relevance??{});let{term:o="",properties:i,threshold:a=0}=e,{index:s,docs:u}=t.data,l=t.tokenizer.tokenize(o,r),c=t.caches.propertiesToSearch;if(!c){let m=t.index.getSearchablePropertiesWithTypes(s);c=t.index.getSearchableProperties(s),c=c.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=c}if(i&&i!=="*"){let m=new Set(c),h=new Set(i);for(let y of i)if(!m.has(y))throw Ur("UNKNOWN_INDEX",y,c.join(", "));c=c.filter(y=>h.has(y))}let d=pH(t.tokenizer,t.index,t.documentsStore,r,e,c,l,t.documentsStore.count(u),n),f=l.length;if(f||i&&i.length>0){let m=c.length;for(let h=0;h<m;h++){let y=c[h];if(f!==0)for(let T=0;T<f;T++){let O=l[T],E=t.index.search(d,s,y,O);Fu(d.indexMap[y][O],E)}else{let T=[];d.indexMap[y][""]=T;let O=t.index.search(d,s,y,"");Fu(T,O)}let g=d.indexMap[y],b=Object.values(g);d.docsIntersection[y]=kOe(b,e?.boost?.[y]??1,a,f);let _=d.docsIntersection[y],w=_.length;for(let T=0;T<w;T++){let[O,E]=_[T],P=d.uniqueDocsIDs[O];d.uniqueDocsIDs[O]=P?P+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 hbr(p)}function Qfo(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 Ur("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Ur("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=qOe(r.value,i,o,e.similarity).map(([s,u])=>[cu(t.internalDocumentIDStore,s),u]);return hbr(a)}function Nat([,t]){return t}function hbr(t){let e=Math.max.apply(Math,t.map(Nat));return t.map(([r,n])=>[r,n/e])}function pbr(t,e){return t/e}function epo(t,e){return(r,n)=>r*t+n*e}function tpo(t,e,r,n){let o=Math.max.apply(Math,t.map(Nat)),i=Math.max.apply(Math,e.map(Nat)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:rpo(r),l=new Map,c=t.length,d=epo(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],y=pbr(h,o),g=d(y,0);l.set(m,g)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],y=pbr(h,i),g=l.get(m)??0;l.set(m,g+d(0,y))}return[...l].sort((p,m)=>m[1]-p[1])}function rpo(t){return{text:.5,vector:.5}}var gbr=v(()=>{gd();JOe();_ae();Jh();mH();WOe();KOe();UOe();x0();mH();gq()});function pH(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 cv(t,e,r){let n=e.mode??HOe;if(n===HOe)return cbr(t,e,r);if(n===Cat)return Iat(t,e);if(n===Sat)return mbr(t,e);throw Ur("INVALID_SEARCH_MODE",n)}function fbr(t,e,r,n,o){let i=t.data.docs,a=new Map,s=[],u=new Set,l=e.length,c=0;for(let d=0;d<l;d++){let f=e[d];if(typeof f>"u")continue;let[p,m]=f;if(u.has(p))continue;let h=t.documentsStore.get(i,p),y=JG(h,o);if(!(typeof y>"u"||a.has(y))&&(a.set(y,!0),c++,!(c<=r)&&(s.push({id:C0(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function XOe(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:C0(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var GOe,mH=v(()=>{x0();Jh();gd();xat();dbr();Aat();gbr();GOe={k:1.2,b:.75,d:.5}});function ZOe(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 Dat(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 ybr=v(()=>{});var bbr=v(()=>{gq();Jh();Mat();Rat();gd()});var _br=v(()=>{Jh();mH()});var vbr=v(()=>{lat();gd();_ae();VOe()});var YOe=v(()=>{rbr();nbr();Mat();Rat();mH();Aat();ybr();bbr();_br();Tat();wat();vbr()});function apo(t,e){let r=wbr(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function wbr(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var T6a,O6a,opo,ipo,jat,spo,hH,$at=v(()=>{T6a=new Error("timeout while waiting for mutex to become available"),O6a=new Error("mutex already locked"),opo=new Error("request for lock canceled"),ipo=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())})},jat=class{constructor(e,r=opo){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=wbr(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return ipo(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]=[]),apo(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}};spo=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())})},hH=class{constructor(e){this._semaphore=new jat(1,e)}acquire(){return spo(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 Sbr=S(()=>{});var ki=S((QOe,Cbr)=>{(function(t,e){typeof QOe=="object"?Cbr.exports=QOe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(QOe,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=Sbr()}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(b){var _;return g.prototype=b,_=new g,g.prototype=null,_}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(g){var b=i(this);return g&&b.mixIn(g),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var b in g)g.hasOwnProperty(b)&&(this[b]=g[b]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(g,b){g=this.words=g||[],b!=r?this.sigBytes=b:this.sigBytes=g.length*4},toString:function(g){return(g||d).stringify(this)},concat:function(g){var b=this.words,_=g.words,w=this.sigBytes,T=g.sigBytes;if(this.clamp(),w%4)for(var O=0;O<T;O++){var E=_[O>>>2]>>>24-O%4*8&255;b[w+O>>>2]|=E<<24-(w+O)%4*8}else for(var P=0;P<T;P+=4)b[w+P>>>2]=_[P>>>2];return this.sigBytes+=T,this},clamp:function(){var g=this.words,b=this.sigBytes;g[b>>>2]&=4294967295<<32-b%4*8,g.length=e.ceil(b/4)},clone:function(){var g=u.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var b=[],_=0;_<g;_+=4)b.push(o());return new l.init(b,g)}}),c=a.enc={},d=c.Hex={stringify:function(g){for(var b=g.words,_=g.sigBytes,w=[],T=0;T<_;T++){var O=b[T>>>2]>>>24-T%4*8&255;w.push((O>>>4).toString(16)),w.push((O&15).toString(16))}return w.join("")},parse:function(g){for(var b=g.length,_=[],w=0;w<b;w+=2)_[w>>>3]|=parseInt(g.substr(w,2),16)<<24-w%8*4;return new l.init(_,b/2)}},f=c.Latin1={stringify:function(g){for(var b=g.words,_=g.sigBytes,w=[],T=0;T<_;T++){var O=b[T>>>2]>>>24-T%4*8&255;w.push(String.fromCharCode(O))}return w.join("")},parse:function(g){for(var b=g.length,_=[],w=0;w<b;w++)_[w>>>2]|=(g.charCodeAt(w)&255)<<24-w%4*8;return new l.init(_,b)}},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 b,_=this._data,w=_.words,T=_.sigBytes,O=this.blockSize,E=O*4,P=T/E;g?P=e.ceil(P):P=e.max((P|0)-this._minBufferSize,0);var R=P*O,I=e.min(R*4,T);if(R){for(var N=0;N<R;N+=O)this._doProcessBlock(w,N);b=w.splice(0,R),_.sigBytes-=I}return new l.init(b,I)},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 b=this._doFinalize();return b},blockSize:512/32,_createHelper:function(g){return function(b,_){return new g.init(_).finalize(b)}},_createHmacHelper:function(g){return function(b,_){return new y.HMAC.init(g,_).finalize(b)}}}),y=a.algo={};return a}(Math);return t})});var Cae=S((eEe,xbr)=>{(function(t,e){typeof eEe=="object"?xbr.exports=eEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(eEe,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 Obr=S((tEe,Tbr)=>{(function(t,e){typeof tEe=="object"?Tbr.exports=tEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tEe,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 Pbr=S((rEe,Ebr)=>{(function(t,e){typeof rEe=="object"?Ebr.exports=rEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(rEe,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 _q=S((nEe,Mbr)=>{(function(t,e){typeof nEe=="object"?Mbr.exports=nEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(nEe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64={stringify:function(s){var u=s.words,l=s.sigBytes,c=this._map;s.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=u[f>>>2]>>>24-f%4*8&255,m=u[f+1>>>2]>>>24-(f+1)%4*8&255,h=u[f+2>>>2]>>>24-(f+2)%4*8&255,y=p<<16|m<<8|h,g=0;g<4&&f+g*.75<l;g++)d.push(c.charAt(y>>>6*(3-g)&63));var b=c.charAt(64);if(b)for(;d.length%4;)d.push(b);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 Ibr=S((oEe,Rbr)=>{(function(t,e){typeof oEe=="object"?Rbr.exports=oEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(oEe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.Base64url={stringify:function(s,u){u===void 0&&(u=!0);var l=s.words,c=s.sigBytes,d=u?this._safe_map:this._map;s.clamp();for(var f=[],p=0;p<c;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,h=l[p+1>>>2]>>>24-(p+1)%4*8&255,y=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=m<<16|h<<8|y,b=0;b<4&&p+b*.75<c;b++)f.push(d.charAt(g>>>6*(3-b)&63));var _=d.charAt(64);if(_)for(;f.length%4;)f.push(_);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 vq=S((iEe,Abr)=>{(function(t,e){typeof iEe=="object"?Abr.exports=iEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(iEe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[];(function(){for(var p=0;p<64;p++)s[p]=e.abs(e.sin(p+1))*4294967296|0})();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,m){for(var h=0;h<16;h++){var y=m+h,g=p[y];p[y]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var b=this._hash.words,_=p[m+0],w=p[m+1],T=p[m+2],O=p[m+3],E=p[m+4],P=p[m+5],R=p[m+6],I=p[m+7],N=p[m+8],z=p[m+9],V=p[m+10],k=p[m+11],X=p[m+12],B=p[m+13],Q=p[m+14],Y=p[m+15],K=b[0],oe=b[1],ue=b[2],de=b[3];K=l(K,oe,ue,de,_,7,s[0]),de=l(de,K,oe,ue,w,12,s[1]),ue=l(ue,de,K,oe,T,17,s[2]),oe=l(oe,ue,de,K,O,22,s[3]),K=l(K,oe,ue,de,E,7,s[4]),de=l(de,K,oe,ue,P,12,s[5]),ue=l(ue,de,K,oe,R,17,s[6]),oe=l(oe,ue,de,K,I,22,s[7]),K=l(K,oe,ue,de,N,7,s[8]),de=l(de,K,oe,ue,z,12,s[9]),ue=l(ue,de,K,oe,V,17,s[10]),oe=l(oe,ue,de,K,k,22,s[11]),K=l(K,oe,ue,de,X,7,s[12]),de=l(de,K,oe,ue,B,12,s[13]),ue=l(ue,de,K,oe,Q,17,s[14]),oe=l(oe,ue,de,K,Y,22,s[15]),K=c(K,oe,ue,de,w,5,s[16]),de=c(de,K,oe,ue,R,9,s[17]),ue=c(ue,de,K,oe,k,14,s[18]),oe=c(oe,ue,de,K,_,20,s[19]),K=c(K,oe,ue,de,P,5,s[20]),de=c(de,K,oe,ue,V,9,s[21]),ue=c(ue,de,K,oe,Y,14,s[22]),oe=c(oe,ue,de,K,E,20,s[23]),K=c(K,oe,ue,de,z,5,s[24]),de=c(de,K,oe,ue,Q,9,s[25]),ue=c(ue,de,K,oe,O,14,s[26]),oe=c(oe,ue,de,K,N,20,s[27]),K=c(K,oe,ue,de,B,5,s[28]),de=c(de,K,oe,ue,T,9,s[29]),ue=c(ue,de,K,oe,I,14,s[30]),oe=c(oe,ue,de,K,X,20,s[31]),K=d(K,oe,ue,de,P,4,s[32]),de=d(de,K,oe,ue,N,11,s[33]),ue=d(ue,de,K,oe,k,16,s[34]),oe=d(oe,ue,de,K,Q,23,s[35]),K=d(K,oe,ue,de,w,4,s[36]),de=d(de,K,oe,ue,E,11,s[37]),ue=d(ue,de,K,oe,I,16,s[38]),oe=d(oe,ue,de,K,V,23,s[39]),K=d(K,oe,ue,de,B,4,s[40]),de=d(de,K,oe,ue,_,11,s[41]),ue=d(ue,de,K,oe,O,16,s[42]),oe=d(oe,ue,de,K,R,23,s[43]),K=d(K,oe,ue,de,z,4,s[44]),de=d(de,K,oe,ue,X,11,s[45]),ue=d(ue,de,K,oe,Y,16,s[46]),oe=d(oe,ue,de,K,T,23,s[47]),K=f(K,oe,ue,de,_,6,s[48]),de=f(de,K,oe,ue,I,10,s[49]),ue=f(ue,de,K,oe,Q,15,s[50]),oe=f(oe,ue,de,K,P,21,s[51]),K=f(K,oe,ue,de,X,6,s[52]),de=f(de,K,oe,ue,O,10,s[53]),ue=f(ue,de,K,oe,V,15,s[54]),oe=f(oe,ue,de,K,w,21,s[55]),K=f(K,oe,ue,de,N,6,s[56]),de=f(de,K,oe,ue,Y,10,s[57]),ue=f(ue,de,K,oe,R,15,s[58]),oe=f(oe,ue,de,K,B,21,s[59]),K=f(K,oe,ue,de,E,6,s[60]),de=f(de,K,oe,ue,k,10,s[61]),ue=f(ue,de,K,oe,T,15,s[62]),oe=f(oe,ue,de,K,z,21,s[63]),b[0]=b[0]+K|0,b[1]=b[1]+oe|0,b[2]=b[2]+ue|0,b[3]=b[3]+de|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,y=p.sigBytes*8;m[y>>>5]|=128<<24-y%32;var g=e.floor(h/4294967296),b=h;m[(y+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,m[(y+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,p.sigBytes=(m.length+1)*4,this._process();for(var _=this._hash,w=_.words,T=0;T<4;T++){var O=w[T];w[T]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}return _},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,y,g,b,_){var w=p+(m&h|~m&y)+g+_;return(w<<b|w>>>32-b)+m}function c(p,m,h,y,g,b,_){var w=p+(m&y|h&~y)+g+_;return(w<<b|w>>>32-b)+m}function d(p,m,h,y,g,b,_){var w=p+(m^h^y)+g+_;return(w<<b|w>>>32-b)+m}function f(p,m,h,y,g,b,_){var w=p+(h^(m|~y))+g+_;return(w<<b|w>>>32-b)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var Lat=S((aEe,Nbr)=>{(function(t,e){typeof aEe=="object"?Nbr.exports=aEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(aEe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.Hasher,i=e.algo,a=[],s=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,l){for(var c=this._hash.words,d=c[0],f=c[1],p=c[2],m=c[3],h=c[4],y=0;y<80;y++){if(y<16)a[y]=u[l+y]|0;else{var g=a[y-3]^a[y-8]^a[y-14]^a[y-16];a[y]=g<<1|g>>>31}var b=(d<<5|d>>>27)+h+a[y];y<20?b+=(f&p|~f&m)+1518500249:y<40?b+=(f^p^m)+1859775393:y<60?b+=(f&p|f&m|p&m)-1894007588:b+=(f^p^m)-899497514,h=m,m=p,p=f<<30|f>>>2,f=d,d=b}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 uEe=S((sEe,Dbr)=>{(function(t,e){typeof sEe=="object"?Dbr.exports=sEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(sEe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.algo,s=[],u=[];(function(){function d(h){for(var y=e.sqrt(h),g=2;g<=y;g++)if(!(h%g))return!1;return!0}function f(h){return(h-(h|0))*4294967296|0}for(var p=2,m=0;m<64;)d(p)&&(m<8&&(s[m]=f(e.pow(p,1/2))),u[m]=f(e.pow(p,1/3)),m++),p++})();var l=[],c=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(d,f){for(var p=this._hash.words,m=p[0],h=p[1],y=p[2],g=p[3],b=p[4],_=p[5],w=p[6],T=p[7],O=0;O<64;O++){if(O<16)l[O]=d[f+O]|0;else{var E=l[O-15],P=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,R=l[O-2],I=(R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10;l[O]=P+l[O-7]+I+l[O-16]}var N=b&_^~b&w,z=m&h^m&y^h&y,V=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),k=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),X=T+k+N+u[O]+l[O],B=V+z;T=w,w=_,_=b,b=g+X|0,g=y,y=h,h=m,m=X+B|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+y|0,p[3]=p[3]+g|0,p[4]=p[4]+b|0,p[5]=p[5]+_|0,p[6]=p[6]+w|0,p[7]=p[7]+T|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 $br=S((lEe,jbr)=>{(function(t,e,r){typeof lEe=="object"?jbr.exports=lEe=e(ki(),uEe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(lEe,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 Fat=S((cEe,Lbr)=>{(function(t,e,r){typeof cEe=="object"?Lbr.exports=cEe=e(ki(),Cae()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(cEe,function(t){return function(){var e=t,r=e.lib,n=r.Hasher,o=e.x64,i=o.Word,a=o.WordArray,s=e.algo;function u(){return i.create.apply(i,arguments)}var l=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],c=[];(function(){for(var f=0;f<80;f++)c[f]=u()})();var d=s.SHA512=n.extend({_doReset:function(){this._hash=new a.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(f,p){for(var m=this._hash.words,h=m[0],y=m[1],g=m[2],b=m[3],_=m[4],w=m[5],T=m[6],O=m[7],E=h.high,P=h.low,R=y.high,I=y.low,N=g.high,z=g.low,V=b.high,k=b.low,X=_.high,B=_.low,Q=w.high,Y=w.low,K=T.high,oe=T.low,ue=O.high,de=O.low,L=E,W=P,ie=R,j=I,A=N,U=z,H=V,re=k,Z=X,le=B,Ce=Q,He=Y,lt=K,qe=oe,Nt=ue,mt=de,Ot=0;Ot<80;Ot++){var je,Gr,ct=c[Ot];if(Ot<16)Gr=ct.high=f[p+Ot*2]|0,je=ct.low=f[p+Ot*2+1]|0;else{var ze=c[Ot-15],ht=ze.high,$e=ze.low,Ue=(ht>>>1|$e<<31)^(ht>>>8|$e<<24)^ht>>>7,Ve=($e>>>1|ht<<31)^($e>>>8|ht<<24)^($e>>>7|ht<<25),Kt=c[Ot-2],so=Kt.high,iu=Kt.low,An=(so>>>19|iu<<13)^(so<<3|iu>>>29)^so>>>6,Si=(iu>>>19|so<<13)^(iu<<3|so>>>29)^(iu>>>6|so<<26),Dl=c[Ot-7],Vi=Dl.high,O_=Dl.low,wg=c[Ot-16],yS=wg.high,ji=wg.low;je=Ve+O_,Gr=Ue+Vi+(je>>>0<Ve>>>0?1:0),je=je+Si,Gr=Gr+An+(je>>>0<Si>>>0?1:0),je=je+ji,Gr=Gr+yS+(je>>>0<ji>>>0?1:0),ct.high=Gr,ct.low=je}var KT=Z&Ce^~Z<,LC=le&He^~le&qe,bS=L&ie^L&A^ie&A,Gs=W&j^W&U^j&U,jl=(L>>>28|W<<4)^(L<<30|W>>>2)^(L<<25|W>>>7),Mu=(W>>>28|L<<4)^(W<<30|L>>>2)^(W<<25|L>>>7),Mm=(Z>>>14|le<<18)^(Z>>>18|le<<14)^(Z<<23|le>>>9),xd=(le>>>14|Z<<18)^(le>>>18|Z<<14)^(le<<23|Z>>>9),ll=l[Ot],rt=ll.high,Rr=ll.low,Be=mt+xd,Ee=Nt+Mm+(Be>>>0<mt>>>0?1:0),Be=Be+LC,Ee=Ee+KT+(Be>>>0<LC>>>0?1:0),Be=Be+Rr,Ee=Ee+rt+(Be>>>0<Rr>>>0?1:0),Be=Be+je,Ee=Ee+Gr+(Be>>>0<je>>>0?1:0),It=Mu+Gs,Qt=jl+bS+(It>>>0<Mu>>>0?1:0);Nt=lt,mt=qe,lt=Ce,qe=He,Ce=Z,He=le,le=re+Be|0,Z=H+Ee+(le>>>0<re>>>0?1:0)|0,H=A,re=U,A=ie,U=j,ie=L,j=W,W=Be+It|0,L=Ee+Qt+(W>>>0<Be>>>0?1:0)|0}P=h.low=P+W,h.high=E+L+(P>>>0<W>>>0?1:0),I=y.low=I+j,y.high=R+ie+(I>>>0<j>>>0?1:0),z=g.low=z+U,g.high=N+A+(z>>>0<U>>>0?1:0),k=b.low=k+re,b.high=V+H+(k>>>0<re>>>0?1:0),B=_.low=B+le,_.high=X+Z+(B>>>0<le>>>0?1:0),Y=w.low=Y+He,w.high=Q+Ce+(Y>>>0<He>>>0?1:0),oe=T.low=oe+qe,T.high=K+lt+(oe>>>0<qe>>>0?1:0),de=O.low=de+mt,O.high=ue+Nt+(de>>>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 y=this._hash.toX32();return y},clone:function(){var f=n.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:1024/32});e.SHA512=n._createHelper(d),e.HmacSHA512=n._createHmacHelper(d)}(),t.SHA512})});var kbr=S((dEe,Fbr)=>{(function(t,e,r){typeof dEe=="object"?Fbr.exports=dEe=e(ki(),Cae(),Fat()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(dEe,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 Ubr=S((fEe,qbr)=>{(function(t,e,r){typeof fEe=="object"?qbr.exports=fEe=e(ki(),Cae()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(fEe,function(t){return function(e){var r=t,n=r.lib,o=n.WordArray,i=n.Hasher,a=r.x64,s=a.Word,u=r.algo,l=[],c=[],d=[];(function(){for(var m=1,h=0,y=0;y<24;y++){l[m+5*h]=(y+1)*(y+2)/2%64;var g=h%5,b=(2*m+3*h)%5;m=g,h=b}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 _=1,w=0;w<24;w++){for(var T=0,O=0,E=0;E<7;E++){if(_&1){var P=(1<<E)-1;P<32?O^=1<<P:T^=1<<P-32}_&128?_=_<<1^113:_<<=1}d[w]=s.create(T,O)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var y=this._state,g=this.blockSize/2,b=0;b<g;b++){var _=m[h+2*b],w=m[h+2*b+1];_=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,w=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360;var T=y[b];T.high^=w,T.low^=_}for(var O=0;O<24;O++){for(var E=0;E<5;E++){for(var P=0,R=0,I=0;I<5;I++){var T=y[E+5*I];P^=T.high,R^=T.low}var N=f[E];N.high=P,N.low=R}for(var E=0;E<5;E++)for(var z=f[(E+4)%5],V=f[(E+1)%5],k=V.high,X=V.low,P=z.high^(k<<1|X>>>31),R=z.low^(X<<1|k>>>31),I=0;I<5;I++){var T=y[E+5*I];T.high^=P,T.low^=R}for(var B=1;B<25;B++){var P,R,T=y[B],Q=T.high,Y=T.low,K=l[B];K<32?(P=Q<<K|Y>>>32-K,R=Y<<K|Q>>>32-K):(P=Y<<K-32|Q>>>64-K,R=Q<<K-32|Y>>>64-K);var oe=f[c[B]];oe.high=P,oe.low=R}var ue=f[0],de=y[0];ue.high=de.high,ue.low=de.low;for(var E=0;E<5;E++)for(var I=0;I<5;I++){var B=E+5*I,T=y[B],L=f[B],W=f[(E+1)%5+5*I],ie=f[(E+2)%5+5*I];T.high=L.high^~W.high&ie.high,T.low=L.low^~W.low&ie.low}var T=y[0],j=d[O];T.high^=j.high,T.low^=j.low}},_doFinalize:function(){var m=this._data,h=m.words,y=this._nDataBytes*8,g=m.sigBytes*8,b=this.blockSize*32;h[g>>>5]|=1<<24-g%32,h[(e.ceil((g+1)/b)*b>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var _=this._state,w=this.cfg.outputLength/8,T=w/8,O=[],E=0;E<T;E++){var P=_[E],R=P.high,I=P.low;R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,O.push(I),O.push(R)}return new o.init(O,w)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),y=0;y<25;y++)h[y]=h[y].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var zbr=S((pEe,Bbr)=>{(function(t,e){typeof pEe=="object"?Bbr.exports=pEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(pEe,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(w,T){for(var O=0;O<16;O++){var E=T+O,P=w[E];w[E]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var R=this._hash.words,I=d.words,N=f.words,z=s.words,V=u.words,k=l.words,X=c.words,B,Q,Y,K,oe,ue,de,L,W,ie;ue=B=R[0],de=Q=R[1],L=Y=R[2],W=K=R[3],ie=oe=R[4];for(var j,O=0;O<80;O+=1)j=B+w[T+z[O]]|0,O<16?j+=m(Q,Y,K)+I[0]:O<32?j+=h(Q,Y,K)+I[1]:O<48?j+=y(Q,Y,K)+I[2]:O<64?j+=g(Q,Y,K)+I[3]:j+=b(Q,Y,K)+I[4],j=j|0,j=_(j,k[O]),j=j+oe|0,B=oe,oe=K,K=_(Y,10),Y=Q,Q=j,j=ue+w[T+V[O]]|0,O<16?j+=b(de,L,W)+N[0]:O<32?j+=g(de,L,W)+N[1]:O<48?j+=y(de,L,W)+N[2]:O<64?j+=h(de,L,W)+N[3]:j+=m(de,L,W)+N[4],j=j|0,j=_(j,X[O]),j=j+ie|0,ue=ie,ie=W,W=_(L,10),L=de,de=j;j=R[1]+Y+W|0,R[1]=R[2]+K+ie|0,R[2]=R[3]+oe+ue|0,R[3]=R[4]+B+de|0,R[4]=R[0]+Q+L|0,R[0]=j},_doFinalize:function(){var w=this._data,T=w.words,O=this._nDataBytes*8,E=w.sigBytes*8;T[E>>>5]|=128<<24-E%32,T[(E+64>>>9<<4)+14]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,w.sigBytes=(T.length+1)*4,this._process();for(var P=this._hash,R=P.words,I=0;I<5;I++){var N=R[I];R[I]=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360}return P},clone:function(){var w=i.clone.call(this);return w._hash=this._hash.clone(),w}});function m(w,T,O){return w^T^O}function h(w,T,O){return w&T|~w&O}function y(w,T,O){return(w|~T)^O}function g(w,T,O){return w&O|T&~O}function b(w,T,O){return w^(T|~O)}function _(w,T){return w<<T|w>>>32-T}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var hEe=S((mEe,Vbr)=>{(function(t,e){typeof mEe=="object"?Vbr.exports=mEe=e(ki()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(mEe,function(t){(function(){var e=t,r=e.lib,n=r.Base,o=e.enc,i=o.Utf8,a=e.algo,s=a.HMAC=n.extend({init:function(u,l){u=this._hasher=new u.init,typeof l=="string"&&(l=i.parse(l));var c=u.blockSize,d=c*4;l.sigBytes>d&&(l=u.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,h=p.words,y=0;y<c;y++)m[y]^=1549556828,h[y]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var u=this._hasher;u.reset(),u.update(this._iKey)},update:function(u){return this._hasher.update(u),this},finalize:function(u){var l=this._hasher,c=l.finalize(u);l.reset();var d=l.finalize(this._oKey.clone().concat(c));return d}})})()})});var Wbr=S((gEe,Hbr)=>{(function(t,e,r){typeof gEe=="object"?Hbr.exports=gEe=e(ki(),uEe(),hEe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(gEe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.SHA256,s=i.HMAC,u=i.PBKDF2=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,c){for(var d=this.cfg,f=s.create(d.hasher,l),p=o.create(),m=o.create([1]),h=p.words,y=m.words,g=d.keySize,b=d.iterations;h.length<g;){var _=f.update(c).finalize(m);f.reset();for(var w=_.words,T=w.length,O=_,E=1;E<b;E++){O=f.finalize(O),f.reset();for(var P=O.words,R=0;R<T;R++)w[R]^=P[R]}p.concat(_),y[0]++}return p.sigBytes=g*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var AD=S((yEe,Jbr)=>{(function(t,e,r){typeof yEe=="object"?Jbr.exports=yEe=e(ki(),Lat(),hEe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(yEe,function(t){return function(){var e=t,r=e.lib,n=r.Base,o=r.WordArray,i=e.algo,a=i.MD5,s=i.EvpKDF=n.extend({cfg:n.extend({keySize:128/32,hasher:a,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,l){for(var c,d=this.cfg,f=d.hasher.create(),p=o.create(),m=p.words,h=d.keySize,y=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var g=1;g<y;g++)c=f.finalize(c),f.reset();p.concat(c)}return p.sigBytes=h*4,p}});e.EvpKDF=function(u,l,c){return s.create(c).compute(u,l)}}(),t.EvpKDF})});var Jm=S((bEe,Kbr)=>{(function(t,e,r){typeof bEe=="object"?Kbr.exports=bEe=e(ki(),AD()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(bEe,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,z){return this.create(this._ENC_XFORM_MODE,N,z)},createDecryptor:function(N,z){return this.create(this._DEC_XFORM_MODE,N,z)},init:function(N,z,V){this.cfg=this.cfg.extend(V),this._xformMode=N,this._key=z,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 z=this._doFinalize();return z},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function N(z){return typeof z=="string"?I:E}return function(z){return{encrypt:function(V,k,X){return N(k).encrypt(z,V,k,X)},decrypt:function(V,k,X){return N(k).decrypt(z,V,k,X)}}}}()}),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,z){return this.Encryptor.create(N,z)},createDecryptor:function(N,z){return this.Decryptor.create(N,z)},init:function(N,z){this._cipher=N,this._iv=z}}),y=m.CBC=function(){var N=h.extend();N.Encryptor=N.extend({processBlock:function(V,k){var X=this._cipher,B=X.blockSize;z.call(this,V,k,B),X.encryptBlock(V,k),this._prevBlock=V.slice(k,k+B)}}),N.Decryptor=N.extend({processBlock:function(V,k){var X=this._cipher,B=X.blockSize,Q=V.slice(k,k+B);X.decryptBlock(V,k),z.call(this,V,k,B),this._prevBlock=Q}});function z(V,k,X){var B,Q=this._iv;Q?(B=Q,this._iv=e):B=this._prevBlock;for(var Y=0;Y<X;Y++)V[k+Y]^=B[Y]}return N}(),g=r.pad={},b=g.Pkcs7={pad:function(N,z){for(var V=z*4,k=V-N.sigBytes%V,X=k<<24|k<<16|k<<8|k,B=[],Q=0;Q<k;Q+=4)B.push(X);var Y=i.create(B,k);N.concat(Y)},unpad:function(N){var z=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=z}},_=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:b}),reset:function(){var N;f.reset.call(this);var z=this.cfg,V=z.iv,k=z.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,V&&V.words):(this._mode=N.call(k,this,V&&V.words),this._mode.__creator=N)},_doProcessBlock:function(N,z){this._mode.processBlock(N,z)},_doFinalize:function(){var N,z=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(z.pad(this._data,this.blockSize),N=this._process(!0)):(N=this._process(!0),z.unpad(N)),N},blockSize:128/32}),w=n.CipherParams=o.extend({init:function(N){this.mixIn(N)},toString:function(N){return(N||this.formatter).stringify(this)}}),T=r.format={},O=T.OpenSSL={stringify:function(N){var z,V=N.ciphertext,k=N.salt;return k?z=i.create([1398893684,1701076831]).concat(k).concat(V):z=V,z.toString(l)},parse:function(N){var z,V=l.parse(N),k=V.words;return k[0]==1398893684&&k[1]==1701076831&&(z=i.create(k.slice(2,4)),k.splice(0,4),V.sigBytes-=16),w.create({ciphertext:V,salt:z})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:O}),encrypt:function(N,z,V,k){k=this.cfg.extend(k);var X=N.createEncryptor(V,k),B=X.finalize(z),Q=X.cfg;return w.create({ciphertext:B,key:V,iv:Q.iv,algorithm:N,mode:Q.mode,padding:Q.padding,blockSize:N.blockSize,formatter:k.format})},decrypt:function(N,z,V,k){k=this.cfg.extend(k),z=this._parse(z,k.format);var X=N.createDecryptor(V,k).finalize(z.ciphertext);return X},_parse:function(N,z){return typeof N=="string"?z.parse(N,this):N}}),P=r.kdf={},R=P.OpenSSL={execute:function(N,z,V,k,X){if(k||(k=i.random(64/8)),X)var B=d.create({keySize:z+V,hasher:X}).compute(N,k);else var B=d.create({keySize:z+V}).compute(N,k);var Q=i.create(B.words.slice(z),V*4);return B.sigBytes=z*4,w.create({key:B,iv:Q,salt:k})}},I=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:R}),encrypt:function(N,z,V,k){k=this.cfg.extend(k);var X=k.kdf.execute(V,N.keySize,N.ivSize,k.salt,k.hasher);k.iv=X.iv;var B=E.encrypt.call(this,N,z,X.key,k);return B.mixIn(X),B},decrypt:function(N,z,V,k){k=this.cfg.extend(k),z=this._parse(z,k.format);var X=k.kdf.execute(V,N.keySize,N.ivSize,z.salt,k.hasher);k.iv=X.iv;var B=E.decrypt.call(this,N,z,X.key,k);return B}})}()})});var Xbr=S((_Ee,Gbr)=>{(function(t,e,r){typeof _Ee=="object"?Gbr.exports=_Ee=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(_Ee,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 Ybr=S((vEe,Zbr)=>{(function(t,e,r){typeof vEe=="object"?Zbr.exports=vEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(vEe,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 e_r=S((wEe,Qbr)=>{(function(t,e,r){typeof wEe=="object"?Qbr.exports=wEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(wEe,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 r_r=S((SEe,t_r)=>{(function(t,e,r){typeof SEe=="object"?t_r.exports=SEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(SEe,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 o_r=S((CEe,n_r)=>{(function(t,e,r){typeof CEe=="object"?n_r.exports=CEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(CEe,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 a_r=S((xEe,i_r)=>{(function(t,e,r){typeof xEe=="object"?i_r.exports=xEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(xEe,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 u_r=S((TEe,s_r)=>{(function(t,e,r){typeof TEe=="object"?s_r.exports=TEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(TEe,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 c_r=S((OEe,l_r)=>{(function(t,e,r){typeof OEe=="object"?l_r.exports=OEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(OEe,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 f_r=S((EEe,d_r)=>{(function(t,e,r){typeof EEe=="object"?d_r.exports=EEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(EEe,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 m_r=S((PEe,p_r)=>{(function(t,e,r){typeof PEe=="object"?p_r.exports=PEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(PEe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var g_r=S((MEe,h_r)=>{(function(t,e,r){typeof MEe=="object"?h_r.exports=MEe=e(ki(),Jm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(MEe,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 b_r=S((REe,y_r)=>{(function(t,e,r){typeof REe=="object"?y_r.exports=REe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(REe,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=[],b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(var _=0,w=0,b=0;b<256;b++){var T=w^w<<1^w<<2^w<<3^w<<4;T=T>>>8^T&255^99,i[_]=T,a[T]=_;var O=g[_],E=g[O],P=g[E],R=g[T]*257^T*16843008;s[_]=R<<24|R>>>8,u[_]=R<<16|R>>>16,l[_]=R<<8|R>>>24,c[_]=R;var R=P*16843009^E*65537^O*257^_*16843008;d[T]=R<<24|R>>>8,f[T]=R<<16|R>>>16,p[T]=R<<8|R>>>24,m[T]=R,_?(_=O^g[g[g[P^O]]],w^=g[g[w]]):_=w=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],y=o.AES=n.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var b=this._keyPriorReset=this._key,_=b.words,w=b.sigBytes/4,T=this._nRounds=w+6,O=(T+1)*4,E=this._keySchedule=[],P=0;P<O;P++)P<w?E[P]=_[P]:(g=E[P-1],P%w?w>6&&P%w==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[P/w|0]<<24),E[P]=E[P-w]^g);for(var R=this._invKeySchedule=[],I=0;I<O;I++){var P=O-I;if(I%4)var g=E[P];else var g=E[P-4];I<4||P<=4?R[I]=g:R[I]=d[i[g>>>24]]^f[i[g>>>16&255]]^p[i[g>>>8&255]]^m[i[g&255]]}}},encryptBlock:function(g,b){this._doCryptBlock(g,b,this._keySchedule,s,u,l,c,i)},decryptBlock:function(g,b){var _=g[b+1];g[b+1]=g[b+3],g[b+3]=_,this._doCryptBlock(g,b,this._invKeySchedule,d,f,p,m,a);var _=g[b+1];g[b+1]=g[b+3],g[b+3]=_},_doCryptBlock:function(g,b,_,w,T,O,E,P){for(var R=this._nRounds,I=g[b]^_[0],N=g[b+1]^_[1],z=g[b+2]^_[2],V=g[b+3]^_[3],k=4,X=1;X<R;X++){var B=w[I>>>24]^T[N>>>16&255]^O[z>>>8&255]^E[V&255]^_[k++],Q=w[N>>>24]^T[z>>>16&255]^O[V>>>8&255]^E[I&255]^_[k++],Y=w[z>>>24]^T[V>>>16&255]^O[I>>>8&255]^E[N&255]^_[k++],K=w[V>>>24]^T[I>>>16&255]^O[N>>>8&255]^E[z&255]^_[k++];I=B,N=Q,z=Y,V=K}var B=(P[I>>>24]<<24|P[N>>>16&255]<<16|P[z>>>8&255]<<8|P[V&255])^_[k++],Q=(P[N>>>24]<<24|P[z>>>16&255]<<16|P[V>>>8&255]<<8|P[I&255])^_[k++],Y=(P[z>>>24]<<24|P[V>>>16&255]<<16|P[I>>>8&255]<<8|P[N&255])^_[k++],K=(P[V>>>24]<<24|P[I>>>16&255]<<16|P[N>>>8&255]<<8|P[z&255])^_[k++];g[b]=B,g[b+1]=Q,g[b+2]=Y,g[b+3]=K},keySize:256/32});e.AES=n._createHelper(y)}(),t.AES})});var v_r=S((IEe,__r)=>{(function(t,e,r){typeof IEe=="object"?__r.exports=IEe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(IEe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=r.BlockCipher,i=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var h=this._key,y=h.words,g=[],b=0;b<56;b++){var _=a[b]-1;g[b]=y[_>>>5]>>>31-_%32&1}for(var w=this._subKeys=[],T=0;T<16;T++){for(var O=w[T]=[],E=u[T],b=0;b<24;b++)O[b/6|0]|=g[(s[b]-1+E)%28]<<31-b%6,O[4+(b/6|0)]|=g[28+(s[b+24]-1+E)%28]<<31-b%6;O[0]=O[0]<<1|O[0]>>>31;for(var b=1;b<7;b++)O[b]=O[b]>>>(b-1)*4+3;O[7]=O[7]<<5|O[7]>>>27}for(var P=this._invSubKeys=[],b=0;b<16;b++)P[b]=w[15-b]},encryptBlock:function(h,y){this._doCryptBlock(h,y,this._subKeys)},decryptBlock:function(h,y){this._doCryptBlock(h,y,this._invSubKeys)},_doCryptBlock:function(h,y,g){this._lBlock=h[y],this._rBlock=h[y+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var b=0;b<16;b++){for(var _=g[b],w=this._lBlock,T=this._rBlock,O=0,E=0;E<8;E++)O|=l[E][((T^_[E])&c[E])>>>0];this._lBlock=T,this._rBlock=w^O}var P=this._lBlock;this._lBlock=this._rBlock,this._rBlock=P,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),h[y]=this._lBlock,h[y+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,y){var g=(this._lBlock>>>h^this._rBlock)&y;this._rBlock^=g,this._lBlock^=g<<h}function p(h,y){var g=(this._rBlock>>>h^this._lBlock)&y;this._lBlock^=g,this._rBlock^=g<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,y=h.words;if(y.length!==2&&y.length!==4&&y.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=y.slice(0,2),b=y.length<4?y.slice(0,2):y.slice(2,4),_=y.length<6?y.slice(0,2):y.slice(4,6);this._des1=d.createEncryptor(n.create(g)),this._des2=d.createEncryptor(n.create(b)),this._des3=d.createEncryptor(n.create(_))},encryptBlock:function(h,y){this._des1.encryptBlock(h,y),this._des2.decryptBlock(h,y),this._des3.encryptBlock(h,y)},decryptBlock:function(h,y){this._des3.decryptBlock(h,y),this._des2.encryptBlock(h,y),this._des1.decryptBlock(h,y)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var S_r=S((AEe,w_r)=>{(function(t,e,r){typeof AEe=="object"?w_r.exports=AEe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(AEe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=o.RC4=n.extend({_doReset:function(){for(var u=this._key,l=u.words,c=u.sigBytes,d=this._S=[],f=0;f<256;f++)d[f]=f;for(var f=0,p=0;f<256;f++){var m=f%c,h=l[m>>>2]>>>24-m%4*8&255;p=(p+d[f]+h)%256;var y=d[f];d[f]=d[p],d[p]=y}this._i=this._j=0},_doProcessBlock:function(u,l){u[l]^=a.call(this)},keySize:256/32,ivSize:0});function a(){for(var u=this._S,l=this._i,c=this._j,d=0,f=0;f<4;f++){l=(l+1)%256,c=(c+u[l])%256;var p=u[l];u[l]=u[c],u[c]=p,d|=u[(u[l]+u[c])%256]<<24-f*8}return this._i=l,this._j=c,d}e.RC4=n._createHelper(i);var s=o.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)a.call(this)}});e.RC4Drop=n._createHelper(s)}(),t.RC4})});var x_r=S((NEe,C_r)=>{(function(t,e,r){typeof NEe=="object"?C_r.exports=NEe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(NEe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.Rabbit=n.extend({_doReset:function(){for(var c=this._key.words,d=this.cfg.iv,f=0;f<4;f++)c[f]=(c[f]<<8|c[f]>>>24)&16711935|(c[f]<<24|c[f]>>>8)&4278255360;var p=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],m=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)m[f]^=p[f+4&7];if(d){var h=d.words,y=h[0],g=h[1],b=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=b>>>16|_&4294901760,T=_<<16|b&65535;m[0]^=b,m[1]^=w,m[2]^=_,m[3]^=T,m[4]^=b,m[5]^=w,m[6]^=_,m[7]^=T;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=n._createHelper(u)}(),t.Rabbit})});var O_r=S((DEe,T_r)=>{(function(t,e,r){typeof DEe=="object"?T_r.exports=DEe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(DEe,function(t){return function(){var e=t,r=e.lib,n=r.StreamCipher,o=e.algo,i=[],a=[],s=[],u=o.RabbitLegacy=n.extend({_doReset:function(){var c=this._key.words,d=this.cfg.iv,f=this._X=[c[0],c[3]<<16|c[2]>>>16,c[1],c[0]<<16|c[3]>>>16,c[2],c[1]<<16|c[0]>>>16,c[3],c[2]<<16|c[1]>>>16],p=this._C=[c[2]<<16|c[2]>>>16,c[0]&4294901760|c[1]&65535,c[3]<<16|c[3]>>>16,c[1]&4294901760|c[2]&65535,c[0]<<16|c[0]>>>16,c[2]&4294901760|c[3]&65535,c[1]<<16|c[1]>>>16,c[3]&4294901760|c[0]&65535];this._b=0;for(var m=0;m<4;m++)l.call(this);for(var m=0;m<8;m++)p[m]^=f[m+4&7];if(d){var h=d.words,y=h[0],g=h[1],b=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,_=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,w=b>>>16|_&4294901760,T=_<<16|b&65535;p[0]^=b,p[1]^=w,p[2]^=_,p[3]^=T,p[4]^=b,p[5]^=w,p[6]^=_,p[7]^=T;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<a[0]>>>0?1:0)|0,d[2]=d[2]+886263092+(d[1]>>>0<a[1]>>>0?1:0)|0,d[3]=d[3]+1295307597+(d[2]>>>0<a[2]>>>0?1:0)|0,d[4]=d[4]+3545052371+(d[3]>>>0<a[3]>>>0?1:0)|0,d[5]=d[5]+886263092+(d[4]>>>0<a[4]>>>0?1:0)|0,d[6]=d[6]+1295307597+(d[5]>>>0<a[5]>>>0?1:0)|0,d[7]=d[7]+3545052371+(d[6]>>>0<a[6]>>>0?1:0)|0,this._b=d[7]>>>0<a[7]>>>0?1:0;for(var f=0;f<8;f++){var p=c[f]+d[f],m=p&65535,h=p>>>16,y=((m*m>>>17)+m*h>>>15)+h*h,g=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=y^g}c[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,c[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,c[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,c[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,c[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,c[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,c[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,c[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=n._createHelper(u)}(),t.RabbitLegacy})});var P_r=S((jEe,E_r)=>{(function(t,e,r){typeof jEe=="object"?E_r.exports=jEe=e(ki(),_q(),vq(),AD(),Jm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(jEe,function(t){return function(){var e=t,r=e.lib,n=r.BlockCipher,o=e.algo;let i=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function l(m,h){let y=h>>24&255,g=h>>16&255,b=h>>8&255,_=h&255,w=m.sbox[0][y]+m.sbox[1][g];return w=w^m.sbox[2][b],w=w+m.sbox[3][_],w}function c(m,h,y){let g=h,b=y,_;for(let w=0;w<i;++w)g=g^m.pbox[w],b=l(m,g)^b,_=g,g=b,b=_;return _=g,g=b,b=_,b=b^m.pbox[i],g=g^m.pbox[i+1],{left:g,right:b}}function d(m,h,y){let g=h,b=y,_;for(let w=i+1;w>1;--w)g=g^m.pbox[w],b=l(m,g)^b,_=g,g=b,b=_;return _=g,g=b,b=_,b=b^m.pbox[1],g=g^m.pbox[0],{left:g,right:b}}function f(m,h,y){for(let T=0;T<4;T++){m.sbox[T]=[];for(let O=0;O<256;O++)m.sbox[T][O]=s[T][O]}let g=0;for(let T=0;T<i+2;T++)m.pbox[T]=a[T]^h[g],g++,g>=y&&(g=0);let b=0,_=0,w=0;for(let T=0;T<i+2;T+=2)w=c(m,b,_),b=w.left,_=w.right,m.pbox[T]=b,m.pbox[T+1]=_;for(let T=0;T<4;T++)for(let O=0;O<256;O+=2)w=c(m,b,_),b=w.left,_=w.right,m.sbox[T][O]=b,m.sbox[T][O+1]=_;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,y=m.sigBytes/4;f(u,h,y)}},encryptBlock:function(m,h){var y=c(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},decryptBlock:function(m,h){var y=d(u,m[h],m[h+1]);m[h]=y.left,m[h+1]=y.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var gH=S(($Ee,M_r)=>{(function(t,e,r){typeof $Ee=="object"?M_r.exports=$Ee=e(ki(),Cae(),Obr(),Pbr(),_q(),Ibr(),vq(),Lat(),uEe(),$br(),Fat(),kbr(),Ubr(),zbr(),hEe(),Wbr(),AD(),Jm(),Xbr(),Ybr(),e_r(),r_r(),o_r(),a_r(),u_r(),c_r(),f_r(),m_r(),g_r(),b_r(),v_r(),S_r(),x_r(),O_r(),P_r()):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)})($Ee,function(t){return t})});var kat,upo,LEe,R_r=v(()=>{lw();Ye();YOe();kat="copilot-index-chunk-",upo=".json",LEe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${kat}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${kat}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${upo}`}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,[]);te().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,te().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),te().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 Dat(e),n=te().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(te().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)),te().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)),te().debug&&console.log(`Saved partition ${l+1}/${n}`)}te().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new lo(`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 lo("Invalid legacy database format");let l=await YG({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await ZOe(l,u),l}let r=await this.loadMetadata(),n=await YG({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 lo("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++):te().debug&&console.warn(`Document ${u} not found in any chunk`)}return o.docs.docs=a,o.docs.count=Object.keys(a).length,o.internalDocumentIDStore.internalIdToId=Object.values(a).map(u=>u.id),o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(u=>u.index?.vectorIndexes?.embedding?.vectors||{})),await ZOe(n,o),n}catch(e){throw console.error("Error loading database:",e),new lo(`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}/${kat}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new lo(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(te().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 lo("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new lo("Invalid metadata file: missing schema");return r}async saveMetadata(e){let r=this.getMetadataPath();await this.ensureDirectoryExists(r),await this.app.vault.adapter.write(r,JSON.stringify(e))}}});var N_r={};En(N_r,{DBOperations:()=>wq});var A_r,yA,I_r,wq,FEe=v(()=>{sH();lw();Xe();Ye();Bt();YOe();$at();A_r=$(gH()),yA=require("obsidian");R_r();ob();I_r=25,wq=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new hH;hl(async()=>{let r=te();yA.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):yA.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await hd.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(F("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await hd.getInstance().getEmbeddingsAPI()),F("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new lo("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new LEe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),yA.Platform.isMobile&&te().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new lo("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),F("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ne("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ne("Error initializing semantic index database:",r),new yA.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(yA.Platform.isMobile&&te().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await hd.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new lo("Semantic index database not found.")}catch(e){throw ne("Failed to initialize database during save:",e),new lo("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,te().debug&&F("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ne("Error saving semantic index database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(r=>setTimeout(r,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new yA.Notice("Local Copilot index cleared successfully."),F("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ne("Error clearing the local Copilot index:",r),new yA.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new lo("Semantic index database not found.");try{let r=await cv(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await Sae(this.oramaDb,r.hits.map(n=>n.id),500),te().debug&&F(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ne("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(te().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),F("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,A_r.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new lo("Embedding instance not found.");let r=await Jit(e);if(!r||r===0)throw new lo("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await YG({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return F(`Created new semantic index database for ${this.dbPath}. Embedding model: ${hd.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 t.getAllDocuments(e)).filter(i=>i.path===r).map(i=>({document:i,score:1})):void 0}static async getDocsByEmbedding(e,r,n){return(await cv(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 cv(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ne("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",nchars:"number"}}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,te().numPartitions),o=await cv(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await fH(r,o.hits[0].id);try{return await wae(r,e),F(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ne(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await wae(r,o.hits[0].document)}catch(a){ne("Failed to restore previous document version:",a)}return}}catch(n){ne(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await cv(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ne("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){F("Semantic index database not loaded in memory. Checking for existing index...");try{await this.initializeDB(e)}catch(o){throw ne("Failed to initialize database:",o),new lo("Failed to initialize semantic index database. Please check your embedding model settings.")}if(!this.oramaDb)return F("No existing index found. Will create new index."),!1}let r=await cv(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=hd.getModelName(e);if(!w1t(n,o))return new yA.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),F(`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 F("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await cv(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){F("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await hd.getInstance().getEmbeddingsAPI();if(!e)throw new lo("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new lo("Failed to initialize database after attempt.")}catch(e){throw ne("Failed to initialize database during garbage collection:",e),new lo("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),r=new Set(e.map(u=>u.path)),{inclusions:n,exclusions:o}=el(),i=new Set(e.filter(u=>Hs(u,n,o)).map(u=>u.path)),s=(await t.getAllDocuments(this.oramaDb)).filter(u=>!r.has(u.path)||!i.has(u.path));return s.length===0?0:(F("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(s.map(u=>u.path))).join(", ")),s.length===1?await fH(this.oramaDb,s[0].id):await Sae(this.oramaDb,s.map(u=>u.id),500),await this.saveDB(),s.length)}catch(e){throw ne("Error garbage collecting the Copilot index:",e),new lo("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new lo("Semantic index database not found.");try{let e=await t.getAllDocuments(this.oramaDb),r=new Set;return e.forEach(n=>{r.add(n.path)}),Array.from(r).sort()}catch(e){throw ne("Error getting indexed files:",e),new lo("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await cv(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ne("Error checking if database is empty:",e),new lo("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 lo("Semantic index database not found.");let r={};for(let n of e){let o=await t.getDocsByPath(this.oramaDb,n);o&&o.length>0&&(r[n]=o.map(i=>({id:i.document.id,title:i.document.title,path:i.document.path,content:i.document.content,metadata:i.document.metadata,embedding:i.document.embedding,embeddingModel:i.document.embeddingModel,tags:i.document.tags,extension:i.document.extension,nchars:i.document.nchars})))}return r}markFileMissingEmbeddings(e){this.filesWithoutEmbeddings.add(e)}clearFilesMissingEmbeddings(){this.filesWithoutEmbeddings.clear()}getFilesMissingEmbeddings(){return Array.from(this.filesWithoutEmbeddings)}isFileMissingEmbeddings(e){return this.filesWithoutEmbeddings.has(e)}async checkIndexIntegrity(){if(!this.oramaDb)throw new lo("Orama database not found.");try{let e=await this.getIndexedFiles(),r=[];for(let n=0;n<e.length;n+=1){let o=e[n];await this.hasEmbeddings(o)||(r.push(o),this.filesWithoutEmbeddings.add(o)),(n+1)%I_r===0&&await this.yieldToEventLoop()}e.length%I_r!==0&&await this.yieldToEventLoop(),r.length>0?F(`Integrity check: ${r.length} file(s) missing embeddings, marked for re-indexing:`,r.join(", ")):F("Index integrity check completed. All documents have embeddings.")}catch(e){throw ne("Error checking index integrity:",e),new lo("Failed to check index integrity.")}}async yieldToEventLoop(){await new Promise(e=>{if(typeof window<"u"){let r=window;if(r.requestIdleCallback){r.requestIdleCallback(()=>e());return}}setTimeout(e,0)})}}});var kEe,D_r=v(()=>{FEe();kEe=class{constructor(e){this.dbOps=new wq(e)}async initialize(e){await this.dbOps.initializeDB(e)}async clearIndex(e){await this.dbOps.clearIndex(e)}requiresEmbeddings(){return!0}async upsert(e){return this.dbOps.upsert(e)}async upsertBatch(e){let r=0;for(let n of e)await this.dbOps.upsert(n)&&(r+=1);return r}async removeByPath(e){await this.dbOps.removeDocs(e)}async getIndexedFiles(){return this.dbOps.getIndexedFiles()}async getLatestFileMtime(){return this.dbOps.getLatestFileMtime()}async isIndexEmpty(){return this.dbOps.isIndexEmpty()}async hasIndex(e){return this.dbOps.hasIndex(e)}async getDocumentsByPath(e){let r=this.dbOps.getDb();if(!r)throw new Error("Database is not loaded. Please restart the plugin.");let n=await wq.getDocsByPath(r,e);return n?n.map(o=>o.document):[]}async checkAndHandleEmbeddingModelChange(e){if(!e)throw new Error("Embedding instance is required to check Orama embedding model changes.");return this.dbOps.checkAndHandleEmbeddingModelChange(e)}async save(){await this.dbOps.saveDB()}async checkIndexIntegrity(){await this.dbOps.checkIndexIntegrity()}async garbageCollect(){return this.dbOps.garbageCollect()}markFileMissingEmbeddings(e){this.dbOps.markFileMissingEmbeddings(e)}clearFilesMissingEmbeddings(){this.dbOps.clearFilesMissingEmbeddings()}getFilesMissingEmbeddings(){return this.dbOps.getFilesMissingEmbeddings()}markUnsavedChanges(){this.dbOps.markUnsavedChanges()}onunload(){this.dbOps.onunload()}getDb(){return this.dbOps.getDb()}async reinitializeForIndexSyncChange(e){let r=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==r&&await this.dbOps.initializeDB(e)}getDbOperations(){return this.dbOps}}});var r9,lpo,xae,j_r=v(()=>{ra();sd();Xe();Ye();r9=require("obsidian");ob();lpo=5e3,xae=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.indexBackend=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.listenersActive=!1;this.handleActiveLeafChange=async e=>{if(!this.shouldHandleEvents()||r9.Platform.isMobile&&te().disableIndexOnMobile||ex()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof r9.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}=el(),u=Hs(n,a,s),l=o!==null&&n.stat.mtime>o;u&&l&&this.debouncedReindexFile(n)}};this.debouncedReindexFile=e=>{this.shouldHandleEvents()&&(this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{te().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},lpo))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof r9.TFile&&await this.indexBackend.removeByPath(e.path)};this.syncEventListeners(),hl(()=>{this.syncEventListeners()})}shouldHandleEvents(){return te().enableSemanticSearchV3}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(F("Copilot Plus: Initializing semantic index event listeners"),this.app.workspace.on("active-leaf-change",this.handleActiveLeafChange),this.app.vault.on("delete",this.handleFileDelete),this.listenersActive=!0):!e&&this.listenersActive&&this.teardownEventListeners()}teardownEventListeners(){this.listenersActive&&(this.app.workspace.off("active-leaf-change",this.handleActiveLeafChange),this.app.vault.off("delete",this.handleFileDelete),this.debounceTimer!==null&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null),this.lastActiveFile=null,this.lastActiveFileMtime=null,this.listenersActive=!1)}cleanup(){this.teardownEventListeners()}unload(){this.teardownEventListeners()}}});function Uat(t){return qat.add(t),()=>{qat.delete(t)}}function qEe(){qat.forEach(t=>t())}var qat,Bat=v(()=>{qat=new Set});var UEe,$_r=v(()=>{UEe=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 tl,zat=v(()=>{tl=class{constructor(t){x(this,"pageContent");x(this,"metadata");x(this,"id");this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}}});var Tae,L_r,F_r=v(()=>{Pg();Tae=class extends Go{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","documents","transformers"])}invoke(e,r){return this.transformDocuments(e)}},L_r=class extends Tae{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}}});var cpo,ND=v(()=>{Jo();zat();F_r();cpo={};$t(cpo,{BaseDocumentTransformer:()=>Tae,Document:()=>tl,MappingDocumentTransformer:()=>L_r})});var k_r,Hat,q_r=v(()=>{ND();_tt();k_r=class extends Tae{constructor(e){super(e);x(this,"lc_namespace",["langchain","document_transformers","text_splitters"]);x(this,"chunkSize",1e3);x(this,"chunkOverlap",200);x(this,"keepSeparator",!1);x(this,"lengthFunction");if(this.chunkSize=e?.chunkSize??this.chunkSize,this.chunkOverlap=e?.chunkOverlap??this.chunkOverlap,this.keepSeparator=e?.keepSeparator??this.keepSeparator,this.lengthFunction=e?.lengthFunction??(r=>r.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,r={}){return this.splitDocuments(e,r)}splitOnSeparator(e,r){let n;if(r)if(this.keepSeparator){let o=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");n=e.split(new RegExp(`(?=${o})`))}else n=e.split(r);else n=e.split("");return n.filter(o=>o!=="")}async createDocuments(e,r=[],n={}){let o=r.length>0?r:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:a="(cont'd) ",appendChunkOverlapHeader:s=!1}=n,u=new Array;for(let l=0;l<e.length;l+=1){let c=e[l],d=1,f=null,p=-1;for(let m of await this.splitText(c)){let h=i,y=c.indexOf(m,p+1);if(f===null){let w=this.numberOfNewLines(c,0,y);d+=w}else{let w=p+await this.lengthFunction(f);if(w<y){let T=this.numberOfNewLines(c,w,y);d+=T}else if(w>y){let T=this.numberOfNewLines(c,y,w);d-=T}s&&(h+=a)}let g=this.numberOfNewLines(m),b=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};b.lines={from:d,to:d+g};let _={...o[l],loc:b};h+=m,u.push(new tl({pageContent:h,metadata:_})),d+=g,f=m,p=y}}return u}numberOfNewLines(e,r,n){return(e.slice(r,n).match(/\n/g)||[]).length}async splitDocuments(e,r={}){let n=e.filter(a=>a.pageContent!==void 0),o=n.map(a=>a.pageContent),i=n.map(a=>a.metadata);return this.createDocuments(o,i,r)}joinDocs(e,r){let n=e.join(r).trim();return n===""?null:n}async mergeSplits(e,r){let n=[],o=[],i=0;for(let s of e){let u=await this.lengthFunction(s);if(i+u+o.length*r.length>this.chunkSize&&(i>this.chunkSize&&console.warn(`Created a chunk of size ${i}, +
|
||
which is longer than the specified ${this.chunkSize}`),o.length>0)){let l=this.joinDocs(o,r);for(l!==null&&n.push(l);i>this.chunkOverlap||i+u+o.length*r.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(s),i+=u}let a=this.joinDocs(o,r);return a!==null&&n.push(a),n}},Hat=class Vat extends k_r{constructor(r){super(r);x(this,"separators",[`
|
||
|
||
`,`
|
||
`," ",""]);this.separators=r?.separators??this.separators,this.keepSeparator=r?.keepSeparator??!0}static lc_name(){return"RecursiveCharacterTextSplitter"}async _splitText(r,n){let o=[],i=n[n.length-1],a;for(let c=0;c<n.length;c+=1){let d=n[c];if(d===""){i=d;break}if(r.includes(d)){i=d,a=n.slice(c+1);break}}let s=this.splitOnSeparator(r,i),u=[],l=this.keepSeparator?"":i;for(let c of s)if(await this.lengthFunction(c)<this.chunkSize)u.push(c);else{if(u.length){let d=await this.mergeSplits(u,l);o.push(...d),u=[]}if(!a)o.push(c);else{let d=await this._splitText(c,a);o.push(...d)}}if(u.length){let c=await this.mergeSplits(u,l);o.push(...c)}return o}async splitText(r){return this._splitText(r,this.separators)}static fromLanguage(r,n){return new Vat({...n,separators:Vat.getSeparatorsForLanguage(r)})}static getSeparatorsForLanguage(r){if(r==="cpp")return[`
|
||
class `,`
|
||
void `,`
|
||
int `,`
|
||
float `,`
|
||
double `,`
|
||
if `,`
|
||
for `,`
|
||
while `,`
|
||
switch `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="go")return[`
|
||
func `,`
|
||
var `,`
|
||
const `,`
|
||
type `,`
|
||
if `,`
|
||
for `,`
|
||
switch `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="java")return[`
|
||
class `,`
|
||
public `,`
|
||
protected `,`
|
||
private `,`
|
||
static `,`
|
||
if `,`
|
||
for `,`
|
||
while `,`
|
||
switch `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="js")return[`
|
||
function `,`
|
||
const `,`
|
||
let `,`
|
||
var `,`
|
||
class `,`
|
||
if `,`
|
||
for `,`
|
||
while `,`
|
||
switch `,`
|
||
case `,`
|
||
default `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="php")return[`
|
||
function `,`
|
||
class `,`
|
||
if `,`
|
||
foreach `,`
|
||
while `,`
|
||
do `,`
|
||
switch `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="proto")return[`
|
||
message `,`
|
||
service `,`
|
||
enum `,`
|
||
option `,`
|
||
import `,`
|
||
syntax `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="python")return[`
|
||
class `,`
|
||
def `,`
|
||
def `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="rst")return[`
|
||
===
|
||
`,`
|
||
---
|
||
`,`
|
||
***
|
||
`,`
|
||
.. `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="ruby")return[`
|
||
def `,`
|
||
class `,`
|
||
if `,`
|
||
unless `,`
|
||
while `,`
|
||
for `,`
|
||
do `,`
|
||
begin `,`
|
||
rescue `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="rust")return[`
|
||
fn `,`
|
||
const `,`
|
||
let `,`
|
||
if `,`
|
||
while `,`
|
||
for `,`
|
||
loop `,`
|
||
match `,`
|
||
const `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="scala")return[`
|
||
class `,`
|
||
object `,`
|
||
def `,`
|
||
val `,`
|
||
var `,`
|
||
if `,`
|
||
for `,`
|
||
while `,`
|
||
match `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="swift")return[`
|
||
func `,`
|
||
class `,`
|
||
struct `,`
|
||
enum `,`
|
||
if `,`
|
||
for `,`
|
||
while `,`
|
||
do `,`
|
||
switch `,`
|
||
case `,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="markdown")return[`
|
||
## `,`
|
||
### `,`
|
||
#### `,`
|
||
##### `,`
|
||
###### `,"```\n\n",`
|
||
|
||
***
|
||
|
||
`,`
|
||
|
||
---
|
||
|
||
`,`
|
||
|
||
___
|
||
|
||
`,`
|
||
|
||
`,`
|
||
`," ",""];if(r==="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(r==="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(r==="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 ${r} is not supported.`)}}});var U_r=v(()=>{q_r()});function Sq(t){return Wat||(Wat=new Jat(t)),Wat}var zEe,BEe,Jat,Wat,Oae=v(()=>{Xe();mr();zEe=require("obsidian");U_r();BEe={maxChars:wye,overlap:0,maxBytesTotal:10*1024*1024},Jat=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0}getCacheKey(e,r){return`${e}:${r.maxChars}:${r.overlap}`}createSplitter(e){return Hat.fromLanguage("markdown",{chunkSize:e.maxChars,chunkOverlap:e.overlap,separators:[`
|
||
|
||
`,`
|
||
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Te("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Te("ChunkManager: Too many note paths, limiting to 1000"),e=e.slice(0,1e3));let n=e.filter(u=>!(!u||typeof u!="string"||u.startsWith("/")||u.startsWith("../")||u.includes("/../")||u.endsWith("/..")));if(n.length===0)return Te("ChunkManager: No valid note paths provided"),[];let o={...BEe,...r},i=[],a=0,s=0;for(let u of n){let l=this.getCacheKey(u,o),c=this.cache.get(l);if(c&&c.length>0){let d=this.app.vault.getAbstractFileByPath(u);if(d&&d instanceof zEe.TFile&&d.stat.mtime>c[0].mtime){let f=this.calculateChunkBytes(c);this.cache.delete(l),this.memoryUsage-=f,c=void 0}}if(!c&&(c=await this.generateChunksForNote(u,o),c.length>0)){let d=this.calculateChunkBytes(c);this.memoryUsage+d<=o.maxBytesTotal?(this.cache.set(l,c),this.memoryUsage+=d):(a+=1,s+=d)}i.push(...c)}if(a>0){let u=(s/1024/1024).toFixed(1);F(`ChunkManager: Cache budget reached, skipped caching ${a} notes (${u}MB total)`)}return F(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return Te("ChunkManager: Failed to get chunks",n),[]}}async getChunkText(e){return(await this.ensureChunkExists(e))?.content||""}async ensureChunkExists(e){let[r]=e.split("#"),o=(await this.getValidatedChunks(r)).find(i=>i.id===e);return o||Te(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r;for(let[o,i]of this.cache.entries())if(o.startsWith(e+":")){r=i;break}if(!r&&(F(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return Te(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof zEe.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(F(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?(Te(`ChunkManager: Failed to regenerate chunks after modification for ${e}`),[]):r}getChunkTextSync(e){let[r]=e.split("#");for(let[n,o]of this.cache.entries())if(n.startsWith(r+":")){let i=o.find(a=>a.id===e);if(i)return i.content}return Te(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),""}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,BEe),n=this.getCacheKey(e,BEe);if(r.length>0){let o=this.calculateChunkBytes(r);if(this.memoryUsage+o<=BEe.maxBytesTotal){let i=this.cache.get(n);i&&(this.memoryUsage-=this.calculateChunkBytes(i)),this.cache.set(n,r),this.memoryUsage+=o}else F(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Te(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,F("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof zEe.TFile))return[];let o=await this.safeReadFile(n);if(!o?.trim())return[];let i=this.app.metadataCache.getFileCache(n),a=(i?.headings||[]).slice().sort((p,m)=>p.position.start.offset-m.position.start.offset),s=[],u=0,l=this.findFrontmatterEnd(o,i?.frontmatter),c=o.substring(l),d=a.length>0?a[0].heading:"";if(`
|
||
|
||
NOTE TITLE: [[${n.basename}]]
|
||
|
||
NOTE BLOCK CONTENT:
|
||
|
||
`.length+c.length<=r.maxChars){let p=await this.processContentSection(c,d,n,u,r);return s.push(...p),s}if(a.length===0){let p=await this.processContentSection(c,"",n,u,r);return s.push(...p),s}for(let p=0;p<a.length;p++){let m=a[p],h=a[p+1],y=p===0?l:m.position.start.offset,g=h?.position.start.offset||o.length,b=o.substring(y,g),_=await this.processContentSection(b,m.heading,n,u,r);s.push(..._),u+=_.length}return s}catch(n){return Te(`ChunkManager: Failed to chunk note ${e}`,n),[]}}async processContentSection(e,r,n,o,i){let a=n.basename,s=[],u=`
|
||
|
||
NOTE TITLE: [[${a}]]
|
||
|
||
NOTE BLOCK CONTENT:
|
||
|
||
`,l=u+e;if(l.length<=i.maxChars){let c=this.generateChunkId(n.path,o),d=this.calculateContentHash(l);s.push({id:c,notePath:n.path,chunkIndex:o,content:l,contentHash:d,title:a,heading:r,mtime:n.stat.mtime})}else try{let d=await this.createSplitter(i).createDocuments([e],[],{chunkHeader:u,appendChunkOverlapHeader:i.overlap>0});this.coalesceTinySplitChunks(d.map(p=>p.pageContent),u,i.maxChars).forEach((p,m)=>{let h=o+m,y=this.generateChunkId(n.path,h),g=this.calculateContentHash(p);s.push({id:y,notePath:n.path,chunkIndex:h,content:p,contentHash:g,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){Te(`ChunkManager: Failed to split section in ${n.path}`,c);let d=this.generateChunkId(n.path,o),f=this.calculateContentHash(l);s.push({id:d,notePath:n.path,chunkIndex:o,content:l,contentHash:f,title:a,heading:r,mtime:n.stat.mtime})}return s}coalesceTinySplitChunks(e,r,n){if(e.length<=1)return e;let o=[...e],i=0;for(;i<o.length-1;){if(this.isTinyStructuralChunk(o[i],r)){let a=this.mergeChunkContents(o[i],o[i+1],r);if(a.length<=n){o.splice(i,2,a);continue}}i++}if(o.length>1){let a=o.length-1;if(this.isTinyStructuralChunk(o[a],r)){let s=this.mergeChunkContents(o[a-1],o[a],r);s.length<=n&&o.splice(a-1,2,s)}}return o}isTinyStructuralChunk(e,r){let n=this.stripChunkHeader(e,r).trim();if(!n)return!0;let o=n.split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return o.length===1&&/^#{1,6}\s+\S+/.test(o[0])}mergeChunkContents(e,r,n){let o=this.stripChunkHeader(e,n).replace(/\s+$/,""),i=this.stripChunkHeader(r,n).replace(/^\s+/,"");return`${n}${o}${o&&i?`
|
||
|
||
`:""}${i}`}stripChunkHeader(e,r){return e.startsWith(r)?e.slice(r.length):e}calculateChunkBytes(e){return e.reduce((r,n)=>r+Buffer.byteLength(n.content,"utf8"),0)}async safeReadFile(e){try{return(await this.app.vault.cachedRead(e))?.trim()||""}catch(r){return Te(`ChunkManager: Failed to read ${e.path}`,r),""}}generateChunkId(e,r){return`${e}#${r}`}calculateContentHash(e){let r=e.length.toString(16),n=e.slice(0,32).replace(/\s/g,"").substring(0,8);return r+n}formatMemoryUsage(){return`${(this.memoryUsage/1024/1024).toFixed(1)}MB`}findFrontmatterEnd(e,r){if(!r||!e.startsWith("---"))return 0;let n=e.match(/\n---(\r?\n|$)/);return n&&n.index!==void 0?n.index+n[0].length:0}},Wat=null});var B_r,VEe,Eae,z_r=v(()=>{ra();sH();Xe();$_r();Oae();Ye();Bt();B_r=$(gH()),VEe=require("obsidian");ob();Eae=class{constructor(e,r,n){this.app=e;this.indexBackend=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set};this.refreshRuntimeIndexingConfig(),this.chunkManager=Sq(e),hl(async()=>{this.refreshRuntimeIndexingConfig()})}refreshRuntimeIndexingConfig(){let e=te();this.rateLimiter=new UEe(e.embeddingRequestsPerMin),this.embeddingBatchSize=Math.max(1,e.embeddingBatchSize),this.checkpointInterval=8*this.embeddingBatchSize}async indexVaultToVectorStore(e,r){if(!te().enableSemanticSearchV3)return Te("indexVaultToVectorStore called with semantic search disabled, skipping."),0;let n=[];JWe();try{let o=this.indexBackend.requiresEmbeddings(),i=o?await this.embeddingsManager.getEmbeddingsAPI():void 0;if(o&&!i)return ne("Embedding instance not found."),WWe({isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:["Embedding model not available. Please check your Copilot settings to make sure you have a working embedding model."],completionStatus:"error"}),0;(o?await this.indexBackend.checkAndHandleEmbeddingModelChange(i):!1)&&(e=!0),e?(await this.indexBackend.clearIndex(i),this.indexBackend.clearFilesMissingEmbeddings()):await this.indexBackend.garbageCollect();let s=await this.getFilesToIndex(e);if(s.length===0)return r?.userInitiated&&Ig({completionStatus:"success"}),0;this.initializeIndexingState(s.length),this.indexBackend.clearFilesMissingEmbeddings();let u=o&&i?hd.getModelName(i):"",l=await this.prepareAllChunks(s,u);if(l.length===0)return JWe(),0;if(this.state.isIndexingCancelled||u5().isCancelled)return Ig({isActive:!1,completionStatus:"cancelled"}),0;let c=new Set(l.map(f=>f.fileInfo.path)).size;this.state.totalFilesToIndex=c,Ig({totalFiles:c});let d=0;for(;d<l.length&&!(this.state.isIndexingCancelled||u5().isCancelled);){await this.handlePause();let f=l.slice(d,d+this.embeddingBatchSize);try{let p=[];if(o&&i){await this.rateLimiter.wait();let y=await i.embedDocuments(f.map(g=>g.content));if(!y||y.length!==f.length)throw new Error(`Embedding model returned ${y?.length??0} embeddings for ${f.length} documents`);for(let g=0;g<f.length;g++){let b=f[g],_=y[g];if(!_||!Array.isArray(_)||_.length===0){ne(`Invalid embedding for document ${b.fileInfo.path}: ${_}`),this.indexBackend.markFileMissingEmbeddings(b.fileInfo.path);continue}p.push({doc:{...b.fileInfo,id:this.getDocHash(b.content),content:b.content,embedding:_,created_at:Date.now(),nchars:b.content.length},filePath:b.fileInfo.path})}}else for(let y of f)p.push({doc:{...y.fileInfo,id:this.getDocHash(y.content),content:y.content,embedding:[],created_at:Date.now(),nchars:y.content.length},filePath:y.fileInfo.path});if(p.length>0)try{await this.indexBackend.upsertBatch(p.map(y=>y.doc)),p.forEach(y=>this.state.processedFiles.add(y.filePath))}catch(y){ne("Batch upsert failed; falling back to per-document upserts.",y);for(let g of p)try{await this.indexBackend.upsert(g.doc),this.state.processedFiles.add(g.filePath)}catch(b){this.handleError(b,{filePath:g.filePath,errors:n}),o&&this.indexBackend.markFileMissingEmbeddings(g.filePath)}}this.state.indexedCount=this.state.processedFiles.size,vDt(this.state.indexedCount);let m=Math.floor((this.state.indexedCount-f.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>m&&(await this.indexBackend.save(),console.log("Copilot index checkpoint save completed."))}catch(p){if(this.handleError(p,{filePath:f?.[0]?.fileInfo?.path,errors:n,batch:f}),this.isRateLimitError(p))break}d+=f.length}return this.finalizeIndexing(n),setTimeout(()=>{this.indexBackend.save().then(()=>{F("Copilot index final save completed."),this.indexBackend.checkIndexIntegrity().catch(f=>{ne("Background integrity check failed:",f)})}).catch(f=>{ne("Background save failed:",f)})},100),this.state.indexedCount}catch(o){return this.handleError(o),Ig({isActive:!1,completionStatus:"error",errors:[o instanceof Error?o.message:String(o)]}),0}}async prepareAllChunks(e,r){let n=[];for(let i=0;i<e.length;i+=1e3){let s=e.slice(i,i+1e3).map(l=>l.path),u=await this.chunkManager.getChunks(s);for(let l of u){let c=this.app.vault.getAbstractFileByPath(l.notePath);if(!c||!(c instanceof VEe.TFile))continue;let d=this.app.metadataCache.getFileCache(c),f={title:l.title,path:l.notePath,embeddingModel:r,ctime:c.stat.ctime,mtime:l.mtime,tags:d?.tags?.map(p=>p.tag)??[],extension:c.extension,metadata:{...d?.frontmatter??{},created:Mg(new Date(c.stat.ctime)).display,modified:Mg(new Date(l.mtime)).display,chunkId:l.id,heading:l.heading}};if(l.content.trim()){let p=`METADATA:${JSON.stringify(f.metadata)}
|
||
|
||
`,m=l.content.indexOf("NOTE BLOCK CONTENT:"),h=m>0?l.content.slice(0,m)+p+l.content.slice(m):l.content;n.push({content:h,chunkId:l.id,fileInfo:f})}}}return n}getDocHash(e){return(0,B_r.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=el(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>Hs(c,r,n));let i=new Set(await this.indexBackend.getIndexedFiles()),a=await this.indexBackend.getLatestFileMtime(),s=new Set(this.indexBackend.getFilesMissingEmbeddings()),u=new Set,l=new Set;for(let c of o){if(!Hs(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 F([`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},WWe({isActive:!0,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:e,errors:[],completionStatus:"none"})}async handlePause(){let e=u5();if(this.state.isIndexingPaused=e.isPaused,this.state.isIndexingCancelled=e.isCancelled,this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;){await new Promise(n=>setTimeout(n,100));let r=u5();this.state.isIndexingPaused=r.isPaused,this.state.isIndexingCancelled=r.isCancelled}if(!this.state.isIndexingCancelled){this.refreshRuntimeIndexingConfig();let r=await this.getFilesToIndex();if(r.length===0){F("No files to index after filter change, stopping indexing"),this.cancelIndexing();return}let n=Math.max(this.state.indexedCount+r.length,1);this.state.totalFilesToIndex=n,Ig({totalFiles:n})}}}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.isStringLengthError(e)){new VEe.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(wDt(),this.state.isIndexingCancelled||u5().isCancelled){Ig({isActive:!1,completionStatus:"cancelled",errors:e});return}Ig({isActive:!1,completionStatus:e.length>0?"error":"success",errors:e,indexedCount:this.state.indexedCount})}async reindexFile(e){try{let r=this.indexBackend.requiresEmbeddings(),n=r?await this.embeddingsManager.getEmbeddingsAPI():void 0;if(r&&!n)return;if(await this.indexBackend.removeByPath(e.path),r&&n&&await this.indexBackend.checkAndHandleEmbeddingModelChange(n)){await this.indexVaultToVectorStore(!0);return}let o=r&&n?hd.getModelName(n):"",i=await this.prepareAllChunks([e],o);if(i.length===0)return;if(r&&n){let a=await n.embedDocuments(i.map(s=>s.content));for(let s=0;s<i.length;s++){let u=i[s];await this.indexBackend.upsert({...u.fileInfo,id:this.getDocHash(u.content),content:u.content,embedding:a[s],created_at:Date.now(),nchars:u.content.length})}}else for(let a of i)await this.indexBackend.upsert({...a.fileInfo,id:this.getDocHash(a.content),content:a.content,embedding:[],created_at:Date.now(),nchars:a.content.length});this.indexBackend.markUnsavedChanges(),te().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){F("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,Ig({isCancelled:!0,isActive:!1,completionStatus:"cancelled"}),await new Promise(e=>setTimeout(e,100))}}});var Vc={};En(Vc,{default:()=>O0});var Pae,O0,Pl=v(()=>{ra();lw();Xe();sH();Fc();Ye();Pae=require("obsidian");Zgr();D_r();j_r();Bat();z_r();O0=class t{constructor(){this.embeddingsManager=hd.getInstance(),this.oramaBackend=new kEe(app),this.miyoBackend=new DOe(app),this.activeBackendKey=this.getBackendKey(te()),this.indexBackend=this.activeBackendKey==="miyo"?this.miyoBackend:this.oramaBackend,this.indexOps=new Eae(app,this.indexBackend,this.embeddingsManager),this.eventHandler=new xae(app,this.indexOps,this.indexBackend),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...te()};let e=async()=>{let r=te(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync&&this.activeBackendKey==="orama"){let o=await this.embeddingsManager.getEmbeddingsAPI();await this.oramaBackend.reinitializeForIndexSyncChange(o)}await this.refreshBackend(r,n)};hl(()=>{this.initializationPromise=e()})}async initialize(){if(te().enableSemanticSearchV3)try{let r=3;for(;r>0;)try{let n=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.initialize(n);break}catch(n){if(n instanceof lo&&n.message.includes("Vault adapter not available")&&(r--,r>0)){await new Promise(o=>setTimeout(o,100));continue}new Pae.Notice("Failed to initialize vector store. Please make sure you have a valid API key for your embedding model and restart the plugin."),console.error("Failed to initialize vector store:",n);break}}catch(r){console.error("Failed to initialize vector store:",r)}}async waitForInitialization(){await this.initializationPromise}async indexVaultToVectorStore(e,r){if(await this.waitForInitialization(),!te().enableSemanticSearchV3)return Te("indexVaultToVectorStore called with semantic search disabled, skipping."),0;if(Pae.Platform.isMobile&&te().disableIndexOnMobile)return new Pae.Notice("Indexing is disabled on mobile devices"),0;let n=await this.indexOps.indexVaultToVectorStore(e,r);return qEe(),n}async clearIndex(){await this.waitForInitialization();let e=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.clearIndex(e),qEe()}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.indexBackend.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.indexBackend.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),await this.indexBackend.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.indexBackend.hasIndex(e)}async getDocumentsByPath(e){return await this.waitForInitialization(),this.indexBackend.getDocumentsByPath(e)}pauseIndexing(){Ig({isPaused:!0})}resumeIndexing(){Ig({isPaused:!1})}async cancelIndexing(){await this.indexOps.cancelIndexing()}shouldUseMiyo(e){return e.enableMiyo&&e.enableSemanticSearchV3&&yH()}getBackendKey(e){return this.shouldUseMiyo(e)?"miyo":"orama"}async refreshBackend(e,r){let n=this.getBackendKey(e);if(n!==this.activeBackendKey){if(this.activeBackendKey=n,this.indexBackend=n==="miyo"?this.miyoBackend:this.oramaBackend,this.indexOps=new Eae(app,this.indexBackend,this.embeddingsManager),this.eventHandler.cleanup(),this.eventHandler=new xae(app,this.indexOps,this.indexBackend),te().debug&&F(`VectorStoreManager: switched backend to ${n}`),e.enableSemanticSearchV3){let o=this.indexBackend.requiresEmbeddings()?await this.embeddingsManager.getEmbeddingsAPI():void 0;await this.indexBackend.initialize(o)}r&&e.enableSemanticSearchV3&&e.enableMiyo!==r.enableMiyo&&F("VectorStoreManager: Miyo backend toggled; reindex recommended.")}}onunload(){this.eventHandler.cleanup(),this.indexBackend.onunload()}async getDb(){await this.waitForInitialization();let e=this.oramaBackend.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),qEe()}}});function yH(){let t=te();return t.selfHostModeValidatedAt==null?!1:t.selfHostValidationCount>=n9?!0:Date.now()-t.selfHostModeValidatedAt<Rae}function o_(){return te().enableSelfHostMode?yH():!1}function p5e(t){return t.split("|")[1]==="copilot-plus"}function V_r(){let t=te();return o_()?!0:t.isPlusUser===!0}function o9(){let t=Br();return t.plusLicenseKey&&t.enableSelfHostMode&&t.selfHostModeValidatedAt!=null&&(t.selfHostValidationCount>=n9||Date.now()-t.selfHostModeValidatedAt<Rae)?!0:t.isPlusUser}async function E0(t){return o_()?!0:te().plusLicenseKey?(await Ql.getInstance().validateLicenseKey(t)).isValid:(tst(),!1)}async function Yat(){if(!te().plusLicenseKey)return!1;let r=(await Ql.getInstance().validateLicenseKey()).plan?.toLowerCase();return r!=null&&fpo.includes(r)}function H_r(){let t=Br(),[e,r]=Kat.default.useState(void 0);return Kat.default.useEffect(()=>{if(!t.plusLicenseKey){t.enableSelfHostMode&&Re("enableSelfHostMode",!1),r(!1);return}Yat().then(n=>{!n&&t.enableSelfHostMode&&Re("enableSelfHostMode",!1),r(n)}).catch(()=>{if(t.selfHostValidationCount>=n9){r(!0);return}if(t.selfHostModeValidatedAt!=null&&Date.now()-t.selfHostModeValidatedAt<Rae){r(!0);return}r(!1)})},[t.plusLicenseKey,t.enableSelfHostMode,t.selfHostModeValidatedAt,t.selfHostValidationCount]),e}async function Qat(){let t=te();if(t.selfHostValidationCount>=n9)return Re("selfHostModeValidatedAt",Date.now()),F("Self-host mode re-enabled (permanently validated)"),!0;if(t.selfHostModeValidatedAt!=null&&Date.now()-t.selfHostModeValidatedAt<Rae)return F("Self-host mode re-enabled (within grace period)"),!0;if(!await Yat())return F("Self-host mode requires an eligible plan (Believer, Supporter)"),new Mae.Notice("Self-host mode is only available for Believer and Supporter plan subscribers."),!1;let r=Math.max(t.selfHostValidationCount||0,1);return Re("selfHostModeValidatedAt",Date.now()),Re("selfHostValidationCount",r),F(`Self-host mode validation successful (${r}/3)`),!0}async function W_r(){let t=te();if(!(!t.enableSelfHostMode&&!t.enableMiyo)){if(t.selfHostValidationCount>=n9){F("Self-host mode permanently validated, skipping refresh");return}try{if(await Yat()){let r=Date.now();if(r-(t.selfHostModeValidatedAt||0)>=Rae){let i=(t.selfHostValidationCount||0)+1;Re("selfHostModeValidatedAt",r),Re("selfHostValidationCount",i),i>=n9?(F("Self-host mode permanently validated (3/3)"),new Mae.Notice("Self-host mode is now permanently enabled!")):F(`Self-host mode validation refreshed (${i}/3)`)}else F("Self-host mode validated (waiting for 15-day interval to increment count)")}else Re("enableSelfHostMode",!1),Re("enableMiyo",!1),Re("selfHostModeValidatedAt",null),Re("selfHostValidationCount",0),F("Self-host mode disabled - user is no longer on an eligible plan"),new Mae.Notice("Self-host mode has been disabled. An eligible plan is required.")}catch(e){F("Could not refresh self-host mode validation (offline?):",e)}}}function J_r(){let t=dpo,e=Zat,r=te().embeddingModelKey;F("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),pDt(t),N4("copilot_plus"),F_({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(F("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Pl(),Vc)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ne("Failed to trigger indexing after Plus settings applied:",n),new Mae.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):F("applyPlusSettings: No embedding model change, skipping indexing")}function est(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function t2(t){window.open(est(t),"_blank")}function K_r(){Re("isPlusUser",!0)}function tst(){let t=te().isPlusUser;Re("isPlusUser",!1),t&&new u_e(app).open()}var Mae,Kat,Gat,dpo,Xat,Zat,p5a,m5a,Rae,n9,fpo,Fc=v(()=>{ra();sd();Vkt();mr();mA();Xe();Ye();Mae=require("obsidian"),Kat=$(J()),Gat="copilot-plus-flash",dpo=Gat+"|"+"copilot-plus",Xat="copilot-plus-small",Zat=Xat+"|"+"copilot-plus",p5a=ko.defaultModelKey,m5a=ko.embeddingModelKey,Rae=15*24*60*60*1e3,n9=3,fpo=["believer","supporter"]});function Cq(t){let e=new Uint8Array(t),r="";for(let n=0;n<e.byteLength;n++)r+=String.fromCharCode(e[n]);return globalThis.btoa(r)}var HEe=v(()=>{});var Ql,mA=v(()=>{mr();vO();lw();Xe();Fc();Ye();HEe();Ql=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!te().plusLicenseKey)throw new E4("Copilot Plus license key not found. Please enter your license key in the settings.")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=te().userId;let a=new URL(`${vWe}${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 oo(te().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 F(`[API ${e} request]:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",te().userId);let o=new URL(`${vWe}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await oo(te().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 F(`[API ${e} form-data request]:`,a),{data:a}}catch(i){return{data:null,error:i instanceof Error?i:new Error(String(i))}}}async validateLicenseKey(e){let r={license_key:await oo(te().plusLicenseKey)};if(e&&typeof e=="object"){let i=Object.fromEntries(Object.entries(e).filter(([s,u])=>u!=null)),a=new Set(["license_key","user_id"]);for(let s of a)s in i&&delete i[s];Object.assign(r,i)}let{data:n,error:o}=await this.makeRequest("/license",r,"POST",!0,!0);return o?o.message==="Invalid license key"?(tst(),{isValid:!1}):{isValid:void 0}:(K_r(),{isValid:!0,plan:n?.plan})}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=Cq(e),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async docs4llm(e,r){let n=new FormData,o=this.getMimeTypeFromExtension(r),i=new Blob([e],{type:o}),a=`file.${r}`,s=new File([i],a,{type:o});n.append("files",s),n.append("file_type",r);let{data:u,error:l}=await this.makeFormDataRequest("/docs4llm",n);if(l)throw l;if(!u)throw new Error("No data returned from docs4llm");return u}getMimeTypeFromExtension(e){return{pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",txt:"text/plain",rtf:"application/rtf",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",html:"text/html",htm:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",csv:"text/csv",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",webm:"video/webm"}[e.toLowerCase()]||"application/octet-stream"}async webSearch(e){let{data:r,error:n}=await this.makeRequest("/websearch",{query:e});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(e){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}async twitter4llm(e){let{data:r,error:n}=await this.makeRequest("/twitter4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from twitter4llm");return r}}});var a9=S((E5a,Y_r)=>{var ppo="Expected a function",X_r=NaN,mpo="[object Symbol]",hpo=/^\s+|\s+$/g,gpo=/^[-+]0x[0-9a-f]+$/i,ypo=/^0b[01]+$/i,bpo=/^0o[0-7]+$/i,_po=parseInt,vpo=typeof window=="object"&&window&&window.Object===Object&&window,wpo=typeof self=="object"&&self&&self.Object===Object&&self,Spo=vpo||wpo||Function("return this")(),Cpo=Object.prototype,xpo=Cpo.toString,Tpo=Math.max,Opo=Math.min,rst=function(){return Spo.Date.now()};function Epo(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(ppo);e=Z_r(e)||0,nst(r)&&(c=!!r.leading,d="maxWait"in r,i=d?Tpo(Z_r(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(O){var E=n,P=o;return n=o=void 0,l=O,a=t.apply(P,E),a}function m(O){return l=O,s=setTimeout(g,e),c?p(O):a}function h(O){var E=O-u,P=O-l,R=e-E;return d?Opo(R,i-P):R}function y(O){var E=O-u,P=O-l;return u===void 0||E>=e||E<0||d&&P>=i}function g(){var O=rst();if(y(O))return b(O);s=setTimeout(g,h(O))}function b(O){return s=void 0,f&&n?p(O):(n=o=void 0,a)}function _(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function w(){return s===void 0?a:b(rst())}function T(){var O=rst(),E=y(O);if(n=arguments,o=this,u=O,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 T.cancel=_,T.flush=w,T}function nst(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Ppo(t){return!!t&&typeof t=="object"}function Mpo(t){return typeof t=="symbol"||Ppo(t)&&xpo.call(t)==mpo}function Z_r(t){if(typeof t=="number")return t;if(Mpo(t))return X_r;if(nst(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=nst(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(hpo,"");var r=ypo.test(t);return r||bpo.test(t)?_po(t.slice(2),r?2:8):gpo.test(t)?X_r:+t}Y_r.exports=Epo});var lvr={};En(lvr,{createToolCallMarker:()=>Upo,decodeResultFromMarker:()=>lst,decodeToolCallMarkerResults:()=>kpo,ensureEncodedToolCallMarkerResults:()=>qpo,parseToolCallMarkers:()=>cst,updateToolCallMarker:()=>Bpo});function ust(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function lst(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function Fpo(t){return`Tool '${t}' ${Lpo}`}function kpo(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=lst(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function qpo(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):([\s\S]*?)-->/g,(e,r,n)=>{if(n.startsWith("ENC:"))return e;let o=ust(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function sst(t,e=0,r=""){let n=[],o=/<errorChunk>([\s\S]*?)<\/errorChunk>/g,i=0,a;for(;(a=o.exec(t))!==null;){a.index>i&&n.push({type:"text",content:t.slice(i,a.index)});let[s,u]=a,l=e+a.index,c=r?`${r}-error-${l}`:`error-${l}`;n.push({type:"error",content:u,error:{id:c,errorContent:u,startIndex:l,endIndex:e+a.index+s.length}}),i=a.index+s.length}return i<t.length&&n.push({type:"text",content:t.slice(i)}),n.length===0&&n.push({type:"text",content:t}),n}function cst(t,e){let r=[],n=/<!--TOOL_CALL_START:([^:]+):([^:]+):([^:]+):([^:]+):([^:]*):([^:]+)-->([\s\S]*?)<!--TOOL_CALL_END:\1:([\s\S]*?)-->/g,o=0,i;for(;(i=n.exec(t))!==null;){if(i.index>o){let _=t.slice(o,i.index);sst(_,o,e).forEach(T=>{T.type==="text"&&T.content.trim()?r.push({type:"text",content:T.content}):T.type==="error"&&T.error&&r.push({type:"error",content:T.content,error:T.error})})}let[a,s,u,l,c,d,f,p,m]=i,y=lst(typeof m=="string"?m:""),b=(typeof y=="string"?y.length:0)>5e3?Fpo(u):y??void 0;r.push({type:"toolCall",content:p,toolCall:{id:s,toolName:u,displayName:l,emoji:c,confirmationMessage:d||void 0,isExecuting:f==="true",result:b,startIndex:i.index,endIndex:i.index+a.length}}),o=i.index+a.length}if(o<t.length){let a=t.slice(o);sst(a,o,e).forEach(u=>{u.type==="text"&&u.content.trim()?r.push({type:"text",content:u.content}):u.type==="error"&&u.error&&r.push({type:"error",content:u.content,error:u.error})})}return r.length===0&&sst(t,0,e).forEach(s=>{s.type==="text"?r.push({type:"text",content:s.content}):s.type==="error"&&s.error&&r.push({type:"error",content:s.content,error:s.error})}),{segments:r}}function Upo(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&ust(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function Bpo(t,e,r){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(<!--TOOL_CALL_START:${n}:[^:]+:[^:]+:[^:]+:[^:]*:)true(-->[\\s\\S]*?<!--TOOL_CALL_END:${n}:)[\\s\\S]*?-->`,"g"),i=ust(r);return t.replace(o,`$1false$2${i}-->`)}var Lpo,dst=v(()=>{Lpo=`Result omitted to keep the UI responsive (payload exceeded ${5e3.toLocaleString()} characters).`});var Kpo,Ux,f9=v(()=>{Jo();WL();rO();Pg();Kpo={};$t(Kpo,{BaseRetriever:()=>Ux});Ux=class extends Go{constructor(e){super(e);x(this,"callbacks");x(this,"tags");x(this,"metadata");x(this,"verbose");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){let n=ai(HN(r)),i=await(await mc.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(e,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}}});var Gpo,bvr,_vr,ny,Nae,p9,Xpo,vvr,Dae,sPe,bst,mst,Zpo,wvr,Svr,wst,Sst,Cvr,Ypo,jae,hst,Qpo,emo,tmo,rmo,gst,mvr,nmo,_st,vst,yst,omo,hvr,gvr,yvr,iPe,aPe,xvr,imo,Tvr=v(()=>{Gpo="ENTRIES",bvr="KEYS",_vr="VALUES",ny="",Nae=class{constructor(e,r){let n=e._tree,o=Array.from(n.keys());this.set=e,this._type=r,this._path=o.length>0?[{node:n,keys:o}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:r}=p9(this._path);if(p9(r)===ny)return{done:!1,value:this.result()};let n=e.get(p9(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=p9(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>p9(e)).filter(e=>e!==ny).join("")}value(){return p9(this._path).node.get(ny)}result(){switch(this._type){case _vr:return this.value();case bvr:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},p9=t=>t[t.length-1],Xpo=(t,e,r)=>{let n=new Map;if(e===void 0)return n;let o=e.length+1,i=o+r,a=new Uint8Array(i*o).fill(r+1);for(let s=0;s<o;++s)a[s]=s;for(let s=1;s<i;++s)a[s*o]=s;return vvr(t,e,r,n,a,1,o,""),n},vvr=(t,e,r,n,o,i,a,s)=>{let u=i*a;e:for(let l of t.keys())if(l===ny){let c=o[u-1];c<=r&&n.set(s,[t.get(l),c])}else{let c=i;for(let d=0;d<l.length;++d,++c){let f=l[d],p=a*c,m=p-a,h=o[p],y=Math.max(0,c-r-1),g=Math.min(a-1,c+r);for(let b=y;b<g;++b){let _=f!==e[b],w=o[m+b]+ +_,T=o[m+b+1]+1,O=o[p+b]+1,E=o[p+b+1]=Math.min(w,T,O);E<h&&(h=E)}if(h>r)continue e}vvr(t.get(l),e,r,n,o,c,a,s+l)}},Dae=class t{constructor(e=new Map,r=""){this._size=void 0,this._tree=e,this._prefix=r}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");let[r,n]=sPe(this._tree,e.slice(this._prefix.length));if(r===void 0){let[o,i]=wst(n);for(let a of o.keys())if(a!==ny&&a.startsWith(i)){let s=new Map;return s.set(a.slice(i.length),o.get(a)),new t(s,e)}}return new t(r,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,Zpo(this._tree,e)}entries(){return new Nae(this,Gpo)}forEach(e){for(let[r,n]of this)e(r,n,this)}fuzzyGet(e,r){return Xpo(this._tree,e,r)}get(e){let r=bst(this._tree,e);return r!==void 0?r.get(ny):void 0}has(e){let r=bst(this._tree,e);return r!==void 0&&r.has(ny)}keys(){return new Nae(this,bvr)}set(e,r){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,mst(this._tree,e).set(ny,r),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let n=mst(this._tree,e);return n.set(ny,r(n.get(ny))),this}fetch(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let n=mst(this._tree,e),o=n.get(ny);return o===void 0&&n.set(ny,o=r()),o}values(){return new Nae(this,_vr)}[Symbol.iterator](){return this.entries()}static from(e){let r=new t;for(let[n,o]of e)r.set(n,o);return r}static fromObject(e){return t.from(Object.entries(e))}},sPe=(t,e,r=[])=>{if(e.length===0||t==null)return[t,r];for(let n of t.keys())if(n!==ny&&e.startsWith(n))return r.push([t,n]),sPe(t.get(n),e.slice(n.length),r);return r.push([t,e]),sPe(void 0,"",r)},bst=(t,e)=>{if(e.length===0||t==null)return t;for(let r of t.keys())if(r!==ny&&e.startsWith(r))return bst(t.get(r),e.slice(r.length))},mst=(t,e)=>{let r=e.length;e:for(let n=0;t&&n<r;){for(let i of t.keys())if(i!==ny&&e[n]===i[0]){let a=Math.min(r-n,i.length),s=1;for(;s<a&&e[n+s]===i[s];)++s;let u=t.get(i);if(s===i.length)t=u;else{let l=new Map;l.set(i.slice(s),u),t.set(e.slice(n,n+s),l),t.delete(i),t=l}n+=s;continue e}let o=new Map;return t.set(e.slice(n),o),o}return t},Zpo=(t,e)=>{let[r,n]=sPe(t,e);if(r!==void 0){if(r.delete(ny),r.size===0)wvr(n);else if(r.size===1){let[o,i]=r.entries().next().value;Svr(n,o,i)}}},wvr=t=>{if(t.length===0)return;let[e,r]=wst(t);if(e.delete(r),e.size===0)wvr(t.slice(0,-1));else if(e.size===1){let[n,o]=e.entries().next().value;n!==ny&&Svr(t.slice(0,-1),n,o)}},Svr=(t,e,r)=>{if(t.length===0)return;let[n,o]=wst(t);n.set(o+e,r),n.delete(o)},wst=t=>t[t.length-1],Sst="or",Cvr="and",Ypo="and_not",jae=class t{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');let r=e.autoVacuum==null||e.autoVacuum===!0?yst:e.autoVacuum;this._options={...gst,...e,autoVacuum:r,searchOptions:{...mvr,...e.searchOptions||{}},autoSuggestOptions:{...nmo,...e.autoSuggestOptions||{}}},this._index=new Dae,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=vst,this.addFields(this._options.fields)}add(e){let{extractField:r,stringifyField:n,tokenize:o,processTerm:i,fields:a,idField:s}=this._options,u=r(e,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);let l=this.addDocumentId(u);this.saveStoredFields(l,e);for(let c of a){let d=r(e,c);if(d==null)continue;let f=o(n(d,c),c),p=this._fieldIds[c],m=new Set(f).size;this.addFieldLength(l,p,this._documentCount-1,m);for(let h of f){let y=i(h,c);if(Array.isArray(y))for(let g of y)this.addTerm(p,l,g);else y&&this.addTerm(p,l,y)}}}addAll(e){for(let r of e)this.add(r)}addAllAsync(e,r={}){let{chunkSize:n=10}=r,o={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:s,promise:u},l,c)=>(s.push(l),(c+1)%n===0?{chunk:[],promise:u.then(()=>new Promise(d=>setTimeout(d,0))).then(()=>this.addAll(s))}:{chunk:s,promise:u}),o);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:r,processTerm:n,extractField:o,stringifyField:i,fields:a,idField:s}=this._options,u=o(e,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);let l=this._idToShortId.get(u);if(l==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(let c of a){let d=o(e,c);if(d==null)continue;let f=r(i(d,c),c),p=this._fieldIds[c],m=new Set(f).size;this.removeFieldLength(l,p,this._documentCount,m);for(let h of f){let y=n(h,c);if(Array.isArray(y))for(let g of y)this.removeTerm(p,l,g);else y&&this.removeTerm(p,l,y)}}this._storedFields.delete(l),this._documentIds.delete(l),this._idToShortId.delete(u),this._fieldLength.delete(l),this._documentCount-=1}removeAll(e){if(e)for(let r of e)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Dae,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){let r=this._idToShortId.get(e);if(r==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((n,o)=>{this.removeFieldLength(r,o,this._documentCount,n)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:r,batchSize:n,batchWait:o}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:o},{minDirtCount:r,minDirtFactor:e})}discardAll(e){let r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let n of e)this.discard(n)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(e){let{idField:r,extractField:n}=this._options,o=n(e,r);this.discard(o),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{let n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=vst,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,r){let n=this._dirtCount;if(this.vacuumConditionsMet(r)){let o=e.batchSize||_st.batchSize,i=e.batchWait||_st.batchWait,a=1;for(let[s,u]of this._index){for(let[l,c]of u)for(let[d]of c)this._documentIds.has(d)||(c.size<=1?u.delete(l):c.delete(d));this._index.get(s).size===0&&this._index.delete(s),a%o===0&&await new Promise(l=>setTimeout(l,i)),a+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:r,minDirtFactor:n}=e;return r=r||yst.minDirtCount,n=n||yst.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)}search(e,r={}){let{searchOptions:n}=this._options,o={...n,...r},i=this.executeQuery(e,r),a=[];for(let[s,{score:u,terms:l,match:c}]of i){let d=l.length||1,f={id:this._documentIds.get(s),score:u*d,terms:Object.keys(c),queryTerms:l,match:c};Object.assign(f,this._storedFields.get(s)),(o.filter==null||o.filter(f))&&a.push(f)}return e===t.wildcard&&o.boostDocument==null||a.sort(gvr),a}autoSuggest(e,r={}){r={...this._options.autoSuggestOptions,...r};let n=new Map;for(let{score:i,terms:a}of this.search(e,r)){let s=a.join(" "),u=n.get(s);u!=null?(u.score+=i,u.count+=1):n.set(s,{score:i,terms:a,count:1})}let o=[];for(let[i,{score:a,terms:s,count:u}]of n)o.push({suggestion:i,terms:s,score:a/u});return o.sort(gvr),o}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)}static async loadJSONAsync(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),r)}static getDefault(e){if(gst.hasOwnProperty(e))return hst(gst,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,r){let{index:n,documentIds:o,fieldLength:i,storedFields:a,serializationVersion:s}=e,u=this.instantiateMiniSearch(e,r);u._documentIds=iPe(o),u._fieldLength=iPe(i),u._storedFields=iPe(a);for(let[l,c]of u._documentIds)u._idToShortId.set(c,l);for(let[l,c]of n){let d=new Map;for(let f of Object.keys(c)){let p=c[f];s===1&&(p=p.ds),d.set(parseInt(f,10),iPe(p))}u._index.set(l,d)}return u}static async loadJSAsync(e,r){let{index:n,documentIds:o,fieldLength:i,storedFields:a,serializationVersion:s}=e,u=this.instantiateMiniSearch(e,r);u._documentIds=await aPe(o),u._fieldLength=await aPe(i),u._storedFields=await aPe(a);for(let[c,d]of u._documentIds)u._idToShortId.set(d,c);let l=0;for(let[c,d]of n){let f=new Map;for(let p of Object.keys(d)){let m=d[p];s===1&&(m=m.ds),f.set(parseInt(p,10),await aPe(m))}++l%1e3===0&&await xvr(0),u._index.set(c,f)}return u}static instantiateMiniSearch(e,r){let{documentCount:n,nextId:o,fieldIds:i,averageFieldLength:a,dirtCount:s,serializationVersion:u}=e;if(u!==1&&u!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");let l=new t(r);return l._documentCount=n,l._nextId=o,l._idToShortId=new Map,l._fieldIds=i,l._avgFieldLength=a,l._dirtCount=s||0,l._index=new Dae,l}executeQuery(e,r={}){if(e===t.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){let f={...r,...e,queries:void 0},p=e.queries.map(m=>this.executeQuery(m,f));return this.combineResults(p,f.combineWith)}let{tokenize:n,processTerm:o,searchOptions:i}=this._options,a={tokenize:n,processTerm:o,...i,...r},{tokenize:s,processTerm:u}=a,d=s(e).flatMap(f=>u(f)).filter(f=>!!f).map(rmo(a)).map(f=>this.executeQuerySpec(f,a));return this.combineResults(d,a.combineWith)}executeQuerySpec(e,r){let n={...this._options.searchOptions,...r},o=(n.fields||this._options.fields).reduce((h,y)=>({...h,[y]:hst(n.boost,y)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:s,bm25:u}=n,{fuzzy:l,prefix:c}={...mvr.weights,...a},d=this._index.get(e.term),f=this.termResults(e.term,e.term,1,e.termBoost,d,o,i,u),p,m;if(e.prefix&&(p=this._index.atPrefix(e.term)),e.fuzzy){let h=e.fuzzy===!0?.2:e.fuzzy,y=h<1?Math.min(s,Math.round(e.term.length*h)):h;y&&(m=this._index.fuzzyGet(e.term,y))}if(p)for(let[h,y]of p){let g=h.length-e.term.length;if(!g)continue;m?.delete(h);let b=c*h.length/(h.length+.3*g);this.termResults(e.term,h,b,e.termBoost,y,o,i,u,f)}if(m)for(let h of m.keys()){let[y,g]=m.get(h);if(!g)continue;let b=l*h.length/(h.length+g);this.termResults(e.term,h,b,e.termBoost,y,o,i,u,f)}return f}executeWildcardQuery(e){let r=new Map,n={...this._options.searchOptions,...e};for(let[o,i]of this._documentIds){let a=n.boostDocument?n.boostDocument(i,"",this._storedFields.get(o)):1;r.set(o,{score:a,terms:[],match:{}})}return r}combineResults(e,r=Sst){if(e.length===0)return new Map;let n=r.toLowerCase(),o=Qpo[n];if(!o)throw new Error(`Invalid combination operator: ${r}`);return e.reduce(o)||new Map}toJSON(){let e=[];for(let[r,n]of this._index){let o={};for(let[i,a]of n)o[i]=Object.fromEntries(a);e.push([r,o])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,r,n,o,i,a,s,u,l=new Map){if(i==null)return l;for(let c of Object.keys(a)){let d=a[c],f=this._fieldIds[c],p=i.get(f);if(p==null)continue;let m=p.size,h=this._avgFieldLength[f];for(let y of p.keys()){if(!this._documentIds.has(y)){this.removeTerm(f,y,r),m-=1;continue}let g=s?s(this._documentIds.get(y),r,this._storedFields.get(y)):1;if(!g)continue;let b=p.get(y),_=this._fieldLength.get(y)[f],w=tmo(b,m,this._documentCount,_,h,u),T=n*o*d*g*w,O=l.get(y);if(O){O.score+=T,omo(O.terms,e);let E=hst(O.match,r);E?E.push(c):O.match[r]=[c]}else l.set(y,{score:T,terms:[e],match:{[r]:[c]}})}}return l}addTerm(e,r,n){let o=this._index.fetch(n,yvr),i=o.get(e);if(i==null)i=new Map,i.set(r,1),o.set(e,i);else{let a=i.get(r);i.set(r,(a||0)+1)}}removeTerm(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}let o=this._index.fetch(n,yvr),i=o.get(e);i==null||i.get(r)==null?this.warnDocumentChanged(r,e,n):i.get(r)<=1?i.size<=1?o.delete(e):i.delete(r):i.set(r,i.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,r,n){for(let o of Object.keys(this._fieldIds))if(this._fieldIds[o]===r){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${o}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){let r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r}addFields(e){for(let r=0;r<e.length;r++)this._fieldIds[e[r]]=r}addFieldLength(e,r,n,o){let i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[r]=o;let s=(this._avgFieldLength[r]||0)*n+o;this._avgFieldLength[r]=s/(n+1)}removeFieldLength(e,r,n,o){if(n===1){this._avgFieldLength[r]=0;return}let i=this._avgFieldLength[r]*n-o;this._avgFieldLength[r]=i/(n-1)}saveStoredFields(e,r){let{storeFields:n,extractField:o}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i==null&&this._storedFields.set(e,i={});for(let a of n){let s=o(r,a);s!==void 0&&(i[a]=s)}}};jae.wildcard=Symbol("*");hst=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,Qpo={[Sst]:(t,e)=>{for(let r of e.keys()){let n=t.get(r);if(n==null)t.set(r,e.get(r));else{let{score:o,terms:i,match:a}=e.get(r);n.score=n.score+o,n.match=Object.assign(n.match,a),hvr(n.terms,i)}}return t},[Cvr]:(t,e)=>{let r=new Map;for(let n of e.keys()){let o=t.get(n);if(o==null)continue;let{score:i,terms:a,match:s}=e.get(n);hvr(o.terms,a),r.set(n,{score:o.score+i,terms:o.terms,match:Object.assign(o.match,s)})}return r},[Ypo]:(t,e)=>{for(let r of e.keys())t.delete(r);return t}},emo={k:1.2,b:.7,d:.5},tmo=(t,e,r,n,o,i)=>{let{k:a,b:s,d:u}=i;return Math.log(1+(r-e+.5)/(e+.5))*(u+t*(a+1)/(t+a*(1-s+s*n/o)))},rmo=t=>(e,r,n)=>{let o=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,i=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0,a=typeof t.boostTerm=="function"?t.boostTerm(e,r,n):1;return{term:e,fuzzy:o,prefix:i,termBoost:a}},gst={idField:"id",extractField:(t,e)=>t[e],stringifyField:(t,e)=>t.toString(),tokenize:t=>t.split(imo),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},mvr={combineWith:Sst,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:emo},nmo={combineWith:Cvr,prefix:(t,e,r)=>e===r.length-1},_st={batchSize:1e3,batchWait:10},vst={minDirtFactor:.1,minDirtCount:20},yst={..._st,...vst},omo=(t,e)=>{t.includes(e)||t.push(e)},hvr=(t,e)=>{for(let r of e)t.includes(r)||t.push(r)},gvr=({score:t},{score:e})=>e-t,yvr=()=>new Map,iPe=t=>{let e=new Map;for(let r of Object.keys(t))e.set(parseInt(r,10),t[r]);return e},aPe=async t=>{let e=new Map,r=0;for(let n of Object.keys(t))e.set(parseInt(n,10),t[n]),++r%1e3===0&&await xvr(0);return e},xvr=t=>new Promise(e=>setTimeout(e,t)),imo=/[\n\r\p{Z}\p{P}]+/u});var m9,uPe,Ovr=v(()=>{Xe();Ye();m9=class m9{constructor(){this.bytesUsed=0;let e=te(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*m9.MB_TO_BYTES,this.candidateLimit=Math.min(m9.DEFAULT_CANDIDATE_LIMIT,Math.floor(r*5))}getMaxBytes(){return this.maxBytes}getCandidateLimit(){return this.candidateLimit}getBytesUsed(){return this.bytesUsed}canAddContent(e){return this.bytesUsed+e<=this.maxBytes}addBytes(e){this.bytesUsed+=e}reset(){let e=this.bytesUsed;this.bytesUsed=0,F(`MemoryManager: Reset memory tracking (was using ${e} bytes, max: ${this.maxBytes} bytes)`)}getUsagePercent(){return Math.round(this.bytesUsed/this.maxBytes*100)}static getByteSize(e){return new TextEncoder().encode(e).length}};m9.DEFAULT_CANDIDATE_LIMIT=500,m9.MB_TO_BYTES=1024*1024;uPe=m9});var cPe,Hc,lPe,Evr=v(()=>{Xe();mr();Tvr();cPe=require("obsidian");Oae();Ovr();Hc=class Hc{constructor(e,r){this.app=e;this.index=null;this.indexedChunks=new Set;this.memoryManager=new uPe,this.chunkManager=r||Sq(e)}createIndex(){return new jae({fields:["title","heading","path","tags","body"],storeFields:["id","notePath","title","heading","chunkIndex"],tokenize:this.tokenizeMixed.bind(this),searchOptions:{boost:{title:Hc.FIELD_WEIGHTS.title,heading:Hc.FIELD_WEIGHTS.heading,path:Hc.FIELD_WEIGHTS.path,tags:Hc.FIELD_WEIGHTS.tags,body:Hc.FIELD_WEIGHTS.body},prefix:!0,fuzzy:!1,combineWith:"OR"}})}tokenizeMixed(e){if(!e)return[];let r=new Set,n=e.toLowerCase(),o=n,i=null;try{i=n.match(/#[\p{L}\p{N}_/-]+/gu)}catch{i=n.match(/#[a-z0-9_/-]+/g)}if(i)for(let l of i){r.add(l);let c=l.slice(1);if(!c)continue;r.add(c);let d=c.split("/").filter(p=>p.length>0);if(d.length>0){let p="";for(let m of d)p=p?`${p}/${m}`:m,r.add(p),r.add(`#${p}`),r.add(m)}let f=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=o.replace(new RegExp(f,"gu")," ")}(o.match(/[a-z0-9_]+/g)||[]).forEach(l=>r.add(l));let s=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g,u=e.match(s)||[];for(let l of u){l.length===1&&r.add(l);for(let c=0;c<l.length-1;c++)r.add(l.slice(c,c+2))}return Array.from(r)}async buildFromCandidates(e){F(`FullTextEngine: [CHUNKS] Starting with ${e.length} candidate notes`),this.indexedChunks.clear(),this.memoryManager.reset(),await new Promise(l=>setTimeout(l,0));let r=Date.now();this.index=this.createIndex();let n=Date.now()-r;F(`FullTextEngine: MiniSearch index created in ${n}ms`);let o={maxChars:wye,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Hc.CHUNK_MEMORY_PERCENTAGE},i=await this.chunkManager.getChunks(e,o);if(i.length===0)return F("FullTextEngine: No chunks generated"),0;F(`FullTextEngine: Generated ${i.length} chunks from ${e.length} notes`);let a=0,s=Hc.BATCH_SIZE,u=new Map;for(let l=0;l<i.length;l++){let c=i[l],d=Buffer.byteLength(c.content,"utf8");if(!this.memoryManager.canAddContent(d)){F(`FullTextEngine: Memory limit reached at ${a} chunks`);break}let f=c.notePath.replace(/\.md$/,"").split("/").join(" "),p=u.get(c.notePath);if(!p){let h=this.app.vault.getAbstractFileByPath(c.notePath);if(h instanceof cPe.TFile){let y=this.app.metadataCache.getFileCache(h),g=y?.frontmatter??{},b=y?(0,cPe.getAllTags)(y)??[]:[],_=this.extractFrontmatterTags(g),w=this.normalizeTagList([...b,..._]),T=this.app.metadataCache.resolvedLinks[h.path]??{},O=this.app.metadataCache.getBacklinksForFile(h)?.data??{},E=Object.keys(T),P=Object.keys(O),R=[...E,...P],I=this.extractPropertyValues(g);p={tags:w,links:R,props:I},u.set(c.notePath,p)}else p={tags:[],links:[],props:[]}}let m=[c.content,...p.props].join(" ");this.index.add({id:c.id,title:c.title,heading:c.heading,path:f,body:m,tags:p.tags.join(" "),notePath:c.notePath,chunkIndex:c.chunkIndex}),this.memoryManager.addBytes(d),this.indexedChunks.add(c.id),a++,l>0&&l%s===0&&await new Promise(h=>setTimeout(h,0))}return F(`FullTextEngine: [CHUNKS] Indexed ${a}/${i.length} chunks (${this.memoryManager.getUsagePercent()}% memory)`),a}extractPropertyValues(e){let r=[];if(e&&typeof e=="object")for(let n of Object.values(e))this.extractPrimitiveValues(n,r,Hc.MAX_EXTRACTION_DEPTH);return r}extractFrontmatterTags(e){if(!e||typeof e!="object")return[];let r=[],n=["tags","tag"],o=i=>{let a=i.trim();a.length>0&&r.push(a)};for(let i of n){let a=e[i];if(a)if(Array.isArray(a))for(let s of a)typeof s=="string"&&o(s);else typeof a=="string"&&a.split(/[,\s]+/g).map(s=>s.trim()).filter(s=>s.length>0).forEach(o)}return r}normalizeTagList(e){let r=new Set;for(let n of e){if(typeof n!="string")continue;let o=n.trim();if(o.length===0)continue;let i=o.replace(/^#+/,"");if(i.length===0)continue;let a=i.toLowerCase();r.add(`#${a}`),r.add(a);let s=a.split("/").filter(u=>u.length>0);if(s.length>1){let u="";for(let l of s)u=u?`${u}/${l}`:l,r.add(`#${u}`),r.add(u),r.add(l)}else s.length===1&&(r.add(`#${s[0]}`),r.add(s[0]))}return Array.from(r)}extractPrimitiveValues(e,r,n){if(!(n<=0||e==null))if(typeof e=="string"){let o=e.trim();o&&r.push(o)}else typeof e=="number"||typeof e=="boolean"?r.push(String(e)):e instanceof Date?r.push(e.toISOString()):Array.isArray(e)&&e.slice(0,Hc.MAX_ARRAY_ITEMS).forEach(o=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){let i=typeof o=="string"?o.trim():String(o);i&&r.push(i)}})}search(e,r=30,n=[],o){if(!this.index)return[];let i=n.length>0?n.join(" "):o||e[0]||"";if(!i.trim())return[];let a={boost:{title:Hc.FIELD_WEIGHTS.title,heading:Hc.FIELD_WEIGHTS.heading,path:Hc.FIELD_WEIGHTS.path,tags:Hc.FIELD_WEIGHTS.tags,body:Hc.FIELD_WEIGHTS.body},prefix:!0,fuzzy:!1,combineWith:"OR"};try{let s=this.index.search(i,a);return F(`FullText: Search found ${s.length} results for "${i.substring(0,50)}..."`),s.slice(0,r).map(u=>({id:u.id,score:u.score,engine:"fulltext",explanation:{lexicalMatches:this.extractLexicalMatches(u),baseScore:u.score,finalScore:u.score}}))}catch(s){return Te(`FullText: Search failed for "${i}": ${s}`),[]}}extractLexicalMatches(e){let r=[];if(e.match)for(let[n,o]of Object.entries(e.match))for(let i of o)r.push({field:n,query:i,weight:this.getFieldWeight(n)});return r}getFieldWeight(e){return Hc.FIELD_WEIGHTS[e]||1}clear(){try{this.index=null,this.indexedChunks.clear(),this.memoryManager.reset(),F("FullTextEngine: Cleanup completed successfully")}catch(e){Te(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Hc.BATCH_SIZE=10,Hc.CHUNK_MEMORY_PERCENTAGE=.35,Hc.MAX_ARRAY_ITEMS=10,Hc.MAX_EXTRACTION_DEPTH=2,Hc.FIELD_WEIGHTS={title:5,heading:2.5,headings:1.5,path:1.5,tags:4,props:1.5,links:1.5,body:1};lPe=Hc});function h9(t){if(!t)return[];let e=null;try{e=t.match(/#[\p{L}\p{N}_/-]+/gu)}catch{e=t.match(/#[a-zA-Z0-9_/-]+/g)}if(!e)return[];let r=new Set;for(let n of e){let o=n.trim();o.length<=1||r.add(o.toLowerCase())}return Array.from(r)}var Cst=v(()=>{});var dPe,g9,xst=v(()=>{mr();lw();Xe();Cst();Bt();dPe=class dPe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??Cye,cacheSize:e.cacheSize??100,minTermLength:2}}async expand(e){if(!e?.trim())return{queries:[],salientTerms:[],originalQuery:"",expandedQueries:[]};let r=this.cache.get(e);if(r)return this.cache.delete(e),this.cache.set(e,r),F(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return Te(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await N1t(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof Cte)return F(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return F("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return F("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=dPe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await Vb(async()=>await n.invoke(o,r?{signal:r}:void 0));if(!i)return this.fallbackExpansion(e);let a=this.extractContent(i);if(!a)return this.fallbackExpansion(e);let s=this.parseXMLResponse(a,e);return F(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ne("QueryExpander: LLM expansion failed:",n),this.fallbackExpansion(e)}}extractContent(e){return typeof e=="string"?e:String(e?.content??e?.text??"").trim()||null}extractSalientTermsFromOriginal(e){let r=this.extractTermsFromQueries([e]),n=h9(e);return this.combineBaseAndTagTerms(r,n,e)}parseXMLResponse(e,r){let n=[r],o=new Set,i=/<query>(.*?)<\/query>/g,a;for(;(a=i.exec(e))!==null;){let f=a[1]?.trim();f&&f!==r&&n.length<=this.config.maxVariants&&n.push(f)}let s=e.match(/<salient>([\s\S]*?)<\/salient>/);if(s){let f=/<term>(.*?)<\/term>/g,p;for(;(p=f.exec(s[1]))!==null;){let m=p[1]?.trim().toLowerCase();m&&this.isValidTerm(m)&&o.add(m)}}if(!(n.length>1||o.size>0||/<term>/.test(e)))return this.fallbackExpansion(r);let l=h9(r),c=o.size>0?Array.from(new Set([...o,...l])):this.extractSalientTermsFromOriginal(r),d=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:c,originalQuery:r,expandedQueries:d.slice(0,this.config.maxVariants)}}fallbackExpansion(e){let r=this.extractTermsFromQueries([e]),n=h9(e),o=this.combineBaseAndTagTerms(r,n,e);return{queries:[e],salientTerms:o,originalQuery:e,expandedQueries:[]}}extractTermsFromQueries(e){let r=new Set;for(let n of e){let o=n.toLowerCase().replace(/[^\w\s-]/g," ").split(/\s+/);for(let i of o)this.isValidTerm(i)&&(r.add(i),i.includes("-")&&i.split("-").forEach(a=>{this.isValidTerm(a)&&r.add(a)}))}return Array.from(r)}isValidTerm(e){if(e.length<this.config.minTermLength)return!1;if(e.startsWith("#"))try{return/^#[\p{L}\p{N}_/-]+$/u.test(e)}catch{return/^#[A-Za-z0-9_/-]+$/.test(e)}try{return/^[\p{L}\p{N}_-]+$/u.test(e)}catch{return/^[A-Za-z0-9_-]+$/.test(e)}}combineBaseAndTagTerms(e,r,n){let o=new Set([...e,...r]);if(r.length===0)return Array.from(o);let i=this.collectStandaloneTerms(n);for(let a of r){let s=a.slice(1);s.length>0&&!i.has(s)&&o.delete(s)}return Array.from(o)}collectStandaloneTerms(e){let r=new Set;if(!e)return r;let n=e.toLowerCase(),o=this.findTagRanges(n),i=[/[\p{L}\p{N}_-]+/gu,/[a-z0-9_-]+/g];for(let a of i)try{for(let s of n.matchAll(a)){if(s.index===void 0)continue;let u=s.index,l=u+s[0].length;if(o.some(({start:f,end:p})=>u>=f&&l<=p))continue;let d=s[0];this.isValidTerm(d)&&!d.startsWith("#")&&(r.add(d),d.includes("-")&&d.split("-").forEach(f=>{this.isValidTerm(f)&&!f.startsWith("#")&&r.add(f)}))}break}catch{continue}return r}findTagRanges(e){let r=[],n=[/#[\p{L}\p{N}_/-]+/gu,/#[a-z0-9_/-]+/g];for(let o of n)try{for(let i of e.matchAll(o))i.index!==void 0&&r.push({start:i.index,end:i.index+i[0].length});break}catch{continue}return r}cacheResult(e,r){if(this.cache.size>=this.config.cacheSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(e,r)}clearCache(){this.cache.clear(),F("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}};dPe.PROMPT_TEMPLATE=`Analyze this search query and provide:
|
||
1. SALIENT TERMS from the original query (for ranking)
|
||
2. Alternative queries and related terms (for finding more results)
|
||
|
||
Query: "{query}"
|
||
|
||
Instructions:
|
||
|
||
SALIENT TERMS (for ranking - ONLY from original query):
|
||
- Extract meaningful words FROM THE ORIGINAL QUERY ONLY
|
||
- Include: nouns, proper nouns, technical terms, domain concepts
|
||
- Exclude: action verbs (find, search, get), pronouns (my, your), articles (the, a), prepositions (in, on, for), conjunctions (and, or)
|
||
- These terms determine search ranking - must be from original query
|
||
|
||
ALTERNATIVE QUERIES (for recall - specific alternative phrasings):
|
||
- Alternative phrasings of the query (specific enough to be useful for search)
|
||
|
||
Example: "find my piano notes"
|
||
- Salient (from original): piano, notes
|
||
- Queries: "piano lesson notes", "piano practice sheets"
|
||
|
||
Example: "\u67E5\u627E\u6211\u7684\u5B66\u4E60\u7B14\u8BB0"
|
||
- Salient (from original): \u5B66\u4E60, \u7B14\u8BB0
|
||
- Queries: "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"
|
||
|
||
Format:
|
||
<salient>
|
||
<term>word_from_original_query</term>
|
||
</salient>
|
||
<queries>
|
||
<query>alternative query</query>
|
||
</queries>`;g9=dPe});var y9,fPe,Pvr=v(()=>{Xe();ob();y9=class y9{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=el(),a=this.app.vault.getMarkdownFiles().filter(h=>Hs(h,n,o)),s=y9.CONFIG.BATCH_SIZE,u=e.map(h=>h.toLowerCase()).filter(h=>this.isGrepWorthy(h)),l=[],c=y9.CONFIG.YIELD_INTERVAL;for(let h=0;h<a.length;h++){let y=a[h],g=y.path.toLowerCase(),b=0;for(let _ of u)g.includes(_)&&b++;b>0&&l.push({path:y.path,matchCount:b}),h>0&&h%c===0&&await new Promise(_=>setTimeout(_,0))}l.sort((h,y)=>y.matchCount-h.matchCount);let d=new Set(l.map(h=>h.path)),f=Math.max(0,r-d.size),p=new Set;if(f>0)for(let h=0;h<a.length&&p.size<f;h+=s){let y=a.slice(h,h+s);await Promise.all(y.map(async g=>{if(!(p.size>=f)&&!d.has(g.path))try{let _=(await this.app.vault.cachedRead(g)).toLowerCase();for(let w of u)if(_.includes(w)){p.add(g.path);break}}catch(b){F(`GrepScanner: Skipping file ${g.path}: ${b}`)}})),h%y9.CONFIG.YIELD_INTERVAL===0&&await new Promise(g=>setTimeout(g,0))}let m=[...d,...p].slice(0,r);if(m.length>0){let h=Math.min(d.size,r),y=m.length-h;F(` Grep: ${m.length} files match (${h} path, ${y} content) [${e.slice(0,3).join(", ")}${e.length>3?"...":""}]`)}return m}async grep(e,r=200){return this.batchCachedReadGrep([e],r)}isGrepWorthy(e){return!(!e||e.length<=1)}async fileContainsAny(e,r){try{let n=e.path.toLowerCase(),o=0;for(let s of r)n.includes(s.toLowerCase())&&o++;if(o>0)return!0;let a=(await this.app.vault.cachedRead(e)).toLowerCase();return r.some(s=>a.includes(s.toLowerCase()))}catch{return!1}}};y9.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};fPe=y9});function Bx(t){let e=t.lastIndexOf("#");return e===-1?t:t.substring(0,e)}var pPe=v(()=>{});var amo,mPe,Mvr=v(()=>{Xe();pPe();amo={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},mPe=class{constructor(e){this.config=amo;this.app=e||null}setConfig(e){this.config={...this.config,...e}}applyBoosts(e){if(!this.config.enabled||e.length===0)return e;let r=this.calculateFolderStats(e);return this.logBoostedFolders(r),e.map(n=>{let o=Bx(n.id),i=this.extractFolder(o),a=r.get(i);if(a){let s=n.score*a.boostFactor;return{...n,score:s,explanation:n.explanation?{...n.explanation,folderBoost:{folder:a.folderPath,documentCount:a.documentCount,totalDocsInFolder:a.totalDocsInFolder,relevanceRatio:a.relevanceRatio,boostFactor:a.boostFactor},finalScore:s}:void 0}}return n})}calculateFolderStats(e){let r=new Map;for(let a of e){let s=Bx(a.id),u=this.extractFolder(s);r.has(u)||r.set(u,new Set),r.get(u).add(s)}let n=new Map;for(let[a,s]of r.entries())n.set(a,s.size);let o=this.getTotalDocsPerFolder(),i=new Map;for(let[a,s]of n.entries()){let u=o.get(a)||s,l=s/u;if(s>=this.config.minDocsForBoost&&l>=this.config.minRelevanceRatio){let d=1+(1+Math.log2(s+1)-1)*Math.sqrt(l),f=Math.min(d,this.config.maxBoostFactor);i.set(a,{folderPath:a,documentCount:s,totalDocsInFolder:u,relevanceRatio:l,boostFactor:f})}}return i}getTotalDocsPerFolder(){let e=new Map;if(!this.app)return e;let r=this.app.vault.getMarkdownFiles();for(let n of r){let o=this.extractFolder(n.path);e.set(o,(e.get(o)||0)+1)}return e}extractFolder(e){return e.substring(0,e.lastIndexOf("/"))||""}logBoostedFolders(e){let r=Array.from(e.values()).sort((n,o)=>o.relevanceRatio-n.relevanceRatio);r.length>0&&(F(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);F(` ${n.folderPath||"(root)"}: ${n.documentCount}/${n.totalDocsInFolder} docs (${o}% relevant, ${n.boostFactor.toFixed(2)}x boost)`)}))}getFolderBoosts(e){return this.config.enabled?this.calculateFolderStats(e):new Map}}});var smo,hPe,Rvr=v(()=>{Xe();pPe();smo={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},hPe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...smo,...r}}applyBoost(e){if(!this.config.enabled||e.length===0)return e;let r=this.filterCandidates(e);if(r.length<2)return e;let n=new Set(r.map(s=>Bx(s.id))),o=new Map;for(let s of n){let u=this.calculateConnections(s,n);o.set(s,u)}let i=e.map(s=>{let u=Bx(s.id),l=o.get(u);return!l||l.boostMultiplier===1?s:{...s,score:s.score*l.boostMultiplier,explanation:s.explanation?{...s.explanation,graphConnections:{backlinks:l.backlinks.length,coCitations:l.coCitations.length,sharedTags:l.sharedTags.length,score:l.connectionScore,boostMultiplier:l.boostMultiplier}}:void 0}}),a=i.filter(s=>{let u=Bx(s.id),l=o.get(u);return l&&l.boostMultiplier>1});return a.length>0&&F(`GraphBoostCalculator: Boosted ${a.length} notes based on connections`),i}calculateConnections(e,r){let n=this.findBacklinks(e,r),o=this.findCoCitations(e,r),i=this.findSharedTags(e,r),a=n.length*this.config.backlinkWeight+o.length*this.config.coCitationWeight+i.length*this.config.sharedTagWeight,s=1;return a>0&&(s=1+this.config.boostStrength*Math.log(1+a),s=Math.min(s,this.config.maxBoostMultiplier)),{backlinks:n,coCitations:o,sharedTags:i,connectionScore:a,boostMultiplier:s}}resolveFile(e){let r=this.metadataCache.getFirstLinkpathDest(e,"");return r&&typeof r=="object"&&"path"in r?r:null}findBacklinks(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getBacklinksForFile(o);if(!i)return n;for(let[a]of i.data)r.has(a)&&a!==e&&n.push(a);return n}findCoCitations(e,r){let n=[],o=new Set,i=this.resolveFile(e);if(!i)return n;let a=this.metadataCache.getBacklinksForFile(i);if(!a)return n;for(let[s]of a.data)o.add(s);if(o.size===0)return n;for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getBacklinksForFile(u);if(l){for(let[c]of l.data)if(o.has(c)){n.push(s);break}}}return n}findSharedTags(e,r){let n=[],o=this.resolveFile(e);if(!o)return n;let i=this.metadataCache.getFileCache(o);if(!i||!i.tags||i.tags.length===0)return n;let a=new Set(i.tags.map(s=>s.tag));for(let s of r){if(s===e)continue;let u=this.resolveFile(s);if(!u)continue;let l=this.metadataCache.getFileCache(u);if(!l||!l.tags)continue;l.tags.some(d=>a.has(d.tag))&&n.push(s)}return n}filterCandidates(e){let r=new Map;for(let i of e){let a=Bx(i.id);r.has(a)||r.set(a,i)}let n=Array.from(r.values()),o=n.length;return n=n.slice(0,this.config.maxCandidates),o>this.config.maxCandidates&&F(`GraphBoost: Limited to top ${this.config.maxCandidates} note candidates (from ${o} unique notes)`),n}setConfig(e){this.config={...this.config,...e}}}});function Ivr(t,e={}){let r={...umo,...e};if(t.length===0)return{results:[],cutoffScore:null,uniqueNotes:0,totalBefore:0};let n=[...t].sort((l,c)=>c.score-l.score),o=n[0].score,i=Math.max(o*r.relativeThreshold,r.absoluteMinScore),a;r.ensureDiversity?a=cmo(n,i,r):a=lmo(n,i,r);let s=new Set(a.map(l=>Bx(l.id))).size,u=a.length<n.length?i:null;return F(`AdaptiveCutoff: ${a.length}/${n.length} results kept (${s} unique notes, threshold=${i.toFixed(3)})`),{results:a,cutoffScore:u,uniqueNotes:s,totalBefore:n.length}}function lmo(t,e,r){let n=[];for(let o of t){if(n.length>=r.ceiling||n.length>=r.floor&&o.score<e)break;n.push(o)}return n}function cmo(t,e,r){let n=[],o=new Set,i=[];for(let a of t){let s=Bx(a.id);if(!o.has(s)&&(n.length<r.floor||a.score>=e)){if(o.add(s),n.push(a),n.length>=r.ceiling)break;continue}i.push(a)}if(n.length<r.ceiling)for(let a of i){if(n.length>=r.ceiling||a.score<e&&n.length>=r.floor)break;n.push(a)}return n.sort((a,s)=>s.score-a.score),n}var umo,Avr=v(()=>{Xe();pPe();umo={floor:3,ceiling:30,relativeThreshold:.3,absoluteMinScore:.01,ensureDiversity:!0}});var gPe,Nvr=v(()=>{gPe=class{constructor(e={}){this.config={method:"zscore-tanh",tanhScale:2.5,clipMin:.02,clipMax:.98};this.config={...this.config,...e}}updateExplanation(e,r,n){if(e)return{...e,baseScore:r,finalScore:n}}normalize(e){if(e.length===0)return e;switch(this.config.method){case"zscore-tanh":return this.normalizeZScoreTanh(e);case"minmax":return this.normalizeMinMax(e);case"percentile":return this.normalizePercentile(e);default:return e}}normalizeZScoreTanh(e){let r=e.map(l=>l.score),n=r.reduce((l,c)=>l+c,0)/r.length,o=r.reduce((l,c)=>l+Math.pow(c-n,2),0)/r.length,i=Math.sqrt(o);if(i===0)return e.map(l=>({...l,score:.5,explanation:this.updateExplanation(l.explanation,l.score,.5)}));let a=this.config.tanhScale||2.5,s=this.config.clipMin||.02,u=this.config.clipMax||.98;return e.map(l=>{let c=(l.score-n)/i,d=.5+.5*Math.tanh(c/a),f=Math.max(s,Math.min(u,d));return{...l,score:f,explanation:this.updateExplanation(l.explanation,l.score,f)}})}normalizeMinMax(e){let r=e.map(u=>u.score),n=Math.min(...r),o=Math.max(...r);if(o===n)return e.map(u=>({...u,score:.5,explanation:this.updateExplanation(u.explanation,u.score,.5)}));let i=this.config.clipMin||.02,a=this.config.clipMax||.98;return e.map(u=>{let l=(u.score-n)/(o-n),c=i+l*(a-i);return{...u,score:c,explanation:this.updateExplanation(u.explanation,u.score,c)}})}normalizePercentile(e){let r=e.length,n=this.config.clipMin||.02,o=this.config.clipMax||.98,i=[...e].sort((s,u)=>s.score-u.score),a=new Map;return i.forEach((s,u)=>{let l=u/(r-1),c=n+l*(o-n);a.set(s.id,c)}),e.map(s=>{let u=a.get(s.id)||.5;return{...s,score:u,explanation:this.updateExplanation(s.explanation,s.score,u)}})}getStatistics(e){if(e.length===0)return{mean:0,std:0,min:0,max:0,median:0};let r=e.map(c=>c.score),n=[...r].sort((c,d)=>c-d),o=r.reduce((c,d)=>c+d,0)/r.length,i=r.reduce((c,d)=>c+Math.pow(d-o,2),0)/r.length,a=Math.sqrt(i),s=n[0],u=n[n.length-1],l=n[Math.floor(n.length/2)];return{mean:o,std:a,min:s,max:u,median:l}}}});function dmo(t,e){return t.length<=e?t:Ivr(t,{floor:0,ceiling:e,relativeThreshold:0,absoluteMinScore:0,ensureDiversity:!0}).results}var Tst,ec,yPe,wH=v(()=>{mr();Xe();Oae();Evr();xst();Pvr();Mvr();Rvr();Avr();Nvr();Tst=3,ec=100,yPe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new fPe(e),this.chunkManager=Sq(e),this.fullTextEngine=new lPe(e,this.chunkManager),this.queryExpander=new g9({getChatModel:this.getChatModel,maxVariants:3,timeout:Cye}),this.folderBoostCalculator=new mPe(e),this.graphBoostCalculator=new hPe(e,{enabled:!0,maxCandidates:20,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new gPe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){let n={queries:[],salientTerms:[],originalQuery:e||"",expandedQueries:[]};if(!e||typeof e!="string")return Te("SearchCore: Invalid query provided"),{results:[],queryExpansion:n};let o=e.trim();if(o.length===0)return Te("SearchCore: Empty query provided"),{results:[],queryExpansion:n};o.length>1e3?(Te("SearchCore: Query too long, truncating"),e=o.substring(0,1e3)):e=o;let i=!!r.returnAll,a=i?ec:Math.min(Math.max(1,r.maxResults||30),100),s=i?ec:Math.min(Math.max(10,r.candidateLimit||200),1e3),u=!!(r.enableLexicalBoosts??!0);try{F(`SearchCore: Searching for "${e}"`);let l;r.preExpandedQuery?(F("SearchCore: Using pre-expanded query data (skipping QueryExpander)"),l={queries:r.preExpandedQuery.queries||[e],salientTerms:r.preExpandedQuery.salientTerms||[],originalQuery:r.preExpandedQuery.originalQuery||e,expandedQueries:r.preExpandedQuery.expandedQueries||[]}):l=await this.queryExpander.expand(e);let c=l.queries,d=r.salientTerms?[...new Set([...l.salientTerms,...r.salientTerms])]:l.salientTerms,f=[],p=new Set,m=w=>{if(!w)return;let T=w.toLowerCase();T.length===0||p.has(T)||(p.add(T),f.push(T))};c.forEach(m),d.forEach(m),(c.length>1||d.length>0)&&F(`Query expansion: variants=${JSON.stringify(c)}, salient=${JSON.stringify(d)}`);let h=i?ec:200,y=await this.grepScanner.batchCachedReadGrep(f,h),g=y.slice(0,s);F(`SearchCore: ${g.length} candidates (from ${y.length} grep hits)`);let _=await this.executeLexicalSearch(g,f,d,a,l.originalQuery,i);if(u&&(_=this.folderBoostCalculator.applyBoosts(_),_=this.graphBoostCalculator.applyBoost(_)),_=this.scoreNormalizer.normalize(_),this.fullTextEngine.clear(),_.length>a&&(_=dmo(_,a)),_.length>0){let w=this.app.vault.getAbstractFileByPath(_[0].id);F(`SearchCore: ${_.length} results found (top: ${w?.name||_[0].id})`)}else F("SearchCore: No results found");return{results:_,queryExpansion:l}}catch(l){ne("SearchCore: Retrieval failed",l);try{return{results:await this.fallbackSearch(e,a),queryExpansion:n}}catch(c){return ne("SearchCore: Fallback search also failed",c),{results:[],queryExpansion:n}}}}async fallbackSearch(e,r){try{return(await this.grepScanner.grep(e,r)).map((o,i)=>({id:o,score:1/(i+1),engine:"grep"}))}catch(n){return ne("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),F("SearchCore: Cleared all caches")}async executeLexicalSearch(e,r,n,o,i,a=!1){try{let s=Date.now(),u=await this.fullTextEngine.buildFromCandidates(e),l=Date.now()-s,c=Date.now(),d=a?ec:Number.isFinite(o)?Math.min(o,1e3):e.length||30,f=a?ec*Tst:Math.max(d*Tst,Tst),p=this.fullTextEngine.search(r,f,n,i),m=Date.now()-c;return F(`Full-text: ${u} docs indexed (${l}ms), ${p.length} results (${m}ms)`),p}catch(s){return ne("Full-text search failed",s),[]}}}});var Ost={};En(Ost,{HybridRetriever:()=>$ae});var $ae,_Pe=v(()=>{mA();sH();Xe();Pl();Ye();Bt();ND();f9();YOe();$ae=class extends Ux{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"]}async getRelevantDocuments(r){return Vb(async()=>{let n=kS(r,app.vault),o=n.map(p=>p.basename),i=[...new Set([...this.options.salientTerms,...o])],a=await this.getExplicitChunks(n),s=await this.getOramaChunks(r,i,this.options.textWeight),u=this.filterAndFormatChunks(s,a),l=u;if(u.length===0)return te().debug&&console.log("No chunks found for query:",r),l;let c=u.reduce((p,m)=>{let h=m.metadata.score;return typeof h=="number"&&!isNaN(h)?Math.max(p,h):p},0),d=u.every(p=>typeof p.metadata.score!="number"||isNaN(p.metadata.score)),f=this.options.useRerankerThreshold&&(c<this.options.useRerankerThreshold||d);return f&&(l=(await Ql.getInstance().rerank(r,u.map(m=>m.pageContent.slice(0,3e3)))).response.data.map(m=>({...u[m.index],metadata:{...u[m.index].metadata,rerank_score:m.relevance_score}}))),te().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),console.log(`
|
||
Explicit Chunks: `,a),console.log("Orama Chunks: ",s),console.log("Combined Chunks: ",u),console.log("Max Orama Score: ",c),f?console.log("Reranked Chunks: ",l):console.log("No reranking applied.")),l})}async getExplicitChunks(r){let n=[];for(let o of r){let i=await O0.getInstance().getDocumentsByPath(o.path);if(i.length===0)continue;let a=i.map(s=>new tl({pageContent:s.content,metadata:{...s.metadata,score:1,path:s.path,mtime:s.mtime,ctime:s.ctime,title:s.title,id:s.id,embeddingModel:s.embeddingModel,tags:s.tags,extension:s.extension,created_at:s.created_at,nchars:s.nchars,chunkId:s.metadata?.chunkId}}));n.push(...a)}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 O0.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&&(te().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);F("Daily note date range:",d[0],d[d.length-1]);let f=kS(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(_=>({..._,metadata:{..._.metadata,includeInContext:!0}}));F("Modified time range:",l,c),s.where={mtime:{between:[l,c]}};let y=(await cv(a,s)).hits.map(_=>new tl({pageContent:_.document.content,metadata:{..._.document.metadata,score:_.score,path:_.document.path,mtime:_.document.mtime,ctime:_.document.ctime,title:_.document.title,id:_.document.id,embeddingModel:_.document.embeddingModel,tags:_.document.tags,extension:_.document.extension,created_at:_.document.created_at,nchars:_.document.nchars,chunkId:_.document.metadata?.chunkId}})),g=[...m,...y];return Array.from(new Set(g.map(_=>_.metadata.id))).map(_=>g.find(w=>w.metadata.id===_)).filter(_=>_!==void 0)}F(`Orama search params:
|
||
`,s);let u=await cv(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 tl({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,chunkId:l.document.metadata?.chunkId}}))).filter(l=>l!==null)}async convertQueryToVector(r){let o=await(await hd.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}}))}}});function Pst(t){let e=[];for(let r of t)r.type==="tool_use"&&e.push({name:r.name,args:r.input,id:r.id,type:"tool_call"});return e}var Est,Mst=v(()=>{uv();fO();Est=class extends v4{constructor(e){super(e);x(this,"lc_namespace",["langchain","anthropic","output_parsers"]);x(this,"returnId",!1);x(this,"keyName");x(this,"returnSingle",!1);x(this,"zodSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,this.zodSchema=e.zodSchema}static lc_name(){return"AnthropicToolsOutputParser"}async _validateResult(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch(o){throw new Ih(`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 tF(this.zodSchema,r);if(n.success)return n.data;throw new Ih(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(r,null,2))}async parseResult(e){let r=e.flatMap(i=>{let{message:a}=i;return Array.isArray(a.content)?Pst(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 Dvr(t){if(t)return t==="any"?{type:"any"}:t==="auto"?{type:"auto"}:t==="none"?{type:"none"}:typeof t=="string"?{type:"tool",name:t}:t}var jvr=v(()=>{});function $vr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Lvr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function Fvr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function kvr(t){return typeof t!="object"||t==null||!("type"in t)||t.type!=="image"||!("source"in t)||typeof t.source!="object"||t.source==null||!("type"in t.source)?!1:t.source.type==="base64"?!(!("media_type"in t.source)||typeof t.source.media_type!="string"||!("data"in t.source)||typeof t.source.data!="string"):t.source.type==="url"?!(!("url"in t.source)||typeof t.source.url!="string"):!1}var qvr,Uvr=v(()=>{ta();qvr={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=Cy({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},..."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},..."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}`)}}});var Bvr,zvr=v(()=>{Bvr=t=>t()});function fmo(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function pmo(t){function*e(){for(let r of t)fmo(r)&&(r.source==="char"?yield{type:"char_location",file_id:r.url??"",start_char_index:r.startIndex??0,end_char_index:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="page"?yield{type:"page_location",file_id:r.url??"",start_page_number:r.startIndex??0,end_page_number:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="block"?yield{type:"content_block_location",file_id:r.url??"",start_block_index:r.startIndex??0,end_block_index:r.endIndex??0,document_title:r.title??null,document_index:0,cited_text:r.citedText??""}:r.source==="url"?yield{type:"web_search_result_location",url:r.url??"",title:r.title??null,encrypted_index:String(r.startIndex??0),cited_text:r.citedText??""}:r.source==="search"&&(yield{type:"search_result_location",title:r.title??null,start_block_index:r.startIndex??0,end_block_index:r.endIndex??0,search_result_index:0,source:r.source??"",cited_text:r.citedText??""}))}return Array.from(e())}function Lae(t){return typeof t=="string"?t:mmo(t)}function mmo(t){let e=[];for(let r=0,{length:n}=t;r<n;r++)e.push(String.fromCharCode(t[r]));return btoa(e.join(""))}function Rst(t){return(t??"").split(";")[0].toLowerCase()}function Fae(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function b9(t,e){let r=Fae(e,"cache_control");r!==void 0&&(t.cache_control=r);let n=Fae(e,"citations");n!==void 0&&(t.citations=n);let o=Fae(e,"context");o!==void 0&&(t.context=o);let i=Fae(e,"title");return i!==void 0&&(t.title=i),t}function Ist(t,e){let r=Fae(e,"cache_control");return r!==void 0&&(t.cache_control=r),t}function Vvr(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function Hvr(t){let e=[],r=t.response_metadata,n="model_provider"in r&&r?.model_provider==="anthropic";for(let o of t.contentBlocks)if(o.type==="text")o.annotations?e.push({type:"text",text:o.text,citations:pmo(o.annotations)}):e.push({type:"text",text:o.text});else if(o.type==="tool_call")e.push({type:"tool_use",id:o.id??"",name:o.name,input:o.args});else if(o.type==="tool_call_chunk"){let i=Bvr(()=>{if(typeof o.args!="string")return o.args;try{return JSON.parse(o.args)}catch{return{}}});e.push({type:"tool_use",id:o.id??"",name:o.name??"",input:i})}else if(o.type==="reasoning"&&n)e.push({type:"thinking",thinking:o.reasoning,signature:String(o.signature)});else if(o.type==="server_tool_call"&&n)o.name==="web_search"?e.push({type:"server_tool_use",name:o.name,id:o.id??"",input:o.args}):o.name==="code_execution"&&e.push({type:"server_tool_use",name:o.name,id:o.id??"",input:o.args});else if(o.type==="server_tool_call_result"&&n)if(o.name==="web_search"&&Array.isArray(o.output.urls)){let i=o.output.urls.map(a=>({type:"web_search_result",title:"",encrypted_content:"",url:a}));e.push({type:"web_search_tool_result",tool_use_id:o.toolCallId??"",content:i})}else o.name==="code_execution"?e.push({type:"code_execution_tool_result",tool_use_id:o.toolCallId??"",content:o.output}):o.name==="mcp_tool_result"&&e.push({type:"mcp_tool_result",tool_use_id:o.toolCallId??"",content:o.output});else{if(o.type==="audio")throw new Error("Anthropic does not support audio content blocks.");if(o.type==="file"){let i=o.metadata;if(o.fileId){e.push(b9({type:"document",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){let a=Rst(o.mimeType);if(a==="application/pdf"||a===""){e.push(b9({type:"document",source:{type:"url",url:o.url}},i));continue}}if(o.data){let a=Rst(o.mimeType);if(a===""||a==="application/pdf")e.push(b9({type:"document",source:{type:"base64",data:Lae(o.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(b9({type:"document",source:{type:"text",data:Lae(o.data),media_type:"text/plain"}},i));else if(Vvr(a))e.push(b9({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:Lae(o.data),media_type:a}}]}},i));else throw new Error(`Unsupported file mime type for Anthropic base64 source: ${a}`);continue}throw new Error("File content block must include a fileId, url, or data property.")}else if(o.type==="image"){let i=o.metadata;if(o.fileId){e.push(Ist({type:"image",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){e.push(Ist({type:"image",source:{type:"url",url:o.url}},i));continue}if(o.data){let a=Rst(o.mimeType)||"image/png";Vvr(a)&&e.push(Ist({type:"image",source:{type:"base64",data:Lae(o.data),media_type:a}},i));continue}throw new Error("Image content block must include a fileId, url, or data property.")}else o.type==="video"||(o.type==="text-plain"?o.data&&e.push(b9({type:"document",source:{type:"text",data:Lae(o.data),media_type:"text/plain"}},o.metadata)):o.type==="non_standard"&&n&&e.push(o.value))}return e}var Wvr=v(()=>{zvr()});function Jvr(t){let e=Cy({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 hmo(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 qs({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new qs({content:[{type:"tool_result",...r.content!=null?{content:Ast(r)}:{},tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function Kvr(t){if(t.id===void 0)throw new Error('Anthropic requires all tool calls to have an "id".');return{type:"tool_use",id:t.id,name:t.name,input:t.args}}function*gmo(t){let e=["bash_code_execution_tool_result","input_json_delta","server_tool_use","text_editor_code_execution_tool_result","tool_result","tool_use","web_search_result","web_search_tool_result"],r=["text","text_delta"];for(let n of t){Ph(n)&&(yield GT(n,qvr));let o="cache_control"in n?n.cache_control:void 0;if(n.type==="image_url"){let i;typeof n.image_url=="string"?i=Jvr(n.image_url):typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url&&typeof n.image_url.url=="string"&&(i=Jvr(n.image_url.url)),i&&(yield{type:"image",source:i,...o?{cache_control:o}:{}})}else{if(kvr(n))return n;if(n.type==="document")yield{...n,...o?{cache_control:o}:{}};else if($vr(n))yield{type:"thinking",thinking:n.thinking,signature:n.signature,...o?{cache_control:o}:{}};else if(Lvr(n))yield{type:"redacted_thinking",data:n.data,...o?{cache_control:o}:{}};else if(Fvr(n))yield{type:"search_result",title:n.title,source:n.source,..."cache_control"in n&&n.cache_control?{cache_control:n.cache_control}:{},..."citations"in n&&n.citations?{citations:n.citations}:{},content:n.content};else if(r.find(i=>i===n.type)&&"text"in n)yield{type:"text",text:n.text,...o?{cache_control:o}:{},..."citations"in n&&n.citations?{citations:n.citations}:{}};else if(e.find(i=>i===n.type)){let i={...n};if("index"in i&&delete i.index,i.type==="input_json_delta"&&(i.type="tool_use"),"input"in i&&typeof i.input=="string")try{i.input=JSON.parse(i.input)}catch{i.input={}}yield{...i,...o?{cache_control:o}:{}}}else n.type==="container_upload"&&(yield{...n,...o?{cache_control:o}:{}})}}}function Ast(t){let{content:e}=t;return typeof e=="string"?e:Array.from(gmo(e))}function vPe(t){let e=hmo(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.type}" is not supported.`);if(kl(i)&&i.response_metadata?.output_version==="v1")return{role:a,content:Hvr(i)};if(kl(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(Kvr)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(Kvr)]};{let{content:s}=i;return!i.tool_calls.every(l=>s.find(c=>(c.type==="tool_use"||c.type==="input_json_delta"||c.type==="server_tool_use")&&c.id===l.id))&&console.warn('The "tool_calls" field on a message is only respected if content is a string.'),{role:a,content:Ast(i)}}}else return{role:a,content:Ast(i)}});return{messages:ymo(o),system:r}}function ymo(t){if(!t||t.length<=1)return t;let e=[],r=t[0],n=i=>typeof i=="string"?[{type:"text",text:i}]:i,o=i=>i.role!=="user"||typeof i.content=="string"?!1:Array.isArray(i.content)&&i.content.every(a=>a.type==="tool_result");for(let i=1;i<t.length;i+=1){let a=t[i];o(r)&&o(a)?r={...r,content:[...n(r.content),...n(a.content)]}:(e.push(r),r=a)}return e.push(r),e}var Nst=v(()=>{Uvr();Wvr();ta()});function Gvr(t,e){let r={model_provider:"anthropic"};if(t.type==="message_start"){let{content:n,usage:o,...i}=t.message,a={};for(let[d,f]of Object.entries(i))f!=null&&(a[d]=f);let{input_tokens:s,output_tokens:u,...l}=o??{},c={input_tokens:s,output_tokens:u,total_tokens:s+u,input_token_details:{cache_creation:l.cache_creation_input_tokens,cache_read:l.cache_read_input_tokens}};return{chunk:new Er({content:e.coerceContentToString?"":[],additional_kwargs:a,usage_metadata:e.streamUsage?c:void 0,response_metadata:{...r,usage:{...l}},id:t.message.id})}}else if(t.type==="message_delta"){let n={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}},o="context_management"in t.delta?{context_management:t.delta.context_management}:void 0;return{chunk:new Er({content:e.coerceContentToString?"":[],response_metadata:o,additional_kwargs:{...t.delta},usage_metadata:e.streamUsage?n:void 0})}}else if(t.type==="content_block_start"&&["tool_use","document","server_tool_use","web_search_tool_result"].includes(t.content_block.type)){let n=t.content_block,o;return n.type==="tool_use"?o=[{id:n.id,index:t.index,name:n.name,args:""}]:o=[],{chunk:new Er({content:e.coerceContentToString?"":[{index:t.index,...t.content_block,input:n.type==="server_tool_use"||n.type==="tool_use"?"":void 0}],response_metadata:r,additional_kwargs:{},tool_call_chunks:o})}}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 Er({content:t.delta.text})};{let n=t.delta;return"citation"in n&&(n.citations=[n.citation],delete n.citation),n.type==="thinking_delta"||n.type==="signature_delta"?{chunk:new Er({content:[{index:t.index,...n,type:"thinking"}],response_metadata:r})}:{chunk:new Er({content:[{index:t.index,...n,type:"text"}],response_metadata:r})}}}else{if(t.type==="content_block_delta"&&t.delta.type==="input_json_delta")return{chunk:new Er({content:e.coerceContentToString?"":[{index:t.index,input:t.delta.partial_json,type:t.delta.type}],response_metadata:r,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 n=t.content_block?.text;if(n!==void 0)return{chunk:new Er({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r,additional_kwargs:{}})}}else{if(t.type==="content_block_start"&&t.content_block.type==="redacted_thinking")return{chunk:new Er({content:e.coerceContentToString?"":[{index:t.index,...t.content_block}],response_metadata:r})};if(t.type==="content_block_start"&&t.content_block.type==="thinking"){let n=t.content_block.thinking;return{chunk:new Er({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r})}}}}return null}function Xvr(t,e){let r={...e,model_provider:"anthropic"},n=e.usage,o=n!=null?{input_tokens:n.input_tokens??0,output_tokens:n.output_tokens??0,total_tokens:(n.input_tokens??0)+(n.output_tokens??0),input_token_details:{cache_creation:n.cache_creation_input_tokens,cache_read:n.cache_read_input_tokens}}:void 0;if(t.length===1&&t[0].type==="text")return[{text:t[0].text,message:new Pn({content:t[0].text,additional_kwargs:e,usage_metadata:o,response_metadata:r,id:e.id})}];{let i=Pst(t);return[{text:"",message:new Pn({content:t,additional_kwargs:e,tool_calls:i,usage_metadata:o,response_metadata:r,id:e.id})}]}}var Zvr=v(()=>{Mst();ta()});function wPe(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function Dst(t){let e;return t.status===400&&t.message.includes("tool")?e=wPe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=wPe(t,"MODEL_AUTHENTICATION"):t.status===404?e=wPe(t,"MODEL_NOT_FOUND"):t.status===429?e=wPe(t,"MODEL_RATE_LIMIT"):e=t,e}var Yvr=v(()=>{});function hr(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function Ie(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var $D=v(()=>{});var jst,Qvr=v(()=>{jst=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return jst=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))}});function LD(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var kae,_9=v(()=>{kae=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var un,Kh,oy,Pq,v9,w9,S9,C9,x9,T9,O9,E9,P9,zx=v(()=>{_9();un=class extends Error{},Kh=class t extends un{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("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 Pq({message:n,cause:kae(r)});let i=r;return e===400?new w9(e,i,n,o):e===401?new S9(e,i,n,o):e===403?new C9(e,i,n,o):e===404?new x9(e,i,n,o):e===409?new T9(e,i,n,o):e===422?new O9(e,i,n,o):e===429?new E9(e,i,n,o):e>=500?new P9(e,i,n,o):new t(e,i,n,o)}},oy=class extends Kh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Pq=class extends Kh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},v9=class extends Pq{constructor({message:e}={}){super({message:e??"Request timed out."})}},w9=class extends Kh{},S9=class extends Kh{},C9=class extends Kh{},x9=class extends Kh{},T9=class extends Kh{},O9=class extends Kh{},E9=class extends Kh{},P9=class extends Kh{}});function Fst(t){return typeof t!="object"?{}:t??{}}function twr(t){if(!t)return!0;for(let e in t)return!1;return!0}function rwr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var _mo,ewr,$st,Lst,nwr,SPe,SH=v(()=>{zx();_mo=/^[a-z][a-z0-9+.-]*:/i,ewr=t=>_mo.test(t),$st=t=>($st=Array.isArray,$st(t)),Lst=$st;nwr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new un(`${t} must be an integer`);if(e<0)throw new un(`${t} must be a positive integer`);return e},SPe=t=>{try{return JSON.parse(t)}catch{return}}});var owr,iwr=v(()=>{owr=t=>new Promise(e=>setTimeout(e,t))});var Mq,kst=v(()=>{Mq="0.65.0"});function vmo(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function Smo(){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 lwr,wmo,awr,swr,uwr,cwr,qst=v(()=>{kst();lwr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";wmo=()=>{let t=vmo();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mq,"X-Stainless-OS":swr(Deno.build.os),"X-Stainless-Arch":awr(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":Mq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mq,"X-Stainless-OS":swr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":awr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Smo();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Mq,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};awr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",swr=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"),cwr=()=>uwr??(uwr=wmo())});function dwr(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ust(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function CPe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Ust({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function qae(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function fwr(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var M9=v(()=>{});var pwr,mwr=v(()=>{pwr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});function ywr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function Uae(t){let e;return(hwr??(e=new globalThis.TextEncoder,hwr=e.encode.bind(e)))(t)}function Bst(t){let e;return(gwr??(e=new globalThis.TextDecoder,gwr=e.decode.bind(e)))(t)}var hwr,gwr,zst=v(()=>{});function Tmo(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 bwr(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 kw,qw,FD,Vst=v(()=>{$D();zst();FD=class{constructor(){kw.set(this,void 0),qw.set(this,void 0),hr(this,kw,new Uint8Array,"f"),hr(this,qw,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Uae(e):e;hr(this,kw,ywr([Ie(this,kw,"f"),r]),"f");let n=[],o;for(;(o=Tmo(Ie(this,kw,"f"),Ie(this,qw,"f")))!=null;){if(o.carriage&&Ie(this,qw,"f")==null){hr(this,qw,o.index,"f");continue}if(Ie(this,qw,"f")!=null&&(o.index!==Ie(this,qw,"f")+1||o.carriage)){n.push(Bst(Ie(this,kw,"f").subarray(0,Ie(this,qw,"f")-1))),hr(this,kw,Ie(this,kw,"f").subarray(Ie(this,qw,"f")),"f"),hr(this,qw,null,"f");continue}let i=Ie(this,qw,"f")!==null?o.preceding-1:o.preceding,a=Bst(Ie(this,kw,"f").subarray(0,i));n.push(a),hr(this,kw,Ie(this,kw,"f").subarray(o.index),"f"),hr(this,qw,null,"f")}return n}flush(){return Ie(this,kw,"f").length?this.decode(`
|
||
`):[]}};kw=new WeakMap,qw=new WeakMap;FD.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);FD.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Bae(){}function xPe(t,e,r){return!e||TPe[t]>TPe[r]?Bae:e[t].bind(e)}function Gh(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Omo;let n=_wr.get(e);if(n&&n[0]===r)return n[1];let o={error:xPe("error",e,r),warn:xPe("warn",e,r),info:xPe("info",e,r),debug:xPe("debug",e,r)};return _wr.set(e,[r,o]),o}var TPe,Hst,Omo,_wr,kD,OPe=v(()=>{SH();TPe={off:0,error:200,warn:300,info:400,debug:500},Hst=(t,e,r)=>{if(t){if(rwr(TPe,t))return t;Gh(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(TPe))}`)}};Omo={error:Bae,warn:Bae,info:Bae,debug:Bae},_wr=new WeakMap;kD=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*Emo(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new un("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new un("Attempted to iterate over a response with no body");let r=new Wst,n=new FD,o=qae(t.body);for await(let i of Pmo(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*Pmo(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"?Uae(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=bwr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Mmo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var zae,vA,Wst,Jst=v(()=>{$D();zx();M9();Vst();M9();_9();SH();zst();OPe();zx();vA=class t{constructor(e,r,n){this.iterator=e,zae.set(this,void 0),this.controller=r,hr(this,zae,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?Gh(n):console;async function*a(){if(o)throw new un("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Emo(e,r)){if(u.event==="completion")try{yield JSON.parse(u.data)}catch(l){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),l}if(u.event==="message_start"||u.event==="message_delta"||u.event==="message_stop"||u.event==="content_block_start"||u.event==="content_block_delta"||u.event==="content_block_stop")try{yield JSON.parse(u.data)}catch(l){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),l}if(u.event!=="ping"&&u.event==="error")throw new Kh(void 0,SPe(u.data)??u.data,void 0,e.headers)}s=!0}catch(u){if(LD(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new FD,u=qae(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new un("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(LD(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(zae=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,Ie(this,zae,"f")),new t(()=>o(r),this.controller,Ie(this,zae,"f"))]}toReadableStream(){let e=this,r;return Ust({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=Uae(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};Wst=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]=Mmo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function EPe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return Gh(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):vA.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();if(u?.includes("application/json")||u?.endsWith("+json")){let d=await r.json();return Kst(d,r)}return await r.text()})();return Gh(t).debug(`[${n}] response parsed`,kD({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function Kst(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 Gst=v(()=>{Jst();OPe()});var Vae,CH,PPe=v(()=>{$D();Gst();CH=class t extends Promise{constructor(e,r,n=EPe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Vae.set(this,void 0),hr(this,Vae,e,"f")}_thenUnwrap(e){return new t(Ie(this,Vae,"f"),this.responsePromise,async(r,n)=>Kst(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(Ie(this,Vae,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Vae=new WeakMap});var MPe,Xst,Hae,P0,Rq=v(()=>{$D();zx();Gst();PPe();SH();Xst=class{constructor(e,r,n,o){MPe.set(this,void 0),hr(this,MPe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new un("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Ie(this,MPe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(MPe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Hae=class extends CH{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await EPe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},P0=class extends Xst{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()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...Fst(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...Fst(this.options.query),after_id:e}}:null}}});function xH(t,e,r){return Yst(),new File(t,e??"unknown_file",r)}function Wae(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}function Imo(t){let e=typeof t=="function"?t:t.fetch,r=vwr.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return vwr.set(e,n),n}var Yst,Qst,wwr,vwr,Amo,Nmo,Zst,RPe=v(()=>{M9();Yst=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};Qst=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",wwr=async(t,e)=>({...t,body:await Amo(t.body,e)}),vwr=new WeakMap;Amo=async(t,e)=>{if(!await Imo(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>Zst(r,n,o))),r},Nmo=t=>t instanceof Blob&&"name"in t,Zst=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let n={},o=r.headers.get("Content-Type");o&&(n={type:o}),t.append(e,xH([await r.blob()],Wae(r),n))}else if(Qst(r))t.append(e,xH([await new Response(CPe(r)).blob()],Wae(r)));else if(Nmo(r))t.append(e,xH([r],Wae(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>Zst(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Zst(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 IPe(t,e,r){if(Yst(),t=await t,e||(e=Wae(t)),Dmo(t))return t instanceof File&&e==null&&r==null?t:xH([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(jmo(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),xH(await eut(o),e,r)}let n=await eut(t);if(!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return xH(n,e,r)}async function eut(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Swr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Qst(t))for await(let r of t)e.push(...await eut(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${$mo(t)}`)}return e}function $mo(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var Swr,Dmo,jmo,Cwr=v(()=>{RPe();RPe();Swr=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",Dmo=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Swr(t),jmo=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var tut=v(()=>{Cwr()});var xwr=v(()=>{});var Fd,wA=v(()=>{Fd=class{constructor(e){this._client=e}}});function*Fmo(t){if(!t)return;if(Twr in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Lst(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=Lst(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var Twr,ia,SA=v(()=>{SH();Twr=Symbol.for("brand.privateNullableHeaders");ia=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of Fmo(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[Twr]:!0,values:e,nulls:r}}});function Ewr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Owr,kmo,ib,R9=v(()=>{zx();Owr=Object.freeze(Object.create(null)),kmo=(t=Ewr)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((c,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=n[f],m=(o?encodeURIComponent:t)(""+p);return f!==n.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??Owr)??Owr)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new un(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},ib=kmo(Ewr)});var I9,rut=v(()=>{wA();Rq();SA();RPe();R9();I9=class extends Fd{list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/files",P0,{query:o,...r,headers:ia([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(ib`/v1/files/${e}`,{...n,headers:ia([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:o}=r??{};return this._client.get(ib`/v1/files/${e}/content`,{...n,headers:ia([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},n){let{betas:o}=r??{};return this._client.get(ib`/v1/files/${e}`,{...n,headers:ia([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}upload(e,r){let{betas:n,...o}=e;return this._client.post("/v1/files",wwr({body:o,...r,headers:ia([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}}});var A9,nut=v(()=>{wA();Rq();SA();R9();A9=class extends Fd{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(ib`/v1/models/${e}?beta=true`,{...n,headers:ia([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/models?beta=true",P0,{query:o,...r,headers:ia([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var N9,out=v(()=>{zx();M9();Vst();N9=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new FD;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(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new un("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new un("Attempted to iterate over a response with no body");return new t(qae(e.body),r)}}});var Jae=v(()=>{zx()});var D9,iut=v(()=>{wA();Rq();SA();out();Jae();R9();D9=class extends Fd{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:ia([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(ib`/v1/messages/batches/${e}?beta=true`,{...n,headers:ia([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",P0,{query:o,...r,headers:ia([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(ib`/v1/messages/batches/${e}?beta=true`,{...n,headers:ia([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:o}=r??{};return this._client.post(ib`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:ia([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}async results(e,r={},n){let o=await this.retrieve(e);if(!o.results_url)throw new un(`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:ia([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,s)=>N9.fromResponse(s.response,s.controller))}}});var aut=v(()=>{Jst()});var zmo,j9,Vmo,Hmo,APe,sut=v(()=>{zmo=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},j9=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),j9(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),j9(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),j9(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),j9(t);break;case"delimiter":return t=t.slice(0,t.length-1),j9(t);break}return t},Vmo=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},Hmo=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},APe=t=>JSON.parse(Hmo(Vmo(j9(zmo(t)))))});function Iwr(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var M0,Iq,Kae,NPe,Gae,Xae,DPe,Zae,qD,Yae,jPe,$Pe,$9,LPe,FPe,uut,Pwr,kPe,lut,cut,dut,Mwr,Rwr,qPe,Awr=v(()=>{$D();_9();Jae();aut();sut();Rwr="__json_buf";qPe=class t{constructor(){M0.add(this),this.messages=[],this.receivedMessages=[],Iq.set(this,void 0),this.controller=new AbortController,Kae.set(this,void 0),NPe.set(this,()=>{}),Gae.set(this,()=>{}),Xae.set(this,void 0),DPe.set(this,()=>{}),Zae.set(this,()=>{}),qD.set(this,{}),Yae.set(this,!1),jPe.set(this,!1),$Pe.set(this,!1),$9.set(this,!1),LPe.set(this,void 0),FPe.set(this,void 0),kPe.set(this,e=>{if(hr(this,jPe,!0,"f"),LD(e)&&(e=new oy),e instanceof oy)return hr(this,$Pe,!0,"f"),this._emit("abort",e);if(e instanceof un)return this._emit("error",e);if(e instanceof Error){let r=new un(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new un(String(e)))}),hr(this,Kae,new Promise((e,r)=>{hr(this,NPe,e,"f"),hr(this,Gae,r,"f")}),"f"),hr(this,Xae,new Promise((e,r)=>{hr(this,DPe,e,"f"),hr(this,Zae,r,"f")}),"f"),Ie(this,Kae,"f").catch(()=>{}),Ie(this,Xae,"f").catch(()=>{})}get response(){return Ie(this,LPe,"f")}get request_id(){return Ie(this,FPe,"f")}async withResponse(){let e=await Ie(this,Kae,"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")},Ie(this,kPe,"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,i;o&&(o.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),o.addEventListener("abort",i));try{Ie(this,M0,"m",lut).call(this);let{response:a,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(a);for await(let u of s)Ie(this,M0,"m",cut).call(this,u);if(s.controller.signal?.aborted)throw new oy;Ie(this,M0,"m",dut).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(hr(this,LPe,e,"f"),hr(this,FPe,e?.headers.get("request-id"),"f"),Ie(this,NPe,"f").call(this,e),this._emit("connect"))}get ended(){return Ie(this,Yae,"f")}get errored(){return Ie(this,jPe,"f")}get aborted(){return Ie(this,$Pe,"f")}abort(){this.controller.abort()}on(e,r){return(Ie(this,qD,"f")[e]||(Ie(this,qD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ie(this,qD,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(Ie(this,qD,"f")[e]||(Ie(this,qD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{hr(this,$9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){hr(this,$9,!0,"f"),await Ie(this,Xae,"f")}get currentMessage(){return Ie(this,Iq,"f")}async finalMessage(){return await this.done(),Ie(this,M0,"m",uut).call(this)}async finalText(){return await this.done(),Ie(this,M0,"m",Pwr).call(this)}_emit(e,...r){if(Ie(this,Yae,"f"))return;e==="end"&&(hr(this,Yae,!0,"f"),Ie(this,DPe,"f").call(this));let n=Ie(this,qD,"f")[e];if(n&&(Ie(this,qD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ie(this,$9,"f")&&!n?.length&&Promise.reject(o),Ie(this,Gae,"f").call(this,o),Ie(this,Zae,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ie(this,$9,"f")&&!n?.length&&Promise.reject(o),Ie(this,Gae,"f").call(this,o),Ie(this,Zae,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Ie(this,M0,"m",uut).call(this))}async _fromReadableStream(e,r){let n=r?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{Ie(this,M0,"m",lut).call(this),this._connected(null);let i=vA.fromReadableStream(e,this.controller);for await(let a of i)Ie(this,M0,"m",cut).call(this,a);if(i.controller.signal?.aborted)throw new oy;Ie(this,M0,"m",dut).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(Iq=new WeakMap,Kae=new WeakMap,NPe=new WeakMap,Gae=new WeakMap,Xae=new WeakMap,DPe=new WeakMap,Zae=new WeakMap,qD=new WeakMap,Yae=new WeakMap,jPe=new WeakMap,$Pe=new WeakMap,$9=new WeakMap,LPe=new WeakMap,FPe=new WeakMap,kPe=new WeakMap,M0=new WeakSet,uut=function(){if(this.receivedMessages.length===0)throw new un("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Pwr=function(){if(this.receivedMessages.length===0)throw new un("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 un("stream ended without producing a content block with type=text");return r.join(" ")},lut=function(){this.ended||hr(this,Iq,void 0,"f")},cut=function(r){if(this.ended)return;let n=Ie(this,M0,"m",Mwr).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":{Iwr(o)&&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":{hr(this,Iq,n,"f");break}case"content_block_start":case"message_delta":break}},dut=function(){if(this.ended)throw new un("stream has ended, this shouldn't happen");let r=Ie(this,Iq,"f");if(!r)throw new un("request ended without sending any chunks");return hr(this,Iq,void 0,"f"),r},Mwr=function(r){let n=Ie(this,Iq,"f");if(r.type==="message_start"){if(n)throw new un(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new un(`Unexpected event order, got ${r.type} before "message_start"`);switch(r.type){case"message_stop":return n;case"message_delta":return n.container=r.delta.container,n.stop_reason=r.delta.stop_reason,n.stop_sequence=r.delta.stop_sequence,n.usage.output_tokens=r.usage.output_tokens,n.context_management=r.context_management,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),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"&&(n.content[r.index]={...o,text:(o.text||"")+r.delta.text});break}case"citations_delta":{o?.type==="text"&&(n.content[r.index]={...o,citations:[...o.citations??[],r.delta.citation]});break}case"input_json_delta":{if(o&&Iwr(o)){let i=o[Rwr]||"";i+=r.delta.partial_json;let a={...o};if(Object.defineProperty(a,Rwr,{value:i,enumerable:!1,writable:!0}),i)try{a.input=APe(i)}catch(s){let u=new un(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${i}`);Ie(this,kPe,"f").call(this,u)}n.content[r.index]=a}break}case"thinking_delta":{o?.type==="thinking"&&(n.content[r.index]={...o,thinking:o.thinking+r.delta.thinking});break}case"signature_delta":{o?.type==="thinking"&&(n.content[r.index]={...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 vA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var UPe,fut=v(()=>{UPe={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function Nwr(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}}async function Wmo(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let r=e.content.filter(o=>o.type==="tool_use");return r.length===0?null:{role:"user",content:await Promise.all(r.map(async o=>{let i=t.tools.find(a=>a.name===o.name);if(!i||!("run"in i))return{type:"tool_result",tool_use_id:o.id,content:`Error: Tool '${o.name}' not found`,is_error:!0};try{let a=o.input;"parse"in i&&i.parse&&(a=i.parse(a));let s=await i.run(a);return{type:"tool_result",tool_use_id:o.id,content:s}}catch(a){return{type:"tool_result",tool_use_id:o.id,content:`Error: ${a instanceof Error?a.message:String(a)}`,is_error:!0}}}))}}var BPe,L9,TH,fv,Qae,CA,UD,Aq,ese,put,F9,mut=v(()=>{$D();zx();SA();F9=class{constructor(e,r,n){BPe.add(this),this.client=e,L9.set(this,!1),TH.set(this,!1),fv.set(this,void 0),Qae.set(this,void 0),CA.set(this,void 0),UD.set(this,void 0),Aq.set(this,void 0),ese.set(this,0),hr(this,fv,{params:{...r,messages:structuredClone(r.messages)}},"f"),hr(this,Qae,{...n,headers:ia([{"x-stainless-helper":"BetaToolRunner"},n?.headers])},"f"),hr(this,Aq,Nwr(),"f")}async*[(L9=new WeakMap,TH=new WeakMap,fv=new WeakMap,Qae=new WeakMap,CA=new WeakMap,UD=new WeakMap,Aq=new WeakMap,ese=new WeakMap,BPe=new WeakSet,Symbol.asyncIterator)](){var e;if(Ie(this,L9,"f"))throw new un("Cannot iterate over a consumed stream");hr(this,L9,!0,"f"),hr(this,TH,!0,"f"),hr(this,UD,void 0,"f");try{for(;;){let r;try{if(Ie(this,fv,"f").params.max_iterations&&Ie(this,ese,"f")>=Ie(this,fv,"f").params.max_iterations)break;hr(this,TH,!1,"f"),hr(this,CA,void 0,"f"),hr(this,UD,void 0,"f"),hr(this,ese,(e=Ie(this,ese,"f"),e++,e),"f");let{max_iterations:n,...o}=Ie(this,fv,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},Ie(this,Qae,"f")),hr(this,CA,r.finalMessage(),"f"),yield r):(hr(this,CA,this.client.beta.messages.create({...o,stream:!1},Ie(this,Qae,"f")),"f"),yield Ie(this,CA,"f")),!Ie(this,TH,"f")){let{role:a,content:s}=await Ie(this,CA,"f");Ie(this,fv,"f").params.messages.push({role:a,content:s})}let i=await Ie(this,BPe,"m",put).call(this,Ie(this,fv,"f").params.messages.at(-1));if(i&&Ie(this,fv,"f").params.messages.push(i),!i&&!Ie(this,TH,"f"))break}finally{r&&r.abort()}}if(!Ie(this,CA,"f"))throw new un("ToolRunner concluded without a message from the server");Ie(this,Aq,"f").resolve(await Ie(this,CA,"f"))}catch(r){throw hr(this,L9,!1,"f"),Ie(this,Aq,"f").promise.catch(()=>{}),Ie(this,Aq,"f").reject(r),hr(this,Aq,Nwr(),"f"),r}}setMessagesParams(e){typeof e=="function"?Ie(this,fv,"f").params=e(Ie(this,fv,"f").params):Ie(this,fv,"f").params=e,hr(this,TH,!0,"f"),hr(this,UD,void 0,"f")}async generateToolResponse(){let e=await Ie(this,CA,"f")??this.params.messages.at(-1);return e?Ie(this,BPe,"m",put).call(this,e):null}done(){return Ie(this,Aq,"f").promise}async runUntilDone(){if(!Ie(this,L9,"f"))for await(let e of this);return this.done()}get params(){return Ie(this,fv,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};put=async function(e){return Ie(this,UD,"f")!==void 0?Ie(this,UD,"f"):(hr(this,UD,Wmo(Ie(this,fv,"f").params,e),"f"),Ie(this,UD,"f"))}});var Dwr,Nq,hut=v(()=>{wA();iut();iut();SA();Awr();fut();mut();mut();Dwr={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},Nq=class extends Fd{constructor(){super(...arguments),this.batches=new D9(this._client)}create(e,r){let{betas:n,...o}=e;o.model in Dwr&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${Dwr[o.model]}
|
||
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let i=this._client._options.timeout;if(!o.stream&&i==null){let a=UPe[o.model]??void 0;i=this._client.calculateNonstreamingTimeout(o.max_tokens,a)}return this._client.post("/v1/messages?beta=true",{body:o,timeout:i??6e5,...r,headers:ia([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return qPe.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:ia([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new F9(this._client,e,r)}};Nq.Batches=D9;Nq.BetaToolRunner=F9});var xA,gut=v(()=>{wA();rut();rut();nut();nut();hut();hut();xA=class extends Fd{constructor(){super(...arguments),this.models=new A9(this._client),this.messages=new Nq(this._client),this.files=new I9(this._client)}};xA.Models=A9;xA.Messages=Nq;xA.Files=I9});var OH,yut=v(()=>{wA();SA();OH=class extends Fd{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??6e5,...r,headers:ia([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}}});function Fwr(t){return t.type==="tool_use"||t.type==="server_tool_use"}var R0,Dq,tse,zPe,rse,nse,VPe,ose,BD,ise,HPe,WPe,k9,JPe,KPe,but,jwr,_ut,vut,wut,Sut,$wr,Lwr,GPe,kwr=v(()=>{$D();_9();Jae();aut();sut();Lwr="__json_buf";GPe=class t{constructor(){R0.add(this),this.messages=[],this.receivedMessages=[],Dq.set(this,void 0),this.controller=new AbortController,tse.set(this,void 0),zPe.set(this,()=>{}),rse.set(this,()=>{}),nse.set(this,void 0),VPe.set(this,()=>{}),ose.set(this,()=>{}),BD.set(this,{}),ise.set(this,!1),HPe.set(this,!1),WPe.set(this,!1),k9.set(this,!1),JPe.set(this,void 0),KPe.set(this,void 0),_ut.set(this,e=>{if(hr(this,HPe,!0,"f"),LD(e)&&(e=new oy),e instanceof oy)return hr(this,WPe,!0,"f"),this._emit("abort",e);if(e instanceof un)return this._emit("error",e);if(e instanceof Error){let r=new un(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new un(String(e)))}),hr(this,tse,new Promise((e,r)=>{hr(this,zPe,e,"f"),hr(this,rse,r,"f")}),"f"),hr(this,nse,new Promise((e,r)=>{hr(this,VPe,e,"f"),hr(this,ose,r,"f")}),"f"),Ie(this,tse,"f").catch(()=>{}),Ie(this,nse,"f").catch(()=>{})}get response(){return Ie(this,JPe,"f")}get request_id(){return Ie(this,KPe,"f")}async withResponse(){let e=await Ie(this,tse,"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")},Ie(this,_ut,"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,i;o&&(o.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),o.addEventListener("abort",i));try{Ie(this,R0,"m",vut).call(this);let{response:a,data:s}=await e.create({...r,stream:!0},{...n,signal:this.controller.signal}).withResponse();this._connected(a);for await(let u of s)Ie(this,R0,"m",wut).call(this,u);if(s.controller.signal?.aborted)throw new oy;Ie(this,R0,"m",Sut).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(hr(this,JPe,e,"f"),hr(this,KPe,e?.headers.get("request-id"),"f"),Ie(this,zPe,"f").call(this,e),this._emit("connect"))}get ended(){return Ie(this,ise,"f")}get errored(){return Ie(this,HPe,"f")}get aborted(){return Ie(this,WPe,"f")}abort(){this.controller.abort()}on(e,r){return(Ie(this,BD,"f")[e]||(Ie(this,BD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ie(this,BD,"f")[e];if(!n)return this;let o=n.findIndex(i=>i.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(Ie(this,BD,"f")[e]||(Ie(this,BD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{hr(this,k9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){hr(this,k9,!0,"f"),await Ie(this,nse,"f")}get currentMessage(){return Ie(this,Dq,"f")}async finalMessage(){return await this.done(),Ie(this,R0,"m",but).call(this)}async finalText(){return await this.done(),Ie(this,R0,"m",jwr).call(this)}_emit(e,...r){if(Ie(this,ise,"f"))return;e==="end"&&(hr(this,ise,!0,"f"),Ie(this,VPe,"f").call(this));let n=Ie(this,BD,"f")[e];if(n&&(Ie(this,BD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ie(this,k9,"f")&&!n?.length&&Promise.reject(o),Ie(this,rse,"f").call(this,o),Ie(this,ose,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ie(this,k9,"f")&&!n?.length&&Promise.reject(o),Ie(this,rse,"f").call(this,o),Ie(this,ose,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Ie(this,R0,"m",but).call(this))}async _fromReadableStream(e,r){let n=r?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{Ie(this,R0,"m",vut).call(this),this._connected(null);let i=vA.fromReadableStream(e,this.controller);for await(let a of i)Ie(this,R0,"m",wut).call(this,a);if(i.controller.signal?.aborted)throw new oy;Ie(this,R0,"m",Sut).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(Dq=new WeakMap,tse=new WeakMap,zPe=new WeakMap,rse=new WeakMap,nse=new WeakMap,VPe=new WeakMap,ose=new WeakMap,BD=new WeakMap,ise=new WeakMap,HPe=new WeakMap,WPe=new WeakMap,k9=new WeakMap,JPe=new WeakMap,KPe=new WeakMap,_ut=new WeakMap,R0=new WeakSet,but=function(){if(this.receivedMessages.length===0)throw new un("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},jwr=function(){if(this.receivedMessages.length===0)throw new un("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 un("stream ended without producing a content block with type=text");return r.join(" ")},vut=function(){this.ended||hr(this,Dq,void 0,"f")},wut=function(r){if(this.ended)return;let n=Ie(this,R0,"m",$wr).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":{Fwr(o)&&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":{hr(this,Dq,n,"f");break}case"content_block_start":case"message_delta":break}},Sut=function(){if(this.ended)throw new un("stream has ended, this shouldn't happen");let r=Ie(this,Dq,"f");if(!r)throw new un("request ended without sending any chunks");return hr(this,Dq,void 0,"f"),r},$wr=function(r){let n=Ie(this,Dq,"f");if(r.type==="message_start"){if(n)throw new un(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new un(`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,r.usage.input_tokens!=null&&(n.usage.input_tokens=r.usage.input_tokens),r.usage.cache_creation_input_tokens!=null&&(n.usage.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.cache_read_input_tokens!=null&&(n.usage.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.server_tool_use!=null&&(n.usage.server_tool_use=r.usage.server_tool_use),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"&&(n.content[r.index]={...o,text:(o.text||"")+r.delta.text});break}case"citations_delta":{o?.type==="text"&&(n.content[r.index]={...o,citations:[...o.citations??[],r.delta.citation]});break}case"input_json_delta":{if(o&&Fwr(o)){let i=o[Lwr]||"";i+=r.delta.partial_json;let a={...o};Object.defineProperty(a,Lwr,{value:i,enumerable:!1,writable:!0}),i&&(a.input=APe(i)),n.content[r.index]=a}break}case"thinking_delta":{o?.type==="thinking"&&(n.content[r.index]={...o,thinking:o.thinking+r.delta.thinking});break}case"signature_delta":{o?.type==="thinking"&&(n.content[r.index]={...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 vA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var q9,Cut=v(()=>{wA();Rq();SA();out();Jae();R9();q9=class extends Fd{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(ib`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",P0,{query:e,...r})}delete(e,r){return this._client.delete(ib`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(ib`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new un(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:ia([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,i)=>N9.fromResponse(i.response,i.controller))}}});var jq,qwr,xut=v(()=>{wA();kwr();Cut();Cut();fut();jq=class extends Fd{constructor(){super(...arguments),this.batches=new q9(this._client)}create(e,r){e.model in qwr&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${qwr[e.model]}
|
||
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let n=this._client._options.timeout;if(!e.stream&&n==null){let o=UPe[e.model]??void 0;n=this._client.calculateNonstreamingTimeout(e.max_tokens,o)}return this._client.post("/v1/messages",{body:e,timeout:n??6e5,...r,stream:e.stream??!1})}stream(e,r){return GPe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},qwr={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"};jq.Batches=q9});var EH,Tut=v(()=>{wA();Rq();SA();R9();EH=class extends Fd{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(ib`/v1/models/${e}`,{...n,headers:ia([{...o?.toString()!=null?{"anthropic-beta":o?.toString()}:void 0},n?.headers])})}list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/models",P0,{query:o,...r,headers:ia([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var Uwr=v(()=>{xwr();gut();yut();xut();Tut()});var ase,Bwr=v(()=>{ase=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()}});var Out,Eut,XPe,zwr,Vwr,Hwr,Tc,TA,Put=v(()=>{$D();Qvr();SH();iwr();_9();qst();M9();mwr();kst();zx();Rq();tut();Uwr();PPe();yut();Tut();gut();xut();qst();SA();Bwr();OPe();SH();Vwr="\\n\\nHuman:",Hwr="\\n\\nAssistant:",Tc=class{constructor({baseURL:e=ase("ANTHROPIC_BASE_URL"),apiKey:r=ase("ANTHROPIC_API_KEY")??null,authToken:n=ase("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){Out.add(this),XPe.set(this,void 0);let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&lwr())throw new un(`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 });
|
||
`);this.baseURL=i.baseURL,this.timeout=i.timeout??Eut.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a="warn";this.logLevel=a,this.logLevel=Hst(i.logLevel,"ClientOptions.logLevel",this)??Hst(ase("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??dwr(),hr(this,XPe,pwr,"f"),this._options=i,this.apiKey=r,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(this.apiKey&&e.get("x-api-key"))&&!r.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!r.has("authorization"))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')}async authHeaders(e){return ia([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return ia([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return ia([{Authorization:`Bearer ${this.authToken}`}])}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 un(`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("&")}getUserAgent(){return`${this.constructor.name}/JS ${Mq}`}defaultIdempotencyKey(){return`stainless-node-retry-${jst()}`}makeStatusError(e,r,n,o){return Kh.generate(e,r,n,o)}buildURL(e,r,n){let o=!Ie(this,Out,"m",zwr).call(this)&&n||this.baseURL,i=ewr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return twr(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new un("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new CH(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),c=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Gh(this).debug(`[${l}] sending request`,kD({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new oy;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(kae),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new oy;let b=LD(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Gh(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),Gh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,kD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw Gh(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Gh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,kD({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new v9:new Pq({cause:p})}let h=[...p.headers.entries()].filter(([g])=>g==="request-id").map(([g,b])=>", "+g+": "+JSON.stringify(b)).join(""),y=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let g=await this.shouldRetry(p);if(r&&g){let E=`retrying, ${r} attempts remaining`;return await fwr(p.body),Gh(this).info(`${y} - ${E}`),Gh(this).debug(`[${l}] response error (${E})`,kD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=g?"error; no more retries left":"error; not retryable";Gh(this).info(`${y} - ${b}`);let _=await p.text().catch(E=>kae(E).message),w=SPe(_),T=w?void 0:_;throw Gh(this).debug(`[${l}] response error (${b})`,kD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,T,p.headers)}return Gh(this).info(y),Gh(this).debug(`[${l}] response start`,kD({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),{response:p,options:o,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new Hae(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{};i&&i.addEventListener("abort",()=>o.abort());let u=setTimeout(()=>o.abort(),n),l=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,c={signal:o.signal,...l?{duplex:"half"}:{},method:"GET",...s};a&&(c.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,c)}finally{clearTimeout(u)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await owr(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}calculateNonstreamingTimeout(e,r){if(36e5*e/128e3>6e5||r!=null&&e>r)throw new un("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&nwr("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:n}),d=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:d,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=ia([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...cwr(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=ia([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:CPe(e)}:Ie(this,XPe,"f").call(this,{body:e,headers:n})}};Eut=Tc,XPe=new WeakMap,Out=new WeakSet,zwr=function(){return this.baseURL!=="https://api.anthropic.com"};Tc.Anthropic=Eut;Tc.HUMAN_PROMPT=Vwr;Tc.AI_PROMPT=Hwr;Tc.DEFAULT_TIMEOUT=6e5;Tc.AnthropicError=un;Tc.APIError=Kh;Tc.APIConnectionError=Pq;Tc.APIConnectionTimeoutError=v9;Tc.APIUserAbortError=oy;Tc.NotFoundError=x9;Tc.ConflictError=T9;Tc.RateLimitError=E9;Tc.BadRequestError=w9;Tc.AuthenticationError=S9;Tc.InternalServerError=P9;Tc.PermissionDeniedError=C9;Tc.UnprocessableEntityError=O9;Tc.toFile=IPe;TA=class extends Tc{constructor(){super(...arguments),this.completions=new OH(this),this.messages=new jq(this),this.models=new EH(this),this.beta=new xA(this)}};TA.Completions=OH;TA.Messages=jq;TA.Models=EH;TA.Beta=xA});var Wwr=v(()=>{Put();tut();PPe();Put();Rq();zx()});function Zmo(t){return t?Object.entries(Xmo).find(([r])=>t.startsWith(r))?.[1]??Jwr:Jwr}function Ymo(t){return!!(t.tools&&t.tools.length>0)}function Qmo(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 eho(t){return!!(t.thinking&&t.thinking.type==="enabled")}function tho(t){return"input_schema"in t}function rho(t){let e=["text_editor_","computer_","bash_","web_search_","web_fetch_","str_replace_editor_","str_replace_based_edit_tool_","code_execution_","memory_"];return typeof t=="object"&&t!==null&&"type"in t&&"name"in t&&typeof t.type=="string"&&e.some(r=>typeof t.type=="string"&&t.type.startsWith(r))}function nho(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]&&typeof t.content[0].text=="string")return t.content[0].text}var Xmo,Jwr,Kwr,Mut,Gwr=v(()=>{Mst();jvr();Nst();Zvr();Yvr();Wwr();ta();Ed();au();YI();Nw();Ny();sw();uv();pD();Xmo={"claude-opus-4-1":8192,"claude-opus-4":8192,"claude-sonnet-4":8192,"claude-sonnet-3-7-sonnet":8192,"claude-3-5-sonnet":4096,"claude-3-5-haiku":4096,"claude-3-haiku":2048},Jwr=2048;Kwr=class extends jd{constructor(e){super(e??{});x(this,"lc_serializable",!0);x(this,"anthropicApiKey");x(this,"apiKey");x(this,"apiUrl");x(this,"temperature");x(this,"topK");x(this,"topP");x(this,"maxTokens");x(this,"modelName","claude-3-5-sonnet-latest");x(this,"model","claude-3-5-sonnet-latest");x(this,"invocationKwargs");x(this,"stopSequences");x(this,"streaming",!1);x(this,"clientOptions");x(this,"thinking",{type:"disabled"});x(this,"contextManagement");x(this,"batchClient");x(this,"streamingClient");x(this,"streamUsage",!0);x(this,"createClient");if(this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??Xr("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.topP=e?.topP??this.topP,this.temperature=e?.temperature??this.temperature,this.topK=e?.topK??this.topK,this.maxTokens=e?.maxTokens??Zmo(this.model),this.stopSequences=e?.stopSequences??this.stopSequences,this.streaming=e?.streaming??!1,this.streamUsage=e?.streamUsage??this.streamUsage,this.thinking=e?.thinking??this.thinking,this.contextManagement=e?.contextManagement??this.contextManagement,this.createClient=e?.createClient??(r=>new TA(r))}static lc_name(){return"ChatAnthropic"}get lc_secrets(){return{anthropicApiKey:"ANTHROPIC_API_KEY",apiKey:"ANTHROPIC_API_KEY"}}get lc_aliases(){return{modelName:"model"}}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(rho(r)||tho(r))return r;if(Aw(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(Xg(r))return{name:r.name,description:r.description,input_schema:Ii(r.schema)?Ci(r.schema):r.schema};throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(r,null,2)}`)})}bindTools(e,r){return this.withConfig({tools:this.formatStructuredToolToAnthropic(e),...r})}invocationParams(e){let r=Dvr(e?.tool_choice);if(this.thinking.type==="enabled"){if(this.topP!==void 0&&this.topK!==-1)throw new Error("topK is not supported when thinking is enabled");if(this.temperature!==void 0&&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,context_management:this.contextManagement,...this.invocationKwargs,container:e?.container}}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,context_management:this.contextManagement,...this.invocationKwargs,container:e?.container}}_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=vPe(e),a={...o,...i,stream:!0},s=!Ymo(a)&&!Qmo(a)&&!eho(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=Gvr(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=nho(f),m=new si({message:new Er({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,...vPe(e)},n),{content:i,...a}=o,s=Xvr(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 Dst(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 Dst(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(Ii(n)){let m=Ci(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new Est({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 Est({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.withConfig({outputVersion:"v0",tools:l,ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:Ci(n)}});let h=y=>{if(!y.tool_calls||y.tool_calls.length===0)throw new Error(m);return y};c=c.pipe(h)}else c=this.withConfig({outputVersion:"v0",tools:l,tool_choice:{type:"tool",name:s},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:Ci(n)}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Au.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Au.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Bl.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},Mut=class extends Kwr{}});var Xwr=v(()=>{Nst()});var Zwr=v(()=>{Gwr();Xwr()});var Rut,Ywr=v(()=>{au();iH();Rut=class extends fq{constructor(e){let r=e?.apiKey||Xr("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}});x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","deepseek"])}static lc_name(){return"ChatDeepSeek"}_llmType(){return"deepseek"}get lc_secrets(){return{apiKey:"DEEPSEEK_API_KEY"}}_convertCompletionsDeltaToBaseMessageChunk(e,r,n){let o=super._convertCompletionsDeltaToBaseMessageChunk(e,r,n);return o.additional_kwargs.reasoning_content=e.reasoning_content,o}_convertCompletionsMessageToBaseMessage(e,r){let n=super._convertCompletionsMessageToBaseMessage(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 Qwr=v(()=>{Ywr()});var PH,eSr=v(()=>{PH="0.19.0"});function rSr(t,e={auto:!1}){if(tSr)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(MH)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${MH}'\``);tSr=e.auto,MH=t.kind,Iut=t.fetch,oho=t.Request,iho=t.Response,aho=t.Headers,Aut=t.FormData,sho=t.Blob,ZPe=t.File,Nut=t.ReadableStream,Dut=t.getMultipartRequestOptions,jut=t.getDefaultAgent,YPe=t.fileFromPath,$ut=t.isFsReadStream}var tSr,MH,Iut,oho,iho,aho,Aut,sho,ZPe,Nut,Dut,jut,YPe,$ut,Lut=v(()=>{tSr=!1});var QPe,nSr=v(()=>{QPe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function oSr({manuallyImported:t}={}){let e=t?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from 'groq-sdk'`:\n- `import 'groq-sdk/shims/node'` (if you're running on Node)\n- `import 'groq-sdk/shims/web'` (otherwise)\n",r,n,o,i;try{r=fetch,n=Request,o=Response,i=Headers}catch(a){throw new Error(`this environment is missing the following Web Fetch API type: ${a.message}. ${e}`)}return{kind:"web",fetch:r,Request:n,Response:o,Headers:i,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${e}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${e}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${e}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${e}`)}},getMultipartRequestOptions:async(a,s)=>({...s,body:new QPe(a)}),getDefaultAgent:a=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/groq/groq-typescript#file-uploads")},isFsReadStream:a=>!1}}var iSr=v(()=>{nSr()});var aSr=v(()=>{iSr()});var Fut,sse=v(()=>{Lut();aSr();Lut();Fut=()=>{MH||rSr(oSr(),{auto:!0})};Fut()});var iy,Xh,RH,$q,U9,use,lse,cse,dse,fse,pse,mse,hse,gse=v(()=>{B9();iy=class extends Error{},Xh=class t extends iy{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||!o)return new $q({message:n,cause:eMe(r)});let i=r;return e===400?new use(e,i,n,o):e===401?new lse(e,i,n,o):e===403?new cse(e,i,n,o):e===404?new dse(e,i,n,o):e===409?new fse(e,i,n,o):e===422?new pse(e,i,n,o):e===429?new mse(e,i,n,o):e>=500?new hse(e,i,n,o):new t(e,i,n,o)}},RH=class extends Xh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},$q=class extends Xh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},U9=class extends $q{constructor({message:e}={}){super({message:e??"Request timed out."})}},use=class extends Xh{},lse=class extends Xh{},cse=class extends Xh{},dse=class extends Xh{},fse=class extends Xh{},pse=class extends Xh{},mse=class extends Xh{},hse=class extends Xh{}});function dho(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function sSr(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 tMe,kut,z9,uSr=v(()=>{sse();gse();gse();tMe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new kut;async function*i(){if(!e.body)throw r.abort(),new iy("Attempted to iterate over a response with no body");let s=new z9,u=sSr(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||u.event==="error"){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 Xh(l.error.status_code,l.error,l.error.message,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 z9,s=sSr(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 Nut({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?.()}})}},kut=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]=dho(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},z9=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 iy(`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 iy(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new iy("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}};z9.NEWLINE_CHARS=new Set([`
|
||
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);z9.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function But(t,e,r){if(t=await t,cSr(t))return t;if(lSr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=yse(o)?[await o.arrayBuffer()]:[o];return new ZPe(i,e,r)}let n=await pho(t);if(e||(e=hho(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new ZPe(n,e,r)}async function pho(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(yse(t))e.push(await t.arrayBuffer());else if(gho(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${mho(t)}`);return e}function mho(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function hho(t){return qut(t.name)||qut(t.filename)||qut(t.path)?.split(/[\\/]/).pop()}var lSr,cSr,yse,fho,qut,gho,zut,IH,dSr,Uut,rMe=v(()=>{sse();sse();lSr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",cSr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&yse(t),yse=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",fho=t=>cSr(t)||lSr(t)||$ut(t);qut=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},gho=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",zut=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",IH=async t=>{let e=await dSr(t.body);return Dut(e,t)},dSr=async t=>{let e=new Aut;return await Promise.all(Object.entries(t||{}).map(([r,n])=>Uut(e,r,n))),e},Uut=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(fho(r)){let n=await But(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>Uut(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Uut(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 ySr(t){let{response:e}=t;if(t.options.stream)return V9("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):tMe.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 V9("response",e.status,e.url,e.headers,a),a}let i=await e.text();return V9("response",e.status,e.url,e.headers,i),i}function Sho(){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 Pho(t){if(!t)return!0;for(let e in t)return!1;return!0}function Mho(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function gSr(t,e){for(let r in e){if(!Mho(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 V9(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var bho,_ho,nMe,iMe,aMe,fSr,Hut,vho,who,pSr,mSr,hSr,Cho,xho,Tho,Oho,Eho,Vut,eMe,Wut,Rho,bSr,Iho,oMe,B9=v(()=>{eSr();uSr();gse();sse();rMe();rMe();bho=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},_ho=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)};Fut();iMe=class t extends Promise{constructor(e,r=ySr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>e(await this.parseResponse(r),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)}},aMe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Vut("maxRetries",r),this.timeout=Vut("timeout",n),this.httpAgent=o,this.fetch=i??Iut}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Cho(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Rho()}`}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&&yse(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:zut(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&&Vut("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??jut(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 gSr(i,a),gSr(i,r),zut(e.body)&&MH!=="node"&&delete i["content-type"],oMe(a,"x-stainless-retry-count")===void 0&&oMe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),oMe(a,"x-stainless-timeout")===void 0&&oMe(r,"x-stainless-timeout")===void 0&&e.timeout&&(i["x-stainless-timeout"]=String(e.timeout)),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 Xh.generate(e,r,n,o)}request(e,r=null){return new iMe(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}),V9("request",a,n,i.headers),n.signal?.aborted)throw new RH;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(eMe);if(l instanceof Error){if(n.signal?.aborted)throw new RH;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new U9:new $q({cause:l})}let c=vho(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return V9(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>eMe(y).message),f=xho(d),p=f?void 0:d;throw V9(`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 Hut(this,n,e)}buildURL(e,r){let n=Oho(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Pho(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 iy(`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 Eho(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 ${PH}`}},fSr=class{constructor(e,r,n,o){nMe.set(this,void 0),bho(this,nMe,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 iy("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 _ho(this,nMe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(nMe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Hut=class extends iMe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await ySr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},vho=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),who=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PH,"X-Stainless-OS":mSr(Deno.build.os),"X-Stainless-Arch":pSr(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":PH,"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":PH,"X-Stainless-OS":mSr(process.platform),"X-Stainless-Arch":pSr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Sho();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":PH,"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":PH,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};pSr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",mSr=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"),Cho=()=>hSr??(hSr=who()),xho=t=>{try{return JSON.parse(t)}catch{return}},Tho=/^[a-z][a-z0-9+.-]*:/i,Oho=t=>Tho.test(t),Eho=t=>new Promise(e=>setTimeout(e,t)),Vut=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new iy(`${t} must be an integer`);if(e<0)throw new iy(`${t} must be a positive integer`);return e},eMe=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)},Wut=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};Rho=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),bSr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Iho=t=>typeof t?.get=="function",oMe=(t,e)=>{let r=e.toLowerCase();if(Iho(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 _Sr=v(()=>{});var tc,I0=v(()=>{tc=class{constructor(e){this._client=e}}});var H9,Jut=v(()=>{I0();H9=class extends tc{create(e,r){return this._client.post("/openai/v1/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var W9,Kut=v(()=>{I0();B9();W9=class extends tc{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",IH({body:e,...r}))}}});var J9,Gut=v(()=>{I0();B9();J9=class extends tc{create(e,r){return this._client.post("/openai/v1/audio/translations",IH({body:e,...r}))}}});var OA,Xut=v(()=>{I0();Jut();Jut();Kut();Kut();Gut();Gut();OA=class extends tc{constructor(){super(...arguments),this.speech=new H9(this._client),this.transcriptions=new W9(this._client),this.translations=new J9(this._client)}};OA.Speech=H9;OA.Transcriptions=W9;OA.Translations=J9});var AH,Zut=v(()=>{I0();AH=class extends tc{create(e,r){return this._client.post("/openai/v1/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/openai/v1/batches/${e}`,r)}list(e){return this._client.get("/openai/v1/batches",e)}cancel(e,r){return this._client.post(`/openai/v1/batches/${e}/cancel`,r)}}});var K9,Yut=v(()=>{I0();K9=class extends tc{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}}});var Lq,Qut=v(()=>{I0();Yut();Yut();Lq=class extends tc{constructor(){super(...arguments),this.completions=new K9(this._client)}};Lq.Completions=K9});var NH,elt=v(()=>{I0();NH=class extends tc{}});var DH,tlt=v(()=>{I0();DH=class extends tc{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}}});var jH,rlt=v(()=>{I0();B9();jH=class extends tc{create(e,r){return this._client.post("/openai/v1/files",IH({body:e,...r}))}list(e){return this._client.get("/openai/v1/files",e)}delete(e,r){return this._client.delete(`/openai/v1/files/${e}`,r)}content(e,r){return this._client.get(`/openai/v1/files/${e}/content`,r)}info(e,r){return this._client.get(`/openai/v1/files/${e}`,r)}}});var $H,nlt=v(()=>{I0();$H=class extends tc{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)}}});var vSr=v(()=>{_Sr();Xut();Zut();Qut();elt();tlt();rlt();nlt()});var wSr,_u,SSr,CSr=v(()=>{B9();gse();rMe();vSr();Zut();elt();tlt();rlt();nlt();Xut();Qut();_u=class extends aMe{constructor({baseURL:e=Wut("GROQ_BASE_URL"),apiKey:r=Wut("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new iy("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&&bSr())throw new iy(`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 NH(this),this.chat=new Lq(this),this.embeddings=new DH(this),this.audio=new OA(this),this.models=new $H(this),this.batches=new AH(this),this.files=new jH(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}`}}};wSr=_u;_u.Groq=wSr;_u.DEFAULT_TIMEOUT=6e4;_u.GroqError=iy;_u.APIError=Xh;_u.APIConnectionError=$q;_u.APIConnectionTimeoutError=U9;_u.APIUserAbortError=RH;_u.NotFoundError=dse;_u.ConflictError=fse;_u.RateLimitError=mse;_u.BadRequestError=use;_u.AuthenticationError=lse;_u.InternalServerError=hse;_u.PermissionDeniedError=cse;_u.UnprocessableEntityError=pse;_u.toFile=But;_u.fileFromPath=YPe;_u.Completions=NH;_u.Chat=Lq;_u.Embeddings=DH;_u.Audio=OA;_u.Models=$H;_u.Batches=AH;_u.Files=jH;SSr=_u});function qho(t){if(t.role!=="system"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function")throw new Error(`Unsupported message role: ${t.role}. Expected "system", "assistant", "user", or "function"`);return t.role}function TSr(t){switch(t.type){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":if(!Td.isInstance(t))throw new Error("Invalid generic chat message");return qho(t);default:throw new Error(`Unknown message type: ${t.type}`)}}function xSr(t){return t.map(e=>{let r={role:TSr(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 kl(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Jk):(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 Uho(t,e,r){let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let a of n??[])try{o.push(Ix(a,{returnId:!0}))}catch(s){i.push(_0(a,s.message))}return new Pn({content:t.content||"",additional_kwargs:{tool_calls:n},tool_calls:o,invalid_tool_calls:i,usage_metadata:e,response_metadata:r})}default:return new Td(t.content||"",t.role??"unknown")}}function Bho(t,e,r,n){let o=t.role??e,i=t.content??"",a;t.function_call?a={function_call:t.function_call}:t.tool_calls?a={tool_calls:t.tool_calls}:a={},t.audio&&(a.audio={...t.audio,index:r.choices[0].index});let s,u=n,l,c=r.x_groq;c?.usage&&(s={input_tokens:c.usage.prompt_tokens,output_tokens:c.usage.completion_tokens,total_tokens:c.usage.total_tokens},l={completion_time:c.usage.completion_time,prompt_time:c.usage.prompt_time,queue_time:c.usage.queue_time,total_time:c.usage.total_time}),c?.id&&(u=c.id);let d={usage:s,timing:l};if(o==="user")return new rw({content:i,response_metadata:d});if(o==="assistant"){let f=[];if(Array.isArray(t.tool_calls))for(let p of t.tool_calls)f.push({name:p.function?.name,args:p.function?.arguments,id:p.id,index:p.index,type:"tool_call_chunk"});return new Er({content:i,tool_call_chunks:f,additional_kwargs:a,id:u,response_metadata:d})}else return o==="system"?new Rb({content:i,response_metadata:d}):o==="developer"?new Rb({content:i,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new tw({content:i,additional_kwargs:a,name:t.name,response_metadata:d}):o==="tool"?new _S({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:d}):new ew({content:i,role:o,response_metadata:d})}function zho(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 Lho,Fho,kho,olt,OSr=v(()=>{Ny();YI();ta();Ed();au();uv();CSr();sw();fO();PV();pD();Lho=["frequency_penalty","function_call","functions","logit_bias","logprobs","max_completion_tokens","max_tokens","n","parallel_tool_calls","presence_penalty","reasoning_format","response_format","seed","service_tier","stop","temperature","tool_choice","top_logprobs","top_p"],Fho=["headers","promptIndex","stream_options","tools"],kho=[...Lho,...Fho];olt=class extends jd{constructor(e){super(e);x(this,"lc_namespace",["langchain","chat_models","groq"]);x(this,"client");x(this,"model");x(this,"temperature",.7);x(this,"stop");x(this,"stopSequences");x(this,"maxTokens");x(this,"streaming",!1);x(this,"apiKey");x(this,"streamUsage",!0);x(this,"topP");x(this,"frequencyPenalty");x(this,"presencePenalty");x(this,"logprobs");x(this,"n");x(this,"logitBias");x(this,"user");x(this,"reasoningFormat");x(this,"serviceTier");x(this,"topLogprobs");x(this,"lc_serializable",!0);let r=e.apiKey||Xr("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"');let n={"User-Agent":"langchainjs",...e.defaultHeaders??{}};this.client=new SSr({apiKey:r,dangerouslyAllowBrowser:!0,baseURL:e.baseUrl,timeout:e.timeout,httpAgent:e.httpAgent,fetch:e.fetch,maxRetries:0,defaultHeaders:n,defaultQuery:e.defaultQuery}),this.apiKey=r,this.temperature=e.temperature??this.temperature,this.model=e.model,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,this.topP=e.topP,this.frequencyPenalty=e.frequencyPenalty,this.presencePenalty=e.presencePenalty,this.logprobs=e.logprobs,this.n=e.n,this.logitBias=e.logitBias,this.user=e.user}get lc_serialized_keys(){return["client","model","temperature","stop","stopSequences","maxTokens","streaming","apiKey","streamUsage","topP","frequencyPenalty","presencePenalty","logprobs","n","logitBias","user","reasoningFormat","serviceTier","topLogprobs"]}static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}get callKeys(){return[...super.callKeys,...kho]}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,r){let n=super.invocationParams(e),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,frequency_penalty:this.frequencyPenalty,function_call:e?.function_call,functions:e?.functions,logit_bias:this.logitBias,logprobs:this.logprobs,n:this.n,parallel_tool_calls:e?.parallel_tool_calls,presence_penalty:this.presencePenalty,reasoning_format:this.reasoningFormat,response_format:e?.response_format,seed:e?.seed,service_tier:this.serviceTier,stop:e?.stop??this.stopSequences,temperature:e?.temperature??this.temperature,tool_choice:zho(e?.tool_choice),tools:e?.tools?.length?e.tools.map(a=>fD(a)):void 0,top_logprobs:this.topLogprobs,top_p:this.topP,user:this.user,stream:this.streaming,...n,...o};return i.max_completion_tokens=e?.max_completion_tokens??e?.max_tokens??this.maxTokens,i.max_completion_tokens===-1&&delete i.max_completion_tokens,i}bindTools(e,r){return this.withConfig({tools:e.map(n=>fD(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r,{streaming:!0}),i=xSr(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 f=Bho(d.delta,s,c,u),p={prompt:r.promptIndex??0,completion:d.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};d.finish_reason!=null&&(m.finish_reason=d.finish_reason,m.system_fingerprint=c.system_fingerprint,m.model_name=c.model);let h=new si({message:f,text:f.content,generationInfo:m});yield h,await n?.handleLLMNewToken(h.text??"",p,void 0,void 0,void 0,{chunk:h})}if(l&&("choices"in l&&delete l.choices,yield new si({message:new Er({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=xSr(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{choices:f,...p}=s,m={text:c,message:Uho(l.message??{role:"assistant"},d,p)};m.generationInfo={...l.finish_reason?{finish_reason:l.finish_reason}:{},...l.logprobs?{logprobs:l.logprobs}:{}},u.push(m)}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"){let p;Ii(n)?(u=uw.fromZodSchema(n),p=Ci(n)):u=new j_,l=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:p}})}else if(Ii(n)){let p=Ci(n);l=this.bindTools([{type:"function",function:{name:s,description:p.description,parameters:p}}]).withConfig({tool_choice:{type:"function",function:{name:s}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:p}}),u=new lv({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.bindTools([{type:"function",function:p}]).withConfig({tool_choice:{type:"function",function:{name:s}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:n}}),u=new lv({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Au.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=Au.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Bl.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var ESr=v(()=>{OSr()});function Hho(t){return Vho.test(t)}function Who(t){let e=t,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";if(e===0)return r[0];let n=[],o=62;for(;e;)n.push(r[e%o]),e=Math.floor(e/o);return n.reverse().join("")}function Jho(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 bse(t){if(Hho(t))return t;{let e=Jho(t),r=Who(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function ilt(t){return t?typeof t=="string"?t:t.map(e=>{if(e.type==="image_url"){if(typeof e.imageUrl!="string"&&e.imageUrl?.detail){let{detail:r}=e.imageUrl;if(r!=="high"&&r!=="auto"&&r!=="low")return{type:e.type,image_url:{url:e.imageUrl.url}}}return{type:e.type,image_url:e.imageUrl}}return e}):""}var Vho,PSr=v(()=>{Vho=/^[a-zA-Z0-9]{9}$/});function MSr(t,e=0){return(ay[t[e+0]]+ay[t[e+1]]+ay[t[e+2]]+ay[t[e+3]]+"-"+ay[t[e+4]]+ay[t[e+5]]+"-"+ay[t[e+6]]+ay[t[e+7]]+"-"+ay[t[e+8]]+ay[t[e+9]]+"-"+ay[t[e+10]]+ay[t[e+11]]+ay[t[e+12]]+ay[t[e+13]]+ay[t[e+14]]+ay[t[e+15]]).toLowerCase()}var ay,uMe,RSr=v(()=>{ay=[];for(uMe=0;uMe<256;++uMe)ay.push((uMe+256).toString(16).slice(1))});function alt(){if(!lMe&&(lMe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!lMe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return lMe(Kho)}var lMe,Kho,ISr=v(()=>{Kho=new Uint8Array(16)});var Gho,slt,ASr=v(()=>{Gho=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),slt={randomUUID:Gho}});function Xho(t,e,r){if(slt.randomUUID&&!e&&!t)return slt.randomUUID();t=t||{};var n=t.random||(t.rng||alt)();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 MSr(n)}var cMe,NSr=v(()=>{ASr();ISr();RSr();cMe=Xho});var DSr=v(()=>{NSr()});var fr=S(ult=>{"use strict";Object.defineProperty(ult,"__esModule",{value:!0});ult.pathToFunc=Yho;var Zho=Object.prototype.hasOwnProperty;function Yho(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Zho.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 dMe=S(A0=>{"use strict";Object.defineProperty(A0,"__esModule",{value:!0});A0.SDK_METADATA=A0.ServerList=A0.ServerEu=void 0;A0.serverURLFromOptions=ego;var Qho=fr();A0.ServerEu="eu";A0.ServerList={[A0.ServerEu]:"https://api.mistral.ai"};function ego(t){let e=t.serverURL,r={};if(!e){let o=t.server??A0.ServerEu;e=A0.ServerList[o]||""}let n=(0,Qho.pathToFunc)(e)(r);return new URL(n)}A0.SDK_METADATA={language:"typescript",openapiDocVersion:"1.0.0",sdkVersion:"1.10.0",genVersion:"2.687.13",userAgent:"speakeasy-sdk/typescript 1.10.0 2.687.13 1.0.0 @mistralai/mistralai"}});var G9=S(fMe=>{"use strict";Object.defineProperty(fMe,"__esModule",{value:!0});fMe.readableStreamToArrayBuffer=tgo;fMe.getContentTypeFromFileName=rgo;async function tgo(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}function rgo(t){if(!t)return null;let e=t.toLowerCase().split(".").pop();return e&&{json:"application/json",xml:"application/xml",html:"text/html",htm:"text/html",txt:"text/plain",csv:"text/csv",pdf:"application/pdf",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",js:"application/javascript",css:"text/css",zip:"application/zip",tar:"application/x-tar",gz:"application/gzip",mp4:"video/mp4",mp3:"audio/mpeg",wav:"audio/wav",webp:"image/webp",ico:"image/x-icon",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",otf:"font/otf"}[e]||null}});var X9=S(EA=>{"use strict";Object.defineProperty(EA,"__esModule",{value:!0});EA.HTTPClient=void 0;EA.matchContentType=$Sr;EA.matchStatusCode=LSr;EA.matchResponse=igo;EA.isConnectionError=ago;EA.isTimeoutError=sgo;EA.isAbortError=ugo;var ngo=(t,e)=>e==null?fetch(t):fetch(t,e),llt=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||ngo}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}};EA.HTTPClient=llt;var jSr=/\s*;\s*/g;function $Sr(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(jSr),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(jSr),[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 ogo=new RegExp("^[0-9]xx$","i");function LSr(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(!ogo.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 igo(t,e,r){return LSr(t,e)&&$Sr(t,r)}function ago(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 sgo(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 ugo(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 FSr=S(pMe=>{"use strict";Object.defineProperty(pMe,"__esModule",{value:!0});pMe.CustomUserAgentHook=void 0;var lgo=dMe(),clt=class{beforeRequest(e,r){let o=`mistral-client-typescript/${lgo.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};pMe.CustomUserAgentHook=clt});var qSr=S(mMe=>{"use strict";Object.defineProperty(mMe,"__esModule",{value:!0});mMe.DeprecationWarningHook=void 0;var kSr="x-model-deprecation-timestamp",dlt=class{afterSuccess(e,r){return r.headers.has(kSr)&&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(kSr)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};mMe.DeprecationWarningHook=dlt});var USr=S(flt=>{"use strict";Object.defineProperty(flt,"__esModule",{value:!0});flt.initHooks=fgo;var cgo=FSr(),dgo=qSr();function fgo(t){let e=new cgo.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new dgo.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var BSr=S(hMe=>{"use strict";Object.defineProperty(hMe,"__esModule",{value:!0});hMe.SDKHooks=void 0;var pgo=USr(),plt=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,pgo.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}}};hMe.SDKHooks=plt});var _lt=S(pv=>{"use strict";Object.defineProperty(pv,"__esModule",{value:!0});pv.ConnectionError=pv.RequestTimeoutError=pv.RequestAbortedError=pv.InvalidRequestError=pv.UnexpectedClientError=pv.HTTPClientError=void 0;var Fq=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)}};pv.HTTPClientError=Fq;var mlt=class extends Fq{constructor(){super(...arguments),this.name="UnexpectedClientError"}};pv.UnexpectedClientError=mlt;var hlt=class extends Fq{constructor(){super(...arguments),this.name="InvalidRequestError"}};pv.InvalidRequestError=hlt;var glt=class extends Fq{constructor(){super(...arguments),this.name="RequestAbortedError"}};pv.RequestAbortedError=glt;var ylt=class extends Fq{constructor(){super(...arguments),this.name="RequestTimeoutError"}};pv.RequestTimeoutError=ylt;var blt=class extends Fq{constructor(){super(...arguments),this.name="ConnectionError"}};pv.ConnectionError=blt});var kd=S(Z9=>{"use strict";Object.defineProperty(Z9,"__esModule",{value:!0});Z9.OK=mgo;Z9.ERR=hgo;Z9.unwrap=ggo;Z9.unwrapAsync=ygo;function mgo(t){return{ok:!0,value:t}}function hgo(t){return{ok:!1,error:t}}function ggo(t){if(!t.ok)throw t.error;return t.value}async function ygo(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var _se=S(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.getParsedType=rl.ZodParsedType=rl.objectUtil=rl.util=void 0;var vlt;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(vlt||(rl.util=vlt={}));var zSr;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(zSr||(rl.objectUtil=zSr={}));rl.ZodParsedType=vlt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var bgo=t=>{switch(typeof t){case"undefined":return rl.ZodParsedType.undefined;case"string":return rl.ZodParsedType.string;case"number":return Number.isNaN(t)?rl.ZodParsedType.nan:rl.ZodParsedType.number;case"boolean":return rl.ZodParsedType.boolean;case"function":return rl.ZodParsedType.function;case"bigint":return rl.ZodParsedType.bigint;case"symbol":return rl.ZodParsedType.symbol;case"object":return Array.isArray(t)?rl.ZodParsedType.array:t===null?rl.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?rl.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?rl.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?rl.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?rl.ZodParsedType.date:rl.ZodParsedType.object;default:return rl.ZodParsedType.unknown}};rl.getParsedType=bgo});var gMe=S(kq=>{"use strict";Object.defineProperty(kq,"__esModule",{value:!0});kq.ZodError=kq.quotelessJson=kq.ZodIssueCode=void 0;var VSr=_se();kq.ZodIssueCode=VSr.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 _go=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");kq.quotelessJson=_go;var vse=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,VSr.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};kq.ZodError=vse;vse.create=t=>new vse(t)});var Slt=S(wlt=>{"use strict";Object.defineProperty(wlt,"__esModule",{value:!0});var ab=gMe(),LH=_se(),vgo=(t,e)=>{let r;switch(t.code){case ab.ZodIssueCode.invalid_type:t.received===LH.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ab.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,LH.util.jsonStringifyReplacer)}`;break;case ab.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${LH.util.joinValues(t.keys,", ")}`;break;case ab.ZodIssueCode.invalid_union:r="Invalid input";break;case ab.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${LH.util.joinValues(t.options)}`;break;case ab.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${LH.util.joinValues(t.options)}, received '${t.received}'`;break;case ab.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ab.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ab.ZodIssueCode.invalid_date:r="Invalid date";break;case ab.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}"`:LH.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ab.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ab.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 ab.ZodIssueCode.custom:r="Invalid input";break;case ab.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ab.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ab.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,LH.util.assertNever(t)}return{message:r}};wlt.default=vgo});var yMe=S(qq=>{"use strict";var wgo=qq&&qq.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qq,"__esModule",{value:!0});qq.defaultErrorMap=void 0;qq.setErrorMap=Sgo;qq.getErrorMap=Cgo;var HSr=wgo(Slt());qq.defaultErrorMap=HSr.default;var WSr=HSr.default;function Sgo(t){WSr=t}function Cgo(){return WSr}});var xlt=S(du=>{"use strict";var xgo=du&&du.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(du,"__esModule",{value:!0});du.isAsync=du.isValid=du.isDirty=du.isAborted=du.OK=du.DIRTY=du.INVALID=du.ParseStatus=du.EMPTY_PATH=du.makeIssue=void 0;du.addIssueToContext=Ego;var Tgo=yMe(),JSr=xgo(Slt()),Ogo=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}};du.makeIssue=Ogo;du.EMPTY_PATH=[];function Ego(t,e){let r=(0,Tgo.getErrorMap)(),n=(0,du.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===JSr.default?void 0:JSr.default].filter(o=>!!o)});t.common.issues.push(n)}var Clt=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 du.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 du.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}}};du.ParseStatus=Clt;du.INVALID=Object.freeze({status:"aborted"});var Pgo=t=>({status:"dirty",value:t});du.DIRTY=Pgo;var Mgo=t=>({status:"valid",value:t});du.OK=Mgo;var Rgo=t=>t.status==="aborted";du.isAborted=Rgo;var Igo=t=>t.status==="dirty";du.isDirty=Igo;var Ago=t=>t.status==="valid";du.isValid=Ago;var Ngo=t=>typeof Promise<"u"&&t instanceof Promise;du.isAsync=Ngo});var GSr=S(KSr=>{"use strict";Object.defineProperty(KSr,"__esModule",{value:!0})});var ZSr=S(bMe=>{"use strict";Object.defineProperty(bMe,"__esModule",{value:!0});bMe.errorUtil=void 0;var XSr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(XSr||(bMe.errorUtil=XSr={}))});var l0r=S(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.discriminatedUnion=Se.date=Se.boolean=Se.bigint=Se.array=Se.any=Se.coerce=Se.ZodFirstPartyTypeKind=Se.late=Se.ZodSchema=Se.Schema=Se.ZodReadonly=Se.ZodPipeline=Se.ZodBranded=Se.BRAND=Se.ZodNaN=Se.ZodCatch=Se.ZodDefault=Se.ZodNullable=Se.ZodOptional=Se.ZodTransformer=Se.ZodEffects=Se.ZodPromise=Se.ZodNativeEnum=Se.ZodEnum=Se.ZodLiteral=Se.ZodLazy=Se.ZodFunction=Se.ZodSet=Se.ZodMap=Se.ZodRecord=Se.ZodTuple=Se.ZodIntersection=Se.ZodDiscriminatedUnion=Se.ZodUnion=Se.ZodObject=Se.ZodArray=Se.ZodVoid=Se.ZodNever=Se.ZodUnknown=Se.ZodAny=Se.ZodNull=Se.ZodUndefined=Se.ZodSymbol=Se.ZodDate=Se.ZodBoolean=Se.ZodBigInt=Se.ZodNumber=Se.ZodString=Se.ZodType=void 0;Se.NEVER=Se.void=Se.unknown=Se.union=Se.undefined=Se.tuple=Se.transformer=Se.symbol=Se.string=Se.strictObject=Se.set=Se.record=Se.promise=Se.preprocess=Se.pipeline=Se.ostring=Se.optional=Se.onumber=Se.oboolean=Se.object=Se.number=Se.nullable=Se.null=Se.never=Se.nativeEnum=Se.nan=Se.map=Se.literal=Se.lazy=Se.intersection=Se.instanceof=Se.function=Se.enum=Se.effect=void 0;Se.datetimeRegex=r0r;Se.custom=o0r;var Et=gMe(),_Me=yMe(),Hr=ZSr(),Oe=xlt(),kt=_se(),D0=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},YSr=(t,e)=>{if((0,Oe.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Et.ZodError(t.common.issues);return this._error=r,this._error}}};function Yo(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var Qo=class{get description(){return this._def.description}_getType(e){return(0,kt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,kt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Oe.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,kt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,Oe.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return YSr(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,Oe.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,Oe.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,kt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,Oe.isAsync)(o)?o:Promise.resolve(o));return YSr(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:Et.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 Uw({schema:this,typeName:Wn.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 N0.create(this,this._def)}nullable(){return MA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return HD.create(this)}promise(){return zq.create(this,this._def)}or(e){return VH.create([this,e],this._def)}and(e){return HH.create(this,e,this._def)}transform(e){return new Uw({...Yo(this._def),schema:this,typeName:Wn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new XH({...Yo(this._def),innerType:this,defaultValue:r,typeName:Wn.ZodDefault})}brand(){return new wse({typeName:Wn.ZodBranded,type:this,...Yo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ZH({...Yo(this._def),innerType:this,catchValue:r,typeName:Wn.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Sse.create(this,e)}readonly(){return YH.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};Se.ZodType=Qo;Se.Schema=Qo;Se.ZodSchema=Qo;var Dgo=/^c[^\s-]{8,}$/i,jgo=/^[0-9a-z]+$/,$go=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Lgo=/^[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,Fgo=/^[a-z0-9_-]{21}$/i,kgo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qgo=/^[-+]?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)?)??$/,Ugo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Bgo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tlt,zgo=/^(?:(?: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])$/,Vgo=/^(?:(?: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])$/,Hgo=/^(([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]))$/,Wgo=/^(([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])$/,Jgo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kgo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,e0r="((\\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])))",Ggo=new RegExp(`^${e0r}$`);function t0r(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Xgo(t){return new RegExp(`^${t0r(t)}$`)}function r0r(t){let e=`${e0r}T${t0r(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 Zgo(t,e){return!!((e==="v4"||!e)&&zgo.test(t)||(e==="v6"||!e)&&Hgo.test(t))}function Ygo(t,e){if(!kgo.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Qgo(t,e){return!!((e==="v4"||!e)&&Vgo.test(t)||(e==="v6"||!e)&&Wgo.test(t))}var Uq=class t extends Qo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==kt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.string,received:i.parsedType}),Oe.INVALID}let n=new Oe.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Ugo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"email",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Tlt||(Tlt=new RegExp(Bgo,"u")),Tlt.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"emoji",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Lgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"uuid",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Fgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"nanoid",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Dgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cuid",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")jgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cuid2",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$go.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"ulid",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"url",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"regex",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?r0r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ggo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Xgo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?qgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"duration",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Zgo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"ip",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Ygo(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"jwt",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Qgo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"cidr",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Jgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"base64",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Kgo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{validation:"base64url",code:Et.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):kt.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Et.ZodIssueCode.invalid_string,...Hr.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Hr.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Hr.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Hr.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Hr.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Hr.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Hr.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Hr.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Hr.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Hr.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Hr.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Hr.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Hr.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Hr.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Hr.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,...Hr.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Hr.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Hr.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Hr.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Hr.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Hr.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Hr.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Hr.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Hr.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,Hr.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Se.ZodString=Uq;Uq.create=t=>new Uq({checks:[],typeName:Wn.ZodString,coerce:t?.coerce??!1,...Yo(t)});function eyo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var FH=class t extends Qo{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)!==kt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.number,received:i.parsedType}),Oe.INVALID}let n,o=new Oe.ParseStatus;for(let i of this._def.checks)i.kind==="int"?kt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?eyo(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.not_finite,message:i.message}),o.dirty()):kt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Hr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Hr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Hr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Hr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Hr.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Hr.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Hr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Hr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Hr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Hr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Hr.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Hr.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Hr.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Hr.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"&&kt.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Se.ZodNumber=FH;FH.create=t=>new FH({checks:[],typeName:Wn.ZodNumber,coerce:t?.coerce||!1,...Yo(t)});var kH=class t extends Qo{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)!==kt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new Oe.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):kt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.bigint,received:r.parsedType}),Oe.INVALID}gte(e,r){return this.setLimit("min",e,!0,Hr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Hr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Hr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Hr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Hr.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:Hr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Hr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Hr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Hr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Hr.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Se.ZodBigInt=kH;kH.create=t=>new kH({checks:[],typeName:Wn.ZodBigInt,coerce:t?.coerce??!1,...Yo(t)});var qH=class extends Qo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==kt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.boolean,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};Se.ZodBoolean=qH;qH.create=t=>new qH({typeName:Wn.ZodBoolean,coerce:t?.coerce||!1,...Yo(t)});var UH=class t extends Qo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==kt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.date,received:i.parsedType}),Oe.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(i,{code:Et.ZodIssueCode.invalid_date}),Oe.INVALID}let n=new Oe.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,Oe.addIssueToContext)(o,{code:Et.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):kt.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:Hr.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Hr.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Se.ZodDate=UH;UH.create=t=>new UH({checks:[],coerce:t?.coerce||!1,typeName:Wn.ZodDate,...Yo(t)});var Q9=class extends Qo{_parse(e){if(this._getType(e)!==kt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.symbol,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};Se.ZodSymbol=Q9;Q9.create=t=>new Q9({typeName:Wn.ZodSymbol,...Yo(t)});var BH=class extends Qo{_parse(e){if(this._getType(e)!==kt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.undefined,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};Se.ZodUndefined=BH;BH.create=t=>new BH({typeName:Wn.ZodUndefined,...Yo(t)});var zH=class extends Qo{_parse(e){if(this._getType(e)!==kt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.null,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};Se.ZodNull=zH;zH.create=t=>new zH({typeName:Wn.ZodNull,...Yo(t)});var Bq=class extends Qo{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,Oe.OK)(e.data)}};Se.ZodAny=Bq;Bq.create=t=>new Bq({typeName:Wn.ZodAny,...Yo(t)});var VD=class extends Qo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,Oe.OK)(e.data)}};Se.ZodUnknown=VD;VD.create=t=>new VD({typeName:Wn.ZodUnknown,...Yo(t)});var Vx=class extends Qo{_parse(e){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.never,received:r.parsedType}),Oe.INVALID}};Se.ZodNever=Vx;Vx.create=t=>new Vx({typeName:Wn.ZodNever,...Yo(t)});var e7=class extends Qo{_parse(e){if(this._getType(e)!==kt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.void,received:n.parsedType}),Oe.INVALID}return(0,Oe.OK)(e.data)}};Se.ZodVoid=e7;e7.create=t=>new e7({typeName:Wn.ZodVoid,...Yo(t)});var HD=class t extends Qo{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==kt.ZodParsedType.array)return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.array,received:r.parsedType}),Oe.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Oe.addIssueToContext)(r,{code:a?Et.ZodIssueCode.too_big:Et.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,Oe.addIssueToContext)(r,{code:Et.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 D0(r,a,r.path,s)))).then(a=>Oe.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new D0(r,a,r.path,s)));return Oe.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Hr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Hr.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Hr.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};Se.ZodArray=HD;HD.create=(t,e)=>new HD({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Wn.ZodArray,...Yo(e)});function Y9(t){if(t instanceof mv){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=N0.create(Y9(n))}return new mv({...t._def,shape:()=>e})}else return t instanceof HD?new HD({...t._def,type:Y9(t.element)}):t instanceof N0?N0.create(Y9(t.unwrap())):t instanceof MA?MA.create(Y9(t.unwrap())):t instanceof PA?PA.create(t.items.map(e=>Y9(e))):t}var mv=class t extends Qo{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=kt.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==kt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(l,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:l.parsedType}),Oe.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Vx&&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 D0(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Vx){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of s)u.push({key:{status:"valid",value:c},value:{status:"valid",value:o.data[c]}});else if(l==="strict")s.length>0&&((0,Oe.addIssueToContext)(o,{code:Et.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 D0(o,d,o.path,c)),alwaysSet:c in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,f=await c.value;l.push({key:d,value:f,alwaysSet:c.alwaysSet})}return l}).then(l=>Oe.ParseStatus.mergeObjectSync(n,l)):Oe.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Hr.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Hr.errorUtil.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Wn.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of kt.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of kt.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Y9(this)}partial(e){let r={};for(let n of kt.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of kt.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof N0;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return n0r(kt.util.objectKeys(this.shape))}};Se.ZodObject=mv;mv.create=(t,e)=>new mv({shape:()=>t,unknownKeys:"strip",catchall:Vx.create(),typeName:Wn.ZodObject,...Yo(e)});mv.strictCreate=(t,e)=>new mv({shape:()=>t,unknownKeys:"strict",catchall:Vx.create(),typeName:Wn.ZodObject,...Yo(e)});mv.lazycreate=(t,e)=>new mv({shape:t,unknownKeys:"strip",catchall:Vx.create(),typeName:Wn.ZodObject,...Yo(e)});var VH=class extends Qo{_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 Et.ZodError(s.ctx.common.issues));return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_union,unionErrors:a}),Oe.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new Et.ZodError(u));return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_union,unionErrors:s}),Oe.INVALID}}get options(){return this._def.options}};Se.ZodUnion=VH;VH.create=(t,e)=>new VH({options:t,typeName:Wn.ZodUnion,...Yo(e)});var zD=t=>t instanceof WH?zD(t.schema):t instanceof Uw?zD(t.innerType()):t instanceof JH?[t.value]:t instanceof KH?t.options:t instanceof GH?kt.util.objectValues(t.enum):t instanceof XH?zD(t._def.innerType):t instanceof BH?[void 0]:t instanceof zH?[null]:t instanceof N0?[void 0,...zD(t.unwrap())]:t instanceof MA?[null,...zD(t.unwrap())]:t instanceof wse||t instanceof YH?zD(t.unwrap()):t instanceof ZH?zD(t._def.innerType):[],vMe=class t extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.object)return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:r.parsedType}),Oe.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Oe.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=zD(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:Wn.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Yo(n)})}};Se.ZodDiscriminatedUnion=vMe;function Olt(t,e){let r=(0,kt.getParsedType)(t),n=(0,kt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===kt.ZodParsedType.object&&n===kt.ZodParsedType.object){let o=kt.util.objectKeys(e),i=kt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Olt(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===kt.ZodParsedType.array&&n===kt.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=Olt(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===kt.ZodParsedType.date&&n===kt.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var HH=class extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,Oe.isAborted)(i)||(0,Oe.isAborted)(a))return Oe.INVALID;let s=Olt(i.value,a.value);return s.valid?(((0,Oe.isDirty)(i)||(0,Oe.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_intersection_types}),Oe.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Se.ZodIntersection=HH;HH.create=(t,e,r)=>new HH({left:t,right:e,typeName:Wn.ZodIntersection,...Yo(r)});var PA=class t extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kt.ZodParsedType.array)return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.array,received:n.parsedType}),Oe.INVALID;if(n.data.length<this._def.items.length)return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Oe.addIssueToContext)(n,{code:Et.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 D0(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Oe.ParseStatus.mergeArray(r,a)):Oe.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Se.ZodTuple=PA;PA.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new PA({items:t,typeName:Wn.ZodTuple,rest:null,...Yo(e)})};var wMe=class t extends Qo{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!==kt.ZodParsedType.object)return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.object,received:n.parsedType}),Oe.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new D0(n,s,n.path,s)),value:a._parse(new D0(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Oe.ParseStatus.mergeObjectAsync(r,o):Oe.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Qo?new t({keyType:e,valueType:r,typeName:Wn.ZodRecord,...Yo(n)}):new t({keyType:Uq.create(),valueType:e,typeName:Wn.ZodRecord,...Yo(r)})}};Se.ZodRecord=wMe;var t7=class extends Qo{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!==kt.ZodParsedType.map)return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.map,received:n.parsedType}),Oe.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new D0(n,s,n.path,[l,"key"])),value:i._parse(new D0(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return Oe.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return Oe.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};Se.ZodMap=t7;t7.create=(t,e,r)=>new t7({valueType:e,keyType:t,typeName:Wn.ZodMap,...Yo(r)});var r7=class t extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==kt.ZodParsedType.set)return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.set,received:n.parsedType}),Oe.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let c of u){if(c.status==="aborted")return Oe.INVALID;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new D0(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:Hr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Hr.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Se.ZodSet=r7;r7.create=(t,e)=>new r7({valueType:t,minSize:null,maxSize:null,typeName:Wn.ZodSet,...Yo(e)});var SMe=class t extends Qo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.function)return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.function,received:r.parsedType}),Oe.INVALID;function n(s,u){return(0,Oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,_Me.getErrorMap)(),_Me.defaultErrorMap].filter(l=>!!l),issueData:{code:Et.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Oe.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,_Me.getErrorMap)(),_Me.defaultErrorMap].filter(l=>!!l),issueData:{code:Et.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof zq){let s=this;return(0,Oe.OK)(async function(...u){let l=new Et.ZodError([]),c=await s._def.args.parseAsync(u,i).catch(p=>{throw l.addIssue(n(u,p)),l}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw l.addIssue(o(d,p)),l})})}else{let s=this;return(0,Oe.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Et.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 Et.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:PA.create(e).rest(VD.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||PA.create([]).rest(VD.create()),returns:r||VD.create(),typeName:Wn.ZodFunction,...Yo(n)})}};Se.ZodFunction=SMe;var WH=class extends Qo{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Se.ZodLazy=WH;WH.create=(t,e)=>new WH({getter:t,typeName:Wn.ZodLazy,...Yo(e)});var JH=class extends Qo{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(r,{received:r.data,code:Et.ZodIssueCode.invalid_literal,expected:this._def.value}),Oe.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};Se.ZodLiteral=JH;JH.create=(t,e)=>new JH({value:t,typeName:Wn.ZodLiteral,...Yo(e)});function n0r(t,e){return new KH({values:t,typeName:Wn.ZodEnum,...Yo(e)})}var KH=class t extends Qo{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Oe.addIssueToContext)(r,{expected:kt.util.joinValues(n),received:r.parsedType,code:Et.ZodIssueCode.invalid_type}),Oe.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Oe.addIssueToContext)(r,{received:r.data,code:Et.ZodIssueCode.invalid_enum_value,options:n}),Oe.INVALID}return(0,Oe.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Se.ZodEnum=KH;KH.create=n0r;var GH=class extends Qo{_parse(e){let r=kt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==kt.ZodParsedType.string&&n.parsedType!==kt.ZodParsedType.number){let o=kt.util.objectValues(r);return(0,Oe.addIssueToContext)(n,{expected:kt.util.joinValues(o),received:n.parsedType,code:Et.ZodIssueCode.invalid_type}),Oe.INVALID}if(this._cache||(this._cache=new Set(kt.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=kt.util.objectValues(r);return(0,Oe.addIssueToContext)(n,{received:n.data,code:Et.ZodIssueCode.invalid_enum_value,options:o}),Oe.INVALID}return(0,Oe.OK)(e.data)}get enum(){return this._def.values}};Se.ZodNativeEnum=GH;GH.create=(t,e)=>new GH({values:t,typeName:Wn.ZodNativeEnum,...Yo(e)});var zq=class extends Qo{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==kt.ZodParsedType.promise&&r.common.async===!1)return(0,Oe.addIssueToContext)(r,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.promise,received:r.parsedType}),Oe.INVALID;let n=r.parsedType===kt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Oe.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Se.ZodPromise=zq;zq.create=(t,e)=>new zq({type:t,typeName:Wn.ZodPromise,...Yo(e)});var Uw=class extends Qo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Wn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{(0,Oe.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Oe.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Oe.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Oe.DIRTY)(u.value):u});{if(r.value==="aborted")return Oe.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Oe.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Oe.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Oe.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Oe.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,Oe.isValid)(a))return Oe.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,Oe.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Oe.INVALID);kt.util.assertNever(o)}};Se.ZodEffects=Uw;Se.ZodTransformer=Uw;Uw.create=(t,e,r)=>new Uw({schema:t,typeName:Wn.ZodEffects,effect:e,...Yo(r)});Uw.createWithPreprocess=(t,e,r)=>new Uw({schema:e,effect:{type:"preprocess",transform:t},typeName:Wn.ZodEffects,...Yo(r)});var N0=class extends Qo{_parse(e){return this._getType(e)===kt.ZodParsedType.undefined?(0,Oe.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Se.ZodOptional=N0;N0.create=(t,e)=>new N0({innerType:t,typeName:Wn.ZodOptional,...Yo(e)});var MA=class extends Qo{_parse(e){return this._getType(e)===kt.ZodParsedType.null?(0,Oe.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Se.ZodNullable=MA;MA.create=(t,e)=>new MA({innerType:t,typeName:Wn.ZodNullable,...Yo(e)});var XH=class extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===kt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Se.ZodDefault=XH;XH.create=(t,e)=>new XH({innerType:t,typeName:Wn.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Yo(e)});var ZH=class extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,Oe.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Et.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Et.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Se.ZodCatch=ZH;ZH.create=(t,e)=>new ZH({innerType:t,typeName:Wn.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Yo(e)});var n7=class extends Qo{_parse(e){if(this._getType(e)!==kt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,Oe.addIssueToContext)(n,{code:Et.ZodIssueCode.invalid_type,expected:kt.ZodParsedType.nan,received:n.parsedType}),Oe.INVALID}return{status:"valid",value:e.data}}};Se.ZodNaN=n7;n7.create=t=>new n7({typeName:Wn.ZodNaN,...Yo(t)});Se.BRAND=Symbol("zod_brand");var wse=class extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};Se.ZodBranded=wse;var Sse=class t extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Oe.INVALID:i.status==="dirty"?(r.dirty(),(0,Oe.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Oe.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Wn.ZodPipeline})}};Se.ZodPipeline=Sse;var YH=class extends Qo{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,Oe.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Oe.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Se.ZodReadonly=YH;YH.create=(t,e)=>new YH({innerType:t,typeName:Wn.ZodReadonly,...Yo(e)});function QSr(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function o0r(t,e={},r){return t?Bq.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=QSr(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=QSr(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Bq.create()}Se.late={object:mv.lazycreate};var Wn;(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"})(Wn||(Se.ZodFirstPartyTypeKind=Wn={}));var tyo=(t,e={message:`Input not instance of ${t.name}`})=>o0r(r=>r instanceof t,e);Se.instanceof=tyo;var i0r=Uq.create;Se.string=i0r;var a0r=FH.create;Se.number=a0r;var ryo=n7.create;Se.nan=ryo;var nyo=kH.create;Se.bigint=nyo;var s0r=qH.create;Se.boolean=s0r;var oyo=UH.create;Se.date=oyo;var iyo=Q9.create;Se.symbol=iyo;var ayo=BH.create;Se.undefined=ayo;var syo=zH.create;Se.null=syo;var uyo=Bq.create;Se.any=uyo;var lyo=VD.create;Se.unknown=lyo;var cyo=Vx.create;Se.never=cyo;var dyo=e7.create;Se.void=dyo;var fyo=HD.create;Se.array=fyo;var pyo=mv.create;Se.object=pyo;var myo=mv.strictCreate;Se.strictObject=myo;var hyo=VH.create;Se.union=hyo;var gyo=vMe.create;Se.discriminatedUnion=gyo;var yyo=HH.create;Se.intersection=yyo;var byo=PA.create;Se.tuple=byo;var _yo=wMe.create;Se.record=_yo;var vyo=t7.create;Se.map=vyo;var wyo=r7.create;Se.set=wyo;var Syo=SMe.create;Se.function=Syo;var Cyo=WH.create;Se.lazy=Cyo;var xyo=JH.create;Se.literal=xyo;var Tyo=KH.create;Se.enum=Tyo;var Oyo=GH.create;Se.nativeEnum=Oyo;var Eyo=zq.create;Se.promise=Eyo;var u0r=Uw.create;Se.effect=u0r;Se.transformer=u0r;var Pyo=N0.create;Se.optional=Pyo;var Myo=MA.create;Se.nullable=Myo;var Ryo=Uw.createWithPreprocess;Se.preprocess=Ryo;var Iyo=Sse.create;Se.pipeline=Iyo;var Ayo=()=>i0r().optional();Se.ostring=Ayo;var Nyo=()=>a0r().optional();Se.onumber=Nyo;var Dyo=()=>s0r().optional();Se.oboolean=Dyo;Se.coerce={string:t=>Uq.create({...t,coerce:!0}),number:t=>FH.create({...t,coerce:!0}),boolean:t=>qH.create({...t,coerce:!0}),bigint:t=>kH.create({...t,coerce:!0}),date:t=>UH.create({...t,coerce:!0})};Se.NEVER=Oe.INVALID});var Elt=S(j0=>{"use strict";var jyo=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]}),o7=j0&&j0.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jyo(e,t,r)};Object.defineProperty(j0,"__esModule",{value:!0});o7(yMe(),j0);o7(xlt(),j0);o7(GSr(),j0);o7(_se(),j0);o7(l0r(),j0);o7(gMe(),j0)});var ae=S(hv=>{"use strict";var c0r=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]}),$yo=hv&&hv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lyo=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)&&c0r(e,t,r);return $yo(e,t),e},Fyo=hv&&hv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&c0r(e,t,r)};Object.defineProperty(hv,"__esModule",{value:!0});hv.z=void 0;var d0r=Lyo(Elt());hv.z=d0r;Fyo(Elt(),hv);hv.default=d0r});var Rlt=S(Zh=>{"use strict";var kyo=Zh&&Zh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qyo=Zh&&Zh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uyo=Zh&&Zh.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kyo(r,e,n[o]);return qyo(r,e),r}}();Object.defineProperty(Zh,"__esModule",{value:!0});Zh.zodInbound=Zh.zodOutbound=void 0;Zh.bytesToBase64=f0r;Zh.bytesFromBase64=Plt;Zh.stringToBytes=Mlt;Zh.stringFromBytes=p0r;Zh.stringToBase64=Byo;Zh.stringFromBase64=zyo;var CMe=Uyo(ae());function f0r(t){return btoa(String.fromCodePoint(...t))}function Plt(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function Mlt(t){return new TextEncoder().encode(t)}function p0r(t){return new TextDecoder().decode(t)}function Byo(t){return f0r(Mlt(t))}function zyo(t){return p0r(Plt(t))}Zh.zodOutbound=CMe.instanceof(Uint8Array).or(CMe.string().transform(Mlt));Zh.zodInbound=CMe.instanceof(Uint8Array).or(CMe.string().transform(Plt))});var Alt=S(Ilt=>{"use strict";Object.defineProperty(Ilt,"__esModule",{value:!0});Ilt.isPlainObject=Vyo;function Vyo(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 Cr=S(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.encodeDeepObjectQuery=aa.encodePipeDelimitedQuery=aa.encodeSpaceDelimitedQuery=aa.encodeFormQuery=aa.encodeJSONQuery=aa.encodeSimple=aa.encodePipeDelimited=aa.encodeSpaceDelimited=aa.encodeForm=aa.EncodingError=void 0;aa.encodeMatrix=Hyo;aa.encodeLabel=Wyo;aa.encodeBodyForm=Jyo;aa.encodeDeepObject=h0r;aa.encodeDeepObjectObject=Dlt;aa.encodeJSON=g0r;aa.queryJoin=y0r;aa.queryEncoder=a7;aa.appendForm=Gyo;var m0r=Rlt(),Hx=Alt(),Cse=class extends Error{constructor(e){super(e),this.name="EncodingError"}};aa.EncodingError=Cse;function Hyo(t,e,r){let n="",o=r?.explode?xse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(i7(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=Tse(u,f=>`${a(f)}`)?.join(","):(0,Hx.isPlainObject)(u)?c=TMe(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 Wyo(t,e,r){let n="",o=r?.explode?xse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(i7(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=Tse(u,c=>`${a(c)}`)?.join("."):(0,Hx.isPlainObject)(u)?l=TMe(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Hx.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function Nlt(t){return(e,r,n)=>{let o="",i=n?.explode?xse(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(i7(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=Tse(c,p=>`${s(p)}`)?.join(u):(0,Hx.isPlainObject)(c)?f=TMe(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)}}aa.encodeForm=Nlt(",");aa.encodeSpaceDelimited=Nlt(" ");aa.encodePipeDelimited=Nlt("|");function Jyo(t,e,r){let n="",o=r?.explode?xse(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(i7(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,Hx.isPlainObject)(u)?c=JSON.stringify(u,xMe):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function h0r(t,e,r){if(e!=null){if(!(0,Hx.isPlainObject)(e))throw new Cse(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return Dlt(t,e,r)}}function Dlt(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,Hx.isPlainObject)(e))throw new Cse(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,Hx.isPlainObject)(a)){let c=Dlt(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=Tse(u,c=>`${o(s)}=${o(i7(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function g0r(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,xMe));return r?.explode?o:`${n(t)}=${o}`}var Kyo=(t,e,r)=>{let n="",o=r?.explode?xse(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(i7(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=Tse(u,c=>`${a(c)}`)?.join(","):(0,Hx.isPlainObject)(u)?l=TMe(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,Hx.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};aa.encodeSimple=Kyo;function xse(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,Hx.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function i7(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,m0r.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,xMe):`${t}`}function xMe(t,e){return e instanceof Uint8Array?(0,m0r.bytesToBase64)(e):e}function Tse(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 TMe(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 y0r(...t){return t.filter(Boolean).join("&")}function a7(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 y0r(...i)}}aa.encodeJSONQuery=a7(g0r);aa.encodeFormQuery=a7(aa.encodeForm);aa.encodeSpaceDelimitedQuery=a7(aa.encodeSpaceDelimited);aa.encodePipeDelimitedQuery=a7(aa.encodePipeDelimited);aa.encodeDeepObjectQuery=a7(h0r);function Gyo(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 b0r=S(jlt=>{"use strict";Object.defineProperty(jlt,"__esModule",{value:!0});jlt.dlv=Xyo;function Xyo(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 Llt=S(Bw=>{"use strict";var Zyo=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]}),Yyo=Bw&&Bw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qyo=Bw&&Bw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zyo(r,e,n[o]);return Yyo(r,e),r}}();Object.defineProperty(Bw,"__esModule",{value:!0});Bw.envSchema=void 0;Bw.env=ebo;Bw.resetEnv=tbo;var _0r=b0r(),$lt=Qyo(ae());Bw.envSchema=$lt.object({MISTRAL_API_KEY:$lt.string().optional(),MISTRAL_DEBUG:$lt.coerce.boolean().optional()});var Ose;function ebo(){return Ose||(Ose=Bw.envSchema.parse((0,_0r.dlv)(globalThis,"process.env")??(0,_0r.dlv)(globalThis,"Deno.env")??{}),Ose)}function tbo(){Ose=void 0}});var w0r=S(e3=>{"use strict";Object.defineProperty(e3,"__esModule",{value:!0});e3.TemporaryError=e3.PermanentError=void 0;e3.retry=nbo;var v0r=X9(),rbo={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},Ese=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)}};e3.PermanentError=Ese;var QH=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};e3.TemporaryError=QH;async function nbo(t,e){switch(e.config.strategy){case"backoff":return sbo(obo(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??rbo);default:return await t()}}function obo(t,e){return async()=>{try{let r=await t();if(abo(r,e.statusCodes))throw new QH("Response failed with retryable status code",r);return r}catch(r){throw r instanceof QH||e.retryConnectionErrors&&((0,v0r.isTimeoutError)(r)||(0,v0r.isConnectionError)(r))?r:new Ese("Permanent error",{cause:r})}}}var ibo=new RegExp("^[0-9]xx$","i");function abo(t,e){let r=`${t.status}`;return e.some(n=>{if(!ibo.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 sbo(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 Ese)throw u.cause;if(Date.now()-a>r){if(u instanceof QH)return u.response;throw u}let c=0;u instanceof QH&&(c=ubo(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await lbo(d),s++}}function ubo(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 lbo(t){return new Promise(e=>setTimeout(e,t))}});var Wc=S(Hq=>{"use strict";var Pse=Hq&&Hq.__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},$0=Hq&&Hq.__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)},EMe,RA,WD;Object.defineProperty(Hq,"__esModule",{value:!0});Hq.ClientSDK=void 0;var S0r=BSr(),s7=_lt(),Vq=kd(),cbo=Rlt(),C0r=dMe(),dbo=Cr(),fbo=Llt(),IA=X9(),pbo=w0r(),OMe=typeof globalThis>"u"?null:globalThis,mbo=typeof OMe=="object"&&OMe!=null&&"importScripts"in OMe&&typeof OMe.importScripts=="function",hbo=mbo||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",Flt=class{constructor(e={}){EMe.set(this,void 0),RA.set(this,void 0),WD.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof S0r.SDKHooks?Pse(this,RA,r.hooks,"f"):Pse(this,RA,new S0r.SDKHooks,"f");let n=(0,C0r.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=$0(this,RA,"f").sdkInit({baseURL:n,client:e.httpClient||new IA.HTTPClient});this._baseURL=o,Pse(this,EMe,i,"f"),this._options={...e,hooks:$0(this,RA,"f")},Pse(this,WD,this._options.debugLogger,"f"),!$0(this,WD,"f")&&(0,fbo.env)().MISTRAL_DEBUG&&Pse(this,WD,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,Vq.ERR)(new s7.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[O,E]of Object.entries(u?.queryParams||{})){let P=(0,dbo.encodeForm)(O,E,{charEncoding:"percent"});typeof P<"u"&&p.push(P)}if(p.length&&(f+=`&${p.join("&")}`),f){let O=f.startsWith("&")?f.slice(1):f;c.search=`?${O}`}let m=new Headers(s),h=u?.basic.username,y=u?.basic.password;if(h!=null||y!=null){let O=(0,cbo.stringToBase64)([h||"",y||""].join(":"));m.set("Authorization",`Basic ${O}`)}let g=new Headers(u?.headers||{});for(let[O,E]of g)m.set(O,E);let b=m.get("cookie")||"";for(let[O,E]of Object.entries(u?.cookies||{}))b+=`; ${O}=${E}`;b=b.startsWith("; ")?b.slice(2):b,m.set("cookie",b);let _=new Headers(n?.headers??n?.fetchOptions?.headers);for(let[O,E]of _)m.set(O,E);hbo||m.set(r.uaHeader??"user-agent",r.userAgent??C0r.SDK_METADATA.userAgent);let w={...n?.fetchOptions,...n};if(!w?.signal&&r.timeoutMs&&r.timeoutMs>0){let O=AbortSignal.timeout(r.timeoutMs);w.signal=O}r.body instanceof ReadableStream&&Object.assign(w,{duplex:"half"});let T;try{T=$0(this,RA,"f").beforeCreateRequest(e,{url:c,options:{...w,body:r.body??null,headers:m,method:o}})}catch(O){return(0,Vq.ERR)(new s7.UnexpectedClientError("Create request hook failed to execute",{cause:O}))}return(0,Vq.OK)(new Request(T.url,T.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,pbo.retry)(async()=>{let i=await $0(this,RA,"f").beforeRequest(n,e.clone());await gbo($0(this,WD,"f"),i).catch(s=>$0(this,WD,"f")?.log("Failed to log request:",s));let a=await $0(this,EMe,"f").request(i);try{if((0,IA.matchStatusCode)(a,o)){let s=await $0(this,RA,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await $0(this,RA,"f").afterSuccess(n,a)}finally{await ybo($0(this,WD,"f"),a,i).catch(s=>$0(this,WD,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,Vq.OK)(i),i=>{switch(!0){case(0,IA.isAbortError)(i):return(0,Vq.ERR)(new s7.RequestAbortedError("Request aborted by client",{cause:i}));case(0,IA.isTimeoutError)(i):return(0,Vq.ERR)(new s7.RequestTimeoutError("Request timed out",{cause:i}));case(0,IA.isConnectionError)(i):return(0,Vq.ERR)(new s7.ConnectionError("Unable to make request",{cause:i}));default:return(0,Vq.ERR)(new s7.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};Hq.ClientSDK=Flt;EMe=new WeakMap,RA=new WeakMap,WD=new WeakMap;var T0r=/(application|text)\/.*?\+*json.*/,x0r=/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;async function gbo(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 T0r.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 ybo(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,IA.matchContentType)(e,"application/json")||T0r.test(o)&&!x0r.test(o)):t.log(await e.clone().json());break;case((0,IA.matchContentType)(e,"application/jsonl")||x0r.test(o)):t.log(await e.clone().text());break;case(0,IA.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,IA.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,IA.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 MMe=S(PMe=>{"use strict";Object.defineProperty(PMe,"__esModule",{value:!0});PMe.MistralError=void 0;var klt=class extends Error{constructor(e,r){super(e),this.statusCode=r.response.status,this.body=r.body,this.headers=r.response.headers,this.contentType=r.response.headers.get("content-type")||"",this.rawResponse=r.response,this.name="MistralError"}};PMe.MistralError=klt});var RMe=S(Wx=>{"use strict";var bbo=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]}),_bo=Wx&&Wx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vbo=Wx&&Wx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bbo(r,e,n[o]);return _bo(r,e),r}}();Object.defineProperty(Wx,"__esModule",{value:!0});Wx.SDKValidationError=void 0;Wx.formatZodError=Ult;var wbo=vbo(ae()),qlt=class extends Error{static[Symbol.hasInstance](e){return!(!(e instanceof Error)||!("rawValue"in e)||!("rawMessage"in e)||!("pretty"in e)||typeof e.pretty!="function")}constructor(e,r,n){super(`${e}: ${r}`),this.name="SDKValidationError",this.cause=r,this.rawValue=n,this.rawMessage=e}pretty(){return this.cause instanceof wbo.ZodError?`${this.rawMessage}
|
||
${Ult(this.cause)}`:this.toString()}};Wx.SDKValidationError=qlt;function Ult(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(`${Ult(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var zlt=S(AA=>{"use strict";var Sbo=AA&&AA.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cbo=AA&&AA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xbo=AA&&AA.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Sbo(r,e,n[o]);return Cbo(r,e),r}}();Object.defineProperty(AA,"__esModule",{value:!0});AA.ResponseValidationError=void 0;var Tbo=xbo(ae()),Obo=MMe(),Ebo=RMe(),Blt=class extends Obo.MistralError{constructor(e,r){super(e,r),this.name="ResponseValidationError",this.cause=r.cause,this.rawValue=r.rawValue,this.rawMessage=r.rawMessage}pretty(){return this.cause instanceof Tbo.ZodError?`${this.rawMessage}
|
||
${(0,Ebo.formatZodError)(this.cause)}`:this.toString()}};AA.ResponseValidationError=Blt});var Hlt=S(IMe=>{"use strict";Object.defineProperty(IMe,"__esModule",{value:!0});IMe.SDKError=void 0;var Pbo=MMe(),Vlt=class extends Pbo.MistralError{constructor(e,r){e&&(e+=": "),e+=`Status ${r.response.status}`;let n=r.response.headers.get("content-type")||'""';n!=="application/json"&&(e+=` Content-Type ${n.includes(" ")?`"${n}"`:n}`);let o=r.body||'""';e+=o.length>100?`
|
||
`:". ";let i=o;if(o.length>1e4){let a=o.substring(0,1e4),s=o.length-1e4;i=`${a}...and ${s} more chars`}e+=`Body: ${i}`,e=e.trim(),super(e,r),this.name="SDKError"}};IMe.SDKError=Vlt});var gr=S(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.jsonErr=Ibo;Km.json=Abo;Km.jsonl=Nbo;Km.jsonlErr=Dbo;Km.textErr=jbo;Km.text=$bo;Km.bytesErr=Lbo;Km.bytes=Fbo;Km.streamErr=kbo;Km.stream=qbo;Km.sseErr=Ubo;Km.sse=Bbo;Km.nilErr=zbo;Km.nil=Vbo;Km.fail=Hbo;Km.match=Wbo;Km.unpackHeaders=AMe;var Mbo=zlt(),O0r=Hlt(),E0r=kd(),P0r=X9(),M0r=Alt(),Rbo={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function Ibo(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function Abo(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function Nbo(t,e,r){return{...r,enc:"jsonl",codes:t,schema:e}}function Dbo(t,e,r){return{...r,err:!0,enc:"jsonl",codes:t,schema:e}}function jbo(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function $bo(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function Lbo(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function Fbo(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function kbo(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function qbo(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function Ubo(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function Bbo(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function zbo(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function Vbo(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Hbo(t){return{enc:"fail",codes:t}}function Wbo(...t){return async function(r,n,o){let i,a;for(let d of t){let{codes:f}=d,p="ctype"in d?d.ctype:Rbo[d.enc];if(p&&(0,P0r.matchResponse)(r,f,p)){a=d;break}else if(!p&&(0,P0r.matchStatusCode)(r,f)){a=d;break}}if(!a)return[{ok:!1,error:new O0r.SDKError("Unexpected Status or Content-Type",{response:r,request:n,body:await r.text().catch(()=>"")})},i];let s=a.enc,u="";switch(s){case"json":u=await r.text(),i=JSON.parse(u);break;case"jsonl":i=r.body;break;case"bytes":i=new Uint8Array(await r.arrayBuffer());break;case"stream":i=r.body;break;case"text":u=await r.text(),i=u;break;case"sse":i=r.body;break;case"nil":u=await r.text(),i=void 0;break;case"fail":u=await r.text(),i=u;break;default:throw new Error(`Unsupported response type: ${s}`)}if(a.enc==="fail")return[{ok:!1,error:new O0r.SDKError("API error occurred",{request:n,response:r,body:u})},i];let l=a.key||o?.resultKey,c;if("err"in a?c={...o?.extraFields,...a.hdrs?{Headers:AMe(r.headers)}:null,...(0,M0r.isPlainObject)(i)?i:null,request$:n,response$:r,body$:u}:l?c={...o?.extraFields,...a.hdrs?{Headers:AMe(r.headers)}:null,[l]:i}:a.hdrs?c={...o?.extraFields,...a.hdrs?{Headers:AMe(r.headers)}:null,...(0,M0r.isPlainObject)(i)?i:null}:c=i,"err"in a){let d=R0r(c,f=>a.schema.parse(f),"Response validation failed",{request:n,response:r,body:u});return[d.ok?{ok:!1,error:d.value}:d,i]}else return[R0r(c,d=>a.schema.parse(d),"Response validation failed",{request:n,response:r,body:u}),i]}}var Jbo=/, */;function AMe(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Jbo);return e}function R0r(t,e,r,n){try{return(0,E0r.OK)(e(t))}catch(o){return(0,E0r.ERR)(new Mbo.ResponseValidationError(r,{cause:o,rawValue:t,rawMessage:r,...n}))}}});var ce=S(Wq=>{"use strict";Object.defineProperty(Wq,"__esModule",{value:!0});Wq.invariant=Kbo;Wq.remap=Gbo;Wq.combineSignals=Xbo;Wq.abortSignalAny=I0r;Wq.compactMap=Zbo;Wq.allRequired=Ybo;var Wlt=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Kbo(t,e){if(!t)throw new Wlt(e)}function Gbo(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 Xbo(...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):I0r(e)}}function I0r(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 Zbo(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function Ybo(t){if(!Object.values(t).every(e=>e==null))return t}});var ee=S(Mse=>{"use strict";Object.defineProperty(Mse,"__esModule",{value:!0});Mse.parse=e_o;Mse.safeParse=t_o;Mse.collectExtraKeys=r_o;var Qbo=ae(),N0r=RMe(),A0r=kd();function e_o(t,e,r){try{return e(t)}catch(n){throw n instanceof Qbo.ZodError?new N0r.SDKValidationError(r,n,t):n}}function t_o(t,e,r){try{return(0,A0r.OK)(e(t))}catch(n){return(0,A0r.ERR)(new N0r.SDKValidationError(r,n,t))}}function r_o(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 yr=S(JD=>{"use strict";Object.defineProperty(JD,"__esModule",{value:!0});JD.SecurityError=JD.SecurityErrorCode=void 0;JD.resolveSecurity=D0r;JD.resolveGlobalSecurity=i_o;JD.extractSecurity=a_o;var n_o=Llt(),DMe;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(DMe||(JD.SecurityErrorCode=DMe={}));var jMe=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(DMe.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(DMe.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};JD.SecurityError=jMe;function D0r(...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 typeof o.value=="string"?!!o.value: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":o_o(e,n);break;case"http:custom":break;case"http:bearer":NMe(e,n);break;case"oauth2":NMe(e,n);break;case"oauth2:password":NMe(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":NMe(e,n);break;default:throw jMe.unrecognizedType(o)}}),e)}function o_o(t,e){e.value!=null&&(t.basic=e.value)}function NMe(t,e){if(typeof e.value!="string"||!e.value)return;let r=e.value;r.slice(0,7).toLowerCase()!=="bearer "&&(r=`Bearer ${r}`),e.fieldName!==void 0&&(t.headers[e.fieldName]=r)}function i_o(t){return D0r([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,n_o.env)().MISTRAL_API_KEY}])}async function a_o(t){if(t!=null)return typeof t=="function"?t():t}});var Jq=S(sa=>{"use strict";var s_o=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]}),u_o=sa&&sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l_o=sa&&sa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s_o(r,e,n[o]);return u_o(r,e),r}}();Object.defineProperty(sa,"__esModule",{value:!0});sa.CodeInterpreterTool$=sa.CodeInterpreterTool$outboundSchema=sa.CodeInterpreterTool$inboundSchema=sa.CodeInterpreterToolType$=sa.CodeInterpreterToolType$outboundSchema=sa.CodeInterpreterToolType$inboundSchema=sa.CodeInterpreterToolType=void 0;sa.codeInterpreterToolToJSON=d_o;sa.codeInterpreterToolFromJSON=f_o;var Jlt=l_o(ae()),c_o=ee();sa.CodeInterpreterToolType={CodeInterpreter:"code_interpreter"};sa.CodeInterpreterToolType$inboundSchema=Jlt.nativeEnum(sa.CodeInterpreterToolType);sa.CodeInterpreterToolType$outboundSchema=sa.CodeInterpreterToolType$inboundSchema;var j0r;(function(t){t.inboundSchema=sa.CodeInterpreterToolType$inboundSchema,t.outboundSchema=sa.CodeInterpreterToolType$outboundSchema})(j0r||(sa.CodeInterpreterToolType$=j0r={}));sa.CodeInterpreterTool$inboundSchema=Jlt.object({type:sa.CodeInterpreterToolType$inboundSchema.default("code_interpreter")});sa.CodeInterpreterTool$outboundSchema=Jlt.object({type:sa.CodeInterpreterToolType$outboundSchema.default("code_interpreter")});var $0r;(function(t){t.inboundSchema=sa.CodeInterpreterTool$inboundSchema,t.outboundSchema=sa.CodeInterpreterTool$outboundSchema})($0r||(sa.CodeInterpreterTool$=$0r={}));function d_o(t){return JSON.stringify(sa.CodeInterpreterTool$outboundSchema.parse(t))}function f_o(t){return(0,c_o.safeParse)(t,e=>sa.CodeInterpreterTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CodeInterpreterTool' from JSON")}});var Klt=S(qd=>{"use strict";var p_o=qd&&qd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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_o=qd&&qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h_o=qd&&qd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p_o(r,e,n[o]);return m_o(r,e),r}}();Object.defineProperty(qd,"__esModule",{value:!0});qd.CompletionArgsStop$=qd.CompletionArgsStop$outboundSchema=qd.CompletionArgsStop$inboundSchema=void 0;qd.completionArgsStopToJSON=y_o;qd.completionArgsStopFromJSON=b_o;var Kq=h_o(ae()),g_o=ee();qd.CompletionArgsStop$inboundSchema=Kq.union([Kq.string(),Kq.array(Kq.string())]);qd.CompletionArgsStop$outboundSchema=Kq.union([Kq.string(),Kq.array(Kq.string())]);var L0r;(function(t){t.inboundSchema=qd.CompletionArgsStop$inboundSchema,t.outboundSchema=qd.CompletionArgsStop$outboundSchema})(L0r||(qd.CompletionArgsStop$=L0r={}));function y_o(t){return JSON.stringify(qd.CompletionArgsStop$outboundSchema.parse(t))}function b_o(t){return(0,g_o.safeParse)(t,e=>qd.CompletionArgsStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgsStop' from JSON")}});var t3=S(Ud=>{"use strict";var __o=Ud&&Ud.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v_o=Ud&&Ud.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w_o=Ud&&Ud.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&__o(r,e,n[o]);return v_o(r,e),r}}();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.Prediction$=Ud.Prediction$outboundSchema=Ud.Prediction$inboundSchema=void 0;Ud.predictionToJSON=C_o;Ud.predictionFromJSON=x_o;var u7=w_o(ae()),S_o=ee();Ud.Prediction$inboundSchema=u7.object({type:u7.literal("content").default("content"),content:u7.string().default("")});Ud.Prediction$outboundSchema=u7.object({type:u7.literal("content").default("content"),content:u7.string().default("")});var F0r;(function(t){t.inboundSchema=Ud.Prediction$inboundSchema,t.outboundSchema=Ud.Prediction$outboundSchema})(F0r||(Ud.Prediction$=F0r={}));function C_o(t){return JSON.stringify(Ud.Prediction$outboundSchema.parse(t))}function x_o(t){return(0,S_o.safeParse)(t,e=>Ud.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var Glt=S(Bd=>{"use strict";var T_o=Bd&&Bd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O_o=Bd&&Bd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E_o=Bd&&Bd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T_o(r,e,n[o]);return O_o(r,e),r}}();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.JsonSchema$=Bd.JsonSchema$outboundSchema=Bd.JsonSchema$inboundSchema=void 0;Bd.jsonSchemaToJSON=M_o;Bd.jsonSchemaFromJSON=R_o;var gv=E_o(ae()),q0r=ce(),P_o=ee();Bd.JsonSchema$inboundSchema=gv.object({name:gv.string(),description:gv.nullable(gv.string()).optional(),schema:gv.record(gv.any()),strict:gv.boolean().optional()}).transform(t=>(0,q0r.remap)(t,{schema:"schemaDefinition"}));Bd.JsonSchema$outboundSchema=gv.object({name:gv.string(),description:gv.nullable(gv.string()).optional(),schemaDefinition:gv.record(gv.any()),strict:gv.boolean().optional()}).transform(t=>(0,q0r.remap)(t,{schemaDefinition:"schema"}));var k0r;(function(t){t.inboundSchema=Bd.JsonSchema$inboundSchema,t.outboundSchema=Bd.JsonSchema$outboundSchema})(k0r||(Bd.JsonSchema$=k0r={}));function M_o(t){return JSON.stringify(Bd.JsonSchema$outboundSchema.parse(t))}function R_o(t){return(0,P_o.safeParse)(t,e=>Bd.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var Xlt=S(zd=>{"use strict";var I_o=zd&&zd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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_o=zd&&zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N_o=zd&&zd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I_o(r,e,n[o]);return A_o(r,e),r}}();Object.defineProperty(zd,"__esModule",{value:!0});zd.ResponseFormats$=zd.ResponseFormats$outboundSchema=zd.ResponseFormats$inboundSchema=zd.ResponseFormats=void 0;var D_o=N_o(ae());zd.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};zd.ResponseFormats$inboundSchema=D_o.nativeEnum(zd.ResponseFormats);zd.ResponseFormats$outboundSchema=zd.ResponseFormats$inboundSchema;var U0r;(function(t){t.inboundSchema=zd.ResponseFormats$inboundSchema,t.outboundSchema=zd.ResponseFormats$outboundSchema})(U0r||(zd.ResponseFormats$=U0r={}))});var Gq=S(Vd=>{"use strict";var j_o=Vd&&Vd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$_o=Vd&&Vd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L_o=Vd&&Vd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j_o(r,e,n[o]);return $_o(r,e),r}}();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ResponseFormat$=Vd.ResponseFormat$outboundSchema=Vd.ResponseFormat$inboundSchema=void 0;Vd.responseFormatToJSON=k_o;Vd.responseFormatFromJSON=q_o;var $Me=L_o(ae()),z0r=ce(),F_o=ee(),V0r=Glt(),H0r=Xlt();Vd.ResponseFormat$inboundSchema=$Me.object({type:H0r.ResponseFormats$inboundSchema.optional(),json_schema:$Me.nullable(V0r.JsonSchema$inboundSchema).optional()}).transform(t=>(0,z0r.remap)(t,{json_schema:"jsonSchema"}));Vd.ResponseFormat$outboundSchema=$Me.object({type:H0r.ResponseFormats$outboundSchema.optional(),jsonSchema:$Me.nullable(V0r.JsonSchema$outboundSchema).optional()}).transform(t=>(0,z0r.remap)(t,{jsonSchema:"json_schema"}));var B0r;(function(t){t.inboundSchema=Vd.ResponseFormat$inboundSchema,t.outboundSchema=Vd.ResponseFormat$outboundSchema})(B0r||(Vd.ResponseFormat$=B0r={}));function k_o(t){return JSON.stringify(Vd.ResponseFormat$outboundSchema.parse(t))}function q_o(t){return(0,F_o.safeParse)(t,e=>Vd.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var r3=S(Hd=>{"use strict";var U_o=Hd&&Hd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B_o=Hd&&Hd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z_o=Hd&&Hd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U_o(r,e,n[o]);return B_o(r,e),r}}();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ToolChoiceEnum$=Hd.ToolChoiceEnum$outboundSchema=Hd.ToolChoiceEnum$inboundSchema=Hd.ToolChoiceEnum=void 0;var V_o=z_o(ae());Hd.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Hd.ToolChoiceEnum$inboundSchema=V_o.nativeEnum(Hd.ToolChoiceEnum);Hd.ToolChoiceEnum$outboundSchema=Hd.ToolChoiceEnum$inboundSchema;var W0r;(function(t){t.inboundSchema=Hd.ToolChoiceEnum$inboundSchema,t.outboundSchema=Hd.ToolChoiceEnum$outboundSchema})(W0r||(Hd.ToolChoiceEnum$=W0r={}))});var L0=S(Wd=>{"use strict";var H_o=Wd&&Wd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W_o=Wd&&Wd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J_o=Wd&&Wd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&H_o(r,e,n[o]);return W_o(r,e),r}}();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.CompletionArgs$=Wd.CompletionArgs$outboundSchema=Wd.CompletionArgs$inboundSchema=void 0;Wd.completionArgsToJSON=G_o;Wd.completionArgsFromJSON=X_o;var cs=J_o(ae()),K0r=ce(),K_o=ee(),G0r=Klt(),X0r=t3(),Z0r=Gq(),Y0r=r3();Wd.CompletionArgs$inboundSchema=cs.object({stop:cs.nullable(G0r.CompletionArgsStop$inboundSchema).optional(),presence_penalty:cs.nullable(cs.number()).optional(),frequency_penalty:cs.nullable(cs.number()).optional(),temperature:cs.nullable(cs.number()).optional(),top_p:cs.nullable(cs.number()).optional(),max_tokens:cs.nullable(cs.number().int()).optional(),random_seed:cs.nullable(cs.number().int()).optional(),prediction:cs.nullable(X0r.Prediction$inboundSchema).optional(),response_format:cs.nullable(Z0r.ResponseFormat$inboundSchema).optional(),tool_choice:Y0r.ToolChoiceEnum$inboundSchema.optional()}).transform(t=>(0,K0r.remap)(t,{presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice"}));Wd.CompletionArgs$outboundSchema=cs.object({stop:cs.nullable(G0r.CompletionArgsStop$outboundSchema).optional(),presencePenalty:cs.nullable(cs.number()).optional(),frequencyPenalty:cs.nullable(cs.number()).optional(),temperature:cs.nullable(cs.number()).optional(),topP:cs.nullable(cs.number()).optional(),maxTokens:cs.nullable(cs.number().int()).optional(),randomSeed:cs.nullable(cs.number().int()).optional(),prediction:cs.nullable(X0r.Prediction$outboundSchema).optional(),responseFormat:cs.nullable(Z0r.ResponseFormat$outboundSchema).optional(),toolChoice:Y0r.ToolChoiceEnum$outboundSchema.optional()}).transform(t=>(0,K0r.remap)(t,{presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice"}));var J0r;(function(t){t.inboundSchema=Wd.CompletionArgs$inboundSchema,t.outboundSchema=Wd.CompletionArgs$outboundSchema})(J0r||(Wd.CompletionArgs$=J0r={}));function G_o(t){return JSON.stringify(Wd.CompletionArgs$outboundSchema.parse(t))}function X_o(t){return(0,K_o.safeParse)(t,e=>Wd.CompletionArgs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgs' from JSON")}});var Xq=S(ua=>{"use strict";var Z_o=ua&&ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y_o=ua&&ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q_o=ua&&ua.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Z_o(r,e,n[o]);return Y_o(r,e),r}}();Object.defineProperty(ua,"__esModule",{value:!0});ua.DocumentLibraryTool$=ua.DocumentLibraryTool$outboundSchema=ua.DocumentLibraryTool$inboundSchema=ua.DocumentLibraryToolType$=ua.DocumentLibraryToolType$outboundSchema=ua.DocumentLibraryToolType$inboundSchema=ua.DocumentLibraryToolType=void 0;ua.documentLibraryToolToJSON=tvo;ua.documentLibraryToolFromJSON=rvo;var n3=Q_o(ae()),tCr=ce(),evo=ee();ua.DocumentLibraryToolType={DocumentLibrary:"document_library"};ua.DocumentLibraryToolType$inboundSchema=n3.nativeEnum(ua.DocumentLibraryToolType);ua.DocumentLibraryToolType$outboundSchema=ua.DocumentLibraryToolType$inboundSchema;var Q0r;(function(t){t.inboundSchema=ua.DocumentLibraryToolType$inboundSchema,t.outboundSchema=ua.DocumentLibraryToolType$outboundSchema})(Q0r||(ua.DocumentLibraryToolType$=Q0r={}));ua.DocumentLibraryTool$inboundSchema=n3.object({type:ua.DocumentLibraryToolType$inboundSchema.default("document_library"),library_ids:n3.array(n3.string())}).transform(t=>(0,tCr.remap)(t,{library_ids:"libraryIds"}));ua.DocumentLibraryTool$outboundSchema=n3.object({type:ua.DocumentLibraryToolType$outboundSchema.default("document_library"),libraryIds:n3.array(n3.string())}).transform(t=>(0,tCr.remap)(t,{libraryIds:"library_ids"}));var eCr;(function(t){t.inboundSchema=ua.DocumentLibraryTool$inboundSchema,t.outboundSchema=ua.DocumentLibraryTool$outboundSchema})(eCr||(ua.DocumentLibraryTool$=eCr={}));function tvo(t){return JSON.stringify(ua.DocumentLibraryTool$outboundSchema.parse(t))}function rvo(t){return(0,evo.safeParse)(t,e=>ua.DocumentLibraryTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentLibraryTool' from JSON")}});var LMe=S(Jd=>{"use strict";var nvo=Jd&&Jd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ovo=Jd&&Jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ivo=Jd&&Jd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nvo(r,e,n[o]);return ovo(r,e),r}}();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.FunctionT$=Jd.FunctionT$outboundSchema=Jd.FunctionT$inboundSchema=void 0;Jd.functionToJSON=svo;Jd.functionFromJSON=uvo;var F0=ivo(ae()),avo=ee();Jd.FunctionT$inboundSchema=F0.object({name:F0.string(),description:F0.string().optional(),strict:F0.boolean().optional(),parameters:F0.record(F0.any())});Jd.FunctionT$outboundSchema=F0.object({name:F0.string(),description:F0.string().optional(),strict:F0.boolean().optional(),parameters:F0.record(F0.any())});var rCr;(function(t){t.inboundSchema=Jd.FunctionT$inboundSchema,t.outboundSchema=Jd.FunctionT$outboundSchema})(rCr||(Jd.FunctionT$=rCr={}));function svo(t){return JSON.stringify(Jd.FunctionT$outboundSchema.parse(t))}function uvo(t){return(0,avo.safeParse)(t,e=>Jd.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var Zq=S(la=>{"use strict";var lvo=la&&la.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cvo=la&&la.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dvo=la&&la.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lvo(r,e,n[o]);return cvo(r,e),r}}();Object.defineProperty(la,"__esModule",{value:!0});la.FunctionTool$=la.FunctionTool$outboundSchema=la.FunctionTool$inboundSchema=la.FunctionToolType$=la.FunctionToolType$outboundSchema=la.FunctionToolType$inboundSchema=la.FunctionToolType=void 0;la.functionToolToJSON=pvo;la.functionToolFromJSON=mvo;var Zlt=dvo(ae()),fvo=ee(),iCr=LMe();la.FunctionToolType={Function:"function"};la.FunctionToolType$inboundSchema=Zlt.nativeEnum(la.FunctionToolType);la.FunctionToolType$outboundSchema=la.FunctionToolType$inboundSchema;var nCr;(function(t){t.inboundSchema=la.FunctionToolType$inboundSchema,t.outboundSchema=la.FunctionToolType$outboundSchema})(nCr||(la.FunctionToolType$=nCr={}));la.FunctionTool$inboundSchema=Zlt.object({type:la.FunctionToolType$inboundSchema.default("function"),function:iCr.FunctionT$inboundSchema});la.FunctionTool$outboundSchema=Zlt.object({type:la.FunctionToolType$outboundSchema.default("function"),function:iCr.FunctionT$outboundSchema});var oCr;(function(t){t.inboundSchema=la.FunctionTool$inboundSchema,t.outboundSchema=la.FunctionTool$outboundSchema})(oCr||(la.FunctionTool$=oCr={}));function pvo(t){return JSON.stringify(la.FunctionTool$outboundSchema.parse(t))}function mvo(t){return(0,fvo.safeParse)(t,e=>la.FunctionTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionTool' from JSON")}});var Yq=S(ca=>{"use strict";var hvo=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]}),gvo=ca&&ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yvo=ca&&ca.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hvo(r,e,n[o]);return gvo(r,e),r}}();Object.defineProperty(ca,"__esModule",{value:!0});ca.ImageGenerationTool$=ca.ImageGenerationTool$outboundSchema=ca.ImageGenerationTool$inboundSchema=ca.ImageGenerationToolType$=ca.ImageGenerationToolType$outboundSchema=ca.ImageGenerationToolType$inboundSchema=ca.ImageGenerationToolType=void 0;ca.imageGenerationToolToJSON=_vo;ca.imageGenerationToolFromJSON=vvo;var Ylt=yvo(ae()),bvo=ee();ca.ImageGenerationToolType={ImageGeneration:"image_generation"};ca.ImageGenerationToolType$inboundSchema=Ylt.nativeEnum(ca.ImageGenerationToolType);ca.ImageGenerationToolType$outboundSchema=ca.ImageGenerationToolType$inboundSchema;var aCr;(function(t){t.inboundSchema=ca.ImageGenerationToolType$inboundSchema,t.outboundSchema=ca.ImageGenerationToolType$outboundSchema})(aCr||(ca.ImageGenerationToolType$=aCr={}));ca.ImageGenerationTool$inboundSchema=Ylt.object({type:ca.ImageGenerationToolType$inboundSchema.default("image_generation")});ca.ImageGenerationTool$outboundSchema=Ylt.object({type:ca.ImageGenerationToolType$outboundSchema.default("image_generation")});var sCr;(function(t){t.inboundSchema=ca.ImageGenerationTool$inboundSchema,t.outboundSchema=ca.ImageGenerationTool$outboundSchema})(sCr||(ca.ImageGenerationTool$=sCr={}));function _vo(t){return JSON.stringify(ca.ImageGenerationTool$outboundSchema.parse(t))}function vvo(t){return(0,bvo.safeParse)(t,e=>ca.ImageGenerationTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageGenerationTool' from JSON")}});var Qq=S(da=>{"use strict";var wvo=da&&da.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Svo=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cvo=da&&da.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wvo(r,e,n[o]);return Svo(r,e),r}}();Object.defineProperty(da,"__esModule",{value:!0});da.WebSearchPremiumTool$=da.WebSearchPremiumTool$outboundSchema=da.WebSearchPremiumTool$inboundSchema=da.WebSearchPremiumToolType$=da.WebSearchPremiumToolType$outboundSchema=da.WebSearchPremiumToolType$inboundSchema=da.WebSearchPremiumToolType=void 0;da.webSearchPremiumToolToJSON=Tvo;da.webSearchPremiumToolFromJSON=Ovo;var Qlt=Cvo(ae()),xvo=ee();da.WebSearchPremiumToolType={WebSearchPremium:"web_search_premium"};da.WebSearchPremiumToolType$inboundSchema=Qlt.nativeEnum(da.WebSearchPremiumToolType);da.WebSearchPremiumToolType$outboundSchema=da.WebSearchPremiumToolType$inboundSchema;var uCr;(function(t){t.inboundSchema=da.WebSearchPremiumToolType$inboundSchema,t.outboundSchema=da.WebSearchPremiumToolType$outboundSchema})(uCr||(da.WebSearchPremiumToolType$=uCr={}));da.WebSearchPremiumTool$inboundSchema=Qlt.object({type:da.WebSearchPremiumToolType$inboundSchema.default("web_search_premium")});da.WebSearchPremiumTool$outboundSchema=Qlt.object({type:da.WebSearchPremiumToolType$outboundSchema.default("web_search_premium")});var lCr;(function(t){t.inboundSchema=da.WebSearchPremiumTool$inboundSchema,t.outboundSchema=da.WebSearchPremiumTool$outboundSchema})(lCr||(da.WebSearchPremiumTool$=lCr={}));function Tvo(t){return JSON.stringify(da.WebSearchPremiumTool$outboundSchema.parse(t))}function Ovo(t){return(0,xvo.safeParse)(t,e=>da.WebSearchPremiumTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchPremiumTool' from JSON")}});var eU=S(fa=>{"use strict";var Evo=fa&&fa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pvo=fa&&fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mvo=fa&&fa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Evo(r,e,n[o]);return Pvo(r,e),r}}();Object.defineProperty(fa,"__esModule",{value:!0});fa.WebSearchTool$=fa.WebSearchTool$outboundSchema=fa.WebSearchTool$inboundSchema=fa.WebSearchToolType$=fa.WebSearchToolType$outboundSchema=fa.WebSearchToolType$inboundSchema=fa.WebSearchToolType=void 0;fa.webSearchToolToJSON=Ivo;fa.webSearchToolFromJSON=Avo;var ect=Mvo(ae()),Rvo=ee();fa.WebSearchToolType={WebSearch:"web_search"};fa.WebSearchToolType$inboundSchema=ect.nativeEnum(fa.WebSearchToolType);fa.WebSearchToolType$outboundSchema=fa.WebSearchToolType$inboundSchema;var cCr;(function(t){t.inboundSchema=fa.WebSearchToolType$inboundSchema,t.outboundSchema=fa.WebSearchToolType$outboundSchema})(cCr||(fa.WebSearchToolType$=cCr={}));fa.WebSearchTool$inboundSchema=ect.object({type:fa.WebSearchToolType$inboundSchema.default("web_search")});fa.WebSearchTool$outboundSchema=ect.object({type:fa.WebSearchToolType$outboundSchema.default("web_search")});var dCr;(function(t){t.inboundSchema=fa.WebSearchTool$inboundSchema,t.outboundSchema=fa.WebSearchTool$outboundSchema})(dCr||(fa.WebSearchTool$=dCr={}));function Ivo(t){return JSON.stringify(fa.WebSearchTool$outboundSchema.parse(t))}function Avo(t){return(0,Rvo.safeParse)(t,e=>fa.WebSearchTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchTool' from JSON")}});var bCr=S(fo=>{"use strict";var Nvo=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]}),Dvo=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jvo=fo&&fo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Nvo(r,e,n[o]);return Dvo(r,e),r}}();Object.defineProperty(fo,"__esModule",{value:!0});fo.Agent$=fo.Agent$outboundSchema=fo.Agent$inboundSchema=fo.AgentObject$=fo.AgentObject$outboundSchema=fo.AgentObject$inboundSchema=fo.AgentTools$=fo.AgentTools$outboundSchema=fo.AgentTools$inboundSchema=fo.AgentObject=void 0;fo.agentToolsToJSON=$vo;fo.agentToolsFromJSON=Lvo;fo.agentToJSON=Fvo;fo.agentFromJSON=kvo;var jt=jvo(ae()),hCr=ce(),gCr=ee(),FMe=Jq(),yCr=L0(),kMe=Xq(),qMe=Zq(),UMe=Yq(),BMe=Qq(),zMe=eU();fo.AgentObject={Agent:"agent"};fo.AgentTools$inboundSchema=jt.union([kMe.DocumentLibraryTool$inboundSchema.and(jt.object({type:jt.literal("document_library")}).transform(t=>({type:t.type}))),qMe.FunctionTool$inboundSchema.and(jt.object({type:jt.literal("function")}).transform(t=>({type:t.type}))),FMe.CodeInterpreterTool$inboundSchema.and(jt.object({type:jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UMe.ImageGenerationTool$inboundSchema.and(jt.object({type:jt.literal("image_generation")}).transform(t=>({type:t.type}))),zMe.WebSearchTool$inboundSchema.and(jt.object({type:jt.literal("web_search")}).transform(t=>({type:t.type}))),BMe.WebSearchPremiumTool$inboundSchema.and(jt.object({type:jt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);fo.AgentTools$outboundSchema=jt.union([kMe.DocumentLibraryTool$outboundSchema.and(jt.object({type:jt.literal("document_library")}).transform(t=>({type:t.type}))),qMe.FunctionTool$outboundSchema.and(jt.object({type:jt.literal("function")}).transform(t=>({type:t.type}))),FMe.CodeInterpreterTool$outboundSchema.and(jt.object({type:jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UMe.ImageGenerationTool$outboundSchema.and(jt.object({type:jt.literal("image_generation")}).transform(t=>({type:t.type}))),zMe.WebSearchTool$outboundSchema.and(jt.object({type:jt.literal("web_search")}).transform(t=>({type:t.type}))),BMe.WebSearchPremiumTool$outboundSchema.and(jt.object({type:jt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var fCr;(function(t){t.inboundSchema=fo.AgentTools$inboundSchema,t.outboundSchema=fo.AgentTools$outboundSchema})(fCr||(fo.AgentTools$=fCr={}));function $vo(t){return JSON.stringify(fo.AgentTools$outboundSchema.parse(t))}function Lvo(t){return(0,gCr.safeParse)(t,e=>fo.AgentTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentTools' from JSON")}fo.AgentObject$inboundSchema=jt.nativeEnum(fo.AgentObject);fo.AgentObject$outboundSchema=fo.AgentObject$inboundSchema;var pCr;(function(t){t.inboundSchema=fo.AgentObject$inboundSchema,t.outboundSchema=fo.AgentObject$outboundSchema})(pCr||(fo.AgentObject$=pCr={}));fo.Agent$inboundSchema=jt.object({instructions:jt.nullable(jt.string()).optional(),tools:jt.array(jt.union([kMe.DocumentLibraryTool$inboundSchema.and(jt.object({type:jt.literal("document_library")}).transform(t=>({type:t.type}))),qMe.FunctionTool$inboundSchema.and(jt.object({type:jt.literal("function")}).transform(t=>({type:t.type}))),FMe.CodeInterpreterTool$inboundSchema.and(jt.object({type:jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UMe.ImageGenerationTool$inboundSchema.and(jt.object({type:jt.literal("image_generation")}).transform(t=>({type:t.type}))),zMe.WebSearchTool$inboundSchema.and(jt.object({type:jt.literal("web_search")}).transform(t=>({type:t.type}))),BMe.WebSearchPremiumTool$inboundSchema.and(jt.object({type:jt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:yCr.CompletionArgs$inboundSchema.optional(),model:jt.string(),name:jt.string(),description:jt.nullable(jt.string()).optional(),handoffs:jt.nullable(jt.array(jt.string())).optional(),object:fo.AgentObject$inboundSchema.default("agent"),id:jt.string(),version:jt.number().int(),created_at:jt.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:jt.string().datetime({offset:!0}).transform(t=>new Date(t))}).transform(t=>(0,hCr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));fo.Agent$outboundSchema=jt.object({instructions:jt.nullable(jt.string()).optional(),tools:jt.array(jt.union([kMe.DocumentLibraryTool$outboundSchema.and(jt.object({type:jt.literal("document_library")}).transform(t=>({type:t.type}))),qMe.FunctionTool$outboundSchema.and(jt.object({type:jt.literal("function")}).transform(t=>({type:t.type}))),FMe.CodeInterpreterTool$outboundSchema.and(jt.object({type:jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UMe.ImageGenerationTool$outboundSchema.and(jt.object({type:jt.literal("image_generation")}).transform(t=>({type:t.type}))),zMe.WebSearchTool$outboundSchema.and(jt.object({type:jt.literal("web_search")}).transform(t=>({type:t.type}))),BMe.WebSearchPremiumTool$outboundSchema.and(jt.object({type:jt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:yCr.CompletionArgs$outboundSchema.optional(),model:jt.string(),name:jt.string(),description:jt.nullable(jt.string()).optional(),handoffs:jt.nullable(jt.array(jt.string())).optional(),object:fo.AgentObject$outboundSchema.default("agent"),id:jt.string(),version:jt.number().int(),createdAt:jt.date().transform(t=>t.toISOString()),updatedAt:jt.date().transform(t=>t.toISOString())}).transform(t=>(0,hCr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var mCr;(function(t){t.inboundSchema=fo.Agent$inboundSchema,t.outboundSchema=fo.Agent$outboundSchema})(mCr||(fo.Agent$=mCr={}));function Fvo(t){return JSON.stringify(fo.Agent$outboundSchema.parse(t))}function kvo(t){return(0,gCr.safeParse)(t,e=>fo.Agent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Agent' from JSON")}});var SCr=S(pa=>{"use strict";var qvo=pa&&pa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Uvo=pa&&pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bvo=pa&&pa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qvo(r,e,n[o]);return Uvo(r,e),r}}();Object.defineProperty(pa,"__esModule",{value:!0});pa.AgentConversation$=pa.AgentConversation$outboundSchema=pa.AgentConversation$inboundSchema=pa.AgentConversationObject$=pa.AgentConversationObject$outboundSchema=pa.AgentConversationObject$inboundSchema=pa.AgentConversationObject=void 0;pa.agentConversationToJSON=Vvo;pa.agentConversationFromJSON=Hvo;var Gm=Bvo(ae()),wCr=ce(),zvo=ee();pa.AgentConversationObject={Conversation:"conversation"};pa.AgentConversationObject$inboundSchema=Gm.nativeEnum(pa.AgentConversationObject);pa.AgentConversationObject$outboundSchema=pa.AgentConversationObject$inboundSchema;var _Cr;(function(t){t.inboundSchema=pa.AgentConversationObject$inboundSchema,t.outboundSchema=pa.AgentConversationObject$outboundSchema})(_Cr||(pa.AgentConversationObject$=_Cr={}));pa.AgentConversation$inboundSchema=Gm.object({name:Gm.nullable(Gm.string()).optional(),description:Gm.nullable(Gm.string()).optional(),object:pa.AgentConversationObject$inboundSchema.default("conversation"),id:Gm.string(),created_at:Gm.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Gm.string().datetime({offset:!0}).transform(t=>new Date(t)),agent_id:Gm.string()}).transform(t=>(0,wCr.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",agent_id:"agentId"}));pa.AgentConversation$outboundSchema=Gm.object({name:Gm.nullable(Gm.string()).optional(),description:Gm.nullable(Gm.string()).optional(),object:pa.AgentConversationObject$outboundSchema.default("conversation"),id:Gm.string(),createdAt:Gm.date().transform(t=>t.toISOString()),updatedAt:Gm.date().transform(t=>t.toISOString()),agentId:Gm.string()}).transform(t=>(0,wCr.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",agentId:"agent_id"}));var vCr;(function(t){t.inboundSchema=pa.AgentConversation$inboundSchema,t.outboundSchema=pa.AgentConversation$outboundSchema})(vCr||(pa.AgentConversation$=vCr={}));function Vvo(t){return JSON.stringify(pa.AgentConversation$outboundSchema.parse(t))}function Hvo(t){return(0,zvo.safeParse)(t,e=>pa.AgentConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentConversation' from JSON")}});var PCr=S(ds=>{"use strict";var Wvo=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]}),Jvo=ds&&ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kvo=ds&&ds.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wvo(r,e,n[o]);return Jvo(r,e),r}}();Object.defineProperty(ds,"__esModule",{value:!0});ds.AgentCreationRequest$=ds.AgentCreationRequest$outboundSchema=ds.AgentCreationRequest$inboundSchema=ds.AgentCreationRequestTools$=ds.AgentCreationRequestTools$outboundSchema=ds.AgentCreationRequestTools$inboundSchema=void 0;ds.agentCreationRequestToolsToJSON=Gvo;ds.agentCreationRequestToolsFromJSON=Xvo;ds.agentCreationRequestToJSON=Zvo;ds.agentCreationRequestFromJSON=Yvo;var rr=Kvo(ae()),TCr=ce(),OCr=ee(),VMe=Jq(),ECr=L0(),HMe=Xq(),WMe=Zq(),JMe=Yq(),KMe=Qq(),GMe=eU();ds.AgentCreationRequestTools$inboundSchema=rr.union([HMe.DocumentLibraryTool$inboundSchema.and(rr.object({type:rr.literal("document_library")}).transform(t=>({type:t.type}))),WMe.FunctionTool$inboundSchema.and(rr.object({type:rr.literal("function")}).transform(t=>({type:t.type}))),VMe.CodeInterpreterTool$inboundSchema.and(rr.object({type:rr.literal("code_interpreter")}).transform(t=>({type:t.type}))),JMe.ImageGenerationTool$inboundSchema.and(rr.object({type:rr.literal("image_generation")}).transform(t=>({type:t.type}))),GMe.WebSearchTool$inboundSchema.and(rr.object({type:rr.literal("web_search")}).transform(t=>({type:t.type}))),KMe.WebSearchPremiumTool$inboundSchema.and(rr.object({type:rr.literal("web_search_premium")}).transform(t=>({type:t.type})))]);ds.AgentCreationRequestTools$outboundSchema=rr.union([HMe.DocumentLibraryTool$outboundSchema.and(rr.object({type:rr.literal("document_library")}).transform(t=>({type:t.type}))),WMe.FunctionTool$outboundSchema.and(rr.object({type:rr.literal("function")}).transform(t=>({type:t.type}))),VMe.CodeInterpreterTool$outboundSchema.and(rr.object({type:rr.literal("code_interpreter")}).transform(t=>({type:t.type}))),JMe.ImageGenerationTool$outboundSchema.and(rr.object({type:rr.literal("image_generation")}).transform(t=>({type:t.type}))),GMe.WebSearchTool$outboundSchema.and(rr.object({type:rr.literal("web_search")}).transform(t=>({type:t.type}))),KMe.WebSearchPremiumTool$outboundSchema.and(rr.object({type:rr.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var CCr;(function(t){t.inboundSchema=ds.AgentCreationRequestTools$inboundSchema,t.outboundSchema=ds.AgentCreationRequestTools$outboundSchema})(CCr||(ds.AgentCreationRequestTools$=CCr={}));function Gvo(t){return JSON.stringify(ds.AgentCreationRequestTools$outboundSchema.parse(t))}function Xvo(t){return(0,OCr.safeParse)(t,e=>ds.AgentCreationRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequestTools' from JSON")}ds.AgentCreationRequest$inboundSchema=rr.object({instructions:rr.nullable(rr.string()).optional(),tools:rr.array(rr.union([HMe.DocumentLibraryTool$inboundSchema.and(rr.object({type:rr.literal("document_library")}).transform(t=>({type:t.type}))),WMe.FunctionTool$inboundSchema.and(rr.object({type:rr.literal("function")}).transform(t=>({type:t.type}))),VMe.CodeInterpreterTool$inboundSchema.and(rr.object({type:rr.literal("code_interpreter")}).transform(t=>({type:t.type}))),JMe.ImageGenerationTool$inboundSchema.and(rr.object({type:rr.literal("image_generation")}).transform(t=>({type:t.type}))),GMe.WebSearchTool$inboundSchema.and(rr.object({type:rr.literal("web_search")}).transform(t=>({type:t.type}))),KMe.WebSearchPremiumTool$inboundSchema.and(rr.object({type:rr.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:ECr.CompletionArgs$inboundSchema.optional(),model:rr.string(),name:rr.string(),description:rr.nullable(rr.string()).optional(),handoffs:rr.nullable(rr.array(rr.string())).optional()}).transform(t=>(0,TCr.remap)(t,{completion_args:"completionArgs"}));ds.AgentCreationRequest$outboundSchema=rr.object({instructions:rr.nullable(rr.string()).optional(),tools:rr.array(rr.union([HMe.DocumentLibraryTool$outboundSchema.and(rr.object({type:rr.literal("document_library")}).transform(t=>({type:t.type}))),WMe.FunctionTool$outboundSchema.and(rr.object({type:rr.literal("function")}).transform(t=>({type:t.type}))),VMe.CodeInterpreterTool$outboundSchema.and(rr.object({type:rr.literal("code_interpreter")}).transform(t=>({type:t.type}))),JMe.ImageGenerationTool$outboundSchema.and(rr.object({type:rr.literal("image_generation")}).transform(t=>({type:t.type}))),GMe.WebSearchTool$outboundSchema.and(rr.object({type:rr.literal("web_search")}).transform(t=>({type:t.type}))),KMe.WebSearchPremiumTool$outboundSchema.and(rr.object({type:rr.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:ECr.CompletionArgs$outboundSchema.optional(),model:rr.string(),name:rr.string(),description:rr.nullable(rr.string()).optional(),handoffs:rr.nullable(rr.array(rr.string())).optional()}).transform(t=>(0,TCr.remap)(t,{completionArgs:"completion_args"}));var xCr;(function(t){t.inboundSchema=ds.AgentCreationRequest$inboundSchema,t.outboundSchema=ds.AgentCreationRequest$outboundSchema})(xCr||(ds.AgentCreationRequest$=xCr={}));function Zvo(t){return JSON.stringify(ds.AgentCreationRequest$outboundSchema.parse(t))}function Yvo(t){return(0,OCr.safeParse)(t,e=>ds.AgentCreationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequest' from JSON")}});var tct=S(ma=>{"use strict";var Qvo=ma&&ma.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ewo=ma&&ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),two=ma&&ma.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qvo(r,e,n[o]);return ewo(r,e),r}}();Object.defineProperty(ma,"__esModule",{value:!0});ma.AgentHandoffDoneEvent$=ma.AgentHandoffDoneEvent$outboundSchema=ma.AgentHandoffDoneEvent$inboundSchema=ma.AgentHandoffDoneEventType$=ma.AgentHandoffDoneEventType$outboundSchema=ma.AgentHandoffDoneEventType$inboundSchema=ma.AgentHandoffDoneEventType=void 0;ma.agentHandoffDoneEventToJSON=nwo;ma.agentHandoffDoneEventFromJSON=owo;var zw=two(ae()),ICr=ce(),rwo=ee();ma.AgentHandoffDoneEventType={AgentHandoffDone:"agent.handoff.done"};ma.AgentHandoffDoneEventType$inboundSchema=zw.nativeEnum(ma.AgentHandoffDoneEventType);ma.AgentHandoffDoneEventType$outboundSchema=ma.AgentHandoffDoneEventType$inboundSchema;var MCr;(function(t){t.inboundSchema=ma.AgentHandoffDoneEventType$inboundSchema,t.outboundSchema=ma.AgentHandoffDoneEventType$outboundSchema})(MCr||(ma.AgentHandoffDoneEventType$=MCr={}));ma.AgentHandoffDoneEvent$inboundSchema=zw.object({type:ma.AgentHandoffDoneEventType$inboundSchema.default("agent.handoff.done"),created_at:zw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:zw.number().int().default(0),id:zw.string(),next_agent_id:zw.string(),next_agent_name:zw.string()}).transform(t=>(0,ICr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));ma.AgentHandoffDoneEvent$outboundSchema=zw.object({type:ma.AgentHandoffDoneEventType$outboundSchema.default("agent.handoff.done"),createdAt:zw.date().transform(t=>t.toISOString()).optional(),outputIndex:zw.number().int().default(0),id:zw.string(),nextAgentId:zw.string(),nextAgentName:zw.string()}).transform(t=>(0,ICr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var RCr;(function(t){t.inboundSchema=ma.AgentHandoffDoneEvent$inboundSchema,t.outboundSchema=ma.AgentHandoffDoneEvent$outboundSchema})(RCr||(ma.AgentHandoffDoneEvent$=RCr={}));function nwo(t){return JSON.stringify(ma.AgentHandoffDoneEvent$outboundSchema.parse(t))}function owo(t){return(0,rwo.safeParse)(t,e=>ma.AgentHandoffDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffDoneEvent' from JSON")}});var Rse=S(Jn=>{"use strict";var iwo=Jn&&Jn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),awo=Jn&&Jn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),swo=Jn&&Jn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iwo(r,e,n[o]);return awo(r,e),r}}();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.AgentHandoffEntry$=Jn.AgentHandoffEntry$outboundSchema=Jn.AgentHandoffEntry$inboundSchema=Jn.AgentHandoffEntryType$=Jn.AgentHandoffEntryType$outboundSchema=Jn.AgentHandoffEntryType$inboundSchema=Jn.AgentHandoffEntryObject$=Jn.AgentHandoffEntryObject$outboundSchema=Jn.AgentHandoffEntryObject$inboundSchema=Jn.AgentHandoffEntryType=Jn.AgentHandoffEntryObject=void 0;Jn.agentHandoffEntryToJSON=lwo;Jn.agentHandoffEntryFromJSON=cwo;var Kd=swo(ae()),jCr=ce(),uwo=ee();Jn.AgentHandoffEntryObject={Entry:"entry"};Jn.AgentHandoffEntryType={AgentHandoff:"agent.handoff"};Jn.AgentHandoffEntryObject$inboundSchema=Kd.nativeEnum(Jn.AgentHandoffEntryObject);Jn.AgentHandoffEntryObject$outboundSchema=Jn.AgentHandoffEntryObject$inboundSchema;var ACr;(function(t){t.inboundSchema=Jn.AgentHandoffEntryObject$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntryObject$outboundSchema})(ACr||(Jn.AgentHandoffEntryObject$=ACr={}));Jn.AgentHandoffEntryType$inboundSchema=Kd.nativeEnum(Jn.AgentHandoffEntryType);Jn.AgentHandoffEntryType$outboundSchema=Jn.AgentHandoffEntryType$inboundSchema;var NCr;(function(t){t.inboundSchema=Jn.AgentHandoffEntryType$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntryType$outboundSchema})(NCr||(Jn.AgentHandoffEntryType$=NCr={}));Jn.AgentHandoffEntry$inboundSchema=Kd.object({object:Jn.AgentHandoffEntryObject$inboundSchema.default("entry"),type:Jn.AgentHandoffEntryType$inboundSchema.default("agent.handoff"),created_at:Kd.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Kd.nullable(Kd.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Kd.string().optional(),previous_agent_id:Kd.string(),previous_agent_name:Kd.string(),next_agent_id:Kd.string(),next_agent_name:Kd.string()}).transform(t=>(0,jCr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));Jn.AgentHandoffEntry$outboundSchema=Kd.object({object:Jn.AgentHandoffEntryObject$outboundSchema.default("entry"),type:Jn.AgentHandoffEntryType$outboundSchema.default("agent.handoff"),createdAt:Kd.date().transform(t=>t.toISOString()).optional(),completedAt:Kd.nullable(Kd.date().transform(t=>t.toISOString())).optional(),id:Kd.string().optional(),previousAgentId:Kd.string(),previousAgentName:Kd.string(),nextAgentId:Kd.string(),nextAgentName:Kd.string()}).transform(t=>(0,jCr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var DCr;(function(t){t.inboundSchema=Jn.AgentHandoffEntry$inboundSchema,t.outboundSchema=Jn.AgentHandoffEntry$outboundSchema})(DCr||(Jn.AgentHandoffEntry$=DCr={}));function lwo(t){return JSON.stringify(Jn.AgentHandoffEntry$outboundSchema.parse(t))}function cwo(t){return(0,uwo.safeParse)(t,e=>Jn.AgentHandoffEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffEntry' from JSON")}});var rct=S(ha=>{"use strict";var dwo=ha&&ha.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fwo=ha&&ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pwo=ha&&ha.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dwo(r,e,n[o]);return fwo(r,e),r}}();Object.defineProperty(ha,"__esModule",{value:!0});ha.AgentHandoffStartedEvent$=ha.AgentHandoffStartedEvent$outboundSchema=ha.AgentHandoffStartedEvent$inboundSchema=ha.AgentHandoffStartedEventType$=ha.AgentHandoffStartedEventType$outboundSchema=ha.AgentHandoffStartedEventType$inboundSchema=ha.AgentHandoffStartedEventType=void 0;ha.agentHandoffStartedEventToJSON=hwo;ha.agentHandoffStartedEventFromJSON=gwo;var Vw=pwo(ae()),FCr=ce(),mwo=ee();ha.AgentHandoffStartedEventType={AgentHandoffStarted:"agent.handoff.started"};ha.AgentHandoffStartedEventType$inboundSchema=Vw.nativeEnum(ha.AgentHandoffStartedEventType);ha.AgentHandoffStartedEventType$outboundSchema=ha.AgentHandoffStartedEventType$inboundSchema;var $Cr;(function(t){t.inboundSchema=ha.AgentHandoffStartedEventType$inboundSchema,t.outboundSchema=ha.AgentHandoffStartedEventType$outboundSchema})($Cr||(ha.AgentHandoffStartedEventType$=$Cr={}));ha.AgentHandoffStartedEvent$inboundSchema=Vw.object({type:ha.AgentHandoffStartedEventType$inboundSchema.default("agent.handoff.started"),created_at:Vw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Vw.number().int().default(0),id:Vw.string(),previous_agent_id:Vw.string(),previous_agent_name:Vw.string()}).transform(t=>(0,FCr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName"}));ha.AgentHandoffStartedEvent$outboundSchema=Vw.object({type:ha.AgentHandoffStartedEventType$outboundSchema.default("agent.handoff.started"),createdAt:Vw.date().transform(t=>t.toISOString()).optional(),outputIndex:Vw.number().int().default(0),id:Vw.string(),previousAgentId:Vw.string(),previousAgentName:Vw.string()}).transform(t=>(0,FCr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name"}));var LCr;(function(t){t.inboundSchema=ha.AgentHandoffStartedEvent$inboundSchema,t.outboundSchema=ha.AgentHandoffStartedEvent$outboundSchema})(LCr||(ha.AgentHandoffStartedEvent$=LCr={}));function hwo(t){return JSON.stringify(ha.AgentHandoffStartedEvent$outboundSchema.parse(t))}function gwo(t){return(0,mwo.safeParse)(t,e=>ha.AgentHandoffStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffStartedEvent' from JSON")}});var nct=S(ga=>{"use strict";var ywo=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]}),bwo=ga&&ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_wo=ga&&ga.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ywo(r,e,n[o]);return bwo(r,e),r}}();Object.defineProperty(ga,"__esModule",{value:!0});ga.AudioChunk$=ga.AudioChunk$outboundSchema=ga.AudioChunk$inboundSchema=ga.AudioChunkType$=ga.AudioChunkType$outboundSchema=ga.AudioChunkType$inboundSchema=ga.AudioChunkType=void 0;ga.audioChunkToJSON=wwo;ga.audioChunkFromJSON=Swo;var Ise=_wo(ae()),UCr=ce(),vwo=ee();ga.AudioChunkType={InputAudio:"input_audio"};ga.AudioChunkType$inboundSchema=Ise.nativeEnum(ga.AudioChunkType);ga.AudioChunkType$outboundSchema=ga.AudioChunkType$inboundSchema;var kCr;(function(t){t.inboundSchema=ga.AudioChunkType$inboundSchema,t.outboundSchema=ga.AudioChunkType$outboundSchema})(kCr||(ga.AudioChunkType$=kCr={}));ga.AudioChunk$inboundSchema=Ise.object({input_audio:Ise.string(),type:ga.AudioChunkType$inboundSchema.default("input_audio")}).transform(t=>(0,UCr.remap)(t,{input_audio:"inputAudio"}));ga.AudioChunk$outboundSchema=Ise.object({inputAudio:Ise.string(),type:ga.AudioChunkType$outboundSchema.default("input_audio")}).transform(t=>(0,UCr.remap)(t,{inputAudio:"input_audio"}));var qCr;(function(t){t.inboundSchema=ga.AudioChunk$inboundSchema,t.outboundSchema=ga.AudioChunk$outboundSchema})(qCr||(ga.AudioChunk$=qCr={}));function wwo(t){return JSON.stringify(ga.AudioChunk$outboundSchema.parse(t))}function Swo(t){return(0,vwo.safeParse)(t,e=>ga.AudioChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioChunk' from JSON")}});var o3=S(ya=>{"use strict";var Cwo=ya&&ya.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xwo=ya&&ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Two=ya&&ya.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cwo(r,e,n[o]);return xwo(r,e),r}}();Object.defineProperty(ya,"__esModule",{value:!0});ya.DocumentURLChunk$=ya.DocumentURLChunk$outboundSchema=ya.DocumentURLChunk$inboundSchema=ya.DocumentURLChunkType$=ya.DocumentURLChunkType$outboundSchema=ya.DocumentURLChunkType$inboundSchema=ya.DocumentURLChunkType=void 0;ya.documentURLChunkToJSON=Ewo;ya.documentURLChunkFromJSON=Pwo;var KD=Two(ae()),VCr=ce(),Owo=ee();ya.DocumentURLChunkType={DocumentUrl:"document_url"};ya.DocumentURLChunkType$inboundSchema=KD.nativeEnum(ya.DocumentURLChunkType);ya.DocumentURLChunkType$outboundSchema=ya.DocumentURLChunkType$inboundSchema;var BCr;(function(t){t.inboundSchema=ya.DocumentURLChunkType$inboundSchema,t.outboundSchema=ya.DocumentURLChunkType$outboundSchema})(BCr||(ya.DocumentURLChunkType$=BCr={}));ya.DocumentURLChunk$inboundSchema=KD.object({document_url:KD.string(),document_name:KD.nullable(KD.string()).optional(),type:ya.DocumentURLChunkType$inboundSchema.default("document_url")}).transform(t=>(0,VCr.remap)(t,{document_url:"documentUrl",document_name:"documentName"}));ya.DocumentURLChunk$outboundSchema=KD.object({documentUrl:KD.string(),documentName:KD.nullable(KD.string()).optional(),type:ya.DocumentURLChunkType$outboundSchema.default("document_url")}).transform(t=>(0,VCr.remap)(t,{documentUrl:"document_url",documentName:"document_name"}));var zCr;(function(t){t.inboundSchema=ya.DocumentURLChunk$inboundSchema,t.outboundSchema=ya.DocumentURLChunk$outboundSchema})(zCr||(ya.DocumentURLChunk$=zCr={}));function Ewo(t){return JSON.stringify(ya.DocumentURLChunk$outboundSchema.parse(t))}function Pwo(t){return(0,Owo.safeParse)(t,e=>ya.DocumentURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentURLChunk' from JSON")}});var XMe=S(Gd=>{"use strict";var Mwo=Gd&&Gd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rwo=Gd&&Gd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iwo=Gd&&Gd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mwo(r,e,n[o]);return Rwo(r,e),r}}();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.FileChunk$=Gd.FileChunk$outboundSchema=Gd.FileChunk$inboundSchema=void 0;Gd.fileChunkToJSON=Nwo;Gd.fileChunkFromJSON=Dwo;var l7=Iwo(ae()),WCr=ce(),Awo=ee();Gd.FileChunk$inboundSchema=l7.object({type:l7.literal("file").default("file"),file_id:l7.string()}).transform(t=>(0,WCr.remap)(t,{file_id:"fileId"}));Gd.FileChunk$outboundSchema=l7.object({type:l7.literal("file").default("file"),fileId:l7.string()}).transform(t=>(0,WCr.remap)(t,{fileId:"file_id"}));var HCr;(function(t){t.inboundSchema=Gd.FileChunk$inboundSchema,t.outboundSchema=Gd.FileChunk$outboundSchema})(HCr||(Gd.FileChunk$=HCr={}));function Nwo(t){return JSON.stringify(Gd.FileChunk$outboundSchema.parse(t))}function Dwo(t){return(0,Awo.safeParse)(t,e=>Gd.FileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileChunk' from JSON")}});var oct=S(Xd=>{"use strict";var jwo=Xd&&Xd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$wo=Xd&&Xd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lwo=Xd&&Xd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jwo(r,e,n[o]);return $wo(r,e),r}}();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.ImageURL$=Xd.ImageURL$outboundSchema=Xd.ImageURL$inboundSchema=void 0;Xd.imageURLToJSON=kwo;Xd.imageURLFromJSON=qwo;var tU=Lwo(ae()),Fwo=ee();Xd.ImageURL$inboundSchema=tU.object({url:tU.string(),detail:tU.nullable(tU.string()).optional()});Xd.ImageURL$outboundSchema=tU.object({url:tU.string(),detail:tU.nullable(tU.string()).optional()});var JCr;(function(t){t.inboundSchema=Xd.ImageURL$inboundSchema,t.outboundSchema=Xd.ImageURL$outboundSchema})(JCr||(Xd.ImageURL$=JCr={}));function kwo(t){return JSON.stringify(Xd.ImageURL$outboundSchema.parse(t))}function qwo(t){return(0,Fwo.safeParse)(t,e=>Xd.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var i3=S(po=>{"use strict";var Uwo=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]}),Bwo=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zwo=po&&po.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uwo(r,e,n[o]);return Bwo(r,e),r}}();Object.defineProperty(po,"__esModule",{value:!0});po.ImageURLChunk$=po.ImageURLChunk$outboundSchema=po.ImageURLChunk$inboundSchema=po.ImageURLChunkType$=po.ImageURLChunkType$outboundSchema=po.ImageURLChunkType$inboundSchema=po.ImageURLChunkImageURL$=po.ImageURLChunkImageURL$outboundSchema=po.ImageURLChunkImageURL$inboundSchema=po.ImageURLChunkType=void 0;po.imageURLChunkImageURLToJSON=Vwo;po.imageURLChunkImageURLFromJSON=Hwo;po.imageURLChunkToJSON=Wwo;po.imageURLChunkFromJSON=Jwo;var Jx=zwo(ae()),ZCr=ce(),YCr=ee(),ZMe=oct();po.ImageURLChunkType={ImageUrl:"image_url"};po.ImageURLChunkImageURL$inboundSchema=Jx.union([ZMe.ImageURL$inboundSchema,Jx.string()]);po.ImageURLChunkImageURL$outboundSchema=Jx.union([ZMe.ImageURL$outboundSchema,Jx.string()]);var KCr;(function(t){t.inboundSchema=po.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=po.ImageURLChunkImageURL$outboundSchema})(KCr||(po.ImageURLChunkImageURL$=KCr={}));function Vwo(t){return JSON.stringify(po.ImageURLChunkImageURL$outboundSchema.parse(t))}function Hwo(t){return(0,YCr.safeParse)(t,e=>po.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}po.ImageURLChunkType$inboundSchema=Jx.nativeEnum(po.ImageURLChunkType);po.ImageURLChunkType$outboundSchema=po.ImageURLChunkType$inboundSchema;var GCr;(function(t){t.inboundSchema=po.ImageURLChunkType$inboundSchema,t.outboundSchema=po.ImageURLChunkType$outboundSchema})(GCr||(po.ImageURLChunkType$=GCr={}));po.ImageURLChunk$inboundSchema=Jx.object({image_url:Jx.union([ZMe.ImageURL$inboundSchema,Jx.string()]),type:po.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,ZCr.remap)(t,{image_url:"imageUrl"}));po.ImageURLChunk$outboundSchema=Jx.object({imageUrl:Jx.union([ZMe.ImageURL$outboundSchema,Jx.string()]),type:po.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,ZCr.remap)(t,{imageUrl:"image_url"}));var XCr;(function(t){t.inboundSchema=po.ImageURLChunk$inboundSchema,t.outboundSchema=po.ImageURLChunk$outboundSchema})(XCr||(po.ImageURLChunk$=XCr={}));function Wwo(t){return JSON.stringify(po.ImageURLChunk$outboundSchema.parse(t))}function Jwo(t){return(0,YCr.safeParse)(t,e=>po.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var YMe=S(ba=>{"use strict";var Kwo=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]}),Gwo=ba&&ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xwo=ba&&ba.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Kwo(r,e,n[o]);return Gwo(r,e),r}}();Object.defineProperty(ba,"__esModule",{value:!0});ba.ReferenceChunk$=ba.ReferenceChunk$outboundSchema=ba.ReferenceChunk$inboundSchema=ba.ReferenceChunkType$=ba.ReferenceChunkType$outboundSchema=ba.ReferenceChunkType$inboundSchema=ba.ReferenceChunkType=void 0;ba.referenceChunkToJSON=Ywo;ba.referenceChunkFromJSON=Qwo;var a3=Xwo(ae()),txr=ce(),Zwo=ee();ba.ReferenceChunkType={Reference:"reference"};ba.ReferenceChunkType$inboundSchema=a3.nativeEnum(ba.ReferenceChunkType);ba.ReferenceChunkType$outboundSchema=ba.ReferenceChunkType$inboundSchema;var QCr;(function(t){t.inboundSchema=ba.ReferenceChunkType$inboundSchema,t.outboundSchema=ba.ReferenceChunkType$outboundSchema})(QCr||(ba.ReferenceChunkType$=QCr={}));ba.ReferenceChunk$inboundSchema=a3.object({reference_ids:a3.array(a3.number().int()),type:ba.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,txr.remap)(t,{reference_ids:"referenceIds"}));ba.ReferenceChunk$outboundSchema=a3.object({referenceIds:a3.array(a3.number().int()),type:ba.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,txr.remap)(t,{referenceIds:"reference_ids"}));var exr;(function(t){t.inboundSchema=ba.ReferenceChunk$inboundSchema,t.outboundSchema=ba.ReferenceChunk$outboundSchema})(exr||(ba.ReferenceChunk$=exr={}));function Ywo(t){return JSON.stringify(ba.ReferenceChunk$outboundSchema.parse(t))}function Qwo(t){return(0,Zwo.safeParse)(t,e=>ba.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var rU=S(_a=>{"use strict";var eSo=_a&&_a.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tSo=_a&&_a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rSo=_a&&_a.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eSo(r,e,n[o]);return tSo(r,e),r}}();Object.defineProperty(_a,"__esModule",{value:!0});_a.TextChunk$=_a.TextChunk$outboundSchema=_a.TextChunk$inboundSchema=_a.TextChunkType$=_a.TextChunkType$outboundSchema=_a.TextChunkType$inboundSchema=_a.TextChunkType=void 0;_a.textChunkToJSON=oSo;_a.textChunkFromJSON=iSo;var Ase=rSo(ae()),nSo=ee();_a.TextChunkType={Text:"text"};_a.TextChunkType$inboundSchema=Ase.nativeEnum(_a.TextChunkType);_a.TextChunkType$outboundSchema=_a.TextChunkType$inboundSchema;var rxr;(function(t){t.inboundSchema=_a.TextChunkType$inboundSchema,t.outboundSchema=_a.TextChunkType$outboundSchema})(rxr||(_a.TextChunkType$=rxr={}));_a.TextChunk$inboundSchema=Ase.object({text:Ase.string(),type:_a.TextChunkType$inboundSchema.default("text")});_a.TextChunk$outboundSchema=Ase.object({text:Ase.string(),type:_a.TextChunkType$outboundSchema.default("text")});var nxr;(function(t){t.inboundSchema=_a.TextChunk$inboundSchema,t.outboundSchema=_a.TextChunk$outboundSchema})(nxr||(_a.TextChunk$=nxr={}));function oSo(t){return JSON.stringify(_a.TextChunk$outboundSchema.parse(t))}function iSo(t){return(0,nSo.safeParse)(t,e=>_a.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var s3=S(mo=>{"use strict";var aSo=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]}),sSo=mo&&mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uSo=mo&&mo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aSo(r,e,n[o]);return sSo(r,e),r}}();Object.defineProperty(mo,"__esModule",{value:!0});mo.ThinkChunk$=mo.ThinkChunk$outboundSchema=mo.ThinkChunk$inboundSchema=mo.ThinkChunkType$=mo.ThinkChunkType$outboundSchema=mo.ThinkChunkType$inboundSchema=mo.Thinking$=mo.Thinking$outboundSchema=mo.Thinking$inboundSchema=mo.ThinkChunkType=void 0;mo.thinkingToJSON=lSo;mo.thinkingFromJSON=cSo;mo.thinkChunkToJSON=dSo;mo.thinkChunkFromJSON=fSo;var Kx=uSo(ae()),sxr=ee(),QMe=YMe(),eRe=rU();mo.ThinkChunkType={Thinking:"thinking"};mo.Thinking$inboundSchema=Kx.union([QMe.ReferenceChunk$inboundSchema,eRe.TextChunk$inboundSchema]);mo.Thinking$outboundSchema=Kx.union([QMe.ReferenceChunk$outboundSchema,eRe.TextChunk$outboundSchema]);var oxr;(function(t){t.inboundSchema=mo.Thinking$inboundSchema,t.outboundSchema=mo.Thinking$outboundSchema})(oxr||(mo.Thinking$=oxr={}));function lSo(t){return JSON.stringify(mo.Thinking$outboundSchema.parse(t))}function cSo(t){return(0,sxr.safeParse)(t,e=>mo.Thinking$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Thinking' from JSON")}mo.ThinkChunkType$inboundSchema=Kx.nativeEnum(mo.ThinkChunkType);mo.ThinkChunkType$outboundSchema=mo.ThinkChunkType$inboundSchema;var ixr;(function(t){t.inboundSchema=mo.ThinkChunkType$inboundSchema,t.outboundSchema=mo.ThinkChunkType$outboundSchema})(ixr||(mo.ThinkChunkType$=ixr={}));mo.ThinkChunk$inboundSchema=Kx.object({thinking:Kx.array(Kx.union([QMe.ReferenceChunk$inboundSchema,eRe.TextChunk$inboundSchema])),closed:Kx.boolean().optional(),type:mo.ThinkChunkType$inboundSchema.default("thinking")});mo.ThinkChunk$outboundSchema=Kx.object({thinking:Kx.array(Kx.union([QMe.ReferenceChunk$outboundSchema,eRe.TextChunk$outboundSchema])),closed:Kx.boolean().optional(),type:mo.ThinkChunkType$outboundSchema.default("thinking")});var axr;(function(t){t.inboundSchema=mo.ThinkChunk$inboundSchema,t.outboundSchema=mo.ThinkChunk$outboundSchema})(axr||(mo.ThinkChunk$=axr={}));function dSo(t){return JSON.stringify(mo.ThinkChunk$outboundSchema.parse(t))}function fSo(t){return(0,sxr.safeParse)(t,e=>mo.ThinkChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ThinkChunk' from JSON")}});var c7=S(Zd=>{"use strict";var pSo=Zd&&Zd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mSo=Zd&&Zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hSo=Zd&&Zd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pSo(r,e,n[o]);return mSo(r,e),r}}();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ContentChunk$=Zd.ContentChunk$outboundSchema=Zd.ContentChunk$inboundSchema=void 0;Zd.contentChunkToJSON=ySo;Zd.contentChunkFromJSON=bSo;var Qs=hSo(ae()),gSo=ee(),lxr=nct(),cxr=o3(),dxr=XMe(),fxr=i3(),pxr=YMe(),mxr=rU(),hxr=s3();Zd.ContentChunk$inboundSchema=Qs.union([fxr.ImageURLChunk$inboundSchema.and(Qs.object({type:Qs.literal("image_url")}).transform(t=>({type:t.type}))),cxr.DocumentURLChunk$inboundSchema.and(Qs.object({type:Qs.literal("document_url")}).transform(t=>({type:t.type}))),mxr.TextChunk$inboundSchema.and(Qs.object({type:Qs.literal("text")}).transform(t=>({type:t.type}))),pxr.ReferenceChunk$inboundSchema.and(Qs.object({type:Qs.literal("reference")}).transform(t=>({type:t.type}))),dxr.FileChunk$inboundSchema.and(Qs.object({type:Qs.literal("file")}).transform(t=>({type:t.type}))),hxr.ThinkChunk$inboundSchema.and(Qs.object({type:Qs.literal("thinking")}).transform(t=>({type:t.type}))),lxr.AudioChunk$inboundSchema.and(Qs.object({type:Qs.literal("input_audio")}).transform(t=>({type:t.type})))]);Zd.ContentChunk$outboundSchema=Qs.union([fxr.ImageURLChunk$outboundSchema.and(Qs.object({type:Qs.literal("image_url")}).transform(t=>({type:t.type}))),cxr.DocumentURLChunk$outboundSchema.and(Qs.object({type:Qs.literal("document_url")}).transform(t=>({type:t.type}))),mxr.TextChunk$outboundSchema.and(Qs.object({type:Qs.literal("text")}).transform(t=>({type:t.type}))),pxr.ReferenceChunk$outboundSchema.and(Qs.object({type:Qs.literal("reference")}).transform(t=>({type:t.type}))),dxr.FileChunk$outboundSchema.and(Qs.object({type:Qs.literal("file")}).transform(t=>({type:t.type}))),hxr.ThinkChunk$outboundSchema.and(Qs.object({type:Qs.literal("thinking")}).transform(t=>({type:t.type}))),lxr.AudioChunk$outboundSchema.and(Qs.object({type:Qs.literal("input_audio")}).transform(t=>({type:t.type})))]);var uxr;(function(t){t.inboundSchema=Zd.ContentChunk$inboundSchema,t.outboundSchema=Zd.ContentChunk$outboundSchema})(uxr||(Zd.ContentChunk$=uxr={}));function ySo(t){return JSON.stringify(Zd.ContentChunk$outboundSchema.parse(t))}function bSo(t){return(0,gSo.safeParse)(t,e=>Zd.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var ict=S(fs=>{"use strict";var _So=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]}),vSo=fs&&fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wSo=fs&&fs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_So(r,e,n[o]);return vSo(r,e),r}}();Object.defineProperty(fs,"__esModule",{value:!0});fs.FunctionCall$=fs.FunctionCall$outboundSchema=fs.FunctionCall$inboundSchema=fs.Arguments$=fs.Arguments$outboundSchema=fs.Arguments$inboundSchema=void 0;fs.argumentsToJSON=SSo;fs.argumentsFromJSON=CSo;fs.functionCallToJSON=xSo;fs.functionCallFromJSON=TSo;var Yd=wSo(ae()),bxr=ee();fs.Arguments$inboundSchema=Yd.union([Yd.record(Yd.any()),Yd.string()]);fs.Arguments$outboundSchema=Yd.union([Yd.record(Yd.any()),Yd.string()]);var gxr;(function(t){t.inboundSchema=fs.Arguments$inboundSchema,t.outboundSchema=fs.Arguments$outboundSchema})(gxr||(fs.Arguments$=gxr={}));function SSo(t){return JSON.stringify(fs.Arguments$outboundSchema.parse(t))}function CSo(t){return(0,bxr.safeParse)(t,e=>fs.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}fs.FunctionCall$inboundSchema=Yd.object({name:Yd.string(),arguments:Yd.union([Yd.record(Yd.any()),Yd.string()])});fs.FunctionCall$outboundSchema=Yd.object({name:Yd.string(),arguments:Yd.union([Yd.record(Yd.any()),Yd.string()])});var yxr;(function(t){t.inboundSchema=fs.FunctionCall$inboundSchema,t.outboundSchema=fs.FunctionCall$outboundSchema})(yxr||(fs.FunctionCall$=yxr={}));function xSo(t){return JSON.stringify(fs.FunctionCall$outboundSchema.parse(t))}function TSo(t){return(0,bxr.safeParse)(t,e=>fs.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var Gx=S(act=>{"use strict";Object.defineProperty(act,"__esModule",{value:!0});act.catchUnrecognizedEnum=OSo;function OSo(t){return t}});var Nse=S(Qd=>{"use strict";var ESo=Qd&&Qd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PSo=Qd&&Qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MSo=Qd&&Qd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ESo(r,e,n[o]);return PSo(r,e),r}}();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ToolTypes$=Qd.ToolTypes$outboundSchema=Qd.ToolTypes$inboundSchema=Qd.ToolTypes=void 0;var u3=MSo(ae()),RSo=Gx();Qd.ToolTypes={Function:"function"};Qd.ToolTypes$inboundSchema=u3.union([u3.nativeEnum(Qd.ToolTypes),u3.string().transform(RSo.catchUnrecognizedEnum)]);Qd.ToolTypes$outboundSchema=u3.union([u3.nativeEnum(Qd.ToolTypes),u3.string().and(u3.custom())]);var _xr;(function(t){t.inboundSchema=Qd.ToolTypes$inboundSchema,t.outboundSchema=Qd.ToolTypes$outboundSchema})(_xr||(Qd.ToolTypes$=_xr={}))});var tRe=S(ef=>{"use strict";var ISo=ef&&ef.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ASo=ef&&ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NSo=ef&&ef.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ISo(r,e,n[o]);return ASo(r,e),r}}();Object.defineProperty(ef,"__esModule",{value:!0});ef.ToolCall$=ef.ToolCall$outboundSchema=ef.ToolCall$inboundSchema=void 0;ef.toolCallToJSON=jSo;ef.toolCallFromJSON=$So;var d7=NSo(ae()),DSo=ee(),wxr=ict(),Sxr=Nse();ef.ToolCall$inboundSchema=d7.object({id:d7.string().default("null"),type:Sxr.ToolTypes$inboundSchema.optional(),function:wxr.FunctionCall$inboundSchema,index:d7.number().int().default(0)});ef.ToolCall$outboundSchema=d7.object({id:d7.string().default("null"),type:Sxr.ToolTypes$outboundSchema.optional(),function:wxr.FunctionCall$outboundSchema,index:d7.number().int().default(0)});var vxr;(function(t){t.inboundSchema=ef.ToolCall$inboundSchema,t.outboundSchema=ef.ToolCall$outboundSchema})(vxr||(ef.ToolCall$=vxr={}));function jSo(t){return JSON.stringify(ef.ToolCall$outboundSchema.parse(t))}function $So(t){return(0,DSo.safeParse)(t,e=>ef.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var NA=S(ho=>{"use strict";var LSo=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]}),FSo=ho&&ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kSo=ho&&ho.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LSo(r,e,n[o]);return FSo(r,e),r}}();Object.defineProperty(ho,"__esModule",{value:!0});ho.AssistantMessage$=ho.AssistantMessage$outboundSchema=ho.AssistantMessage$inboundSchema=ho.AssistantMessageRole$=ho.AssistantMessageRole$outboundSchema=ho.AssistantMessageRole$inboundSchema=ho.AssistantMessageContent$=ho.AssistantMessageContent$outboundSchema=ho.AssistantMessageContent$inboundSchema=ho.AssistantMessageRole=void 0;ho.assistantMessageContentToJSON=qSo;ho.assistantMessageContentFromJSON=USo;ho.assistantMessageToJSON=BSo;ho.assistantMessageFromJSON=zSo;var Oc=kSo(ae()),Oxr=ce(),Exr=ee(),rRe=c7(),Pxr=tRe();ho.AssistantMessageRole={Assistant:"assistant"};ho.AssistantMessageContent$inboundSchema=Oc.union([Oc.string(),Oc.array(rRe.ContentChunk$inboundSchema)]);ho.AssistantMessageContent$outboundSchema=Oc.union([Oc.string(),Oc.array(rRe.ContentChunk$outboundSchema)]);var Cxr;(function(t){t.inboundSchema=ho.AssistantMessageContent$inboundSchema,t.outboundSchema=ho.AssistantMessageContent$outboundSchema})(Cxr||(ho.AssistantMessageContent$=Cxr={}));function qSo(t){return JSON.stringify(ho.AssistantMessageContent$outboundSchema.parse(t))}function USo(t){return(0,Exr.safeParse)(t,e=>ho.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}ho.AssistantMessageRole$inboundSchema=Oc.nativeEnum(ho.AssistantMessageRole);ho.AssistantMessageRole$outboundSchema=ho.AssistantMessageRole$inboundSchema;var xxr;(function(t){t.inboundSchema=ho.AssistantMessageRole$inboundSchema,t.outboundSchema=ho.AssistantMessageRole$outboundSchema})(xxr||(ho.AssistantMessageRole$=xxr={}));ho.AssistantMessage$inboundSchema=Oc.object({content:Oc.nullable(Oc.union([Oc.string(),Oc.array(rRe.ContentChunk$inboundSchema)])).optional(),tool_calls:Oc.nullable(Oc.array(Pxr.ToolCall$inboundSchema)).optional(),prefix:Oc.boolean().default(!1),role:ho.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,Oxr.remap)(t,{tool_calls:"toolCalls"}));ho.AssistantMessage$outboundSchema=Oc.object({content:Oc.nullable(Oc.union([Oc.string(),Oc.array(rRe.ContentChunk$outboundSchema)])).optional(),toolCalls:Oc.nullable(Oc.array(Pxr.ToolCall$outboundSchema)).optional(),prefix:Oc.boolean().default(!1),role:ho.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,Oxr.remap)(t,{toolCalls:"tool_calls"}));var Txr;(function(t){t.inboundSchema=ho.AssistantMessage$inboundSchema,t.outboundSchema=ho.AssistantMessage$outboundSchema})(Txr||(ho.AssistantMessage$=Txr={}));function BSo(t){return JSON.stringify(ho.AssistantMessage$outboundSchema.parse(t))}function zSo(t){return(0,Exr.safeParse)(t,e=>ho.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var f7=S(tf=>{"use strict";var VSo=tf&&tf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HSo=tf&&tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WSo=tf&&tf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VSo(r,e,n[o]);return HSo(r,e),r}}();Object.defineProperty(tf,"__esModule",{value:!0});tf.MistralPromptMode$=tf.MistralPromptMode$outboundSchema=tf.MistralPromptMode$inboundSchema=tf.MistralPromptMode=void 0;var l3=WSo(ae()),JSo=Gx();tf.MistralPromptMode={Reasoning:"reasoning"};tf.MistralPromptMode$inboundSchema=l3.union([l3.nativeEnum(tf.MistralPromptMode),l3.string().transform(JSo.catchUnrecognizedEnum)]);tf.MistralPromptMode$outboundSchema=l3.union([l3.nativeEnum(tf.MistralPromptMode),l3.string().and(l3.custom())]);var Mxr;(function(t){t.inboundSchema=tf.MistralPromptMode$inboundSchema,t.outboundSchema=tf.MistralPromptMode$outboundSchema})(Mxr||(tf.MistralPromptMode$=Mxr={}))});var sct=S(rf=>{"use strict";var KSo=rf&&rf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GSo=rf&&rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XSo=rf&&rf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KSo(r,e,n[o]);return GSo(r,e),r}}();Object.defineProperty(rf,"__esModule",{value:!0});rf.SystemMessageContentChunks$=rf.SystemMessageContentChunks$outboundSchema=rf.SystemMessageContentChunks$inboundSchema=void 0;rf.systemMessageContentChunksToJSON=YSo;rf.systemMessageContentChunksFromJSON=QSo;var DA=XSo(ae()),ZSo=ee(),Ixr=rU(),Axr=s3();rf.SystemMessageContentChunks$inboundSchema=DA.union([Ixr.TextChunk$inboundSchema.and(DA.object({type:DA.literal("text")}).transform(t=>({type:t.type}))),Axr.ThinkChunk$inboundSchema.and(DA.object({type:DA.literal("thinking")}).transform(t=>({type:t.type})))]);rf.SystemMessageContentChunks$outboundSchema=DA.union([Ixr.TextChunk$outboundSchema.and(DA.object({type:DA.literal("text")}).transform(t=>({type:t.type}))),Axr.ThinkChunk$outboundSchema.and(DA.object({type:DA.literal("thinking")}).transform(t=>({type:t.type})))]);var Rxr;(function(t){t.inboundSchema=rf.SystemMessageContentChunks$inboundSchema,t.outboundSchema=rf.SystemMessageContentChunks$outboundSchema})(Rxr||(rf.SystemMessageContentChunks$=Rxr={}));function YSo(t){return JSON.stringify(rf.SystemMessageContentChunks$outboundSchema.parse(t))}function QSo(t){return(0,ZSo.safeParse)(t,e=>rf.SystemMessageContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContentChunks' from JSON")}});var GD=S(go=>{"use strict";var e0o=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]}),t0o=go&&go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r0o=go&&go.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&e0o(r,e,n[o]);return t0o(r,e),r}}();Object.defineProperty(go,"__esModule",{value:!0});go.SystemMessage$=go.SystemMessage$outboundSchema=go.SystemMessage$inboundSchema=go.Role$=go.Role$outboundSchema=go.Role$inboundSchema=go.SystemMessageContent$=go.SystemMessageContent$outboundSchema=go.SystemMessageContent$inboundSchema=go.Role=void 0;go.systemMessageContentToJSON=n0o;go.systemMessageContentFromJSON=o0o;go.systemMessageToJSON=i0o;go.systemMessageFromJSON=a0o;var i_=r0o(ae()),$xr=ee(),nRe=sct();go.Role={System:"system"};go.SystemMessageContent$inboundSchema=i_.union([i_.string(),i_.array(nRe.SystemMessageContentChunks$inboundSchema)]);go.SystemMessageContent$outboundSchema=i_.union([i_.string(),i_.array(nRe.SystemMessageContentChunks$outboundSchema)]);var Nxr;(function(t){t.inboundSchema=go.SystemMessageContent$inboundSchema,t.outboundSchema=go.SystemMessageContent$outboundSchema})(Nxr||(go.SystemMessageContent$=Nxr={}));function n0o(t){return JSON.stringify(go.SystemMessageContent$outboundSchema.parse(t))}function o0o(t){return(0,$xr.safeParse)(t,e=>go.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}go.Role$inboundSchema=i_.nativeEnum(go.Role);go.Role$outboundSchema=go.Role$inboundSchema;var Dxr;(function(t){t.inboundSchema=go.Role$inboundSchema,t.outboundSchema=go.Role$outboundSchema})(Dxr||(go.Role$=Dxr={}));go.SystemMessage$inboundSchema=i_.object({content:i_.union([i_.string(),i_.array(nRe.SystemMessageContentChunks$inboundSchema)]),role:go.Role$inboundSchema.default("system")});go.SystemMessage$outboundSchema=i_.object({content:i_.union([i_.string(),i_.array(nRe.SystemMessageContentChunks$outboundSchema)]),role:go.Role$outboundSchema.default("system")});var jxr;(function(t){t.inboundSchema=go.SystemMessage$inboundSchema,t.outboundSchema=go.SystemMessage$outboundSchema})(jxr||(go.SystemMessage$=jxr={}));function i0o(t){return JSON.stringify(go.SystemMessage$outboundSchema.parse(t))}function a0o(t){return(0,$xr.safeParse)(t,e=>go.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var p7=S(nf=>{"use strict";var s0o=nf&&nf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u0o=nf&&nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l0o=nf&&nf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s0o(r,e,n[o]);return u0o(r,e),r}}();Object.defineProperty(nf,"__esModule",{value:!0});nf.Tool$=nf.Tool$outboundSchema=nf.Tool$inboundSchema=void 0;nf.toolToJSON=d0o;nf.toolFromJSON=f0o;var Fxr=l0o(ae()),c0o=ee(),kxr=LMe(),qxr=Nse();nf.Tool$inboundSchema=Fxr.object({type:qxr.ToolTypes$inboundSchema.optional(),function:kxr.FunctionT$inboundSchema});nf.Tool$outboundSchema=Fxr.object({type:qxr.ToolTypes$outboundSchema.optional(),function:kxr.FunctionT$outboundSchema});var Lxr;(function(t){t.inboundSchema=nf.Tool$inboundSchema,t.outboundSchema=nf.Tool$outboundSchema})(Lxr||(nf.Tool$=Lxr={}));function d0o(t){return JSON.stringify(nf.Tool$outboundSchema.parse(t))}function f0o(t){return(0,c0o.safeParse)(t,e=>nf.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var uct=S(of=>{"use strict";var p0o=of&&of.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m0o=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h0o=of&&of.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p0o(r,e,n[o]);return m0o(r,e),r}}();Object.defineProperty(of,"__esModule",{value:!0});of.FunctionName$=of.FunctionName$outboundSchema=of.FunctionName$inboundSchema=void 0;of.functionNameToJSON=y0o;of.functionNameFromJSON=b0o;var oRe=h0o(ae()),g0o=ee();of.FunctionName$inboundSchema=oRe.object({name:oRe.string()});of.FunctionName$outboundSchema=oRe.object({name:oRe.string()});var Uxr;(function(t){t.inboundSchema=of.FunctionName$inboundSchema,t.outboundSchema=of.FunctionName$outboundSchema})(Uxr||(of.FunctionName$=Uxr={}));function y0o(t){return JSON.stringify(of.FunctionName$outboundSchema.parse(t))}function b0o(t){return(0,g0o.safeParse)(t,e=>of.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var m7=S(af=>{"use strict";var _0o=af&&af.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v0o=af&&af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w0o=af&&af.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_0o(r,e,n[o]);return v0o(r,e),r}}();Object.defineProperty(af,"__esModule",{value:!0});af.ToolChoice$=af.ToolChoice$outboundSchema=af.ToolChoice$inboundSchema=void 0;af.toolChoiceToJSON=C0o;af.toolChoiceFromJSON=x0o;var zxr=w0o(ae()),S0o=ee(),Vxr=uct(),Hxr=Nse();af.ToolChoice$inboundSchema=zxr.object({type:Hxr.ToolTypes$inboundSchema.optional(),function:Vxr.FunctionName$inboundSchema});af.ToolChoice$outboundSchema=zxr.object({type:Hxr.ToolTypes$outboundSchema.optional(),function:Vxr.FunctionName$outboundSchema});var Bxr;(function(t){t.inboundSchema=af.ToolChoice$inboundSchema,t.outboundSchema=af.ToolChoice$outboundSchema})(Bxr||(af.ToolChoice$=Bxr={}));function C0o(t){return JSON.stringify(af.ToolChoice$outboundSchema.parse(t))}function x0o(t){return(0,S0o.safeParse)(t,e=>af.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var XD=S(yo=>{"use strict";var T0o=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]}),O0o=yo&&yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E0o=yo&&yo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T0o(r,e,n[o]);return O0o(r,e),r}}();Object.defineProperty(yo,"__esModule",{value:!0});yo.ToolMessage$=yo.ToolMessage$outboundSchema=yo.ToolMessage$inboundSchema=yo.ToolMessageRole$=yo.ToolMessageRole$outboundSchema=yo.ToolMessageRole$inboundSchema=yo.ToolMessageContent$=yo.ToolMessageContent$outboundSchema=yo.ToolMessageContent$inboundSchema=yo.ToolMessageRole=void 0;yo.toolMessageContentToJSON=P0o;yo.toolMessageContentFromJSON=M0o;yo.toolMessageToJSON=R0o;yo.toolMessageFromJSON=I0o;var Ml=E0o(ae()),Gxr=ce(),Xxr=ee(),iRe=c7();yo.ToolMessageRole={Tool:"tool"};yo.ToolMessageContent$inboundSchema=Ml.union([Ml.string(),Ml.array(iRe.ContentChunk$inboundSchema)]);yo.ToolMessageContent$outboundSchema=Ml.union([Ml.string(),Ml.array(iRe.ContentChunk$outboundSchema)]);var Wxr;(function(t){t.inboundSchema=yo.ToolMessageContent$inboundSchema,t.outboundSchema=yo.ToolMessageContent$outboundSchema})(Wxr||(yo.ToolMessageContent$=Wxr={}));function P0o(t){return JSON.stringify(yo.ToolMessageContent$outboundSchema.parse(t))}function M0o(t){return(0,Xxr.safeParse)(t,e=>yo.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}yo.ToolMessageRole$inboundSchema=Ml.nativeEnum(yo.ToolMessageRole);yo.ToolMessageRole$outboundSchema=yo.ToolMessageRole$inboundSchema;var Jxr;(function(t){t.inboundSchema=yo.ToolMessageRole$inboundSchema,t.outboundSchema=yo.ToolMessageRole$outboundSchema})(Jxr||(yo.ToolMessageRole$=Jxr={}));yo.ToolMessage$inboundSchema=Ml.object({content:Ml.nullable(Ml.union([Ml.string(),Ml.array(iRe.ContentChunk$inboundSchema)])),tool_call_id:Ml.nullable(Ml.string()).optional(),name:Ml.nullable(Ml.string()).optional(),role:yo.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,Gxr.remap)(t,{tool_call_id:"toolCallId"}));yo.ToolMessage$outboundSchema=Ml.object({content:Ml.nullable(Ml.union([Ml.string(),Ml.array(iRe.ContentChunk$outboundSchema)])),toolCallId:Ml.nullable(Ml.string()).optional(),name:Ml.nullable(Ml.string()).optional(),role:yo.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,Gxr.remap)(t,{toolCallId:"tool_call_id"}));var Kxr;(function(t){t.inboundSchema=yo.ToolMessage$inboundSchema,t.outboundSchema=yo.ToolMessage$outboundSchema})(Kxr||(yo.ToolMessage$=Kxr={}));function R0o(t){return JSON.stringify(yo.ToolMessage$outboundSchema.parse(t))}function I0o(t){return(0,Xxr.safeParse)(t,e=>yo.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var ZD=S(bo=>{"use strict";var A0o=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]}),N0o=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D0o=bo&&bo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A0o(r,e,n[o]);return N0o(r,e),r}}();Object.defineProperty(bo,"__esModule",{value:!0});bo.UserMessage$=bo.UserMessage$outboundSchema=bo.UserMessage$inboundSchema=bo.UserMessageRole$=bo.UserMessageRole$outboundSchema=bo.UserMessageRole$inboundSchema=bo.UserMessageContent$=bo.UserMessageContent$outboundSchema=bo.UserMessageContent$inboundSchema=bo.UserMessageRole=void 0;bo.userMessageContentToJSON=j0o;bo.userMessageContentFromJSON=$0o;bo.userMessageToJSON=L0o;bo.userMessageFromJSON=F0o;var sy=D0o(ae()),eTr=ee(),aRe=c7();bo.UserMessageRole={User:"user"};bo.UserMessageContent$inboundSchema=sy.union([sy.string(),sy.array(aRe.ContentChunk$inboundSchema)]);bo.UserMessageContent$outboundSchema=sy.union([sy.string(),sy.array(aRe.ContentChunk$outboundSchema)]);var Zxr;(function(t){t.inboundSchema=bo.UserMessageContent$inboundSchema,t.outboundSchema=bo.UserMessageContent$outboundSchema})(Zxr||(bo.UserMessageContent$=Zxr={}));function j0o(t){return JSON.stringify(bo.UserMessageContent$outboundSchema.parse(t))}function $0o(t){return(0,eTr.safeParse)(t,e=>bo.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}bo.UserMessageRole$inboundSchema=sy.nativeEnum(bo.UserMessageRole);bo.UserMessageRole$outboundSchema=bo.UserMessageRole$inboundSchema;var Yxr;(function(t){t.inboundSchema=bo.UserMessageRole$inboundSchema,t.outboundSchema=bo.UserMessageRole$outboundSchema})(Yxr||(bo.UserMessageRole$=Yxr={}));bo.UserMessage$inboundSchema=sy.object({content:sy.nullable(sy.union([sy.string(),sy.array(aRe.ContentChunk$inboundSchema)])),role:bo.UserMessageRole$inboundSchema.default("user")});bo.UserMessage$outboundSchema=sy.object({content:sy.nullable(sy.union([sy.string(),sy.array(aRe.ContentChunk$outboundSchema)])),role:bo.UserMessageRole$outboundSchema.default("user")});var Qxr;(function(t){t.inboundSchema=bo.UserMessage$inboundSchema,t.outboundSchema=bo.UserMessage$outboundSchema})(Qxr||(bo.UserMessage$=Qxr={}));function L0o(t){return JSON.stringify(bo.UserMessage$outboundSchema.parse(t))}function F0o(t){return(0,eTr.safeParse)(t,e=>bo.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var cTr=S(Zr=>{"use strict";var k0o=Zr&&Zr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q0o=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U0o=Zr&&Zr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k0o(r,e,n[o]);return q0o(r,e),r}}();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.AgentsCompletionRequest$=Zr.AgentsCompletionRequest$outboundSchema=Zr.AgentsCompletionRequest$inboundSchema=Zr.AgentsCompletionRequestToolChoice$=Zr.AgentsCompletionRequestToolChoice$outboundSchema=Zr.AgentsCompletionRequestToolChoice$inboundSchema=Zr.AgentsCompletionRequestMessages$=Zr.AgentsCompletionRequestMessages$outboundSchema=Zr.AgentsCompletionRequestMessages$inboundSchema=Zr.AgentsCompletionRequestStop$=Zr.AgentsCompletionRequestStop$outboundSchema=Zr.AgentsCompletionRequestStop$inboundSchema=void 0;Zr.agentsCompletionRequestStopToJSON=B0o;Zr.agentsCompletionRequestStopFromJSON=z0o;Zr.agentsCompletionRequestMessagesToJSON=V0o;Zr.agentsCompletionRequestMessagesFromJSON=H0o;Zr.agentsCompletionRequestToolChoiceToJSON=W0o;Zr.agentsCompletionRequestToolChoiceFromJSON=J0o;Zr.agentsCompletionRequestToJSON=K0o;Zr.agentsCompletionRequestFromJSON=G0o;var Ct=U0o(ae()),iTr=ce(),sRe=ee(),uRe=NA(),aTr=f7(),sTr=t3(),uTr=Gq(),lRe=GD(),lTr=p7(),cRe=m7(),dRe=r3(),fRe=XD(),pRe=ZD();Zr.AgentsCompletionRequestStop$inboundSchema=Ct.union([Ct.string(),Ct.array(Ct.string())]);Zr.AgentsCompletionRequestStop$outboundSchema=Ct.union([Ct.string(),Ct.array(Ct.string())]);var tTr;(function(t){t.inboundSchema=Zr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Zr.AgentsCompletionRequestStop$outboundSchema})(tTr||(Zr.AgentsCompletionRequestStop$=tTr={}));function B0o(t){return JSON.stringify(Zr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function z0o(t){return(0,sRe.safeParse)(t,e=>Zr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Zr.AgentsCompletionRequestMessages$inboundSchema=Ct.union([lRe.SystemMessage$inboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),fRe.ToolMessage$inboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),pRe.UserMessage$inboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),uRe.AssistantMessage$inboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))]);Zr.AgentsCompletionRequestMessages$outboundSchema=Ct.union([lRe.SystemMessage$outboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),fRe.ToolMessage$outboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),pRe.UserMessage$outboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),uRe.AssistantMessage$outboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))]);var rTr;(function(t){t.inboundSchema=Zr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Zr.AgentsCompletionRequestMessages$outboundSchema})(rTr||(Zr.AgentsCompletionRequestMessages$=rTr={}));function V0o(t){return JSON.stringify(Zr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function H0o(t){return(0,sRe.safeParse)(t,e=>Zr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Zr.AgentsCompletionRequestToolChoice$inboundSchema=Ct.union([cRe.ToolChoice$inboundSchema,dRe.ToolChoiceEnum$inboundSchema]);Zr.AgentsCompletionRequestToolChoice$outboundSchema=Ct.union([cRe.ToolChoice$outboundSchema,dRe.ToolChoiceEnum$outboundSchema]);var nTr;(function(t){t.inboundSchema=Zr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Zr.AgentsCompletionRequestToolChoice$outboundSchema})(nTr||(Zr.AgentsCompletionRequestToolChoice$=nTr={}));function W0o(t){return JSON.stringify(Zr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function J0o(t){return(0,sRe.safeParse)(t,e=>Zr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Zr.AgentsCompletionRequest$inboundSchema=Ct.object({max_tokens:Ct.nullable(Ct.number().int()).optional(),stream:Ct.boolean().default(!1),stop:Ct.union([Ct.string(),Ct.array(Ct.string())]).optional(),random_seed:Ct.nullable(Ct.number().int()).optional(),messages:Ct.array(Ct.union([lRe.SystemMessage$inboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),fRe.ToolMessage$inboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),pRe.UserMessage$inboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),uRe.AssistantMessage$inboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:uTr.ResponseFormat$inboundSchema.optional(),tools:Ct.nullable(Ct.array(lTr.Tool$inboundSchema)).optional(),tool_choice:Ct.union([cRe.ToolChoice$inboundSchema,dRe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ct.number().optional(),frequency_penalty:Ct.number().optional(),n:Ct.nullable(Ct.number().int()).optional(),prediction:sTr.Prediction$inboundSchema.optional(),parallel_tool_calls:Ct.boolean().optional(),prompt_mode:Ct.nullable(aTr.MistralPromptMode$inboundSchema).optional(),agent_id:Ct.string()}).transform(t=>(0,iTr.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",agent_id:"agentId"}));Zr.AgentsCompletionRequest$outboundSchema=Ct.object({maxTokens:Ct.nullable(Ct.number().int()).optional(),stream:Ct.boolean().default(!1),stop:Ct.union([Ct.string(),Ct.array(Ct.string())]).optional(),randomSeed:Ct.nullable(Ct.number().int()).optional(),messages:Ct.array(Ct.union([lRe.SystemMessage$outboundSchema.and(Ct.object({role:Ct.literal("system")}).transform(t=>({role:t.role}))),fRe.ToolMessage$outboundSchema.and(Ct.object({role:Ct.literal("tool")}).transform(t=>({role:t.role}))),pRe.UserMessage$outboundSchema.and(Ct.object({role:Ct.literal("user")}).transform(t=>({role:t.role}))),uRe.AssistantMessage$outboundSchema.and(Ct.object({role:Ct.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:uTr.ResponseFormat$outboundSchema.optional(),tools:Ct.nullable(Ct.array(lTr.Tool$outboundSchema)).optional(),toolChoice:Ct.union([cRe.ToolChoice$outboundSchema,dRe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ct.number().optional(),frequencyPenalty:Ct.number().optional(),n:Ct.nullable(Ct.number().int()).optional(),prediction:sTr.Prediction$outboundSchema.optional(),parallelToolCalls:Ct.boolean().optional(),promptMode:Ct.nullable(aTr.MistralPromptMode$outboundSchema).optional(),agentId:Ct.string()}).transform(t=>(0,iTr.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",agentId:"agent_id"}));var oTr;(function(t){t.inboundSchema=Zr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Zr.AgentsCompletionRequest$outboundSchema})(oTr||(Zr.AgentsCompletionRequest$=oTr={}));function K0o(t){return JSON.stringify(Zr.AgentsCompletionRequest$outboundSchema.parse(t))}function G0o(t){return(0,sRe.safeParse)(t,e=>Zr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var vTr=S(Yr=>{"use strict";var X0o=Yr&&Yr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z0o=Yr&&Yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y0o=Yr&&Yr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X0o(r,e,n[o]);return Z0o(r,e),r}}();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.AgentsCompletionStreamRequest$=Yr.AgentsCompletionStreamRequest$outboundSchema=Yr.AgentsCompletionStreamRequest$inboundSchema=Yr.AgentsCompletionStreamRequestToolChoice$=Yr.AgentsCompletionStreamRequestToolChoice$outboundSchema=Yr.AgentsCompletionStreamRequestToolChoice$inboundSchema=Yr.AgentsCompletionStreamRequestMessages$=Yr.AgentsCompletionStreamRequestMessages$outboundSchema=Yr.AgentsCompletionStreamRequestMessages$inboundSchema=Yr.AgentsCompletionStreamRequestStop$=Yr.AgentsCompletionStreamRequestStop$outboundSchema=Yr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Yr.agentsCompletionStreamRequestStopToJSON=Q0o;Yr.agentsCompletionStreamRequestStopFromJSON=eCo;Yr.agentsCompletionStreamRequestMessagesToJSON=tCo;Yr.agentsCompletionStreamRequestMessagesFromJSON=rCo;Yr.agentsCompletionStreamRequestToolChoiceToJSON=nCo;Yr.agentsCompletionStreamRequestToolChoiceFromJSON=oCo;Yr.agentsCompletionStreamRequestToJSON=iCo;Yr.agentsCompletionStreamRequestFromJSON=aCo;var xt=Y0o(ae()),hTr=ce(),mRe=ee(),hRe=NA(),gTr=f7(),yTr=t3(),bTr=Gq(),gRe=GD(),_Tr=p7(),yRe=m7(),bRe=r3(),_Re=XD(),vRe=ZD();Yr.AgentsCompletionStreamRequestStop$inboundSchema=xt.union([xt.string(),xt.array(xt.string())]);Yr.AgentsCompletionStreamRequestStop$outboundSchema=xt.union([xt.string(),xt.array(xt.string())]);var dTr;(function(t){t.inboundSchema=Yr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Yr.AgentsCompletionStreamRequestStop$outboundSchema})(dTr||(Yr.AgentsCompletionStreamRequestStop$=dTr={}));function Q0o(t){return JSON.stringify(Yr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function eCo(t){return(0,mRe.safeParse)(t,e=>Yr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Yr.AgentsCompletionStreamRequestMessages$inboundSchema=xt.union([gRe.SystemMessage$inboundSchema.and(xt.object({role:xt.literal("system")}).transform(t=>({role:t.role}))),_Re.ToolMessage$inboundSchema.and(xt.object({role:xt.literal("tool")}).transform(t=>({role:t.role}))),vRe.UserMessage$inboundSchema.and(xt.object({role:xt.literal("user")}).transform(t=>({role:t.role}))),hRe.AssistantMessage$inboundSchema.and(xt.object({role:xt.literal("assistant")}).transform(t=>({role:t.role})))]);Yr.AgentsCompletionStreamRequestMessages$outboundSchema=xt.union([gRe.SystemMessage$outboundSchema.and(xt.object({role:xt.literal("system")}).transform(t=>({role:t.role}))),_Re.ToolMessage$outboundSchema.and(xt.object({role:xt.literal("tool")}).transform(t=>({role:t.role}))),vRe.UserMessage$outboundSchema.and(xt.object({role:xt.literal("user")}).transform(t=>({role:t.role}))),hRe.AssistantMessage$outboundSchema.and(xt.object({role:xt.literal("assistant")}).transform(t=>({role:t.role})))]);var fTr;(function(t){t.inboundSchema=Yr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Yr.AgentsCompletionStreamRequestMessages$outboundSchema})(fTr||(Yr.AgentsCompletionStreamRequestMessages$=fTr={}));function tCo(t){return JSON.stringify(Yr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function rCo(t){return(0,mRe.safeParse)(t,e=>Yr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Yr.AgentsCompletionStreamRequestToolChoice$inboundSchema=xt.union([yRe.ToolChoice$inboundSchema,bRe.ToolChoiceEnum$inboundSchema]);Yr.AgentsCompletionStreamRequestToolChoice$outboundSchema=xt.union([yRe.ToolChoice$outboundSchema,bRe.ToolChoiceEnum$outboundSchema]);var pTr;(function(t){t.inboundSchema=Yr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Yr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(pTr||(Yr.AgentsCompletionStreamRequestToolChoice$=pTr={}));function nCo(t){return JSON.stringify(Yr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function oCo(t){return(0,mRe.safeParse)(t,e=>Yr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Yr.AgentsCompletionStreamRequest$inboundSchema=xt.object({max_tokens:xt.nullable(xt.number().int()).optional(),stream:xt.boolean().default(!0),stop:xt.union([xt.string(),xt.array(xt.string())]).optional(),random_seed:xt.nullable(xt.number().int()).optional(),messages:xt.array(xt.union([gRe.SystemMessage$inboundSchema.and(xt.object({role:xt.literal("system")}).transform(t=>({role:t.role}))),_Re.ToolMessage$inboundSchema.and(xt.object({role:xt.literal("tool")}).transform(t=>({role:t.role}))),vRe.UserMessage$inboundSchema.and(xt.object({role:xt.literal("user")}).transform(t=>({role:t.role}))),hRe.AssistantMessage$inboundSchema.and(xt.object({role:xt.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:bTr.ResponseFormat$inboundSchema.optional(),tools:xt.nullable(xt.array(_Tr.Tool$inboundSchema)).optional(),tool_choice:xt.union([yRe.ToolChoice$inboundSchema,bRe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:xt.number().optional(),frequency_penalty:xt.number().optional(),n:xt.nullable(xt.number().int()).optional(),prediction:yTr.Prediction$inboundSchema.optional(),parallel_tool_calls:xt.boolean().optional(),prompt_mode:xt.nullable(gTr.MistralPromptMode$inboundSchema).optional(),agent_id:xt.string()}).transform(t=>(0,hTr.remap)(t,{max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",agent_id:"agentId"}));Yr.AgentsCompletionStreamRequest$outboundSchema=xt.object({maxTokens:xt.nullable(xt.number().int()).optional(),stream:xt.boolean().default(!0),stop:xt.union([xt.string(),xt.array(xt.string())]).optional(),randomSeed:xt.nullable(xt.number().int()).optional(),messages:xt.array(xt.union([gRe.SystemMessage$outboundSchema.and(xt.object({role:xt.literal("system")}).transform(t=>({role:t.role}))),_Re.ToolMessage$outboundSchema.and(xt.object({role:xt.literal("tool")}).transform(t=>({role:t.role}))),vRe.UserMessage$outboundSchema.and(xt.object({role:xt.literal("user")}).transform(t=>({role:t.role}))),hRe.AssistantMessage$outboundSchema.and(xt.object({role:xt.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:bTr.ResponseFormat$outboundSchema.optional(),tools:xt.nullable(xt.array(_Tr.Tool$outboundSchema)).optional(),toolChoice:xt.union([yRe.ToolChoice$outboundSchema,bRe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:xt.number().optional(),frequencyPenalty:xt.number().optional(),n:xt.nullable(xt.number().int()).optional(),prediction:yTr.Prediction$outboundSchema.optional(),parallelToolCalls:xt.boolean().optional(),promptMode:xt.nullable(gTr.MistralPromptMode$outboundSchema).optional(),agentId:xt.string()}).transform(t=>(0,hTr.remap)(t,{maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",agentId:"agent_id"}));var mTr;(function(t){t.inboundSchema=Yr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Yr.AgentsCompletionStreamRequest$outboundSchema})(mTr||(Yr.AgentsCompletionStreamRequest$=mTr={}));function iCo(t){return JSON.stringify(Yr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function aCo(t){return(0,mRe.safeParse)(t,e=>Yr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var OTr=S(ps=>{"use strict";var sCo=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]}),uCo=ps&&ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lCo=ps&&ps.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sCo(r,e,n[o]);return uCo(r,e),r}}();Object.defineProperty(ps,"__esModule",{value:!0});ps.AgentUpdateRequest$=ps.AgentUpdateRequest$outboundSchema=ps.AgentUpdateRequest$inboundSchema=ps.AgentUpdateRequestTools$=ps.AgentUpdateRequestTools$outboundSchema=ps.AgentUpdateRequestTools$inboundSchema=void 0;ps.agentUpdateRequestToolsToJSON=cCo;ps.agentUpdateRequestToolsFromJSON=dCo;ps.agentUpdateRequestToJSON=fCo;ps.agentUpdateRequestFromJSON=pCo;var Wt=lCo(ae()),CTr=ce(),xTr=ee(),wRe=Jq(),TTr=L0(),SRe=Xq(),CRe=Zq(),xRe=Yq(),TRe=Qq(),ORe=eU();ps.AgentUpdateRequestTools$inboundSchema=Wt.union([SRe.DocumentLibraryTool$inboundSchema.and(Wt.object({type:Wt.literal("document_library")}).transform(t=>({type:t.type}))),CRe.FunctionTool$inboundSchema.and(Wt.object({type:Wt.literal("function")}).transform(t=>({type:t.type}))),wRe.CodeInterpreterTool$inboundSchema.and(Wt.object({type:Wt.literal("code_interpreter")}).transform(t=>({type:t.type}))),xRe.ImageGenerationTool$inboundSchema.and(Wt.object({type:Wt.literal("image_generation")}).transform(t=>({type:t.type}))),ORe.WebSearchTool$inboundSchema.and(Wt.object({type:Wt.literal("web_search")}).transform(t=>({type:t.type}))),TRe.WebSearchPremiumTool$inboundSchema.and(Wt.object({type:Wt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);ps.AgentUpdateRequestTools$outboundSchema=Wt.union([SRe.DocumentLibraryTool$outboundSchema.and(Wt.object({type:Wt.literal("document_library")}).transform(t=>({type:t.type}))),CRe.FunctionTool$outboundSchema.and(Wt.object({type:Wt.literal("function")}).transform(t=>({type:t.type}))),wRe.CodeInterpreterTool$outboundSchema.and(Wt.object({type:Wt.literal("code_interpreter")}).transform(t=>({type:t.type}))),xRe.ImageGenerationTool$outboundSchema.and(Wt.object({type:Wt.literal("image_generation")}).transform(t=>({type:t.type}))),ORe.WebSearchTool$outboundSchema.and(Wt.object({type:Wt.literal("web_search")}).transform(t=>({type:t.type}))),TRe.WebSearchPremiumTool$outboundSchema.and(Wt.object({type:Wt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var wTr;(function(t){t.inboundSchema=ps.AgentUpdateRequestTools$inboundSchema,t.outboundSchema=ps.AgentUpdateRequestTools$outboundSchema})(wTr||(ps.AgentUpdateRequestTools$=wTr={}));function cCo(t){return JSON.stringify(ps.AgentUpdateRequestTools$outboundSchema.parse(t))}function dCo(t){return(0,xTr.safeParse)(t,e=>ps.AgentUpdateRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequestTools' from JSON")}ps.AgentUpdateRequest$inboundSchema=Wt.object({instructions:Wt.nullable(Wt.string()).optional(),tools:Wt.array(Wt.union([SRe.DocumentLibraryTool$inboundSchema.and(Wt.object({type:Wt.literal("document_library")}).transform(t=>({type:t.type}))),CRe.FunctionTool$inboundSchema.and(Wt.object({type:Wt.literal("function")}).transform(t=>({type:t.type}))),wRe.CodeInterpreterTool$inboundSchema.and(Wt.object({type:Wt.literal("code_interpreter")}).transform(t=>({type:t.type}))),xRe.ImageGenerationTool$inboundSchema.and(Wt.object({type:Wt.literal("image_generation")}).transform(t=>({type:t.type}))),ORe.WebSearchTool$inboundSchema.and(Wt.object({type:Wt.literal("web_search")}).transform(t=>({type:t.type}))),TRe.WebSearchPremiumTool$inboundSchema.and(Wt.object({type:Wt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:TTr.CompletionArgs$inboundSchema.optional(),model:Wt.nullable(Wt.string()).optional(),name:Wt.nullable(Wt.string()).optional(),description:Wt.nullable(Wt.string()).optional(),handoffs:Wt.nullable(Wt.array(Wt.string())).optional()}).transform(t=>(0,CTr.remap)(t,{completion_args:"completionArgs"}));ps.AgentUpdateRequest$outboundSchema=Wt.object({instructions:Wt.nullable(Wt.string()).optional(),tools:Wt.array(Wt.union([SRe.DocumentLibraryTool$outboundSchema.and(Wt.object({type:Wt.literal("document_library")}).transform(t=>({type:t.type}))),CRe.FunctionTool$outboundSchema.and(Wt.object({type:Wt.literal("function")}).transform(t=>({type:t.type}))),wRe.CodeInterpreterTool$outboundSchema.and(Wt.object({type:Wt.literal("code_interpreter")}).transform(t=>({type:t.type}))),xRe.ImageGenerationTool$outboundSchema.and(Wt.object({type:Wt.literal("image_generation")}).transform(t=>({type:t.type}))),ORe.WebSearchTool$outboundSchema.and(Wt.object({type:Wt.literal("web_search")}).transform(t=>({type:t.type}))),TRe.WebSearchPremiumTool$outboundSchema.and(Wt.object({type:Wt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:TTr.CompletionArgs$outboundSchema.optional(),model:Wt.nullable(Wt.string()).optional(),name:Wt.nullable(Wt.string()).optional(),description:Wt.nullable(Wt.string()).optional(),handoffs:Wt.nullable(Wt.array(Wt.string())).optional()}).transform(t=>(0,CTr.remap)(t,{completionArgs:"completion_args"}));var STr;(function(t){t.inboundSchema=ps.AgentUpdateRequest$inboundSchema,t.outboundSchema=ps.AgentUpdateRequest$outboundSchema})(STr||(ps.AgentUpdateRequest$=STr={}));function fCo(t){return JSON.stringify(ps.AgentUpdateRequest$outboundSchema.parse(t))}function pCo(t){return(0,xTr.safeParse)(t,e=>ps.AgentUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequest' from JSON")}});var lct=S(sf=>{"use strict";var mCo=sf&&sf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hCo=sf&&sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gCo=sf&&sf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mCo(r,e,n[o]);return hCo(r,e),r}}();Object.defineProperty(sf,"__esModule",{value:!0});sf.ApiEndpoint$=sf.ApiEndpoint$outboundSchema=sf.ApiEndpoint$inboundSchema=sf.ApiEndpoint=void 0;var c3=gCo(ae()),yCo=Gx();sf.ApiEndpoint={RootV1ChatCompletions:"/v1/chat/completions",RootV1Embeddings:"/v1/embeddings",RootV1FimCompletions:"/v1/fim/completions",RootV1Moderations:"/v1/moderations",RootV1ChatModerations:"/v1/chat/moderations",RootV1Ocr:"/v1/ocr",RootV1Classifications:"/v1/classifications",RootV1ChatClassifications:"/v1/chat/classifications",RootV1Conversations:"/v1/conversations",RootV1AudioTranscriptions:"/v1/audio/transcriptions"};sf.ApiEndpoint$inboundSchema=c3.union([c3.nativeEnum(sf.ApiEndpoint),c3.string().transform(yCo.catchUnrecognizedEnum)]);sf.ApiEndpoint$outboundSchema=c3.union([c3.nativeEnum(sf.ApiEndpoint),c3.string().and(c3.custom())]);var ETr;(function(t){t.inboundSchema=sf.ApiEndpoint$inboundSchema,t.outboundSchema=sf.ApiEndpoint$outboundSchema})(ETr||(sf.ApiEndpoint$=ETr={}))});var RTr=S(va=>{"use strict";var bCo=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]}),_Co=va&&va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vCo=va&&va.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bCo(r,e,n[o]);return _Co(r,e),r}}();Object.defineProperty(va,"__esModule",{value:!0});va.ArchiveFTModelOut$=va.ArchiveFTModelOut$outboundSchema=va.ArchiveFTModelOut$inboundSchema=va.ArchiveFTModelOutObject$=va.ArchiveFTModelOutObject$outboundSchema=va.ArchiveFTModelOutObject$inboundSchema=va.ArchiveFTModelOutObject=void 0;va.archiveFTModelOutToJSON=SCo;va.archiveFTModelOutFromJSON=CCo;var d3=vCo(ae()),wCo=ee();va.ArchiveFTModelOutObject={Model:"model"};va.ArchiveFTModelOutObject$inboundSchema=d3.nativeEnum(va.ArchiveFTModelOutObject);va.ArchiveFTModelOutObject$outboundSchema=va.ArchiveFTModelOutObject$inboundSchema;var PTr;(function(t){t.inboundSchema=va.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=va.ArchiveFTModelOutObject$outboundSchema})(PTr||(va.ArchiveFTModelOutObject$=PTr={}));va.ArchiveFTModelOut$inboundSchema=d3.object({id:d3.string(),object:va.ArchiveFTModelOutObject$inboundSchema.default("model"),archived:d3.boolean().default(!0)});va.ArchiveFTModelOut$outboundSchema=d3.object({id:d3.string(),object:va.ArchiveFTModelOutObject$outboundSchema.default("model"),archived:d3.boolean().default(!0)});var MTr;(function(t){t.inboundSchema=va.ArchiveFTModelOut$inboundSchema,t.outboundSchema=va.ArchiveFTModelOut$outboundSchema})(MTr||(va.ArchiveFTModelOut$=MTr={}));function SCo(t){return JSON.stringify(va.ArchiveFTModelOut$outboundSchema.parse(t))}function CCo(t){return(0,wCo.safeParse)(t,e=>va.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var YD=S(Xx=>{"use strict";var xCo=Xx&&Xx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TCo=Xx&&Xx.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OCo=Xx&&Xx.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xCo(r,e,n[o]);return TCo(r,e),r}}();Object.defineProperty(Xx,"__esModule",{value:!0});Xx.blobLikeSchema=void 0;Xx.isBlobLike=ITr;var ECo=OCo(ae());Xx.blobLikeSchema=ECo.custom(ITr,{message:"expected a Blob, File or Blob-like object",fatal:!0});function ITr(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 ERe=S(uf=>{"use strict";var PCo=uf&&uf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MCo=uf&&uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RCo=uf&&uf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PCo(r,e,n[o]);return MCo(r,e),r}}();Object.defineProperty(uf,"__esModule",{value:!0});uf.FileT$=uf.FileT$outboundSchema=uf.FileT$inboundSchema=void 0;uf.fileToJSON=ACo;uf.fileFromJSON=NCo;var yv=RCo(ae()),ICo=ee();uf.FileT$inboundSchema=yv.object({fileName:yv.string(),content:yv.union([yv.instanceof(ReadableStream),yv.instanceof(Blob),yv.instanceof(ArrayBuffer),yv.instanceof(Uint8Array)])});uf.FileT$outboundSchema=yv.object({fileName:yv.string(),content:yv.union([yv.instanceof(ReadableStream),yv.instanceof(Blob),yv.instanceof(ArrayBuffer),yv.instanceof(Uint8Array)])});var ATr;(function(t){t.inboundSchema=uf.FileT$inboundSchema,t.outboundSchema=uf.FileT$outboundSchema})(ATr||(uf.FileT$=ATr={}));function ACo(t){return JSON.stringify(uf.FileT$outboundSchema.parse(t))}function NCo(t){return(0,ICo.safeParse)(t,e=>uf.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}});var PRe=S(lf=>{"use strict";var DCo=lf&&lf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jCo=lf&&lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Co=lf&&lf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DCo(r,e,n[o]);return jCo(r,e),r}}();Object.defineProperty(lf,"__esModule",{value:!0});lf.TimestampGranularity$=lf.TimestampGranularity$outboundSchema=lf.TimestampGranularity$inboundSchema=lf.TimestampGranularity=void 0;var LCo=$Co(ae());lf.TimestampGranularity={Segment:"segment"};lf.TimestampGranularity$inboundSchema=LCo.nativeEnum(lf.TimestampGranularity);lf.TimestampGranularity$outboundSchema=lf.TimestampGranularity$inboundSchema;var NTr;(function(t){t.inboundSchema=lf.TimestampGranularity$inboundSchema,t.outboundSchema=lf.TimestampGranularity$outboundSchema})(NTr||(lf.TimestampGranularity$=NTr={}))});var FTr=S(cf=>{"use strict";var FCo=cf&&cf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kCo=cf&&cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qCo=cf&&cf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FCo(r,e,n[o]);return kCo(r,e),r}}();Object.defineProperty(cf,"__esModule",{value:!0});cf.AudioTranscriptionRequest$=cf.AudioTranscriptionRequest$outboundSchema=cf.AudioTranscriptionRequest$inboundSchema=void 0;cf.audioTranscriptionRequestToJSON=zCo;cf.audioTranscriptionRequestFromJSON=VCo;var rc=qCo(ae()),jTr=ce(),UCo=ee(),BCo=YD(),$Tr=ERe(),LTr=PRe();cf.AudioTranscriptionRequest$inboundSchema=rc.object({model:rc.string(),file:$Tr.FileT$inboundSchema.optional(),file_url:rc.nullable(rc.string()).optional(),file_id:rc.nullable(rc.string()).optional(),language:rc.nullable(rc.string()).optional(),temperature:rc.nullable(rc.number()).optional(),stream:rc.literal(!1).default(!1),timestamp_granularities:rc.array(LTr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,jTr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));cf.AudioTranscriptionRequest$outboundSchema=rc.object({model:rc.string(),file:$Tr.FileT$outboundSchema.or(BCo.blobLikeSchema).optional(),fileUrl:rc.nullable(rc.string()).optional(),fileId:rc.nullable(rc.string()).optional(),language:rc.nullable(rc.string()).optional(),temperature:rc.nullable(rc.number()).optional(),stream:rc.literal(!1).default(!1),timestampGranularities:rc.array(LTr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,jTr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var DTr;(function(t){t.inboundSchema=cf.AudioTranscriptionRequest$inboundSchema,t.outboundSchema=cf.AudioTranscriptionRequest$outboundSchema})(DTr||(cf.AudioTranscriptionRequest$=DTr={}));function zCo(t){return JSON.stringify(cf.AudioTranscriptionRequest$outboundSchema.parse(t))}function VCo(t){return(0,UCo.safeParse)(t,e=>cf.AudioTranscriptionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequest' from JSON")}});var zTr=S(df=>{"use strict";var HCo=df&&df.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WCo=df&&df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JCo=df&&df.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HCo(r,e,n[o]);return WCo(r,e),r}}();Object.defineProperty(df,"__esModule",{value:!0});df.AudioTranscriptionRequestStream$=df.AudioTranscriptionRequestStream$outboundSchema=df.AudioTranscriptionRequestStream$inboundSchema=void 0;df.audioTranscriptionRequestStreamToJSON=XCo;df.audioTranscriptionRequestStreamFromJSON=ZCo;var nc=JCo(ae()),qTr=ce(),KCo=ee(),GCo=YD(),UTr=ERe(),BTr=PRe();df.AudioTranscriptionRequestStream$inboundSchema=nc.object({model:nc.string(),file:UTr.FileT$inboundSchema.optional(),file_url:nc.nullable(nc.string()).optional(),file_id:nc.nullable(nc.string()).optional(),language:nc.nullable(nc.string()).optional(),temperature:nc.nullable(nc.number()).optional(),stream:nc.literal(!0).default(!0),timestamp_granularities:nc.array(BTr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,qTr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));df.AudioTranscriptionRequestStream$outboundSchema=nc.object({model:nc.string(),file:UTr.FileT$outboundSchema.or(GCo.blobLikeSchema).optional(),fileUrl:nc.nullable(nc.string()).optional(),fileId:nc.nullable(nc.string()).optional(),language:nc.nullable(nc.string()).optional(),temperature:nc.nullable(nc.number()).optional(),stream:nc.literal(!0).default(!0),timestampGranularities:nc.array(BTr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,qTr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var kTr;(function(t){t.inboundSchema=df.AudioTranscriptionRequestStream$inboundSchema,t.outboundSchema=df.AudioTranscriptionRequestStream$outboundSchema})(kTr||(df.AudioTranscriptionRequestStream$=kTr={}));function XCo(t){return JSON.stringify(df.AudioTranscriptionRequestStream$outboundSchema.parse(t))}function ZCo(t){return(0,KCo.safeParse)(t,e=>df.AudioTranscriptionRequestStream$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequestStream' from JSON")}});var MRe=S(ff=>{"use strict";var YCo=ff&&ff.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),QCo=ff&&ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),exo=ff&&ff.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&YCo(r,e,n[o]);return QCo(r,e),r}}();Object.defineProperty(ff,"__esModule",{value:!0});ff.ModelCapabilities$=ff.ModelCapabilities$outboundSchema=ff.ModelCapabilities$inboundSchema=void 0;ff.modelCapabilitiesToJSON=rxo;ff.modelCapabilitiesFromJSON=nxo;var bv=exo(ae()),HTr=ce(),txo=ee();ff.ModelCapabilities$inboundSchema=bv.object({completion_chat:bv.boolean().default(!0),completion_fim:bv.boolean().default(!1),function_calling:bv.boolean().default(!0),fine_tuning:bv.boolean().default(!1),vision:bv.boolean().default(!1),classification:bv.boolean().default(!1)}).transform(t=>(0,HTr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));ff.ModelCapabilities$outboundSchema=bv.object({completionChat:bv.boolean().default(!0),completionFim:bv.boolean().default(!1),functionCalling:bv.boolean().default(!0),fineTuning:bv.boolean().default(!1),vision:bv.boolean().default(!1),classification:bv.boolean().default(!1)}).transform(t=>(0,HTr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var VTr;(function(t){t.inboundSchema=ff.ModelCapabilities$inboundSchema,t.outboundSchema=ff.ModelCapabilities$outboundSchema})(VTr||(ff.ModelCapabilities$=VTr={}));function rxo(t){return JSON.stringify(ff.ModelCapabilities$outboundSchema.parse(t))}function nxo(t){return(0,txo.safeParse)(t,e=>ff.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var cct=S(ms=>{"use strict";var oxo=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]}),ixo=ms&&ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),axo=ms&&ms.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oxo(r,e,n[o]);return ixo(r,e),r}}();Object.defineProperty(ms,"__esModule",{value:!0});ms.BaseModelCard$=ms.BaseModelCard$outboundSchema=ms.BaseModelCard$inboundSchema=ms.BaseModelCardType$=ms.BaseModelCardType$outboundSchema=ms.BaseModelCardType$inboundSchema=ms.BaseModelCardType=void 0;ms.baseModelCardToJSON=uxo;ms.baseModelCardFromJSON=lxo;var Ti=axo(ae()),KTr=ce(),sxo=ee(),GTr=MRe();ms.BaseModelCardType={Base:"base"};ms.BaseModelCardType$inboundSchema=Ti.nativeEnum(ms.BaseModelCardType);ms.BaseModelCardType$outboundSchema=ms.BaseModelCardType$inboundSchema;var WTr;(function(t){t.inboundSchema=ms.BaseModelCardType$inboundSchema,t.outboundSchema=ms.BaseModelCardType$outboundSchema})(WTr||(ms.BaseModelCardType$=WTr={}));ms.BaseModelCard$inboundSchema=Ti.object({id:Ti.string(),object:Ti.string().default("model"),created:Ti.number().int().optional(),owned_by:Ti.string().default("mistralai"),capabilities:GTr.ModelCapabilities$inboundSchema,name:Ti.nullable(Ti.string()).optional(),description:Ti.nullable(Ti.string()).optional(),max_context_length:Ti.number().int().default(32768),aliases:Ti.array(Ti.string()).optional(),deprecation:Ti.nullable(Ti.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:Ti.nullable(Ti.string()).optional(),default_model_temperature:Ti.nullable(Ti.number()).optional(),type:Ti.literal("base").default("base")}).transform(t=>(0,KTr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));ms.BaseModelCard$outboundSchema=Ti.object({id:Ti.string(),object:Ti.string().default("model"),created:Ti.number().int().optional(),ownedBy:Ti.string().default("mistralai"),capabilities:GTr.ModelCapabilities$outboundSchema,name:Ti.nullable(Ti.string()).optional(),description:Ti.nullable(Ti.string()).optional(),maxContextLength:Ti.number().int().default(32768),aliases:Ti.array(Ti.string()).optional(),deprecation:Ti.nullable(Ti.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:Ti.nullable(Ti.string()).optional(),defaultModelTemperature:Ti.nullable(Ti.number()).optional(),type:Ti.literal("base").default("base")}).transform(t=>(0,KTr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var JTr;(function(t){t.inboundSchema=ms.BaseModelCard$inboundSchema,t.outboundSchema=ms.BaseModelCard$outboundSchema})(JTr||(ms.BaseModelCard$=JTr={}));function uxo(t){return JSON.stringify(ms.BaseModelCard$outboundSchema.parse(t))}function lxo(t){return(0,sxo.safeParse)(t,e=>ms.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var dct=S(pf=>{"use strict";var cxo=pf&&pf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dxo=pf&&pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fxo=pf&&pf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cxo(r,e,n[o]);return dxo(r,e),r}}();Object.defineProperty(pf,"__esModule",{value:!0});pf.BatchError$=pf.BatchError$outboundSchema=pf.BatchError$inboundSchema=void 0;pf.batchErrorToJSON=mxo;pf.batchErrorFromJSON=hxo;var h7=fxo(ae()),pxo=ee();pf.BatchError$inboundSchema=h7.object({message:h7.string(),count:h7.number().int().default(1)});pf.BatchError$outboundSchema=h7.object({message:h7.string(),count:h7.number().int().default(1)});var XTr;(function(t){t.inboundSchema=pf.BatchError$inboundSchema,t.outboundSchema=pf.BatchError$outboundSchema})(XTr||(pf.BatchError$=XTr={}));function mxo(t){return JSON.stringify(pf.BatchError$outboundSchema.parse(t))}function hxo(t){return(0,pxo.safeParse)(t,e=>pf.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var eOr=S(mf=>{"use strict";var gxo=mf&&mf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yxo=mf&&mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bxo=mf&&mf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gxo(r,e,n[o]);return yxo(r,e),r}}();Object.defineProperty(mf,"__esModule",{value:!0});mf.BatchJobIn$=mf.BatchJobIn$outboundSchema=mf.BatchJobIn$inboundSchema=void 0;mf.batchJobInToJSON=vxo;mf.batchJobInFromJSON=wxo;var Jc=bxo(ae()),YTr=ce(),_xo=ee(),QTr=lct();mf.BatchJobIn$inboundSchema=Jc.object({input_files:Jc.array(Jc.string()),endpoint:QTr.ApiEndpoint$inboundSchema,model:Jc.nullable(Jc.string()).optional(),agent_id:Jc.nullable(Jc.string()).optional(),metadata:Jc.nullable(Jc.record(Jc.string())).optional(),timeout_hours:Jc.number().int().default(24)}).transform(t=>(0,YTr.remap)(t,{input_files:"inputFiles",agent_id:"agentId",timeout_hours:"timeoutHours"}));mf.BatchJobIn$outboundSchema=Jc.object({inputFiles:Jc.array(Jc.string()),endpoint:QTr.ApiEndpoint$outboundSchema,model:Jc.nullable(Jc.string()).optional(),agentId:Jc.nullable(Jc.string()).optional(),metadata:Jc.nullable(Jc.record(Jc.string())).optional(),timeoutHours:Jc.number().int().default(24)}).transform(t=>(0,YTr.remap)(t,{inputFiles:"input_files",agentId:"agent_id",timeoutHours:"timeout_hours"}));var ZTr;(function(t){t.inboundSchema=mf.BatchJobIn$inboundSchema,t.outboundSchema=mf.BatchJobIn$outboundSchema})(ZTr||(mf.BatchJobIn$=ZTr={}));function vxo(t){return JSON.stringify(mf.BatchJobIn$outboundSchema.parse(t))}function wxo(t){return(0,_xo.safeParse)(t,e=>mf.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var fct=S(hf=>{"use strict";var Sxo=hf&&hf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cxo=hf&&hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xxo=hf&&hf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Sxo(r,e,n[o]);return Cxo(r,e),r}}();Object.defineProperty(hf,"__esModule",{value:!0});hf.BatchJobStatus$=hf.BatchJobStatus$outboundSchema=hf.BatchJobStatus$inboundSchema=hf.BatchJobStatus=void 0;var Txo=xxo(ae());hf.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};hf.BatchJobStatus$inboundSchema=Txo.nativeEnum(hf.BatchJobStatus);hf.BatchJobStatus$outboundSchema=hf.BatchJobStatus$inboundSchema;var tOr;(function(t){t.inboundSchema=hf.BatchJobStatus$inboundSchema,t.outboundSchema=hf.BatchJobStatus$outboundSchema})(tOr||(hf.BatchJobStatus$=tOr={}))});var pct=S(wa=>{"use strict";var Oxo=wa&&wa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Exo=wa&&wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pxo=wa&&wa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Oxo(r,e,n[o]);return Exo(r,e),r}}();Object.defineProperty(wa,"__esModule",{value:!0});wa.BatchJobOut$=wa.BatchJobOut$outboundSchema=wa.BatchJobOut$inboundSchema=wa.BatchJobOutObject$=wa.BatchJobOutObject$outboundSchema=wa.BatchJobOutObject$inboundSchema=wa.BatchJobOutObject=void 0;wa.batchJobOutToJSON=Rxo;wa.batchJobOutFromJSON=Ixo;var mn=Pxo(ae()),oOr=ce(),Mxo=ee(),iOr=dct(),aOr=fct();wa.BatchJobOutObject={Batch:"batch"};wa.BatchJobOutObject$inboundSchema=mn.nativeEnum(wa.BatchJobOutObject);wa.BatchJobOutObject$outboundSchema=wa.BatchJobOutObject$inboundSchema;var rOr;(function(t){t.inboundSchema=wa.BatchJobOutObject$inboundSchema,t.outboundSchema=wa.BatchJobOutObject$outboundSchema})(rOr||(wa.BatchJobOutObject$=rOr={}));wa.BatchJobOut$inboundSchema=mn.object({id:mn.string(),object:wa.BatchJobOutObject$inboundSchema.default("batch"),input_files:mn.array(mn.string()),metadata:mn.nullable(mn.record(mn.any())).optional(),endpoint:mn.string(),model:mn.nullable(mn.string()).optional(),agent_id:mn.nullable(mn.string()).optional(),output_file:mn.nullable(mn.string()).optional(),error_file:mn.nullable(mn.string()).optional(),errors:mn.array(iOr.BatchError$inboundSchema),status:aOr.BatchJobStatus$inboundSchema,created_at:mn.number().int(),total_requests:mn.number().int(),completed_requests:mn.number().int(),succeeded_requests:mn.number().int(),failed_requests:mn.number().int(),started_at:mn.nullable(mn.number().int()).optional(),completed_at:mn.nullable(mn.number().int()).optional()}).transform(t=>(0,oOr.remap)(t,{input_files:"inputFiles",agent_id:"agentId",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"}));wa.BatchJobOut$outboundSchema=mn.object({id:mn.string(),object:wa.BatchJobOutObject$outboundSchema.default("batch"),inputFiles:mn.array(mn.string()),metadata:mn.nullable(mn.record(mn.any())).optional(),endpoint:mn.string(),model:mn.nullable(mn.string()).optional(),agentId:mn.nullable(mn.string()).optional(),outputFile:mn.nullable(mn.string()).optional(),errorFile:mn.nullable(mn.string()).optional(),errors:mn.array(iOr.BatchError$outboundSchema),status:aOr.BatchJobStatus$outboundSchema,createdAt:mn.number().int(),totalRequests:mn.number().int(),completedRequests:mn.number().int(),succeededRequests:mn.number().int(),failedRequests:mn.number().int(),startedAt:mn.nullable(mn.number().int()).optional(),completedAt:mn.nullable(mn.number().int()).optional()}).transform(t=>(0,oOr.remap)(t,{inputFiles:"input_files",agentId:"agent_id",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 nOr;(function(t){t.inboundSchema=wa.BatchJobOut$inboundSchema,t.outboundSchema=wa.BatchJobOut$outboundSchema})(nOr||(wa.BatchJobOut$=nOr={}));function Rxo(t){return JSON.stringify(wa.BatchJobOut$outboundSchema.parse(t))}function Ixo(t){return(0,Mxo.safeParse)(t,e=>wa.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var cOr=S(Sa=>{"use strict";var Axo=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]}),Nxo=Sa&&Sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dxo=Sa&&Sa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Axo(r,e,n[o]);return Nxo(r,e),r}}();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.BatchJobsOut$=Sa.BatchJobsOut$outboundSchema=Sa.BatchJobsOut$inboundSchema=Sa.BatchJobsOutObject$=Sa.BatchJobsOutObject$outboundSchema=Sa.BatchJobsOutObject$inboundSchema=Sa.BatchJobsOutObject=void 0;Sa.batchJobsOutToJSON=$xo;Sa.batchJobsOutFromJSON=Lxo;var f3=Dxo(ae()),jxo=ee(),lOr=pct();Sa.BatchJobsOutObject={List:"list"};Sa.BatchJobsOutObject$inboundSchema=f3.nativeEnum(Sa.BatchJobsOutObject);Sa.BatchJobsOutObject$outboundSchema=Sa.BatchJobsOutObject$inboundSchema;var sOr;(function(t){t.inboundSchema=Sa.BatchJobsOutObject$inboundSchema,t.outboundSchema=Sa.BatchJobsOutObject$outboundSchema})(sOr||(Sa.BatchJobsOutObject$=sOr={}));Sa.BatchJobsOut$inboundSchema=f3.object({data:f3.array(lOr.BatchJobOut$inboundSchema).optional(),object:Sa.BatchJobsOutObject$inboundSchema.default("list"),total:f3.number().int()});Sa.BatchJobsOut$outboundSchema=f3.object({data:f3.array(lOr.BatchJobOut$outboundSchema).optional(),object:Sa.BatchJobsOutObject$outboundSchema.default("list"),total:f3.number().int()});var uOr;(function(t){t.inboundSchema=Sa.BatchJobsOut$inboundSchema,t.outboundSchema=Sa.BatchJobsOut$outboundSchema})(uOr||(Sa.BatchJobsOut$=uOr={}));function $xo(t){return JSON.stringify(Sa.BatchJobsOut$outboundSchema.parse(t))}function Lxo(t){return(0,jxo.safeParse)(t,e=>Sa.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var nU=S(gf=>{"use strict";var Fxo=gf&&gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kxo=gf&&gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qxo=gf&&gf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Fxo(r,e,n[o]);return kxo(r,e),r}}();Object.defineProperty(gf,"__esModule",{value:!0});gf.BuiltInConnectors$=gf.BuiltInConnectors$outboundSchema=gf.BuiltInConnectors$inboundSchema=gf.BuiltInConnectors=void 0;var Uxo=qxo(ae());gf.BuiltInConnectors={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"};gf.BuiltInConnectors$inboundSchema=Uxo.nativeEnum(gf.BuiltInConnectors);gf.BuiltInConnectors$outboundSchema=gf.BuiltInConnectors$inboundSchema;var dOr;(function(t){t.inboundSchema=gf.BuiltInConnectors$inboundSchema,t.outboundSchema=gf.BuiltInConnectors$outboundSchema})(dOr||(gf.BuiltInConnectors$=dOr={}))});var mct=S(hs=>{"use strict";var Bxo=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]}),zxo=hs&&hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vxo=hs&&hs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Bxo(r,e,n[o]);return zxo(r,e),r}}();Object.defineProperty(hs,"__esModule",{value:!0});hs.InstructRequest$=hs.InstructRequest$outboundSchema=hs.InstructRequest$inboundSchema=hs.InstructRequestMessages$=hs.InstructRequestMessages$outboundSchema=hs.InstructRequestMessages$inboundSchema=void 0;hs.instructRequestMessagesToJSON=Hxo;hs.instructRequestMessagesFromJSON=Wxo;hs.instructRequestToJSON=Jxo;hs.instructRequestFromJSON=Kxo;var yi=Vxo(ae()),mOr=ee(),RRe=NA(),IRe=GD(),ARe=XD(),NRe=ZD();hs.InstructRequestMessages$inboundSchema=yi.union([IRe.SystemMessage$inboundSchema.and(yi.object({role:yi.literal("system")}).transform(t=>({role:t.role}))),ARe.ToolMessage$inboundSchema.and(yi.object({role:yi.literal("tool")}).transform(t=>({role:t.role}))),NRe.UserMessage$inboundSchema.and(yi.object({role:yi.literal("user")}).transform(t=>({role:t.role}))),RRe.AssistantMessage$inboundSchema.and(yi.object({role:yi.literal("assistant")}).transform(t=>({role:t.role})))]);hs.InstructRequestMessages$outboundSchema=yi.union([IRe.SystemMessage$outboundSchema.and(yi.object({role:yi.literal("system")}).transform(t=>({role:t.role}))),ARe.ToolMessage$outboundSchema.and(yi.object({role:yi.literal("tool")}).transform(t=>({role:t.role}))),NRe.UserMessage$outboundSchema.and(yi.object({role:yi.literal("user")}).transform(t=>({role:t.role}))),RRe.AssistantMessage$outboundSchema.and(yi.object({role:yi.literal("assistant")}).transform(t=>({role:t.role})))]);var fOr;(function(t){t.inboundSchema=hs.InstructRequestMessages$inboundSchema,t.outboundSchema=hs.InstructRequestMessages$outboundSchema})(fOr||(hs.InstructRequestMessages$=fOr={}));function Hxo(t){return JSON.stringify(hs.InstructRequestMessages$outboundSchema.parse(t))}function Wxo(t){return(0,mOr.safeParse)(t,e=>hs.InstructRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestMessages' from JSON")}hs.InstructRequest$inboundSchema=yi.object({messages:yi.array(yi.union([IRe.SystemMessage$inboundSchema.and(yi.object({role:yi.literal("system")}).transform(t=>({role:t.role}))),ARe.ToolMessage$inboundSchema.and(yi.object({role:yi.literal("tool")}).transform(t=>({role:t.role}))),NRe.UserMessage$inboundSchema.and(yi.object({role:yi.literal("user")}).transform(t=>({role:t.role}))),RRe.AssistantMessage$inboundSchema.and(yi.object({role:yi.literal("assistant")}).transform(t=>({role:t.role})))]))});hs.InstructRequest$outboundSchema=yi.object({messages:yi.array(yi.union([IRe.SystemMessage$outboundSchema.and(yi.object({role:yi.literal("system")}).transform(t=>({role:t.role}))),ARe.ToolMessage$outboundSchema.and(yi.object({role:yi.literal("tool")}).transform(t=>({role:t.role}))),NRe.UserMessage$outboundSchema.and(yi.object({role:yi.literal("user")}).transform(t=>({role:t.role}))),RRe.AssistantMessage$outboundSchema.and(yi.object({role:yi.literal("assistant")}).transform(t=>({role:t.role})))]))});var pOr;(function(t){t.inboundSchema=hs.InstructRequest$inboundSchema,t.outboundSchema=hs.InstructRequest$outboundSchema})(pOr||(hs.InstructRequest$=pOr={}));function Jxo(t){return JSON.stringify(hs.InstructRequest$outboundSchema.parse(t))}function Kxo(t){return(0,mOr.safeParse)(t,e=>hs.InstructRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequest' from JSON")}});var gct=S(vo=>{"use strict";var Gxo=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]}),Xxo=vo&&vo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zxo=vo&&vo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Gxo(r,e,n[o]);return Xxo(r,e),r}}();Object.defineProperty(vo,"__esModule",{value:!0});vo.Inputs$=vo.Inputs$outboundSchema=vo.Inputs$inboundSchema=vo.InstructRequestInputs$=vo.InstructRequestInputs$outboundSchema=vo.InstructRequestInputs$inboundSchema=vo.InstructRequestInputsMessages$=vo.InstructRequestInputsMessages$outboundSchema=vo.InstructRequestInputsMessages$inboundSchema=void 0;vo.instructRequestInputsMessagesToJSON=Yxo;vo.instructRequestInputsMessagesFromJSON=Qxo;vo.instructRequestInputsToJSON=eTo;vo.instructRequestInputsFromJSON=tTo;vo.inputsToJSON=rTo;vo.inputsFromJSON=nTo;var _o=Zxo(ae()),hct=ee(),DRe=NA(),bOr=mct(),jRe=GD(),$Re=XD(),LRe=ZD();vo.InstructRequestInputsMessages$inboundSchema=_o.union([jRe.SystemMessage$inboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),$Re.ToolMessage$inboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),LRe.UserMessage$inboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),DRe.AssistantMessage$inboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]);vo.InstructRequestInputsMessages$outboundSchema=_o.union([jRe.SystemMessage$outboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),$Re.ToolMessage$outboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),LRe.UserMessage$outboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),DRe.AssistantMessage$outboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]);var hOr;(function(t){t.inboundSchema=vo.InstructRequestInputsMessages$inboundSchema,t.outboundSchema=vo.InstructRequestInputsMessages$outboundSchema})(hOr||(vo.InstructRequestInputsMessages$=hOr={}));function Yxo(t){return JSON.stringify(vo.InstructRequestInputsMessages$outboundSchema.parse(t))}function Qxo(t){return(0,hct.safeParse)(t,e=>vo.InstructRequestInputsMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputsMessages' from JSON")}vo.InstructRequestInputs$inboundSchema=_o.object({messages:_o.array(_o.union([jRe.SystemMessage$inboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),$Re.ToolMessage$inboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),LRe.UserMessage$inboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),DRe.AssistantMessage$inboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]))});vo.InstructRequestInputs$outboundSchema=_o.object({messages:_o.array(_o.union([jRe.SystemMessage$outboundSchema.and(_o.object({role:_o.literal("system")}).transform(t=>({role:t.role}))),$Re.ToolMessage$outboundSchema.and(_o.object({role:_o.literal("tool")}).transform(t=>({role:t.role}))),LRe.UserMessage$outboundSchema.and(_o.object({role:_o.literal("user")}).transform(t=>({role:t.role}))),DRe.AssistantMessage$outboundSchema.and(_o.object({role:_o.literal("assistant")}).transform(t=>({role:t.role})))]))});var gOr;(function(t){t.inboundSchema=vo.InstructRequestInputs$inboundSchema,t.outboundSchema=vo.InstructRequestInputs$outboundSchema})(gOr||(vo.InstructRequestInputs$=gOr={}));function eTo(t){return JSON.stringify(vo.InstructRequestInputs$outboundSchema.parse(t))}function tTo(t){return(0,hct.safeParse)(t,e=>vo.InstructRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputs' from JSON")}vo.Inputs$inboundSchema=_o.union([_o.lazy(()=>vo.InstructRequestInputs$inboundSchema),_o.array(bOr.InstructRequest$inboundSchema)]);vo.Inputs$outboundSchema=_o.union([_o.lazy(()=>vo.InstructRequestInputs$outboundSchema),_o.array(bOr.InstructRequest$outboundSchema)]);var yOr;(function(t){t.inboundSchema=vo.Inputs$inboundSchema,t.outboundSchema=vo.Inputs$outboundSchema})(yOr||(vo.Inputs$=yOr={}));function rTo(t){return JSON.stringify(vo.Inputs$outboundSchema.parse(t))}function nTo(t){return(0,hct.safeParse)(t,e=>vo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}});var SOr=S(yf=>{"use strict";var oTo=yf&&yf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iTo=yf&&yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aTo=yf&&yf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oTo(r,e,n[o]);return iTo(r,e),r}}();Object.defineProperty(yf,"__esModule",{value:!0});yf.ChatClassificationRequest$=yf.ChatClassificationRequest$outboundSchema=yf.ChatClassificationRequest$inboundSchema=void 0;yf.chatClassificationRequestToJSON=uTo;yf.chatClassificationRequestFromJSON=lTo;var FRe=aTo(ae()),vOr=ce(),sTo=ee(),wOr=gct();yf.ChatClassificationRequest$inboundSchema=FRe.object({model:FRe.string(),input:wOr.Inputs$inboundSchema}).transform(t=>(0,vOr.remap)(t,{input:"inputs"}));yf.ChatClassificationRequest$outboundSchema=FRe.object({model:FRe.string(),inputs:wOr.Inputs$outboundSchema}).transform(t=>(0,vOr.remap)(t,{inputs:"input"}));var _Or;(function(t){t.inboundSchema=yf.ChatClassificationRequest$inboundSchema,t.outboundSchema=yf.ChatClassificationRequest$outboundSchema})(_Or||(yf.ChatClassificationRequest$=_Or={}));function uTo(t){return JSON.stringify(yf.ChatClassificationRequest$outboundSchema.parse(t))}function lTo(t){return(0,sTo.safeParse)(t,e=>yf.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var kRe=S(Ca=>{"use strict";var cTo=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]}),dTo=Ca&&Ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fTo=Ca&&Ca.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cTo(r,e,n[o]);return dTo(r,e),r}}();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ChatCompletionChoice$=Ca.ChatCompletionChoice$outboundSchema=Ca.ChatCompletionChoice$inboundSchema=Ca.FinishReason$=Ca.FinishReason$outboundSchema=Ca.FinishReason$inboundSchema=Ca.FinishReason=void 0;Ca.chatCompletionChoiceToJSON=hTo;Ca.chatCompletionChoiceFromJSON=gTo;var Zx=fTo(ae()),TOr=ce(),pTo=ee(),mTo=Gx(),OOr=NA();Ca.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};Ca.FinishReason$inboundSchema=Zx.union([Zx.nativeEnum(Ca.FinishReason),Zx.string().transform(mTo.catchUnrecognizedEnum)]);Ca.FinishReason$outboundSchema=Zx.union([Zx.nativeEnum(Ca.FinishReason),Zx.string().and(Zx.custom())]);var COr;(function(t){t.inboundSchema=Ca.FinishReason$inboundSchema,t.outboundSchema=Ca.FinishReason$outboundSchema})(COr||(Ca.FinishReason$=COr={}));Ca.ChatCompletionChoice$inboundSchema=Zx.object({index:Zx.number().int(),message:OOr.AssistantMessage$inboundSchema,finish_reason:Ca.FinishReason$inboundSchema}).transform(t=>(0,TOr.remap)(t,{finish_reason:"finishReason"}));Ca.ChatCompletionChoice$outboundSchema=Zx.object({index:Zx.number().int(),message:OOr.AssistantMessage$outboundSchema,finishReason:Ca.FinishReason$outboundSchema}).transform(t=>(0,TOr.remap)(t,{finishReason:"finish_reason"}));var xOr;(function(t){t.inboundSchema=Ca.ChatCompletionChoice$inboundSchema,t.outboundSchema=Ca.ChatCompletionChoice$outboundSchema})(xOr||(Ca.ChatCompletionChoice$=xOr={}));function hTo(t){return JSON.stringify(Ca.ChatCompletionChoice$outboundSchema.parse(t))}function gTo(t){return(0,pTo.safeParse)(t,e=>Ca.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var $Or=S(Qr=>{"use strict";var yTo=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]}),bTo=Qr&&Qr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_To=Qr&&Qr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yTo(r,e,n[o]);return bTo(r,e),r}}();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ChatCompletionRequest$=Qr.ChatCompletionRequest$outboundSchema=Qr.ChatCompletionRequest$inboundSchema=Qr.ChatCompletionRequestToolChoice$=Qr.ChatCompletionRequestToolChoice$outboundSchema=Qr.ChatCompletionRequestToolChoice$inboundSchema=Qr.Messages$=Qr.Messages$outboundSchema=Qr.Messages$inboundSchema=Qr.Stop$=Qr.Stop$outboundSchema=Qr.Stop$inboundSchema=void 0;Qr.stopToJSON=vTo;Qr.stopFromJSON=wTo;Qr.messagesToJSON=STo;Qr.messagesFromJSON=CTo;Qr.chatCompletionRequestToolChoiceToJSON=xTo;Qr.chatCompletionRequestToolChoiceFromJSON=TTo;Qr.chatCompletionRequestToJSON=OTo;Qr.chatCompletionRequestFromJSON=ETo;var at=_To(ae()),IOr=ce(),qRe=ee(),URe=NA(),AOr=f7(),NOr=t3(),DOr=Gq(),BRe=GD(),jOr=p7(),zRe=m7(),VRe=r3(),HRe=XD(),WRe=ZD();Qr.Stop$inboundSchema=at.union([at.string(),at.array(at.string())]);Qr.Stop$outboundSchema=at.union([at.string(),at.array(at.string())]);var EOr;(function(t){t.inboundSchema=Qr.Stop$inboundSchema,t.outboundSchema=Qr.Stop$outboundSchema})(EOr||(Qr.Stop$=EOr={}));function vTo(t){return JSON.stringify(Qr.Stop$outboundSchema.parse(t))}function wTo(t){return(0,qRe.safeParse)(t,e=>Qr.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Qr.Messages$inboundSchema=at.union([BRe.SystemMessage$inboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),HRe.ToolMessage$inboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),WRe.UserMessage$inboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),URe.AssistantMessage$inboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))]);Qr.Messages$outboundSchema=at.union([BRe.SystemMessage$outboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),HRe.ToolMessage$outboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),WRe.UserMessage$outboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),URe.AssistantMessage$outboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))]);var POr;(function(t){t.inboundSchema=Qr.Messages$inboundSchema,t.outboundSchema=Qr.Messages$outboundSchema})(POr||(Qr.Messages$=POr={}));function STo(t){return JSON.stringify(Qr.Messages$outboundSchema.parse(t))}function CTo(t){return(0,qRe.safeParse)(t,e=>Qr.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Qr.ChatCompletionRequestToolChoice$inboundSchema=at.union([zRe.ToolChoice$inboundSchema,VRe.ToolChoiceEnum$inboundSchema]);Qr.ChatCompletionRequestToolChoice$outboundSchema=at.union([zRe.ToolChoice$outboundSchema,VRe.ToolChoiceEnum$outboundSchema]);var MOr;(function(t){t.inboundSchema=Qr.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Qr.ChatCompletionRequestToolChoice$outboundSchema})(MOr||(Qr.ChatCompletionRequestToolChoice$=MOr={}));function xTo(t){return JSON.stringify(Qr.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function TTo(t){return(0,qRe.safeParse)(t,e=>Qr.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Qr.ChatCompletionRequest$inboundSchema=at.object({model:at.string(),temperature:at.nullable(at.number()).optional(),top_p:at.number().optional(),max_tokens:at.nullable(at.number().int()).optional(),stream:at.boolean().default(!1),stop:at.union([at.string(),at.array(at.string())]).optional(),random_seed:at.nullable(at.number().int()).optional(),messages:at.array(at.union([BRe.SystemMessage$inboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),HRe.ToolMessage$inboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),WRe.UserMessage$inboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),URe.AssistantMessage$inboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:DOr.ResponseFormat$inboundSchema.optional(),tools:at.nullable(at.array(jOr.Tool$inboundSchema)).optional(),tool_choice:at.union([zRe.ToolChoice$inboundSchema,VRe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:at.number().optional(),frequency_penalty:at.number().optional(),n:at.nullable(at.number().int()).optional(),prediction:NOr.Prediction$inboundSchema.optional(),parallel_tool_calls:at.boolean().optional(),prompt_mode:at.nullable(AOr.MistralPromptMode$inboundSchema).optional(),safe_prompt:at.boolean().optional()}).transform(t=>(0,IOr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",safe_prompt:"safePrompt"}));Qr.ChatCompletionRequest$outboundSchema=at.object({model:at.string(),temperature:at.nullable(at.number()).optional(),topP:at.number().optional(),maxTokens:at.nullable(at.number().int()).optional(),stream:at.boolean().default(!1),stop:at.union([at.string(),at.array(at.string())]).optional(),randomSeed:at.nullable(at.number().int()).optional(),messages:at.array(at.union([BRe.SystemMessage$outboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),HRe.ToolMessage$outboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),WRe.UserMessage$outboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),URe.AssistantMessage$outboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:DOr.ResponseFormat$outboundSchema.optional(),tools:at.nullable(at.array(jOr.Tool$outboundSchema)).optional(),toolChoice:at.union([zRe.ToolChoice$outboundSchema,VRe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:at.number().optional(),frequencyPenalty:at.number().optional(),n:at.nullable(at.number().int()).optional(),prediction:NOr.Prediction$outboundSchema.optional(),parallelToolCalls:at.boolean().optional(),promptMode:at.nullable(AOr.MistralPromptMode$outboundSchema).optional(),safePrompt:at.boolean().optional()}).transform(t=>(0,IOr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",safePrompt:"safe_prompt"}));var ROr;(function(t){t.inboundSchema=Qr.ChatCompletionRequest$inboundSchema,t.outboundSchema=Qr.ChatCompletionRequest$outboundSchema})(ROr||(Qr.ChatCompletionRequest$=ROr={}));function OTo(t){return JSON.stringify(Qr.ChatCompletionRequest$outboundSchema.parse(t))}function ETo(t){return(0,qRe.safeParse)(t,e=>Qr.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var oU=S(bf=>{"use strict";var PTo=bf&&bf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MTo=bf&&bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RTo=bf&&bf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PTo(r,e,n[o]);return MTo(r,e),r}}();Object.defineProperty(bf,"__esModule",{value:!0});bf.UsageInfo$=bf.UsageInfo$outboundSchema=bf.UsageInfo$inboundSchema=void 0;bf.usageInfoToJSON=ITo;bf.usageInfoFromJSON=ATo;var a_=RTo(ae()),FOr=ce(),kOr=ee();bf.UsageInfo$inboundSchema=(0,kOr.collectExtraKeys)(a_.object({prompt_tokens:a_.number().int().default(0),completion_tokens:a_.number().int().default(0),total_tokens:a_.number().int().default(0),prompt_audio_seconds:a_.nullable(a_.number().int()).optional()}).catchall(a_.any()),"additionalProperties",!0).transform(t=>(0,FOr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"}));bf.UsageInfo$outboundSchema=a_.object({promptTokens:a_.number().int().default(0),completionTokens:a_.number().int().default(0),totalTokens:a_.number().int().default(0),promptAudioSeconds:a_.nullable(a_.number().int()).optional(),additionalProperties:a_.record(a_.any())}).transform(t=>({...t.additionalProperties,...(0,FOr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds",additionalProperties:null})}));var LOr;(function(t){t.inboundSchema=bf.UsageInfo$inboundSchema,t.outboundSchema=bf.UsageInfo$outboundSchema})(LOr||(bf.UsageInfo$=LOr={}));function ITo(t){return JSON.stringify(bf.UsageInfo$outboundSchema.parse(t))}function ATo(t){return(0,kOr.safeParse)(t,e=>bf.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var zOr=S(_f=>{"use strict";var NTo=_f&&_f.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DTo=_f&&_f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jTo=_f&&_f.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NTo(r,e,n[o]);return DTo(r,e),r}}();Object.defineProperty(_f,"__esModule",{value:!0});_f.ChatCompletionResponse$=_f.ChatCompletionResponse$outboundSchema=_f.ChatCompletionResponse$inboundSchema=void 0;_f.chatCompletionResponseToJSON=LTo;_f.chatCompletionResponseFromJSON=FTo;var k0=jTo(ae()),$To=ee(),UOr=kRe(),BOr=oU();_f.ChatCompletionResponse$inboundSchema=k0.object({id:k0.string(),object:k0.string(),model:k0.string(),usage:BOr.UsageInfo$inboundSchema,created:k0.number().int(),choices:k0.array(UOr.ChatCompletionChoice$inboundSchema)});_f.ChatCompletionResponse$outboundSchema=k0.object({id:k0.string(),object:k0.string(),model:k0.string(),usage:BOr.UsageInfo$outboundSchema,created:k0.number().int(),choices:k0.array(UOr.ChatCompletionChoice$outboundSchema)});var qOr;(function(t){t.inboundSchema=_f.ChatCompletionResponse$inboundSchema,t.outboundSchema=_f.ChatCompletionResponse$outboundSchema})(qOr||(_f.ChatCompletionResponse$=qOr={}));function LTo(t){return JSON.stringify(_f.ChatCompletionResponse$outboundSchema.parse(t))}function FTo(t){return(0,$To.safeParse)(t,e=>_f.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var QOr=S(en=>{"use strict";var kTo=en&&en.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qTo=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UTo=en&&en.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kTo(r,e,n[o]);return qTo(r,e),r}}();Object.defineProperty(en,"__esModule",{value:!0});en.ChatCompletionStreamRequest$=en.ChatCompletionStreamRequest$outboundSchema=en.ChatCompletionStreamRequest$inboundSchema=en.ChatCompletionStreamRequestToolChoice$=en.ChatCompletionStreamRequestToolChoice$outboundSchema=en.ChatCompletionStreamRequestToolChoice$inboundSchema=en.ChatCompletionStreamRequestMessages$=en.ChatCompletionStreamRequestMessages$outboundSchema=en.ChatCompletionStreamRequestMessages$inboundSchema=en.ChatCompletionStreamRequestStop$=en.ChatCompletionStreamRequestStop$outboundSchema=en.ChatCompletionStreamRequestStop$inboundSchema=void 0;en.chatCompletionStreamRequestStopToJSON=BTo;en.chatCompletionStreamRequestStopFromJSON=zTo;en.chatCompletionStreamRequestMessagesToJSON=VTo;en.chatCompletionStreamRequestMessagesFromJSON=HTo;en.chatCompletionStreamRequestToolChoiceToJSON=WTo;en.chatCompletionStreamRequestToolChoiceFromJSON=JTo;en.chatCompletionStreamRequestToJSON=KTo;en.chatCompletionStreamRequestFromJSON=GTo;var st=UTo(ae()),KOr=ce(),JRe=ee(),KRe=NA(),GOr=f7(),XOr=t3(),ZOr=Gq(),GRe=GD(),YOr=p7(),XRe=m7(),ZRe=r3(),YRe=XD(),QRe=ZD();en.ChatCompletionStreamRequestStop$inboundSchema=st.union([st.string(),st.array(st.string())]);en.ChatCompletionStreamRequestStop$outboundSchema=st.union([st.string(),st.array(st.string())]);var VOr;(function(t){t.inboundSchema=en.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=en.ChatCompletionStreamRequestStop$outboundSchema})(VOr||(en.ChatCompletionStreamRequestStop$=VOr={}));function BTo(t){return JSON.stringify(en.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function zTo(t){return(0,JRe.safeParse)(t,e=>en.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}en.ChatCompletionStreamRequestMessages$inboundSchema=st.union([GRe.SystemMessage$inboundSchema.and(st.object({role:st.literal("system")}).transform(t=>({role:t.role}))),YRe.ToolMessage$inboundSchema.and(st.object({role:st.literal("tool")}).transform(t=>({role:t.role}))),QRe.UserMessage$inboundSchema.and(st.object({role:st.literal("user")}).transform(t=>({role:t.role}))),KRe.AssistantMessage$inboundSchema.and(st.object({role:st.literal("assistant")}).transform(t=>({role:t.role})))]);en.ChatCompletionStreamRequestMessages$outboundSchema=st.union([GRe.SystemMessage$outboundSchema.and(st.object({role:st.literal("system")}).transform(t=>({role:t.role}))),YRe.ToolMessage$outboundSchema.and(st.object({role:st.literal("tool")}).transform(t=>({role:t.role}))),QRe.UserMessage$outboundSchema.and(st.object({role:st.literal("user")}).transform(t=>({role:t.role}))),KRe.AssistantMessage$outboundSchema.and(st.object({role:st.literal("assistant")}).transform(t=>({role:t.role})))]);var HOr;(function(t){t.inboundSchema=en.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=en.ChatCompletionStreamRequestMessages$outboundSchema})(HOr||(en.ChatCompletionStreamRequestMessages$=HOr={}));function VTo(t){return JSON.stringify(en.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function HTo(t){return(0,JRe.safeParse)(t,e=>en.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}en.ChatCompletionStreamRequestToolChoice$inboundSchema=st.union([XRe.ToolChoice$inboundSchema,ZRe.ToolChoiceEnum$inboundSchema]);en.ChatCompletionStreamRequestToolChoice$outboundSchema=st.union([XRe.ToolChoice$outboundSchema,ZRe.ToolChoiceEnum$outboundSchema]);var WOr;(function(t){t.inboundSchema=en.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=en.ChatCompletionStreamRequestToolChoice$outboundSchema})(WOr||(en.ChatCompletionStreamRequestToolChoice$=WOr={}));function WTo(t){return JSON.stringify(en.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function JTo(t){return(0,JRe.safeParse)(t,e=>en.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}en.ChatCompletionStreamRequest$inboundSchema=st.object({model:st.string(),temperature:st.nullable(st.number()).optional(),top_p:st.number().optional(),max_tokens:st.nullable(st.number().int()).optional(),stream:st.boolean().default(!0),stop:st.union([st.string(),st.array(st.string())]).optional(),random_seed:st.nullable(st.number().int()).optional(),messages:st.array(st.union([GRe.SystemMessage$inboundSchema.and(st.object({role:st.literal("system")}).transform(t=>({role:t.role}))),YRe.ToolMessage$inboundSchema.and(st.object({role:st.literal("tool")}).transform(t=>({role:t.role}))),QRe.UserMessage$inboundSchema.and(st.object({role:st.literal("user")}).transform(t=>({role:t.role}))),KRe.AssistantMessage$inboundSchema.and(st.object({role:st.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:ZOr.ResponseFormat$inboundSchema.optional(),tools:st.nullable(st.array(YOr.Tool$inboundSchema)).optional(),tool_choice:st.union([XRe.ToolChoice$inboundSchema,ZRe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:st.number().optional(),frequency_penalty:st.number().optional(),n:st.nullable(st.number().int()).optional(),prediction:XOr.Prediction$inboundSchema.optional(),parallel_tool_calls:st.boolean().optional(),prompt_mode:st.nullable(GOr.MistralPromptMode$inboundSchema).optional(),safe_prompt:st.boolean().optional()}).transform(t=>(0,KOr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice",presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",parallel_tool_calls:"parallelToolCalls",prompt_mode:"promptMode",safe_prompt:"safePrompt"}));en.ChatCompletionStreamRequest$outboundSchema=st.object({model:st.string(),temperature:st.nullable(st.number()).optional(),topP:st.number().optional(),maxTokens:st.nullable(st.number().int()).optional(),stream:st.boolean().default(!0),stop:st.union([st.string(),st.array(st.string())]).optional(),randomSeed:st.nullable(st.number().int()).optional(),messages:st.array(st.union([GRe.SystemMessage$outboundSchema.and(st.object({role:st.literal("system")}).transform(t=>({role:t.role}))),YRe.ToolMessage$outboundSchema.and(st.object({role:st.literal("tool")}).transform(t=>({role:t.role}))),QRe.UserMessage$outboundSchema.and(st.object({role:st.literal("user")}).transform(t=>({role:t.role}))),KRe.AssistantMessage$outboundSchema.and(st.object({role:st.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:ZOr.ResponseFormat$outboundSchema.optional(),tools:st.nullable(st.array(YOr.Tool$outboundSchema)).optional(),toolChoice:st.union([XRe.ToolChoice$outboundSchema,ZRe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:st.number().optional(),frequencyPenalty:st.number().optional(),n:st.nullable(st.number().int()).optional(),prediction:XOr.Prediction$outboundSchema.optional(),parallelToolCalls:st.boolean().optional(),promptMode:st.nullable(GOr.MistralPromptMode$outboundSchema).optional(),safePrompt:st.boolean().optional()}).transform(t=>(0,KOr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice",presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",parallelToolCalls:"parallel_tool_calls",promptMode:"prompt_mode",safePrompt:"safe_prompt"}));var JOr;(function(t){t.inboundSchema=en.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=en.ChatCompletionStreamRequest$outboundSchema})(JOr||(en.ChatCompletionStreamRequest$=JOr={}));function KTo(t){return JSON.stringify(en.ChatCompletionStreamRequest$outboundSchema.parse(t))}function GTo(t){return(0,JRe.safeParse)(t,e=>en.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var iEr=S(tn=>{"use strict";var XTo=tn&&tn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZTo=tn&&tn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YTo=tn&&tn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XTo(r,e,n[o]);return ZTo(r,e),r}}();Object.defineProperty(tn,"__esModule",{value:!0});tn.ChatModerationRequest$=tn.ChatModerationRequest$outboundSchema=tn.ChatModerationRequest$inboundSchema=tn.ChatModerationRequestInputs$=tn.ChatModerationRequestInputs$outboundSchema=tn.ChatModerationRequestInputs$inboundSchema=tn.One$=tn.One$outboundSchema=tn.One$inboundSchema=tn.Two$=tn.Two$outboundSchema=tn.Two$inboundSchema=void 0;tn.twoToJSON=QTo;tn.twoFromJSON=eOo;tn.oneToJSON=tOo;tn.oneFromJSON=rOo;tn.chatModerationRequestInputsToJSON=nOo;tn.chatModerationRequestInputsFromJSON=oOo;tn.chatModerationRequestToJSON=iOo;tn.chatModerationRequestFromJSON=aOo;var Fe=YTo(ae()),oEr=ce(),eIe=ee(),q0=NA(),U0=GD(),B0=XD(),z0=ZD();tn.Two$inboundSchema=Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))]);tn.Two$outboundSchema=Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))]);var eEr;(function(t){t.inboundSchema=tn.Two$inboundSchema,t.outboundSchema=tn.Two$outboundSchema})(eEr||(tn.Two$=eEr={}));function QTo(t){return JSON.stringify(tn.Two$outboundSchema.parse(t))}function eOo(t){return(0,eIe.safeParse)(t,e=>tn.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}tn.One$inboundSchema=Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))]);tn.One$outboundSchema=Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))]);var tEr;(function(t){t.inboundSchema=tn.One$inboundSchema,t.outboundSchema=tn.One$outboundSchema})(tEr||(tn.One$=tEr={}));function tOo(t){return JSON.stringify(tn.One$outboundSchema.parse(t))}function rOo(t){return(0,eIe.safeParse)(t,e=>tn.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}tn.ChatModerationRequestInputs$inboundSchema=Fe.union([Fe.array(Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])),Fe.array(Fe.array(Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])))]);tn.ChatModerationRequestInputs$outboundSchema=Fe.union([Fe.array(Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])),Fe.array(Fe.array(Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])))]);var rEr;(function(t){t.inboundSchema=tn.ChatModerationRequestInputs$inboundSchema,t.outboundSchema=tn.ChatModerationRequestInputs$outboundSchema})(rEr||(tn.ChatModerationRequestInputs$=rEr={}));function nOo(t){return JSON.stringify(tn.ChatModerationRequestInputs$outboundSchema.parse(t))}function oOo(t){return(0,eIe.safeParse)(t,e=>tn.ChatModerationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequestInputs' from JSON")}tn.ChatModerationRequest$inboundSchema=Fe.object({input:Fe.union([Fe.array(Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])),Fe.array(Fe.array(Fe.union([U0.SystemMessage$inboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$inboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$inboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$inboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:Fe.string()}).transform(t=>(0,oEr.remap)(t,{input:"inputs"}));tn.ChatModerationRequest$outboundSchema=Fe.object({inputs:Fe.union([Fe.array(Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])),Fe.array(Fe.array(Fe.union([U0.SystemMessage$outboundSchema.and(Fe.object({role:Fe.literal("system")}).transform(t=>({role:t.role}))),B0.ToolMessage$outboundSchema.and(Fe.object({role:Fe.literal("tool")}).transform(t=>({role:t.role}))),z0.UserMessage$outboundSchema.and(Fe.object({role:Fe.literal("user")}).transform(t=>({role:t.role}))),q0.AssistantMessage$outboundSchema.and(Fe.object({role:Fe.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:Fe.string()}).transform(t=>(0,oEr.remap)(t,{inputs:"input"}));var nEr;(function(t){t.inboundSchema=tn.ChatModerationRequest$inboundSchema,t.outboundSchema=tn.ChatModerationRequest$outboundSchema})(nEr||(tn.ChatModerationRequest$=nEr={}));function iOo(t){return JSON.stringify(tn.ChatModerationRequest$outboundSchema.parse(t))}function aOo(t){return(0,eIe.safeParse)(t,e=>tn.ChatModerationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequest' from JSON")}});var yct=S(vf=>{"use strict";var sOo=vf&&vf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uOo=vf&&vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lOo=vf&&vf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sOo(r,e,n[o]);return uOo(r,e),r}}();Object.defineProperty(vf,"__esModule",{value:!0});vf.MetricOut$=vf.MetricOut$outboundSchema=vf.MetricOut$inboundSchema=void 0;vf.metricOutToJSON=dOo;vf.metricOutFromJSON=fOo;var _v=lOo(ae()),sEr=ce(),cOo=ee();vf.MetricOut$inboundSchema=_v.object({train_loss:_v.nullable(_v.number()).optional(),valid_loss:_v.nullable(_v.number()).optional(),valid_mean_token_accuracy:_v.nullable(_v.number()).optional()}).transform(t=>(0,sEr.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));vf.MetricOut$outboundSchema=_v.object({trainLoss:_v.nullable(_v.number()).optional(),validLoss:_v.nullable(_v.number()).optional(),validMeanTokenAccuracy:_v.nullable(_v.number()).optional()}).transform(t=>(0,sEr.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var aEr;(function(t){t.inboundSchema=vf.MetricOut$inboundSchema,t.outboundSchema=vf.MetricOut$outboundSchema})(aEr||(vf.MetricOut$=aEr={}));function dOo(t){return JSON.stringify(vf.MetricOut$outboundSchema.parse(t))}function fOo(t){return(0,cOo.safeParse)(t,e=>vf.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var tIe=S(wf=>{"use strict";var pOo=wf&&wf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mOo=wf&&wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hOo=wf&&wf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pOo(r,e,n[o]);return mOo(r,e),r}}();Object.defineProperty(wf,"__esModule",{value:!0});wf.CheckpointOut$=wf.CheckpointOut$outboundSchema=wf.CheckpointOut$inboundSchema=void 0;wf.checkpointOutToJSON=yOo;wf.checkpointOutFromJSON=bOo;var g7=hOo(ae()),lEr=ce(),gOo=ee(),cEr=yct();wf.CheckpointOut$inboundSchema=g7.object({metrics:cEr.MetricOut$inboundSchema,step_number:g7.number().int(),created_at:g7.number().int()}).transform(t=>(0,lEr.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));wf.CheckpointOut$outboundSchema=g7.object({metrics:cEr.MetricOut$outboundSchema,stepNumber:g7.number().int(),createdAt:g7.number().int()}).transform(t=>(0,lEr.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var uEr;(function(t){t.inboundSchema=wf.CheckpointOut$inboundSchema,t.outboundSchema=wf.CheckpointOut$outboundSchema})(uEr||(wf.CheckpointOut$=uEr={}));function yOo(t){return JSON.stringify(wf.CheckpointOut$outboundSchema.parse(t))}function bOo(t){return(0,gOo.safeParse)(t,e=>wf.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var hEr=S(gs=>{"use strict";var _Oo=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]}),vOo=gs&&gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wOo=gs&&gs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Oo(r,e,n[o]);return vOo(r,e),r}}();Object.defineProperty(gs,"__esModule",{value:!0});gs.ClassificationRequest$=gs.ClassificationRequest$outboundSchema=gs.ClassificationRequest$inboundSchema=gs.ClassificationRequestInputs$=gs.ClassificationRequestInputs$outboundSchema=gs.ClassificationRequestInputs$inboundSchema=void 0;gs.classificationRequestInputsToJSON=SOo;gs.classificationRequestInputsFromJSON=COo;gs.classificationRequestToJSON=xOo;gs.classificationRequestFromJSON=TOo;var Sf=wOo(ae()),pEr=ce(),mEr=ee();gs.ClassificationRequestInputs$inboundSchema=Sf.union([Sf.string(),Sf.array(Sf.string())]);gs.ClassificationRequestInputs$outboundSchema=Sf.union([Sf.string(),Sf.array(Sf.string())]);var dEr;(function(t){t.inboundSchema=gs.ClassificationRequestInputs$inboundSchema,t.outboundSchema=gs.ClassificationRequestInputs$outboundSchema})(dEr||(gs.ClassificationRequestInputs$=dEr={}));function SOo(t){return JSON.stringify(gs.ClassificationRequestInputs$outboundSchema.parse(t))}function COo(t){return(0,mEr.safeParse)(t,e=>gs.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}gs.ClassificationRequest$inboundSchema=Sf.object({model:Sf.string(),input:Sf.union([Sf.string(),Sf.array(Sf.string())])}).transform(t=>(0,pEr.remap)(t,{input:"inputs"}));gs.ClassificationRequest$outboundSchema=Sf.object({model:Sf.string(),inputs:Sf.union([Sf.string(),Sf.array(Sf.string())])}).transform(t=>(0,pEr.remap)(t,{inputs:"input"}));var fEr;(function(t){t.inboundSchema=gs.ClassificationRequest$inboundSchema,t.outboundSchema=gs.ClassificationRequest$outboundSchema})(fEr||(gs.ClassificationRequest$=fEr={}));function xOo(t){return JSON.stringify(gs.ClassificationRequest$outboundSchema.parse(t))}function TOo(t){return(0,mEr.safeParse)(t,e=>gs.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var bct=S(Cf=>{"use strict";var OOo=Cf&&Cf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EOo=Cf&&Cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),POo=Cf&&Cf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OOo(r,e,n[o]);return EOo(r,e),r}}();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.ClassificationTargetResult$=Cf.ClassificationTargetResult$outboundSchema=Cf.ClassificationTargetResult$inboundSchema=void 0;Cf.classificationTargetResultToJSON=ROo;Cf.classificationTargetResultFromJSON=IOo;var y7=POo(ae()),MOo=ee();Cf.ClassificationTargetResult$inboundSchema=y7.object({scores:y7.record(y7.number())});Cf.ClassificationTargetResult$outboundSchema=y7.object({scores:y7.record(y7.number())});var gEr;(function(t){t.inboundSchema=Cf.ClassificationTargetResult$inboundSchema,t.outboundSchema=Cf.ClassificationTargetResult$outboundSchema})(gEr||(Cf.ClassificationTargetResult$=gEr={}));function ROo(t){return JSON.stringify(Cf.ClassificationTargetResult$outboundSchema.parse(t))}function IOo(t){return(0,MOo.safeParse)(t,e=>Cf.ClassificationTargetResult$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationTargetResult' from JSON")}});var _Er=S(xf=>{"use strict";var AOo=xf&&xf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NOo=xf&&xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DOo=xf&&xf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&AOo(r,e,n[o]);return NOo(r,e),r}}();Object.defineProperty(xf,"__esModule",{value:!0});xf.ClassificationResponse$=xf.ClassificationResponse$outboundSchema=xf.ClassificationResponse$inboundSchema=void 0;xf.classificationResponseToJSON=$Oo;xf.classificationResponseFromJSON=LOo;var jA=DOo(ae()),jOo=ee(),bEr=bct();xf.ClassificationResponse$inboundSchema=jA.object({id:jA.string(),model:jA.string(),results:jA.array(jA.record(bEr.ClassificationTargetResult$inboundSchema))});xf.ClassificationResponse$outboundSchema=jA.object({id:jA.string(),model:jA.string(),results:jA.array(jA.record(bEr.ClassificationTargetResult$outboundSchema))});var yEr;(function(t){t.inboundSchema=xf.ClassificationResponse$inboundSchema,t.outboundSchema=xf.ClassificationResponse$outboundSchema})(yEr||(xf.ClassificationResponse$=yEr={}));function $Oo(t){return JSON.stringify(xf.ClassificationResponse$outboundSchema.parse(t))}function LOo(t){return(0,jOo.safeParse)(t,e=>xf.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var rIe=S(Tf=>{"use strict";var FOo=Tf&&Tf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kOo=Tf&&Tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qOo=Tf&&Tf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FOo(r,e,n[o]);return kOo(r,e),r}}();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.FTClassifierLossFunction$=Tf.FTClassifierLossFunction$outboundSchema=Tf.FTClassifierLossFunction$inboundSchema=Tf.FTClassifierLossFunction=void 0;var UOo=qOo(ae());Tf.FTClassifierLossFunction={SingleClass:"single_class",MultiClass:"multi_class"};Tf.FTClassifierLossFunction$inboundSchema=UOo.nativeEnum(Tf.FTClassifierLossFunction);Tf.FTClassifierLossFunction$outboundSchema=Tf.FTClassifierLossFunction$inboundSchema;var vEr;(function(t){t.inboundSchema=Tf.FTClassifierLossFunction$inboundSchema,t.outboundSchema=Tf.FTClassifierLossFunction$outboundSchema})(vEr||(Tf.FTClassifierLossFunction$=vEr={}))});var nIe=S(Of=>{"use strict";var BOo=Of&&Of.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zOo=Of&&Of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VOo=Of&&Of.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BOo(r,e,n[o]);return zOo(r,e),r}}();Object.defineProperty(Of,"__esModule",{value:!0});Of.ClassifierTargetOut$=Of.ClassifierTargetOut$outboundSchema=Of.ClassifierTargetOut$inboundSchema=void 0;Of.classifierTargetOutToJSON=WOo;Of.classifierTargetOutFromJSON=JOo;var $A=VOo(ae()),SEr=ce(),HOo=ee(),CEr=rIe();Of.ClassifierTargetOut$inboundSchema=$A.object({name:$A.string(),labels:$A.array($A.string()),weight:$A.number(),loss_function:CEr.FTClassifierLossFunction$inboundSchema}).transform(t=>(0,SEr.remap)(t,{loss_function:"lossFunction"}));Of.ClassifierTargetOut$outboundSchema=$A.object({name:$A.string(),labels:$A.array($A.string()),weight:$A.number(),lossFunction:CEr.FTClassifierLossFunction$outboundSchema}).transform(t=>(0,SEr.remap)(t,{lossFunction:"loss_function"}));var wEr;(function(t){t.inboundSchema=Of.ClassifierTargetOut$inboundSchema,t.outboundSchema=Of.ClassifierTargetOut$outboundSchema})(wEr||(Of.ClassifierTargetOut$=wEr={}));function WOo(t){return JSON.stringify(Of.ClassifierTargetOut$outboundSchema.parse(t))}function JOo(t){return(0,HOo.safeParse)(t,e=>Of.ClassifierTargetOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetOut' from JSON")}});var oIe=S(Ef=>{"use strict";var KOo=Ef&&Ef.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GOo=Ef&&Ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XOo=Ef&&Ef.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KOo(r,e,n[o]);return GOo(r,e),r}}();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.ClassifierTrainingParameters$=Ef.ClassifierTrainingParameters$outboundSchema=Ef.ClassifierTrainingParameters$inboundSchema=void 0;Ef.classifierTrainingParametersToJSON=YOo;Ef.classifierTrainingParametersFromJSON=QOo;var oc=XOo(ae()),TEr=ce(),ZOo=ee();Ef.ClassifierTrainingParameters$inboundSchema=oc.object({training_steps:oc.nullable(oc.number().int()).optional(),learning_rate:oc.number().default(1e-4),weight_decay:oc.nullable(oc.number()).optional(),warmup_fraction:oc.nullable(oc.number()).optional(),epochs:oc.nullable(oc.number()).optional(),seq_len:oc.nullable(oc.number().int()).optional()}).transform(t=>(0,TEr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));Ef.ClassifierTrainingParameters$outboundSchema=oc.object({trainingSteps:oc.nullable(oc.number().int()).optional(),learningRate:oc.number().default(1e-4),weightDecay:oc.nullable(oc.number()).optional(),warmupFraction:oc.nullable(oc.number()).optional(),epochs:oc.nullable(oc.number()).optional(),seqLen:oc.nullable(oc.number().int()).optional()}).transform(t=>(0,TEr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var xEr;(function(t){t.inboundSchema=Ef.ClassifierTrainingParameters$inboundSchema,t.outboundSchema=Ef.ClassifierTrainingParameters$outboundSchema})(xEr||(Ef.ClassifierTrainingParameters$=xEr={}));function YOo(t){return JSON.stringify(Ef.ClassifierTrainingParameters$outboundSchema.parse(t))}function QOo(t){return(0,ZOo.safeParse)(t,e=>Ef.ClassifierTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParameters' from JSON")}});var iIe=S(Pf=>{"use strict";var eEo=Pf&&Pf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tEo=Pf&&Pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rEo=Pf&&Pf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eEo(r,e,n[o]);return tEo(r,e),r}}();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.EventOut$=Pf.EventOut$outboundSchema=Pf.EventOut$inboundSchema=void 0;Pf.eventOutToJSON=oEo;Pf.eventOutFromJSON=iEo;var V0=rEo(ae()),EEr=ce(),nEo=ee();Pf.EventOut$inboundSchema=V0.object({name:V0.string(),data:V0.nullable(V0.record(V0.any())).optional(),created_at:V0.number().int()}).transform(t=>(0,EEr.remap)(t,{created_at:"createdAt"}));Pf.EventOut$outboundSchema=V0.object({name:V0.string(),data:V0.nullable(V0.record(V0.any())).optional(),createdAt:V0.number().int()}).transform(t=>(0,EEr.remap)(t,{createdAt:"created_at"}));var OEr;(function(t){t.inboundSchema=Pf.EventOut$inboundSchema,t.outboundSchema=Pf.EventOut$outboundSchema})(OEr||(Pf.EventOut$=OEr={}));function oEo(t){return JSON.stringify(Pf.EventOut$outboundSchema.parse(t))}function iEo(t){return(0,nEo.safeParse)(t,e=>Pf.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var b7=S(Mf=>{"use strict";var aEo=Mf&&Mf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sEo=Mf&&Mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uEo=Mf&&Mf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aEo(r,e,n[o]);return sEo(r,e),r}}();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.JobMetadataOut$=Mf.JobMetadataOut$outboundSchema=Mf.JobMetadataOut$inboundSchema=void 0;Mf.jobMetadataOutToJSON=cEo;Mf.jobMetadataOutFromJSON=dEo;var eu=uEo(ae()),MEr=ce(),lEo=ee();Mf.JobMetadataOut$inboundSchema=eu.object({expected_duration_seconds:eu.nullable(eu.number().int()).optional(),cost:eu.nullable(eu.number()).optional(),cost_currency:eu.nullable(eu.string()).optional(),train_tokens_per_step:eu.nullable(eu.number().int()).optional(),train_tokens:eu.nullable(eu.number().int()).optional(),data_tokens:eu.nullable(eu.number().int()).optional(),estimated_start_time:eu.nullable(eu.number().int()).optional()}).transform(t=>(0,MEr.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));Mf.JobMetadataOut$outboundSchema=eu.object({expectedDurationSeconds:eu.nullable(eu.number().int()).optional(),cost:eu.nullable(eu.number()).optional(),costCurrency:eu.nullable(eu.string()).optional(),trainTokensPerStep:eu.nullable(eu.number().int()).optional(),trainTokens:eu.nullable(eu.number().int()).optional(),dataTokens:eu.nullable(eu.number().int()).optional(),estimatedStartTime:eu.nullable(eu.number().int()).optional()}).transform(t=>(0,MEr.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 PEr;(function(t){t.inboundSchema=Mf.JobMetadataOut$inboundSchema,t.outboundSchema=Mf.JobMetadataOut$outboundSchema})(PEr||(Mf.JobMetadataOut$=PEr={}));function cEo(t){return JSON.stringify(Mf.JobMetadataOut$outboundSchema.parse(t))}function dEo(t){return(0,lEo.safeParse)(t,e=>Mf.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var _7=S(xa=>{"use strict";var fEo=xa&&xa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pEo=xa&&xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mEo=xa&&xa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fEo(r,e,n[o]);return pEo(r,e),r}}();Object.defineProperty(xa,"__esModule",{value:!0});xa.WandbIntegrationOut$=xa.WandbIntegrationOut$outboundSchema=xa.WandbIntegrationOut$inboundSchema=xa.WandbIntegrationOutType$=xa.WandbIntegrationOutType$outboundSchema=xa.WandbIntegrationOutType$inboundSchema=xa.WandbIntegrationOutType=void 0;xa.wandbIntegrationOutToJSON=gEo;xa.wandbIntegrationOutFromJSON=yEo;var uy=mEo(ae()),AEr=ce(),hEo=ee();xa.WandbIntegrationOutType={Wandb:"wandb"};xa.WandbIntegrationOutType$inboundSchema=uy.nativeEnum(xa.WandbIntegrationOutType);xa.WandbIntegrationOutType$outboundSchema=xa.WandbIntegrationOutType$inboundSchema;var REr;(function(t){t.inboundSchema=xa.WandbIntegrationOutType$inboundSchema,t.outboundSchema=xa.WandbIntegrationOutType$outboundSchema})(REr||(xa.WandbIntegrationOutType$=REr={}));xa.WandbIntegrationOut$inboundSchema=uy.object({type:xa.WandbIntegrationOutType$inboundSchema.default("wandb"),project:uy.string(),name:uy.nullable(uy.string()).optional(),run_name:uy.nullable(uy.string()).optional(),url:uy.nullable(uy.string()).optional()}).transform(t=>(0,AEr.remap)(t,{run_name:"runName"}));xa.WandbIntegrationOut$outboundSchema=uy.object({type:xa.WandbIntegrationOutType$outboundSchema.default("wandb"),project:uy.string(),name:uy.nullable(uy.string()).optional(),runName:uy.nullable(uy.string()).optional(),url:uy.nullable(uy.string()).optional()}).transform(t=>(0,AEr.remap)(t,{runName:"run_name"}));var IEr;(function(t){t.inboundSchema=xa.WandbIntegrationOut$inboundSchema,t.outboundSchema=xa.WandbIntegrationOut$outboundSchema})(IEr||(xa.WandbIntegrationOut$=IEr={}));function gEo(t){return JSON.stringify(xa.WandbIntegrationOut$outboundSchema.parse(t))}function yEo(t){return(0,hEo.safeParse)(t,e=>xa.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var HEr=S(nr=>{"use strict";var bEo=nr&&nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Eo=nr&&nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vEo=nr&&nr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bEo(r,e,n[o]);return _Eo(r,e),r}}();Object.defineProperty(nr,"__esModule",{value:!0});nr.ClassifierDetailedJobOut$=nr.ClassifierDetailedJobOut$outboundSchema=nr.ClassifierDetailedJobOut$inboundSchema=nr.ClassifierDetailedJobOutJobType$=nr.ClassifierDetailedJobOutJobType$outboundSchema=nr.ClassifierDetailedJobOutJobType$inboundSchema=nr.ClassifierDetailedJobOutIntegrations$=nr.ClassifierDetailedJobOutIntegrations$outboundSchema=nr.ClassifierDetailedJobOutIntegrations$inboundSchema=nr.ClassifierDetailedJobOutObject$=nr.ClassifierDetailedJobOutObject$outboundSchema=nr.ClassifierDetailedJobOutObject$inboundSchema=nr.ClassifierDetailedJobOutStatus$=nr.ClassifierDetailedJobOutStatus$outboundSchema=nr.ClassifierDetailedJobOutStatus$inboundSchema=nr.ClassifierDetailedJobOutJobType=nr.ClassifierDetailedJobOutObject=nr.ClassifierDetailedJobOutStatus=void 0;nr.classifierDetailedJobOutIntegrationsToJSON=wEo;nr.classifierDetailedJobOutIntegrationsFromJSON=SEo;nr.classifierDetailedJobOutToJSON=CEo;nr.classifierDetailedJobOutFromJSON=xEo;var Un=vEo(ae()),FEr=ce(),kEr=ee(),qEr=tIe(),UEr=nIe(),BEr=oIe(),zEr=iIe(),VEr=b7(),aIe=_7();nr.ClassifierDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};nr.ClassifierDetailedJobOutObject={Job:"job"};nr.ClassifierDetailedJobOutJobType={Classifier:"classifier"};nr.ClassifierDetailedJobOutStatus$inboundSchema=Un.nativeEnum(nr.ClassifierDetailedJobOutStatus);nr.ClassifierDetailedJobOutStatus$outboundSchema=nr.ClassifierDetailedJobOutStatus$inboundSchema;var NEr;(function(t){t.inboundSchema=nr.ClassifierDetailedJobOutStatus$inboundSchema,t.outboundSchema=nr.ClassifierDetailedJobOutStatus$outboundSchema})(NEr||(nr.ClassifierDetailedJobOutStatus$=NEr={}));nr.ClassifierDetailedJobOutObject$inboundSchema=Un.nativeEnum(nr.ClassifierDetailedJobOutObject);nr.ClassifierDetailedJobOutObject$outboundSchema=nr.ClassifierDetailedJobOutObject$inboundSchema;var DEr;(function(t){t.inboundSchema=nr.ClassifierDetailedJobOutObject$inboundSchema,t.outboundSchema=nr.ClassifierDetailedJobOutObject$outboundSchema})(DEr||(nr.ClassifierDetailedJobOutObject$=DEr={}));nr.ClassifierDetailedJobOutIntegrations$inboundSchema=aIe.WandbIntegrationOut$inboundSchema;nr.ClassifierDetailedJobOutIntegrations$outboundSchema=aIe.WandbIntegrationOut$outboundSchema;var jEr;(function(t){t.inboundSchema=nr.ClassifierDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=nr.ClassifierDetailedJobOutIntegrations$outboundSchema})(jEr||(nr.ClassifierDetailedJobOutIntegrations$=jEr={}));function wEo(t){return JSON.stringify(nr.ClassifierDetailedJobOutIntegrations$outboundSchema.parse(t))}function SEo(t){return(0,kEr.safeParse)(t,e=>nr.ClassifierDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOutIntegrations' from JSON")}nr.ClassifierDetailedJobOutJobType$inboundSchema=Un.nativeEnum(nr.ClassifierDetailedJobOutJobType);nr.ClassifierDetailedJobOutJobType$outboundSchema=nr.ClassifierDetailedJobOutJobType$inboundSchema;var $Er;(function(t){t.inboundSchema=nr.ClassifierDetailedJobOutJobType$inboundSchema,t.outboundSchema=nr.ClassifierDetailedJobOutJobType$outboundSchema})($Er||(nr.ClassifierDetailedJobOutJobType$=$Er={}));nr.ClassifierDetailedJobOut$inboundSchema=Un.object({id:Un.string(),auto_start:Un.boolean(),model:Un.string(),status:nr.ClassifierDetailedJobOutStatus$inboundSchema,created_at:Un.number().int(),modified_at:Un.number().int(),training_files:Un.array(Un.string()),validation_files:Un.nullable(Un.array(Un.string())).optional(),object:nr.ClassifierDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Un.nullable(Un.string()).optional(),suffix:Un.nullable(Un.string()).optional(),integrations:Un.nullable(Un.array(aIe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Un.nullable(Un.number().int()).optional(),metadata:Un.nullable(VEr.JobMetadataOut$inboundSchema).optional(),job_type:nr.ClassifierDetailedJobOutJobType$inboundSchema.default("classifier"),hyperparameters:BEr.ClassifierTrainingParameters$inboundSchema,events:Un.array(zEr.EventOut$inboundSchema).optional(),checkpoints:Un.array(qEr.CheckpointOut$inboundSchema).optional(),classifier_targets:Un.array(UEr.ClassifierTargetOut$inboundSchema)}).transform(t=>(0,FEr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType",classifier_targets:"classifierTargets"}));nr.ClassifierDetailedJobOut$outboundSchema=Un.object({id:Un.string(),autoStart:Un.boolean(),model:Un.string(),status:nr.ClassifierDetailedJobOutStatus$outboundSchema,createdAt:Un.number().int(),modifiedAt:Un.number().int(),trainingFiles:Un.array(Un.string()),validationFiles:Un.nullable(Un.array(Un.string())).optional(),object:nr.ClassifierDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Un.nullable(Un.string()).optional(),suffix:Un.nullable(Un.string()).optional(),integrations:Un.nullable(Un.array(aIe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Un.nullable(Un.number().int()).optional(),metadata:Un.nullable(VEr.JobMetadataOut$outboundSchema).optional(),jobType:nr.ClassifierDetailedJobOutJobType$outboundSchema.default("classifier"),hyperparameters:BEr.ClassifierTrainingParameters$outboundSchema,events:Un.array(zEr.EventOut$outboundSchema).optional(),checkpoints:Un.array(qEr.CheckpointOut$outboundSchema).optional(),classifierTargets:Un.array(UEr.ClassifierTargetOut$outboundSchema)}).transform(t=>(0,FEr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type",classifierTargets:"classifier_targets"}));var LEr;(function(t){t.inboundSchema=nr.ClassifierDetailedJobOut$inboundSchema,t.outboundSchema=nr.ClassifierDetailedJobOut$outboundSchema})(LEr||(nr.ClassifierDetailedJobOut$=LEr={}));function CEo(t){return JSON.stringify(nr.ClassifierDetailedJobOut$outboundSchema.parse(t))}function xEo(t){return(0,kEr.safeParse)(t,e=>nr.ClassifierDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOut' from JSON")}});var sIe=S(Rf=>{"use strict";var TEo=Rf&&Rf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OEo=Rf&&Rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EEo=Rf&&Rf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TEo(r,e,n[o]);return OEo(r,e),r}}();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.FTModelCapabilitiesOut$=Rf.FTModelCapabilitiesOut$outboundSchema=Rf.FTModelCapabilitiesOut$inboundSchema=void 0;Rf.ftModelCapabilitiesOutToJSON=MEo;Rf.ftModelCapabilitiesOutFromJSON=REo;var H0=EEo(ae()),JEr=ce(),PEo=ee();Rf.FTModelCapabilitiesOut$inboundSchema=H0.object({completion_chat:H0.boolean().default(!0),completion_fim:H0.boolean().default(!1),function_calling:H0.boolean().default(!1),fine_tuning:H0.boolean().default(!1),classification:H0.boolean().default(!1)}).transform(t=>(0,JEr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Rf.FTModelCapabilitiesOut$outboundSchema=H0.object({completionChat:H0.boolean().default(!0),completionFim:H0.boolean().default(!1),functionCalling:H0.boolean().default(!1),fineTuning:H0.boolean().default(!1),classification:H0.boolean().default(!1)}).transform(t=>(0,JEr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var WEr;(function(t){t.inboundSchema=Rf.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=Rf.FTModelCapabilitiesOut$outboundSchema})(WEr||(Rf.FTModelCapabilitiesOut$=WEr={}));function MEo(t){return JSON.stringify(Rf.FTModelCapabilitiesOut$outboundSchema.parse(t))}function REo(t){return(0,PEo.safeParse)(t,e=>Rf.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var ePr=S(Kn=>{"use strict";var IEo=Kn&&Kn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AEo=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NEo=Kn&&Kn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IEo(r,e,n[o]);return AEo(r,e),r}}();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ClassifierFTModelOut$=Kn.ClassifierFTModelOut$outboundSchema=Kn.ClassifierFTModelOut$inboundSchema=Kn.ClassifierFTModelOutModelType$=Kn.ClassifierFTModelOutModelType$outboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema=Kn.ClassifierFTModelOutObject$=Kn.ClassifierFTModelOutObject$outboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema=Kn.ClassifierFTModelOutModelType=Kn.ClassifierFTModelOutObject=void 0;Kn.classifierFTModelOutToJSON=jEo;Kn.classifierFTModelOutFromJSON=$Eo;var qi=NEo(ae()),ZEr=ce(),DEo=ee(),YEr=nIe(),QEr=sIe();Kn.ClassifierFTModelOutObject={Model:"model"};Kn.ClassifierFTModelOutModelType={Classifier:"classifier"};Kn.ClassifierFTModelOutObject$inboundSchema=qi.nativeEnum(Kn.ClassifierFTModelOutObject);Kn.ClassifierFTModelOutObject$outboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema;var KEr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOutObject$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOutObject$outboundSchema})(KEr||(Kn.ClassifierFTModelOutObject$=KEr={}));Kn.ClassifierFTModelOutModelType$inboundSchema=qi.nativeEnum(Kn.ClassifierFTModelOutModelType);Kn.ClassifierFTModelOutModelType$outboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema;var GEr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOutModelType$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOutModelType$outboundSchema})(GEr||(Kn.ClassifierFTModelOutModelType$=GEr={}));Kn.ClassifierFTModelOut$inboundSchema=qi.object({id:qi.string(),object:Kn.ClassifierFTModelOutObject$inboundSchema.default("model"),created:qi.number().int(),owned_by:qi.string(),workspace_id:qi.string(),root:qi.string(),root_version:qi.string(),archived:qi.boolean(),name:qi.nullable(qi.string()).optional(),description:qi.nullable(qi.string()).optional(),capabilities:QEr.FTModelCapabilitiesOut$inboundSchema,max_context_length:qi.number().int().default(32768),aliases:qi.array(qi.string()).optional(),job:qi.string(),classifier_targets:qi.array(YEr.ClassifierTargetOut$inboundSchema),model_type:Kn.ClassifierFTModelOutModelType$inboundSchema.default("classifier")}).transform(t=>(0,ZEr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",classifier_targets:"classifierTargets",model_type:"modelType"}));Kn.ClassifierFTModelOut$outboundSchema=qi.object({id:qi.string(),object:Kn.ClassifierFTModelOutObject$outboundSchema.default("model"),created:qi.number().int(),ownedBy:qi.string(),workspaceId:qi.string(),root:qi.string(),rootVersion:qi.string(),archived:qi.boolean(),name:qi.nullable(qi.string()).optional(),description:qi.nullable(qi.string()).optional(),capabilities:QEr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:qi.number().int().default(32768),aliases:qi.array(qi.string()).optional(),job:qi.string(),classifierTargets:qi.array(YEr.ClassifierTargetOut$outboundSchema),modelType:Kn.ClassifierFTModelOutModelType$outboundSchema.default("classifier")}).transform(t=>(0,ZEr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",classifierTargets:"classifier_targets",modelType:"model_type"}));var XEr;(function(t){t.inboundSchema=Kn.ClassifierFTModelOut$inboundSchema,t.outboundSchema=Kn.ClassifierFTModelOut$outboundSchema})(XEr||(Kn.ClassifierFTModelOut$=XEr={}));function jEo(t){return JSON.stringify(Kn.ClassifierFTModelOut$outboundSchema.parse(t))}function $Eo(t){return(0,DEo.safeParse)(t,e=>Kn.ClassifierFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierFTModelOut' from JSON")}});var _ct=S(or=>{"use strict";var LEo=or&&or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FEo=or&&or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kEo=or&&or.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LEo(r,e,n[o]);return FEo(r,e),r}}();Object.defineProperty(or,"__esModule",{value:!0});or.ClassifierJobOut$=or.ClassifierJobOut$outboundSchema=or.ClassifierJobOut$inboundSchema=or.ClassifierJobOutJobType$=or.ClassifierJobOutJobType$outboundSchema=or.ClassifierJobOutJobType$inboundSchema=or.ClassifierJobOutIntegrations$=or.ClassifierJobOutIntegrations$outboundSchema=or.ClassifierJobOutIntegrations$inboundSchema=or.ClassifierJobOutObject$=or.ClassifierJobOutObject$outboundSchema=or.ClassifierJobOutObject$inboundSchema=or.ClassifierJobOutStatus$=or.ClassifierJobOutStatus$outboundSchema=or.ClassifierJobOutStatus$inboundSchema=or.ClassifierJobOutJobType=or.ClassifierJobOutObject=or.ClassifierJobOutStatus=void 0;or.classifierJobOutIntegrationsToJSON=qEo;or.classifierJobOutIntegrationsFromJSON=UEo;or.classifierJobOutToJSON=BEo;or.classifierJobOutFromJSON=zEo;var Uo=kEo(ae()),aPr=ce(),sPr=ee(),uPr=oIe(),lPr=b7(),uIe=_7();or.ClassifierJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};or.ClassifierJobOutObject={Job:"job"};or.ClassifierJobOutJobType={Classifier:"classifier"};or.ClassifierJobOutStatus$inboundSchema=Uo.nativeEnum(or.ClassifierJobOutStatus);or.ClassifierJobOutStatus$outboundSchema=or.ClassifierJobOutStatus$inboundSchema;var tPr;(function(t){t.inboundSchema=or.ClassifierJobOutStatus$inboundSchema,t.outboundSchema=or.ClassifierJobOutStatus$outboundSchema})(tPr||(or.ClassifierJobOutStatus$=tPr={}));or.ClassifierJobOutObject$inboundSchema=Uo.nativeEnum(or.ClassifierJobOutObject);or.ClassifierJobOutObject$outboundSchema=or.ClassifierJobOutObject$inboundSchema;var rPr;(function(t){t.inboundSchema=or.ClassifierJobOutObject$inboundSchema,t.outboundSchema=or.ClassifierJobOutObject$outboundSchema})(rPr||(or.ClassifierJobOutObject$=rPr={}));or.ClassifierJobOutIntegrations$inboundSchema=uIe.WandbIntegrationOut$inboundSchema;or.ClassifierJobOutIntegrations$outboundSchema=uIe.WandbIntegrationOut$outboundSchema;var nPr;(function(t){t.inboundSchema=or.ClassifierJobOutIntegrations$inboundSchema,t.outboundSchema=or.ClassifierJobOutIntegrations$outboundSchema})(nPr||(or.ClassifierJobOutIntegrations$=nPr={}));function qEo(t){return JSON.stringify(or.ClassifierJobOutIntegrations$outboundSchema.parse(t))}function UEo(t){return(0,sPr.safeParse)(t,e=>or.ClassifierJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOutIntegrations' from JSON")}or.ClassifierJobOutJobType$inboundSchema=Uo.nativeEnum(or.ClassifierJobOutJobType);or.ClassifierJobOutJobType$outboundSchema=or.ClassifierJobOutJobType$inboundSchema;var oPr;(function(t){t.inboundSchema=or.ClassifierJobOutJobType$inboundSchema,t.outboundSchema=or.ClassifierJobOutJobType$outboundSchema})(oPr||(or.ClassifierJobOutJobType$=oPr={}));or.ClassifierJobOut$inboundSchema=Uo.object({id:Uo.string(),auto_start:Uo.boolean(),model:Uo.string(),status:or.ClassifierJobOutStatus$inboundSchema,created_at:Uo.number().int(),modified_at:Uo.number().int(),training_files:Uo.array(Uo.string()),validation_files:Uo.nullable(Uo.array(Uo.string())).optional(),object:or.ClassifierJobOutObject$inboundSchema.default("job"),fine_tuned_model:Uo.nullable(Uo.string()).optional(),suffix:Uo.nullable(Uo.string()).optional(),integrations:Uo.nullable(Uo.array(uIe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Uo.nullable(Uo.number().int()).optional(),metadata:Uo.nullable(lPr.JobMetadataOut$inboundSchema).optional(),job_type:or.ClassifierJobOutJobType$inboundSchema.default("classifier"),hyperparameters:uPr.ClassifierTrainingParameters$inboundSchema}).transform(t=>(0,aPr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));or.ClassifierJobOut$outboundSchema=Uo.object({id:Uo.string(),autoStart:Uo.boolean(),model:Uo.string(),status:or.ClassifierJobOutStatus$outboundSchema,createdAt:Uo.number().int(),modifiedAt:Uo.number().int(),trainingFiles:Uo.array(Uo.string()),validationFiles:Uo.nullable(Uo.array(Uo.string())).optional(),object:or.ClassifierJobOutObject$outboundSchema.default("job"),fineTunedModel:Uo.nullable(Uo.string()).optional(),suffix:Uo.nullable(Uo.string()).optional(),integrations:Uo.nullable(Uo.array(uIe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Uo.nullable(Uo.number().int()).optional(),metadata:Uo.nullable(lPr.JobMetadataOut$outboundSchema).optional(),jobType:or.ClassifierJobOutJobType$outboundSchema.default("classifier"),hyperparameters:uPr.ClassifierTrainingParameters$outboundSchema}).transform(t=>(0,aPr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var iPr;(function(t){t.inboundSchema=or.ClassifierJobOut$inboundSchema,t.outboundSchema=or.ClassifierJobOut$outboundSchema})(iPr||(or.ClassifierJobOut$=iPr={}));function BEo(t){return JSON.stringify(or.ClassifierJobOut$outboundSchema.parse(t))}function zEo(t){return(0,sPr.safeParse)(t,e=>or.ClassifierJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOut' from JSON")}});var vct=S(If=>{"use strict";var VEo=If&&If.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HEo=If&&If.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WEo=If&&If.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VEo(r,e,n[o]);return HEo(r,e),r}}();Object.defineProperty(If,"__esModule",{value:!0});If.ClassifierTargetIn$=If.ClassifierTargetIn$outboundSchema=If.ClassifierTargetIn$inboundSchema=void 0;If.classifierTargetInToJSON=KEo;If.classifierTargetInFromJSON=GEo;var W0=WEo(ae()),dPr=ce(),JEo=ee(),fPr=rIe();If.ClassifierTargetIn$inboundSchema=W0.object({name:W0.string(),labels:W0.array(W0.string()),weight:W0.number().default(1),loss_function:W0.nullable(fPr.FTClassifierLossFunction$inboundSchema).optional()}).transform(t=>(0,dPr.remap)(t,{loss_function:"lossFunction"}));If.ClassifierTargetIn$outboundSchema=W0.object({name:W0.string(),labels:W0.array(W0.string()),weight:W0.number().default(1),lossFunction:W0.nullable(fPr.FTClassifierLossFunction$outboundSchema).optional()}).transform(t=>(0,dPr.remap)(t,{lossFunction:"loss_function"}));var cPr;(function(t){t.inboundSchema=If.ClassifierTargetIn$inboundSchema,t.outboundSchema=If.ClassifierTargetIn$outboundSchema})(cPr||(If.ClassifierTargetIn$=cPr={}));function KEo(t){return JSON.stringify(If.ClassifierTargetIn$outboundSchema.parse(t))}function GEo(t){return(0,JEo.safeParse)(t,e=>If.ClassifierTargetIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetIn' from JSON")}});var wct=S(Af=>{"use strict";var XEo=Af&&Af.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZEo=Af&&Af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEo=Af&&Af.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XEo(r,e,n[o]);return ZEo(r,e),r}}();Object.defineProperty(Af,"__esModule",{value:!0});Af.ClassifierTrainingParametersIn$=Af.ClassifierTrainingParametersIn$outboundSchema=Af.ClassifierTrainingParametersIn$inboundSchema=void 0;Af.classifierTrainingParametersInToJSON=ePo;Af.classifierTrainingParametersInFromJSON=tPo;var ic=YEo(ae()),mPr=ce(),QEo=ee();Af.ClassifierTrainingParametersIn$inboundSchema=ic.object({training_steps:ic.nullable(ic.number().int()).optional(),learning_rate:ic.number().default(1e-4),weight_decay:ic.nullable(ic.number()).optional(),warmup_fraction:ic.nullable(ic.number()).optional(),epochs:ic.nullable(ic.number()).optional(),seq_len:ic.nullable(ic.number().int()).optional()}).transform(t=>(0,mPr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));Af.ClassifierTrainingParametersIn$outboundSchema=ic.object({trainingSteps:ic.nullable(ic.number().int()).optional(),learningRate:ic.number().default(1e-4),weightDecay:ic.nullable(ic.number()).optional(),warmupFraction:ic.nullable(ic.number()).optional(),epochs:ic.nullable(ic.number()).optional(),seqLen:ic.nullable(ic.number().int()).optional()}).transform(t=>(0,mPr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var pPr;(function(t){t.inboundSchema=Af.ClassifierTrainingParametersIn$inboundSchema,t.outboundSchema=Af.ClassifierTrainingParametersIn$outboundSchema})(pPr||(Af.ClassifierTrainingParametersIn$=pPr={}));function ePo(t){return JSON.stringify(Af.ClassifierTrainingParametersIn$outboundSchema.parse(t))}function tPo(t){return(0,QEo.safeParse)(t,e=>Af.ClassifierTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParametersIn' from JSON")}});var Sct=S(ys=>{"use strict";var rPo=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]}),nPo=ys&&ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oPo=ys&&ys.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rPo(r,e,n[o]);return nPo(r,e),r}}();Object.defineProperty(ys,"__esModule",{value:!0});ys.DeltaMessage$=ys.DeltaMessage$outboundSchema=ys.DeltaMessage$inboundSchema=ys.Content$=ys.Content$outboundSchema=ys.Content$inboundSchema=void 0;ys.contentToJSON=iPo;ys.contentFromJSON=aPo;ys.deltaMessageToJSON=sPo;ys.deltaMessageFromJSON=uPo;var ac=oPo(ae()),yPr=ce(),bPr=ee(),lIe=c7(),_Pr=tRe();ys.Content$inboundSchema=ac.union([ac.string(),ac.array(lIe.ContentChunk$inboundSchema)]);ys.Content$outboundSchema=ac.union([ac.string(),ac.array(lIe.ContentChunk$outboundSchema)]);var hPr;(function(t){t.inboundSchema=ys.Content$inboundSchema,t.outboundSchema=ys.Content$outboundSchema})(hPr||(ys.Content$=hPr={}));function iPo(t){return JSON.stringify(ys.Content$outboundSchema.parse(t))}function aPo(t){return(0,bPr.safeParse)(t,e=>ys.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}ys.DeltaMessage$inboundSchema=ac.object({role:ac.nullable(ac.string()).optional(),content:ac.nullable(ac.union([ac.string(),ac.array(lIe.ContentChunk$inboundSchema)])).optional(),tool_calls:ac.nullable(ac.array(_Pr.ToolCall$inboundSchema)).optional()}).transform(t=>(0,yPr.remap)(t,{tool_calls:"toolCalls"}));ys.DeltaMessage$outboundSchema=ac.object({role:ac.nullable(ac.string()).optional(),content:ac.nullable(ac.union([ac.string(),ac.array(lIe.ContentChunk$outboundSchema)])).optional(),toolCalls:ac.nullable(ac.array(_Pr.ToolCall$outboundSchema)).optional()}).transform(t=>(0,yPr.remap)(t,{toolCalls:"tool_calls"}));var gPr;(function(t){t.inboundSchema=ys.DeltaMessage$inboundSchema,t.outboundSchema=ys.DeltaMessage$outboundSchema})(gPr||(ys.DeltaMessage$=gPr={}));function sPo(t){return JSON.stringify(ys.DeltaMessage$outboundSchema.parse(t))}function uPo(t){return(0,bPr.safeParse)(t,e=>ys.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var Cct=S(Ta=>{"use strict";var lPo=Ta&&Ta.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cPo=Ta&&Ta.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dPo=Ta&&Ta.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lPo(r,e,n[o]);return cPo(r,e),r}}();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.CompletionResponseStreamChoice$=Ta.CompletionResponseStreamChoice$outboundSchema=Ta.CompletionResponseStreamChoice$inboundSchema=Ta.CompletionResponseStreamChoiceFinishReason$=Ta.CompletionResponseStreamChoiceFinishReason$outboundSchema=Ta.CompletionResponseStreamChoiceFinishReason$inboundSchema=Ta.CompletionResponseStreamChoiceFinishReason=void 0;Ta.completionResponseStreamChoiceToJSON=mPo;Ta.completionResponseStreamChoiceFromJSON=hPo;var Hw=dPo(ae()),SPr=ce(),fPo=ee(),pPo=Gx(),CPr=Sct();Ta.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};Ta.CompletionResponseStreamChoiceFinishReason$inboundSchema=Hw.union([Hw.nativeEnum(Ta.CompletionResponseStreamChoiceFinishReason),Hw.string().transform(pPo.catchUnrecognizedEnum)]);Ta.CompletionResponseStreamChoiceFinishReason$outboundSchema=Hw.union([Hw.nativeEnum(Ta.CompletionResponseStreamChoiceFinishReason),Hw.string().and(Hw.custom())]);var vPr;(function(t){t.inboundSchema=Ta.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=Ta.CompletionResponseStreamChoiceFinishReason$outboundSchema})(vPr||(Ta.CompletionResponseStreamChoiceFinishReason$=vPr={}));Ta.CompletionResponseStreamChoice$inboundSchema=Hw.object({index:Hw.number().int(),delta:CPr.DeltaMessage$inboundSchema,finish_reason:Hw.nullable(Ta.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,SPr.remap)(t,{finish_reason:"finishReason"}));Ta.CompletionResponseStreamChoice$outboundSchema=Hw.object({index:Hw.number().int(),delta:CPr.DeltaMessage$outboundSchema,finishReason:Hw.nullable(Ta.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,SPr.remap)(t,{finishReason:"finish_reason"}));var wPr;(function(t){t.inboundSchema=Ta.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=Ta.CompletionResponseStreamChoice$outboundSchema})(wPr||(Ta.CompletionResponseStreamChoice$=wPr={}));function mPo(t){return JSON.stringify(Ta.CompletionResponseStreamChoice$outboundSchema.parse(t))}function hPo(t){return(0,fPo.safeParse)(t,e=>Ta.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var xct=S(Nf=>{"use strict";var gPo=Nf&&Nf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yPo=Nf&&Nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bPo=Nf&&Nf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gPo(r,e,n[o]);return yPo(r,e),r}}();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.CompletionChunk$=Nf.CompletionChunk$outboundSchema=Nf.CompletionChunk$inboundSchema=void 0;Nf.completionChunkToJSON=vPo;Nf.completionChunkFromJSON=wPo;var J0=bPo(ae()),_Po=ee(),TPr=Cct(),OPr=oU();Nf.CompletionChunk$inboundSchema=J0.object({id:J0.string(),object:J0.string().optional(),created:J0.number().int().optional(),model:J0.string(),usage:OPr.UsageInfo$inboundSchema.optional(),choices:J0.array(TPr.CompletionResponseStreamChoice$inboundSchema)});Nf.CompletionChunk$outboundSchema=J0.object({id:J0.string(),object:J0.string().optional(),created:J0.number().int().optional(),model:J0.string(),usage:OPr.UsageInfo$outboundSchema.optional(),choices:J0.array(TPr.CompletionResponseStreamChoice$outboundSchema)});var xPr;(function(t){t.inboundSchema=Nf.CompletionChunk$inboundSchema,t.outboundSchema=Nf.CompletionChunk$outboundSchema})(xPr||(Nf.CompletionChunk$=xPr={}));function vPo(t){return JSON.stringify(Nf.CompletionChunk$outboundSchema.parse(t))}function wPo(t){return(0,_Po.safeParse)(t,e=>Nf.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var cIe=S(Df=>{"use strict";var SPo=Df&&Df.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CPo=Df&&Df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xPo=Df&&Df.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SPo(r,e,n[o]);return CPo(r,e),r}}();Object.defineProperty(Df,"__esModule",{value:!0});Df.CompletionTrainingParameters$=Df.CompletionTrainingParameters$outboundSchema=Df.CompletionTrainingParameters$inboundSchema=void 0;Df.completionTrainingParametersToJSON=OPo;Df.completionTrainingParametersFromJSON=EPo;var vu=xPo(ae()),PPr=ce(),TPo=ee();Df.CompletionTrainingParameters$inboundSchema=vu.object({training_steps:vu.nullable(vu.number().int()).optional(),learning_rate:vu.number().default(1e-4),weight_decay:vu.nullable(vu.number()).optional(),warmup_fraction:vu.nullable(vu.number()).optional(),epochs:vu.nullable(vu.number()).optional(),seq_len:vu.nullable(vu.number().int()).optional(),fim_ratio:vu.nullable(vu.number()).optional()}).transform(t=>(0,PPr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));Df.CompletionTrainingParameters$outboundSchema=vu.object({trainingSteps:vu.nullable(vu.number().int()).optional(),learningRate:vu.number().default(1e-4),weightDecay:vu.nullable(vu.number()).optional(),warmupFraction:vu.nullable(vu.number()).optional(),epochs:vu.nullable(vu.number()).optional(),seqLen:vu.nullable(vu.number().int()).optional(),fimRatio:vu.nullable(vu.number()).optional()}).transform(t=>(0,PPr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var EPr;(function(t){t.inboundSchema=Df.CompletionTrainingParameters$inboundSchema,t.outboundSchema=Df.CompletionTrainingParameters$outboundSchema})(EPr||(Df.CompletionTrainingParameters$=EPr={}));function OPo(t){return JSON.stringify(Df.CompletionTrainingParameters$outboundSchema.parse(t))}function EPo(t){return(0,TPo.safeParse)(t,e=>Df.CompletionTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParameters' from JSON")}});var dIe=S(Oa=>{"use strict";var PPo=Oa&&Oa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MPo=Oa&&Oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RPo=Oa&&Oa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PPo(r,e,n[o]);return MPo(r,e),r}}();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.GithubRepositoryOut$=Oa.GithubRepositoryOut$outboundSchema=Oa.GithubRepositoryOut$inboundSchema=Oa.GithubRepositoryOutType$=Oa.GithubRepositoryOutType$outboundSchema=Oa.GithubRepositoryOutType$inboundSchema=Oa.GithubRepositoryOutType=void 0;Oa.githubRepositoryOutToJSON=APo;Oa.githubRepositoryOutFromJSON=NPo;var s_=RPo(ae()),IPr=ce(),IPo=ee();Oa.GithubRepositoryOutType={Github:"github"};Oa.GithubRepositoryOutType$inboundSchema=s_.nativeEnum(Oa.GithubRepositoryOutType);Oa.GithubRepositoryOutType$outboundSchema=Oa.GithubRepositoryOutType$inboundSchema;var MPr;(function(t){t.inboundSchema=Oa.GithubRepositoryOutType$inboundSchema,t.outboundSchema=Oa.GithubRepositoryOutType$outboundSchema})(MPr||(Oa.GithubRepositoryOutType$=MPr={}));Oa.GithubRepositoryOut$inboundSchema=s_.object({type:Oa.GithubRepositoryOutType$inboundSchema.default("github"),name:s_.string(),owner:s_.string(),ref:s_.nullable(s_.string()).optional(),weight:s_.number().default(1),commit_id:s_.string()}).transform(t=>(0,IPr.remap)(t,{commit_id:"commitId"}));Oa.GithubRepositoryOut$outboundSchema=s_.object({type:Oa.GithubRepositoryOutType$outboundSchema.default("github"),name:s_.string(),owner:s_.string(),ref:s_.nullable(s_.string()).optional(),weight:s_.number().default(1),commitId:s_.string()}).transform(t=>(0,IPr.remap)(t,{commitId:"commit_id"}));var RPr;(function(t){t.inboundSchema=Oa.GithubRepositoryOut$inboundSchema,t.outboundSchema=Oa.GithubRepositoryOut$outboundSchema})(RPr||(Oa.GithubRepositoryOut$=RPr={}));function APo(t){return JSON.stringify(Oa.GithubRepositoryOut$outboundSchema.parse(t))}function NPo(t){return(0,IPo.safeParse)(t,e=>Oa.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var zPr=S(Pt=>{"use strict";var DPo=Pt&&Pt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jPo=Pt&&Pt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Po=Pt&&Pt.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DPo(r,e,n[o]);return jPo(r,e),r}}();Object.defineProperty(Pt,"__esModule",{value:!0});Pt.CompletionDetailedJobOut$=Pt.CompletionDetailedJobOut$outboundSchema=Pt.CompletionDetailedJobOut$inboundSchema=Pt.CompletionDetailedJobOutRepositories$=Pt.CompletionDetailedJobOutRepositories$outboundSchema=Pt.CompletionDetailedJobOutRepositories$inboundSchema=Pt.CompletionDetailedJobOutJobType$=Pt.CompletionDetailedJobOutJobType$outboundSchema=Pt.CompletionDetailedJobOutJobType$inboundSchema=Pt.CompletionDetailedJobOutIntegrations$=Pt.CompletionDetailedJobOutIntegrations$outboundSchema=Pt.CompletionDetailedJobOutIntegrations$inboundSchema=Pt.CompletionDetailedJobOutObject$=Pt.CompletionDetailedJobOutObject$outboundSchema=Pt.CompletionDetailedJobOutObject$inboundSchema=Pt.CompletionDetailedJobOutStatus$=Pt.CompletionDetailedJobOutStatus$outboundSchema=Pt.CompletionDetailedJobOutStatus$inboundSchema=Pt.CompletionDetailedJobOutJobType=Pt.CompletionDetailedJobOutObject=Pt.CompletionDetailedJobOutStatus=void 0;Pt.completionDetailedJobOutIntegrationsToJSON=LPo;Pt.completionDetailedJobOutIntegrationsFromJSON=FPo;Pt.completionDetailedJobOutRepositoriesToJSON=kPo;Pt.completionDetailedJobOutRepositoriesFromJSON=qPo;Pt.completionDetailedJobOutToJSON=UPo;Pt.completionDetailedJobOutFromJSON=BPo;var Bn=$Po(ae()),FPr=ce(),Tct=ee(),kPr=tIe(),qPr=cIe(),UPr=iIe(),fIe=dIe(),BPr=b7(),pIe=_7();Pt.CompletionDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Pt.CompletionDetailedJobOutObject={Job:"job"};Pt.CompletionDetailedJobOutJobType={Completion:"completion"};Pt.CompletionDetailedJobOutStatus$inboundSchema=Bn.nativeEnum(Pt.CompletionDetailedJobOutStatus);Pt.CompletionDetailedJobOutStatus$outboundSchema=Pt.CompletionDetailedJobOutStatus$inboundSchema;var APr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOutStatus$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOutStatus$outboundSchema})(APr||(Pt.CompletionDetailedJobOutStatus$=APr={}));Pt.CompletionDetailedJobOutObject$inboundSchema=Bn.nativeEnum(Pt.CompletionDetailedJobOutObject);Pt.CompletionDetailedJobOutObject$outboundSchema=Pt.CompletionDetailedJobOutObject$inboundSchema;var NPr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOutObject$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOutObject$outboundSchema})(NPr||(Pt.CompletionDetailedJobOutObject$=NPr={}));Pt.CompletionDetailedJobOutIntegrations$inboundSchema=pIe.WandbIntegrationOut$inboundSchema;Pt.CompletionDetailedJobOutIntegrations$outboundSchema=pIe.WandbIntegrationOut$outboundSchema;var DPr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOutIntegrations$outboundSchema})(DPr||(Pt.CompletionDetailedJobOutIntegrations$=DPr={}));function LPo(t){return JSON.stringify(Pt.CompletionDetailedJobOutIntegrations$outboundSchema.parse(t))}function FPo(t){return(0,Tct.safeParse)(t,e=>Pt.CompletionDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutIntegrations' from JSON")}Pt.CompletionDetailedJobOutJobType$inboundSchema=Bn.nativeEnum(Pt.CompletionDetailedJobOutJobType);Pt.CompletionDetailedJobOutJobType$outboundSchema=Pt.CompletionDetailedJobOutJobType$inboundSchema;var jPr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOutJobType$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOutJobType$outboundSchema})(jPr||(Pt.CompletionDetailedJobOutJobType$=jPr={}));Pt.CompletionDetailedJobOutRepositories$inboundSchema=fIe.GithubRepositoryOut$inboundSchema;Pt.CompletionDetailedJobOutRepositories$outboundSchema=fIe.GithubRepositoryOut$outboundSchema;var $Pr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOutRepositories$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOutRepositories$outboundSchema})($Pr||(Pt.CompletionDetailedJobOutRepositories$=$Pr={}));function kPo(t){return JSON.stringify(Pt.CompletionDetailedJobOutRepositories$outboundSchema.parse(t))}function qPo(t){return(0,Tct.safeParse)(t,e=>Pt.CompletionDetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutRepositories' from JSON")}Pt.CompletionDetailedJobOut$inboundSchema=Bn.object({id:Bn.string(),auto_start:Bn.boolean(),model:Bn.string(),status:Pt.CompletionDetailedJobOutStatus$inboundSchema,created_at:Bn.number().int(),modified_at:Bn.number().int(),training_files:Bn.array(Bn.string()),validation_files:Bn.nullable(Bn.array(Bn.string())).optional(),object:Pt.CompletionDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Bn.nullable(Bn.string()).optional(),suffix:Bn.nullable(Bn.string()).optional(),integrations:Bn.nullable(Bn.array(pIe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Bn.nullable(Bn.number().int()).optional(),metadata:Bn.nullable(BPr.JobMetadataOut$inboundSchema).optional(),job_type:Pt.CompletionDetailedJobOutJobType$inboundSchema.default("completion"),hyperparameters:qPr.CompletionTrainingParameters$inboundSchema,repositories:Bn.array(fIe.GithubRepositoryOut$inboundSchema).optional(),events:Bn.array(UPr.EventOut$inboundSchema).optional(),checkpoints:Bn.array(kPr.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,FPr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));Pt.CompletionDetailedJobOut$outboundSchema=Bn.object({id:Bn.string(),autoStart:Bn.boolean(),model:Bn.string(),status:Pt.CompletionDetailedJobOutStatus$outboundSchema,createdAt:Bn.number().int(),modifiedAt:Bn.number().int(),trainingFiles:Bn.array(Bn.string()),validationFiles:Bn.nullable(Bn.array(Bn.string())).optional(),object:Pt.CompletionDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Bn.nullable(Bn.string()).optional(),suffix:Bn.nullable(Bn.string()).optional(),integrations:Bn.nullable(Bn.array(pIe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Bn.nullable(Bn.number().int()).optional(),metadata:Bn.nullable(BPr.JobMetadataOut$outboundSchema).optional(),jobType:Pt.CompletionDetailedJobOutJobType$outboundSchema.default("completion"),hyperparameters:qPr.CompletionTrainingParameters$outboundSchema,repositories:Bn.array(fIe.GithubRepositoryOut$outboundSchema).optional(),events:Bn.array(UPr.EventOut$outboundSchema).optional(),checkpoints:Bn.array(kPr.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,FPr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var LPr;(function(t){t.inboundSchema=Pt.CompletionDetailedJobOut$inboundSchema,t.outboundSchema=Pt.CompletionDetailedJobOut$outboundSchema})(LPr||(Pt.CompletionDetailedJobOut$=LPr={}));function UPo(t){return JSON.stringify(Pt.CompletionDetailedJobOut$outboundSchema.parse(t))}function BPo(t){return(0,Tct.safeParse)(t,e=>Pt.CompletionDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOut' from JSON")}});var WPr=S(jf=>{"use strict";var zPo=jf&&jf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VPo=jf&&jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HPo=jf&&jf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zPo(r,e,n[o]);return VPo(r,e),r}}();Object.defineProperty(jf,"__esModule",{value:!0});jf.CompletionEvent$=jf.CompletionEvent$outboundSchema=jf.CompletionEvent$inboundSchema=void 0;jf.completionEventToJSON=JPo;jf.completionEventFromJSON=KPo;var Dse=HPo(ae()),WPo=ee(),HPr=xct();jf.CompletionEvent$inboundSchema=Dse.object({data:Dse.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:Dse.ZodIssueCode.custom,message:`malformed json: ${r}`}),Dse.NEVER}}).pipe(HPr.CompletionChunk$inboundSchema)});jf.CompletionEvent$outboundSchema=Dse.object({data:HPr.CompletionChunk$outboundSchema});var VPr;(function(t){t.inboundSchema=jf.CompletionEvent$inboundSchema,t.outboundSchema=jf.CompletionEvent$outboundSchema})(VPr||(jf.CompletionEvent$=VPr={}));function JPo(t){return JSON.stringify(jf.CompletionEvent$outboundSchema.parse(t))}function KPo(t){return(0,WPo.safeParse)(t,e=>jf.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var YPr=S(Gn=>{"use strict";var GPo=Gn&&Gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XPo=Gn&&Gn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZPo=Gn&&Gn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GPo(r,e,n[o]);return XPo(r,e),r}}();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.CompletionFTModelOut$=Gn.CompletionFTModelOut$outboundSchema=Gn.CompletionFTModelOut$inboundSchema=Gn.ModelType$=Gn.ModelType$outboundSchema=Gn.ModelType$inboundSchema=Gn.CompletionFTModelOutObject$=Gn.CompletionFTModelOutObject$outboundSchema=Gn.CompletionFTModelOutObject$inboundSchema=Gn.ModelType=Gn.CompletionFTModelOutObject=void 0;Gn.completionFTModelOutToJSON=QPo;Gn.completionFTModelOutFromJSON=eMo;var Ea=ZPo(ae()),XPr=ce(),YPo=ee(),ZPr=sIe();Gn.CompletionFTModelOutObject={Model:"model"};Gn.ModelType={Completion:"completion"};Gn.CompletionFTModelOutObject$inboundSchema=Ea.nativeEnum(Gn.CompletionFTModelOutObject);Gn.CompletionFTModelOutObject$outboundSchema=Gn.CompletionFTModelOutObject$inboundSchema;var JPr;(function(t){t.inboundSchema=Gn.CompletionFTModelOutObject$inboundSchema,t.outboundSchema=Gn.CompletionFTModelOutObject$outboundSchema})(JPr||(Gn.CompletionFTModelOutObject$=JPr={}));Gn.ModelType$inboundSchema=Ea.nativeEnum(Gn.ModelType);Gn.ModelType$outboundSchema=Gn.ModelType$inboundSchema;var KPr;(function(t){t.inboundSchema=Gn.ModelType$inboundSchema,t.outboundSchema=Gn.ModelType$outboundSchema})(KPr||(Gn.ModelType$=KPr={}));Gn.CompletionFTModelOut$inboundSchema=Ea.object({id:Ea.string(),object:Gn.CompletionFTModelOutObject$inboundSchema.default("model"),created:Ea.number().int(),owned_by:Ea.string(),workspace_id:Ea.string(),root:Ea.string(),root_version:Ea.string(),archived:Ea.boolean(),name:Ea.nullable(Ea.string()).optional(),description:Ea.nullable(Ea.string()).optional(),capabilities:ZPr.FTModelCapabilitiesOut$inboundSchema,max_context_length:Ea.number().int().default(32768),aliases:Ea.array(Ea.string()).optional(),job:Ea.string(),model_type:Gn.ModelType$inboundSchema.default("completion")}).transform(t=>(0,XPr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",model_type:"modelType"}));Gn.CompletionFTModelOut$outboundSchema=Ea.object({id:Ea.string(),object:Gn.CompletionFTModelOutObject$outboundSchema.default("model"),created:Ea.number().int(),ownedBy:Ea.string(),workspaceId:Ea.string(),root:Ea.string(),rootVersion:Ea.string(),archived:Ea.boolean(),name:Ea.nullable(Ea.string()).optional(),description:Ea.nullable(Ea.string()).optional(),capabilities:ZPr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Ea.number().int().default(32768),aliases:Ea.array(Ea.string()).optional(),job:Ea.string(),modelType:Gn.ModelType$outboundSchema.default("completion")}).transform(t=>(0,XPr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",modelType:"model_type"}));var GPr;(function(t){t.inboundSchema=Gn.CompletionFTModelOut$inboundSchema,t.outboundSchema=Gn.CompletionFTModelOut$outboundSchema})(GPr||(Gn.CompletionFTModelOut$=GPr={}));function QPo(t){return JSON.stringify(Gn.CompletionFTModelOut$outboundSchema.parse(t))}function eMo(t){return(0,YPo.safeParse)(t,e=>Gn.CompletionFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionFTModelOut' from JSON")}});var Ect=S(Mt=>{"use strict";var tMo=Mt&&Mt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rMo=Mt&&Mt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nMo=Mt&&Mt.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tMo(r,e,n[o]);return rMo(r,e),r}}();Object.defineProperty(Mt,"__esModule",{value:!0});Mt.CompletionJobOut$=Mt.CompletionJobOut$outboundSchema=Mt.CompletionJobOut$inboundSchema=Mt.Repositories$=Mt.Repositories$outboundSchema=Mt.Repositories$inboundSchema=Mt.JobType$=Mt.JobType$outboundSchema=Mt.JobType$inboundSchema=Mt.Integrations$=Mt.Integrations$outboundSchema=Mt.Integrations$inboundSchema=Mt.CompletionJobOutObject$=Mt.CompletionJobOutObject$outboundSchema=Mt.CompletionJobOutObject$inboundSchema=Mt.Status$=Mt.Status$outboundSchema=Mt.Status$inboundSchema=Mt.JobType=Mt.CompletionJobOutObject=Mt.Status=void 0;Mt.integrationsToJSON=oMo;Mt.integrationsFromJSON=iMo;Mt.repositoriesToJSON=aMo;Mt.repositoriesFromJSON=sMo;Mt.completionJobOutToJSON=uMo;Mt.completionJobOutFromJSON=lMo;var jo=nMo(ae()),iMr=ce(),Oct=ee(),aMr=cIe(),mIe=dIe(),sMr=b7(),hIe=_7();Mt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Mt.CompletionJobOutObject={Job:"job"};Mt.JobType={Completion:"completion"};Mt.Status$inboundSchema=jo.nativeEnum(Mt.Status);Mt.Status$outboundSchema=Mt.Status$inboundSchema;var QPr;(function(t){t.inboundSchema=Mt.Status$inboundSchema,t.outboundSchema=Mt.Status$outboundSchema})(QPr||(Mt.Status$=QPr={}));Mt.CompletionJobOutObject$inboundSchema=jo.nativeEnum(Mt.CompletionJobOutObject);Mt.CompletionJobOutObject$outboundSchema=Mt.CompletionJobOutObject$inboundSchema;var eMr;(function(t){t.inboundSchema=Mt.CompletionJobOutObject$inboundSchema,t.outboundSchema=Mt.CompletionJobOutObject$outboundSchema})(eMr||(Mt.CompletionJobOutObject$=eMr={}));Mt.Integrations$inboundSchema=hIe.WandbIntegrationOut$inboundSchema;Mt.Integrations$outboundSchema=hIe.WandbIntegrationOut$outboundSchema;var tMr;(function(t){t.inboundSchema=Mt.Integrations$inboundSchema,t.outboundSchema=Mt.Integrations$outboundSchema})(tMr||(Mt.Integrations$=tMr={}));function oMo(t){return JSON.stringify(Mt.Integrations$outboundSchema.parse(t))}function iMo(t){return(0,Oct.safeParse)(t,e=>Mt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}Mt.JobType$inboundSchema=jo.nativeEnum(Mt.JobType);Mt.JobType$outboundSchema=Mt.JobType$inboundSchema;var rMr;(function(t){t.inboundSchema=Mt.JobType$inboundSchema,t.outboundSchema=Mt.JobType$outboundSchema})(rMr||(Mt.JobType$=rMr={}));Mt.Repositories$inboundSchema=mIe.GithubRepositoryOut$inboundSchema;Mt.Repositories$outboundSchema=mIe.GithubRepositoryOut$outboundSchema;var nMr;(function(t){t.inboundSchema=Mt.Repositories$inboundSchema,t.outboundSchema=Mt.Repositories$outboundSchema})(nMr||(Mt.Repositories$=nMr={}));function aMo(t){return JSON.stringify(Mt.Repositories$outboundSchema.parse(t))}function sMo(t){return(0,Oct.safeParse)(t,e=>Mt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}Mt.CompletionJobOut$inboundSchema=jo.object({id:jo.string(),auto_start:jo.boolean(),model:jo.string(),status:Mt.Status$inboundSchema,created_at:jo.number().int(),modified_at:jo.number().int(),training_files:jo.array(jo.string()),validation_files:jo.nullable(jo.array(jo.string())).optional(),object:Mt.CompletionJobOutObject$inboundSchema.default("job"),fine_tuned_model:jo.nullable(jo.string()).optional(),suffix:jo.nullable(jo.string()).optional(),integrations:jo.nullable(jo.array(hIe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:jo.nullable(jo.number().int()).optional(),metadata:jo.nullable(sMr.JobMetadataOut$inboundSchema).optional(),job_type:Mt.JobType$inboundSchema.default("completion"),hyperparameters:aMr.CompletionTrainingParameters$inboundSchema,repositories:jo.array(mIe.GithubRepositoryOut$inboundSchema).optional()}).transform(t=>(0,iMr.remap)(t,{auto_start:"autoStart",created_at:"createdAt",modified_at:"modifiedAt",training_files:"trainingFiles",validation_files:"validationFiles",fine_tuned_model:"fineTunedModel",trained_tokens:"trainedTokens",job_type:"jobType"}));Mt.CompletionJobOut$outboundSchema=jo.object({id:jo.string(),autoStart:jo.boolean(),model:jo.string(),status:Mt.Status$outboundSchema,createdAt:jo.number().int(),modifiedAt:jo.number().int(),trainingFiles:jo.array(jo.string()),validationFiles:jo.nullable(jo.array(jo.string())).optional(),object:Mt.CompletionJobOutObject$outboundSchema.default("job"),fineTunedModel:jo.nullable(jo.string()).optional(),suffix:jo.nullable(jo.string()).optional(),integrations:jo.nullable(jo.array(hIe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:jo.nullable(jo.number().int()).optional(),metadata:jo.nullable(sMr.JobMetadataOut$outboundSchema).optional(),jobType:Mt.JobType$outboundSchema.default("completion"),hyperparameters:aMr.CompletionTrainingParameters$outboundSchema,repositories:jo.array(mIe.GithubRepositoryOut$outboundSchema).optional()}).transform(t=>(0,iMr.remap)(t,{autoStart:"auto_start",createdAt:"created_at",modifiedAt:"modified_at",trainingFiles:"training_files",validationFiles:"validation_files",fineTunedModel:"fine_tuned_model",trainedTokens:"trained_tokens",jobType:"job_type"}));var oMr;(function(t){t.inboundSchema=Mt.CompletionJobOut$inboundSchema,t.outboundSchema=Mt.CompletionJobOut$outboundSchema})(oMr||(Mt.CompletionJobOut$=oMr={}));function uMo(t){return JSON.stringify(Mt.CompletionJobOut$outboundSchema.parse(t))}function lMo(t){return(0,Oct.safeParse)(t,e=>Mt.CompletionJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionJobOut' from JSON")}});var Pct=S($f=>{"use strict";var cMo=$f&&$f.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dMo=$f&&$f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fMo=$f&&$f.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cMo(r,e,n[o]);return dMo(r,e),r}}();Object.defineProperty($f,"__esModule",{value:!0});$f.CompletionTrainingParametersIn$=$f.CompletionTrainingParametersIn$outboundSchema=$f.CompletionTrainingParametersIn$inboundSchema=void 0;$f.completionTrainingParametersInToJSON=mMo;$f.completionTrainingParametersInFromJSON=hMo;var wu=fMo(ae()),lMr=ce(),pMo=ee();$f.CompletionTrainingParametersIn$inboundSchema=wu.object({training_steps:wu.nullable(wu.number().int()).optional(),learning_rate:wu.number().default(1e-4),weight_decay:wu.nullable(wu.number()).optional(),warmup_fraction:wu.nullable(wu.number()).optional(),epochs:wu.nullable(wu.number()).optional(),seq_len:wu.nullable(wu.number().int()).optional(),fim_ratio:wu.nullable(wu.number()).optional()}).transform(t=>(0,lMr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));$f.CompletionTrainingParametersIn$outboundSchema=wu.object({trainingSteps:wu.nullable(wu.number().int()).optional(),learningRate:wu.number().default(1e-4),weightDecay:wu.nullable(wu.number()).optional(),warmupFraction:wu.nullable(wu.number()).optional(),epochs:wu.nullable(wu.number()).optional(),seqLen:wu.nullable(wu.number().int()).optional(),fimRatio:wu.nullable(wu.number()).optional()}).transform(t=>(0,lMr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var uMr;(function(t){t.inboundSchema=$f.CompletionTrainingParametersIn$inboundSchema,t.outboundSchema=$f.CompletionTrainingParametersIn$outboundSchema})(uMr||($f.CompletionTrainingParametersIn$=uMr={}));function mMo(t){return JSON.stringify($f.CompletionTrainingParametersIn$outboundSchema.parse(t))}function hMo(t){return(0,pMo.safeParse)(t,e=>$f.CompletionTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParametersIn' from JSON")}});var Mct=S(Lf=>{"use strict";var gMo=Lf&&Lf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yMo=Lf&&Lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bMo=Lf&&Lf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gMo(r,e,n[o]);return yMo(r,e),r}}();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.FunctionCallEntryArguments$=Lf.FunctionCallEntryArguments$outboundSchema=Lf.FunctionCallEntryArguments$inboundSchema=void 0;Lf.functionCallEntryArgumentsToJSON=vMo;Lf.functionCallEntryArgumentsFromJSON=wMo;var iU=bMo(ae()),_Mo=ee();Lf.FunctionCallEntryArguments$inboundSchema=iU.union([iU.record(iU.any()),iU.string()]);Lf.FunctionCallEntryArguments$outboundSchema=iU.union([iU.record(iU.any()),iU.string()]);var cMr;(function(t){t.inboundSchema=Lf.FunctionCallEntryArguments$inboundSchema,t.outboundSchema=Lf.FunctionCallEntryArguments$outboundSchema})(cMr||(Lf.FunctionCallEntryArguments$=cMr={}));function vMo(t){return JSON.stringify(Lf.FunctionCallEntryArguments$outboundSchema.parse(t))}function wMo(t){return(0,_Mo.safeParse)(t,e=>Lf.FunctionCallEntryArguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntryArguments' from JSON")}});var jse=S(Xn=>{"use strict";var SMo=Xn&&Xn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CMo=Xn&&Xn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xMo=Xn&&Xn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SMo(r,e,n[o]);return CMo(r,e),r}}();Object.defineProperty(Xn,"__esModule",{value:!0});Xn.FunctionCallEntry$=Xn.FunctionCallEntry$outboundSchema=Xn.FunctionCallEntry$inboundSchema=Xn.FunctionCallEntryType$=Xn.FunctionCallEntryType$outboundSchema=Xn.FunctionCallEntryType$inboundSchema=Xn.FunctionCallEntryObject$=Xn.FunctionCallEntryObject$outboundSchema=Xn.FunctionCallEntryObject$inboundSchema=Xn.FunctionCallEntryType=Xn.FunctionCallEntryObject=void 0;Xn.functionCallEntryToJSON=OMo;Xn.functionCallEntryFromJSON=EMo;var sb=xMo(ae()),mMr=ce(),TMo=ee(),hMr=Mct();Xn.FunctionCallEntryObject={Entry:"entry"};Xn.FunctionCallEntryType={FunctionCall:"function.call"};Xn.FunctionCallEntryObject$inboundSchema=sb.nativeEnum(Xn.FunctionCallEntryObject);Xn.FunctionCallEntryObject$outboundSchema=Xn.FunctionCallEntryObject$inboundSchema;var dMr;(function(t){t.inboundSchema=Xn.FunctionCallEntryObject$inboundSchema,t.outboundSchema=Xn.FunctionCallEntryObject$outboundSchema})(dMr||(Xn.FunctionCallEntryObject$=dMr={}));Xn.FunctionCallEntryType$inboundSchema=sb.nativeEnum(Xn.FunctionCallEntryType);Xn.FunctionCallEntryType$outboundSchema=Xn.FunctionCallEntryType$inboundSchema;var fMr;(function(t){t.inboundSchema=Xn.FunctionCallEntryType$inboundSchema,t.outboundSchema=Xn.FunctionCallEntryType$outboundSchema})(fMr||(Xn.FunctionCallEntryType$=fMr={}));Xn.FunctionCallEntry$inboundSchema=sb.object({object:Xn.FunctionCallEntryObject$inboundSchema.default("entry"),type:Xn.FunctionCallEntryType$inboundSchema.default("function.call"),created_at:sb.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:sb.nullable(sb.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:sb.string().optional(),tool_call_id:sb.string(),name:sb.string(),arguments:hMr.FunctionCallEntryArguments$inboundSchema}).transform(t=>(0,mMr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Xn.FunctionCallEntry$outboundSchema=sb.object({object:Xn.FunctionCallEntryObject$outboundSchema.default("entry"),type:Xn.FunctionCallEntryType$outboundSchema.default("function.call"),createdAt:sb.date().transform(t=>t.toISOString()).optional(),completedAt:sb.nullable(sb.date().transform(t=>t.toISOString())).optional(),id:sb.string().optional(),toolCallId:sb.string(),name:sb.string(),arguments:hMr.FunctionCallEntryArguments$outboundSchema}).transform(t=>(0,mMr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var pMr;(function(t){t.inboundSchema=Xn.FunctionCallEntry$inboundSchema,t.outboundSchema=Xn.FunctionCallEntry$outboundSchema})(pMr||(Xn.FunctionCallEntry$=pMr={}));function OMo(t){return JSON.stringify(Xn.FunctionCallEntry$outboundSchema.parse(t))}function EMo(t){return(0,TMo.safeParse)(t,e=>Xn.FunctionCallEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntry' from JSON")}});var gIe=S(Zn=>{"use strict";var PMo=Zn&&Zn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MMo=Zn&&Zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RMo=Zn&&Zn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PMo(r,e,n[o]);return MMo(r,e),r}}();Object.defineProperty(Zn,"__esModule",{value:!0});Zn.FunctionResultEntry$=Zn.FunctionResultEntry$outboundSchema=Zn.FunctionResultEntry$inboundSchema=Zn.FunctionResultEntryType$=Zn.FunctionResultEntryType$outboundSchema=Zn.FunctionResultEntryType$inboundSchema=Zn.FunctionResultEntryObject$=Zn.FunctionResultEntryObject$outboundSchema=Zn.FunctionResultEntryObject$inboundSchema=Zn.FunctionResultEntryType=Zn.FunctionResultEntryObject=void 0;Zn.functionResultEntryToJSON=AMo;Zn.functionResultEntryFromJSON=NMo;var ub=RMo(ae()),_Mr=ce(),IMo=ee();Zn.FunctionResultEntryObject={Entry:"entry"};Zn.FunctionResultEntryType={FunctionResult:"function.result"};Zn.FunctionResultEntryObject$inboundSchema=ub.nativeEnum(Zn.FunctionResultEntryObject);Zn.FunctionResultEntryObject$outboundSchema=Zn.FunctionResultEntryObject$inboundSchema;var gMr;(function(t){t.inboundSchema=Zn.FunctionResultEntryObject$inboundSchema,t.outboundSchema=Zn.FunctionResultEntryObject$outboundSchema})(gMr||(Zn.FunctionResultEntryObject$=gMr={}));Zn.FunctionResultEntryType$inboundSchema=ub.nativeEnum(Zn.FunctionResultEntryType);Zn.FunctionResultEntryType$outboundSchema=Zn.FunctionResultEntryType$inboundSchema;var yMr;(function(t){t.inboundSchema=Zn.FunctionResultEntryType$inboundSchema,t.outboundSchema=Zn.FunctionResultEntryType$outboundSchema})(yMr||(Zn.FunctionResultEntryType$=yMr={}));Zn.FunctionResultEntry$inboundSchema=ub.object({object:Zn.FunctionResultEntryObject$inboundSchema.default("entry"),type:Zn.FunctionResultEntryType$inboundSchema.default("function.result"),created_at:ub.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:ub.nullable(ub.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:ub.string().optional(),tool_call_id:ub.string(),result:ub.string()}).transform(t=>(0,_Mr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Zn.FunctionResultEntry$outboundSchema=ub.object({object:Zn.FunctionResultEntryObject$outboundSchema.default("entry"),type:Zn.FunctionResultEntryType$outboundSchema.default("function.result"),createdAt:ub.date().transform(t=>t.toISOString()).optional(),completedAt:ub.nullable(ub.date().transform(t=>t.toISOString())).optional(),id:ub.string().optional(),toolCallId:ub.string(),result:ub.string()}).transform(t=>(0,_Mr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var bMr;(function(t){t.inboundSchema=Zn.FunctionResultEntry$inboundSchema,t.outboundSchema=Zn.FunctionResultEntry$outboundSchema})(bMr||(Zn.FunctionResultEntry$=bMr={}));function AMo(t){return JSON.stringify(Zn.FunctionResultEntry$outboundSchema.parse(t))}function NMo(t){return(0,IMo.safeParse)(t,e=>Zn.FunctionResultEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionResultEntry' from JSON")}});var $se=S(Pa=>{"use strict";var DMo=Pa&&Pa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jMo=Pa&&Pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Mo=Pa&&Pa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DMo(r,e,n[o]);return jMo(r,e),r}}();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.ToolFileChunk$=Pa.ToolFileChunk$outboundSchema=Pa.ToolFileChunk$inboundSchema=Pa.ToolFileChunkType$=Pa.ToolFileChunkType$outboundSchema=Pa.ToolFileChunkType$inboundSchema=Pa.ToolFileChunkType=void 0;Pa.toolFileChunkToJSON=FMo;Pa.toolFileChunkFromJSON=kMo;var Ww=$Mo(ae()),SMr=ce(),LMo=ee(),CMr=nU();Pa.ToolFileChunkType={ToolFile:"tool_file"};Pa.ToolFileChunkType$inboundSchema=Ww.nativeEnum(Pa.ToolFileChunkType);Pa.ToolFileChunkType$outboundSchema=Pa.ToolFileChunkType$inboundSchema;var vMr;(function(t){t.inboundSchema=Pa.ToolFileChunkType$inboundSchema,t.outboundSchema=Pa.ToolFileChunkType$outboundSchema})(vMr||(Pa.ToolFileChunkType$=vMr={}));Pa.ToolFileChunk$inboundSchema=Ww.object({type:Pa.ToolFileChunkType$inboundSchema.default("tool_file"),tool:CMr.BuiltInConnectors$inboundSchema,file_id:Ww.string(),file_name:Ww.nullable(Ww.string()).optional(),file_type:Ww.nullable(Ww.string()).optional()}).transform(t=>(0,SMr.remap)(t,{file_id:"fileId",file_name:"fileName",file_type:"fileType"}));Pa.ToolFileChunk$outboundSchema=Ww.object({type:Pa.ToolFileChunkType$outboundSchema.default("tool_file"),tool:CMr.BuiltInConnectors$outboundSchema,fileId:Ww.string(),fileName:Ww.nullable(Ww.string()).optional(),fileType:Ww.nullable(Ww.string()).optional()}).transform(t=>(0,SMr.remap)(t,{fileId:"file_id",fileName:"file_name",fileType:"file_type"}));var wMr;(function(t){t.inboundSchema=Pa.ToolFileChunk$inboundSchema,t.outboundSchema=Pa.ToolFileChunk$outboundSchema})(wMr||(Pa.ToolFileChunk$=wMr={}));function FMo(t){return JSON.stringify(Pa.ToolFileChunk$outboundSchema.parse(t))}function kMo(t){return(0,LMo.safeParse)(t,e=>Pa.ToolFileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolFileChunk' from JSON")}});var Rct=S(Ff=>{"use strict";var qMo=Ff&&Ff.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UMo=Ff&&Ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BMo=Ff&&Ff.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qMo(r,e,n[o]);return UMo(r,e),r}}();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.MessageInputContentChunks$=Ff.MessageInputContentChunks$outboundSchema=Ff.MessageInputContentChunks$inboundSchema=void 0;Ff.messageInputContentChunksToJSON=VMo;Ff.messageInputContentChunksFromJSON=HMo;var TMr=BMo(ae()),zMo=ee(),OMr=o3(),EMr=i3(),PMr=rU(),MMr=s3(),RMr=$se();Ff.MessageInputContentChunks$inboundSchema=TMr.union([RMr.ToolFileChunk$inboundSchema,PMr.TextChunk$inboundSchema,EMr.ImageURLChunk$inboundSchema,OMr.DocumentURLChunk$inboundSchema,MMr.ThinkChunk$inboundSchema]);Ff.MessageInputContentChunks$outboundSchema=TMr.union([RMr.ToolFileChunk$outboundSchema,PMr.TextChunk$outboundSchema,EMr.ImageURLChunk$outboundSchema,OMr.DocumentURLChunk$outboundSchema,MMr.ThinkChunk$outboundSchema]);var xMr;(function(t){t.inboundSchema=Ff.MessageInputContentChunks$inboundSchema,t.outboundSchema=Ff.MessageInputContentChunks$outboundSchema})(xMr||(Ff.MessageInputContentChunks$=xMr={}));function VMo(t){return JSON.stringify(Ff.MessageInputContentChunks$outboundSchema.parse(t))}function HMo(t){return(0,zMo.safeParse)(t,e=>Ff.MessageInputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputContentChunks' from JSON")}});var Lse=S(ir=>{"use strict";var WMo=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]}),JMo=ir&&ir.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KMo=ir&&ir.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WMo(r,e,n[o]);return JMo(r,e),r}}();Object.defineProperty(ir,"__esModule",{value:!0});ir.MessageInputEntry$=ir.MessageInputEntry$outboundSchema=ir.MessageInputEntry$inboundSchema=ir.MessageInputEntryContent$=ir.MessageInputEntryContent$outboundSchema=ir.MessageInputEntryContent$inboundSchema=ir.MessageInputEntryRole$=ir.MessageInputEntryRole$outboundSchema=ir.MessageInputEntryRole$inboundSchema=ir.MessageInputEntryType$=ir.MessageInputEntryType$outboundSchema=ir.MessageInputEntryType$inboundSchema=ir.ObjectT$=ir.ObjectT$outboundSchema=ir.ObjectT$inboundSchema=ir.MessageInputEntryRole=ir.MessageInputEntryType=ir.ObjectT=void 0;ir.messageInputEntryContentToJSON=GMo;ir.messageInputEntryContentFromJSON=XMo;ir.messageInputEntryToJSON=ZMo;ir.messageInputEntryFromJSON=YMo;var ku=KMo(ae()),$Mr=ce(),LMr=ee(),yIe=Rct();ir.ObjectT={Entry:"entry"};ir.MessageInputEntryType={MessageInput:"message.input"};ir.MessageInputEntryRole={Assistant:"assistant",User:"user"};ir.ObjectT$inboundSchema=ku.nativeEnum(ir.ObjectT);ir.ObjectT$outboundSchema=ir.ObjectT$inboundSchema;var IMr;(function(t){t.inboundSchema=ir.ObjectT$inboundSchema,t.outboundSchema=ir.ObjectT$outboundSchema})(IMr||(ir.ObjectT$=IMr={}));ir.MessageInputEntryType$inboundSchema=ku.nativeEnum(ir.MessageInputEntryType);ir.MessageInputEntryType$outboundSchema=ir.MessageInputEntryType$inboundSchema;var AMr;(function(t){t.inboundSchema=ir.MessageInputEntryType$inboundSchema,t.outboundSchema=ir.MessageInputEntryType$outboundSchema})(AMr||(ir.MessageInputEntryType$=AMr={}));ir.MessageInputEntryRole$inboundSchema=ku.nativeEnum(ir.MessageInputEntryRole);ir.MessageInputEntryRole$outboundSchema=ir.MessageInputEntryRole$inboundSchema;var NMr;(function(t){t.inboundSchema=ir.MessageInputEntryRole$inboundSchema,t.outboundSchema=ir.MessageInputEntryRole$outboundSchema})(NMr||(ir.MessageInputEntryRole$=NMr={}));ir.MessageInputEntryContent$inboundSchema=ku.union([ku.string(),ku.array(yIe.MessageInputContentChunks$inboundSchema)]);ir.MessageInputEntryContent$outboundSchema=ku.union([ku.string(),ku.array(yIe.MessageInputContentChunks$outboundSchema)]);var DMr;(function(t){t.inboundSchema=ir.MessageInputEntryContent$inboundSchema,t.outboundSchema=ir.MessageInputEntryContent$outboundSchema})(DMr||(ir.MessageInputEntryContent$=DMr={}));function GMo(t){return JSON.stringify(ir.MessageInputEntryContent$outboundSchema.parse(t))}function XMo(t){return(0,LMr.safeParse)(t,e=>ir.MessageInputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntryContent' from JSON")}ir.MessageInputEntry$inboundSchema=ku.object({object:ir.ObjectT$inboundSchema.default("entry"),type:ir.MessageInputEntryType$inboundSchema.default("message.input"),created_at:ku.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:ku.nullable(ku.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:ku.string().optional(),role:ir.MessageInputEntryRole$inboundSchema,content:ku.union([ku.string(),ku.array(yIe.MessageInputContentChunks$inboundSchema)]),prefix:ku.boolean().default(!1)}).transform(t=>(0,$Mr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));ir.MessageInputEntry$outboundSchema=ku.object({object:ir.ObjectT$outboundSchema.default("entry"),type:ir.MessageInputEntryType$outboundSchema.default("message.input"),createdAt:ku.date().transform(t=>t.toISOString()).optional(),completedAt:ku.nullable(ku.date().transform(t=>t.toISOString())).optional(),id:ku.string().optional(),role:ir.MessageInputEntryRole$outboundSchema,content:ku.union([ku.string(),ku.array(yIe.MessageInputContentChunks$outboundSchema)]),prefix:ku.boolean().default(!1)}).transform(t=>(0,$Mr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var jMr;(function(t){t.inboundSchema=ir.MessageInputEntry$inboundSchema,t.outboundSchema=ir.MessageInputEntry$outboundSchema})(jMr||(ir.MessageInputEntry$=jMr={}));function ZMo(t){return JSON.stringify(ir.MessageInputEntry$outboundSchema.parse(t))}function YMo(t){return(0,LMr.safeParse)(t,e=>ir.MessageInputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntry' from JSON")}});var bIe=S(Ma=>{"use strict";var QMo=Ma&&Ma.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eRo=Ma&&Ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tRo=Ma&&Ma.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QMo(r,e,n[o]);return eRo(r,e),r}}();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.ToolReferenceChunk$=Ma.ToolReferenceChunk$outboundSchema=Ma.ToolReferenceChunk$inboundSchema=Ma.ToolReferenceChunkType$=Ma.ToolReferenceChunkType$outboundSchema=Ma.ToolReferenceChunkType$inboundSchema=Ma.ToolReferenceChunkType=void 0;Ma.toolReferenceChunkToJSON=nRo;Ma.toolReferenceChunkFromJSON=oRo;var ly=tRo(ae()),rRo=ee(),qMr=nU();Ma.ToolReferenceChunkType={ToolReference:"tool_reference"};Ma.ToolReferenceChunkType$inboundSchema=ly.nativeEnum(Ma.ToolReferenceChunkType);Ma.ToolReferenceChunkType$outboundSchema=Ma.ToolReferenceChunkType$inboundSchema;var FMr;(function(t){t.inboundSchema=Ma.ToolReferenceChunkType$inboundSchema,t.outboundSchema=Ma.ToolReferenceChunkType$outboundSchema})(FMr||(Ma.ToolReferenceChunkType$=FMr={}));Ma.ToolReferenceChunk$inboundSchema=ly.object({type:Ma.ToolReferenceChunkType$inboundSchema.default("tool_reference"),tool:qMr.BuiltInConnectors$inboundSchema,title:ly.string(),url:ly.nullable(ly.string()).optional(),favicon:ly.nullable(ly.string()).optional(),description:ly.nullable(ly.string()).optional()});Ma.ToolReferenceChunk$outboundSchema=ly.object({type:Ma.ToolReferenceChunkType$outboundSchema.default("tool_reference"),tool:qMr.BuiltInConnectors$outboundSchema,title:ly.string(),url:ly.nullable(ly.string()).optional(),favicon:ly.nullable(ly.string()).optional(),description:ly.nullable(ly.string()).optional()});var kMr;(function(t){t.inboundSchema=Ma.ToolReferenceChunk$inboundSchema,t.outboundSchema=Ma.ToolReferenceChunk$outboundSchema})(kMr||(Ma.ToolReferenceChunk$=kMr={}));function nRo(t){return JSON.stringify(Ma.ToolReferenceChunk$outboundSchema.parse(t))}function oRo(t){return(0,rRo.safeParse)(t,e=>Ma.ToolReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolReferenceChunk' from JSON")}});var Ict=S(kf=>{"use strict";var iRo=kf&&kf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aRo=kf&&kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sRo=kf&&kf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iRo(r,e,n[o]);return aRo(r,e),r}}();Object.defineProperty(kf,"__esModule",{value:!0});kf.MessageOutputContentChunks$=kf.MessageOutputContentChunks$outboundSchema=kf.MessageOutputContentChunks$inboundSchema=void 0;kf.messageOutputContentChunksToJSON=lRo;kf.messageOutputContentChunksFromJSON=cRo;var BMr=sRo(ae()),uRo=ee(),zMr=o3(),VMr=i3(),HMr=rU(),WMr=s3(),JMr=$se(),KMr=bIe();kf.MessageOutputContentChunks$inboundSchema=BMr.union([JMr.ToolFileChunk$inboundSchema,KMr.ToolReferenceChunk$inboundSchema,HMr.TextChunk$inboundSchema,VMr.ImageURLChunk$inboundSchema,zMr.DocumentURLChunk$inboundSchema,WMr.ThinkChunk$inboundSchema]);kf.MessageOutputContentChunks$outboundSchema=BMr.union([JMr.ToolFileChunk$outboundSchema,KMr.ToolReferenceChunk$outboundSchema,HMr.TextChunk$outboundSchema,VMr.ImageURLChunk$outboundSchema,zMr.DocumentURLChunk$outboundSchema,WMr.ThinkChunk$outboundSchema]);var UMr;(function(t){t.inboundSchema=kf.MessageOutputContentChunks$inboundSchema,t.outboundSchema=kf.MessageOutputContentChunks$outboundSchema})(UMr||(kf.MessageOutputContentChunks$=UMr={}));function lRo(t){return JSON.stringify(kf.MessageOutputContentChunks$outboundSchema.parse(t))}function cRo(t){return(0,uRo.safeParse)(t,e=>kf.MessageOutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputContentChunks' from JSON")}});var v7=S(ar=>{"use strict";var dRo=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]}),fRo=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pRo=ar&&ar.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dRo(r,e,n[o]);return fRo(r,e),r}}();Object.defineProperty(ar,"__esModule",{value:!0});ar.MessageOutputEntry$=ar.MessageOutputEntry$outboundSchema=ar.MessageOutputEntry$inboundSchema=ar.MessageOutputEntryContent$=ar.MessageOutputEntryContent$outboundSchema=ar.MessageOutputEntryContent$inboundSchema=ar.MessageOutputEntryRole$=ar.MessageOutputEntryRole$outboundSchema=ar.MessageOutputEntryRole$inboundSchema=ar.MessageOutputEntryType$=ar.MessageOutputEntryType$outboundSchema=ar.MessageOutputEntryType$inboundSchema=ar.MessageOutputEntryObject$=ar.MessageOutputEntryObject$outboundSchema=ar.MessageOutputEntryObject$inboundSchema=ar.MessageOutputEntryRole=ar.MessageOutputEntryType=ar.MessageOutputEntryObject=void 0;ar.messageOutputEntryContentToJSON=mRo;ar.messageOutputEntryContentFromJSON=hRo;ar.messageOutputEntryToJSON=gRo;ar.messageOutputEntryFromJSON=yRo;var as=pRo(ae()),eRr=ce(),tRr=ee(),_Ie=Ict();ar.MessageOutputEntryObject={Entry:"entry"};ar.MessageOutputEntryType={MessageOutput:"message.output"};ar.MessageOutputEntryRole={Assistant:"assistant"};ar.MessageOutputEntryObject$inboundSchema=as.nativeEnum(ar.MessageOutputEntryObject);ar.MessageOutputEntryObject$outboundSchema=ar.MessageOutputEntryObject$inboundSchema;var GMr;(function(t){t.inboundSchema=ar.MessageOutputEntryObject$inboundSchema,t.outboundSchema=ar.MessageOutputEntryObject$outboundSchema})(GMr||(ar.MessageOutputEntryObject$=GMr={}));ar.MessageOutputEntryType$inboundSchema=as.nativeEnum(ar.MessageOutputEntryType);ar.MessageOutputEntryType$outboundSchema=ar.MessageOutputEntryType$inboundSchema;var XMr;(function(t){t.inboundSchema=ar.MessageOutputEntryType$inboundSchema,t.outboundSchema=ar.MessageOutputEntryType$outboundSchema})(XMr||(ar.MessageOutputEntryType$=XMr={}));ar.MessageOutputEntryRole$inboundSchema=as.nativeEnum(ar.MessageOutputEntryRole);ar.MessageOutputEntryRole$outboundSchema=ar.MessageOutputEntryRole$inboundSchema;var ZMr;(function(t){t.inboundSchema=ar.MessageOutputEntryRole$inboundSchema,t.outboundSchema=ar.MessageOutputEntryRole$outboundSchema})(ZMr||(ar.MessageOutputEntryRole$=ZMr={}));ar.MessageOutputEntryContent$inboundSchema=as.union([as.string(),as.array(_Ie.MessageOutputContentChunks$inboundSchema)]);ar.MessageOutputEntryContent$outboundSchema=as.union([as.string(),as.array(_Ie.MessageOutputContentChunks$outboundSchema)]);var YMr;(function(t){t.inboundSchema=ar.MessageOutputEntryContent$inboundSchema,t.outboundSchema=ar.MessageOutputEntryContent$outboundSchema})(YMr||(ar.MessageOutputEntryContent$=YMr={}));function mRo(t){return JSON.stringify(ar.MessageOutputEntryContent$outboundSchema.parse(t))}function hRo(t){return(0,tRr.safeParse)(t,e=>ar.MessageOutputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntryContent' from JSON")}ar.MessageOutputEntry$inboundSchema=as.object({object:ar.MessageOutputEntryObject$inboundSchema.default("entry"),type:ar.MessageOutputEntryType$inboundSchema.default("message.output"),created_at:as.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:as.nullable(as.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:as.string().optional(),agent_id:as.nullable(as.string()).optional(),model:as.nullable(as.string()).optional(),role:ar.MessageOutputEntryRole$inboundSchema.default("assistant"),content:as.union([as.string(),as.array(_Ie.MessageOutputContentChunks$inboundSchema)])}).transform(t=>(0,eRr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",agent_id:"agentId"}));ar.MessageOutputEntry$outboundSchema=as.object({object:ar.MessageOutputEntryObject$outboundSchema.default("entry"),type:ar.MessageOutputEntryType$outboundSchema.default("message.output"),createdAt:as.date().transform(t=>t.toISOString()).optional(),completedAt:as.nullable(as.date().transform(t=>t.toISOString())).optional(),id:as.string().optional(),agentId:as.nullable(as.string()).optional(),model:as.nullable(as.string()).optional(),role:ar.MessageOutputEntryRole$outboundSchema.default("assistant"),content:as.union([as.string(),as.array(_Ie.MessageOutputContentChunks$outboundSchema)])}).transform(t=>(0,eRr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",agentId:"agent_id"}));var QMr;(function(t){t.inboundSchema=ar.MessageOutputEntry$inboundSchema,t.outboundSchema=ar.MessageOutputEntry$outboundSchema})(QMr||(ar.MessageOutputEntry$=QMr={}));function gRo(t){return JSON.stringify(ar.MessageOutputEntry$outboundSchema.parse(t))}function yRo(t){return(0,tRr.safeParse)(t,e=>ar.MessageOutputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntry' from JSON")}});var Fse=S(Yn=>{"use strict";var bRo=Yn&&Yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Ro=Yn&&Yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vRo=Yn&&Yn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bRo(r,e,n[o]);return _Ro(r,e),r}}();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.ToolExecutionEntry$=Yn.ToolExecutionEntry$outboundSchema=Yn.ToolExecutionEntry$inboundSchema=Yn.ToolExecutionEntryType$=Yn.ToolExecutionEntryType$outboundSchema=Yn.ToolExecutionEntryType$inboundSchema=Yn.ToolExecutionEntryObject$=Yn.ToolExecutionEntryObject$outboundSchema=Yn.ToolExecutionEntryObject$inboundSchema=Yn.ToolExecutionEntryType=Yn.ToolExecutionEntryObject=void 0;Yn.toolExecutionEntryToJSON=SRo;Yn.toolExecutionEntryFromJSON=CRo;var Yh=vRo(ae()),iRr=ce(),wRo=ee(),aRr=nU();Yn.ToolExecutionEntryObject={Entry:"entry"};Yn.ToolExecutionEntryType={ToolExecution:"tool.execution"};Yn.ToolExecutionEntryObject$inboundSchema=Yh.nativeEnum(Yn.ToolExecutionEntryObject);Yn.ToolExecutionEntryObject$outboundSchema=Yn.ToolExecutionEntryObject$inboundSchema;var rRr;(function(t){t.inboundSchema=Yn.ToolExecutionEntryObject$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntryObject$outboundSchema})(rRr||(Yn.ToolExecutionEntryObject$=rRr={}));Yn.ToolExecutionEntryType$inboundSchema=Yh.nativeEnum(Yn.ToolExecutionEntryType);Yn.ToolExecutionEntryType$outboundSchema=Yn.ToolExecutionEntryType$inboundSchema;var nRr;(function(t){t.inboundSchema=Yn.ToolExecutionEntryType$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntryType$outboundSchema})(nRr||(Yn.ToolExecutionEntryType$=nRr={}));Yn.ToolExecutionEntry$inboundSchema=Yh.object({object:Yn.ToolExecutionEntryObject$inboundSchema.default("entry"),type:Yn.ToolExecutionEntryType$inboundSchema.default("tool.execution"),created_at:Yh.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Yh.nullable(Yh.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Yh.string().optional(),name:aRr.BuiltInConnectors$inboundSchema,arguments:Yh.string(),info:Yh.record(Yh.any()).optional()}).transform(t=>(0,iRr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));Yn.ToolExecutionEntry$outboundSchema=Yh.object({object:Yn.ToolExecutionEntryObject$outboundSchema.default("entry"),type:Yn.ToolExecutionEntryType$outboundSchema.default("tool.execution"),createdAt:Yh.date().transform(t=>t.toISOString()).optional(),completedAt:Yh.nullable(Yh.date().transform(t=>t.toISOString())).optional(),id:Yh.string().optional(),name:aRr.BuiltInConnectors$outboundSchema,arguments:Yh.string(),info:Yh.record(Yh.any()).optional()}).transform(t=>(0,iRr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var oRr;(function(t){t.inboundSchema=Yn.ToolExecutionEntry$inboundSchema,t.outboundSchema=Yn.ToolExecutionEntry$outboundSchema})(oRr||(Yn.ToolExecutionEntry$=oRr={}));function SRo(t){return JSON.stringify(Yn.ToolExecutionEntry$outboundSchema.parse(t))}function CRo(t){return(0,wRo.safeParse)(t,e=>Yn.ToolExecutionEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionEntry' from JSON")}});var Act=S(qf=>{"use strict";var xRo=qf&&qf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TRo=qf&&qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORo=qf&&qf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xRo(r,e,n[o]);return TRo(r,e),r}}();Object.defineProperty(qf,"__esModule",{value:!0});qf.InputEntries$=qf.InputEntries$outboundSchema=qf.InputEntries$inboundSchema=void 0;qf.inputEntriesToJSON=PRo;qf.inputEntriesFromJSON=MRo;var uRr=ORo(ae()),ERo=ee(),lRr=Rse(),cRr=jse(),dRr=gIe(),fRr=Lse(),pRr=v7(),mRr=Fse();qf.InputEntries$inboundSchema=uRr.union([lRr.AgentHandoffEntry$inboundSchema,cRr.FunctionCallEntry$inboundSchema,fRr.MessageInputEntry$inboundSchema,dRr.FunctionResultEntry$inboundSchema,mRr.ToolExecutionEntry$inboundSchema,pRr.MessageOutputEntry$inboundSchema]);qf.InputEntries$outboundSchema=uRr.union([lRr.AgentHandoffEntry$outboundSchema,cRr.FunctionCallEntry$outboundSchema,fRr.MessageInputEntry$outboundSchema,dRr.FunctionResultEntry$outboundSchema,mRr.ToolExecutionEntry$outboundSchema,pRr.MessageOutputEntry$outboundSchema]);var sRr;(function(t){t.inboundSchema=qf.InputEntries$inboundSchema,t.outboundSchema=qf.InputEntries$outboundSchema})(sRr||(qf.InputEntries$=sRr={}));function PRo(t){return JSON.stringify(qf.InputEntries$outboundSchema.parse(t))}function MRo(t){return(0,ERo.safeParse)(t,e=>qf.InputEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InputEntries' from JSON")}});var aU=S(Uf=>{"use strict";var RRo=Uf&&Uf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IRo=Uf&&Uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ARo=Uf&&Uf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RRo(r,e,n[o]);return IRo(r,e),r}}();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.ConversationInputs$=Uf.ConversationInputs$outboundSchema=Uf.ConversationInputs$inboundSchema=void 0;Uf.conversationInputsToJSON=DRo;Uf.conversationInputsFromJSON=jRo;var w7=ARo(ae()),NRo=ee(),gRr=Act();Uf.ConversationInputs$inboundSchema=w7.union([w7.string(),w7.array(gRr.InputEntries$inboundSchema)]);Uf.ConversationInputs$outboundSchema=w7.union([w7.string(),w7.array(gRr.InputEntries$outboundSchema)]);var hRr;(function(t){t.inboundSchema=Uf.ConversationInputs$inboundSchema,t.outboundSchema=Uf.ConversationInputs$outboundSchema})(hRr||(Uf.ConversationInputs$=hRr={}));function DRo(t){return JSON.stringify(Uf.ConversationInputs$outboundSchema.parse(t))}function jRo(t){return(0,NRo.safeParse)(t,e=>Uf.ConversationInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationInputs' from JSON")}});var SRr=S(Ra=>{"use strict";var $Ro=Ra&&Ra.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LRo=Ra&&Ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRo=Ra&&Ra.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Ro(r,e,n[o]);return LRo(r,e),r}}();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ConversationAppendRequest$=Ra.ConversationAppendRequest$outboundSchema=Ra.ConversationAppendRequest$inboundSchema=Ra.ConversationAppendRequestHandoffExecution$=Ra.ConversationAppendRequestHandoffExecution$outboundSchema=Ra.ConversationAppendRequestHandoffExecution$inboundSchema=Ra.ConversationAppendRequestHandoffExecution=void 0;Ra.conversationAppendRequestToJSON=qRo;Ra.conversationAppendRequestFromJSON=URo;var p3=FRo(ae()),_Rr=ce(),kRo=ee(),vRr=L0(),wRr=aU();Ra.ConversationAppendRequestHandoffExecution={Client:"client",Server:"server"};Ra.ConversationAppendRequestHandoffExecution$inboundSchema=p3.nativeEnum(Ra.ConversationAppendRequestHandoffExecution);Ra.ConversationAppendRequestHandoffExecution$outboundSchema=Ra.ConversationAppendRequestHandoffExecution$inboundSchema;var yRr;(function(t){t.inboundSchema=Ra.ConversationAppendRequestHandoffExecution$inboundSchema,t.outboundSchema=Ra.ConversationAppendRequestHandoffExecution$outboundSchema})(yRr||(Ra.ConversationAppendRequestHandoffExecution$=yRr={}));Ra.ConversationAppendRequest$inboundSchema=p3.object({inputs:wRr.ConversationInputs$inboundSchema,stream:p3.boolean().default(!1),store:p3.boolean().default(!0),handoff_execution:Ra.ConversationAppendRequestHandoffExecution$inboundSchema.default("server"),completion_args:vRr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,_Rr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Ra.ConversationAppendRequest$outboundSchema=p3.object({inputs:wRr.ConversationInputs$outboundSchema,stream:p3.boolean().default(!1),store:p3.boolean().default(!0),handoffExecution:Ra.ConversationAppendRequestHandoffExecution$outboundSchema.default("server"),completionArgs:vRr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,_Rr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var bRr;(function(t){t.inboundSchema=Ra.ConversationAppendRequest$inboundSchema,t.outboundSchema=Ra.ConversationAppendRequest$outboundSchema})(bRr||(Ra.ConversationAppendRequest$=bRr={}));function qRo(t){return JSON.stringify(Ra.ConversationAppendRequest$outboundSchema.parse(t))}function URo(t){return(0,kRo.safeParse)(t,e=>Ra.ConversationAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendRequest' from JSON")}});var PRr=S(Ia=>{"use strict";var BRo=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]}),zRo=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VRo=Ia&&Ia.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BRo(r,e,n[o]);return zRo(r,e),r}}();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.ConversationAppendStreamRequest$=Ia.ConversationAppendStreamRequest$outboundSchema=Ia.ConversationAppendStreamRequest$inboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution$=Ia.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution$inboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution=void 0;Ia.conversationAppendStreamRequestToJSON=WRo;Ia.conversationAppendStreamRequestFromJSON=JRo;var m3=VRo(ae()),TRr=ce(),HRo=ee(),ORr=L0(),ERr=aU();Ia.ConversationAppendStreamRequestHandoffExecution={Client:"client",Server:"server"};Ia.ConversationAppendStreamRequestHandoffExecution$inboundSchema=m3.nativeEnum(Ia.ConversationAppendStreamRequestHandoffExecution);Ia.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution$inboundSchema;var CRr;(function(t){t.inboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Ia.ConversationAppendStreamRequestHandoffExecution$outboundSchema})(CRr||(Ia.ConversationAppendStreamRequestHandoffExecution$=CRr={}));Ia.ConversationAppendStreamRequest$inboundSchema=m3.object({inputs:ERr.ConversationInputs$inboundSchema,stream:m3.boolean().default(!0),store:m3.boolean().default(!0),handoff_execution:Ia.ConversationAppendStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:ORr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,TRr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Ia.ConversationAppendStreamRequest$outboundSchema=m3.object({inputs:ERr.ConversationInputs$outboundSchema,stream:m3.boolean().default(!0),store:m3.boolean().default(!0),handoffExecution:Ia.ConversationAppendStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:ORr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,TRr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var xRr;(function(t){t.inboundSchema=Ia.ConversationAppendStreamRequest$inboundSchema,t.outboundSchema=Ia.ConversationAppendStreamRequest$outboundSchema})(xRr||(Ia.ConversationAppendStreamRequest$=xRr={}));function WRo(t){return JSON.stringify(Ia.ConversationAppendStreamRequest$outboundSchema.parse(t))}function JRo(t){return(0,HRo.safeParse)(t,e=>Ia.ConversationAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendStreamRequest' from JSON")}});var Nct=S(Aa=>{"use strict";var KRo=Aa&&Aa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GRo=Aa&&Aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XRo=Aa&&Aa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KRo(r,e,n[o]);return GRo(r,e),r}}();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.FunctionCallEvent$=Aa.FunctionCallEvent$outboundSchema=Aa.FunctionCallEvent$inboundSchema=Aa.FunctionCallEventType$=Aa.FunctionCallEventType$outboundSchema=Aa.FunctionCallEventType$inboundSchema=Aa.FunctionCallEventType=void 0;Aa.functionCallEventToJSON=YRo;Aa.functionCallEventFromJSON=QRo;var u_=XRo(ae()),IRr=ce(),ZRo=ee();Aa.FunctionCallEventType={FunctionCallDelta:"function.call.delta"};Aa.FunctionCallEventType$inboundSchema=u_.nativeEnum(Aa.FunctionCallEventType);Aa.FunctionCallEventType$outboundSchema=Aa.FunctionCallEventType$inboundSchema;var MRr;(function(t){t.inboundSchema=Aa.FunctionCallEventType$inboundSchema,t.outboundSchema=Aa.FunctionCallEventType$outboundSchema})(MRr||(Aa.FunctionCallEventType$=MRr={}));Aa.FunctionCallEvent$inboundSchema=u_.object({type:Aa.FunctionCallEventType$inboundSchema.default("function.call.delta"),created_at:u_.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:u_.number().int().default(0),id:u_.string(),name:u_.string(),tool_call_id:u_.string(),arguments:u_.string()}).transform(t=>(0,IRr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",tool_call_id:"toolCallId"}));Aa.FunctionCallEvent$outboundSchema=u_.object({type:Aa.FunctionCallEventType$outboundSchema.default("function.call.delta"),createdAt:u_.date().transform(t=>t.toISOString()).optional(),outputIndex:u_.number().int().default(0),id:u_.string(),name:u_.string(),toolCallId:u_.string(),arguments:u_.string()}).transform(t=>(0,IRr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",toolCallId:"tool_call_id"}));var RRr;(function(t){t.inboundSchema=Aa.FunctionCallEvent$inboundSchema,t.outboundSchema=Aa.FunctionCallEvent$outboundSchema})(RRr||(Aa.FunctionCallEvent$=RRr={}));function YRo(t){return JSON.stringify(Aa.FunctionCallEvent$outboundSchema.parse(t))}function QRo(t){return(0,ZRo.safeParse)(t,e=>Aa.FunctionCallEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEvent' from JSON")}});var Dct=S(Bf=>{"use strict";var eIo=Bf&&Bf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tIo=Bf&&Bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rIo=Bf&&Bf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eIo(r,e,n[o]);return tIo(r,e),r}}();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.OutputContentChunks$=Bf.OutputContentChunks$outboundSchema=Bf.OutputContentChunks$inboundSchema=void 0;Bf.outputContentChunksToJSON=oIo;Bf.outputContentChunksFromJSON=iIo;var NRr=rIo(ae()),nIo=ee(),DRr=o3(),jRr=i3(),$Rr=rU(),LRr=s3(),FRr=$se(),kRr=bIe();Bf.OutputContentChunks$inboundSchema=NRr.union([FRr.ToolFileChunk$inboundSchema,kRr.ToolReferenceChunk$inboundSchema,$Rr.TextChunk$inboundSchema,jRr.ImageURLChunk$inboundSchema,DRr.DocumentURLChunk$inboundSchema,LRr.ThinkChunk$inboundSchema]);Bf.OutputContentChunks$outboundSchema=NRr.union([FRr.ToolFileChunk$outboundSchema,kRr.ToolReferenceChunk$outboundSchema,$Rr.TextChunk$outboundSchema,jRr.ImageURLChunk$outboundSchema,DRr.DocumentURLChunk$outboundSchema,LRr.ThinkChunk$outboundSchema]);var ARr;(function(t){t.inboundSchema=Bf.OutputContentChunks$inboundSchema,t.outboundSchema=Bf.OutputContentChunks$outboundSchema})(ARr||(Bf.OutputContentChunks$=ARr={}));function oIo(t){return JSON.stringify(Bf.OutputContentChunks$outboundSchema.parse(t))}function iIo(t){return(0,nIo.safeParse)(t,e=>Bf.OutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OutputContentChunks' from JSON")}});var jct=S(Fr=>{"use strict";var aIo=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sIo=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uIo=Fr&&Fr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aIo(r,e,n[o]);return sIo(r,e),r}}();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.MessageOutputEvent$=Fr.MessageOutputEvent$outboundSchema=Fr.MessageOutputEvent$inboundSchema=Fr.MessageOutputEventContent$=Fr.MessageOutputEventContent$outboundSchema=Fr.MessageOutputEventContent$inboundSchema=Fr.MessageOutputEventRole$=Fr.MessageOutputEventRole$outboundSchema=Fr.MessageOutputEventRole$inboundSchema=Fr.MessageOutputEventType$=Fr.MessageOutputEventType$outboundSchema=Fr.MessageOutputEventType$inboundSchema=Fr.MessageOutputEventRole=Fr.MessageOutputEventType=void 0;Fr.messageOutputEventContentToJSON=lIo;Fr.messageOutputEventContentFromJSON=cIo;Fr.messageOutputEventToJSON=dIo;Fr.messageOutputEventFromJSON=fIo;var Su=uIo(ae()),VRr=ce(),HRr=ee(),vIe=Dct();Fr.MessageOutputEventType={MessageOutputDelta:"message.output.delta"};Fr.MessageOutputEventRole={Assistant:"assistant"};Fr.MessageOutputEventType$inboundSchema=Su.nativeEnum(Fr.MessageOutputEventType);Fr.MessageOutputEventType$outboundSchema=Fr.MessageOutputEventType$inboundSchema;var qRr;(function(t){t.inboundSchema=Fr.MessageOutputEventType$inboundSchema,t.outboundSchema=Fr.MessageOutputEventType$outboundSchema})(qRr||(Fr.MessageOutputEventType$=qRr={}));Fr.MessageOutputEventRole$inboundSchema=Su.nativeEnum(Fr.MessageOutputEventRole);Fr.MessageOutputEventRole$outboundSchema=Fr.MessageOutputEventRole$inboundSchema;var URr;(function(t){t.inboundSchema=Fr.MessageOutputEventRole$inboundSchema,t.outboundSchema=Fr.MessageOutputEventRole$outboundSchema})(URr||(Fr.MessageOutputEventRole$=URr={}));Fr.MessageOutputEventContent$inboundSchema=Su.union([Su.string(),vIe.OutputContentChunks$inboundSchema]);Fr.MessageOutputEventContent$outboundSchema=Su.union([Su.string(),vIe.OutputContentChunks$outboundSchema]);var BRr;(function(t){t.inboundSchema=Fr.MessageOutputEventContent$inboundSchema,t.outboundSchema=Fr.MessageOutputEventContent$outboundSchema})(BRr||(Fr.MessageOutputEventContent$=BRr={}));function lIo(t){return JSON.stringify(Fr.MessageOutputEventContent$outboundSchema.parse(t))}function cIo(t){return(0,HRr.safeParse)(t,e=>Fr.MessageOutputEventContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEventContent' from JSON")}Fr.MessageOutputEvent$inboundSchema=Su.object({type:Fr.MessageOutputEventType$inboundSchema.default("message.output.delta"),created_at:Su.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Su.number().int().default(0),id:Su.string(),content_index:Su.number().int().default(0),model:Su.nullable(Su.string()).optional(),agent_id:Su.nullable(Su.string()).optional(),role:Fr.MessageOutputEventRole$inboundSchema.default("assistant"),content:Su.union([Su.string(),vIe.OutputContentChunks$inboundSchema])}).transform(t=>(0,VRr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",content_index:"contentIndex",agent_id:"agentId"}));Fr.MessageOutputEvent$outboundSchema=Su.object({type:Fr.MessageOutputEventType$outboundSchema.default("message.output.delta"),createdAt:Su.date().transform(t=>t.toISOString()).optional(),outputIndex:Su.number().int().default(0),id:Su.string(),contentIndex:Su.number().int().default(0),model:Su.nullable(Su.string()).optional(),agentId:Su.nullable(Su.string()).optional(),role:Fr.MessageOutputEventRole$outboundSchema.default("assistant"),content:Su.union([Su.string(),vIe.OutputContentChunks$outboundSchema])}).transform(t=>(0,VRr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",contentIndex:"content_index",agentId:"agent_id"}));var zRr;(function(t){t.inboundSchema=Fr.MessageOutputEvent$inboundSchema,t.outboundSchema=Fr.MessageOutputEvent$outboundSchema})(zRr||(Fr.MessageOutputEvent$=zRr={}));function dIo(t){return JSON.stringify(Fr.MessageOutputEvent$outboundSchema.parse(t))}function fIo(t){return(0,HRr.safeParse)(t,e=>Fr.MessageOutputEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEvent' from JSON")}});var wIe=S(zf=>{"use strict";var pIo=zf&&zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mIo=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hIo=zf&&zf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pIo(r,e,n[o]);return mIo(r,e),r}}();Object.defineProperty(zf,"__esModule",{value:!0});zf.ConversationUsageInfo$=zf.ConversationUsageInfo$outboundSchema=zf.ConversationUsageInfo$inboundSchema=void 0;zf.conversationUsageInfoToJSON=yIo;zf.conversationUsageInfoFromJSON=bIo;var Qh=hIo(ae()),JRr=ce(),gIo=ee();zf.ConversationUsageInfo$inboundSchema=Qh.object({prompt_tokens:Qh.number().int().default(0),completion_tokens:Qh.number().int().default(0),total_tokens:Qh.number().int().default(0),connector_tokens:Qh.nullable(Qh.number().int()).optional(),connectors:Qh.nullable(Qh.record(Qh.number().int())).optional()}).transform(t=>(0,JRr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",connector_tokens:"connectorTokens"}));zf.ConversationUsageInfo$outboundSchema=Qh.object({promptTokens:Qh.number().int().default(0),completionTokens:Qh.number().int().default(0),totalTokens:Qh.number().int().default(0),connectorTokens:Qh.nullable(Qh.number().int()).optional(),connectors:Qh.nullable(Qh.record(Qh.number().int())).optional()}).transform(t=>(0,JRr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",connectorTokens:"connector_tokens"}));var WRr;(function(t){t.inboundSchema=zf.ConversationUsageInfo$inboundSchema,t.outboundSchema=zf.ConversationUsageInfo$outboundSchema})(WRr||(zf.ConversationUsageInfo$=WRr={}));function yIo(t){return JSON.stringify(zf.ConversationUsageInfo$outboundSchema.parse(t))}function bIo(t){return(0,gIo.safeParse)(t,e=>zf.ConversationUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationUsageInfo' from JSON")}});var $ct=S(Na=>{"use strict";var _Io=Na&&Na.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vIo=Na&&Na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wIo=Na&&Na.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Io(r,e,n[o]);return vIo(r,e),r}}();Object.defineProperty(Na,"__esModule",{value:!0});Na.ResponseDoneEvent$=Na.ResponseDoneEvent$outboundSchema=Na.ResponseDoneEvent$inboundSchema=Na.ResponseDoneEventType$=Na.ResponseDoneEventType$outboundSchema=Na.ResponseDoneEventType$inboundSchema=Na.ResponseDoneEventType=void 0;Na.responseDoneEventToJSON=CIo;Na.responseDoneEventFromJSON=xIo;var kse=wIo(ae()),XRr=ce(),SIo=ee(),ZRr=wIe();Na.ResponseDoneEventType={ConversationResponseDone:"conversation.response.done"};Na.ResponseDoneEventType$inboundSchema=kse.nativeEnum(Na.ResponseDoneEventType);Na.ResponseDoneEventType$outboundSchema=Na.ResponseDoneEventType$inboundSchema;var KRr;(function(t){t.inboundSchema=Na.ResponseDoneEventType$inboundSchema,t.outboundSchema=Na.ResponseDoneEventType$outboundSchema})(KRr||(Na.ResponseDoneEventType$=KRr={}));Na.ResponseDoneEvent$inboundSchema=kse.object({type:Na.ResponseDoneEventType$inboundSchema.default("conversation.response.done"),created_at:kse.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),usage:ZRr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,XRr.remap)(t,{created_at:"createdAt"}));Na.ResponseDoneEvent$outboundSchema=kse.object({type:Na.ResponseDoneEventType$outboundSchema.default("conversation.response.done"),createdAt:kse.date().transform(t=>t.toISOString()).optional(),usage:ZRr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,XRr.remap)(t,{createdAt:"created_at"}));var GRr;(function(t){t.inboundSchema=Na.ResponseDoneEvent$inboundSchema,t.outboundSchema=Na.ResponseDoneEvent$outboundSchema})(GRr||(Na.ResponseDoneEvent$=GRr={}));function CIo(t){return JSON.stringify(Na.ResponseDoneEvent$outboundSchema.parse(t))}function xIo(t){return(0,SIo.safeParse)(t,e=>Na.ResponseDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseDoneEvent' from JSON")}});var Lct=S(Da=>{"use strict";var TIo=Da&&Da.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OIo=Da&&Da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EIo=Da&&Da.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TIo(r,e,n[o]);return OIo(r,e),r}}();Object.defineProperty(Da,"__esModule",{value:!0});Da.ResponseErrorEvent$=Da.ResponseErrorEvent$outboundSchema=Da.ResponseErrorEvent$inboundSchema=Da.ResponseErrorEventType$=Da.ResponseErrorEventType$outboundSchema=Da.ResponseErrorEventType$inboundSchema=Da.ResponseErrorEventType=void 0;Da.responseErrorEventToJSON=MIo;Da.responseErrorEventFromJSON=RIo;var QD=EIo(ae()),eIr=ce(),PIo=ee();Da.ResponseErrorEventType={ConversationResponseError:"conversation.response.error"};Da.ResponseErrorEventType$inboundSchema=QD.nativeEnum(Da.ResponseErrorEventType);Da.ResponseErrorEventType$outboundSchema=Da.ResponseErrorEventType$inboundSchema;var YRr;(function(t){t.inboundSchema=Da.ResponseErrorEventType$inboundSchema,t.outboundSchema=Da.ResponseErrorEventType$outboundSchema})(YRr||(Da.ResponseErrorEventType$=YRr={}));Da.ResponseErrorEvent$inboundSchema=QD.object({type:Da.ResponseErrorEventType$inboundSchema.default("conversation.response.error"),created_at:QD.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),message:QD.string(),code:QD.number().int()}).transform(t=>(0,eIr.remap)(t,{created_at:"createdAt"}));Da.ResponseErrorEvent$outboundSchema=QD.object({type:Da.ResponseErrorEventType$outboundSchema.default("conversation.response.error"),createdAt:QD.date().transform(t=>t.toISOString()).optional(),message:QD.string(),code:QD.number().int()}).transform(t=>(0,eIr.remap)(t,{createdAt:"created_at"}));var QRr;(function(t){t.inboundSchema=Da.ResponseErrorEvent$inboundSchema,t.outboundSchema=Da.ResponseErrorEvent$outboundSchema})(QRr||(Da.ResponseErrorEvent$=QRr={}));function MIo(t){return JSON.stringify(Da.ResponseErrorEvent$outboundSchema.parse(t))}function RIo(t){return(0,PIo.safeParse)(t,e=>Da.ResponseErrorEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseErrorEvent' from JSON")}});var Fct=S(ja=>{"use strict";var IIo=ja&&ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AIo=ja&&ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NIo=ja&&ja.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IIo(r,e,n[o]);return AIo(r,e),r}}();Object.defineProperty(ja,"__esModule",{value:!0});ja.ResponseStartedEvent$=ja.ResponseStartedEvent$outboundSchema=ja.ResponseStartedEvent$inboundSchema=ja.ResponseStartedEventType$=ja.ResponseStartedEventType$outboundSchema=ja.ResponseStartedEventType$inboundSchema=ja.ResponseStartedEventType=void 0;ja.responseStartedEventToJSON=jIo;ja.responseStartedEventFromJSON=$Io;var h3=NIo(ae()),nIr=ce(),DIo=ee();ja.ResponseStartedEventType={ConversationResponseStarted:"conversation.response.started"};ja.ResponseStartedEventType$inboundSchema=h3.nativeEnum(ja.ResponseStartedEventType);ja.ResponseStartedEventType$outboundSchema=ja.ResponseStartedEventType$inboundSchema;var tIr;(function(t){t.inboundSchema=ja.ResponseStartedEventType$inboundSchema,t.outboundSchema=ja.ResponseStartedEventType$outboundSchema})(tIr||(ja.ResponseStartedEventType$=tIr={}));ja.ResponseStartedEvent$inboundSchema=h3.object({type:ja.ResponseStartedEventType$inboundSchema.default("conversation.response.started"),created_at:h3.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),conversation_id:h3.string()}).transform(t=>(0,nIr.remap)(t,{created_at:"createdAt",conversation_id:"conversationId"}));ja.ResponseStartedEvent$outboundSchema=h3.object({type:ja.ResponseStartedEventType$outboundSchema.default("conversation.response.started"),createdAt:h3.date().transform(t=>t.toISOString()).optional(),conversationId:h3.string()}).transform(t=>(0,nIr.remap)(t,{createdAt:"created_at",conversationId:"conversation_id"}));var rIr;(function(t){t.inboundSchema=ja.ResponseStartedEvent$inboundSchema,t.outboundSchema=ja.ResponseStartedEvent$outboundSchema})(rIr||(ja.ResponseStartedEvent$=rIr={}));function jIo(t){return JSON.stringify(ja.ResponseStartedEvent$outboundSchema.parse(t))}function $Io(t){return(0,DIo.safeParse)(t,e=>ja.ResponseStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseStartedEvent' from JSON")}});var kct=S(Vf=>{"use strict";var LIo=Vf&&Vf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FIo=Vf&&Vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kIo=Vf&&Vf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LIo(r,e,n[o]);return FIo(r,e),r}}();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.SSETypes$=Vf.SSETypes$outboundSchema=Vf.SSETypes$inboundSchema=Vf.SSETypes=void 0;var qIo=kIo(ae());Vf.SSETypes={ConversationResponseStarted:"conversation.response.started",ConversationResponseDone:"conversation.response.done",ConversationResponseError:"conversation.response.error",MessageOutputDelta:"message.output.delta",ToolExecutionStarted:"tool.execution.started",ToolExecutionDelta:"tool.execution.delta",ToolExecutionDone:"tool.execution.done",AgentHandoffStarted:"agent.handoff.started",AgentHandoffDone:"agent.handoff.done",FunctionCallDelta:"function.call.delta"};Vf.SSETypes$inboundSchema=qIo.nativeEnum(Vf.SSETypes);Vf.SSETypes$outboundSchema=Vf.SSETypes$inboundSchema;var oIr;(function(t){t.inboundSchema=Vf.SSETypes$inboundSchema,t.outboundSchema=Vf.SSETypes$outboundSchema})(oIr||(Vf.SSETypes$=oIr={}))});var qct=S($a=>{"use strict";var UIo=$a&&$a.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BIo=$a&&$a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zIo=$a&&$a.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UIo(r,e,n[o]);return BIo(r,e),r}}();Object.defineProperty($a,"__esModule",{value:!0});$a.ToolExecutionDeltaEvent$=$a.ToolExecutionDeltaEvent$outboundSchema=$a.ToolExecutionDeltaEvent$inboundSchema=$a.ToolExecutionDeltaEventType$=$a.ToolExecutionDeltaEventType$outboundSchema=$a.ToolExecutionDeltaEventType$inboundSchema=$a.ToolExecutionDeltaEventType=void 0;$a.toolExecutionDeltaEventToJSON=HIo;$a.toolExecutionDeltaEventFromJSON=WIo;var Yx=zIo(ae()),sIr=ce(),VIo=ee(),uIr=nU();$a.ToolExecutionDeltaEventType={ToolExecutionDelta:"tool.execution.delta"};$a.ToolExecutionDeltaEventType$inboundSchema=Yx.nativeEnum($a.ToolExecutionDeltaEventType);$a.ToolExecutionDeltaEventType$outboundSchema=$a.ToolExecutionDeltaEventType$inboundSchema;var iIr;(function(t){t.inboundSchema=$a.ToolExecutionDeltaEventType$inboundSchema,t.outboundSchema=$a.ToolExecutionDeltaEventType$outboundSchema})(iIr||($a.ToolExecutionDeltaEventType$=iIr={}));$a.ToolExecutionDeltaEvent$inboundSchema=Yx.object({type:$a.ToolExecutionDeltaEventType$inboundSchema.default("tool.execution.delta"),created_at:Yx.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Yx.number().int().default(0),id:Yx.string(),name:uIr.BuiltInConnectors$inboundSchema,arguments:Yx.string()}).transform(t=>(0,sIr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));$a.ToolExecutionDeltaEvent$outboundSchema=Yx.object({type:$a.ToolExecutionDeltaEventType$outboundSchema.default("tool.execution.delta"),createdAt:Yx.date().transform(t=>t.toISOString()).optional(),outputIndex:Yx.number().int().default(0),id:Yx.string(),name:uIr.BuiltInConnectors$outboundSchema,arguments:Yx.string()}).transform(t=>(0,sIr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var aIr;(function(t){t.inboundSchema=$a.ToolExecutionDeltaEvent$inboundSchema,t.outboundSchema=$a.ToolExecutionDeltaEvent$outboundSchema})(aIr||($a.ToolExecutionDeltaEvent$=aIr={}));function HIo(t){return JSON.stringify($a.ToolExecutionDeltaEvent$outboundSchema.parse(t))}function WIo(t){return(0,VIo.safeParse)(t,e=>$a.ToolExecutionDeltaEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDeltaEvent' from JSON")}});var Uct=S(La=>{"use strict";var JIo=La&&La.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KIo=La&&La.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GIo=La&&La.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JIo(r,e,n[o]);return KIo(r,e),r}}();Object.defineProperty(La,"__esModule",{value:!0});La.ToolExecutionDoneEvent$=La.ToolExecutionDoneEvent$outboundSchema=La.ToolExecutionDoneEvent$inboundSchema=La.ToolExecutionDoneEventType$=La.ToolExecutionDoneEventType$outboundSchema=La.ToolExecutionDoneEventType$inboundSchema=La.ToolExecutionDoneEventType=void 0;La.toolExecutionDoneEventToJSON=ZIo;La.toolExecutionDoneEventFromJSON=YIo;var Jw=GIo(ae()),dIr=ce(),XIo=ee(),fIr=nU();La.ToolExecutionDoneEventType={ToolExecutionDone:"tool.execution.done"};La.ToolExecutionDoneEventType$inboundSchema=Jw.nativeEnum(La.ToolExecutionDoneEventType);La.ToolExecutionDoneEventType$outboundSchema=La.ToolExecutionDoneEventType$inboundSchema;var lIr;(function(t){t.inboundSchema=La.ToolExecutionDoneEventType$inboundSchema,t.outboundSchema=La.ToolExecutionDoneEventType$outboundSchema})(lIr||(La.ToolExecutionDoneEventType$=lIr={}));La.ToolExecutionDoneEvent$inboundSchema=Jw.object({type:La.ToolExecutionDoneEventType$inboundSchema.default("tool.execution.done"),created_at:Jw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Jw.number().int().default(0),id:Jw.string(),name:fIr.BuiltInConnectors$inboundSchema,info:Jw.record(Jw.any()).optional()}).transform(t=>(0,dIr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));La.ToolExecutionDoneEvent$outboundSchema=Jw.object({type:La.ToolExecutionDoneEventType$outboundSchema.default("tool.execution.done"),createdAt:Jw.date().transform(t=>t.toISOString()).optional(),outputIndex:Jw.number().int().default(0),id:Jw.string(),name:fIr.BuiltInConnectors$outboundSchema,info:Jw.record(Jw.any()).optional()}).transform(t=>(0,dIr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var cIr;(function(t){t.inboundSchema=La.ToolExecutionDoneEvent$inboundSchema,t.outboundSchema=La.ToolExecutionDoneEvent$outboundSchema})(cIr||(La.ToolExecutionDoneEvent$=cIr={}));function ZIo(t){return JSON.stringify(La.ToolExecutionDoneEvent$outboundSchema.parse(t))}function YIo(t){return(0,XIo.safeParse)(t,e=>La.ToolExecutionDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDoneEvent' from JSON")}});var Bct=S(Fa=>{"use strict";var QIo=Fa&&Fa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eAo=Fa&&Fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tAo=Fa&&Fa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QIo(r,e,n[o]);return eAo(r,e),r}}();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.ToolExecutionStartedEvent$=Fa.ToolExecutionStartedEvent$outboundSchema=Fa.ToolExecutionStartedEvent$inboundSchema=Fa.ToolExecutionStartedEventType$=Fa.ToolExecutionStartedEventType$outboundSchema=Fa.ToolExecutionStartedEventType$inboundSchema=Fa.ToolExecutionStartedEventType=void 0;Fa.toolExecutionStartedEventToJSON=nAo;Fa.toolExecutionStartedEventFromJSON=oAo;var Qx=tAo(ae()),hIr=ce(),rAo=ee(),gIr=nU();Fa.ToolExecutionStartedEventType={ToolExecutionStarted:"tool.execution.started"};Fa.ToolExecutionStartedEventType$inboundSchema=Qx.nativeEnum(Fa.ToolExecutionStartedEventType);Fa.ToolExecutionStartedEventType$outboundSchema=Fa.ToolExecutionStartedEventType$inboundSchema;var pIr;(function(t){t.inboundSchema=Fa.ToolExecutionStartedEventType$inboundSchema,t.outboundSchema=Fa.ToolExecutionStartedEventType$outboundSchema})(pIr||(Fa.ToolExecutionStartedEventType$=pIr={}));Fa.ToolExecutionStartedEvent$inboundSchema=Qx.object({type:Fa.ToolExecutionStartedEventType$inboundSchema.default("tool.execution.started"),created_at:Qx.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:Qx.number().int().default(0),id:Qx.string(),name:gIr.BuiltInConnectors$inboundSchema,arguments:Qx.string()}).transform(t=>(0,hIr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Fa.ToolExecutionStartedEvent$outboundSchema=Qx.object({type:Fa.ToolExecutionStartedEventType$outboundSchema.default("tool.execution.started"),createdAt:Qx.date().transform(t=>t.toISOString()).optional(),outputIndex:Qx.number().int().default(0),id:Qx.string(),name:gIr.BuiltInConnectors$outboundSchema,arguments:Qx.string()}).transform(t=>(0,hIr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var mIr;(function(t){t.inboundSchema=Fa.ToolExecutionStartedEvent$inboundSchema,t.outboundSchema=Fa.ToolExecutionStartedEvent$outboundSchema})(mIr||(Fa.ToolExecutionStartedEvent$=mIr={}));function nAo(t){return JSON.stringify(Fa.ToolExecutionStartedEvent$outboundSchema.parse(t))}function oAo(t){return(0,rAo.safeParse)(t,e=>Fa.ToolExecutionStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionStartedEvent' from JSON")}});var wIr=S(bs=>{"use strict";var iAo=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]}),aAo=bs&&bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sAo=bs&&bs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iAo(r,e,n[o]);return aAo(r,e),r}}();Object.defineProperty(bs,"__esModule",{value:!0});bs.ConversationEvents$=bs.ConversationEvents$outboundSchema=bs.ConversationEvents$inboundSchema=bs.ConversationEventsData$=bs.ConversationEventsData$outboundSchema=bs.ConversationEventsData$inboundSchema=void 0;bs.conversationEventsDataToJSON=uAo;bs.conversationEventsDataFromJSON=lAo;bs.conversationEventsToJSON=cAo;bs.conversationEventsFromJSON=dAo;var yt=sAo(ae()),_Ir=ee(),SIe=tct(),CIe=rct(),xIe=Nct(),TIe=jct(),OIe=$ct(),EIe=Lct(),PIe=Fct(),vIr=kct(),MIe=qct(),RIe=Uct(),IIe=Bct();bs.ConversationEventsData$inboundSchema=yt.union([xIe.FunctionCallEvent$inboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),SIe.AgentHandoffDoneEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),CIe.AgentHandoffStartedEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),MIe.ToolExecutionDeltaEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),IIe.ToolExecutionStartedEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),EIe.ResponseErrorEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),TIe.MessageOutputEvent$inboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),RIe.ToolExecutionDoneEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),OIe.ResponseDoneEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),PIe.ResponseStartedEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);bs.ConversationEventsData$outboundSchema=yt.union([xIe.FunctionCallEvent$outboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),SIe.AgentHandoffDoneEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),CIe.AgentHandoffStartedEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),MIe.ToolExecutionDeltaEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),IIe.ToolExecutionStartedEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),EIe.ResponseErrorEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),TIe.MessageOutputEvent$outboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),RIe.ToolExecutionDoneEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),OIe.ResponseDoneEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),PIe.ResponseStartedEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);var yIr;(function(t){t.inboundSchema=bs.ConversationEventsData$inboundSchema,t.outboundSchema=bs.ConversationEventsData$outboundSchema})(yIr||(bs.ConversationEventsData$=yIr={}));function uAo(t){return JSON.stringify(bs.ConversationEventsData$outboundSchema.parse(t))}function lAo(t){return(0,_Ir.safeParse)(t,e=>bs.ConversationEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEventsData' from JSON")}bs.ConversationEvents$inboundSchema=yt.object({event:vIr.SSETypes$inboundSchema,data:yt.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:yt.ZodIssueCode.custom,message:`malformed json: ${r}`}),yt.NEVER}}).pipe(yt.union([xIe.FunctionCallEvent$inboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),SIe.AgentHandoffDoneEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),CIe.AgentHandoffStartedEvent$inboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),MIe.ToolExecutionDeltaEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),IIe.ToolExecutionStartedEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),EIe.ResponseErrorEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),TIe.MessageOutputEvent$inboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),RIe.ToolExecutionDoneEvent$inboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),OIe.ResponseDoneEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),PIe.ResponseStartedEvent$inboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))]))});bs.ConversationEvents$outboundSchema=yt.object({event:vIr.SSETypes$outboundSchema,data:yt.union([xIe.FunctionCallEvent$outboundSchema.and(yt.object({type:yt.literal("function.call.delta")}).transform(t=>({type:t.type}))),SIe.AgentHandoffDoneEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),CIe.AgentHandoffStartedEvent$outboundSchema.and(yt.object({type:yt.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),MIe.ToolExecutionDeltaEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),IIe.ToolExecutionStartedEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.started")}).transform(t=>({type:t.type}))),EIe.ResponseErrorEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.error")}).transform(t=>({type:t.type}))),TIe.MessageOutputEvent$outboundSchema.and(yt.object({type:yt.literal("message.output.delta")}).transform(t=>({type:t.type}))),RIe.ToolExecutionDoneEvent$outboundSchema.and(yt.object({type:yt.literal("tool.execution.done")}).transform(t=>({type:t.type}))),OIe.ResponseDoneEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.done")}).transform(t=>({type:t.type}))),PIe.ResponseStartedEvent$outboundSchema.and(yt.object({type:yt.literal("conversation.response.started")}).transform(t=>({type:t.type})))])});var bIr;(function(t){t.inboundSchema=bs.ConversationEvents$inboundSchema,t.outboundSchema=bs.ConversationEvents$outboundSchema})(bIr||(bs.ConversationEvents$=bIr={}));function cAo(t){return JSON.stringify(bs.ConversationEvents$outboundSchema.parse(t))}function dAo(t){return(0,_Ir.safeParse)(t,e=>bs.ConversationEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEvents' from JSON")}});var EIr=S(wo=>{"use strict";var fAo=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]}),pAo=wo&&wo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAo=wo&&wo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fAo(r,e,n[o]);return pAo(r,e),r}}();Object.defineProperty(wo,"__esModule",{value:!0});wo.ConversationHistory$=wo.ConversationHistory$outboundSchema=wo.ConversationHistory$inboundSchema=wo.Entries$=wo.Entries$outboundSchema=wo.Entries$inboundSchema=wo.ConversationHistoryObject$=wo.ConversationHistoryObject$outboundSchema=wo.ConversationHistoryObject$inboundSchema=wo.ConversationHistoryObject=void 0;wo.entriesToJSON=hAo;wo.entriesFromJSON=gAo;wo.conversationHistoryToJSON=yAo;wo.conversationHistoryFromJSON=bAo;var eT=mAo(ae()),TIr=ce(),OIr=ee(),AIe=Rse(),NIe=jse(),DIe=gIe(),jIe=Lse(),$Ie=v7(),LIe=Fse();wo.ConversationHistoryObject={ConversationHistory:"conversation.history"};wo.ConversationHistoryObject$inboundSchema=eT.nativeEnum(wo.ConversationHistoryObject);wo.ConversationHistoryObject$outboundSchema=wo.ConversationHistoryObject$inboundSchema;var SIr;(function(t){t.inboundSchema=wo.ConversationHistoryObject$inboundSchema,t.outboundSchema=wo.ConversationHistoryObject$outboundSchema})(SIr||(wo.ConversationHistoryObject$=SIr={}));wo.Entries$inboundSchema=eT.union([AIe.AgentHandoffEntry$inboundSchema,NIe.FunctionCallEntry$inboundSchema,jIe.MessageInputEntry$inboundSchema,DIe.FunctionResultEntry$inboundSchema,LIe.ToolExecutionEntry$inboundSchema,$Ie.MessageOutputEntry$inboundSchema]);wo.Entries$outboundSchema=eT.union([AIe.AgentHandoffEntry$outboundSchema,NIe.FunctionCallEntry$outboundSchema,jIe.MessageInputEntry$outboundSchema,DIe.FunctionResultEntry$outboundSchema,LIe.ToolExecutionEntry$outboundSchema,$Ie.MessageOutputEntry$outboundSchema]);var CIr;(function(t){t.inboundSchema=wo.Entries$inboundSchema,t.outboundSchema=wo.Entries$outboundSchema})(CIr||(wo.Entries$=CIr={}));function hAo(t){return JSON.stringify(wo.Entries$outboundSchema.parse(t))}function gAo(t){return(0,OIr.safeParse)(t,e=>wo.Entries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Entries' from JSON")}wo.ConversationHistory$inboundSchema=eT.object({object:wo.ConversationHistoryObject$inboundSchema.default("conversation.history"),conversation_id:eT.string(),entries:eT.array(eT.union([AIe.AgentHandoffEntry$inboundSchema,NIe.FunctionCallEntry$inboundSchema,jIe.MessageInputEntry$inboundSchema,DIe.FunctionResultEntry$inboundSchema,LIe.ToolExecutionEntry$inboundSchema,$Ie.MessageOutputEntry$inboundSchema]))}).transform(t=>(0,TIr.remap)(t,{conversation_id:"conversationId"}));wo.ConversationHistory$outboundSchema=eT.object({object:wo.ConversationHistoryObject$outboundSchema.default("conversation.history"),conversationId:eT.string(),entries:eT.array(eT.union([AIe.AgentHandoffEntry$outboundSchema,NIe.FunctionCallEntry$outboundSchema,jIe.MessageInputEntry$outboundSchema,DIe.FunctionResultEntry$outboundSchema,LIe.ToolExecutionEntry$outboundSchema,$Ie.MessageOutputEntry$outboundSchema]))}).transform(t=>(0,TIr.remap)(t,{conversationId:"conversation_id"}));var xIr;(function(t){t.inboundSchema=wo.ConversationHistory$inboundSchema,t.outboundSchema=wo.ConversationHistory$outboundSchema})(xIr||(wo.ConversationHistory$=xIr={}));function yAo(t){return JSON.stringify(wo.ConversationHistory$outboundSchema.parse(t))}function bAo(t){return(0,OIr.safeParse)(t,e=>wo.ConversationHistory$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationHistory' from JSON")}});var zct=S(Hf=>{"use strict";var _Ao=Hf&&Hf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vAo=Hf&&Hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wAo=Hf&&Hf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Ao(r,e,n[o]);return vAo(r,e),r}}();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.MessageEntries$=Hf.MessageEntries$outboundSchema=Hf.MessageEntries$inboundSchema=void 0;Hf.messageEntriesToJSON=CAo;Hf.messageEntriesFromJSON=xAo;var MIr=wAo(ae()),SAo=ee(),RIr=Lse(),IIr=v7();Hf.MessageEntries$inboundSchema=MIr.union([RIr.MessageInputEntry$inboundSchema,IIr.MessageOutputEntry$inboundSchema]);Hf.MessageEntries$outboundSchema=MIr.union([RIr.MessageInputEntry$outboundSchema,IIr.MessageOutputEntry$outboundSchema]);var PIr;(function(t){t.inboundSchema=Hf.MessageEntries$inboundSchema,t.outboundSchema=Hf.MessageEntries$outboundSchema})(PIr||(Hf.MessageEntries$=PIr={}));function CAo(t){return JSON.stringify(Hf.MessageEntries$outboundSchema.parse(t))}function xAo(t){return(0,SAo.safeParse)(t,e=>Hf.MessageEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageEntries' from JSON")}});var $Ir=S(ka=>{"use strict";var TAo=ka&&ka.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OAo=ka&&ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EAo=ka&&ka.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TAo(r,e,n[o]);return OAo(r,e),r}}();Object.defineProperty(ka,"__esModule",{value:!0});ka.ConversationMessages$=ka.ConversationMessages$outboundSchema=ka.ConversationMessages$inboundSchema=ka.ConversationMessagesObject$=ka.ConversationMessagesObject$outboundSchema=ka.ConversationMessagesObject$inboundSchema=ka.ConversationMessagesObject=void 0;ka.conversationMessagesToJSON=MAo;ka.conversationMessagesFromJSON=RAo;var g3=EAo(ae()),DIr=ce(),PAo=ee(),jIr=zct();ka.ConversationMessagesObject={ConversationMessages:"conversation.messages"};ka.ConversationMessagesObject$inboundSchema=g3.nativeEnum(ka.ConversationMessagesObject);ka.ConversationMessagesObject$outboundSchema=ka.ConversationMessagesObject$inboundSchema;var AIr;(function(t){t.inboundSchema=ka.ConversationMessagesObject$inboundSchema,t.outboundSchema=ka.ConversationMessagesObject$outboundSchema})(AIr||(ka.ConversationMessagesObject$=AIr={}));ka.ConversationMessages$inboundSchema=g3.object({object:ka.ConversationMessagesObject$inboundSchema.default("conversation.messages"),conversation_id:g3.string(),messages:g3.array(jIr.MessageEntries$inboundSchema)}).transform(t=>(0,DIr.remap)(t,{conversation_id:"conversationId"}));ka.ConversationMessages$outboundSchema=g3.object({object:ka.ConversationMessagesObject$outboundSchema.default("conversation.messages"),conversationId:g3.string(),messages:g3.array(jIr.MessageEntries$outboundSchema)}).transform(t=>(0,DIr.remap)(t,{conversationId:"conversation_id"}));var NIr;(function(t){t.inboundSchema=ka.ConversationMessages$inboundSchema,t.outboundSchema=ka.ConversationMessages$outboundSchema})(NIr||(ka.ConversationMessages$=NIr={}));function MAo(t){return JSON.stringify(ka.ConversationMessages$outboundSchema.parse(t))}function RAo(t){return(0,PAo.safeParse)(t,e=>ka.ConversationMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationMessages' from JSON")}});var VIr=S(So=>{"use strict";var IAo=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]}),AAo=So&&So.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NAo=So&&So.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IAo(r,e,n[o]);return AAo(r,e),r}}();Object.defineProperty(So,"__esModule",{value:!0});So.ConversationRequest$=So.ConversationRequest$outboundSchema=So.ConversationRequest$inboundSchema=So.Tools$=So.Tools$outboundSchema=So.Tools$inboundSchema=So.HandoffExecution$=So.HandoffExecution$outboundSchema=So.HandoffExecution$inboundSchema=So.HandoffExecution=void 0;So.toolsToJSON=DAo;So.toolsFromJSON=jAo;So.conversationRequestToJSON=$Ao;So.conversationRequestFromJSON=LAo;var bt=NAo(ae()),qIr=ce(),UIr=ee(),FIe=Jq(),BIr=L0(),zIr=aU(),kIe=Xq(),qIe=Zq(),UIe=Yq(),BIe=Qq(),zIe=eU();So.HandoffExecution={Client:"client",Server:"server"};So.HandoffExecution$inboundSchema=bt.nativeEnum(So.HandoffExecution);So.HandoffExecution$outboundSchema=So.HandoffExecution$inboundSchema;var LIr;(function(t){t.inboundSchema=So.HandoffExecution$inboundSchema,t.outboundSchema=So.HandoffExecution$outboundSchema})(LIr||(So.HandoffExecution$=LIr={}));So.Tools$inboundSchema=bt.union([kIe.DocumentLibraryTool$inboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),qIe.FunctionTool$inboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),FIe.CodeInterpreterTool$inboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UIe.ImageGenerationTool$inboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),zIe.WebSearchTool$inboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),BIe.WebSearchPremiumTool$inboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);So.Tools$outboundSchema=bt.union([kIe.DocumentLibraryTool$outboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),qIe.FunctionTool$outboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),FIe.CodeInterpreterTool$outboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UIe.ImageGenerationTool$outboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),zIe.WebSearchTool$outboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),BIe.WebSearchPremiumTool$outboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var FIr;(function(t){t.inboundSchema=So.Tools$inboundSchema,t.outboundSchema=So.Tools$outboundSchema})(FIr||(So.Tools$=FIr={}));function DAo(t){return JSON.stringify(So.Tools$outboundSchema.parse(t))}function jAo(t){return(0,UIr.safeParse)(t,e=>So.Tools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tools' from JSON")}So.ConversationRequest$inboundSchema=bt.object({inputs:zIr.ConversationInputs$inboundSchema,stream:bt.boolean().default(!1),store:bt.nullable(bt.boolean()).optional(),handoff_execution:bt.nullable(So.HandoffExecution$inboundSchema).optional(),instructions:bt.nullable(bt.string()).optional(),tools:bt.nullable(bt.array(bt.union([kIe.DocumentLibraryTool$inboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),qIe.FunctionTool$inboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),FIe.CodeInterpreterTool$inboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UIe.ImageGenerationTool$inboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),zIe.WebSearchTool$inboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),BIe.WebSearchPremiumTool$inboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:bt.nullable(BIr.CompletionArgs$inboundSchema).optional(),name:bt.nullable(bt.string()).optional(),description:bt.nullable(bt.string()).optional(),agent_id:bt.nullable(bt.string()).optional(),model:bt.nullable(bt.string()).optional()}).transform(t=>(0,qIr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));So.ConversationRequest$outboundSchema=bt.object({inputs:zIr.ConversationInputs$outboundSchema,stream:bt.boolean().default(!1),store:bt.nullable(bt.boolean()).optional(),handoffExecution:bt.nullable(So.HandoffExecution$outboundSchema).optional(),instructions:bt.nullable(bt.string()).optional(),tools:bt.nullable(bt.array(bt.union([kIe.DocumentLibraryTool$outboundSchema.and(bt.object({type:bt.literal("document_library")}).transform(t=>({type:t.type}))),qIe.FunctionTool$outboundSchema.and(bt.object({type:bt.literal("function")}).transform(t=>({type:t.type}))),FIe.CodeInterpreterTool$outboundSchema.and(bt.object({type:bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),UIe.ImageGenerationTool$outboundSchema.and(bt.object({type:bt.literal("image_generation")}).transform(t=>({type:t.type}))),zIe.WebSearchTool$outboundSchema.and(bt.object({type:bt.literal("web_search")}).transform(t=>({type:t.type}))),BIe.WebSearchPremiumTool$outboundSchema.and(bt.object({type:bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:bt.nullable(BIr.CompletionArgs$outboundSchema).optional(),name:bt.nullable(bt.string()).optional(),description:bt.nullable(bt.string()).optional(),agentId:bt.nullable(bt.string()).optional(),model:bt.nullable(bt.string()).optional()}).transform(t=>(0,qIr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var kIr;(function(t){t.inboundSchema=So.ConversationRequest$inboundSchema,t.outboundSchema=So.ConversationRequest$outboundSchema})(kIr||(So.ConversationRequest$=kIr={}));function $Ao(t){return JSON.stringify(So.ConversationRequest$outboundSchema.parse(t))}function LAo(t){return(0,UIr.safeParse)(t,e=>So.ConversationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRequest' from JSON")}});var ZIr=S(Co=>{"use strict";var FAo=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]}),kAo=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qAo=Co&&Co.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&FAo(r,e,n[o]);return kAo(r,e),r}}();Object.defineProperty(Co,"__esModule",{value:!0});Co.ConversationResponse$=Co.ConversationResponse$outboundSchema=Co.ConversationResponse$inboundSchema=Co.Outputs$=Co.Outputs$outboundSchema=Co.Outputs$inboundSchema=Co.ConversationResponseObject$=Co.ConversationResponseObject$outboundSchema=Co.ConversationResponseObject$inboundSchema=Co.ConversationResponseObject=void 0;Co.outputsToJSON=UAo;Co.outputsFromJSON=BAo;Co.conversationResponseToJSON=zAo;Co.conversationResponseFromJSON=VAo;var tT=qAo(ae()),KIr=ce(),GIr=ee(),VIe=Rse(),XIr=wIe(),HIe=jse(),WIe=v7(),JIe=Fse();Co.ConversationResponseObject={ConversationResponse:"conversation.response"};Co.ConversationResponseObject$inboundSchema=tT.nativeEnum(Co.ConversationResponseObject);Co.ConversationResponseObject$outboundSchema=Co.ConversationResponseObject$inboundSchema;var HIr;(function(t){t.inboundSchema=Co.ConversationResponseObject$inboundSchema,t.outboundSchema=Co.ConversationResponseObject$outboundSchema})(HIr||(Co.ConversationResponseObject$=HIr={}));Co.Outputs$inboundSchema=tT.union([VIe.AgentHandoffEntry$inboundSchema,HIe.FunctionCallEntry$inboundSchema,JIe.ToolExecutionEntry$inboundSchema,WIe.MessageOutputEntry$inboundSchema]);Co.Outputs$outboundSchema=tT.union([VIe.AgentHandoffEntry$outboundSchema,HIe.FunctionCallEntry$outboundSchema,JIe.ToolExecutionEntry$outboundSchema,WIe.MessageOutputEntry$outboundSchema]);var WIr;(function(t){t.inboundSchema=Co.Outputs$inboundSchema,t.outboundSchema=Co.Outputs$outboundSchema})(WIr||(Co.Outputs$=WIr={}));function UAo(t){return JSON.stringify(Co.Outputs$outboundSchema.parse(t))}function BAo(t){return(0,GIr.safeParse)(t,e=>Co.Outputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Outputs' from JSON")}Co.ConversationResponse$inboundSchema=tT.object({object:Co.ConversationResponseObject$inboundSchema.default("conversation.response"),conversation_id:tT.string(),outputs:tT.array(tT.union([VIe.AgentHandoffEntry$inboundSchema,HIe.FunctionCallEntry$inboundSchema,JIe.ToolExecutionEntry$inboundSchema,WIe.MessageOutputEntry$inboundSchema])),usage:XIr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,KIr.remap)(t,{conversation_id:"conversationId"}));Co.ConversationResponse$outboundSchema=tT.object({object:Co.ConversationResponseObject$outboundSchema.default("conversation.response"),conversationId:tT.string(),outputs:tT.array(tT.union([VIe.AgentHandoffEntry$outboundSchema,HIe.FunctionCallEntry$outboundSchema,JIe.ToolExecutionEntry$outboundSchema,WIe.MessageOutputEntry$outboundSchema])),usage:XIr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,KIr.remap)(t,{conversationId:"conversation_id"}));var JIr;(function(t){t.inboundSchema=Co.ConversationResponse$inboundSchema,t.outboundSchema=Co.ConversationResponse$outboundSchema})(JIr||(Co.ConversationResponse$=JIr={}));function zAo(t){return JSON.stringify(Co.ConversationResponse$outboundSchema.parse(t))}function VAo(t){return(0,GIr.safeParse)(t,e=>Co.ConversationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationResponse' from JSON")}});var nAr=S(qa=>{"use strict";var HAo=qa&&qa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WAo=qa&&qa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAo=qa&&qa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&HAo(r,e,n[o]);return WAo(r,e),r}}();Object.defineProperty(qa,"__esModule",{value:!0});qa.ConversationRestartRequest$=qa.ConversationRestartRequest$outboundSchema=qa.ConversationRestartRequest$inboundSchema=qa.ConversationRestartRequestHandoffExecution$=qa.ConversationRestartRequestHandoffExecution$outboundSchema=qa.ConversationRestartRequestHandoffExecution$inboundSchema=qa.ConversationRestartRequestHandoffExecution=void 0;qa.conversationRestartRequestToJSON=GAo;qa.conversationRestartRequestFromJSON=XAo;var ej=JAo(ae()),eAr=ce(),KAo=ee(),tAr=L0(),rAr=aU();qa.ConversationRestartRequestHandoffExecution={Client:"client",Server:"server"};qa.ConversationRestartRequestHandoffExecution$inboundSchema=ej.nativeEnum(qa.ConversationRestartRequestHandoffExecution);qa.ConversationRestartRequestHandoffExecution$outboundSchema=qa.ConversationRestartRequestHandoffExecution$inboundSchema;var YIr;(function(t){t.inboundSchema=qa.ConversationRestartRequestHandoffExecution$inboundSchema,t.outboundSchema=qa.ConversationRestartRequestHandoffExecution$outboundSchema})(YIr||(qa.ConversationRestartRequestHandoffExecution$=YIr={}));qa.ConversationRestartRequest$inboundSchema=ej.object({inputs:rAr.ConversationInputs$inboundSchema,stream:ej.boolean().default(!1),store:ej.boolean().default(!0),handoff_execution:qa.ConversationRestartRequestHandoffExecution$inboundSchema.default("server"),completion_args:tAr.CompletionArgs$inboundSchema.optional(),from_entry_id:ej.string()}).transform(t=>(0,eAr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));qa.ConversationRestartRequest$outboundSchema=ej.object({inputs:rAr.ConversationInputs$outboundSchema,stream:ej.boolean().default(!1),store:ej.boolean().default(!0),handoffExecution:qa.ConversationRestartRequestHandoffExecution$outboundSchema.default("server"),completionArgs:tAr.CompletionArgs$outboundSchema.optional(),fromEntryId:ej.string()}).transform(t=>(0,eAr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var QIr;(function(t){t.inboundSchema=qa.ConversationRestartRequest$inboundSchema,t.outboundSchema=qa.ConversationRestartRequest$outboundSchema})(QIr||(qa.ConversationRestartRequest$=QIr={}));function GAo(t){return JSON.stringify(qa.ConversationRestartRequest$outboundSchema.parse(t))}function XAo(t){return(0,KAo.safeParse)(t,e=>qa.ConversationRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartRequest' from JSON")}});var lAr=S(Ua=>{"use strict";var ZAo=Ua&&Ua.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YAo=Ua&&Ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QAo=Ua&&Ua.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZAo(r,e,n[o]);return YAo(r,e),r}}();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.ConversationRestartStreamRequest$=Ua.ConversationRestartStreamRequest$outboundSchema=Ua.ConversationRestartStreamRequest$inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$=Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution=void 0;Ua.conversationRestartStreamRequestToJSON=tNo;Ua.conversationRestartStreamRequestFromJSON=rNo;var tj=QAo(ae()),aAr=ce(),eNo=ee(),sAr=L0(),uAr=aU();Ua.ConversationRestartStreamRequestHandoffExecution={Client:"client",Server:"server"};Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema=tj.nativeEnum(Ua.ConversationRestartStreamRequestHandoffExecution);Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema;var oAr;(function(t){t.inboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema})(oAr||(Ua.ConversationRestartStreamRequestHandoffExecution$=oAr={}));Ua.ConversationRestartStreamRequest$inboundSchema=tj.object({inputs:uAr.ConversationInputs$inboundSchema,stream:tj.boolean().default(!0),store:tj.boolean().default(!0),handoff_execution:Ua.ConversationRestartStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:sAr.CompletionArgs$inboundSchema.optional(),from_entry_id:tj.string()}).transform(t=>(0,aAr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Ua.ConversationRestartStreamRequest$outboundSchema=tj.object({inputs:uAr.ConversationInputs$outboundSchema,stream:tj.boolean().default(!0),store:tj.boolean().default(!0),handoffExecution:Ua.ConversationRestartStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:sAr.CompletionArgs$outboundSchema.optional(),fromEntryId:tj.string()}).transform(t=>(0,aAr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var iAr;(function(t){t.inboundSchema=Ua.ConversationRestartStreamRequest$inboundSchema,t.outboundSchema=Ua.ConversationRestartStreamRequest$outboundSchema})(iAr||(Ua.ConversationRestartStreamRequest$=iAr={}));function tNo(t){return JSON.stringify(Ua.ConversationRestartStreamRequest$outboundSchema.parse(t))}function rNo(t){return(0,eNo.safeParse)(t,e=>Ua.ConversationRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartStreamRequest' from JSON")}});var yAr=S(xo=>{"use strict";var nNo=xo&&xo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oNo=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iNo=xo&&xo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nNo(r,e,n[o]);return oNo(r,e),r}}();Object.defineProperty(xo,"__esModule",{value:!0});xo.ConversationStreamRequest$=xo.ConversationStreamRequest$outboundSchema=xo.ConversationStreamRequest$inboundSchema=xo.ConversationStreamRequestTools$=xo.ConversationStreamRequestTools$outboundSchema=xo.ConversationStreamRequestTools$inboundSchema=xo.ConversationStreamRequestHandoffExecution$=xo.ConversationStreamRequestHandoffExecution$outboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema=xo.ConversationStreamRequestHandoffExecution=void 0;xo.conversationStreamRequestToolsToJSON=aNo;xo.conversationStreamRequestToolsFromJSON=sNo;xo.conversationStreamRequestToJSON=uNo;xo.conversationStreamRequestFromJSON=lNo;var _t=iNo(ae()),pAr=ce(),mAr=ee(),KIe=Jq(),hAr=L0(),gAr=aU(),GIe=Xq(),XIe=Zq(),ZIe=Yq(),YIe=Qq(),QIe=eU();xo.ConversationStreamRequestHandoffExecution={Client:"client",Server:"server"};xo.ConversationStreamRequestHandoffExecution$inboundSchema=_t.nativeEnum(xo.ConversationStreamRequestHandoffExecution);xo.ConversationStreamRequestHandoffExecution$outboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema;var cAr;(function(t){t.inboundSchema=xo.ConversationStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=xo.ConversationStreamRequestHandoffExecution$outboundSchema})(cAr||(xo.ConversationStreamRequestHandoffExecution$=cAr={}));xo.ConversationStreamRequestTools$inboundSchema=_t.union([GIe.DocumentLibraryTool$inboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),XIe.FunctionTool$inboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),KIe.CodeInterpreterTool$inboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),ZIe.ImageGenerationTool$inboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),QIe.WebSearchTool$inboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),YIe.WebSearchPremiumTool$inboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]);xo.ConversationStreamRequestTools$outboundSchema=_t.union([GIe.DocumentLibraryTool$outboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),XIe.FunctionTool$outboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),KIe.CodeInterpreterTool$outboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),ZIe.ImageGenerationTool$outboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),QIe.WebSearchTool$outboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),YIe.WebSearchPremiumTool$outboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var dAr;(function(t){t.inboundSchema=xo.ConversationStreamRequestTools$inboundSchema,t.outboundSchema=xo.ConversationStreamRequestTools$outboundSchema})(dAr||(xo.ConversationStreamRequestTools$=dAr={}));function aNo(t){return JSON.stringify(xo.ConversationStreamRequestTools$outboundSchema.parse(t))}function sNo(t){return(0,mAr.safeParse)(t,e=>xo.ConversationStreamRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequestTools' from JSON")}xo.ConversationStreamRequest$inboundSchema=_t.object({inputs:gAr.ConversationInputs$inboundSchema,stream:_t.boolean().default(!0),store:_t.nullable(_t.boolean()).optional(),handoff_execution:_t.nullable(xo.ConversationStreamRequestHandoffExecution$inboundSchema).optional(),instructions:_t.nullable(_t.string()).optional(),tools:_t.nullable(_t.array(_t.union([GIe.DocumentLibraryTool$inboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),XIe.FunctionTool$inboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),KIe.CodeInterpreterTool$inboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),ZIe.ImageGenerationTool$inboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),QIe.WebSearchTool$inboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),YIe.WebSearchPremiumTool$inboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:_t.nullable(hAr.CompletionArgs$inboundSchema).optional(),name:_t.nullable(_t.string()).optional(),description:_t.nullable(_t.string()).optional(),agent_id:_t.nullable(_t.string()).optional(),model:_t.nullable(_t.string()).optional()}).transform(t=>(0,pAr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));xo.ConversationStreamRequest$outboundSchema=_t.object({inputs:gAr.ConversationInputs$outboundSchema,stream:_t.boolean().default(!0),store:_t.nullable(_t.boolean()).optional(),handoffExecution:_t.nullable(xo.ConversationStreamRequestHandoffExecution$outboundSchema).optional(),instructions:_t.nullable(_t.string()).optional(),tools:_t.nullable(_t.array(_t.union([GIe.DocumentLibraryTool$outboundSchema.and(_t.object({type:_t.literal("document_library")}).transform(t=>({type:t.type}))),XIe.FunctionTool$outboundSchema.and(_t.object({type:_t.literal("function")}).transform(t=>({type:t.type}))),KIe.CodeInterpreterTool$outboundSchema.and(_t.object({type:_t.literal("code_interpreter")}).transform(t=>({type:t.type}))),ZIe.ImageGenerationTool$outboundSchema.and(_t.object({type:_t.literal("image_generation")}).transform(t=>({type:t.type}))),QIe.WebSearchTool$outboundSchema.and(_t.object({type:_t.literal("web_search")}).transform(t=>({type:t.type}))),YIe.WebSearchPremiumTool$outboundSchema.and(_t.object({type:_t.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:_t.nullable(hAr.CompletionArgs$outboundSchema).optional(),name:_t.nullable(_t.string()).optional(),description:_t.nullable(_t.string()).optional(),agentId:_t.nullable(_t.string()).optional(),model:_t.nullable(_t.string()).optional()}).transform(t=>(0,pAr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var fAr;(function(t){t.inboundSchema=xo.ConversationStreamRequest$inboundSchema,t.outboundSchema=xo.ConversationStreamRequest$outboundSchema})(fAr||(xo.ConversationStreamRequest$=fAr={}));function uNo(t){return JSON.stringify(xo.ConversationStreamRequest$outboundSchema.parse(t))}function lNo(t){return(0,mAr.safeParse)(t,e=>xo.ConversationStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequest' from JSON")}});var _Ar=S(Wf=>{"use strict";var cNo=Wf&&Wf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dNo=Wf&&Wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fNo=Wf&&Wf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cNo(r,e,n[o]);return dNo(r,e),r}}();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.DeleteFileOut$=Wf.DeleteFileOut$outboundSchema=Wf.DeleteFileOut$inboundSchema=void 0;Wf.deleteFileOutToJSON=mNo;Wf.deleteFileOutFromJSON=hNo;var sU=fNo(ae()),pNo=ee();Wf.DeleteFileOut$inboundSchema=sU.object({id:sU.string(),object:sU.string(),deleted:sU.boolean()});Wf.DeleteFileOut$outboundSchema=sU.object({id:sU.string(),object:sU.string(),deleted:sU.boolean()});var bAr;(function(t){t.inboundSchema=Wf.DeleteFileOut$inboundSchema,t.outboundSchema=Wf.DeleteFileOut$outboundSchema})(bAr||(Wf.DeleteFileOut$=bAr={}));function mNo(t){return JSON.stringify(Wf.DeleteFileOut$outboundSchema.parse(t))}function hNo(t){return(0,pNo.safeParse)(t,e=>Wf.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var wAr=S(Jf=>{"use strict";var gNo=Jf&&Jf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yNo=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bNo=Jf&&Jf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gNo(r,e,n[o]);return yNo(r,e),r}}();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.DeleteModelOut$=Jf.DeleteModelOut$outboundSchema=Jf.DeleteModelOut$inboundSchema=void 0;Jf.deleteModelOutToJSON=vNo;Jf.deleteModelOutFromJSON=wNo;var uU=bNo(ae()),_No=ee();Jf.DeleteModelOut$inboundSchema=uU.object({id:uU.string(),object:uU.string().default("model"),deleted:uU.boolean().default(!0)});Jf.DeleteModelOut$outboundSchema=uU.object({id:uU.string(),object:uU.string().default("model"),deleted:uU.boolean().default(!0)});var vAr;(function(t){t.inboundSchema=Jf.DeleteModelOut$inboundSchema,t.outboundSchema=Jf.DeleteModelOut$outboundSchema})(vAr||(Jf.DeleteModelOut$=vAr={}));function vNo(t){return JSON.stringify(Jf.DeleteModelOut$outboundSchema.parse(t))}function wNo(t){return(0,_No.safeParse)(t,e=>Jf.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var Vct=S(Kf=>{"use strict";var SNo=Kf&&Kf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CNo=Kf&&Kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xNo=Kf&&Kf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SNo(r,e,n[o]);return CNo(r,e),r}}();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.DocumentOut$=Kf.DocumentOut$outboundSchema=Kf.DocumentOut$inboundSchema=void 0;Kf.documentOutToJSON=ONo;Kf.documentOutFromJSON=ENo;var To=xNo(ae()),CAr=ce(),TNo=ee();Kf.DocumentOut$inboundSchema=To.object({id:To.string(),library_id:To.string(),hash:To.string(),mime_type:To.string(),extension:To.string(),size:To.number().int(),name:To.string(),summary:To.nullable(To.string()).optional(),created_at:To.string().datetime({offset:!0}).transform(t=>new Date(t)),last_processed_at:To.nullable(To.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),number_of_pages:To.nullable(To.number().int()).optional(),processing_status:To.string(),uploaded_by_id:To.string(),uploaded_by_type:To.string(),tokens_processing_main_content:To.nullable(To.number().int()).optional(),tokens_processing_summary:To.nullable(To.number().int()).optional(),tokens_processing_total:To.number().int()}).transform(t=>(0,CAr.remap)(t,{library_id:"libraryId",mime_type:"mimeType",created_at:"createdAt",last_processed_at:"lastProcessedAt",number_of_pages:"numberOfPages",processing_status:"processingStatus",uploaded_by_id:"uploadedById",uploaded_by_type:"uploadedByType",tokens_processing_main_content:"tokensProcessingMainContent",tokens_processing_summary:"tokensProcessingSummary",tokens_processing_total:"tokensProcessingTotal"}));Kf.DocumentOut$outboundSchema=To.object({id:To.string(),libraryId:To.string(),hash:To.string(),mimeType:To.string(),extension:To.string(),size:To.number().int(),name:To.string(),summary:To.nullable(To.string()).optional(),createdAt:To.date().transform(t=>t.toISOString()),lastProcessedAt:To.nullable(To.date().transform(t=>t.toISOString())).optional(),numberOfPages:To.nullable(To.number().int()).optional(),processingStatus:To.string(),uploadedById:To.string(),uploadedByType:To.string(),tokensProcessingMainContent:To.nullable(To.number().int()).optional(),tokensProcessingSummary:To.nullable(To.number().int()).optional(),tokensProcessingTotal:To.number().int()}).transform(t=>(0,CAr.remap)(t,{libraryId:"library_id",mimeType:"mime_type",createdAt:"created_at",lastProcessedAt:"last_processed_at",numberOfPages:"number_of_pages",processingStatus:"processing_status",uploadedById:"uploaded_by_id",uploadedByType:"uploaded_by_type",tokensProcessingMainContent:"tokens_processing_main_content",tokensProcessingSummary:"tokens_processing_summary",tokensProcessingTotal:"tokens_processing_total"}));var SAr;(function(t){t.inboundSchema=Kf.DocumentOut$inboundSchema,t.outboundSchema=Kf.DocumentOut$outboundSchema})(SAr||(Kf.DocumentOut$=SAr={}));function ONo(t){return JSON.stringify(Kf.DocumentOut$outboundSchema.parse(t))}function ENo(t){return(0,TNo.safeParse)(t,e=>Kf.DocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentOut' from JSON")}});var TAr=S(Gf=>{"use strict";var PNo=Gf&&Gf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MNo=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RNo=Gf&&Gf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PNo(r,e,n[o]);return MNo(r,e),r}}();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.DocumentTextContent$=Gf.DocumentTextContent$outboundSchema=Gf.DocumentTextContent$inboundSchema=void 0;Gf.documentTextContentToJSON=ANo;Gf.documentTextContentFromJSON=NNo;var eAe=RNo(ae()),INo=ee();Gf.DocumentTextContent$inboundSchema=eAe.object({text:eAe.string()});Gf.DocumentTextContent$outboundSchema=eAe.object({text:eAe.string()});var xAr;(function(t){t.inboundSchema=Gf.DocumentTextContent$inboundSchema,t.outboundSchema=Gf.DocumentTextContent$outboundSchema})(xAr||(Gf.DocumentTextContent$=xAr={}));function ANo(t){return JSON.stringify(Gf.DocumentTextContent$outboundSchema.parse(t))}function NNo(t){return(0,INo.safeParse)(t,e=>Gf.DocumentTextContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentTextContent' from JSON")}});var EAr=S(Xf=>{"use strict";var DNo=Xf&&Xf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jNo=Xf&&Xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$No=Xf&&Xf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&DNo(r,e,n[o]);return jNo(r,e),r}}();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.DocumentUpdateIn$=Xf.DocumentUpdateIn$outboundSchema=Xf.DocumentUpdateIn$inboundSchema=void 0;Xf.documentUpdateInToJSON=FNo;Xf.documentUpdateInFromJSON=kNo;var S7=$No(ae()),LNo=ee();Xf.DocumentUpdateIn$inboundSchema=S7.object({name:S7.nullable(S7.string()).optional()});Xf.DocumentUpdateIn$outboundSchema=S7.object({name:S7.nullable(S7.string()).optional()});var OAr;(function(t){t.inboundSchema=Xf.DocumentUpdateIn$inboundSchema,t.outboundSchema=Xf.DocumentUpdateIn$outboundSchema})(OAr||(Xf.DocumentUpdateIn$=OAr={}));function FNo(t){return JSON.stringify(Xf.DocumentUpdateIn$outboundSchema.parse(t))}function kNo(t){return(0,LNo.safeParse)(t,e=>Xf.DocumentUpdateIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentUpdateIn' from JSON")}});var Hct=S(Zf=>{"use strict";var qNo=Zf&&Zf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UNo=Zf&&Zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BNo=Zf&&Zf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qNo(r,e,n[o]);return UNo(r,e),r}}();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.EmbeddingDtype$=Zf.EmbeddingDtype$outboundSchema=Zf.EmbeddingDtype$inboundSchema=Zf.EmbeddingDtype=void 0;var zNo=BNo(ae());Zf.EmbeddingDtype={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"};Zf.EmbeddingDtype$inboundSchema=zNo.nativeEnum(Zf.EmbeddingDtype);Zf.EmbeddingDtype$outboundSchema=Zf.EmbeddingDtype$inboundSchema;var PAr;(function(t){t.inboundSchema=Zf.EmbeddingDtype$inboundSchema,t.outboundSchema=Zf.EmbeddingDtype$outboundSchema})(PAr||(Zf.EmbeddingDtype$=PAr={}))});var Wct=S(Yf=>{"use strict";var VNo=Yf&&Yf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HNo=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WNo=Yf&&Yf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VNo(r,e,n[o]);return HNo(r,e),r}}();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.EncodingFormat$=Yf.EncodingFormat$outboundSchema=Yf.EncodingFormat$inboundSchema=Yf.EncodingFormat=void 0;var JNo=WNo(ae());Yf.EncodingFormat={Float:"float",Base64:"base64"};Yf.EncodingFormat$inboundSchema=JNo.nativeEnum(Yf.EncodingFormat);Yf.EncodingFormat$outboundSchema=Yf.EncodingFormat$inboundSchema;var MAr;(function(t){t.inboundSchema=Yf.EncodingFormat$inboundSchema,t.outboundSchema=Yf.EncodingFormat$outboundSchema})(MAr||(Yf.EncodingFormat$=MAr={}))});var $Ar=S(_s=>{"use strict";var KNo=_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]}),GNo=_s&&_s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XNo=_s&&_s.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KNo(r,e,n[o]);return GNo(r,e),r}}();Object.defineProperty(_s,"__esModule",{value:!0});_s.EmbeddingRequest$=_s.EmbeddingRequest$outboundSchema=_s.EmbeddingRequest$inboundSchema=_s.EmbeddingRequestInputs$=_s.EmbeddingRequestInputs$outboundSchema=_s.EmbeddingRequestInputs$inboundSchema=void 0;_s.embeddingRequestInputsToJSON=ZNo;_s.embeddingRequestInputsFromJSON=YNo;_s.embeddingRequestToJSON=QNo;_s.embeddingRequestFromJSON=e1o;var sc=XNo(ae()),AAr=ce(),NAr=ee(),DAr=Hct(),jAr=Wct();_s.EmbeddingRequestInputs$inboundSchema=sc.union([sc.string(),sc.array(sc.string())]);_s.EmbeddingRequestInputs$outboundSchema=sc.union([sc.string(),sc.array(sc.string())]);var RAr;(function(t){t.inboundSchema=_s.EmbeddingRequestInputs$inboundSchema,t.outboundSchema=_s.EmbeddingRequestInputs$outboundSchema})(RAr||(_s.EmbeddingRequestInputs$=RAr={}));function ZNo(t){return JSON.stringify(_s.EmbeddingRequestInputs$outboundSchema.parse(t))}function YNo(t){return(0,NAr.safeParse)(t,e=>_s.EmbeddingRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequestInputs' from JSON")}_s.EmbeddingRequest$inboundSchema=sc.object({model:sc.string(),input:sc.union([sc.string(),sc.array(sc.string())]),output_dimension:sc.nullable(sc.number().int()).optional(),output_dtype:DAr.EmbeddingDtype$inboundSchema.optional(),encoding_format:jAr.EncodingFormat$inboundSchema.optional()}).transform(t=>(0,AAr.remap)(t,{input:"inputs",output_dimension:"outputDimension",output_dtype:"outputDtype",encoding_format:"encodingFormat"}));_s.EmbeddingRequest$outboundSchema=sc.object({model:sc.string(),inputs:sc.union([sc.string(),sc.array(sc.string())]),outputDimension:sc.nullable(sc.number().int()).optional(),outputDtype:DAr.EmbeddingDtype$outboundSchema.optional(),encodingFormat:jAr.EncodingFormat$outboundSchema.optional()}).transform(t=>(0,AAr.remap)(t,{inputs:"input",outputDimension:"output_dimension",outputDtype:"output_dtype",encodingFormat:"encoding_format"}));var IAr;(function(t){t.inboundSchema=_s.EmbeddingRequest$inboundSchema,t.outboundSchema=_s.EmbeddingRequest$outboundSchema})(IAr||(_s.EmbeddingRequest$=IAr={}));function QNo(t){return JSON.stringify(_s.EmbeddingRequest$outboundSchema.parse(t))}function e1o(t){return(0,NAr.safeParse)(t,e=>_s.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var Jct=S(Qf=>{"use strict";var t1o=Qf&&Qf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),r1o=Qf&&Qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n1o=Qf&&Qf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&t1o(r,e,n[o]);return r1o(r,e),r}}();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.EmbeddingResponseData$=Qf.EmbeddingResponseData$outboundSchema=Qf.EmbeddingResponseData$inboundSchema=void 0;Qf.embeddingResponseDataToJSON=i1o;Qf.embeddingResponseDataFromJSON=a1o;var LA=n1o(ae()),o1o=ee();Qf.EmbeddingResponseData$inboundSchema=LA.object({object:LA.string().optional(),embedding:LA.array(LA.number()).optional(),index:LA.number().int().optional()});Qf.EmbeddingResponseData$outboundSchema=LA.object({object:LA.string().optional(),embedding:LA.array(LA.number()).optional(),index:LA.number().int().optional()});var LAr;(function(t){t.inboundSchema=Qf.EmbeddingResponseData$inboundSchema,t.outboundSchema=Qf.EmbeddingResponseData$outboundSchema})(LAr||(Qf.EmbeddingResponseData$=LAr={}));function i1o(t){return JSON.stringify(Qf.EmbeddingResponseData$outboundSchema.parse(t))}function a1o(t){return(0,o1o.safeParse)(t,e=>Qf.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var UAr=S(ep=>{"use strict";var s1o=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]}),u1o=ep&&ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l1o=ep&&ep.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s1o(r,e,n[o]);return u1o(r,e),r}}();Object.defineProperty(ep,"__esModule",{value:!0});ep.EmbeddingResponse$=ep.EmbeddingResponse$outboundSchema=ep.EmbeddingResponse$inboundSchema=void 0;ep.embeddingResponseToJSON=d1o;ep.embeddingResponseFromJSON=f1o;var FA=l1o(ae()),c1o=ee(),kAr=Jct(),qAr=oU();ep.EmbeddingResponse$inboundSchema=FA.object({id:FA.string(),object:FA.string(),model:FA.string(),usage:qAr.UsageInfo$inboundSchema,data:FA.array(kAr.EmbeddingResponseData$inboundSchema)});ep.EmbeddingResponse$outboundSchema=FA.object({id:FA.string(),object:FA.string(),model:FA.string(),usage:qAr.UsageInfo$outboundSchema,data:FA.array(kAr.EmbeddingResponseData$outboundSchema)});var FAr;(function(t){t.inboundSchema=ep.EmbeddingResponse$inboundSchema,t.outboundSchema=ep.EmbeddingResponse$outboundSchema})(FAr||(ep.EmbeddingResponse$=FAr={}));function d1o(t){return JSON.stringify(ep.EmbeddingResponse$outboundSchema.parse(t))}function f1o(t){return(0,c1o.safeParse)(t,e=>ep.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var tAe=S(tp=>{"use strict";var p1o=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]}),m1o=tp&&tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h1o=tp&&tp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&p1o(r,e,n[o]);return m1o(r,e),r}}();Object.defineProperty(tp,"__esModule",{value:!0});tp.EntityType$=tp.EntityType$outboundSchema=tp.EntityType$inboundSchema=tp.EntityType=void 0;var y3=h1o(ae()),g1o=Gx();tp.EntityType={User:"User",Workspace:"Workspace",Org:"Org"};tp.EntityType$inboundSchema=y3.union([y3.nativeEnum(tp.EntityType),y3.string().transform(g1o.catchUnrecognizedEnum)]);tp.EntityType$outboundSchema=y3.union([y3.nativeEnum(tp.EntityType),y3.string().and(y3.custom())]);var BAr;(function(t){t.inboundSchema=tp.EntityType$inboundSchema,t.outboundSchema=tp.EntityType$outboundSchema})(BAr||(tp.EntityType$=BAr={}))});var qse=S(rp=>{"use strict";var y1o=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]}),b1o=rp&&rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_1o=rp&&rp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&y1o(r,e,n[o]);return b1o(r,e),r}}();Object.defineProperty(rp,"__esModule",{value:!0});rp.FilePurpose$=rp.FilePurpose$outboundSchema=rp.FilePurpose$inboundSchema=rp.FilePurpose=void 0;var b3=_1o(ae()),v1o=Gx();rp.FilePurpose={FineTune:"fine-tune",Batch:"batch",Ocr:"ocr"};rp.FilePurpose$inboundSchema=b3.union([b3.nativeEnum(rp.FilePurpose),b3.string().transform(v1o.catchUnrecognizedEnum)]);rp.FilePurpose$outboundSchema=b3.union([b3.nativeEnum(rp.FilePurpose),b3.string().and(b3.custom())]);var zAr;(function(t){t.inboundSchema=rp.FilePurpose$inboundSchema,t.outboundSchema=rp.FilePurpose$outboundSchema})(zAr||(rp.FilePurpose$=zAr={}))});var Use=S(np=>{"use strict";var w1o=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]}),S1o=np&&np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C1o=np&&np.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w1o(r,e,n[o]);return S1o(r,e),r}}();Object.defineProperty(np,"__esModule",{value:!0});np.SampleType$=np.SampleType$outboundSchema=np.SampleType$inboundSchema=np.SampleType=void 0;var _3=C1o(ae()),x1o=Gx();np.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};np.SampleType$inboundSchema=_3.union([_3.nativeEnum(np.SampleType),_3.string().transform(x1o.catchUnrecognizedEnum)]);np.SampleType$outboundSchema=_3.union([_3.nativeEnum(np.SampleType),_3.string().and(_3.custom())]);var VAr;(function(t){t.inboundSchema=np.SampleType$inboundSchema,t.outboundSchema=np.SampleType$outboundSchema})(VAr||(np.SampleType$=VAr={}))});var Bse=S(op=>{"use strict";var T1o=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]}),O1o=op&&op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E1o=op&&op.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T1o(r,e,n[o]);return O1o(r,e),r}}();Object.defineProperty(op,"__esModule",{value:!0});op.Source$=op.Source$outboundSchema=op.Source$inboundSchema=op.Source=void 0;var v3=E1o(ae()),P1o=Gx();op.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};op.Source$inboundSchema=v3.union([v3.nativeEnum(op.Source),v3.string().transform(P1o.catchUnrecognizedEnum)]);op.Source$outboundSchema=v3.union([v3.nativeEnum(op.Source),v3.string().and(v3.custom())]);var HAr;(function(t){t.inboundSchema=op.Source$inboundSchema,t.outboundSchema=op.Source$outboundSchema})(HAr||(op.Source$=HAr={}))});var Kct=S(ip=>{"use strict";var M1o=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]}),R1o=ip&&ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I1o=ip&&ip.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M1o(r,e,n[o]);return R1o(r,e),r}}();Object.defineProperty(ip,"__esModule",{value:!0});ip.FileSchema$=ip.FileSchema$outboundSchema=ip.FileSchema$inboundSchema=void 0;ip.fileSchemaToJSON=N1o;ip.fileSchemaFromJSON=D1o;var uc=I1o(ae()),JAr=ce(),A1o=ee(),KAr=qse(),GAr=Use(),XAr=Bse();ip.FileSchema$inboundSchema=uc.object({id:uc.string(),object:uc.string(),bytes:uc.number().int(),created_at:uc.number().int(),filename:uc.string(),purpose:KAr.FilePurpose$inboundSchema,sample_type:GAr.SampleType$inboundSchema,num_lines:uc.nullable(uc.number().int()).optional(),mimetype:uc.nullable(uc.string()).optional(),source:XAr.Source$inboundSchema,signature:uc.nullable(uc.string()).optional()}).transform(t=>(0,JAr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));ip.FileSchema$outboundSchema=uc.object({id:uc.string(),object:uc.string(),sizeBytes:uc.number().int(),createdAt:uc.number().int(),filename:uc.string(),purpose:KAr.FilePurpose$outboundSchema,sampleType:GAr.SampleType$outboundSchema,numLines:uc.nullable(uc.number().int()).optional(),mimetype:uc.nullable(uc.string()).optional(),source:XAr.Source$outboundSchema,signature:uc.nullable(uc.string()).optional()}).transform(t=>(0,JAr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var WAr;(function(t){t.inboundSchema=ip.FileSchema$inboundSchema,t.outboundSchema=ip.FileSchema$outboundSchema})(WAr||(ip.FileSchema$=WAr={}));function N1o(t){return JSON.stringify(ip.FileSchema$outboundSchema.parse(t))}function D1o(t){return(0,A1o.safeParse)(t,e=>ip.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var YAr=S(ap=>{"use strict";var j1o=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]}),$1o=ap&&ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L1o=ap&&ap.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&j1o(r,e,n[o]);return $1o(r,e),r}}();Object.defineProperty(ap,"__esModule",{value:!0});ap.FileSignedURL$=ap.FileSignedURL$outboundSchema=ap.FileSignedURL$inboundSchema=void 0;ap.fileSignedURLToJSON=k1o;ap.fileSignedURLFromJSON=q1o;var rAe=L1o(ae()),F1o=ee();ap.FileSignedURL$inboundSchema=rAe.object({url:rAe.string()});ap.FileSignedURL$outboundSchema=rAe.object({url:rAe.string()});var ZAr;(function(t){t.inboundSchema=ap.FileSignedURL$inboundSchema,t.outboundSchema=ap.FileSignedURL$outboundSchema})(ZAr||(ap.FileSignedURL$=ZAr={}));function k1o(t){return JSON.stringify(ap.FileSignedURL$outboundSchema.parse(t))}function q1o(t){return(0,F1o.safeParse)(t,e=>ap.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var nNr=S(vs=>{"use strict";var U1o=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]}),B1o=vs&&vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z1o=vs&&vs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U1o(r,e,n[o]);return B1o(r,e),r}}();Object.defineProperty(vs,"__esModule",{value:!0});vs.FIMCompletionRequest$=vs.FIMCompletionRequest$outboundSchema=vs.FIMCompletionRequest$inboundSchema=vs.FIMCompletionRequestStop$=vs.FIMCompletionRequestStop$outboundSchema=vs.FIMCompletionRequestStop$inboundSchema=void 0;vs.fimCompletionRequestStopToJSON=V1o;vs.fimCompletionRequestStopFromJSON=H1o;vs.fimCompletionRequestToJSON=W1o;vs.fimCompletionRequestFromJSON=J1o;var Oo=z1o(ae()),tNr=ce(),rNr=ee();vs.FIMCompletionRequestStop$inboundSchema=Oo.union([Oo.string(),Oo.array(Oo.string())]);vs.FIMCompletionRequestStop$outboundSchema=Oo.union([Oo.string(),Oo.array(Oo.string())]);var QAr;(function(t){t.inboundSchema=vs.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=vs.FIMCompletionRequestStop$outboundSchema})(QAr||(vs.FIMCompletionRequestStop$=QAr={}));function V1o(t){return JSON.stringify(vs.FIMCompletionRequestStop$outboundSchema.parse(t))}function H1o(t){return(0,rNr.safeParse)(t,e=>vs.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}vs.FIMCompletionRequest$inboundSchema=Oo.object({model:Oo.string(),temperature:Oo.nullable(Oo.number()).optional(),top_p:Oo.number().default(1),max_tokens:Oo.nullable(Oo.number().int()).optional(),stream:Oo.boolean().default(!1),stop:Oo.union([Oo.string(),Oo.array(Oo.string())]).optional(),random_seed:Oo.nullable(Oo.number().int()).optional(),prompt:Oo.string(),suffix:Oo.nullable(Oo.string()).optional(),min_tokens:Oo.nullable(Oo.number().int()).optional()}).transform(t=>(0,tNr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));vs.FIMCompletionRequest$outboundSchema=Oo.object({model:Oo.string(),temperature:Oo.nullable(Oo.number()).optional(),topP:Oo.number().default(1),maxTokens:Oo.nullable(Oo.number().int()).optional(),stream:Oo.boolean().default(!1),stop:Oo.union([Oo.string(),Oo.array(Oo.string())]).optional(),randomSeed:Oo.nullable(Oo.number().int()).optional(),prompt:Oo.string(),suffix:Oo.nullable(Oo.string()).optional(),minTokens:Oo.nullable(Oo.number().int()).optional()}).transform(t=>(0,tNr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var eNr;(function(t){t.inboundSchema=vs.FIMCompletionRequest$inboundSchema,t.outboundSchema=vs.FIMCompletionRequest$outboundSchema})(eNr||(vs.FIMCompletionRequest$=eNr={}));function W1o(t){return JSON.stringify(vs.FIMCompletionRequest$outboundSchema.parse(t))}function J1o(t){return(0,rNr.safeParse)(t,e=>vs.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var sNr=S(sp=>{"use strict";var K1o=sp&&sp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),G1o=sp&&sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X1o=sp&&sp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&K1o(r,e,n[o]);return G1o(r,e),r}}();Object.defineProperty(sp,"__esModule",{value:!0});sp.FIMCompletionResponse$=sp.FIMCompletionResponse$outboundSchema=sp.FIMCompletionResponse$inboundSchema=void 0;sp.fimCompletionResponseToJSON=Y1o;sp.fimCompletionResponseFromJSON=Q1o;var K0=X1o(ae()),Z1o=ee(),iNr=kRe(),aNr=oU();sp.FIMCompletionResponse$inboundSchema=K0.object({id:K0.string(),object:K0.string(),model:K0.string(),usage:aNr.UsageInfo$inboundSchema,created:K0.number().int(),choices:K0.array(iNr.ChatCompletionChoice$inboundSchema)});sp.FIMCompletionResponse$outboundSchema=K0.object({id:K0.string(),object:K0.string(),model:K0.string(),usage:aNr.UsageInfo$outboundSchema,created:K0.number().int(),choices:K0.array(iNr.ChatCompletionChoice$outboundSchema)});var oNr;(function(t){t.inboundSchema=sp.FIMCompletionResponse$inboundSchema,t.outboundSchema=sp.FIMCompletionResponse$outboundSchema})(oNr||(sp.FIMCompletionResponse$=oNr={}));function Y1o(t){return JSON.stringify(sp.FIMCompletionResponse$outboundSchema.parse(t))}function Q1o(t){return(0,Z1o.safeParse)(t,e=>sp.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var fNr=S(ws=>{"use strict";var eDo=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]}),tDo=ws&&ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rDo=ws&&ws.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eDo(r,e,n[o]);return tDo(r,e),r}}();Object.defineProperty(ws,"__esModule",{value:!0});ws.FIMCompletionStreamRequest$=ws.FIMCompletionStreamRequest$outboundSchema=ws.FIMCompletionStreamRequest$inboundSchema=ws.FIMCompletionStreamRequestStop$=ws.FIMCompletionStreamRequestStop$outboundSchema=ws.FIMCompletionStreamRequestStop$inboundSchema=void 0;ws.fimCompletionStreamRequestStopToJSON=nDo;ws.fimCompletionStreamRequestStopFromJSON=oDo;ws.fimCompletionStreamRequestToJSON=iDo;ws.fimCompletionStreamRequestFromJSON=aDo;var Eo=rDo(ae()),cNr=ce(),dNr=ee();ws.FIMCompletionStreamRequestStop$inboundSchema=Eo.union([Eo.string(),Eo.array(Eo.string())]);ws.FIMCompletionStreamRequestStop$outboundSchema=Eo.union([Eo.string(),Eo.array(Eo.string())]);var uNr;(function(t){t.inboundSchema=ws.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=ws.FIMCompletionStreamRequestStop$outboundSchema})(uNr||(ws.FIMCompletionStreamRequestStop$=uNr={}));function nDo(t){return JSON.stringify(ws.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function oDo(t){return(0,dNr.safeParse)(t,e=>ws.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}ws.FIMCompletionStreamRequest$inboundSchema=Eo.object({model:Eo.string(),temperature:Eo.nullable(Eo.number()).optional(),top_p:Eo.number().default(1),max_tokens:Eo.nullable(Eo.number().int()).optional(),stream:Eo.boolean().default(!0),stop:Eo.union([Eo.string(),Eo.array(Eo.string())]).optional(),random_seed:Eo.nullable(Eo.number().int()).optional(),prompt:Eo.string(),suffix:Eo.nullable(Eo.string()).optional(),min_tokens:Eo.nullable(Eo.number().int()).optional()}).transform(t=>(0,cNr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));ws.FIMCompletionStreamRequest$outboundSchema=Eo.object({model:Eo.string(),temperature:Eo.nullable(Eo.number()).optional(),topP:Eo.number().default(1),maxTokens:Eo.nullable(Eo.number().int()).optional(),stream:Eo.boolean().default(!0),stop:Eo.union([Eo.string(),Eo.array(Eo.string())]).optional(),randomSeed:Eo.nullable(Eo.number().int()).optional(),prompt:Eo.string(),suffix:Eo.nullable(Eo.string()).optional(),minTokens:Eo.nullable(Eo.number().int()).optional()}).transform(t=>(0,cNr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var lNr;(function(t){t.inboundSchema=ws.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=ws.FIMCompletionStreamRequest$outboundSchema})(lNr||(ws.FIMCompletionStreamRequest$=lNr={}));function iDo(t){return JSON.stringify(ws.FIMCompletionStreamRequest$outboundSchema.parse(t))}function aDo(t){return(0,dNr.safeParse)(t,e=>ws.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var Gct=S(up=>{"use strict";var sDo=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]}),uDo=up&&up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lDo=up&&up.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sDo(r,e,n[o]);return uDo(r,e),r}}();Object.defineProperty(up,"__esModule",{value:!0});up.FineTuneableModelType$=up.FineTuneableModelType$outboundSchema=up.FineTuneableModelType$inboundSchema=up.FineTuneableModelType=void 0;var cDo=lDo(ae());up.FineTuneableModelType={Completion:"completion",Classifier:"classifier"};up.FineTuneableModelType$inboundSchema=cDo.nativeEnum(up.FineTuneableModelType);up.FineTuneableModelType$outboundSchema=up.FineTuneableModelType$inboundSchema;var pNr;(function(t){t.inboundSchema=up.FineTuneableModelType$inboundSchema,t.outboundSchema=up.FineTuneableModelType$outboundSchema})(pNr||(up.FineTuneableModelType$=pNr={}))});var Xct=S(Ss=>{"use strict";var dDo=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]}),fDo=Ss&&Ss.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pDo=Ss&&Ss.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dDo(r,e,n[o]);return fDo(r,e),r}}();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.FTModelCard$=Ss.FTModelCard$outboundSchema=Ss.FTModelCard$inboundSchema=Ss.FTModelCardType$=Ss.FTModelCardType$outboundSchema=Ss.FTModelCardType$inboundSchema=Ss.FTModelCardType=void 0;Ss.ftModelCardToJSON=hDo;Ss.ftModelCardFromJSON=gDo;var $o=pDo(ae()),gNr=ce(),mDo=ee(),yNr=MRe();Ss.FTModelCardType={FineTuned:"fine-tuned"};Ss.FTModelCardType$inboundSchema=$o.nativeEnum(Ss.FTModelCardType);Ss.FTModelCardType$outboundSchema=Ss.FTModelCardType$inboundSchema;var mNr;(function(t){t.inboundSchema=Ss.FTModelCardType$inboundSchema,t.outboundSchema=Ss.FTModelCardType$outboundSchema})(mNr||(Ss.FTModelCardType$=mNr={}));Ss.FTModelCard$inboundSchema=$o.object({id:$o.string(),object:$o.string().default("model"),created:$o.number().int().optional(),owned_by:$o.string().default("mistralai"),capabilities:yNr.ModelCapabilities$inboundSchema,name:$o.nullable($o.string()).optional(),description:$o.nullable($o.string()).optional(),max_context_length:$o.number().int().default(32768),aliases:$o.array($o.string()).optional(),deprecation:$o.nullable($o.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:$o.nullable($o.string()).optional(),default_model_temperature:$o.nullable($o.number()).optional(),type:$o.literal("fine-tuned").default("fine-tuned"),job:$o.string(),root:$o.string(),archived:$o.boolean().default(!1)}).transform(t=>(0,gNr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));Ss.FTModelCard$outboundSchema=$o.object({id:$o.string(),object:$o.string().default("model"),created:$o.number().int().optional(),ownedBy:$o.string().default("mistralai"),capabilities:yNr.ModelCapabilities$outboundSchema,name:$o.nullable($o.string()).optional(),description:$o.nullable($o.string()).optional(),maxContextLength:$o.number().int().default(32768),aliases:$o.array($o.string()).optional(),deprecation:$o.nullable($o.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:$o.nullable($o.string()).optional(),defaultModelTemperature:$o.nullable($o.number()).optional(),type:$o.literal("fine-tuned").default("fine-tuned"),job:$o.string(),root:$o.string(),archived:$o.boolean().default(!1)}).transform(t=>(0,gNr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var hNr;(function(t){t.inboundSchema=Ss.FTModelCard$inboundSchema,t.outboundSchema=Ss.FTModelCard$outboundSchema})(hNr||(Ss.FTModelCard$=hNr={}));function hDo(t){return JSON.stringify(Ss.FTModelCard$outboundSchema.parse(t))}function gDo(t){return(0,mDo.safeParse)(t,e=>Ss.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var Zct=S(Ba=>{"use strict";var yDo=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]}),bDo=Ba&&Ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Do=Ba&&Ba.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yDo(r,e,n[o]);return bDo(r,e),r}}();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.GithubRepositoryIn$=Ba.GithubRepositoryIn$outboundSchema=Ba.GithubRepositoryIn$inboundSchema=Ba.GithubRepositoryInType$=Ba.GithubRepositoryInType$outboundSchema=Ba.GithubRepositoryInType$inboundSchema=Ba.GithubRepositoryInType=void 0;Ba.githubRepositoryInToJSON=wDo;Ba.githubRepositoryInFromJSON=SDo;var l_=_Do(ae()),vDo=ee();Ba.GithubRepositoryInType={Github:"github"};Ba.GithubRepositoryInType$inboundSchema=l_.nativeEnum(Ba.GithubRepositoryInType);Ba.GithubRepositoryInType$outboundSchema=Ba.GithubRepositoryInType$inboundSchema;var bNr;(function(t){t.inboundSchema=Ba.GithubRepositoryInType$inboundSchema,t.outboundSchema=Ba.GithubRepositoryInType$outboundSchema})(bNr||(Ba.GithubRepositoryInType$=bNr={}));Ba.GithubRepositoryIn$inboundSchema=l_.object({type:Ba.GithubRepositoryInType$inboundSchema.default("github"),name:l_.string(),owner:l_.string(),ref:l_.nullable(l_.string()).optional(),weight:l_.number().default(1),token:l_.string()});Ba.GithubRepositoryIn$outboundSchema=l_.object({type:Ba.GithubRepositoryInType$outboundSchema.default("github"),name:l_.string(),owner:l_.string(),ref:l_.nullable(l_.string()).optional(),weight:l_.number().default(1),token:l_.string()});var _Nr;(function(t){t.inboundSchema=Ba.GithubRepositoryIn$inboundSchema,t.outboundSchema=Ba.GithubRepositoryIn$outboundSchema})(_Nr||(Ba.GithubRepositoryIn$=_Nr={}));function wDo(t){return JSON.stringify(Ba.GithubRepositoryIn$outboundSchema.parse(t))}function SDo(t){return(0,vDo.safeParse)(t,e=>Ba.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var Yct=S(lp=>{"use strict";var CDo=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]}),xDo=lp&&lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TDo=lp&&lp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CDo(r,e,n[o]);return xDo(r,e),r}}();Object.defineProperty(lp,"__esModule",{value:!0});lp.TrainingFile$=lp.TrainingFile$outboundSchema=lp.TrainingFile$inboundSchema=void 0;lp.trainingFileToJSON=EDo;lp.trainingFileFromJSON=PDo;var C7=TDo(ae()),wNr=ce(),ODo=ee();lp.TrainingFile$inboundSchema=C7.object({file_id:C7.string(),weight:C7.number().default(1)}).transform(t=>(0,wNr.remap)(t,{file_id:"fileId"}));lp.TrainingFile$outboundSchema=C7.object({fileId:C7.string(),weight:C7.number().default(1)}).transform(t=>(0,wNr.remap)(t,{fileId:"file_id"}));var vNr;(function(t){t.inboundSchema=lp.TrainingFile$inboundSchema,t.outboundSchema=lp.TrainingFile$outboundSchema})(vNr||(lp.TrainingFile$=vNr={}));function EDo(t){return JSON.stringify(lp.TrainingFile$outboundSchema.parse(t))}function PDo(t){return(0,ODo.safeParse)(t,e=>lp.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var Qct=S(za=>{"use strict";var MDo=za&&za.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RDo=za&&za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IDo=za&&za.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MDo(r,e,n[o]);return RDo(r,e),r}}();Object.defineProperty(za,"__esModule",{value:!0});za.WandbIntegration$=za.WandbIntegration$outboundSchema=za.WandbIntegration$inboundSchema=za.WandbIntegrationType$=za.WandbIntegrationType$outboundSchema=za.WandbIntegrationType$inboundSchema=za.WandbIntegrationType=void 0;za.wandbIntegrationToJSON=NDo;za.wandbIntegrationFromJSON=DDo;var c_=IDo(ae()),xNr=ce(),ADo=ee();za.WandbIntegrationType={Wandb:"wandb"};za.WandbIntegrationType$inboundSchema=c_.nativeEnum(za.WandbIntegrationType);za.WandbIntegrationType$outboundSchema=za.WandbIntegrationType$inboundSchema;var SNr;(function(t){t.inboundSchema=za.WandbIntegrationType$inboundSchema,t.outboundSchema=za.WandbIntegrationType$outboundSchema})(SNr||(za.WandbIntegrationType$=SNr={}));za.WandbIntegration$inboundSchema=c_.object({type:za.WandbIntegrationType$inboundSchema.default("wandb"),project:c_.string(),name:c_.nullable(c_.string()).optional(),api_key:c_.string(),run_name:c_.nullable(c_.string()).optional()}).transform(t=>(0,xNr.remap)(t,{api_key:"apiKey",run_name:"runName"}));za.WandbIntegration$outboundSchema=c_.object({type:za.WandbIntegrationType$outboundSchema.default("wandb"),project:c_.string(),name:c_.nullable(c_.string()).optional(),apiKey:c_.string(),runName:c_.nullable(c_.string()).optional()}).transform(t=>(0,xNr.remap)(t,{apiKey:"api_key",runName:"run_name"}));var CNr;(function(t){t.inboundSchema=za.WandbIntegration$inboundSchema,t.outboundSchema=za.WandbIntegration$outboundSchema})(CNr||(za.WandbIntegration$=CNr={}));function NDo(t){return JSON.stringify(za.WandbIntegration$outboundSchema.parse(t))}function DDo(t){return(0,ADo.safeParse)(t,e=>za.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var NNr=S(rn=>{"use strict";var jDo=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Do=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LDo=rn&&rn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jDo(r,e,n[o]);return $Do(r,e),r}}();Object.defineProperty(rn,"__esModule",{value:!0});rn.JobIn$=rn.JobIn$outboundSchema=rn.JobIn$inboundSchema=rn.JobInRepositories$=rn.JobInRepositories$outboundSchema=rn.JobInRepositories$inboundSchema=rn.Hyperparameters$=rn.Hyperparameters$outboundSchema=rn.Hyperparameters$inboundSchema=rn.JobInIntegrations$=rn.JobInIntegrations$outboundSchema=rn.JobInIntegrations$inboundSchema=void 0;rn.jobInIntegrationsToJSON=FDo;rn.jobInIntegrationsFromJSON=kDo;rn.hyperparametersToJSON=qDo;rn.hyperparametersFromJSON=UDo;rn.jobInRepositoriesToJSON=BDo;rn.jobInRepositoriesFromJSON=zDo;rn.jobInToJSON=VDo;rn.jobInFromJSON=HDo;var Ri=LDo(ae()),MNr=ce(),nAe=ee(),RNr=vct(),oAe=wct(),iAe=Pct(),INr=Gct(),aAe=Zct(),ANr=Yct(),sAe=Qct();rn.JobInIntegrations$inboundSchema=sAe.WandbIntegration$inboundSchema;rn.JobInIntegrations$outboundSchema=sAe.WandbIntegration$outboundSchema;var TNr;(function(t){t.inboundSchema=rn.JobInIntegrations$inboundSchema,t.outboundSchema=rn.JobInIntegrations$outboundSchema})(TNr||(rn.JobInIntegrations$=TNr={}));function FDo(t){return JSON.stringify(rn.JobInIntegrations$outboundSchema.parse(t))}function kDo(t){return(0,nAe.safeParse)(t,e=>rn.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}rn.Hyperparameters$inboundSchema=Ri.union([iAe.CompletionTrainingParametersIn$inboundSchema,oAe.ClassifierTrainingParametersIn$inboundSchema]);rn.Hyperparameters$outboundSchema=Ri.union([iAe.CompletionTrainingParametersIn$outboundSchema,oAe.ClassifierTrainingParametersIn$outboundSchema]);var ONr;(function(t){t.inboundSchema=rn.Hyperparameters$inboundSchema,t.outboundSchema=rn.Hyperparameters$outboundSchema})(ONr||(rn.Hyperparameters$=ONr={}));function qDo(t){return JSON.stringify(rn.Hyperparameters$outboundSchema.parse(t))}function UDo(t){return(0,nAe.safeParse)(t,e=>rn.Hyperparameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Hyperparameters' from JSON")}rn.JobInRepositories$inboundSchema=aAe.GithubRepositoryIn$inboundSchema;rn.JobInRepositories$outboundSchema=aAe.GithubRepositoryIn$outboundSchema;var ENr;(function(t){t.inboundSchema=rn.JobInRepositories$inboundSchema,t.outboundSchema=rn.JobInRepositories$outboundSchema})(ENr||(rn.JobInRepositories$=ENr={}));function BDo(t){return JSON.stringify(rn.JobInRepositories$outboundSchema.parse(t))}function zDo(t){return(0,nAe.safeParse)(t,e=>rn.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}rn.JobIn$inboundSchema=Ri.object({model:Ri.string(),training_files:Ri.array(ANr.TrainingFile$inboundSchema).optional(),validation_files:Ri.nullable(Ri.array(Ri.string())).optional(),suffix:Ri.nullable(Ri.string()).optional(),integrations:Ri.nullable(Ri.array(sAe.WandbIntegration$inboundSchema)).optional(),auto_start:Ri.boolean().optional(),invalid_sample_skip_percentage:Ri.number().default(0),job_type:Ri.nullable(INr.FineTuneableModelType$inboundSchema).optional(),hyperparameters:Ri.union([iAe.CompletionTrainingParametersIn$inboundSchema,oAe.ClassifierTrainingParametersIn$inboundSchema]),repositories:Ri.nullable(Ri.array(aAe.GithubRepositoryIn$inboundSchema)).optional(),classifier_targets:Ri.nullable(Ri.array(RNr.ClassifierTargetIn$inboundSchema)).optional()}).transform(t=>(0,MNr.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart",invalid_sample_skip_percentage:"invalidSampleSkipPercentage",job_type:"jobType",classifier_targets:"classifierTargets"}));rn.JobIn$outboundSchema=Ri.object({model:Ri.string(),trainingFiles:Ri.array(ANr.TrainingFile$outboundSchema).optional(),validationFiles:Ri.nullable(Ri.array(Ri.string())).optional(),suffix:Ri.nullable(Ri.string()).optional(),integrations:Ri.nullable(Ri.array(sAe.WandbIntegration$outboundSchema)).optional(),autoStart:Ri.boolean().optional(),invalidSampleSkipPercentage:Ri.number().default(0),jobType:Ri.nullable(INr.FineTuneableModelType$outboundSchema).optional(),hyperparameters:Ri.union([iAe.CompletionTrainingParametersIn$outboundSchema,oAe.ClassifierTrainingParametersIn$outboundSchema]),repositories:Ri.nullable(Ri.array(aAe.GithubRepositoryIn$outboundSchema)).optional(),classifierTargets:Ri.nullable(Ri.array(RNr.ClassifierTargetIn$outboundSchema)).optional()}).transform(t=>(0,MNr.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start",invalidSampleSkipPercentage:"invalid_sample_skip_percentage",jobType:"job_type",classifierTargets:"classifier_targets"}));var PNr;(function(t){t.inboundSchema=rn.JobIn$inboundSchema,t.outboundSchema=rn.JobIn$outboundSchema})(PNr||(rn.JobIn$=PNr={}));function VDo(t){return JSON.stringify(rn.JobIn$outboundSchema.parse(t))}function HDo(t){return(0,nAe.safeParse)(t,e=>rn.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var FNr=S(Po=>{"use strict";var WDo=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]}),JDo=Po&&Po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KDo=Po&&Po.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WDo(r,e,n[o]);return JDo(r,e),r}}();Object.defineProperty(Po,"__esModule",{value:!0});Po.JobsOut$=Po.JobsOut$outboundSchema=Po.JobsOut$inboundSchema=Po.JobsOutObject$=Po.JobsOutObject$outboundSchema=Po.JobsOutObject$inboundSchema=Po.JobsOutData$=Po.JobsOutData$outboundSchema=Po.JobsOutData$inboundSchema=Po.JobsOutObject=void 0;Po.jobsOutDataToJSON=GDo;Po.jobsOutDataFromJSON=XDo;Po.jobsOutToJSON=ZDo;Po.jobsOutFromJSON=YDo;var qu=KDo(ae()),LNr=ee(),uAe=_ct(),lAe=Ect();Po.JobsOutObject={List:"list"};Po.JobsOutData$inboundSchema=qu.union([uAe.ClassifierJobOut$inboundSchema.and(qu.object({job_type:qu.literal("classifier")}).transform(t=>({jobType:t.job_type}))),lAe.CompletionJobOut$inboundSchema.and(qu.object({job_type:qu.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Po.JobsOutData$outboundSchema=qu.union([uAe.ClassifierJobOut$outboundSchema.and(qu.object({jobType:qu.literal("classifier")}).transform(t=>({job_type:t.jobType}))),lAe.CompletionJobOut$outboundSchema.and(qu.object({jobType:qu.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var DNr;(function(t){t.inboundSchema=Po.JobsOutData$inboundSchema,t.outboundSchema=Po.JobsOutData$outboundSchema})(DNr||(Po.JobsOutData$=DNr={}));function GDo(t){return JSON.stringify(Po.JobsOutData$outboundSchema.parse(t))}function XDo(t){return(0,LNr.safeParse)(t,e=>Po.JobsOutData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOutData' from JSON")}Po.JobsOutObject$inboundSchema=qu.nativeEnum(Po.JobsOutObject);Po.JobsOutObject$outboundSchema=Po.JobsOutObject$inboundSchema;var jNr;(function(t){t.inboundSchema=Po.JobsOutObject$inboundSchema,t.outboundSchema=Po.JobsOutObject$outboundSchema})(jNr||(Po.JobsOutObject$=jNr={}));Po.JobsOut$inboundSchema=qu.object({data:qu.array(qu.union([uAe.ClassifierJobOut$inboundSchema.and(qu.object({job_type:qu.literal("classifier")}).transform(t=>({jobType:t.job_type}))),lAe.CompletionJobOut$inboundSchema.and(qu.object({job_type:qu.literal("completion")}).transform(t=>({jobType:t.job_type})))])).optional(),object:Po.JobsOutObject$inboundSchema.default("list"),total:qu.number().int()});Po.JobsOut$outboundSchema=qu.object({data:qu.array(qu.union([uAe.ClassifierJobOut$outboundSchema.and(qu.object({jobType:qu.literal("classifier")}).transform(t=>({job_type:t.jobType}))),lAe.CompletionJobOut$outboundSchema.and(qu.object({jobType:qu.literal("completion")}).transform(t=>({job_type:t.jobType})))])).optional(),object:Po.JobsOutObject$outboundSchema.default("list"),total:qu.number().int()});var $Nr;(function(t){t.inboundSchema=Po.JobsOut$inboundSchema,t.outboundSchema=Po.JobsOut$outboundSchema})($Nr||(Po.JobsOut$=$Nr={}));function ZDo(t){return JSON.stringify(Po.JobsOut$outboundSchema.parse(t))}function YDo(t){return(0,LNr.safeParse)(t,e=>Po.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var BNr=S(Va=>{"use strict";var QDo=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]}),ejo=Va&&Va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tjo=Va&&Va.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QDo(r,e,n[o]);return ejo(r,e),r}}();Object.defineProperty(Va,"__esModule",{value:!0});Va.LegacyJobMetadataOut$=Va.LegacyJobMetadataOut$outboundSchema=Va.LegacyJobMetadataOut$inboundSchema=Va.LegacyJobMetadataOutObject$=Va.LegacyJobMetadataOutObject$outboundSchema=Va.LegacyJobMetadataOutObject$inboundSchema=Va.LegacyJobMetadataOutObject=void 0;Va.legacyJobMetadataOutToJSON=njo;Va.legacyJobMetadataOutFromJSON=ojo;var Bo=tjo(ae()),UNr=ce(),rjo=ee();Va.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Va.LegacyJobMetadataOutObject$inboundSchema=Bo.nativeEnum(Va.LegacyJobMetadataOutObject);Va.LegacyJobMetadataOutObject$outboundSchema=Va.LegacyJobMetadataOutObject$inboundSchema;var kNr;(function(t){t.inboundSchema=Va.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Va.LegacyJobMetadataOutObject$outboundSchema})(kNr||(Va.LegacyJobMetadataOutObject$=kNr={}));Va.LegacyJobMetadataOut$inboundSchema=Bo.object({expected_duration_seconds:Bo.nullable(Bo.number().int()).optional(),cost:Bo.nullable(Bo.number()).optional(),cost_currency:Bo.nullable(Bo.string()).optional(),train_tokens_per_step:Bo.nullable(Bo.number().int()).optional(),train_tokens:Bo.nullable(Bo.number().int()).optional(),data_tokens:Bo.nullable(Bo.number().int()).optional(),estimated_start_time:Bo.nullable(Bo.number().int()).optional(),deprecated:Bo.boolean().default(!0),details:Bo.string(),epochs:Bo.nullable(Bo.number()).optional(),training_steps:Bo.nullable(Bo.number().int()).optional(),object:Va.LegacyJobMetadataOutObject$inboundSchema.default("job.metadata")}).transform(t=>(0,UNr.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"}));Va.LegacyJobMetadataOut$outboundSchema=Bo.object({expectedDurationSeconds:Bo.nullable(Bo.number().int()).optional(),cost:Bo.nullable(Bo.number()).optional(),costCurrency:Bo.nullable(Bo.string()).optional(),trainTokensPerStep:Bo.nullable(Bo.number().int()).optional(),trainTokens:Bo.nullable(Bo.number().int()).optional(),dataTokens:Bo.nullable(Bo.number().int()).optional(),estimatedStartTime:Bo.nullable(Bo.number().int()).optional(),deprecated:Bo.boolean().default(!0),details:Bo.string(),epochs:Bo.nullable(Bo.number()).optional(),trainingSteps:Bo.nullable(Bo.number().int()).optional(),object:Va.LegacyJobMetadataOutObject$outboundSchema.default("job.metadata")}).transform(t=>(0,UNr.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 qNr;(function(t){t.inboundSchema=Va.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Va.LegacyJobMetadataOut$outboundSchema})(qNr||(Va.LegacyJobMetadataOut$=qNr={}));function njo(t){return JSON.stringify(Va.LegacyJobMetadataOut$outboundSchema.parse(t))}function ojo(t){return(0,rjo.safeParse)(t,e=>Va.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var HNr=S(cp=>{"use strict";var ijo=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]}),ajo=cp&&cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sjo=cp&&cp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ijo(r,e,n[o]);return ajo(r,e),r}}();Object.defineProperty(cp,"__esModule",{value:!0});cp.LibraryIn$=cp.LibraryIn$outboundSchema=cp.LibraryIn$inboundSchema=void 0;cp.libraryInToJSON=ljo;cp.libraryInFromJSON=cjo;var G0=sjo(ae()),VNr=ce(),ujo=ee();cp.LibraryIn$inboundSchema=G0.object({name:G0.string(),description:G0.nullable(G0.string()).optional(),chunk_size:G0.nullable(G0.number().int()).optional()}).transform(t=>(0,VNr.remap)(t,{chunk_size:"chunkSize"}));cp.LibraryIn$outboundSchema=G0.object({name:G0.string(),description:G0.nullable(G0.string()).optional(),chunkSize:G0.nullable(G0.number().int()).optional()}).transform(t=>(0,VNr.remap)(t,{chunkSize:"chunk_size"}));var zNr;(function(t){t.inboundSchema=cp.LibraryIn$inboundSchema,t.outboundSchema=cp.LibraryIn$outboundSchema})(zNr||(cp.LibraryIn$=zNr={}));function ljo(t){return JSON.stringify(cp.LibraryIn$outboundSchema.parse(t))}function cjo(t){return(0,ujo.safeParse)(t,e=>cp.LibraryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryIn' from JSON")}});var JNr=S(dp=>{"use strict";var djo=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]}),fjo=dp&&dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pjo=dp&&dp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&djo(r,e,n[o]);return fjo(r,e),r}}();Object.defineProperty(dp,"__esModule",{value:!0});dp.LibraryInUpdate$=dp.LibraryInUpdate$outboundSchema=dp.LibraryInUpdate$inboundSchema=void 0;dp.libraryInUpdateToJSON=hjo;dp.libraryInUpdateFromJSON=gjo;var kA=pjo(ae()),mjo=ee();dp.LibraryInUpdate$inboundSchema=kA.object({name:kA.nullable(kA.string()).optional(),description:kA.nullable(kA.string()).optional()});dp.LibraryInUpdate$outboundSchema=kA.object({name:kA.nullable(kA.string()).optional(),description:kA.nullable(kA.string()).optional()});var WNr;(function(t){t.inboundSchema=dp.LibraryInUpdate$inboundSchema,t.outboundSchema=dp.LibraryInUpdate$outboundSchema})(WNr||(dp.LibraryInUpdate$=WNr={}));function hjo(t){return JSON.stringify(dp.LibraryInUpdate$outboundSchema.parse(t))}function gjo(t){return(0,mjo.safeParse)(t,e=>dp.LibraryInUpdate$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryInUpdate' from JSON")}});var edt=S(fp=>{"use strict";var yjo=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]}),bjo=fp&&fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_jo=fp&&fp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yjo(r,e,n[o]);return bjo(r,e),r}}();Object.defineProperty(fp,"__esModule",{value:!0});fp.LibraryOut$=fp.LibraryOut$outboundSchema=fp.LibraryOut$inboundSchema=void 0;fp.libraryOutToJSON=wjo;fp.libraryOutFromJSON=Sjo;var jn=_jo(ae()),GNr=ce(),vjo=ee();fp.LibraryOut$inboundSchema=jn.object({id:jn.string(),name:jn.string(),created_at:jn.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:jn.string().datetime({offset:!0}).transform(t=>new Date(t)),owner_id:jn.string(),owner_type:jn.string(),total_size:jn.number().int(),nb_documents:jn.number().int(),chunk_size:jn.nullable(jn.number().int()),emoji:jn.nullable(jn.string()).optional(),description:jn.nullable(jn.string()).optional(),generated_name:jn.nullable(jn.string()).optional(),generated_description:jn.nullable(jn.string()).optional(),explicit_user_members_count:jn.nullable(jn.number().int()).optional(),explicit_workspace_members_count:jn.nullable(jn.number().int()).optional(),org_sharing_role:jn.nullable(jn.string()).optional()}).transform(t=>(0,GNr.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",owner_id:"ownerId",owner_type:"ownerType",total_size:"totalSize",nb_documents:"nbDocuments",chunk_size:"chunkSize",generated_name:"generatedName",generated_description:"generatedDescription",explicit_user_members_count:"explicitUserMembersCount",explicit_workspace_members_count:"explicitWorkspaceMembersCount",org_sharing_role:"orgSharingRole"}));fp.LibraryOut$outboundSchema=jn.object({id:jn.string(),name:jn.string(),createdAt:jn.date().transform(t=>t.toISOString()),updatedAt:jn.date().transform(t=>t.toISOString()),ownerId:jn.string(),ownerType:jn.string(),totalSize:jn.number().int(),nbDocuments:jn.number().int(),chunkSize:jn.nullable(jn.number().int()),emoji:jn.nullable(jn.string()).optional(),description:jn.nullable(jn.string()).optional(),generatedName:jn.nullable(jn.string()).optional(),generatedDescription:jn.nullable(jn.string()).optional(),explicitUserMembersCount:jn.nullable(jn.number().int()).optional(),explicitWorkspaceMembersCount:jn.nullable(jn.number().int()).optional(),orgSharingRole:jn.nullable(jn.string()).optional()}).transform(t=>(0,GNr.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",ownerId:"owner_id",ownerType:"owner_type",totalSize:"total_size",nbDocuments:"nb_documents",chunkSize:"chunk_size",generatedName:"generated_name",generatedDescription:"generated_description",explicitUserMembersCount:"explicit_user_members_count",explicitWorkspaceMembersCount:"explicit_workspace_members_count",orgSharingRole:"org_sharing_role"}));var KNr;(function(t){t.inboundSchema=fp.LibraryOut$inboundSchema,t.outboundSchema=fp.LibraryOut$outboundSchema})(KNr||(fp.LibraryOut$=KNr={}));function wjo(t){return JSON.stringify(fp.LibraryOut$outboundSchema.parse(t))}function Sjo(t){return(0,vjo.safeParse)(t,e=>fp.LibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryOut' from JSON")}});var tdt=S(pp=>{"use strict";var Cjo=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]}),xjo=pp&&pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tjo=pp&&pp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Cjo(r,e,n[o]);return xjo(r,e),r}}();Object.defineProperty(pp,"__esModule",{value:!0});pp.PaginationInfo$=pp.PaginationInfo$outboundSchema=pp.PaginationInfo$inboundSchema=void 0;pp.paginationInfoToJSON=Ejo;pp.paginationInfoFromJSON=Pjo;var X0=Tjo(ae()),ZNr=ce(),Ojo=ee();pp.PaginationInfo$inboundSchema=X0.object({total_items:X0.number().int(),total_pages:X0.number().int(),current_page:X0.number().int(),page_size:X0.number().int(),has_more:X0.boolean()}).transform(t=>(0,ZNr.remap)(t,{total_items:"totalItems",total_pages:"totalPages",current_page:"currentPage",page_size:"pageSize",has_more:"hasMore"}));pp.PaginationInfo$outboundSchema=X0.object({totalItems:X0.number().int(),totalPages:X0.number().int(),currentPage:X0.number().int(),pageSize:X0.number().int(),hasMore:X0.boolean()}).transform(t=>(0,ZNr.remap)(t,{totalItems:"total_items",totalPages:"total_pages",currentPage:"current_page",pageSize:"page_size",hasMore:"has_more"}));var XNr;(function(t){t.inboundSchema=pp.PaginationInfo$inboundSchema,t.outboundSchema=pp.PaginationInfo$outboundSchema})(XNr||(pp.PaginationInfo$=XNr={}));function Ejo(t){return JSON.stringify(pp.PaginationInfo$outboundSchema.parse(t))}function Pjo(t){return(0,Ojo.safeParse)(t,e=>pp.PaginationInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'PaginationInfo' from JSON")}});var t1r=S(mp=>{"use strict";var Mjo=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]}),Rjo=mp&&mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ijo=mp&&mp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mjo(r,e,n[o]);return Rjo(r,e),r}}();Object.defineProperty(mp,"__esModule",{value:!0});mp.ListDocumentOut$=mp.ListDocumentOut$outboundSchema=mp.ListDocumentOut$inboundSchema=void 0;mp.listDocumentOutToJSON=Njo;mp.listDocumentOutFromJSON=Djo;var cAe=Ijo(ae()),Ajo=ee(),QNr=Vct(),e1r=tdt();mp.ListDocumentOut$inboundSchema=cAe.object({pagination:e1r.PaginationInfo$inboundSchema,data:cAe.array(QNr.DocumentOut$inboundSchema)});mp.ListDocumentOut$outboundSchema=cAe.object({pagination:e1r.PaginationInfo$outboundSchema,data:cAe.array(QNr.DocumentOut$outboundSchema)});var YNr;(function(t){t.inboundSchema=mp.ListDocumentOut$inboundSchema,t.outboundSchema=mp.ListDocumentOut$outboundSchema})(YNr||(mp.ListDocumentOut$=YNr={}));function Njo(t){return JSON.stringify(mp.ListDocumentOut$outboundSchema.parse(t))}function Djo(t){return(0,Ajo.safeParse)(t,e=>mp.ListDocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListDocumentOut' from JSON")}});var o1r=S(hp=>{"use strict";var jjo=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]}),$jo=hp&&hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ljo=hp&&hp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jjo(r,e,n[o]);return $jo(r,e),r}}();Object.defineProperty(hp,"__esModule",{value:!0});hp.ListFilesOut$=hp.ListFilesOut$outboundSchema=hp.ListFilesOut$inboundSchema=void 0;hp.listFilesOutToJSON=kjo;hp.listFilesOutFromJSON=qjo;var lU=Ljo(ae()),Fjo=ee(),n1r=Kct();hp.ListFilesOut$inboundSchema=lU.object({data:lU.array(n1r.FileSchema$inboundSchema),object:lU.string(),total:lU.number().int()});hp.ListFilesOut$outboundSchema=lU.object({data:lU.array(n1r.FileSchema$outboundSchema),object:lU.string(),total:lU.number().int()});var r1r;(function(t){t.inboundSchema=hp.ListFilesOut$inboundSchema,t.outboundSchema=hp.ListFilesOut$outboundSchema})(r1r||(hp.ListFilesOut$=r1r={}));function kjo(t){return JSON.stringify(hp.ListFilesOut$outboundSchema.parse(t))}function qjo(t){return(0,Fjo.safeParse)(t,e=>hp.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var s1r=S(gp=>{"use strict";var Ujo=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]}),Bjo=gp&&gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zjo=gp&&gp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Ujo(r,e,n[o]);return Bjo(r,e),r}}();Object.defineProperty(gp,"__esModule",{value:!0});gp.ListLibraryOut$=gp.ListLibraryOut$outboundSchema=gp.ListLibraryOut$inboundSchema=void 0;gp.listLibraryOutToJSON=Hjo;gp.listLibraryOutFromJSON=Wjo;var dAe=zjo(ae()),Vjo=ee(),a1r=edt();gp.ListLibraryOut$inboundSchema=dAe.object({data:dAe.array(a1r.LibraryOut$inboundSchema)});gp.ListLibraryOut$outboundSchema=dAe.object({data:dAe.array(a1r.LibraryOut$outboundSchema)});var i1r;(function(t){t.inboundSchema=gp.ListLibraryOut$inboundSchema,t.outboundSchema=gp.ListLibraryOut$outboundSchema})(i1r||(gp.ListLibraryOut$=i1r={}));function Hjo(t){return JSON.stringify(gp.ListLibraryOut$outboundSchema.parse(t))}function Wjo(t){return(0,Vjo.safeParse)(t,e=>gp.ListLibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListLibraryOut' from JSON")}});var rdt=S(yp=>{"use strict";var Jjo=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]}),Kjo=yp&&yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gjo=yp&&yp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Jjo(r,e,n[o]);return Kjo(r,e),r}}();Object.defineProperty(yp,"__esModule",{value:!0});yp.SharingOut$=yp.SharingOut$outboundSchema=yp.SharingOut$inboundSchema=void 0;yp.sharingOutToJSON=Zjo;yp.sharingOutFromJSON=Yjo;var lb=Gjo(ae()),l1r=ce(),Xjo=ee();yp.SharingOut$inboundSchema=lb.object({library_id:lb.string(),user_id:lb.nullable(lb.string()).optional(),org_id:lb.string(),role:lb.string(),share_with_type:lb.string(),share_with_uuid:lb.string()}).transform(t=>(0,l1r.remap)(t,{library_id:"libraryId",user_id:"userId",org_id:"orgId",share_with_type:"shareWithType",share_with_uuid:"shareWithUuid"}));yp.SharingOut$outboundSchema=lb.object({libraryId:lb.string(),userId:lb.nullable(lb.string()).optional(),orgId:lb.string(),role:lb.string(),shareWithType:lb.string(),shareWithUuid:lb.string()}).transform(t=>(0,l1r.remap)(t,{libraryId:"library_id",userId:"user_id",orgId:"org_id",shareWithType:"share_with_type",shareWithUuid:"share_with_uuid"}));var u1r;(function(t){t.inboundSchema=yp.SharingOut$inboundSchema,t.outboundSchema=yp.SharingOut$outboundSchema})(u1r||(yp.SharingOut$=u1r={}));function Zjo(t){return JSON.stringify(yp.SharingOut$outboundSchema.parse(t))}function Yjo(t){return(0,Xjo.safeParse)(t,e=>yp.SharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingOut' from JSON")}});var f1r=S(bp=>{"use strict";var Qjo=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]}),e$o=bp&&bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t$o=bp&&bp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qjo(r,e,n[o]);return e$o(r,e),r}}();Object.defineProperty(bp,"__esModule",{value:!0});bp.ListSharingOut$=bp.ListSharingOut$outboundSchema=bp.ListSharingOut$inboundSchema=void 0;bp.listSharingOutToJSON=n$o;bp.listSharingOutFromJSON=o$o;var fAe=t$o(ae()),r$o=ee(),d1r=rdt();bp.ListSharingOut$inboundSchema=fAe.object({data:fAe.array(d1r.SharingOut$inboundSchema)});bp.ListSharingOut$outboundSchema=fAe.object({data:fAe.array(d1r.SharingOut$outboundSchema)});var c1r;(function(t){t.inboundSchema=bp.ListSharingOut$inboundSchema,t.outboundSchema=bp.ListSharingOut$outboundSchema})(c1r||(bp.ListSharingOut$=c1r={}));function n$o(t){return JSON.stringify(bp.ListSharingOut$outboundSchema.parse(t))}function o$o(t){return(0,r$o.safeParse)(t,e=>bp.ListSharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListSharingOut' from JSON")}});var _1r=S(Mo=>{"use strict";var i$o=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]}),a$o=Mo&&Mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s$o=Mo&&Mo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i$o(r,e,n[o]);return a$o(r,e),r}}();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ModelConversation$=Mo.ModelConversation$outboundSchema=Mo.ModelConversation$inboundSchema=Mo.ModelConversationObject$=Mo.ModelConversationObject$outboundSchema=Mo.ModelConversationObject$inboundSchema=Mo.ModelConversationTools$=Mo.ModelConversationTools$outboundSchema=Mo.ModelConversationTools$inboundSchema=Mo.ModelConversationObject=void 0;Mo.modelConversationToolsToJSON=u$o;Mo.modelConversationToolsFromJSON=l$o;Mo.modelConversationToJSON=c$o;Mo.modelConversationFromJSON=d$o;var Xt=s$o(ae()),g1r=ce(),y1r=ee(),pAe=Jq(),b1r=L0(),mAe=Xq(),hAe=Zq(),gAe=Yq(),yAe=Qq(),bAe=eU();Mo.ModelConversationObject={Conversation:"conversation"};Mo.ModelConversationTools$inboundSchema=Xt.union([mAe.DocumentLibraryTool$inboundSchema.and(Xt.object({type:Xt.literal("document_library")}).transform(t=>({type:t.type}))),hAe.FunctionTool$inboundSchema.and(Xt.object({type:Xt.literal("function")}).transform(t=>({type:t.type}))),pAe.CodeInterpreterTool$inboundSchema.and(Xt.object({type:Xt.literal("code_interpreter")}).transform(t=>({type:t.type}))),gAe.ImageGenerationTool$inboundSchema.and(Xt.object({type:Xt.literal("image_generation")}).transform(t=>({type:t.type}))),bAe.WebSearchTool$inboundSchema.and(Xt.object({type:Xt.literal("web_search")}).transform(t=>({type:t.type}))),yAe.WebSearchPremiumTool$inboundSchema.and(Xt.object({type:Xt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);Mo.ModelConversationTools$outboundSchema=Xt.union([mAe.DocumentLibraryTool$outboundSchema.and(Xt.object({type:Xt.literal("document_library")}).transform(t=>({type:t.type}))),hAe.FunctionTool$outboundSchema.and(Xt.object({type:Xt.literal("function")}).transform(t=>({type:t.type}))),pAe.CodeInterpreterTool$outboundSchema.and(Xt.object({type:Xt.literal("code_interpreter")}).transform(t=>({type:t.type}))),gAe.ImageGenerationTool$outboundSchema.and(Xt.object({type:Xt.literal("image_generation")}).transform(t=>({type:t.type}))),bAe.WebSearchTool$outboundSchema.and(Xt.object({type:Xt.literal("web_search")}).transform(t=>({type:t.type}))),yAe.WebSearchPremiumTool$outboundSchema.and(Xt.object({type:Xt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var p1r;(function(t){t.inboundSchema=Mo.ModelConversationTools$inboundSchema,t.outboundSchema=Mo.ModelConversationTools$outboundSchema})(p1r||(Mo.ModelConversationTools$=p1r={}));function u$o(t){return JSON.stringify(Mo.ModelConversationTools$outboundSchema.parse(t))}function l$o(t){return(0,y1r.safeParse)(t,e=>Mo.ModelConversationTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversationTools' from JSON")}Mo.ModelConversationObject$inboundSchema=Xt.nativeEnum(Mo.ModelConversationObject);Mo.ModelConversationObject$outboundSchema=Mo.ModelConversationObject$inboundSchema;var m1r;(function(t){t.inboundSchema=Mo.ModelConversationObject$inboundSchema,t.outboundSchema=Mo.ModelConversationObject$outboundSchema})(m1r||(Mo.ModelConversationObject$=m1r={}));Mo.ModelConversation$inboundSchema=Xt.object({instructions:Xt.nullable(Xt.string()).optional(),tools:Xt.array(Xt.union([mAe.DocumentLibraryTool$inboundSchema.and(Xt.object({type:Xt.literal("document_library")}).transform(t=>({type:t.type}))),hAe.FunctionTool$inboundSchema.and(Xt.object({type:Xt.literal("function")}).transform(t=>({type:t.type}))),pAe.CodeInterpreterTool$inboundSchema.and(Xt.object({type:Xt.literal("code_interpreter")}).transform(t=>({type:t.type}))),gAe.ImageGenerationTool$inboundSchema.and(Xt.object({type:Xt.literal("image_generation")}).transform(t=>({type:t.type}))),bAe.WebSearchTool$inboundSchema.and(Xt.object({type:Xt.literal("web_search")}).transform(t=>({type:t.type}))),yAe.WebSearchPremiumTool$inboundSchema.and(Xt.object({type:Xt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:b1r.CompletionArgs$inboundSchema.optional(),name:Xt.nullable(Xt.string()).optional(),description:Xt.nullable(Xt.string()).optional(),object:Mo.ModelConversationObject$inboundSchema.default("conversation"),id:Xt.string(),created_at:Xt.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Xt.string().datetime({offset:!0}).transform(t=>new Date(t)),model:Xt.string()}).transform(t=>(0,g1r.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));Mo.ModelConversation$outboundSchema=Xt.object({instructions:Xt.nullable(Xt.string()).optional(),tools:Xt.array(Xt.union([mAe.DocumentLibraryTool$outboundSchema.and(Xt.object({type:Xt.literal("document_library")}).transform(t=>({type:t.type}))),hAe.FunctionTool$outboundSchema.and(Xt.object({type:Xt.literal("function")}).transform(t=>({type:t.type}))),pAe.CodeInterpreterTool$outboundSchema.and(Xt.object({type:Xt.literal("code_interpreter")}).transform(t=>({type:t.type}))),gAe.ImageGenerationTool$outboundSchema.and(Xt.object({type:Xt.literal("image_generation")}).transform(t=>({type:t.type}))),bAe.WebSearchTool$outboundSchema.and(Xt.object({type:Xt.literal("web_search")}).transform(t=>({type:t.type}))),yAe.WebSearchPremiumTool$outboundSchema.and(Xt.object({type:Xt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:b1r.CompletionArgs$outboundSchema.optional(),name:Xt.nullable(Xt.string()).optional(),description:Xt.nullable(Xt.string()).optional(),object:Mo.ModelConversationObject$outboundSchema.default("conversation"),id:Xt.string(),createdAt:Xt.date().transform(t=>t.toISOString()),updatedAt:Xt.date().transform(t=>t.toISOString()),model:Xt.string()}).transform(t=>(0,g1r.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var h1r;(function(t){t.inboundSchema=Mo.ModelConversation$inboundSchema,t.outboundSchema=Mo.ModelConversation$outboundSchema})(h1r||(Mo.ModelConversation$=h1r={}));function c$o(t){return JSON.stringify(Mo.ModelConversation$outboundSchema.parse(t))}function d$o(t){return(0,y1r.safeParse)(t,e=>Mo.ModelConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversation' from JSON")}});var C1r=S(Cs=>{"use strict";var f$o=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]}),p$o=Cs&&Cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m$o=Cs&&Cs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f$o(r,e,n[o]);return p$o(r,e),r}}();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ModelList$=Cs.ModelList$outboundSchema=Cs.ModelList$inboundSchema=Cs.Data$=Cs.Data$outboundSchema=Cs.Data$inboundSchema=void 0;Cs.dataToJSON=h$o;Cs.dataFromJSON=g$o;Cs.modelListToJSON=y$o;Cs.modelListFromJSON=b$o;var nl=m$o(ae()),S1r=ee(),_Ae=cct(),vAe=Xct();Cs.Data$inboundSchema=nl.union([vAe.FTModelCard$inboundSchema.and(nl.object({type:nl.literal("fine-tuned")}).transform(t=>({type:t.type}))),_Ae.BaseModelCard$inboundSchema.and(nl.object({type:nl.literal("base")}).transform(t=>({type:t.type})))]);Cs.Data$outboundSchema=nl.union([vAe.FTModelCard$outboundSchema.and(nl.object({type:nl.literal("fine-tuned")}).transform(t=>({type:t.type}))),_Ae.BaseModelCard$outboundSchema.and(nl.object({type:nl.literal("base")}).transform(t=>({type:t.type})))]);var v1r;(function(t){t.inboundSchema=Cs.Data$inboundSchema,t.outboundSchema=Cs.Data$outboundSchema})(v1r||(Cs.Data$=v1r={}));function h$o(t){return JSON.stringify(Cs.Data$outboundSchema.parse(t))}function g$o(t){return(0,S1r.safeParse)(t,e=>Cs.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Cs.ModelList$inboundSchema=nl.object({object:nl.string().default("list"),data:nl.array(nl.union([vAe.FTModelCard$inboundSchema.and(nl.object({type:nl.literal("fine-tuned")}).transform(t=>({type:t.type}))),_Ae.BaseModelCard$inboundSchema.and(nl.object({type:nl.literal("base")}).transform(t=>({type:t.type})))])).optional()});Cs.ModelList$outboundSchema=nl.object({object:nl.string().default("list"),data:nl.array(nl.union([vAe.FTModelCard$outboundSchema.and(nl.object({type:nl.literal("fine-tuned")}).transform(t=>({type:t.type}))),_Ae.BaseModelCard$outboundSchema.and(nl.object({type:nl.literal("base")}).transform(t=>({type:t.type})))])).optional()});var w1r;(function(t){t.inboundSchema=Cs.ModelList$inboundSchema,t.outboundSchema=Cs.ModelList$outboundSchema})(w1r||(Cs.ModelList$=w1r={}));function y$o(t){return JSON.stringify(Cs.ModelList$outboundSchema.parse(t))}function b$o(t){return(0,S1r.safeParse)(t,e=>Cs.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var ndt=S(_p=>{"use strict";var _$o=_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]}),v$o=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w$o=_p&&_p.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_$o(r,e,n[o]);return v$o(r,e),r}}();Object.defineProperty(_p,"__esModule",{value:!0});_p.ModerationObject$=_p.ModerationObject$outboundSchema=_p.ModerationObject$inboundSchema=void 0;_p.moderationObjectToJSON=C$o;_p.moderationObjectFromJSON=x$o;var qA=w$o(ae()),T1r=ce(),S$o=ee();_p.ModerationObject$inboundSchema=qA.object({categories:qA.record(qA.boolean()).optional(),category_scores:qA.record(qA.number()).optional()}).transform(t=>(0,T1r.remap)(t,{category_scores:"categoryScores"}));_p.ModerationObject$outboundSchema=qA.object({categories:qA.record(qA.boolean()).optional(),categoryScores:qA.record(qA.number()).optional()}).transform(t=>(0,T1r.remap)(t,{categoryScores:"category_scores"}));var x1r;(function(t){t.inboundSchema=_p.ModerationObject$inboundSchema,t.outboundSchema=_p.ModerationObject$outboundSchema})(x1r||(_p.ModerationObject$=x1r={}));function C$o(t){return JSON.stringify(_p.ModerationObject$outboundSchema.parse(t))}function x$o(t){return(0,S$o.safeParse)(t,e=>_p.ModerationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationObject' from JSON")}});var P1r=S(vp=>{"use strict";var T$o=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]}),O$o=vp&&vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E$o=vp&&vp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T$o(r,e,n[o]);return O$o(r,e),r}}();Object.defineProperty(vp,"__esModule",{value:!0});vp.ModerationResponse$=vp.ModerationResponse$outboundSchema=vp.ModerationResponse$inboundSchema=void 0;vp.moderationResponseToJSON=M$o;vp.moderationResponseFromJSON=R$o;var cU=E$o(ae()),P$o=ee(),E1r=ndt();vp.ModerationResponse$inboundSchema=cU.object({id:cU.string(),model:cU.string(),results:cU.array(E1r.ModerationObject$inboundSchema)});vp.ModerationResponse$outboundSchema=cU.object({id:cU.string(),model:cU.string(),results:cU.array(E1r.ModerationObject$outboundSchema)});var O1r;(function(t){t.inboundSchema=vp.ModerationResponse$inboundSchema,t.outboundSchema=vp.ModerationResponse$outboundSchema})(O1r||(vp.ModerationResponse$=O1r={}));function M$o(t){return JSON.stringify(vp.ModerationResponse$outboundSchema.parse(t))}function R$o(t){return(0,P$o.safeParse)(t,e=>vp.ModerationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationResponse' from JSON")}});var odt=S(wp=>{"use strict";var I$o=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]}),A$o=wp&&wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N$o=wp&&wp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I$o(r,e,n[o]);return A$o(r,e),r}}();Object.defineProperty(wp,"__esModule",{value:!0});wp.OCRImageObject$=wp.OCRImageObject$outboundSchema=wp.OCRImageObject$inboundSchema=void 0;wp.ocrImageObjectToJSON=j$o;wp.ocrImageObjectFromJSON=$$o;var Cu=N$o(ae()),R1r=ce(),D$o=ee();wp.OCRImageObject$inboundSchema=Cu.object({id:Cu.string(),top_left_x:Cu.nullable(Cu.number().int()),top_left_y:Cu.nullable(Cu.number().int()),bottom_right_x:Cu.nullable(Cu.number().int()),bottom_right_y:Cu.nullable(Cu.number().int()),image_base64:Cu.nullable(Cu.string()).optional(),image_annotation:Cu.nullable(Cu.string()).optional()}).transform(t=>(0,R1r.remap)(t,{top_left_x:"topLeftX",top_left_y:"topLeftY",bottom_right_x:"bottomRightX",bottom_right_y:"bottomRightY",image_base64:"imageBase64",image_annotation:"imageAnnotation"}));wp.OCRImageObject$outboundSchema=Cu.object({id:Cu.string(),topLeftX:Cu.nullable(Cu.number().int()),topLeftY:Cu.nullable(Cu.number().int()),bottomRightX:Cu.nullable(Cu.number().int()),bottomRightY:Cu.nullable(Cu.number().int()),imageBase64:Cu.nullable(Cu.string()).optional(),imageAnnotation:Cu.nullable(Cu.string()).optional()}).transform(t=>(0,R1r.remap)(t,{topLeftX:"top_left_x",topLeftY:"top_left_y",bottomRightX:"bottom_right_x",bottomRightY:"bottom_right_y",imageBase64:"image_base64",imageAnnotation:"image_annotation"}));var M1r;(function(t){t.inboundSchema=wp.OCRImageObject$inboundSchema,t.outboundSchema=wp.OCRImageObject$outboundSchema})(M1r||(wp.OCRImageObject$=M1r={}));function j$o(t){return JSON.stringify(wp.OCRImageObject$outboundSchema.parse(t))}function $$o(t){return(0,D$o.safeParse)(t,e=>wp.OCRImageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRImageObject' from JSON")}});var idt=S(Sp=>{"use strict";var L$o=Sp&&Sp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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$o=Sp&&Sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k$o=Sp&&Sp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&L$o(r,e,n[o]);return F$o(r,e),r}}();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.OCRPageDimensions$=Sp.OCRPageDimensions$outboundSchema=Sp.OCRPageDimensions$inboundSchema=void 0;Sp.ocrPageDimensionsToJSON=U$o;Sp.ocrPageDimensionsFromJSON=B$o;var dU=k$o(ae()),q$o=ee();Sp.OCRPageDimensions$inboundSchema=dU.object({dpi:dU.number().int(),height:dU.number().int(),width:dU.number().int()});Sp.OCRPageDimensions$outboundSchema=dU.object({dpi:dU.number().int(),height:dU.number().int(),width:dU.number().int()});var I1r;(function(t){t.inboundSchema=Sp.OCRPageDimensions$inboundSchema,t.outboundSchema=Sp.OCRPageDimensions$outboundSchema})(I1r||(Sp.OCRPageDimensions$=I1r={}));function U$o(t){return JSON.stringify(Sp.OCRPageDimensions$outboundSchema.parse(t))}function B$o(t){return(0,q$o.safeParse)(t,e=>Sp.OCRPageDimensions$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageDimensions' from JSON")}});var adt=S(Cp=>{"use strict";var z$o=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]}),V$o=Cp&&Cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H$o=Cp&&Cp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z$o(r,e,n[o]);return V$o(r,e),r}}();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.OCRPageObject$=Cp.OCRPageObject$outboundSchema=Cp.OCRPageObject$inboundSchema=void 0;Cp.ocrPageObjectToJSON=J$o;Cp.ocrPageObjectFromJSON=K$o;var UA=H$o(ae()),W$o=ee(),N1r=odt(),D1r=idt();Cp.OCRPageObject$inboundSchema=UA.object({index:UA.number().int(),markdown:UA.string(),images:UA.array(N1r.OCRImageObject$inboundSchema),dimensions:UA.nullable(D1r.OCRPageDimensions$inboundSchema)});Cp.OCRPageObject$outboundSchema=UA.object({index:UA.number().int(),markdown:UA.string(),images:UA.array(N1r.OCRImageObject$outboundSchema),dimensions:UA.nullable(D1r.OCRPageDimensions$outboundSchema)});var A1r;(function(t){t.inboundSchema=Cp.OCRPageObject$inboundSchema,t.outboundSchema=Cp.OCRPageObject$outboundSchema})(A1r||(Cp.OCRPageObject$=A1r={}));function J$o(t){return JSON.stringify(Cp.OCRPageObject$outboundSchema.parse(t))}function K$o(t){return(0,W$o.safeParse)(t,e=>Cp.OCRPageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageObject' from JSON")}});var k1r=S(xs=>{"use strict";var G$o=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]}),X$o=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z$o=xs&&xs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&G$o(r,e,n[o]);return X$o(r,e),r}}();Object.defineProperty(xs,"__esModule",{value:!0});xs.OCRRequest$=xs.OCRRequest$outboundSchema=xs.OCRRequest$inboundSchema=xs.Document$=xs.Document$outboundSchema=xs.Document$inboundSchema=void 0;xs.documentToJSON=Y$o;xs.documentFromJSON=Q$o;xs.ocrRequestToJSON=eLo;xs.ocrRequestFromJSON=tLo;var Ha=Z$o(ae()),L1r=ce(),F1r=ee(),SAe=o3(),CAe=XMe(),xAe=i3(),wAe=Gq();xs.Document$inboundSchema=Ha.union([CAe.FileChunk$inboundSchema,SAe.DocumentURLChunk$inboundSchema,xAe.ImageURLChunk$inboundSchema]);xs.Document$outboundSchema=Ha.union([CAe.FileChunk$outboundSchema,SAe.DocumentURLChunk$outboundSchema,xAe.ImageURLChunk$outboundSchema]);var j1r;(function(t){t.inboundSchema=xs.Document$inboundSchema,t.outboundSchema=xs.Document$outboundSchema})(j1r||(xs.Document$=j1r={}));function Y$o(t){return JSON.stringify(xs.Document$outboundSchema.parse(t))}function Q$o(t){return(0,F1r.safeParse)(t,e=>xs.Document$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Document' from JSON")}xs.OCRRequest$inboundSchema=Ha.object({model:Ha.nullable(Ha.string()),id:Ha.string().optional(),document:Ha.union([CAe.FileChunk$inboundSchema,SAe.DocumentURLChunk$inboundSchema,xAe.ImageURLChunk$inboundSchema]),pages:Ha.nullable(Ha.array(Ha.number().int())).optional(),include_image_base64:Ha.nullable(Ha.boolean()).optional(),image_limit:Ha.nullable(Ha.number().int()).optional(),image_min_size:Ha.nullable(Ha.number().int()).optional(),bbox_annotation_format:Ha.nullable(wAe.ResponseFormat$inboundSchema).optional(),document_annotation_format:Ha.nullable(wAe.ResponseFormat$inboundSchema).optional()}).transform(t=>(0,L1r.remap)(t,{include_image_base64:"includeImageBase64",image_limit:"imageLimit",image_min_size:"imageMinSize",bbox_annotation_format:"bboxAnnotationFormat",document_annotation_format:"documentAnnotationFormat"}));xs.OCRRequest$outboundSchema=Ha.object({model:Ha.nullable(Ha.string()),id:Ha.string().optional(),document:Ha.union([CAe.FileChunk$outboundSchema,SAe.DocumentURLChunk$outboundSchema,xAe.ImageURLChunk$outboundSchema]),pages:Ha.nullable(Ha.array(Ha.number().int())).optional(),includeImageBase64:Ha.nullable(Ha.boolean()).optional(),imageLimit:Ha.nullable(Ha.number().int()).optional(),imageMinSize:Ha.nullable(Ha.number().int()).optional(),bboxAnnotationFormat:Ha.nullable(wAe.ResponseFormat$outboundSchema).optional(),documentAnnotationFormat:Ha.nullable(wAe.ResponseFormat$outboundSchema).optional()}).transform(t=>(0,L1r.remap)(t,{includeImageBase64:"include_image_base64",imageLimit:"image_limit",imageMinSize:"image_min_size",bboxAnnotationFormat:"bbox_annotation_format",documentAnnotationFormat:"document_annotation_format"}));var $1r;(function(t){t.inboundSchema=xs.OCRRequest$inboundSchema,t.outboundSchema=xs.OCRRequest$outboundSchema})($1r||(xs.OCRRequest$=$1r={}));function eLo(t){return JSON.stringify(xs.OCRRequest$outboundSchema.parse(t))}function tLo(t){return(0,F1r.safeParse)(t,e=>xs.OCRRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRRequest' from JSON")}});var sdt=S(xp=>{"use strict";var rLo=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]}),nLo=xp&&xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oLo=xp&&xp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rLo(r,e,n[o]);return nLo(r,e),r}}();Object.defineProperty(xp,"__esModule",{value:!0});xp.OCRUsageInfo$=xp.OCRUsageInfo$outboundSchema=xp.OCRUsageInfo$inboundSchema=void 0;xp.ocrUsageInfoToJSON=aLo;xp.ocrUsageInfoFromJSON=sLo;var fU=oLo(ae()),U1r=ce(),iLo=ee();xp.OCRUsageInfo$inboundSchema=fU.object({pages_processed:fU.number().int(),doc_size_bytes:fU.nullable(fU.number().int()).optional()}).transform(t=>(0,U1r.remap)(t,{pages_processed:"pagesProcessed",doc_size_bytes:"docSizeBytes"}));xp.OCRUsageInfo$outboundSchema=fU.object({pagesProcessed:fU.number().int(),docSizeBytes:fU.nullable(fU.number().int()).optional()}).transform(t=>(0,U1r.remap)(t,{pagesProcessed:"pages_processed",docSizeBytes:"doc_size_bytes"}));var q1r;(function(t){t.inboundSchema=xp.OCRUsageInfo$inboundSchema,t.outboundSchema=xp.OCRUsageInfo$outboundSchema})(q1r||(xp.OCRUsageInfo$=q1r={}));function aLo(t){return JSON.stringify(xp.OCRUsageInfo$outboundSchema.parse(t))}function sLo(t){return(0,iLo.safeParse)(t,e=>xp.OCRUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRUsageInfo' from JSON")}});var W1r=S(Tp=>{"use strict";var uLo=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]}),lLo=Tp&&Tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cLo=Tp&&Tp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uLo(r,e,n[o]);return lLo(r,e),r}}();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.OCRResponse$=Tp.OCRResponse$outboundSchema=Tp.OCRResponse$inboundSchema=void 0;Tp.ocrResponseToJSON=fLo;Tp.ocrResponseFromJSON=pLo;var BA=cLo(ae()),z1r=ce(),dLo=ee(),V1r=adt(),H1r=sdt();Tp.OCRResponse$inboundSchema=BA.object({pages:BA.array(V1r.OCRPageObject$inboundSchema),model:BA.string(),document_annotation:BA.nullable(BA.string()).optional(),usage_info:H1r.OCRUsageInfo$inboundSchema}).transform(t=>(0,z1r.remap)(t,{document_annotation:"documentAnnotation",usage_info:"usageInfo"}));Tp.OCRResponse$outboundSchema=BA.object({pages:BA.array(V1r.OCRPageObject$outboundSchema),model:BA.string(),documentAnnotation:BA.nullable(BA.string()).optional(),usageInfo:H1r.OCRUsageInfo$outboundSchema}).transform(t=>(0,z1r.remap)(t,{documentAnnotation:"document_annotation",usageInfo:"usage_info"}));var B1r;(function(t){t.inboundSchema=Tp.OCRResponse$inboundSchema,t.outboundSchema=Tp.OCRResponse$outboundSchema})(B1r||(Tp.OCRResponse$=B1r={}));function fLo(t){return JSON.stringify(Tp.OCRResponse$outboundSchema.parse(t))}function pLo(t){return(0,dLo.safeParse)(t,e=>Tp.OCRResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRResponse' from JSON")}});var G1r=S(Op=>{"use strict";var mLo=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]}),hLo=Op&&Op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gLo=Op&&Op.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mLo(r,e,n[o]);return hLo(r,e),r}}();Object.defineProperty(Op,"__esModule",{value:!0});Op.ProcessingStatusOut$=Op.ProcessingStatusOut$outboundSchema=Op.ProcessingStatusOut$inboundSchema=void 0;Op.processingStatusOutToJSON=bLo;Op.processingStatusOutFromJSON=_Lo;var x7=gLo(ae()),K1r=ce(),yLo=ee();Op.ProcessingStatusOut$inboundSchema=x7.object({document_id:x7.string(),processing_status:x7.string()}).transform(t=>(0,K1r.remap)(t,{document_id:"documentId",processing_status:"processingStatus"}));Op.ProcessingStatusOut$outboundSchema=x7.object({documentId:x7.string(),processingStatus:x7.string()}).transform(t=>(0,K1r.remap)(t,{documentId:"document_id",processingStatus:"processing_status"}));var J1r;(function(t){t.inboundSchema=Op.ProcessingStatusOut$inboundSchema,t.outboundSchema=Op.ProcessingStatusOut$outboundSchema})(J1r||(Op.ProcessingStatusOut$=J1r={}));function bLo(t){return JSON.stringify(Op.ProcessingStatusOut$outboundSchema.parse(t))}function _Lo(t){return(0,yLo.safeParse)(t,e=>Op.ProcessingStatusOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ProcessingStatusOut' from JSON")}});var tDr=S(Ep=>{"use strict";var vLo=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]}),wLo=Ep&&Ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SLo=Ep&&Ep.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vLo(r,e,n[o]);return wLo(r,e),r}}();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.RetrieveFileOut$=Ep.RetrieveFileOut$outboundSchema=Ep.RetrieveFileOut$inboundSchema=void 0;Ep.retrieveFileOutToJSON=xLo;Ep.retrieveFileOutFromJSON=TLo;var ol=SLo(ae()),Z1r=ce(),CLo=ee(),Y1r=qse(),Q1r=Use(),eDr=Bse();Ep.RetrieveFileOut$inboundSchema=ol.object({id:ol.string(),object:ol.string(),bytes:ol.number().int(),created_at:ol.number().int(),filename:ol.string(),purpose:Y1r.FilePurpose$inboundSchema,sample_type:Q1r.SampleType$inboundSchema,num_lines:ol.nullable(ol.number().int()).optional(),mimetype:ol.nullable(ol.string()).optional(),source:eDr.Source$inboundSchema,signature:ol.nullable(ol.string()).optional(),deleted:ol.boolean()}).transform(t=>(0,Z1r.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Ep.RetrieveFileOut$outboundSchema=ol.object({id:ol.string(),object:ol.string(),sizeBytes:ol.number().int(),createdAt:ol.number().int(),filename:ol.string(),purpose:Y1r.FilePurpose$outboundSchema,sampleType:Q1r.SampleType$outboundSchema,numLines:ol.nullable(ol.number().int()).optional(),mimetype:ol.nullable(ol.string()).optional(),source:eDr.Source$outboundSchema,signature:ol.nullable(ol.string()).optional(),deleted:ol.boolean()}).transform(t=>(0,Z1r.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var X1r;(function(t){t.inboundSchema=Ep.RetrieveFileOut$inboundSchema,t.outboundSchema=Ep.RetrieveFileOut$outboundSchema})(X1r||(Ep.RetrieveFileOut$=X1r={}));function xLo(t){return JSON.stringify(Ep.RetrieveFileOut$outboundSchema.parse(t))}function TLo(t){return(0,CLo.safeParse)(t,e=>Ep.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var oDr=S(Pp=>{"use strict";var OLo=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]}),ELo=Pp&&Pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PLo=Pp&&Pp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OLo(r,e,n[o]);return ELo(r,e),r}}();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.Security$=Pp.Security$outboundSchema=Pp.Security$inboundSchema=void 0;Pp.securityToJSON=RLo;Pp.securityFromJSON=ILo;var TAe=PLo(ae()),nDr=ce(),MLo=ee();Pp.Security$inboundSchema=TAe.object({ApiKey:TAe.string().optional()}).transform(t=>(0,nDr.remap)(t,{ApiKey:"apiKey"}));Pp.Security$outboundSchema=TAe.object({apiKey:TAe.string().optional()}).transform(t=>(0,nDr.remap)(t,{apiKey:"ApiKey"}));var rDr;(function(t){t.inboundSchema=Pp.Security$inboundSchema,t.outboundSchema=Pp.Security$outboundSchema})(rDr||(Pp.Security$=rDr={}));function RLo(t){return JSON.stringify(Pp.Security$outboundSchema.parse(t))}function ILo(t){return(0,MLo.safeParse)(t,e=>Pp.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var udt=S(Mp=>{"use strict";var ALo=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]}),NLo=Mp&&Mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DLo=Mp&&Mp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ALo(r,e,n[o]);return NLo(r,e),r}}();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.ShareEnum$=Mp.ShareEnum$outboundSchema=Mp.ShareEnum$inboundSchema=Mp.ShareEnum=void 0;var w3=DLo(ae()),jLo=Gx();Mp.ShareEnum={Viewer:"Viewer",Editor:"Editor"};Mp.ShareEnum$inboundSchema=w3.union([w3.nativeEnum(Mp.ShareEnum),w3.string().transform(jLo.catchUnrecognizedEnum)]);Mp.ShareEnum$outboundSchema=w3.union([w3.nativeEnum(Mp.ShareEnum),w3.string().and(w3.custom())]);var iDr;(function(t){t.inboundSchema=Mp.ShareEnum$inboundSchema,t.outboundSchema=Mp.ShareEnum$outboundSchema})(iDr||(Mp.ShareEnum$=iDr={}))});var lDr=S(Rp=>{"use strict";var $Lo=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]}),LLo=Rp&&Rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FLo=Rp&&Rp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Lo(r,e,n[o]);return LLo(r,e),r}}();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.SharingDelete$=Rp.SharingDelete$outboundSchema=Rp.SharingDelete$inboundSchema=void 0;Rp.sharingDeleteToJSON=qLo;Rp.sharingDeleteFromJSON=ULo;var T7=FLo(ae()),sDr=ce(),kLo=ee(),uDr=tAe();Rp.SharingDelete$inboundSchema=T7.object({org_id:T7.string(),share_with_uuid:T7.string(),share_with_type:uDr.EntityType$inboundSchema}).transform(t=>(0,sDr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));Rp.SharingDelete$outboundSchema=T7.object({orgId:T7.string(),shareWithUuid:T7.string(),shareWithType:uDr.EntityType$outboundSchema}).transform(t=>(0,sDr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var aDr;(function(t){t.inboundSchema=Rp.SharingDelete$inboundSchema,t.outboundSchema=Rp.SharingDelete$outboundSchema})(aDr||(Rp.SharingDelete$=aDr={}));function qLo(t){return JSON.stringify(Rp.SharingDelete$outboundSchema.parse(t))}function ULo(t){return(0,kLo.safeParse)(t,e=>Rp.SharingDelete$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingDelete' from JSON")}});var mDr=S(Ip=>{"use strict";var BLo=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]}),zLo=Ip&&Ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VLo=Ip&&Ip.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BLo(r,e,n[o]);return zLo(r,e),r}}();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.SharingIn$=Ip.SharingIn$outboundSchema=Ip.SharingIn$inboundSchema=void 0;Ip.sharingInToJSON=WLo;Ip.sharingInFromJSON=JLo;var O7=VLo(ae()),dDr=ce(),HLo=ee(),fDr=tAe(),pDr=udt();Ip.SharingIn$inboundSchema=O7.object({org_id:O7.string(),level:pDr.ShareEnum$inboundSchema,share_with_uuid:O7.string(),share_with_type:fDr.EntityType$inboundSchema}).transform(t=>(0,dDr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));Ip.SharingIn$outboundSchema=O7.object({orgId:O7.string(),level:pDr.ShareEnum$outboundSchema,shareWithUuid:O7.string(),shareWithType:fDr.EntityType$outboundSchema}).transform(t=>(0,dDr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var cDr;(function(t){t.inboundSchema=Ip.SharingIn$inboundSchema,t.outboundSchema=Ip.SharingIn$outboundSchema})(cDr||(Ip.SharingIn$=cDr={}));function WLo(t){return JSON.stringify(Ip.SharingIn$outboundSchema.parse(t))}function JLo(t){return(0,HLo.safeParse)(t,e=>Ip.SharingIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingIn' from JSON")}});var OAe=S(Wa=>{"use strict";var KLo=Wa&&Wa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GLo=Wa&&Wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XLo=Wa&&Wa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&KLo(r,e,n[o]);return GLo(r,e),r}}();Object.defineProperty(Wa,"__esModule",{value:!0});Wa.TranscriptionSegmentChunk$=Wa.TranscriptionSegmentChunk$outboundSchema=Wa.TranscriptionSegmentChunk$inboundSchema=Wa.Type$=Wa.Type$outboundSchema=Wa.Type$inboundSchema=Wa.Type=void 0;Wa.transcriptionSegmentChunkToJSON=YLo;Wa.transcriptionSegmentChunkFromJSON=QLo;var Z0=XLo(ae()),ZLo=ce(),yDr=ee();Wa.Type={TranscriptionSegment:"transcription_segment"};Wa.Type$inboundSchema=Z0.nativeEnum(Wa.Type);Wa.Type$outboundSchema=Wa.Type$inboundSchema;var hDr;(function(t){t.inboundSchema=Wa.Type$inboundSchema,t.outboundSchema=Wa.Type$outboundSchema})(hDr||(Wa.Type$=hDr={}));Wa.TranscriptionSegmentChunk$inboundSchema=(0,yDr.collectExtraKeys)(Z0.object({text:Z0.string(),start:Z0.number(),end:Z0.number(),type:Wa.Type$inboundSchema.default("transcription_segment")}).catchall(Z0.any()),"additionalProperties",!0);Wa.TranscriptionSegmentChunk$outboundSchema=Z0.object({text:Z0.string(),start:Z0.number(),end:Z0.number(),type:Wa.Type$outboundSchema.default("transcription_segment"),additionalProperties:Z0.record(Z0.any())}).transform(t=>({...t.additionalProperties,...(0,ZLo.remap)(t,{additionalProperties:null})}));var gDr;(function(t){t.inboundSchema=Wa.TranscriptionSegmentChunk$inboundSchema,t.outboundSchema=Wa.TranscriptionSegmentChunk$outboundSchema})(gDr||(Wa.TranscriptionSegmentChunk$=gDr={}));function YLo(t){return JSON.stringify(Wa.TranscriptionSegmentChunk$outboundSchema.parse(t))}function QLo(t){return(0,yDr.safeParse)(t,e=>Wa.TranscriptionSegmentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionSegmentChunk' from JSON")}});var SDr=S(Ap=>{"use strict";var eFo=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]}),tFo=Ap&&Ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rFo=Ap&&Ap.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eFo(r,e,n[o]);return tFo(r,e),r}}();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.TranscriptionResponse$=Ap.TranscriptionResponse$outboundSchema=Ap.TranscriptionResponse$inboundSchema=void 0;Ap.transcriptionResponseToJSON=oFo;Ap.transcriptionResponseFromJSON=iFo;var d_=rFo(ae()),nFo=ce(),_Dr=ee(),vDr=OAe(),wDr=oU();Ap.TranscriptionResponse$inboundSchema=(0,_Dr.collectExtraKeys)(d_.object({model:d_.string(),text:d_.string(),segments:d_.array(vDr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:wDr.UsageInfo$inboundSchema,language:d_.nullable(d_.string())}).catchall(d_.any()),"additionalProperties",!0);Ap.TranscriptionResponse$outboundSchema=d_.object({model:d_.string(),text:d_.string(),segments:d_.array(vDr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:wDr.UsageInfo$outboundSchema,language:d_.nullable(d_.string()),additionalProperties:d_.record(d_.any())}).transform(t=>({...t.additionalProperties,...(0,nFo.remap)(t,{additionalProperties:null})}));var bDr;(function(t){t.inboundSchema=Ap.TranscriptionResponse$inboundSchema,t.outboundSchema=Ap.TranscriptionResponse$outboundSchema})(bDr||(Ap.TranscriptionResponse$=bDr={}));function oFo(t){return JSON.stringify(Ap.TranscriptionResponse$outboundSchema.parse(t))}function iFo(t){return(0,_Dr.safeParse)(t,e=>Ap.TranscriptionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionResponse' from JSON")}});var ldt=S(Ja=>{"use strict";var aFo=Ja&&Ja.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sFo=Ja&&Ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uFo=Ja&&Ja.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aFo(r,e,n[o]);return sFo(r,e),r}}();Object.defineProperty(Ja,"__esModule",{value:!0});Ja.TranscriptionStreamDone$=Ja.TranscriptionStreamDone$outboundSchema=Ja.TranscriptionStreamDone$inboundSchema=Ja.TranscriptionStreamDoneType$=Ja.TranscriptionStreamDoneType$outboundSchema=Ja.TranscriptionStreamDoneType$inboundSchema=Ja.TranscriptionStreamDoneType=void 0;Ja.transcriptionStreamDoneToJSON=cFo;Ja.transcriptionStreamDoneFromJSON=dFo;var cb=uFo(ae()),lFo=ce(),TDr=ee(),ODr=OAe(),EDr=oU();Ja.TranscriptionStreamDoneType={TranscriptionDone:"transcription.done"};Ja.TranscriptionStreamDoneType$inboundSchema=cb.nativeEnum(Ja.TranscriptionStreamDoneType);Ja.TranscriptionStreamDoneType$outboundSchema=Ja.TranscriptionStreamDoneType$inboundSchema;var CDr;(function(t){t.inboundSchema=Ja.TranscriptionStreamDoneType$inboundSchema,t.outboundSchema=Ja.TranscriptionStreamDoneType$outboundSchema})(CDr||(Ja.TranscriptionStreamDoneType$=CDr={}));Ja.TranscriptionStreamDone$inboundSchema=(0,TDr.collectExtraKeys)(cb.object({model:cb.string(),text:cb.string(),segments:cb.array(ODr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:EDr.UsageInfo$inboundSchema,type:Ja.TranscriptionStreamDoneType$inboundSchema.default("transcription.done"),language:cb.nullable(cb.string())}).catchall(cb.any()),"additionalProperties",!0);Ja.TranscriptionStreamDone$outboundSchema=cb.object({model:cb.string(),text:cb.string(),segments:cb.array(ODr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:EDr.UsageInfo$outboundSchema,type:Ja.TranscriptionStreamDoneType$outboundSchema.default("transcription.done"),language:cb.nullable(cb.string()),additionalProperties:cb.record(cb.any())}).transform(t=>({...t.additionalProperties,...(0,lFo.remap)(t,{additionalProperties:null})}));var xDr;(function(t){t.inboundSchema=Ja.TranscriptionStreamDone$inboundSchema,t.outboundSchema=Ja.TranscriptionStreamDone$outboundSchema})(xDr||(Ja.TranscriptionStreamDone$=xDr={}));function cFo(t){return JSON.stringify(Ja.TranscriptionStreamDone$outboundSchema.parse(t))}function dFo(t){return(0,TDr.safeParse)(t,e=>Ja.TranscriptionStreamDone$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamDone' from JSON")}});var cdt=S(Np=>{"use strict";var fFo=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]}),pFo=Np&&Np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mFo=Np&&Np.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fFo(r,e,n[o]);return pFo(r,e),r}}();Object.defineProperty(Np,"__esModule",{value:!0});Np.TranscriptionStreamEventTypes$=Np.TranscriptionStreamEventTypes$outboundSchema=Np.TranscriptionStreamEventTypes$inboundSchema=Np.TranscriptionStreamEventTypes=void 0;var hFo=mFo(ae());Np.TranscriptionStreamEventTypes={TranscriptionLanguage:"transcription.language",TranscriptionSegment:"transcription.segment",TranscriptionTextDelta:"transcription.text.delta",TranscriptionDone:"transcription.done"};Np.TranscriptionStreamEventTypes$inboundSchema=hFo.nativeEnum(Np.TranscriptionStreamEventTypes);Np.TranscriptionStreamEventTypes$outboundSchema=Np.TranscriptionStreamEventTypes$inboundSchema;var PDr;(function(t){t.inboundSchema=Np.TranscriptionStreamEventTypes$inboundSchema,t.outboundSchema=Np.TranscriptionStreamEventTypes$outboundSchema})(PDr||(Np.TranscriptionStreamEventTypes$=PDr={}))});var ddt=S(Ka=>{"use strict";var gFo=Ka&&Ka.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yFo=Ka&&Ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bFo=Ka&&Ka.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gFo(r,e,n[o]);return yFo(r,e),r}}();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.TranscriptionStreamLanguage$=Ka.TranscriptionStreamLanguage$outboundSchema=Ka.TranscriptionStreamLanguage$inboundSchema=Ka.TranscriptionStreamLanguageType$=Ka.TranscriptionStreamLanguageType$outboundSchema=Ka.TranscriptionStreamLanguageType$inboundSchema=Ka.TranscriptionStreamLanguageType=void 0;Ka.transcriptionStreamLanguageToJSON=_Fo;Ka.transcriptionStreamLanguageFromJSON=vFo;var pU=bFo(ae()),IDr=ce(),ADr=ee();Ka.TranscriptionStreamLanguageType={TranscriptionLanguage:"transcription.language"};Ka.TranscriptionStreamLanguageType$inboundSchema=pU.nativeEnum(Ka.TranscriptionStreamLanguageType);Ka.TranscriptionStreamLanguageType$outboundSchema=Ka.TranscriptionStreamLanguageType$inboundSchema;var MDr;(function(t){t.inboundSchema=Ka.TranscriptionStreamLanguageType$inboundSchema,t.outboundSchema=Ka.TranscriptionStreamLanguageType$outboundSchema})(MDr||(Ka.TranscriptionStreamLanguageType$=MDr={}));Ka.TranscriptionStreamLanguage$inboundSchema=(0,ADr.collectExtraKeys)(pU.object({type:Ka.TranscriptionStreamLanguageType$inboundSchema.default("transcription.language"),audio_language:pU.string()}).catchall(pU.any()),"additionalProperties",!0).transform(t=>(0,IDr.remap)(t,{audio_language:"audioLanguage"}));Ka.TranscriptionStreamLanguage$outboundSchema=pU.object({type:Ka.TranscriptionStreamLanguageType$outboundSchema.default("transcription.language"),audioLanguage:pU.string(),additionalProperties:pU.record(pU.any())}).transform(t=>({...t.additionalProperties,...(0,IDr.remap)(t,{audioLanguage:"audio_language",additionalProperties:null})}));var RDr;(function(t){t.inboundSchema=Ka.TranscriptionStreamLanguage$inboundSchema,t.outboundSchema=Ka.TranscriptionStreamLanguage$outboundSchema})(RDr||(Ka.TranscriptionStreamLanguage$=RDr={}));function _Fo(t){return JSON.stringify(Ka.TranscriptionStreamLanguage$outboundSchema.parse(t))}function vFo(t){return(0,ADr.safeParse)(t,e=>Ka.TranscriptionStreamLanguage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamLanguage' from JSON")}});var fdt=S(Ga=>{"use strict";var wFo=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]}),SFo=Ga&&Ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CFo=Ga&&Ga.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wFo(r,e,n[o]);return SFo(r,e),r}}();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.TranscriptionStreamSegmentDelta$=Ga.TranscriptionStreamSegmentDelta$outboundSchema=Ga.TranscriptionStreamSegmentDelta$inboundSchema=Ga.TranscriptionStreamSegmentDeltaType$=Ga.TranscriptionStreamSegmentDeltaType$outboundSchema=Ga.TranscriptionStreamSegmentDeltaType$inboundSchema=Ga.TranscriptionStreamSegmentDeltaType=void 0;Ga.transcriptionStreamSegmentDeltaToJSON=TFo;Ga.transcriptionStreamSegmentDeltaFromJSON=OFo;var Y0=CFo(ae()),xFo=ce(),jDr=ee();Ga.TranscriptionStreamSegmentDeltaType={TranscriptionSegment:"transcription.segment"};Ga.TranscriptionStreamSegmentDeltaType$inboundSchema=Y0.nativeEnum(Ga.TranscriptionStreamSegmentDeltaType);Ga.TranscriptionStreamSegmentDeltaType$outboundSchema=Ga.TranscriptionStreamSegmentDeltaType$inboundSchema;var NDr;(function(t){t.inboundSchema=Ga.TranscriptionStreamSegmentDeltaType$inboundSchema,t.outboundSchema=Ga.TranscriptionStreamSegmentDeltaType$outboundSchema})(NDr||(Ga.TranscriptionStreamSegmentDeltaType$=NDr={}));Ga.TranscriptionStreamSegmentDelta$inboundSchema=(0,jDr.collectExtraKeys)(Y0.object({text:Y0.string(),start:Y0.number(),end:Y0.number(),type:Ga.TranscriptionStreamSegmentDeltaType$inboundSchema.default("transcription.segment")}).catchall(Y0.any()),"additionalProperties",!0);Ga.TranscriptionStreamSegmentDelta$outboundSchema=Y0.object({text:Y0.string(),start:Y0.number(),end:Y0.number(),type:Ga.TranscriptionStreamSegmentDeltaType$outboundSchema.default("transcription.segment"),additionalProperties:Y0.record(Y0.any())}).transform(t=>({...t.additionalProperties,...(0,xFo.remap)(t,{additionalProperties:null})}));var DDr;(function(t){t.inboundSchema=Ga.TranscriptionStreamSegmentDelta$inboundSchema,t.outboundSchema=Ga.TranscriptionStreamSegmentDelta$outboundSchema})(DDr||(Ga.TranscriptionStreamSegmentDelta$=DDr={}));function TFo(t){return JSON.stringify(Ga.TranscriptionStreamSegmentDelta$outboundSchema.parse(t))}function OFo(t){return(0,jDr.safeParse)(t,e=>Ga.TranscriptionStreamSegmentDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamSegmentDelta' from JSON")}});var pdt=S(Xa=>{"use strict";var EFo=Xa&&Xa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PFo=Xa&&Xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MFo=Xa&&Xa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EFo(r,e,n[o]);return PFo(r,e),r}}();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.TranscriptionStreamTextDelta$=Xa.TranscriptionStreamTextDelta$outboundSchema=Xa.TranscriptionStreamTextDelta$inboundSchema=Xa.TranscriptionStreamTextDeltaType$=Xa.TranscriptionStreamTextDeltaType$outboundSchema=Xa.TranscriptionStreamTextDeltaType$inboundSchema=Xa.TranscriptionStreamTextDeltaType=void 0;Xa.transcriptionStreamTextDeltaToJSON=IFo;Xa.transcriptionStreamTextDeltaFromJSON=AFo;var mU=MFo(ae()),RFo=ce(),FDr=ee();Xa.TranscriptionStreamTextDeltaType={TranscriptionTextDelta:"transcription.text.delta"};Xa.TranscriptionStreamTextDeltaType$inboundSchema=mU.nativeEnum(Xa.TranscriptionStreamTextDeltaType);Xa.TranscriptionStreamTextDeltaType$outboundSchema=Xa.TranscriptionStreamTextDeltaType$inboundSchema;var $Dr;(function(t){t.inboundSchema=Xa.TranscriptionStreamTextDeltaType$inboundSchema,t.outboundSchema=Xa.TranscriptionStreamTextDeltaType$outboundSchema})($Dr||(Xa.TranscriptionStreamTextDeltaType$=$Dr={}));Xa.TranscriptionStreamTextDelta$inboundSchema=(0,FDr.collectExtraKeys)(mU.object({text:mU.string(),type:Xa.TranscriptionStreamTextDeltaType$inboundSchema.default("transcription.text.delta")}).catchall(mU.any()),"additionalProperties",!0);Xa.TranscriptionStreamTextDelta$outboundSchema=mU.object({text:mU.string(),type:Xa.TranscriptionStreamTextDeltaType$outboundSchema.default("transcription.text.delta"),additionalProperties:mU.record(mU.any())}).transform(t=>({...t.additionalProperties,...(0,RFo.remap)(t,{additionalProperties:null})}));var LDr;(function(t){t.inboundSchema=Xa.TranscriptionStreamTextDelta$inboundSchema,t.outboundSchema=Xa.TranscriptionStreamTextDelta$outboundSchema})(LDr||(Xa.TranscriptionStreamTextDelta$=LDr={}));function IFo(t){return JSON.stringify(Xa.TranscriptionStreamTextDelta$outboundSchema.parse(t))}function AFo(t){return(0,FDr.safeParse)(t,e=>Xa.TranscriptionStreamTextDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamTextDelta' from JSON")}});var zDr=S(Ts=>{"use strict";var NFo=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]}),DFo=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jFo=Ts&&Ts.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NFo(r,e,n[o]);return DFo(r,e),r}}();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.TranscriptionStreamEvents$=Ts.TranscriptionStreamEvents$outboundSchema=Ts.TranscriptionStreamEvents$inboundSchema=Ts.TranscriptionStreamEventsData$=Ts.TranscriptionStreamEventsData$outboundSchema=Ts.TranscriptionStreamEventsData$inboundSchema=void 0;Ts.transcriptionStreamEventsDataToJSON=$Fo;Ts.transcriptionStreamEventsDataFromJSON=LFo;Ts.transcriptionStreamEventsToJSON=FFo;Ts.transcriptionStreamEventsFromJSON=kFo;var di=jFo(ae()),UDr=ee(),EAe=ldt(),BDr=cdt(),PAe=ddt(),MAe=fdt(),RAe=pdt();Ts.TranscriptionStreamEventsData$inboundSchema=di.union([EAe.TranscriptionStreamDone$inboundSchema.and(di.object({type:di.literal("transcription.done")}).transform(t=>({type:t.type}))),MAe.TranscriptionStreamSegmentDelta$inboundSchema.and(di.object({type:di.literal("transcription.segment")}).transform(t=>({type:t.type}))),PAe.TranscriptionStreamLanguage$inboundSchema.and(di.object({type:di.literal("transcription.language")}).transform(t=>({type:t.type}))),RAe.TranscriptionStreamTextDelta$inboundSchema.and(di.object({type:di.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);Ts.TranscriptionStreamEventsData$outboundSchema=di.union([EAe.TranscriptionStreamDone$outboundSchema.and(di.object({type:di.literal("transcription.done")}).transform(t=>({type:t.type}))),MAe.TranscriptionStreamSegmentDelta$outboundSchema.and(di.object({type:di.literal("transcription.segment")}).transform(t=>({type:t.type}))),PAe.TranscriptionStreamLanguage$outboundSchema.and(di.object({type:di.literal("transcription.language")}).transform(t=>({type:t.type}))),RAe.TranscriptionStreamTextDelta$outboundSchema.and(di.object({type:di.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);var kDr;(function(t){t.inboundSchema=Ts.TranscriptionStreamEventsData$inboundSchema,t.outboundSchema=Ts.TranscriptionStreamEventsData$outboundSchema})(kDr||(Ts.TranscriptionStreamEventsData$=kDr={}));function $Fo(t){return JSON.stringify(Ts.TranscriptionStreamEventsData$outboundSchema.parse(t))}function LFo(t){return(0,UDr.safeParse)(t,e=>Ts.TranscriptionStreamEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEventsData' from JSON")}Ts.TranscriptionStreamEvents$inboundSchema=di.object({event:BDr.TranscriptionStreamEventTypes$inboundSchema,data:di.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:di.ZodIssueCode.custom,message:`malformed json: ${r}`}),di.NEVER}}).pipe(di.union([EAe.TranscriptionStreamDone$inboundSchema.and(di.object({type:di.literal("transcription.done")}).transform(t=>({type:t.type}))),MAe.TranscriptionStreamSegmentDelta$inboundSchema.and(di.object({type:di.literal("transcription.segment")}).transform(t=>({type:t.type}))),PAe.TranscriptionStreamLanguage$inboundSchema.and(di.object({type:di.literal("transcription.language")}).transform(t=>({type:t.type}))),RAe.TranscriptionStreamTextDelta$inboundSchema.and(di.object({type:di.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]))});Ts.TranscriptionStreamEvents$outboundSchema=di.object({event:BDr.TranscriptionStreamEventTypes$outboundSchema,data:di.union([EAe.TranscriptionStreamDone$outboundSchema.and(di.object({type:di.literal("transcription.done")}).transform(t=>({type:t.type}))),MAe.TranscriptionStreamSegmentDelta$outboundSchema.and(di.object({type:di.literal("transcription.segment")}).transform(t=>({type:t.type}))),PAe.TranscriptionStreamLanguage$outboundSchema.and(di.object({type:di.literal("transcription.language")}).transform(t=>({type:t.type}))),RAe.TranscriptionStreamTextDelta$outboundSchema.and(di.object({type:di.literal("transcription.text.delta")}).transform(t=>({type:t.type})))])});var qDr;(function(t){t.inboundSchema=Ts.TranscriptionStreamEvents$inboundSchema,t.outboundSchema=Ts.TranscriptionStreamEvents$outboundSchema})(qDr||(Ts.TranscriptionStreamEvents$=qDr={}));function FFo(t){return JSON.stringify(Ts.TranscriptionStreamEvents$outboundSchema.parse(t))}function kFo(t){return(0,UDr.safeParse)(t,e=>Ts.TranscriptionStreamEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEvents' from JSON")}});var WDr=S(Za=>{"use strict";var qFo=Za&&Za.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UFo=Za&&Za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BFo=Za&&Za.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qFo(r,e,n[o]);return UFo(r,e),r}}();Object.defineProperty(Za,"__esModule",{value:!0});Za.UnarchiveFTModelOut$=Za.UnarchiveFTModelOut$outboundSchema=Za.UnarchiveFTModelOut$inboundSchema=Za.UnarchiveFTModelOutObject$=Za.UnarchiveFTModelOutObject$outboundSchema=Za.UnarchiveFTModelOutObject$inboundSchema=Za.UnarchiveFTModelOutObject=void 0;Za.unarchiveFTModelOutToJSON=VFo;Za.unarchiveFTModelOutFromJSON=HFo;var S3=BFo(ae()),zFo=ee();Za.UnarchiveFTModelOutObject={Model:"model"};Za.UnarchiveFTModelOutObject$inboundSchema=S3.nativeEnum(Za.UnarchiveFTModelOutObject);Za.UnarchiveFTModelOutObject$outboundSchema=Za.UnarchiveFTModelOutObject$inboundSchema;var VDr;(function(t){t.inboundSchema=Za.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Za.UnarchiveFTModelOutObject$outboundSchema})(VDr||(Za.UnarchiveFTModelOutObject$=VDr={}));Za.UnarchiveFTModelOut$inboundSchema=S3.object({id:S3.string(),object:Za.UnarchiveFTModelOutObject$inboundSchema.default("model"),archived:S3.boolean().default(!1)});Za.UnarchiveFTModelOut$outboundSchema=S3.object({id:S3.string(),object:Za.UnarchiveFTModelOutObject$outboundSchema.default("model"),archived:S3.boolean().default(!1)});var HDr;(function(t){t.inboundSchema=Za.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Za.UnarchiveFTModelOut$outboundSchema})(HDr||(Za.UnarchiveFTModelOut$=HDr={}));function VFo(t){return JSON.stringify(Za.UnarchiveFTModelOut$outboundSchema.parse(t))}function HFo(t){return(0,zFo.safeParse)(t,e=>Za.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var KDr=S(Dp=>{"use strict";var WFo=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]}),JFo=Dp&&Dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KFo=Dp&&Dp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WFo(r,e,n[o]);return JFo(r,e),r}}();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.UpdateFTModelIn$=Dp.UpdateFTModelIn$outboundSchema=Dp.UpdateFTModelIn$inboundSchema=void 0;Dp.updateFTModelInToJSON=XFo;Dp.updateFTModelInFromJSON=ZFo;var zA=KFo(ae()),GFo=ee();Dp.UpdateFTModelIn$inboundSchema=zA.object({name:zA.nullable(zA.string()).optional(),description:zA.nullable(zA.string()).optional()});Dp.UpdateFTModelIn$outboundSchema=zA.object({name:zA.nullable(zA.string()).optional(),description:zA.nullable(zA.string()).optional()});var JDr;(function(t){t.inboundSchema=Dp.UpdateFTModelIn$inboundSchema,t.outboundSchema=Dp.UpdateFTModelIn$outboundSchema})(JDr||(Dp.UpdateFTModelIn$=JDr={}));function XFo(t){return JSON.stringify(Dp.UpdateFTModelIn$outboundSchema.parse(t))}function ZFo(t){return(0,GFo.safeParse)(t,e=>Dp.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var ejr=S(jp=>{"use strict";var YFo=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]}),QFo=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eko=jp&&jp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&YFo(r,e,n[o]);return QFo(r,e),r}}();Object.defineProperty(jp,"__esModule",{value:!0});jp.UploadFileOut$=jp.UploadFileOut$outboundSchema=jp.UploadFileOut$inboundSchema=void 0;jp.uploadFileOutToJSON=rko;jp.uploadFileOutFromJSON=nko;var lc=eko(ae()),XDr=ce(),tko=ee(),ZDr=qse(),YDr=Use(),QDr=Bse();jp.UploadFileOut$inboundSchema=lc.object({id:lc.string(),object:lc.string(),bytes:lc.number().int(),created_at:lc.number().int(),filename:lc.string(),purpose:ZDr.FilePurpose$inboundSchema,sample_type:YDr.SampleType$inboundSchema,num_lines:lc.nullable(lc.number().int()).optional(),mimetype:lc.nullable(lc.string()).optional(),source:QDr.Source$inboundSchema,signature:lc.nullable(lc.string()).optional()}).transform(t=>(0,XDr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));jp.UploadFileOut$outboundSchema=lc.object({id:lc.string(),object:lc.string(),sizeBytes:lc.number().int(),createdAt:lc.number().int(),filename:lc.string(),purpose:ZDr.FilePurpose$outboundSchema,sampleType:YDr.SampleType$outboundSchema,numLines:lc.nullable(lc.number().int()).optional(),mimetype:lc.nullable(lc.string()).optional(),source:QDr.Source$outboundSchema,signature:lc.nullable(lc.string()).optional()}).transform(t=>(0,XDr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var GDr;(function(t){t.inboundSchema=jp.UploadFileOut$inboundSchema,t.outboundSchema=jp.UploadFileOut$outboundSchema})(GDr||(jp.UploadFileOut$=GDr={}));function rko(t){return JSON.stringify(jp.UploadFileOut$outboundSchema.parse(t))}function nko(t){return(0,tko.safeParse)(t,e=>jp.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var ojr=S(Os=>{"use strict";var oko=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]}),iko=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ako=Os&&Os.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oko(r,e,n[o]);return iko(r,e),r}}();Object.defineProperty(Os,"__esModule",{value:!0});Os.ValidationError$=Os.ValidationError$outboundSchema=Os.ValidationError$inboundSchema=Os.Loc$=Os.Loc$outboundSchema=Os.Loc$inboundSchema=void 0;Os.locToJSON=sko;Os.locFromJSON=uko;Os.validationErrorToJSON=lko;Os.validationErrorFromJSON=cko;var $p=ako(ae()),njr=ee();Os.Loc$inboundSchema=$p.union([$p.string(),$p.number().int()]);Os.Loc$outboundSchema=$p.union([$p.string(),$p.number().int()]);var tjr;(function(t){t.inboundSchema=Os.Loc$inboundSchema,t.outboundSchema=Os.Loc$outboundSchema})(tjr||(Os.Loc$=tjr={}));function sko(t){return JSON.stringify(Os.Loc$outboundSchema.parse(t))}function uko(t){return(0,njr.safeParse)(t,e=>Os.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Os.ValidationError$inboundSchema=$p.object({loc:$p.array($p.union([$p.string(),$p.number().int()])),msg:$p.string(),type:$p.string()});Os.ValidationError$outboundSchema=$p.object({loc:$p.array($p.union([$p.string(),$p.number().int()])),msg:$p.string(),type:$p.string()});var rjr;(function(t){t.inboundSchema=Os.ValidationError$inboundSchema,t.outboundSchema=Os.ValidationError$outboundSchema})(rjr||(Os.ValidationError$=rjr={}));function lko(t){return JSON.stringify(Os.ValidationError$outboundSchema.parse(t))}function cko(t){return(0,njr.safeParse)(t,e=>Os.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var Vt=S(ge=>{"use strict";var dko=ge&&ge.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ve=ge&&ge.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dko(e,t,r)};Object.defineProperty(ge,"__esModule",{value:!0});ve(bCr(),ge);ve(SCr(),ge);ve(PCr(),ge);ve(tct(),ge);ve(Rse(),ge);ve(rct(),ge);ve(cTr(),ge);ve(vTr(),ge);ve(OTr(),ge);ve(lct(),ge);ve(RTr(),ge);ve(NA(),ge);ve(nct(),ge);ve(FTr(),ge);ve(zTr(),ge);ve(cct(),ge);ve(dct(),ge);ve(eOr(),ge);ve(pct(),ge);ve(cOr(),ge);ve(fct(),ge);ve(nU(),ge);ve(SOr(),ge);ve(kRe(),ge);ve($Or(),ge);ve(zOr(),ge);ve(QOr(),ge);ve(iEr(),ge);ve(tIe(),ge);ve(hEr(),ge);ve(_Er(),ge);ve(bct(),ge);ve(HEr(),ge);ve(ePr(),ge);ve(_ct(),ge);ve(vct(),ge);ve(nIe(),ge);ve(oIe(),ge);ve(wct(),ge);ve(Jq(),ge);ve(L0(),ge);ve(Klt(),ge);ve(xct(),ge);ve(zPr(),ge);ve(WPr(),ge);ve(YPr(),ge);ve(Ect(),ge);ve(Cct(),ge);ve(cIe(),ge);ve(Pct(),ge);ve(c7(),ge);ve(SRr(),ge);ve(PRr(),ge);ve(wIr(),ge);ve(EIr(),ge);ve(aU(),ge);ve($Ir(),ge);ve(VIr(),ge);ve(ZIr(),ge);ve(nAr(),ge);ve(lAr(),ge);ve(yAr(),ge);ve(wIe(),ge);ve(_Ar(),ge);ve(wAr(),ge);ve(Sct(),ge);ve(Xq(),ge);ve(Vct(),ge);ve(TAr(),ge);ve(EAr(),ge);ve(o3(),ge);ve(Hct(),ge);ve($Ar(),ge);ve(UAr(),ge);ve(Jct(),ge);ve(Wct(),ge);ve(tAe(),ge);ve(iIe(),ge);ve(ERe(),ge);ve(XMe(),ge);ve(qse(),ge);ve(Kct(),ge);ve(YAr(),ge);ve(nNr(),ge);ve(sNr(),ge);ve(fNr(),ge);ve(Gct(),ge);ve(rIe(),ge);ve(sIe(),ge);ve(Xct(),ge);ve(LMe(),ge);ve(ict(),ge);ve(jse(),ge);ve(Mct(),ge);ve(Nct(),ge);ve(uct(),ge);ve(gIe(),ge);ve(Zq(),ge);ve(Zct(),ge);ve(dIe(),ge);ve(Yq(),ge);ve(oct(),ge);ve(i3(),ge);ve(Act(),ge);ve(gct(),ge);ve(mct(),ge);ve(NNr(),ge);ve(b7(),ge);ve(FNr(),ge);ve(Glt(),ge);ve(BNr(),ge);ve(HNr(),ge);ve(JNr(),ge);ve(edt(),ge);ve(t1r(),ge);ve(o1r(),ge);ve(s1r(),ge);ve(f1r(),ge);ve(zct(),ge);ve(Rct(),ge);ve(Lse(),ge);ve(Ict(),ge);ve(v7(),ge);ve(jct(),ge);ve(yct(),ge);ve(f7(),ge);ve(MRe(),ge);ve(_1r(),ge);ve(C1r(),ge);ve(ndt(),ge);ve(P1r(),ge);ve(odt(),ge);ve(idt(),ge);ve(adt(),ge);ve(k1r(),ge);ve(W1r(),ge);ve(sdt(),ge);ve(Dct(),ge);ve(tdt(),ge);ve(t3(),ge);ve(G1r(),ge);ve(YMe(),ge);ve($ct(),ge);ve(Lct(),ge);ve(Gq(),ge);ve(Xlt(),ge);ve(Fct(),ge);ve(tDr(),ge);ve(Use(),ge);ve(oDr(),ge);ve(udt(),ge);ve(lDr(),ge);ve(mDr(),ge);ve(rdt(),ge);ve(Bse(),ge);ve(kct(),ge);ve(GD(),ge);ve(sct(),ge);ve(rU(),ge);ve(s3(),ge);ve(PRe(),ge);ve(p7(),ge);ve(tRe(),ge);ve(m7(),ge);ve(r3(),ge);ve(qct(),ge);ve(Uct(),ge);ve(Fse(),ge);ve(Bct(),ge);ve($se(),ge);ve(XD(),ge);ve(bIe(),ge);ve(Nse(),ge);ve(Yct(),ge);ve(SDr(),ge);ve(OAe(),ge);ve(ldt(),ge);ve(zDr(),ge);ve(cdt(),ge);ve(ddt(),ge);ve(fdt(),ge);ve(pdt(),ge);ve(WDr(),ge);ve(KDr(),ge);ve(ejr(),ge);ve(oU(),ge);ve(ZD(),ge);ve(ojr(),ge);ve(Qct(),ge);ve(_7(),ge);ve(Qq(),ge);ve(eU(),ge)});var ujr=S(eg=>{"use strict";var fko=eg&&eg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pko=eg&&eg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ajr=eg&&eg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fko(r,e,n[o]);return pko(r,e),r}}();Object.defineProperty(eg,"__esModule",{value:!0});eg.HTTPValidationError$=eg.HTTPValidationError$outboundSchema=eg.HTTPValidationError$inboundSchema=eg.HTTPValidationError=void 0;var hU=ajr(ae()),sjr=ajr(Vt()),mko=MMe(),zse=class extends mko.MistralError{constructor(e,r){let n="message"in e&&typeof e.message=="string"?e.message:`API error occurred: ${JSON.stringify(e)}`;super(n,r),this.data$=e,e.detail!=null&&(this.detail=e.detail),this.name="HTTPValidationError"}};eg.HTTPValidationError=zse;eg.HTTPValidationError$inboundSchema=hU.object({detail:hU.array(sjr.ValidationError$inboundSchema).optional(),request$:hU.instanceof(Request),response$:hU.instanceof(Response),body$:hU.string()}).transform(t=>new zse(t,{request:t.request$,response:t.response$,body:t.body$}));eg.HTTPValidationError$outboundSchema=hU.instanceof(zse).transform(t=>t.data$).pipe(hU.object({detail:hU.array(sjr.ValidationError$outboundSchema).optional()}));var ijr;(function(t){t.inboundSchema=eg.HTTPValidationError$inboundSchema,t.outboundSchema=eg.HTTPValidationError$outboundSchema})(ijr||(eg.HTTPValidationError$=ijr={}))});var Qn=S(rT=>{"use strict";var hko=rT&&rT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vse=rT&&rT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hko(e,t,r)};Object.defineProperty(rT,"__esModule",{value:!0});Vse(_lt(),rT);Vse(ujr(),rT);Vse(zlt(),rT);Vse(Hlt(),rT);Vse(RMe(),rT)});var br=S(gU=>{"use strict";var ljr=gU&&gU.__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},Hse=gU&&gU.__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)},E7,Wse,cjr;Object.defineProperty(gU,"__esModule",{value:!0});gU.APIPromise=void 0;var mdt=class{constructor(e){E7.set(this,void 0),Wse.set(this,void 0),this[cjr]="APIPromise",ljr(this,E7,e instanceof Promise?e:Promise.resolve(e),"f"),ljr(this,Wse,e instanceof Promise?Hse(this,E7,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Hse(this,E7,"f").then(e?([n])=>e(n):void 0,r)}catch(e){return Hse(this,Wse,"f").catch(e)}finally(e){return Hse(this,Wse,"f").finally(e)}$inspect(){return Hse(this,E7,"f")}};gU.APIPromise=mdt;E7=new WeakMap,Wse=new WeakMap,cjr=Symbol.toStringTag});var pjr=S(rj=>{"use strict";var gko=rj&&rj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yko=rj&&rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hdt=rj&&rj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gko(r,e,n[o]);return yko(r,e),r}}();Object.defineProperty(rj,"__esModule",{value:!0});rj.agentsComplete=xko;var bko=Cr(),Jse=hdt(gr()),_ko=ce(),vko=ee(),djr=yr(),wko=fr(),fjr=hdt(Vt()),Sko=hdt(Qn()),Cko=br();function xko(t,e,r){return new Cko.APIPromise(Tko(t,e,r))}async function Tko(t,e,r){let n=(0,vko.safeParse)(e,b=>fjr.AgentsCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,bko.encodeJSON)("body",o,{explode:!0}),a=(0,wko.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,_ko.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,djr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,djr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Jse.match(Jse.json(200,fjr.ChatCompletionResponse$inboundSchema),Jse.jsonErr(422,Sko.HTTPValidationError$inboundSchema),Jse.fail("4XX"),Jse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var yU=S(IAe=>{"use strict";Object.defineProperty(IAe,"__esModule",{value:!0});IAe.EventStream=void 0;var gdt=class extends ReadableStream{constructor(e,r){let n=e.getReader(),o=new Uint8Array;super({async pull(i){try{for(;;){let a=Eko(o);if(!a){let l=await n.read();if(l.done)return i.close();o=Oko(o,l.value);continue}let s=o.slice(0,a.index);o=o.slice(a.index+a.length);let u=Pko(s,r);if(u?.value)return i.enqueue(u.value);if(u?.done)return await n.cancel("done"),i.close()}}catch(a){i.error(a),await n.cancel(a)}},cancel:i=>n.cancel(i)})}[Symbol.asyncIterator](){let e=ReadableStream.prototype[Symbol.asyncIterator];if(typeof e=="function")return e.call(this);let r=this.getReader();return{next:async()=>{let n=await r.read();return n.done?(r.releaseLock(),{done:!0,value:void 0}):{done:!1,value:n.value}},throw:async n=>(await r.cancel(n),r.releaseLock(),{done:!0,value:void 0}),return:async()=>(await r.cancel("done"),r.releaseLock(),{done:!0,value:void 0}),[Symbol.asyncIterator](){return this}}}};IAe.EventStream=gdt;function Oko(t,e){let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r}function Eko(t){let e=t.length;for(let r=0;r<e;r++){if(r<=e-4&&t[r]===13&&t[r+1]===10&&t[r+2]===13&&t[r+3]===10)return{index:r,length:4};if(r<=e-2&&t[r]===13&&t[r+1]===13)return{index:r,length:2};if(r<=e-2&&t[r]===10&&t[r+1]===10)return{index:r,length:2}}return null}function Pko(t,e){let n=new TextDecoder().decode(t).split(/\r\n|\r|\n/),o=[],i={},a=!0;for(let s of n){if(!s||s.startsWith(":"))continue;a=!1;let u=s.indexOf(":"),l=s.slice(0,u),c=s[u+1]===" "?s.slice(u+2):s.slice(u+1);if(l==="data")o.push(c);else if(l==="event")i.event=c;else if(l==="id")i.id=c;else if(l==="retry"){let d=Number(c);isNaN(d)||(i.retry=d)}}if(!a)return o.length&&(i.data=o.join(`
|
||
`)),e(i)}});var gjr=S(nj=>{"use strict";var Mko=nj&&nj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rko=nj&&nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AAe=nj&&nj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mko(r,e,n[o]);return Rko(r,e),r}}();Object.defineProperty(nj,"__esModule",{value:!0});nj.agentsStream=kko;var Iko=AAe(ae()),Ako=Cr(),Nko=yU(),Kse=AAe(gr()),Dko=ce(),jko=ee(),mjr=yr(),$ko=fr(),hjr=AAe(Vt()),Lko=AAe(Qn()),Fko=br();function kko(t,e,r){return new Fko.APIPromise(qko(t,e,r))}async function qko(t,e,r){let n=(0,jko.safeParse)(e,b=>hjr.AgentsCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Ako.encodeJSON)("body",o,{explode:!0}),a=(0,$ko.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,Dko.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,mjr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,mjr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Kse.match(Kse.sse(200,Iko.instanceof(ReadableStream).transform(b=>new Nko.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:hjr.CompletionEvent$inboundSchema.parse(_)}))),Kse.jsonErr(422,Lko.HTTPValidationError$inboundSchema),Kse.fail("4XX"),Kse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var bjr=S(NAe=>{"use strict";Object.defineProperty(NAe,"__esModule",{value:!0});NAe.Agents=void 0;var Uko=pjr(),Bko=gjr(),zko=Wc(),yjr=kd(),ydt=class extends zko.ClientSDK{async complete(e,r){return(0,yjr.unwrapAsync)((0,Uko.agentsComplete)(this,e,r))}async stream(e,r){return(0,yjr.unwrapAsync)((0,Bko.agentsStream)(this,e,r))}};NAe.Agents=ydt});var Gse=S(bdt=>{"use strict";Object.defineProperty(bdt,"__esModule",{value:!0});bdt.isReadableStream=Vko;function Vko(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 Sjr=S(oj=>{"use strict";var Hko=oj&&oj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wko=oj&&oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wjr=oj&&oj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Hko(r,e,n[o]);return Wko(r,e),r}}();Object.defineProperty(oj,"__esModule",{value:!0});oj.audioTranscriptionsComplete=Qko;var VA=Cr(),_dt=G9(),DAe=wjr(gr()),Jko=ce(),Kko=ee(),_jr=yr(),Gko=fr(),vjr=wjr(Vt()),Xko=br(),Zko=YD(),Yko=Gse();function Qko(t,e,r){return new Xko.APIPromise(eqo(t,e,r))}async function eqo(t,e,r){let n=(0,Kko.safeParse)(e,g=>vjr.AudioTranscriptionRequest$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,VA.appendForm)(i,"model",o.model),o.file!==void 0)if((0,Zko.isBlobLike)(o.file))(0,VA.appendForm)(i,"file",o.file);else if((0,Yko.isReadableStream)(o.file.content)){let g=await(0,_dt.readableStreamToArrayBuffer)(o.file.content),b=(0,_dt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,VA.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,_dt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,VA.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,VA.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,VA.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,VA.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,VA.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,VA.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,VA.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,Gko.pathToFunc)("/v1/audio/transcriptions")(),s=new Headers((0,Jko.compactMap)({Accept:"application/json"})),u=await(0,_jr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_jr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"audio_api_v1_transcriptions_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await DAe.match(DAe.json(200,vjr.TranscriptionResponse$inboundSchema),DAe.fail("4XX"),DAe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var Tjr=S(ij=>{"use strict";var tqo=ij&&ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rqo=ij&&ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wdt=ij&&ij.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tqo(r,e,n[o]);return rqo(r,e),r}}();Object.defineProperty(ij,"__esModule",{value:!0});ij.audioTranscriptionsStream=dqo;var nqo=wdt(ae()),HA=Cr(),oqo=yU(),vdt=G9(),jAe=wdt(gr()),iqo=ce(),aqo=ee(),Cjr=yr(),sqo=fr(),xjr=wdt(Vt()),uqo=br(),lqo=YD(),cqo=Gse();function dqo(t,e,r){return new uqo.APIPromise(fqo(t,e,r))}async function fqo(t,e,r){let n=(0,aqo.safeParse)(e,g=>xjr.AudioTranscriptionRequestStream$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,HA.appendForm)(i,"model",o.model),o.file!==void 0)if((0,lqo.isBlobLike)(o.file))(0,HA.appendForm)(i,"file",o.file);else if((0,cqo.isReadableStream)(o.file.content)){let g=await(0,vdt.readableStreamToArrayBuffer)(o.file.content),b=(0,vdt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,HA.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,vdt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,HA.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,HA.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,HA.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,HA.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,HA.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,HA.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,HA.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,sqo.pathToFunc)("/v1/audio/transcriptions#stream")(),s=new Headers((0,iqo.compactMap)({Accept:"text/event-stream"})),u=await(0,Cjr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Cjr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"audio_api_v1_transcriptions_post_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await jAe.match(jAe.sse(200,nqo.instanceof(ReadableStream).transform(g=>new oqo.EventStream(g,b=>({value:xjr.TranscriptionStreamEvents$inboundSchema.parse(b)})))),jAe.fail("4XX"),jAe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var Ejr=S($Ae=>{"use strict";Object.defineProperty($Ae,"__esModule",{value:!0});$Ae.Transcriptions=void 0;var pqo=Sjr(),mqo=Tjr(),hqo=Wc(),Ojr=kd(),Sdt=class extends hqo.ClientSDK{async complete(e,r){return(0,Ojr.unwrapAsync)((0,pqo.audioTranscriptionsComplete)(this,e,r))}async stream(e,r){return(0,Ojr.unwrapAsync)((0,mqo.audioTranscriptionsStream)(this,e,r))}};$Ae.Transcriptions=Sdt});var Pjr=S(LAe=>{"use strict";Object.defineProperty(LAe,"__esModule",{value:!0});LAe.Audio=void 0;var gqo=Wc(),yqo=Ejr(),Cdt=class extends gqo.ClientSDK{get transcriptions(){return this._transcriptions??(this._transcriptions=new yqo.Transcriptions(this._options))}};LAe.Audio=Cdt});var Ijr=S(Lp=>{"use strict";var bqo=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]}),_qo=Lp&&Lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vqo=Lp&&Lp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bqo(r,e,n[o]);return _qo(r,e),r}}();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.AgentsApiV1AgentsGetRequest$=Lp.AgentsApiV1AgentsGetRequest$outboundSchema=Lp.AgentsApiV1AgentsGetRequest$inboundSchema=void 0;Lp.agentsApiV1AgentsGetRequestToJSON=Sqo;Lp.agentsApiV1AgentsGetRequestFromJSON=Cqo;var FAe=vqo(ae()),Rjr=ce(),wqo=ee();Lp.AgentsApiV1AgentsGetRequest$inboundSchema=FAe.object({agent_id:FAe.string()}).transform(t=>(0,Rjr.remap)(t,{agent_id:"agentId"}));Lp.AgentsApiV1AgentsGetRequest$outboundSchema=FAe.object({agentId:FAe.string()}).transform(t=>(0,Rjr.remap)(t,{agentId:"agent_id"}));var Mjr;(function(t){t.inboundSchema=Lp.AgentsApiV1AgentsGetRequest$inboundSchema,t.outboundSchema=Lp.AgentsApiV1AgentsGetRequest$outboundSchema})(Mjr||(Lp.AgentsApiV1AgentsGetRequest$=Mjr={}));function Sqo(t){return JSON.stringify(Lp.AgentsApiV1AgentsGetRequest$outboundSchema.parse(t))}function Cqo(t){return(0,wqo.safeParse)(t,e=>Lp.AgentsApiV1AgentsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsGetRequest' from JSON")}});var Djr=S(Fp=>{"use strict";var xqo=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]}),Tqo=Fp&&Fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oqo=Fp&&Fp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xqo(r,e,n[o]);return Tqo(r,e),r}}();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.AgentsApiV1AgentsListRequest$=Fp.AgentsApiV1AgentsListRequest$outboundSchema=Fp.AgentsApiV1AgentsListRequest$inboundSchema=void 0;Fp.agentsApiV1AgentsListRequestToJSON=Pqo;Fp.agentsApiV1AgentsListRequestFromJSON=Mqo;var P7=Oqo(ae()),Njr=ce(),Eqo=ee();Fp.AgentsApiV1AgentsListRequest$inboundSchema=P7.object({page:P7.number().int().default(0),page_size:P7.number().int().default(20)}).transform(t=>(0,Njr.remap)(t,{page_size:"pageSize"}));Fp.AgentsApiV1AgentsListRequest$outboundSchema=P7.object({page:P7.number().int().default(0),pageSize:P7.number().int().default(20)}).transform(t=>(0,Njr.remap)(t,{pageSize:"page_size"}));var Ajr;(function(t){t.inboundSchema=Fp.AgentsApiV1AgentsListRequest$inboundSchema,t.outboundSchema=Fp.AgentsApiV1AgentsListRequest$outboundSchema})(Ajr||(Fp.AgentsApiV1AgentsListRequest$=Ajr={}));function Pqo(t){return JSON.stringify(Fp.AgentsApiV1AgentsListRequest$outboundSchema.parse(t))}function Mqo(t){return(0,Eqo.safeParse)(t,e=>Fp.AgentsApiV1AgentsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsListRequest' from JSON")}});var kjr=S(kp=>{"use strict";var Rqo=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]}),Iqo=kp&&kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$jr=kp&&kp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rqo(r,e,n[o]);return Iqo(r,e),r}}();Object.defineProperty(kp,"__esModule",{value:!0});kp.AgentsApiV1AgentsUpdateRequest$=kp.AgentsApiV1AgentsUpdateRequest$outboundSchema=kp.AgentsApiV1AgentsUpdateRequest$inboundSchema=void 0;kp.agentsApiV1AgentsUpdateRequestToJSON=Nqo;kp.agentsApiV1AgentsUpdateRequestFromJSON=Dqo;var kAe=$jr(ae()),Ljr=ce(),Aqo=ee(),Fjr=$jr(Vt());kp.AgentsApiV1AgentsUpdateRequest$inboundSchema=kAe.object({agent_id:kAe.string(),AgentUpdateRequest:Fjr.AgentUpdateRequest$inboundSchema}).transform(t=>(0,Ljr.remap)(t,{agent_id:"agentId",AgentUpdateRequest:"agentUpdateRequest"}));kp.AgentsApiV1AgentsUpdateRequest$outboundSchema=kAe.object({agentId:kAe.string(),agentUpdateRequest:Fjr.AgentUpdateRequest$outboundSchema}).transform(t=>(0,Ljr.remap)(t,{agentId:"agent_id",agentUpdateRequest:"AgentUpdateRequest"}));var jjr;(function(t){t.inboundSchema=kp.AgentsApiV1AgentsUpdateRequest$inboundSchema,t.outboundSchema=kp.AgentsApiV1AgentsUpdateRequest$outboundSchema})(jjr||(kp.AgentsApiV1AgentsUpdateRequest$=jjr={}));function Nqo(t){return JSON.stringify(kp.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(t))}function Dqo(t){return(0,Aqo.safeParse)(t,e=>kp.AgentsApiV1AgentsUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateRequest' from JSON")}});var Bjr=S(qp=>{"use strict";var jqo=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]}),$qo=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lqo=qp&&qp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jqo(r,e,n[o]);return $qo(r,e),r}}();Object.defineProperty(qp,"__esModule",{value:!0});qp.AgentsApiV1AgentsUpdateVersionRequest$=qp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=qp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=void 0;qp.agentsApiV1AgentsUpdateVersionRequestToJSON=kqo;qp.agentsApiV1AgentsUpdateVersionRequestFromJSON=qqo;var M7=Lqo(ae()),Ujr=ce(),Fqo=ee();qp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=M7.object({agent_id:M7.string(),version:M7.number().int()}).transform(t=>(0,Ujr.remap)(t,{agent_id:"agentId"}));qp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=M7.object({agentId:M7.string(),version:M7.number().int()}).transform(t=>(0,Ujr.remap)(t,{agentId:"agent_id"}));var qjr;(function(t){t.inboundSchema=qp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema,t.outboundSchema=qp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema})(qjr||(qp.AgentsApiV1AgentsUpdateVersionRequest$=qjr={}));function kqo(t){return JSON.stringify(qp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(t))}function qqo(t){return(0,Fqo.safeParse)(t,e=>qp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateVersionRequest' from JSON")}});var Jjr=S(Up=>{"use strict";var Uqo=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]}),Bqo=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vjr=Up&&Up.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uqo(r,e,n[o]);return Bqo(r,e),r}}();Object.defineProperty(Up,"__esModule",{value:!0});Up.AgentsApiV1ConversationsAppendRequest$=Up.AgentsApiV1ConversationsAppendRequest$outboundSchema=Up.AgentsApiV1ConversationsAppendRequest$inboundSchema=void 0;Up.agentsApiV1ConversationsAppendRequestToJSON=Vqo;Up.agentsApiV1ConversationsAppendRequestFromJSON=Hqo;var qAe=Vjr(ae()),Hjr=ce(),zqo=ee(),Wjr=Vjr(Vt());Up.AgentsApiV1ConversationsAppendRequest$inboundSchema=qAe.object({conversation_id:qAe.string(),ConversationAppendRequest:Wjr.ConversationAppendRequest$inboundSchema}).transform(t=>(0,Hjr.remap)(t,{conversation_id:"conversationId",ConversationAppendRequest:"conversationAppendRequest"}));Up.AgentsApiV1ConversationsAppendRequest$outboundSchema=qAe.object({conversationId:qAe.string(),conversationAppendRequest:Wjr.ConversationAppendRequest$outboundSchema}).transform(t=>(0,Hjr.remap)(t,{conversationId:"conversation_id",conversationAppendRequest:"ConversationAppendRequest"}));var zjr;(function(t){t.inboundSchema=Up.AgentsApiV1ConversationsAppendRequest$inboundSchema,t.outboundSchema=Up.AgentsApiV1ConversationsAppendRequest$outboundSchema})(zjr||(Up.AgentsApiV1ConversationsAppendRequest$=zjr={}));function Vqo(t){return JSON.stringify(Up.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(t))}function Hqo(t){return(0,zqo.safeParse)(t,e=>Up.AgentsApiV1ConversationsAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendRequest' from JSON")}});var Yjr=S(Bp=>{"use strict";var Wqo=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]}),Jqo=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gjr=Bp&&Bp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Wqo(r,e,n[o]);return Jqo(r,e),r}}();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.AgentsApiV1ConversationsAppendStreamRequest$=Bp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=Bp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=void 0;Bp.agentsApiV1ConversationsAppendStreamRequestToJSON=Gqo;Bp.agentsApiV1ConversationsAppendStreamRequestFromJSON=Xqo;var UAe=Gjr(ae()),Xjr=ce(),Kqo=ee(),Zjr=Gjr(Vt());Bp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=UAe.object({conversation_id:UAe.string(),ConversationAppendStreamRequest:Zjr.ConversationAppendStreamRequest$inboundSchema}).transform(t=>(0,Xjr.remap)(t,{conversation_id:"conversationId",ConversationAppendStreamRequest:"conversationAppendStreamRequest"}));Bp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=UAe.object({conversationId:UAe.string(),conversationAppendStreamRequest:Zjr.ConversationAppendStreamRequest$outboundSchema}).transform(t=>(0,Xjr.remap)(t,{conversationId:"conversation_id",conversationAppendStreamRequest:"ConversationAppendStreamRequest"}));var Kjr;(function(t){t.inboundSchema=Bp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema,t.outboundSchema=Bp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema})(Kjr||(Bp.AgentsApiV1ConversationsAppendStreamRequest$=Kjr={}));function Gqo(t){return JSON.stringify(Bp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(t))}function Xqo(t){return(0,Kqo.safeParse)(t,e=>Bp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendStreamRequest' from JSON")}});var o$r=S(Es=>{"use strict";var Zqo=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]}),Yqo=Es&&Es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t$r=Es&&Es.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Zqo(r,e,n[o]);return Yqo(r,e),r}}();Object.defineProperty(Es,"__esModule",{value:!0});Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=Es.AgentsApiV1ConversationsGetRequest$=Es.AgentsApiV1ConversationsGetRequest$outboundSchema=Es.AgentsApiV1ConversationsGetRequest$inboundSchema=void 0;Es.agentsApiV1ConversationsGetRequestToJSON=Qqo;Es.agentsApiV1ConversationsGetRequestFromJSON=eUo;Es.agentsApiV1ConversationsGetResponseV1ConversationsGetToJSON=tUo;Es.agentsApiV1ConversationsGetResponseV1ConversationsGetFromJSON=rUo;var R7=t$r(ae()),r$r=ce(),n$r=ee(),BAe=t$r(Vt());Es.AgentsApiV1ConversationsGetRequest$inboundSchema=R7.object({conversation_id:R7.string()}).transform(t=>(0,r$r.remap)(t,{conversation_id:"conversationId"}));Es.AgentsApiV1ConversationsGetRequest$outboundSchema=R7.object({conversationId:R7.string()}).transform(t=>(0,r$r.remap)(t,{conversationId:"conversation_id"}));var Qjr;(function(t){t.inboundSchema=Es.AgentsApiV1ConversationsGetRequest$inboundSchema,t.outboundSchema=Es.AgentsApiV1ConversationsGetRequest$outboundSchema})(Qjr||(Es.AgentsApiV1ConversationsGetRequest$=Qjr={}));function Qqo(t){return JSON.stringify(Es.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(t))}function eUo(t){return(0,n$r.safeParse)(t,e=>Es.AgentsApiV1ConversationsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetRequest' from JSON")}Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=R7.union([BAe.ModelConversation$inboundSchema,BAe.AgentConversation$inboundSchema]);Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=R7.union([BAe.ModelConversation$outboundSchema,BAe.AgentConversation$outboundSchema]);var e$r;(function(t){t.inboundSchema=Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema,t.outboundSchema=Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema})(e$r||(Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=e$r={}));function tUo(t){return JSON.stringify(Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema.parse(t))}function rUo(t){return(0,n$r.safeParse)(t,e=>Es.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetResponseV1ConversationsGet' from JSON")}});var s$r=S(zp=>{"use strict";var nUo=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]}),oUo=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iUo=zp&&zp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nUo(r,e,n[o]);return oUo(r,e),r}}();Object.defineProperty(zp,"__esModule",{value:!0});zp.AgentsApiV1ConversationsHistoryRequest$=zp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=zp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=void 0;zp.agentsApiV1ConversationsHistoryRequestToJSON=sUo;zp.agentsApiV1ConversationsHistoryRequestFromJSON=uUo;var zAe=iUo(ae()),a$r=ce(),aUo=ee();zp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=zAe.object({conversation_id:zAe.string()}).transform(t=>(0,a$r.remap)(t,{conversation_id:"conversationId"}));zp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=zAe.object({conversationId:zAe.string()}).transform(t=>(0,a$r.remap)(t,{conversationId:"conversation_id"}));var i$r;(function(t){t.inboundSchema=zp.AgentsApiV1ConversationsHistoryRequest$inboundSchema,t.outboundSchema=zp.AgentsApiV1ConversationsHistoryRequest$outboundSchema})(i$r||(zp.AgentsApiV1ConversationsHistoryRequest$=i$r={}));function sUo(t){return JSON.stringify(zp.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(t))}function uUo(t){return(0,aUo.safeParse)(t,e=>zp.AgentsApiV1ConversationsHistoryRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsHistoryRequest' from JSON")}});var p$r=S(Ps=>{"use strict";var lUo=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]}),cUo=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c$r=Ps&&Ps.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&lUo(r,e,n[o]);return cUo(r,e),r}}();Object.defineProperty(Ps,"__esModule",{value:!0});Ps.ResponseBody$=Ps.ResponseBody$outboundSchema=Ps.ResponseBody$inboundSchema=Ps.AgentsApiV1ConversationsListRequest$=Ps.AgentsApiV1ConversationsListRequest$outboundSchema=Ps.AgentsApiV1ConversationsListRequest$inboundSchema=void 0;Ps.agentsApiV1ConversationsListRequestToJSON=dUo;Ps.agentsApiV1ConversationsListRequestFromJSON=fUo;Ps.responseBodyToJSON=pUo;Ps.responseBodyFromJSON=mUo;var bU=c$r(ae()),d$r=ce(),f$r=ee(),VAe=c$r(Vt());Ps.AgentsApiV1ConversationsListRequest$inboundSchema=bU.object({page:bU.number().int().default(0),page_size:bU.number().int().default(100)}).transform(t=>(0,d$r.remap)(t,{page_size:"pageSize"}));Ps.AgentsApiV1ConversationsListRequest$outboundSchema=bU.object({page:bU.number().int().default(0),pageSize:bU.number().int().default(100)}).transform(t=>(0,d$r.remap)(t,{pageSize:"page_size"}));var u$r;(function(t){t.inboundSchema=Ps.AgentsApiV1ConversationsListRequest$inboundSchema,t.outboundSchema=Ps.AgentsApiV1ConversationsListRequest$outboundSchema})(u$r||(Ps.AgentsApiV1ConversationsListRequest$=u$r={}));function dUo(t){return JSON.stringify(Ps.AgentsApiV1ConversationsListRequest$outboundSchema.parse(t))}function fUo(t){return(0,f$r.safeParse)(t,e=>Ps.AgentsApiV1ConversationsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsListRequest' from JSON")}Ps.ResponseBody$inboundSchema=bU.union([VAe.ModelConversation$inboundSchema,VAe.AgentConversation$inboundSchema]);Ps.ResponseBody$outboundSchema=bU.union([VAe.ModelConversation$outboundSchema,VAe.AgentConversation$outboundSchema]);var l$r;(function(t){t.inboundSchema=Ps.ResponseBody$inboundSchema,t.outboundSchema=Ps.ResponseBody$outboundSchema})(l$r||(Ps.ResponseBody$=l$r={}));function pUo(t){return JSON.stringify(Ps.ResponseBody$outboundSchema.parse(t))}function mUo(t){return(0,f$r.safeParse)(t,e=>Ps.ResponseBody$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseBody' from JSON")}});var g$r=S(Vp=>{"use strict";var hUo=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]}),gUo=Vp&&Vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yUo=Vp&&Vp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hUo(r,e,n[o]);return gUo(r,e),r}}();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.AgentsApiV1ConversationsMessagesRequest$=Vp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=Vp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=void 0;Vp.agentsApiV1ConversationsMessagesRequestToJSON=_Uo;Vp.agentsApiV1ConversationsMessagesRequestFromJSON=vUo;var HAe=yUo(ae()),h$r=ce(),bUo=ee();Vp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=HAe.object({conversation_id:HAe.string()}).transform(t=>(0,h$r.remap)(t,{conversation_id:"conversationId"}));Vp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=HAe.object({conversationId:HAe.string()}).transform(t=>(0,h$r.remap)(t,{conversationId:"conversation_id"}));var m$r;(function(t){t.inboundSchema=Vp.AgentsApiV1ConversationsMessagesRequest$inboundSchema,t.outboundSchema=Vp.AgentsApiV1ConversationsMessagesRequest$outboundSchema})(m$r||(Vp.AgentsApiV1ConversationsMessagesRequest$=m$r={}));function _Uo(t){return JSON.stringify(Vp.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(t))}function vUo(t){return(0,bUo.safeParse)(t,e=>Vp.AgentsApiV1ConversationsMessagesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsMessagesRequest' from JSON")}});var w$r=S(Hp=>{"use strict";var wUo=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]}),SUo=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b$r=Hp&&Hp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wUo(r,e,n[o]);return SUo(r,e),r}}();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.AgentsApiV1ConversationsRestartRequest$=Hp.AgentsApiV1ConversationsRestartRequest$outboundSchema=Hp.AgentsApiV1ConversationsRestartRequest$inboundSchema=void 0;Hp.agentsApiV1ConversationsRestartRequestToJSON=xUo;Hp.agentsApiV1ConversationsRestartRequestFromJSON=TUo;var WAe=b$r(ae()),_$r=ce(),CUo=ee(),v$r=b$r(Vt());Hp.AgentsApiV1ConversationsRestartRequest$inboundSchema=WAe.object({conversation_id:WAe.string(),ConversationRestartRequest:v$r.ConversationRestartRequest$inboundSchema}).transform(t=>(0,_$r.remap)(t,{conversation_id:"conversationId",ConversationRestartRequest:"conversationRestartRequest"}));Hp.AgentsApiV1ConversationsRestartRequest$outboundSchema=WAe.object({conversationId:WAe.string(),conversationRestartRequest:v$r.ConversationRestartRequest$outboundSchema}).transform(t=>(0,_$r.remap)(t,{conversationId:"conversation_id",conversationRestartRequest:"ConversationRestartRequest"}));var y$r;(function(t){t.inboundSchema=Hp.AgentsApiV1ConversationsRestartRequest$inboundSchema,t.outboundSchema=Hp.AgentsApiV1ConversationsRestartRequest$outboundSchema})(y$r||(Hp.AgentsApiV1ConversationsRestartRequest$=y$r={}));function xUo(t){return JSON.stringify(Hp.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(t))}function TUo(t){return(0,CUo.safeParse)(t,e=>Hp.AgentsApiV1ConversationsRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartRequest' from JSON")}});var O$r=S(Wp=>{"use strict";var OUo=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]}),EUo=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C$r=Wp&&Wp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OUo(r,e,n[o]);return EUo(r,e),r}}();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.AgentsApiV1ConversationsRestartStreamRequest$=Wp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=Wp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=void 0;Wp.agentsApiV1ConversationsRestartStreamRequestToJSON=MUo;Wp.agentsApiV1ConversationsRestartStreamRequestFromJSON=RUo;var JAe=C$r(ae()),x$r=ce(),PUo=ee(),T$r=C$r(Vt());Wp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=JAe.object({conversation_id:JAe.string(),ConversationRestartStreamRequest:T$r.ConversationRestartStreamRequest$inboundSchema}).transform(t=>(0,x$r.remap)(t,{conversation_id:"conversationId",ConversationRestartStreamRequest:"conversationRestartStreamRequest"}));Wp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=JAe.object({conversationId:JAe.string(),conversationRestartStreamRequest:T$r.ConversationRestartStreamRequest$outboundSchema}).transform(t=>(0,x$r.remap)(t,{conversationId:"conversation_id",conversationRestartStreamRequest:"ConversationRestartStreamRequest"}));var S$r;(function(t){t.inboundSchema=Wp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema,t.outboundSchema=Wp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema})(S$r||(Wp.AgentsApiV1ConversationsRestartStreamRequest$=S$r={}));function MUo(t){return JSON.stringify(Wp.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(t))}function RUo(t){return(0,PUo.safeParse)(t,e=>Wp.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartStreamRequest' from JSON")}});var M$r=S(Jp=>{"use strict";var IUo=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]}),AUo=Jp&&Jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NUo=Jp&&Jp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IUo(r,e,n[o]);return AUo(r,e),r}}();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.DeleteModelV1ModelsModelIdDeleteRequest$=Jp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Jp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Jp.deleteModelV1ModelsModelIdDeleteRequestToJSON=jUo;Jp.deleteModelV1ModelsModelIdDeleteRequestFromJSON=$Uo;var KAe=NUo(ae()),P$r=ce(),DUo=ee();Jp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=KAe.object({model_id:KAe.string()}).transform(t=>(0,P$r.remap)(t,{model_id:"modelId"}));Jp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=KAe.object({modelId:KAe.string()}).transform(t=>(0,P$r.remap)(t,{modelId:"model_id"}));var E$r;(function(t){t.inboundSchema=Jp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Jp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(E$r||(Jp.DeleteModelV1ModelsModelIdDeleteRequest$=E$r={}));function jUo(t){return JSON.stringify(Jp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function $Uo(t){return(0,DUo.safeParse)(t,e=>Jp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var A$r=S(Kp=>{"use strict";var LUo=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]}),FUo=Kp&&Kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kUo=Kp&&Kp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LUo(r,e,n[o]);return FUo(r,e),r}}();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.FilesApiRoutesDeleteFileRequest$=Kp.FilesApiRoutesDeleteFileRequest$outboundSchema=Kp.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Kp.filesApiRoutesDeleteFileRequestToJSON=UUo;Kp.filesApiRoutesDeleteFileRequestFromJSON=BUo;var GAe=kUo(ae()),I$r=ce(),qUo=ee();Kp.FilesApiRoutesDeleteFileRequest$inboundSchema=GAe.object({file_id:GAe.string()}).transform(t=>(0,I$r.remap)(t,{file_id:"fileId"}));Kp.FilesApiRoutesDeleteFileRequest$outboundSchema=GAe.object({fileId:GAe.string()}).transform(t=>(0,I$r.remap)(t,{fileId:"file_id"}));var R$r;(function(t){t.inboundSchema=Kp.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Kp.FilesApiRoutesDeleteFileRequest$outboundSchema})(R$r||(Kp.FilesApiRoutesDeleteFileRequest$=R$r={}));function UUo(t){return JSON.stringify(Kp.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function BUo(t){return(0,qUo.safeParse)(t,e=>Kp.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var j$r=S(Gp=>{"use strict";var zUo=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]}),VUo=Gp&&Gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HUo=Gp&&Gp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zUo(r,e,n[o]);return VUo(r,e),r}}();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.FilesApiRoutesDownloadFileRequest$=Gp.FilesApiRoutesDownloadFileRequest$outboundSchema=Gp.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Gp.filesApiRoutesDownloadFileRequestToJSON=JUo;Gp.filesApiRoutesDownloadFileRequestFromJSON=KUo;var XAe=HUo(ae()),D$r=ce(),WUo=ee();Gp.FilesApiRoutesDownloadFileRequest$inboundSchema=XAe.object({file_id:XAe.string()}).transform(t=>(0,D$r.remap)(t,{file_id:"fileId"}));Gp.FilesApiRoutesDownloadFileRequest$outboundSchema=XAe.object({fileId:XAe.string()}).transform(t=>(0,D$r.remap)(t,{fileId:"file_id"}));var N$r;(function(t){t.inboundSchema=Gp.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Gp.FilesApiRoutesDownloadFileRequest$outboundSchema})(N$r||(Gp.FilesApiRoutesDownloadFileRequest$=N$r={}));function JUo(t){return JSON.stringify(Gp.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function KUo(t){return(0,WUo.safeParse)(t,e=>Gp.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var F$r=S(Xp=>{"use strict";var GUo=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]}),XUo=Xp&&Xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZUo=Xp&&Xp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&GUo(r,e,n[o]);return XUo(r,e),r}}();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.FilesApiRoutesGetSignedUrlRequest$=Xp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Xp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Xp.filesApiRoutesGetSignedUrlRequestToJSON=QUo;Xp.filesApiRoutesGetSignedUrlRequestFromJSON=eBo;var I7=ZUo(ae()),L$r=ce(),YUo=ee();Xp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=I7.object({file_id:I7.string(),expiry:I7.number().int().default(24)}).transform(t=>(0,L$r.remap)(t,{file_id:"fileId"}));Xp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=I7.object({fileId:I7.string(),expiry:I7.number().int().default(24)}).transform(t=>(0,L$r.remap)(t,{fileId:"file_id"}));var $$r;(function(t){t.inboundSchema=Xp.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Xp.FilesApiRoutesGetSignedUrlRequest$outboundSchema})($$r||(Xp.FilesApiRoutesGetSignedUrlRequest$=$$r={}));function QUo(t){return JSON.stringify(Xp.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function eBo(t){return(0,YUo.safeParse)(t,e=>Xp.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var B$r=S(Yp=>{"use strict";var tBo=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]}),rBo=Yp&&Yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q$r=Yp&&Yp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tBo(r,e,n[o]);return rBo(r,e),r}}();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.FilesApiRoutesListFilesRequest$=Yp.FilesApiRoutesListFilesRequest$outboundSchema=Yp.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Yp.filesApiRoutesListFilesRequestToJSON=oBo;Yp.filesApiRoutesListFilesRequestFromJSON=iBo;var Zp=q$r(ae()),U$r=ce(),nBo=ee(),A7=q$r(Vt());Yp.FilesApiRoutesListFilesRequest$inboundSchema=Zp.object({page:Zp.number().int().default(0),page_size:Zp.number().int().default(100),sample_type:Zp.nullable(Zp.array(A7.SampleType$inboundSchema)).optional(),source:Zp.nullable(Zp.array(A7.Source$inboundSchema)).optional(),search:Zp.nullable(Zp.string()).optional(),purpose:Zp.nullable(A7.FilePurpose$inboundSchema).optional()}).transform(t=>(0,U$r.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Yp.FilesApiRoutesListFilesRequest$outboundSchema=Zp.object({page:Zp.number().int().default(0),pageSize:Zp.number().int().default(100),sampleType:Zp.nullable(Zp.array(A7.SampleType$outboundSchema)).optional(),source:Zp.nullable(Zp.array(A7.Source$outboundSchema)).optional(),search:Zp.nullable(Zp.string()).optional(),purpose:Zp.nullable(A7.FilePurpose$outboundSchema).optional()}).transform(t=>(0,U$r.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var k$r;(function(t){t.inboundSchema=Yp.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Yp.FilesApiRoutesListFilesRequest$outboundSchema})(k$r||(Yp.FilesApiRoutesListFilesRequest$=k$r={}));function oBo(t){return JSON.stringify(Yp.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function iBo(t){return(0,nBo.safeParse)(t,e=>Yp.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var H$r=S(Qp=>{"use strict";var aBo=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]}),sBo=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uBo=Qp&&Qp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&aBo(r,e,n[o]);return sBo(r,e),r}}();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.FilesApiRoutesRetrieveFileRequest$=Qp.FilesApiRoutesRetrieveFileRequest$outboundSchema=Qp.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Qp.filesApiRoutesRetrieveFileRequestToJSON=cBo;Qp.filesApiRoutesRetrieveFileRequestFromJSON=dBo;var ZAe=uBo(ae()),V$r=ce(),lBo=ee();Qp.FilesApiRoutesRetrieveFileRequest$inboundSchema=ZAe.object({file_id:ZAe.string()}).transform(t=>(0,V$r.remap)(t,{file_id:"fileId"}));Qp.FilesApiRoutesRetrieveFileRequest$outboundSchema=ZAe.object({fileId:ZAe.string()}).transform(t=>(0,V$r.remap)(t,{fileId:"file_id"}));var z$r;(function(t){t.inboundSchema=Qp.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Qp.FilesApiRoutesRetrieveFileRequest$outboundSchema})(z$r||(Qp.FilesApiRoutesRetrieveFileRequest$=z$r={}));function cBo(t){return JSON.stringify(Qp.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function dBo(t){return(0,lBo.safeParse)(t,e=>Qp.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var G$r=S(em=>{"use strict";var fBo=em&&em.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pBo=em&&em.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J$r=em&&em.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fBo(r,e,n[o]);return pBo(r,e),r}}();Object.defineProperty(em,"__esModule",{value:!0});em.FilesApiRoutesUploadFileMultiPartBodyParams$=em.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=em.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=void 0;em.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=gBo;em.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=yBo;var K$r=J$r(ae()),mBo=ee(),hBo=YD(),YAe=J$r(Vt());em.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=K$r.object({purpose:YAe.FilePurpose$inboundSchema.optional(),file:YAe.FileT$inboundSchema});em.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=K$r.object({purpose:YAe.FilePurpose$outboundSchema.optional(),file:YAe.FileT$outboundSchema.or(hBo.blobLikeSchema)});var W$r;(function(t){t.inboundSchema=em.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=em.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(W$r||(em.FilesApiRoutesUploadFileMultiPartBodyParams$=W$r={}));function gBo(t){return JSON.stringify(em.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function yBo(t){return(0,mBo.safeParse)(t,e=>em.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var Y$r=S(tm=>{"use strict";var bBo=tm&&tm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Bo=tm&&tm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vBo=tm&&tm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bBo(r,e,n[o]);return _Bo(r,e),r}}();Object.defineProperty(tm,"__esModule",{value:!0});tm.JobsApiRoutesBatchCancelBatchJobRequest$=tm.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=tm.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;tm.jobsApiRoutesBatchCancelBatchJobRequestToJSON=SBo;tm.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=CBo;var QAe=vBo(ae()),Z$r=ce(),wBo=ee();tm.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=QAe.object({job_id:QAe.string()}).transform(t=>(0,Z$r.remap)(t,{job_id:"jobId"}));tm.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=QAe.object({jobId:QAe.string()}).transform(t=>(0,Z$r.remap)(t,{jobId:"job_id"}));var X$r;(function(t){t.inboundSchema=tm.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=tm.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(X$r||(tm.JobsApiRoutesBatchCancelBatchJobRequest$=X$r={}));function SBo(t){return JSON.stringify(tm.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function CBo(t){return(0,wBo.safeParse)(t,e=>tm.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var tLr=S(rm=>{"use strict";var xBo=rm&&rm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TBo=rm&&rm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBo=rm&&rm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&xBo(r,e,n[o]);return TBo(r,e),r}}();Object.defineProperty(rm,"__esModule",{value:!0});rm.JobsApiRoutesBatchGetBatchJobRequest$=rm.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=rm.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;rm.jobsApiRoutesBatchGetBatchJobRequestToJSON=PBo;rm.jobsApiRoutesBatchGetBatchJobRequestFromJSON=MBo;var eNe=OBo(ae()),eLr=ce(),EBo=ee();rm.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=eNe.object({job_id:eNe.string()}).transform(t=>(0,eLr.remap)(t,{job_id:"jobId"}));rm.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=eNe.object({jobId:eNe.string()}).transform(t=>(0,eLr.remap)(t,{jobId:"job_id"}));var Q$r;(function(t){t.inboundSchema=rm.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=rm.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(Q$r||(rm.JobsApiRoutesBatchGetBatchJobRequest$=Q$r={}));function PBo(t){return JSON.stringify(rm.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function MBo(t){return(0,EBo.safeParse)(t,e=>rm.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var aLr=S(nm=>{"use strict";var RBo=nm&&nm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IBo=nm&&nm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nLr=nm&&nm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&RBo(r,e,n[o]);return IBo(r,e),r}}();Object.defineProperty(nm,"__esModule",{value:!0});nm.JobsApiRoutesBatchGetBatchJobsRequest$=nm.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=nm.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;nm.jobsApiRoutesBatchGetBatchJobsRequestToJSON=NBo;nm.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=DBo;var tu=nLr(ae()),oLr=ce(),ABo=ee(),iLr=nLr(Vt());nm.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=tu.object({page:tu.number().int().default(0),page_size:tu.number().int().default(100),model:tu.nullable(tu.string()).optional(),agent_id:tu.nullable(tu.string()).optional(),metadata:tu.nullable(tu.record(tu.any())).optional(),created_after:tu.nullable(tu.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:tu.boolean().default(!1),status:tu.nullable(tu.array(iLr.BatchJobStatus$inboundSchema)).optional()}).transform(t=>(0,oLr.remap)(t,{page_size:"pageSize",agent_id:"agentId",created_after:"createdAfter",created_by_me:"createdByMe"}));nm.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=tu.object({page:tu.number().int().default(0),pageSize:tu.number().int().default(100),model:tu.nullable(tu.string()).optional(),agentId:tu.nullable(tu.string()).optional(),metadata:tu.nullable(tu.record(tu.any())).optional(),createdAfter:tu.nullable(tu.date().transform(t=>t.toISOString())).optional(),createdByMe:tu.boolean().default(!1),status:tu.nullable(tu.array(iLr.BatchJobStatus$outboundSchema)).optional()}).transform(t=>(0,oLr.remap)(t,{pageSize:"page_size",agentId:"agent_id",createdAfter:"created_after",createdByMe:"created_by_me"}));var rLr;(function(t){t.inboundSchema=nm.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=nm.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(rLr||(nm.JobsApiRoutesBatchGetBatchJobsRequest$=rLr={}));function NBo(t){return JSON.stringify(nm.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function DBo(t){return(0,ABo.safeParse)(t,e=>nm.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var lLr=S(om=>{"use strict";var jBo=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]}),$Bo=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LBo=om&&om.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jBo(r,e,n[o]);return $Bo(r,e),r}}();Object.defineProperty(om,"__esModule",{value:!0});om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;om.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=kBo;om.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=qBo;var tNe=LBo(ae()),uLr=ce(),FBo=ee();om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=tNe.object({model_id:tNe.string()}).transform(t=>(0,uLr.remap)(t,{model_id:"modelId"}));om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=tNe.object({modelId:tNe.string()}).transform(t=>(0,uLr.remap)(t,{modelId:"model_id"}));var sLr;(function(t){t.inboundSchema=om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(sLr||(om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=sLr={}));function kBo(t){return JSON.stringify(om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function qBo(t){return(0,FBo.safeParse)(t,e=>om.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var hLr=S(Ms=>{"use strict";var UBo=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]}),BBo=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fLr=Ms&&Ms.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UBo(r,e,n[o]);return BBo(r,e),r}}();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Ms.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=zBo;Ms.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=VBo;Ms.jobsApiRoutesFineTuningCancelFineTuningJobResponseToJSON=HBo;Ms.jobsApiRoutesFineTuningCancelFineTuningJobResponseFromJSON=WBo;var vv=fLr(ae()),pLr=ce(),mLr=ee(),rNe=fLr(Vt());Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=vv.object({job_id:vv.string()}).transform(t=>(0,pLr.remap)(t,{job_id:"jobId"}));Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=vv.object({jobId:vv.string()}).transform(t=>(0,pLr.remap)(t,{jobId:"job_id"}));var cLr;(function(t){t.inboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(cLr||(Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=cLr={}));function zBo(t){return JSON.stringify(Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function VBo(t){return(0,mLr.safeParse)(t,e=>Ms.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=vv.union([rNe.ClassifierDetailedJobOut$inboundSchema.and(vv.object({job_type:vv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),rNe.CompletionDetailedJobOut$inboundSchema.and(vv.object({job_type:vv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=vv.union([rNe.ClassifierDetailedJobOut$outboundSchema.and(vv.object({jobType:vv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),rNe.CompletionDetailedJobOut$outboundSchema.and(vv.object({jobType:vv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var dLr;(function(t){t.inboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema,t.outboundSchema=Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema})(dLr||(Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=dLr={}));function HBo(t){return JSON.stringify(Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema.parse(t))}function WBo(t){return(0,mLr.safeParse)(t,e=>Ms.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobResponse' from JSON")}});var vLr=S(Rs=>{"use strict";var JBo=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]}),KBo=Rs&&Rs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bLr=Rs&&Rs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JBo(r,e,n[o]);return KBo(r,e),r}}();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Rs.One$=Rs.One$outboundSchema=Rs.One$inboundSchema=void 0;Rs.oneToJSON=GBo;Rs.oneFromJSON=XBo;Rs.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=ZBo;Rs.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=YBo;var Kc=bLr(ae()),_Lr=ee(),WA=bLr(Vt());Rs.One$inboundSchema=Kc.union([WA.ClassifierJobOut$inboundSchema.and(Kc.object({job_type:Kc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),WA.CompletionJobOut$inboundSchema.and(Kc.object({job_type:Kc.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Rs.One$outboundSchema=Kc.union([WA.ClassifierJobOut$outboundSchema.and(Kc.object({jobType:Kc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),WA.CompletionJobOut$outboundSchema.and(Kc.object({jobType:Kc.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var gLr;(function(t){t.inboundSchema=Rs.One$inboundSchema,t.outboundSchema=Rs.One$outboundSchema})(gLr||(Rs.One$=gLr={}));function GBo(t){return JSON.stringify(Rs.One$outboundSchema.parse(t))}function XBo(t){return(0,_Lr.safeParse)(t,e=>Rs.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Kc.union([WA.LegacyJobMetadataOut$inboundSchema,Kc.union([WA.ClassifierJobOut$inboundSchema.and(Kc.object({job_type:Kc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),WA.CompletionJobOut$inboundSchema.and(Kc.object({job_type:Kc.literal("completion")}).transform(t=>({jobType:t.job_type})))])]);Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Kc.union([WA.LegacyJobMetadataOut$outboundSchema,Kc.union([WA.ClassifierJobOut$outboundSchema.and(Kc.object({jobType:Kc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),WA.CompletionJobOut$outboundSchema.and(Kc.object({jobType:Kc.literal("completion")}).transform(t=>({job_type:t.jobType})))])]);var yLr;(function(t){t.inboundSchema=Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(yLr||(Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=yLr={}));function ZBo(t){return JSON.stringify(Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function YBo(t){return(0,_Lr.safeParse)(t,e=>Rs.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var OLr=S(Is=>{"use strict";var QBo=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]}),ezo=Is&&Is.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLr=Is&&Is.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QBo(r,e,n[o]);return ezo(r,e),r}}();Object.defineProperty(Is,"__esModule",{value:!0});Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Is.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=tzo;Is.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=rzo;Is.jobsApiRoutesFineTuningGetFineTuningJobResponseToJSON=nzo;Is.jobsApiRoutesFineTuningGetFineTuningJobResponseFromJSON=ozo;var wv=CLr(ae()),xLr=ce(),TLr=ee(),nNe=CLr(Vt());Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=wv.object({job_id:wv.string()}).transform(t=>(0,xLr.remap)(t,{job_id:"jobId"}));Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=wv.object({jobId:wv.string()}).transform(t=>(0,xLr.remap)(t,{jobId:"job_id"}));var wLr;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(wLr||(Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$=wLr={}));function tzo(t){return JSON.stringify(Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function rzo(t){return(0,TLr.safeParse)(t,e=>Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=wv.union([nNe.ClassifierDetailedJobOut$inboundSchema.and(wv.object({job_type:wv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),nNe.CompletionDetailedJobOut$inboundSchema.and(wv.object({job_type:wv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=wv.union([nNe.ClassifierDetailedJobOut$outboundSchema.and(wv.object({jobType:wv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),nNe.CompletionDetailedJobOut$outboundSchema.and(wv.object({jobType:wv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var SLr;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema})(SLr||(Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$=SLr={}));function nzo(t){return JSON.stringify(Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema.parse(t))}function ozo(t){return(0,TLr.safeParse)(t,e=>Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobResponse' from JSON")}});var RLr=S(Ya=>{"use strict";var izo=Ya&&Ya.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),azo=Ya&&Ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),szo=Ya&&Ya.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&izo(r,e,n[o]);return azo(r,e),r}}();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Ya.Status$=Ya.Status$outboundSchema=Ya.Status$inboundSchema=Ya.Status=void 0;Ya.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=lzo;Ya.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=czo;var Ki=szo(ae()),MLr=ce(),uzo=ee();Ya.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Ya.Status$inboundSchema=Ki.nativeEnum(Ya.Status);Ya.Status$outboundSchema=Ya.Status$inboundSchema;var ELr;(function(t){t.inboundSchema=Ya.Status$inboundSchema,t.outboundSchema=Ya.Status$outboundSchema})(ELr||(Ya.Status$=ELr={}));Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Ki.object({page:Ki.number().int().default(0),page_size:Ki.number().int().default(100),model:Ki.nullable(Ki.string()).optional(),created_after:Ki.nullable(Ki.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_before:Ki.nullable(Ki.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Ki.boolean().default(!1),status:Ki.nullable(Ya.Status$inboundSchema).optional(),wandb_project:Ki.nullable(Ki.string()).optional(),wandb_name:Ki.nullable(Ki.string()).optional(),suffix:Ki.nullable(Ki.string()).optional()}).transform(t=>(0,MLr.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_before:"createdBefore",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Ki.object({page:Ki.number().int().default(0),pageSize:Ki.number().int().default(100),model:Ki.nullable(Ki.string()).optional(),createdAfter:Ki.nullable(Ki.date().transform(t=>t.toISOString())).optional(),createdBefore:Ki.nullable(Ki.date().transform(t=>t.toISOString())).optional(),createdByMe:Ki.boolean().default(!1),status:Ki.nullable(Ya.Status$outboundSchema).optional(),wandbProject:Ki.nullable(Ki.string()).optional(),wandbName:Ki.nullable(Ki.string()).optional(),suffix:Ki.nullable(Ki.string()).optional()}).transform(t=>(0,MLr.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdBefore:"created_before",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var PLr;(function(t){t.inboundSchema=Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(PLr||(Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=PLr={}));function lzo(t){return JSON.stringify(Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function czo(t){return(0,uzo.safeParse)(t,e=>Ya.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var $Lr=S(As=>{"use strict";var dzo=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]}),fzo=As&&As.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NLr=As&&As.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dzo(r,e,n[o]);return fzo(r,e),r}}();Object.defineProperty(As,"__esModule",{value:!0});As.JobsApiRoutesFineTuningStartFineTuningJobResponse$=As.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobRequest$=As.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;As.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=pzo;As.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=mzo;As.jobsApiRoutesFineTuningStartFineTuningJobResponseToJSON=hzo;As.jobsApiRoutesFineTuningStartFineTuningJobResponseFromJSON=gzo;var Sv=NLr(ae()),DLr=ce(),jLr=ee(),oNe=NLr(Vt());As.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=Sv.object({job_id:Sv.string()}).transform(t=>(0,DLr.remap)(t,{job_id:"jobId"}));As.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Sv.object({jobId:Sv.string()}).transform(t=>(0,DLr.remap)(t,{jobId:"job_id"}));var ILr;(function(t){t.inboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(ILr||(As.JobsApiRoutesFineTuningStartFineTuningJobRequest$=ILr={}));function pzo(t){return JSON.stringify(As.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function mzo(t){return(0,jLr.safeParse)(t,e=>As.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}As.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=Sv.union([oNe.ClassifierDetailedJobOut$inboundSchema.and(Sv.object({job_type:Sv.literal("classifier")}).transform(t=>({jobType:t.job_type}))),oNe.CompletionDetailedJobOut$inboundSchema.and(Sv.object({job_type:Sv.literal("completion")}).transform(t=>({jobType:t.job_type})))]);As.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=Sv.union([oNe.ClassifierDetailedJobOut$outboundSchema.and(Sv.object({jobType:Sv.literal("classifier")}).transform(t=>({job_type:t.jobType}))),oNe.CompletionDetailedJobOut$outboundSchema.and(Sv.object({jobType:Sv.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var ALr;(function(t){t.inboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema,t.outboundSchema=As.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema})(ALr||(As.JobsApiRoutesFineTuningStartFineTuningJobResponse$=ALr={}));function hzo(t){return JSON.stringify(As.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema.parse(t))}function gzo(t){return(0,jLr.safeParse)(t,e=>As.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobResponse' from JSON")}});var kLr=S(im=>{"use strict";var yzo=im&&im.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bzo=im&&im.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_zo=im&&im.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yzo(r,e,n[o]);return bzo(r,e),r}}();Object.defineProperty(im,"__esModule",{value:!0});im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;im.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=wzo;im.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=Szo;var iNe=_zo(ae()),FLr=ce(),vzo=ee();im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=iNe.object({model_id:iNe.string()}).transform(t=>(0,FLr.remap)(t,{model_id:"modelId"}));im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=iNe.object({modelId:iNe.string()}).transform(t=>(0,FLr.remap)(t,{modelId:"model_id"}));var LLr;(function(t){t.inboundSchema=im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(LLr||(im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=LLr={}));function wzo(t){return JSON.stringify(im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function Szo(t){return(0,vzo.safeParse)(t,e=>im.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var HLr=S(Ns=>{"use strict";var Czo=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]}),xzo=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BLr=Ns&&Ns.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Czo(r,e,n[o]);return xzo(r,e),r}}();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Ns.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=Tzo;Ns.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=Ozo;Ns.jobsApiRoutesFineTuningUpdateFineTunedModelResponseToJSON=Ezo;Ns.jobsApiRoutesFineTuningUpdateFineTunedModelResponseFromJSON=Pzo;var Cv=BLr(ae()),zLr=ce(),VLr=ee(),N7=BLr(Vt());Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=Cv.object({model_id:Cv.string(),UpdateFTModelIn:N7.UpdateFTModelIn$inboundSchema}).transform(t=>(0,zLr.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Cv.object({modelId:Cv.string(),updateFTModelIn:N7.UpdateFTModelIn$outboundSchema}).transform(t=>(0,zLr.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var qLr;(function(t){t.inboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(qLr||(Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=qLr={}));function Tzo(t){return JSON.stringify(Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function Ozo(t){return(0,VLr.safeParse)(t,e=>Ns.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=Cv.union([N7.ClassifierFTModelOut$inboundSchema.and(Cv.object({model_type:Cv.literal("classifier")}).transform(t=>({modelType:t.model_type}))),N7.CompletionFTModelOut$inboundSchema.and(Cv.object({model_type:Cv.literal("completion")}).transform(t=>({modelType:t.model_type})))]);Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=Cv.union([N7.ClassifierFTModelOut$outboundSchema.and(Cv.object({modelType:Cv.literal("classifier")}).transform(t=>({model_type:t.modelType}))),N7.CompletionFTModelOut$outboundSchema.and(Cv.object({modelType:Cv.literal("completion")}).transform(t=>({model_type:t.modelType})))]);var ULr;(function(t){t.inboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema,t.outboundSchema=Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema})(ULr||(Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=ULr={}));function Ezo(t){return JSON.stringify(Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema.parse(t))}function Pzo(t){return(0,VLr.safeParse)(t,e=>Ns.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelResponse' from JSON")}});var KLr=S(am=>{"use strict";var Mzo=am&&am.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Rzo=am&&am.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Izo=am&&am.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Mzo(r,e,n[o]);return Rzo(r,e),r}}();Object.defineProperty(am,"__esModule",{value:!0});am.LibrariesDeleteV1Request$=am.LibrariesDeleteV1Request$outboundSchema=am.LibrariesDeleteV1Request$inboundSchema=void 0;am.librariesDeleteV1RequestToJSON=Nzo;am.librariesDeleteV1RequestFromJSON=Dzo;var aNe=Izo(ae()),JLr=ce(),Azo=ee();am.LibrariesDeleteV1Request$inboundSchema=aNe.object({library_id:aNe.string()}).transform(t=>(0,JLr.remap)(t,{library_id:"libraryId"}));am.LibrariesDeleteV1Request$outboundSchema=aNe.object({libraryId:aNe.string()}).transform(t=>(0,JLr.remap)(t,{libraryId:"library_id"}));var WLr;(function(t){t.inboundSchema=am.LibrariesDeleteV1Request$inboundSchema,t.outboundSchema=am.LibrariesDeleteV1Request$outboundSchema})(WLr||(am.LibrariesDeleteV1Request$=WLr={}));function Nzo(t){return JSON.stringify(am.LibrariesDeleteV1Request$outboundSchema.parse(t))}function Dzo(t){return(0,Azo.safeParse)(t,e=>am.LibrariesDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDeleteV1Request' from JSON")}});var ZLr=S(sm=>{"use strict";var jzo=sm&&sm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$zo=sm&&sm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lzo=sm&&sm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jzo(r,e,n[o]);return $zo(r,e),r}}();Object.defineProperty(sm,"__esModule",{value:!0});sm.LibrariesDocumentsDeleteV1Request$=sm.LibrariesDocumentsDeleteV1Request$outboundSchema=sm.LibrariesDocumentsDeleteV1Request$inboundSchema=void 0;sm.librariesDocumentsDeleteV1RequestToJSON=kzo;sm.librariesDocumentsDeleteV1RequestFromJSON=qzo;var D7=Lzo(ae()),XLr=ce(),Fzo=ee();sm.LibrariesDocumentsDeleteV1Request$inboundSchema=D7.object({library_id:D7.string(),document_id:D7.string()}).transform(t=>(0,XLr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));sm.LibrariesDocumentsDeleteV1Request$outboundSchema=D7.object({libraryId:D7.string(),documentId:D7.string()}).transform(t=>(0,XLr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var GLr;(function(t){t.inboundSchema=sm.LibrariesDocumentsDeleteV1Request$inboundSchema,t.outboundSchema=sm.LibrariesDocumentsDeleteV1Request$outboundSchema})(GLr||(sm.LibrariesDocumentsDeleteV1Request$=GLr={}));function kzo(t){return JSON.stringify(sm.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(t))}function qzo(t){return(0,Fzo.safeParse)(t,e=>sm.LibrariesDocumentsDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsDeleteV1Request' from JSON")}});var eFr=S(um=>{"use strict";var Uzo=um&&um.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bzo=um&&um.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zzo=um&&um.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uzo(r,e,n[o]);return Bzo(r,e),r}}();Object.defineProperty(um,"__esModule",{value:!0});um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=void 0;um.librariesDocumentsGetExtractedTextSignedUrlV1RequestToJSON=Hzo;um.librariesDocumentsGetExtractedTextSignedUrlV1RequestFromJSON=Wzo;var j7=zzo(ae()),QLr=ce(),Vzo=ee();um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=j7.object({library_id:j7.string(),document_id:j7.string()}).transform(t=>(0,QLr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=j7.object({libraryId:j7.string(),documentId:j7.string()}).transform(t=>(0,QLr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var YLr;(function(t){t.inboundSchema=um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema,t.outboundSchema=um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema})(YLr||(um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=YLr={}));function Hzo(t){return JSON.stringify(um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(t))}function Wzo(t){return(0,Vzo.safeParse)(t,e=>um.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetExtractedTextSignedUrlV1Request' from JSON")}});var nFr=S(lm=>{"use strict";var Jzo=lm&&lm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Kzo=lm&&lm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gzo=lm&&lm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Jzo(r,e,n[o]);return Kzo(r,e),r}}();Object.defineProperty(lm,"__esModule",{value:!0});lm.LibrariesDocumentsGetSignedUrlV1Request$=lm.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=lm.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=void 0;lm.librariesDocumentsGetSignedUrlV1RequestToJSON=Zzo;lm.librariesDocumentsGetSignedUrlV1RequestFromJSON=Yzo;var $7=Gzo(ae()),rFr=ce(),Xzo=ee();lm.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=$7.object({library_id:$7.string(),document_id:$7.string()}).transform(t=>(0,rFr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));lm.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=$7.object({libraryId:$7.string(),documentId:$7.string()}).transform(t=>(0,rFr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var tFr;(function(t){t.inboundSchema=lm.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema,t.outboundSchema=lm.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema})(tFr||(lm.LibrariesDocumentsGetSignedUrlV1Request$=tFr={}));function Zzo(t){return JSON.stringify(lm.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(t))}function Yzo(t){return(0,Xzo.safeParse)(t,e=>lm.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetSignedUrlV1Request' from JSON")}});var aFr=S(cm=>{"use strict";var Qzo=cm&&cm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e4o=cm&&cm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t4o=cm&&cm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qzo(r,e,n[o]);return e4o(r,e),r}}();Object.defineProperty(cm,"__esModule",{value:!0});cm.LibrariesDocumentsGetStatusV1Request$=cm.LibrariesDocumentsGetStatusV1Request$outboundSchema=cm.LibrariesDocumentsGetStatusV1Request$inboundSchema=void 0;cm.librariesDocumentsGetStatusV1RequestToJSON=n4o;cm.librariesDocumentsGetStatusV1RequestFromJSON=o4o;var L7=t4o(ae()),iFr=ce(),r4o=ee();cm.LibrariesDocumentsGetStatusV1Request$inboundSchema=L7.object({library_id:L7.string(),document_id:L7.string()}).transform(t=>(0,iFr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));cm.LibrariesDocumentsGetStatusV1Request$outboundSchema=L7.object({libraryId:L7.string(),documentId:L7.string()}).transform(t=>(0,iFr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var oFr;(function(t){t.inboundSchema=cm.LibrariesDocumentsGetStatusV1Request$inboundSchema,t.outboundSchema=cm.LibrariesDocumentsGetStatusV1Request$outboundSchema})(oFr||(cm.LibrariesDocumentsGetStatusV1Request$=oFr={}));function n4o(t){return JSON.stringify(cm.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(t))}function o4o(t){return(0,r4o.safeParse)(t,e=>cm.LibrariesDocumentsGetStatusV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetStatusV1Request' from JSON")}});var lFr=S(dm=>{"use strict";var i4o=dm&&dm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),a4o=dm&&dm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s4o=dm&&dm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&i4o(r,e,n[o]);return a4o(r,e),r}}();Object.defineProperty(dm,"__esModule",{value:!0});dm.LibrariesDocumentsGetTextContentV1Request$=dm.LibrariesDocumentsGetTextContentV1Request$outboundSchema=dm.LibrariesDocumentsGetTextContentV1Request$inboundSchema=void 0;dm.librariesDocumentsGetTextContentV1RequestToJSON=l4o;dm.librariesDocumentsGetTextContentV1RequestFromJSON=c4o;var F7=s4o(ae()),uFr=ce(),u4o=ee();dm.LibrariesDocumentsGetTextContentV1Request$inboundSchema=F7.object({library_id:F7.string(),document_id:F7.string()}).transform(t=>(0,uFr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));dm.LibrariesDocumentsGetTextContentV1Request$outboundSchema=F7.object({libraryId:F7.string(),documentId:F7.string()}).transform(t=>(0,uFr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var sFr;(function(t){t.inboundSchema=dm.LibrariesDocumentsGetTextContentV1Request$inboundSchema,t.outboundSchema=dm.LibrariesDocumentsGetTextContentV1Request$outboundSchema})(sFr||(dm.LibrariesDocumentsGetTextContentV1Request$=sFr={}));function l4o(t){return JSON.stringify(dm.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(t))}function c4o(t){return(0,u4o.safeParse)(t,e=>dm.LibrariesDocumentsGetTextContentV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetTextContentV1Request' from JSON")}});var fFr=S(fm=>{"use strict";var d4o=fm&&fm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f4o=fm&&fm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p4o=fm&&fm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d4o(r,e,n[o]);return f4o(r,e),r}}();Object.defineProperty(fm,"__esModule",{value:!0});fm.LibrariesDocumentsGetV1Request$=fm.LibrariesDocumentsGetV1Request$outboundSchema=fm.LibrariesDocumentsGetV1Request$inboundSchema=void 0;fm.librariesDocumentsGetV1RequestToJSON=h4o;fm.librariesDocumentsGetV1RequestFromJSON=g4o;var k7=p4o(ae()),dFr=ce(),m4o=ee();fm.LibrariesDocumentsGetV1Request$inboundSchema=k7.object({library_id:k7.string(),document_id:k7.string()}).transform(t=>(0,dFr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));fm.LibrariesDocumentsGetV1Request$outboundSchema=k7.object({libraryId:k7.string(),documentId:k7.string()}).transform(t=>(0,dFr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var cFr;(function(t){t.inboundSchema=fm.LibrariesDocumentsGetV1Request$inboundSchema,t.outboundSchema=fm.LibrariesDocumentsGetV1Request$outboundSchema})(cFr||(fm.LibrariesDocumentsGetV1Request$=cFr={}));function h4o(t){return JSON.stringify(fm.LibrariesDocumentsGetV1Request$outboundSchema.parse(t))}function g4o(t){return(0,m4o.safeParse)(t,e=>fm.LibrariesDocumentsGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetV1Request' from JSON")}});var hFr=S(pm=>{"use strict";var y4o=pm&&pm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b4o=pm&&pm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_4o=pm&&pm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&y4o(r,e,n[o]);return b4o(r,e),r}}();Object.defineProperty(pm,"__esModule",{value:!0});pm.LibrariesDocumentsListV1Request$=pm.LibrariesDocumentsListV1Request$outboundSchema=pm.LibrariesDocumentsListV1Request$inboundSchema=void 0;pm.librariesDocumentsListV1RequestToJSON=w4o;pm.librariesDocumentsListV1RequestFromJSON=S4o;var db=_4o(ae()),mFr=ce(),v4o=ee();pm.LibrariesDocumentsListV1Request$inboundSchema=db.object({library_id:db.string(),search:db.nullable(db.string()).optional(),page_size:db.number().int().default(100),page:db.number().int().default(0),sort_by:db.string().default("created_at"),sort_order:db.string().default("desc")}).transform(t=>(0,mFr.remap)(t,{library_id:"libraryId",page_size:"pageSize",sort_by:"sortBy",sort_order:"sortOrder"}));pm.LibrariesDocumentsListV1Request$outboundSchema=db.object({libraryId:db.string(),search:db.nullable(db.string()).optional(),pageSize:db.number().int().default(100),page:db.number().int().default(0),sortBy:db.string().default("created_at"),sortOrder:db.string().default("desc")}).transform(t=>(0,mFr.remap)(t,{libraryId:"library_id",pageSize:"page_size",sortBy:"sort_by",sortOrder:"sort_order"}));var pFr;(function(t){t.inboundSchema=pm.LibrariesDocumentsListV1Request$inboundSchema,t.outboundSchema=pm.LibrariesDocumentsListV1Request$outboundSchema})(pFr||(pm.LibrariesDocumentsListV1Request$=pFr={}));function w4o(t){return JSON.stringify(pm.LibrariesDocumentsListV1Request$outboundSchema.parse(t))}function S4o(t){return(0,v4o.safeParse)(t,e=>pm.LibrariesDocumentsListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsListV1Request' from JSON")}});var bFr=S(mm=>{"use strict";var C4o=mm&&mm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x4o=mm&&mm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T4o=mm&&mm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&C4o(r,e,n[o]);return x4o(r,e),r}}();Object.defineProperty(mm,"__esModule",{value:!0});mm.LibrariesDocumentsReprocessV1Request$=mm.LibrariesDocumentsReprocessV1Request$outboundSchema=mm.LibrariesDocumentsReprocessV1Request$inboundSchema=void 0;mm.librariesDocumentsReprocessV1RequestToJSON=E4o;mm.librariesDocumentsReprocessV1RequestFromJSON=P4o;var q7=T4o(ae()),yFr=ce(),O4o=ee();mm.LibrariesDocumentsReprocessV1Request$inboundSchema=q7.object({library_id:q7.string(),document_id:q7.string()}).transform(t=>(0,yFr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));mm.LibrariesDocumentsReprocessV1Request$outboundSchema=q7.object({libraryId:q7.string(),documentId:q7.string()}).transform(t=>(0,yFr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var gFr;(function(t){t.inboundSchema=mm.LibrariesDocumentsReprocessV1Request$inboundSchema,t.outboundSchema=mm.LibrariesDocumentsReprocessV1Request$outboundSchema})(gFr||(mm.LibrariesDocumentsReprocessV1Request$=gFr={}));function E4o(t){return JSON.stringify(mm.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(t))}function P4o(t){return(0,O4o.safeParse)(t,e=>mm.LibrariesDocumentsReprocessV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsReprocessV1Request' from JSON")}});var CFr=S(hm=>{"use strict";var M4o=hm&&hm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R4o=hm&&hm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vFr=hm&&hm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M4o(r,e,n[o]);return R4o(r,e),r}}();Object.defineProperty(hm,"__esModule",{value:!0});hm.LibrariesDocumentsUpdateV1Request$=hm.LibrariesDocumentsUpdateV1Request$outboundSchema=hm.LibrariesDocumentsUpdateV1Request$inboundSchema=void 0;hm.librariesDocumentsUpdateV1RequestToJSON=A4o;hm.librariesDocumentsUpdateV1RequestFromJSON=N4o;var U7=vFr(ae()),wFr=ce(),I4o=ee(),SFr=vFr(Vt());hm.LibrariesDocumentsUpdateV1Request$inboundSchema=U7.object({library_id:U7.string(),document_id:U7.string(),DocumentUpdateIn:SFr.DocumentUpdateIn$inboundSchema}).transform(t=>(0,wFr.remap)(t,{library_id:"libraryId",document_id:"documentId",DocumentUpdateIn:"documentUpdateIn"}));hm.LibrariesDocumentsUpdateV1Request$outboundSchema=U7.object({libraryId:U7.string(),documentId:U7.string(),documentUpdateIn:SFr.DocumentUpdateIn$outboundSchema}).transform(t=>(0,wFr.remap)(t,{libraryId:"library_id",documentId:"document_id",documentUpdateIn:"DocumentUpdateIn"}));var _Fr;(function(t){t.inboundSchema=hm.LibrariesDocumentsUpdateV1Request$inboundSchema,t.outboundSchema=hm.LibrariesDocumentsUpdateV1Request$outboundSchema})(_Fr||(hm.LibrariesDocumentsUpdateV1Request$=_Fr={}));function A4o(t){return JSON.stringify(hm.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(t))}function N4o(t){return(0,I4o.safeParse)(t,e=>hm.LibrariesDocumentsUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUpdateV1Request' from JSON")}});var RFr=S(Qa=>{"use strict";var D4o=Qa&&Qa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j4o=Qa&&Qa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OFr=Qa&&Qa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D4o(r,e,n[o]);return j4o(r,e),r}}();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.LibrariesDocumentsUploadV1Request$=Qa.LibrariesDocumentsUploadV1Request$outboundSchema=Qa.LibrariesDocumentsUploadV1Request$inboundSchema=Qa.LibrariesDocumentsUploadV1DocumentUpload$=Qa.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=Qa.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=void 0;Qa.librariesDocumentsUploadV1DocumentUploadToJSON=L4o;Qa.librariesDocumentsUploadV1DocumentUploadFromJSON=F4o;Qa.librariesDocumentsUploadV1RequestToJSON=k4o;Qa.librariesDocumentsUploadV1RequestFromJSON=q4o;var _U=OFr(ae()),EFr=ce(),PFr=ee(),$4o=YD(),MFr=OFr(Vt());Qa.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=_U.object({file:MFr.FileT$inboundSchema});Qa.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=_U.object({file:MFr.FileT$outboundSchema.or($4o.blobLikeSchema)});var xFr;(function(t){t.inboundSchema=Qa.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema,t.outboundSchema=Qa.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema})(xFr||(Qa.LibrariesDocumentsUploadV1DocumentUpload$=xFr={}));function L4o(t){return JSON.stringify(Qa.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema.parse(t))}function F4o(t){return(0,PFr.safeParse)(t,e=>Qa.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1DocumentUpload' from JSON")}Qa.LibrariesDocumentsUploadV1Request$inboundSchema=_U.object({library_id:_U.string(),RequestBody:_U.lazy(()=>Qa.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema)}).transform(t=>(0,EFr.remap)(t,{library_id:"libraryId",RequestBody:"requestBody"}));Qa.LibrariesDocumentsUploadV1Request$outboundSchema=_U.object({libraryId:_U.string(),requestBody:_U.lazy(()=>Qa.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema)}).transform(t=>(0,EFr.remap)(t,{libraryId:"library_id",requestBody:"RequestBody"}));var TFr;(function(t){t.inboundSchema=Qa.LibrariesDocumentsUploadV1Request$inboundSchema,t.outboundSchema=Qa.LibrariesDocumentsUploadV1Request$outboundSchema})(TFr||(Qa.LibrariesDocumentsUploadV1Request$=TFr={}));function k4o(t){return JSON.stringify(Qa.LibrariesDocumentsUploadV1Request$outboundSchema.parse(t))}function q4o(t){return(0,PFr.safeParse)(t,e=>Qa.LibrariesDocumentsUploadV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1Request' from JSON")}});var NFr=S(gm=>{"use strict";var U4o=gm&&gm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B4o=gm&&gm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z4o=gm&&gm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U4o(r,e,n[o]);return B4o(r,e),r}}();Object.defineProperty(gm,"__esModule",{value:!0});gm.LibrariesGetV1Request$=gm.LibrariesGetV1Request$outboundSchema=gm.LibrariesGetV1Request$inboundSchema=void 0;gm.librariesGetV1RequestToJSON=H4o;gm.librariesGetV1RequestFromJSON=W4o;var sNe=z4o(ae()),AFr=ce(),V4o=ee();gm.LibrariesGetV1Request$inboundSchema=sNe.object({library_id:sNe.string()}).transform(t=>(0,AFr.remap)(t,{library_id:"libraryId"}));gm.LibrariesGetV1Request$outboundSchema=sNe.object({libraryId:sNe.string()}).transform(t=>(0,AFr.remap)(t,{libraryId:"library_id"}));var IFr;(function(t){t.inboundSchema=gm.LibrariesGetV1Request$inboundSchema,t.outboundSchema=gm.LibrariesGetV1Request$outboundSchema})(IFr||(gm.LibrariesGetV1Request$=IFr={}));function H4o(t){return JSON.stringify(gm.LibrariesGetV1Request$outboundSchema.parse(t))}function W4o(t){return(0,V4o.safeParse)(t,e=>gm.LibrariesGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesGetV1Request' from JSON")}});var FFr=S(ym=>{"use strict";var J4o=ym&&ym.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K4o=ym&&ym.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jFr=ym&&ym.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J4o(r,e,n[o]);return K4o(r,e),r}}();Object.defineProperty(ym,"__esModule",{value:!0});ym.LibrariesShareCreateV1Request$=ym.LibrariesShareCreateV1Request$outboundSchema=ym.LibrariesShareCreateV1Request$inboundSchema=void 0;ym.librariesShareCreateV1RequestToJSON=X4o;ym.librariesShareCreateV1RequestFromJSON=Z4o;var uNe=jFr(ae()),$Fr=ce(),G4o=ee(),LFr=jFr(Vt());ym.LibrariesShareCreateV1Request$inboundSchema=uNe.object({library_id:uNe.string(),SharingIn:LFr.SharingIn$inboundSchema}).transform(t=>(0,$Fr.remap)(t,{library_id:"libraryId",SharingIn:"sharingIn"}));ym.LibrariesShareCreateV1Request$outboundSchema=uNe.object({libraryId:uNe.string(),sharingIn:LFr.SharingIn$outboundSchema}).transform(t=>(0,$Fr.remap)(t,{libraryId:"library_id",sharingIn:"SharingIn"}));var DFr;(function(t){t.inboundSchema=ym.LibrariesShareCreateV1Request$inboundSchema,t.outboundSchema=ym.LibrariesShareCreateV1Request$outboundSchema})(DFr||(ym.LibrariesShareCreateV1Request$=DFr={}));function X4o(t){return JSON.stringify(ym.LibrariesShareCreateV1Request$outboundSchema.parse(t))}function Z4o(t){return(0,G4o.safeParse)(t,e=>ym.LibrariesShareCreateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareCreateV1Request' from JSON")}});var zFr=S(bm=>{"use strict";var Y4o=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]}),Q4o=bm&&bm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qFr=bm&&bm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y4o(r,e,n[o]);return Q4o(r,e),r}}();Object.defineProperty(bm,"__esModule",{value:!0});bm.LibrariesShareDeleteV1Request$=bm.LibrariesShareDeleteV1Request$outboundSchema=bm.LibrariesShareDeleteV1Request$inboundSchema=void 0;bm.librariesShareDeleteV1RequestToJSON=t2o;bm.librariesShareDeleteV1RequestFromJSON=r2o;var lNe=qFr(ae()),UFr=ce(),e2o=ee(),BFr=qFr(Vt());bm.LibrariesShareDeleteV1Request$inboundSchema=lNe.object({library_id:lNe.string(),SharingDelete:BFr.SharingDelete$inboundSchema}).transform(t=>(0,UFr.remap)(t,{library_id:"libraryId",SharingDelete:"sharingDelete"}));bm.LibrariesShareDeleteV1Request$outboundSchema=lNe.object({libraryId:lNe.string(),sharingDelete:BFr.SharingDelete$outboundSchema}).transform(t=>(0,UFr.remap)(t,{libraryId:"library_id",sharingDelete:"SharingDelete"}));var kFr;(function(t){t.inboundSchema=bm.LibrariesShareDeleteV1Request$inboundSchema,t.outboundSchema=bm.LibrariesShareDeleteV1Request$outboundSchema})(kFr||(bm.LibrariesShareDeleteV1Request$=kFr={}));function t2o(t){return JSON.stringify(bm.LibrariesShareDeleteV1Request$outboundSchema.parse(t))}function r2o(t){return(0,e2o.safeParse)(t,e=>bm.LibrariesShareDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareDeleteV1Request' from JSON")}});var WFr=S(_m=>{"use strict";var n2o=_m&&_m.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o2o=_m&&_m.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i2o=_m&&_m.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n2o(r,e,n[o]);return o2o(r,e),r}}();Object.defineProperty(_m,"__esModule",{value:!0});_m.LibrariesShareListV1Request$=_m.LibrariesShareListV1Request$outboundSchema=_m.LibrariesShareListV1Request$inboundSchema=void 0;_m.librariesShareListV1RequestToJSON=s2o;_m.librariesShareListV1RequestFromJSON=u2o;var cNe=i2o(ae()),HFr=ce(),a2o=ee();_m.LibrariesShareListV1Request$inboundSchema=cNe.object({library_id:cNe.string()}).transform(t=>(0,HFr.remap)(t,{library_id:"libraryId"}));_m.LibrariesShareListV1Request$outboundSchema=cNe.object({libraryId:cNe.string()}).transform(t=>(0,HFr.remap)(t,{libraryId:"library_id"}));var VFr;(function(t){t.inboundSchema=_m.LibrariesShareListV1Request$inboundSchema,t.outboundSchema=_m.LibrariesShareListV1Request$outboundSchema})(VFr||(_m.LibrariesShareListV1Request$=VFr={}));function s2o(t){return JSON.stringify(_m.LibrariesShareListV1Request$outboundSchema.parse(t))}function u2o(t){return(0,a2o.safeParse)(t,e=>_m.LibrariesShareListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareListV1Request' from JSON")}});var ZFr=S(vm=>{"use strict";var l2o=vm&&vm.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),c2o=vm&&vm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KFr=vm&&vm.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l2o(r,e,n[o]);return c2o(r,e),r}}();Object.defineProperty(vm,"__esModule",{value:!0});vm.LibrariesUpdateV1Request$=vm.LibrariesUpdateV1Request$outboundSchema=vm.LibrariesUpdateV1Request$inboundSchema=void 0;vm.librariesUpdateV1RequestToJSON=f2o;vm.librariesUpdateV1RequestFromJSON=p2o;var dNe=KFr(ae()),GFr=ce(),d2o=ee(),XFr=KFr(Vt());vm.LibrariesUpdateV1Request$inboundSchema=dNe.object({library_id:dNe.string(),LibraryInUpdate:XFr.LibraryInUpdate$inboundSchema}).transform(t=>(0,GFr.remap)(t,{library_id:"libraryId",LibraryInUpdate:"libraryInUpdate"}));vm.LibrariesUpdateV1Request$outboundSchema=dNe.object({libraryId:dNe.string(),libraryInUpdate:XFr.LibraryInUpdate$outboundSchema}).transform(t=>(0,GFr.remap)(t,{libraryId:"library_id",libraryInUpdate:"LibraryInUpdate"}));var JFr;(function(t){t.inboundSchema=vm.LibrariesUpdateV1Request$inboundSchema,t.outboundSchema=vm.LibrariesUpdateV1Request$outboundSchema})(JFr||(vm.LibrariesUpdateV1Request$=JFr={}));function f2o(t){return JSON.stringify(vm.LibrariesUpdateV1Request$outboundSchema.parse(t))}function p2o(t){return(0,d2o.safeParse)(t,e=>vm.LibrariesUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesUpdateV1Request' from JSON")}});var nkr=S(Ds=>{"use strict";var m2o=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]}),h2o=Ds&&Ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ekr=Ds&&Ds.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m2o(r,e,n[o]);return h2o(r,e),r}}();Object.defineProperty(Ds,"__esModule",{value:!0});Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Ds.RetrieveModelV1ModelsModelIdGetRequest$=Ds.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Ds.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Ds.retrieveModelV1ModelsModelIdGetRequestToJSON=g2o;Ds.retrieveModelV1ModelsModelIdGetRequestFromJSON=y2o;Ds.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=b2o;Ds.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=_2o;var xv=ekr(ae()),tkr=ce(),rkr=ee(),fNe=ekr(Vt());Ds.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=xv.object({model_id:xv.string()}).transform(t=>(0,tkr.remap)(t,{model_id:"modelId"}));Ds.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=xv.object({modelId:xv.string()}).transform(t=>(0,tkr.remap)(t,{modelId:"model_id"}));var YFr;(function(t){t.inboundSchema=Ds.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Ds.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(YFr||(Ds.RetrieveModelV1ModelsModelIdGetRequest$=YFr={}));function g2o(t){return JSON.stringify(Ds.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function y2o(t){return(0,rkr.safeParse)(t,e=>Ds.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=xv.union([fNe.FTModelCard$inboundSchema.and(xv.object({type:xv.literal("fine-tuned")}).transform(t=>({type:t.type}))),fNe.BaseModelCard$inboundSchema.and(xv.object({type:xv.literal("base")}).transform(t=>({type:t.type})))]);Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=xv.union([fNe.FTModelCard$outboundSchema.and(xv.object({type:xv.literal("fine-tuned")}).transform(t=>({type:t.type}))),fNe.BaseModelCard$outboundSchema.and(xv.object({type:xv.literal("base")}).transform(t=>({type:t.type})))]);var QFr;(function(t){t.inboundSchema=Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(QFr||(Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=QFr={}));function b2o(t){return JSON.stringify(Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function _2o(t){return(0,rkr.safeParse)(t,e=>Ds.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var eo=S(hn=>{"use strict";var v2o=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),io=hn&&hn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v2o(e,t,r)};Object.defineProperty(hn,"__esModule",{value:!0});io(Ijr(),hn);io(Djr(),hn);io(kjr(),hn);io(Bjr(),hn);io(Jjr(),hn);io(Yjr(),hn);io(o$r(),hn);io(s$r(),hn);io(p$r(),hn);io(g$r(),hn);io(w$r(),hn);io(O$r(),hn);io(M$r(),hn);io(A$r(),hn);io(j$r(),hn);io(F$r(),hn);io(B$r(),hn);io(H$r(),hn);io(G$r(),hn);io(Y$r(),hn);io(tLr(),hn);io(aLr(),hn);io(lLr(),hn);io(hLr(),hn);io(vLr(),hn);io(OLr(),hn);io(RLr(),hn);io($Lr(),hn);io(kLr(),hn);io(HLr(),hn);io(KLr(),hn);io(ZLr(),hn);io(eFr(),hn);io(nFr(),hn);io(aFr(),hn);io(lFr(),hn);io(fFr(),hn);io(hFr(),hn);io(bFr(),hn);io(CFr(),hn);io(RFr(),hn);io(NFr(),hn);io(FFr(),hn);io(zFr(),hn);io(WFr(),hn);io(ZFr(),hn);io(nkr(),hn)});var ikr=S(aj=>{"use strict";var w2o=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]}),S2o=aj&&aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xdt=aj&&aj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w2o(r,e,n[o]);return S2o(r,e),r}}();Object.defineProperty(aj,"__esModule",{value:!0});aj.batchJobsCancel=R2o;var C2o=Cr(),pNe=xdt(gr()),x2o=ce(),T2o=ee(),okr=yr(),O2o=fr(),E2o=xdt(Vt()),P2o=xdt(eo()),M2o=br();function R2o(t,e,r){return new M2o.APIPromise(I2o(t,e,r))}async function I2o(t,e,r){let n=(0,T2o.safeParse)(e,b=>P2o.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,C2o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,O2o.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,x2o.compactMap)({Accept:"application/json"})),l=await(0,okr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,okr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await pNe.match(pNe.json(200,E2o.BatchJobOut$inboundSchema),pNe.fail("4XX"),pNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var lkr=S(sj=>{"use strict";var A2o=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]}),N2o=sj&&sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ukr=sj&&sj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&A2o(r,e,n[o]);return N2o(r,e),r}}();Object.defineProperty(sj,"__esModule",{value:!0});sj.batchJobsCreate=k2o;var D2o=Cr(),mNe=ukr(gr()),j2o=ce(),$2o=ee(),akr=yr(),L2o=fr(),skr=ukr(Vt()),F2o=br();function k2o(t,e,r){return new F2o.APIPromise(q2o(t,e,r))}async function q2o(t,e,r){let n=(0,$2o.safeParse)(e,g=>skr.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,D2o.encodeJSON)("body",o,{explode:!0}),a=(0,L2o.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,j2o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,akr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,akr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await mNe.match(mNe.json(200,skr.BatchJobOut$inboundSchema),mNe.fail("4XX"),mNe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var dkr=S(uj=>{"use strict";var U2o=uj&&uj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),B2o=uj&&uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tdt=uj&&uj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&U2o(r,e,n[o]);return B2o(r,e),r}}();Object.defineProperty(uj,"__esModule",{value:!0});uj.batchJobsGet=X2o;var z2o=Cr(),hNe=Tdt(gr()),V2o=ce(),H2o=ee(),ckr=yr(),W2o=fr(),J2o=Tdt(Vt()),K2o=Tdt(eo()),G2o=br();function X2o(t,e,r){return new G2o.APIPromise(Z2o(t,e,r))}async function Z2o(t,e,r){let n=(0,H2o.safeParse)(e,b=>K2o.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,z2o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,W2o.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,V2o.compactMap)({Accept:"application/json"})),l=await(0,ckr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ckr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await hNe.match(hNe.json(200,J2o.BatchJobOut$inboundSchema),hNe.fail("4XX"),hNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var pkr=S(lj=>{"use strict";var Y2o=lj&&lj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q2o=lj&&lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Odt=lj&&lj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Y2o(r,e,n[o]);return Q2o(r,e),r}}();Object.defineProperty(lj,"__esModule",{value:!0});lj.batchJobsList=sVo;var eVo=Cr(),gNe=Odt(gr()),tVo=ce(),rVo=ee(),fkr=yr(),nVo=fr(),oVo=Odt(Vt()),iVo=Odt(eo()),aVo=br();function sVo(t,e,r){return new aVo.APIPromise(uVo(t,e,r))}async function uVo(t,e,r){let n=(0,rVo.safeParse)(e,b=>iVo.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,nVo.pathToFunc)("/v1/batch/jobs")(),s=(0,eVo.encodeFormQuery)({agent_id:o?.agent_id,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,tVo.compactMap)({Accept:"application/json"})),l=await(0,fkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,fkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await gNe.match(gNe.json(200,oVo.BatchJobsOut$inboundSchema),gNe.fail("4XX"),gNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var mkr=S(bNe=>{"use strict";Object.defineProperty(bNe,"__esModule",{value:!0});bNe.MistralJobs=void 0;var lVo=ikr(),cVo=lkr(),dVo=dkr(),fVo=pkr(),pVo=Wc(),yNe=kd(),Edt=class extends pVo.ClientSDK{async list(e,r){return(0,yNe.unwrapAsync)((0,fVo.batchJobsList)(this,e,r))}async create(e,r){return(0,yNe.unwrapAsync)((0,cVo.batchJobsCreate)(this,e,r))}async get(e,r){return(0,yNe.unwrapAsync)((0,dVo.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,yNe.unwrapAsync)((0,lVo.batchJobsCancel)(this,e,r))}};bNe.MistralJobs=Edt});var hkr=S(_Ne=>{"use strict";Object.defineProperty(_Ne,"__esModule",{value:!0});_Ne.Batch=void 0;var mVo=Wc(),hVo=mkr(),Pdt=class extends mVo.ClientSDK{get jobs(){return this._jobs??(this._jobs=new hVo.MistralJobs(this._options))}};_Ne.Batch=Pdt});var bkr=S(cj=>{"use strict";var gVo=cj&&cj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yVo=cj&&cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vNe=cj&&cj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gVo(r,e,n[o]);return yVo(r,e),r}}();Object.defineProperty(cj,"__esModule",{value:!0});cj.betaConversationsAppend=TVo;var gkr=Cr(),Xse=vNe(gr()),bVo=ce(),_Vo=ee(),ykr=yr(),vVo=fr(),wVo=vNe(Vt()),SVo=vNe(Qn()),CVo=vNe(eo()),xVo=br();function TVo(t,e,r){return new xVo.APIPromise(OVo(t,e,r))}async function OVo(t,e,r){let n=(0,_Vo.safeParse)(e,_=>CVo.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,gkr.encodeJSON)("body",o.ConversationAppendRequest,{explode:!0}),a={conversation_id:(0,gkr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,vVo.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,bVo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,ykr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ykr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_append",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Xse.match(Xse.json(200,wVo.ConversationResponse$inboundSchema),Xse.jsonErr(422,SVo.HTTPValidationError$inboundSchema),Xse.fail("4XX"),Xse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var wkr=S(dj=>{"use strict";var EVo=dj&&dj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PVo=dj&&dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yse=dj&&dj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EVo(r,e,n[o]);return PVo(r,e),r}}();Object.defineProperty(dj,"__esModule",{value:!0});dj.betaConversationsAppendStream=FVo;var MVo=Yse(ae()),_kr=Cr(),RVo=yU(),Zse=Yse(gr()),IVo=ce(),AVo=ee(),vkr=yr(),NVo=fr(),DVo=Yse(Vt()),jVo=Yse(Qn()),$Vo=Yse(eo()),LVo=br();function FVo(t,e,r){return new LVo.APIPromise(kVo(t,e,r))}async function kVo(t,e,r){let n=(0,AVo.safeParse)(e,_=>$Vo.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,_kr.encodeJSON)("body",o.ConversationAppendStreamRequest,{explode:!0}),a={conversation_id:(0,_kr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,NVo.pathToFunc)("/v1/conversations/{conversation_id}#stream")(a),u=new Headers((0,IVo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,vkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_append_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Zse.match(Zse.sse(200,MVo.instanceof(ReadableStream).transform(_=>new RVo.EventStream(_,w=>({value:DVo.ConversationEvents$inboundSchema.parse(w)})))),Zse.jsonErr(422,jVo.HTTPValidationError$inboundSchema),Zse.fail("4XX"),Zse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var xkr=S(fj=>{"use strict";var qVo=fj&&fj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UVo=fj&&fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mdt=fj&&fj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qVo(r,e,n[o]);return UVo(r,e),r}}();Object.defineProperty(fj,"__esModule",{value:!0});fj.betaConversationsGet=KVo;var BVo=Cr(),Qse=Mdt(gr()),zVo=ce(),VVo=ee(),Skr=yr(),HVo=fr(),WVo=Mdt(Qn()),Ckr=Mdt(eo()),JVo=br();function KVo(t,e,r){return new JVo.APIPromise(GVo(t,e,r))}async function GVo(t,e,r){let n=(0,VVo.safeParse)(e,_=>Ckr.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,BVo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,HVo.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,zVo.compactMap)({Accept:"application/json"})),l=await(0,Skr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Skr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Qse.match(Qse.json(200,Ckr.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema),Qse.jsonErr(422,WVo.HTTPValidationError$inboundSchema),Qse.fail("4XX"),Qse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Okr=S(pj=>{"use strict";var XVo=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]}),ZVo=pj&&pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wNe=pj&&pj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XVo(r,e,n[o]);return ZVo(r,e),r}}();Object.defineProperty(pj,"__esModule",{value:!0});pj.betaConversationsGetHistory=aHo;var YVo=Cr(),eue=wNe(gr()),QVo=ce(),eHo=ee(),Tkr=yr(),tHo=fr(),rHo=wNe(Vt()),nHo=wNe(Qn()),oHo=wNe(eo()),iHo=br();function aHo(t,e,r){return new iHo.APIPromise(sHo(t,e,r))}async function sHo(t,e,r){let n=(0,eHo.safeParse)(e,_=>oHo.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,YVo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,tHo.pathToFunc)("/v1/conversations/{conversation_id}/history")(a),u=new Headers((0,QVo.compactMap)({Accept:"application/json"})),l=await(0,Tkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Tkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_history",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await eue.match(eue.json(200,rHo.ConversationHistory$inboundSchema),eue.jsonErr(422,nHo.HTTPValidationError$inboundSchema),eue.fail("4XX"),eue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Pkr=S(mj=>{"use strict";var uHo=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]}),lHo=mj&&mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SNe=mj&&mj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uHo(r,e,n[o]);return lHo(r,e),r}}();Object.defineProperty(mj,"__esModule",{value:!0});mj.betaConversationsGetMessages=bHo;var cHo=Cr(),tue=SNe(gr()),dHo=ce(),fHo=ee(),Ekr=yr(),pHo=fr(),mHo=SNe(Vt()),hHo=SNe(Qn()),gHo=SNe(eo()),yHo=br();function bHo(t,e,r){return new yHo.APIPromise(_Ho(t,e,r))}async function _Ho(t,e,r){let n=(0,fHo.safeParse)(e,_=>gHo.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,cHo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,pHo.pathToFunc)("/v1/conversations/{conversation_id}/messages")(a),u=new Headers((0,dHo.compactMap)({Accept:"application/json"})),l=await(0,Ekr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Ekr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_messages",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await tue.match(tue.json(200,mHo.ConversationMessages$inboundSchema),tue.jsonErr(422,hHo.HTTPValidationError$inboundSchema),tue.fail("4XX"),tue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Ikr=S(hj=>{"use strict";var vHo=hj&&hj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wHo=hj&&hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CNe=hj&&hj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vHo(r,e,n[o]);return wHo(r,e),r}}();Object.defineProperty(hj,"__esModule",{value:!0});hj.betaConversationsList=MHo;var SHo=CNe(ae()),CHo=Cr(),rue=CNe(gr()),xHo=ce(),THo=ee(),Mkr=yr(),OHo=fr(),EHo=CNe(Qn()),Rkr=CNe(eo()),PHo=br();function MHo(t,e,r){return new PHo.APIPromise(RHo(t,e,r))}async function RHo(t,e,r){let n=(0,THo.safeParse)(e,_=>Rkr.AgentsApiV1ConversationsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,OHo.pathToFunc)("/v1/conversations")(),s=(0,CHo.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,xHo.compactMap)({Accept:"application/json"})),l=await(0,Mkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Mkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_list",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await rue.match(rue.json(200,SHo.array(Rkr.ResponseBody$inboundSchema)),rue.jsonErr(422,EHo.HTTPValidationError$inboundSchema),rue.fail("4XX"),rue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Dkr=S(gj=>{"use strict";var IHo=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]}),AHo=gj&&gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xNe=gj&&gj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IHo(r,e,n[o]);return AHo(r,e),r}}();Object.defineProperty(gj,"__esModule",{value:!0});gj.betaConversationsRestart=qHo;var Akr=Cr(),nue=xNe(gr()),NHo=ce(),DHo=ee(),Nkr=yr(),jHo=fr(),$Ho=xNe(Vt()),LHo=xNe(Qn()),FHo=xNe(eo()),kHo=br();function qHo(t,e,r){return new kHo.APIPromise(UHo(t,e,r))}async function UHo(t,e,r){let n=(0,DHo.safeParse)(e,_=>FHo.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Akr.encodeJSON)("body",o.ConversationRestartRequest,{explode:!0}),a={conversation_id:(0,Akr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,jHo.pathToFunc)("/v1/conversations/{conversation_id}/restart")(a),u=new Headers((0,NHo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Nkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Nkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_restart",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await nue.match(nue.json(200,$Ho.ConversationResponse$inboundSchema),nue.jsonErr(422,LHo.HTTPValidationError$inboundSchema),nue.fail("4XX"),nue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Lkr=S(yj=>{"use strict";var BHo=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]}),zHo=yj&&yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iue=yj&&yj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BHo(r,e,n[o]);return zHo(r,e),r}}();Object.defineProperty(yj,"__esModule",{value:!0});yj.betaConversationsRestartStream=QHo;var VHo=iue(ae()),jkr=Cr(),HHo=yU(),oue=iue(gr()),WHo=ce(),JHo=ee(),$kr=yr(),KHo=fr(),GHo=iue(Vt()),XHo=iue(Qn()),ZHo=iue(eo()),YHo=br();function QHo(t,e,r){return new YHo.APIPromise(e3o(t,e,r))}async function e3o(t,e,r){let n=(0,JHo.safeParse)(e,_=>ZHo.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,jkr.encodeJSON)("body",o.ConversationRestartStreamRequest,{explode:!0}),a={conversation_id:(0,jkr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,KHo.pathToFunc)("/v1/conversations/{conversation_id}/restart#stream")(a),u=new Headers((0,WHo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,$kr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,$kr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_restart_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await oue.match(oue.sse(200,VHo.instanceof(ReadableStream).transform(_=>new HHo.EventStream(_,w=>({value:GHo.ConversationEvents$inboundSchema.parse(w)})))),oue.jsonErr(422,XHo.HTTPValidationError$inboundSchema),oue.fail("4XX"),oue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var qkr=S(bj=>{"use strict";var t3o=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]}),r3o=bj&&bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rdt=bj&&bj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&t3o(r,e,n[o]);return r3o(r,e),r}}();Object.defineProperty(bj,"__esModule",{value:!0});bj.betaConversationsStart=l3o;var n3o=Cr(),aue=Rdt(gr()),o3o=ce(),i3o=ee(),Fkr=yr(),a3o=fr(),kkr=Rdt(Vt()),s3o=Rdt(Qn()),u3o=br();function l3o(t,e,r){return new u3o.APIPromise(c3o(t,e,r))}async function c3o(t,e,r){let n=(0,i3o.safeParse)(e,b=>kkr.ConversationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,n3o.encodeJSON)("body",o,{explode:!0}),a=(0,a3o.pathToFunc)("/v1/conversations")(),s=new Headers((0,o3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Fkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Fkr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_start",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await aue.match(aue.json(200,kkr.ConversationResponse$inboundSchema),aue.jsonErr(422,s3o.HTTPValidationError$inboundSchema),aue.fail("4XX"),aue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var zkr=S(_j=>{"use strict";var d3o=_j&&_j.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),f3o=_j&&_j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TNe=_j&&_j.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&d3o(r,e,n[o]);return f3o(r,e),r}}();Object.defineProperty(_j,"__esModule",{value:!0});_j.betaConversationsStartStream=w3o;var p3o=TNe(ae()),m3o=Cr(),h3o=yU(),sue=TNe(gr()),g3o=ce(),y3o=ee(),Ukr=yr(),b3o=fr(),Bkr=TNe(Vt()),_3o=TNe(Qn()),v3o=br();function w3o(t,e,r){return new v3o.APIPromise(S3o(t,e,r))}async function S3o(t,e,r){let n=(0,y3o.safeParse)(e,b=>Bkr.ConversationStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,m3o.encodeJSON)("body",o,{explode:!0}),a=(0,b3o.pathToFunc)("/v1/conversations#stream")(),s=new Headers((0,g3o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,Ukr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Ukr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_conversations_start_stream",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await sue.match(sue.sse(200,p3o.instanceof(ReadableStream).transform(b=>new h3o.EventStream(b,_=>({value:Bkr.ConversationEvents$inboundSchema.parse(_)})))),sue.jsonErr(422,_3o.HTTPValidationError$inboundSchema),sue.fail("4XX"),sue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Vkr=S(ONe=>{"use strict";Object.defineProperty(ONe,"__esModule",{value:!0});ONe.Conversations=void 0;var C3o=bkr(),x3o=wkr(),T3o=xkr(),O3o=Okr(),E3o=Pkr(),P3o=Ikr(),M3o=Dkr(),R3o=Lkr(),I3o=qkr(),A3o=zkr(),N3o=Wc(),JA=kd(),Idt=class extends N3o.ClientSDK{async start(e,r){return(0,JA.unwrapAsync)((0,I3o.betaConversationsStart)(this,e,r))}async list(e,r){return(0,JA.unwrapAsync)((0,P3o.betaConversationsList)(this,e,r))}async get(e,r){return(0,JA.unwrapAsync)((0,T3o.betaConversationsGet)(this,e,r))}async append(e,r){return(0,JA.unwrapAsync)((0,C3o.betaConversationsAppend)(this,e,r))}async getHistory(e,r){return(0,JA.unwrapAsync)((0,O3o.betaConversationsGetHistory)(this,e,r))}async getMessages(e,r){return(0,JA.unwrapAsync)((0,E3o.betaConversationsGetMessages)(this,e,r))}async restart(e,r){return(0,JA.unwrapAsync)((0,M3o.betaConversationsRestart)(this,e,r))}async startStream(e,r){return(0,JA.unwrapAsync)((0,A3o.betaConversationsStartStream)(this,e,r))}async appendStream(e,r){return(0,JA.unwrapAsync)((0,x3o.betaConversationsAppendStream)(this,e,r))}async restartStream(e,r){return(0,JA.unwrapAsync)((0,R3o.betaConversationsRestartStream)(this,e,r))}};ONe.Conversations=Idt});var Jkr=S(vj=>{"use strict";var D3o=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]}),j3o=vj&&vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Adt=vj&&vj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D3o(r,e,n[o]);return j3o(r,e),r}}();Object.defineProperty(vj,"__esModule",{value:!0});vj.betaLibrariesCreate=B3o;var $3o=Cr(),uue=Adt(gr()),L3o=ce(),F3o=ee(),Hkr=yr(),k3o=fr(),Wkr=Adt(Vt()),q3o=Adt(Qn()),U3o=br();function B3o(t,e,r){return new U3o.APIPromise(z3o(t,e,r))}async function z3o(t,e,r){let n=(0,F3o.safeParse)(e,b=>Wkr.LibraryIn$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,$3o.encodeJSON)("body",o,{explode:!0}),a=(0,k3o.pathToFunc)("/v1/libraries")(),s=new Headers((0,L3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Hkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Hkr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_create_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await uue.match(uue.json(201,Wkr.LibraryOut$inboundSchema),uue.jsonErr(422,q3o.HTTPValidationError$inboundSchema),uue.fail("4XX"),uue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Gkr=S(wj=>{"use strict";var V3o=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]}),H3o=wj&&wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ENe=wj&&wj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V3o(r,e,n[o]);return H3o(r,e),r}}();Object.defineProperty(wj,"__esModule",{value:!0});wj.betaLibrariesDelete=eWo;var W3o=Cr(),lue=ENe(gr()),J3o=ce(),K3o=ee(),Kkr=yr(),G3o=fr(),X3o=ENe(Vt()),Z3o=ENe(Qn()),Y3o=ENe(eo()),Q3o=br();function eWo(t,e,r){return new Q3o.APIPromise(tWo(t,e,r))}async function tWo(t,e,r){let n=(0,K3o.safeParse)(e,_=>Y3o.LibrariesDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,W3o.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,G3o.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,J3o.compactMap)({Accept:"application/json"})),l=await(0,Kkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Kkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await lue.match(lue.json(200,X3o.LibraryOut$inboundSchema),lue.jsonErr(422,Z3o.HTTPValidationError$inboundSchema),lue.fail("4XX"),lue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Zkr=S(Sj=>{"use strict";var rWo=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]}),nWo=Sj&&Sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PNe=Sj&&Sj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rWo(r,e,n[o]);return nWo(r,e),r}}();Object.defineProperty(Sj,"__esModule",{value:!0});Sj.betaLibrariesGet=fWo;var oWo=Cr(),cue=PNe(gr()),iWo=ce(),aWo=ee(),Xkr=yr(),sWo=fr(),uWo=PNe(Vt()),lWo=PNe(Qn()),cWo=PNe(eo()),dWo=br();function fWo(t,e,r){return new dWo.APIPromise(pWo(t,e,r))}async function pWo(t,e,r){let n=(0,aWo.safeParse)(e,_=>cWo.LibrariesGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,oWo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,sWo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,iWo.compactMap)({Accept:"application/json"})),l=await(0,Xkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Xkr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_get_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await cue.match(cue.json(200,uWo.LibraryOut$inboundSchema),cue.jsonErr(422,lWo.HTTPValidationError$inboundSchema),cue.fail("4XX"),cue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var eqr=S(Cj=>{"use strict";var mWo=Cj&&Cj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hWo=Cj&&Cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qkr=Cj&&Cj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mWo(r,e,n[o]);return hWo(r,e),r}}();Object.defineProperty(Cj,"__esModule",{value:!0});Cj.betaLibrariesList=vWo;var MNe=Qkr(gr()),gWo=ce(),Ykr=yr(),yWo=fr(),bWo=Qkr(Vt()),_Wo=br();function vWo(t,e){return new _Wo.APIPromise(wWo(t,e))}async function wWo(t,e){let r=(0,yWo.pathToFunc)("/v1/libraries")(),n=new Headers((0,gWo.compactMap)({Accept:"application/json"})),o=await(0,Ykr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,Ykr.resolveGlobalSecurity)(i),s={options:t._options,baseURL:e?.serverURL??t._baseURL??"",operationID:"libraries_list_v1",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,userAgent:t._options.userAgent,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return[u,{status:"invalid"}];let l=u.value,c=await t._do(l,{context:s,errorCodes:["4XX","5XX"],retryConfig:s.retryConfig,retryCodes:s.retryCodes});if(!c.ok)return[c,{status:"request-error",request:l}];let d=c.value,[f]=await MNe.match(MNe.json(200,bWo.ListLibraryOut$inboundSchema),MNe.fail("4XX"),MNe.fail("5XX"))(d,l);return f.ok?[f,{status:"complete",request:l,response:d}]:[f,{status:"complete",request:l,response:d}]}});var nqr=S(xj=>{"use strict";var SWo=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]}),CWo=xj&&xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RNe=xj&&xj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SWo(r,e,n[o]);return CWo(r,e),r}}();Object.defineProperty(xj,"__esModule",{value:!0});xj.betaLibrariesUpdate=IWo;var tqr=Cr(),due=RNe(gr()),xWo=ce(),TWo=ee(),rqr=yr(),OWo=fr(),EWo=RNe(Vt()),PWo=RNe(Qn()),MWo=RNe(eo()),RWo=br();function IWo(t,e,r){return new RWo.APIPromise(AWo(t,e,r))}async function AWo(t,e,r){let n=(0,TWo.safeParse)(e,_=>MWo.LibrariesUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,tqr.encodeJSON)("body",o.LibraryInUpdate,{explode:!0}),a={library_id:(0,tqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,OWo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,xWo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,rqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,rqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_update_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await due.match(due.json(200,EWo.LibraryOut$inboundSchema),due.jsonErr(422,PWo.HTTPValidationError$inboundSchema),due.fail("4XX"),due.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var aqr=S(Tj=>{"use strict";var NWo=Tj&&Tj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DWo=Tj&&Tj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),INe=Tj&&Tj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&NWo(r,e,n[o]);return DWo(r,e),r}}();Object.defineProperty(Tj,"__esModule",{value:!0});Tj.betaLibrariesAccessesDelete=BWo;var oqr=Cr(),fue=INe(gr()),jWo=ce(),$Wo=ee(),iqr=yr(),LWo=fr(),FWo=INe(Vt()),kWo=INe(Qn()),qWo=INe(eo()),UWo=br();function BWo(t,e,r){return new UWo.APIPromise(zWo(t,e,r))}async function zWo(t,e,r){let n=(0,$Wo.safeParse)(e,_=>qWo.LibrariesShareDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,oqr.encodeJSON)("body",o.SharingDelete,{explode:!0}),a={library_id:(0,oqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,LWo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,jWo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,iqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,iqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await fue.match(fue.json(200,FWo.SharingOut$inboundSchema),fue.jsonErr(422,kWo.HTTPValidationError$inboundSchema),fue.fail("4XX"),fue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var uqr=S(Oj=>{"use strict";var VWo=Oj&&Oj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HWo=Oj&&Oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ANe=Oj&&Oj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VWo(r,e,n[o]);return HWo(r,e),r}}();Object.defineProperty(Oj,"__esModule",{value:!0});Oj.betaLibrariesAccessesList=e6o;var WWo=Cr(),pue=ANe(gr()),JWo=ce(),KWo=ee(),sqr=yr(),GWo=fr(),XWo=ANe(Vt()),ZWo=ANe(Qn()),YWo=ANe(eo()),QWo=br();function e6o(t,e,r){return new QWo.APIPromise(t6o(t,e,r))}async function t6o(t,e,r){let n=(0,KWo.safeParse)(e,_=>YWo.LibrariesShareListV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,WWo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,GWo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,JWo.compactMap)({Accept:"application/json"})),l=await(0,sqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,sqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_list_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await pue.match(pue.json(200,XWo.ListSharingOut$inboundSchema),pue.jsonErr(422,ZWo.HTTPValidationError$inboundSchema),pue.fail("4XX"),pue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var dqr=S(Ej=>{"use strict";var r6o=Ej&&Ej.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n6o=Ej&&Ej.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NNe=Ej&&Ej.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r6o(r,e,n[o]);return n6o(r,e),r}}();Object.defineProperty(Ej,"__esModule",{value:!0});Ej.betaLibrariesAccessesUpdateOrCreate=d6o;var lqr=Cr(),mue=NNe(gr()),o6o=ce(),i6o=ee(),cqr=yr(),a6o=fr(),s6o=NNe(Vt()),u6o=NNe(Qn()),l6o=NNe(eo()),c6o=br();function d6o(t,e,r){return new c6o.APIPromise(f6o(t,e,r))}async function f6o(t,e,r){let n=(0,i6o.safeParse)(e,_=>l6o.LibrariesShareCreateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,lqr.encodeJSON)("body",o.SharingIn,{explode:!0}),a={library_id:(0,lqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,a6o.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,o6o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,cqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,cqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_share_create_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await mue.match(mue.json(200,s6o.SharingOut$inboundSchema),mue.jsonErr(422,u6o.HTTPValidationError$inboundSchema),mue.fail("4XX"),mue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var fqr=S(DNe=>{"use strict";Object.defineProperty(DNe,"__esModule",{value:!0});DNe.Accesses=void 0;var p6o=aqr(),m6o=uqr(),h6o=dqr(),g6o=Wc(),Ndt=kd(),Ddt=class extends g6o.ClientSDK{async list(e,r){return(0,Ndt.unwrapAsync)((0,m6o.betaLibrariesAccessesList)(this,e,r))}async updateOrCreate(e,r){return(0,Ndt.unwrapAsync)((0,h6o.betaLibrariesAccessesUpdateOrCreate)(this,e,r))}async delete(e,r){return(0,Ndt.unwrapAsync)((0,p6o.betaLibrariesAccessesDelete)(this,e,r))}};DNe.Accesses=Ddt});var hqr=S(Pj=>{"use strict";var y6o=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]}),b6o=Pj&&Pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jNe=Pj&&Pj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&y6o(r,e,n[o]);return b6o(r,e),r}}();Object.defineProperty(Pj,"__esModule",{value:!0});Pj.betaLibrariesDocumentsDelete=O6o;var _6o=jNe(ae()),pqr=Cr(),hue=jNe(gr()),v6o=ce(),w6o=ee(),mqr=yr(),S6o=fr(),C6o=jNe(Qn()),x6o=jNe(eo()),T6o=br();function O6o(t,e,r){return new T6o.APIPromise(E6o(t,e,r))}async function E6o(t,e,r){let n=(0,w6o.safeParse)(e,_=>x6o.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,pqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,pqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,S6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,v6o.compactMap)({Accept:"application/json"})),l=await(0,mqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,mqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_delete_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await hue.match(hue.nil(204,_6o.void()),hue.jsonErr(422,C6o.HTTPValidationError$inboundSchema),hue.fail("4XX"),hue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var bqr=S(Mj=>{"use strict";var P6o=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]}),M6o=Mj&&Mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ne=Mj&&Mj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P6o(r,e,n[o]);return M6o(r,e),r}}();Object.defineProperty(Mj,"__esModule",{value:!0});Mj.betaLibrariesDocumentsExtractedTextSignedUrl=L6o;var R6o=$Ne(ae()),gqr=Cr(),gue=$Ne(gr()),I6o=ce(),A6o=ee(),yqr=yr(),N6o=fr(),D6o=$Ne(Qn()),j6o=$Ne(eo()),$6o=br();function L6o(t,e,r){return new $6o.APIPromise(F6o(t,e,r))}async function F6o(t,e,r){let n=(0,A6o.safeParse)(e,_=>j6o.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,gqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,gqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,N6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/extracted-text-signed-url")(a),u=new Headers((0,I6o.compactMap)({Accept:"application/json"})),l=await(0,yqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,yqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_extracted_text_signed_url_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await gue.match(gue.json(200,R6o.string()),gue.jsonErr(422,D6o.HTTPValidationError$inboundSchema),gue.fail("4XX"),gue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var wqr=S(Rj=>{"use strict";var k6o=Rj&&Rj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q6o=Rj&&Rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LNe=Rj&&Rj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k6o(r,e,n[o]);return q6o(r,e),r}}();Object.defineProperty(Rj,"__esModule",{value:!0});Rj.betaLibrariesDocumentsGet=K6o;var _qr=Cr(),yue=LNe(gr()),U6o=ce(),B6o=ee(),vqr=yr(),z6o=fr(),V6o=LNe(Vt()),H6o=LNe(Qn()),W6o=LNe(eo()),J6o=br();function K6o(t,e,r){return new J6o.APIPromise(G6o(t,e,r))}async function G6o(t,e,r){let n=(0,B6o.safeParse)(e,_=>W6o.LibrariesDocumentsGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,_qr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,_qr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,z6o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,U6o.compactMap)({Accept:"application/json"})),l=await(0,vqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await yue.match(yue.json(200,V6o.DocumentOut$inboundSchema),yue.jsonErr(422,H6o.HTTPValidationError$inboundSchema),yue.fail("4XX"),yue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var xqr=S(Ij=>{"use strict";var X6o=Ij&&Ij.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z6o=Ij&&Ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FNe=Ij&&Ij.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X6o(r,e,n[o]);return Z6o(r,e),r}}();Object.defineProperty(Ij,"__esModule",{value:!0});Ij.betaLibrariesDocumentsGetSignedUrl=iJo;var Y6o=FNe(ae()),Sqr=Cr(),bue=FNe(gr()),Q6o=ce(),eJo=ee(),Cqr=yr(),tJo=fr(),rJo=FNe(Qn()),nJo=FNe(eo()),oJo=br();function iJo(t,e,r){return new oJo.APIPromise(aJo(t,e,r))}async function aJo(t,e,r){let n=(0,eJo.safeParse)(e,_=>nJo.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Sqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Sqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,tJo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/signed-url")(a),u=new Headers((0,Q6o.compactMap)({Accept:"application/json"})),l=await(0,Cqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Cqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_signed_url_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await bue.match(bue.json(200,Y6o.string()),bue.jsonErr(422,rJo.HTTPValidationError$inboundSchema),bue.fail("4XX"),bue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Eqr=S(Aj=>{"use strict";var sJo=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]}),uJo=Aj&&Aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kNe=Aj&&Aj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sJo(r,e,n[o]);return uJo(r,e),r}}();Object.defineProperty(Aj,"__esModule",{value:!0});Aj.betaLibrariesDocumentsList=gJo;var Tqr=Cr(),_ue=kNe(gr()),lJo=ce(),cJo=ee(),Oqr=yr(),dJo=fr(),fJo=kNe(Vt()),pJo=kNe(Qn()),mJo=kNe(eo()),hJo=br();function gJo(t,e,r){return new hJo.APIPromise(yJo(t,e,r))}async function yJo(t,e,r){let n=(0,cJo.safeParse)(e,w=>mJo.LibrariesDocumentsListV1Request$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,Tqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,dJo.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=(0,Tqr.encodeFormQuery)({page:o.page,page_size:o.page_size,search:o.search,sort_by:o.sort_by,sort_order:o.sort_order}),l=new Headers((0,lJo.compactMap)({Accept:"application/json"})),c=await(0,Oqr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,Oqr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_list_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,b={HttpMeta:{Response:g,Request:h}},[_]=await _ue.match(_ue.json(200,fJo.ListDocumentOut$inboundSchema),_ue.jsonErr(422,pJo.HTTPValidationError$inboundSchema),_ue.fail("4XX"),_ue.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var Rqr=S(Nj=>{"use strict";var bJo=Nj&&Nj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_Jo=Nj&&Nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qNe=Nj&&Nj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&bJo(r,e,n[o]);return _Jo(r,e),r}}();Object.defineProperty(Nj,"__esModule",{value:!0});Nj.betaLibrariesDocumentsReprocess=EJo;var vJo=qNe(ae()),Pqr=Cr(),vue=qNe(gr()),wJo=ce(),SJo=ee(),Mqr=yr(),CJo=fr(),xJo=qNe(Qn()),TJo=qNe(eo()),OJo=br();function EJo(t,e,r){return new OJo.APIPromise(PJo(t,e,r))}async function PJo(t,e,r){let n=(0,SJo.safeParse)(e,_=>TJo.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Pqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Pqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,CJo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/reprocess")(a),u=new Headers((0,wJo.compactMap)({Accept:"application/json"})),l=await(0,Mqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Mqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_reprocess_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await vue.match(vue.nil(204,vJo.void()),vue.jsonErr(422,xJo.HTTPValidationError$inboundSchema),vue.fail("4XX"),vue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Nqr=S(Dj=>{"use strict";var MJo=Dj&&Dj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RJo=Dj&&Dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UNe=Dj&&Dj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MJo(r,e,n[o]);return RJo(r,e),r}}();Object.defineProperty(Dj,"__esModule",{value:!0});Dj.betaLibrariesDocumentsStatus=FJo;var Iqr=Cr(),wue=UNe(gr()),IJo=ce(),AJo=ee(),Aqr=yr(),NJo=fr(),DJo=UNe(Vt()),jJo=UNe(Qn()),$Jo=UNe(eo()),LJo=br();function FJo(t,e,r){return new LJo.APIPromise(kJo(t,e,r))}async function kJo(t,e,r){let n=(0,AJo.safeParse)(e,_=>$Jo.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Iqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Iqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,NJo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/status")(a),u=new Headers((0,IJo.compactMap)({Accept:"application/json"})),l=await(0,Aqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Aqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_status_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await wue.match(wue.json(200,DJo.ProcessingStatusOut$inboundSchema),wue.jsonErr(422,jJo.HTTPValidationError$inboundSchema),wue.fail("4XX"),wue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var $qr=S(jj=>{"use strict";var qJo=jj&&jj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),UJo=jj&&jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BNe=jj&&jj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qJo(r,e,n[o]);return UJo(r,e),r}}();Object.defineProperty(jj,"__esModule",{value:!0});jj.betaLibrariesDocumentsTextContent=GJo;var Dqr=Cr(),Sue=BNe(gr()),BJo=ce(),zJo=ee(),jqr=yr(),VJo=fr(),HJo=BNe(Vt()),WJo=BNe(Qn()),JJo=BNe(eo()),KJo=br();function GJo(t,e,r){return new KJo.APIPromise(XJo(t,e,r))}async function XJo(t,e,r){let n=(0,zJo.safeParse)(e,_=>JJo.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,Dqr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Dqr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,VJo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/text_content")(a),u=new Headers((0,BJo.compactMap)({Accept:"application/json"})),l=await(0,jqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_get_text_content_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Sue.match(Sue.json(200,HJo.DocumentTextContent$inboundSchema),Sue.jsonErr(422,WJo.HTTPValidationError$inboundSchema),Sue.fail("4XX"),Sue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Fqr=S($j=>{"use strict";var ZJo=$j&&$j.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YJo=$j&&$j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zNe=$j&&$j.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZJo(r,e,n[o]);return YJo(r,e),r}}();Object.defineProperty($j,"__esModule",{value:!0});$j.betaLibrariesDocumentsUpdate=a5o;var jdt=Cr(),Cue=zNe(gr()),QJo=ce(),e5o=ee(),Lqr=yr(),t5o=fr(),r5o=zNe(Vt()),n5o=zNe(Qn()),o5o=zNe(eo()),i5o=br();function a5o(t,e,r){return new i5o.APIPromise(s5o(t,e,r))}async function s5o(t,e,r){let n=(0,e5o.safeParse)(e,_=>o5o.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,jdt.encodeJSON)("body",o.DocumentUpdateIn,{explode:!0}),a={document_id:(0,jdt.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,jdt.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,t5o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,QJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Lqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Lqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_update_v1",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:"PUT",baseURL:r?.serverURL,path:s,headers:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Cue.match(Cue.json(200,r5o.DocumentOut$inboundSchema),Cue.jsonErr(422,n5o.HTTPValidationError$inboundSchema),Cue.fail("4XX"),Cue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var qqr=S(Lj=>{"use strict";var u5o=Lj&&Lj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l5o=Lj&&Lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HNe=Lj&&Lj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u5o(r,e,n[o]);return l5o(r,e),r}}();Object.defineProperty(Lj,"__esModule",{value:!0});Lj.betaLibrariesDocumentsUpload=_5o;var VNe=Cr(),$dt=G9(),xue=HNe(gr()),c5o=ce(),d5o=ee(),kqr=yr(),f5o=fr(),p5o=HNe(Vt()),m5o=HNe(Qn()),h5o=HNe(eo()),g5o=br(),y5o=YD(),b5o=Gse();function _5o(t,e,r){return new g5o.APIPromise(v5o(t,e,r))}async function v5o(t,e,r){let n=(0,d5o.safeParse)(e,_=>h5o.LibrariesDocumentsUploadV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,y5o.isBlobLike)(o.RequestBody.file))(0,VNe.appendForm)(i,"file",o.RequestBody.file);else if((0,b5o.isReadableStream)(o.RequestBody.file.content)){let _=await(0,$dt.readableStreamToArrayBuffer)(o.RequestBody.file.content),w=(0,$dt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream",T=new Blob([_],{type:w});(0,VNe.appendForm)(i,"file",T,o.RequestBody.file.fileName)}else{let _=(0,$dt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream";(0,VNe.appendForm)(i,"file",new Blob([o.RequestBody.file.content],{type:_}),o.RequestBody.file.fileName)}let a={library_id:(0,VNe.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,f5o.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=new Headers((0,c5o.compactMap)({Accept:"application/json"})),l=await(0,kqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"libraries_documents_upload_v1",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await xue.match(xue.json([200,201],p5o.DocumentOut$inboundSchema),xue.jsonErr(422,m5o.HTTPValidationError$inboundSchema),xue.fail("4XX"),xue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Uqr=S(WNe=>{"use strict";Object.defineProperty(WNe,"__esModule",{value:!0});WNe.Documents=void 0;var w5o=hqr(),S5o=bqr(),C5o=wqr(),x5o=xqr(),T5o=Eqr(),O5o=Rqr(),E5o=Nqr(),P5o=$qr(),M5o=Fqr(),R5o=qqr(),I5o=Wc(),KA=kd(),Ldt=class extends I5o.ClientSDK{async list(e,r){return(0,KA.unwrapAsync)((0,T5o.betaLibrariesDocumentsList)(this,e,r))}async upload(e,r){return(0,KA.unwrapAsync)((0,R5o.betaLibrariesDocumentsUpload)(this,e,r))}async get(e,r){return(0,KA.unwrapAsync)((0,C5o.betaLibrariesDocumentsGet)(this,e,r))}async update(e,r){return(0,KA.unwrapAsync)((0,M5o.betaLibrariesDocumentsUpdate)(this,e,r))}async delete(e,r){return(0,KA.unwrapAsync)((0,w5o.betaLibrariesDocumentsDelete)(this,e,r))}async textContent(e,r){return(0,KA.unwrapAsync)((0,P5o.betaLibrariesDocumentsTextContent)(this,e,r))}async status(e,r){return(0,KA.unwrapAsync)((0,E5o.betaLibrariesDocumentsStatus)(this,e,r))}async getSignedUrl(e,r){return(0,KA.unwrapAsync)((0,x5o.betaLibrariesDocumentsGetSignedUrl)(this,e,r))}async extractedTextSignedUrl(e,r){return(0,KA.unwrapAsync)((0,S5o.betaLibrariesDocumentsExtractedTextSignedUrl)(this,e,r))}async reprocess(e,r){return(0,KA.unwrapAsync)((0,O5o.betaLibrariesDocumentsReprocess)(this,e,r))}};WNe.Documents=Ldt});var Bqr=S(JNe=>{"use strict";Object.defineProperty(JNe,"__esModule",{value:!0});JNe.Libraries=void 0;var A5o=Jkr(),N5o=Gkr(),D5o=Zkr(),j5o=eqr(),$5o=nqr(),L5o=Wc(),Tue=kd(),F5o=fqr(),k5o=Uqr(),Fdt=class extends L5o.ClientSDK{get documents(){return this._documents??(this._documents=new k5o.Documents(this._options))}get accesses(){return this._accesses??(this._accesses=new F5o.Accesses(this._options))}async list(e){return(0,Tue.unwrapAsync)((0,j5o.betaLibrariesList)(this,e))}async create(e,r){return(0,Tue.unwrapAsync)((0,A5o.betaLibrariesCreate)(this,e,r))}async get(e,r){return(0,Tue.unwrapAsync)((0,D5o.betaLibrariesGet)(this,e,r))}async delete(e,r){return(0,Tue.unwrapAsync)((0,N5o.betaLibrariesDelete)(this,e,r))}async update(e,r){return(0,Tue.unwrapAsync)((0,$5o.betaLibrariesUpdate)(this,e,r))}};JNe.Libraries=Fdt});var Hqr=S(Fj=>{"use strict";var q5o=Fj&&Fj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),U5o=Fj&&Fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kdt=Fj&&Fj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&q5o(r,e,n[o]);return U5o(r,e),r}}();Object.defineProperty(Fj,"__esModule",{value:!0});Fj.betaAgentsCreate=K5o;var B5o=Cr(),Oue=kdt(gr()),z5o=ce(),V5o=ee(),zqr=yr(),H5o=fr(),Vqr=kdt(Vt()),W5o=kdt(Qn()),J5o=br();function K5o(t,e,r){return new J5o.APIPromise(G5o(t,e,r))}async function G5o(t,e,r){let n=(0,V5o.safeParse)(e,b=>Vqr.AgentCreationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,B5o.encodeJSON)("body",o,{explode:!0}),a=(0,H5o.pathToFunc)("/v1/agents")(),s=new Headers((0,z5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,zqr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zqr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_create",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Oue.match(Oue.json(200,Vqr.Agent$inboundSchema),Oue.jsonErr(422,W5o.HTTPValidationError$inboundSchema),Oue.fail("4XX"),Oue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Jqr=S(kj=>{"use strict";var X5o=kj&&kj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Z5o=kj&&kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KNe=kj&&kj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&X5o(r,e,n[o]);return Z5o(r,e),r}}();Object.defineProperty(kj,"__esModule",{value:!0});kj.betaAgentsGet=aKo;var Y5o=Cr(),Eue=KNe(gr()),Q5o=ce(),eKo=ee(),Wqr=yr(),tKo=fr(),rKo=KNe(Vt()),nKo=KNe(Qn()),oKo=KNe(eo()),iKo=br();function aKo(t,e,r){return new iKo.APIPromise(sKo(t,e,r))}async function sKo(t,e,r){let n=(0,eKo.safeParse)(e,_=>oKo.AgentsApiV1AgentsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,Y5o.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,tKo.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,Q5o.compactMap)({Accept:"application/json"})),l=await(0,Wqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Wqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Eue.match(Eue.json(200,rKo.Agent$inboundSchema),Eue.jsonErr(422,nKo.HTTPValidationError$inboundSchema),Eue.fail("4XX"),Eue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Gqr=S(qj=>{"use strict";var uKo=qj&&qj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lKo=qj&&qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mue=qj&&qj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uKo(r,e,n[o]);return lKo(r,e),r}}();Object.defineProperty(qj,"__esModule",{value:!0});qj.betaAgentsList=_Ko;var cKo=Mue(ae()),dKo=Cr(),Pue=Mue(gr()),fKo=ce(),pKo=ee(),Kqr=yr(),mKo=fr(),hKo=Mue(Vt()),gKo=Mue(Qn()),yKo=Mue(eo()),bKo=br();function _Ko(t,e,r){return new bKo.APIPromise(vKo(t,e,r))}async function vKo(t,e,r){let n=(0,pKo.safeParse)(e,_=>yKo.AgentsApiV1AgentsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,mKo.pathToFunc)("/v1/agents")(),s=(0,dKo.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,fKo.compactMap)({Accept:"application/json"})),l=await(0,Kqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Kqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_list",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Pue.match(Pue.json(200,cKo.array(hKo.Agent$inboundSchema)),Pue.jsonErr(422,gKo.HTTPValidationError$inboundSchema),Pue.fail("4XX"),Pue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var Yqr=S(Uj=>{"use strict";var wKo=Uj&&Uj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SKo=Uj&&Uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GNe=Uj&&Uj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wKo(r,e,n[o]);return SKo(r,e),r}}();Object.defineProperty(Uj,"__esModule",{value:!0});Uj.betaAgentsUpdate=RKo;var Xqr=Cr(),Rue=GNe(gr()),CKo=ce(),xKo=ee(),Zqr=yr(),TKo=fr(),OKo=GNe(Vt()),EKo=GNe(Qn()),PKo=GNe(eo()),MKo=br();function RKo(t,e,r){return new MKo.APIPromise(IKo(t,e,r))}async function IKo(t,e,r){let n=(0,xKo.safeParse)(e,_=>PKo.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Xqr.encodeJSON)("body",o.AgentUpdateRequest,{explode:!0}),a={agent_id:(0,Xqr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,TKo.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,CKo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Zqr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Zqr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_update",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Rue.match(Rue.json(200,OKo.Agent$inboundSchema),Rue.jsonErr(422,EKo.HTTPValidationError$inboundSchema),Rue.fail("4XX"),Rue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var tUr=S(Bj=>{"use strict";var AKo=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]}),NKo=Bj&&Bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XNe=Bj&&Bj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&AKo(r,e,n[o]);return NKo(r,e),r}}();Object.defineProperty(Bj,"__esModule",{value:!0});Bj.betaAgentsUpdateVersion=UKo;var Qqr=Cr(),Iue=XNe(gr()),DKo=ce(),jKo=ee(),eUr=yr(),$Ko=fr(),LKo=XNe(Vt()),FKo=XNe(Qn()),kKo=XNe(eo()),qKo=br();function UKo(t,e,r){return new qKo.APIPromise(BKo(t,e,r))}async function BKo(t,e,r){let n=(0,jKo.safeParse)(e,w=>kKo.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,Qqr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,$Ko.pathToFunc)("/v1/agents/{agent_id}/version")(a),u=(0,Qqr.encodeFormQuery)({version:o.version}),l=new Headers((0,DKo.compactMap)({Accept:"application/json"})),c=await(0,eUr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,eUr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"agents_api_v1_agents_update_version",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:"PATCH",baseURL:r?.serverURL,path:s,headers:l,query:u,body:i,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,b={HttpMeta:{Response:g,Request:h}},[_]=await Iue.match(Iue.json(200,LKo.Agent$inboundSchema),Iue.jsonErr(422,FKo.HTTPValidationError$inboundSchema),Iue.fail("4XX"),Iue.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var rUr=S(ZNe=>{"use strict";Object.defineProperty(ZNe,"__esModule",{value:!0});ZNe.MistralAgents=void 0;var zKo=Hqr(),VKo=Jqr(),HKo=Gqr(),WKo=Yqr(),JKo=tUr(),KKo=Wc(),Aue=kd(),qdt=class extends KKo.ClientSDK{async create(e,r){return(0,Aue.unwrapAsync)((0,zKo.betaAgentsCreate)(this,e,r))}async list(e,r){return(0,Aue.unwrapAsync)((0,HKo.betaAgentsList)(this,e,r))}async get(e,r){return(0,Aue.unwrapAsync)((0,VKo.betaAgentsGet)(this,e,r))}async update(e,r){return(0,Aue.unwrapAsync)((0,WKo.betaAgentsUpdate)(this,e,r))}async updateVersion(e,r){return(0,Aue.unwrapAsync)((0,JKo.betaAgentsUpdateVersion)(this,e,r))}};ZNe.MistralAgents=qdt});var nUr=S(YNe=>{"use strict";Object.defineProperty(YNe,"__esModule",{value:!0});YNe.Beta=void 0;var GKo=Wc(),XKo=Vkr(),ZKo=Bqr(),YKo=rUr(),Udt=class extends GKo.ClientSDK{get conversations(){return this._conversations??(this._conversations=new XKo.Conversations(this._options))}get agents(){return this._agents??(this._agents=new YKo.MistralAgents(this._options))}get libraries(){return this._libraries??(this._libraries=new ZKo.Libraries(this._options))}};YNe.Beta=Udt});var aUr=S(zj=>{"use strict";var QKo=zj&&zj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e8o=zj&&zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bdt=zj&&zj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QKo(r,e,n[o]);return e8o(r,e),r}}();Object.defineProperty(zj,"__esModule",{value:!0});zj.chatComplete=s8o;var t8o=Cr(),Nue=Bdt(gr()),r8o=ce(),n8o=ee(),oUr=yr(),o8o=fr(),iUr=Bdt(Vt()),i8o=Bdt(Qn()),a8o=br();function s8o(t,e,r){return new a8o.APIPromise(u8o(t,e,r))}async function u8o(t,e,r){let n=(0,n8o.safeParse)(e,b=>iUr.ChatCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,t8o.encodeJSON)("body",o,{explode:!0}),a=(0,o8o.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,r8o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,oUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,oUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Nue.match(Nue.json(200,iUr.ChatCompletionResponse$inboundSchema),Nue.jsonErr(422,i8o.HTTPValidationError$inboundSchema),Nue.fail("4XX"),Nue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var lUr=S(Vj=>{"use strict";var l8o=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]}),c8o=Vj&&Vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QNe=Vj&&Vj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l8o(r,e,n[o]);return c8o(r,e),r}}();Object.defineProperty(Vj,"__esModule",{value:!0});Vj.chatStream=_8o;var d8o=QNe(ae()),f8o=Cr(),p8o=yU(),Due=QNe(gr()),m8o=ce(),h8o=ee(),sUr=yr(),g8o=fr(),uUr=QNe(Vt()),y8o=QNe(Qn()),b8o=br();function _8o(t,e,r){return new b8o.APIPromise(v8o(t,e,r))}async function v8o(t,e,r){let n=(0,h8o.safeParse)(e,b=>uUr.ChatCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,f8o.encodeJSON)("body",o,{explode:!0}),a=(0,g8o.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,m8o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,sUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,sUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Due.match(Due.sse(200,d8o.instanceof(ReadableStream).transform(b=>new p8o.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:uUr.CompletionEvent$inboundSchema.parse(_)}))),Due.jsonErr(422,y8o.HTTPValidationError$inboundSchema),Due.fail("4XX"),Due.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var e1e=S(GA=>{"use strict";Object.defineProperty(GA,"__esModule",{value:!0});GA.getDefaultOptions=GA.defaultOptions=GA.ignoreOverride=void 0;GA.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");GA.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 w8o=t=>typeof t=="string"?{...GA.defaultOptions,name:t}:{...GA.defaultOptions,...t};GA.getDefaultOptions=w8o});var zdt=S(t1e=>{"use strict";Object.defineProperty(t1e,"__esModule",{value:!0});t1e.getRefs=void 0;var S8o=e1e(),C8o=t=>{let e=(0,S8o.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}]))}};t1e.getRefs=C8o});var vU=S(B7=>{"use strict";Object.defineProperty(B7,"__esModule",{value:!0});B7.setResponseValueAndErrors=B7.addErrorMessage=void 0;function cUr(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}B7.addErrorMessage=cUr;function x8o(t,e,r,n,o){t[e]=r,cUr(t,e,n,o)}B7.setResponseValueAndErrors=x8o});var Vdt=S(r1e=>{"use strict";Object.defineProperty(r1e,"__esModule",{value:!0});r1e.parseAnyDef=void 0;function T8o(){return{}}r1e.parseAnyDef=T8o});var Hdt=S(o1e=>{"use strict";Object.defineProperty(o1e,"__esModule",{value:!0});o1e.parseArrayDef=void 0;var O8o=ae(),n1e=vU(),E8o=wm();function P8o(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==O8o.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,E8o.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,n1e.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,n1e.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,n1e.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,n1e.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}o1e.parseArrayDef=P8o});var Wdt=S(i1e=>{"use strict";Object.defineProperty(i1e,"__esModule",{value:!0});i1e.parseBigintDef=void 0;var C3=vU();function M8o(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,C3.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,C3.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,C3.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,C3.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,C3.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,C3.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,C3.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}i1e.parseBigintDef=M8o});var Jdt=S(a1e=>{"use strict";Object.defineProperty(a1e,"__esModule",{value:!0});a1e.parseBooleanDef=void 0;function R8o(){return{type:"boolean"}}a1e.parseBooleanDef=R8o});var u1e=S(s1e=>{"use strict";Object.defineProperty(s1e,"__esModule",{value:!0});s1e.parseBrandedDef=void 0;var I8o=wm();function A8o(t,e){return(0,I8o.parseDef)(t.type._def,e)}s1e.parseBrandedDef=A8o});var Kdt=S(l1e=>{"use strict";Object.defineProperty(l1e,"__esModule",{value:!0});l1e.parseCatchDef=void 0;var N8o=wm(),D8o=(t,e)=>(0,N8o.parseDef)(t.innerType._def,e);l1e.parseCatchDef=D8o});var Gdt=S(c1e=>{"use strict";Object.defineProperty(c1e,"__esModule",{value:!0});c1e.parseDateDef=void 0;var dUr=vU();function fUr(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>fUr(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 j8o(t,e)}}c1e.parseDateDef=fUr;var j8o=(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,dUr.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,dUr.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var Xdt=S(d1e=>{"use strict";Object.defineProperty(d1e,"__esModule",{value:!0});d1e.parseDefaultDef=void 0;var $8o=wm();function L8o(t,e){return{...(0,$8o.parseDef)(t.innerType._def,e),default:t.defaultValue()}}d1e.parseDefaultDef=L8o});var Zdt=S(f1e=>{"use strict";Object.defineProperty(f1e,"__esModule",{value:!0});f1e.parseEffectsDef=void 0;var F8o=wm();function k8o(t,e){return e.effectStrategy==="input"?(0,F8o.parseDef)(t.schema._def,e):{}}f1e.parseEffectsDef=k8o});var Ydt=S(p1e=>{"use strict";Object.defineProperty(p1e,"__esModule",{value:!0});p1e.parseEnumDef=void 0;function q8o(t){return{type:"string",enum:Array.from(t.values)}}p1e.parseEnumDef=q8o});var Qdt=S(m1e=>{"use strict";Object.defineProperty(m1e,"__esModule",{value:!0});m1e.parseIntersectionDef=void 0;var pUr=wm(),U8o=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function B8o(t,e){let r=[(0,pUr.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,pUr.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(U8o(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}m1e.parseIntersectionDef=B8o});var eft=S(h1e=>{"use strict";Object.defineProperty(h1e,"__esModule",{value:!0});h1e.parseLiteralDef=void 0;function z8o(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}}h1e.parseLiteralDef=z8o});var g1e=S(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.parseStringDef=cy.zodPatterns=void 0;var x3=vU(),tft;cy.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:()=>(tft===void 0&&(tft=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),tft),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 V8o(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,x3.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,x3.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":nT(r,"email",n.message,e);break;case"format:idn-email":nT(r,"idn-email",n.message,e);break;case"pattern:zod":f_(r,cy.zodPatterns.email,n.message,e);break}break;case"url":nT(r,"uri",n.message,e);break;case"uuid":nT(r,"uuid",n.message,e);break;case"regex":f_(r,n.regex,n.message,e);break;case"cuid":f_(r,cy.zodPatterns.cuid,n.message,e);break;case"cuid2":f_(r,cy.zodPatterns.cuid2,n.message,e);break;case"startsWith":f_(r,RegExp(`^${rft(n.value,e)}`),n.message,e);break;case"endsWith":f_(r,RegExp(`${rft(n.value,e)}$`),n.message,e);break;case"datetime":nT(r,"date-time",n.message,e);break;case"date":nT(r,"date",n.message,e);break;case"time":nT(r,"time",n.message,e);break;case"duration":nT(r,"duration",n.message,e);break;case"length":(0,x3.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,x3.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{f_(r,RegExp(rft(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&nT(r,"ipv4",n.message,e),n.version!=="v4"&&nT(r,"ipv6",n.message,e);break}case"base64url":f_(r,cy.zodPatterns.base64url,n.message,e);break;case"jwt":f_(r,cy.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&f_(r,cy.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&f_(r,cy.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":f_(r,cy.zodPatterns.emoji(),n.message,e);break;case"ulid":{f_(r,cy.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{nT(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,x3.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{f_(r,cy.zodPatterns.base64,n.message,e);break}}break}case"nanoid":f_(r,cy.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}cy.parseStringDef=V8o;function rft(t,e){return e.patternStrategy==="escape"?W8o(t):t}var H8o=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function W8o(t){let e="";for(let r=0;r<t.length;r++)H8o.has(t[r])||(e+="\\"),e+=t[r];return e}function nT(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,x3.setResponseValueAndErrors)(t,"format",e,r,n)}function f_(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:mUr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,x3.setResponseValueAndErrors)(t,"pattern",mUr(e,n),r,n)}function mUr(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 b1e=S(y1e=>{"use strict";Object.defineProperty(y1e,"__esModule",{value:!0});y1e.parseRecordDef=void 0;var jue=ae(),hUr=wm(),J8o=g1e(),K8o=u1e();function G8o(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===jue.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,hUr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,hUr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===jue.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,J8o.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===jue.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===jue.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===jue.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,K8o.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}y1e.parseRecordDef=G8o});var nft=S(_1e=>{"use strict";Object.defineProperty(_1e,"__esModule",{value:!0});_1e.parseMapDef=void 0;var gUr=wm(),X8o=b1e();function Z8o(t,e){if(e.mapStrategy==="record")return(0,X8o.parseRecordDef)(t,e);let r=(0,gUr.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,gUr.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}}}_1e.parseMapDef=Z8o});var oft=S(v1e=>{"use strict";Object.defineProperty(v1e,"__esModule",{value:!0});v1e.parseNativeEnumDef=void 0;function Y8o(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}}v1e.parseNativeEnumDef=Y8o});var ift=S(w1e=>{"use strict";Object.defineProperty(w1e,"__esModule",{value:!0});w1e.parseNeverDef=void 0;function Q8o(){return{not:{}}}w1e.parseNeverDef=Q8o});var aft=S(S1e=>{"use strict";Object.defineProperty(S1e,"__esModule",{value:!0});S1e.parseNullDef=void 0;function eGo(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}S1e.parseNullDef=eGo});var C1e=S(wU=>{"use strict";Object.defineProperty(wU,"__esModule",{value:!0});wU.parseUnionDef=wU.primitiveMappings=void 0;var tGo=wm();wU.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function rGo(t,e){if(e.target==="openApi3")return yUr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in wU.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=wU.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 yUr(t,e)}wU.parseUnionDef=rGo;var yUr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,tGo.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 sft=S(x1e=>{"use strict";Object.defineProperty(x1e,"__esModule",{value:!0});x1e.parseNullableDef=void 0;var bUr=wm(),_Ur=C1e();function nGo(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:_Ur.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[_Ur.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,bUr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,bUr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}x1e.parseNullableDef=nGo});var uft=S(T1e=>{"use strict";Object.defineProperty(T1e,"__esModule",{value:!0});T1e.parseNumberDef=void 0;var SU=vU();function oGo(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,SU.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,SU.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,SU.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,SU.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,SU.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,SU.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,SU.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,SU.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}T1e.parseNumberDef=oGo});var cft=S(O1e=>{"use strict";Object.defineProperty(O1e,"__esModule",{value:!0});O1e.parseObjectDef=void 0;var iGo=ae(),lft=wm();function aGo(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,lft.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,lft.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function sGo(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 iGo.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,lft.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:aGo(t,e)};return n.required.length||delete n.required,n}O1e.parseObjectDef=sGo});var dft=S(E1e=>{"use strict";Object.defineProperty(E1e,"__esModule",{value:!0});E1e.parseOptionalDef=void 0;var vUr=wm(),uGo=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,vUr.parseDef)(t.innerType._def,e);let r=(0,vUr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};E1e.parseOptionalDef=uGo});var fft=S(M1e=>{"use strict";Object.defineProperty(M1e,"__esModule",{value:!0});M1e.parsePipelineDef=void 0;var P1e=wm(),lGo=(t,e)=>{if(e.pipeStrategy==="input")return(0,P1e.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,P1e.parseDef)(t.out._def,e);let r=(0,P1e.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,P1e.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};M1e.parsePipelineDef=lGo});var pft=S(R1e=>{"use strict";Object.defineProperty(R1e,"__esModule",{value:!0});R1e.parsePromiseDef=void 0;var cGo=wm();function dGo(t,e){return(0,cGo.parseDef)(t.type._def,e)}R1e.parsePromiseDef=dGo});var mft=S(I1e=>{"use strict";Object.defineProperty(I1e,"__esModule",{value:!0});I1e.parseSetDef=void 0;var wUr=vU(),fGo=wm();function pGo(t,e){let n={type:"array",uniqueItems:!0,items:(0,fGo.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,wUr.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,wUr.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}I1e.parseSetDef=pGo});var gft=S(A1e=>{"use strict";Object.defineProperty(A1e,"__esModule",{value:!0});A1e.parseTupleDef=void 0;var hft=wm();function mGo(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,hft.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,hft.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,hft.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}A1e.parseTupleDef=mGo});var yft=S(N1e=>{"use strict";Object.defineProperty(N1e,"__esModule",{value:!0});N1e.parseUndefinedDef=void 0;function hGo(){return{not:{}}}N1e.parseUndefinedDef=hGo});var bft=S(D1e=>{"use strict";Object.defineProperty(D1e,"__esModule",{value:!0});D1e.parseUnknownDef=void 0;function gGo(){return{}}D1e.parseUnknownDef=gGo});var _ft=S(j1e=>{"use strict";Object.defineProperty(j1e,"__esModule",{value:!0});j1e.parseReadonlyDef=void 0;var yGo=wm(),bGo=(t,e)=>(0,yGo.parseDef)(t.innerType._def,e);j1e.parseReadonlyDef=bGo});var wm=S($1e=>{"use strict";Object.defineProperty($1e,"__esModule",{value:!0});$1e.parseDef=void 0;var Ui=ae(),_Go=Vdt(),vGo=Hdt(),wGo=Wdt(),SGo=Jdt(),CGo=u1e(),xGo=Kdt(),TGo=Gdt(),OGo=Xdt(),EGo=Zdt(),PGo=Ydt(),MGo=Qdt(),RGo=eft(),IGo=nft(),AGo=oft(),NGo=ift(),DGo=aft(),jGo=sft(),$Go=uft(),LGo=cft(),FGo=dft(),kGo=fft(),qGo=pft(),UGo=b1e(),BGo=mft(),zGo=g1e(),VGo=gft(),HGo=yft(),WGo=C1e(),JGo=bft(),KGo=_ft(),GGo=e1e();function SUr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==GGo.ignoreOverride)return a}if(n&&!r){let a=XGo(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=YGo(t,t.typeName,e);return i&&QGo(t,e,i),o.jsonSchema=i,i}$1e.parseDef=SUr;var XGo=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:ZGo(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}},ZGo=(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("/")},YGo=(t,e,r)=>{switch(e){case Ui.ZodFirstPartyTypeKind.ZodString:return(0,zGo.parseStringDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodNumber:return(0,$Go.parseNumberDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodObject:return(0,LGo.parseObjectDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodBigInt:return(0,wGo.parseBigintDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodBoolean:return(0,SGo.parseBooleanDef)();case Ui.ZodFirstPartyTypeKind.ZodDate:return(0,TGo.parseDateDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodUndefined:return(0,HGo.parseUndefinedDef)();case Ui.ZodFirstPartyTypeKind.ZodNull:return(0,DGo.parseNullDef)(r);case Ui.ZodFirstPartyTypeKind.ZodArray:return(0,vGo.parseArrayDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodUnion:case Ui.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,WGo.parseUnionDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodIntersection:return(0,MGo.parseIntersectionDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodTuple:return(0,VGo.parseTupleDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodRecord:return(0,UGo.parseRecordDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodLiteral:return(0,RGo.parseLiteralDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodEnum:return(0,PGo.parseEnumDef)(t);case Ui.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,AGo.parseNativeEnumDef)(t);case Ui.ZodFirstPartyTypeKind.ZodNullable:return(0,jGo.parseNullableDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodOptional:return(0,FGo.parseOptionalDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodMap:return(0,IGo.parseMapDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodSet:return(0,BGo.parseSetDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodLazy:return SUr(t.getter()._def,r);case Ui.ZodFirstPartyTypeKind.ZodPromise:return(0,qGo.parsePromiseDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodNaN:case Ui.ZodFirstPartyTypeKind.ZodNever:return(0,NGo.parseNeverDef)();case Ui.ZodFirstPartyTypeKind.ZodEffects:return(0,EGo.parseEffectsDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodAny:return(0,_Go.parseAnyDef)();case Ui.ZodFirstPartyTypeKind.ZodUnknown:return(0,JGo.parseUnknownDef)();case Ui.ZodFirstPartyTypeKind.ZodDefault:return(0,OGo.parseDefaultDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodBranded:return(0,CGo.parseBrandedDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodReadonly:return(0,KGo.parseReadonlyDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodCatch:return(0,xGo.parseCatchDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodPipeline:return(0,kGo.parsePipelineDef)(t,r);case Ui.ZodFirstPartyTypeKind.ZodFunction:case Ui.ZodFirstPartyTypeKind.ZodVoid:case Ui.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},QGo=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var vft=S(L1e=>{"use strict";Object.defineProperty(L1e,"__esModule",{value:!0});L1e.zodToJsonSchema=void 0;var CUr=wm(),e9o=zdt(),t9o=(t,e)=>{let r=(0,e9o.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,CUr.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,CUr.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};L1e.zodToJsonSchema=t9o});var xUr=S(ei=>{"use strict";var r9o=ei&&ei.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gi=ei&&ei.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&r9o(e,t,r)};Object.defineProperty(ei,"__esModule",{value:!0});Gi(e1e(),ei);Gi(zdt(),ei);Gi(vU(),ei);Gi(wm(),ei);Gi(Vdt(),ei);Gi(Hdt(),ei);Gi(Wdt(),ei);Gi(Jdt(),ei);Gi(u1e(),ei);Gi(Kdt(),ei);Gi(Gdt(),ei);Gi(Xdt(),ei);Gi(Zdt(),ei);Gi(Ydt(),ei);Gi(Qdt(),ei);Gi(eft(),ei);Gi(nft(),ei);Gi(oft(),ei);Gi(ift(),ei);Gi(aft(),ei);Gi(sft(),ei);Gi(uft(),ei);Gi(cft(),ei);Gi(dft(),ei);Gi(fft(),ei);Gi(pft(),ei);Gi(_ft(),ei);Gi(b1e(),ei);Gi(mft(),ei);Gi(g1e(),ei);Gi(gft(),ei);Gi(yft(),ei);Gi(C1e(),ei);Gi(bft(),ei);Gi(vft(),ei);var n9o=vft();ei.default=n9o.zodToJsonSchema});var OUr=S($ue=>{"use strict";Object.defineProperty($ue,"__esModule",{value:!0});$ue.transformToChatCompletionRequest=i9o;$ue.convertToParsedChatCompletionResponse=a9o;$ue.responseFormatFromZodObject=TUr;var o9o=xUr();function i9o(t){let{responseFormat:e,...r}=t,n=TUr(e);return{...r,responseFormat:n}}function a9o(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 TUr(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,o9o.zodToJsonSchema)(t),strict:!0}}}});var MUr=S(k1e=>{"use strict";Object.defineProperty(k1e,"__esModule",{value:!0});k1e.Chat=void 0;var EUr=aUr(),PUr=lUr(),s9o=Wc(),F1e=kd(),wft=OUr(),Sft=class extends s9o.ClientSDK{async parse(e,r){let n=(0,wft.transformToChatCompletionRequest)(e),o=await(0,F1e.unwrapAsync)((0,EUr.chatComplete)(this,n,r));return(0,wft.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,wft.transformToChatCompletionRequest)(e);return(0,F1e.unwrapAsync)((0,PUr.chatStream)(this,n,r))}async complete(e,r){return(0,F1e.unwrapAsync)((0,EUr.chatComplete)(this,e,r))}async stream(e,r){return(0,F1e.unwrapAsync)((0,PUr.chatStream)(this,e,r))}};k1e.Chat=Sft});var AUr=S(Hj=>{"use strict";var u9o=Hj&&Hj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l9o=Hj&&Hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cft=Hj&&Hj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u9o(r,e,n[o]);return l9o(r,e),r}}();Object.defineProperty(Hj,"__esModule",{value:!0});Hj.classifiersClassify=g9o;var c9o=Cr(),Lue=Cft(gr()),d9o=ce(),f9o=ee(),RUr=yr(),p9o=fr(),IUr=Cft(Vt()),m9o=Cft(Qn()),h9o=br();function g9o(t,e,r){return new h9o.APIPromise(y9o(t,e,r))}async function y9o(t,e,r){let n=(0,f9o.safeParse)(e,b=>IUr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,c9o.encodeJSON)("body",o,{explode:!0}),a=(0,p9o.pathToFunc)("/v1/classifications")(),s=new Headers((0,d9o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,RUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,RUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"classifications_v1_classifications_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Lue.match(Lue.json(200,IUr.ClassificationResponse$inboundSchema),Lue.jsonErr(422,m9o.HTTPValidationError$inboundSchema),Lue.fail("4XX"),Lue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var jUr=S(Wj=>{"use strict";var b9o=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]}),_9o=Wj&&Wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xft=Wj&&Wj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&b9o(r,e,n[o]);return _9o(r,e),r}}();Object.defineProperty(Wj,"__esModule",{value:!0});Wj.classifiersClassifyChat=O9o;var v9o=Cr(),Fue=xft(gr()),w9o=ce(),S9o=ee(),NUr=yr(),C9o=fr(),DUr=xft(Vt()),x9o=xft(Qn()),T9o=br();function O9o(t,e,r){return new T9o.APIPromise(E9o(t,e,r))}async function E9o(t,e,r){let n=(0,S9o.safeParse)(e,b=>DUr.ChatClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,v9o.encodeJSON)("body",o,{explode:!0}),a=(0,C9o.pathToFunc)("/v1/chat/classifications")(),s=new Headers((0,w9o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,NUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,NUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"chat_classifications_v1_chat_classifications_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Fue.match(Fue.json(200,DUr.ClassificationResponse$inboundSchema),Fue.jsonErr(422,x9o.HTTPValidationError$inboundSchema),Fue.fail("4XX"),Fue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var FUr=S(Jj=>{"use strict";var P9o=Jj&&Jj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),M9o=Jj&&Jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tft=Jj&&Jj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&P9o(r,e,n[o]);return M9o(r,e),r}}();Object.defineProperty(Jj,"__esModule",{value:!0});Jj.classifiersModerate=$9o;var R9o=Cr(),kue=Tft(gr()),I9o=ce(),A9o=ee(),$Ur=yr(),N9o=fr(),LUr=Tft(Vt()),D9o=Tft(Qn()),j9o=br();function $9o(t,e,r){return new j9o.APIPromise(L9o(t,e,r))}async function L9o(t,e,r){let n=(0,A9o.safeParse)(e,b=>LUr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,R9o.encodeJSON)("body",o,{explode:!0}),a=(0,N9o.pathToFunc)("/v1/moderations")(),s=new Headers((0,I9o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,$Ur.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,$Ur.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await kue.match(kue.json(200,LUr.ModerationResponse$inboundSchema),kue.jsonErr(422,D9o.HTTPValidationError$inboundSchema),kue.fail("4XX"),kue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var UUr=S(Kj=>{"use strict";var F9o=Kj&&Kj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k9o=Kj&&Kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Oft=Kj&&Kj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F9o(r,e,n[o]);return k9o(r,e),r}}();Object.defineProperty(Kj,"__esModule",{value:!0});Kj.classifiersModerateChat=W9o;var q9o=Cr(),que=Oft(gr()),U9o=ce(),B9o=ee(),kUr=yr(),z9o=fr(),qUr=Oft(Vt()),V9o=Oft(Qn()),H9o=br();function W9o(t,e,r){return new H9o.APIPromise(J9o(t,e,r))}async function J9o(t,e,r){let n=(0,B9o.safeParse)(e,b=>qUr.ChatModerationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,q9o.encodeJSON)("body",o,{explode:!0}),a=(0,z9o.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,U9o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,kUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,kUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"chat_moderations_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await que.match(que.json(200,qUr.ModerationResponse$inboundSchema),que.jsonErr(422,V9o.HTTPValidationError$inboundSchema),que.fail("4XX"),que.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var BUr=S(U1e=>{"use strict";Object.defineProperty(U1e,"__esModule",{value:!0});U1e.Classifiers=void 0;var K9o=AUr(),G9o=jUr(),X9o=FUr(),Z9o=UUr(),Y9o=Wc(),q1e=kd(),Eft=class extends Y9o.ClientSDK{async moderate(e,r){return(0,q1e.unwrapAsync)((0,X9o.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,q1e.unwrapAsync)((0,Z9o.classifiersModerateChat)(this,e,r))}async classify(e,r){return(0,q1e.unwrapAsync)((0,K9o.classifiersClassify)(this,e,r))}async classifyChat(e,r){return(0,q1e.unwrapAsync)((0,G9o.classifiersClassifyChat)(this,e,r))}};U1e.Classifiers=Eft});var HUr=S(Gj=>{"use strict";var Q9o=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]}),e7o=Gj&&Gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pft=Gj&&Gj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Q9o(r,e,n[o]);return e7o(r,e),r}}();Object.defineProperty(Gj,"__esModule",{value:!0});Gj.embeddingsCreate=s7o;var t7o=Cr(),Uue=Pft(gr()),r7o=ce(),n7o=ee(),zUr=yr(),o7o=fr(),VUr=Pft(Vt()),i7o=Pft(Qn()),a7o=br();function s7o(t,e,r){return new a7o.APIPromise(u7o(t,e,r))}async function u7o(t,e,r){let n=(0,n7o.safeParse)(e,b=>VUr.EmbeddingRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,t7o.encodeJSON)("body",o,{explode:!0}),a=(0,o7o.pathToFunc)("/v1/embeddings")(),s=new Headers((0,r7o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,zUr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zUr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Uue.match(Uue.json(200,VUr.EmbeddingResponse$inboundSchema),Uue.jsonErr(422,i7o.HTTPValidationError$inboundSchema),Uue.fail("4XX"),Uue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var WUr=S(B1e=>{"use strict";Object.defineProperty(B1e,"__esModule",{value:!0});B1e.Embeddings=void 0;var l7o=HUr(),c7o=Wc(),d7o=kd(),Mft=class extends c7o.ClientSDK{async create(e,r){return(0,d7o.unwrapAsync)((0,l7o.embeddingsCreate)(this,e,r))}};B1e.Embeddings=Mft});var KUr=S(Xj=>{"use strict";var f7o=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]}),p7o=Xj&&Xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rft=Xj&&Xj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&f7o(r,e,n[o]);return p7o(r,e),r}}();Object.defineProperty(Xj,"__esModule",{value:!0});Xj.filesDelete=w7o;var m7o=Cr(),z1e=Rft(gr()),h7o=ce(),g7o=ee(),JUr=yr(),y7o=fr(),b7o=Rft(Vt()),_7o=Rft(eo()),v7o=br();function w7o(t,e,r){return new v7o.APIPromise(S7o(t,e,r))}async function S7o(t,e,r){let n=(0,g7o.safeParse)(e,b=>_7o.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,m7o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,y7o.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,h7o.compactMap)({Accept:"application/json"})),l=await(0,JUr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JUr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await z1e.match(z1e.json(200,b7o.DeleteFileOut$inboundSchema),z1e.fail("4XX"),z1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var XUr=S(Zj=>{"use strict";var C7o=Zj&&Zj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),x7o=Zj&&Zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ift=Zj&&Zj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&C7o(r,e,n[o]);return x7o(r,e),r}}();Object.defineProperty(Zj,"__esModule",{value:!0});Zj.filesDownload=A7o;var T7o=Ift(ae()),O7o=Cr(),V1e=Ift(gr()),E7o=ce(),P7o=ee(),GUr=yr(),M7o=fr(),R7o=Ift(eo()),I7o=br();function A7o(t,e,r){return new I7o.APIPromise(N7o(t,e,r))}async function N7o(t,e,r){let n=(0,P7o.safeParse)(e,b=>R7o.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,O7o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,M7o.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,E7o.compactMap)({Accept:"application/octet-stream"})),l=await(0,GUr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,GUr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await V1e.match(V1e.stream(200,T7o.instanceof(ReadableStream)),V1e.fail("4XX"),V1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var QUr=S(Yj=>{"use strict";var D7o=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]}),j7o=Yj&&Yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aft=Yj&&Yj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&D7o(r,e,n[o]);return j7o(r,e),r}}();Object.defineProperty(Yj,"__esModule",{value:!0});Yj.filesGetSignedUrl=B7o;var ZUr=Cr(),H1e=Aft(gr()),$7o=ce(),L7o=ee(),YUr=yr(),F7o=fr(),k7o=Aft(Vt()),q7o=Aft(eo()),U7o=br();function B7o(t,e,r){return new U7o.APIPromise(z7o(t,e,r))}async function z7o(t,e,r){let n=(0,L7o.safeParse)(e,_=>q7o.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,ZUr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,F7o.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,ZUr.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,$7o.compactMap)({Accept:"application/json"})),c=await(0,YUr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,YUr.resolveGlobalSecurity)(d),p={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!m.ok)return[m,{status:"invalid"}];let h=m.value,y=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!y.ok)return[y,{status:"request-error",request:h}];let g=y.value,[b]=await H1e.match(H1e.json(200,k7o.FileSignedURL$inboundSchema),H1e.fail("4XX"),H1e.fail("5XX"))(g,h);return b.ok?[b,{status:"complete",request:h,response:g}]:[b,{status:"complete",request:h,response:g}]}});var tBr=S(Qj=>{"use strict";var V7o=Qj&&Qj.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H7o=Qj&&Qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nft=Qj&&Qj.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V7o(r,e,n[o]);return H7o(r,e),r}}();Object.defineProperty(Qj,"__esModule",{value:!0});Qj.filesList=Q7o;var W7o=Cr(),W1e=Nft(gr()),J7o=ce(),K7o=ee(),eBr=yr(),G7o=fr(),X7o=Nft(Vt()),Z7o=Nft(eo()),Y7o=br();function Q7o(t,e,r){return new Y7o.APIPromise(eXo(t,e,r))}async function eXo(t,e,r){let n=(0,K7o.safeParse)(e,b=>Z7o.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,G7o.pathToFunc)("/v1/files")(),s=(0,W7o.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,J7o.compactMap)({Accept:"application/json"})),l=await(0,eBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,eBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await W1e.match(W1e.json(200,X7o.ListFilesOut$inboundSchema),W1e.fail("4XX"),W1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var nBr=S(e$=>{"use strict";var tXo=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]}),rXo=e$&&e$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dft=e$&&e$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tXo(r,e,n[o]);return rXo(r,e),r}}();Object.defineProperty(e$,"__esModule",{value:!0});e$.filesRetrieve=cXo;var nXo=Cr(),J1e=Dft(gr()),oXo=ce(),iXo=ee(),rBr=yr(),aXo=fr(),sXo=Dft(Vt()),uXo=Dft(eo()),lXo=br();function cXo(t,e,r){return new lXo.APIPromise(dXo(t,e,r))}async function dXo(t,e,r){let n=(0,iXo.safeParse)(e,b=>uXo.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,nXo.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,aXo.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,oXo.compactMap)({Accept:"application/json"})),l=await(0,rBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,rBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await J1e.match(J1e.json(200,sXo.RetrieveFileOut$inboundSchema),J1e.fail("4XX"),J1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var iBr=S(t$=>{"use strict";var fXo=t$&&t$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pXo=t$&&t$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$ft=t$&&t$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&fXo(r,e,n[o]);return pXo(r,e),r}}();Object.defineProperty(t$,"__esModule",{value:!0});t$.filesUpload=SXo;var K1e=Cr(),jft=G9(),G1e=$ft(gr()),mXo=ce(),hXo=ee(),oBr=yr(),gXo=fr(),yXo=$ft(Vt()),bXo=$ft(eo()),_Xo=br(),vXo=YD(),wXo=Gse();function SXo(t,e,r){return new _Xo.APIPromise(CXo(t,e,r))}async function CXo(t,e,r){let n=(0,hXo.safeParse)(e,g=>bXo.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,vXo.isBlobLike)(o.file))(0,K1e.appendForm)(i,"file",o.file);else if((0,wXo.isReadableStream)(o.file.content)){let g=await(0,jft.readableStreamToArrayBuffer)(o.file.content),b=(0,jft.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,K1e.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,jft.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,K1e.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.purpose!==void 0&&(0,K1e.appendForm)(i,"purpose",o.purpose);let a=(0,gXo.pathToFunc)("/v1/files")(),s=new Headers((0,mXo.compactMap)({Accept:"application/json"})),u=await(0,oBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,oBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await G1e.match(G1e.json(200,yXo.UploadFileOut$inboundSchema),G1e.fail("4XX"),G1e.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var aBr=S(X1e=>{"use strict";Object.defineProperty(X1e,"__esModule",{value:!0});X1e.Files=void 0;var xXo=KUr(),TXo=XUr(),OXo=QUr(),EXo=tBr(),PXo=nBr(),MXo=iBr(),RXo=Wc(),z7=kd(),Lft=class extends RXo.ClientSDK{async upload(e,r){return(0,z7.unwrapAsync)((0,MXo.filesUpload)(this,e,r))}async list(e,r){return(0,z7.unwrapAsync)((0,EXo.filesList)(this,e,r))}async retrieve(e,r){return(0,z7.unwrapAsync)((0,PXo.filesRetrieve)(this,e,r))}async delete(e,r){return(0,z7.unwrapAsync)((0,xXo.filesDelete)(this,e,r))}async download(e,r){return(0,z7.unwrapAsync)((0,TXo.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,z7.unwrapAsync)((0,OXo.filesGetSignedUrl)(this,e,r))}};X1e.Files=Lft});var lBr=S(r$=>{"use strict";var IXo=r$&&r$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AXo=r$&&r$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fft=r$&&r$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IXo(r,e,n[o]);return AXo(r,e),r}}();Object.defineProperty(r$,"__esModule",{value:!0});r$.fimComplete=kXo;var NXo=Cr(),Bue=Fft(gr()),DXo=ce(),jXo=ee(),sBr=yr(),$Xo=fr(),uBr=Fft(Vt()),LXo=Fft(Qn()),FXo=br();function kXo(t,e,r){return new FXo.APIPromise(qXo(t,e,r))}async function qXo(t,e,r){let n=(0,jXo.safeParse)(e,b=>uBr.FIMCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,NXo.encodeJSON)("body",o,{explode:!0}),a=(0,$Xo.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,DXo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,sBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,sBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Bue.match(Bue.json(200,uBr.FIMCompletionResponse$inboundSchema),Bue.jsonErr(422,LXo.HTTPValidationError$inboundSchema),Bue.fail("4XX"),Bue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var fBr=S(n$=>{"use strict";var UXo=n$&&n$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BXo=n$&&n$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z1e=n$&&n$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&UXo(r,e,n[o]);return BXo(r,e),r}}();Object.defineProperty(n$,"__esModule",{value:!0});n$.fimStream=ZXo;var zXo=Z1e(ae()),VXo=Cr(),HXo=yU(),zue=Z1e(gr()),WXo=ce(),JXo=ee(),cBr=yr(),KXo=fr(),dBr=Z1e(Vt()),GXo=Z1e(Qn()),XXo=br();function ZXo(t,e,r){return new XXo.APIPromise(YXo(t,e,r))}async function YXo(t,e,r){let n=(0,JXo.safeParse)(e,b=>dBr.FIMCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,VXo.encodeJSON)("body",o,{explode:!0}),a=(0,KXo.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,WXo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,cBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,cBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await zue.match(zue.sse(200,zXo.instanceof(ReadableStream).transform(b=>new HXo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:dBr.CompletionEvent$inboundSchema.parse(_)}))),zue.jsonErr(422,GXo.HTTPValidationError$inboundSchema),zue.fail("4XX"),zue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var mBr=S(Y1e=>{"use strict";Object.defineProperty(Y1e,"__esModule",{value:!0});Y1e.Fim=void 0;var QXo=lBr(),eZo=fBr(),tZo=Wc(),pBr=kd(),kft=class extends tZo.ClientSDK{async complete(e,r){return(0,pBr.unwrapAsync)((0,QXo.fimComplete)(this,e,r))}async stream(e,r){return(0,pBr.unwrapAsync)((0,eZo.fimStream)(this,e,r))}};Y1e.Fim=kft});var bBr=S(o$=>{"use strict";var rZo=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]}),nZo=o$&&o$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yBr=o$&&o$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&rZo(r,e,n[o]);return nZo(r,e),r}}();Object.defineProperty(o$,"__esModule",{value:!0});o$.fineTuningJobsCancel=lZo;var oZo=Cr(),Q1e=yBr(gr()),iZo=ce(),aZo=ee(),hBr=yr(),sZo=fr(),gBr=yBr(eo()),uZo=br();function lZo(t,e,r){return new uZo.APIPromise(cZo(t,e,r))}async function cZo(t,e,r){let n=(0,aZo.safeParse)(e,b=>gBr.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,oZo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,sZo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,iZo.compactMap)({Accept:"application/json"})),l=await(0,hBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await Q1e.match(Q1e.json(200,gBr.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema),Q1e.fail("4XX"),Q1e.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var vBr=S(i$=>{"use strict";var dZo=i$&&i$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fZo=i$&&i$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qft=i$&&i$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dZo(r,e,n[o]);return fZo(r,e),r}}();Object.defineProperty(i$,"__esModule",{value:!0});i$.fineTuningJobsCreate=vZo;var pZo=Cr(),eDe=qft(gr()),mZo=ce(),hZo=ee(),_Br=yr(),gZo=fr(),yZo=qft(Vt()),bZo=qft(eo()),_Zo=br();function vZo(t,e,r){return new _Zo.APIPromise(wZo(t,e,r))}async function wZo(t,e,r){let n=(0,hZo.safeParse)(e,g=>yZo.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,pZo.encodeJSON)("body",o,{explode:!0}),a=(0,gZo.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,mZo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,_Br.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_Br.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,[y]=await eDe.match(eDe.json(200,bZo.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),eDe.fail("4XX"),eDe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var xBr=S(a$=>{"use strict";var SZo=a$&&a$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CZo=a$&&a$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CBr=a$&&a$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&SZo(r,e,n[o]);return CZo(r,e),r}}();Object.defineProperty(a$,"__esModule",{value:!0});a$.fineTuningJobsGet=MZo;var xZo=Cr(),tDe=CBr(gr()),TZo=ce(),OZo=ee(),wBr=yr(),EZo=fr(),SBr=CBr(eo()),PZo=br();function MZo(t,e,r){return new PZo.APIPromise(RZo(t,e,r))}async function RZo(t,e,r){let n=(0,OZo.safeParse)(e,b=>SBr.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,xZo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,EZo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,TZo.compactMap)({Accept:"application/json"})),l=await(0,wBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,wBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await tDe.match(tDe.json(200,SBr.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema),tDe.fail("4XX"),tDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var OBr=S(s$=>{"use strict";var IZo=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]}),AZo=s$&&s$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uft=s$&&s$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IZo(r,e,n[o]);return AZo(r,e),r}}();Object.defineProperty(s$,"__esModule",{value:!0});s$.fineTuningJobsList=qZo;var NZo=Cr(),rDe=Uft(gr()),DZo=ce(),jZo=ee(),TBr=yr(),$Zo=fr(),LZo=Uft(Vt()),FZo=Uft(eo()),kZo=br();function qZo(t,e,r){return new kZo.APIPromise(UZo(t,e,r))}async function UZo(t,e,r){let n=(0,jZo.safeParse)(e,b=>FZo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,$Zo.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,NZo.encodeFormQuery)({created_after:o?.created_after,created_before:o?.created_before,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,DZo.compactMap)({Accept:"application/json"})),l=await(0,TBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,TBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await rDe.match(rDe.json(200,LZo.JobsOut$inboundSchema),rDe.fail("4XX"),rDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var RBr=S(u$=>{"use strict";var BZo=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]}),zZo=u$&&u$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MBr=u$&&u$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&BZo(r,e,n[o]);return zZo(r,e),r}}();Object.defineProperty(u$,"__esModule",{value:!0});u$.fineTuningJobsStart=GZo;var VZo=Cr(),nDe=MBr(gr()),HZo=ce(),WZo=ee(),EBr=yr(),JZo=fr(),PBr=MBr(eo()),KZo=br();function GZo(t,e,r){return new KZo.APIPromise(XZo(t,e,r))}async function XZo(t,e,r){let n=(0,WZo.safeParse)(e,b=>PBr.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,VZo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,JZo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,HZo.compactMap)({Accept:"application/json"})),l=await(0,EBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await nDe.match(nDe.json(200,PBr.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema),nDe.fail("4XX"),nDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var IBr=S(oDe=>{"use strict";Object.defineProperty(oDe,"__esModule",{value:!0});oDe.Jobs=void 0;var ZZo=bBr(),YZo=vBr(),QZo=xBr(),eYo=OBr(),tYo=RBr(),rYo=Wc(),Vue=kd(),Bft=class extends rYo.ClientSDK{async list(e,r){return(0,Vue.unwrapAsync)((0,eYo.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,Vue.unwrapAsync)((0,YZo.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,Vue.unwrapAsync)((0,QZo.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,Vue.unwrapAsync)((0,ZZo.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,Vue.unwrapAsync)((0,tYo.fineTuningJobsStart)(this,e,r))}};oDe.Jobs=Bft});var ABr=S(iDe=>{"use strict";Object.defineProperty(iDe,"__esModule",{value:!0});iDe.FineTuning=void 0;var nYo=Wc(),oYo=IBr(),zft=class extends nYo.ClientSDK{get jobs(){return this._jobs??(this._jobs=new oYo.Jobs(this._options))}};iDe.FineTuning=zft});var DBr=S(l$=>{"use strict";var iYo=l$&&l$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aYo=l$&&l$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vft=l$&&l$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iYo(r,e,n[o]);return aYo(r,e),r}}();Object.defineProperty(l$,"__esModule",{value:!0});l$.modelsArchive=mYo;var sYo=Cr(),aDe=Vft(gr()),uYo=ce(),lYo=ee(),NBr=yr(),cYo=fr(),dYo=Vft(Vt()),fYo=Vft(eo()),pYo=br();function mYo(t,e,r){return new pYo.APIPromise(hYo(t,e,r))}async function hYo(t,e,r){let n=(0,lYo.safeParse)(e,b=>fYo.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,sYo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,cYo.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,uYo.compactMap)({Accept:"application/json"})),l=await(0,NBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,NBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await aDe.match(aDe.json(200,dYo.ArchiveFTModelOut$inboundSchema),aDe.fail("4XX"),aDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var $Br=S(c$=>{"use strict";var gYo=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]}),yYo=c$&&c$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sDe=c$&&c$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gYo(r,e,n[o]);return yYo(r,e),r}}();Object.defineProperty(c$,"__esModule",{value:!0});c$.modelsDelete=OYo;var bYo=Cr(),Hue=sDe(gr()),_Yo=ce(),vYo=ee(),jBr=yr(),wYo=fr(),SYo=sDe(Vt()),CYo=sDe(Qn()),xYo=sDe(eo()),TYo=br();function OYo(t,e,r){return new TYo.APIPromise(EYo(t,e,r))}async function EYo(t,e,r){let n=(0,vYo.safeParse)(e,_=>xYo.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,bYo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,wYo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,_Yo.compactMap)({Accept:"application/json"})),l=await(0,jBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Hue.match(Hue.json(200,SYo.DeleteModelOut$inboundSchema),Hue.jsonErr(422,CYo.HTTPValidationError$inboundSchema),Hue.fail("4XX"),Hue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var FBr=S(d$=>{"use strict";var PYo=d$&&d$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MYo=d$&&d$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hft=d$&&d$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PYo(r,e,n[o]);return MYo(r,e),r}}();Object.defineProperty(d$,"__esModule",{value:!0});d$.modelsList=jYo;var Wue=Hft(gr()),RYo=ce(),LBr=yr(),IYo=fr(),AYo=Hft(Vt()),NYo=Hft(Qn()),DYo=br();function jYo(t,e){return new DYo.APIPromise($Yo(t,e))}async function $Yo(t,e){let r=(0,IYo.pathToFunc)("/v1/models")(),n=new Headers((0,RYo.compactMap)({Accept:"application/json"})),o=await(0,LBr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,LBr.resolveGlobalSecurity)(i),s={options:t._options,baseURL:e?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:e?.timeoutMs||t._options.timeoutMs||-1},e);if(!u.ok)return[u,{status:"invalid"}];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,{status:"request-error",request:l}];let d=c.value,f={HttpMeta:{Response:d,Request:l}},[p]=await Wue.match(Wue.json(200,AYo.ModelList$inboundSchema),Wue.jsonErr(422,NYo.HTTPValidationError$inboundSchema),Wue.fail("4XX"),Wue.fail("5XX"))(d,l,{extraFields:f});return p.ok?[p,{status:"complete",request:l,response:d}]:[p,{status:"complete",request:l,response:d}]}});var UBr=S(f$=>{"use strict";var LYo=f$&&f$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FYo=f$&&f$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wft=f$&&f$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LYo(r,e,n[o]);return FYo(r,e),r}}();Object.defineProperty(f$,"__esModule",{value:!0});f$.modelsRetrieve=HYo;var kYo=Cr(),Jue=Wft(gr()),qYo=ce(),UYo=ee(),kBr=yr(),BYo=fr(),zYo=Wft(Qn()),qBr=Wft(eo()),VYo=br();function HYo(t,e,r){return new VYo.APIPromise(WYo(t,e,r))}async function WYo(t,e,r){let n=(0,UYo.safeParse)(e,_=>qBr.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,kYo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,BYo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,qYo.compactMap)({Accept:"application/json"})),l=await(0,kBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,kBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,g={HttpMeta:{Response:y,Request:m}},[b]=await Jue.match(Jue.json(200,qBr.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),Jue.jsonErr(422,zYo.HTTPValidationError$inboundSchema),Jue.fail("4XX"),Jue.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var zBr=S(p$=>{"use strict";var JYo=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]}),KYo=p$&&p$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jft=p$&&p$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JYo(r,e,n[o]);return KYo(r,e),r}}();Object.defineProperty(p$,"__esModule",{value:!0});p$.modelsUnarchive=rQo;var GYo=Cr(),uDe=Jft(gr()),XYo=ce(),ZYo=ee(),BBr=yr(),YYo=fr(),QYo=Jft(Vt()),eQo=Jft(eo()),tQo=br();function rQo(t,e,r){return new tQo.APIPromise(nQo(t,e,r))}async function nQo(t,e,r){let n=(0,ZYo.safeParse)(e,b=>eQo.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,GYo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,YYo.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,XYo.compactMap)({Accept:"application/json"})),l=await(0,BBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,BBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await uDe.match(uDe.json(200,QYo.UnarchiveFTModelOut$inboundSchema),uDe.fail("4XX"),uDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var KBr=S(m$=>{"use strict";var oQo=m$&&m$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iQo=m$&&m$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JBr=m$&&m$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oQo(r,e,n[o]);return iQo(r,e),r}}();Object.defineProperty(m$,"__esModule",{value:!0});m$.modelsUpdate=cQo;var VBr=Cr(),lDe=JBr(gr()),aQo=ce(),sQo=ee(),HBr=yr(),uQo=fr(),WBr=JBr(eo()),lQo=br();function cQo(t,e,r){return new lQo.APIPromise(dQo(t,e,r))}async function dQo(t,e,r){let n=(0,sQo.safeParse)(e,b=>WBr.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,VBr.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,VBr.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,uQo.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,aQo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,HBr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,HBr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!p.ok)return[p,{status:"invalid"}];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,{status:"request-error",request:m}];let y=h.value,[g]=await lDe.match(lDe.json(200,WBr.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema),lDe.fail("4XX"),lDe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var GBr=S(cDe=>{"use strict";Object.defineProperty(cDe,"__esModule",{value:!0});cDe.Models=void 0;var fQo=DBr(),pQo=$Br(),mQo=FBr(),hQo=UBr(),gQo=zBr(),yQo=KBr(),bQo=Wc(),V7=kd(),Kft=class extends bQo.ClientSDK{async list(e){return(0,V7.unwrapAsync)((0,mQo.modelsList)(this,e))}async retrieve(e,r){return(0,V7.unwrapAsync)((0,hQo.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,V7.unwrapAsync)((0,pQo.modelsDelete)(this,e,r))}async update(e,r){return(0,V7.unwrapAsync)((0,yQo.modelsUpdate)(this,e,r))}async archive(e,r){return(0,V7.unwrapAsync)((0,fQo.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,V7.unwrapAsync)((0,gQo.modelsUnarchive)(this,e,r))}};cDe.Models=Kft});var YBr=S(h$=>{"use strict";var _Qo=h$&&h$.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vQo=h$&&h$.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gft=h$&&h$.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Qo(r,e,n[o]);return vQo(r,e),r}}();Object.defineProperty(h$,"__esModule",{value:!0});h$.ocrProcess=EQo;var wQo=Cr(),Kue=Gft(gr()),SQo=ce(),CQo=ee(),XBr=yr(),xQo=fr(),ZBr=Gft(Vt()),TQo=Gft(Qn()),OQo=br();function EQo(t,e,r){return new OQo.APIPromise(PQo(t,e,r))}async function PQo(t,e,r){let n=(0,CQo.safeParse)(e,b=>ZBr.OCRRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,wQo.encodeJSON)("body",o,{explode:!0}),a=(0,xQo.pathToFunc)("/v1/ocr")(),s=new Headers((0,SQo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,XBr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,XBr.resolveGlobalSecurity)(l),d={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"ocr_v1_ocr_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,userAgent:t._options.userAgent,timeoutMs:r?.timeoutMs||t._options.timeoutMs||-1},r);if(!f.ok)return[f,{status:"invalid"}];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,{status:"request-error",request:p}];let h=m.value,y={HttpMeta:{Response:h,Request:p}},[g]=await Kue.match(Kue.json(200,ZBr.OCRResponse$inboundSchema),Kue.jsonErr(422,TQo.HTTPValidationError$inboundSchema),Kue.fail("4XX"),Kue.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var QBr=S(dDe=>{"use strict";Object.defineProperty(dDe,"__esModule",{value:!0});dDe.Ocr=void 0;var MQo=YBr(),RQo=Wc(),IQo=kd(),Xft=class extends RQo.ClientSDK{async process(e,r){return(0,IQo.unwrapAsync)((0,MQo.ocrProcess)(this,e,r))}};dDe.Ocr=Xft});var ezr=S(fDe=>{"use strict";Object.defineProperty(fDe,"__esModule",{value:!0});fDe.Mistral=void 0;var AQo=Wc(),NQo=bjr(),DQo=Pjr(),jQo=hkr(),$Qo=nUr(),LQo=MUr(),FQo=BUr(),kQo=WUr(),qQo=aBr(),UQo=mBr(),BQo=ABr(),zQo=GBr(),VQo=QBr(),Zft=class extends AQo.ClientSDK{get models(){return this._models??(this._models=new zQo.Models(this._options))}get beta(){return this._beta??(this._beta=new $Qo.Beta(this._options))}get files(){return this._files??(this._files=new qQo.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new BQo.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new jQo.Batch(this._options))}get chat(){return this._chat??(this._chat=new LQo.Chat(this._options))}get fim(){return this._fim??(this._fim=new UQo.Fim(this._options))}get agents(){return this._agents??(this._agents=new NQo.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new kQo.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new FQo.Classifiers(this._options))}get ocr(){return this._ocr??(this._ocr=new VQo.Ocr(this._options))}get audio(){return this._audio??(this._audio=new DQo.Audio(this._options))}};fDe.Mistral=Zft});var nzr=S(fb=>{"use strict";var tzr=fb&&fb.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HQo=fb&&fb.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rzr=fb&&fb.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tzr(e,t,r)},WQo=fb&&fb.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tzr(r,e,n[o]);return HQo(r,e),r}}();Object.defineProperty(fb,"__esModule",{value:!0});fb.HTTPClient=fb.files=void 0;rzr(dMe(),fb);fb.files=WQo(G9());var JQo=X9();Object.defineProperty(fb,"HTTPClient",{enumerable:!0,get:function(){return JQo.HTTPClient}});rzr(ezr(),fb)});function Yft(t){let e=i=>{switch(i){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: ${i}`)}},r=(i,a)=>{let s=(u,l)=>{if(u.type==="image_url"&&(l==="user"||l==="assistant"))return{type:u.type,imageUrl:u?.image_url};if(u.type==="text")return{type:u.type,text:u?.text};throw new Error(`ChatMistralAI only supports messages of "image_url" for roles "user" and "assistant", and "text" for all others.
|
||
|
||
Received: ${JSON.stringify(i,null,2)}`)};if(typeof i=="string")return i;if(Array.isArray(i)){let u=e(a),l=[];return i.forEach(c=>{if(c.type==="text"||c.type==="image_url")l.push(s(c,u));else throw new Error('Mistral only supports types "text" or "image_url" for complex message types.')}),l}throw new Error(`Message content must be a string or an array.
|
||
|
||
Received: ${JSON.stringify(i,null,2)}`)},n=i=>{if(kl(i)&&i.tool_calls?.length)return i.tool_calls.map(a=>({...a,id:bse(a.id??"")})).map(Jk)},o=new Set;for(let i of t)"tool_call_id"in i&&typeof i.tool_call_id=="string"&&o.add(bse(i.tool_call_id));return t.flatMap(i=>{let a=n(i),s=r(i.content,i.getType());if("tool_call_id"in i&&typeof i.tool_call_id=="string")return[{role:e(i.getType()),content:s,name:i.name,toolCallId:bse(i.tool_call_id)}];if(kl(i)){if(a===void 0)return[{role:e(i.getType()),content:s}];{let u=a.filter(l=>o.has(bse(l.id??"")));return u.length===0?typeof s=="string"&&s.trim()===""||Array.isArray(s)&&s.length===0?[]:[{role:e(i.getType()),content:s}]:[{role:e(i.getType()),toolCalls:u}]}}return[{role:e(i.getType()),content:s}]})}function KQo(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=ilt(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=Ix(s,{returnId:!0});i.push({...u,id:u.id??cMe().replace(/-/g,"")})}catch(u){a.push(_0(s,u.message))}return new Pn({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 qs({content:o})}}function GQo(t,e){if(!t.content&&!t.toolCalls)return e?new Er({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??cMe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=ilt(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 rw({content:o}):n==="assistant"?new Er({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 _S({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new tw({content:o,additional_kwargs:i}):new ew({content:o,role:n})}function ozr(t){if(!(!t||!t.length))return t.map(e=>{if("function"in e)return{type:e.type??"function",function:e.function};if(Xg(e)){let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Ii(e.schema)?Ci(e.schema):e.schema}}}throw new Error(`Unknown tool type passed to ChatMistral: ${JSON.stringify(e,null,2)}`)})}var izr,azr,Qft,szr=v(()=>{PSr();DSr();izr=$(nzr(),1),azr=$(X9(),1);ta();YI();Ed();Jz();au();fO();PV();sw();Ny();pD();uv();Qft=class extends jd{constructor(e){super(e??{});x(this,"lc_namespace",["langchain","chat_models","mistralai"]);x(this,"model","mistral-small-latest");x(this,"apiKey");x(this,"endpoint");x(this,"serverURL");x(this,"temperature",.7);x(this,"streaming",!1);x(this,"topP",1);x(this,"maxTokens");x(this,"safeMode",!1);x(this,"safePrompt",!1);x(this,"randomSeed");x(this,"seed");x(this,"maxRetries");x(this,"lc_serializable",!0);x(this,"streamUsage",!0);x(this,"beforeRequestHooks");x(this,"requestErrorHooks");x(this,"responseHooks");x(this,"httpClient");x(this,"presencePenalty");x(this,"frequencyPenalty");x(this,"numCompletions");let r=e?.apiKey??Xr("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()}static lc_name(){return"ChatMistralAI"}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?ozr(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){let n=ozr(e);return new DS({bound:this,kwargs:{...r??{},tools:n},config:{}})}async completionWithRetry(e,r){let n=new ES({maxRetries:this.maxRetries}),o=new izr.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=Yft(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 b=g.generationInfo?.completion??0;h[b]===void 0?h[b]=g:h[b]=h[b].concat(g)}return{generations:Object.entries(h).sort(([g],[b])=>parseInt(g,10)-parseInt(b,10)).map(([g,b])=>b),llmOutput:{estimatedTokenUsage:o}}}let l=await this.completionWithRetry(s,!1),{completionTokens:c,promptTokens:d,totalTokens:f}=l?.usage??{};c&&(o.completionTokens=(o.completionTokens??0)+c),d&&(o.promptTokens=(o.promptTokens??0)+d),f&&(o.totalTokens=(o.totalTokens??0)+f);let p=[];for(let m of l?.choices??[]){if("delta"in m)throw new Error("Delta not supported in non-streaming mode.");if(!("message"in m))throw new Error("No message found in the choice.");let h=m.message?.content??"";Array.isArray(h)&&(h=h[0].type==="text"?h[0].text:"");let y={text:h,message:KQo(m,l?.usage)};m.finishReason&&(y.generationInfo={finishReason:m.finishReason}),p.push(y)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=Yft(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=GQo(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 si({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 azr.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"){let f;Ii(n)?(u=uw.fromZodSchema(n),f=Ci(n)):u=new j_,s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:f}})}else{let f=o??"extract";if(Ii(n)){let p=Ci(n);s=this.bindTools([{type:"function",function:{name:f,description:p.description,parameters:p}}]).withConfig({tool_choice:"any",ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:p}}),u=new lv({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.bindTools([{type:"function",function:p}]).withConfig({tool_choice:"any"}),u=new lv({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Au.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Au.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Bl.from([{raw:s},d])}}});var uzr=v(()=>{au();vV();zk()});var lzr=v(()=>{Ed();Jz();au();zk();Tie()});var czr=v(()=>{szr();uzr();lzr()});var ept,dzr=v(()=>{au();iH();ept=class extends fq{constructor(e){let r=e?.apiKey||Xr("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"}});x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain","chat_models","xai"])}static lc_name(){return"ChatXAI"}_llmType(){return"xai"}get lc_secrets(){return{apiKey:"XAI_API_KEY"}}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)}_convertCompletionsDeltaToBaseMessageChunk(e,r,n){let o=super._convertCompletionsDeltaToBaseMessageChunk(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}_convertCompletionsMessageToBaseMessage(e,r){let n=super._convertCompletionsMessageToBaseMessage(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 fzr=v(()=>{dzr()});var pDe,mDe,pzr,tpt=v(()=>{pDe="RFC3986",mDe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},pzr="RFC1738"});function hzr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function npt(t,e){if(XQo(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var XQo,XA,rpt,mzr,gzr=v(()=>{tpt();XQo=Array.isArray,XA=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),rpt=1024,mzr=(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+=rpt){let u=i.length>=rpt?i.slice(s,s+rpt):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===pzr&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=XA[d];continue}if(d<2048){l[l.length]=XA[192|d>>6]+XA[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=XA[224|d>>12]+XA[128|d>>6&63]+XA[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=XA[240|d>>18]+XA[128|d>>12&63]+XA[128|d>>6&63]+XA[128|d&63]}a+=l.join("")}return a}});function eei(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function _zr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,T=!1;for(;(_=_.get(opt))!==void 0&&!T;){let I=_.get(t);if(w+=1,typeof I<"u"){if(I===w)throw new RangeError("Cyclic object value");T=!0}typeof _.get(opt)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&ZA(b)&&(b=npt(b,function(I){return I instanceof Date?f?.(I):I})),b===null){if(i)return u&&!h?u(e,Xm.encoder,y,"key",p):e;b=""}if(eei(b)||hzr(b)){if(u){let I=h?e:u(e,Xm.encoder,y,"key",p);return[m?.(I)+"="+m?.(u(b,Xm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&ZA(b))h&&u&&(b=npt(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(ZA(l))E=l;else{let I=Object.keys(b);E=c?I.sort(c):I}let P=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&ZA(b)&&b.length===1?P+"[]":P;if(o&&ZA(b)&&b.length===0)return R+"[]";for(let I=0;I<E.length;++I){let N=E[I],z=typeof N=="object"&&typeof N.value<"u"?N.value:b[N];if(a&&z===null)continue;let V=d&&s?N.replace(/\./g,"%2E"):N,k=ZA(b)?typeof r=="function"?r(R,V):R:R+(d?"."+V:"["+V+"]");g.set(t,w);let X=new WeakMap;X.set(opt,g),bzr(O,_zr(z,k,r,n,o,i,a,s,r==="comma"&&h&&ZA(b)?null:u,l,c,d,f,p,m,h,y,X))}return O}function tei(t=Xm){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||Xm.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=pDe;if(typeof t.format<"u"){if(!ZQo.call(mDe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=mDe[r],o=Xm.filter;(typeof t.filter=="function"||ZA(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in yzr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Xm.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:Xm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Xm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Xm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Xm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Xm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Xm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Xm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Xm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Xm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Xm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Xm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Xm.strictNullHandling}}function ipt(t,e={}){let r=t,n=tei(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):ZA(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=yzr[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||bzr(a,_zr(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 ZQo,yzr,ZA,YQo,bzr,QQo,Xm,opt,vzr=v(()=>{gzr();tpt();ZQo=Object.prototype.hasOwnProperty,yzr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},ZA=Array.isArray,YQo=Array.prototype.push,bzr=function(t,e){YQo.apply(t,ZA(e)?e:[e])},QQo=Date.prototype.toISOString,Xm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:mzr,encodeValuesOnly:!1,format:pDe,formatter:mDe[pDe],indices:!1,serializeDate(t){return QQo.call(t)},skipNulls:!1,strictNullHandling:!1};opt={}});var wzr=v(()=>{vzr()});var T3,Szr=v(()=>{T3="4.95.1"});function xzr(t,e={auto:!1}){if(Czr)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(O3)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${O3}'\``);Czr=e.auto,O3=t.kind,apt=t.fetch,nei=t.Request,oei=t.Response,iei=t.Headers,spt=t.FormData,aei=t.Blob,hDe=t.File,upt=t.ReadableStream,lpt=t.getMultipartRequestOptions,cpt=t.getDefaultAgent,gDe=t.fileFromPath,dpt=t.isFsReadStream}var Czr,O3,apt,nei,oei,iei,spt,aei,hDe,upt,lpt,cpt,gDe,dpt,fpt=v(()=>{Czr=!1});var yDe,Tzr=v(()=>{yDe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function Ozr({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 yDe(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 Ezr=v(()=>{Tzr()});var Pzr=v(()=>{Ezr()});var ppt,Gue=v(()=>{fpt();Pzr();fpt();ppt=()=>{O3||xzr(Ozr(),{auto:!0})};ppt()});var jr,Zm,Sm,CU,xU,Xue,Zue,Yue,Que,ele,tle,rle,nle,H7,W7,Kw=v(()=>{Xi();jr=class extends Error{},Zm=class t extends jr{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 CU({message:n,cause:bDe(r)});let i=r?.error;return e===400?new Xue(e,i,n,o):e===401?new Zue(e,i,n,o):e===403?new Yue(e,i,n,o):e===404?new Que(e,i,n,o):e===409?new ele(e,i,n,o):e===422?new tle(e,i,n,o):e===429?new rle(e,i,n,o):e>=500?new nle(e,i,n,o):new t(e,i,n,o)}},Sm=class extends Zm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},CU=class extends Zm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},xU=class extends CU{constructor({message:e}={}){super({message:e??"Request timed out."})}},Xue=class extends Zm{},Zue=class extends Zm{},Yue=class extends Zm{},Que=class extends Zm{},ele=class extends Zm{},tle=class extends Zm{},rle=class extends Zm{},nle=class extends Zm{},H7=class extends jr{constructor(){super("Could not parse response content as the length limit was reached")}},W7=class extends jr{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function cei(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 Mzr(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 _De,E3,Gw,P3,Rzr=v(()=>{Kw();_De=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},E3=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)},P3=class{constructor(){Gw.set(this,void 0),this.buffer=new Uint8Array,_De(this,Gw,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=cei(this.buffer,E3(this,Gw,"f")))!=null;){if(i.carriage&&E3(this,Gw,"f")==null){_De(this,Gw,i.index,"f");continue}if(E3(this,Gw,"f")!=null&&(i.index!==E3(this,Gw,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,E3(this,Gw,"f")-1))),this.buffer=this.buffer.slice(E3(this,Gw,"f")),_De(this,Gw,null,"f");continue}let a=E3(this,Gw,"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),_De(this,Gw,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 jr(`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 jr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new jr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
||
`):[]}};Gw=new WeakMap;P3.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);P3.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function mpt(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 Izr=v(()=>{});async function*dei(t,e){if(!t.body)throw e.abort(),new jr("Attempted to iterate over a response with no body");let r=new hpt,n=new P3,o=mpt(t.body);for await(let i of fei(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*fei(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=Mzr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function pei(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var YA,hpt,vDe=v(()=>{Gue();Kw();Rzr();Izr();Xi();Kw();YA=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 dei(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 Zm(void 0,s.error,void 0,gpt(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 Zm(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 P3,s=mpt(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 upt({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?.()}})}};hpt=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]=pei(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function _pt(t,e,r){if(t=await t,Nzr(t))return t;if(Azr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=ole(o)?[await o.arrayBuffer()]:[o];return new hDe(i,e,r)}let n=await hei(t);if(e||(e=yei(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new hDe(n,e,r)}async function hei(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(ole(t))e.push(await t.arrayBuffer());else if(bei(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${gei(t)}`);return e}function gei(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function yei(t){return ypt(t.name)||ypt(t.filename)||ypt(t.path)?.split(/[\\/]/).pop()}var Azr,Nzr,ole,mei,ypt,bei,vpt,Q0,Dzr,bpt,wDe=v(()=>{Gue();Gue();Azr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Nzr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&ole(t),ole=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",mei=t=>Nzr(t)||Azr(t)||dpt(t);ypt=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},bei=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",vpt=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",Q0=async t=>{let e=await Dzr(t.body);return lpt(e,t)},Dzr=async t=>{let e=new spt;return await Promise.all(Object.entries(t||{}).map(([r,n])=>bpt(e,r,n))),e},bpt=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(mei(r)){let n=await _pt(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>bpt(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>bpt(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 qzr(t){let{response:e}=t;if(t.options.stream)return g$("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):YA.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 g$("response",e.status,e.url,e.headers,a),Uzr(a,e)}let i=await e.text();return g$("response",e.status,e.url,e.headers,i),i}function Uzr(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 xei(){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 Bzr(t){if(!t)return!0;for(let e in t)return!1;return!0}function zzr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Fzr(t,e){for(let r in e){if(!zzr(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 g$(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)kzr.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)kzr.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function sle(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var vei,wei,SDe,xDe,TDe,ile,Spt,gpt,Sei,ti,Cei,jzr,$zr,Lzr,Tei,Oei,Eei,Pei,y$,wpt,bDe,ale,kzr,Mei,Vzr,Rei,CDe,Hzr,Xi=v(()=>{Szr();vDe();Kw();Gue();wDe();wDe();vei=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},wei=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)};ppt();xDe=class t extends Promise{constructor(e,r=qzr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>Uzr(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)}},TDe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=wpt("maxRetries",r),this.timeout=wpt("timeout",n),this.httpAgent=o,this.fetch=i??apt}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Tei(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Mei()}`}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&&ole(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:vpt(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&&wpt("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??cpt(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 Fzr(i,a),Fzr(i,r),vpt(e.body)&&O3!=="node"&&delete i["content-type"],CDe(a,"x-stainless-retry-count")===void 0&&CDe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),CDe(a,"x-stainless-timeout")===void 0&&CDe(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 Zm.generate(e,r,n,o)}request(e,r=null){return new xDe(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}),g$("request",a,n,i.headers),n.signal?.aborted)throw new Sm;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(bDe);if(l instanceof Error){if(n.signal?.aborted)throw new Sm;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new xU:new CU({cause:l})}let c=gpt(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return g$(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>bDe(y).message),f=Oei(d),p=f?void 0:d;throw g$(`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 Spt(this,n,e)}buildURL(e,r){let n=Pei(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Bzr(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 jr(`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 y$(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 ${T3}`}},ile=class{constructor(e,r,n,o){SDe.set(this,void 0),vei(this,SDe,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 jr("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 wei(this,SDe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(SDe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Spt=class extends xDe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await qzr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},gpt=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),Sei={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},ti=t=>typeof t=="object"&&t!==null&&!Bzr(t)&&Object.keys(t).every(e=>zzr(Sei,e)),Cei=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T3,"X-Stainless-OS":$zr(Deno.build.os),"X-Stainless-Arch":jzr(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":T3,"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":T3,"X-Stainless-OS":$zr(process.platform),"X-Stainless-Arch":jzr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=xei();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":T3,"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":T3,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};jzr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",$zr=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"),Tei=()=>Lzr??(Lzr=Cei()),Oei=t=>{try{return JSON.parse(t)}catch{return}},Eei=/^[a-z][a-z0-9+.-]*:/i,Pei=t=>Eei.test(t),y$=t=>new Promise(e=>setTimeout(e,t)),wpt=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new jr(`${t} must be an integer`);if(e<0)throw new jr(`${t} must be a positive integer`);return e},bDe=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)},ale=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};kzr=new Set(["authorization","api-key"]);Mei=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),Vzr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",Rei=t=>typeof t?.get=="function",CDe=(t,e)=>{let r=e.toLowerCase();if(Rei(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},Hzr=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 QA,es,tg=v(()=>{Xi();QA=class extends ile{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}},es=class extends ile{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 Lt,fi=v(()=>{Lt=class{constructor(e){this._client=e}}});var J7,Cpt=v(()=>{fi();Xi();ule();J7=class extends Lt{list(e,r={},n){return ti(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,ODe,{query:r,...n})}}});var OU,EU,ODe,ule=v(()=>{fi();Xi();Cpt();Cpt();tg();OU=class extends Lt{constructor(){super(...arguments),this.messages=new J7(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 ti(e)?this.list({},e):this._client.getAPIList("/chat/completions",EU,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},EU=class extends es{},ODe=class extends es{};OU.ChatCompletionsPage=EU;OU.Messages=J7});var b$,xpt=v(()=>{fi();ule();ule();b$=class extends Lt{constructor(){super(...arguments),this.completions=new OU(this._client)}};b$.Completions=OU;b$.ChatCompletionsPage=EU});var Wzr=v(()=>{xpt()});var Jzr=v(()=>{});var K7,Tpt=v(()=>{fi();K7=class extends Lt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var G7,Opt=v(()=>{fi();Xi();G7=class extends Lt{create(e,r){return this._client.post("/audio/transcriptions",Q0({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var X7,Ept=v(()=>{fi();Xi();X7=class extends Lt{create(e,r){return this._client.post("/audio/translations",Q0({body:e,...r,__metadata:{model:e.model}}))}}});var eN,Ppt=v(()=>{fi();Tpt();Tpt();Opt();Opt();Ept();Ept();eN=class extends Lt{constructor(){super(...arguments),this.transcriptions=new G7(this._client),this.translations=new X7(this._client),this.speech=new K7(this._client)}};eN.Transcriptions=G7;eN.Translations=X7;eN.Speech=K7});var PU,M3,Mpt=v(()=>{fi();Xi();tg();PU=class extends Lt{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 ti(e)?this.list({},e):this._client.getAPIList("/batches",M3,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},M3=class extends es{};PU.BatchesPage=M3});var R3,Z7,Rpt=v(()=>{fi();Xi();tg();R3=class extends Lt{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 ti(e)?this.list({},e):this._client.getAPIList("/assistants",Z7,{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}})}},Z7=class extends es{};R3.AssistantsPage=Z7});function Ipt(t){return typeof t.parse=="function"}var Kzr=v(()=>{});var MU,Apt,Npt,Dpt=v(()=>{MU=t=>t?.role==="assistant",Apt=t=>t?.role==="function",Npt=t=>t?.role==="tool"});var oT,Ec,jpt,EDe,PDe,lle,cle,MDe,dle,_$,fle,RDe,IDe,Y7,Gzr,RU,ADe=v(()=>{Kw();oT=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},Ec=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)},RU=class{constructor(){jpt.add(this),this.controller=new AbortController,EDe.set(this,void 0),PDe.set(this,()=>{}),lle.set(this,()=>{}),cle.set(this,void 0),MDe.set(this,()=>{}),dle.set(this,()=>{}),_$.set(this,{}),fle.set(this,!1),RDe.set(this,!1),IDe.set(this,!1),Y7.set(this,!1),oT(this,EDe,new Promise((e,r)=>{oT(this,PDe,e,"f"),oT(this,lle,r,"f")}),"f"),oT(this,cle,new Promise((e,r)=>{oT(this,MDe,e,"f"),oT(this,dle,r,"f")}),"f"),Ec(this,EDe,"f").catch(()=>{}),Ec(this,cle,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},Ec(this,jpt,"m",Gzr).bind(this))},0)}_connected(){this.ended||(Ec(this,PDe,"f").call(this),this._emit("connect"))}get ended(){return Ec(this,fle,"f")}get errored(){return Ec(this,RDe,"f")}get aborted(){return Ec(this,IDe,"f")}abort(){this.controller.abort()}on(e,r){return(Ec(this,_$,"f")[e]||(Ec(this,_$,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Ec(this,_$,"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(Ec(this,_$,"f")[e]||(Ec(this,_$,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{oT(this,Y7,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){oT(this,Y7,!0,"f"),await Ec(this,cle,"f")}_emit(e,...r){if(Ec(this,fle,"f"))return;e==="end"&&(oT(this,fle,!0,"f"),Ec(this,MDe,"f").call(this));let n=Ec(this,_$,"f")[e];if(n&&(Ec(this,_$,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Ec(this,Y7,"f")&&!n?.length&&Promise.reject(o),Ec(this,lle,"f").call(this,o),Ec(this,dle,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Ec(this,Y7,"f")&&!n?.length&&Promise.reject(o),Ec(this,lle,"f").call(this,o),Ec(this,dle,"f").call(this,o),this._emit("end")}}_emitFinal(){}};EDe=new WeakMap,PDe=new WeakMap,lle=new WeakMap,cle=new WeakMap,MDe=new WeakMap,dle=new WeakMap,_$=new WeakMap,fle=new WeakMap,RDe=new WeakMap,IDe=new WeakMap,Y7=new WeakMap,jpt=new WeakSet,Gzr=function(e){if(oT(this,RDe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Sm),e instanceof Sm)return oT(this,IDe,!0,"f"),this._emit("abort",e);if(e instanceof jr)return this._emit("error",e);if(e instanceof Error){let r=new jr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new jr(String(e)))}});function ple(t){return t?.$brand==="auto-parseable-response-format"}function I3(t){return t?.$brand==="auto-parseable-tool"}function Xzr(t,e){return!e||!$pt(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}}))}:mle(t,e)}function mle(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new H7;if(n.finish_reason==="content_filter")throw new W7;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>Fei(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?Lei(e,n.message.content):null}}});return{...t,choices:r}}function Lei(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 Fei(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:I3(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Zzr(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return I3(r)||r?.function.strict||!1}function $pt(t){return ple(t.response_format)?!0:t.tools?.some(e=>I3(e)||e.type==="function"&&e.function.strict===!0)??!1}function Yzr(t){for(let e of t??[]){if(e.type!=="function")throw new jr(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new jr(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var hle=v(()=>{Kw()});var Tv,pb,Lpt,NDe,Fpt,kpt,qpt,e4r,Upt,Qzr,Q7,Bpt=v(()=>{Kw();Kzr();Dpt();ADe();hle();Tv=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)},Qzr=10,Q7=class extends RU{constructor(){super(...arguments),pb.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),(Apt(e)||Npt(e))&&e.content)this._emit("functionCallResult",e.content);else if(MU(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(MU(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 jr("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),Tv(this,pb,"m",Lpt).call(this)}async finalMessage(){return await this.done(),Tv(this,pb,"m",NDe).call(this)}async finalFunctionCall(){return await this.done(),Tv(this,pb,"m",Fpt).call(this)}async finalFunctionCallResult(){return await this.done(),Tv(this,pb,"m",kpt).call(this)}async totalUsage(){return await this.done(),Tv(this,pb,"m",qpt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=Tv(this,pb,"m",NDe).call(this);r&&this._emit("finalMessage",r);let n=Tv(this,pb,"m",Lpt).call(this);n&&this._emit("finalContent",n);let o=Tv(this,pb,"m",Fpt).call(this);o&&this._emit("finalFunctionCall",o);let i=Tv(this,pb,"m",kpt).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",Tv(this,pb,"m",qpt).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),Tv(this,pb,"m",e4r).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(mle(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=Qzr}=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 jr("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:y}=m.function_call,g=c[h];if(g){if(u&&u!==h){let T=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:T});continue}}else{let T=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(O=>JSON.stringify(O.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:T});continue}let b;try{b=Ipt(g)?await g.parse(y):y}catch(T){this._addMessage({role:o,name:h,content:T instanceof Error?T.message:String(T)});continue}let _=await g.function(b,this),w=Tv(this,pb,"m",Upt).call(this,_);if(this._addMessage({role:o,name:h,content:w}),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=Qzr}=n||{},c=r.tools.map(p=>{if(I3(p)){if(!p.$callback)throw new jr("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 jr("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let y of h.tool_calls){if(y.type!=="function")continue;let g=y.id,{name:b,arguments:_}=y.function,w=d[b];if(w){if(u&&u!==b){let P=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}}else{let P=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:P});continue}let T;try{T=Ipt(w)?await w.parse(_):_}catch(P){let R=P instanceof Error?P.message:String(P);this._addMessage({role:o,tool_call_id:g,content:R});continue}let O=await w.function(T,this),E=Tv(this,pb,"m",Upt).call(this,O);if(this._addMessage({role:o,tool_call_id:g,content:E}),u)return}}}};pb=new WeakSet,Lpt=function(){return Tv(this,pb,"m",NDe).call(this).content??null},NDe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(MU(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 jr("stream ended without producing a ChatCompletionMessage with role=assistant")},Fpt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(MU(r)&&r?.function_call)return r.function_call;if(MU(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},kpt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Apt(r)&&r.content!=null||Npt(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}},qpt=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},e4r=function(e){if(e.n!=null&&e.n>1)throw new jr("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Upt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var gle,t4r=v(()=>{Bpt();Dpt();gle=class t extends Q7{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),MU(e)&&e.content&&this._emit("content",e.content)}}});function kei(t,e=rg.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return qei(t.trim(),e)}var rg,zpt,Vpt,qei,Hpt,r4r=v(()=>{rg={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},zpt=class extends Error{},Vpt=class extends Error{};qei=(t,e)=>{let r=t.length,n=0,o=f=>{throw new zpt(`${f} at position ${n}`)},i=f=>{throw new Vpt(`${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"||rg.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||rg.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||rg.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||rg.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||rg.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||rg.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(rg.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&&rg.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(rg.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(rg.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(rg.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&rg.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(rg.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&&!(rg.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&rg.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()},Hpt=t=>kei(t,rg.ALL^rg.NUM)});function Uei(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 jr(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,b=l.role;if(!b)throw new jr(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new jr(`missing function_call.arguments for choice ${d}`);if(!w)throw new jr(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:_,name:w},role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return y?{...p,index:d,finish_reason:c,logprobs:f,message:{...g,role:b,content:m,refusal:l.refusal??null,tool_calls:y.map((_,w)=>{let{function:T,type:O,id:E,...P}=_,{arguments:R,name:I,...N}=T||{};if(E==null)throw new jr(`missing choices[${d}].tool_calls[${w}].id
|
||
${$De(t)}`);if(O==null)throw new jr(`missing choices[${d}].tool_calls[${w}].type
|
||
${$De(t)}`);if(I==null)throw new jr(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${$De(t)}`);if(R==null)throw new jr(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${$De(t)}`);return{...P,id:E,type:O,function:{...N,name:I,arguments:R}}})}}:{...p,message:{...g,content:m,role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...a?{system_fingerprint:a}:{}};return Xzr(u,e)}function $De(t){return JSON.stringify(t)}var eX,xu,Ym,v$,tX,IU,Wpt,DDe,Jpt,Kpt,Gpt,jDe,Xpt,n4r,rX,Zpt=v(()=>{Kw();Bpt();vDe();hle();r4r();eX=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},xu=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)},rX=class t extends Q7{constructor(e){super(),Ym.add(this),v$.set(this,void 0),tX.set(this,void 0),IU.set(this,void 0),eX(this,v$,e,"f"),eX(this,tX,[],"f")}get currentChatCompletionSnapshot(){return xu(this,IU,"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())),xu(this,Ym,"m",Wpt).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)xu(this,Ym,"m",Jpt).call(this,a);if(i.controller.signal?.aborted)throw new Sm;return this._addChatCompletion(xu(this,Ym,"m",jDe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),xu(this,Ym,"m",Wpt).call(this),this._connected();let o=YA.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(xu(this,Ym,"m",jDe).call(this)),xu(this,Ym,"m",Jpt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Sm;return this._addChatCompletion(xu(this,Ym,"m",jDe).call(this))}[(v$=new WeakMap,tX=new WeakMap,IU=new WeakMap,Ym=new WeakSet,Wpt=function(){this.ended||eX(this,IU,void 0,"f")},DDe=function(r){let n=xu(this,tX,"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},xu(this,tX,"f")[r.index]=n,n)},Jpt=function(r){if(this.ended)return;let n=xu(this,Ym,"m",n4r).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=xu(this,Ym,"m",DDe).call(this,i);i.finish_reason&&(xu(this,Ym,"m",Gpt).call(this,i),a.current_tool_call_index!=null&&xu(this,Ym,"m",Kpt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(xu(this,Ym,"m",Gpt).call(this,i),a.current_tool_call_index!=null&&xu(this,Ym,"m",Kpt).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))}}},Kpt=function(r,n){if(xu(this,Ym,"m",DDe).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=xu(this,v$,"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:I3(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Gpt=function(r){let n=xu(this,Ym,"m",DDe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=xu(this,Ym,"m",Xpt).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}))},jDe=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");let r=xu(this,IU,"f");if(!r)throw new jr("request ended without sending any chunks");return eX(this,IU,void 0,"f"),eX(this,tX,[],"f"),Uei(r,xu(this,v$,"f"))},Xpt=function(){let r=xu(this,v$,"f")?.response_format;return ple(r)?r:null},n4r=function(r){var n,o,i,a;let s=xu(this,IU,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=eX(this,IU,{...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:O,refusal:E,...P}=p;Object.assign(h.logprobs,P),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,xu(this,v$,"f")&&$pt(xu(this,v$,"f")))){if(d==="length")throw new H7;if(d==="content_filter")throw new W7}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...T}=c;if(Object.assign(h.message,T),g&&(h.message.refusal=(h.message.refusal||"")+g),_&&(h.message.role=_),b&&(h.message.function_call?(b.name&&(h.message.function_call.name=b.name),b.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=b.arguments)):h.message.function_call=b),y&&(h.message.content=(h.message.content||"")+y,!h.message.refusal&&xu(this,Ym,"m",Xpt).call(this)&&(h.message.parsed=Hpt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:P,function:R,...I}of w){let N=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(N,I),E&&(N.id=E),P&&(N.type=P),R&&(N.function??(N.function={name:R.name??"",arguments:""})),R?.name&&(N.function.name=R.name),R?.arguments&&(N.function.arguments+=R.arguments,Zzr(xu(this,v$,"f"),N)&&(N.function.parsed_arguments=Hpt(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 YA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var yle,o4r=v(()=>{Zpt();yle=class t extends rX{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 ble,i4r=v(()=>{fi();t4r();o4r();Zpt();hle();ble=class extends Lt{parse(e,r){return Yzr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>mle(n,e))}runFunctions(e,r){return e.stream?yle.runFunctions(this._client,e,r):gle.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?yle.runTools(this._client,e,r):gle.runTools(this._client,e,r)}stream(e,r){return rX.createChatCompletion(this._client,e,r)}}});var nX,a4r=v(()=>{fi();i4r();nX=class extends Lt{constructor(){super(...arguments),this.completions=new ble(this._client)}};(function(t){t.Completions=ble})(nX||(nX={}))});var oX,Ypt=v(()=>{fi();oX=class extends Lt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var iX,Qpt=v(()=>{fi();iX=class extends Lt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var AU,emt=v(()=>{fi();Ypt();Ypt();Qpt();Qpt();AU=class extends Lt{constructor(){super(...arguments),this.sessions=new oX(this._client),this.transcriptionSessions=new iX(this._client)}};AU.Sessions=oX;AU.TranscriptionSessions=iX});var nn,Xw,dy,tmt,tN,LDe,iT,N3,aX,A3,qDe,Zw,FDe,kDe,wle,_le,vle,s4r,u4r,l4r,c4r,d4r,f4r,p4r,rN,rmt=v(()=>{Xi();vDe();Kw();ADe();nn=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)},Xw=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},rN=class t extends RU{constructor(){super(...arguments),dy.add(this),tmt.set(this,[]),tN.set(this,{}),LDe.set(this,{}),iT.set(this,void 0),N3.set(this,void 0),aX.set(this,void 0),A3.set(this,void 0),qDe.set(this,void 0),Zw.set(this,void 0),FDe.set(this,void 0),kDe.set(this,void 0),wle.set(this,void 0)}[(tmt=new WeakMap,tN=new WeakMap,LDe=new WeakMap,iT=new WeakMap,N3=new WeakMap,aX=new WeakMap,A3=new WeakMap,qDe=new WeakMap,Zw=new WeakMap,FDe=new WeakMap,kDe=new WeakMap,wle=new WeakMap,dy=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=YA.fromReadableStream(e,this.controller);for await(let i of o)nn(this,dy,"m",_le).call(this,i);if(o.controller.signal?.aborted)throw new Sm;return this._addRun(nn(this,dy,"m",vle).call(this))}toReadableStream(){return new YA(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)nn(this,dy,"m",_le).call(this,l);if(u.controller.signal?.aborted)throw new Sm;return this._addRun(nn(this,dy,"m",vle).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 nn(this,FDe,"f")}currentRun(){return nn(this,kDe,"f")}currentMessageSnapshot(){return nn(this,iT,"f")}currentRunStepSnapshot(){return nn(this,wle,"f")}async finalRunSteps(){return await this.done(),Object.values(nn(this,tN,"f"))}async finalMessages(){return await this.done(),Object.values(nn(this,LDe,"f"))}async finalRun(){if(await this.done(),!nn(this,N3,"f"))throw Error("Final run was not received.");return nn(this,N3,"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)nn(this,dy,"m",_le).call(this,s);if(a.controller.signal?.aborted)throw new Sm;return this._addRun(nn(this,dy,"m",vle).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)nn(this,dy,"m",_le).call(this,u);if(s.controller.signal?.aborted)throw new Sm;return this._addRun(nn(this,dy,"m",vle).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(sle(i)&&sle(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(!sle(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)}};_le=function(e){if(!this.ended)switch(Xw(this,FDe,e,"f"),nn(this,dy,"m",l4r).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":nn(this,dy,"m",p4r).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":nn(this,dy,"m",u4r).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":nn(this,dy,"m",s4r).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},vle=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");if(!nn(this,N3,"f"))throw Error("Final run has not been received");return nn(this,N3,"f")},s4r=function(e){let[r,n]=nn(this,dy,"m",d4r).call(this,e,nn(this,iT,"f"));Xw(this,iT,r,"f"),nn(this,LDe,"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!=nn(this,aX,"f")){if(nn(this,A3,"f"))switch(nn(this,A3,"f").type){case"text":this._emit("textDone",nn(this,A3,"f").text,nn(this,iT,"f"));break;case"image_file":this._emit("imageFileDone",nn(this,A3,"f").image_file,nn(this,iT,"f"));break}Xw(this,aX,o.index,"f")}Xw(this,A3,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(nn(this,aX,"f")!==void 0){let o=e.data.content[nn(this,aX,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,nn(this,iT,"f"));break;case"text":this._emit("textDone",o.text,nn(this,iT,"f"));break}}nn(this,iT,"f")&&this._emit("messageDone",e.data),Xw(this,iT,void 0,"f")}},u4r=function(e){let r=nn(this,dy,"m",c4r).call(this,e);switch(Xw(this,wle,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==nn(this,qDe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(nn(this,Zw,"f")&&this._emit("toolCallDone",nn(this,Zw,"f")),Xw(this,qDe,i.index,"f"),Xw(this,Zw,r.step_details.tool_calls[i.index],"f"),nn(this,Zw,"f")&&this._emit("toolCallCreated",nn(this,Zw,"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":Xw(this,wle,void 0,"f"),e.data.step_details.type=="tool_calls"&&nn(this,Zw,"f")&&(this._emit("toolCallDone",nn(this,Zw,"f")),Xw(this,Zw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},l4r=function(e){nn(this,tmt,"f").push(e),this._emit("event",e)},c4r=function(e){switch(e.event){case"thread.run.step.created":return nn(this,tN,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=nn(this,tN,"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=rN.accumulateDelta(r,n.delta);nn(this,tN,"f")[e.data.id]=o}return nn(this,tN,"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":nn(this,tN,"f")[e.data.id]=e.data;break}if(nn(this,tN,"f")[e.data.id])return nn(this,tN,"f")[e.data.id];throw new Error("No snapshot available")},d4r=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]=nn(this,dy,"m",f4r).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")},f4r=function(e,r){return rN.accumulateDelta(r,e)},p4r=function(e){switch(Xw(this,kDe,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":Xw(this,N3,e.data,"f"),nn(this,Zw,"f")&&(this._emit("toolCallDone",nn(this,Zw,"f")),Xw(this,Zw,void 0,"f"));break;case"thread.run.cancelling":break}}});var D3,sX,nmt=v(()=>{fi();Xi();tg();D3=class extends Lt{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 ti(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,sX,{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}})}},sX=class extends es{};D3.MessagesPage=sX});var j3,uX,omt=v(()=>{fi();Xi();tg();j3=class extends Lt{retrieve(e,r,n,o={},i){return ti(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 ti(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,uX,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},uX=class extends es{};j3.RunStepsPage=uX});var w$,lX,imt=v(()=>{fi();Xi();rmt();Xi();omt();omt();tg();w$=class extends Lt{constructor(){super(...arguments),this.steps=new j3(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 ti(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,lX,{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 rN.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 y$(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return rN.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 rN.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},lX=class extends es{};w$.RunsPage=lX;w$.Steps=j3;w$.RunStepsPage=uX});var nN,amt=v(()=>{fi();Xi();rmt();nmt();nmt();imt();imt();nN=class extends Lt{constructor(){super(...arguments),this.runs=new w$(this._client),this.messages=new D3(this._client)}create(e={},r){return ti(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 rN.createThreadAssistantStream(e,this._client.beta.threads,r)}};nN.Runs=w$;nN.RunsPage=lX;nN.Messages=D3;nN.MessagesPage=sX});var aT,smt=v(()=>{fi();Rpt();a4r();Rpt();emt();emt();amt();amt();aT=class extends Lt{constructor(){super(...arguments),this.realtime=new AU(this._client),this.chat=new nX(this._client),this.assistants=new R3(this._client),this.threads=new nN(this._client)}};aT.Realtime=AU;aT.Assistants=R3;aT.AssistantsPage=Z7;aT.Threads=nN});var $3,umt=v(()=>{fi();$3=class extends Lt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var L3,lmt=v(()=>{fi();Xi();L3=class extends Lt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&g$("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(g$("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=Hzr(u)}),a)))}}});var F3,cX,cmt=v(()=>{fi();Xi();tg();F3=class extends Lt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return ti(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,cX,{query:n,...o})}},cX=class extends es{};F3.OutputItemListResponsesPage=cX});var S$,dX,dmt=v(()=>{fi();Xi();cmt();cmt();tg();S$=class extends Lt{constructor(){super(...arguments),this.outputItems=new F3(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 ti(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,dX,{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)}},dX=class extends es{};S$.RunListResponsesPage=dX;S$.OutputItems=F3;S$.OutputItemListResponsesPage=cX});var oN,k3,fmt=v(()=>{fi();Xi();dmt();dmt();tg();oN=class extends Lt{constructor(){super(...arguments),this.runs=new S$(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 ti(e)?this.list({},e):this._client.getAPIList("/evals",k3,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},k3=class extends es{};oN.EvalListResponsesPage=k3;oN.Runs=S$;oN.RunListResponsesPage=dX});var NU,q3,pmt=v(()=>{fi();Xi();Xi();Kw();Xi();tg();NU=class extends Lt{create(e,r){return this._client.post("/files",Q0({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return ti(e)?this.list({},e):this._client.getAPIList("/files",q3,{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 y$(r),a=await this.retrieve(e),Date.now()-i>n)throw new xU({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},q3=class extends es{};NU.FileObjectsPage=q3});var U3,fX,mmt=v(()=>{fi();Xi();tg();U3=class extends Lt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,fX,{body:r,method:"post",...n})}retrieve(e,r={},n){return ti(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)}},fX=class extends QA{};U3.PermissionCreateResponsesPage=fX});var DU,hmt=v(()=>{fi();mmt();mmt();DU=class extends Lt{constructor(){super(...arguments),this.permissions=new U3(this._client)}};DU.Permissions=U3;DU.PermissionCreateResponsesPage=fX});var B3,pX,gmt=v(()=>{fi();Xi();tg();B3=class extends Lt{list(e,r={},n){return ti(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,pX,{query:r,...n})}},pX=class extends es{};B3.FineTuningJobCheckpointsPage=pX});var iN,mX,hX,ymt=v(()=>{fi();Xi();gmt();gmt();tg();iN=class extends Lt{constructor(){super(...arguments),this.checkpoints=new B3(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 ti(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",mX,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return ti(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,hX,{query:r,...n})}},mX=class extends es{},hX=class extends es{};iN.FineTuningJobsPage=mX;iN.FineTuningJobEventsPage=hX;iN.Checkpoints=B3;iN.FineTuningJobCheckpointsPage=pX});var sT,bmt=v(()=>{fi();hmt();hmt();ymt();ymt();sT=class extends Lt{constructor(){super(...arguments),this.jobs=new iN(this._client),this.checkpoints=new DU(this._client)}};sT.Jobs=iN;sT.FineTuningJobsPage=mX;sT.FineTuningJobEventsPage=hX;sT.Checkpoints=DU});var z3,_mt=v(()=>{fi();Xi();z3=class extends Lt{createVariation(e,r){return this._client.post("/images/variations",Q0({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",Q0({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var jU,V3,vmt=v(()=>{fi();tg();jU=class extends Lt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",V3,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},V3=class extends QA{};jU.ModelsPage=V3});var H3,wmt=v(()=>{fi();H3=class extends Lt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function m4r(t,e){return!e||!oti(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)}:Smt(t,e)}function Smt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:sti(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:nti(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Cmt(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 nti(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function oti(t){return!!ple(t.text?.format)}function iti(t){return t?.$brand==="auto-parseable-tool"}function ati(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function sti(t,e){let r=ati(t.tools??[],e.name);return{...e,...e,parsed_arguments:iti(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Cmt(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 xmt=v(()=>{hle()});var gX,Tmt=v(()=>{fi();Xi();BDe();gX=class extends Lt{list(e,r={},n){return ti(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,UDe,{query:r,...n})}}});function lti(t,e){return m4r(t,e)}var yX,$U,bX,zDe,LU,VDe,h4r,g4r,y4r,b4r,HDe,_4r=v(()=>{Kw();ADe();xmt();yX=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},$U=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)},HDe=class t extends RU{constructor(e){super(),bX.add(this),zDe.set(this,void 0),LU.set(this,void 0),VDe.set(this,void 0),yX(this,zDe,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())),$U(this,bX,"m",h4r).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)$U(this,bX,"m",g4r).call(this,a);if(i.controller.signal?.aborted)throw new Sm;return $U(this,bX,"m",y4r).call(this)}[(zDe=new WeakMap,LU=new WeakMap,VDe=new WeakMap,bX=new WeakSet,h4r=function(){this.ended||yX(this,LU,void 0,"f")},g4r=function(r){if(this.ended)return;let n=$U(this,bX,"m",b4r).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 jr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new jr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new jr(`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 jr(`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}},y4r=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");let r=$U(this,LU,"f");if(!r)throw new jr("request ended without sending any events");yX(this,LU,void 0,"f");let n=lti(r,$U(this,zDe,"f"));return yX(this,VDe,n,"f"),n},b4r=function(r){let n=$U(this,LU,"f");if(!n){if(r.type!=="response.created")throw new jr(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=yX(this,LU,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 jr(`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 jr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new jr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new jr(`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 jr(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{yX(this,LU,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=$U(this,VDe,"f");if(!e)throw new jr("stream ended without producing a ChatCompletion");return e}}});var FU,UDe,BDe=v(()=>{xmt();Xi();fi();Tmt();Tmt();_4r();tg();FU=class extends Lt{constructor(){super(...arguments),this.inputItems=new gX(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"&&Cmt(n),n))}retrieve(e,r={},n){return ti(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=>Smt(n,e))}stream(e,r){return HDe.createResponse(this._client,e,r)}},UDe=class extends es{};FU.InputItems=gX});var _X,Omt=v(()=>{fi();Xi();_X=class extends Lt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,Q0({body:r,...n}))}}});var kU,Emt=v(()=>{fi();Omt();Omt();kU=class extends Lt{constructor(){super(...arguments),this.parts=new _X(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})}};kU.Parts=_X});var v4r,w4r=v(()=>{v4r=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 qU,UU,vX,WDe=v(()=>{fi();Xi();tg();qU=class extends Lt{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 ti(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,UU,{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 y$(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`,vX,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},UU=class extends es{},vX=class extends QA{};qU.VectorStoreFilesPage=UU;qU.FileContentResponsesPage=vX});var wX,Pmt=v(()=>{fi();Xi();Xi();w4r();WDe();wX=class extends Lt{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 ti(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,UU,{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 y$(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 v4r(d),await this.createAndPoll(e,{file_ids:l})}}});var Yw,W3,J3,Mmt=v(()=>{fi();Xi();Pmt();Pmt();WDe();WDe();tg();Yw=class extends Lt{constructor(){super(...arguments),this.files=new qU(this._client),this.fileBatches=new wX(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 ti(e)?this.list({},e):this._client.getAPIList("/vector_stores",W3,{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`,J3,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},W3=class extends es{},J3=class extends QA{};Yw.VectorStoresPage=W3;Yw.VectorStoreSearchResponsesPage=J3;Yw.Files=qU;Yw.VectorStoreFilesPage=UU;Yw.FileContentResponsesPage=vX;Yw.FileBatches=wX});var S4r=v(()=>{Wzr();Jzr();Ppt();Mpt();smt();umt();lmt();fmt();pmt();bmt();_mt();vmt();wmt();BDe();Emt();Mmt()});var C4r,zo,x4r,T4r=v(()=>{wzr();Xi();Kw();wDe();S4r();Mpt();umt();lmt();pmt();_mt();vmt();wmt();Ppt();smt();xpt();fmt();bmt();BDe();Emt();Mmt();ule();zo=class extends TDe{constructor({baseURL:e=ale("OPENAI_BASE_URL"),apiKey:r=ale("OPENAI_API_KEY"),organization:n=ale("OPENAI_ORG_ID")??null,project:o=ale("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new jr("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&&Vzr())throw new jr(`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 $3(this),this.chat=new b$(this),this.embeddings=new L3(this),this.files=new NU(this),this.images=new z3(this),this.audio=new eN(this),this.moderations=new H3(this),this.models=new jU(this),this.fineTuning=new sT(this),this.vectorStores=new Yw(this),this.beta=new aT(this),this.batches=new PU(this),this.uploads=new kU(this),this.responses=new FU(this),this.evals=new oN(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 ipt(e,{arrayFormat:"brackets"})}};C4r=zo;zo.OpenAI=C4r;zo.DEFAULT_TIMEOUT=6e5;zo.OpenAIError=jr;zo.APIError=Zm;zo.APIConnectionError=CU;zo.APIConnectionTimeoutError=xU;zo.APIUserAbortError=Sm;zo.NotFoundError=Que;zo.ConflictError=ele;zo.RateLimitError=rle;zo.BadRequestError=Xue;zo.AuthenticationError=Zue;zo.InternalServerError=nle;zo.PermissionDeniedError=Yue;zo.UnprocessableEntityError=tle;zo.toFile=_pt;zo.fileFromPath=gDe;zo.Completions=$3;zo.Chat=b$;zo.ChatCompletionsPage=EU;zo.Embeddings=L3;zo.Files=NU;zo.FileObjectsPage=q3;zo.Images=z3;zo.Audio=eN;zo.Moderations=H3;zo.Models=jU;zo.ModelsPage=V3;zo.FineTuning=sT;zo.VectorStores=Yw;zo.VectorStoresPage=W3;zo.VectorStoreSearchResponsesPage=J3;zo.Beta=aT;zo.Batches=PU;zo.BatchesPage=M3;zo.Uploads=kU;zo.Responses=FU;zo.Evals=oN;zo.EvalListResponsesPage=k3;x4r=zo});var SX,O4r=v(()=>{ta();Ed();iH();T4r();Xe();SX=class extends RD{constructor(e){let{enableReasoning:r=!1,reasoningEffort:n,...o}=e;super(o),this.enableReasoning=r,this.reasoningEffort=n,this.openaiClient=new x4r({apiKey:e.apiKey,baseURL:e.configuration?.baseURL||"https://openrouter.ai/api/v1",defaultHeaders:e.configuration?.defaultHeaders,fetch:e.configuration?.fetch,dangerouslyAllowBrowser:!0})}invocationParams(e){let r=super.invocationParams(e);if(this.enableReasoning)if(this.reasoningEffort){let n=this.reasoningEffort==="minimal"?"low":this.reasoningEffort;return F(`OpenRouter reasoning enabled with effort: ${n}`),{...r,reasoning:{effort:n}}}else return F("OpenRouter reasoning enabled with max_tokens: 1024"),{...r,reasoning:{max_tokens:1024}};return r}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r),i=this.toOpenRouterMessages(e),a=await this.openaiClient.chat.completions.create({...o,messages:i,stream:!0,stream_options:{...o.stream_options??{},include_usage:!0}}),s;for await(let u of a){u.usage&&(s=u.usage);let l=u.choices?.[0],c=l?.delta;if(!l||!c)continue;let d=this.normalizeReasoningChunk(c?.reasoning),f=this.extractReasoningDetails(l),p=this.extractDeltaContent(c.content),m=this.buildMessageChunk({rawChunk:u,delta:c,content:p,finishReason:l.finish_reason,reasoningDetails:f,reasoningText:d}),h=new si({message:m,text:typeof m.content=="string"?m.content:"",generationInfo:{finish_reason:l.finish_reason,system_fingerprint:u.system_fingerprint,model:u.model}});yield h,h.text&&await n?.handleLLMNewToken(h.text)}if(s&&(yield this.buildUsageGenerationChunk(s)),r.signal?.aborted)throw new Error("AbortError")}toOpenRouterMessages(e){return e.map(r=>{let n=typeof r._getType=="function"?r._getType():r.role??"user",o=n==="human"?"user":n==="ai"?"assistant":n;return r.tool_call_id?{role:"tool",content:r.content,tool_call_id:r.tool_call_id}:r.additional_kwargs?.function_call?{role:o,content:r.content,function_call:r.additional_kwargs.function_call}:r.additional_kwargs?.tool_calls?{role:o,content:r.content,tool_calls:r.additional_kwargs.tool_calls}:{role:o,content:r.content}})}buildMessageChunk(e){let{rawChunk:r,delta:n,content:o,finishReason:i,reasoningText:a,reasoningDetails:s}=e,u=this.extractToolCallChunks(n.tool_calls),l={};n.function_call&&(l.function_call=n.function_call),Array.isArray(n.tool_calls)&&(l.tool_calls=n.tool_calls);let c={};a&&(c.reasoning=a),s&&s.length>0&&(c.reasoning_details=s),Object.keys(c).length>0&&(l.delta={...l.delta,...c}),s&&s.length>0&&(l.reasoning_details=s);let d=this.buildResponseMetadata(r,i);return new Er({content:o,additional_kwargs:l,tool_call_chunks:u,response_metadata:d,id:r.id})}normalizeReasoningChunk(e){if(e){if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>this.normalizeReasoningChunk(r)).filter(r=>!!r).join("");if(typeof e=="object"){let r=e,o=[r.output_text,r.text,r.reasoning,r.thinking,r.content].find(i=>typeof i=="string");if(typeof o=="string")return o}}}extractReasoningDetails(e){let r=e?.delta?.reasoning_details??e?.message?.reasoning_details??e?.reasoning_details;if(Array.isArray(r))return r.filter(n=>n!=null)}extractDeltaContent(e){return typeof e=="string"?e:Array.isArray(e)?e.map(r=>typeof r=="string"?r:r&&typeof r=="object"&&typeof r.text=="string"?r.text:"").join(""):""}extractToolCallChunks(e){if(Array.isArray(e))return e.map(r=>({name:r?.function?.name,args:r?.function?.arguments,id:r?.id,index:r?.index,type:"tool_call_chunk"}))}buildResponseMetadata(e,r){let n={model_provider:"openrouter"};return r&&(n.finish_reason=r),e.model&&(n.model=e.model),e.system_fingerprint&&(n.system_fingerprint=e.system_fingerprint),e.usage&&(n.usage={...e.usage},n.tokenUsage={promptTokens:e.usage.prompt_tokens,completionTokens:e.usage.completion_tokens,totalTokens:e.usage.total_tokens}),n}buildUsageGenerationChunk(e){let r={},n={},o=e.prompt_tokens_details??{};typeof o.audio_tokens=="number"&&(r.audio=o.audio_tokens),typeof o.cached_tokens=="number"&&(r.cache_read=o.cached_tokens);let i=e.completion_tokens_details??{};typeof i.audio_tokens=="number"&&(n.audio=i.audio_tokens),typeof i.reasoning_tokens=="number"&&(n.reasoning=i.reasoning_tokens);let a={input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0};Object.keys(r).length>0&&(a.input_token_details=r),Object.keys(n).length>0&&(a.output_token_details=n);let s=new Er({content:"",response_metadata:{usage:{...e}},usage_metadata:a});return new si({message:s,text:""})}}});var JDe,E4r=v(()=>{YI();Xe();ta();Ed();uv();Ny();JDe=class extends jd{constructor(e){let{modelId:r,apiKey:n,endpoint:o,streamEndpoint:i,defaultMaxTokens:a,defaultTemperature:s,defaultTopP:u,anthropicVersion:l,enableThinking:c,fetchImplementation:d,...f}=e;if(!r)throw new Error("Amazon Bedrock model identifier is required.");if(!n)throw new Error("Amazon Bedrock API key is required.");if(!o)throw new Error("Amazon Bedrock endpoint is required.");super(f);let p=typeof fetch<"u"?fetch.bind(globalThis):void 0;if(this.fetchImpl=d??p,!this.fetchImpl)throw new Error("No fetch implementation available for Amazon Bedrock requests.");f.streaming&&!i&&Te("Amazon Bedrock streaming requested without a streaming endpoint; falling back to non-streaming mode."),this.modelName=r,this.apiKey=n,this.endpoint=o,this.streamEndpoint=i,this.defaultMaxTokens=a,this.defaultTemperature=s,this.defaultTopP=u,this.anthropicVersion=l,this.enableThinking=c??!1}_llmType(){return"amazon-bedrock"}bindTools(e){let r=Object.create(this);return r.boundTools=e,r}convertToolsToClaude(e){return e.map(r=>{let n={type:"object",properties:{}};return r.schema&&(n=Ii(r.schema)?Ci(r.schema):r.schema),{name:r.name,description:r.description||"",input_schema:n}})}extractToolCalls(e){if(!Array.isArray(e?.content))return;let r=e.content.filter(n=>n.type==="tool_use");if(r.length!==0)return r.map(n=>({id:n.id,name:n.name,args:n.input||{},type:"tool_call"}))}async _generate(e,r,n){let o=this.buildRequestBody(e,r),i=await this.fetchImpl(this.endpoint,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)});if(!i.ok){let m=await i.text();throw new Error(`Amazon Bedrock request failed with status ${i.status}: ${m}`)}let a=await i.json(),s=this.extractText(a),u=this.extractToolCalls(a);n&&s&&await n.handleLLMNewToken(s);let l=this.extractUsage(a),c=l?this.normaliseUsageMetadata(l):void 0,d={stopReason:a.stop_reason??a.stopReason,usage:l,rawResponse:a};return{generations:[{message:new Pn({content:s,response_metadata:d,usage_metadata:c,tool_calls:u}),text:s,generationInfo:d}],llmOutput:d}}async*_streamResponseChunks(e,r={},n){if(!this.streamEndpoint){let p=await this._generate(e,r,n),m=p.generations[0]?.text??"";if(!m)return;let h=new Er({content:m,response_metadata:p.llmOutput??{}});yield new si({message:h,text:m,generationInfo:p.llmOutput??{}});return}let o=this.buildRequestBody(e,r),i=`bedrock-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;F(`[${i}] Starting Bedrock stream request to ${this.streamEndpoint}`);let a=await this.fetchImpl(this.streamEndpoint,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o),signal:r?.signal});if(!a.ok){let p=await a.text();throw new Error(`Amazon Bedrock streaming request failed with status ${a.status}: ${p}`)}if(!a.body)throw new Error("Amazon Bedrock streaming response did not include a readable body.");let s=a.body.getReader(),u=new Uint8Array(0),l,c,d=!1,f=[];try{for(;;){let{value:p,done:m}=await s.read();if(m)break;if(!p)continue;let h=new Uint8Array(u.length+p.length);h.set(u),h.set(p,u.length),u=h;let{messages:y,remainingBytes:g}=this.parseEventStreamBuffer(u);u=new Uint8Array(g);for(let b of y){let _=this.safeJsonParse(b);if(!_){Te(`[${i}] Failed to parse event JSON: ${b.slice(0,100)}...`);continue}let w=_;typeof _.bytes=="string"&&!_.type&&(w={type:"chunk",chunk:{bytes:_.bytes}});let T=await this.processStreamEvent(w,n,c,l);if(c=T.usage??c,l=T.stopReason??l,T.hasText||f.push(this.describeEvent(_)),T.deltaChunks.length>0)for(let O of T.deltaChunks)!(Array.isArray(O.message.content)&&O.message.content.length>0&&O.message.content[0]?.type==="thinking")&&O.text&&(d=!0),yield O;T.debugSummaries.length>0&&f.push(...T.debugSummaries)}}}catch(p){throw ne(`[${i}] Error during stream processing: ${p instanceof Error?p.message:String(p)}`),p}finally{s.releaseLock()}if((c||l)&&(yield this.buildTerminalMetadataChunk(l,c)),!d){Te(`[${i}] Stream complete but no answer text yielded (only thinking or no content). Usage: ${JSON.stringify(c)}, stopReason: ${l}`),f.length>0&&F(`[${i}] Amazon Bedrock streaming produced no answer text. Sample events: ${f.slice(0,5).join(" | ")}`),Te(`[${i}] Amazon Bedrock streaming returned no answer content. Falling back to non-streaming response.`);let p=await this._generate(e,r,n),m=p.generations[0]?.text??"";m&&(yield new si({message:new Er({content:m,response_metadata:p.llmOutput??{}}),text:m,generationInfo:p.llmOutput??{}}))}}safeJsonParse(e){try{return JSON.parse(e)}catch{return null}}buildContentItemsFromDelta(e){if(!e||typeof e!="object")return null;let r=e.content_block_delta?.delta||e.contentBlockDelta?.delta||e.delta;if(!r||typeof r!="object")return null;let n=r.type;if(n==="thinking"||n==="thinking_delta"){let o=r.thinking;return typeof o=="string"&&o.length>0?[{type:"thinking",thinking:o}]:[{type:"thinking",thinking:""}]}if(n==="text_delta"||n==="text"){let o=r.text;if(typeof o=="string"&&o.length>0)return[{type:"text",text:o}]}return null}extractToolCallChunk(e){return!e||typeof e!="object"?null:e.type==="content_block_start"&&e.content_block?.type==="tool_use"?{id:e.content_block.id,index:e.index??0,name:e.content_block.name,args:""}:e.type==="content_block_delta"&&e.delta?.type==="input_json_delta"?{index:e.index??0,args:e.delta.partial_json||""}:null}async processStreamEvent(e,r,n,o){let i=[],a=n,s=o,u=!1,l=[];if(e?.type==="chunk"&&typeof e.chunk?.bytes=="string"){let c=this.decodeChunkBytes(e.chunk.bytes);for(let d of c){let f=this.safeJsonParse(d);if(!f){l.push(`Failed to parse inner payload: ${this.describePayload(d)}`);continue}let p=this.buildChunkMetadata(f),m=this.buildContentItemsFromDelta(f),h=this.extractToolCallChunk(f);if(h){let b=new Er({content:"",response_metadata:p,tool_call_chunks:[h]}),_=new si({message:b,text:"",generationInfo:p});i.push(_),u=!0}else if(m&&m.length>0){let b=m[0]?.type==="thinking",_=b?m[0].thinking||"":m[0]?.text||"",w={};b&&_&&(w.delta={reasoning:_});let T=new Er({content:m,response_metadata:p,...Object.keys(w).length>0?{additional_kwargs:w}:{}}),O=new si({message:T,text:_,generationInfo:p});i.push(O),u=!0,r&&_&&await r.handleLLMNewToken(_)}else{let b=this.extractStreamText(f);if(b){let _=new Er({content:b,response_metadata:p}),w=new si({message:_,text:b,generationInfo:p});i.push(w),u=!0,r&&await r.handleLLMNewToken(b)}else if(f.type==="content_block_delta"&&f.delta?.type!=="input_json_delta"){let _=`No content in content_block_delta event: ${this.describeEvent(f)}`;l.push(_),Te(`processStreamEvent: ${_}`)}}let y=this.extractUsage(f);y&&(a=y);let g=this.extractStopReason(f);g&&(s=g)}}else{let c=this.buildChunkMetadata(e),d=this.buildContentItemsFromDelta(e),f=this.extractToolCallChunk(e);if(f){let h=new Er({content:"",response_metadata:c,tool_call_chunks:[f]}),y=new si({message:h,text:"",generationInfo:c});i.push(y),u=!0}else if(d&&d.length>0){let h=d[0]?.type==="thinking",y=h?d[0].thinking||"":d[0]?.text||"",g={};h&&y&&(g.delta={reasoning:y});let b=new Er({content:d,response_metadata:c,...Object.keys(g).length>0?{additional_kwargs:g}:{}}),_=new si({message:b,text:y,generationInfo:c});i.push(_),u=!0,r&&y&&await r.handleLLMNewToken(y)}else{let h=this.extractStreamText(e);if(h){let y=new Er({content:h,response_metadata:c}),g=new si({message:y,text:h,generationInfo:c});i.push(g),u=!0,r&&await r.handleLLMNewToken(h)}}let p=this.extractUsage(e);p&&(a=p);let m=this.extractStopReason(e);m&&(s=m)}return{deltaChunks:i,usage:a,stopReason:s,hasText:u,debugSummaries:l}}describeEvent(e){if(!e)return"<empty event>";let r=typeof e.type=="string"?e.type:"unknown",n=Object.keys(e).slice(0,6).join(","),o=this.stringifyForLog(e);return`${r} {${n}} -> ${o}`}describePayload(e){return e?e.length<=200?e:`${e.slice(0,200)}\u2026 (len=${e.length})`:"<empty payload>"}stringifyForLog(e){try{let r=this.sanitiseForLog(e),n=JSON.stringify(r);return n?n.length>400?`${n.slice(0,400)}\u2026 (len=${n.length})`:n:"<un-stringifiable>"}catch{return"<failed to stringify>"}}sanitiseForLog(e){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.slice(0,5).map(i=>this.sanitiseForLog(i));let r=e,n={},o=Object.entries(r);for(let i=0;i<o.length&&i<10;i+=1){let[a,s]=o[i];typeof s=="string"&&s.length>200?a==="bytes"||a==="chunk"||a==="chunk_bytes"?n[a]=`<base64 len=${s.length}>`:n[a]=`${s.slice(0,200)}\u2026 (len=${s.length})`:n[a]=this.sanitiseForLog(s)}return n}decodeChunkBytes(e){let r=this.decodeBase64ToUint8Array(e);if(!r||r.length===0)return Te("decodeChunkBytes: Failed to decode base64 or empty bytes"),[];let n=this.findFirstNonWhitespaceByte(r);if(n===123||n===91){let a=this.decodeUtf8(r);return this.splitJsonLines(a)}let o=this.decodeEventStreamMessages(r);if(o.length>0)return o;Te("decodeChunkBytes: EventStream decoding failed, falling back to plain UTF-8");let i=this.decodeUtf8(r);return this.splitJsonLines(i)}decodeBase64ToUint8Array(e){try{if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));if(typeof atob=="function"){let r=atob(e),n=new Uint8Array(r.length);for(let o=0;o<r.length;o+=1)n[o]=r.charCodeAt(o);return n}return null}catch{return null}}findFirstNonWhitespaceByte(e){for(let r=0;r<e.length;r+=1){let n=e[r];if(n!==void 0&&!this.isWhitespaceByte(n))return n}return null}isWhitespaceByte(e){return e===9||e===10||e===13||e===32}decodeUtf8(e){return e.length===0?"":typeof TextDecoder<"u"?new TextDecoder().decode(e):typeof Buffer<"u"?Buffer.from(e).toString("utf-8"):""}splitJsonLines(e){return e?e.split(`
|
||
`).map(r=>r.trim()).filter(r=>r.length>0):[]}parseEventStreamBuffer(e){let r=[];if(e.length<12)return{messages:r,remainingBytes:e};let n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=0;for(;o+12<=e.length;){let a=n.getUint32(o,!1),s=n.getUint32(o+4,!1);if(o+a>e.length)break;if(a<=0||s<0||s+12>a){Te(`parseEventStreamBuffer: Invalid message structure at offset ${o}: totalLength=${a}, headersLength=${s}`);break}let u=o+12+s,l=o+a-4;if(u>l||l>e.length){Te(`parseEventStreamBuffer: Invalid payload bounds at offset ${o}`);break}if(u<e.length){let c=e.subarray(u,l),d=this.decodeUtf8(c).trim();d.length>0&&r.push(d)}if(o+=a,a===0)break}let i=o<e.length?e.subarray(o):new Uint8Array(0);return{messages:r,remainingBytes:i}}decodeEventStreamMessages(e){let{messages:r}=this.parseEventStreamBuffer(e);return r}buildChunkMetadata(e){let r={provider:"amazon-bedrock"};typeof e?.type=="string"&&(r.event_type=e.type),e?.index!==void 0&&(r.event_index=e.index);let n=this.extractStopReason(e);n&&(r.stop_reason=n);let o=this.extractUsage(e);return o&&(r.usage=o),r}extractStreamText(e){if(!e||typeof e!="object")return null;let r=[e.delta?.thinking,e.content_block_delta?.delta?.thinking,e.contentBlockDelta?.delta?.thinking,e.delta?.reasoning_content,e.reasoning_content];for(let i of r)if(typeof i=="string"&&i.length>0)return i;let n=[e.text,e.outputText,e.completion,e.resultText,e.delta];for(let i of n)if(typeof i=="string"&&i.length>0)return i;let o=[e.delta?.text,e.delta?.output_text,e.delta?.content,e.contentBlockDelta?.delta?.text,e.contentBlockDelta?.delta?.output_text,e.contentBlockDelta?.delta?.content,e.content_block_delta?.delta?.text,e.content_block_delta?.delta?.output_text,e.content_block_delta?.delta?.content,e.message?.content,e.messageStop?.message?.content,e.message_stop?.message?.content,e.content];for(let i of o){let a=this.extractTextFromCandidate(i);if(a)return a}return null}extractTextFromCandidate(e){if(!e)return null;if(typeof e=="string")return e.length>0?e:null;if(Array.isArray(e)){let r=e.map(n=>{if(typeof n=="string")return n;if(n&&typeof n=="object"){if(typeof n.text=="string")return n.text;if(typeof n.value=="string")return n.value;if(Array.isArray(n.content))return n.content.map(o=>typeof o?.text=="string"?o.text:"").join("")}return""}).join("");return r.length>0?r:null}if(typeof e=="object"){let r=e;if(typeof r.text=="string")return r.text.length>0?r.text:null;if(r.text&&typeof r.text=="object"){let n=this.extractTextFromCandidate(r.text);if(n)return n}if(typeof r.value=="string")return r.value.length>0?r.value:null;if(Array.isArray(r.content))return this.extractTextFromCandidate(r.content);if(r.delta){let n=this.extractTextFromCandidate(r.delta);if(n)return n}if(r.message&&typeof r.message=="object"){let n=this.extractTextFromCandidate(r.message);if(n)return n}}return null}extractUsage(e){if(!(!e||typeof e!="object")){if(e.usage&&typeof e.usage=="object")return e.usage;if(e.metrics&&typeof e.metrics=="object")return e.metrics;if(e["amazon-bedrock-invocationMetrics"]&&typeof e["amazon-bedrock-invocationMetrics"]=="object")return e["amazon-bedrock-invocationMetrics"];if(e.messageStop&&typeof e.messageStop=="object")return this.extractUsage(e.messageStop);if(e.message_stop&&typeof e.message_stop=="object")return this.extractUsage(e.message_stop)}}extractStopReason(e){if(!e||typeof e!="object")return;let r=e.stop_reason||e.stopReason||e.completionReason||e.completion_reason||e.reason||e.messageStop?.stopReason||e.message_stop?.stop_reason||(e.type==="message_stop"?e.reason:void 0);return typeof r=="string"?r:void 0}buildTerminalMetadataChunk(e,r){let n=r?this.normaliseUsageMetadata(r):void 0,o={provider:"amazon-bedrock"};e&&(o.stop_reason=e),r&&(o.usage=r);let i=new Er({content:"",response_metadata:o,usage_metadata:n});return new si({message:i,text:"",generationInfo:o})}normaliseUsageMetadata(e){let r=this.coerceNumber(e.inputTokens)??this.coerceNumber(e.input_tokens)??this.coerceNumber(e.inputTokenCount)??this.coerceNumber(e.promptTokens)??this.coerceNumber(e.prompt_tokens)??0,n=this.coerceNumber(e.outputTokens)??this.coerceNumber(e.output_tokens)??this.coerceNumber(e.outputTokenCount)??this.coerceNumber(e.completionTokens)??this.coerceNumber(e.completion_tokens)??0,o=this.coerceNumber(e.totalTokens)??this.coerceNumber(e.total_tokens)??r+n;return{input_tokens:r,output_tokens:n,total_tokens:o}}coerceNumber(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let r=Number(e);return Number.isFinite(r)?r:void 0}}convertImageContent(e){try{let r=e.match(/^data:([^;]+);base64,(.+)$/);if(!r)return null;let[,n,o]=r;return!n||!o||!n.startsWith("image/")?null:{type:"image",source:{type:"base64",media_type:n,data:o}}}catch(r){return ne("Error converting image content:",r),null}}buildRequestBody(e,r){let n=[],o=[];e.forEach(l=>{let c=l._getType();if(c==="system"){let p=this.normaliseMessageContent(l),m=typeof p=="string"?p:"";m&&o.push(m);return}if(c==="tool"){let p=l,m=typeof p.content=="string"?p.content:JSON.stringify(p.content);n.push({role:"user",content:[{type:"tool_result",tool_use_id:p.tool_call_id,content:m}]});return}if(c==="ai"){let m=l.tool_calls;if(m&&m.length>0){let h=[],y=this.normaliseMessageContent(l);typeof y=="string"&&y&&h.push({type:"text",text:y});for(let g of m)h.push({type:"tool_use",id:g.id||`tool_${Date.now()}`,name:g.name,input:g.args});h.length>0&&n.push({role:"assistant",content:h});return}}let d=this.normaliseMessageContent(l);if(!d)return;let f=[];if(typeof d=="string")f.push({type:"text",text:d});else if(Array.isArray(d))for(let p of d)if(p.type==="text"&&typeof p.text=="string")f.push({type:"text",text:p.text});else if(p.type==="image_url"&&p.image_url?.url){let m=this.convertImageContent(p.image_url.url);m&&f.push(m)}else p.type==="image"&&p.source&&f.push(p);f.length>0&&n.push({role:c==="ai"?"assistant":"user",content:f})});let i=r?.maxTokens??this.defaultMaxTokens,a=r?.temperature??this.defaultTemperature,s=r?.topP??this.defaultTopP,u={messages:n};return this.boundTools&&this.boundTools.length>0&&(u.tools=this.convertToolsToClaude(this.boundTools)),o.length>0&&(u.system=o.join(`
|
||
|
||
`)),i!==void 0&&(u.max_tokens=i),this.anthropicVersion&&(u.anthropic_version=this.anthropicVersion),this.enableThinking?(u.thinking={type:"enabled",budget_tokens:2048},u.temperature=1,F("[BedrockChatModel] Enabled thinking mode for Claude model with temperature=1")):a!==void 0&&(u.temperature=a),s!==void 0&&(u.top_p=s),u}normaliseMessageContent(e){let{content:r}=e;return typeof r=="string"?r:Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null&&(o.type==="image_url"||o.type==="image"))?r.map(o=>{if(typeof o=="string")return{type:"text",text:o};if(typeof o=="object"&&o!==null){if(o.type==="text"||o.type==="image_url"||o.type==="image")return o;if("text"in o&&typeof o.text=="string")return{type:"text",text:o.text};if("content"in o&&typeof o.content=="string")return{type:"text",text:o.content}}return null}).filter(o=>o!==null):r.map(o=>{if(typeof o=="string")return o;if(typeof o=="object"&&o!==null){if("text"in o&&typeof o.text=="string")return o.text;if("content"in o&&typeof o.content=="string")return o.content}return""}).join(""):typeof r=="object"&&r!==null&&"text"in r?r.text??"":""}extractText(e){return typeof e?.outputText=="string"?e.outputText:Array.isArray(e?.content)?e.content.map(r=>{if(!r)return"";if(typeof r=="string")return r;if(typeof r=="object"){if(typeof r.text=="string")return r.text;if(r.text&&typeof r.text=="object"&&"text"in r.text)return r.text.text??""}return""}).join(""):typeof e?.completion=="string"?e.completion:typeof e?.resultText=="string"?e.resultText:""}}});function P4r(t){let e,r,n,o,i,a,s;return u(),{feed:l,reset:u};function u(){e=!0,r="",n=0,o=-1,i=void 0,a=void 0,s=""}function l(d){r=r?r+d:d,e&&mti(r)&&(r=r.slice(M4r.length)),e=!1;let f=r.length,p=0,m=!1;for(;p<f;){m&&(r[p]===`
|
||
`&&++p,m=!1);let h=-1,y=o,g;for(let b=n;h<0&&b<f;++b)g=r[b],g===":"&&y<0?y=b-p:g==="\r"?(m=!0,h=b-p):g===`
|
||
`&&(h=b-p);if(h<0){n=f-p,o=y;break}else n=0,o=-1;c(r,p,y,h),p+=h+1}p===f?r="":p>0&&(r=r.slice(p))}function c(d,f,p,m){if(m===0){s.length>0&&(t({type:"event",id:i,event:a||void 0,data:s.slice(0,-1)}),s="",i=void 0),a=void 0;return}let h=p<0,y=d.slice(f,f+(h?m:p)),g=0;h?g=m:d[f+p+1]===" "?g=p+2:g=p+1;let b=f+g,_=m-g,w=d.slice(b,b+_).toString();if(y==="data")s+=w?"".concat(w,`
|
||
`):`
|
||
`;else if(y==="event")a=w;else if(y==="id"&&!w.includes("\0"))i=w;else if(y==="retry"){let T=parseInt(w,10);Number.isNaN(T)||t({type:"reconnect-interval",value:T})}}}function mti(t){return M4r.every((e,r)=>t.charCodeAt(r)===e)}var M4r,R4r=v(()=>{M4r=[239,187,191]});function Rmt(t){return t instanceof eC||t instanceof Error&&t.name==="AuthCancelledError"}var eC,Imt=v(()=>{eC=class t extends Error{constructor(r="Authentication cancelled by user."){super(r);this.name="AuthCancelledError";Object.setPrototypeOf(this,t.prototype)}}});var Sle,I4r,hti,gti,yti,j4r,A4r,bti,_ti,N4r,vti,D4r,BU,KDe=v(()=>{Ye();vO();Sle=require("obsidian");R4r();Imt();I4r="Iv1.b507a08c87ecfe98",hti="https://github.com/login/device/code",gti="https://github.com/login/oauth/access_token",yti="https://api.github.com/copilot_internal/v2/token",j4r="https://api.githubcopilot.com",A4r=`${j4r}/chat/completions`,bti=`${j4r}/models`,_ti=60*1e3,N4r=60*60*1e3,vti=3,D4r={401:"Authentication failed - token may be expired",403:"Access denied - check your Copilot subscription",429:"Rate limited - please wait before retrying"},BU=class t{constructor(){this.abortController=null;this.refreshPromise=null;this.refreshAttempts=0;this.authGeneration=0}static getInstance(){return t.instance||(t.instance=new t),t.instance}getAuthState(){let e=te(),r=!!e.githubCopilotAccessToken,n=!!e.githubCopilotToken,o=e.githubCopilotTokenExpiresAt,a=!(typeof o=="number"&&o>0)||o<Date.now();return n&&!a||n&&r?{status:"authenticated"}:r?{status:"pending"}:{status:"idle"}}isAuthenticated(){return this.getAuthState().status==="authenticated"}async startDeviceCodeFlow(){let e=new URLSearchParams({client_id:I4r,scope:"read:user"}).toString(),r=await(0,Sle.requestUrl)({url:hti,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:e,throw:!1}),n=this.getRequestUrlJson(r);if(r.status!==200){let i=typeof n.error_description=="string"?n.error_description:typeof n.error=="string"?n.error:"";throw new Error(i?`Failed to get device code: ${i}`:`Failed to get device code: ${r.status}`)}if(typeof n.device_code!="string"||typeof n.user_code!="string"||typeof n.expires_in!="number")throw new Error("Invalid device code response from GitHub");let o=typeof n.verification_uri=="string"?n.verification_uri:typeof n.verification_uri_complete=="string"?n.verification_uri_complete:null;if(!o)throw new Error("Invalid device code response from GitHub: missing verification URI");return{deviceCode:n.device_code,userCode:n.user_code,verificationUri:o,expiresIn:n.expires_in,interval:typeof n.interval=="number"&&n.interval>0?n.interval:5}}async pollForAccessToken(e,r,n,o){let i=this.authGeneration;this.abortPolling();let a=new AbortController;this.abortController=a;let s=Date.now()+n*1e3,u=0;try{for(;Date.now()<s;){if(a.signal.aborted||this.authGeneration!==i)throw new eC;if(u++,o?.(u),await this.delay(r*1e3,a.signal),a.signal.aborted||this.authGeneration!==i)throw new eC;let l=new URLSearchParams({client_id:I4r,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}).toString(),c=await(0,Sle.requestUrl)({url:gti,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:l,throw:!1});if(a.signal.aborted||this.authGeneration!==i)throw new eC;let d=this.getRequestUrlJson(c);if(c.status!==200){let f=typeof d.error_description=="string"?d.error_description:typeof d.error=="string"?d.error:`HTTP ${c.status}`;throw new Error(`Token request failed: ${f}`)}if(typeof d.access_token=="string"&&d.access_token){if(a.signal.aborted||this.authGeneration!==i)throw new eC;return F_({githubCopilotAccessToken:d.access_token}),d.access_token}if(d.error!=="authorization_pending"){if(d.error==="slow_down"){r+=5;continue}if(d.error==="device_code_expired"||d.error==="expired_token")throw new Error("Device code expired. Please restart authentication.");if(d.error==="access_denied")throw new Error("Authorization denied by user.");if(typeof d.error=="string"&&d.error)throw new Error(typeof d.error_description=="string"&&d.error_description?d.error_description:d.error)}}throw new Error("Device code expired. Please restart authentication.")}finally{this.abortController===a&&(this.abortController=null)}}async fetchCopilotToken(e){let r=this.authGeneration,n=e||te().githubCopilotAccessToken;if(!n)throw new Error("No GitHub access token available");n=await oo(n);let o=await(0,Sle.requestUrl)({url:yti,method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"},throw:!1});if(this.authGeneration!==r)throw new eC("Authentication was reset during token refresh.");let i=this.getRequestUrlJson(o);if(o.status!==200){let u=typeof i.message=="string"?i.message:typeof i.error=="string"?i.error:"";throw new Error(u?`Failed to get Copilot token: ${o.status} (${u})`:`Failed to get Copilot token: ${o.status}`)}let a=i.token;if(!a||typeof a!="string")throw new Error("Invalid response from Copilot API: missing or invalid token");let s=this.parseCopilotTokenExpiresAt(i);if(this.authGeneration!==r)throw new eC("Authentication was reset during token refresh.");return F_({githubCopilotToken:a,githubCopilotTokenExpiresAt:s}),a}async getValidCopilotToken(){let e=te(),r=e.githubCopilotTokenExpiresAt,o=!(typeof r=="number"&&r>0)||r<Date.now()+_ti;if(e.githubCopilotToken&&!o)return this.refreshAttempts=0,await oo(e.githubCopilotToken);if(!e.githubCopilotAccessToken)throw new Error("Not authenticated with GitHub Copilot. Please set up authentication first.");if(this.refreshAttempts>=vti)throw this.refreshAttempts=0,new Error("Failed to refresh Copilot token after multiple attempts. Please try reconnecting.");return this.refreshPromise?this.refreshPromise:(this.refreshAttempts++,this.refreshPromise=this.fetchCopilotToken().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}buildCopilotHeaders(e){return{"Content-Type":"application/json",Authorization:`Bearer ${e}`,"User-Agent":"GitHubCopilotChat/0.22.2024092501","Editor-Version":"vscode/1.95.1","Copilot-Integration-Id":"vscode-chat","Openai-Intent":"conversation-panel"}}async executeWithTokenRetry(e){let r=await this.getValidCopilotToken(),n=await e(r);if(n.status===401){try{await n.body?.cancel()}catch{}this.clearCopilotToken(),r=await this.getValidCopilotToken(),n=await e(r)}return n}async sendChatMessage(e,r={}){let{model:n="gpt-4o",signal:o,fetchImpl:i}=r,a=i??fetch,s=await this.executeWithTokenRetry(c=>a(A4r,{method:"POST",headers:{...this.buildCopilotHeaders(c),Accept:"application/json"},body:JSON.stringify({model:n,messages:e,stream:!1}),signal:o})),u=await s.text(),l=null;if(u)try{l=JSON.parse(u)}catch{l=u}if(!s.ok){let c="";if(l&&typeof l=="object"){let f=l,p=f.error;if(p&&typeof p=="object"){let m=p;typeof m.message=="string"&&(c=m.message)}if(!c&&typeof f.message=="string"&&(c=f.message),!c)try{c=JSON.stringify(l)}catch{c=""}}else typeof l=="string"&&(c=l);let d=D4r[s.status]||`Request failed: ${s.status}`;throw new Error(c?`${d}: ${c}`:d)}if(!l||typeof l!="object"||!Array.isArray(l.choices))throw new Error("Invalid response from Copilot API: missing choices array");return l}async*sendChatMessageStream(e,r={}){let{model:n="gpt-4o",signal:o,fetchImpl:i}=r,a=i??fetch,s=await this.executeWithTokenRetry(y=>a(A4r,{method:"POST",headers:{...this.buildCopilotHeaders(y),Accept:"text/event-stream"},body:JSON.stringify({model:n,messages:e,stream:!0}),signal:o}));if(!s.ok){let y=await s.text(),g=D4r[s.status]||`Request failed: ${s.status}`;throw new Error(y?`${g}: ${y}`:g)}let u=s.headers.get("content-type")||"";if(u&&!u.includes("text/event-stream")&&!u.includes("application/json"))throw new Error(`Expected text/event-stream but received ${u}`);if(!s.body)throw new Error("Response body is not available for streaming");let l=s.body.getReader(),c=new TextDecoder,d=[],f=!1,p=0,m="",h=P4r(y=>{if(y.type!=="event")return;let g=y.data;if(g==="[DONE]"){f=!0;return}try{let b=JSON.parse(g);d.push(b)}catch{}});try{for(;!f;){let{done:g,value:b}=await l.read();if(g)break;let _=c.decode(b,{stream:!0});for(m.length<500&&(m+=_.slice(0,500-m.length)),h.feed(_);d.length>0;){let w=d.shift();w&&(p++,yield w)}}let y=c.decode();if(y)for(m.length<500&&(m+=y.slice(0,500-m.length)),h.feed(y);d.length>0;){let g=d.shift();g&&(p++,yield g)}if(p===0){let g=m.slice(0,200);throw new Error(`GitHub Copilot streaming produced no chunks. Content-Type: ${u||"(empty)"}, Response preview: ${g||"(empty)"}`)}}finally{try{await l.cancel()}catch{}l.releaseLock()}}abortPolling(){this.abortController&&(this.abortController.abort(),this.abortController=null)}resetAuth(){this.authGeneration++,this.abortPolling(),this.refreshPromise=null,this.refreshAttempts=0,F_({githubCopilotAccessToken:"",githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}async listModels(){let e=async o=>await(0,Sle.requestUrl)({url:bti,method:"GET",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json","Copilot-Integration-Id":"vscode-chat"},throw:!1}),r=await this.getValidCopilotToken(),n=await e(r);if(n.status===401&&(this.clearCopilotToken(),r=await this.getValidCopilotToken(),n=await e(r)),n.status!==200)throw new Error(`Failed to list models: ${n.status}`);return this.getRequestUrlJson(n)}clearCopilotToken(){F_({githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}getRequestUrlJson(e){if(typeof e.json=="string")try{return JSON.parse(e.json)}catch{return e.json}return e.json}parseCopilotTokenExpiresAt(e){if(!e||typeof e!="object")return Date.now()+N4r;let r=e,n=this.parseExpiresAtValue(r.expires_at);if(n!==null)return n;let o=r.expires_in,i=typeof o=="number"?o:typeof o=="string"?Number(o):Number.NaN;return Number.isFinite(i)&&i>0?Date.now()+i*1e3:Date.now()+N4r}parseExpiresAtValue(e){if(typeof e=="number")return!Number.isFinite(e)||e<=0?null:e>1e12?e:e*1e3;if(typeof e=="string"){let r=e.trim();if(!r)return null;let n=Number(r);if(Number.isFinite(n)&&n>0)return n>1e12?n:n*1e3;let o=Date.parse(r);if(!Number.isNaN(o)&&o>0)return o}return null}delay(e,r){return r?r.aborted?Promise.reject(new eC):new Promise((n,o)=>{let i=()=>{clearTimeout(a),o(new eC)},a=setTimeout(()=>{r.removeEventListener("abort",i),n()},e);r.addEventListener("abort",i,{once:!0})}):new Promise(n=>setTimeout(n,e))}}});var wti,GDe,$4r=v(()=>{YI();ta();Ed();KDe();Bt();wti=4,GDe=class extends jd{constructor(r){super(r);this.lc_serializable=!1;this.lc_namespace=["langchain","chat_models","github_copilot"];this.provider=BU.getInstance(),this.modelName=r.modelName,this.streaming=r.streaming??!0,this.fetchImpl=r.fetchImplementation??fetch}_llmType(){return"github-copilot"}convertMessageType(r){switch(r){case"human":return"user";case"ai":return"assistant";case"system":return"system";case"tool":case"function":return"user";case"generic":default:return"user"}}toCopilotMessages(r){return r.map(n=>({role:this.convertMessageType(n._getType()),content:M4(n.content)}))}async _generate(r,n,o){let i=this.toCopilotMessages(r),a=await this.provider.sendChatMessage(i,{model:this.modelName,fetchImpl:this.fetchImpl,signal:n?.signal}),s=a.choices?.[0],u=s?.message?.content||"",l=s?.finish_reason,c=a.usage?{promptTokens:a.usage.prompt_tokens,completionTokens:a.usage.completion_tokens,totalTokens:a.usage.total_tokens}:void 0,d={finish_reason:l,tokenUsage:c,model:a.model};return{generations:[{text:u,message:new Pn({content:u,response_metadata:d}),generationInfo:{finish_reason:l}}],llmOutput:{tokenUsage:c}}}async*_streamResponseChunks(r,n,o){if(!this.streaming){let u=(await this._generate(r,n,o)).generations[0];if(!u)return;let l=new Er({content:u.text,response_metadata:u.message.response_metadata}),c=new si({message:l,text:u.text,generationInfo:u.generationInfo});o&&u.text&&await o.handleLLMNewToken(u.text),yield c;return}let i=this.toCopilotMessages(r),a=!1;for await(let s of this.provider.sendChatMessageStream(i,{model:this.modelName,signal:n?.signal,fetchImpl:this.fetchImpl})){let u=s.choices?.[0],l=u?.delta?.content||"",c=u?.finish_reason||s.usage||u?.delta?.role;if(!l&&!c)continue;let d={};u?.finish_reason&&(d.finish_reason=u.finish_reason),u?.delta?.role&&(d.role=u.delta.role),s.usage&&(d.tokenUsage={promptTokens:s.usage.prompt_tokens,completionTokens:s.usage.completion_tokens,totalTokens:s.usage.total_tokens}),s.model&&(d.model=s.model);let f=new Er({content:l,response_metadata:Object.keys(d).length>0?d:void 0}),p=new si({message:f,text:l,generationInfo:u?.finish_reason?{finish_reason:u.finish_reason}:void 0});o&&l&&await o.handleLLMNewToken(l),a=!0,yield p}if(!a)throw new Error("GitHub Copilot streaming produced no usable chunks (no content, finish_reason, or usage)")}async getNumTokens(r){let n=M4(r);return n?Math.ceil(n.length/wti):0}}});var F4r={};En(F4r,{default:()=>tC});var L4r,Sti,bd,tC,CX=v(()=>{ra();mr();vO();Xe();Fc();Ye();Bt();Iie();Zwr();Ptt();Qwr();Btt();ESr();czr();irt();iH();fzr();lw();L4r=require("obsidian");O4r();E4r();$4r();Sti={openai:RD,"azure openai":RD,anthropic:Mut,cohereai:Ttt,google:qtt,xai:ept,openrouterai:SX,ollama:nrt,"lm-studio":SX,groq:olt,"3rd party (openai-format)":RD,siliconflow:RD,"copilot-plus":SX,mistralai:Qft,deepseek:Rut,"amazon-bedrock":JDe,"github-copilot":GDe},bd=class bd{constructor(){this.providerApiKeyMap={openai:()=>te().openAIApiKey,google:()=>te().googleApiKey,"azure openai":()=>te().azureOpenAIApiKey,anthropic:()=>te().anthropicApiKey,cohereai:()=>te().cohereApiKey,openrouterai:()=>te().openRouterAiApiKey,groq:()=>te().groqApiKey,xai:()=>te().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>te().plusLicenseKey,mistralai:()=>te().mistralApiKey,deepseek:()=>te().deepseekApiKey,"amazon-bedrock":()=>te().amazonBedrockApiKey,siliconflow:()=>te().siliconflowApiKey,"github-copilot":()=>te().githubCopilotToken||te().githubCopilotAccessToken};this.buildModelMap(),hl(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return bd.instance||(bd.instance=new bd),bd.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?bd.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=te(),n=e.name,o=GJ(n),{isThinkingEnabled:i}=o,a=this.getTemperatureForModel(o,e,r),s=e.maxTokens??r.maxTokens,u={modelName:n,streaming:e.stream??!0,maxRetries:3,maxConcurrency:3,enableCors:e.enableCors,...!i&&a!==void 0?{temperature:a}:{}},c={openai:{modelName:n,apiKey:await oo(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?gl:void 0,organization:await oo(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await oo(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?gl:void 0},...i&&{thinking:{type:"enabled",budget_tokens:bd.ANTHROPIC_THINKING_BUDGET_TOKENS}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await oo(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 oo(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?gl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await oo(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await oo(e.apiKey||r.googleApiKey),model:n,safetySettings:[{category:wV.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_HATE_SPEECH,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_HARASSMENT,threshold:SV.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await oo(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await oo(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?gl:void 0,defaultHeaders:{"HTTP-Referer":"https://obsidiancopilot.com","X-Title":"Obsidian Copilot"}},enableReasoning:e.capabilities?.includes("reasoning")??!1,reasoningEffort:e.capabilities?.includes("reasoning")&&e.reasoningEffort?e.reasoningEffort:void 0},groq:{apiKey:await oo(e.apiKey||r.groqApiKey),model:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:{Authorization:`Bearer ${await oo(e.apiKey||"default-key")}`},think:e.capabilities?.includes("reasoning")??!1,repeatPenalty:1.1,numCtx:131072},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",streamUsage:e.streamUsage??!1,configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?gl:void 0},enableReasoning:e.capabilities?.includes("reasoning")??!1,reasoningEffort:e.capabilities?.includes("reasoning")&&e.reasoningEffort?e.reasoningEffort:void 0},"3rd party (openai-format)":{modelName:n,apiKey:await oo(e.apiKey||r.openAIApiKey),streamUsage:e.streamUsage??!1,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?gl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},siliconflow:{modelName:n,apiKey:await oo(e.apiKey||r.siliconflowApiKey),configuration:{baseURL:e.baseUrl||QC.siliconflow.host,fetch:e.enableCors?gl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await oo(r.plusLicenseKey),configuration:{baseURL:p1,fetch:e.enableCors?gl:void 0}},mistralai:{model:n,apiKey:await oo(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await oo(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||QC.deepseek.host,fetch:e.enableCors?gl:void 0}},"amazon-bedrock":{},"github-copilot":{modelName:n,fetchImplementation:e.enableCors?R1t:void 0}}[e.provider]||{};e.provider==="amazon-bedrock"&&(c=await this.buildBedrockConfig(e,n,r,s,a));let d=this.getProviderSpecificParams(e.provider,e);return{...u,...c,...d,...{maxTokens:s}}}getOpenAISpecialConfig(e,r,n,o){let i=te(),a=GJ(e),s=this.getTemperatureForModel(a,o||{},i),u={maxTokens:r,temperature:s};if((a.isOSeries||a.isGPT5)&&o?.reasoningEffort&&(u.reasoning={effort:o.reasoningEffort},a.isGPT5&&o?.verbosity)){let l=o.verbosity;u.text={verbosity:l}}return u}async buildBedrockConfig(e,r,n,o,i){let a=e.apiKey||n.amazonBedrockApiKey;if(!a)throw new Error("Amazon Bedrock API key is not configured. Provide a key in Settings > API Keys or the model definition.");let s=await oo(a),u=e.bedrockRegion?.trim(),l=n.amazonBedrockRegion?.trim(),c=u||l||"us-east-1",d=e.baseUrl?.trim(),p=(d?d.replace(/\/+$/,""):void 0)||`https://bedrock-runtime.${c}.amazonaws.com`,m=encodeURIComponent(r),h=`${p}/model/${m}/invoke`,y=`${p}/model/${m}/invoke-with-response-stream`,g=e.enableCors?gl:void 0,_=/(^|\.)anthropic\./.test(r)?"bedrock-2023-05-31":void 0,w=e.capabilities?.includes("reasoning")??!1;return{modelName:r,modelId:r,apiKey:s,endpoint:h,streamEndpoint:y,defaultMaxTokens:o,defaultTemperature:i,defaultTopP:e.topP,anthropicVersion:_,enableThinking:w,fetchImplementation:g,streaming:e.stream??!0}}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","siliconflow"].includes(e)&&(n.topP=r.topP),r.frequencyPenalty!==void 0&&["openai","azure openai","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek","siliconflow"].includes(e)&&(n.frequencyPenalty=r.frequencyPenalty),n}buildModelMap(){let e=te().activeModels;bd.modelMap={};let r=bd.modelMap;(e??hO).forEach(o=>{if(o.enabled){if(!Object.values(k_).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.hasProviderCredentials(o),s=no(o);r[s]={hasApiKey:a,AIConstructor:i,vendor:o.provider}}})}hasProviderCredentials(e){if(e.provider==="amazon-bedrock"){let n=te();return!!(e.apiKey||n.amazonBedrockApiKey)}let r=this.providerApiKeyMap[e.provider];return r?!!(e.apiKey||r()):!!e.apiKey}getProviderConstructor(e){let r=Sti[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(!bd.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return bd.chatModel}isModelConfigValid(e,r){let n=no(e),o=bd.modelMap[n];return!(!o||!o.hasApiKey||e.plusExclusive&&!V_r())}resolveModelForTemperatureOverride(){let e=te();try{let r=B_();if(r){let n=qS(r,e.activeModels);if(this.isModelConfigValid(n,e))return n}}catch{}for(let r of e.activeModels)if(r.enabled&&!r.believerExclusive&&this.isModelConfigValid(r,e))return r;throw new Error("No valid chat model available for temperature override. Please check your API key settings and ensure at least one model is properly configured.")}async getChatModelWithTemperature(e){let n={...this.resolveModelForTemperatureOverride(),temperature:e};return await this.createModelInstance(n)}async setChatModel(e){try{let r=await this.createModelInstance(e);bd.chatModel=r,GJ(e.name).isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&F(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(r){throw ne(r),r}}async createModelInstance(e){let r=no(e),n=bd.modelMap[r];if(!n)throw new Error(`No model found for: ${r}`);if(!n.hasApiKey){let u=`API key is not provided for the model: ${r}.`;throw e.provider==="copilot-plus"?new E4("Copilot Plus license key is not configured. Please enter your license key in the Copilot Plus section at the top of Basic Settings."):new xte(u)}let o=await this.getModelConfig(e),i=GJ(e.name),a={...o};i.isGPT5&&(n.vendor==="openai"||n.vendor==="azure openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,F(`Enabling Responses API for GPT-5 model: ${e.name} (${n.vendor})`));let s=new n.AIConstructor(a);return s.getNumTokens=async u=>{let l=typeof u=="string"?u:u.map(c=>typeof c=="string"?c:c.text??"").join("");return Math.ceil(l.length/4)},s}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){return bd.chatModel?.getNumTokens(e)??this.estimateTokens(e)}validateCurrentModel(){if(!bd.chatModel)return;let e=B_();if(!e)return;bd.modelMap[e]?.hasApiKey||(bd.chatModel=null,F("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=GJ(e.name),f={maxTokens:c.isThinkingEnabled?4096:30},p={...l,...f};c.isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&(p.useResponsesApi=!0),await new(this.getProviderConstructor(o))(p).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 L4r.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: `+zr(n)+`
|
||
with CORS Error: `+zr(o);throw new Error(i)}}}findModelByName(e){return te().activeModels.find(n=>n.name===e)}};bd.ANTHROPIC_THINKING_BUDGET_TOKENS=2048,bd.REASONING_MODEL_TEMPERATURE=1;tC=bd});var Dmt={};En(Dmt,{TieredLexicalRetriever:()=>uT});async function Cti(){try{if(!Amt){let e=await Promise.resolve().then(()=>(CX(),F4r));Amt=()=>e.default.getInstance()}return Amt().getChatModel()}catch{return null}}var Nmt,Amt,uT,xX=v(()=>{Xe();Ye();Bt();ND();f9();Nmt=require("obsidian");Oae();wH();Amt=null;uT=class extends Ux{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.lastQueryExpansion=null;this.searchCore=new yPe(r,Cti),this.chunkManager=Sq(r)}getLastQueryExpansion(){return this.lastQueryExpansion}async getRelevantDocuments(r,n){try{let i=kS(r,this.app.vault).map(f=>f.basename),a=[...new Set([...this.options.salientTerms,...i])];te().debug&&F("TieredLexicalRetriever: Starting search",{query:r,salientTerms:a,maxK:this.options.maxK});let s=te(),u=await this.searchCore.retrieve(r,{maxResults:this.options.maxK,salientTerms:a,enableLexicalBoosts:s.enableLexicalBoosts,preExpandedQuery:this.options.preExpandedQuery}),l=u.results;this.lastQueryExpansion=u.queryExpansion;let c=await this.convertToDocuments(l),d=this.sortResults(c);return te().debug&&F("TieredLexicalRetriever: Search complete",{totalResults:d.length,searchResults:l.length}),d}catch(o){return Te("TieredLexicalRetriever: Error during search",o),[]}}async convertToDocuments(r){let n=[];for(let o of r)try{if(o.id.includes("#")){let[a]=o.id.split("#"),s=this.app.vault.getAbstractFileByPath(a);if(!s||!(s instanceof Nmt.TFile))continue;let u="",l=this.chunkManager;if(typeof l.getChunkText=="function"?u=await l.getChunkText(o.id):typeof l.getChunkTextSync=="function"&&(u=l.getChunkTextSync(o.id)||""),!u)continue;let c=this.app.metadataCache.getFileCache(s);n.push(new tl({pageContent:u,metadata:{path:a,chunkId:o.id,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:c?.tags?.map(d=>d.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"chunk-v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!0}}))}else{let a=this.app.vault.getAbstractFileByPath(o.id);if(!a||!(a instanceof Nmt.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new tl({pageContent:s,metadata:{path:o.id,title:a.basename,mtime:a.stat.mtime,ctime:a.stat.ctime,tags:u?.tags?.map(l=>l.tag)||[],score:o.score,rerank_score:o.score,engine:o.engine||"v3",includeInContext:o.score>(this.options.minSimilarityScore||.1),explanation:o.explanation,isChunk:!1}}))}}catch(i){Te(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return F(`TieredLexicalRetriever: Converted ${n.length} results to Documents`),n}sortResults(r){return r.sort((n,o)=>{let i=n.metadata.score||0,s=(o.metadata.score||0)-i;if(Math.abs(s)>.01)return s;if(n.metadata.isChunk&&o.metadata.isChunk&&n.metadata.path===o.metadata.path){let u=parseInt(n.metadata.chunkId?.split("#")[1]||"0"),l=parseInt(o.metadata.chunkId?.split("#")[1]||"0");return u-l}return s})}}});var k4r={};En(k4r,{MergedSemanticRetriever:()=>K3});var zU,K3,jmt=v(()=>{_Pe();wH();xX();ND();f9();zU=class zU extends Ux{constructor(r,n,o){super();this.app=r;this.options=n;this.lc_namespace=["merged_semantic_retriever"];this.originalMaxK=Math.max(1,n.maxK),this.returnAll=!!n.returnAll;let i=this.returnAll?ec:Math.min(this.originalMaxK*2,ec),a={...n,maxK:i,returnAll:this.returnAll};this.lexicalRetriever=new uT(r,a);let s=this.returnAll?ec:Math.min(this.originalMaxK*2,ec);this.semanticRetriever=o||new $ae({minSimilarityScore:n.minSimilarityScore??.1,maxK:s,salientTerms:n.salientTerms,timeRange:n.timeRange,textWeight:n.textWeight,returnAll:this.returnAll,useRerankerThreshold:n.useRerankerThreshold})}async getRelevantDocuments(r){let[n,o]=await Promise.all([this.lexicalRetriever.getRelevantDocuments(r),this.semanticRetriever.getRelevantDocuments(r)]),i=new Map;for(let u of n)this.insertResult(i,u,"lexical");for(let u of o)this.insertResult(i,u,"semantic");let a=Array.from(i.values()).sort((u,l)=>(l.metadata?.score??0)-(u.metadata?.score??0)),s=this.returnAll?ec:this.originalMaxK;return a.slice(0,s)}insertResult(r,n,o){let i=this.getDocumentKey(n),a=this.decorateDocument(n,o),s=r.get(i);if(!s){r.set(i,a);return}let u=s.metadata?.source,l=this.getDocumentScore(s),c=this.getDocumentScore(a);if(o==="lexical"){(u!=="lexical"||c>l)&&r.set(i,a);return}u!=="lexical"&&c>l&&r.set(i,a)}getDocumentKey(r){let n=r.metadata??{};return n.chunkId||n.path||n.id||n.title||`${r.pageContent.slice(0,64)}::${r.pageContent.length}`}decorateDocument(r,n){let o={...r.metadata??{},source:n},i=this.extractBaseScore(o),a=n==="lexical"?zU.LEXICAL_WEIGHT:zU.SEMANTIC_WEIGHT,s=i*a;return n==="lexical"&&this.hasTagMatch(o)&&(s*=zU.TAG_MATCH_BOOST),o.score=s,o.rerank_score=s,new tl({pageContent:r.pageContent,metadata:o})}extractBaseScore(r){let n=[r?.rerank_score,r?.score];for(let o of n)if(typeof o=="number"&&!Number.isNaN(o))return o;return 0}getDocumentScore(r){let n=r.metadata?.score;return typeof n=="number"&&!Number.isNaN(n)?n:0}hasTagMatch(r){let n=r?.explanation;if(!n)return!1;let o=n.lexicalMatches;return Array.isArray(o)?o.some(i=>i?.field==="tags"):!1}};zU.LEXICAL_WEIGHT=1,zU.SEMANTIC_WEIGHT=1,zU.TAG_MATCH_BOOST=1.1;K3=zU});var U4r={};En(U4r,{FilterRetriever:()=>VU});var q4r,VU,ZDe=v(()=>{Xe();Ye();ob();Bt();ND();q4r=require("obsidian");wH();VU=class{constructor(e,r){this.app=e;this.options=r}async getRelevantDocuments(e){if(this.options.timeRange)return this.getTimeRangeDocuments(e);let r=kS(e,this.app.vault),n=await this.getTitleMatches(r),o=await this.getTagMatches(this.resolveTagTerms(e));return this.combineGuaranteedMatches(n,o)}hasTimeRange(){return this.options.timeRange!==void 0}async getTimeRangeDocuments(e){if(!this.options.timeRange)return[];let{startTime:r,endTime:n}=this.options.timeRange,o=this.generateDailyNoteDateRange(r,n);te().debug&&F("FilterRetriever: Generated daily note titles",{startTime:new Date(r).toISOString(),endTime:new Date(n).toISOString(),titlesCount:o.length,firstTitle:o[0],lastTitle:o[o.length-1]});let{inclusions:i,exclusions:a}=el(),s=o.join(", "),u=kS(s,this.app.vault).filter(g=>Hs(g,i,a)),c=(await this.getTitleMatches(u)).map(g=>(g.metadata.includeInContext=!0,g)),d=this.app.vault.getMarkdownFiles().filter(g=>Hs(g,i,a)),f=[],p=this.options.returnAll?ec:Math.min(this.options.maxK,ec);for(let g of d)if(g.stat.mtime>=r&&g.stat.mtime<=n){if(u.some(b=>b.path===g.path))continue;if(f.length>=p)break;try{let b=await this.app.vault.cachedRead(g),_=this.app.metadataCache.getFileCache(g),w=(Date.now()-g.stat.mtime)/(1e3*60*60*24),T=Math.max(.3,Math.min(1,1-w/30));f.push(new tl({pageContent:b,metadata:{path:g.path,title:g.basename,mtime:g.stat.mtime,ctime:g.stat.ctime,tags:_?.tags?.map(O=>O.tag)||[],includeInContext:!0,score:T,rerank_score:T,source:"time-filtered"}}))}catch(b){Te(`FilterRetriever: Failed to read file ${g.path}`,b)}}let m=new Map;for(let g of c)m.set(g.metadata.path,g);for(let g of f)m.has(g.metadata.path)||m.set(g.metadata.path,{...g,metadata:{...g.metadata,includeInContext:!0}});let h=this.options.returnAll?ec:this.options.maxK,y=Array.from(m.values()).sort((g,b)=>{let _=g.metadata.score||0;return(b.metadata.score||0)-_}).slice(0,h);return te().debug&&F("FilterRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:u.length,timeFilteredDocs:f.length,totalResults:y.length}),y}resolveTagTerms(e){let r=new Set;for(let n of this.options.salientTerms??[])typeof n=="string"&&n.startsWith("#")&&r.add(n.toLowerCase());if(r.size===0)for(let n of this.extractTagsFromQuery(e))r.add(n);return Array.from(r)}extractTagsFromQuery(e){if(!e)return[];let r=null;try{r=e.match(/#[\p{L}\p{N}_/-]+/gu)}catch{r=e.match(/#[a-z0-9_/-]+/g)}if(!r)return[];let n=new Set;for(let o of r){let i=o.trim();i.length<=1||n.add(i.toLowerCase())}return Array.from(n)}generateDailyNoteDateRange(e,r){let n=[],o=new Date(e),i=new Date(r),a=365;Math.ceil((r-e)/(1e3*60*60*24))>a&&(Te(`FilterRetriever: Date range exceeds ${a} days, limiting to recent ${a} days`),o.setTime(i.getTime()-a*24*60*60*1e3));let u=new Date(o);for(;u<=i;)n.push(`[[${u.toLocaleDateString("en-CA")}]]`),u.setDate(u.getDate()+1);return n}async getTitleMatches(e){let r=[];for(let n of e)if(!mae(n))try{let o=await this.app.vault.cachedRead(n),i=this.app.metadataCache.getFileCache(n);r.push(new tl({pageContent:o,metadata:{path:n.path,title:n.basename,mtime:n.stat.mtime,ctime:n.stat.ctime,tags:i?.tags?.map(a=>a.tag)||[],includeInContext:!0,score:1,rerank_score:1,source:"title-match"}}))}catch(o){Te(`FilterRetriever: Failed to read title-matched file ${n.path}`,o)}return r}async getTagMatches(e){if(e.length===0)return[];let{inclusions:r,exclusions:n}=el(),o=this.app.vault.getMarkdownFiles(),i=[],a=this.options.returnAll?ec:this.options.maxK;for(let s of o){if(i.length>=a)break;if(!Hs(s,r,n)||mae(s))continue;let u=this.app.metadataCache.getFileCache(s);if(!u)continue;let l=(0,q4r.getAllTags)(u)??[];if(!(l.length===0||!l.some(d=>{let f=d.toLowerCase();return e.some(p=>f===p||f.startsWith(p+"/"))})))try{let d=await this.app.vault.cachedRead(s);i.push(new tl({pageContent:d,metadata:{path:s.path,title:s.basename,mtime:s.stat.mtime,ctime:s.stat.ctime,tags:l,includeInContext:!0,score:1,rerank_score:1,source:"tag-match"}}))}catch(d){Te(`FilterRetriever: Failed to read tag-matched file ${s.path}`,d)}}return i}combineGuaranteedMatches(...e){let r=new Set,n=[];for(let o of e)for(let i of o)r.has(i.metadata.path)||(r.add(i.metadata.path),n.push(i));return n}}});var B4r={};En(B4r,{mergeFilterAndSearchResults:()=>TX});function TX(t,e){let r=new Set;for(let o of t)o.metadata?.path&&r.add(o.metadata.path);let n=e.filter(o=>{let i=o.metadata?.path;return!i||!r.has(i)});return{filterResults:t,searchResults:n}}var YDe=v(()=>{});var x2r=S((tht,rht)=>{(function(t,e){typeof tht=="object"&&typeof rht<"u"?rht.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(tht,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 ZU=S((nht,oht)=>{(function(t,e){typeof nht=="object"&&typeof oht<"u"?oht.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(nht,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",o="second",i="minute",a="hour",s="day",u="week",l="month",c="quarter",d="year",f="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var V=["th","st","nd","rd"],k=z%100;return"["+z+(V[(k-20)%10]||V[k]||V[0])+"]"}},g=function(z,V,k){var X=String(z);return!X||X.length>=V?z:""+Array(V+1-X.length).join(k)+z},b={s:g,z:function(z){var V=-z.utcOffset(),k=Math.abs(V),X=Math.floor(k/60),B=k%60;return(V<=0?"+":"-")+g(X,2,"0")+":"+g(B,2,"0")},m:function z(V,k){if(V.date()<k.date())return-z(k,V);var X=12*(k.year()-V.year())+(k.month()-V.month()),B=V.clone().add(X,l),Q=k-B<0,Y=V.clone().add(X+(Q?-1:1),l);return+(-(X+(k-B)/(Q?B-Y:Y-B))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},_="en",w={};w[_]=y;var T="$isDayjsObject",O=function(z){return z instanceof I||!(!z||!z[T])},E=function z(V,k,X){var B;if(!V)return _;if(typeof V=="string"){var Q=V.toLowerCase();w[Q]&&(B=Q),k&&(w[Q]=k,B=Q);var Y=V.split("-");if(!B&&Y.length>1)return z(Y[0])}else{var K=V.name;w[K]=V,B=K}return!X&&B&&(_=B),B||!X&&_},P=function(z,V){if(O(z))return z.clone();var k=typeof V=="object"?V:{};return k.date=z,k.args=arguments,new I(k)},R=b;R.l=E,R.i=O,R.w=function(z,V){return P(z,{locale:V.$L,utc:V.$u,x:V.$x,$offset:V.$offset})};var I=function(){function z(k){this.$L=E(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[T]=!0}var V=z.prototype;return V.parse=function(k){this.$d=function(X){var B=X.date,Q=X.utc;if(B===null)return new Date(NaN);if(R.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var Y=B.match(m);if(Y){var K=Y[2]-1||0,oe=(Y[7]||"0").substring(0,3);return Q?new Date(Date.UTC(Y[1],K,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,oe)):new Date(Y[1],K,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,oe)}}return new Date(B)}(k),this.init()},V.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()},V.$utils=function(){return R},V.isValid=function(){return this.$d.toString()!==p},V.isSame=function(k,X){var B=P(k);return this.startOf(X)<=B&&B<=this.endOf(X)},V.isAfter=function(k,X){return P(k)<this.startOf(X)},V.isBefore=function(k,X){return this.endOf(X)<P(k)},V.$g=function(k,X,B){return R.u(k)?this[X]:this.set(B,k)},V.unix=function(){return Math.floor(this.valueOf()/1e3)},V.valueOf=function(){return this.$d.getTime()},V.startOf=function(k,X){var B=this,Q=!!R.u(X)||X,Y=R.p(k),K=function(A,U){var H=R.w(B.$u?Date.UTC(B.$y,U,A):new Date(B.$y,U,A),B);return Q?H:H.endOf(s)},oe=function(A,U){return R.w(B.toDate()[A].apply(B.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice(U)),B)},ue=this.$W,de=this.$M,L=this.$D,W="set"+(this.$u?"UTC":"");switch(Y){case d:return Q?K(1,0):K(31,11);case l:return Q?K(1,de):K(0,de+1);case u:var ie=this.$locale().weekStart||0,j=(ue<ie?ue+7:ue)-ie;return K(Q?L-j:L+(6-j),de);case s:case f:return oe(W+"Hours",0);case a:return oe(W+"Minutes",1);case i:return oe(W+"Seconds",2);case o:return oe(W+"Milliseconds",3);default:return this.clone()}},V.endOf=function(k){return this.startOf(k,!1)},V.$set=function(k,X){var B,Q=R.p(k),Y="set"+(this.$u?"UTC":""),K=(B={},B[s]=Y+"Date",B[f]=Y+"Date",B[l]=Y+"Month",B[d]=Y+"FullYear",B[a]=Y+"Hours",B[i]=Y+"Minutes",B[o]=Y+"Seconds",B[n]=Y+"Milliseconds",B)[Q],oe=Q===s?this.$D+(X-this.$W):X;if(Q===l||Q===d){var ue=this.clone().set(f,1);ue.$d[K](oe),ue.init(),this.$d=ue.set(f,Math.min(this.$D,ue.daysInMonth())).$d}else K&&this.$d[K](oe);return this.init(),this},V.set=function(k,X){return this.clone().$set(k,X)},V.get=function(k){return this[R.p(k)]()},V.add=function(k,X){var B,Q=this;k=Number(k);var Y=R.p(X),K=function(de){var L=P(Q);return R.w(L.date(L.date()+Math.round(de*k)),Q)};if(Y===l)return this.set(l,this.$M+k);if(Y===d)return this.set(d,this.$y+k);if(Y===s)return K(1);if(Y===u)return K(7);var oe=(B={},B[i]=e,B[a]=r,B[o]=t,B)[Y]||1,ue=this.$d.getTime()+k*oe;return R.w(ue,this)},V.subtract=function(k,X){return this.add(-1*k,X)},V.format=function(k){var X=this,B=this.$locale();if(!this.isValid())return B.invalidDate||p;var Q=k||"YYYY-MM-DDTHH:mm:ssZ",Y=R.z(this),K=this.$H,oe=this.$m,ue=this.$M,de=B.weekdays,L=B.months,W=B.meridiem,ie=function(U,H,re,Z){return U&&(U[H]||U(X,Q))||re[H].slice(0,Z)},j=function(U){return R.s(K%12||12,U,"0")},A=W||function(U,H,re){var Z=U<12?"AM":"PM";return re?Z.toLowerCase():Z};return Q.replace(h,function(U,H){return H||function(re){switch(re){case"YY":return String(X.$y).slice(-2);case"YYYY":return R.s(X.$y,4,"0");case"M":return ue+1;case"MM":return R.s(ue+1,2,"0");case"MMM":return ie(B.monthsShort,ue,L,3);case"MMMM":return ie(L,ue);case"D":return X.$D;case"DD":return R.s(X.$D,2,"0");case"d":return String(X.$W);case"dd":return ie(B.weekdaysMin,X.$W,de,2);case"ddd":return ie(B.weekdaysShort,X.$W,de,3);case"dddd":return de[X.$W];case"H":return String(K);case"HH":return R.s(K,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return A(K,oe,!0);case"A":return A(K,oe,!1);case"m":return String(oe);case"mm":return R.s(oe,2,"0");case"s":return String(X.$s);case"ss":return R.s(X.$s,2,"0");case"SSS":return R.s(X.$ms,3,"0");case"Z":return Y}return null}(U)||Y.replace(":","")})},V.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},V.diff=function(k,X,B){var Q,Y=this,K=R.p(X),oe=P(k),ue=(oe.utcOffset()-this.utcOffset())*e,de=this-oe,L=function(){return R.m(Y,oe)};switch(K){case d:Q=L()/12;break;case l:Q=L();break;case c:Q=L()/3;break;case u:Q=(de-ue)/6048e5;break;case s:Q=(de-ue)/864e5;break;case a:Q=de/r;break;case i:Q=de/e;break;case o:Q=de/t;break;default:Q=de}return B?Q:R.a(Q)},V.daysInMonth=function(){return this.endOf(l).$D},V.$locale=function(){return w[this.$L]},V.locale=function(k,X){if(!k)return this.$L;var B=this.clone(),Q=E(k,X,!0);return Q&&(B.$L=Q),B},V.clone=function(){return R.w(this.$d,this)},V.toDate=function(){return new Date(this.valueOf())},V.toJSON=function(){return this.isValid()?this.toISOString():null},V.toISOString=function(){return this.$d.toISOString()},V.toString=function(){return this.$d.toUTCString()},z}(),N=I.prototype;return P.prototype=N,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(z){N[z[1]]=function(V){return this.$g(V,z[0],z[1])}}),P.extend=function(z,V){return z.$i||(z(V,I,P),z.$i=!0),P},P.locale=E,P.isDayjs=O,P.unix=function(z){return P(1e3*z)},P.en=w[_],P.Ls=w,P.p={},P})});function hgt(t,e){let r=new Set;for(let n of e)t.has(n)&&r.add(n);return r}function s3r(t,e){let r=new Set(t);for(let n of e)r.add(n);return r}function Kce(t,e){let r=new Set(t);for(let n of e)r.delete(n);return r}var u3r=v(()=>{});var ggt={};En(ggt,{SequentialChain:()=>Vii,SimpleSequentialChain:()=>Hii});function Gce(t){return Array.from(t).map(e=>`"${e}"`).join(", ")}var Vii,Hii,ygt=v(()=>{nZ();u3r();Vii=class l3r extends hb{constructor(r){super(r);x(this,"chains");x(this,"inputVariables");x(this,"outputVariables");x(this,"returnAll");if(this.chains=r.chains,this.inputVariables=r.inputVariables,this.outputVariables=r.outputVariables??[],this.outputVariables.length>0&&r.returnAll)throw new Error("Either specify variables to return using `outputVariables` or use `returnAll` param. Cannot apply both conditions at the same time.");this.returnAll=r.returnAll??!1,this._validateChains()}static lc_name(){return"SequentialChain"}get inputKeys(){return this.inputVariables}get outputKeys(){return this.outputVariables}_validateChains(){if(this.chains.length===0)throw new Error("Sequential chain must have at least one chain.");let r=this.memory?.memoryKeys??[],n=new Set(this.inputKeys),o=new Set(r),i=hgt(n,o);if(i.size>0)throw new Error(`The following keys: ${Gce(i)} are overlapping between memory and input keys of the chain variables. This can lead to unexpected behaviour. Please use input and memory keys that don't overlap.`);let a=s3r(n,o);for(let s of this.chains){let u=Kce(new Set(s.inputKeys),a);if(s.memory&&(u=Kce(u,new Set(s.memory.memoryKeys))),u.size>0)throw new Error(`Missing variables for chain "${s._chainType()}": ${Gce(u)}. Only got the following variables: ${Gce(a)}.`);let l=new Set(s.outputKeys),c=hgt(a,l);if(c.size>0)throw new Error(`The following output variables for chain "${s._chainType()}" are overlapping: ${Gce(c)}. This can lead to unexpected behaviour.`);for(let d of l)a.add(d)}if(this.outputVariables.length===0)if(this.returnAll){let s=Kce(a,n);this.outputVariables=Array.from(s)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{let s=Kce(new Set(this.outputVariables),new Set(a));if(s.size>0)throw new Error(`The following output variables were expected to be in the final chain output but were not found: ${Gce(s)}.`)}}async _call(r,n){let o={},i=r,a=0;for(let u of this.chains){a+=1,o=await u.call(i,n?.getChild(`step_${a}`));for(let l of Object.keys(o))i[l]=o[l]}let s={};for(let u of this.outputVariables)s[u]=i[u];return s}_chainType(){return"sequential_chain"}static async deserialize(r){let n=[],o=r.input_variables,i=r.output_variables,a=r.chains;for(let s of a){let u=await hb.deserialize(s);n.push(u)}return new l3r({chains:n,inputVariables:o,outputVariables:i})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),input_variables:this.inputVariables,output_variables:this.outputVariables,chains:r}}},Hii=class c3r extends hb{constructor(r){super(r);x(this,"chains");x(this,"inputKey","input");x(this,"outputKey","output");x(this,"trimOutputs");this.chains=r.chains,this.trimOutputs=r.trimOutputs??!1,this._validateChains()}static lc_name(){return"SimpleSequentialChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}_validateChains(){for(let r of this.chains){if(r.inputKeys.filter(n=>!r.memory?.memoryKeys.includes(n)).length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one input, got ${r.inputKeys.length} for ${r._chainType()}.`);if(r.outputKeys.length!==1)throw new Error(`Chains used in SimpleSequentialChain should all have one output, got ${r.outputKeys.length} for ${r._chainType()}.`)}}async _call(r,n){let o=r[this.inputKey],i=0;for(let a of this.chains)i+=1,o=(await a.call({[a.inputKeys[0]]:o,signal:r.signal},n?.getChild(`step_${i}`)))[a.outputKeys[0]],this.trimOutputs&&(o=o.trim()),await n?.handleText(o);return{[this.outputKey]:o}}_chainType(){return"simple_sequential_chain"}static async deserialize(r){let n=[],o=r.chains;for(let i of o){let a=await hb.deserialize(i);n.push(a)}return new c3r({chains:n})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),chains:r}}}});var Yje={};En(Yje,{MapReduceDocumentsChain:()=>f3r,RefineDocumentsChain:()=>m3r,StuffDocumentsChain:()=>Zje});var Zje,f3r,m3r,Xce=v(()=>{nZ();cW();FS();Zje=class d3r extends hb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"documentVariableName","context");this.llmChain=r.llmChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.inputKey=r.inputKey??this.inputKey}static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(r=>r!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}_prepInputs(r){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:n,...o}=r,a=n.map(({pageContent:s})=>s).join(`
|
||
|
||
`);return{...o,[this.documentVariableName]:a}}async _call(r,n){return await this.llmChain.call(this._prepInputs(r),n?.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(r){if(!r.llm_chain)throw new Error("Missing llm_chain");return new d3r({llmChain:await ag.deserialize(r.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}},f3r=class p3r extends hb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"documentVariableName","context");x(this,"returnIntermediateSteps",!1);x(this,"maxTokens",3e3);x(this,"maxIterations",10);x(this,"ensureMapStep",!1);x(this,"combineDocumentChain");this.llmChain=r.llmChain,this.combineDocumentChain=r.combineDocumentChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.ensureMapStep=r.ensureMapStep??this.ensureMapStep,this.inputKey=r.inputKey??this.inputKey,this.maxTokens=r.maxTokens??this.maxTokens,this.maxIterations=r.maxIterations??this.maxIterations,this.returnIntermediateSteps=r.returnIntermediateSteps??!1}static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:o,...i}=r,a=o,s=[];for(let c=0;c<this.maxIterations;c+=1){let d=a.map(h=>({[this.documentVariableName]:h.pageContent,...i}));if(c!==0||!this.ensureMapStep){let h=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...i}));if(await this.combineDocumentChain.llmChain._getNumTokens(h)<this.maxTokens)break}let p=await this.llmChain.apply(d,n?Array.from({length:d.length},(h,y)=>n.getChild(`map_${y+1}`)):void 0),{outputKey:m}=this.llmChain;this.returnIntermediateSteps&&(s=s.concat(p.map(h=>h[m]))),a=p.map(h=>({pageContent:h[m],metadata:{}}))}let u={[this.combineDocumentChain.inputKey]:a,...i},l=await this.combineDocumentChain.call(u,n?.getChild("combine_documents"));return this.returnIntermediateSteps?{...l,intermediateSteps:s}:l}_chainType(){return"map_reduce_documents_chain"}static async deserialize(r){if(!r.llm_chain)throw new Error("Missing llm_chain");if(!r.combine_document_chain)throw new Error("Missing combine_document_chain");return new p3r({llmChain:await ag.deserialize(r.llm_chain),combineDocumentChain:await Zje.deserialize(r.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}},m3r=class h3r extends hb{constructor(r){super(r);x(this,"llmChain");x(this,"inputKey","input_documents");x(this,"outputKey","output_text");x(this,"documentVariableName","context");x(this,"initialResponseName","existing_answer");x(this,"refineLLMChain");x(this,"documentPrompt",this.defaultDocumentPrompt);this.llmChain=r.llmChain,this.refineLLMChain=r.refineLLMChain,this.documentVariableName=r.documentVariableName??this.documentVariableName,this.inputKey=r.inputKey??this.inputKey,this.outputKey=r.outputKey??this.outputKey,this.documentPrompt=r.documentPrompt??this.documentPrompt,this.initialResponseName=r.initialResponseName??this.initialResponseName}static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new mu({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(r=>r!==this.documentVariableName&&r!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}async _constructInitialInputs(r,n){let o={page_content:r.pageContent,...r.metadata},i={};return this.documentPrompt.inputVariables.forEach(u=>{i[u]=o[u]}),{...{[this.documentVariableName]:await this.documentPrompt.format({...i})},...n}}async _constructRefineInputs(r,n){let o={page_content:r.pageContent,...r.metadata},i={};this.documentPrompt.inputVariables.forEach(u=>{i[u]=o[u]});let a={[this.documentVariableName]:await this.documentPrompt.format({...i})};return{[this.initialResponseName]:n,...a}}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Document key ${this.inputKey} not found.`);let{[this.inputKey]:o,...i}=r,a=o,s=await this._constructInitialInputs(a[0],i),u=await this.llmChain.predict({...s},n?.getChild("answer")),l=[u];for(let c=1;c<a.length;c+=1){let f={...await this._constructRefineInputs(a[c],u),...i};u=await this.refineLLMChain.predict({...f},n?.getChild("refine")),l.push(u)}return{[this.outputKey]:u}}_chainType(){return"refine_documents_chain"}static async deserialize(r){let n=r.llm_chain;if(!n)throw new Error("Missing llm_chain");let o=r.refine_llm_chain;if(!o)throw new Error("Missing refine_llm_chain");return new h3r({llmChain:await ag.deserialize(n),refineLLMChain:await ag.deserialize(o)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}});var oZ,Qje=v(()=>{kL();oZ=class extends Cg{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","example_selectors","base"])}}});function g3r(t){return t._modelType()==="base_llm"}function aZ(t){return t._modelType()==="base_chat_model"}var bgt,iZ,y3r=v(()=>{bgt=class{async getPromptAsync(t,e){return this.getPrompt(t).partial(e?.partialVariables??{})}},iZ=class extends bgt{constructor(e,r=[]){super();x(this,"defaultPrompt");x(this,"conditionals");this.defaultPrompt=e,this.conditionals=r}getPrompt(e){for(let[r,n]of this.conditionals)if(r(e))return n;return this.defaultPrompt}}});function b3r(t){return t.split(/\n| /).length}var _3r,w3r=v(()=>{Qje();_3r=class v3r extends oZ{constructor(r){super(r);x(this,"examples",[]);x(this,"examplePrompt");x(this,"getTextLength",b3r);x(this,"maxLength",2048);x(this,"exampleTextLengths",[]);this.examplePrompt=r.examplePrompt,this.maxLength=r.maxLength??2048,this.getTextLength=r.getTextLength??b3r}async addExample(r){this.examples.push(r);let n=await this.examplePrompt.format(r);this.exampleTextLengths.push(this.getTextLength(n))}async calculateExampleTextLengths(r,n){if(r.length>0)return r;let{examples:o,examplePrompt:i}=n;return(await Promise.all(o.map(s=>i.format(s)))).map(s=>this.getTextLength(s))}async selectExamples(r){let n=Object.values(r).join(" "),o=this.maxLength-this.getTextLength(n),i=0,a=[];for(;o>0&&i<this.examples.length;){let s=o-this.exampleTextLengths[i];if(s<0)break;a.push(this.examples[i]),o=s,i+=1}return a}static async fromExamples(r,n){let o=new v3r(n);return await Promise.all(r.map(i=>o.addExample(i))),o}}});function _gt(t){return Object.keys(t).sort().map(e=>t[e])}var S3r,x3r=v(()=>{zat();Qje();S3r=class C3r extends oZ{constructor(r){super(r);x(this,"vectorStoreRetriever");x(this,"exampleKeys");x(this,"inputKeys");if(this.exampleKeys=r.exampleKeys,this.inputKeys=r.inputKeys,r.vectorStore!==void 0)this.vectorStoreRetriever=r.vectorStore.asRetriever({k:r.k??4,filter:r.filter});else if(r.vectorStoreRetriever)this.vectorStoreRetriever=r.vectorStoreRetriever;else throw new Error('You must specify one of "vectorStore" and "vectorStoreRetriever".')}async addExample(r){let n=this.inputKeys??Object.keys(r),o=_gt(n.reduce((i,a)=>({...i,[a]:r[a]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new tl({pageContent:o,metadata:r})])}async selectExamples(r){let n=this.inputKeys??Object.keys(r),o=_gt(n.reduce((s,u)=>({...s,[u]:r[u]}),{})).join(" "),a=(await this.vectorStoreRetriever.invoke(o)).map(s=>s.metadata);return this.exampleKeys?a.map(s=>this.exampleKeys.reduce((u,l)=>({...u,[l]:s[l]}),{})):a}static async fromExamples(r,n,o,i={}){let a=i.inputKeys??null,s=r.map(l=>_gt(a?a.reduce((c,d)=>({...c,[d]:l[d]}),{}):l).join(" ")),u=await o.fromTexts(s,r,n,i);return new C3r({vectorStore:u,k:i.k??4,exampleKeys:i.exampleKeys,inputKeys:i.inputKeys})}}});var Wii,e$e=v(()=>{Jo();Qje();y3r();w3r();x3r();Wii={};$t(Wii,{BaseExampleSelector:()=>oZ,BasePromptSelector:()=>bgt,ConditionalPromptSelector:()=>iZ,LengthBasedExampleSelector:()=>_3r,SemanticSimilarityExampleSelector:()=>S3r,isChatModel:()=>aZ,isLLM:()=>g3r})});var Jii,Kii,Gii,Xii,T3r,O3r=v(()=>{FS();e$e();Jii=new mu({template:`Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
||
|
||
{context}
|
||
|
||
Question: {question}
|
||
Helpful Answer:`,inputVariables:["context","question"]}),Kii=`Use the following pieces of context to answer the users question.
|
||
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
||
----------------
|
||
{context}`,Gii=[LS.fromTemplate(Kii),$_.fromTemplate("{question}")],Xii=Ah.fromMessages(Gii),T3r=new iZ(Jii,[[aZ,Xii]])});var E3r=v(()=>{FS();e$e()});var P3r=v(()=>{FS();e$e()});function M3r(t,e={}){let{prompt:r=T3r.getPrompt(t),verbose:n}=e,o=new ag({prompt:r,llm:t,verbose:n});return new Zje({llmChain:o,verbose:n})}var R3r=v(()=>{cW();Xce();O3r();E3r();P3r()});var A3r={};En(A3r,{VectorDBQAChain:()=>Zii});var Zii,N3r=v(()=>{nZ();R3r();Zii=class I3r extends hb{constructor(r){super(r);x(this,"k",4);x(this,"inputKey","query");x(this,"vectorstore");x(this,"combineDocumentsChain");x(this,"returnSourceDocuments",!1);this.vectorstore=r.vectorstore,this.combineDocumentsChain=r.combineDocumentsChain,this.inputKey=r.inputKey??this.inputKey,this.k=r.k??this.k,this.returnSourceDocuments=r.returnSourceDocuments??this.returnSourceDocuments}static lc_name(){return"VectorDBQAChain"}get inputKeys(){return[this.inputKey]}get outputKeys(){return this.combineDocumentsChain.outputKeys.concat(this.returnSourceDocuments?["sourceDocuments"]:[])}async _call(r,n){if(!(this.inputKey in r))throw new Error(`Question key ${this.inputKey} not found.`);let o=r[this.inputKey],i=await this.vectorstore.similaritySearch(o,this.k,r.filter,n?.getChild("vectorstore")),a={question:o,input_documents:i},s=await this.combineDocumentsChain.call(a,n?.getChild("combine_documents"));return this.returnSourceDocuments?{...s,sourceDocuments:i}:s}_chainType(){return"vector_db_qa"}static async deserialize(r,n){if(!("vectorstore"in n))throw new Error("Need to pass in a vectorstore to deserialize VectorDBQAChain");let{vectorstore:o}=n;if(!r.combine_documents_chain)throw new Error("VectorDBQAChain must have combine_documents_chain in serialized data");return new I3r({combineDocumentsChain:await hb.deserialize(r.combine_documents_chain),k:r.k,vectorstore:o})}serialize(){return{_type:this._chainType(),combine_documents_chain:this.combineDocumentsChain.serialize(),k:this.k}}static fromLLM(r,n,o){let i=M3r(r);return new this({vectorstore:n,combineDocumentsChain:i,...o})}}});var D3r,j3r,Yii,$3r,L3r=v(()=>{FS();D3r=`You are given the below API Documentation:
|
||
{api_docs}
|
||
Using this documentation, generate the full API url to call for answering the user question.
|
||
You should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.
|
||
|
||
Question:{question}
|
||
API url:`,j3r=new mu({inputVariables:["api_docs","question"],template:D3r}),Yii=`${D3r} {api_url}
|
||
|
||
Here is the response from the API:
|
||
|
||
{api_response}
|
||
|
||
Summarize this response to answer the original question.
|
||
|
||
Summary:`,$3r=new mu({inputVariables:["api_docs","question","api_url","api_response"],template:Yii})});var k3r={};En(k3r,{APIChain:()=>Qii});var Qii,q3r=v(()=>{nZ();cW();L3r();Qii=class F3r extends hb{constructor(r){super(r);x(this,"apiAnswerChain");x(this,"apiRequestChain");x(this,"apiDocs");x(this,"headers",{});x(this,"inputKey","question");x(this,"outputKey","output");this.apiRequestChain=r.apiRequestChain,this.apiAnswerChain=r.apiAnswerChain,this.apiDocs=r.apiDocs,this.inputKey=r.inputKey??this.inputKey,this.outputKey=r.outputKey??this.outputKey,this.headers=r.headers??this.headers}get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}async _call(r,n){let o=r[this.inputKey],i=await this.apiRequestChain.predict({question:o,api_docs:this.apiDocs},n?.getChild("request")),s=await(await fetch(i,{headers:this.headers})).text(),u=await this.apiAnswerChain.predict({question:o,api_docs:this.apiDocs,api_url:i,api_response:s},n?.getChild("response"));return{[this.outputKey]:u}}_chainType(){return"api_chain"}static async deserialize(r){let{api_request_chain:n,api_answer_chain:o,api_docs:i}=r;if(!n)throw new Error("LLMChain must have api_request_chain");if(!o)throw new Error("LLMChain must have api_answer_chain");if(!i)throw new Error("LLMChain must have api_docs");return new F3r({apiAnswerChain:await ag.deserialize(o),apiRequestChain:await ag.deserialize(n),apiDocs:i})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(r,n,o={}){let{apiUrlPrompt:i=j3r,apiResponsePrompt:a=$3r}=o,s=new ag({prompt:i,llm:r}),u=new ag({prompt:a,llm:r});return new this({apiAnswerChain:u,apiRequestChain:s,apiDocs:n,...o})}}});var hb,nZ=v(()=>{sw();Nw();Ed();WL();hb=class extends k8{get lc_namespace(){return["langchain","chains",this._chainType()]}constructor(t,e,r){if(arguments.length===1&&typeof t=="object"&&!("saveContext"in t)){let{memory:n,callbackManager:o,...i}=t;super({...i,callbacks:o??i.callbacks}),this.memory=n}else super({verbose:e,callbacks:r}),this.memory=t}_selectMemoryInputs(t){let e={...t};return"signal"in e&&delete e.signal,"timeout"in e&&delete e.timeout,e}async invoke(t,e){let r=ai(e),n=await this._formatValues(t),i=await(await mc.configure(r?.callbacks,this.callbacks,r?.tags,this.tags,r?.metadata,this.metadata,{verbose:this.verbose}))?.handleChainStart(this.toJSON(),n,void 0,void 0,void 0,void 0,r?.runName),a;try{if(n.signal){let s;a=await Promise.race([this._call(n,i,r),new Promise((u,l)=>{s=()=>{l(new Error("AbortError"))},n.signal?.addEventListener("abort",s)})]).finally(()=>{n.signal&&s&&n.signal.removeEventListener("abort",s)})}else a=await this._call(n,i,r)}catch(s){throw await i?.handleChainError(s),s}return this.memory!=null&&await this.memory.saveContext(this._selectMemoryInputs(t),a),await i?.handleChainEnd(a),Object.defineProperty(a,JN,{value:i?{runId:i?.runId}:void 0,configurable:!0}),a}_validateOutputs(t){let e=this.outputKeys.filter(r=>!(r in t));if(e.length)throw new Error(`Missing output keys: ${e.join(", ")} from chain ${this._chainType()}`)}async prepOutputs(t,e,r=!1){return this._validateOutputs(e),this.memory&&await this.memory.saveContext(t,e),r?e:{...t,...e}}serialize(){throw new Error("Method not implemented.")}async run(t,e){let r=this.inputKeys.filter(s=>!this.memory?.memoryKeys.includes(s));if(!(r.length<=1))throw new Error(`Chain ${this._chainType()} expects multiple inputs, cannot use 'run' `);let o=r.length?{[r[0]]:t}:{},i=await this.call(o,e),a=Object.keys(i);if(a.length===1)return i[a[0]];throw new Error("return values have multiple keys, `run` only supported when one key currently")}async _formatValues(t){let e={...t};if(e.timeout&&!e.signal&&(e.signal=AbortSignal.timeout(e.timeout),delete e.timeout),this.memory!=null){let r=await this.memory.loadMemoryVariables(this._selectMemoryInputs(t));for(let[n,o]of Object.entries(r))e[n]=o}return e}async call(t,e,r){let n={tags:r,...HN(e)};return this.invoke(t,n)}async apply(t,e){return Promise.all(t.map(async(r,n)=>this.call(r,e?.[n])))}static async deserialize(t,e={}){switch(t._type){case"llm_chain":{let{LLMChain:r}=await Promise.resolve().then(()=>(cW(),U3r));return r.deserialize(t)}case"sequential_chain":{let{SequentialChain:r}=await Promise.resolve().then(()=>(ygt(),ggt));return r.deserialize(t)}case"simple_sequential_chain":{let{SimpleSequentialChain:r}=await Promise.resolve().then(()=>(ygt(),ggt));return r.deserialize(t)}case"stuff_documents_chain":{let{StuffDocumentsChain:r}=await Promise.resolve().then(()=>(Xce(),Yje));return r.deserialize(t)}case"map_reduce_documents_chain":{let{MapReduceDocumentsChain:r}=await Promise.resolve().then(()=>(Xce(),Yje));return r.deserialize(t)}case"refine_documents_chain":{let{RefineDocumentsChain:r}=await Promise.resolve().then(()=>(Xce(),Yje));return r.deserialize(t)}case"vector_db_qa":{let{VectorDBQAChain:r}=await Promise.resolve().then(()=>(N3r(),A3r));return r.deserialize(t,e)}case"api_chain":{let{APIChain:r}=await Promise.resolve().then(()=>(q3r(),k3r));return r.deserialize(t)}default:throw new Error(`Invalid prompt type in config: ${t._type}`)}}}});var B3r,z3r=v(()=>{fO();B3r=class extends o1{constructor(){super(...arguments);x(this,"lc_namespace",["langchain","output_parsers","default"]);x(this,"lc_serializable",!0)}static lc_name(){return"NoOpOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}}});var U3r={};En(U3r,{LLMChain:()=>ag});function eai(t){return typeof t._llmType=="function"}function t$e(t){if(eai(t))return t;if("bound"in t&&Go.isRunnable(t.bound))return t$e(t.bound);if("runnable"in t&&"fallbacks"in t&&Go.isRunnable(t.runnable))return t$e(t.runnable);if("default"in t&&Go.isRunnable(t.default))return t$e(t.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}var ag,cW=v(()=>{nZ();z3r();FS();sw();Nw();ag=class V3r extends hb{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"prompt");x(this,"llm");x(this,"llmKwargs");x(this,"outputKey","text");x(this,"outputParser");if(this.prompt=r.prompt,this.llm=r.llm,this.llmKwargs=r.llmKwargs,this.outputKey=r.outputKey??this.outputKey,this.outputParser=r.outputParser??new B3r,this.prompt.outputParser){if(r.outputParser)throw new Error("Cannot set both outputParser and prompt.outputParser");this.outputParser=this.prompt.outputParser}}static lc_name(){return"LLMChain"}get inputKeys(){return this.prompt.inputVariables}get outputKeys(){return[this.outputKey]}getCallKeys(){return"callKeys"in this.llm?this.llm.callKeys:[]}_selectMemoryInputs(r){let n=super._selectMemoryInputs(r),o=this.getCallKeys();for(let i of o)i in r&&delete n[i];return n}async _getFinalOutput(r,n,o){let i;return this.outputParser?i=await this.outputParser.parseResultWithPrompt(r,n,o?.getChild()):i=r[0].text,i}call(r,n){return super.call(r,n)}async _call(r,n){let o={...r},i={...this.llmKwargs},a=this.getCallKeys();for(let c of a)c in r&&i&&(i[c]=r[c],delete o[c]);let s=await this.prompt.formatPromptValue(o);if("generatePrompt"in this.llm){let{generations:c}=await this.llm.generatePrompt([s],i,n?.getChild());return{[this.outputKey]:await this._getFinalOutput(c[0],s,n)}}let l=await(this.outputParser?this.llm.pipe(this.outputParser):this.llm).invoke(s,n?.getChild());return{[this.outputKey]:l}}async predict(r,n){return(await this.call(r,n))[this.outputKey]}_chainType(){return"llm"}static async deserialize(r){let{llm:n,prompt:o}=r;if(!n)throw new Error("LLMChain must have llm");if(!o)throw new Error("LLMChain must have prompt");return new V3r({llm:await bV.deserialize(n),prompt:await jS.deserialize(o)})}serialize(){let r="serialize"in this.llm?this.llm.serialize():void 0;return{_type:`${this._chainType()}_chain`,llm:r,prompt:this.prompt.serialize()}}_getNumTokens(r){return t$e(this.llm).getNumTokens(r)}}});function Fde(t){if(!t)return!1;let e=t.view;return!e||typeof e!="object"?!1:typeof e.getViewType=="function"&&t.view.getViewType()===NW}function DZ(t){let e=t.view?.webview;if(!e||typeof e!="object"||typeof e.executeJavaScript!="function")throw new pbt("Web Viewer webview is unavailable. The view may not be fully initialized.");return e}var NW,ALe,iS,RLe,ILe,pbt,PB,jZ=v(()=>{NW="webviewer",ALe={OPEN:"webviewer:open",SAVE_TO_VAULT:"webviewer:save-to-vault"},iS=class t extends Error{constructor(e){super(e),this.name="WebViewerError",Object.setPrototypeOf(this,t.prototype)}},RLe=class t extends iS{constructor(e){super(e),this.name="WebViewerUnsupportedError",Object.setPrototypeOf(this,t.prototype)}},ILe=class t extends iS{constructor(e){super(e),this.name="WebViewerLeafNotFoundError",Object.setPrototypeOf(this,t.prototype)}},pbt=class t extends iS{constructor(e){super(e),this.name="WebviewUnavailableError",Object.setPrototypeOf(this,t.prototype)}},PB=class t extends iS{constructor(e){super(e),this.name="WebViewerTimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Zdi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}return t}function ybt(t,e){return Array(e+1).join(t)}function tGr(t){return t.replace(/^\n*/,"")}function rGr(t){for(var e=t.length;e>0&&t[e-1]===`
|
||
`;)e--;return t.substring(0,e)}function nGr(t){return rGr(tGr(t))}function bbt(t){return _bt(t,Ydi)}function iGr(t){return _bt(t,oGr)}function Qdi(t){return sGr(t,oGr)}function efi(t){return _bt(t,aGr)}function tfi(t){return sGr(t,aGr)}function _bt(t,e){return e.indexOf(t.nodeName)>=0}function sGr(t,e){return t.getElementsByTagName&&e.some(function(r){return t.getElementsByTagName(r).length})}function NLe(t){return t?t.replace(/(\n+\s*)+/g,`
|
||
`):""}function uGr(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}function mbt(t,e,r){for(var n=0;n<t.length;n++){var o=t[n];if(rfi(o,e,r))return o}}function rfi(t,e,r){var n=t.filter;if(typeof n=="string"){if(n===e.nodeName.toLowerCase())return!0}else if(Array.isArray(n)){if(n.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof n=="function"){if(n.call(t,e,r))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function nfi(t){var e=t.element,r=t.isBlock,n=t.isVoid,o=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||o(e))){for(var i=null,a=!1,s=null,u=Q8r(s,e,o);u!==e;){if(u.nodeType===3||u.nodeType===4){var l=u.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!a&&l[0]===" "&&(l=l.substr(1)),!l){u=hbt(u);continue}u.data=l,i=u}else if(u.nodeType===1)r(u)||u.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,a=!1):n(u)||o(u)?(i=null,a=!0):i&&(a=!1);else{u=hbt(u);continue}var c=Q8r(s,u,o);s=u,u=c}i&&(i.data=i.data.replace(/ $/,""),i.data||hbt(i))}}function hbt(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function Q8r(t,e,r){return t&&t.parentNode===e||r(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}function ofi(){var t=vbt.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function ifi(){var t=function(){};return afi()?t.prototype.parseFromString=function(e){var r=new window.ActiveXObject("htmlfile");return r.designMode="on",r.open(),r.write(e),r.close(),r}:t.prototype.parseFromString=function(e){var r=document.implementation.createHTMLDocument("");return r.open(),r.write(e),r.close(),r},t}function afi(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{vbt.ActiveXObject&&(t=!0)}return t}function ufi(t,e){var r;if(typeof t=="string"){var n=lfi().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");r=n.getElementById("turndown-root")}else r=t.cloneNode(!0);return nfi({element:r,isBlock:bbt,isVoid:iGr,isPre:e.preformattedCode?cfi:null}),r}function lfi(){return gbt=gbt||new sfi,gbt}function cfi(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function dfi(t,e){return t.isBlock=bbt(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=ffi(t),t.flankingWhitespace=pfi(t,e),t}function ffi(t){return!iGr(t)&&!efi(t)&&/^\s*$/i.test(t.textContent)&&!Qdi(t)&&!tfi(t)}function pfi(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var r=mfi(t.textContent);return r.leadingAscii&&eGr("left",t,e)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&eGr("right",t,e)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function mfi(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function eGr(t,e,r){var n,o,i;return t==="left"?(n=e.previousSibling,o=/ $/):(n=e.nextSibling,o=/^ /),n&&(n.nodeType===3?i=o.test(n.nodeValue):r.preformattedCode&&n.nodeName==="CODE"?i=!1:n.nodeType===1&&!bbt(n)&&(i=o.test(n.textContent))),i}function DLe(t){if(!(this instanceof DLe))return new DLe(t);var e={rules:bb,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(r,n){return n.isBlock?`
|
||
|
||
`:""},keepReplacement:function(r,n){return n.isBlock?`
|
||
|
||
`+n.outerHTML+`
|
||
|
||
`:n.outerHTML},defaultReplacement:function(r,n){return n.isBlock?`
|
||
|
||
`+r+`
|
||
|
||
`:r}};this.options=Zdi({},e,t),this.rules=new uGr(this.options)}function lGr(t){var e=this;return hfi.call(t.childNodes,function(r,n){n=new dfi(n,e.options);var o="";return n.nodeType===3?o=n.isCode?n.nodeValue:e.escape(n.nodeValue):n.nodeType===1&&(o=bfi.call(e,n)),cGr(r,o)},"")}function yfi(t){var e=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(t=cGr(t,r.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function bfi(t){var e=this.rules.forNode(t),r=lGr.call(this,t),n=t.flankingWhitespace;return(n.leading||n.trailing)&&(r=r.trim()),n.leading+e.replacement(r,t,this.options)+n.trailing}function cGr(t,e){var r=rGr(t),n=tGr(e),o=Math.max(t.length-r.length,e.length-n.length),i=`
|
||
|
||
`.substring(0,o);return r+i+n}function _fi(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}var Ydi,oGr,aGr,bb,vbt,sfi,gbt,hfi,gfi,dGr,fGr=v(()=>{Ydi=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];oGr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];aGr=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];bb={};bb.paragraph={filter:"p",replacement:function(t){return`
|
||
|
||
`+t+`
|
||
|
||
`}};bb.lineBreak={filter:"br",replacement:function(t,e,r){return r.br+`
|
||
`}};bb.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,r){var n=Number(e.nodeName.charAt(1));if(r.headingStyle==="setext"&&n<3){var o=ybt(n===1?"=":"-",t.length);return`
|
||
|
||
`+t+`
|
||
`+o+`
|
||
|
||
`}else return`
|
||
|
||
`+ybt("#",n)+" "+t+`
|
||
|
||
`}};bb.blockquote={filter:"blockquote",replacement:function(t){return t=nGr(t).replace(/^/gm,"> "),`
|
||
|
||
`+t+`
|
||
|
||
`}};bb.list={filter:["ul","ol"],replacement:function(t,e){var r=e.parentNode;return r.nodeName==="LI"&&r.lastElementChild===e?`
|
||
`+t:`
|
||
|
||
`+t+`
|
||
|
||
`}};bb.listItem={filter:"li",replacement:function(t,e,r){var n=r.bulletListMarker+" ",o=e.parentNode;if(o.nodeName==="OL"){var i=o.getAttribute("start"),a=Array.prototype.indexOf.call(o.children,e);n=(i?Number(i)+a:a+1)+". "}var s=/\n$/.test(t);return t=nGr(t)+(s?`
|
||
`:""),t=t.replace(/\n/gm,`
|
||
`+" ".repeat(n.length)),n+t+(e.nextSibling?`
|
||
`:"")}};bb.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){return`
|
||
|
||
`+e.firstChild.textContent.replace(/\n/g,`
|
||
`)+`
|
||
|
||
`}};bb.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,r){for(var n=e.firstChild.getAttribute("class")||"",o=(n.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,a=r.fence.charAt(0),s=3,u=new RegExp("^"+a+"{3,}","gm"),l;l=u.exec(i);)l[0].length>=s&&(s=l[0].length+1);var c=ybt(a,s);return`
|
||
|
||
`+c+o+`
|
||
`+i.replace(/\n$/,"")+`
|
||
`+c+`
|
||
|
||
`}};bb.horizontalRule={filter:"hr",replacement:function(t,e,r){return`
|
||
|
||
`+r.hr+`
|
||
|
||
`}};bb.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var r=e.getAttribute("href");r&&(r=r.replace(/([()])/g,"\\$1"));var n=NLe(e.getAttribute("title"));return n&&(n=' "'+n.replace(/"/g,'\\"')+'"'),"["+t+"]("+r+n+")"}};bb.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,r){var n=e.getAttribute("href"),o=NLe(e.getAttribute("title"));o&&(o=' "'+o+'"');var i,a;switch(r.linkReferenceStyle){case"collapsed":i="["+t+"][]",a="["+t+"]: "+n+o;break;case"shortcut":i="["+t+"]",a="["+t+"]: "+n+o;break;default:var s=this.references.length+1;i="["+t+"]["+s+"]",a="["+s+"]: "+n+o}return this.references.push(a),i},references:[],append:function(t){var e="";return this.references.length&&(e=`
|
||
|
||
`+this.references.join(`
|
||
`)+`
|
||
|
||
`,this.references=[]),e}};bb.emphasis={filter:["em","i"],replacement:function(t,e,r){return t.trim()?r.emDelimiter+t+r.emDelimiter:""}};bb.strong={filter:["strong","b"],replacement:function(t,e,r){return t.trim()?r.strongDelimiter+t+r.strongDelimiter:""}};bb.code={filter:function(t){var e=t.previousSibling||t.nextSibling,r=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!r},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",r="`",n=t.match(/`+/gm)||[];n.indexOf(r)!==-1;)r=r+"`";return r+e+t+e+r}};bb.image={filter:"img",replacement:function(t,e){var r=NLe(e.getAttribute("alt")),n=e.getAttribute("src")||"",o=NLe(e.getAttribute("title")),i=o?' "'+o+'"':"";return n?"":""}};uGr.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=mbt(this.array,t,this.options))||(e=mbt(this._keep,t,this.options))||(e=mbt(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};vbt=typeof window<"u"?window:{};sfi=ofi()?vbt.DOMParser:ifi();hfi=Array.prototype.reduce,gfi=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];DLe.prototype={turndown:function(t){if(!_fi(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=lGr.call(this,new ufi(t,this.options));return yfi.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return gfi.reduce(function(e,r){return e.replace(r[0],r[1])},t)}};dGr=DLe});function $Z(t){return typeof t=="object"&&t!==null}function LZ(t){if(typeof t=="string")return t;if(t==null)return"";try{return String(t)}catch{return""}}function gGr(t){return t instanceof Error?t.message:LZ(t)}async function vfi(t){await new Promise(e=>setTimeout(e,t))}async function yGr(t,e,r,n){let o=Date.now();for(;;){if(t())return;if(Date.now()-o>=e)throw new iS(`${n} timed out after ${e}ms`);await vfi(r)}}function pGr(t,e){let r=(t??"").trim();if(!r)return"";if(!e)return r;try{return new URL(r,e).href}catch{return r}}function mGr(t){let e=(t??"").trim();return e?/[\s)]/.test(e)?`<${e}>`:e:""}function wfi(t){let e=new dGr({headingStyle:"atx",hr:"---",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined"});return e.remove(["script","style","noscript"]),e.addRule("webviewer-link",{filter:"a",replacement:(r,n)=>{let o=n,i=o.getAttribute("href")??"",a=mGr(pGr(i,t)),s=r?.trim()||o.textContent||a;return a?`[${s}](${a})`:s}}),e.addRule("webviewer-image",{filter:"img",replacement:(r,n)=>{let o=n,i=o.getAttribute("alt")??"",a=o.getAttribute("src")??"",s=mGr(pGr(a,t));return s?``:""}}),e}function wbt(t,e){if(!t.trim())return"";let r=wfi(e),i=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild;return i?r.turndown(i).replace(/\n{3,}/g,`
|
||
|
||
`).trim():""}function Sbt(t){let e=t.commands;return!e||!$Z(e)||typeof e.executeCommandById!="function"?null:e}function bGr(t,e){let r=Sbt(t);if(!r)return!1;if(r.commands){if(r.commands instanceof Map)return r.commands.has(e);if(typeof r.commands=="object")return e in r.commands}return typeof r.listCommands=="function"?r.listCommands().some(o=>o.id===e):!1}function _Gr(t,e){return t.workspace.getLeavesOfType(NW).includes(e)}function hGr(t){if(!$Z(t)||t.enabled!==!0)return null;let e=t.instance;if(!e||!$Z(e))return null;let r=e;return typeof r.openUrl=="function"||typeof r.handleOpenUrl=="function"?r:null}function vGr(t,e){let r=t.internalPlugins;if(!r||!$Z(r))return null;let n=r.plugins;if(!n)return null;let o=n instanceof Map?n.get(NW):$Z(n)?n[NW]:null;if(o){let a=hGr(o);if(a)return a}let i;if(n instanceof Map)i=Array.from(n.values());else if($Z(n))i=Object.values(n);else return e&&e(),null;for(let a of i){let s=hGr(a);if(s)return s}return null}var jLe=v(()=>{fGr();jZ()});function FZ(t){return{url:typeof t.view?.url=="string"?t.view.url:"",title:typeof t.view?.title=="string"?t.view.title:"",faviconUrl:typeof t.view?.faviconUrl=="string"?t.view.faviconUrl:"",mode:t.view?.mode==="reader"?"reader":"webview"}}async function wGr(t,e={}){let{signal:r}=e;if(r?.aborted)throw new PB("Operation was aborted");try{let n=Promise.resolve(t.view.getReaderModeContent());if(!r){let i=await n;return typeof i?.md=="string"?i.md:""}let o=await new Promise((i,a)=>{let s=()=>{a(new PB("Operation was aborted"))};r.addEventListener("abort",s,{once:!0}),n.then(u=>{r.removeEventListener("abort",s),i(u)}).catch(u=>{r.removeEventListener("abort",s),a(u)})});return typeof o?.md=="string"?o.md:""}catch(n){throw n instanceof PB||ne("Failed to get reader mode content:",n),n}}async function $Le(t,e=!0){let r=DZ(t),n='(() => { try { return window.getSelection?.()?.toString?.() ?? ""; } catch { return ""; } })()';try{let o=await r.executeJavaScript(n),i=LZ(o);return e?i.trim():i}catch(o){throw ne("Failed to get selected text:",o),o}}async function LLe(t){let e=DZ(t),r="";try{r=typeof e.getURL=="function"?e.getURL():""}catch{r=t.view?.url??""}let n=`(() => {
|
||
const sel = window.getSelection();
|
||
if (!sel || sel.rangeCount === 0 || sel.isCollapsed) return "";
|
||
const div = document.createElement("div");
|
||
for (let i = 0; i < sel.rangeCount; i++) div.appendChild(sel.getRangeAt(i).cloneContents());
|
||
return div.innerHTML;
|
||
})()`,o="";try{let i=await e.executeJavaScript(n);o=LZ(i)}catch(i){throw ne("Failed to get selection HTML:",i),i}try{return wbt(o,r)}catch(i){throw ne("Failed to convert HTML to Markdown:",i),i}}async function SGr(t){let e=DZ(t),r="";try{r=typeof e.getURL=="function"?e.getURL():""}catch{r=t.view?.url??""}let n=`(() => {
|
||
const clone = document.body.cloneNode(true);
|
||
clone.querySelectorAll('script, style, noscript').forEach(el => el.remove());
|
||
return clone.innerHTML;
|
||
})()`,o="";try{let i=await e.executeJavaScript(n);o=LZ(i)}catch(i){throw ne("Failed to get page HTML:",i),i}try{return wbt(o,r)}catch(i){throw ne("Failed to convert page HTML to Markdown:",i),i}}async function CGr(t,e=!0){let r=DZ(t),n=e?'(() => { try { return document.documentElement?.outerHTML ?? ""; } catch { return ""; } })()':'(() => { try { return document.body?.outerHTML ?? ""; } catch { return ""; } })()';try{let o=await r.executeJavaScript(n);return LZ(o)}catch(o){throw ne("Failed to get HTML:",o),o}}function FLe(t){try{let e=new URL(t),r=e.hostname.replace(/^www\./,"").replace(/^m\./,"");return r==="youtube.com"&&e.pathname==="/watch"?e.searchParams.get("v"):r==="youtu.be"&&e.pathname.length>1?e.pathname.slice(1).split("/")[0]:(r==="youtube.com"&&e.pathname.startsWith("/shorts/")||r==="youtube.com"&&e.pathname.startsWith("/embed/"))&&e.pathname.split("/")[2]||null}catch{return null}}function xGr(t){return FLe(t)!==null}function Sfi(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.videoId=="string"&&typeof e.title=="string"&&typeof e.channel=="string"&&(e.description===void 0||typeof e.description=="string")&&(e.uploadDate===void 0||typeof e.uploadDate=="string")&&(e.duration===void 0||typeof e.duration=="string")&&(e.genre===void 0||typeof e.genre=="string")&&Array.isArray(e.transcript)&&e.transcript.every(r=>typeof r=="object"&&r!==null&&typeof r.timestamp=="string"&&typeof r.text=="string")}async function TGr(t,e={}){let r=DZ(t),{timeoutMs:n=1e4}=e,o=Math.ceil(n/500),i="";try{i=typeof r.getURL=="function"?r.getURL():""}catch{i=""}i||(i=t.view?.url??"");let a=FLe(i);if(!a)throw new Error("Not a YouTube video page");let s=`(async () => {
|
||
const videoId = ${JSON.stringify(a)};
|
||
|
||
// =========================================================================
|
||
// Step 1: Extract video metadata from JSON-LD (structured data)
|
||
// JSON-LD is more reliable than DOM selectors as it's machine-readable
|
||
// =========================================================================
|
||
let title = '';
|
||
let channel = '';
|
||
let description = '';
|
||
let uploadDate = '';
|
||
let duration = '';
|
||
let genre = '';
|
||
|
||
// Helper to extract fields from a VideoObject schema
|
||
const extractVideoObject = (data) => {
|
||
if (!data || data['@type'] !== 'VideoObject') return;
|
||
if (!title && data.name && typeof data.name === 'string') {
|
||
title = data.name;
|
||
}
|
||
if (!description && data.description && typeof data.description === 'string') {
|
||
description = data.description;
|
||
}
|
||
if (!uploadDate && data.uploadDate && typeof data.uploadDate === 'string') {
|
||
uploadDate = data.uploadDate;
|
||
}
|
||
// JSON-LD duration is ISO 8601 format (e.g., "PT12M34S"), convert to readable format
|
||
if (!duration && data.duration && typeof data.duration === 'string') {
|
||
const match = data.duration.match(/PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?/);
|
||
if (match) {
|
||
const h = match[1] ? match[1] + ':' : '';
|
||
const m = match[2] || '0';
|
||
const s = match[3] || '0';
|
||
duration = h + (h ? m.padStart(2, '0') : m) + ':' + s.padStart(2, '0');
|
||
}
|
||
}
|
||
if (!genre && data.genre) {
|
||
genre = Array.isArray(data.genre) ? data.genre.join(', ') : String(data.genre);
|
||
}
|
||
// author can be string, object {name}, or array [{name}]
|
||
if (!channel && data.author) {
|
||
const author = data.author;
|
||
if (typeof author === 'string') {
|
||
channel = author;
|
||
} else if (Array.isArray(author) && author[0]?.name) {
|
||
channel = String(author[0].name);
|
||
} else if (author?.name) {
|
||
channel = String(author.name);
|
||
}
|
||
}
|
||
};
|
||
|
||
// Parse all JSON-LD scripts, handling various formats (@graph, array, single object)
|
||
const ldJsonEls = document.querySelectorAll('script[type="application/ld+json"]');
|
||
for (const el of ldJsonEls) {
|
||
try {
|
||
const data = JSON.parse(el.textContent || '');
|
||
if (Array.isArray(data)) {
|
||
for (const item of data) {
|
||
extractVideoObject(item);
|
||
}
|
||
} else if (data['@graph'] && Array.isArray(data['@graph'])) {
|
||
for (const item of data['@graph']) {
|
||
extractVideoObject(item);
|
||
}
|
||
} else {
|
||
extractVideoObject(data);
|
||
}
|
||
// Stop if we have all essential fields
|
||
if (title && channel && description) break;
|
||
} catch {}
|
||
}
|
||
|
||
// =========================================================================
|
||
// Step 2: Fallback to DOM selectors for missing metadata
|
||
// =========================================================================
|
||
if (!title) {
|
||
title = document.querySelector('h1.ytd-watch-metadata yt-formatted-string')?.textContent?.trim()
|
||
|| document.querySelector('#title h1')?.textContent?.trim() || '';
|
||
}
|
||
if (!channel) {
|
||
channel = document.querySelector('#owner #channel-name a')?.textContent?.trim()
|
||
|| document.querySelector('#channel-name a')?.textContent?.trim()
|
||
|| document.querySelector('#channel-name')?.textContent?.trim() || '';
|
||
}
|
||
if (!duration) {
|
||
duration = document.querySelector('#ytd-player .ytp-time-duration')?.textContent?.trim() || '';
|
||
}
|
||
|
||
// =========================================================================
|
||
// Step 3: Try to extract transcript
|
||
// Check if transcript panel is already open, otherwise click the button
|
||
// =========================================================================
|
||
let segments = document.querySelectorAll('ytd-transcript-segment-renderer');
|
||
let needClose = false;
|
||
|
||
if (segments.length === 0) {
|
||
const btn = document.querySelector('ytd-video-description-transcript-section-renderer button');
|
||
|
||
if (btn) {
|
||
btn.click();
|
||
needClose = true;
|
||
|
||
// Wait for transcript to load (poll every 500ms)
|
||
for (let i = 0; i < ${o}; i++) {
|
||
await new Promise(r => setTimeout(r, 500));
|
||
segments = document.querySelectorAll('ytd-transcript-segment-renderer');
|
||
if (segments.length > 0) break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Helper to close the transcript panel (called in finally block)
|
||
const closePanel = () => {
|
||
if (needClose) {
|
||
const closeBtn = document.querySelector(
|
||
'ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #visibility-button button'
|
||
);
|
||
if (closeBtn) closeBtn.click();
|
||
}
|
||
};
|
||
|
||
// =========================================================================
|
||
// Step 4: Extract transcript segments and return result
|
||
// =========================================================================
|
||
try {
|
||
const transcript = [...segments].map(seg => ({
|
||
timestamp: seg.querySelector('.segment-timestamp')?.textContent?.trim() || '',
|
||
text: seg.querySelector('yt-formatted-string.segment-text, .segment-text')?.textContent?.trim() || ''
|
||
})).filter(t => t.timestamp && t.text);
|
||
|
||
return { videoId, title, channel, description, uploadDate, duration, genre, transcript };
|
||
} finally {
|
||
// Step 5: Always close the transcript panel if we opened it
|
||
closePanel();
|
||
}
|
||
})()`,u=await r.executeJavaScript(s);if(!Sfi(u))throw new Error("Invalid transcript data structure");return u}async function OGr(t,e,r={}){let{preferCommand:n=!0,focusLeafBeforeCommand:o=!0}=r;if(n)try{return await e(ALe.SAVE_TO_VAULT,{leaf:t,focusLeaf:o}),F("Saved via webviewer:save-to-vault command"),{method:"command"}}catch(i){Te("save-to-vault command failed, falling back:",i)}try{return await Promise.resolve(t.view.saveAsMarkdown()),F("Saved via view.saveAsMarkdown()"),{method:"view.saveAsMarkdown"}}catch(i){throw ne("Failed to save Web Viewer page:",i),i}}var Cbt=v(()=>{Xe();jZ();jLe()});function _b(t){if(typeof t!="string")return null;let e=t.trim();return e||null}function kZ(t){if(typeof t!="string")return null;let e=t.trim();if(!e)return null;try{let r=new URL(e);r.hash="",(r.protocol==="http:"&&r.port==="80"||r.protocol==="https:"&&r.port==="443")&&(r.port=""),r.pathname!=="/"&&(r.pathname=r.pathname.replace(/\/+$/,""));let n=Array.from(r.searchParams.entries());return n.length>0?(n.sort(([o,i],[a,s])=>o!==a?o.localeCompare(a):i.localeCompare(s)),r.search=`?${new URLSearchParams(n).toString()}`):r.search="",r.toString()}catch{return e}}function PGr(t){return _b(t)??void 0}function xbt(t){let e=_b(t.url);if(!e)return null;let r=PGr(t.title),n=PGr(t.faviconUrl);return{url:e,title:r,faviconUrl:n,isLoaded:t.isLoaded,isActive:t.isActive?!0:void 0}}function DW(t){let e=new Map;for(let r of t){let n=xbt(r);if(!n)continue;let o=e.get(n.url);if(!o){e.set(n.url,n);continue}e.set(n.url,{...o,title:n.title??o.title,faviconUrl:n.faviconUrl??o.faviconUrl,isLoaded:n.isLoaded??o.isLoaded,isActive:o.isActive||n.isActive?!0:void 0})}return Array.from(e.values())}function MGr(t){let e=DW(t),r=!1;return e.map(n=>{if(!n.isActive)return n;if(!r)return r=!0,n;let{isActive:o,...i}=n;return i})}var qZ=v(()=>{});var Cfi,kLe,RGr=v(()=>{Xe();jLe();jZ();qZ();Cfi=["did-finish-load","page-favicon-updated","page-title-updated"],kLe=class t{constructor(e){this.lastActiveLeaf=null;this.activeWebTabState={activeWebTabForMentions:null,activeOrLastWebTab:null};this.activeWebTabLeaf=null;this.activeWebTabListeners=new Set;this.activeWebTabTrackingRefs=null;this.activeWebTabTrackingPreserveViewTypes=[];this.webviewLoadListeners=new Map;this.webviewLoadCallbacks=new Set;this.cancelScheduledWebviewLoadNotify=null;this.app=e.app,this.isSupportedPlatform=e.isSupportedPlatform,this.getActiveLeaf=e.getActiveLeaf,this.getLeaves=e.getLeaves,this.getPageInfo=e.getPageInfo}getLastActiveLeaf(){let e=this.lastActiveLeaf;return!e||!Fde(e)?(this.lastActiveLeaf=null,null):_Gr(this.app,e)?e:(this.lastActiveLeaf=null,null)}findLeafByUrl(e,r={}){let n=e.trim();if(!n)return null;let o=this.getLeaves();for(let c of o)if(c?.view?.url===n)return c;let i=kZ(n);if(!i)return null;let a=[];for(let c of o){let d=c?.view?.url;if(!d)continue;kZ(d)===i&&a.push(c)}if(a.length===0)return null;if(a.length===1)return a[0];let s=(r.title??"").trim();if(s){let c=s.toLowerCase(),d=[];for(let f of a)try{let m=(this.getPageInfo(f).title||"").trim();m&&m.toLowerCase()===c&&d.push(f)}catch{}if(d.length===1)return d[0];if(d.length>1){let f=this.getActiveLeaf();if(f&&d.includes(f))return f;let p=this.getLastActiveLeaf();return p&&d.includes(p)?p:(Te("[WebViewerStateManager] Multiple leaves matched URL + title; returning first match.",{url:n,title:s,matches:d.length}),d[0])}}let u=this.getActiveLeaf();if(u&&a.includes(u))return u;let l=this.getLastActiveLeaf();return l&&a.includes(l)?l:(Te("[WebViewerStateManager] Multiple leaves matched URL; returning first match as fallback.",{url:n,matches:a.length}),a[0])}getActiveWebTabState(){return this.activeWebTabState}subscribeActiveWebTabState(e){return this.activeWebTabListeners.add(e),()=>{this.activeWebTabListeners.delete(e)}}subscribeToWebviewLoad(e){return this.webviewLoadCallbacks.add(e),()=>{this.webviewLoadCallbacks.delete(e)}}startActiveWebTabTracking(e={}){this.activeWebTabTrackingRefs&&this.stopActiveWebTabTracking(),this.activeWebTabTrackingPreserveViewTypes=[...e.preserveOnViewTypes??[]];let r=this.app.workspace.on("active-leaf-change",o=>{try{Fde(o)&&(this.lastActiveLeaf=o)}catch(i){Te("WebViewerStateManager failed to track active leaf:",i)}this.recomputeActiveWebTabState({trigger:"active-leaf-change",activeLeaf:o}),this.subscribeToWebviewLoadEvents()}),n=this.app.workspace.on("layout-change",()=>{this.recomputeActiveWebTabState({trigger:"layout-change"}),this.subscribeToWebviewLoadEvents()});return this.activeWebTabTrackingRefs={activeLeafRef:r,layoutRef:n},this.recomputeActiveWebTabState({trigger:"active-leaf-change",activeLeaf:this.app.workspace.activeLeaf??null}),this.subscribeToWebviewLoadEvents(),this.activeWebTabTrackingRefs}subscribeToWebviewLoadEvents(){if(!this.isSupportedPlatform()){this.cleanupWebviewLoadListeners();return}try{let e=this.getLeaves(),r=new Set;for(let o of e){let i=o.view?.webview;if(i&&typeof i.addEventListener=="function"&&typeof i.removeEventListener=="function"){r.add(i);let a=this.webviewLoadListeners.get(i);if(a&&a.leaf===o)continue;if(a){for(let l of a.events)i.removeEventListener(l,a.handler);this.webviewLoadListeners.delete(i)}let s=()=>{this.recomputeActiveWebTabState({trigger:"webview-metadata",loadedLeaf:o}),this.scheduleWebviewLoadCallbackNotification()},u={leaf:o,handler:s,events:Cfi};for(let l of u.events)i.addEventListener(l,s);this.webviewLoadListeners.set(i,u)}}let n=[];for(let o of this.webviewLoadListeners.keys())r.has(o)||n.push(o);for(let o of n){let i=this.webviewLoadListeners.get(o);if(i){try{for(let a of i.events)o.removeEventListener(a,i.handler)}catch{}this.webviewLoadListeners.delete(o)}}}catch{}}cleanupWebviewLoadListeners(){for(let[e,{handler:r,events:n}]of this.webviewLoadListeners)try{if(typeof e.removeEventListener=="function")for(let o of n)e.removeEventListener(o,r)}catch{}this.webviewLoadListeners.clear()}scheduleWebviewLoadCallbackNotification(){if(this.cancelScheduledWebviewLoadNotify)return;let e=r=>{if(typeof window<"u"&&typeof window.requestAnimationFrame=="function"){let o=window.requestAnimationFrame(()=>r());return()=>window.cancelAnimationFrame(o)}let n=window.setTimeout(r,0);return()=>window.clearTimeout(n)};this.cancelScheduledWebviewLoadNotify=e(()=>{this.cancelScheduledWebviewLoadNotify=null,this.notifyWebviewLoadCallbacks()})}notifyWebviewLoadCallbacks(){for(let e of this.webviewLoadCallbacks)try{e()}catch{}}stopActiveWebTabTracking(){this.activeWebTabTrackingRefs=null,this.cleanupWebviewLoadListeners(),this.cancelScheduledWebviewLoadNotify?.(),this.cancelScheduledWebviewLoadNotify=null,this.activeWebTabState={activeWebTabForMentions:null,activeOrLastWebTab:null},this.activeWebTabLeaf=null,this.lastActiveLeaf=null,this.activeWebTabTrackingPreserveViewTypes=[]}recomputeActiveWebTabState(e){if(!this.isSupportedPlatform()){this.setActiveWebTabState({activeWebTabForMentions:null,activeOrLastWebTab:null}),this.activeWebTabLeaf=null;return}let r=this.getActiveLeaf();if(e.trigger==="webview-metadata"){let a=e.loadedLeaf;if(!(a===this.activeWebTabLeaf||a===r))return}let n=this.activeWebTabLeaf,o=this.activeWebTabState.activeWebTabForMentions;if(r)n=r,o=this.toWebTabContext(r);else if(e.trigger==="active-leaf-change"){let a=e.activeLeaf?.view?.getViewType();!!(a&&this.activeWebTabTrackingPreserveViewTypes.includes(a))||(n=null,o=null)}if(e.trigger!=="webview-metadata"&&n&&(this.getLeaves().includes(n)||(n=null,o=null)),e.trigger==="layout-change")n&&(o=this.toWebTabContext(n));else if(e.trigger==="webview-metadata"){let a=e.loadedLeaf;n=a,o=this.toWebTabContext(a)}this.activeWebTabLeaf=n;let i=this.computeActiveOrLastWebTabContext();this.setActiveWebTabState({activeWebTabForMentions:o,activeOrLastWebTab:i})}computeActiveOrLastWebTabContext(){try{let e=this.getActiveLeaf()??this.getLastActiveLeaf();return e?this.toWebTabContext(e):null}catch{return null}}toWebTabContext(e){try{let r=this.getPageInfo(e),n=(r.url||"").trim();if(!n)return null;let o=(r.title||"").trim(),i=(r.faviconUrl||"").trim();return{url:n,title:o||void 0,faviconUrl:i||void 0}}catch{return null}}setActiveWebTabState(e){let r=this.activeWebTabState;t.areWebTabContextsEqual(r.activeWebTabForMentions,e.activeWebTabForMentions)&&t.areWebTabContextsEqual(r.activeOrLastWebTab,e.activeOrLastWebTab)||(this.activeWebTabState=e,this.notifyActiveWebTabListeners())}notifyActiveWebTabListeners(){for(let e of this.activeWebTabListeners)try{e(this.activeWebTabState)}catch(r){Te("[WebViewerStateManager] Error in Active Web Tab listener:",r)}}static areWebTabContextsEqual(e,r){return e===r?!0:!e||!r?!1:e.url===r.url&&e.title===r.title&&e.faviconUrl===r.faviconUrl}}});var IGr,qLe,AGr=v(()=>{IGr=require("obsidian");Xe();Cbt();jLe();RGr();jZ();qLe=class{constructor(e){this.internalPluginApi=null;this.internalApiWarned=!1;this.app=e,this.stateManager=new kLe({app:e,isSupportedPlatform:()=>this.isSupportedPlatform(),getActiveLeaf:()=>this.getActiveLeaf(),getLeaves:()=>this.getLeaves(),getPageInfo:r=>FZ(r)})}isSupportedPlatform(){return IGr.Platform.isDesktopApp===!0}getAvailability(){let e=this.isSupportedPlatform()?"desktop":"mobile";return this.isSupportedPlatform()?this.getLeaves().length>0?{supported:!0,available:!0,platform:e}:this.getInternalPluginApi()?{supported:!0,available:!0,platform:e}:bGr(this.app,ALe.OPEN)?{supported:!0,available:!0,platform:e,reason:"No Web Viewer leaves open, but Web Viewer commands are registered."}:{supported:!0,available:!1,platform:e,reason:"Web Viewer does not appear available."}:{supported:!1,available:!1,platform:e,reason:"Web Viewer is not supported on mobile platforms."}}assertAvailable(){let e=this.getAvailability();if(!e.supported)throw new RLe(e.reason??"Web Viewer unsupported.");if(!e.available)throw new iS(e.reason??"Web Viewer is not available.")}getLeaves(){return this.isSupportedPlatform()?this.app.workspace.getLeavesOfType(NW):[]}getActiveLeaf(){let e=this.app.workspace.activeLeaf;return Fde(e)?e:null}getLastActiveLeaf(){return this.stateManager.getLastActiveLeaf()}async resolveLeaf(e={}){this.assertAvailable();let{strategy:r="active-or-last",focus:n=!1,requireWebviewReady:o=!1,timeoutMs:i=15e3}=e,a=this.getActiveLeaf();if(a)return n&&this.app.workspace.setActiveLeaf(a,{focus:!0}),o&&await this.waitForWebviewReady(a,i),a;if(r==="active-or-last"||r==="active-or-last-or-any"){let s=this.getLastActiveLeaf();if(s)return n&&this.app.workspace.setActiveLeaf(s,{focus:!0}),o&&await this.waitForWebviewReady(s,i),s}if(r==="active-or-last-or-any"){let s=this.getLeaves()[0];if(s)return n&&this.app.workspace.setActiveLeaf(s,{focus:!0}),o&&await this.waitForWebviewReady(s,i),s}throw new ILe("No Web Viewer leaf found.")}async waitForWebviewReady(e,r){let n=e.view;n.webviewMounted===void 0||n.webviewFirstLoadFinished===void 0||n.webviewMounted&&n.webviewFirstLoadFinished||await yGr(()=>!!(n.webviewMounted&&n.webviewFirstLoadFinished),r,100,"Waiting for Web Viewer webview ready")}findLeafByUrl(e,r={}){return this.stateManager.findLeafByUrl(e,r)}getActiveWebTabState(){return this.stateManager.getActiveWebTabState()}subscribeActiveWebTabState(e){return this.stateManager.subscribeActiveWebTabState(e)}subscribeToWebviewLoad(e){return this.stateManager.subscribeToWebviewLoad(e)}startActiveWebTabTracking(e={}){return this.stateManager.startActiveWebTabTracking(e)}stopActiveWebTabTracking(){this.stateManager.stopActiveWebTabTracking()}async executeCommand(e,r={}){let n=Sbt(this.app);if(!n)throw new iS("Command manager unavailable.");let{leaf:o,focusLeaf:i=!1}=r;o&&i&&this.app.workspace.setActiveLeaf(o,{focus:!0});try{if(n.executeCommandById(e)===!1)throw new iS(`Command returned false: ${e}`)}catch(a){throw ne(`Failed to execute command ${e}:`,a),new iS(`Failed to execute command ${e}: ${gGr(a)}`)}}getInternalPluginApi(){if(this.internalPluginApi)return this.internalPluginApi;let e=vGr(this.app,()=>{this.internalApiWarned||(this.internalApiWarned=!0,Te("[WebViewerService] internalPlugins.plugins has unexpected structure. Web Viewer integration may not work correctly."))});return e&&(this.internalPluginApi=e),e}getPageInfo(e){return FZ(e)}async getReaderModeMarkdown(e,r){return wGr(e,r)}async getSelectedText(e,r=!0){return $Le(e,r)}async getSelectedMarkdown(e){return LLe(e)}async getPageMarkdown(e){return SGr(e)}async getHtml(e,r=!0){return CGr(e,r)}getYouTubeVideoId(e){return FLe(e)}isYouTubeVideoUrl(e){return xGr(e)}async getYouTubeTranscript(e,r){return TGr(e,r)}async saveToVault(e,r={}){return OGr(e,(n,o)=>this.executeCommand(n,o),r)}}});var DGr={};En(DGr,{getWebViewerMarkdown:()=>xfi,getWebViewerPageInfo:()=>Efi,getWebViewerSelectedMarkdown:()=>Ofi,getWebViewerSelectedText:()=>Tfi,getWebViewerService:()=>_d,resolveWebViewerLeaf:()=>UZ,saveWebViewerToVault:()=>Pfi,startActiveWebTabTracking:()=>Tbt});function _d(t){let e=NGr.get(t);if(e)return e;let r=new qLe(t);return NGr.set(t,r),r}function Tbt(t,e){return _d(t).startActiveWebTabTracking(e)}async function UZ(t,e){return _d(t).resolveLeaf(e)}async function xfi(t,e){let r=await UZ(t,e);return _d(t).getReaderModeMarkdown(r)}async function Tfi(t,e=!0,r){let n=await UZ(t,r);return _d(t).getSelectedText(n,e)}async function Ofi(t,e){let r=await UZ(t,e);return _d(t).getSelectedMarkdown(r)}async function Efi(t,e){let r=await UZ(t,e);return _d(t).getPageInfo(r)}async function Pfi(t,e,r){let n=await UZ(t,{...r,focus:!0});return _d(t).saveToVault(n,e)}var NGr,jW=v(()=>{AGr();NGr=new WeakMap});var Efe=S((uen,Mke)=>{((t,e)=>{typeof define=="function"&&define.amd?define([],e):typeof Mke=="object"&&Mke.exports?Mke.exports=e():t.fuzzysort=e()})(uen,t=>{"use strict";var e=(L,W)=>{if(!L||!W)return K;var ie=p(L);X(W)||(W=f(W));var j=ie.bitflags;return(j&W._bitflags)!==j?K:h(ie,W)},r=(L,W,ie)=>{if(!L)return ie?.all?m(W,ie):Y;var j=p(L),A=j.bitflags,U=j.containsSpace,H=c(ie?.threshold||0),re=ie?.limit||B,Z=0,le=0,Ce=W.length;function He(so){Z<re?(de.add(so),++Z):(++le,so._score>de.peek()._score&&de.replaceTop(so))}if(ie?.key)for(var lt=ie.key,qe=0;qe<Ce;++qe){var Nt=W[qe],mt=k(Nt,lt);if(mt&&(X(mt)||(mt=f(mt)),(A&mt._bitflags)===A)){var Ot=h(j,mt);Ot!==K&&(Ot._score<H||(Ot.obj=Nt,He(Ot)))}}else if(ie?.keys){var je=ie.keys,Gr=je.length;e:for(var qe=0;qe<Ce;++qe){var Nt=W[qe];{for(var ct=0,ze=0;ze<Gr;++ze){var lt=je[ze],mt=k(Nt,lt);if(!mt){z[ze]=oe;continue}X(mt)||(mt=f(mt)),z[ze]=mt,ct|=mt._bitflags}if((A&ct)!==A)continue}if(U)for(let An=0;An<j.spaceSearches.length;An++)I[An]=Q;for(var ze=0;ze<Gr;++ze){if(mt=z[ze],mt===oe){V[ze]=oe;continue}if(V[ze]=h(j,mt,!1,U),V[ze]===K){V[ze]=oe;continue}if(U)for(let Si=0;Si<j.spaceSearches.length;Si++){if(N[Si]>-1e3&&I[Si]>Q){var ht=(I[Si]+N[Si])/4;ht>I[Si]&&(I[Si]=ht)}N[Si]>I[Si]&&(I[Si]=N[Si])}}if(U){for(let An=0;An<j.spaceSearches.length;An++)if(I[An]===Q)continue e}else{var $e=!1;for(let An=0;An<Gr;An++)if(V[An]._score!==Q){$e=!0;break}if(!$e)continue}var Ue=new s(Gr);for(let An=0;An<Gr;An++)Ue[An]=V[An];if(U){var Ve=0;for(let An=0;An<j.spaceSearches.length;An++)Ve+=I[An]}else{var Ve=Q;for(let Si=0;Si<Gr;Si++){var Ot=Ue[Si];if(Ot._score>-1e3&&Ve>Q){var ht=(Ve+Ot._score)/4;ht>Ve&&(Ve=ht)}Ot._score>Ve&&(Ve=Ot._score)}}if(Ue.obj=Nt,Ue._score=Ve,ie?.scoreFn){if(Ve=ie.scoreFn(Ue),!Ve)continue;Ve=c(Ve),Ue._score=Ve}Ve<H||He(Ue)}}else for(var qe=0;qe<Ce;++qe){var mt=W[qe];if(mt&&(X(mt)||(mt=f(mt)),(A&mt._bitflags)===A)){var Ot=h(j,mt);Ot!==K&&(Ot._score<H||He(Ot))}}if(Z===0)return Y;for(var Kt=new Array(Z),qe=Z-1;qe>=0;--qe)Kt[qe]=de.poll();return Kt.total=Z+le,Kt},n=(L,W="<b>",ie="</b>")=>{for(var j=typeof W=="function"?W:void 0,A=L.target,U=A.length,H=L.indexes,re="",Z=0,le=0,Ce=!1,He=[],lt=0;lt<U;++lt){var qe=A[lt];if(H[le]===lt){if(++le,Ce||(Ce=!0,j?(He.push(re),re=""):re+=W),le===H.length){j?(re+=qe,He.push(j(re,Z++)),re="",He.push(A.substr(lt+1))):re+=qe+ie+A.substr(lt+1);break}}else Ce&&(Ce=!1,j?(He.push(j(re,Z++)),re=""):re+=ie);re+=qe}return j?He:re},o=L=>{typeof L=="number"?L=""+L:typeof L!="string"&&(L="");var W=b(L);return u(L,{_targetLower:W._lower,_targetLowerCodes:W.lowerCodes,_bitflags:W.bitflags})},i=()=>{T.clear(),O.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((W,ie)=>W-ie)}set indexes(W){return this._indexes=W}highlight(W,ie){return n(this,W,ie)}get score(){return l(this._score)}set score(W){this._score=c(W)}}class s extends Array{get score(){return l(this._score)}set score(W){this._score=c(W)}}var u=(L,W)=>{let ie=new a;return ie.target=L,ie.obj=W.obj??K,ie._score=W._score??Q,ie._indexes=W._indexes??[],ie._targetLower=W._targetLower??"",ie._targetLowerCodes=W._targetLowerCodes??K,ie._nextBeginningIndexes=W._nextBeginningIndexes??K,ie._bitflags=W._bitflags??0,ie},l=L=>L===Q?0:L>1?L:Math.E**(((-L+1)**.04307-1)*-2),c=L=>L===0?Q:L>1?L:1-Math.pow(Math.log(L)/-2+1,1/.04307),d=L=>{typeof L=="number"?L=""+L:typeof L!="string"&&(L=""),L=L.trim();var W=b(L),ie=[];if(W.containsSpace){var j=L.split(/\s+/);j=[...new Set(j)];for(var A=0;A<j.length;A++)if(j[A]!==""){var U=b(j[A]);ie.push({lowerCodes:U.lowerCodes,_lower:j[A].toLowerCase(),containsSpace:!1})}}return{lowerCodes:W.lowerCodes,_lower:W._lower,containsSpace:W.containsSpace,bitflags:W.bitflags,spaceSearches:ie}},f=L=>{if(L.length>999)return o(L);var W=T.get(L);return W!==void 0||(W=o(L),T.set(L,W)),W},p=L=>{if(L.length>999)return d(L);var W=O.get(L);return W!==void 0||(W=d(L),O.set(L,W)),W},m=(L,W)=>{var ie=[];ie.total=L.length;var j=W?.limit||B;if(W?.key)for(var A=0;A<L.length;A++){var U=L[A],H=k(U,W.key);if(H!=K){X(H)||(H=f(H));var re=u(H.target,{_score:H._score,obj:U});if(ie.push(re),ie.length>=j)return ie}}else if(W?.keys)for(var A=0;A<L.length;A++){for(var U=L[A],Z=new s(W.keys.length),le=W.keys.length-1;le>=0;--le){var H=k(U,W.keys[le]);if(!H){Z[le]=oe;continue}X(H)||(H=f(H)),H._score=Q,H._indexes.len=0,Z[le]=H}if(Z.obj=U,Z._score=Q,ie.push(Z),ie.length>=j)return ie}else for(var A=0;A<L.length;A++){var H=L[A];if(H!=K&&(X(H)||(H=f(H)),H._score=Q,H._indexes.len=0,ie.push(H),ie.length>=j))return ie}return ie},h=(L,W,ie=!1,j=!1)=>{if(ie===!1&&L.containsSpace)return y(L,W,j);for(var A=L._lower,U=L.lowerCodes,H=U[0],re=W._targetLowerCodes,Z=U.length,le=re.length,qe=0,Ce=0,He=0;;){var lt=H===re[Ce];if(lt){if(E[He++]=Ce,++qe,qe===Z)break;H=U[qe]}if(++Ce,Ce>=le)return K}var qe=0,Nt=!1,mt=0,Ot=W._nextBeginningIndexes;Ot===K&&(Ot=W._nextBeginningIndexes=w(W.target)),Ce=E[0]===0?0:Ot[E[0]-1];var je=0;if(Ce!==le)for(;;)if(Ce>=le){if(qe<=0||(++je,je>200))break;--qe;var Gr=P[--mt];Ce=Ot[Gr]}else{var lt=U[qe]===re[Ce];if(lt){if(P[mt++]=Ce,++qe,qe===Z){Nt=!0;break}++Ce}else Ce=Ot[Ce]}var ct=Z<=1?-1:W._targetLower.indexOf(A,E[0]),ze=!!~ct,ht=ze?ct===0||W._nextBeginningIndexes[ct-1]===ct:!1;if(ze&&!ht){for(var $e=0;$e<Ot.length;$e=Ot[$e])if(!($e<=ct)){for(var Ue=0;Ue<Z&&U[Ue]===W._targetLowerCodes[$e+Ue];Ue++);if(Ue===Z){ct=$e,ht=!0;break}}}var Ve=An=>{for(var Si=0,Dl=0,Vi=1;Vi<Z;++Vi)An[Vi]-An[Vi-1]!==1&&(Si-=An[Vi],++Dl);var O_=An[Z-1]-An[0]-(Z-1);if(Si-=(12+O_)*Dl,An[0]!==0&&(Si-=An[0]*An[0]*.2),!Nt)Si*=1e3;else{for(var wg=1,Vi=Ot[0];Vi<le;Vi=Ot[Vi])++wg;wg>24&&(Si*=(wg-24)*10)}return Si-=(le-Z)/2,ze&&(Si/=1+Z*Z*1),ht&&(Si/=1+Z*Z*1),Si-=(le-Z)/2,Si};if(Nt)if(ht){for(var $e=0;$e<Z;++$e)E[$e]=ct+$e;var Kt=E,so=Ve(E)}else var Kt=P,so=Ve(P);else{if(ze)for(var $e=0;$e<Z;++$e)E[$e]=ct+$e;var Kt=E,so=Ve(Kt)}W._score=so;for(var $e=0;$e<Z;++$e)W._indexes[$e]=Kt[$e];W._indexes.len=Z;let iu=new a;return iu.target=W.target,iu._score=W._score,iu._indexes=W._indexes,iu},y=(L,W,ie)=>{for(var j=new Set,A=0,U=K,H=0,re=L.spaceSearches,Z=re.length,le=0,Ce=()=>{for(let ht=le-1;ht>=0;ht--)W._nextBeginningIndexes[R[ht*2+0]]=R[ht*2+1]},He=!1,ze=0;ze<Z;++ze){N[ze]=Q;var lt=re[ze];if(U=h(lt,W),ie){if(U===K)continue;He=!0}else if(U===K)return Ce(),K;var qe=ze===Z-1;if(!qe){var Nt=U._indexes,mt=!0;for(let $e=0;$e<Nt.len-1;$e++)if(Nt[$e+1]-Nt[$e]!==1){mt=!1;break}if(mt){var Ot=Nt[Nt.len-1]+1,je=W._nextBeginningIndexes[Ot-1];for(let $e=Ot-1;$e>=0&&je===W._nextBeginningIndexes[$e];$e--)W._nextBeginningIndexes[$e]=Ot,R[le*2+0]=$e,R[le*2+1]=je,le++}}A+=U._score/Z,N[ze]=U._score/Z,U._indexes[0]<H&&(A-=(H-U._indexes[0])*2),H=U._indexes[0];for(var Gr=0;Gr<U._indexes.len;++Gr)j.add(U._indexes[Gr])}if(ie&&!He)return K;Ce();var ct=h(L,W,!0);if(ct!==K&&ct._score>A){if(ie)for(var ze=0;ze<Z;++ze)N[ze]=ct._score/Z;return ct}ie&&(U=W),U._score=A;var ze=0;for(let ht of j)U._indexes[ze++]=ht;return U._indexes.len=ze,U},g=L=>L.replace(/\p{Script=Latin}+/gu,W=>W.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),b=L=>{L=g(L);for(var W=L.length,ie=L.toLowerCase(),j=[],A=0,U=!1,H=0;H<W;++H){var re=j[H]=ie.charCodeAt(H);if(re===32){U=!0;continue}var Z=re>=97&&re<=122?re-97:re>=48&&re<=57?26:re<=127?30:31;A|=1<<Z}return{lowerCodes:j,bitflags:A,containsSpace:U,_lower:ie}},_=L=>{for(var W=L.length,ie=[],j=0,A=!1,U=!1,H=0;H<W;++H){var re=L.charCodeAt(H),Z=re>=65&&re<=90,le=Z||re>=97&&re<=122||re>=48&&re<=57,Ce=Z&&!A||!U||!le;A=Z,U=le,Ce&&(ie[j++]=H)}return ie},w=L=>{L=g(L);for(var W=L.length,ie=_(L),j=[],A=ie[0],U=0,H=0;H<W;++H)A>H?j[H]=A:(A=ie[++U],j[H]=A===void 0?W:A);return j},T=new Map,O=new Map,E=[],P=[],R=[],I=[],N=[],z=[],V=[],k=(L,W)=>{var ie=L[W];if(ie!==void 0)return ie;if(typeof W=="function")return W(L);var j=W;Array.isArray(W)||(j=W.split("."));for(var A=j.length,U=-1;L&&++U<A;)L=L[j[U]];return L},X=L=>typeof L=="object"&&typeof L._bitflags=="number",B=1/0,Q=-B,Y=[];Y.total=0;var K=null,oe=o(""),ue=L=>{var W=[],ie=0,j={},A=U=>{for(var H=0,re=W[H],Z=1;Z<ie;){var le=Z+1;H=Z,le<ie&&W[le]._score<W[Z]._score&&(H=le),W[H-1>>1]=W[H],Z=1+(H<<1)}for(var Ce=H-1>>1;H>0&&re._score<W[Ce]._score;Ce=(H=Ce)-1>>1)W[H]=W[Ce];W[H]=re};return j.add=U=>{var H=ie;W[ie++]=U;for(var re=H-1>>1;H>0&&U._score<W[re]._score;re=(H=re)-1>>1)W[H]=W[re];W[H]=U},j.poll=U=>{if(ie!==0){var H=W[0];return W[0]=W[--ie],A(),H}},j.peek=U=>{if(ie!==0)return W[0]},j.replaceTop=U=>{W[0]=U,A()},j},de=ue();return{single:e,go:r,prepare:o,cleanup:i}})});var Hon={};En(Hon,{ContextCompactor:()=>zSt});var zSt,Won=v(()=>{Xe();CX();ta();zSt=class t{constructor(){this.MIN_ITEM_SIZE=5e4;this.MAX_CONCURRENCY=3;this.TEMPERATURE=.1;this.MAX_ITEM_SIZE=5e5;this.BLOCK_TYPES=["note_context","active_note","url_content","selected_text","embedded_note","embedded_pdf","web_tab_context","active_web_tab","youtube_video_context"];this.PROMPT=`Summarize the following content, preserving:
|
||
- Key concepts and main ideas
|
||
- Important facts, names, and dates
|
||
- Technical details relevant for Q&A
|
||
|
||
Keep the summary concise but information-dense. Output only the summary.
|
||
|
||
Title: {title}
|
||
Path: {path}
|
||
|
||
Content:
|
||
{content}
|
||
|
||
Summary:`;this.URL_BASED_TYPES=["url_content","web_tab_context","active_web_tab","youtube_video_context"];this.chatModelManager=tC.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async compact(e){let r=e.length;F(`[ContextCompactor] Starting compaction of ${r} chars`);let n=this.parseItems(e);if(n.length===0)return this.noOpResult(e);let o=await this.summarizeItems(n);if(o.size===0)return this.noOpResult(e);let i=this.rebuild(e,n,o);return F(`[ContextCompactor] Done: ${r} -> ${i.length} chars (${((1-i.length/r)*100).toFixed(0)}% reduction)`),{content:i,wasCompacted:!0,originalCharCount:r,compactedCharCount:i.length,itemsProcessed:n.length,itemsSummarized:o.size}}noOpResult(e){return{content:e,wasCompacted:!1,originalCharCount:e.length,compactedCharCount:e.length,itemsProcessed:0,itemsSummarized:0}}parseItems(e){let r=[];for(let n of this.BLOCK_TYPES){let o=new RegExp(`<${n}>[\\s\\S]*?<\\/${n}>`,"g"),i;for(;(i=o.exec(e))!==null;){let a=this.parseBlock(i[0],n,i.index);a&&r.push(a)}}return r.sort((n,o)=>n.startIndex-o.startIndex),r.filter((n,o)=>!r.some((i,a)=>o!==a&&i.startIndex<=n.startIndex&&i.endIndex>=n.endIndex))}parseBlock(e,r,n){let o=l=>new RegExp(`<${l}>([^<]*)</${l}>`).exec(e)?.[1]||"",i=()=>/<content>([\s\S]*?)<\/content>/.exec(e)?.[1]||"",a=o("path")||o("url"),s=o("title")||a.split("/").pop()||"Untitled",u=i();return{type:r,path:a,title:s,content:u,metadata:{ctime:o("ctime"),mtime:o("mtime")},originalXml:e,startIndex:n,endIndex:n+e.length}}async summarizeItems(e){let r=new Map,n=e.map((o,i)=>({index:i,item:o})).filter(({item:o})=>o.content.length>=this.MIN_ITEM_SIZE);if(n.length===0)return r;F(`[ContextCompactor] Summarizing ${n.length} items`);for(let o=0;o<n.length;o+=this.MAX_CONCURRENCY){let i=n.slice(o,o+this.MAX_CONCURRENCY);(await Promise.all(i.map(async({index:s,item:u})=>{try{return{index:s,summary:await this.summarize(u)}}catch(l){return F(`[ContextCompactor] Failed to summarize item ${s}:`,l),{index:s,summary:null}}}))).forEach(({index:s,summary:u})=>{u&&r.set(s,u)})}return r.size<n.length*.5?(F("[ContextCompactor] High failure rate, aborting compaction"),new Map):r}async summarize(e){let r=e.content;r.length>this.MAX_ITEM_SIZE&&(r=r.slice(0,this.MAX_ITEM_SIZE)+`
|
||
[TRUNCATED]`);let n=this.PROMPT.replace("{title}",e.title).replace("{path}",e.path).replace("{content}",r),i=await(await this.chatModelManager.getChatModelWithTemperature(this.TEMPERATURE)).invoke([new qs(n)]);return typeof i.content=="string"?i.content.trim():""}rebuild(e,r,n){let o=e;return Array.from(n.keys()).sort((i,a)=>a-i).forEach(i=>{let a=r[i],s=n.get(i),u=this.buildBlock(a,s);o=o.slice(0,a.startIndex)+u+o.slice(a.endIndex)}),o}buildBlock(e,r){let n=[`<${e.type}>`];if(e.title&&n.push(`<title>${e.title}</title>`),e.path){let o=this.URL_BASED_TYPES.includes(e.type)?"url":"path";n.push(`<${o}>${e.path}</${o}>`)}return e.metadata.ctime&&n.push(`<ctime>${e.metadata.ctime}</ctime>`),e.metadata.mtime&&n.push(`<mtime>${e.metadata.mtime}</mtime>`),n.push(`<content>[SUMMARIZED]
|
||
${r}</content>`),n.push(`</${e.type}>`),n.join(`
|
||
`)}}});var LCi={};En(LCi,{default:()=>WUe});module.exports=Bpe(LCi);mA();ra();Xe();var G_r=$(gH()),i9=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)||(F("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,G_r.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return F("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){F("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 F("Cache miss for file:",e),null}catch(r){return ne("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),F("Cached file content:",e)}catch(n){ne("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),F("Removed file from cache:",e))}catch(r){ne("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);F("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ne("Error clearing file cache:",e)}}};Xe();ob();Ye();var Q_r=$(gH()),WEe=require("obsidian"),evr=$(a9());$at();var xq=class xq{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new hH;this.handleFileEvent=e=>{e instanceof WEe.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=te().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=el({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});Hs(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),F(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ne("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,evr.default)(e=>{this.handleFileChange(e)},xq.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=i9.getInstance(),this.initializeEventListeners()}static getInstance(){return xq.instance||(xq.instance=new xq),xq.instance}cleanup(){this.debouncedHandleFileChange.cancel(),this.vault.off("create",this.handleFileEvent),this.vault.off("modify",this.handleFileEvent),this.vault.off("delete",this.handleFileEvent),this.vault.off("rename",this.handleFileEvent),this.projectMutexMap.clear()}initializeEventListeners(){this.vault.on("create",this.handleFileEvent),this.vault.on("modify",this.handleFileEvent),this.vault.on("delete",this.handleFileEvent),this.vault.on("rename",this.handleFileEvent)}async ensureCacheDir(){await this.vault.adapter.exists(this.cacheDir)||(F("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,Q_r.MD5)(e.id).toString()}getCachePath(e){return`${this.cacheDir}/${e}.json`}async getOrCreateProjectMutex(e){let r=e.id,n=this.projectMutexMap.get(r);return n||await this.mutexCreationMutex.runExclusive(async()=>{let o=this.projectMutexMap.get(r);if(o)return o;let i=new hH;return this.projectMutexMap.set(r,i),F(`Created new mutex for project: ${e.name} (ID: ${r})`),i})}async get(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);if(n)return F("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){F("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 F("Cache miss for project:",e.name),null}catch(r){return ne("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return F(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;F(`[getOrInitializeCache] Project ${e.name}: No existing cache found, building fresh context.`);let n=this.createEmptyCache();return await this.setWithoutMutex(e,n),n}getSync(e){try{let r=this.getCacheKey(e),n=this.memoryCache.get(r);return n?(F("Memory cache hit for project:",e.name),n):(F("Memory cache miss for project:",e.name),null)}catch(r){return ne("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&F(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(F(`Acquired cache lock for project: ${e.name}`),await this.setWithoutMutex(e,r)))}async setWithoutMutex(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);F("Caching context for project:",e.name);let i=JSON.parse(JSON.stringify(r));this.memoryCache.set(n,i),await this.vault.adapter.write(o,JSON.stringify(i))}catch(n){throw ne("Error writing to project context cache:",n),n}}createEmptyCache(){return{markdownContext:"",webContexts:{},youtubeContexts:{},fileContexts:{},timestamp:Date.now(),markdownNeedsReload:!0}}async clearAllCache(){try{let e=new Set;for(let r of Array.from(this.memoryCache.values()))if(r?.fileContexts)for(let n in r.fileContexts)r.fileContexts[n]?.cacheKey&&e.add(r.fileContexts[n].cacheKey);if(this.memoryCache.clear(),await this.vault.adapter.exists(this.cacheDir)){let r=await this.vault.adapter.list(this.cacheDir);F("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);F(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ne("Error clearing project context cache:",e)}}async clearForProject(e){try{F(`[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){F(`[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++):Te(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}F(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else F(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),F(`[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),F(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):F(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),F(`[clearForProject] Cleaned up mutex for project: ${e.name}`),F(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ne(`[clearForProject] Error for project ${e.name} (ID: ${e.id}):`,r)}}async invalidateMarkdownContext(e,r=!1){await this.updateCacheSafely(e,n=>{n.markdownContext="",n.markdownNeedsReload=!0,r&&(n.webContexts={},n.youtubeContexts={},F(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return F(`Invalidated markdown context for project ${e.name}`),o},!0)}async updateMarkdownContext(e,r){return await this.updateCacheSafely(e,n=>(n.markdownContext=r,n.markdownNeedsReload=!1,F(`Updated markdown context for project ${e.name}`),n))}async clearMarkdownContext(e){await this.updateCacheSafely(e,r=>(r.markdownContext="",r.markdownNeedsReload=!0,r))}async getOrReuseFileContext(e,r){try{let n=await this.getFileContext(e,r);if(n)return n;let o=await this.searchOtherProjectsForFile(r);return o?(await this.associateCacheWithProject(e,r,o.cacheKey),F(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ne(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ne("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 Te(`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"?(Te(`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 ne(`Error getting file context for ${r} in project ${e.name}:`,n),null}}async setFileContext(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>{o.fileContexts||(o.fileContexts={});let i=this.vault.getAbstractFileByPath(r);if(!(i instanceof WEe.TFile))throw new Error(`File not found: ${r}`);let a=this.fileCache.getCacheKey(i,e.id);return await this.fileCache.set(a,n),o.fileContexts[r]={timestamp:Date.now(),cacheKey:a},F(`Added/updated file context for ${r} in project ${e.name}`),o})}async removeFileContext(e,r){return await this.updateCacheSafelyAsync(e,async n=>{if(n.fileContexts&&n.fileContexts[r]){let{cacheKey:o}=n.fileContexts[r];delete n.fileContexts[r],await this.fileCache.remove(o),F(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=te().projectList||[];if(n.length===0)return null;F(`Searching other projects for file: ${e}`);for(let o of n){let i=await this.get(o);if(!(!i||!i.fileContexts)&&i.fileContexts[e]){let{cacheKey:a}=i.fileContexts[e];if(!a)continue;let s=await this.fileCache.get(a);if(s)return F(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return F(`No content found in any project for file: ${e}`),null}catch(r){return ne(`Error searching other projects for file ${e}:`,r),null}}async associateCacheWithProject(e,r,n){return await this.updateCacheSafelyAsync(e,async o=>(o.fileContexts||(o.fileContexts={}),o.fileContexts[r]={timestamp:Date.now(),cacheKey:n},F(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=el({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 WEe.TFile)||!Hs(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,F(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){F(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ne(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{F(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=el({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(Hs(s,n,o,!0)){if(r.fileContexts[s.path])continue;let u=this.fileCache.getCacheKey(s,e.id);r.fileContexts[s.path]={timestamp:Date.now(),cacheKey:u},a++}a>0&&F(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),F(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ne(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,n)}return r}updateProjectMarkdownFilesFromPatterns(e,r,n){try{r.fileContexts||(r.fileContexts={});let o=n.filter(a=>a.extension==="md"),i=0;for(let a of o){if(r.fileContexts[a.path])continue;let s=this.fileCache.getCacheKey(a,e.id);r.fileContexts[a.path]={timestamp:Date.now(),cacheKey:s},i++}i>0&&F(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),F(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ne(`[updateProjectFilesFromPatterns] Error for project ${e.name}:`,o)}return r}async removeWebUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.webContexts){for(let o of r)n.webContexts[o]&&delete n.webContexts[o];F(`Removed web contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateWebUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.webContexts||(o.webContexts={}),o.webContexts[r]=n,F(`Updated web context for URL ${r} in project ${e.name}`),o))}async removeYoutubeUrls(e,r){r.length&&await this.updateCacheSafely(e,n=>{if(n.youtubeContexts){for(let o of r)n.youtubeContexts[o]&&delete n.youtubeContexts[o];F(`removeYoutubeUrls: Removed YouTube contexts for URLs ${r.join(", ")} in project ${e.name}`)}return n})}async updateYoutubeUrl(e,r,n){return await this.updateCacheSafely(e,o=>(o.youtubeContexts||(o.youtubeContexts={}),o.youtubeContexts[r]=n,F(`Updated YouTube context for URL ${r} in project ${e.name}`),o))}async updateCacheSafely(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=r(i);await this.setWithoutMutex(e,a)}catch(i){throw ne(`Error updating cache for project ${e.name}:`,i),i}})}async updateCacheSafelyAsync(e,r,n=!1){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>{try{let i=await this.get(e);if(!i){if(n)return;throw new Error(`Project: ${e.name} context cache not found, please invoke getOrInitializeCache method before invoke update context cache`)}let a=await r(i);await this.setWithoutMutex(e,a)}catch(i){throw ne(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(F(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};xq.DEBOUNCE_DELAY=5e3;var Fw=xq;sd();mr();Xe();Xe();Bt();HEe();var bH=require("obsidian"),bA=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 ne(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await gl(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?(ne(`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 bH.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ne(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ne(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ne(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ne(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ne(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ne(`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 ne(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let i=Cq(n);return`data:${o};base64,${i}`}catch(n){return ne("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await gl(e,{method:"GET",headers:{}});if(!r.ok)return ne(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ne(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ne(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let i=Cq(o);return`data:${n};base64,${i}`}catch(r){return ne("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 bH.TFile))return ne(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ne(`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 ne(`Invalid MIME type: ${a}, path: ${n}`),null;let s=Cq(i);return`data:${a};base64,${s}`}catch(n){return ne("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 bH.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 bH.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}}:(ne(`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 ne(i),new Error(i)}return o}};bA.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],bA.MAX_IMAGE_SIZE=3*1024*1024,bA.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};var _H=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 ne("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await bA.isImageUrl(e,n))return null;let o=await bA.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ne(`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){ne("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 bA.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ne(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new bH.Notice(`Failed to process images:
|
||
${e.join(`
|
||
`)}`)}};mA();vO();Xe();Ye();var Rpo="https://api.firecrawl.dev/v2/search",Ipo="https://api.perplexity.ai/chat/completions",rvr="https://api.supadata.ai/v1/transcript",Apo=2e3,tvr=6e4;function nvr(){let t=te();switch(t.selfHostSearchProvider){case"perplexity":return!!t.perplexityApiKey;case"firecrawl":default:return!!t.firecrawlApiKey}}async function Npo(t,e){let r=Date.now(),n=await fetch(Rpo,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({query:t,limit:5})});if(!n.ok){let c=await n.text();throw new Error(`Firecrawl search failed (${n.status}): ${c}`)}let i=(await n.json())?.data,a=Array.isArray(i)?i:Array.isArray(i?.web)?i.web:[],s=[],u=[];for(let c of a){let d=c.title||"Untitled",f=c.description||"",p=c.url||"";s.push(`### ${d}
|
||
${f}
|
||
Source: ${p}`),p&&u.push(p)}let l=Date.now()-r;return F(`[selfHostWebSearch] Firecrawl: ${a.length} results in ${l}ms`),{content:s.join(`
|
||
|
||
`),citations:u}}async function Dpo(t,e){let r=await fetch(Ipo,{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({model:"sonar",messages:[{role:"user",content:t}]})});if(!r.ok){let a=await r.text();throw new Error(`Perplexity Sonar search failed (${r.status}): ${a}`)}let n=await r.json(),o=n?.choices?.[0]?.message?.content??"",i=Array.isArray(n?.citations)?n.citations:[];return{content:o,citations:i}}async function ovr(t){let e=te();switch(e.selfHostSearchProvider){case"perplexity":return Dpo(t,await oo(e.perplexityApiKey));case"firecrawl":default:return Npo(t,await oo(e.firecrawlApiKey))}}async function JEe(t){let e=Date.now(),r=await oo(te().supadataApiKey),n=`${rvr}?url=${encodeURIComponent(t)}&mode=auto&text=true`,o=await fetch(n,{method:"GET",headers:{"x-api-key":r,Accept:"application/json"}});if(o.status===200){let a=await o.json(),s=Date.now()-e;return F(`[selfHostYoutube4llm] transcript received in ${s}ms`),{response:{transcript:a.content||""},elapsed_time_ms:s}}if(o.status===201||o.status===202){let s=(await o.json()).job_id;if(!s)throw new Error("Supadata returned async status but no job_id");return await jpo(s,r,e)}let i=await o.text();throw new Error(`Supadata transcript request failed (${o.status}): ${i}`)}async function jpo(t,e,r){let n=Date.now()+tvr,o=`${rvr}/${t}`;for(;Date.now()<n;){await new Promise(s=>setTimeout(s,Apo));let i=await fetch(o,{method:"GET",headers:{"x-api-key":e,Accept:"application/json"}});if(i.status===200){let s=await i.json(),u=Date.now()-r;return F(`[selfHostYoutube4llm] async transcript completed in ${u}ms`),{response:{transcript:s.content||""},elapsed_time_ms:u}}if(i.status===202)continue;let a=await i.text();throw ne(`[selfHostYoutube4llm] poll failed (${i.status}): ${a}`),new Error(`Supadata poll failed (${i.status}): ${a}`)}throw new Error(`Supadata transcript timed out after ${tvr}ms`)}Bt();Xe();Fc();Ye();var s9=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Ql.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)}async processUrl(e){try{return await this.brevilabsClient.url4llm(e)}catch(r){let n=zr(r);return ne(`Error processing URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processYoutubeUrl(e){try{return{transcript:(o_()&&te().supadataApiKey?await JEe(e):await this.brevilabsClient.youtube4llm(e)).response.transcript}}catch(r){let n=zr(r);return ne(`Error processing YouTube URL ${e}: ${n}`),{transcript:"",error:n}}}async processTwitterUrl(e){try{return await this.brevilabsClient.twitter4llm(e)}catch(r){let n=zr(r);return ne(`Error processing Twitter URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processUrlList(e){let r="",n=[],o={};if(e.length===0)return{urlContext:r,imageUrls:n,processedErrorUrls:o};let i=e.map(async s=>{if(await bA.isImageUrl(s,app.vault))return n.push(s),{type:"image",url:s};if(E1t(s)){let l=this.mentions.get(s);if(!l||l.error){let c=await this.processYoutubeUrl(s);this.mentions.set(s,{type:"youtube",original:s,processed:c.transcript,error:c.error})}return{type:"youtube",data:this.mentions.get(s)}}if(P1t(s)){let l=this.mentions.get(s);if(!l||l.error){let c=await this.processTwitterUrl(s);this.mentions.set(s,{type:"twitter",original:s,processed:c.response,error:c.error})}return{type:"twitter",data:this.mentions.get(s)}}let u=this.mentions.get(s);if(!u||u.error){let l=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:l.response,error:l.error})}return{type:"url",data:this.mentions.get(s)}});return(await Promise.all(i)).forEach(s=>{if(s.type==="image")return;let u=s.data;u&&(u.processed&&(s.type==="youtube"?r+=`
|
||
|
||
<youtube_video_context>
|
||
<url>${u.original}</url>
|
||
<content>
|
||
${u.processed}
|
||
</content>
|
||
</youtube_video_context>`:s.type==="twitter"?r+=`
|
||
|
||
<twitter_content>
|
||
<url>${u.original}</url>
|
||
<content>
|
||
${u.processed}
|
||
</content>
|
||
</twitter_content>`:r+=`
|
||
|
||
<url_content>
|
||
<url>${u.original}</url>
|
||
<content>
|
||
${u.processed}
|
||
</content>
|
||
</url_content>`),u.error&&(o[u.original]=u.error))}),{urlContext:r,imageUrls:n,processedErrorUrls:o}}async processUrls(e){let r=this.extractUrls(e);return this.processUrlList(r)}getMentions(){return this.mentions}clearMentions(){this.mentions.clear()}};ob();Ye();Xe();var ivr=$(gH()),KEe=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)||(F("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,ivr.MD5)(r).toString();return F("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)){F("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return F("Cache miss for PDF:",e.path),null}catch(r){return ne("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);F("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ne("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);F("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ne("Error clearing PDF cache:",e)}}};Xe();BG();Fc();Ye();function DD(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 avr(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var YEe=require("obsidian");var svr=require("obsidian");var XEe,uvr,GEe=class{constructor(e){this.vault=e;cBe(this,XEe)}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 svr.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];dCt(this,XEe,uvr).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}};XEe=new WeakSet,uvr=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"})}};function $po(t,e){let r=e.adapter;if(r instanceof YEe.FileSystemAdapter)return r.getFullPath(t.path);let n=r;return typeof n.getFullPath=="function"?n.getFullPath(t.path):null}var ost=class{constructor(){this.miyoClient=new S0}async parsePdf(e,r){let n=te();if(!n.enableMiyo||e.extension.toLowerCase()!=="pdf")return null;let o=$po(e,r);if(!o)return Te(`[SelfHostPdfParser] Could not resolve absolute path for ${e.path}; cannot call Miyo parse-doc`),null;try{let i=await this.miyoClient.resolveBaseUrl(n.selfHostUrl),a=await this.miyoClient.parseDoc(i,o);if(typeof a.text!="string"||a.text.trim().length===0)throw new Error("Miyo parse-doc returned empty text");return F(`[SelfHostPdfParser] Parsed PDF via Miyo: ${e.path}`),a.text}catch(i){return Te(`[SelfHostPdfParser] Failed to parse ${e.path} via Miyo parse-doc: ${i instanceof Error?i.message:String(i)}`),null}}},ist=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},ZEe=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=KEe.getInstance(),this.selfHostPdfParser=new ost}async parseFile(e,r){try{F("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return F("Using cached PDF content for:",e.path),n.response;let o=te();if(o_()&&o.enableMiyo&&e.extension.toLowerCase()==="pdf"){let s=await this.selfHostPdfParser.parsePdf(e,r);return s!==null?(await this.pdfCache.set(e,{response:s,elapsed_time_ms:0}),s):(ne(`[PDFParser] Miyo enabled but parse-doc failed for ${e.path}`),`[Error: Could not extract content from PDF ${e.basename}]`)}let i=await r.readBinary(e);F("Calling pdf4llm API for:",e.path);let a=await this.brevilabsClient.pdf4llm(i);return await this.pdfCache.set(e,a),a.response}catch(n){return ne(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){F("Clearing PDF cache"),await this.pdfCache.clear()}},ast=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{F("Parsing Canvas file:",e.path);let n=new GEe(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ne(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},u9=class u9{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=Fw.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){u9.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(F(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ne("[Docs4LLMParser] No project context for parsing file: ",e.path),new Error("No project context provided for file parsing");let n=await this.projectContextCache.getOrReuseFileContext(this.currentProject,e.path);if(n)return F(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;F(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);F(`[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),F(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ne(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),DD(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-u9.lastRateLimitNoticeTime<6e4)return;u9.lastRateLimitNoticeTime=r;let n=avr(e);new YEe.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(){F("Cache clearing is now handled at the project level")}};u9.lastRateLimitNoticeTime=0;var Iae=u9,Tq=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new ist),this.registerParser(new Iae(e,o)),n||this.registerParser(new ZEe(e)),this.registerParser(new ast)}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 ZEe&&await e.clearCache()}};Bt();l1();var dW=require("obsidian");mA();ra();sd();mr();mr();Xe();Bt();var jD=class{constructor(e){this.chainManager=e}async handleResponse(e,r,n,o,i,a,s,u){if((e||u?.wasTruncated)&&!(n.signal.aborted&&n.signal.reason==="new-chat")){let p=r.contextEnvelope?.layers.find(g=>g.id==="L5_USER")?.text||r.originalMessage||r.message,m=s||e||"[Response truncated - no content generated]";await this.chainManager.memoryManager.saveContext({input:p},{output:m});let y={message:e||(u?.wasTruncated?"_[The response was truncated before any content could be generated. Try increasing the max tokens limit.]_":""),sender:cw,isVisible:!0,timestamp:Mg(new Date),sources:a,responseMetadata:u};o(y),i("")}else n.signal.reason==="new-chat"&&i("");let c=this.chainManager.memoryManager.getMemory().chatHistory.messages;F(`Chat memory updated:
|
||
`,{turns:Array.isArray(c)?c.length:0});let d=2e3;try{let{parseToolCallMarkers:f}=await Promise.resolve().then(()=>(dst(),lvr)),m=f(e).segments.map(y=>y.type==="text"?y.content:"").join("").trim();m||(m=e||"");let h=m.length>d?m.slice(0,d)+"... (truncated)":m;F(`Final AI response (truncated):
|
||
`,h)}catch{let f=typeof e=="string"?e:String(e??""),p=f.length>d?f.slice(0,d)+"... (truncated)":f;F(`Final AI response (truncated):
|
||
`,p)}return e}async handleError(e,r){let n=zr(e);ne("Error during LLM invocation:",n);let o=e?.response?.data?.error||n,i=o?.code||n,a="";e?.message?.includes("Invalid license key")?a="Invalid Copilot Plus license key. Please check your license key in settings.":i==="model_not_found"?a="You do not have access to this model or the model does not exist, please check with your API provider.":a=`${i}`,ne(o),r(this.enhancedErrorMsg(a,n,e))}enhancedErrorMsg(e,r,n){let o=e.search("Troubleshooting URL");return e=o!==-1?e.slice(0,o):e,this.isAuthenticationError(n,r)&&(e=`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: `+e),e}isAuthenticationError(e,r){let n=e?.response,o=n?.data?.error??e?.error,i=n?.status??o?.status,a=typeof i=="string"?Number.parseInt(i,10):i,s=typeof o=="object"&&o!==null?o:void 0,u=(typeof s?.message=="string"?s.message:r).toLowerCase(),l=typeof s?.code=="string"?s.code.toLowerCase():"",c=typeof s?.type=="string"?s.type.toLowerCase():"";return a===401?!0:["api key","apikey","unauthorized","authentication","invalid authentication"].some(f=>u.includes(f)||l.includes(f)||c.includes(f))}};mr();Xe();var _A=class{static convert(e,r={}){let{includeSystemMessage:n=!0,mergeUserContent:o=!0,debug:i=!1}=r,a=[],s=e.layers.find(f=>f.id==="L1_SYSTEM"),u=e.layers.find(f=>f.id==="L2_PREVIOUS"),l=e.layers.find(f=>f.id==="L3_TURN"),c=e.layers.find(f=>f.id==="L4_STRIP"),d=e.layers.find(f=>f.id==="L5_USER");if(n&&s&&s.text){let f=[s.text];u&&u.text&&(f.push(`
|
||
## Context Library
|
||
|
||
The following notes are available for reference:
|
||
|
||
`+u.text),i&&F("[LayerToMessagesConverter] Added L2 (cumulative context) to system")),a.push({role:"system",content:f.join(`
|
||
`)}),i&&F("[LayerToMessagesConverter] Added L1 (System) + L2 (Cumulative) as stable prefix")}if(c&&c.text&&i&&F("[LayerToMessagesConverter] L4 (Strip) found but skipped (using LangChain memory)"),o){let f=[];if(l&&l.segments.length>0&&u){let p=new Set(u.segments.map(y=>y.id)),m=[],h=[];for(let y of l.segments)p.has(y.id)?m.push(y.id):h.push(y);if(m.length>0||h.length>0){let y=[];m.length>0&&y.push(`Context attached to this message:
|
||
`+m.map(g=>`- ${g}`).join(`
|
||
`)+`
|
||
|
||
Find them in the Context Library in the system prompt above.`),h.length>0&&y.push(h.map(g=>g.content).join(`
|
||
`)),f.push(y.join(`
|
||
|
||
`)),i&&F(`[LayerToMessagesConverter] Added L3: ${m.length} references, ${h.length} new items`)}}else l&&l.text&&(f.push(l.text),i&&F("[LayerToMessagesConverter] Added L3 (all new context)"));f.length>0&&d&&d.text&&f.push(`---
|
||
|
||
[User query]:`),d&&d.text&&(f.push(d.text),i&&F("[LayerToMessagesConverter] Added L5 (user message)")),f.length>0&&a.push({role:"user",content:f.join(`
|
||
|
||
`)})}else l&&l.text&&a.push({role:"user",content:l.text}),d&&d.text&&a.push({role:"user",content:d.text});return i&&(F(`[LayerToMessagesConverter] Converted envelope to ${a.length} messages`),a.forEach((f,p)=>{let m=f.content.substring(0,100);F(` Message ${p+1} [${f.role}]: ${m}...`)})),a}static extractUserContent(e){let r=e.layers.find(i=>i.id==="L3_TURN"),n=e.layers.find(i=>i.id==="L5_USER"),o=[];return r&&r.text&&o.push(r.text),n&&n.text&&o.push(n.text),o.join(`
|
||
|
||
`)}static extractFullContext(e){let r=e.layers.find(a=>a.id==="L2_PREVIOUS"),n=e.layers.find(a=>a.id==="L3_TURN"),o=e.layers.find(a=>a.id==="L5_USER"),i=[];return r&&r.text&&i.push(r.text),n&&n.text&&i.push(n.text),o&&o.text&&i.push(o.text),i.join(`
|
||
|
||
`)}static extractSystemMessage(e){return e.layers.find(n=>n.id==="L1_SYSTEM")?.text||""}static getLayerHashes(e){return e.layerHashes}};Xe();Ye();Bt();Xe();function fst(t){let e=[];for(let r of t)if(r){if(typeof r._getType=="function"){let n=r._getType();n==="human"?e.push({role:"user",content:r.content}):n==="ai"&&e.push({role:"assistant",content:r.content})}else if(r.content!==void 0){let n=zpo(r);n&&e.push({role:n,content:r.content})}}return e}function zpo(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function Vpo(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(r=>r.type==="text").map(r=>r.text||"").join(" ")||"[Image content]":String(t||"")}function cvr(t){return t.map(e=>({role:e.role,content:Vpo(e.content)}))}async function Oq(t,e){let n=(await t.loadMemoryVariables({})).history||[],o=n.length?fst(n):[];for(let u of o)e.push({role:u.role,content:u.content});let i=0;for(let u of e)typeof u.content=="string"&&u.role==="system"&&(i+=u.content.length);let a=0;for(let u of o)typeof u.content=="string"&&(a+=u.content.length);let s=i+a;return s>2e6&&F("[Token Budget] Large payload detected (excluding user message):",{"L1+L2 (system)":`${Math.round(i/4e3)}k tokens`,"L4 (history)":`${Math.round(a/4e3)}k tokens (${o.length} msgs)`,total:`${Math.round(s/4e3)}k tokens`}),o}Xe();var yd=class t{constructor(){this.tools=new Map}static getInstance(){return t.instance||(t.instance=new t),t.instance}register(e){this.tools.set(e.metadata.id,e)}registerAll(e){e.forEach(r=>this.register(r))}getAllTools(){return Array.from(this.tools.values())}getEnabledTools(e,r){let n=[];for(let[o,i]of this.tools){let{metadata:a,tool:s}=i;if(a.isAlwaysEnabled){(!a.requiresVault||r)&&n.push(s);continue}e.has(o)&&(!a.requiresVault||r)&&n.push(s)}return n}getToolsByCategory(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.category;e.has(n)||e.set(n,[]),e.get(n).push(r)}return e}getConfigurableTools(){return Array.from(this.tools.values()).filter(e=>!e.metadata.isAlwaysEnabled)}getCopilotCommandMappings(){let e=new Map;for(let r of this.tools.values()){let n=r.metadata.copilotCommands;if(n)for(let o of n){let i=o.toLowerCase();e.has(i)||e.set(i,r)}}return e}getToolMetadata(e){return this.tools.get(e)?.metadata}getToolDefinition(e){return this.tools.get(e)}clear(){this.tools.clear()}};var l9=null;function Hpo(t){let e=new WeakSet;return JSON.stringify(t,(r,n)=>{if(typeof n=="object"&&n!==null){if(e.has(n))return"[Circular]";e.add(n)}return typeof n=="bigint"?n.toString():n},2)}function Wpo(t,e){let r=[];e&&(r.push(`msg:${e.messageId??"N/A"} | conv:${e.conversationId??"N/A"} | v${e.version}`),r.push(""));let n=yd.getInstance(),o=new Set(n.getAllTools().map(c=>c.tool.name)),i=c=>{let d=[],f=/<(\w+)>([\s\S]*?)<\/\1>/g,p;for(;(p=f.exec(c))!==null;){let m=p[1],h=p[2];if(o.has(m)){let y=h.length>200?h.substring(0,200).trim()+"...[truncated]":h.trim();d.push({tool:m,preview:y})}}return d},a=c=>typeof c.content=="string"?c.content:Array.isArray(c.content)?c.content.filter(f=>f.type==="text").map(f=>f.text).join(`
|
||
`):"",s=Array.isArray(t)?t:[],u=0;for(let c=0;c<s.length;c++){let d=s[c],f=a(d);if(d.role==="system"){r.push("\u2501\u2501\u2501 SYSTEM MESSAGE \u2501\u2501\u2501"),r.push("");let p=e?.layers.find(h=>h.id==="L1_SYSTEM"),m=e?.layers.find(h=>h.id==="L2_PREVIOUS");if(p&&f.includes(p.text)){let h=p.hash.substring(0,8);r.push(`\u{1F512} L1_SYSTEM (${h}) [CACHEABLE]`);let y=f.indexOf(p.text)+p.text.length,g=p.text.length>300?p.text.substring(0,300)+"...[truncated]":p.text;if(r.push(g),r.push(""),m&&m.text){let w=m.hash.substring(0,8);r.push(`\u{1F512} L2_PREVIOUS (${w}) [CACHEABLE]`);let T=m.text.length>300?m.text.substring(0,300)+"...[truncated]":m.text;r.push(T),r.push("")}let b=f.substring(y),_=i(b);if(_.length>0){r.push("--- PER-TURN ADDITIONS (not cached) ---"),r.push("");for(let w of _)r.push(`\u{1F4E6} TOOL: ${w.tool} (turn-specific RAG)`),r.push(w.preview),r.push("")}}else{let h=i(f);if(h.length>0){let y=f.match(/<(\w+)>/);if(y){let g=f.substring(0,y.index);if(g.trim()){let b=g.length>300?g.substring(0,300)+"...[truncated]":g;r.push(b),r.push("")}}r.push("--- PER-TURN ADDITIONS (not cached) ---"),r.push("");for(let g of h)r.push(`\u{1F4E6} TOOL: ${g.tool}`),r.push(g.preview),r.push("")}else{let y=f.length>300?f.substring(0,300)+"...[truncated]":f;r.push(y),r.push("")}}}else(d.role==="user"||d.role==="assistant")&&c<s.length-1&&u++}u>0&&(r.push("\u2501\u2501\u2501 CHAT HISTORY (L4) \u2501\u2501\u2501"),r.push(""),r.push(`${u} message(s)`),r.push(""));let l=s[s.length-1];if(l&&l.role==="user"){r.push("\u2501\u2501\u2501 USER MESSAGE \u2501\u2501\u2501"),r.push("");let c=a(l),d=i(c);if(d.length>0){r.push("--- PER-TURN TOOL RESULTS ---"),r.push("");for(let m of d)r.push(`\u{1F4E6} TOOL: ${m.tool}`),r.push(m.preview),r.push("")}let f=e?.layers.find(m=>m.id==="L3_TURN"),p=e?.layers.find(m=>m.id==="L5_USER");if(f&&f.text&&c.includes(f.text)){let m=f.hash.substring(0,8);r.push(`\u26A1 L3_TURN (${m})`);let h=f.text.length>300?f.text.substring(0,300)+"...[truncated]":f.text;r.push(h),r.push("")}if(p&&p.text&&c.includes(p.text)){let m=p.hash.substring(0,8);r.push(`\u26A1 L5_USER (${m})`),r.push(p.text),r.push("")}}return r.join(`
|
||
`)}function Eq(t){let{messages:e,modelName:r,contextEnvelope:n}=t;try{l9={timestamp:new Date().toISOString(),modelName:r,serializedMessages:Hpo(e),messagesArray:e,contextEnvelope:n}}catch{l9={timestamp:new Date().toISOString(),modelName:r,serializedMessages:String(e),messagesArray:e,contextEnvelope:n}}}function c9(){l9=null}async function QEe(){if(!l9)return;let{timestamp:t,modelName:e,serializedMessages:r,messagesArray:n,contextEnvelope:o}=l9,i=[`### Prompt \u2014 ${t}${e?` \u2014 ${e}`:""}`,"","**Actual Messages Sent to LLM:**","","```json",r,"```",""],a=Wpo(n,o);i.push("**Layered Context Metadata:**"),i.push(""),i.push("```"),i.push(a),i.push("```"),i.push(""),fye(i),l9=null}function dvr(t){let e=t.response_metadata||{};return e.finish_reason==="length"?{wasTruncated:!0,message:"Response truncated due to token limit"}:e.stop_reason==="max_tokens"?{wasTruncated:!0,message:"Response truncated due to max_tokens limit"}:e.finishReason==="MAX_TOKENS"||e.finish_reason==="MAX_TOKENS"?{wasTruncated:!0,message:"Response truncated due to MAX_TOKENS limit"}:{wasTruncated:!1,message:null}}function fvr(t){let e=t.response_metadata||{};return e.tokenUsage?{inputTokens:e.tokenUsage.promptTokens,outputTokens:e.tokenUsage.completionTokens,totalTokens:e.tokenUsage.totalTokens}:e.usage?{inputTokens:e.usage.input_tokens||e.usage.inputTokens||e.usage.inputTokenCount||e.usage.prompt_tokens,outputTokens:e.usage.output_tokens||e.usage.outputTokens||e.usage.outputTokenCount||e.usage.completion_tokens,totalTokens:e.usage.total_tokens||e.usage.totalTokens||(e.usage.input_tokens||e.usage.inputTokenCount||0)+(e.usage.output_tokens||e.usage.outputTokenCount||0)}:t.usage_metadata?{inputTokens:t.usage_metadata.input_tokens,outputTokens:t.usage_metadata.output_tokens,totalTokens:t.usage_metadata.total_tokens}:null}function Jpo(t){return`<errorChunk>${t}</errorChunk>`}function ePe(t,e){let r=Jpo(t);return e?`${e}
|
||
${r}`:`
|
||
${r}`}ta();Xe();function pst(t,e,r){return new Mh({content:r,tool_call_id:t,name:e})}function tPe(){let t=Date.now(),e=Math.random().toString(36).substring(2,11);return`call_${t}_${e}`}function rPe(t){let e=[];for(let r of t.values()){if(!r.name)continue;let n={};if(r.args)try{n=JSON.parse(r.args)}catch{ne(`[ToolCall] Failed to parse args for tool "${r.name}": ${r.args}`),n={}}e.push({id:r.id||tPe(),name:r.name,args:n})}return e}function pvr(t,e){return new Pn({content:t,tool_calls:e.map(r=>({id:r.id,name:r.name,args:r.args,type:"tool_call"}))})}Xe();var dv=class{constructor(e,r=!1){this.updateCurrentAiMessage=e;this.excludeThinking=r;this.hasOpenThinkBlock=!1;this.fullResponse="";this.errorResponse="";this.wasTruncated=!1;this.tokenUsage=null;this.hasHandledTextLevelThinkTag=!1;this.toolCallChunks=new Map;this.accumulatedToolCalls=[];F(`[ThinkBlockStreamer] Created with excludeThinking=${r}`)}handleTextLevelThinkTags(){let e=this.fullResponse.includes("</think>"),r=this.fullResponse.includes("<think>");if(e){if(this.excludeThinking){if(r)this.fullResponse=this.fullResponse.replace(/<think>[\s\S]*?<\/think>/g,"").trim();else{let n=this.fullResponse.indexOf("</think>");this.fullResponse=this.fullResponse.substring(n+8).trim()}return}!r&&!this.hasHandledTextLevelThinkTag&&(this.hasHandledTextLevelThinkTag=!0,Te("Detected </think> closing tag without opening <think> tag. This may indicate a misconfigured chat template in LM Studio. Adding opening tag."),this.fullResponse="<think>"+this.fullResponse)}}handleClaudeChunk(e){let r="",n=!1;for(let o of e)switch(o.type){case"text":r+=o.text;break;case"thinking":if(n=!0,this.excludeThinking)break;this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),o.thinking!==void 0&&(this.fullResponse+=o.thinking),this.updateCurrentAiMessage(this.fullResponse);break}return r&&this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),r&&(this.fullResponse+=r),n}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=e.content),e.additional_kwargs?.reasoning_content?(this.excludeThinking||(this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),e.additional_kwargs.reasoning_content!==void 0&&(this.fullResponse+=e.additional_kwargs.reasoning_content)),!0):!1}handleOpenRouterChunk(e){return e.additional_kwargs?.delta?.reasoning?(this.excludeThinking||(this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.delta.reasoning),!0):(typeof e.content=="string"&&e.content&&this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),typeof e.content=="string"&&e.content&&(this.fullResponse+=e.content),!1)}handleToolCallChunks(e){let r=e.tool_call_chunks;if(!(!r||!Array.isArray(r)))for(let n of r){let o=n.index??0,i=this.toolCallChunks.get(o)||{name:"",args:""};n.id&&(i.id=n.id),n.name&&(i.name+=n.name),n.args&&(i.args+=n.args),this.toolCallChunks.set(o,i)}}processChunk(e){dvr(e).wasTruncated&&(this.wasTruncated=!0);let n=fvr(e);n&&(this.tokenUsage=n),this.handleToolCallChunks(e);let o=Array.isArray(e.content)||e.additional_kwargs?.delta?.reasoning||e.additional_kwargs?.reasoning_details&&Array.isArray(e.additional_kwargs.reasoning_details)&&e.additional_kwargs.reasoning_details.length>0||e.additional_kwargs?.reasoning_content;this.hasOpenThinkBlock&&!o&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),Array.isArray(e.content)?this.handleClaudeChunk(e.content):e.additional_kwargs?.reasoning_content?this.handleDeepseekChunk(e):o?this.handleOpenRouterChunk(e):this.handleDeepseekChunk(e),this.handleTextLevelThinkTags(),this.updateCurrentAiMessage(this.fullResponse)}processErrorChunk(e){this.errorResponse=ePe(e)}getToolCalls(){return this.accumulatedToolCalls.length>0?this.accumulatedToolCalls:rPe(this.toolCallChunks)}hasToolCalls(){return this.toolCallChunks.size>0||this.accumulatedToolCalls.length>0}setToolCalls(e){this.accumulatedToolCalls=e}buildAIMessage(){let e=this.getToolCalls();return pvr(this.fullResponse,e)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>"),this.handleTextLevelThinkTags(),this.errorResponse&&(this.fullResponse+=this.errorResponse),this.updateCurrentAiMessage(this.fullResponse),{content:this.fullResponse,wasTruncated:this.wasTruncated,tokenUsage:this.tokenUsage}}};ra();var Aae=class extends jD{async constructMessages(e){if(!e.contextEnvelope)throw new Error("[LLMChainRunner] Context envelope is required but not available. Cannot proceed with LLM chain.");F("[LLMChainRunner] Using envelope-based context");let r=_A.convert(e.contextEnvelope,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),n=[],o=r.find(s=>s.role==="system");o&&n.push(o);let i=this.chainManager.memoryManager.getMemory();await Oq(i,n);let a=r.find(s=>s.role==="user");if(a)if(e.content&&Array.isArray(e.content)){let s=e.content.map(u=>u.type==="text"?{...u,text:a.content}:u);n.push({role:"user",content:s})}else n.push(a);return n}async run(e,r,n,o,i){let a=te(),s=B_(),u=!1;try{u=!qS(s,a.activeModels).capabilities?.includes("reasoning")}catch(f){F("Could not determine model capabilities, defaulting to include thinking blocks",f)}let l=new dv(n,u);try{let f=await this.constructMessages(e),m=this.chainManager.chatModelManager.getChatModel()?.modelName;Eq({messages:f,modelName:m,contextEnvelope:e.contextEnvelope}),F(`Final Request to AI:
|
||
`,f);let h=await Vb(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:r.signal}));for await(let y of h){if(r.signal.aborted){F("Stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(y)}}catch(f){f.name==="AbortError"||r.signal.aborted?F("Stream aborted by user",{reason:r.signal.reason}):await this.handleError(f,l.processErrorChunk.bind(l))}let c=l.close(),d={wasTruncated:c.wasTruncated,tokenUsage:c.tokenUsage??void 0};return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(await this.handleResponse(c.content,e,r,o,n,void 0,void 0,d),c.content)}};mr();Bt();async function nPe(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 Vb(async()=>{let i=await(await ry.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0)).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]),a=Rte(i.content);return _ye(a)})}Xe();Xe();Fc();Ye();Xe();Bt();ND();f9();var oPe=class extends Ux{constructor(r,n,o){super();this.lc_namespace=["self_host_retriever"];this.app=r,this.backend=n,this.options={...o,minSimilarityScore:o.minSimilarityScore??.01,salientTerms:o.salientTerms??[],returnAll:o.returnAll??!1}}async getRelevantDocuments(r,n){try{if(!await this.backend.isAvailable())return Te("SelfHostRetriever: Backend is not available"),[];let a=kS(r,this.app.vault).map(f=>f.basename),s=[...new Set([...this.options.salientTerms||[],...a])],u=this.buildFilter(),l=this.options.returnAll?100:this.options.maxK,c=await this.backend.search(r,{limit:l,minScore:this.options.minSimilarityScore,filter:u});F(`SelfHostRetriever: Found ${c.length} results for query "${r.substring(0,50)}..."`);let d=this.convertToDocuments(c);return s.length>0?this.boostBySalientTerms(d,s):d}catch(o){return Te(`SelfHostRetriever: Search failed: ${o}`),[]}}buildFilter(){let r={};return this.options.timeRange&&(r.mtime={gte:this.options.timeRange.startTime,lte:this.options.timeRange.endTime}),this.options.tagTerms&&this.options.tagTerms.length>0&&(r.tags={containsAny:this.options.tagTerms}),Object.keys(r).length>0?r:void 0}convertToDocuments(r){return r.map(n=>new tl({pageContent:n.content,metadata:{...n.metadata,score:n.score,rerank_score:n.score,id:n.id,source:"self_host"}}))}boostBySalientTerms(r,n){return r.map(a=>{let s=a.pageContent.toLowerCase(),u=(a.metadata?.title||"").toLowerCase();if(n.some(c=>s.includes(c.toLowerCase())||u.includes(c.toLowerCase()))){let c=(a.metadata?.score||0)*1.1;return new tl({pageContent:a.pageContent,metadata:{...a.metadata,score:c,rerank_score:c,salientBoost:!0}})}return a}).sort((a,s)=>(s.metadata?.score||0)-(a.metadata?.score||0))}getBackend(){return this.backend}};ND();f9();Xe();BG();NOe();Ye();wH();var bPe=class extends Ux{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["miyo_semantic_retriever"];this.client=new S0,this.returnAll=!!n.returnAll,this.maxK=Math.max(1,n.maxK),this.minSimilarityScore=n.minSimilarityScore??.1}async getRelevantDocuments(r,n){let o=await this.searchMiyo(r),i=this.deduplicateResults(o);return te().debug&&this.logDebugInfo(r,o,i),i}async searchMiyo(r){try{let n=await this.client.resolveBaseUrl(te().selfHostUrl),o=this.returnAll?ec:this.maxK,i=this.buildSearchFilters();te().debug&&F("MiyoSemanticRetriever: search params:",{baseUrl:n,limit:o,maxK:this.maxK,minSimilarityScore:this.minSimilarityScore,returnAll:this.returnAll,filters:i});let s=(await this.client.search(n,zG(this.app),r,o,i)).results||[],u=s.filter(l=>this.isScoreAboveThreshold(l));return te().debug&&F(`MiyoSemanticRetriever: received ${s.length} results, ${u.length} after threshold`),u.map(l=>this.toDocument(l))}catch(n){return Te(`MiyoSemanticRetriever: search failed: ${n}`),[]}}buildSearchFilters(){if(!this.options.timeRange)return;let{startTime:r,endTime:n}=this.options.timeRange;return[{field:"mtime",gte:r,lte:n}]}toDocument(r){let n=r.metadata??{},o=n.chunkId||(r.chunk_index!==void 0?`${r.path}#${r.chunk_index}`:void 0),i=typeof r.score=="number"?r.score.toFixed(2):"?";return new tl({pageContent:r.chunk_text??"",metadata:{...n,score:r.score,explanation:`miyo ${i}`,path:r.path,mtime:r.mtime,ctime:r.ctime,title:r.title??"",id:r.id,embeddingModel:r.embedding_model,tags:r.tags??[],extension:r.extension,created_at:r.created_at,nchars:r.nchars,chunkId:o}})}isScoreAboveThreshold(r){let n=r.score;return typeof n!="number"||Number.isNaN(n)?!0:n>=this.minSimilarityScore}deduplicateResults(r){let n=new Map,o=i=>{let a=this.getDocumentKey(i);n.has(a)||n.set(a,i)};return r.forEach(o),te().debug&&n.size!==r.length&&F(`MiyoSemanticRetriever: deduplicated semantic results from ${r.length} to ${n.size}`),Array.from(n.values())}logDebugInfo(r,n,o){F("*** MIYO SEMANTIC RETRIEVER DEBUG INFO: ***"),F("Query: ",r),F("Semantic Chunks: ",n),F("Deduplicated Chunks: ",o);let i=n.reduce((a,s)=>{let u=s.metadata?.score;return typeof u=="number"&&!Number.isNaN(u)?Math.max(a,u):a},0);F("Max Miyo Score: ",i)}getDocumentKey(r){let n=r.metadata??{};return n.chunkId||n.path||n.id||n.title||`${r.pageContent.slice(0,64)}::${r.pageContent.length}`}};jmt();wH();xX();function XDe(t){return{minSimilarityScore:t.minSimilarityScore??.1,maxK:t.maxK,salientTerms:t.salientTerms??[],timeRange:t.timeRange,textWeight:t.textWeight,returnAll:t.returnAll??!1,useRerankerThreshold:t.useRerankerThreshold,tagTerms:t.tagTerms??[]}}var fy=class fy{static registerSelfHostedBackend(e){fy.selfHostedBackend=e,F("RetrieverFactory: Self-hosted backend registered")}static clearSelfHostedBackend(){fy.selfHostedBackend=null,F("RetrieverFactory: Self-hosted backend cleared")}static hasSelfHostedBackend(){return fy.selfHostedBackend!==null}static async createRetriever(e,r,n){let o=n?{...te(),...n}:te(),i=XDe(r);if(fy.shouldUseMiyo(o)){let s=fy.createMiyoRetriever(e,r);return F("RetrieverFactory: Using MiyoSemanticRetriever (standalone)"),{retriever:s,type:"semantic",reason:"Miyo search is enabled"}}if(o_()){if(o.selfHostUrl){let u=await fy.getSelfHostedBackend(o);if(u){let l=new oPe(e,u,i);return F("RetrieverFactory: Using self-host mode backend"),{retriever:l,type:"self_hosted",reason:"Self-host mode is enabled and backend is available"}}Te("RetrieverFactory: Self-host mode backend unavailable, falling back")}else F("RetrieverFactory: Self-host mode enabled but URL not configured, falling back");if(o.enableSemanticSearchV3){let u=new K3(e,i);return F("RetrieverFactory: Using MergedSemanticRetriever (semantic search fallback for self-host mode)"),{retriever:u,type:"semantic",reason:"Self-host mode fallback to semantic search"}}let s=new uT(e,i);return F("RetrieverFactory: Using TieredLexicalRetriever (lexical search fallback for self-host mode)"),{retriever:s,type:"lexical",reason:"Self-host mode fallback to lexical search (semantic disabled)"}}if(o.enableSemanticSearchV3){let s=new K3(e,i);return F("RetrieverFactory: Using MergedSemanticRetriever (semantic search)"),{retriever:s,type:"semantic",reason:"Semantic search is enabled"}}let a=new uT(e,i);return F("RetrieverFactory: Using TieredLexicalRetriever (lexical search)"),{retriever:a,type:"lexical",reason:"Default lexical search"}}static createLexicalRetriever(e,r){return new uT(e,XDe(r))}static createSemanticRetriever(e,r){return fy.shouldUseMiyo(te())?fy.createMiyoRetriever(e,r):new K3(e,XDe(r))}static async getSelfHostedBackend(e){if(fy.selfHostedBackend)try{if(await fy.selfHostedBackend.isAvailable())return fy.selfHostedBackend;Te("RetrieverFactory: Registered backend is not available")}catch(r){Te("RetrieverFactory: Error checking backend availability:",r)}return Te("RetrieverFactory: No self-hosted backend available. Register a VectorSearchBackend implementation via RetrieverFactory.registerSelfHostedBackend()"),null}static getRetrieverType(e){let r=e?{...te(),...e}:te();return fy.shouldUseMiyo(r)?"semantic":o_()&&r.selfHostUrl&&fy.selfHostedBackend?"self_hosted":r.enableSemanticSearchV3?"semantic":"lexical"}static shouldUseMiyo(e){return e.enableMiyo&&e.enableSemanticSearchV3&&yH()}static isMiyoActive(){return fy.shouldUseMiyo(te())}static createMiyoRetriever(e,r){let n=XDe(r),o=n.returnAll?ec:Math.min(n.maxK*2,ec);return new bPe(e,{...n,maxK:o})}};fy.selfHostedBackend=null;var lT=fy;ZDe();YDe();Cst();Ye();Bt();var V4r=`CITATION RULES:
|
||
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
|
||
2. BE SELECTIVE: ONLY cite when introducing NEW factual claims, specific data, or direct quotes from sources
|
||
3. IMPORTANT: Do NOT cite every sentence or bullet point. This creates clutter and poor readability.
|
||
4. DO NOT cite for:
|
||
- General knowledge or common facts
|
||
- Your own analysis or synthesis
|
||
- Transitional or concluding statements
|
||
- Every single sentence (AVOID CITATION CLUTTER - aim for 1-3 citations per paragraph maximum)
|
||
5. Citations are for SOURCE ATTRIBUTION, not for proving every statement
|
||
6. GOOD: One citation per key concept. BAD: Citation after every sentence.
|
||
7. Place citations immediately after the specific claim: "The study found X [^1]" not "The study found X. [^1]"
|
||
8. Do not reuse any bracketed numbers that appear inside the source content itself
|
||
9. If multiple source chunks come from the same document, cite each relevant chunk separately (e.g., [^1] and [^2] can both be from the same document title)
|
||
10. End with '#### Sources' section containing: [^n]: [[Title]] (one per line, matching citation order)`,xti=`WEB CITATION RULES:
|
||
1. START with [^1] and increment sequentially ([^1], [^2], [^3], etc.) with NO gaps
|
||
2. Cite ONLY when introducing new factual claims, statistics, or direct quotes from the search results
|
||
3. After every cited claim, place the corresponding footnote immediately after the sentence ("The study found X [^1]")
|
||
4. End with '#### Sources' and provide definitions EXACTLY in this format: [^n]: [Short Title](URL)
|
||
|
||
IMPORTANT: Each source definition must follow this exact pattern:
|
||
- Start with [^n]: (where n is the citation number)
|
||
- Follow with [Title](URL) where Title is SHORT (2-5 words) and wrapped in square brackets
|
||
- Example: [^1]: [Paul Graham Essay](https://paulgraham.com/wealth.html)
|
||
- DO NOT write long descriptions - keep titles concise`;function H4r(t,e=!0){return e?`
|
||
|
||
<guidance>
|
||
${V4r}
|
||
|
||
IMAGE INCLUSION:
|
||
When the retrieved documents contain relevant images (in formats like  or ![[image.png]]), include them in your response at appropriate locations using their exact original markdown format from the source.
|
||
|
||
Source Catalog (for reference only):
|
||
${t.join(`
|
||
`)}
|
||
</guidance>`:`
|
||
|
||
<guidance>
|
||
IMAGE INCLUSION:
|
||
When the retrieved documents contain relevant images (in formats like  or ![[image.png]]), include them in your response at appropriate locations using their exact original markdown format from the source.
|
||
|
||
Source Catalog (for reference only):
|
||
${t.join(`
|
||
`)}
|
||
</guidance>`}function W4r(t,e=!0){return e?`
|
||
|
||
${V4r}
|
||
|
||
Source Catalog (for reference only):
|
||
${t}`:""}var Tti=20;function QDe(t,e,r=!0){if(!r||!e?.length||!t)return t||"";if(Oti(t))return t;let n=e.slice(0,Tti).map((o,i)=>{let a=(o.title||o.path||"Untitled").replace(/^\[\[|\]\]$/g,"");return`[^${i+1}]: [[${a}]]`}).join(`
|
||
`);return`${t}
|
||
|
||
#### Sources:
|
||
|
||
${n}`}function eje(t){if(!t)return"";let e=t.replace(/\[\^\d+\]/g,"");return e=e.replace(/\[(\d+(?:\s*,\s*\d+)*)\](?!\()/g,""),e=e.replace(/^\s*\[\^\d+\]:.*$/gm,""),e}function Oti(t){let e=t||"",r=/(^|\n)\s*#{1,6}\s*Sources\b/i.test(e),n=/(^|\n)\s*Sources\s*(?:[:-]\s*)?(\n|$)/i.test(e),o=/<summary[^>]*>\s*Sources\s*<\/summary>/i.test(e),i=/(^|\n)\s*\[\^\d+\]:\s*/.test(e);return r||n||o||i}function J4r(t){let e=t||"";return/\[\^\d+\]/.test(e)}function K4r(t=!0){return t?`
|
||
|
||
${xti}`:""}function Eti(t){let e=/([\s\S]*?)\n+(?:####\s*)?Sources\s*:?\s*\n+([\s\S]*)$/i,r=t.match(e);return r?{mainContent:r[1],sourcesBlock:(r[2]||"").trim()}:null}function Pti(t){return t.includes(`
|
||
`)||(t=t.replace(/\s*\[(\d+)\]\s*/g,`
|
||
[$1] `),t=t.replace(/\s+(\d+)\.\s/g,`
|
||
$1. `),t=t.trim()),t}function Mti(t){return t.split(`
|
||
`).map(e=>e.trim()).filter(e=>/^\[\^\d+\]:/.test(e))}function Rti(t,e){let r=new Map,n=new Set,o=[],i=/\[\^(\d+)\]/g,a;for(;(a=i.exec(t))!==null;){let s=parseInt(a[1],10);n.has(s)||(n.add(s),o.push(s))}if(o.length>0)o.forEach((s,u)=>r.set(s,u+1));else{let s=1;for(let u of e){let l=u.match(/^\[\^(\d+)\]:/);if(l){let c=parseInt(l[1],10);r.has(c)||r.set(c,s++)}}}return r}function Iti(t,e){let r=t,n;do n=!1,r=r.replace(/\[\^(\d+)\]/g,(o,i)=>{let a=parseInt(i,10),u=`[${e.get(a)??a}]`;return u!==o&&(n=!0),u}),r=r.replace(/\[\^(\d+(?:\s*,\s*\^?\d+)*)\]/g,(o,i)=>{let s=`[${i.split(",").map(u=>{let l=u.trim().replace(/^\^/,""),c=parseInt(l,10);return e.get(c)??c}).sort((u,l)=>u-l).map(u=>u.toString()).join(", ")}]`;return s!==o&&(n=!0),s});while(n);return r=r.replace(/\[(\d+)\]\./g,"[$1]"),r}function Ati(t,e){let r=[];return t.split(`
|
||
`).forEach(n=>{let o=n.match(/^\[\^(\d+)\]:\s*(.*)$/);if(!o)return;let i=parseInt(o[1],10),a=e.get(i)??i,s=o[2].match(/\[([^\]]+)\]\(([^)]+)\)/),u=o[2].match(/\[\[(.*?)\]\]/),l;if(s)l=`<a href="${s[2]}">${s[1]}</a>`;else if(u)l=`[[${u[1]}]]`;else{let c=o[2].match(/^(.*?)\]\s*\(([^)]+)\)\s*$/);if(c){let d=c[1].trim();l=`<a href="${c[2].trim()}">${d}</a>`}else l=o[2].replace(/\s*\([^)]*\)\s*$/,"")}r[a-1]=l}),r}function Nti(t){let e=[],r=new Set,n=new Map;return t.forEach((o,i)=>{if(!o)return;let a=o.match(/\[\[(.*?)\]\]/),s=a?a[1].toLowerCase():o.toLowerCase();if(!r.has(s))r.add(s),e.push(o),n.set(i+1,e.length);else{let u=e.findIndex(l=>{let c=l.match(/\[\[(.*?)\]\]/);return(c?c[1].toLowerCase():l.toLowerCase())===s});u>=0&&n.set(i+1,u+1)}}),{uniqueItems:e,consolidationMap:n}}function Dti(t,e){return e.size===0?t:t.replace(/\[(\d+(?:\s*,\s*\d+)*)\]/g,(r,n)=>`[${n.split(/\s*,\s*/).map(a=>{let s=parseInt(a,10);return String(e.get(s)||s)}).join(", ")}]`)}function jti(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $ti(t){return t!=null}function Lti(t){let e=t.split(`
|
||
`),r=[];return e.forEach(n=>{let o=n.trim();if(!o)return;let i=o.replace(/^<li>/i,"").replace(/<\/li>$/i,"").replace(/^[-*]\s*/,"").trim();if(!i)return;let a=i.match(/\[([^\]]+)\]\(([^)]+)\)/),s=i.match(/\[\[(.*?)\]\]/),u;a?u=`<a href="${a[2]}">${a[1]}</a>`:s?u=`[[${s[1]}]]`:u=jti(i),r.push({index:r.length+1,html:u})}),r}function z4r(t,e){let r=e.filter(o=>o.html.trim().length>0);if(r.length===0)return t;let n=r.map(({index:o,html:i})=>`<li class="copilot-sources__item"><span class="copilot-sources__index">[${o}]</span><span class="copilot-sources__text">${i}</span></li>`).join(`
|
||
`);return`${t}
|
||
|
||
<br/>
|
||
<details class="copilot-sources"><summary class="copilot-sources__summary">Sources</summary>
|
||
<ul class="copilot-sources__list">
|
||
${n}
|
||
</ul>
|
||
</details>`}function G4r(t,e=!0){if(!e)return t;let r=Eti(t);if(!r)return t;let{mainContent:n,sourcesBlock:o}=r;o=Pti(o);let i=Mti(o);if(i.length===0){let d=Lti(o);return z4r(n,d)}let a=Rti(n,i);n=Iti(n,a);let s=Ati(o,a),{uniqueItems:u,consolidationMap:l}=Nti(s);l.size>0&&(n=Dti(n,l),s=u);let c=s.map((d,f)=>d?{index:f+1,html:d}:null).filter($ti);return z4r(n,c)}function tje(t){return t.map(e=>{let r=e.title||e.path||"Untitled",n=e.path||r;return`- [[${r}]] (${n})`})}ra();var Cle=class extends jD{async run(e,r,n,o,i){let a=te(),s=B_(),u=!1;try{u=!qS(s,a.activeModels).capabilities?.includes("reasoning")}catch(p){F("Could not determine model capabilities, defaulting to include thinking blocks",p)}let l=new dv(n,u);try{let p=e.contextEnvelope;if(!p)throw new Error("[VaultQA] Context envelope is required but not available. Cannot proceed with VaultQA chain.");let h=p.layers.find(re=>re.id==="L5_USER")?.text||e.message,y=this.extractTagTerms(h);F("[VaultQA] Extracted tags before condensing:",y);let g=this.chainManager.memoryManager.getMemory(),b=await g.loadMemoryVariables({}),_=gye(b),w=h;_.length>0&&(F("[VaultQA] Condensing query with chat history for better retrieval"),w=await nPe(h,_),F("[VaultQA] Standalone question:",w));let T=te(),O=y.length>0,P=await new VU(app,{salientTerms:O?[...y]:[],maxK:Ly,returnAll:O}).getRelevantDocuments(w),R=lT.isMiyoActive(),I=await lT.createRetriever(app,{minSimilarityScore:.01,maxK:Ly,salientTerms:O?[...y]:[],tagTerms:y,returnAll:O},R?{enableMiyo:!1,enableSemanticSearchV3:!1}:{}),N=I.retriever;F(`VaultQA: Using ${I.type} retriever - ${I.reason}`);let z=await N.getRelevantDocuments(w),{filterResults:V,searchResults:k}=TX(P,z),X=[...V,...k],B=X.length>Ly,Q=X.slice(0,Ly);this.chainManager.storeRetrieverDocuments(Q);let Y=Q.map(re=>{let Z=re.metadata?.title||"Untitled",le=re.metadata?.path||Z;return`<${CWe}>
|
||
<title>${Z}</title>
|
||
<path>${le}</path>
|
||
<content>
|
||
${eje(re.pageContent)}
|
||
</content>
|
||
</${CWe}>`}).join(`
|
||
|
||
`),K=[],oe=this.chainManager.chatModelManager.getChatModel(),ue=Q.slice(0,Math.max(5,Math.min(20,Q.length))).map(re=>({title:re.metadata?.title||re.metadata?.path||"Untitled",path:re.metadata?.path||re.metadata?.title||""})),de=tje(ue).join(`
|
||
`),L=B?`
|
||
|
||
IMPORTANT: The retrieval limit of ${Ly} documents was reached. ${X.length-Ly} additional matching documents were omitted. Inform the user: "Note: The retrieval cap was reached \u2014 some matching documents were not included. Upgrade to Copilot Plus for more complete answers."`:"",W=`
|
||
|
||
Answer the question based only on the following context:
|
||
`+Y+W4r(de,T.enableInlineCitations)+L;F("[VaultQA] Using envelope-based context construction with LayerToMessagesConverter");let ie=_A.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),j=ie.find(re=>re.role==="system");j&&K.push({role:Mte(oe),content:j.content}),await Oq(g,K);let A=ie.find(re=>re.role==="user");if(A){let re=W+`
|
||
|
||
`+A.content;if(e.content&&Array.isArray(e.content)){let Z=e.content.map(le=>le.type==="text"?{...le,text:re}:le);K.push({role:"user",content:Z})}else K.push({role:"user",content:re})}let U=oe?.modelName;Eq({messages:K,modelName:U,contextEnvelope:e.contextEnvelope}),F(`Final Request to AI:
|
||
`,K);let H=await Vb(()=>this.chainManager.chatModelManager.getChatModel().stream(K,{signal:r.signal}));for await(let re of H){if(r.signal.aborted){F("VaultQA stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(re)}}catch(p){p.name==="AbortError"||r.signal.aborted?F("VaultQA stream aborted by user",{reason:r.signal.reason}):await this.handleError(p,l.processErrorChunk.bind(l))}let c=l.close(),d={wasTruncated:c.wasTruncated,tokenUsage:c.tokenUsage??void 0};if(r.signal.aborted&&r.signal.reason==="new-chat")return n(""),"";let f=this.addSourcestoResponse(c.content);return await this.handleResponse(f,e,r,o,n,void 0,void 0,d),f}addSourcestoResponse(e){let r=te();if(!J4r(e))return e;let n=this.chainManager.getRetrievedDocuments(),o=T1t(n).map(i=>({title:i}));return QDe(e,o,r.enableInlineCitations)}extractTagTerms(e){return h9(e)}};var OX=["@vault","@websearch","@composer","@memory"];mr();Xe();Fc();Ye();Ye();mr();Xe();XC();XC();Ye();var Qw=pF(),HU=bc([]),$mt=bc(""),X4r=bc(!1);function rje(){return L_(HU,{store:Qw})}function Z4r(){return u1($mt,{store:Qw})}function EX(){return Qw.get(HU)}function G3(){return Qw.get($mt)}function nje(t){Qw.set(HU,t)}function X3(t){let e=Qw.get(HU),r=e.findIndex(n=>n.title===t.title);if(r!==-1){let n=[...e];n[r]=t,Qw.set(HU,n)}else Qw.set(HU,[...e,t])}function PX(t){let e=Qw.get(HU);Qw.set(HU,e.filter(r=>r.title!==t))}function WU(t){Qw.set($mt,t)}function xle(t){Qw.set(X4r,t)}function Tle(){return Qw.get(X4r)}var Lmt=new Set;function JU(t){Lmt.add(t)}function KU(t){Lmt.delete(t)}function C$(t){return Lmt.has(t)}function oje(){return te().defaultSystemPromptTitle}function Y4r(){let t=EX(),e=G3();if(e){let n=t.find(o=>o.title===e);if(n)return n.content}let r=oje();if(r){let n=t.find(o=>o.title===r);if(n)return n.content}return""}function Q4r(){let t=oje();WU(t)}function Fmt(){xle(!1),WU("")}function ije(){return Y4r()||te()?.userSystemPrompt||""}function x$(){let t=ije();if(Tle())return t;let r=L1t;return t?`${r}
|
||
<user_custom_instructions>
|
||
${t}
|
||
</user_custom_instructions>`:r}async function T$(t){let e=x$();if(!t)return F("No UserMemoryManager provided to getSystemPromptWithMemory"),e;let r=await t.getUserMemoryPrompt();return r?`${r}
|
||
${e}`:e}var MX=require("obsidian");$r();Xe();Ye();function cT(){}cT.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(w){return w=a.postProcess(w,o),i?(setTimeout(function(){i(w)},0),!0):w}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(e2r(a,m[0].lastComponent,r,e,a.useLongestToken));var y=-1/0,g=1/0;function b(){for(var w=Math.max(y,-c);w<=Math.min(g,c);w+=2){var T=void 0,O=m[w-1],E=m[w+1];O&&(m[w-1]=void 0);var P=!1;if(E){var R=E.oldPos-w;P=E&&0<=R&&R<u}var I=O&&O.oldPos+1<l;if(!P&&!I){m[w]=void 0;continue}if(!I||P&&O.oldPos<E.oldPos?T=a.addToPath(E,!0,!1,0,o):T=a.addToPath(O,!1,!0,1,o),h=a.extractCommon(T,r,e,w,o),T.oldPos+1>=l&&h+1>=u)return s(e2r(a,T.lastComponent,r,e,a.useLongestToken));m[w]=T,T.oldPos+1>=l&&(g=Math.min(g,w-1)),h+1>=u&&(y=Math.max(y,w+1))}c++}if(i)(function w(){setTimeout(function(){if(c>d||Date.now()>p)return i();b()||w()},0)})();else for(;c<=d&&Date.now()<=p;){var _=b();if(_)return _}},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 e2r(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 Jps=new cT;function t2r(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 r2r(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 kmt(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 qmt(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 Ole(t,e){return kmt(t,e,"")}function aje(t,e){return qmt(t,e,"")}function n2r(t,e){return e.slice(0,Fti(t,e))}function Fti(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 sje="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}",kti=new RegExp("[".concat(sje,"]+|\\s+|[^").concat(sje,"]"),"ug"),lje=new cT;lje.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};lje.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(kti)||[];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};lje.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};lje.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)&&o2r(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&o2r(r,o,n,null),t};function o2r(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=t2r(o,a);t.value=qmt(t.value,a,u),e.value=Ole(e.value,u),r.value=Ole(r.value,u)}if(n){var l=r2r(i,s);n.value=kmt(n.value,s,l),e.value=aje(e.value,l),r.value=aje(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=t2r(c,d);e.value=Ole(e.value,p);var m=r2r(Ole(c,p),f);e.value=aje(e.value,m),n.value=kmt(n.value,c,m),t.value=qmt(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],y=e.value.match(/\s*$/)[0],g=n2r(y,h);e.value=aje(e.value,g)}else if(t){var b=t.value.match(/\s*$/)[0],_=e.value.match(/^\s*/)[0],w=n2r(b,_);e.value=Ole(e.value,w)}}var qti=new cT;qti.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(sje,"]+|[^\\S\\n\\r]+|[^").concat(sje,"]"),"ug");return t.match(e)||[]};function Uti(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 cje=new cT;cje.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};cje.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))),cT.prototype.equals.call(this,t,e,r)};function i2r(t,e,r){var n=Uti(r,{ignoreWhitespace:!0});return cje.diff(t,e,n)}var Bti=new cT;Bti.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var zti=new cT;zti.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function Umt(t){"@babel/helpers - typeof";return Umt=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},Umt(t)}var Ele=new cT;Ele.useLongestToken=!0;Ele.tokenize=cje.tokenize;Ele.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(Bmt(t,null,null,o),o," ")};Ele.equals=function(t,e,r){return cT.prototype.equals.call(Ele,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};function Bmt(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]=Bmt(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),Umt(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]=Bmt(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var uje=new cT;uje.tokenize=function(t){return t.slice()};uje.join=uje.removeEmpty=function(t){return t};function a2r(t,e,r){return uje.diff(t,e,r)}Or();var O$=require("obsidian"),Ft=$(J()),u2r=$(jm());Cn();var Ple=$(J());$r();var dT=Ple.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 Ple.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:we("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},Ple.createElement("div",{className:we("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")}))});dT.displayName="SettingSwitch";function s2r(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}Bt();function Vti(t,e){let r=o=>o.split(/(\s+)/).filter(Boolean);return a2r(r(t),r(e)).map(o=>({value:o.value.join(""),added:o.added,removed:o.removed}))}function Mle(t){let e=t.split(`
|
||
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function l2r(t){let e=[],r=0;for(;r<t.length;){let n=t[r];if(!n.added&&!n.removed)Mle(n.value).forEach(o=>{e.push({original:o,modified:o,isUnchanged:!0})}),r++;else if(n.removed){let o=t[r+1];if(o?.added){let i=Mle(n.value),a=Mle(o.value),s=Math.max(i.length,a.length);for(let u=0;u<s;u++)e.push({original:i[u]??null,modified:a[u]??null,isUnchanged:!1});r+=2}else Mle(n.value).forEach(i=>{e.push({original:i,modified:null,isUnchanged:!1})}),r++}else n.added&&Mle(n.value).forEach(o=>{e.push({original:null,modified:o,isUnchanged:!1})}),r++}return e}var c2r=(0,Ft.memo)(({original:t,modified:e,side:r})=>{let n=Vti(t,e);return Ft.default.createElement("span",null,n.map((o,i)=>{if(r==="original"){if(o.removed)return Ft.default.createElement("span",{key:i,className:"tw-bg-error tw-text-error"},o.value);if(o.added)return null}else{if(o.added)return Ft.default.createElement("span",{key:i,className:"tw-bg-success tw-text-success"},o.value);if(o.removed)return null}return Ft.default.createElement("span",{key:i},o.value)}))});c2r.displayName="WordDiffSpan";var Rle=(0,Ft.memo)(({row:t,side:e})=>{let r=e==="original"?t.original:t.modified,n=e==="original"?t.modified:t.original;return r===null?Ft.default.createElement("span",{className:"tw-text-muted"},"\xA0"):t.isUnchanged?Ft.default.createElement("span",{className:"tw-text-normal"},r||"\xA0"):n!==null?Ft.default.createElement(c2r,{original:t.original,modified:t.modified,side:e}):Ft.default.createElement("span",{className:e==="original"?"tw-bg-error tw-text-error":"tw-bg-success tw-text-success"},r||"\xA0")});Rle.displayName="DiffCell";var Ile="obsidian-copilot-apply-view",dje=class extends O$.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return Ile}getDisplayText(){return"Preview Changes"}async setState(r){this.state=r,this.render()}async onOpen(){this.render()}async onClose(){this.root&&(this.root.unmount(),this.root=null),this.state?.resultCallback?.(this.result?this.result:"aborted")}render(){if(!this.state)return;let r=this.containerEl.children[1];r.empty();let n=r.createDiv();this.root||(this.root=(0,u2r.createRoot)(n)),this.root.render(Ft.default.createElement(Hti,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},d2r=(0,Ft.memo)(({block:t})=>{let e=(0,Ft.useMemo)(()=>l2r(t),[t]);return Ft.default.createElement("div",{className:"tw-grid tw-grid-cols-2 tw-gap-2"},Ft.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},e.map((r,n)=>Ft.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},Ft.default.createElement(Rle,{row:r,side:"original"})))),Ft.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},e.map((r,n)=>Ft.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},Ft.default.createElement(Rle,{row:r,side:"modified"})))))});d2r.displayName="SideBySideBlock";var f2r=(0,Ft.memo)(({block:t})=>{let e=t.some(n=>n.added||n.removed),r=(0,Ft.useMemo)(()=>l2r(t),[t]);return e?Ft.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ft.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},Ft.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Original"),Ft.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.original!==null?Ft.default.createElement("div",{key:o},Ft.default.createElement(Rle,{row:n,side:"original"})):null))),Ft.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},Ft.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Modified"),Ft.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.modified!==null?Ft.default.createElement("div",{key:o},Ft.default.createElement(Rle,{row:n,side:"modified"})):null)))):Ft.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},t.map((n,o)=>Ft.default.createElement("span",{key:o},n.value)))});f2r.displayName="SplitBlock";var Hti=({app:t,state:e,close:r})=>{let[n,o]=(0,Ft.useState)(()=>e.changes.map(g=>({...g,accepted:null}))),[i,a]=(0,Ft.useState)(()=>te().diffViewMode??"split"),s=g=>{a(g),Re("diffViewMode",g)},u=s2r(n),l=(0,Ft.useRef)([]);if(!e||!e.changes)return ne("Invalid state:",e),Ft.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Ft.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Ft.default.createElement(pe,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let c=async()=>{try{let g=n.map(_=>_.accepted===null?{..._,accepted:!0}:_),b=await p(g);r(b?"accepted":"failed")}catch(g){ne("Error applying changes:",g),new O$.Notice(`Error applying changes: ${g.message}`),r("failed")}},d=async()=>{try{let g=n.map(_=>_.accepted===null?{..._,accepted:!1}:_),b=await p(g,!1);r(b?"rejected":"failed")}catch(g){ne("Error applying changes:",g),new O$.Notice(`Error applying changes: ${g.message}`),r("failed")}},f=async g=>{let b=t.vault.getAbstractFileByPath(g);if(b)return b;if(g.includes("/")){let _=g.split("/").slice(0,-1).join("/");await $c(_)}return await t.vault.create(g,"")},p=async(g,b=!0)=>{let _=g.filter(T=>T.added?T.accepted===!0:T.removed?T.accepted===!1:!0).map(T=>T.value).join(""),w=await f(e.path);return!w||!(w instanceof O$.TFile)?(ne("Error in getting file",e.path),new O$.Notice("Failed to create file"),!1):(await t.vault.modify(w,_),b&&new O$.Notice("Changes applied successfully"),!0)},m=g=>{if(!u)return;let b=-1;for(let _=g+1;_<u.length;_++){let w=u[_],T=w.some(E=>E.added||E.removed),O=w.some(E=>(E.added||E.removed)&&E.accepted===null);if(T&&O){b=_;break}}b!==-1&&l.current[b]&&l.current[b]?.scrollIntoView({behavior:"smooth",block:"center"})},h=g=>{o(b=>{let _=[...b],w=u?.[g];return w&&w.forEach(T=>{let O=_.findIndex(E=>E===T);O!==-1&&(_[O]={..._[O],accepted:!0})}),_}),setTimeout(()=>m(g),0)},y=g=>{o(b=>{let _=[...b],w=u?.[g];return w&&w.forEach(T=>{let O=_.findIndex(E=>E===T);O!==-1&&(_[O]={..._[O],accepted:!1})}),_}),setTimeout(()=>m(g),0)};return Ft.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Ft.default.createElement("div",{className:"tw-fixed tw-bottom-4 tw-left-1/2 tw-z-[9999] tw-flex tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-secondary tw-p-2 tw-shadow-lg"},Ft.default.createElement(pe,{variant:"destructive",size:"sm",onClick:d},Ft.default.createElement(qo,{className:"tw-size-4"}),"Reject"),Ft.default.createElement(pe,{variant:"success",size:"sm",onClick:c},Ft.default.createElement(Yu,{className:"tw-size-4"}),"Accept")),Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-border-b tw-border-solid tw-border-border tw-p-2"},Ft.default.createElement("div",{className:"tw-text-sm tw-font-medium"},e.path),Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement("span",{className:we("tw-text-xs",i==="split"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Split"),Ft.default.createElement(dT,{checked:i==="side-by-side",onCheckedChange:g=>s(g?"side-by-side":"split")}),Ft.default.createElement("span",{className:we("tw-text-xs",i==="side-by-side"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Side-by-side"))),Ft.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},u?.map((g,b)=>{let _=g.some(T=>T.added||T.removed),w=_?g.every(T=>!T.added&&!T.removed||T.accepted===!0)?"accepted":g.every(T=>!T.added&&!T.removed||T.accepted===!1)?"rejected":"undecided":"unchanged";return Ft.default.createElement("div",{key:b,ref:T=>l.current[b]=T,className:we("tw-mb-4 tw-overflow-hidden tw-rounded-md")},w==="accepted"?Ft.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"},g.filter(T=>!T.removed).map((T,O)=>Ft.default.createElement("div",{key:O},T.value))):w==="rejected"?Ft.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"},g.filter(T=>!T.added).map((T,O)=>Ft.default.createElement("div",{key:O},T.value))):i==="side-by-side"?Ft.default.createElement(d2r,{block:g}):Ft.default.createElement(f2r,{block:g}),_&&w==="undecided"&&Ft.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"},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement(pe,{variant:"destructive",size:"sm",onClick:()=>y(b)},Ft.default.createElement(qo,{className:"tw-size-4"}),"Reject"),Ft.default.createElement(pe,{variant:"success",size:"sm",onClick:()=>h(b)},Ft.default.createElement(Yu,{className:"tw-size-4"}),"Accept"))),_&&(w==="accepted"||w==="rejected")&&Ft.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"},Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ft.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},w==="accepted"?Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Ft.default.createElement(Yu,{className:"tw-size-4"}),Ft.default.createElement("div",null,"Accepted")):Ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Ft.default.createElement(qo,{className:"tw-size-4"}),Ft.default.createElement("div",null,"Rejected"))),Ft.default.createElement(pe,{variant:"secondary",size:"sm",onClick:()=>{o(T=>{let O=[...T],E=u?.[b];return E&&E.forEach(P=>{let R=O.findIndex(I=>I===P);R!==-1&&(O[R]={...O[R],accepted:null})}),O})}},"Revert"))))})))};nte();nte();mq();function cc(t){return oH(async e=>{let r=await t.func(e);return typeof r=="string"?r:JSON.stringify(r)},{name:t.name,description:t.description,schema:t.schema})}var hms={emptyParams:wt.object({}),stringParam:t=>wt.string().describe(t),numberParam:t=>wt.number().describe(t),booleanParam:t=>wt.boolean().describe(t),optionalString:t=>wt.string().optional().describe(t),nonEmptyString:t=>wt.string().min(1).describe(t),url:t=>wt.string().url().describe(t),email:t=>wt.string().email().describe(t)};Bt();Ye();Xe();async function p2r(t){let e=app.vault.getAbstractFileByPath(t);if(e&&e instanceof MX.TFile)return e;if(e&&!(e instanceof MX.TFile))throw new Error(`Path "${t}" exists but is not a file`);try{let r=t.includes("/")?t.split("/").slice(0,-1).join("/"):"";if(r&&await $c(r),e=app.vault.getAbstractFileByPath(t),e&&e instanceof MX.TFile)return e;if(e=await app.vault.create(t,""),!(e instanceof MX.TFile))throw new Error(`Failed to create file: unexpected type returned for "${t}"`);return e}catch(r){throw new Error(`Failed to get or create file "${t}": ${r.message}`)}}async function m2r(t,e){let r=await p2r(t),n=app.workspace.getActiveFile();r&&(!n||n.path!==t)&&await app.workspace.getLeaf().openFile(r);let o="";r&&(o=await app.vault.read(r));let i=i2r(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:Ile,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}var Wti=wt.object({path:wt.string().describe(`(Required) The path to the file to write to.
|
||
The path must end with explicit file extension, such as .md or .canvas .
|
||
Prefer to create new files in existing folders or root folder unless the user's request specifies otherwise.
|
||
The path must be relative to the root of the vault.`),content:wt.union([wt.string(),wt.object({}).passthrough()]).describe(`(Required) The content to write to the file. Can be either a string or an object.
|
||
ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions.
|
||
You MUST include ALL parts of the file, even if they haven't been modified.
|
||
|
||
# For string content
|
||
* Use when writing text files like .md, .txt, etc.
|
||
|
||
# For object content
|
||
* Use when writing structured data files like .json, .canvas, etc.
|
||
* The object will be automatically converted to JSON string format
|
||
|
||
# Canvas JSON Format (JSON Canvas spec 1.0)
|
||
Required node fields: id, type, x, y, width, height
|
||
Node types: "text" (needs text), "file" (needs file), "link" (needs url), "group" (optional label)
|
||
Optional node fields: color (hex #FF0000 or preset "1"-"6"), subpath (file nodes, starts with #)
|
||
Required edge fields: id, fromNode, toNode
|
||
Optional edge fields: fromSide/toSide ("top"/"right"/"bottom"/"left"), fromEnd/toEnd ("none"/"arrow"), color, label
|
||
All IDs must be unique. Edge nodes must reference existing node IDs.
|
||
|
||
Example:
|
||
{
|
||
"nodes": [
|
||
{"id": "1", "type": "text", "text": "Hello", "x": 0, "y": 0, "width": 200, "height": 50},
|
||
{"id": "2", "type": "file", "file": "note.md", "subpath": "#heading", "x": 250, "y": 0, "width": 200, "height": 100, "color": "2"},
|
||
{"id": "3", "type": "group", "label": "Group", "x": 0, "y": 100, "width": 300, "height": 150}
|
||
],
|
||
"edges": [
|
||
{"id": "e1-2", "fromNode": "1", "toNode": "2", "fromSide": "right", "toSide": "left", "color": "3", "label": "links to"}
|
||
]
|
||
}`),confirmation:wt.preprocess(t=>{if(typeof t=="string"){let e=t.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return t},wt.boolean()).optional().default(!0).describe("(Optional) Whether to ask for change confirmation with preview UI before writing changes. Default: true. Set to false to skip preview and apply changes immediately.")}),fje=cc({name:"writeToFile",description:`Request to write content to a file at the specified path and show the changes in a Change Preview UI.
|
||
|
||
# Steps to find the the target path
|
||
1. Extract the target file information from user message and find out the file path from the context.
|
||
2. If target file is not specified, use the active note as the target file.
|
||
3. If still failed to find the target file or the file path, ask the user to specify the target file.
|
||
`,schema:Wti,func:async({path:t,content:e,confirmation:r=!0})=>{let n=D1t(t);n!==t&&(Te(`Filename too long, truncated for filesystem compatibility: "${t}" \u2192 "${n}"`),t=n);let o=typeof e=="string"?e:JSON.stringify(e,null,2);if(te().autoAcceptEdits||r===!1)try{let u=await p2r(t);return await app.vault.modify(u,o),{result:"accepted",message:"File changes applied without preview. Do not retry or attempt alternative approaches to modify this file in response to the current user request."}}catch(u){return{result:"failed",message:`Error writing to file without preview: ${u?.message||u}`}}let s=await m2r(t,o);return{result:s,message:`File change result: ${s}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`}}}),Jti=wt.object({path:wt.string().describe("(Required) The path of the file to modify (relative to the root of the vault and include the file extension)."),diff:wt.string().describe(`(Required) One or more SEARCH/REPLACE blocks. Each block MUST follow this exact format with these exact markers:
|
||
|
||
------- SEARCH
|
||
[exact content to find, including all whitespace and indentation]
|
||
=======
|
||
[new content to replace with]
|
||
+++++++ REPLACE
|
||
|
||
WHEN TO USE THIS TOOL vs writeToFile:
|
||
- Use replaceInFile for: small edits, fixing typos, updating specific sections, targeted changes
|
||
- Use writeToFile for: creating new files, major rewrites, when you can't identify specific text to replace
|
||
|
||
CRITICAL RULES:
|
||
1. SEARCH content must match EXACTLY - every character, space, and line break
|
||
2. Use the exact markers: "------- SEARCH", "=======", "+++++++ REPLACE"
|
||
3. For multiple changes, include multiple SEARCH/REPLACE blocks in order
|
||
4. Keep blocks concise - include only the lines being changed plus minimal context
|
||
|
||
COMMON MISTAKES TO AVOID:
|
||
- Wrong: Using different markers like "---- SEARCH" or "SEARCH -------"
|
||
- Wrong: Including too many unchanged lines
|
||
- Wrong: Not matching whitespace/indentation exactly`)});function Ale(t){return t.replace(/\r\n/g,`
|
||
`).replace(/\r/g,`
|
||
`)}function Kti(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=Ale(t),s=Ale(e),u=Ale(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
|
||
`):l}var h2r=cc({name:"replaceInFile",description:"Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a LARGE file.",schema:Jti,func:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof MX.TFile))return`File not found at path: ${t}. Please check the file path and try again.`;try{let n=await app.vault.read(r),o=n;if(n.length<3e3)return"File is too small to use this tool. Please use writeToFile instead.";let a=Gti(e);if(a.length===0)return`No valid SEARCH/REPLACE blocks found in diff. Please use the correct format with ------- SEARCH, =======, and +++++++ REPLACE markers.
|
||
diff: ${e}`;let s=0;for(let c of a){let{searchText:d,replaceText:f}=c,p=Ale(o),m=Ale(d);if(!p.includes(m))if(p.includes(m.trimEnd()))d=d.trimEnd(),f=f.trimEnd();else return`Search text not found in file ${t} : "${d}".`;let h=o;o=Kti(o,d,f),o!==h&&s++}if(n===o)return`No changes made to ${t}. The search text was not found or replacement resulted in identical content. Call writeToFile instead`;if(te().autoAcceptEdits)try{return await app.vault.modify(r,o),{result:"accepted",blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) without preview. Do not call this tool again to modify this file in response to the current user request.`}}catch(c){return{result:"failed",blocksApplied:s,message:`Error applying changes without preview: ${c?.message||c}`}}let l=await m2r(t,o);return{result:l,blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) (replacing all occurrences). Result: ${l}. Do not call this tool again to modify this file in response to the current user request.`}}catch(n){return`Error performing SEARCH/REPLACE on ${t}: ${n}. Please check the file path and diff format and try again.`}}});function Gti(t){let e=[],r=/-{3,}\s*SEARCH\s*(?:\r?\n)?/,n=/(?:\r?\n)?={3,}\s*(?:\r?\n)?/,o=/(?:\r?\n)?\+{3,}\s*REPLACE/,i=new RegExp(r.source+"([\\s\\S]*?)"+n.source+"([\\s\\S]*?)"+o.source,"g"),a;for(;(a=i.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();e.push({searchText:s,replaceText:u})}return e}Xe();var zmt=t=>{switch(t){case"@vault":return"Search through your vault for relevant information";case"@websearch":return"Search the web for information";case"@composer":return"Edit existing notes or create new notes.";case"@memory":return"Save information to user memory";default:return""}},E$=class{static async callTool(e,r){if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(Te(`[ToolCall] Tool "${e.name}" returned null/undefined`),null)}};function g2r(t){let e=t.trim();if(!e)return"note";let r=e.match(/^\[\[([\s\S]+?)\]\]$/),n=r?r[1]:e,[o="",i=""]=n.split("|"),a=i.trim();if(a.length>0)return a;let s=o.trim(),[u]=s.split("#"),l=(u||s).trim()||e,c=l.split("/").filter(Boolean),d=c.length>0?c[c.length-1]:l;return d.replace(/\.[^/.]+$/,"")||d||"note"}var y2r=180;function Xti(t){let e=t.trim();return e.length<=y2r?e:`${e.slice(0,y2r)}\u2026`}function Zti(t){if(!t||typeof t!="object")return null;let e=typeof t.status=="string"?t.status:null,r=typeof t.message=="string"&&t.message.trim().length>0?Xti(t.message):null,n=typeof t.notePath=="string"?t.notePath:"",i=(typeof t.noteTitle=="string"&&t.noteTitle.trim().length>0?t.noteTitle.trim():g2r(n))||g2r(n);if(e==="invalid_path")return r??`\u26A0\uFE0F Invalid note path "${i}"`;if(e==="not_found")return r??`\u26A0\uFE0F Note "${i}" not found`;if(e==="not_unique"){let c=Array.isArray(t.candidates)?t.candidates.length:0;return r||(c>0?`\u26A0\uFE0F Multiple matches for "${i}" (${c} candidates)`:`\u26A0\uFE0F Multiple matches for "${i}"`)}if(e==="empty")return r??`\u26A0\uFE0F "${i}" contains no readable content`;if(e==="out_of_range"){if(r)return r;let c=typeof t.totalChunks=="number"&&Number.isFinite(t.totalChunks)?t.totalChunks:null,d=typeof t.chunkIndex=="number"&&Number.isFinite(t.chunkIndex)?t.chunkIndex:null;if(d!==null&&c!==null){let f=Math.max(c-1,0);return`\u26A0\uFE0F Chunk ${d} exceeds available range (max index ${f})`}return"\u26A0\uFE0F Requested chunk is out of range"}let a=typeof t.chunkIndex=="number"&&Number.isFinite(t.chunkIndex)?t.chunkIndex:0,s=typeof t.totalChunks=="number"&&Number.isFinite(t.totalChunks)?t.totalChunks:null,u=!!t.hasMore,l=[`\u2705 Read "${i||"note"}"`];return s&&s>0?l.push(`chunk ${a+1} of ${s}`):l.push(`chunk ${a+1}`),u&&l.push("more available"),l.join(" \xB7 ")}var P$=class{static format(e,r){try{let n=r;if(typeof n=="string"&&n.startsWith("ENC:"))try{n=decodeURIComponent(n.slice(4))}catch{}let o;try{o=JSON.parse(n)}catch{o=n}switch(e){case"localSearch":return this.formatLocalSearch(o);case"webSearch":return this.formatWebSearch(o);case"youtubeTranscription":return this.formatYoutubeTranscription(o);case"writeToFile":return this.formatWriteToFile(o);case"replaceInFile":return this.formatReplaceInFile(o);case"readNote":return this.formatReadNote(o);default:return r}}catch{return r}}static formatLocalSearchDocuments(e){if(!Array.isArray(e)||e.length===0)return`\u{1F4DA} Found 0 relevant notes
|
||
|
||
No matching notes found.`;let r=e.length,n=e.slice(0,10),o=n.some(s=>typeof s?.rerank_score=="number"||typeof s?.score=="number"||s?.source),i=n.map((s,u)=>o?this.formatSearchItem(s,u):this.formatBasicSearchItem(s,u)).join(`
|
||
|
||
`),a=r>10?`
|
||
|
||
... and ${r-10} more results`:"";return`\u{1F4DA} Found ${r} relevant notes
|
||
|
||
Top results:
|
||
|
||
${i}${a}`}static formatLocalSearch(e){if(typeof e=="string"){let n=e.match(/<localSearch[^>]*>([\s\S]*)<\/localSearch>/);if(n){let o=n[1].trim(),i=o.match(/<document>/g);if((i?i.length:0)===0)return`\u{1F4DA} Found 0 relevant notes
|
||
|
||
No matching notes found.`;let s=[],u=/<document>([\s\S]*?)<\/document>/g,l;for(;(l=u.exec(o))!==null;){let c=l[1],d=c.match(/<title>([\s\S]*?)<\/title>/),f=c.match(/<path>([\s\S]*?)<\/path>/),p=c.match(/<modified>([\s\S]*?)<\/modified>/),m=(d?.[1]||"Untitled").trim(),h=(f?.[1]||"").trim(),y=(p?.[1]||"").trim();s.push({title:m,path:h,mtime:y||null})}return this.formatLocalSearchDocuments(s)}}let r=this.parseSearchResults(e);return Array.isArray(r)?r.length===0?typeof e=="string"&&!e.includes("<localSearch")&&!e.includes('"type":"local_search"')?e:`\u{1F4DA} Found 0 relevant notes
|
||
|
||
No matching notes found.`:this.formatLocalSearchDocuments(r):typeof e=="string"?e:JSON.stringify(e,null,2)}static parseSearchResults(e){if(typeof e=="object"&&e!==null)return e.type==="local_search"&&Array.isArray(e.documents)?e.documents:[];if(typeof e=="string"){try{let r=JSON.parse(e);if(r&&r.type==="local_search"&&Array.isArray(r.documents))return r.documents}catch{}return[]}return[]}static formatSearchItem(e,r){let n=e.path?.split("/").pop()?.replace(/\.md$/,"")||e.title||"Untitled",o=e.rerank_score||e.score||0,i=typeof o=="number"?o.toFixed(4):o,a=e.source==="time-filtered"?"Recency":"Relevance",s=[`${r+1}. ${n}`];if(e.source==="time-filtered"){if(e.mtime)try{let l=new Date(e.mtime),c=isNaN(l.getTime())?String(e.mtime):l.toISOString();s.push(` \u{1F552} Modified: ${c}${e.includeInContext?" \u2713":""}`)}catch{s.push(` \u{1F552} Modified: ${String(e.mtime)}${e.includeInContext?" \u2713":""}`)}}else e.source==="title-match"?s.push(` \u{1F516} Title match${e.includeInContext?" \u2713":""}`):s.push(` \u{1F4CA} ${a}: ${i}${e.includeInContext?" \u2713":""}`);let u=this.extractContentSnippet(e.content);return u&&s.push(` \u{1F4AC} "${u}${e.content?.length>150?"...":""}"`),e.path&&!e.path.endsWith(`/${n}.md`)&&s.push(` \u{1F4C1} ${e.path}`),s.join(`
|
||
`)}static formatBasicSearchItem(e,r){let n=e.title||e.path||`Result ${r+1}`,o=[`${r+1}. ${n}`],i=e.mtime||e.modified||e.modified_at||e.updated_at;return i&&o.push(` \u{1F552} Modified: ${String(i)}`),e.path&&e.path!==n&&o.push(` \u{1F4C1} ${e.path}`),o.join(`
|
||
`)}static extractContentSnippet(e,r=150){return e?(e.match(/NOTE BLOCK CONTENT:\s*([\s\S]*)/)?.[1]||e).substring(0,r).replace(/\s+/g," ").trim():""}static formatWebSearch(e){if(Array.isArray(e)&&e.length>0&&e[0].type==="web_search"){let r=["\u{1F310} Web Search Results"],n=e[0];return n.content&&(r.push(""),r.push(n.content)),n.citations&&n.citations.length>0&&(r.push(""),r.push("Sources:"),n.citations.forEach((o,i)=>{r.push(`[${i+1}] ${o}`)})),n.instruction&&(r.push(""),r.push(`Note: ${n.instruction}`)),r.join(`
|
||
`)}if(typeof e=="string"){let r=e.split(`
|
||
`),n=["\u{1F310} Web Search Results"],o=!1,i=[],a=[];for(let s of r){if(s.includes("Sources:")){o=!0;continue}o?a.push(s):s.includes("Here are the web search results")||i.push(s)}return i.length>0&&(n.push(""),n.push(...i.filter(s=>s.trim()))),a.length>0&&(n.push(""),n.push("Sources:"),a.forEach(s=>{s.trim()&&n.push(s)})),n.join(`
|
||
`)}return e}static formatYoutubeTranscription(e){let r;if(typeof e=="string")try{r=JSON.parse(e)}catch{return e}else if(typeof e=="object")r=e;else return String(e);if(r.success===!1)return`\u{1F4FA} YouTube Transcription Failed
|
||
|
||
${r.message}`;if(r.results&&Array.isArray(r.results)){let n=[`\u{1F4FA} YouTube Transcripts (${r.total_urls} video${r.total_urls>1?"s":""})`];n.push("");for(let o of r.results){if(o.success){n.push(`\u{1F4F9} Video: ${o.url}`),n.push("");let i=o.transcript.split(`
|
||
`),a=0;for(let s of i)if(s.trim()&&(s.match(/^\[(\d+:\d+)\]/)?(a>0&&n.push(""),n.push(`\u23F0 ${s}`)):n.push(` ${s.trim()}`),a++,a>30)){n.push(""),n.push("... (transcript truncated for display)");break}o.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(o.elapsed_time_ms/1e3).toFixed(1)}s`))}else n.push(`\u274C Failed to transcribe: ${o.url}`),n.push(` ${o.message}`);n.push(""),n.push("---"),n.push("")}return n.join(`
|
||
`).trimEnd()}if(r.transcript){let n=["\u{1F4FA} YouTube Transcript"];n.push("");let o=r.transcript.split(`
|
||
`),i=0;for(let a of o)if(a.trim()&&(a.match(/^\[(\d+:\d+)\]/)?(i>0&&n.push(""),n.push(`\u23F0 ${a}`)):n.push(` ${a.trim()}`),i++,i>50)){n.push(""),n.push("... (transcript truncated for display)");break}return r.elapsed_time_ms&&(n.push(""),n.push(`Processing time: ${(r.elapsed_time_ms/1e3).toFixed(1)}s`)),n.join(`
|
||
`)}return typeof e=="object"?JSON.stringify(e,null,2):String(e)}static formatWriteToFile(e){let r=typeof e=="object"?e.result:e,n=String(r).toLowerCase();return n.includes("accepted")?"\u2705 File change: accepted":n.includes("rejected")?"\u274C File change: rejected":typeof e=="object"&&e.message?e.message:String(r)}static formatReplaceInFile(e){let r=0,n="";if(typeof e=="object")r=e.blocksApplied||0,n=e.result||"";else if(typeof e=="string"){let i=e.match(/Applied (\d+) SEARCH\/REPLACE block/);i&&(r=parseInt(i[1])),n=e}let o=String(n).toLowerCase();if(o.includes("accepted")){let i=r===1?"replacement":"replacements";return r>0?`\u2705 ${r} ${i} accepted`:"\u2705 File replacements: accepted"}else if(o.includes("rejected"))return r===0?"\u274C No replacements made":"\u274C File replacements: rejected";return typeof e=="object"&&e.message?e.message:String(n)}static formatReadNote(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch{r=null}let n=Zti(r);return n||(typeof e=="string"?e:JSON.stringify(e,null,2))}};Ye();ob();function Yti(t){return"children"in t&&"path"in t}function Qti(t){return"path"in t&&!("children"in t)}function eri(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function Vmt(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=el();for(let u of t.children)if(Qti(u)){if(Hs(u,i,a)){e&&r.push(u.name);let l=eri(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(Yti(u)){let l=Vmt(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 b2r=t=>cc({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:wt.object({}),func:async()=>{let e=Vmt(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=Vmt(t,!1);return r+JSON.stringify(o)}return r+n}});var RX=require("obsidian");Xe();Ye();Bt();ta();var GU=class{constructor(e){this.recentConversationsContent="";this.savedMemoriesContent="";this.isUpdatingMemory=!1;this.app=e}async loadMemory(){try{let e=this.app.vault.getAbstractFileByPath(this.getRecentConversationFilePath());e instanceof RX.TFile?this.recentConversationsContent=await this.app.vault.read(e):(this.recentConversationsContent="",F("[UserMemoryManager] Recent Conversations file not found, skipping memory load"));let r=this.app.vault.getAbstractFileByPath(this.getSavedMemoriesFilePath());r instanceof RX.TFile?this.savedMemoriesContent=await this.app.vault.read(r):(this.savedMemoriesContent="",F("[UserMemoryManager] Saved Memories file not found, skipping saved memory load"))}catch(e){ne("[UserMemoryManager] Error reading memory files:",e),this.recentConversationsContent="",this.savedMemoriesContent=""}}addRecentConversation(e,r){if(!te().enableRecentConversations){Te("[UserMemoryManager] Recent history referencing is disabled, skipping analysis");return}if(e.length===0){Te("[UserMemoryManager] No messages to analyze for user memory");return}this.updateMemory(e,r).catch(o=>{ne("[UserMemoryManager] Background user memory operation failed:",o)})}async updateSavedMemory(e,r){if(!te().enableSavedMemory)return{error:"Saved memory is disabled, skipping save"};if(!e||e.trim()==="")return{error:"No content provided for saved memory"};if(!r)return{error:"No chat model available, skipping save"};try{return await this.ensureMemoryFolderExists(),await this.updateSavedMemoryFile(this.getSavedMemoriesFilePath(),e,r)}catch(o){return{error:"Error saving memory: "+o.message}}}async getUserMemoryPrompt(){await this.loadMemory();try{let e=te(),r="";return e.enableRecentConversations&&this.recentConversationsContent&&(r+=`<recent_conversations>
|
||
${this.recentConversationsContent}
|
||
</recent_conversations>
|
||
|
||
The current time is ${this.getTimestamp()}.
|
||
<recent_conversations> are the recent conversations between you and the user.
|
||
You can use it to provide more context for your responses.
|
||
Only use the recent conversations if they are relevant to the current conversation.`),e.enableSavedMemory&&this.savedMemoriesContent&&(r+=`<saved_memories>
|
||
${this.savedMemoriesContent}
|
||
</saved_memories>
|
||
|
||
<saved_memories> are important memories that the user explicitly asked you to remember.
|
||
Use these memories to provide more personalized and contextually relevant responses.`),r.length>0?r:null}catch(e){return ne("[UserMemoryManager] Error reading user memory content:",e),null}}getTimestamp(){let e=new Date,r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0");return`${r}-${n}-${o} ${i}:${a}`}async createConversationSection(e,r){let{title:n,summary:o}=await this.extractTitleAndSummary(e,r),i=this.getTimestamp(),a=`## ${n}
|
||
`;return a+=`**Time:** ${i}
|
||
`,a+=`**Summary:** ${o}
|
||
`,a}async updateMemory(e,r){if(this.isUpdatingMemory){F("[UserMemoryManager] Memory update already in progress, skipping.");return}this.isUpdatingMemory=!0;try{if(await this.ensureMemoryFolderExists(),!r){ne("[UserMemoryManager] No chat model available, skipping memory update");return}if(e.length===0){F("[UserMemoryManager] No messages available, skipping memory update");return}let n=await this.createConversationSection(e,r);await this.addToRecentConversationsFile(this.getRecentConversationFilePath(),n)}catch(n){ne("[UserMemoryManager] Error analyzing chat messages for user memory:",n)}finally{this.isUpdatingMemory=!1}}async ensureMemoryFolderExists(){let r=te().memoryFolderName;await $c(r)}getRecentConversationFilePath(){return`${te().memoryFolderName}/Recent Conversations.md`}getSavedMemoriesFilePath(){return`${te().memoryFolderName}/Saved Memories.md`}async updateSavedMemoryFile(e,r,n){let o=this.app.vault.getAbstractFileByPath(e),i=o instanceof RX.TFile?await this.app.vault.read(o):"";if(!n)return{error:"No chat model available, skipping memory update"};let a=`You maintain a user's long-term personal memory list as concise bullet points.
|
||
|
||
You task is to update the user's memory list with the new statement.
|
||
Rules:
|
||
- Keep only stable, evergreen facts or preferences that will help future conversations.
|
||
- Remove duplicates and near-duplicates by merging them into one concise statement.
|
||
- If the new statement conflicts with older ones, keep the most recent truth and remove obsolete/conflicting entries.
|
||
- Prefer short, specific, and unambiguous phrasing.
|
||
- Preserve the language used in the input memories.
|
||
- Output only the memory content with each as a bullet point.
|
||
|
||
|
||
# OUTPUT FORMAT
|
||
Return the updated memory list with each as a bullet point.
|
||
- memory item 1
|
||
- memory item 2
|
||
- memory item 3
|
||
...
|
||
`,s=`<current_memories>
|
||
${i.trim()}
|
||
</current_memories>
|
||
|
||
<new_statement>
|
||
${r.trim()}
|
||
</new_statement>
|
||
`,u=[new Od(a),new qs(s)],l=null;try{l=(await n.invoke(u)).text??""}catch(c){return{error:"LLM call failed while updating saved memories: "+c.message}}return l==null||l.trim()===""?{error:"Empty content returned from LLM"}:(o instanceof RX.TFile?await this.app.vault.modify(o,l):await this.app.vault.create(e,l),{content:l})}async addToRecentConversationsFile(e,r){let n=this.app.vault.getAbstractFileByPath(e);if(n instanceof RX.TFile){let o=await this.app.vault.read(n),i;if(o.trim()==="")i=`${r.trim()}
|
||
`;else{let a=this.parseExistingConversations(o);a.push(r);let u=te().maxRecentConversations;a.length>u&&a.splice(0,a.length-u),i=`${a.map(c=>c.trim()).join(`
|
||
|
||
`)}
|
||
`}await this.app.vault.modify(n,i)}else{let o=`${r.trim()}
|
||
`;await this.app.vault.create(e,o)}}parseExistingConversations(e){let r=e.split(`
|
||
`),n=[],o=[];for(let i of r)i.trim().startsWith("## ")?(o.length>0&&n.push(o.join(`
|
||
`).trim()),o=[i]):o.length>0&&o.push(i);return o.length>0&&n.push(o.join(`
|
||
`).trim()),n}extractJsonFromResponse(e){let r=e.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);if(r)return r[1].trim();let n=e.match(/\{[\s\S]*\}/);return n?n[0]:e}async extractTitleAndSummary(e,r){let n=e.map(s=>`${s.sender}: ${s.message}`).join(`
|
||
|
||
`),o=`Your task is to analyze a conversation and generate both a title and a summary.
|
||
|
||
# OUTPUT FORMAT
|
||
You must return your response in the following JSON format:
|
||
{
|
||
"title": "Brief 2-8 word title capturing the main user intent",
|
||
"summary": "2-3 sentence summary at most including key details (e.g. user facts mentioned entities), and key conclusions if there are any."
|
||
}
|
||
|
||
# RULES
|
||
* Use the same language as the conversation`,i=`<conversation_text>
|
||
${n}
|
||
</conversation_text>
|
||
|
||
Generate a title and summary for this conversation:`,a=[new Od(o),new qs(i)];try{let u=(await r.invoke(a)).text,l=this.extractJsonFromResponse(u);try{let c=JSON.parse(l);return{title:c.title||"Untitled Conversation",summary:c.summary||"No summary available"}}catch(c){return ne("[UserMemoryManager] Failed to parse LLM response as JSON:",c),{title:"Untitled Conversation",summary:"Summary generation failed"}}}catch(s){return ne("[UserMemoryManager] Failed to extract title and summary:",s),{title:"Untitled Conversation",summary:"Summary generation failed"}}}};Xe();CX();var tri=wt.object({statement:wt.string().min(1).describe("The user statement for explicitly updating saved memories")}),pje=cc({name:"updateMemory",description:"Update the user memory when the user explicitly asks to update the memory",schema:tri,func:async({statement:t})=>{try{let e=new GU(app),r=tC.getInstance().getChatModel(),n=await e.updateSavedMemory(t,r);return n.error?{success:!1,message:n.error}:{success:!0,message:`Memory updated successfully into ${e.getSavedMemoriesFilePath()}: ${n.content}`}}catch(e){return ne("[updateMemoryTool] Error updating memory:",e),{success:!1,message:`Failed to save memory: ${e.message}`}}}});var Nle=require("obsidian");Xe();var Hmt=200;function mje(t){return t.replace(/\\/g,"/").toLowerCase()}function rri(t){return t.replace(/\.[^/.]+$/,"")}function nri(t,e){if(e.length===0)return!1;let n=mje(t).split("/").filter(Boolean);if(n.length<e.length)return!1;let o=n.slice(-e.length);for(let i=0;i<e.length;i+=1){let a=e[i];if(!a)return!1;let s=o[i];if(i===o.length-1){let u=rri(s);if(!s.includes(a)&&!u.includes(a))return!1}else if(!s.includes(a))return!1}return!0}function Wmt(t){return/\.[^/]+$/.test(t)}async function ori(t){let e=b=>{let _=app.vault.getAbstractFileByPath(b);return _ instanceof Nle.TFile?_:null},r=t.trim(),n=r.match(/^\s*\[\[([\s\S]+?)\]\]\s*$/),i=(n?n[1]:r).trim(),[a]=i.split("|"),[s]=a.split("#"),u=s.trim(),l=Array.from(new Set([r,i,u].map(b=>b.trim()).filter(Boolean)));for(let b of l){let _=e(b);if(_)return{type:"resolved",file:_};if(!Wmt(b))for(let w of[".md",".canvas"]){let T=e(`${b}${w}`);if(T)return{type:"resolved",file:T}}}let c=app.metadataCache,d=u.trim();if(c&&d){let b=new Set([d]);if(!Wmt(d))for(let _ of[".md",".canvas"])b.add(`${d}${_}`);for(let _ of b){let w=c.getFirstLinkpathDest?.(_,"");if(w instanceof Nle.TFile)return{type:"resolved",file:w}}}if(!d)return{type:"not_found"};let f=app.vault.getMarkdownFiles?.()??[];if(f.length===0)return{type:"not_found"};let p=mje(d),m=new Set([p]);if(!Wmt(d))for(let b of[".md",".canvas"])m.add(mje(`${d}${b}`));for(let b of f){let _=mje(b.path);if(m.has(_))return{type:"resolved",file:b}}let h=d.split("/").pop();if(h){let b=h.toLowerCase(),_=f.filter(w=>w.basename.toLowerCase()===b);if(_.length===1)return{type:"resolved",file:_[0]};if(_.length>1)return{type:"not_unique",matches:_}}let y=p.split("/").filter(Boolean);if(y.length===0)return{type:"not_found"};let g=f.filter(b=>nri(b.path,y));return g.length===1?{type:"resolved",file:g[0]}:g.length>1?{type:"not_unique",matches:g}:{type:"not_found"}}async function iri(t){try{return await app.vault.cachedRead(t)}catch(e){return Te(`readNote: failed to read ${t.path}`,e),""}}function ari(){let t=new Map,e=app.vault.getMarkdownFiles?.()??[];for(let r of e)if(r instanceof Nle.TFile){let n=t.get(r.basename)??[];n.push(r),t.set(r.basename,n)}return t}function sri(t,e,r){let n=t.trim();if(!n)return[];let o=new Map,i=app.metadataCache.getFirstLinkpathDest?.(n,e);if(i instanceof Nle.TFile&&o.set(i.path,i),!/\.[^./]+$/.test(n)){let a=n.split("/").pop()??n,s=r.get(a)??[];for(let u of s)o.set(u.path,u)}return Array.from(o.values())}function uri(t,e){if(!t)return[];let r=/\[\[([^\]]+)\]\]/g,n=new Map,o=null,i;for(;(i=r.exec(t))!==null;){if(i.index>0&&t[i.index-1]==="!")continue;let a=i[1]?.trim();if(!a)continue;let[s,u]=a.split("|"),[l,c]=s.split("#"),d=l?.trim();if(!d)continue;let f=`${d}|${u??""}|${c??""}`;if(n.has(f))continue;o||(o=ari());let p=sri(d,e.path,o);n.set(f,{linkText:d,displayText:u?.trim()||d,section:c?.trim()||void 0,candidates:p.map(m=>({path:m.path,title:m.basename})),unresolved:p.length===0?!0:void 0})}return Array.from(n.values())}function lri(t,e){let r=e.split(/\r?\n/),n=r.length===1&&r[0]===""?0:r.length;if(n===0)return[{id:`${t.path}#L1-1`,notePath:t.path,chunkIndex:0,content:"",heading:""}];let o=Math.ceil(n/Hmt),i=[];for(let a=0;a<o;a++){let s=a*Hmt,u=Math.min((a+1)*Hmt,n),l=r.slice(s,u),c=l.find(f=>/^#+\s+/.test(f.trim())),d=c?c.trim().replace(/^#+\s+/,""):"";i.push({id:`${t.path}#L${s+1}-${u}`,notePath:t.path,chunkIndex:a,content:l.join(`
|
||
`).trimEnd(),heading:d})}return i}var cri=wt.object({notePath:wt.string().min(1).describe("Full path to the note (relative to the vault root) that needs to be read, such as 'Projects/plan.md'."),chunkIndex:wt.preprocess(t=>{if(typeof t=="string"){let e=t.trim();if(e.length===0)return;let r=Number(e);return Number.isFinite(r)?r:t}return t},wt.number().int().min(0)).optional().describe("0-based chunk index to read. Omit to read the first chunk.")}),_2r=cc({name:"readNote",description:"Read a single note in search v3 sized chunks. Use only when you already know the exact note path and need its contents.",schema:cri,func:async({notePath:t,chunkIndex:e=0})=>{let r=t.trim();if(r.startsWith("/"))return{notePath:r,status:"invalid_path",message:"Provide the note path relative to the vault root without a leading slash."};let n=await ori(r);if(n.type==="not_found")return Te(`readNote: note not found or not a file (${r})`),{notePath:r,status:"not_found",message:`Note "${r}" was not found or is not a readable file.`};if(n.type==="not_unique")return Te(`readNote: ambiguous note path "${r}" matched multiple files`,n.matches.map(f=>f.path)),{notePath:r,status:"not_unique",message:`Multiple notes match "${r}". Provide a more specific path.`,candidates:n.matches.map(f=>({path:f.path,title:f.basename}))};let o=n.file,i=o.path,a=await iri(o),s=lri(o,a),u=s.length;if(u===0)return{notePath:i,status:"empty",message:`No readable content was found in "${i}".`};if(e>=u)return{notePath:i,status:"out_of_range",message:`Chunk index ${e} exceeds available chunks (last index ${u-1}).`,totalChunks:u};let l=s[e];F(`readNote: returning chunk ${l.chunkIndex} of ${u} for ${i}`);let c=l.chunkIndex<u-1,d=uri(l.content,o);return{notePath:i,noteTitle:o.basename,heading:l.heading,chunkId:l.id,chunkIndex:l.chunkIndex,totalChunks:u,hasMore:c,nextChunkIndex:c?l.chunkIndex+1:null,content:l.content,mtime:o.stat.mtime,linkedNotes:d.length>0?d:void 0}}});mr();mA();Xe();Fc();Ye();Xe();Fc();Ye();Bt();async function Jmt(t,e,r){try{if(!t||!t.name)return{toolName:t?.name||"unknown",result:"Error: Invalid tool call - missing tool name",success:!1};let o=e.find(c=>c.name===t.name);if(!o){let c=e.map(d=>d.name).join(", ");return{toolName:t.name,result:`Error: Tool '${t.name}' not found. Available tools: ${c}. Make sure you have the tool enabled in the Agent settings.`,success:!1}}let a=yd.getInstance().getToolMetadata(t.name);if(a?.isPlusOnly&&!await E0()&&!o_())return{toolName:t.name,result:`Error: ${hje(t.name)} requires a Copilot Plus subscription`,success:!1};let s={...t.args};a?.requiresUserMessageContent&&r&&(s._userMessageContent=r);let u=12e4;typeof a?.timeoutMs=="number"&&(u=a.timeoutMs);let l;return!u||u===1/0?l=await E$.callTool(o,s):l=await Promise.race([E$.callTool(o,s),new Promise((c,d)=>setTimeout(()=>d(new Error(`Tool execution timed out after ${u}ms`)),u))]),l==null?(Te(`Tool ${t.name} returned null/undefined result`),{toolName:t.name,result:JSON.stringify({message:"Tool executed but returned no result",status:"empty"}),success:!0}):{toolName:t.name,result:typeof l=="string"?l:JSON.stringify(l),success:!0}}catch(o){let i=zr(o);return i.includes("schema")?ne(`[ToolCall] Schema validation failed for "${t.name}". Args: ${JSON.stringify(t.args,null,2)}`):ne(`[ToolCall] Error executing "${t.name}": ${i}`),{toolName:t.name,result:`Error: ${i}`,success:!1}}}function hje(t){return t==="localSearch"?te().enableSemanticSearchV3?"vault search (semantic)":"vault search (index-free)":{webSearch:"web search",getFileTree:"file tree",getCurrentTime:"current time",getTimeRangeMs:"time range",getTimeInfoByEpoch:"time info",convertTimeBetweenTimezones:"timezone converter",startPomodoro:"pomodoro timer",pomodoroTool:"pomodoro timer",youtubeTranscription:"YouTube transcription",indexVault:"vault indexing",indexTool:"index",writeToFile:"file editor",replaceInFile:"file editor"}[t]||t}function Kmt(t){return{localSearch:"\u{1F50D}",webSearch:"\u{1F310}",getFileTree:"\u{1F4C1}",getCurrentTime:"\u{1F552}",getTimeRangeMs:"\u{1F4C5}",getTimeInfoByEpoch:"\u{1F570}\uFE0F",convertTimeBetweenTimezones:"\u{1F30D}",youtubeTranscription:"\u{1F4FA}",indexVault:"\u{1F4DA}",indexTool:"\u{1F4DA}",writeToFile:"\u270F\uFE0F",replaceInFile:"\u{1F504}",readNote:"\u{1F50D}"}[t]||"\u{1F527}"}function Gmt(t,e){let r=hje(t.name),n=Kmt(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";F(`${n} [Iteration ${e}] ${r.toUpperCase()}`),F("Parameters:",o),F("---")}function Xmt(t,e){if(t==="localSearch")return;let r=hje(t),n=Kmt(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";F(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300,a=String(e.result??"");a.length>i?F(`Result: ${a.substring(0,i)}... (truncated, ${a.length} chars total)`):a.length>0&&F("Result:",a)}function XU(t){let e=new Map;for(let r of t){let n=r.path||r.title,o=e.get(n);(!o||r.score>o.score)&&e.set(n,r)}return Array.from(e.values()).sort((r,n)=>n.score-r.score)}wH();xX();ZDe();YDe();function dri(t){let e=new Set,r=[],n=o=>{if(typeof o!="string")return;let i=o.toLowerCase().trim();i&&!e.has(i)&&(e.add(i),r.push(o.trim()))};return t.originalQuery&&typeof t.originalQuery=="string"&&n(t.originalQuery),(t.salientTerms||[]).forEach(n),(t.expandedQueries||[]).forEach(n),r}var Ymt=wt.object({query:wt.string().min(1).describe("The search query to find relevant notes"),salientTerms:wt.array(wt.string()).describe("Keywords extracted from the user's query for BM25 full-text search. Must be from original query."),timeRange:wt.object({startTime:wt.number().optional().describe("Start time as epoch milliseconds"),endTime:wt.number().optional().describe("End time as epoch milliseconds")}).optional().describe("Optional time range filter. Use epoch milliseconds from getTimeRangeMs result."),returnAll:wt.boolean().optional().describe("Set to true when the user wants ALL matching notes, not just the best few. Use for requests like 'find all my X', 'list every Y', 'show me all my Z', 'how many notes about W'. Returns up to 100 results instead of default 30. Leave false/undefined for normal questions."),_preExpandedQuery:wt.object({originalQuery:wt.string(),salientTerms:wt.array(wt.string()),expandedQueries:wt.array(wt.string()),recallTerms:wt.array(wt.string())}).optional().describe("Internal: pre-expanded query data injected by the system to avoid double expansion")});async function Zmt({timeRange:t,query:e,salientTerms:r,forceLexical:n=!1,preExpandedQuery:o,returnAll:i=!1}){let a=r.filter(P=>P.startsWith("#")),s=i||t!==void 0||a.length>0,u=s?ec:Ly;F(`lexicalSearch useExpandedLimits: ${s} (timeRange: ${!!t}, tags: ${a.length>0}, explicit: ${i}), forceLexical: ${n}`);let l=o?{...o,queries:[o.originalQuery,...o.expandedQueries||[]].filter(Boolean)}:void 0,c=new VU(app,{salientTerms:r,timeRange:t,maxK:u,returnAll:s}),d=await c.getRelevantDocuments(e);F(`lexicalSearch filterRetriever returned ${d.length} filter docs`);let f=[],p;if(!c.hasTimeRange()){let P={minSimilarityScore:s?0:.1,maxK:u,salientTerms:r,textWeight:Sye,returnAll:s,useRerankerThreshold:.5,tagTerms:a,preExpandedQuery:l},R,I;if(n)R=lT.createLexicalRetriever(app,P),I="lexical (forced)";else{let N=await lT.createRetriever(app,P);R=N.retriever,I=N.type}if(F(`lexicalSearch using ${I} retriever`),f=await R.getRelevantDocuments(e),R instanceof uT){let N=R.getLastQueryExpansion();N&&(p={originalQuery:N.originalQuery,salientTerms:N.salientTerms,expandedQueries:N.expandedQueries,recallTerms:dri(N)})}}let{filterResults:m,searchResults:h}=TX(d,f),y=(P,R)=>({title:P.metadata.title||"Untitled",content:P.pageContent,path:P.metadata.path||"",score:P.metadata.rerank_score??P.metadata.score??0,rerank_score:P.metadata.rerank_score??P.metadata.score??0,includeInContext:P.metadata.includeInContext??!0,source:P.metadata.source,mtime:P.metadata.mtime??null,ctime:P.metadata.ctime??null,chunkId:P.metadata.chunkId??null,isChunk:P.metadata.isChunk??!1,explanation:P.metadata.explanation??null,isFilterResult:R,matchType:R?P.metadata.source||"filter":void 0}),g=m.map(P=>y(P,!0)),b=h.map(P=>y(P,!1));F(`lexicalSearch found ${g.length} filter + ${b.length} search documents for query: "${e}"`),t&&F(`Time range search from ${new Date(t.startTime).toISOString()} to ${new Date(t.endTime).toISOString()}`);let _=b.map(P=>({title:P.title||P.path||"Untitled",path:P.path||P.title||"",score:P.rerank_score||P.score||0})),w=XU(_),T=new Map;for(let P of b){let R=(P.path||P.title).toLowerCase(),I=T.get(R);(!I||(P.rerank_score||0)>(I.rerank_score||0))&&T.set(R,P)}let O=w.map(P=>T.get((P.path||P.title).toLowerCase())).filter(Boolean);return{type:"local_search",documents:[...g,...O].slice(0,u),queryExpansion:p}}var yhs=cc({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:Ymt,func:async({timeRange:t,query:e,salientTerms:r,returnAll:n})=>{let o=Qmt(t);return await Zmt({timeRange:o,query:e,salientTerms:r,returnAll:n===!0})}}),bhs=cc({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:Ymt,func:async({timeRange:t,query:e,salientTerms:r,returnAll:n})=>{let o=Qmt(t),i=r.filter(h=>h.startsWith("#")),a=n===!0||o!==void 0||i.length>0,s=a?Math.max(Ly,200):Ly;F(`semanticSearch useExpandedLimits: ${a} (timeRange: ${!!o}, tags: ${i.length>0}, explicit: ${n===!0})`);let l=await new(await Promise.resolve().then(()=>(_Pe(),Ost))).HybridRetriever({minSimilarityScore:a?0:.1,maxK:s,salientTerms:r,timeRange:o,textWeight:Sye,returnAll:a,useRerankerThreshold:.5}).getRelevantDocuments(e);F(`semanticSearch found ${l.length} documents for query: "${e}"`),o&&F(`Time range search from ${new Date(o.startTime).toISOString()} to ${new Date(o.endTime).toISOString()}`);let c=l.map(h=>{let y=h.metadata.rerank_score??h.metadata.score??0;return{title:h.metadata.title||"Untitled",content:h.pageContent,path:h.metadata.path||"",score:y,rerank_score:y,includeInContext:h.metadata.includeInContext??!0,source:h.metadata.source,mtime:h.metadata.mtime??null,ctime:h.metadata.ctime??null,chunkId:h.metadata.chunkId??null,isChunk:h.metadata.isChunk??!1,explanation:h.metadata.explanation??null}}),d=c.map(h=>({title:h.title||h.path||"Untitled",path:h.path||h.title||"",score:h.rerank_score||h.score||0})),f=XU(d),p=new Map;for(let h of c){let y=(h.path||h.title).toLowerCase(),g=p.get(y);(!g||(h.rerank_score||0)>(g.rerank_score||0))&&p.set(y,h)}return{type:"local_search",documents:f.map(h=>p.get((h.path||h.title).toLowerCase())).filter(Boolean)}}});function Qmt(t){if(!t)return;let{startTime:e,endTime:r}=t;if(!e||!r||e<=0||r<=0){F("localSearch: Ignoring invalid time range (missing, zero, or negative values)");return}if(e>r){F("localSearch: Ignoring inverted time range (start > end)");return}return{startTime:e,endTime:r}}async function fri({query:t,salientTerms:e,returnAll:r=!1}){let n=e.filter(m=>m.startsWith("#")),o=r||n.length>0,i=o?ec:Ly,s=await new VU(app,{salientTerms:e,maxK:i,returnAll:o}).getRelevantDocuments(t),l=await lT.createMiyoRetriever(app,{minSimilarityScore:o?0:.1,maxK:i,salientTerms:e,textWeight:Sye,returnAll:o,useRerankerThreshold:.5,tagTerms:n}).getRelevantDocuments(t);F(`miyoSearch: ${s.length} filter + ${l.length} miyo docs for query: "${t}"`);let{filterResults:c,searchResults:d}=TX(s,l),f=(m,h)=>({title:m.metadata.title||"Untitled",content:m.pageContent,path:m.metadata.path||"",score:m.metadata.rerank_score??m.metadata.score??0,rerank_score:m.metadata.rerank_score??m.metadata.score??0,includeInContext:m.metadata.includeInContext??!0,source:m.metadata.source,mtime:m.metadata.mtime??null,ctime:m.metadata.ctime??null,chunkId:m.metadata.chunkId??null,isChunk:m.metadata.isChunk??!1,explanation:m.metadata.explanation??null,isFilterResult:h,matchType:h?m.metadata.source||"filter":void 0});return{type:"local_search",documents:[...c.map(m=>f(m,!0)),...d.map(m=>f(m,!1))].slice(0,i)}}var gje=cc({name:"localSearch",description:"Search for notes in the vault based on query, salient terms, and optional time range",schema:Ymt,func:async({timeRange:t,query:e,salientTerms:r,returnAll:n,_preExpandedQuery:o})=>{let i=Qmt(t);if(lT.isMiyoActive())return F("localSearch: Using Miyo search path"),await fri({query:e,salientTerms:r,returnAll:n===!0});let a=r.filter(l=>l.startsWith("#"));if(i!==void 0||a.length>0)return F("localSearch: Forcing lexical search (time range or tags present)"),await Zmt({timeRange:i,query:e,salientTerms:r,forceLexical:!0,preExpandedQuery:o,returnAll:n===!0});let u=lT.getRetrieverType();return F(`localSearch: Using ${u} retriever via factory`),await Zmt({timeRange:i,query:e,salientTerms:r,preExpandedQuery:o,returnAll:n===!0})}}),_hs=cc({name:"indexVault",description:"Index the vault to the Copilot index",schema:wt.object({}),func:async()=>{if(te().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore();return{success:!0,message:`Semantic search index refreshed with ${r} documents.
|
||
`+`Semantic search index has been refreshed with ${r} documents.`,documentCount:r}}catch(e){return{success:!1,message:`Failed to index with semantic search: ${e.message}`}}else return{success:!0,message:"Tiered lexical retriever uses on-demand indexing. No manual indexing required."}}}),pri=wt.object({query:wt.string().min(1).describe("The search query to search the internet"),chatHistory:wt.array(wt.object({role:wt.enum(["user","assistant"]),content:wt.string()})).describe("Previous conversation turns for context (usually empty array)")}),yje=cc({name:"webSearch",description:"Search the INTERNET (NOT vault notes) when user explicitly asks for web/online information",schema:pri,func:async({query:t,chatHistory:e})=>{try{let r=await nPe(t,e),n,o;if(o_()&&nvr()){let a=await ovr(r);n=a.content,o=a.citations}else{let a=await Ql.getInstance().webSearch(r);n=a.response.choices[0].message.content,o=a.response.citations||[]}return[{type:"web_search",content:n,citations:o,instruction:K4r()}]}catch(r){return console.error(`Error processing web search query ${t}:`,r),{error:`Web search failed: ${r}`}}}});var eht=5e5,mri=500,v2r=50,hri=wt.object({includeInline:wt.boolean().optional().describe("Include inline tags in addition to frontmatter tags. Defaults to true."),maxEntries:wt.number().int().min(1).max(5e3).optional().describe("Maximum number of tag entries to return, sorted by occurrences. Responses are capped at ~500KB.")}).describe("Parameters for retrieving the tag list.");function gri(){return typeof app>"u"||!app?.metadataCache?null:app.metadataCache}function w2r(t){let e={};if(!t)return e;for(let[r,n]of Object.entries(t)){let o=r?.trim();if(!o)continue;let i=o.replace(/^#+/,"").trim().toLowerCase();if(!i)continue;let a=`#${i}`;if(a==="#")continue;let s=Number.isFinite(n)?Math.max(0,Math.floor(n)):0;e[a]=(e[a]||0)+s}return e}function yri(t,e,r){let n=t,o=w2r(n.getFrontmatterTags?.()),i=e?w2r(n.getTags?.()):{},a=new Set([...Object.keys(o),...e?Object.keys(i):[]]),s=[],u=0;for(let c of a){let d=o[c]??0,f=e?Math.max(0,i[c]??0):0,p=0,m=d;e&&(f>=d?(p=f-d,m=f):f>0&&(p=f,m=d+p)),m!==0&&(u+=m,s.push({tag:c,occurrences:m,frontmatterOccurrences:d,inlineOccurrences:p}))}s.sort((c,d)=>d.occurrences===c.occurrences?c.tag.localeCompare(d.tag):d.occurrences-c.occurrences);let l=s.slice(0,r);return{totalUniqueTags:s.length,returnedTagCount:l.length,totalOccurrences:u,includedSources:e?["frontmatter","inline"]:["frontmatter"],truncated:l.length<s.length,tags:l}}function bri(t){let e=t,r=JSON.stringify(e);if(r.length<=eht)return e;let n=e.tags.length;for(;r.length>eht&&n>v2r;)n=Math.max(v2r,Math.floor(n/2)),e={...e,tags:t.tags.slice(0,n),returnedTagCount:n,truncated:!0},r=JSON.stringify(e);return r.length>eht?{totalUniqueTags:t.totalUniqueTags,returnedTagCount:0,totalOccurrences:t.totalOccurrences,includedSources:t.includedSources,truncated:!0,tags:[],note:"Tag list exceeded the size limit. Request a narrower scope or specify a smaller maxEntries value."}:e}function S2r(t){return`A JSON object lists the vault tags and their occurrence counts:
|
||
* totalUniqueTags: number of unique tags indexed across the vault
|
||
* returnedTagCount: number of tag entries included in this response
|
||
* totalOccurrences: total tag occurrences across included sources
|
||
* includedSources: sources represented in the counts (frontmatter, inline)
|
||
* truncated: whether the list was shortened due to limits
|
||
* tags: array of tag objects { tag, occurrences, frontmatterOccurrences, inlineOccurrences }
|
||
${JSON.stringify(t)}`}var C2r=()=>cc({name:"getTagList",description:"Get the list of tags in the vault with occurrence statistics.",schema:hri,func:async t=>{let e=gri(),r=t?.includeInline??!0,n=t?.maxEntries??mri;if(!e)return S2r({totalUniqueTags:0,returnedTagCount:0,totalOccurrences:0,includedSources:r?["frontmatter","inline"]:["frontmatter"],truncated:!1,tags:[],note:"Metadata cache is unavailable. Try again after the vault finishes indexing."});let o=yri(e,r,n),i=bri(o);return S2r(i)}});var E2r=$(x2r(),1),Dle=$(ZU(),1);var ts;(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(ts||(ts={}));var Cm;(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"})(Cm||(Cm={}));var eS;(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"})(eS||(eS={}));function T2r(t,e){e=e.add(1,"day"),Z3(t,e),IX(t,e)}function fT(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function bje(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",ts.AM):t.assign("meridiem",ts.PM)}function Z3(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function IX(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var iht=$(ZU(),1);var _ri={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=>O2r(t,eS.MARCH,Cm.SUNDAY,2),dstEnd:t=>O2r(t,eS.OCTOBER,Cm.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=>YU(t,eS.MARCH,Cm.SUNDAY,2,2),dstEnd:t=>YU(t,eS.NOVEMBER,Cm.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=>YU(t,eS.MARCH,Cm.SUNDAY,2,2),dstEnd:t=>YU(t,eS.NOVEMBER,Cm.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=>YU(t,eS.MARCH,Cm.SUNDAY,2,2),dstEnd:t=>YU(t,eS.NOVEMBER,Cm.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=>YU(t,eS.MARCH,Cm.SUNDAY,2,2),dstEnd:t=>YU(t,eS.NOVEMBER,Cm.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 YU(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 O2r(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 _je(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??_ri[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,iht.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,iht.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}Dle.default.extend(E2r.default);var QU=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=_je(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}},rs=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,Dle.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,Dle.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,Dle.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?(bje(o,n),fT(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(IX(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}},M$=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 rs(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 aht(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function vri(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function py(t){return`(?:${vri(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var P2r=$(ZU(),1);function vje(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function eB(t,e,r){let n=(0,P2r.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 lht={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},cht={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},rC={...cht,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},sht={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},uht={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},R2r={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"},jle={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",...R2r},I2r=`(?:${py(sht)}|[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 wri(t){let e=t.toLowerCase();return sht[e]!==void 0?sht[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 AX=`(?:${py(uht)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function NX(t){let e=t.toLowerCase();return uht[e]!==void 0?uht[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}var tB="(?:[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 rB(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 vje(e)}var A2r=`(${I2r})\\s{0,3}(${py(jle)})`,M2r=new RegExp(A2r,"i"),Sri=`(${I2r})\\s{0,3}(${py(R2r)})`,N2r="\\s{0,5},?(?:\\s*and)?\\s{0,5}",R$=aht("(?:(?:about|around)\\s{0,3})?",A2r,N2r),nB=aht("(?:(?:about|around)\\s{0,3})?",Sri,N2r);function nC(t){let e={},r=t,n=M2r.exec(r);for(;n;)Cri(e,n),r=r.substring(n[0].length).trim(),n=M2r.exec(r);return Object.keys(e).length==0?null:e}function Cri(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=wri(e[1]),n=jle[e[2].toLowerCase()];t[n]=r}var ru=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 xri=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${R$})(?=\\W|$)`,"i"),Tri=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${R$})(?=\\W|$)`,"i"),Ori=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${nB})(?=\\W|$)`,"i"),$le=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?Ori:e.option.forwardDate?xri:Tri}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=nC(r[1]);return n?rs.createRelativeFromReference(e.reference,n):null}};var Eri=new RegExp(`(?:on\\s{0,3})?(${AX})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${AX}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${py(rC)})(?:(?:-|/|,?\\s{0,3})(${tB}(?!\\w)))?(?=\\W|$)`,"i"),D2r=1,j2r=2,Pri=3,$2r=4,Lle=class extends ru{innerPattern(){return Eri}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=rC[r[Pri].toLowerCase()],i=NX(r[D2r]);if(i>31)return r.index=r.index+r[D2r].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[$2r]){let a=rB(r[$2r]);n.start.assign("year",a)}else{let a=eB(e.refDate,i,o);n.start.imply("year",a)}if(r[j2r]){let a=NX(r[j2r]);n.end=n.start.clone(),n.end.assign("day",a)}return n}};var Mri=new RegExp(`(${py(rC)})(?:-|/|\\s*,?\\s*)(${AX})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${AX})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${tB}))?(?=\\W|$)(?!\\:\\d)`,"i"),Rri=1,L2r=2,dht=3,fht=4,Fle=class extends ru{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return Mri}innerExtract(e,r){let n=rC[r[Rri].toLowerCase()],o=NX(r[L2r]);if(o>31||this.shouldSkipYearLikeDate&&!r[dht]&&!r[fht]&&r[L2r].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[fht]){let u=rB(r[fht]);i.assign("year",u)}else{let u=eB(e.refDate,o,n);i.imply("year",u)}if(!r[dht])return i;let a=NX(r[dht]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}};var Iri=new RegExp(`((?:in)\\s*)?(${py(rC)})\\s*(?:[,-]?\\s*(${tB})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),Ari=1,Nri=2,F2r=3,kle=class extends ru{innerPattern(){return Iri}innerExtract(e,r){let n=r[Nri].toLowerCase();if(r[0].length<=3&&!cht[n])return null;let o=e.createParsingResult(r.index+(r[Ari]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=rC[n];if(o.start.assign("month",i),r[F2r]){let a=rB(r[F2r]);o.start.assign("year",a)}else{let a=eB(e.refDate,1,i);o.start.imply("year",a)}return o}};var Dri=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${py(rC)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),jri=1,$ri=2,k2r=3,Lri=4,qle=class extends ru{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return Dri}innerExtract(e,r){let n=parseInt(r[jri]),o=parseInt(r[Lri]),i=r[k2r]?parseInt(r[k2r]):rC[r[$ri].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 Fri=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),kri=1,qri=2,Ule=class extends ru{innerPattern(){return Fri}innerExtract(e,r){let n=parseInt(r[qri]),o=parseInt(r[kri]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}};function Uri(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 Bri(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 q2r=2,DX=3,wje=4,Sje=5,Ble=6,Cje=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[q2r]);if(s>100){if(this.strictMode||r[DX]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[DX]!=null){if(r[DX].length==1&&!r[Ble])return null;i=parseInt(r[DX])}if(i>=60)return null;if(s>12&&(a=ts.PM),r[Ble]!=null){if(s>12)return null;let u=r[Ble][0].toLowerCase();u=="a"&&(a=ts.AM,s==12&&(s=0)),u=="p"&&(a=ts.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",ts.AM):o.imply("meridiem",ts.PM),r[Sje]!=null){let u=parseInt(r[Sje].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[wje]!=null){let u=parseInt(r[wje]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[Sje]!=null){let u=parseInt(r[Sje].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[wje]!=null){let u=parseInt(r[wje]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[q2r]),a=0,s=-1;if(r[DX]!=null?a=parseInt(r[DX]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=ts.PM),r[Ble]!=null){if(i>12)return null;let u=r[Ble][0].toLowerCase();u=="a"&&(s=ts.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=ts.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==ts.AM?(n.start.imply("meridiem",ts.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",ts.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",ts.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",ts.PM)):i>12?o.imply("meridiem",ts.PM):i<=12&&o.imply("meridiem",ts.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=Uri(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=Bri(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}};var zle=class extends Cje{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",ts.PM)):o<6&&n.assign("meridiem",ts.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",ts.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",ts.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}};function oB(t){let e={};for(let r in t)e[r]=-t[r];return e}function U2r(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 zri=new RegExp(`(${R$})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Vri=new RegExp(`(${nB})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Vle=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Vri:zri}innerExtract(e,r){let n=nC(r[1]);if(!n)return null;let o=oB(n);return rs.createRelativeFromReference(e.reference,o)}};var Hri=new RegExp(`(${R$})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),Wri=new RegExp(`(${nB})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),Jri=1,Hle=class extends ru{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?Wri:Hri}innerExtract(e,r){let n=nC(r[Jri]);return n?rs.createRelativeFromReference(e.reference,n):null}};var xje=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},oC=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 Wle=class extends oC{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 Jle=class extends Wle{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function pht(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=B2r(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=B2r(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?fT(s,u):Z3(s,u)}r.end=s}return r}function B2r(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")==ts.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 Kle=class extends oC{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()?pht(r,n):pht(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}};var jX=class extends Kle{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}};var Kri=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Gle=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=Kri.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=_je(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 Gri=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),Xri=1,Zri=2,Yri=3,Xle=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=Gri.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[Zri]),s=parseInt(i[Yri]||"0"),u=a*60+s;u>14*60||(i[Xri]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}};var iB=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 z2r=$(ZU(),1);var Zle=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,z2r.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),Z3(n.start,o),n.end&&n.end.isOnlyTime()&&(Z3(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),Z3(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 Yle=class extends xje{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 Qri=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"),eni=1,tni=2,rni=3,V2r=4,nni=5,H2r=6,W2r=7,oni=8,J2r=9,K2r=10,Qle=class extends ru{innerPattern(){return Qri}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[eni]),month:parseInt(r[tni]),day:parseInt(r[rni])});if(r[V2r]!=null&&(n.assign("hour",parseInt(r[V2r])),n.assign("minute",parseInt(r[nni])),r[H2r]!=null&&n.assign("second",parseInt(r[H2r])),r[W2r]!=null&&n.assign("millisecond",parseInt(r[W2r])),r[oni]!=null)){let o=0;if(r[J2r]){let i=parseInt(r[J2r]),a=0;r[K2r]!=null&&(a=parseInt(r[K2r])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}};var ece=class extends oC{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 G2r(t,e=!1){return t.parsers.unshift(new Qle),t.refiners.unshift(new ece),t.refiners.unshift(new Xle),t.refiners.unshift(new iB),t.refiners.push(new Gle),t.refiners.push(new iB),t.refiners.push(new Zle),t.refiners.push(new Yle(e)),t}var uVr=$(ZU(),1);var $X=$(ZU(),1);function X2r(t){let e=(0,$X.default)(t.instant),r=new rs(t,{});return fT(r,e),bje(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function Z2r(t){let e=(0,$X.default)(t.instant),r=new rs(t,{});return fT(r,e),IX(r,e),r.addTag("casualReference/today"),r}function Y2r(t){return ini(t,1).addTag("casualReference/yesterday")}function ini(t,e){return eVr(t,-e)}function Q2r(t){return eVr(t,1).addTag("casualReference/tomorrow")}function eVr(t,e){let r=(0,$X.default)(t.instant),n=new rs(t,{});return r=r.add(e,"day"),fT(n,r),IX(n,r),n}function tVr(t,e=22){let r=(0,$X.default)(t.instant),n=new rs(t,{});return fT(n,r),n.imply("hour",e),n.imply("meridiem",ts.PM),n.addTag("casualReference/tonight"),n}function rVr(t,e=20){let r=new rs(t,{});return r.imply("meridiem",ts.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function nVr(t){let e=new rs(t,{}),r=(0,$X.default)(t.instant);return r.hour()>2&&T2r(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function oVr(t,e=6){let r=new rs(t,{});return r.imply("meridiem",ts.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function iVr(t,e=15){let r=new rs(t,{});return r.imply("meridiem",ts.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function aVr(t){let e=new rs(t,{});return e.imply("meridiem",ts.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var ani=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,tce=class extends ru{innerPattern(e){return ani}innerExtract(e,r){let n=(0,uVr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=X2r(e.reference);break;case"today":i=Z2r(e.reference);break;case"yesterday":i=Y2r(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=Q2r(e.reference);break;case"tonight":i=tVr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),fT(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}};var sni=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,rce=class extends ru{innerPattern(){return sni}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=iVr(e.reference);break;case"evening":case"night":n=rVr(e.reference);break;case"midnight":n=nVr(e.reference);break;case"morning":n=oVr(e.reference);break;case"noon":case"midday":n=aVr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}};function lVr(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=uni(n,e,r),i=new rs(t);return i=U2r(i,{day:o}),i.assign("weekday",e),i}function uni(t,e,r){let n=t.getDay();switch(r){case"this":return Tje(t,e);case"last":return cVr(t,e);case"next":return n==Cm.SUNDAY?e==Cm.SUNDAY?7:e:n==Cm.SATURDAY?e==Cm.SATURDAY?7:e==Cm.SUNDAY?8:1+e:e<n&&e!=Cm.SUNDAY?Tje(t,e):Tje(t,e)+7}return lni(t,e)}function lni(t,e){let r=cVr(t,e),n=Tje(t,e);return n<-r?n:r}function Tje(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function cVr(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var cni=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${py(lht)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),dni=1,fni=2,pni=3,nce=class extends ru{innerPattern(){return cni}innerExtract(e,r){let n=r[fni].toLowerCase(),o=lht[n],i=r[dni],a=r[pni],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"),lVr(e.reference,o,u)}};var dVr=$(ZU(),1);var mni=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${py(jle)})(?=\\s*)(?=\\W|$)`,"i"),hni=1,gni=2,oce=class extends ru{innerPattern(){return mni}innerExtract(e,r){let n=r[hni].toLowerCase(),o=r[gni].toLowerCase(),i=jle[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,rs.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,rs.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,dVr.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 yni=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"),bni=1,_ni=5,fVr=2,pVr=3,mht=4,ice=class{constructor(e){this.groupNumberMonth=e?pVr:fVr,this.groupNumberDay=e?fVr:pVr}pattern(){return yni}extract(e,r){let n=r.index+r[bni].length,o=r.index+r[0].length-r[_ni].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[mht]&&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[mht]){let l=parseInt(r[mht]),c=vje(l);a.start.assign("year",c)}else{let l=eB(e.refDate,u,s);a.start.imply("year",l)}return a}};var vni=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${R$})(?=\\W|$)`,"i"),wni=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${nB})(?=\\W|$)`,"i"),ace=class extends ru{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?vni:wni}innerExtract(e,r){let n=r[1].toLowerCase(),o=nC(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=oB(o);break}return rs.createRelativeFromReference(e.reference,o)}};function Sni(t){return t.text.match(/^[+-]/i)!=null}function mVr(t){return t.text.match(/^-/i)!=null}var sce=class extends oC{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?Sni(n)||mVr(n):!1}mergeResults(e,r,n,o){let i=nC(n.text);mVr(n)&&(i=oB(i));let a=rs.createRelativeFromReference(new QU(r.start.date()),i);return new M$(r.reference,r.index,`${r.text}${e}${n.text}`,a)}};function hVr(t){return t.text.match(/\s+(before|from)$/i)!=null}function Cni(t){return t.text.match(/\s+(after|since)$/i)!=null}var uce=class extends oC{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!hVr(r)&&!Cni(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=nC(r.text);hVr(r)&&(o=oB(o));let i=rs.createRelativeFromReference(new QU(n.start.date()),o);return new M$(n.reference,r.index,`${r.text}${e}${n.text}`,i)}};var xni=new RegExp(`^\\s*(${tB})`,"i"),Tni=1,lce=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=xni.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=rB(i[Tni]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}};var Y3=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new tce),r.parsers.push(new rce),r.parsers.push(new kle),r.parsers.push(new oce),r.parsers.push(new ace),r}createConfiguration(e=!0,r=!1){let n=G2r({parsers:[new ice(r),new $le(e),new Lle,new Fle(r),new nce,new Ule,new zle(e),new Vle(e),new Hle(e)],refiners:[new jX]},e);return n.parsers.unshift(new qle(e)),n.refiners.unshift(new uce),n.refiners.unshift(new sce),n.refiners.unshift(new iB),n.refiners.push(new jX),n.refiners.push(new lce),n.refiners.push(new Jle),n}};var LX=class t{constructor(e){this.defaultConfig=new Y3,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 hht(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 M$?c=l:l instanceof rs?(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}},hht=class{constructor(e,r,n){this.text=e,this.reference=new QU(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof rs?e:new rs(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 M$(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 ght=new Y3,gVr=new LX(ght.createCasualConfiguration(!1)),Oni=new LX(ght.createConfiguration(!0,!1)),Cbs=new LX(ght.createCasualConfiguration(!0));var yVr=gVr;function yht(t,e,r){return yVr.parse(t,e,r)}function bVr(t,e,r){return yVr.parseDate(t,e,r)}var I$=class extends Error{},Oje=class extends I${constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Eje=class extends I${constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},Pje=class extends I${constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},pT=class extends I${},FX=class extends I${constructor(e){super(`Invalid unit ${e}`)}},Gc=class extends I${},mT=class extends I${constructor(){super("Zone is an abstract class")}};var er="numeric",hT="short",tS="long",aB={year:er,month:er,day:er},cce={year:er,month:hT,day:er},bht={year:er,month:hT,day:er,weekday:hT},dce={year:er,month:tS,day:er},fce={year:er,month:tS,day:er,weekday:tS},pce={hour:er,minute:er},mce={hour:er,minute:er,second:er},hce={hour:er,minute:er,second:er,timeZoneName:hT},gce={hour:er,minute:er,second:er,timeZoneName:tS},yce={hour:er,minute:er,hourCycle:"h23"},bce={hour:er,minute:er,second:er,hourCycle:"h23"},_ce={hour:er,minute:er,second:er,hourCycle:"h23",timeZoneName:hT},vce={hour:er,minute:er,second:er,hourCycle:"h23",timeZoneName:tS},wce={year:er,month:er,day:er,hour:er,minute:er},Sce={year:er,month:er,day:er,hour:er,minute:er,second:er},Cce={year:er,month:hT,day:er,hour:er,minute:er},xce={year:er,month:hT,day:er,hour:er,minute:er,second:er},_ht={year:er,month:hT,day:er,weekday:hT,hour:er,minute:er},Tce={year:er,month:tS,day:er,hour:er,minute:er,timeZoneName:hT},Oce={year:er,month:tS,day:er,hour:er,minute:er,second:er,timeZoneName:hT},Ece={year:er,month:tS,day:er,weekday:tS,hour:er,minute:er,timeZoneName:tS},Pce={year:er,month:tS,day:er,weekday:tS,hour:er,minute:er,second:er,timeZoneName:tS};var Ov=class{get type(){throw new mT}get name(){throw new mT}get ianaName(){return this.name}get isUniversal(){throw new mT}offsetName(e,r){throw new mT}formatOffset(e,r){throw new mT}offset(e){throw new mT}equals(e){throw new mT}get isValid(){throw new mT}};var vht=null,sB=class t extends Ov{static get instance(){return vht===null&&(vht=new t),vht}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Rje(e,r,n)}formatOffset(e,r){return uB(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}};var Aje={};function Mni(t){return Aje[t]||(Aje[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"})),Aje[t]}var Rni={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Ini(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 Ani(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=Rni[i];i==="era"?n[s]=a:gn(s)||(n[s]=parseInt(a,10))}return n}var Ije={},mb=class t extends Ov{static create(e){return Ije[e]||(Ije[e]=new t(e)),Ije[e]}static resetCache(){Ije={},Aje={}}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 Rje(e,r,n,this.name)}formatOffset(e,r){return uB(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=Mni(this.name),[o,i,a,s,u,l,c]=n.formatToParts?Ani(n,r):Ini(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=kX({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 _Vr={};function Nni(t,e={}){let r=JSON.stringify([t,e]),n=_Vr[r];return n||(n=new Intl.ListFormat(t,e),_Vr[r]=n),n}var wht={};function Sht(t,e={}){let r=JSON.stringify([t,e]),n=wht[r];return n||(n=new Intl.DateTimeFormat(t,e),wht[r]=n),n}var Cht={};function Dni(t,e={}){let r=JSON.stringify([t,e]),n=Cht[r];return n||(n=new Intl.NumberFormat(t,e),Cht[r]=n),n}var xht={};function jni(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=xht[o];return i||(i=new Intl.RelativeTimeFormat(t,e),xht[o]=i),i}var Mce=null;function $ni(){return Mce||(Mce=new Intl.DateTimeFormat().resolvedOptions().locale,Mce)}var vVr={};function Lni(t){let e=vVr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,vVr[t]=e}return e}function Fni(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=Sht(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=Sht(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function kni(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function qni(t){let e=[];for(let r=1;r<=12;r++){let n=$n.utc(2009,r,1);e.push(t(n))}return e}function Uni(t){let e=[];for(let r=1;r<=7;r++){let n=$n.utc(2016,11,13+r);e.push(t(n))}return e}function Nje(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function Bni(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 Tht=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=Dni(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):qX(e,3);return Pc(r,this.padTo)}}},Oht=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&&mb.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=Sht(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()}},Eht=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Dje()&&(this.rtf=jni(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):wVr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},zni={firstDay:1,minimalDays:4,weekend:[6,7]},$s=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||js.defaultLocale,s=a||(i?"en-US":$ni()),u=r||js.defaultNumberingSystem,l=n||js.defaultOutputCalendar,c=Rce(o)||js.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){Mce=null,wht={},Cht={},xht={}}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]=Fni(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=kni(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=Bni(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,Rce(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 Nje(this,e,Pht,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=qni(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return Nje(this,e,Mht,()=>{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]=Uni(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return Nje(this,void 0,()=>Rht,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[$n.utc(2016,11,13,9),$n.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return Nje(this,e,Iht,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[$n.utc(-40,1,1),$n.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 Tht(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new Oht(e,this.intl,r)}relFormatter(e={}){return new Eht(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Nni(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:jje()?Lni(this.locale):zni}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 Nht=null,ng=class t extends Ov{static get utcInstance(){return Nht===null&&(Nht=new t(0)),Nht}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(Q3(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${uB(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${uB(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return uB(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 UX=class extends Ov{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 gT(t,e){let r;if(gn(t)||t===null)return e;if(t instanceof Ov)return t;if(SVr(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?sB.instance:n==="utc"||n==="gmt"?ng.utcInstance:ng.parseSpecifier(n)||mb.create(t)}else return yT(t)?ng.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new UX(t)}var Dht={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"},CVr={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]},Vni=Dht.hanidec.replace(/[\[|\]]/g,"").split("");function xVr(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(Dht.hanidec)!==-1)e+=Vni.indexOf(t[r]);else for(let o in CVr){let[i,a]=CVr[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}var BX={};function TVr(){BX={}}function iC({numberingSystem:t},e=""){let r=t||"latn";return BX[r]||(BX[r]={}),BX[r][e]||(BX[r][e]=new RegExp(`${Dht[r]}${e}`)),BX[r][e]}var OVr=()=>Date.now(),EVr="system",PVr=null,MVr=null,RVr=null,IVr=60,AVr,NVr=null,js=class{static get now(){return OVr}static set now(e){OVr=e}static set defaultZone(e){EVr=e}static get defaultZone(){return gT(EVr,sB.instance)}static get defaultLocale(){return PVr}static set defaultLocale(e){PVr=e}static get defaultNumberingSystem(){return MVr}static set defaultNumberingSystem(e){MVr=e}static get defaultOutputCalendar(){return RVr}static set defaultOutputCalendar(e){RVr=e}static get defaultWeekSettings(){return NVr}static set defaultWeekSettings(e){NVr=Rce(e)}static get twoDigitCutoffYear(){return IVr}static set twoDigitCutoffYear(e){IVr=e%100}static get throwOnInvalid(){return AVr}static set throwOnInvalid(e){AVr=e}static resetCaches(){$s.resetCache(),mb.resetCache(),$n.resetCache(),TVr()}};var og=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}};var DVr=[0,31,59,90,120,151,181,212,243,273,304,334],jVr=[0,31,60,91,121,152,182,213,244,274,305,335];function aC(t,e){return new og("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function $je(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 $Vr(t,e,r){return r+(tW(t)?jVr:DVr)[e-1]}function LVr(t,e){let r=tW(t)?jVr:DVr,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Lje(t,e){return(t-e+7)%7+1}function Ice(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=$Vr(n,o,i),s=Lje($je(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=eW(l,e,r)):u>eW(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...Nce(t)}}function jht(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Lje($je(n,1,e),r),s=lB(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=lB(l)):u>s?(l=n+1,u-=lB(n)):l=n;let{month:c,day:d}=LVr(l,u);return{year:l,month:c,day:d,...Nce(t)}}function Fje(t){let{year:e,month:r,day:n}=t,o=$Vr(e,r,n);return{year:e,ordinal:o,...Nce(t)}}function $ht(t){let{year:e,ordinal:r}=t,{month:n,day:o}=LVr(e,r);return{year:e,month:n,day:o,...Nce(t)}}function Lht(t,e){if(!gn(t.localWeekday)||!gn(t.localWeekNumber)||!gn(t.localWeekYear)){if(!gn(t.weekday)||!gn(t.weekNumber)||!gn(t.weekYear))throw new pT("Cannot mix locale-based week fields with ISO-based week fields");return gn(t.localWeekday)||(t.weekday=t.localWeekday),gn(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),gn(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 FVr(t,e=4,r=1){let n=Ace(t.weekYear),o=rS(t.weekNumber,1,eW(t.weekYear,e,r)),i=rS(t.weekday,1,7);return n?o?i?!1:aC("weekday",t.weekday):aC("week",t.weekNumber):aC("weekYear",t.weekYear)}function kVr(t){let e=Ace(t.year),r=rS(t.ordinal,1,lB(t.year));return e?r?!1:aC("ordinal",t.ordinal):aC("year",t.year)}function Fht(t){let e=Ace(t.year),r=rS(t.month,1,12),n=rS(t.day,1,zX(t.year,t.month));return e?r?n?!1:aC("day",t.day):aC("month",t.month):aC("year",t.year)}function kht(t){let{hour:e,minute:r,second:n,millisecond:o}=t,i=rS(e,0,23)||e===24&&r===0&&n===0&&o===0,a=rS(r,0,59),s=rS(n,0,59),u=rS(o,0,999);return i?a?s?u?!1:aC("millisecond",o):aC("second",n):aC("minute",r):aC("hour",e)}function gn(t){return typeof t>"u"}function yT(t){return typeof t=="number"}function Ace(t){return typeof t=="number"&&t%1===0}function SVr(t){return typeof t=="string"}function UVr(t){return Object.prototype.toString.call(t)==="[object Date]"}function Dje(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function jje(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function BVr(t){return Array.isArray(t)?t:[t]}function qht(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 zVr(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function cB(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Rce(t){if(t==null)return null;if(typeof t!="object")throw new Gc("Week settings must be an object");if(!rS(t.firstDay,1,7)||!rS(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!rS(e,1,7)))throw new Gc("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function rS(t,e,r){return Ace(t)&&t>=e&&t<=r}function Hni(t,e){return t-e*Math.floor(t/e)}function Pc(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function A$(t){if(!(gn(t)||t===null||t===""))return parseInt(t,10)}function dB(t){if(!(gn(t)||t===null||t===""))return parseFloat(t)}function Dce(t){if(!(gn(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function qX(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function tW(t){return t%4===0&&(t%100!==0||t%400===0)}function lB(t){return tW(t)?366:365}function zX(t,e){let r=Hni(e-1,12)+1,n=t+(e-r)/12;return r===2?tW(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function kX(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 qVr(t,e,r){return-Lje($je(t,1,e),r)+e-1}function eW(t,e=4,r=1){let n=qVr(t,e,r),o=qVr(t+1,e,r);return(lB(t)-n+o)/7}function jce(t){return t>99?t:t>js.twoDigitCutoffYear?1900+t:2e3+t}function Rje(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 Q3(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 Uht(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Gc(`Invalid unit value ${t}`);return e}function VX(t,e){let r={};for(let n in t)if(cB(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=Uht(o)}return r}function uB(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}${Pc(r,2)}:${Pc(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${Pc(r,2)}${Pc(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Nce(t){return zVr(t,["hour","minute","second","millisecond"])}var Wni=["January","February","March","April","May","June","July","August","September","October","November","December"],Bht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Jni=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pht(t){switch(t){case"narrow":return[...Jni];case"short":return[...Bht];case"long":return[...Wni];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 zht=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Vht=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Kni=["M","T","W","T","F","S","S"];function Mht(t){switch(t){case"narrow":return[...Kni];case"short":return[...Vht];case"long":return[...zht];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}var Rht=["AM","PM"],Gni=["Before Christ","Anno Domini"],Xni=["BC","AD"],Zni=["B","A"];function Iht(t){switch(t){case"narrow":return[...Zni];case"short":return[...Xni];case"long":return[...Gni];default:return null}}function VVr(t){return Rht[t.hour<12?0:1]}function HVr(t,e){return Mht(e)[t.weekday-1]}function WVr(t,e){return Pht(e)[t.month-1]}function JVr(t,e){return Iht(e)[t.year<0?0:1]}function wVr(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 KVr(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var Yni={D:aB,DD:cce,DDD:dce,DDDD:fce,t:pce,tt:mce,ttt:hce,tttt:gce,T:yce,TT:bce,TTT:_ce,TTTT:vce,f:wce,ff:Cce,fff:Tce,ffff:Ece,F:Sce,FF:xce,FFF:Oce,FFFF:Pce},ig=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 Yni[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 Pc(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?VVr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?WVr(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?HVr(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?JVr(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 KVr(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 KVr(i,o(s))}};var XVr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function WX(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function JX(...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 KX(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 ZVr(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=A$(e[r+o]);return[n,null,r+o]}}var YVr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,Qni=`(?:${YVr.source}?(?:\\[(${XVr.source})\\])?)?`,Hht=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,QVr=RegExp(`${Hht.source}${Qni}`),Wht=RegExp(`(?:T${QVr.source})?`),eoi=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,toi=/(\d{4})-?W(\d\d)(?:-?(\d))?/,roi=/(\d{4})-?(\d{3})/,noi=ZVr("weekYear","weekNumber","weekDay"),ooi=ZVr("year","ordinal"),ioi=/(\d{4})-(\d\d)-(\d\d)/,eHr=RegExp(`${Hht.source} ?(?:${YVr.source}|(${XVr.source}))?`),aoi=RegExp(`(?: ${eHr.source})?`);function HX(t,e,r){let n=t[e];return gn(n)?r:A$(n)}function soi(t,e){return[{year:HX(t,e),month:HX(t,e+1,1),day:HX(t,e+2,1)},null,e+3]}function GX(t,e){return[{hours:HX(t,e,0),minutes:HX(t,e+1,0),seconds:HX(t,e+2,0),milliseconds:Dce(t[e+3])},null,e+4]}function $ce(t,e){let r=!t[e]&&!t[e+1],n=Q3(t[e+1],t[e+2]),o=r?null:ng.instance(n);return[{},o,e+3]}function Lce(t,e){let r=t[e]?mb.create(t[e]):null;return[{},r,e+1]}var uoi=RegExp(`^T?${Hht.source}$`),loi=/^-?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 coi(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(dB(r)),months:f(dB(n)),weeks:f(dB(o)),days:f(dB(i)),hours:f(dB(a)),minutes:f(dB(s)),seconds:f(dB(u),u==="-0"),milliseconds:f(Dce(l),d)}]}var doi={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 Jht(t,e,r,n,o,i,a){let s={year:e.length===2?jce(A$(e)):A$(e),month:Bht.indexOf(r)+1,day:A$(n),hour:A$(o),minute:A$(i)};return a&&(s.second=A$(a)),t&&(s.weekday=t.length>3?zht.indexOf(t)+1:Vht.indexOf(t)+1),s}var foi=/^(?:(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 poi(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=Jht(e,o,n,r,i,a,s),p;return u?p=doi[u]:l?p=0:p=Q3(c,d),[f,new ng(p)]}function moi(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}var hoi=/^(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$/,goi=/^(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$/,yoi=/^(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 GVr(t){let[,e,r,n,o,i,a,s]=t;return[Jht(e,o,n,r,i,a,s),ng.utcInstance]}function boi(t){let[,e,r,n,o,i,a,s]=t;return[Jht(e,s,r,n,o,i,a),ng.utcInstance]}var _oi=WX(eoi,Wht),voi=WX(toi,Wht),woi=WX(roi,Wht),Soi=WX(QVr),tHr=JX(soi,GX,$ce,Lce),Coi=JX(noi,GX,$ce,Lce),xoi=JX(ooi,GX,$ce,Lce),Toi=JX(GX,$ce,Lce);function rHr(t){return KX(t,[_oi,tHr],[voi,Coi],[woi,xoi],[Soi,Toi])}function nHr(t){return KX(moi(t),[foi,poi])}function oHr(t){return KX(t,[hoi,GVr],[goi,GVr],[yoi,boi])}function iHr(t){return KX(t,[loi,coi])}var Ooi=JX(GX);function aHr(t){return KX(t,[uoi,Ooi])}var Eoi=WX(ioi,aoi),Poi=WX(eHr),Moi=JX(GX,$ce,Lce);function sHr(t){return KX(t,[Eoi,tHr],[Poi,Moi])}var uHr="Invalid Duration",cHr={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}},Roi={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},...cHr},sC=146097/400,XX=146097/4800,Ioi={years:{quarters:4,months:12,weeks:sC/7,days:sC,hours:sC*24,minutes:sC*24*60,seconds:sC*24*60*60,milliseconds:sC*24*60*60*1e3},quarters:{months:3,weeks:sC/28,days:sC/4,hours:sC*24/4,minutes:sC*24*60/4,seconds:sC*24*60*60/4,milliseconds:sC*24*60*60*1e3/4},months:{weeks:XX/7,days:XX,hours:XX*24,minutes:XX*24*60,seconds:XX*24*60*60,milliseconds:XX*24*60*60*1e3},...cHr},rW=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Aoi=rW.slice(0).reverse();function fB(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 Mc(n)}function dHr(t,e){let r=e.milliseconds??0;for(let n of Aoi.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function lHr(t,e){let r=dHr(t,e)<0?-1:1;rW.reduceRight((n,o)=>{if(gn(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),rW.reduce((n,o)=>{if(gn(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function Noi(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Mc=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?Ioi:Roi;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||$s.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 Gc(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:VX(e,t.normalizeUnit),loc:$s.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(yT(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Gc(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=iHr(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]=aHr(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 Gc("need to specify a reason the Duration is invalid");let n=e instanceof og?e:new og(e,r);if(js.throwOnInvalid)throw new Pje(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 FX(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?ig.create(this.loc,n).formatDurationFromString(this,e):uHr}toHuman(e={}){if(!this.isValid)return uHr;let r=rW.map(n=>{let o=this.values[n];return gn(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+=qX(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},$n.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?dHr(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 rW)(cB(r.values,o)||cB(this.values,o))&&(n[o]=r.get(o)+this.get(o));return fB(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]=Uht(e(this.values[n],n));return fB(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...VX(e,t.normalizeUnit)};return fB(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 fB(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return lHr(this.matrix,e),fB(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Noi(this.normalize().shiftToAll().toObject());return fB(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 rW)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;yT(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else yT(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 lHr(this.matrix,r),fB(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 fB(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 rW)if(!r(this.values[n],e.values[n]))return!1;return!0}};var ZX="Invalid Interval";function Doi(t,e){return!t||!t.isValid?N$.invalid("missing or invalid start"):!e||!e.isValid?N$.invalid("missing or invalid end"):e<t?N$.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 N$=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 Gc("need to specify a reason the Interval is invalid");let n=e instanceof og?e:new og(e,r);if(js.throwOnInvalid)throw new Eje(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=YX(e),o=YX(r),i=Doi(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=Mc.fromDurationLike(r),o=YX(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=Mc.fromDurationLike(r),o=YX(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=$n.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=$n.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=Mc.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=Mc.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(YX).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=Mc.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()})`:ZX}[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=aB,r={}){return this.isValid?ig.create(this.s.loc.clone(r),e).formatInterval(this):ZX}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ZX}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ZX}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ZX}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:ZX}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):Mc.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}};var D$=class{static hasDST(e=js.defaultZone){let r=$n.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return mb.isValidZone(e)}static normalizeZone(e){return gT(e,js.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||$s.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||$s.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||$s.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||$s.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||$s.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||$s.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||$s.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return $s.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return $s.create(r,null,"gregory").eras(e)}static features(){return{relative:Dje(),localeWeek:jje()}}};function fHr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(Mc.fromMillis(n).as("days"))}function joi(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=fHr(u,l);return(c-c%7)/7}],["days",fHr]],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 pHr(t,e,r,n){let[o,i,a,s]=joi(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=Mc.fromObject(i,n);return l.length>0?Mc.fromMillis(u,n).shiftTo(...l).plus(c):c}var $oi="missing Intl.DateTimeFormat.formatToParts support";function Ws(t,e=r=>r){return{regex:t,deser:([r])=>e(xVr(r))}}var Loi="\xA0",gHr=`[ ${Loi}]`,yHr=new RegExp(gHr,"g");function Foi(t){return t.replace(/\./g,"\\.?").replace(yHr,gHr)}function mHr(t){return t.replace(/\./g,"").replace(yHr," ").toLowerCase()}function bT(t,e){return t===null?null:{regex:RegExp(t.map(Foi).join("|")),deser:([r])=>t.findIndex(n=>mHr(r)===mHr(n))+e}}function hHr(t,e){return{regex:t,deser:([,r,n])=>Q3(r,n),groups:e}}function kje(t){return{regex:t,deser:([e])=>e}}function koi(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function qoi(t,e){let r=iC(e),n=iC(e,"{2}"),o=iC(e,"{3}"),i=iC(e,"{4}"),a=iC(e,"{6}"),s=iC(e,"{1,2}"),u=iC(e,"{1,3}"),l=iC(e,"{1,6}"),c=iC(e,"{1,9}"),d=iC(e,"{2,4}"),f=iC(e,"{4,6}"),p=y=>({regex:RegExp(koi(y.val)),deser:([g])=>g,literal:!0}),h=(y=>{if(t.literal)return p(y);switch(y.val){case"G":return bT(e.eras("short"),0);case"GG":return bT(e.eras("long"),0);case"y":return Ws(l);case"yy":return Ws(d,jce);case"yyyy":return Ws(i);case"yyyyy":return Ws(f);case"yyyyyy":return Ws(a);case"M":return Ws(s);case"MM":return Ws(n);case"MMM":return bT(e.months("short",!0),1);case"MMMM":return bT(e.months("long",!0),1);case"L":return Ws(s);case"LL":return Ws(n);case"LLL":return bT(e.months("short",!1),1);case"LLLL":return bT(e.months("long",!1),1);case"d":return Ws(s);case"dd":return Ws(n);case"o":return Ws(u);case"ooo":return Ws(o);case"HH":return Ws(n);case"H":return Ws(s);case"hh":return Ws(n);case"h":return Ws(s);case"mm":return Ws(n);case"m":return Ws(s);case"q":return Ws(s);case"qq":return Ws(n);case"s":return Ws(s);case"ss":return Ws(n);case"S":return Ws(u);case"SSS":return Ws(o);case"u":return kje(c);case"uu":return kje(s);case"uuu":return Ws(r);case"a":return bT(e.meridiems(),0);case"kkkk":return Ws(i);case"kk":return Ws(d,jce);case"W":return Ws(s);case"WW":return Ws(n);case"E":case"c":return Ws(r);case"EEE":return bT(e.weekdays("short",!1),1);case"EEEE":return bT(e.weekdays("long",!1),1);case"ccc":return bT(e.weekdays("short",!0),1);case"cccc":return bT(e.weekdays("long",!0),1);case"Z":case"ZZ":return hHr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return hHr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return kje(/[a-z_+-/]{1,256}?/i);case" ":return kje(/[^\S\n\r]/);default:return p(y)}})(t)||{invalidReason:$oi};return h.token=t,h}var Uoi={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 Boi(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=Uoi[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function zoi(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Voi(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(cB(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 Hoi(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 gn(t.z)||(r=mb.create(t.z)),gn(t.Z)||(r||(r=new ng(t.Z)),n=t.Z),gn(t.q)||(t.M=(t.q-1)*3+1),gn(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),gn(t.u)||(t.S=Dce(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}var Kht=null;function Woi(){return Kht||(Kht=$n.fromMillis(1555555555555)),Kht}function Joi(t,e){if(t.literal)return t;let r=ig.macroTokenToFormatOpts(t.val),n=Zht(r,e);return n==null||n.includes(void 0)?t:n}function Ght(t,e){return Array.prototype.concat(...t.map(r=>Joi(r,e)))}var Fce=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Ght(ig.parseFormat(r),e),this.units=this.tokens.map(n=>qoi(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=zoi(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=Voi(e,this.regex,this.handlers),[o,i,a]=n?Hoi(n):[null,null,void 0];if(cB(n,"a")&&cB(n,"H"))throw new pT("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 Xht(t,e,r){return new Fce(t,r).explainFromTokens(e)}function bHr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=Xht(t,e,r);return[n,o,i,a]}function Zht(t,e){if(!t)return null;let n=ig.create(e,t).dtFormatter(Woi()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>Boi(a,t,i))}var Yht="Invalid DateTime",_Hr=864e13;function kce(t){return new og("unsupported zone",`the zone "${t.name}" is not supported`)}function Qht(t){return t.weekData===null&&(t.weekData=Ice(t.c)),t.weekData}function egt(t){return t.localWeekData===null&&(t.localWeekData=Ice(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function nW(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new $n({...r,...e,old:r})}function OHr(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 qje(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 Bje(t,e,r){return OHr(kX(t),e,r)}function vHr(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,zX(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Mc.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=kX(i),[u,l]=OHr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function QX(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=$n.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return $n.invalid(new og("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Uje(t,e,r=!0){return t.isValid?ig.create($s.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function tgt(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=Pc(t.c.year,r?6:4),e?(n+="-",n+=Pc(t.c.month),n+="-",n+=Pc(t.c.day)):(n+=Pc(t.c.month),n+=Pc(t.c.day)),n}function wHr(t,e,r,n,o,i){let a=Pc(t.c.hour);return e?(a+=":",a+=Pc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=Pc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=Pc(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=Pc(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=Pc(Math.trunc(-t.o/60)),a+=":",a+=Pc(Math.trunc(-t.o%60))):(a+="+",a+=Pc(Math.trunc(t.o/60)),a+=":",a+=Pc(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}var EHr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Koi={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Goi={ordinal:1,hour:0,minute:0,second:0,millisecond:0},PHr=["year","month","day","hour","minute","second","millisecond"],Xoi=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Zoi=["year","ordinal","hour","minute","second","millisecond"];function Yoi(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 FX(t);return e}function SHr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Yoi(t)}}function Qoi(t){return Vje[t]||(zje===void 0&&(zje=js.now()),Vje[t]=t.offset(zje)),Vje[t]}function CHr(t,e){let r=gT(e.zone,js.defaultZone);if(!r.isValid)return $n.invalid(kce(r));let n=$s.fromObject(e),o,i;if(gn(t.year))o=js.now();else{for(let u of PHr)gn(t[u])&&(t[u]=EHr[u]);let a=Fht(t)||kht(t);if(a)return $n.invalid(a);let s=Qoi(r);[o,i]=Bje(t,s,r)}return new $n({ts:o,zone:r,loc:n,o:i})}function xHr(t,e,r){let n=gn(r.round)?!0:r.round,o=(a,s)=>(a=qX(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 THr(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 zje,Vje={},$n=class t{constructor(e){let r=e.zone||js.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new og("invalid input"):null)||(r.isValid?null:kce(r));this.ts=gn(e.ts)?js.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=yT(e.o)&&!e.old?e.o:r.offset(this.ts);o=qje(this.ts,s),n=Number.isNaN(o.year)?new og("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||$s.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]=THr(arguments),[n,o,i,a,s,u,l]=r;return CHr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=THr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=ng.utcInstance,CHr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=UVr(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=gT(r.zone,js.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:$s.fromObject(r)}):t.invalid(kce(o))}static fromMillis(e,r={}){if(yT(e))return e<-_Hr||e>_Hr?t.invalid("Timestamp out of range"):new t({ts:e,zone:gT(r.zone,js.defaultZone),loc:$s.fromObject(r)});throw new Gc(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(yT(e))return new t({ts:e*1e3,zone:gT(r.zone,js.defaultZone),loc:$s.fromObject(r)});throw new Gc("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=gT(r.zone,js.defaultZone);if(!n.isValid)return t.invalid(kce(n));let o=$s.fromObject(r),i=VX(e,SHr),{minDaysInFirstWeek:a,startOfWeek:s}=Lht(i,o),u=js.now(),l=gn(r.specificOffset)?n.offset(u):r.specificOffset,c=!gn(i.ordinal),d=!gn(i.year),f=!gn(i.month)||!gn(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new pT("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new pT("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,y,g,b=qje(u,l);h?(y=Xoi,g=Koi,b=Ice(b,a,s)):c?(y=Zoi,g=Goi,b=Fje(b)):(y=PHr,g=EHr);let _=!1;for(let I of y){let N=i[I];gn(N)?_?i[I]=g[I]:i[I]=b[I]:_=!0}let w=h?FVr(i,a,s):c?kVr(i):Fht(i),T=w||kht(i);if(T)return t.invalid(T);let O=h?jht(i,a,s):c?$ht(i):i,[E,P]=Bje(O,l,n),R=new t({ts:E,zone:n,o:P,loc:o});return i.weekday&&p&&e.weekday!==R.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${R.toISO()}`):R.isValid?R:t.invalid(R.invalid)}static fromISO(e,r={}){let[n,o]=rHr(e);return QX(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=nHr(e);return QX(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=oHr(e);return QX(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(gn(e)||gn(r))throw new Gc("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=$s.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=bHr(a,e,r);return c?t.invalid(c):QX(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]=sHr(e);return QX(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Gc("need to specify a reason the DateTime is invalid");let n=e instanceof og?e:new og(e,r);if(js.throwOnInvalid)throw new Oje(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Zht(e,$s.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Ght(ig.parseFormat(e),$s.fromObject(r)).map(o=>o.val).join("")}static resetCache(){zje=void 0,Vje={}}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?Qht(this).weekYear:NaN}get weekNumber(){return this.isValid?Qht(this).weekNumber:NaN}get weekday(){return this.isValid?Qht(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?egt(this).weekday:NaN}get localWeekNumber(){return this.isValid?egt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?egt(this).weekYear:NaN}get ordinal(){return this.isValid?Fje(this.c).ordinal:NaN}get monthShort(){return this.isValid?D$.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?D$.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?D$.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?D$.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=kX(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=qje(u,a),d=qje(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[nW(this,{ts:u}),nW(this,{ts:l})]:[this]}get isInLeapYear(){return tW(this.year)}get daysInMonth(){return zX(this.year,this.month)}get daysInYear(){return this.isValid?lB(this.year):NaN}get weeksInWeekYear(){return this.isValid?eW(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?eW(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=ig.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(ng.instance(e),r)}toLocal(){return this.setZone(js.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=gT(e,js.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]=Bje(a,i,e)}return nW(this,{ts:o,zone:e})}else return t.invalid(kce(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return nW(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=VX(e,SHr),{minDaysInFirstWeek:n,startOfWeek:o}=Lht(r,this.loc),i=!gn(r.weekYear)||!gn(r.weekNumber)||!gn(r.weekday),a=!gn(r.ordinal),s=!gn(r.year),u=!gn(r.month)||!gn(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new pT("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new pT("Can't mix ordinal dates with month/day");let d;i?d=jht({...Ice(this.c,n,o),...r},n,o):gn(r.ordinal)?(d={...this.toObject(),...r},gn(r.day)&&(d.day=Math.min(zX(d.year,d.month),d.day))):d=$ht({...Fje(this.c),...r});let[f,p]=Bje(d,this.o,this.zone);return nW(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=Mc.fromDurationLike(e);return nW(this,vHr(this,r))}minus(e){if(!this.isValid)return this;let r=Mc.fromDurationLike(e).negate();return nW(this,vHr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=Mc.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?ig.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Yht}toLocaleString(e=aB,r={}){return this.isValid?ig.create(this.loc.clone(r),e).formatDateTime(this):Yht}toLocaleParts(e={}){return this.isValid?ig.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=tgt(this,a);return s+="T",s+=wHr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?tgt(this,e==="extended"):null}toISOWeekDate(){return Uje(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":"")+wHr(this,a==="extended",r,e,n,i):null}toRFC2822(){return Uje(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Uje(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?tgt(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")),Uje(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Yht}[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 Mc.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=BVr(r).map(Mc.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=pHr(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?N$.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),xHr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?xHr(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 Gc("min requires all arguments be DateTimes");return qht(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Gc("max requires all arguments be DateTimes");return qht(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=$s.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return Xht(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=$s.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new Fce(i,e)}static fromFormatParser(e,r,n={}){if(gn(e)||gn(r))throw new Gc("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=$s.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Gc(`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):QX(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return aB}static get DATE_MED(){return cce}static get DATE_MED_WITH_WEEKDAY(){return bht}static get DATE_FULL(){return dce}static get DATE_HUGE(){return fce}static get TIME_SIMPLE(){return pce}static get TIME_WITH_SECONDS(){return mce}static get TIME_WITH_SHORT_OFFSET(){return hce}static get TIME_WITH_LONG_OFFSET(){return gce}static get TIME_24_SIMPLE(){return yce}static get TIME_24_WITH_SECONDS(){return bce}static get TIME_24_WITH_SHORT_OFFSET(){return _ce}static get TIME_24_WITH_LONG_OFFSET(){return vce}static get DATETIME_SHORT(){return wce}static get DATETIME_SHORT_WITH_SECONDS(){return Sce}static get DATETIME_MED(){return Cce}static get DATETIME_MED_WITH_SECONDS(){return xce}static get DATETIME_MED_WITH_WEEKDAY(){return _ht}static get DATETIME_FULL(){return Tce}static get DATETIME_FULL_WITH_SECONDS(){return Oce}static get DATETIME_HUGE(){return Ece}static get DATETIME_HUGE_WITH_SECONDS(){return Pce}};function YX(t){if($n.isDateTime(t))return t;if(t&&t.valueOf&&yT(t.valueOf()))return $n.fromJSDate(t);if(t&&typeof t=="object")return $n.fromObject(t);throw new Gc(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function rgt(t){let e=t.match(/^(?:UTC|GMT)?([-+]?\d{1,2})(?::(\d{2}))?$/i);if(!e)throw new Error(`Invalid timezone offset format: ${t}. Use formats like '+8', '-5', '+5:30', 'UTC+8', 'GMT-5'`);let r=parseInt(e[1]),n=parseInt(e[2]||"0");if(Math.abs(r)>14||n>=60)throw new Error(`Invalid timezone offset: ${t}. Hours must be between -14 and +14, minutes must be less than 60`);let o=r>=0?"+":"",i=n>0?`:${n.toString().padStart(2,"0")}`:"";return`UTC${o}${r}${i}`}async function eii(t){let e=$n.now();if(t)try{let i=rgt(t),a=e.setZone(i);if(!a.isValid)throw new Error(`Failed to apply timezone offset: ${t}`);e=a}catch(i){throw new Error(`${i.message}`)}let r=e.toJSDate(),n=e.offset,o=e.offsetNameShort||"Unknown";return{epoch:Math.floor(r.getTime()),isoString:r.toISOString(),userLocaleString:e.toLocaleString($n.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}var MHr=cc({name:"getCurrentTime",description:"Get the current time in local timezone or at a specified UTC offset. Returns epoch time, ISO string, and formatted strings.",schema:wt.object({timezoneOffset:wt.string().optional().describe(`Optional UTC offset. IMPORTANT: Must be a numeric offset, NOT a timezone name.
|
||
|
||
EXAMPLES OF CORRECT USAGE:
|
||
- "what time is it" \u2192 No parameter (uses local time)
|
||
- "what time is it in Tokyo" \u2192 timezoneOffset: "+9"
|
||
- "what time is it in Beijing" \u2192 timezoneOffset: "+8"
|
||
- "what time is it in New York" \u2192 timezoneOffset: "-5" (or "-4" during DST)
|
||
- "what time is it in Mumbai" \u2192 timezoneOffset: "+5:30"
|
||
|
||
SUPPORTED FORMATS:
|
||
- Simple: "+8", "-5", "+5:30"
|
||
- With prefix: "UTC+8", "GMT-5", "UTC+5:30"
|
||
|
||
COMMON TIMEZONE OFFSETS:
|
||
- Tokyo: UTC+9
|
||
- Beijing/Singapore: UTC+8
|
||
- Mumbai: UTC+5:30
|
||
- Dubai: UTC+4
|
||
- London: UTC+0 (UTC+1 during BST)
|
||
- New York: UTC-5 (UTC-4 during DST)
|
||
- Los Angeles: UTC-8 (UTC-7 during DST)`)}),func:async({timezoneOffset:t})=>eii(t)}),RHr={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,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function tii(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 rii(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 nii(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=yht(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=$n.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 oii(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|sept|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=RHr[r[1]],o=e.year;n>e.month&&o--;let i=$n.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 iii(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=$n.fromObject({year:n,month:1,day:1}),i=$n.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 aii(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=$n.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 sii(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|sept|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=RHr[r[1].toLowerCase()],o=parseInt(r[2]),i=$n.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 uii(t){let e=$n.now(),r=t.toLowerCase().replace("@vault","").trim(),n=tii(r,e)||rii(r,e)||nii(r,e)||oii(r,e)||sii(r,e)||aii(r,e)||iii(r,e);if(n)return{startTime:n.start.toMillis(),endTime:n.end.toMillis()};let o=yht(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=$n.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?$n.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:i.toMillis(),endTime:a.toMillis()}}console.warn(`Unable to parse time expression: ${t}`)}function lii(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString($n.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}var IHr=cc({name:"getTimeRangeMs",description:"Convert natural language time expressions to date ranges for use with localSearch",schema:wt.object({timeExpression:wt.string().describe(`Natural language time expression to convert to a date range.
|
||
|
||
COMMON EXPRESSIONS:
|
||
- Relative past: "yesterday", "last week", "last month", "last year"
|
||
- Relative ranges: "this week", "this month", "this year"
|
||
- Specific dates: "July 1", "July 1 2023", "2023-07-01"
|
||
- Date ranges: "from July 1 to July 15", "between May and June"
|
||
- Time periods: "last 7 days", "past 30 days", "previous 3 months"
|
||
|
||
IMPORTANT: This tool is typically used as the first step before localSearch when searching notes by time.
|
||
|
||
EXAMPLE WORKFLOW:
|
||
1. User: "what did I do last week"
|
||
2. First call getTimeRangeMs with timeExpression: "last week"
|
||
3. Then use the returned time range with localSearch`)}),func:async({timeExpression:t})=>{let e=uii(t);return e||{error:`Unable to parse time expression: ${t}`}}});function cii(t){let e=t.toString().length===10?t*1e3:t,r=$n.fromMillis(e);return lii(r)}var AHr=cc({name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:wt.object({epoch:wt.number().describe("Unix timestamp in seconds or milliseconds")}),func:async({epoch:t})=>cii(t)});async function dii(t,e,r){let n=rgt(e),o=rgt(r);try{let i=$n.now().setZone(n),a=bVr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=$n.fromJSDate(a,{zone:n}),u=s.setZone(o);if(!u.isValid)throw new Error("Invalid timezone conversion");let l=u.toJSDate(),c=u.offset;return{epoch:Math.floor(l.getTime()),isoString:l.toISOString(),userLocaleString:u.toLocaleString($n.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString($n.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString($n.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var NHr=cc({name:"convertTimeBetweenTimezones",description:"Convert a specific time from one timezone to another using UTC offsets",schema:wt.object({time:wt.string().describe(`Time to convert. Supports various formats:
|
||
- 12-hour: "6pm", "3:30 PM", "11:45 am"
|
||
- 24-hour: "18:00", "15:30", "23:45"
|
||
- Relative: "noon", "midnight"`),fromOffset:wt.string().describe(`Source UTC offset. Must be numeric, not timezone name.
|
||
Examples: "-8" for PT, "+0" for London, "+8" for Beijing`),toOffset:wt.string().describe(`Target UTC offset. Must be numeric, not timezone name.
|
||
Examples: "+9" for Tokyo, "-5" for NY, "+5:30" for Mumbai
|
||
|
||
EXAMPLE USAGE:
|
||
- "what time is 6pm PT in Tokyo" \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"
|
||
- "convert 3:30 PM EST to London time" \u2192 time: "3:30 PM", fromOffset: "-5", toOffset: "+0"
|
||
- "what is 9am Beijing time in New York" \u2192 time: "9am", fromOffset: "+8", toOffset: "-5"`)}),func:async({time:t,fromOffset:e,toOffset:r})=>dii(t,e,r)});mA();Fc();Ye();Bt();var DHr=5e4,jHr=cc({name:"youtubeTranscription",description:"Get transcripts of YouTube videos when the user provides YouTube URLs",schema:wt.object({_userMessageContent:wt.string().optional().describe("Internal: user message content injected by the system")}),func:async t=>{let{_userMessageContent:e}=t;if(typeof e!="string")return{success:!1,message:"Invalid input: User message must be a string"};if(e.length>DHr)return{success:!1,message:`Input too long: Maximum allowed length is ${DHr} characters`};let r=M1t(e);if(r.length===0)return{success:!1,message:"No YouTube URLs found in the user prompt. URLs must be in the user prompt instead of the context notes."};let n=await Promise.all(r.map(async i=>{try{let a=o_()&&te().supadataApiKey?await JEe(i):await Ql.getInstance().youtube4llm(i);return a.response.transcript?{url:i,success:!0,transcript:a.response.transcript,elapsed_time_ms:a.elapsed_time_ms}:{url:i,success:!1,message:"Transcript not available. Only English videos with auto transcript enabled are supported"}}catch(a){return console.error(`Error transcribing YouTube video ${i}:`,a),{url:i,success:!1,message:"An error occurred while transcribing the YouTube video"}}}));return{success:n.some(i=>i.success),results:n,total_urls:r.length}}});var fii=[{tool:gje,metadata:{id:"localSearch",displayName:"Vault Search",description:"Search through your vault notes",category:"search",copilotCommands:["@vault"],customPromptInstructions:`For localSearch (searching notes based on their contents in the vault):
|
||
- You MUST always provide both "query" (string) and "salientTerms" (array of strings)
|
||
- salientTerms MUST be extracted from the user's original query - never invent new terms
|
||
- They are keywords used for BM25 full-text search to find notes containing those exact words
|
||
- Treat every token that begins with "#" as a high-priority salient term. Keep the leading "#" and the full tag hierarchy (e.g., "#project/phase1").
|
||
- Include tagged terms alongside other meaningful words; never strip hashes or rewrite tags into plain words.
|
||
- Extract meaningful content words from the query (nouns, verbs, names, etc.)
|
||
- Exclude common words like "what", "I", "do", "the", "a", etc.
|
||
- Exclude time expressions like "last month", "yesterday", "last week"
|
||
- Preserve the original language - do NOT translate terms to English
|
||
|
||
Evaluating search results and re-searching:
|
||
- Results include a relevance quality summary: high (score \u22650.7), medium (0.3-0.7), low (<0.3)
|
||
- If most results are low relevance or miss key concepts from the user's question:
|
||
1. Try searching again with synonyms or related terms
|
||
2. Use more specific phrasing if query was too broad
|
||
3. Use more general phrasing if query was too narrow
|
||
- Example: "machine learning algorithms" returned low results \u2192 try "ML models", "neural networks", or "AI techniques"
|
||
|
||
Examples:
|
||
- Query "piano learning practice" \u2192 query: "piano learning practice", salientTerms: ["piano", "learning", "practice"]
|
||
- Query "#projectx status update" \u2192 query: "#projectx status update", salientTerms: ["#projectx", "status", "update"]
|
||
- Query "\u94A2\u7434\u5B66\u4E60" (Chinese) \u2192 query: "\u94A2\u7434\u5B66\u4E60", salientTerms: ["\u94A2\u7434", "\u5B66\u4E60"] (preserve original language)
|
||
|
||
For time-based searches (e.g., "what did I do last week"):
|
||
1. First call getTimeRangeMs with timeExpression: "last week"
|
||
2. Then use localSearch with the returned timeRange, query matching the user's question, and salientTerms: [] (empty for generic time queries)
|
||
|
||
For time-based searches with meaningful terms (e.g., "python debugging notes from yesterday"):
|
||
1. First call getTimeRangeMs with timeExpression: "yesterday"
|
||
2. Then use localSearch with the returned timeRange, query: "python debugging notes", salientTerms: ["python", "debugging", "notes"]
|
||
|
||
For exhaustive "find all" searches:
|
||
- Set returnAll: true when the user wants ALL matching notes (e.g., "find all my X", "list every Y", "show me all Z", "how many notes about W")
|
||
- Keep returnAll: false (or omit) for normal questions seeking specific information
|
||
- When setting returnAll: true, also call getFileTree to get all note titles as reference. This helps verify search completeness and identify notes the search may have missed.`}},{tool:yje,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the INTERNET (NOT vault notes) when user explicitly asks for web/online information",category:"search",copilotCommands:["@websearch","@web"],customPromptInstructions:`For webSearch:
|
||
- ONLY use when the user's query contains explicit web-search intent like:
|
||
* "web search", "internet search", "online search"
|
||
* "Google", "search online", "look up online", "search the web"
|
||
- Always provide an empty chatHistory array
|
||
|
||
Example: "search the web for python tutorials" \u2192 query: "python tutorials", chatHistory: []`}},{tool:MHr,metadata:{id:"getCurrentTime",displayName:"Get Current Time",description:"Get the current time in any timezone",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time queries (IMPORTANT: Always use UTC offsets, not timezone names):
|
||
|
||
- If the user mentions a specific city, country, or timezone name (e.g., "Tokyo", "Japan", "JST"), you MUST convert it to the correct UTC offset and pass it via the timezoneOffset parameter (e.g., "+9").
|
||
- Only omit timezoneOffset when the user asks for the current local time without naming any location or timezone.
|
||
- If you cannot confidently determine the offset from the user request, ask the user to clarify before calling the tool.
|
||
|
||
Examples:
|
||
- "what time is it" (local time) \u2192 call with no parameters
|
||
- "what time is it in Tokyo" (UTC+9) \u2192 timezoneOffset: "+9"
|
||
- "what time is it in New York" (UTC-5 or UTC-4 depending on DST) \u2192 timezoneOffset: "-5"`}},{tool:AHr,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:IHr,metadata:{id:"getTimeRangeMs",displayName:"Get Time Range",description:"Convert time expressions to date ranges",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For time-based queries:
|
||
- Use this tool to convert time expressions like "last week", "yesterday", "last month" to proper time ranges
|
||
- This is typically the first step before using localSearch with a time range
|
||
|
||
Example: For "last week" \u2192 timeExpression: "last week"`}},{tool:NHr,metadata:{id:"convertTimeBetweenTimezones",displayName:"Convert Timezones",description:"Convert time between different timezones",category:"time",isAlwaysEnabled:!0,customPromptInstructions:`For timezone conversions:
|
||
|
||
Example: "what time is 6pm PT in Tokyo" (PT is UTC-8 or UTC-7, Tokyo is UTC+9) \u2192 time: "6pm", fromOffset: "-8", toOffset: "+9"`}},{tool:_2r,metadata:{id:"readNote",displayName:"Read Note",description:"Read a specific note in sequential chunks using its own line-chunking logic.",category:"file",requiresVault:!0,isAlwaysEnabled:!0,customPromptInstructions:`For readNote:
|
||
- Decide based on the user's request: only call this tool when the question requires reading note content.
|
||
- If the user asks about a note title that is already mentioned in the current or previous turns of the conversation, or linked in <active_note> or <note_context> blocks, call readNote directly\u2014do not use localSearch to look it up. Even if the note title mention is partial but similar to what you have seen in the context, try to infer the correct note path from context. Skip the tool when a note is irrelevant to the user query.
|
||
- If the user asks about notes linked from that note, read the original note first, then follow the "linkedNotes" paths returned in the tool result to inspect those linked notes.
|
||
- Always start with chunk 0 (omit chunkIndex or set it to 0). Only request the next chunk if the previous chunk did not answer the question.
|
||
- Pass vault-relative paths without a leading slash. If a call fails, adjust the path (for example, add ".md" or use an alternative candidate) and retry only if necessary.
|
||
- Every tool result may include a "linkedNotes" array. If the user needs information from those linked notes, call readNote again with one of the provided candidate paths, starting again at chunk 0. Do not expand links you don't need.
|
||
- Stop calling readNote as soon as you have the required information.
|
||
- Always call getFileTree to get the exact note path if it is not provided in the context before calling readNote.
|
||
|
||
Examples:
|
||
- First chunk: notePath: "Projects/launch-plan.md" (chunkIndex omitted or 0)
|
||
- Next chunk: notePath: "Projects/launch-plan.md", chunkIndex: 1`}},{tool:fje,metadata:{id:"writeToFile",displayName:"Write to File",description:"Create or modify files in your vault",category:"file",requiresVault:!0,timeoutMs:0,copilotCommands:["@composer"],customPromptInstructions:`For writeToFile:
|
||
- NEVER display the file content directly in your response
|
||
- Always pass the complete file content to the tool
|
||
- Include the full path to the file
|
||
- You MUST explicitly call writeToFile for any intent of updating or creating files
|
||
- Do not call writeToFile tool again if the result is not accepted
|
||
- Do not call writeToFile tool if no change needs to be made
|
||
- Always create new notes in root folder or folders the user explicitly specifies
|
||
- When creating a new note in a folder, you MUST use getFileTree to get the exact folder path first
|
||
|
||
Examples:
|
||
- Basic: path: "path/to/note.md", content: "FULL CONTENT OF THE NOTE"
|
||
- Skip confirmation: path: "path/to/note.md", content: "FULL CONTENT", confirmation: false`}},{tool:h2r,metadata:{id:"replaceInFile",displayName:"Replace in File",description:"Make targeted changes to existing files using SEARCH/REPLACE blocks",category:"file",requiresVault:!0,timeoutMs:0,customPromptInstructions:`For replaceInFile:
|
||
- Remember: Small edits \u2192 replaceInFile, Major rewrites \u2192 writeToFile
|
||
- SEARCH text must match EXACTLY including all whitespace
|
||
- The diff parameter uses SEARCH/REPLACE block format
|
||
|
||
Example: To add "Bob Johnson" to attendees list in notes/meeting.md:
|
||
path: "notes/meeting.md"
|
||
diff: "------- SEARCH\\n## Attendees\\n- John Smith\\n- Jane Doe\\n=======\\n## Attendees\\n- John Smith\\n- Jane Doe\\n- Bob Johnson\\n+++++++ REPLACE"`}},{tool:jHr,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",isPlusOnly:!0,requiresUserMessageContent:!0,customPromptInstructions:`For youtubeTranscription:
|
||
- Use when user provides YouTube URLs
|
||
- No parameters needed - the tool will process URLs from the conversation`}}];function pii(t){yd.getInstance().register({tool:b2r(t.getRoot()),metadata:{id:"getFileTree",displayName:"File Tree",description:"Browse vault file structure",category:"file",isAlwaysEnabled:!0,requiresVault:!0,isBackground:!0,customPromptInstructions:`For getFileTree:
|
||
- Use to browse the vault's file structure including paths of notes and folders
|
||
- Always call this tool to explore the exact path of notes or folders when you are not given the exact path.
|
||
- DO NOT use this tool to look up note contents or metadata - use localSearch or readNote instead.
|
||
- No parameters needed
|
||
|
||
Example queries that should use getFileTree:
|
||
- "Create a new note in the projects folder" \u2192 call getFileTree to get the exact folder path
|
||
- "Create a new note using the quick note template" \u2192 call getFileTree to look up the template path
|
||
- "How many files are in the projects folder" \u2192 call getFileTree to list all files`}})}function mii(){yd.getInstance().register({tool:C2r(),metadata:{id:"getTagList",displayName:"Tag List",description:"List vault tags with occurrence statistics",category:"file",isAlwaysEnabled:!0,requiresVault:!0,isBackground:!0,customPromptInstructions:`For getTagList:
|
||
- Use to inspect existing tags before suggesting new ones or reorganizing notes.
|
||
- Omit parameters to include both frontmatter and inline tags.
|
||
- Set includeInline to false when you only need frontmatter-defined tags.
|
||
- Use maxEntries to limit output for very large vaults.
|
||
|
||
Examples:
|
||
- Default (all tags): call with no parameters
|
||
- Frontmatter only: includeInline: false`}})}function hii(){yd.getInstance().register({tool:pje,metadata:{id:"updateMemory",displayName:"Update Memory",description:"Save information to user memory when the user explicitly asks to remember something or update the memory",category:"memory",copilotCommands:["@memory"],isAlwaysEnabled:!0,customPromptInstructions:`For updateMemory:
|
||
- Use this tool to update the memory when the user explicitly asks to update the memory
|
||
- DO NOT use for general information - only for personal facts, preferences, or specific things the user wants stored
|
||
|
||
Example: statement: "I'm studying Japanese and I'm preparing for JLPT N3"`}})}function eZ(t){let e=yd.getInstance(),r=te(),n=e.getToolMetadata("getFileTree")!==void 0,o=t!==void 0,i=e.getToolMetadata("updateMemory")!==void 0,a=r.enableSavedMemory;(e.getAllTools().length===0||n!==o||i!==a)&&(e.clear(),e.registerAll(fii),t&&(pii(t),mii()),r.enableSavedMemory&&hii())}Bt();Bt();var Hje=class{constructor(e,r){this.toolManager=e;this.writeToFileTool=r;this.buffer=""}findCompleteBlock(e){let r=/<writeToFile>[\s\S]*?<\/writeToFile>/,n=e.match(r);return!n||n.index===void 0?null:{block:n[0],endIdx:n.index+n[0].length}}async*processChunk(e){let r="";if(Array.isArray(e.content))for(let o of e.content)o.type==="text"&&o.text!=null&&(r+=o.text);else e.content!=null&&(r=e.content);r&&(this.buffer+=r),yield e;let n=this.findCompleteBlock(this.buffer);for(;n;){let{block:o,endIdx:i}=n,a=o.match(/<path>([\s\S]*?)<\/path>/),s=o.match(/<content>([\s\S]*?)<\/content>/),u=a?a[1].trim():void 0,l=s?s[1].trim():void 0;try{let c=await this.toolManager.callTool(this.writeToFileTool,{path:u,content:l}),d=P$.format("writeToFile",c);yield{...e,content:`
|
||
${d}
|
||
`}}catch(c){yield{...e,content:`
|
||
Error: ${c?.message||c}
|
||
`}}this.buffer=this.buffer.substring(i),n=this.findCompleteBlock(this.buffer)}}};Xe();function $Hr(t){if(!Array.isArray(t)||t.length===0)return{high:0,medium:0,low:0,total:0,averageScore:0};let e=0,r=0,n=0,o=0;for(let i of t){let a=i.rerank_score??i.score??0;o+=a,a>=.7?e++:a>=.3?r++:n++}return{high:e,medium:r,low:n,total:t.length,averageScore:o/t.length}}function LHr(t){let e=[];return t.high>0&&e.push(`${t.high} high`),t.medium>0&&e.push(`${t.medium} medium`),t.low>0&&e.push(`${t.low} low`),e.length===0?"[Relevance: no results]":`[Relevance: ${e.join(", ")}]`}function ogt(t){if(!Array.isArray(t))return"";let e=t.filter(n=>n.includeInContext!==!1);return e.length===0?"No relevant documents found.":e.map((n,o)=>{let i=n.title||"Untitled",a=n.path||"",s=n.__sourceId||n.collection_name||n.source_id||o+1,u=null;if(n.mtime){let l=new Date(n.mtime);isNaN(l.getTime())||(u=l.toISOString())}return`<document>
|
||
<id>${s}</id>
|
||
<title>${i}</title>${a&&a!==i?`
|
||
<path>${a}</path>`:""}${u?`
|
||
<modified>${u}</modified>`:""}
|
||
<content>
|
||
${n.content||""}
|
||
</content>
|
||
</document>`}).filter(n=>n.length>0).join(`
|
||
|
||
`)}function FHr(t){try{let e=JSON.parse(t);return Array.isArray(e)?ogt(e):"Invalid search results format."}catch(e){return Te("Failed to format localSearch result string:",e),"Error processing search results."}}function kHr(t){return Array.isArray(t)?t.map(e=>({title:e.title||e.path||"Untitled",path:e.path||e.title||"",score:e.rerank_score||e.score||0,explanation:e.explanation||null})):[]}function ngt(t){if(typeof t=="number"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}if(typeof t=="string"){let e=new Date(t);return isNaN(e.getTime())?"":e.toISOString()}return""}function gii(t){if(!t)return"";let e=[];try{if(Array.isArray(t.lexicalMatches)&&t.lexicalMatches.length>0){let r=new Set,n=new Set;for(let a of t.lexicalMatches)a?.field&&r.add(String(a.field)),a?.query&&n.add(String(a.query));let o=Array.from(r).join("/"),i=Array.from(n).slice(0,3).join(", ");e.push(`Lexical(${o}): ${i}${n.size>3?", ...":""}`)}if(typeof t.semanticScore=="number"&&t.semanticScore>0&&e.push(`Semantic: ${(t.semanticScore*100).toFixed(1)}%`),t.folderBoost&&typeof t.folderBoost.boostFactor=="number"){let r=t.folderBoost,n=r.folder||"root";e.push(`Folder +${r.boostFactor.toFixed(2)} (${n})`)}if(t.graphConnections&&typeof t.graphConnections=="object"){let r=t.graphConnections,n=[];r.backlinks>0&&n.push(`${r.backlinks} backlinks`),r.coCitations>0&&n.push(`${r.coCitations} co-cites`),r.sharedTags>0&&n.push(`${r.sharedTags} tags`),typeof r.score=="number"?e.push(`Graph ${r.score.toFixed(1)}${n.length?` (${n.join(", ")})`:""}`):n.length&&e.push(`Graph (${n.join(", ")})`)}if(t.graphBoost&&typeof t.graphBoost.boostFactor=="number"&&!t.graphConnections){let r=t.graphBoost;e.push(`Graph +${r.boostFactor.toFixed(2)} (${r.connections} connections)`)}typeof t.baseScore=="number"&&typeof t.finalScore=="number"&&t.baseScore!==t.finalScore&&e.push(`Score: ${t.baseScore.toFixed(4)}\u2192${t.finalScore.toFixed(4)}`)}catch{}return e.join(" | ")}function qHr(t,e,r=1){let n=r,o=[];if(t.length>0){let i=t.map(a=>{let s=a.__sourceId||n++,u=a.title||"Untitled",l=a.path||"",c=a.matchType||a.source||"filter",d=ngt(a.mtime);return`<document>
|
||
<id>${s}</id>
|
||
<title>${u}</title>
|
||
<path>${l}</path>
|
||
<matchType>${c}</matchType>${d?`
|
||
<modified>${d}</modified>`:""}
|
||
<content>
|
||
${a.content||""}
|
||
</content>
|
||
</document>`}).join(`
|
||
|
||
`);o.push(`<filterResults>
|
||
${i}
|
||
</filterResults>`)}if(e.length>0){let i=e.map(a=>{let s=a.__sourceId||n++,u=a.title||"Untitled",l=a.path||"",c=ngt(a.mtime);return`<document>
|
||
<id>${s}</id>
|
||
<title>${u}</title>${l&&l!==u?`
|
||
<path>${l}</path>`:""}${c?`
|
||
<modified>${c}</modified>`:""}
|
||
<content>
|
||
${a.content||""}
|
||
</content>
|
||
</document>`}).join(`
|
||
|
||
`);o.push(`<searchResults>
|
||
${i}
|
||
</searchResults>`)}return o.length===0?"No relevant documents found.":o.join(`
|
||
|
||
`)}function UHr(t){if(!Array.isArray(t)||t.length===0){F("Search Results: (none)");return}let e=0,r=t.map((u,l)=>{let c=ngt(u.mtime),d=typeof u.rerank_score=="number"?u.rerank_score:u.score||0,f=(Number.isFinite(d)?d:0).toFixed(4),p=u.chunkId||u.path||"",m=gii(u.explanation),h=u.includeInContext!==!1;return h&&e++,{idx:String(l+1),in:h?"Y":"",path:p,mtime:c,score:f,explanation:m}}),n=r.length;F(`Search Results (debug table): ${n} rows; in-context ${e}/${n}`),p1t(r,["idx","in","path","mtime","score","explanation"]);let o=u=>String(u||"").replace(/\|/g,"\\|"),i="| # | IN | PATH | MTIME | SCORE | EXPLANATION |",a="| ---: | :-: | --- | --- | ---: | --- |",s=r.map(u=>`| ${u.idx} | ${u.in} | ${o(u.path)} | ${u.mtime||""} | ${u.score} | ${o(u.explanation)} |`);fye(["",`Results: ${n} rows; in-context ${e}/${n}`,"",i,a,...s,""])}function BHr(t,e){return[t,e].map(n=>n?.trim()).filter(n=>!!n).join(`
|
||
|
||
`)}function zHr(t,e){let r=t?`
|
||
${t}
|
||
`:"";return`<localSearch${e?` timeRange="${e}"`:""}>${r}</localSearch>`}function igt(t,e){let r=t.trim();return r?`${r}
|
||
|
||
${e}`:e}function VHr(t,e){let r=e.trim();return!r||t.includes(r)?t:igt(t,`[User query]:
|
||
${r}`)}function HHr(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf("![",r);if(n===-1)break;let o=_ii(t,n+2);if(o===null){r=n+2;continue}let i=o+1;for(;i<t.length&&Wje(t[i]);)i++;if(t[i]!=="("){r=i;continue}let a=vii(t,i);if(a===null){r=i+1;continue}let s=yii(t.slice(i+1,a));s&&e.push(s),r=a+1}return e}function yii(t){let e=t.trim();if(e.length===0)return null;if(e.startsWith("<")){let n=wii(e,0);if(n===null)return null;let o=e.slice(1,n).trim();return o.length>0?o:null}let r=bii(e).trim();return r.length>0?r:null}function bii(t){let e=t.trimEnd();if(e.length===0)return"";let r=e[e.length-1];if(r==='"'||r==="'"){let o=Sii(e,r,e.length-1);if(o!==null){let i=e.slice(0,o);if(i.length>0&&Wje(i[i.length-1]))return i.trimEnd()}}if(r===")"){let n=Cii(e);if(n!==null){let o=e.slice(0,n);if(o.length>0&&Wje(o[o.length-1]))return o.trimEnd()}}return e}function _ii(t,e){let r=e,n=0;for(;r<t.length;){let o=t[r];if(o==="\\"){r+=2;continue}if(o==="["){n++,r++;continue}if(o==="]"){if(n===0)return r;n--,r++;continue}r++}return null}function vii(t,e){let r=e+1,n=1,o=!0,i=!1;for(;r<t.length;){let a=t[r];if(i){if(a==="\\"){r+=2;continue}if(a===">"){i=!1,o=!1,r++;continue}r++;continue}if(o){if(Wje(a)){r++;continue}if(a==="<"){i=!0,r++;continue}o=!1}if(a==="\\"){r+=2;continue}if(a==="("){n++,r++;continue}if(a===")"){if(n--,n===0)return r;r++;continue}r++}return null}function wii(t,e){for(let r=e+1;r<t.length;r++){let n=t[r];if(n==="\\"){r++;continue}if(n===">")return r}return null}function Sii(t,e,r){for(let n=r-1;n>=0;n--)if(t[n]===e&&!WHr(t,n))return n;return null}function Cii(t){if(t.length===0||t[t.length-1]!==")")return null;let e=0;for(let r=t.length-1;r>=0;r--){let n=t[r];if(!((n===")"||n==="(")&&WHr(t,r))){if(n===")"){e++;continue}if(n==="("&&(e--,e===0))return r}}return null}function WHr(t,e){let r=0;for(let n=e-1;n>=0&&t[n]==="\\";n--)r++;return r%2===1}function Wje(t){return t===" "||t===" "||t===`
|
||
`||t==="\r"}function Rc(t){return typeof t!="string"?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function JHr(t){return typeof t!="string"?"":t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}ra();var aN=class extends jD{constructor(){super(...arguments);this.lastCitationSources=null}getAvailableToolsForPlanning(){let r=yd.getInstance();return r.getAllTools().length===0&&eZ(this.chainManager.app?.vault),r.getAllTools().map(o=>o.tool).filter(o=>o.name==="getCurrentTime"||o.name==="convertTimeBetweenTimezones"||o.name==="getTimeInfoByEpoch"||o.name==="getTimeRangeMs"||o.name==="getFileTree")}async planToolCalls(r,n){let o=this.getAvailableToolsForPlanning();if(typeof n.bindTools!="function")return Te("[CopilotPlus] Model does not support native tool calling, skipping tool planning"),{toolCalls:[],salientTerms:this.extractSalientTermsFromQuery(r),returnAll:!1};let i=n.bindTools(o),s=[{role:Mte(n),content:`You are a helpful AI assistant. Analyze the user's message and determine if any tools should be called.
|
||
|
||
Guidelines:
|
||
- Use tools when the user's request requires external information or computation
|
||
- For time-related queries, use getTimeRangeMs to convert time expressions to timestamps
|
||
- For file structure queries, use getFileTree to explore the vault
|
||
- If no tools are needed, respond with your analysis
|
||
|
||
After analyzing, extract key search terms from the user's message that would be useful for searching notes:
|
||
- Extract meaningful nouns, topics, and specific concepts
|
||
- Preserve the EXACT words and language from the user's message (works for any language)
|
||
- Exclude time expressions (those are handled by tools)
|
||
|
||
Include your extracted terms as: [SALIENT_TERMS: term1, term2, term3]
|
||
|
||
If the user wants ALL matching notes (e.g., "find all my X", "list every Y", "show me all Z", "how many notes about W"), output: [RETURN_ALL: true]
|
||
Otherwise omit RETURN_ALL or output: [RETURN_ALL: false]`},{role:"user",content:r}];F("[CopilotPlus] Requesting tool planning with native tool calling...");let u=await Vb(()=>i.invoke(s)),l=u.tool_calls||[],c=typeof u.content=="string"?u.content:String(u.content);F("[CopilotPlus] Native tool calls:",l.length);let{salientTerms:d,returnAll:f}=this.extractPlanningFieldsFromResponse(c,r),p=[];for(let m of l){let h=o.find(y=>y.name===m.name);h?(p.push({tool:h,args:m.args}),F(`[CopilotPlus] Tool call: ${m.name}`,m.args)):Te(`[CopilotPlus] Tool '${m.name}' not found in available tools`)}return{toolCalls:p,salientTerms:d,returnAll:f}}extractPlanningFieldsFromResponse(r,n){let o,i=r.match(/\[SALIENT_TERMS:\s*([^\]]+?)\s*\]/i);if(i){let u=i[1].split(",").map(l=>l.trim()).filter(l=>l.length>0);o=u.length>0?u:this.extractSalientTermsFromQuery(n)}else o=this.extractSalientTermsFromQuery(n);let a=r.match(/\[RETURN_ALL:\s*(true|false)\s*\]/i),s=a?a[1].toLowerCase()==="true":!1;return{salientTerms:o,returnAll:s}}extractSalientTermsFromQuery(r){return r.split(/[\s\p{P}]+/u).filter(n=>n.length>=3).slice(0,10)}async processAtCommands(r,n,o){let i=r.toLowerCase(),a=this.removeAtCommands(r),s=[...n];if(i.includes("@vault")&&(s.some(l=>l.tool.name==="localSearch")||s.push({tool:gje,args:{query:a,salientTerms:o.salientTerms,timeRange:o.timeRange,returnAll:o.returnAll===!0?!0:void 0}})),(i.includes("@websearch")||i.includes("@web"))&&!s.some(l=>l.tool.name==="webSearch")){let c=await ry.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=gye(c);s.push({tool:yje,args:{query:a,chatHistory:d}})}return i.includes("@memory")&&(s.some(l=>l.tool.name==="updateMemory")||s.push({tool:pje,args:{statement:a}})),s}removeAtCommands(r){return r.split(" ").filter(n=>!OX.includes(n.toLowerCase())).join(" ").trim()}async processImageUrls(r){let n=[],o=await _H.processUrlBatch(r,n,this.chainManager.app.vault);return _H.showFailedImagesNotice(n),o}async processChatInputImages(r){let n=[],o=await _H.processChatImageBatch(r,n,this.chainManager.app.vault);return _H.showFailedImagesNotice(n),o}async extractImagesFromContextBlock(r,n){let i=new RegExp(`<${n.tagName}>([\\s\\S]*?)<\\/${n.tagName}>`).exec(r);if(!i)return[];let a=i[1],u=/<content>([\s\S]*?)<\/content>/.exec(a),l=u?JHr(u[1]):"";if(!l)return[];let d=new RegExp(`<${n.identifierTag}>(.*?)<\\/${n.identifierTag}>`).exec(a),f=d?d[1]:void 0;F(`[CopilotPlus] Extracting images from ${n.displayName}:`,f||`no ${n.identifierTag}`);let p=n.useForResolution?f:void 0;return this.extractEmbeddedImages(l,p)}async extractEmbeddedImages(r,n){let o=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,i=[],a=[...r.matchAll(o)];for(let u of a){let l=u[1];if(n){let c=app.metadataCache.getFirstLinkpathDest(l,n);c?i.push(c.path):(Te(`Could not resolve embedded image: ${l} from source: ${n}`),i.push(l))}else i.push(l)}let s=HHr(r);for(let u of s){if(!u)continue;if(u.match(/^https?:\/\//)){i.push(u);continue}let l=u.replace(/^\.\//,"").replace(/^\//,"");if(n){let c=app.metadataCache.getFirstLinkpathDest(l,n);c?i.push(c.path):i.push(l)}else i.push(l)}return i}async buildMessageContent(r,n){let o=[],i=[],a=te(),s=[];if(a.passMarkdownImages){let d=n.contextEnvelope;if(!d)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot extract images.");let f=d.layers.find(p=>p.id==="L3_TURN");if(f){let p=[{tagName:"active_note",identifierTag:"path",displayName:"active note",useForResolution:!0},{tagName:"active_web_tab",identifierTag:"url",displayName:"active web tab",useForResolution:!1}];for(let m of p){let h=await this.extractImagesFromContextBlock(f.text,m);h.length>0&&s.push({urls:h,type:"embedded"})}}}for(let d of s){let f=await this.processImageUrls(d.urls);i.push(...f.successfulImages),o.push(...f.failureDescriptions)}let u=n.content;if(u&&u.length>0){let d=await this.processChatInputImages(u);i.push(...d.successfulImages),o.push(...d.failureDescriptions)}let l=r;o.length>0&&(l=`${r}
|
||
|
||
Note:
|
||
${o.join(`
|
||
`)}
|
||
`);let c=[{type:"text",text:l}];return i.length>0&&c.push(...i),c}hasCapability(r,n){let o=r.modelName||r.model||"";return this.chainManager.chatModelManager.findModelByName(o)?.capabilities?.includes(n)??!1}isMultimodalModel(r){return this.hasCapability(r,"vision")}appendComposerInstructionsIfNeeded(r,n){if(!n.message||!n.message.includes("@composer"))return r;let o=`<OUTPUT_FORMAT>
|
||
${F1t}
|
||
</OUTPUT_FORMAT>`;return`${r}
|
||
|
||
${o}`}async streamMultimodalResponse(r,n,o,i,a,s,u){let l=this.chainManager.memoryManager.getMemory(),c=this.chainManager.chatModelManager.getChatModel(),d=this.isMultimodalModel(c),f=[],p=n.contextEnvelope;if(!p)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot proceed with CopilotPlus chain.");F("[CopilotPlus] Using envelope-based context construction");let m=_A.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),h=m.find(w=>w.role==="system");h&&f.push({role:Mte(c),content:h.content}),await Oq(l,f);let y=m.find(w=>w.role==="user");if(y){let w,T=o.length>0,O=P=>{let R="[User query]:";if(P.includes(R))return P;let I=P.trimEnd(),N=[];I.length>0&&N.push(I);let z=s.trim()||n.originalMessage?.trim()||"";return z.length>0?N.push(`${R}
|
||
${z}`):N.push(R),N.join(`
|
||
|
||
`)};if(T){let P=this.formatAllToolOutputs(o),R=O(y.content);w=igt(P,R)}else w=O(y.content);if(r.includes("<OUTPUT_FORMAT>")&&!w.includes("<OUTPUT_FORMAT>")){let P=r.match(/<OUTPUT_FORMAT>[\s\S]*?<\/OUTPUT_FORMAT>/);P&&(w+=`
|
||
|
||
`+P[0])}let E=d?await this.buildMessageContent(w,n):w;f.push({role:"user",content:E})}F("Final request to AI",{messages:f.length});let g=c?.modelName;Eq({messages:f,modelName:g,contextEnvelope:n.contextEnvelope});let b=new Hje(E$,fje),_=await Vb(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:i.signal}));for await(let w of _){if(i.signal.aborted){F("CopilotPlus multimodal stream iteration aborted",{reason:i.signal.reason});break}for await(let T of b.processChunk(w))a.processChunk(T)}}async run(r,n,o,i,a){let{updateLoadingMessage:s}=a,u=this.chainManager.chatModelManager.getChatModel(),c=!this.hasCapability(u,"reasoning"),d=new dv(o,c),f=[];if(!await E0({isCopilotPlus:!0})){await this.handleError(new Error("Invalid license key"),d.processErrorChunk.bind(d));let _=d.close().content;return this.handleResponse(_,r,n,i,o,void 0)}try{F("==== Step 1: Planning tools ====");let _,w=r.contextEnvelope;if(!w)throw new Error("[CopilotPlus] Context envelope is required but not available. Cannot proceed with CopilotPlus chain.");let O=w.layers.find(V=>V.id==="L5_USER")?.text||r.originalMessage||"";try{let V=this.chainManager.chatModelManager.getChatModel(),k=await this.planToolCalls(O,V),X,B=k.toolCalls.find(Y=>Y.tool.name==="getTimeRangeMs");if(B){let Y=await E$.callTool(B.tool,B.args),K=oe=>oe?.startTime?.epoch!==void 0&&oe?.endTime?.epoch!==void 0?{startTime:oe.startTime.epoch,endTime:oe.endTime.epoch}:oe;if(typeof Y=="string")try{let oe=JSON.parse(Y);oe.error||(X=K(oe))}catch{Te("[CopilotPlus] Failed to parse getTimeRangeMs result:",Y)}else Y&&!Y.error&&(X=K(Y));F("[CopilotPlus] Executed getTimeRangeMs, result:",X)}let Q=k.toolCalls.filter(Y=>Y.tool.name==="getFileTree"&&a5()?(F("Skipping getFileTree in project mode"),!1):Y.tool.name==="getTimeRangeMs"&&X?(F("Skipping getTimeRangeMs - already executed during planning"),!1):!0);_=await this.processAtCommands(O,Q,{salientTerms:k.salientTerms,timeRange:X,returnAll:k.returnAll})}catch(V){return this.handleResponse(_1t(V),r,n,i,o)}let E=r.contextEnvelope?.layers.find(V=>V.id==="L5_USER")?.text,P=this.removeAtCommands(E||r.originalMessage||r.message),{toolOutputs:R,sources:I}=await this.executeToolCalls(_,s);f=I;let N=R.filter(V=>V.output!=null),z=this.appendComposerInstructionsIfNeeded(P,r);F("Invoking LLM with envelope-based context construction"),await this.streamMultimodalResponse(z,r,N,n,d,P,s)}catch(_){s?.(dw.DEFAULT),_.name==="AbortError"||n.signal.aborted?F("CopilotPlus stream aborted by user",{reason:n.signal.reason}):await this.handleError(_,d.processErrorChunk.bind(d))}if(n.signal.aborted&&n.signal.reason==="new-chat")return o(""),"";let m=d.close(),h=m.content,y={wasTruncated:m.wasTruncated,tokenUsage:m.tokenUsage??void 0},g=te(),b=this.lastCitationSources&&this.lastCitationSources.length>0?this.lastCitationSources:(f||[]).map(_=>({title:_.title,path:_.path}));return h=QDe(h,b,g.enableInlineCitations),await this.handleResponse(h,r,n,i,o,f,void 0,y),h}async executeToolCalls(r,n){let o=[],i=[],a=r.some(s=>s.tool.name==="localSearch");for(let s of r){if(s.tool.name==="getFileTree"&&a){F("Skipping getFileTree since localSearch is already active");continue}F(`Step 2: Calling tool: ${s.tool.name}`),s.tool.name==="localSearch"?n?.(dw.READING_FILES):s.tool.name==="webSearch"?n?.(dw.SEARCHING_WEB):s.tool.name==="getFileTree"&&n?.(dw.READING_FILE_TREE);let u=await E$.callTool(s.tool,s.args);if(s.tool.name==="localSearch"){let c={result:typeof u=="string"?u:JSON.stringify(u),success:u!=null},d=this.getTimeExpression(r),f=this.processLocalSearchResult(c,d);i.push(...f.sources),o.push({tool:s.tool.name,output:f.formattedForLLM})}else o.push({tool:s.tool.name,output:u})}return{toolOutputs:o,sources:XU(i)}}getTimeExpression(r){let n=r.find(o=>o.tool.name==="getTimeRangeMs");return n?n.args.timeExpression:""}prepareLocalSearchResult(r,n){let o=r.filter(T=>T.includeInContext!==!1),i=$Hr(o),a=LHr(i),s=o.reduce((T,O)=>T+(O.content?.length||0),0),u=o;if(s>OWe){let T=OWe/s;F("Truncating document contents to fit context length. Truncation ratio:",T),u=o.map(O=>({...O,content:O.content?.slice(0,Math.floor((O.content?.length||0)*T))||""}))}let l=u.map((T,O)=>({...T,__sourceId:O+1,content:eje(T.content||"")})),c=l.filter(T=>T.isFilterResult===!0),d=l.filter(T=>T.isFilterResult!==!0),p=c.length>0?qHr(c,d):ogt(l),m=l.slice(0,Math.min(20,l.length)).map(T=>({title:T.title||T.path||"Untitled",path:T.path||T.title||""})),h=tje(m);this.lastCitationSources=l.slice(0,Math.min(20,l.length)).map(T=>({title:T.title||T.path||"Untitled",path:T.path||void 0}));let y=te(),g=H4r(h,y.enableInlineCitations).trim(),_=BHr("Answer the question based only on the following context:",p),w=g?`${a}
|
||
|
||
${_}
|
||
|
||
${g}`:`${a}
|
||
|
||
${_}`;return zHr(w,n)}processLocalSearchResult(r,n){let o=[],i,a;if(!r.success)return i=`<localSearch>
|
||
Search failed.
|
||
</localSearch>`,a=`Search failed: ${r.result}`,{formattedForLLM:i,formattedForDisplay:a,sources:o};try{let s=JSON.parse(r.result),u=s&&typeof s=="object"&&s.type==="local_search"&&Array.isArray(s.documents)?s.documents:null;if(!Array.isArray(u))return i=`<localSearch>
|
||
Invalid search results format.
|
||
</localSearch>`,a="Search results were in an unexpected format.",{formattedForLLM:i,formattedForDisplay:a,sources:o};UHr(u),o=kHr(u),i=this.prepareLocalSearchResult(u,n||""),a=P$.format("localSearch",i)}catch(s){Te("Failed to parse localSearch results:",s);let u=FHr(r.result);i=n?`<localSearch timeRange="${n}">
|
||
${u}
|
||
</localSearch>`:`<localSearch>
|
||
${u}
|
||
</localSearch>`,a=P$.format("localSearch",i)}return{formattedForLLM:i,formattedForDisplay:a,sources:o}}async getSystemPrompt(){return T$(this.chainManager.userMemoryManager)}formatAllToolOutputs(r){return r.length===0?"":`# Additional context:
|
||
|
||
`+r.map(o=>{let i=o.output;return typeof i!="string"&&(i=JSON.stringify(i)),`<${o.tool}>
|
||
${i}
|
||
</${o.tool}>`}).join(`
|
||
|
||
`)}};var qce=class extends aN{};mr();Xe();Fc();Ye();Bt();ta();Xe();function cgt(t){return t.map(e=>e.content).filter(e=>e&&e.trim().length>0).join(`
|
||
|
||
`)}var oW=class{constructor(e){this.modelName=e}buildToolSpecificInstructions(e){let r=[];for(let o of e)o.customPromptInstructions&&r.push(o.customPromptInstructions);let n=this.buildCopilotCommandInstructions(e);return n&&r.push(n),r.length>0?r.join(`
|
||
|
||
`):""}buildCopilotCommandInstructions(e){let r=[];for(let n of e)if(!(!n.copilotCommands||n.copilotCommands.length===0))for(let o of n.copilotCommands)r.push(`- ${o}: call the tool named ${n.id}`);return r.length===0?null:["When the user explicitly includes a Copilot command alias (e.g., @vault) in their message, treat it as a direct request to call the mapped tool before proceeding.","Honor these aliases exactly (case-insensitive):",...r,"If the referenced tool is unavailable, explain that the command cannot be fulfilled instead of ignoring it."].join(`
|
||
`)}enhanceSystemPrompt(e,r,n,o){let i=this.buildSystemPromptSections(e,r,n,o);return cgt(i)}buildSystemPromptSections(e,r,n,o){let i=o||[],a=this.buildToolSpecificInstructions(i).trim(),u=[{id:"base-system-prompt",label:"System prompt with memory",source:"src/system-prompts/systemPromptBuilder.ts#getSystemPromptWithMemory",content:e.trimEnd()},{id:"autonomous-agent-intro",label:"Autonomous agent introduction",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`# Autonomous Agent Mode
|
||
|
||
You are now in autonomous agent mode. You can use tools to gather information and complete tasks step by step.
|
||
|
||
Tools are provided via native function calling - use them when needed to complete tasks.
|
||
`}],l=r.trim();return l.length>0&&u.push({id:"tool-descriptions",label:"Tool descriptions (native tool calling via bindTools)",source:"Native tool calling - schemas provided via bindTools()",content:`Available tools:
|
||
${l}`}),u.push({id:"tool-usage-guidelines",label:"Tool usage guidelines",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`# Tool Usage Guidelines
|
||
|
||
## Time-based Queries
|
||
When users ask about temporal periods (e.g., "what did I do last month", "show me notes from last week"), you MUST:
|
||
1. First call getTimeRangeMs to convert the time expression to a proper time range
|
||
2. Then use localSearch with the timeRange parameter from step 1
|
||
3. For salientTerms, ONLY use words that exist in the user's original query (excluding time expressions)
|
||
|
||
Example for "what did I do last month":
|
||
1. Call getTimeRangeMs with timeExpression: "last month"
|
||
2. Use localSearch with query matching the user's question
|
||
3. salientTerms: [] - empty because "what", "I", "do" are not meaningful search terms
|
||
|
||
Example for "meetings about project X last week":
|
||
1. Call getTimeRangeMs with timeExpression: "last week"
|
||
2. Use localSearch with query "meetings about project X"
|
||
3. salientTerms: ["meetings", "project", "X"] - these words exist in the original query
|
||
|
||
## File-related Queries
|
||
|
||
### Handle ambiguity in folder/note paths
|
||
When user mentions a folder name (e.g., "meetings folder") or a note name (e.g., "meeting note template") without providing an exact path,
|
||
you MUST first call getFileTree to find the folder or notes best matching the user's query.
|
||
If multiple results or no result, you should ask the user to provide a more specific path.
|
||
`}),a.length>0&&u.push({id:"tool-specific-instructions",label:"Tool-specific instructions",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildToolSpecificInstructions",content:a}),u.push({id:"general-guidelines",label:"General guidelines",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#BaseModelAdapter.buildSystemPromptSections",content:`## General Guidelines
|
||
- Think hard about whether a query could potentially be answered from personal knowledge or notes, if yes, call a vault search (localSearch) first
|
||
- NEVER mention tool names like "localSearch", "webSearch", etc. in your responses. Use natural language like "searching your vault", "searching the web", etc.
|
||
|
||
You can use multiple tools in sequence. After each tool execution, you'll receive the results and can decide whether to use more tools or provide your final response.
|
||
|
||
Always explain your reasoning before using tools. Be conversational and clear about what you're doing.
|
||
When you've gathered enough information, provide your final response without any tool calls.
|
||
|
||
## Citation Integrity (CRITICAL)
|
||
- ONLY cite sources from tools you ACTUALLY called and received results from
|
||
- NEVER fabricate or hallucinate search results, web searches, or any tool outputs
|
||
- If you did not call a tool, do not claim you did or cite results from it
|
||
- Each citation must correspond to a real document or result returned by a tool in this conversation`}),u}enhanceUserMessage(e,r){return e}needsSpecialHandling(){return!1}},agt=class extends oW{isGPT5Model(){return this.modelName.includes("gpt-5")||this.modelName.includes("gpt5")}buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o),a=n||[],s=a.includes("writeToFile")||a.includes("replaceInFile"),u=[];this.isGPT5Model()?u.push(`GPT-5 SPECIFIC RULES:
|
||
- Use maximum 2 tool calls initially, then provide an answer
|
||
- Call each tool ONCE per unique query
|
||
- For optional parameters: OMIT them entirely if not needed (don't pass empty strings/null)
|
||
- For localSearch: OMIT timeRange if not doing time-based search`):u.push("CRITICAL FOR GPT MODELS: You MUST use tools when the user's request requires them. Do not just describe what you plan to do - actually call the tools."),s&&u.push(`\u{1F6A8} FILE EDITING WITH COMPOSER TOOLS \u{1F6A8}
|
||
|
||
When user asks you to edit or modify a file, you MUST:
|
||
1. Determine if it's a small edit (use replaceInFile) or major rewrite (use writeToFile)
|
||
2. Call the tool immediately - do not just describe what you plan to do
|
||
|
||
For replaceInFile, the diff parameter must use SEARCH/REPLACE format:
|
||
------- SEARCH
|
||
content to find
|
||
=======
|
||
replacement content
|
||
+++++++ REPLACE
|
||
|
||
\u274C WRONG: "I'll help you add item 4 to the list. Let me update that for you." [No tool call = FAILURE]
|
||
\u2705 CORRECT: Actually call replaceInFile or writeToFile with proper parameters`),u.push("FINAL REMINDER FOR GPT MODELS: If the user asks you to search, find, edit, or modify anything, you MUST call the appropriate tool immediately. Do not wait for another turn.");let l=u.join(`
|
||
|
||
`);return i.push({id:"gpt-specific-guidelines",label:"GPT-specific guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#GPTModelAdapter.buildSystemPromptSections",content:l}),i}enhanceUserMessage(e,r){return r?this.getBaseEnhancement(e,r):e}getBaseEnhancement(e,r){if(!r)return e;let n=e.toLowerCase(),o=n.includes("find")||n.includes("search")||n.includes("my notes"),i=n.includes("edit")||n.includes("modify")||n.includes("update")||n.includes("change")||n.includes("fix")||n.includes("add")||n.includes("typo");return o?`${e}
|
||
|
||
REMINDER: Call the localSearch tool now.`:i?`${e}
|
||
|
||
\u{1F6A8} GPT REMINDER: Use replaceInFile for small edits (with SEARCH/REPLACE blocks in diff parameter).`:e}needsSpecialHandling(){return!0}},sgt=class extends oW{isThinkingModel(){return this.modelName.includes("claude-3-7-sonnet")||this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-3.7-sonnet")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-opus-4")}isClaudeSonnet4(){return this.modelName.includes("claude-sonnet-4")||this.modelName.includes("claude-4-sonnet")||this.modelName.includes("claude-sonnet-4-20250514")}buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o);if(!this.isThinkingModel())return i;let a=[`IMPORTANT FOR CLAUDE THINKING MODELS:
|
||
- You are a thinking model with internal reasoning capability
|
||
- Your thinking process will be automatically wrapped in <think> tags - do not manually add thinking tags
|
||
- Call tools AFTER your thinking is complete
|
||
- Do not provide final answers before using tools - use tools first, then provide your response based on the results
|
||
|
||
CORRECT FLOW FOR THINKING MODELS:
|
||
1. Think through the problem (this happens automatically)
|
||
2. Use tools to gather information
|
||
3. Wait for tool results
|
||
4. Provide final response based on gathered information
|
||
|
||
INCORRECT: Providing a final answer before using tools
|
||
CORRECT: Using tools first, then providing answer based on results`];return this.isClaudeSonnet4()&&a.push(`\u{1F6A8} CRITICAL INSTRUCTIONS FOR CLAUDE SONNET 4 - AUTONOMOUS AGENT MODE \u{1F6A8}
|
||
|
||
\u26A0\uFE0F WARNING: You have a specific tendency to write complete responses immediately after tool calls. This BREAKS the autonomous agent pattern!
|
||
|
||
\u{1F504} CORRECT AUTONOMOUS AGENT ITERATION PATTERN:
|
||
1. User asks question
|
||
2. Brief sentence about what you'll do (1 sentence max)
|
||
3. Use tools to gather information
|
||
4. \u270B STOP after tool calls - Do not write anything else
|
||
5. Wait for tool results (system provides them)
|
||
6. Evaluate results and either: Use more tools OR provide final answer
|
||
|
||
\u2705 IDEAL RESPONSE FLOW:
|
||
- Brief action statement (1 sentence)
|
||
- Tool calls
|
||
- STOP (wait for results)
|
||
- Brief transition statement (1 sentence)
|
||
- More tool calls OR final answer
|
||
|
||
\u{1F3AF} CORRECT PATTERN:
|
||
I'll search your vault for piano practice information.
|
||
[Call localSearch tool]
|
||
[RESPONSE ENDS HERE - NO MORE TEXT]
|
||
|
||
\u274C WRONG PATTERN (DO NOT DO THIS):
|
||
[Call tool]
|
||
Based on the search results, here's a complete practice plan...
|
||
[This is FORBIDDEN - you haven't received results yet!]
|
||
|
||
\u{1F511} KEY UNDERSTANDING FOR CLAUDE 4:
|
||
- Brief 1-sentence explanations BEFORE tool calls are good
|
||
- Each response is ONE STEP in a multi-step process
|
||
- After tool calls, STOP and wait for the system to provide results
|
||
- Your thinking is automatically handled in <think> blocks
|
||
|
||
\u26A1 AUTONOMOUS AGENT RULES FOR CLAUDE 4:
|
||
1. If you need tools: Brief sentence + tool calls, then STOP
|
||
2. If you receive tool results: Evaluate if you need more tools
|
||
3. If you need more tools: Brief sentence + more tool calls, then STOP
|
||
4. If you have enough info: THEN provide your final response
|
||
|
||
REMEMBER: One brief sentence before tools is perfect. Nothing after tool calls.`),i.push({id:"claude-thinking-guidelines",label:"Claude thinking model guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#ClaudeModelAdapter.buildSystemPromptSections",content:a.join(`
|
||
|
||
`)}),i}needsSpecialHandling(){return this.isThinkingModel()}},ugt=class extends oW{buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o),u=[`\u{1F6A8} CRITICAL INSTRUCTIONS FOR GEMINI - AUTONOMOUS AGENT MODE \u{1F6A8}
|
||
|
||
You MUST use tools to complete tasks. DO NOT ask the user questions about how to proceed.
|
||
${(n||[]).includes("localSearch")?`
|
||
When the user mentions "my notes" or "my vault", use the localSearch tool.
|
||
|
||
\u274C WRONG:
|
||
"Let's start by searching your notes. What kind of information should I look for?"
|
||
|
||
\u2705 CORRECT: Call localSearch immediately with the user's topic as the query`:""}`.trim()];return u.push(`GEMINI SPECIFIC RULES:
|
||
1. When user mentions "my notes" about X \u2192 use localSearch with query "X"
|
||
2. DO NOT ask clarifying questions about search terms
|
||
3. DO NOT wait for permission to use tools
|
||
4. Use tools based on the user's request
|
||
|
||
\u{1F6A8} CRITICAL: SEQUENTIAL vs PARALLEL TOOL CALLS \u{1F6A8}
|
||
|
||
When one tool's OUTPUT is needed as INPUT to another tool, you MUST make them in SEPARATE responses:
|
||
1. Call the FIRST tool
|
||
2. STOP and wait for the result
|
||
3. In the NEXT response, use the result from step 1 in the SECOND tool call
|
||
|
||
\u274C WRONG (DO NOT DO THIS):
|
||
User: "Recap my last week"
|
||
- Call getTimeRangeMs AND localSearch together with made-up timeRange values
|
||
- This is WRONG because you're hallucinating the timeRange values!
|
||
|
||
\u2705 CORRECT (DO THIS):
|
||
User: "Recap my last week"
|
||
- FIRST: Call getTimeRangeMs with timeExpression "last week"
|
||
- WAIT for result
|
||
- SECOND: Call localSearch using the actual timeRange from the result
|
||
|
||
RULE: NEVER make up or guess parameter values. If you need a tool's output, call that tool FIRST, then WAIT for the result.
|
||
|
||
Remember: The user has already told you what to do. Execute it NOW with the available tools.`),i.push({id:"gemini-specific-guidelines",label:"Gemini-specific guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#GeminiModelAdapter.buildSystemPromptSections",content:u.join(`
|
||
|
||
`)}),i}enhanceUserMessage(e,r){return r?`${e}
|
||
|
||
REMINDER: Use the tools immediately. Do not ask questions. For "my notes", use localSearch.`:e}needsSpecialHandling(){return!0}},lgt=class extends oW{buildSystemPromptSections(e,r,n,o){let i=super.buildSystemPromptSections(e,r,n,o);return i.push({id:"copilot-plus-guidelines",label:"Copilot Plus model guidance",source:"src/LLMProviders/chainRunner/utils/modelAdapter.ts#CopilotPlusModelAdapter.buildSystemPromptSections",content:`\u{1F6A8} CRITICAL: NO HALLUCINATED TOOL CALLS OR SOURCES \u{1F6A8}
|
||
|
||
You are a Copilot Plus model. You MUST follow these rules strictly:
|
||
|
||
## Tool Call Integrity
|
||
- You can ONLY reference results from tools you have ACTUALLY called in this conversation
|
||
- NEVER claim to have performed a web search unless you called the webSearch tool AND received results
|
||
- NEVER claim to have searched notes unless you called localSearch AND received results
|
||
- If you want to search the web, you MUST call the webSearch tool first - do not make up results
|
||
|
||
## Citation Rules
|
||
- Every citation [1], [2], etc. MUST correspond to a real source returned by a tool
|
||
- Do NOT invent sources like "General web search results for X" unless webSearch was actually called
|
||
- If you only called localSearch, your citations can ONLY reference notes from that search
|
||
- Count your actual tool calls - if you only made 1 tool call, you cannot have citations from multiple different tools
|
||
|
||
## Before Writing Citations
|
||
Ask yourself: "Did I actually call this tool and receive this result?"
|
||
- If YES: You may cite it
|
||
- If NO: Do NOT cite it or claim you did
|
||
|
||
REMEMBER: It is better to say "I only searched your notes, not the web" than to fabricate web search results.
|
||
|
||
## Formatting Guidelines
|
||
- AVOID using markdown tables - they often render poorly in chat interfaces
|
||
- Instead of tables, use bullet points, numbered lists, or simple formatted text
|
||
- Only use tables when the user explicitly requests tabular format`}),i}needsSpecialHandling(){return!0}},Uce=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(F(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new agt(r);return n.isGPT5Model()?F("Using GPTModelAdapter with GPT-5 specific enhancements"):F("Using GPTModelAdapter"),n}return r.includes("claude")?(F("Using ClaudeModelAdapter"),new sgt(r)):r.includes("gemini")||r.includes("google/gemini")?(F("Using GeminiModelAdapter"),new ugt(r)):r.includes("copilot-plus")?(F("Using CopilotPlusModelAdapter"),new lgt(r)):(F("Using BaseModelAdapter (default)"),new oW(r))}};function KHr(t){let e=["find","search","look for","look up","my notes","in my vault","from my vault","check the web","search online","from the internet","current time","what time","timer","youtube","video","transcript"],r=t.toLowerCase();return e.some(n=>r.includes(n))}function xii(t){let{systemSections:e,rawHistory:r,adapterName:n,originalUserMessage:o,enhancedUserMessage:i}=t,a=[...e];if(r&&r.length>0){let u=fst(r);if(u.length>0){let c=cvr(u).map((d,f)=>`${f+1}. ${d.role.toUpperCase()}
|
||
${d.content}`);a.push({id:"chat-history",label:"Restored chat history from memory",source:"src/LLMProviders/chainRunner/utils/chatHistoryUtils.ts#processRawChatHistory",content:c.join(`
|
||
|
||
`)})}}a.push({id:"user-original-message",label:"Original user message",source:"Chat input",content:o});let s=i===o?" (unchanged)":"";return a.push({id:"user-enhanced-message",label:`User message after ${n}.enhanceUserMessage${s}`,source:`src/LLMProviders/chainRunner/utils/modelAdapter.ts#${n}.enhanceUserMessage`,content:i}),a}function Tii(t){return t.map(e=>`${`[Section: ${e.label} | Source: ${e.source}]`}
|
||
${e.content}`).join(`
|
||
|
||
`)}function GHr(t){let e=xii(t),r=Tii(e),n=cgt(t.systemSections);return{sections:e,annotatedPrompt:r,systemPrompt:n}}async function Oii(t){let{chainManager:e,adapter:r,basePrompt:n,toolDescriptions:o,toolNames:i,toolMetadata:a,userMessage:s}=t,u=r.buildSystemPromptSections(n,o,i,a),c=await e.memoryManager.getMemory().loadMemoryVariables({}),d=Array.isArray(c.history)?c.history:[],f=s.originalMessage||s.message,p=KHr(s.message),m=r.enhanceUserMessage(s.message,p);return GHr({systemSections:u,rawHistory:d,adapterName:r.constructor?.name||"ModelAdapter",originalUserMessage:f,enhancedUserMessage:m})}async function Eii(t){return T$(t.userMemoryManager)}async function XHr(t){let{chainManager:e,adapter:r,availableTools:n,toolDescriptions:o,userMessage:i}=t,a=yd.getInstance(),s=n.map(c=>c.name),u=n.map(c=>a.getToolMetadata(c.name)).filter(c=>c!==void 0),l=await Eii(e);return Oii({chainManager:e,adapter:r,basePrompt:l,toolDescriptions:o,toolNames:s,toolMetadata:u,userMessage:i})}function ZHr(){return{status:"idle",startTime:null,elapsedSeconds:0,steps:[]}}function dgt(t){if(t.status==="idle")return"";let e=JSON.stringify(t.steps.map(r=>r.summary));return`<!--AGENT_REASONING:${t.status}:${t.elapsedSeconds}:${e}-->`}function Bce(t){let e=t.match(/<!--AGENT_REASONING:(\w+):(\d+):(.+?)-->/);if(!e)return null;let[r,n,o,i]=e,a=[];try{a=JSON.parse(i)}catch{a=[]}return{hasReasoning:!0,status:n,elapsedSeconds:parseInt(o,10),steps:a,contentAfter:t.replace(r,"").trim()}}function YHr(t,e,r,n){if(!e.success)return`${fgt(t,n)} failed`;switch(t){case"localSearch":{if(r&&r.count>0){let o=r.titles.slice(0,3),i=r.count-o.length,a=`Found ${r.count} note${r.count!==1?"s":""}: ${o.join(", ")}`;return i>0&&(a+=` +${i} more`),a}return"No matching notes found"}case"webSearch":return"Retrieved web search results";case"getTimeRangeMs":return"Calculated time range";case"readFile":return"Read file content";case"readNote":{let o=n?.notePath;return o?`Read "${o.split("/").pop()?.replace(/\.md$/i,"")||o}"`:"Read note content"}case"createNote":return"Created new note";case"appendToNote":return"Appended to note";case"editNote":return"Edited note";case"deleteNote":return"Deleted note";case"youtubeTranscript":case"youtubeTranscription":return"Fetched video transcript";case"fetchUrl":return"Fetched URL content";case"getFileTree":return"Retrieved vault file tree";case"getTagList":return"Retrieved vault tags";case"getCurrentTime":return"Got current time";case"getTimeInfoByEpoch":return"Converted timestamp";case"convertTimeBetweenTimezones":return"Converted timezone";case"indexVault":return"Indexed vault";case"updateMemory":return"Updated memory";case"writeToFile":case"replaceInFile":{let o=n?.path,i=o?o.split("/").pop()||o:"file",a=e.result||"";return a.includes('"rejected"')||a.includes("rejected")?`Edit rejected for "${i}"`:a.includes('"failed"')||a.includes("Error")?`Edit failed for "${i}"`:t==="writeToFile"?`Wrote to "${i}"`:`Edited "${i}"`}default:return"Done"}}function fgt(t,e,r){switch(t){case"localSearch":{if(r&&r.recallTerms&&r.recallTerms.length>0){let o=r.recallTerms.filter(i=>typeof i=="string"&&i.trim().length>0&&!i.includes("[object ")&&i!=="[object Object]");if(o.length>0){let i=o.slice(0,6).map(u=>`"${u}"`).join(", "),a=o.length-6,s=a>0?` +${a} more`:"";return`Searching notes for ${i}${s}`}}let n=e?.query;return n?`Searching notes for "${n.length>50?n.slice(0,50)+"...":n}"`:"Searching notes"}case"webSearch":{let n=e?.query;return n?`Searching web for "${n.length>30?n.slice(0,30)+"...":n}"`:"Searching the web"}case"getTimeRangeMs":return"Calculating time range";case"readFile":{let n=e?.path;return n?`Reading "${n.split("/").pop()||n}"`:"Reading file"}case"readNote":{let n=e?.notePath;return n?`Reading "${n.split("/").pop()?.replace(/\.md$/i,"")||n}"`:"Reading note"}case"createNote":return"Creating new note";case"appendToNote":return"Appending to note";case"editNote":return"Editing note";case"deleteNote":return"Deleting note";case"youtubeTranscript":case"youtubeTranscription":return"Fetching video transcript";case"fetchUrl":return"Fetching URL content";case"getFileTree":return"Browsing vault file tree";case"getTagList":return"Loading vault tags";case"getCurrentTime":return"Getting current time";case"getTimeInfoByEpoch":return"Converting timestamp";case"convertTimeBetweenTimezones":return"Converting timezone";case"indexVault":return"Indexing vault";case"updateMemory":return"Saving to memory";case"writeToFile":{let n=e?.path;return n?`Writing to "${n.split("/").pop()||n}"`:"Writing to file"}case"replaceInFile":{let n=e?.path;return n?`Editing "${n.split("/").pop()||n}"`:"Editing file"}default:return"Processing"}}function Pii(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function QHr(t){if(!t||t.trim().length===0)return null;let e=t.trim().split(`
|
||
`)[0];return Pii(e,100)}xst();var zce=class extends aN{constructor(){super(...arguments);this.llmFormattedMessages=[];this.lastDisplayedContent="";this.reasoningState=ZHr();this.reasoningTimerInterval=null;this.accumulatedContent="";this.allReasoningSteps=[];this.abortHandledByTimer=!1}getAvailableTools(){let r=te(),n=yd.getInstance();n.getAllTools().length===0&&eZ(this.chainManager.app?.vault);let o=new Set(r.autonomousAgentEnabledToolIds||[]);return n.getEnabledTools(o,!!this.chainManager.app?.vault)}startReasoningTimer(r,n){this.reasoningState={status:"reasoning",startTime:Date.now(),elapsedSeconds:0,steps:[]},this.accumulatedContent="",this.allReasoningSteps=[],this.abortHandledByTimer=!1;let o=["Understanding your question","Analyzing your request","Processing your query","Thinking about this","Considering your question","Working on this","Pondering the possibilities","Diving into your request","Let me think about this","Exploring your question","Getting my thoughts together","Examining the details","Looking into this","Mulling this over","On it","Firing up the neurons","Connecting the dots","Brewing some ideas","Spinning up the gears","Warming up the engines","Crunching the details","Putting on my thinking cap","Consulting my notes","Gathering my thoughts","Rolling up my sleeves"],i=o[Math.floor(Math.random()*o.length)];this.addReasoningStep(i),this.reasoningTimerInterval=setInterval(()=>{if(n?.signal.aborted&&this.reasoningState.status==="reasoning"){this.stopReasoningTimer(),this.reasoningState.status="complete",this.abortHandledByTimer=!0;let a=this.buildReasoningBlockMarkup(),s="The response was interrupted.",u=a?a+`
|
||
|
||
`+s:s;r(u);return}if(this.reasoningState.startTime&&this.reasoningState.status==="reasoning"){this.reasoningState.elapsedSeconds=Math.floor((Date.now()-this.reasoningState.startTime)/1e3);let a=this.buildReasoningBlockMarkup(),s=a?a+(this.accumulatedContent?`
|
||
|
||
`+this.accumulatedContent:""):this.accumulatedContent;r(s)}},100)}addReasoningStep(r,n,o=!1){let i={timestamp:Date.now(),summary:r,toolName:n};this.allReasoningSteps.push(i),!o&&(this.reasoningState.steps.push(i),this.reasoningState.steps.length>4&&this.reasoningState.steps.shift())}stopReasoningTimer(){this.reasoningTimerInterval&&(clearInterval(this.reasoningTimerInterval),this.reasoningTimerInterval=null),this.reasoningState.status="collapsed"}buildReasoningBlockMarkup(){if(this.reasoningState.status==="complete"||this.reasoningState.status==="collapsed"){let r={...this.reasoningState,steps:this.allReasoningSteps};return dgt(r)}return dgt(this.reasoningState)}static async generateSystemPrompt(r,n,o){let i=await T$(o),a=yd.getInstance(),u=r.map(l=>a.getToolMetadata(l.name)).filter(l=>l!==void 0).filter(l=>l.customPromptInstructions).map(l=>`For ${l.displayName}: ${l.customPromptInstructions}`).join(`
|
||
`);return u?`${i}
|
||
|
||
## Tool Guidelines
|
||
${u}`:i}async buildToolPromptDebugReport(r){let n=this.getAvailableTools(),o=Uce.createAdapter(this.chainManager.chatModelManager.getChatModel()),i=n.map(a=>`${a.name}: ${a.description}`).join(`
|
||
`);return XHr({chainManager:this.chainManager,adapter:o,availableTools:n,toolDescriptions:i,userMessage:r})}applyCiCOrderingToLocalSearchResult(r,n){return VHr(r,n)}async run(r,n,o,i,a){this.llmFormattedMessages=[],this.lastDisplayedContent="";let s=await E0({isAutonomousAgent:!0}),u=this.chainManager.chatModelManager.getChatModel(),l=Uce.createAdapter(u),c=new dv(o,!0);if(!s){await this.handleError(new Error("Invalid license key"),c.processErrorChunk.bind(c));let m=c.close().content;return this.handleResponse(m,r,n,i,o,void 0)}let d=u?.modelName;if(!r.contextEnvelope)throw new Error("[Agent] Context envelope is required but not available. Cannot proceed with autonomous agent.");F("[Agent] Using native tool calling with ReAct pattern");let p=await this.prepareAgentConversation(r,u,a.updateLoadingMessage);try{this.startReasoningTimer(o,n);let m=await this.runReActLoop({boundModel:p.loopDeps.boundModel,tools:p.loopDeps.availableTools,messages:p.messages,originalPrompt:p.originalUserPrompt,abortController:n,updateCurrentAiMessage:o,processLocalSearchResult:p.loopDeps.processLocalSearchResult,applyCiCOrderingToLocalSearchResult:p.loopDeps.applyCiCOrderingToLocalSearchResult,adapter:l});if(this.abortHandledByTimer)return this.lastDisplayedContent="","";let h=XU(m.sources);return p.messages.length>0&&Eq({messages:[...p.messages],modelName:d,contextEnvelope:r.contextEnvelope}),await this.handleResponse(m.finalResponse,r,n,i,o,h.length>0?h:void 0,this.llmFormattedMessages.join(`
|
||
|
||
`),m.responseMetadata),this.lastDisplayedContent="",m.finalResponse}catch(m){if(this.stopReasoningTimer(),m.name==="AbortError"||n.signal.aborted)return F("Autonomous agent stream aborted by user",{reason:n.signal.reason}),"";ne("Autonomous agent failed, falling back to regular Plus mode:",m);try{return await new aN(this.chainManager).run(r,n,o,i,a)}catch(h){ne("Fallback to regular Plus mode also failed:",h),this.lastDisplayedContent&&c.processChunk({content:this.lastDisplayedContent});let y=zr(m),g=`
|
||
|
||
Fallback to regular Plus mode also failed: `+zr(h);await this.handleError(new Error(y+g),c.processErrorChunk.bind(c));let b=c.close().content;return this.handleResponse(b,r,n,i,o,void 0,b)}}}async prepareAgentConversation(r,n,o){let i=[],a=this.getAvailableTools(),s=n.modelName||n.model||"unknown";if(typeof n.bindTools!="function")throw new Error(`Model ${s} does not support native tool calling (bindTools not available). Agent mode requires a model with tool calling support.`);let u=n.bindTools(a),l={availableTools:a,boundModel:u,processLocalSearchResult:this.processLocalSearchResult.bind(this),applyCiCOrderingToLocalSearchResult:this.applyCiCOrderingToLocalSearchResult.bind(this)},c=r.contextEnvelope,d=_A.convert(c,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),f=this.chainManager.memoryManager.getMemory(),p=d.find(E=>E.role==="system"),m=yd.getInstance(),y=a.map(E=>m.getToolMetadata(E.name)).filter(E=>E!==void 0).filter(E=>E.customPromptInstructions).map(E=>`For ${E.displayName}: ${E.customPromptInstructions}`).join(`
|
||
`),g=[p?.content||"",y?`
|
||
## Tool Guidelines
|
||
${y}`:""].filter(Boolean).join(`
|
||
|
||
`);g&&i.push(new Od({content:g}));let w=c.layers.find(E=>E.id==="L5_USER")?.text||""||r.originalMessage||r.message,T=[];await Oq(f,T);for(let E of T)E.role==="user"?i.push(new qs(E.content)):i.push(new Pn(E.content));let O=d.find(E=>E.role==="user");if(O){let P=this.isMultimodalModel(n)?await this.buildMessageContent(O.content,r):O.content;i.push(new qs(P))}return{messages:i,collectedSources:[],originalUserPrompt:w,loopDeps:l}}async runReActLoop(r){let{boundModel:n,tools:o,messages:i,originalPrompt:a,abortController:s,updateCurrentAiMessage:u,processLocalSearchResult:l,applyCiCOrderingToLocalSearchResult:c}=r,d=te().autonomousAgentMaxIterations,f=[],p=Date.now(),m=0,h;for(;m<d&&!s.signal.aborted;){let T=Date.now()-p;if(T>=EWe){Te(`Agent loop timed out after ${Math.round(T/1e3)}s`);break}m++;let{content:O,aiMessage:E,streamingResult:P}=await this.streamModelResponse(n,i,s,u);h={wasTruncated:P.wasTruncated,tokenUsage:P.tokenUsage??void 0};let R=E.tool_calls||[];if(R.length===0){this.stopReasoningTimer(),this.reasoningState.status="complete",i.push(E);let I=O,N=this.buildReasoningBlockMarkup(),z=20,V=5,k="";for(let B=0;B<I.length&&!s.signal.aborted;B+=z){k+=I.slice(B,B+z);let Q=N?N+`
|
||
|
||
`+k:k;u(Q),B+z<I.length&&await new Promise(Y=>setTimeout(Y,V))}let X=N?N+`
|
||
|
||
`+I:I;return u(X),{finalResponse:X,sources:f,responseMetadata:h}}if(i.push(E),m>1&&O&&O.trim().length>0){let I=QHr(O);I&&this.addReasoningStep(I)}for(let I of R){if(s.signal.aborted)break;let N={name:I.name,args:I.args},z;if(I.name==="localSearch"){let Y=N.args.query;if(Y)try{let oe=await new g9({getChatModel:async()=>this.chainManager.chatModelManager.getChatModel()}).expand(Y),ue=new Set,de=[],L=W=>{if(typeof W!="string")return;let ie=W.trim();if(!ie||ie==="[object Object]"||ie.startsWith("[object "))return;let j=ie.toLowerCase();ue.has(j)||(ue.add(j),de.push(ie))};oe.originalQuery&&L(oe.originalQuery),(oe.salientTerms||[]).forEach(L),(oe.expandedQueries||[]).forEach(L),z={originalQuery:oe.originalQuery,salientTerms:oe.salientTerms,expandedQueries:oe.expandedQueries,recallTerms:de}}catch{}}let V=fgt(I.name,N.args,z);this.addReasoningStep(V,I.name),z&&(N.args._preExpandedQuery=z),Gmt(N,m);let k=await Jmt(N,o,a),X;if(I.name==="localSearch"&&k.success){let Y=l(k);f.push(...Y.sources),X={titles:Y.sources.map(K=>K.title),count:Y.sources.length},k.result=c(Y.formattedForLLM,a||"")}Xmt(I.name,k);let B=YHr(I.name,k,X,N.args);this.addReasoningStep(B,I.name);let Q=pst(I.id||tPe(),I.name,k.result);i.push(Q)}}this.stopReasoningTimer(),this.reasoningState.status="complete";let y=this.buildReasoningBlockMarkup();if(s.signal.aborted){if(F("Agent reasoning interrupted by user"),this.abortHandledByTimer)return{finalResponse:"",sources:f,responseMetadata:h};let T="The response was interrupted.";return{finalResponse:y?y+`
|
||
|
||
`+T:T,sources:f,responseMetadata:h}}let g=Date.now()-p,b=g>=EWe;b?Te(`Agent loop timed out after ${Math.round(g/1e3)}s`):Te(`Agent reached max iterations (${d})`);let _=b?"I've reached the time limit for reasoning. Here's what I found so far based on the search results.":"I've reached the maximum number of tool calls. Here's what I found so far based on the search results.";return{finalResponse:y?y+`
|
||
|
||
`+_:_,sources:f,responseMetadata:h}}async streamModelResponse(r,n,o,i){let a=new Map,s=new dv(()=>{},!0);try{let u=await Vb(()=>r.stream(n,{signal:o.signal}));for await(let p of u){if(o.signal.aborted)break;if(p.response_metadata?.finish_reason==="MALFORMED_FUNCTION_CALL")throw Te("Backend returned MALFORMED_FUNCTION_CALL - falling back to non-agent mode"),new Error("MALFORMED_FUNCTION_CALL: Model does not support native tool calling");let h=p.tool_call_chunks;if(h&&Array.isArray(h))for(let y of h){let g=y.index??0,b=a.get(g)||{name:"",args:""};y.id&&(b.id=y.id),y.name&&(b.name+=y.name),y.args&&(b.args+=y.args),a.set(g,b)}s.processChunk(p)}let l=s.close(),c=l.content,d=rPe(a),f=new Pn({content:c,tool_calls:d.map(p=>({id:p.id,name:p.name,args:p.args,type:"tool_call"}))});return{content:c,aiMessage:f,streamingResult:l}}catch(u){if(ne(`Stream error: ${u.message}`),u.name==="AbortError"||o.signal.aborted){let l=s.close();return{content:l.content,aiMessage:new Pn({content:l.content}),streamingResult:l}}throw u}}};Xe();Ye();Bt();lw();FS();var Q3r=require("obsidian");CX();var Vce=[{tag:"note_context",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"active_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"embedded_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"vault_note",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"retrieved_document",sourceType:"note",recoverable:!0,sourceExtractor:"path"},{tag:"url_content",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"web_tab_context",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"active_web_tab",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"youtube_video_context",sourceType:"youtube",recoverable:!0,sourceExtractor:"url"},{tag:"twitter_content",sourceType:"url",recoverable:!0,sourceExtractor:"url"},{tag:"embedded_pdf",sourceType:"pdf",recoverable:!0,sourceExtractor:"name"},{tag:"selected_text",sourceType:"selected_text",recoverable:!1,sourceExtractor:null},{tag:"web_selected_text",sourceType:"selected_text",recoverable:!1,sourceExtractor:null},{tag:"localSearch",sourceType:"note",recoverable:!0,sourceExtractor:null}],Jje=new Map;for(let t of Vce)Jje.set(t.tag,t);function iW(t){return Jje.get(t)?.sourceType??"unknown"}function Kje(t){return Jje.get(t)?.recoverable??!1}function tZ(t,e){let r=Jje.get(e);if(!r?.sourceExtractor)return"";let n=r.sourceExtractor;return new RegExp(`<${n}>([^<]+)</${n}>`).exec(t)?.[1]??""}function Hce(t){let e=/<content>([\s\S]*?)<\/content>/.exec(t);return e?e[1]:t}function pgt(t){return t.match(/^<(\w+)[\s>]/)?.[1]??null}var nS={previewCharsPerSection:500,maxSections:20,verbatimThreshold:5e3};function aW(t,e=500,r=20){let n=t.split(/(?=^#{1,6}\s+)/m).filter(s=>s.trim());if(n.length<=1)return mgt(t,e*4);let o=n.slice(0,r),i=n.length>r,a=o.map(s=>{let u=s.trim().split(`
|
||
`),l=u[0],c=u.slice(1).join(`
|
||
`).trim();return c.length<=e?s.trim():`${l}
|
||
${mgt(c,e)}`}).join(`
|
||
|
||
`);return i?`${a}
|
||
|
||
[... ${n.length-r} more sections omitted ...]`:a}function mgt(t,e){if(t.length<=e)return t;let r=t.slice(0,e),n=/[.!?]\s+/g,o=-1,i;for(;(i=n.exec(r))!==null;)i.index>e*.5&&(o=i.index+1);if(o>0)return r.slice(0,o)+" ...";let a=r.lastIndexOf(`
|
||
|
||
`);if(a>e*.5)return r.slice(0,a)+`
|
||
|
||
...`;let s=r.lastIndexOf(" ");return s>e*.8?r.slice(0,s)+" ...":r+"..."}function Gje(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function Mii(){return["localSearch","note_context","active_note","retrieved_document","url_content","youtube_video_context"].map(e=>({pattern:new RegExp(`<${e}[^>]*>[\\s\\S]*?</${e}>`,"g"),tag:e}))}var Rii=Mii(),rZ="Tool 'readNote' result: ";function Iii(t,e){if(t[e]!=="{")return null;let r=0,n=!1,o=!1;for(let i=e;i<t.length;i++){let a=t[i];if(o){o=!1;continue}if(a==="\\"&&n){o=!0;continue}if(a==='"'){n=!n;continue}if(!n){if(a==="{")r++;else if(a==="}"&&(r--,r===0))return{json:t.slice(e,i+1),endPos:i+1}}}return null}function sW(t,e={}){return Array.isArray(t)?t.map(r=>r.type==="text"&&typeof r.text=="string"?{...r,text:e3r(r.text,e)}:r):typeof t=="string"?e3r(t,e):t}function e3r(t,e={}){let r=e.verbatimThreshold??nS.verbatimThreshold,n=t;for(let{pattern:o,tag:i}of Rii)o.lastIndex=0,n=n.replace(o,a=>a.length<r?a:Nii(a,i,e));return n=Aii(n,r,e),n}function Aii(t,e,r){let n="",o=0;for(;o<t.length;){let i=t.indexOf(rZ,o);if(i===-1){n+=t.slice(o);break}n+=t.slice(o,i);let a=i+rZ.length,s=Iii(t,a);if(!s){n+=rZ,o=a;continue}try{let u=JSON.parse(s.json);if(u.content&&u.content.length>e){let l=jii(u,r);n+=`${rZ}${JSON.stringify(l)}`}else n+=rZ+s.json}catch{n+=rZ+s.json}o=s.endPos}return n}function Nii(t,e,r={}){if(!Kje(e))return t;if(e==="localSearch")return Dii(t,r);let n=tZ(t,e),o=Hce(t),i=iW(e),a=r.previewCharsPerSection??nS.previewCharsPerSection,s=r.maxSections??nS.maxSections,u=aW(o,a,s);return`<prior_context source="${Gje(n)}" type="${i}">
|
||
${u}
|
||
</prior_context>`}function Dii(t,e={}){let r=e.previewCharsPerSection??nS.previewCharsPerSection,n=/<document>([\s\S]*?)<\/document>/g,o=[],i;for(;(i=n.exec(t))!==null;){let s=i[1],u=/<path>([^<]+)<\/path>/.exec(s),l=/<title>([^<]+)<\/title>/.exec(s),c=/<content>([\s\S]*?)<\/content>/.exec(s),d=u?.[1]??"",f=l?.[1]??d.split("/").pop()??"Untitled",p=c?.[1]??"",m=p.length>r?p.slice(0,r)+"...":p;o.push({path:d,title:f,preview:m.trim()})}if(o.length===0){let s=Hce(t);return`<prior_context source="localSearch" type="note">
|
||
${aW(s,r,e.maxSections??nS.maxSections)}
|
||
</prior_context>`}let a=o.map((s,u)=>`${u+1}. [[${s.title}]] (${s.path})
|
||
${s.preview}`).join(`
|
||
|
||
`);return`<prior_context source="localSearch" type="note">
|
||
[${o.length} search results - use localSearch to re-query]
|
||
|
||
${a}
|
||
</prior_context>`}function jii(t,e={}){let{content:r,notePath:n,noteTitle:o,...i}=t;if(!r||typeof r!="string")return t;let a=e.previewCharsPerSection??nS.previewCharsPerSection,s=e.maxSections??nS.maxSections,u=aW(r,a,s);return{...i,notePath:n,noteTitle:o,content:`[COMPACTED - use readNote to get full content]
|
||
|
||
${u}`,_wasCompacted:!0}}Ye();nye();FS();var $ii=`Progressively summarize the lines of conversation provided, adding onto the previous summary returning a new summary.
|
||
|
||
EXAMPLE
|
||
Current summary:
|
||
The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good.
|
||
|
||
New lines of conversation:
|
||
Human: Why do you think artificial intelligence is a force for good?
|
||
AI: Because artificial intelligence will help humans reach their full potential.
|
||
|
||
New summary:
|
||
The human asks what the AI thinks of artificial intelligence. The AI thinks artificial intelligence is a force for good because it will help humans reach their full potential.
|
||
END OF EXAMPLE
|
||
|
||
Current summary:
|
||
{summary}
|
||
|
||
New lines of conversation:
|
||
{new_lines}
|
||
|
||
New summary:`,t3r=new mu({inputVariables:["summary","new_lines"],template:$ii}),Lii=`You are an assistant to a human, powered by a large language model trained by OpenAI.
|
||
|
||
You are designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, you are able to generate human-like text based on the input you receive, allowing you to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
|
||
|
||
You are constantly learning and improving, and your capabilities are constantly evolving. You are able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. You have access to some personalized information provided by the human in the Context section below. Additionally, you are able to generate your own text based on the input you receive, allowing you to engage in discussions and provide explanations and descriptions on a wide range of topics.
|
||
|
||
Overall, you are a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether the human needs help with a specific question or just wants to have a conversation about a particular topic, you are here to assist.
|
||
|
||
Context:
|
||
{entities}
|
||
|
||
Current conversation:
|
||
{history}
|
||
Last line:
|
||
Human: {input}
|
||
You:`,r3r=new mu({inputVariables:["entities","history","input"],template:Lii}),Fii=`You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You should definitely extract all names and places.
|
||
|
||
The conversation history is provided just in case of a coreference (e.g. "What do you know about him" where "him" is defined in a previous line) -- ignore items mentioned there that are not in the last line.
|
||
|
||
Return the output as a single comma-separated list, or NONE if there is nothing of note to return (e.g. the user is just issuing a greeting or having a simple conversation).
|
||
|
||
EXAMPLE
|
||
Conversation history:
|
||
Person #1: my name is Jacob. how's it going today?
|
||
AI: "It's going great! How about you?"
|
||
Person #1: good! busy working on Langchain. lots to do.
|
||
AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?"
|
||
Last line:
|
||
Person #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff.
|
||
Output: Jacob,Langchain
|
||
END OF EXAMPLE
|
||
|
||
EXAMPLE
|
||
Conversation history:
|
||
Person #1: how's it going today?
|
||
AI: "It's going great! How about you?"
|
||
Person #1: good! busy working on Langchain. lots to do.
|
||
AI: "That sounds like a lot of work! What kind of things are you doing to make Langchain better?"
|
||
Last line:
|
||
Person #1: i'm trying to improve Langchain's interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I'm working with Person #2.
|
||
Output: Langchain, Person #2
|
||
END OF EXAMPLE
|
||
|
||
Conversation history (for reference only):
|
||
{history}
|
||
Last line of conversation (for extraction):
|
||
Human: {input}
|
||
|
||
Output:`,n3r=new mu({inputVariables:["history","input"],template:Fii}),kii=`You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update and add to the summary of the provided entity in the "Entity" section based on the last line of your conversation with the human. If you are writing the summary for the first time, return a single sentence.
|
||
The update should only include facts that are relayed in the last line of conversation about the provided entity, and should only contain facts about the provided entity.
|
||
|
||
If there is no new information about the provided entity or the information is not worth noting (not an important or relevant fact to remember long-term), output the exact string "UNCHANGED" below.
|
||
|
||
Full conversation history (for context):
|
||
{history}
|
||
|
||
Entity to summarize:
|
||
{entity}
|
||
|
||
Existing summary of {entity}:
|
||
{summary}
|
||
|
||
Last line of conversation:
|
||
Human: {input}
|
||
Updated summary (or the exact string "UNCHANGED" if there is no new information about {entity} above):`,o3r=new mu({inputVariables:["entity","summary","history","input"],template:kii});nye();Jo();kL();zL();vS();ta();var qii={};$t(qii,{BaseChatMessageHistory:()=>Uii,BaseListChatMessageHistory:()=>i3r,InMemoryChatMessageHistory:()=>Wce});var Uii=class extends Cg{async addMessages(t){for(let e of t)await this.addMessage(e)}},i3r=class extends Cg{addUserMessage(t){return this.addMessage(new qs(t))}addAIMessage(t){return this.addMessage(new Pn(t))}async addMessages(t){for(let e of t)await this.addMessage(e)}clear(){throw new Error("Not implemented.")}},Wce=class extends i3r{constructor(e){super(...arguments);x(this,"lc_namespace",["langchain","stores","message","in_memory"]);x(this,"messages",[]);this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};Jo();var Bii={};$t(Bii,{BaseMemory:()=>uW,getInputValue:()=>lW,getOutputValue:()=>Jce,getPromptInputKey:()=>Xje});var uW=class{},a3r=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},lW=(t,e)=>{let r=a3r(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},Jce=(t,e)=>{let r=a3r(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};function Xje(t,e){let r=Object.keys(t).filter(n=>!e.includes(n)&&n!=="stop");if(r.length!==1)throw new Error(`One input key expected, but got ${r.length}`);return r[0]}var zii={};$J(zii,{BaseChatMemory:()=>p_});var p_=class extends uW{constructor(e){super();x(this,"chatHistory");x(this,"returnMessages",!1);x(this,"inputKey");x(this,"outputKey");this.chatHistory=e?.chatHistory??new Wce,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(lW(e,this.inputKey)),await this.chatHistory.addAIMessage(Jce(r,this.outputKey))}async clear(){await this.chatHistory.clear()}};cW();ta();var Zce=class extends p_{constructor(e){let{returnMessages:r,inputKey:n,outputKey:o,chatHistory:i,humanPrefix:a,aiPrefix:s,llm:u,prompt:l,summaryChatMessageClass:c}=e;super({returnMessages:r,inputKey:n,outputKey:o,chatHistory:i});x(this,"memoryKey","history");x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"llm");x(this,"prompt",t3r);x(this,"summaryChatMessageClass",Od);this.memoryKey=e?.memoryKey??this.memoryKey,this.humanPrefix=a??this.humanPrefix,this.aiPrefix=s??this.aiPrefix,this.llm=u,this.prompt=l??this.prompt,this.summaryChatMessageClass=c??this.summaryChatMessageClass}async predictNewSummary(e,r){let n=fl(e,this.humanPrefix,this.aiPrefix);return await new ag({llm:this.llm,prompt:this.prompt}).predict({summary:r,new_lines:n})}},H3r=class extends Zce{constructor(e){super(e);x(this,"buffer","")}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){return this.returnMessages?{[this.memoryKey]:[new this.summaryChatMessageClass(this.buffer)]}:{[this.memoryKey]:this.buffer}}async saveContext(e,r){await super.saveContext(e,r);let n=await this.chatHistory.getMessages();this.buffer=await this.predictNewSummary(n.slice(-2),this.buffer)}async clear(){await super.clear(),this.buffer=""}};ta();var W3r=class extends Zce{constructor(e){super(e);x(this,"movingSummaryBuffer","");x(this,"maxTokenLimit",2e3);this.maxTokenLimit=e?.maxTokenLimit??this.maxTokenLimit}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();this.movingSummaryBuffer&&(r=[new this.summaryChatMessageClass(this.movingSummaryBuffer),...r]);let n;return this.returnMessages?n=r:n=fl(r,this.humanPrefix,this.aiPrefix),{[this.memoryKey]:n}}async saveContext(e,r){await super.saveContext(e,r),await this.prune()}async prune(){let e=await this.chatHistory.getMessages();this.movingSummaryBuffer&&(e=[new this.summaryChatMessageClass(this.movingSummaryBuffer),...e]);let r=await this.llm.getNumTokens(fl(e,this.humanPrefix,this.aiPrefix));if(r>this.maxTokenLimit){let n=[];for(;r>this.maxTokenLimit;){let o=e.shift();o&&(n.push(o),r=await this.llm.getNumTokens(fl(e,this.humanPrefix,this.aiPrefix)))}this.movingSummaryBuffer=await this.predictNewSummary(n,this.movingSummaryBuffer)}}async clear(){await super.clear(),this.movingSummaryBuffer=""}};ta();var r$e=class extends p_{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","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]:fl(r,this.humanPrefix,this.aiPrefix)}}};ta();var n$e=class extends p_{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"k",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]:fl(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}};J3e();ND();var J3r=class extends uW{constructor(e){super();x(this,"vectorStoreRetriever");x(this,"inputKey");x(this,"memoryKey");x(this,"returnDocs");x(this,"metadata");this.vectorStoreRetriever=e.vectorStoreRetriever,this.inputKey=e.inputKey,this.memoryKey=e.memoryKey??"memory",this.returnDocs=e.returnDocs??!1,this.metadata=e.metadata}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=lW(e,this.inputKey),n=await this.vectorStoreRetriever.invoke(r);return{[this.memoryKey]:this.returnDocs?n:_te(n)}}async saveContext(e,r){let n=typeof this.metadata=="function"?this.metadata(e,r):this.metadata,o=Object.entries(e).filter(([i])=>i!==this.memoryKey).concat(Object.entries(r)).map(([i,a])=>`${i}: ${a}`).join(`
|
||
`);await this.vectorStoreRetriever.addDocuments([new tl({pageContent:o,metadata:n})])}};cW();kL();var K3r=class extends Cg{};var G3r=class extends K3r{constructor(){super();x(this,"lc_namespace",["langchain","stores","entity","in_memory"]);x(this,"store");this.store=Object.create(null)}async get(e,r){return e in this.store?this.store[e]:r}async set(e,r){this.store[e]=r}async delete(e){delete this.store[e]}async exists(e){return e in this.store}async clear(){this.store=Object.create(null)}};ta();var X3r=class extends p_{constructor(e){super({chatHistory:e.chatHistory,returnMessages:e.returnMessages??!1,inputKey:e.inputKey,outputKey:e.outputKey});x(this,"entityExtractionChain");x(this,"entitySummarizationChain");x(this,"entityStore");x(this,"entityCache",[]);x(this,"k",3);x(this,"chatHistoryKey","history");x(this,"llm");x(this,"entitiesKey","entities");x(this,"humanPrefix");x(this,"aiPrefix");this.llm=e.llm,this.humanPrefix=e.humanPrefix,this.aiPrefix=e.aiPrefix,this.chatHistoryKey=e.chatHistoryKey??this.chatHistoryKey,this.entitiesKey=e.entitiesKey??this.entitiesKey,this.entityExtractionChain=new ag({llm:this.llm,prompt:e.entityExtractionPrompt??n3r}),this.entitySummarizationChain=new ag({llm:this.llm,prompt:e.entitySummarizationPrompt??o3r}),this.entityStore=e.entityStore??new G3r,this.entityCache=e.entityCache??this.entityCache,this.k=e.k??this.k}get memoryKeys(){return[this.chatHistoryKey]}get memoryVariables(){return[this.entitiesKey,this.chatHistoryKey]}async loadMemoryVariables(e){let r=this.inputKey??Xje(e,this.memoryVariables),n=await this.chatHistory.getMessages(),o=fl(n.slice(-this.k*2),this.humanPrefix,this.aiPrefix),i=await this.entityExtractionChain.predict({history:o,input:e[r]}),a=i.trim()==="NONE"?[]:i.split(",").map(l=>l.trim()),s={};for(let l of a)s[l]=await this.entityStore.get(l,"No current information known.");this.entityCache=[...a];let u=this.returnMessages?n.slice(-this.k*2):o;return{[this.chatHistoryKey]:u,[this.entitiesKey]:s}}async saveContext(e,r){await super.saveContext(e,r);let n=this.inputKey??Xje(e,this.memoryVariables),o=await this.chatHistory.getMessages(),i=fl(o.slice(-this.k*2),this.humanPrefix,this.aiPrefix),a=e[n];for(let s of this.entityCache){let u=await this.entityStore.get(s,"No current information known."),l=await this.entitySummarizationChain.predict({summary:u,entity:s,history:i,input:a});l.trim()!=="UNCHANGED"&&await this.entityStore.set(s,l.trim())}}async clear(){await super.clear(),await this.entityStore.clear()}};var Z3r=class extends p_{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"memories",[]);this.memories=e?.memories??this.memories,this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.checkRepeatedMemoryVariable(),this.checkInputKey()}checkRepeatedMemoryVariable(){let e=[];for(let r of this.memories){let n=e.filter(o=>r.memoryKeys.includes(o));if(n.length>0)throw new Error(`The same variables ${[...n]} are found in multiple memory objects, which is not allowed by CombinedMemory.`);e.push(...r.memoryKeys)}}checkInputKey(){for(let e of this.memories)e.chatHistory!==void 0&&e.inputKey===void 0&&console.warn(`When using CombinedMemory, input keys should be set so the input is known. Was not set on ${e}.`)}async loadMemoryVariables(e){let r={};for(let n of this.memories){let o=await n.loadMemoryVariables(e);r={...r,...o}}return r}async saveContext(e,r){for(let n of this.memories)await n.saveContext(e,r)}async clear(){for(let e of this.memories)typeof e.clear=="function"&&await e.clear()}get memoryKeys(){let e=[];for(let r of this.memories)e.push(...r.memoryKeys);return e}};ta();var Y3r=class extends p_{constructor(e){super(e);x(this,"humanPrefix","Human");x(this,"aiPrefix","AI");x(this,"memoryKey","history");x(this,"maxTokenLimit",2e3);x(this,"llm");this.llm=e.llm,this.humanPrefix=e?.humanPrefix??this.humanPrefix,this.aiPrefix=e?.aiPrefix??this.aiPrefix,this.memoryKey=e?.memoryKey??this.memoryKey,this.maxTokenLimit=e?.maxTokenLimit??this.maxTokenLimit}get memoryKeys(){return[this.memoryKey]}async loadMemoryVariables(e){let r=await this.chatHistory.getMessages();return this.returnMessages?{[this.memoryKey]:r}:{[this.memoryKey]:fl(r,this.humanPrefix,this.aiPrefix)}}async saveContext(e,r){await super.saveContext(e,r);let n=await this.chatHistory.getMessages(),o=await this.llm.getNumTokens(fl(n,this.humanPrefix,this.aiPrefix));if(o>this.maxTokenLimit){let i=[];for(;o>this.maxTokenLimit;)i.push(n.shift()),o=await this.llm.getNumTokens(fl(n,this.humanPrefix,this.aiPrefix))}}};ta();var tai={};$J(tai,{BaseChatMemory:()=>p_,BaseConversationSummaryMemory:()=>Zce,BaseMemory:()=>uW,BufferMemory:()=>r$e,BufferWindowMemory:()=>n$e,ChatMessageHistory:()=>Wce,CombinedMemory:()=>Z3r,ConversationSummaryBufferMemory:()=>W3r,ConversationSummaryMemory:()=>H3r,ConversationTokenBufferMemory:()=>Y3r,ENTITY_MEMORY_CONVERSATION_TEMPLATE:()=>r3r,EntityMemory:()=>X3r,VectorStoreRetrieverMemory:()=>J3r,getBufferString:()=>fl,getInputValue:()=>lW,getOutputValue:()=>Jce});var Yce=class t{constructor(){this.initMemory(),hl(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=te().contextTurns;this.memory=new n$e({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){let n=typeof r=="string"?sW(r):{...r,output:sW(r.output)};this.debug&&console.log("Saving to memory - Input:",e,"Output (compacted):",n),await this.memory.saveContext(e,n)}};Ye();FS();ra();var Qce=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),hl(()=>{this.initChatPrompt(),this.initQAPrompt()}),i5(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=x$(),r=Gu();r&&a5()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=Ah.fromMessages([LS.fromTemplate(n),new pO("history"),$_.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=Ah.fromMessages([LS.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 ede=class{constructor(e){this.retrievedDocuments=[];this.pendingModelError=null;this.app=e,this.memoryManager=Yce.getInstance(),this.chatModelManager=tC.getInstance(),this.promptManager=Qce.getInstance(),this.userMemoryManager=new GU(e),this.initialize(),hl(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.pendingModelError)throw this.pendingModelError;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 zJ(e)}}validateChainInitialization(){(!this.chain||!v1t(this.chain))&&(F("Reinitializing chat chain after detecting missing or unsupported instance."),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n,o=ex(),i=Gu();if(!(o==="project"&&!i))try{if(n=o==="project"?i?.projectModelKey:B_(),!n)throw new zJ("No model key found. Please select a model in settings.");if(r){let a=qS(n,te().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",n),a=hO[0],n=a.name+"|"+a.provider),o==="project"&&!a.projectEnabled){let u=te().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,n=u.name+"|"+u.provider,new Q3r.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,...i?.modelConfigs};await this.chatModelManager.setChatModel(s),this.pendingModelError=null}this.setChain(o,e),F(`Setting model to ${n}`)}catch(a){this.pendingModelError=a instanceof Error?a:new Error(String(a)),ne(`createChainWithNewModel failed: ${a}`),F(`modelKey: ${n||B_()}`)}}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=Ate.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),N4("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let s=te().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(_Pe(),Ost))).HybridRetriever({minSimilarityScore:.01,maxK:Ly,salientTerms:[]}):new(await Promise.resolve().then(()=>(xX(),Dmt))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:Ly,salientTerms:[],textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=Ate.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:x$()},this.storeRetrieverDocuments.bind(this),te().debug),N4("vault_qa"),te().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=Ate.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),N4("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=Ate.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),N4("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=ex(),r=te();switch(e){case"llm_chain":return new Aae(this);case"vault_qa":return new Cle(this);case"copilot_plus":return r.enableAutonomousAgent?new zce(this):new aN(this);case"project":return new qce(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&te().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{ignoreSystemMessage:a=!1}=i,s=e.contextEnvelope?.layers.find(c=>c.id==="L5_USER")?.text;F(`Step 0: Initial user message:
|
||
`,s||e.originalMessage||e.message),this.validateChatModel(),this.validateChainInitialization();let u=this.chatModelManager.getChatModel();if(a||Pte(u)){let c=Ah.fromMessages([new pO("history"),$_.fromTemplate("{input}")]);Pte(u)&&(c=Ah.fromMessages([[Zs,x$()||""],c])),this.createChainWithNewModel({prompt:c},!1)}return await this.getChainRunner().run(e,r,n,o,i)}};ra();Xe();Ye();Bt();var o$e=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){_Dt({success:[],failed:[],processingFiles:[],total:[]})}async executeWithProcessTracking(e,r,n){this.setFileOrUrlStartProcess(e);try{let o=await n();return this.setFileOrUrlProcessSuccessful(e),o}catch(o){let i=DD(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":zr(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){No.set(Ute,r=>{let n={...r};return n.failed.find(o=>o.path===e)&&(n.failed=n.failed.filter(o=>o.path!==e)),n.success.includes(e)&&(n.success=n.success.filter(o=>o!==e)),n.processingFiles.includes(e)||(n.processingFiles=[...n.processingFiles,e]),n.total.includes(e)||(n.total=[...n.total,e]),n})}setFileOrUrlProcessSuccessful(e){CO("processingFiles",r=>r.filter(n=>n!==e)),CO("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){CO("processingFiles",o=>o.filter(i=>i!==e)),CO("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}preComputeAllItems(e,r){F(`[preComputeAllItems] Starting pre-computation for project: ${e.name}`);let n=[];n.push(...r.map(a=>a.path));let o=e.contextSource?.webUrls?.trim()||"";if(o){let a=o.split(`
|
||
`).filter(s=>s.trim());n.push(...a)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let a=i.split(`
|
||
`).filter(s=>s.trim());n.push(...a)}if(n.length>0){let a=[...new Set([...n])];CO("total",s=>a),F(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){F(`[markAllCachedItemsAsSuccess] Starting for project: ${e.name||"default"}`);let o=e.contextSource?.webUrls?.trim()||"";if(o){let s=o.split(`
|
||
`).filter(u=>u.trim()).filter(u=>r.webContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached Web URLs as successful`)}let i=e.contextSource?.youtubeUrls?.trim()||"";if(i){let s=i.split(`
|
||
`).filter(u=>u.trim()).filter(u=>r.youtubeContexts[u]);s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached YouTube URLs as successful`)}if(r.fileContexts){let a=new Set(n.filter(u=>u.extension==="md").map(u=>u.path)),s=Object.keys(r.fileContexts).filter(u=>a.has(u));s.forEach(u=>{this.markCachedItemAsSuccess(u)}),s.length>0&&F(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){CO("total",r=>r.includes(e)?r:[...r,e]),CO("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){CO("total",o=>o.includes(e)?o:[...o,e]),CO("failed",o=>{if(!o.find(a=>a.path===e)){let a={path:e,type:r,error:n,timestamp:Date.now()};return[...o,a]}return o})}};var ry=class t{constructor(e,r){this.projectUsageTimestampsManager=new kJ;this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new ede(e),this.projectContextCache=Fw.getInstance(),this.fileParserManager=new Tq(Ql.getInstance(),this.app.vault,!0,null),this.loadTracker=o$e.getInstance(this.app),mDt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),hDt(async()=>{if(a5())return;let n=te(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(ex()==="vault_qa"||ex()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),i5(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){hl(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&&this.hasMeaningfulProjectConfigChange(a,i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i,!0),this.getCurrentChainManager().createChainWithNewModel()]))}})}hasMeaningfulProjectConfigChange(e,r){let n={...e,UsageTimestamps:0},o={...r,UsageTimestamps:0};return JSON.stringify(n)!==JSON.stringify(o)}static getInstance(e,r){return t.instance||(t.instance=new t(e,r)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}touchProjectUsageTimestamps(e){this.projectUsageTimestampsManager.touch(e.id);let r=te().projectList||[],n=r.find(i=>i.id===e.id);if(!n)return;let o=this.projectUsageTimestampsManager.shouldPersist(e.id,n.UsageTimestamps);o!==null&&(Re("projectList",r.map(i=>i.id===e.id?{...i,UsageTimestamps:o}:i)),this.projectUsageTimestampsManager.markPersisted(e.id,o))}getProjectUsageTimestampsManager(){return this.projectUsageTimestampsManager}async switchProject(e){try{if(this.loadTracker.clearAllLoadStates(),wO(!0),F("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 Tq(Ql.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),this.touchProjectUsageTimestamps(e),F(`Switched to project: ${e.name}`)}catch(r){throw ne(`Failed to switch project: ${r}`),r}finally{wO(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e,r=!1){r&&(this.loadTracker.clearAllLoadStates(),wO(!0));try{if(!e.contextSource)return Te(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;F(`[loadProjectContext] Starting for project: ${e.name}`);let n=await this.projectContextCache.getOrInitializeCache(e),o=this.getProjectAllFiles(e);this.loadTracker.preComputeAllItems(e,o),this.loadTracker.markAllCachedItemsAsSuccess(e,n,o);let[i]=await Promise.all([this.processMarkdownFiles(e,n,o),this.processWebUrls(e,n),this.processYoutubeUrls(e,n)]);return i.timestamp=Date.now(),await this.projectContextCache.setCacheSafely(e,i),await this.processNonMarkdownFiles(e,o),F(`[loadProjectContext] Completed for project: ${e.name}.`),i}catch(n){throw ne(`[loadProjectContext] Failed for project ${e.name}:`,n),n}finally{r&&wO(!1)}}async compareAndUpdateCache(e,r){try{if(!await this.projectContextCache.get(e))return!0;let o=e.contextSource?.inclusions||"",i=r.contextSource?.inclusions||"",a=e.contextSource?.exclusions||"",s=r.contextSource?.exclusions||"";(o!==i||a!==s)&&(await this.projectContextCache.invalidateMarkdownContext(r),F(`Markdown configuration changed for project ${r.name}, marking for reload`));let u=e.contextSource?.webUrls||"",l=r.contextSource?.webUrls||"";if(u!==l){let f=u.split(`
|
||
`).filter(m=>m.trim()),p=l.split(`
|
||
`).filter(m=>m.trim());await this.projectContextCache.removeWebUrls(r,f.filter(m=>!p.includes(m)))}let c=e.contextSource?.youtubeUrls||"",d=r.contextSource?.youtubeUrls||"";if(c!==d){let f=c.split(`
|
||
`).filter(m=>m.trim()),p=d.split(`
|
||
`).filter(m=>m.trim());await this.projectContextCache.removeYoutubeUrls(r,f.filter(m=>!p.includes(m)))}}catch(n){ne(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(Nu)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=te().projectList.find(o=>o.id===e);if(!r)return Te(`[getProjectContext] Project not found for ID: ${e}`),null;F(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?F(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):F(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r,!0);if(!o)return ne(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else F(`[getProjectContext] Project ${r.name}: Memory cache hit and markdown OK. Using existing context.`);return this.formatProjectContextWithFiles(n,r)}async formatProjectContextWithFiles(e,r){let n=[];if(e.markdownContext&&n.push(`## Markdown Files
|
||
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&n.push(`## Web Content
|
||
${Object.values(e.webContexts).join(`
|
||
|
||
`)}`),Object.keys(e.youtubeContexts).length>0&&n.push(`## YouTube Content
|
||
${Object.values(e.youtubeContexts).join(`
|
||
|
||
`)}`),Object.keys(e.fileContexts).length>0){let o=Object.entries(e.fileContexts).filter(([i])=>i.split(".").pop()?.toLowerCase()!=="md");if(o.length>0){let i=o.map(async([s,u])=>{let l=s.split("/"),c=l[l.length-1],d=c.split(".").pop()||"",f=await this.projectContextCache.getOrReuseFileContext(r,s)||"[Content not available]";return`[[${c}]]
|
||
path: ${s}
|
||
type: ${d}
|
||
modified: ${new Date(u.timestamp).toISOString()}
|
||
|
||
${f}`}),a=await Promise.all(i);a.length>0&&n.push(`## Other Files
|
||
${a.join(`
|
||
|
||
`)}`)}}return`
|
||
# Project Context
|
||
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
|
||
|
||
<ProjectContext>
|
||
${n.join(`
|
||
|
||
`)}
|
||
</ProjectContext>
|
||
`}formatProjectContext(e){let r=[];if(e.markdownContext&&r.push(`## Markdown Files
|
||
${e.markdownContext}`),Object.keys(e.webContexts).length>0&&r.push(`## Web Content
|
||
${Object.values(e.webContexts).join(`
|
||
|
||
`)}`),Object.keys(e.youtubeContexts).length>0&&r.push(`## YouTube Content
|
||
${Object.values(e.youtubeContexts).join(`
|
||
|
||
`)}`),Object.keys(e.fileContexts).length>0){let n="";for(let[o,i]of Object.entries(e.fileContexts)){let a=o.split("/"),s=a[a.length-1],u=s.split(".").pop()||"";n+=`[[${s}]]
|
||
path: ${o}
|
||
type: ${u}
|
||
modified: ${new Date(i.timestamp).toISOString()}
|
||
|
||
`}n&&r.push(`## Other Files
|
||
${n}`)}return`
|
||
# Project Context
|
||
The following information is the relevant context for this project. Use this information to inform your responses when appropriate:
|
||
|
||
<ProjectContext>
|
||
${r.join(`
|
||
|
||
`)}
|
||
</ProjectContext>
|
||
`}async processMarkdownFiles(e,r,n){if(F(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){F(`[processMarkdownFiles] Project ${e.name}: Processing markdown content.`);let o=await this.processMarkdownFileContext(n);this.projectContextCache.updateProjectMarkdownFilesFromPatterns(e,r,n),r.markdownContext=o,r.markdownNeedsReload=!1,F(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else F(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return F(`[processMarkdownFiles] Completed for project: ${e.name}. Total fileContexts: ${Object.keys(r.fileContexts||{}).length}`),r}async processMarkdownFileContext(e){let r=e.filter(o=>o.extension==="md");F(`Found ${r.length} markdown files to process for project context`);let n=await Promise.all(r.map(async o=>{let i="",a="";try{let[s,u]=await this.loadTracker.executeWithProcessTracking(o.path,"md",async()=>Promise.all([this.app.vault.adapter.stat(o.path),this.app.vault.read(o)]));a=`[[${o.basename}]]
|
||
path: ${o.path}
|
||
type: ${o.extension}
|
||
created: ${s?new Date(s.ctime).toISOString():"unknown"}
|
||
modified: ${s?new Date(s.mtime).toISOString():"unknown"}`,i=u,F(`Completed processing markdown file: ${o.path}`)}catch(s){ne(`Error processing file ${o.path}: ${s}`),i=`[Error: ${zr(s)}]`}return`${a}
|
||
|
||
${i}`}));return F("All markdown files processed for project context"),n.join(`
|
||
|
||
`)}async processWebUrls(e,r){F(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(F(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());F(`[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&&F(`[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){F(`[processWebUrls] Project ${e.name}: Removing ${s.length} obsolete Web URL contexts.`);for(let c of s)delete r.webContexts[c]}let u=a.map(async c=>{let d=await this.processWebUrlContext(c);return d&&F(`[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&&Te(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),F(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){F(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(F(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());F(`[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&&F(`[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){F(`[processYoutubeUrls] Project ${e.name}: Removing ${s.length} obsolete YouTube URL contexts.`);for(let c of s)delete r.youtubeContexts[c]}let u=a.map(async c=>{let d=await this.processYoutubeUrlContext(c);return d&&F(`[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&&Te(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),F(`[processYoutubeUrls] Completed for project: ${e.name}. Total YouTube contexts: ${Object.keys(r.youtubeContexts).length}`),r}async processWebUrlContext(e){if(!e?.trim())return"";try{let r=s9.getInstance(),{urlContext:n}=await this.loadTracker.executeWithProcessTracking(e,"web",async()=>{let o=await r.processUrls(e);if(o.processedErrorUrls[e])throw new Error(o.processedErrorUrls[e]);return o});return n||""}catch(r){return ne(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>Ql.getInstance().youtube4llm(e));return r.response.transcript?`
|
||
|
||
YouTube transcript from ${e}:
|
||
${r.response.transcript}`:""}catch(r){return ne(`Failed to process YouTube URL ${e}: ${r}`),new dW.Notice(`Failed to process YouTube URL ${e}: ${zr(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(F(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new Tq(Ql.getInstance(),this.app.vault,!0,e);let o=0;for(let i of n){let a=i.path;if(this.fileParserManager.supportsExtension(i.extension))try{await this.loadTracker.executeWithProcessTracking(a,"nonMd",async()=>{await this.projectContextCache.getOrReuseFileContext(e,a)||(F(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault)),o++})}catch(s){if(ne(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),DD(s))throw s}}o>0&&F(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Te("[retryFailedItem] No current project, aborting retry");return}let r=te().projectList.find(n=>n.id===this.currentProjectId);if(!r){ne(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(F(`[retryFailedItem] Starting retry for ${e.type} item: ${e.path}`),e.type){case"web":await this.retryWebUrl(r,e.path);break;case"youtube":await this.retryYoutubeUrl(r,e.path);break;case"md":await this.retryMarkdownFile(r,e.path);break;case"nonMd":await this.retryNonMarkdownFile(r,e.path);break;default:Te(`[retryFailedItem] Unknown item type: ${e.type}`);return}F(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new dW.Notice(`Retry successful: ${e.path}`)}catch(r){ne(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new dW.Notice(`Retry failed: ${zr(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Te(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}F(`[retryWebUrl] Project ${e.name}: Successfully fetched content for URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateWebUrl(e,r,n)}async retryYoutubeUrl(e,r){let n=await this.processYoutubeUrlContext(r);if(!n){Te(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}F(`[retryYoutubeUrl] Project ${e.name}: Successfully fetched transcript for YouTube URL: ${r.substring(0,50)}...`),await this.projectContextCache.updateYoutubeUrl(e,r,n)}async retryMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof dW.TFile)||n.extension!=="md")throw new Error(`File not found or not a markdown file: ${r}`);try{await this.loadTracker.executeWithProcessTracking(n.path,"md",async()=>{}),F(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ne(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof dW.TFile)||n.extension==="md")throw new Error(`File not found or is a markdown file: ${r}`);if(!this.fileParserManager.supportsExtension(n.extension))throw new Error(`Unsupported file extension: ${n.extension}`);try{await this.loadTracker.executeWithProcessTracking(r,"nonMd",async()=>this.fileParserManager.parseFile(n,this.app.vault)),F(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ne(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=el({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>Hs(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}};ra();O4();Xe();var NWr=require("obsidian");Cn();var i$e=$(J());$r();var ri=i$e.forwardRef(({className:t,type:e,...r},n)=>i$e.createElement("input",{type:e,className:we("!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}));ri.displayName="Input";var s$e=$(J());var aWr=$(J(),1);var nWr=$(J(),1),lai=$(hu(),1);var Qm=$(J(),1);var nai=$(J(),1);function eWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function tWr(...t){return e=>{let r=!1,n=t.map(o=>{let i=eWr(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():eWr(t[o],null)}}}}var a$e=$(St(),1);function rWr(t){let e=oai(t),r=Qm.forwardRef((n,o)=>{let{children:i,...a}=n,s=Qm.Children.toArray(i),u=s.find(aai);if(u){let l=u.props.children,c=s.map(d=>d===u?Qm.Children.count(l)>1?Qm.Children.only(null):Qm.isValidElement(l)?l.props.children:null:d);return(0,a$e.jsx)(e,{...a,ref:o,children:Qm.isValidElement(l)?Qm.cloneElement(l,void 0,c):null})}return(0,a$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function oai(t){let e=Qm.forwardRef((r,n)=>{let{children:o,...i}=r;if(Qm.isValidElement(o)){let a=uai(o),s=sai(i,o.props);return o.type!==Qm.Fragment&&(s.ref=n?tWr(n,a):a),Qm.cloneElement(o,s)}return Qm.Children.count(o)>1?Qm.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iai=Symbol("radix.slottable");function aai(t){return Qm.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iai}function sai(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 uai(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 oWr=$(St(),1),cai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iWr=cai.reduce((t,e)=>{let r=rWr(`Primitive.${e}`),n=nWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,oWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var sWr=$(St(),1),dai="Label",uWr=aWr.forwardRef((t,e)=>(0,sWr.jsx)(iWr.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));uWr.displayName=dai;var vgt=uWr;o_e();$r();var pai=k5("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Xc=s$e.forwardRef(({className:t,...e},r)=>s$e.createElement(vgt,{ref:r,className:we(pai(),t),...e}));Xc.displayName=vgt.displayName;var sZ=$(J());var m_=$(J(),1);var cWr=$(J(),1);function lWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wgt(...t){return e=>{let r=!1,n=t.map(o=>{let i=lWr(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():lWr(t[o],null)}}}}function tde(...t){return cWr.useCallback(wgt(...t),t)}var j$=$(J(),1),dWr=$(St(),1);function fWr(t,e=[]){let r=[];function n(i,a){let s=j$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=j$.useMemo(()=>m,Object.values(m));return(0,dWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=j$.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=>j$.createContext(a));return function(s){let u=s?.[t]||i;return j$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,mai(o,...e)]}function mai(...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 j$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var cOs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Sgt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var uC=$(J(),1);var pWr=$(J(),1),fW=globalThis?.document?pWr.useLayoutEffect:()=>{};var u$e=$(J(),1);var hai=uC[" useInsertionEffect ".trim().toString()]||fW;function mWr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=gai({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=uC.useRef(t!==void 0);uC.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=uC.useCallback(c=>{if(s){let d=yai(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function gai({defaultProp:t,onChange:e}){let[r,n]=uC.useState(t),o=uC.useRef(r),i=uC.useRef(e);return hai(()=>{i.current=e},[e]),uC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function yai(t){return typeof t=="function"}var mOs=Symbol("RADIX:SYNC_STATE");var l$e=$(J(),1);function hWr(t){let e=l$e.useRef({value:t,previous:t});return l$e.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var gWr=$(J(),1);function yWr(t){let[e,r]=gWr.useState(void 0);return fW(()=>{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 Ev=$(J(),1);var bWr=$(J(),1);function bai(t,e){return bWr.useReducer((r,n)=>e[r][n]??r,t)}var Cgt=t=>{let{present:e,children:r}=t,n=_ai(e),o=typeof r=="function"?r({present:n.isPresent}):Ev.Children.only(r),i=tde(n.ref,vai(o));return typeof r=="function"||n.isPresent?Ev.cloneElement(o,{ref:i}):null};Cgt.displayName="Presence";function _ai(t){let[e,r]=Ev.useState(),n=Ev.useRef(null),o=Ev.useRef(t),i=Ev.useRef("none"),a=t?"mounted":"unmounted",[s,u]=bai(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Ev.useEffect(()=>{let l=c$e(n.current);i.current=s==="mounted"?l:"none"},[s]),fW(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=c$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),fW(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=c$e(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=c$e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Ev.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function c$e(t){return t?.animationName||"none"}function vai(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 vWr=$(J(),1),Oai=$(hu(),1);var eh=$(J(),1);var d$e=$(St(),1);function _Wr(t){let e=wai(t),r=eh.forwardRef((n,o)=>{let{children:i,...a}=n,s=eh.Children.toArray(i),u=s.find(Cai);if(u){let l=u.props.children,c=s.map(d=>d===u?eh.Children.count(l)>1?eh.Children.only(null):eh.isValidElement(l)?l.props.children:null:d);return(0,d$e.jsx)(e,{...a,ref:o,children:eh.isValidElement(l)?eh.cloneElement(l,void 0,c):null})}return(0,d$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function wai(t){let e=eh.forwardRef((r,n)=>{let{children:o,...i}=r;if(eh.isValidElement(o)){let a=Tai(o),s=xai(i,o.props);return o.type!==eh.Fragment&&(s.ref=n?wgt(n,a):a),eh.cloneElement(o,s)}return eh.Children.count(o)>1?eh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Sai=Symbol("radix.slottable");function Cai(t){return eh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Sai}function xai(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 Tai(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 wWr=$(St(),1),Eai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f$e=Eai.reduce((t,e)=>{let r=_Wr(`Primitive.${e}`),n=vWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,wWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var oS=$(St(),1),p$e="Checkbox",[Pai,DOs]=fWr(p$e),[Mai,xgt]=Pai(p$e);function Rai(t){let{__scopeCheckbox:e,checked:r,children:n,defaultChecked:o,disabled:i,form:a,name:s,onCheckedChange:u,required:l,value:c="on",internal_do_not_use_render:d}=t,[f,p]=mWr({prop:r,defaultProp:o??!1,onChange:u,caller:p$e}),[m,h]=m_.useState(null),[y,g]=m_.useState(null),b=m_.useRef(!1),_=m?!!a||!!m.closest("form"):!0,w={checked:f,disabled:i,setChecked:p,control:m,setControl:h,name:s,form:a,value:c,hasConsumerStoppedPropagationRef:b,required:l,defaultChecked:pB(o)?!1:o,isFormControl:_,bubbleInput:y,setBubbleInput:g};return(0,oS.jsx)(Mai,{scope:e,...w,children:Iai(d)?d(w):n})}var SWr="CheckboxTrigger",CWr=m_.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:r,...n},o)=>{let{control:i,value:a,disabled:s,checked:u,required:l,setControl:c,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=xgt(SWr,t),h=tde(o,c),y=m_.useRef(u);return m_.useEffect(()=>{let g=i?.form;if(g){let b=()=>d(y.current);return g.addEventListener("reset",b),()=>g.removeEventListener("reset",b)}},[i,d]),(0,oS.jsx)(f$e.button,{type:"button",role:"checkbox","aria-checked":pB(u)?"mixed":u,"aria-required":l,"data-state":EWr(u),"data-disabled":s?"":void 0,disabled:s,value:a,...n,ref:h,onKeyDown:Sgt(e,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:Sgt(r,g=>{d(b=>pB(b)?!0:!b),m&&p&&(f.current=g.isPropagationStopped(),f.current||g.stopPropagation())})})});CWr.displayName=SWr;var m$e=m_.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u,onCheckedChange:l,form:c,...d}=t;return(0,oS.jsx)(Rai,{__scopeCheckbox:r,checked:o,defaultChecked:i,disabled:s,required:a,onCheckedChange:l,name:n,form:c,value:u,internal_do_not_use_render:({isFormControl:f})=>(0,oS.jsxs)(oS.Fragment,{children:[(0,oS.jsx)(CWr,{...d,ref:e,__scopeCheckbox:r}),f&&(0,oS.jsx)(OWr,{__scopeCheckbox:r})]})})});m$e.displayName=p$e;var xWr="CheckboxIndicator",Tgt=m_.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=xgt(xWr,r);return(0,oS.jsx)(Cgt,{present:n||pB(i.checked)||i.checked===!0,children:(0,oS.jsx)(f$e.span,{"data-state":EWr(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});Tgt.displayName=xWr;var TWr="CheckboxBubbleInput",OWr=m_.forwardRef(({__scopeCheckbox:t,...e},r)=>{let{control:n,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:s,disabled:u,name:l,value:c,form:d,bubbleInput:f,setBubbleInput:p}=xgt(TWr,t),m=tde(r,p),h=hWr(i),y=yWr(n);m_.useEffect(()=>{let b=f;if(!b)return;let _=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(_,"checked").set,O=!o.current;if(h!==i&&T){let E=new Event("click",{bubbles:O});b.indeterminate=pB(i),T.call(b,pB(i)?!1:i),b.dispatchEvent(E)}},[f,h,i,o]);let g=m_.useRef(pB(i)?!1:i);return(0,oS.jsx)(f$e.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??g.current,required:s,disabled:u,name:l,value:c,form:d,...e,tabIndex:-1,ref:m,style:{...e.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});OWr.displayName=TWr;function Iai(t){return typeof t=="function"}function pB(t){return t==="indeterminate"}function EWr(t){return pB(t)?"indeterminate":t?"checked":"unchecked"}Or();$r();var Rl=sZ.forwardRef(({className:t,...e},r)=>sZ.createElement(m$e,{ref:r,className:we("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},sZ.createElement(Tgt,{className:we("tw-flex tw-items-center tw-justify-center tw-text-current")},sZ.createElement(Yu,{className:"tw-size-4"}))));Rl.displayName=m$e.displayName;var lC=$(J());$r();var h_=lC.forwardRef(({className:t,value:e,...r},n)=>{let o=lC.useRef(null),i=lC.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);lC.useLayoutEffect(()=>{i()},[e,i]),lC.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 lC.createElement("textarea",{className:we("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})});h_.displayName="Textarea";var Ls=$(J()),DWr=$(jm());Ye();var sN=$(J());Bt();Or();mr();var Ogt=({capabilities:t=[],iconSize:e=16})=>sN.default.createElement(sN.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return sN.default.createElement(px,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return sN.default.createElement(dx,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return sN.default.createElement(vl,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),Egt=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return sN.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},sN.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&sN.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},sN.default.createElement(Ogt,{capabilities:t.capabilities,iconSize:e})))},PWr=t=>{let e=t.displayName||t.name,r=`(${Rg(t.provider)})`;return`${e} ${r}`},uZ=t=>{let e=t.displayName||t.name,r=`(${Rg(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}`};$r();Or();Xe();var uN=$(J());function MWr(){return uN.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},uN.default.createElement("li",null,uN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),uN.default.createElement("li",null,uN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),uN.default.createElement("li",null,uN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),uN.default.createElement("li",null,uN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{#tag1, #tag2}")," represents ALL notes with ANY of the specified tags in their property (an OR operation)."))}var Pgt="{copilot-selection}";var lN={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},$$="copilot-command-context-menu-enabled",L$="copilot-command-slash-enabled",cN="copilot-command-context-menu-order",F$="copilot-command-model-key",k$="copilot-command-last-used",RWr=[{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},{title:"Clip YouTube Transcript",content:`
|
||
Based on the YouTube video information and transcript provided in the context, generate a complete Obsidian note in the following format.
|
||
|
||
IMPORTANT: If no YouTube video context is found, remind the user to:
|
||
1. Open a YouTube video in Web Viewer (or use @ to select a YouTube web tab)
|
||
2. Then use this command again
|
||
|
||
Generate the note with this exact structure:
|
||
|
||
---
|
||
title: "<video title>"
|
||
description: "<first 200 chars of description>"
|
||
channel: "<channel name>"
|
||
url: "<video url>"
|
||
duration: "<duration>"
|
||
published: <upload date in YYYY-MM-DD format>
|
||
thumbnailUrl: "<YouTube thumbnail URL: i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg with https protocol>"
|
||
genre:
|
||
- "<genre>"
|
||
watched:
|
||
---
|
||

|
||
|
||
> [!summary]- Description
|
||
> <full video description, preserve line breaks>
|
||
|
||
## Summary
|
||
|
||
<Brief 2-3 paragraph summary of the video content>
|
||
|
||
## Key Takeaways
|
||
|
||
<List 5-8 key takeaways as bullet points>
|
||
|
||
## Mindmap
|
||
|
||
CRITICAL Mermaid mindmap syntax rules - MUST follow exactly:
|
||
- Root node format: root(Topic Name) - use round brackets, NO double brackets
|
||
- Child nodes: just plain text, no brackets needed
|
||
- Do NOT use quotes, parentheses, brackets, or any special characters in text
|
||
- Do NOT use icons or emojis
|
||
- Keep all node text short and simple - max 3-4 words per node
|
||
- Use only letters, numbers, and spaces
|
||
|
||
Example of CORRECT syntax:
|
||
\`\`\`mermaid
|
||
mindmap
|
||
root(Video Main Topic)
|
||
First Theme
|
||
Detail one
|
||
Detail two
|
||
Second Theme
|
||
Detail three
|
||
Third Theme
|
||
\`\`\`
|
||
|
||
## Notable Quotes
|
||
|
||
<List 5-10 notable quotes from the transcript. Format each as:>
|
||
- [<timestamp>: <quote text>](<video_url>&t=<seconds>s)
|
||
|
||
Return only the markdown content without any explanations or comments.`,showInContextMenu:!1,showInSlashMenu:!0,order:1130,modelKey:"",lastUsedMs:0},{title:"Clip Web Page",content:`
|
||
Based on the web page content provided in the context (from Obsidian Web Clipper or Web Viewer), generate a complete Obsidian note.
|
||
|
||
IMPORTANT: If no web page context is found, remind the user to:
|
||
1. Open a web page in Web Viewer (or use @ to select a web tab)
|
||
2. Or open a note clipped by Obsidian Web Clipper
|
||
3. Then use this command again
|
||
|
||
Generate the note with this exact structure:
|
||
|
||
---
|
||
title: "<page title>"
|
||
source: "<page url>"
|
||
description: "<brief description>"
|
||
tags:
|
||
- "clippings"
|
||
---
|
||
|
||
## Summary
|
||
|
||
<Brief 2-3 paragraph summary of the page content>
|
||
|
||
## Key Takeaways
|
||
|
||
<List 5-8 key takeaways as bullet points>
|
||
|
||
## Mindmap
|
||
|
||
CRITICAL Mermaid mindmap syntax rules - MUST follow exactly:
|
||
- Root node format: root(Topic Name) - use round brackets, NO double brackets
|
||
- Child nodes: just plain text, no brackets needed
|
||
- Do NOT use quotes, parentheses, brackets, or any special characters in text
|
||
- Keep all node text short and simple - max 3-4 words per node
|
||
|
||
\`\`\`mermaid
|
||
mindmap
|
||
root(Main Topic)
|
||
Theme One
|
||
Detail
|
||
Theme Two
|
||
Detail
|
||
\`\`\`
|
||
|
||
## Notable Quotes
|
||
|
||
<List 3-5 notable quotes from the content, if any>
|
||
|
||
Return only the markdown content without any explanations or comments.`,showInContextMenu:!1,showInSlashMenu:!0,order:1140,modelKey:"",lastUsedMs:0}];Xe();var lZ=require("obsidian");Ye();XC();XC();var pW=pF(),mW=bc([]),Mgt=new Set;function hW(t){Mgt.add(t)}function gW(t){Mgt.delete(t)}function rde(t){return Mgt.has(t)}function nde(t){let e=pW.get(mW);pW.set(mW,e.filter(r=>r.title!==t))}function yW(t,e){let r=pW.get(mW),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],pW.set(mW,n)}function h$e(t){pW.set(mW,t)}function g$e(){return L_(mW,{store:pW})}function Pv(){return pW.get(mW)}Nte();Bt();l1();mr();function y$e(t,e,r){let n=t.trim();return n?t!==n?"Command name cannot have leading or trailing spaces":r&&t===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:"Command name cannot be empty"}function cZ(t){return encodeURIComponent(t.toLowerCase())}function mB(){return(0,lZ.normalizePath)(te().customPromptsFolder)}function dZ(t){return`${mB()}/${t}.md`}function fZ(t){if(!(t instanceof lZ.TFile)||t.extension!=="md")return!1;let e=mB();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function IWr(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[cN]!=null}async function ode(t){let e=await app.vault.read(t),r=HJ(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[$$]??lN.showInContextMenu,i=n?.frontmatter?.[L$]??lN.showInSlashMenu,a=n?.frontmatter?.[k$]??lN.lastUsedMs,s=n?.frontmatter?.[cN]??lN.order,u=n?.frontmatter?.[F$]??lN.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function b$e(){let t=app.vault.getFiles().filter(r=>fZ(r)),e=await Promise.all(t.map(ode));return h$e(e),e}function ide(t){return mO(t,"manual",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0,getManualOrder:e=>e.order})}function Nai(t){return mO(t,"recent",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:e=>e.lastUsedMs})}function Dai(t){return mO(t,"name",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0})}function _$e(t){switch(te().promptSortStrategy){case"timestamp":return Nai(t);case"alphabetical":return Dai(t);case"manual":return ide(t);default:return t}}async function ade(t,e,r=!1){let o=(await sde(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${q_}}`)||r)return o;let i=o.indexOf(Pgt);return i===-1?e.trim()?o+`
|
||
|
||
<`+q_+">"+e+"</"+q_+">":o:o.slice(0,i)+e+o.slice(i+Pgt.length)}var jai=/\{(?!copilot-selection\}|\[\[)([^}]+)\}/g;async function $ai(t,e,r){let n=new Map,o=new Set,i;for(;(i=jai.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]},u=a.toLowerCase();if(u==="activenote")if(r){let l=await WJ(r,e);l&&(s.content=`<${R4}>
|
||
<path>${r.path}</path>
|
||
## ${hye(r)}
|
||
|
||
${l}
|
||
</${R4}>`,s.files.push(r))}else new lZ.Notice("No active note found.");else{if(u==="activewebtab")continue;if(a.startsWith("#")){let l=a.slice(1).split(",").map(f=>f.trim()),c=await mye(e,l),d=[];for(let f of c){let p=await WJ(f,e);p&&(d.push(`<${R4}>
|
||
<path>${f.path}</path>
|
||
## ${hye(f)}
|
||
|
||
${p}
|
||
</${R4}>`),s.files.push(f))}s.content=d.join(`
|
||
|
||
`)}else{let l=x1t(a),c=await Ote(e,l),d=[];for(let f of c){let p=await WJ(f,e);p&&(d.push(`<${R4}>
|
||
<path>${f.path}</path>
|
||
## ${hye(f)}
|
||
|
||
${p}
|
||
</${R4}>`),s.files.push(f))}s.content=d.join(`
|
||
|
||
`)}}s.content?(n.set(a,s.content),s.files.forEach(l=>o.add(l))):u!=="activenote"&&u!=="activewebtab"&&(a.startsWith('"')||Te(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function sde(t,e,r,n,o=!1){let i=te(),a=new Set;if(!i.enableCustomPromptTemplating)return!o&&t.includes("{}")&&!e&&n&&a.add(n),{processedPrompt:t+`
|
||
|
||
`,includedFiles:Array.from(a)};let{variablesMap:s,includedFiles:u}=await $ai(t,r,n);u.forEach(p=>a.add(p));let l=t,c="",d=null;!o&&l.includes("{}")&&(l=l.replace(/\{\}/g,`{${q_}}`),e?c+=`<${q_}>
|
||
${e}
|
||
</${q_}>`:n?(d=await WJ(n,r),c+=`<${q_} type="active_note">
|
||
${d||""}
|
||
</${q_}>`,a.add(n)):c+=`<${q_}>
|
||
(No selected text or active note available)
|
||
</${q_}>`);for(let[p,m]of s.entries())p.toLowerCase()==="activenote"&&d!==null||(c?c+=`
|
||
|
||
<${jte} name="${p}">
|
||
${m}
|
||
</${jte}>`:c+=`<${jte} name="${p}">
|
||
${m}
|
||
</${jte}>`);let f=C1t(l,r);for(let p of f)if(!a.has(p)){let m=await WJ(p,r);if(m){let h=await r.adapter.stat(p.path),y=h?new Date(h.ctime).toISOString():"Unknown",g=h?new Date(h.mtime).toISOString():"Unknown",b=`<${Dte}>
|
||
<title>${p.basename}</title>
|
||
<path>${p.path}</path>
|
||
<ctime>${y}</ctime>
|
||
<mtime>${g}</mtime>
|
||
<content>
|
||
${m}
|
||
</content>
|
||
</${Dte}>`;c&&(c+=`
|
||
|
||
`),c+=`${b}`,a.add(p)}}return{processedPrompt:c?`${l}
|
||
|
||
${c}`:`${l}
|
||
|
||
`,includedFiles:Array.from(a)}}function AWr(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}function v$e(){let e=Pv().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function Rgt(t,e){try{hW(t.path),await app.fileManager.processFrontMatter(t,r=>{r[$$]==null&&(r[$$]=e.showInContextMenu),r[L$]==null&&(r[L$]=e.showInSlashMenu),r[cN]==null&&(r[cN]=e.order),r[F$]==null&&(r[F$]=e.modelKey),r[k$]==null&&(r[k$]=e.lastUsedMs)})}finally{gW(t.path)}}function Lai({commands:t,command:e,onConfirm:r,onCancel:n}){let i=Br().activeModels.filter(f=>f.enabled).map(f=>({label:PWr(f),value:no(f)})),[a,s]=(0,Ls.useState)(e),[u,l]=(0,Ls.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=y$e(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 Ls.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Ls.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ls.default.createElement(Xc,{htmlFor:"title"},"Name"),Ls.default.createElement(ri,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&Ls.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),Ls.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ls.default.createElement(Xc,{htmlFor:"content"},"Prompt"),Ls.default.createElement(MWr,null),Ls.default.createElement(h_,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&Ls.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),Ls.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ls.default.createElement(Xc,{htmlFor:"modelKey"},"Model (Optional)"),Ls.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},Ls.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)){ne(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:we("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")},Ls.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Ls.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Ls.default.createElement("div",{className:we("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")},Ls.default.createElement(Wi,{className:"tw-size-4"})))),Ls.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ls.default.createElement(Rl,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Ls.default.createElement(Xc,{htmlFor:"showInContextMenu"},"Show in context menu")),Ls.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ls.default.createElement(Rl,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),Ls.default.createElement(Xc,{htmlFor:"showInSlashMenu"},"Show in slash menu")),Ls.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Ls.default.createElement(pe,{variant:"secondary",onClick:n},"Cancel"),Ls.default.createElement(pe,{variant:"default",onClick:d},"Save")))}var hB=class extends NWr.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,DWr.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(Ls.default.createElement(Lai,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var ude=require("obsidian");lw();Bt();var th=class t{static getInstance(){return t.instance||(t.instance=new t),t.instance}async createCommand(e,r={}){let n={skipStoreUpdate:!1,autoOrder:!0,...r},o=dZ(e.title);try{hW(o);let i=e.order;n.autoOrder&&(i=v$e()),e={...e,order:i};let a=mB();await $c(a);let s=app.vault.getAbstractFileByPath(o);!s||!(s instanceof ude.TFile)?s=await app.vault.create(o,e.content):await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[$$]=e.showInContextMenu,u[L$]=e.showInSlashMenu,u[cN]=e.order,u[F$]=e.modelKey,u[k$]=e.lastUsedMs}),n.skipStoreUpdate||yW(e,e.title)}finally{gW(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=dZ(e.title),i=dZ(r),a=e.title!==r;try{hW(o),a&&hW(i),n||yW(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new lo("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof ude.TFile&&(await app.vault.rename(l,o),s=app.vault.getAbstractFileByPath(o))}s||(await this.createCommand(e,{skipStoreUpdate:n,autoOrder:!0}),s=app.vault.getAbstractFileByPath(dZ(e.title))),s instanceof ude.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[$$]=e.showInContextMenu,u[L$]=e.showInSlashMenu,u[cN]=e.order,u[F$]=e.modelKey,u[k$]=e.lastUsedMs}))}finally{gW(o),a&&gW(i)}}async updateCommands(e){h$e(e),await Promise.all(e.map(r=>this.updateCommand(r,r.title,!0)))}async reorderCommands(e){let r=[...e];for(let n=0;n<r.length;n++)r[n]={...r[n],order:n*10};await this.updateCommands(r)}async deleteCommand(e){let r=dZ(e.title);try{hW(r),nde(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof ude.TFile&&await app.vault.delete(n)}finally{gW(r)}}};var w$e=`
|
||
You are an AI assistant designed to execute user instructions with precision. Your responses should be:
|
||
|
||
- Direct and focused: Address only what is explicitly requested
|
||
- Concise: Avoid unnecessary elaboration unless the user asks for details
|
||
- Context-aware: When text is selected or highlighted, treat it as the primary target for any requested action
|
||
- Action-oriented: Prioritize completing the task over explaining the process
|
||
|
||
Key principles:
|
||
|
||
- Follow instructions literally and completely
|
||
- Assume selected/highlighted text is the focus unless told otherwise
|
||
- Use all provided context: Consider any additional information, examples, or constraints the user provides to better complete the task
|
||
- Add explanations only when explicitly requested or when clarification is essential
|
||
- Maintain the user's preferred format and style
|
||
|
||
Response format: Match the format implied by the user's request (e.g., if they ask for a list, provide a list; if they ask for a rewrite, provide only the rewritten text).
|
||
`;function S$e(t,e){if(!e)return t;let r=t.includes("{}"),n=/\{activenote\}/i.test(t),o=[];return r||o.push("{}"),n||o.push("{activeNote}"),o.length>0?t+`
|
||
|
||
${o.join(`
|
||
|
||
`)}`:t}ra();var Igt=$(J());$r();function Agt({onMouseDown:t,className:e}){return Igt.createElement("div",{className:we("tw-flex tw-h-4 tw-items-center tw-justify-center","tw-cursor-grab active:tw-cursor-grabbing","hover:tw-bg-[color-mix(in_srgb,var(--background-modifier-hover)_20%,transparent)]",e),onMouseDown:t},Igt.createElement("div",{className:"tw-h-[5px] tw-w-16 tw-rounded-sm tw-bg-[color-mix(in_srgb,var(--text-muted)_40%,transparent)] hover:tw-bg-[color-mix(in_srgb,var(--text-muted)_65%,transparent)]"}))}var Ngt=$(J());Or();$r();Cn();function Dgt({onClose:t,className:e}){return Ngt.createElement(pe,{className:we("tw-absolute tw-right-2 tw-top-1 tw-rounded tw-p-1 tw-text-normal",e),variant:"ghost2",onClick:t,title:"Close","aria-label":"Close"},Ngt.createElement(qo,{className:"tw-size-4"}))}var C$e=$(J());Or();$r();function jgt({icon:t,label:e,className:r}){let n=t===null?null:t!==void 0?t:C$e.createElement(JF,{className:"tw-size-4 tw-text-muted"});return C$e.createElement("div",{className:we("tw-flex tw-flex-none tw-items-center tw-justify-center tw-gap-2","tw-px-4 tw-py-2",r)},n,C$e.createElement("span",{className:"tw-truncate tw-text-sm tw-font-medium tw-text-normal"},e))}var OW=$(J());$r();Or();Cn();Cn();var bde=$(J());var ni=$(J(),1);var kEs=!!(typeof window<"u"&&window.document&&window.document.createElement);function bW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var $Wr=$(J(),1);function jWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function $gt(...t){return e=>{let r=!1,n=t.map(o=>{let i=jWr(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():jWr(t[o],null)}}}}function lde(...t){return $Wr.useCallback($gt(...t),t)}var q$=$(J(),1),LWr=$(St(),1);function FWr(t,e=[]){let r=[];function n(i,a){let s=q$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=q$.useMemo(()=>m,Object.values(m));return(0,LWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=q$.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=>q$.createContext(a));return function(s){let u=s?.[t]||i;return q$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Fai(o,...e)]}function Fai(...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 q$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Ic=$(J(),1);var zEs=!!(typeof window<"u"&&window.document&&window.document.createElement);function x$e(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var BWr=$(J(),1),zWr=$(hu(),1);var rh=$(J(),1);var qWr=$(J(),1);function kWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Lgt(...t){return e=>{let r=!1,n=t.map(o=>{let i=kWr(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():kWr(t[o],null)}}}}function Fgt(...t){return qWr.useCallback(Lgt(...t),t)}var T$e=$(St(),1);function UWr(t){let e=kai(t),r=rh.forwardRef((n,o)=>{let{children:i,...a}=n,s=rh.Children.toArray(i),u=s.find(Uai);if(u){let l=u.props.children,c=s.map(d=>d===u?rh.Children.count(l)>1?rh.Children.only(null):rh.isValidElement(l)?l.props.children:null:d);return(0,T$e.jsx)(e,{...a,ref:o,children:rh.isValidElement(l)?rh.cloneElement(l,void 0,c):null})}return(0,T$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function kai(t){let e=rh.forwardRef((r,n)=>{let{children:o,...i}=r;if(rh.isValidElement(o)){let a=zai(o),s=Bai(i,o.props);return o.type!==rh.Fragment&&(s.ref=n?Lgt(n,a):a),rh.cloneElement(o,s)}return rh.Children.count(o)>1?rh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var qai=Symbol("radix.slottable");function Uai(t){return rh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===qai}function Bai(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 zai(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 VWr=$(St(),1),Vai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kgt=Vai.reduce((t,e)=>{let r=UWr(`Primitive.${e}`),n=BWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,VWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function HWr(t,e){t&&zWr.flushSync(()=>t.dispatchEvent(e))}var pZ=$(J(),1);function qgt(t){let e=pZ.useRef(t);return pZ.useEffect(()=>{e.current=t}),pZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var JWr=$(J(),1);var mZ=$(J(),1);function WWr(t){let e=mZ.useRef(t);return mZ.useEffect(()=>{e.current=t}),mZ.useMemo(()=>(...r)=>e.current?.(...r),[])}function KWr(t,e=globalThis?.document){let r=WWr(t);JWr.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 Bgt=$(St(),1),Hai="DismissableLayer",Ugt="dismissableLayer.update",Wai="dismissableLayer.pointerDownOutside",Jai="dismissableLayer.focusOutside",GWr,ZWr=Ic.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_T=Ic.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Ic.useContext(ZWr),[c,d]=Ic.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Ic.useState({}),m=Fgt(e,E=>d(E)),h=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=g,T=Xai(E=>{let P=E.target,R=[...l.branches].some(I=>I.contains(P));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=Zai(E=>{let P=E.target;[...l.branches].some(I=>I.contains(P))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return KWr(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Ic.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(GWr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),XWr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=GWr)}},[c,f,r,l]),Ic.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),XWr())},[c,l]),Ic.useEffect(()=>{let E=()=>p({});return document.addEventListener(Ugt,E),()=>document.removeEventListener(Ugt,E)},[]),(0,Bgt.jsx)(kgt.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:x$e(t.onFocusCapture,O.onFocusCapture),onBlurCapture:x$e(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:x$e(t.onPointerDownCapture,T.onPointerDownCapture)})});_T.displayName=Hai;var Kai="DismissableLayerBranch",Gai=Ic.forwardRef((t,e)=>{let r=Ic.useContext(ZWr),n=Ic.useRef(null),o=Fgt(e,n);return Ic.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Bgt.jsx)(kgt.div,{...t,ref:o})});Gai.displayName=Kai;function Xai(t,e=globalThis?.document){let r=qgt(t),n=Ic.useRef(!1),o=Ic.useRef(()=>{});return Ic.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){YWr(Wai,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 Zai(t,e=globalThis?.document){let r=qgt(t),n=Ic.useRef(!1);return Ic.useEffect(()=>{let o=i=>{i.target&&!n.current&&YWr(Jai,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 XWr(){let t=new CustomEvent(Ugt);document.dispatchEvent(t)}function YWr(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?HWr(o,i):o.dispatchEvent(i)}var zgt=$(J(),1);var QWr=$(J(),1),_W=globalThis?.document?QWr.useLayoutEffect:()=>{};var Yai=zgt[" useId ".trim().toString()]||(()=>{}),Qai=0;function e6r(t){let[e,r]=zgt.useState(Yai());return _W(()=>{t||r(n=>n??String(Qai++))},[t]),t||(e?`radix-${e}`:"")}var Rv=$(J(),1);var n6r=["top","right","bottom","left"];var dN=Math.min,g_=Math.max,dde=Math.round,fde=Math.floor,vT=t=>({x:t,y:t}),esi={left:"right",right:"left",bottom:"top",top:"bottom"},tsi={start:"end",end:"start"};function E$e(t,e,r){return g_(t,dN(e,r))}function fN(t,e){return typeof t=="function"?t(e):t}function pN(t){return t.split("-")[0]}function vW(t){return t.split("-")[1]}function P$e(t){return t==="x"?"y":"x"}function M$e(t){return t==="y"?"height":"width"}var rsi=new Set(["top","bottom"]);function wT(t){return rsi.has(pN(t))?"y":"x"}function R$e(t){return P$e(wT(t))}function o6r(t,e,r){r===void 0&&(r=!1);let n=vW(t),o=R$e(t),i=M$e(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=cde(a)),[a,cde(a)]}function i6r(t){let e=cde(t);return[O$e(t),e,O$e(e)]}function O$e(t){return t.replace(/start|end/g,e=>tsi[e])}var t6r=["left","right"],r6r=["right","left"],nsi=["top","bottom"],osi=["bottom","top"];function isi(t,e,r){switch(t){case"top":case"bottom":return r?e?r6r:t6r:e?t6r:r6r;case"left":case"right":return e?nsi:osi;default:return[]}}function a6r(t,e,r,n){let o=vW(t),i=isi(pN(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(O$e)))),i}function cde(t){return t.replace(/left|right|bottom|top/g,e=>esi[e])}function asi(t){return{top:0,right:0,bottom:0,left:0,...t}}function Vgt(t){return typeof t!="number"?asi(t):{top:t,right:t,bottom:t,left:t}}function wW(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 s6r(t,e,r){let{reference:n,floating:o}=t,i=wT(e),a=R$e(e),s=M$e(a),u=pN(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(vW(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var c6r=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}=s6r(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:y,fn:g}=s[h],{x:b,y:_,data:w,reset:T}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=b??c,d=_??d,p={...p,[y]:{...p[y],...w}},T&&m<=50&&(m++,typeof T=="object"&&(T.placement&&(f=T.placement),T.rects&&(l=T.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):T.rects),{x:c,y:d}=s6r(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function hZ(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}=fN(e,t),m=Vgt(p),y=s[f?d==="floating"?"reference":"floating":d],g=wW(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(y)))==null||r?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:c,strategy:u})),b=d==="floating"?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),w=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},T=wW(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:_,strategy:u}):b);return{top:(g.top-T.top+m.top)/w.y,bottom:(T.bottom-g.bottom+m.bottom)/w.y,left:(g.left-T.left+m.left)/w.x,right:(T.right-g.right+m.right)/w.x}}var d6r=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}=fN(t,e)||{};if(l==null)return{};let d=Vgt(c),f={x:r,y:n},p=R$e(o),m=M$e(p),h=await a.getDimensions(l),y=p==="y",g=y?"top":"left",b=y?"bottom":"right",_=y?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[p]-f[p]-i.floating[m],T=f[p]-i.reference[p],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=O?O[_]:0;(!E||!await(a.isElement==null?void 0:a.isElement(O)))&&(E=s.floating[_]||i.floating[m]);let P=w/2-T/2,R=E/2-h[m]/2-1,I=dN(d[g],R),N=dN(d[b],R),z=I,V=E-h[m]-N,k=E/2-h[m]/2+P,X=E$e(z,k,V),B=!u.arrow&&vW(o)!=null&&k!==X&&i.reference[m]/2-(k<z?I:N)-h[m]/2<0,Q=B?k<z?k-z:k-V:0;return{[p]:f[p]+Q,data:{[p]:X,centerOffset:k-X-Q,...B&&{alignmentOffset:Q}},reset:B}}});var f6r=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var r,n;let{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:u,elements:l}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...y}=fN(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=pN(o),b=wT(s),_=pN(s)===s,w=await(u.isRTL==null?void 0:u.isRTL(l.floating)),T=f||(_||!h?[cde(s)]:i6r(s)),O=m!=="none";!f&&O&&T.push(...a6r(s,h,m,w));let E=[s,...T],P=await hZ(e,y),R=[],I=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&R.push(P[g]),d){let k=o6r(o,a,w);R.push(P[k[0]],P[k[1]])}if(I=[...I,{placement:o,overflows:R}],!R.every(k=>k<=0)){var N,z;let k=(((N=i.flip)==null?void 0:N.index)||0)+1,X=E[k];if(X&&(!(d==="alignment"?b!==wT(X):!1)||I.every(Y=>wT(Y.placement)===b?Y.overflows[0]>0:!0)))return{data:{index:k,overflows:I},reset:{placement:X}};let B=(z=I.filter(Q=>Q.overflows[0]<=0).sort((Q,Y)=>Q.overflows[1]-Y.overflows[1])[0])==null?void 0:z.placement;if(!B)switch(p){case"bestFit":{var V;let Q=(V=I.filter(Y=>{if(O){let K=wT(Y.placement);return K===b||K==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(K=>K>0).reduce((K,oe)=>K+oe,0)]).sort((Y,K)=>Y[1]-K[1])[0])==null?void 0:V[0];Q&&(B=Q);break}case"initialPlacement":B=s;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function u6r(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function l6r(t){return n6r.some(e=>t[e]>=0)}var p6r=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=fN(t,e);switch(n){case"referenceHidden":{let i=await hZ(e,{...o,elementContext:"reference"}),a=u6r(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:l6r(a)}}}case"escaped":{let i=await hZ(e,{...o,altBoundary:!0}),a=u6r(i,r.floating);return{data:{escapedOffsets:a,escaped:l6r(a)}}}default:return{}}}}};var m6r=new Set(["left","top"]);async function ssi(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=pN(r),s=vW(r),u=wT(r)==="y",l=m6r.has(a)?-1:1,c=i&&u?-1:1,d=fN(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 h6r=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 ssi(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}}}}},g6r=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:r,y:n,placement:o}=e,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:y=>{let{x:g,y:b}=y;return{x:g,y:b}}},...u}=fN(t,e),l={x:r,y:n},c=await hZ(e,u),d=wT(pN(o)),f=P$e(d),p=l[f],m=l[d];if(i){let y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",b=p+c[y],_=p-c[g];p=E$e(b,p,_)}if(a){let y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=m+c[y],_=m-c[g];m=E$e(b,m,_)}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}}}}}},y6r=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}=fN(t,e),c={x:r,y:n},d=wT(o),f=P$e(d),p=c[f],m=c[d],h=fN(s,e),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){let _=f==="y"?"height":"width",w=i.reference[f]-i.floating[_]+y.mainAxis,T=i.reference[f]+i.reference[_]-y.mainAxis;p<w?p=w:p>T&&(p=T)}if(l){var g,b;let _=f==="y"?"width":"height",w=m6r.has(pN(o)),T=i.reference[d]-i.floating[_]+(w&&((g=a.offset)==null?void 0:g[d])||0)+(w?0:y.crossAxis),O=i.reference[d]+i.reference[_]+(w?0:((b=a.offset)==null?void 0:b[d])||0)-(w?y.crossAxis:0);m<T?m=T:m>O&&(m=O)}return{[f]:p,[d]:m}}}},b6r=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}=fN(t,e),c=await hZ(e,l),d=pN(o),f=vW(o),p=wT(o)==="y",{width:m,height:h}=i.floating,y,g;d==="top"||d==="bottom"?(y=d,g=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(g=d,y=f==="end"?"top":"bottom");let b=h-c.top-c.bottom,_=m-c.left-c.right,w=dN(h-c[y],b),T=dN(m-c[g],_),O=!e.middlewareData.shift,E=w,P=T;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(P=_),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=b),O&&!f){let I=g_(c.left,0),N=g_(c.right,0),z=g_(c.top,0),V=g_(c.bottom,0);p?P=m-2*(I!==0||N!==0?I+N:g_(c.left,c.right)):E=h-2*(z!==0||V!==0?z+V:g_(c.top,c.bottom))}await u({...e,availableWidth:P,availableHeight:E});let R=await a.getDimensions(s.floating);return m!==R.width||h!==R.height?{reset:{rects:!0}}:{}}}};function I$e(){return typeof window<"u"}function CW(t){return v6r(t)?(t.nodeName||"").toLowerCase():"#document"}function Mv(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ST(t){var e;return(e=(v6r(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function v6r(t){return I$e()?t instanceof Node||t instanceof Mv(t).Node:!1}function cC(t){return I$e()?t instanceof Element||t instanceof Mv(t).Element:!1}function CT(t){return I$e()?t instanceof HTMLElement||t instanceof Mv(t).HTMLElement:!1}function _6r(t){return!I$e()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Mv(t).ShadowRoot}var usi=new Set(["inline","contents"]);function gZ(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=dC(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!usi.has(o)}var lsi=new Set(["table","td","th"]);function w6r(t){return lsi.has(CW(t))}var csi=[":popover-open",":modal"];function pde(t){return csi.some(e=>{try{return t.matches(e)}catch{return!1}})}var dsi=["transform","translate","scale","rotate","perspective"],fsi=["transform","translate","scale","rotate","perspective","filter"],psi=["paint","layout","strict","content"];function A$e(t){let e=N$e(),r=cC(t)?dC(t):t;return dsi.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||fsi.some(n=>(r.willChange||"").includes(n))||psi.some(n=>(r.contain||"").includes(n))}function S6r(t){let e=U$(t);for(;CT(e)&&!xW(e);){if(A$e(e))return e;if(pde(e))return null;e=U$(e)}return null}function N$e(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var msi=new Set(["html","body","#document"]);function xW(t){return msi.has(CW(t))}function dC(t){return Mv(t).getComputedStyle(t)}function mde(t){return cC(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U$(t){if(CW(t)==="html")return t;let e=t.assignedSlot||t.parentNode||_6r(t)&&t.host||ST(t);return _6r(e)?e.host:e}function C6r(t){let e=U$(t);return xW(e)?t.ownerDocument?t.ownerDocument.body:t.body:CT(e)&&gZ(e)?e:C6r(e)}function SW(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=C6r(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=Mv(o);if(i){let s=D$e(a);return e.concat(a,a.visualViewport||[],gZ(o)?o:[],s&&r?SW(s):[])}return e.concat(o,SW(o,[],r))}function D$e(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function E6r(t){let e=dC(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=CT(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=dde(r)!==i||dde(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function Wgt(t){return cC(t)?t:t.contextElement}function yZ(t){let e=Wgt(t);if(!CT(e))return vT(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=E6r(e),a=(i?dde(r.width):r.width)/n,s=(i?dde(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var hsi=vT(0);function P6r(t){let e=Mv(t);return!N$e()||!e.visualViewport?hsi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function gsi(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Mv(t)?!1:e}function TW(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=Wgt(t),a=vT(1);e&&(n?cC(n)&&(a=yZ(n)):a=yZ(t));let s=gsi(i,r,n)?P6r(i):vT(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=Mv(i),p=n&&cC(n)?Mv(n):n,m=f,h=D$e(m);for(;h&&n&&p!==m;){let y=yZ(h),g=h.getBoundingClientRect(),b=dC(h),_=g.left+(h.clientLeft+parseFloat(b.paddingLeft))*y.x,w=g.top+(h.clientTop+parseFloat(b.paddingTop))*y.y;u*=y.x,l*=y.y,c*=y.x,d*=y.y,u+=_,l+=w,m=Mv(h),h=D$e(m)}}return wW({width:c,height:d,x:u,y:l})}function j$e(t,e){let r=mde(t).scrollLeft;return e?e.left+r:TW(ST(t)).left+r}function M6r(t,e){let r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-j$e(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function ysi(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=ST(n),s=e?pde(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=vT(1),c=vT(0),d=CT(n);if((d||!d&&!i)&&((CW(n)!=="body"||gZ(a))&&(u=mde(n)),CT(n))){let p=TW(n);l=yZ(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?M6r(a,u):vT(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 bsi(t){return Array.from(t.getClientRects())}function _si(t){let e=ST(t),r=mde(t),n=t.ownerDocument.body,o=g_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=g_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+j$e(t),s=-r.scrollTop;return dC(n).direction==="rtl"&&(a+=g_(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}var x6r=25;function vsi(t,e){let r=Mv(t),n=ST(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let c=N$e();(!c||c&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}let l=j$e(n);if(l<=0){let c=n.ownerDocument,d=c.body,f=getComputedStyle(d),p=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-d.clientWidth-p);m<=x6r&&(i-=m)}else l<=x6r&&(i+=l);return{width:i,height:a,x:s,y:u}}var wsi=new Set(["absolute","fixed"]);function Ssi(t,e){let r=TW(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=CT(t)?yZ(t):vT(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 T6r(t,e,r){let n;if(e==="viewport")n=vsi(t,r);else if(e==="document")n=_si(ST(t));else if(cC(e))n=Ssi(e,r);else{let o=P6r(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return wW(n)}function R6r(t,e){let r=U$(t);return r===e||!cC(r)||xW(r)?!1:dC(r).position==="fixed"||R6r(r,e)}function Csi(t,e){let r=e.get(t);if(r)return r;let n=SW(t,[],!1).filter(s=>cC(s)&&CW(s)!=="body"),o=null,i=dC(t).position==="fixed",a=i?U$(t):t;for(;cC(a)&&!xW(a);){let s=dC(a),u=A$e(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&wsi.has(o.position)||gZ(a)&&!u&&R6r(t,a))?n=n.filter(c=>c!==a):o=s,a=U$(a)}return e.set(t,n),n}function xsi(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?pde(e)?[]:Csi(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=T6r(e,c,o);return l.top=g_(d.top,l.top),l.right=dN(d.right,l.right),l.bottom=dN(d.bottom,l.bottom),l.left=g_(d.left,l.left),l},T6r(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Tsi(t){let{width:e,height:r}=E6r(t);return{width:e,height:r}}function Osi(t,e,r){let n=CT(e),o=ST(e),i=r==="fixed",a=TW(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=vT(0);function l(){u.x=j$e(o)}if(n||!n&&!i)if((CW(e)!=="body"||gZ(o))&&(s=mde(e)),n){let p=TW(e,!0,i,e);u.x=p.x+e.clientLeft,u.y=p.y+e.clientTop}else o&&l();i&&!n&&o&&l();let c=o&&!n&&!i?M6r(o,s):vT(0),d=a.left+s.scrollLeft-u.x-c.x,f=a.top+s.scrollTop-u.y-c.y;return{x:d,y:f,width:a.width,height:a.height}}function Hgt(t){return dC(t).position==="static"}function O6r(t,e){if(!CT(t)||dC(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return ST(t)===r&&(r=r.ownerDocument.body),r}function I6r(t,e){let r=Mv(t);if(pde(t))return r;if(!CT(t)){let o=U$(t);for(;o&&!xW(o);){if(cC(o)&&!Hgt(o))return o;o=U$(o)}return r}let n=O6r(t,e);for(;n&&w6r(n)&&Hgt(n);)n=O6r(n,e);return n&&xW(n)&&Hgt(n)&&!A$e(n)?r:n||S6r(t)||r}var Esi=async function(t){let e=this.getOffsetParent||I6r,r=this.getDimensions,n=await r(t.floating);return{reference:Osi(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Psi(t){return dC(t).direction==="rtl"}var A6r={convertOffsetParentRelativeRectToViewportRelativeRect:ysi,getDocumentElement:ST,getClippingRect:xsi,getOffsetParent:I6r,getElementRects:Esi,getClientRects:bsi,getDimensions:Tsi,getScale:yZ,isElement:cC,isRTL:Psi};function N6r(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Msi(t,e){let r=null,n,o=ST(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 l=t.getBoundingClientRect(),{left:c,top:d,width:f,height:p}=l;if(s||e(),!f||!p)return;let m=fde(d),h=fde(o.clientWidth-(c+f)),y=fde(o.clientHeight-(d+p)),g=fde(c),_={rootMargin:-m+"px "+-h+"px "+-y+"px "+-g+"px",threshold:g_(0,dN(1,u))||1},w=!0;function T(O){let E=O[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!N6r(l,t.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(T,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(T,_)}r.observe(t)}return a(!0),i}function Jgt(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=Wgt(t),c=o||i?[...l?SW(l):[],...SW(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?Msi(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(g=>{let[b]=g;b&&b.target===l&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(e)})),r()}),l&&!u&&p.observe(l),p.observe(e));let m,h=u?TW(t):null;u&&y();function y(){let g=TW(t);h&&!N6r(h,g)&&r(),h=g,m=requestAnimationFrame(y)}return r(),()=>{var g;c.forEach(b=>{o&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),d?.(),(g=p)==null||g.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var D6r=h6r;var j6r=g6r,$6r=f6r,L6r=b6r,F6r=p6r,Kgt=d6r;var k6r=y6r,Ggt=(t,e,r)=>{let n=new Map,o={platform:A6r,...r},i={...o.platform,_c:n};return c6r(t,e,{...o,platform:i})};var xm=$(J(),1),U6r=$(J(),1),B6r=$(hu(),1),Rsi=typeof document<"u",Isi=function(){},$$e=Rsi?U6r.useLayoutEffect:Isi;function L$e(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!L$e(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),r=o.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=r;n--!==0;){let i=o[n];if(!(i==="_owner"&&t.$$typeof)&&!L$e(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function z6r(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function q6r(t,e){let r=z6r(t);return Math.round(e*r)/r}function Xgt(t){let e=xm.useRef(t);return $$e(()=>{e.current=t}),e}function V6r(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]=xm.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=xm.useState(n);L$e(f,n)||p(n);let[m,h]=xm.useState(null),[y,g]=xm.useState(null),b=xm.useCallback(Y=>{Y!==O.current&&(O.current=Y,h(Y))},[]),_=xm.useCallback(Y=>{Y!==E.current&&(E.current=Y,g(Y))},[]),w=i||m,T=a||y,O=xm.useRef(null),E=xm.useRef(null),P=xm.useRef(c),R=u!=null,I=Xgt(u),N=Xgt(o),z=Xgt(l),V=xm.useCallback(()=>{if(!O.current||!E.current)return;let Y={placement:e,strategy:r,middleware:f};N.current&&(Y.platform=N.current),Ggt(O.current,E.current,Y).then(K=>{let oe={...K,isPositioned:z.current!==!1};k.current&&!L$e(P.current,oe)&&(P.current=oe,B6r.flushSync(()=>{d(oe)}))})},[f,e,r,N,z]);$$e(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(Y=>({...Y,isPositioned:!1})))},[l]);let k=xm.useRef(!1);$$e(()=>(k.current=!0,()=>{k.current=!1}),[]),$$e(()=>{if(w&&(O.current=w),T&&(E.current=T),w&&T){if(I.current)return I.current(w,T,V);V()}},[w,T,V,I,R]);let X=xm.useMemo(()=>({reference:O,floating:E,setReference:b,setFloating:_}),[b,_]),B=xm.useMemo(()=>({reference:w,floating:T}),[w,T]),Q=xm.useMemo(()=>{let Y={position:r,left:0,top:0};if(!B.floating)return Y;let K=q6r(B.floating,c.x),oe=q6r(B.floating,c.y);return s?{...Y,transform:"translate("+K+"px, "+oe+"px)",...z6r(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:K,top:oe}},[r,s,B.floating,c.x,c.y]);return xm.useMemo(()=>({...c,update:V,refs:X,elements:B,floatingStyles:Q}),[c,V,X,B,Q])}var Asi=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?Kgt({element:n.current,padding:o}).fn(r):{}:n?Kgt({element:n,padding:o}).fn(r):{}}}},H6r=(t,e)=>({...D6r(t),options:[t,e]}),W6r=(t,e)=>({...j6r(t),options:[t,e]}),J6r=(t,e)=>({...k6r(t),options:[t,e]}),K6r=(t,e)=>({...$6r(t),options:[t,e]}),G6r=(t,e)=>({...L6r(t),options:[t,e]});var X6r=(t,e)=>({...F6r(t),options:[t,e]});var Z6r=(t,e)=>({...Asi(t),options:[t,e]});var oJr=$(J(),1);var tJr=$(J(),1),ksi=$(hu(),1);var nh=$(J(),1);var Nsi=$(J(),1);function Y6r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Q6r(...t){return e=>{let r=!1,n=t.map(o=>{let i=Y6r(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():Y6r(t[o],null)}}}}var F$e=$(St(),1);function eJr(t){let e=Dsi(t),r=nh.forwardRef((n,o)=>{let{children:i,...a}=n,s=nh.Children.toArray(i),u=s.find($si);if(u){let l=u.props.children,c=s.map(d=>d===u?nh.Children.count(l)>1?nh.Children.only(null):nh.isValidElement(l)?l.props.children:null:d);return(0,F$e.jsx)(e,{...a,ref:o,children:nh.isValidElement(l)?nh.cloneElement(l,void 0,c):null})}return(0,F$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Dsi(t){let e=nh.forwardRef((r,n)=>{let{children:o,...i}=r;if(nh.isValidElement(o)){let a=Fsi(o),s=Lsi(i,o.props);return o.type!==nh.Fragment&&(s.ref=n?Q6r(n,a):a),nh.cloneElement(o,s)}return nh.Children.count(o)>1?nh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var jsi=Symbol("radix.slottable");function $si(t){return nh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===jsi}function Lsi(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 Fsi(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 rJr=$(St(),1),qsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nJr=qsi.reduce((t,e)=>{let r=eJr(`Primitive.${e}`),n=tJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,rJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Zgt=$(St(),1),Usi="Arrow",iJr=oJr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Zgt.jsx)(nJr.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Zgt.jsx)("polygon",{points:"0,0 30,0 15,10"})})});iJr.displayName=Usi;var aJr=iJr;var uJr=$(J(),1);function sJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ygt(...t){return e=>{let r=!1,n=t.map(o=>{let i=sJr(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():sJr(t[o],null)}}}}function Qgt(...t){return uJr.useCallback(Ygt(...t),t)}var B$=$(J(),1),lJr=$(St(),1);function cJr(t,e=[]){let r=[];function n(i,a){let s=B$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=B$.useMemo(()=>m,Object.values(m));return(0,lJr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=B$.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=>B$.createContext(a));return function(s){let u=s?.[t]||i;return B$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,zsi(o,...e)]}function zsi(...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 B$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var fJr=$(J(),1),Gsi=$(hu(),1);var oh=$(J(),1);var k$e=$(St(),1);function dJr(t){let e=Vsi(t),r=oh.forwardRef((n,o)=>{let{children:i,...a}=n,s=oh.Children.toArray(i),u=s.find(Wsi);if(u){let l=u.props.children,c=s.map(d=>d===u?oh.Children.count(l)>1?oh.Children.only(null):oh.isValidElement(l)?l.props.children:null:d);return(0,k$e.jsx)(e,{...a,ref:o,children:oh.isValidElement(l)?oh.cloneElement(l,void 0,c):null})}return(0,k$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Vsi(t){let e=oh.forwardRef((r,n)=>{let{children:o,...i}=r;if(oh.isValidElement(o)){let a=Ksi(o),s=Jsi(i,o.props);return o.type!==oh.Fragment&&(s.ref=n?Ygt(n,a):a),oh.cloneElement(o,s)}return oh.Children.count(o)>1?oh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Hsi=Symbol("radix.slottable");function Wsi(t){return oh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Hsi}function Jsi(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 Ksi(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 pJr=$(St(),1),Xsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eyt=Xsi.reduce((t,e)=>{let r=dJr(`Primitive.${e}`),n=fJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,pJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var bZ=$(J(),1);function mJr(t){let e=bZ.useRef(t);return bZ.useEffect(()=>{e.current=t}),bZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var hJr=$(J(),1),hde=globalThis?.document?hJr.useLayoutEffect:()=>{};var gJr=$(J(),1);function yJr(t){let[e,r]=gJr.useState(void 0);return hde(()=>{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 gB=$(St(),1);var tyt="Popper",[bJr,fC]=cJr(tyt),[Zsi,_Jr]=bJr(tyt),vJr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Rv.useState(null);return(0,gB.jsx)(Zsi,{scope:e,anchor:n,onAnchorChange:o,children:r})};vJr.displayName=tyt;var wJr="PopperAnchor",SJr=Rv.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=_Jr(wJr,r),a=Rv.useRef(null),s=Qgt(e,a),u=Rv.useRef(null);return Rv.useEffect(()=>{let l=u.current;u.current=n?.current||a.current,l!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,gB.jsx)(eyt.div,{...o,ref:s})});SJr.displayName=wJr;var ryt="PopperContent",[Ysi,Qsi]=bJr(ryt),CJr=Rv.forwardRef((t,e)=>{let{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:u=!0,collisionBoundary:l=[],collisionPadding:c=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...h}=t,y=_Jr(ryt,r),[g,b]=Rv.useState(null),_=Qgt(e,A=>b(A)),[w,T]=Rv.useState(null),O=yJr(w),E=O?.width??0,P=O?.height??0,R=n+(i!=="center"?"-"+i:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},N=Array.isArray(l)?l:[l],z=N.length>0,V={padding:I,boundary:N.filter(tui),altBoundary:z},{refs:k,floatingStyles:X,placement:B,isPositioned:Q,middlewareData:Y}=V6r({strategy:"fixed",placement:R,whileElementsMounted:(...A)=>Jgt(...A,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[H6r({mainAxis:o+P,alignmentAxis:a}),u&&W6r({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?J6r():void 0,...V}),u&&K6r({...V}),G6r({...V,apply:({elements:A,rects:U,availableWidth:H,availableHeight:re})=>{let{width:Z,height:le}=U.reference,Ce=A.floating.style;Ce.setProperty("--radix-popper-available-width",`${H}px`),Ce.setProperty("--radix-popper-available-height",`${re}px`),Ce.setProperty("--radix-popper-anchor-width",`${Z}px`),Ce.setProperty("--radix-popper-anchor-height",`${le}px`)}}),w&&Z6r({element:w,padding:s}),rui({arrowWidth:E,arrowHeight:P}),f&&X6r({strategy:"referenceHidden",...V})]}),[K,oe]=OJr(B),ue=mJr(m);hde(()=>{Q&&ue?.()},[Q,ue]);let de=Y.arrow?.x,L=Y.arrow?.y,W=Y.arrow?.centerOffset!==0,[ie,j]=Rv.useState();return hde(()=>{g&&j(window.getComputedStyle(g).zIndex)},[g]),(0,gB.jsx)("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:Q?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[Y.transformOrigin?.x,Y.transformOrigin?.y].join(" "),...Y.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,gB.jsx)(Ysi,{scope:r,placedSide:K,onArrowChange:T,arrowX:de,arrowY:L,shouldHideArrow:W,children:(0,gB.jsx)(eyt.div,{"data-side":K,"data-align":oe,...h,ref:_,style:{...h.style,animation:Q?void 0:"none"}})})})});CJr.displayName=ryt;var xJr="PopperArrow",eui={top:"bottom",right:"left",bottom:"top",left:"right"},TJr=Rv.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Qsi(xJr,n),a=eui[i.placedSide];return(0,gB.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,gB.jsx)(aJr,{...o,ref:r,style:{...o.style,display:"block"}})})});TJr.displayName=xJr;function tui(t){return t!==null}var rui=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]=OJr(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 OJr(t){let[e,r="center"]=t.split("-");return[e,r]}var z$=vJr,V$=SJr,yB=CJr,bB=TJr;var B$e=$(J(),1),jJr=$(hu(),1);var RJr=$(J(),1),lui=$(hu(),1);var ih=$(J(),1);var nui=$(J(),1);function EJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function PJr(...t){return e=>{let r=!1,n=t.map(o=>{let i=EJr(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():EJr(t[o],null)}}}}var U$e=$(St(),1);function MJr(t){let e=oui(t),r=ih.forwardRef((n,o)=>{let{children:i,...a}=n,s=ih.Children.toArray(i),u=s.find(aui);if(u){let l=u.props.children,c=s.map(d=>d===u?ih.Children.count(l)>1?ih.Children.only(null):ih.isValidElement(l)?l.props.children:null:d);return(0,U$e.jsx)(e,{...a,ref:o,children:ih.isValidElement(l)?ih.cloneElement(l,void 0,c):null})}return(0,U$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function oui(t){let e=ih.forwardRef((r,n)=>{let{children:o,...i}=r;if(ih.isValidElement(o)){let a=uui(o),s=sui(i,o.props);return o.type!==ih.Fragment&&(s.ref=n?PJr(n,a):a),ih.cloneElement(o,s)}return ih.Children.count(o)>1?ih.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var iui=Symbol("radix.slottable");function aui(t){return ih.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iui}function sui(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 uui(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 IJr=$(St(),1),cui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AJr=cui.reduce((t,e)=>{let r=MJr(`Primitive.${e}`),n=RJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,IJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var NJr=$(J(),1),DJr=globalThis?.document?NJr.useLayoutEffect:()=>{};var $Jr=$(St(),1),dui="Portal",xT=B$e.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=B$e.useState(!1);DJr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?jJr.default.createPortal((0,$Jr.jsx)(AJr.div,{...n,ref:e}),a):null});xT.displayName=dui;var Iv=$(J(),1);var LJr=$(J(),1);function fui(t,e){return LJr.useReducer((r,n)=>e[r][n]??r,t)}var V$e=t=>{let{present:e,children:r}=t,n=pui(e),o=typeof r=="function"?r({present:n.isPresent}):Iv.Children.only(r),i=lde(n.ref,mui(o));return typeof r=="function"||n.isPresent?Iv.cloneElement(o,{ref:i}):null};V$e.displayName="Presence";function pui(t){let[e,r]=Iv.useState(),n=Iv.useRef(null),o=Iv.useRef(t),i=Iv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=fui(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Iv.useEffect(()=>{let l=z$e(n.current);i.current=s==="mounted"?l:"none"},[s]),_W(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=z$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),_W(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=z$e(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=z$e(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:Iv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function z$e(t){return t?.animationName||"none"}function mui(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 UJr=$(J(),1),_ui=$(hu(),1);var ah=$(J(),1);var _Z=$(St(),1);function FJr(t){let e=hui(t),r=ah.forwardRef((n,o)=>{let{children:i,...a}=n,s=ah.Children.toArray(i),u=s.find(gui);if(u){let l=u.props.children,c=s.map(d=>d===u?ah.Children.count(l)>1?ah.Children.only(null):ah.isValidElement(l)?l.props.children:null:d);return(0,_Z.jsx)(e,{...a,ref:o,children:ah.isValidElement(l)?ah.cloneElement(l,void 0,c):null})}return(0,_Z.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function hui(t){let e=ah.forwardRef((r,n)=>{let{children:o,...i}=r;if(ah.isValidElement(o)){let a=bui(o),s=yui(i,o.props);return o.type!==ah.Fragment&&(s.ref=n?$gt(n,a):a),ah.cloneElement(o,s)}return ah.Children.count(o)>1?ah.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var kJr=Symbol("radix.slottable");function qJr(t){let e=({children:r})=>(0,_Z.jsx)(_Z.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=kJr,e}function gui(t){return ah.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===kJr}function yui(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 bui(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 BJr=$(St(),1),vui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zJr=vui.reduce((t,e)=>{let r=FJr(`Primitive.${e}`),n=UJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,BJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var pC=$(J(),1);var H$e=$(J(),1);var wui=pC[" useInsertionEffect ".trim().toString()]||_W;function VJr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Sui({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=pC.useRef(t!==void 0);pC.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=pC.useCallback(c=>{if(s){let d=Cui(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Sui({defaultProp:t,onChange:e}){let[r,n]=pC.useState(t),o=pC.useRef(r),i=pC.useRef(e);return wui(()=>{i.current=e},[e]),pC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Cui(t){return typeof t=="function"}var pMs=Symbol("RADIX:SYNC_STATE");var ZJr=$(J(),1);var KJr=$(J(),1),Rui=$(hu(),1);var sh=$(J(),1);var xui=$(J(),1);function HJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function WJr(...t){return e=>{let r=!1,n=t.map(o=>{let i=HJr(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():HJr(t[o],null)}}}}var W$e=$(St(),1);function JJr(t){let e=Tui(t),r=sh.forwardRef((n,o)=>{let{children:i,...a}=n,s=sh.Children.toArray(i),u=s.find(Eui);if(u){let l=u.props.children,c=s.map(d=>d===u?sh.Children.count(l)>1?sh.Children.only(null):sh.isValidElement(l)?l.props.children:null:d);return(0,W$e.jsx)(e,{...a,ref:o,children:sh.isValidElement(l)?sh.cloneElement(l,void 0,c):null})}return(0,W$e.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Tui(t){let e=sh.forwardRef((r,n)=>{let{children:o,...i}=r;if(sh.isValidElement(o)){let a=Mui(o),s=Pui(i,o.props);return o.type!==sh.Fragment&&(s.ref=n?WJr(n,a):a),sh.cloneElement(o,s)}return sh.Children.count(o)>1?sh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Oui=Symbol("radix.slottable");function Eui(t){return sh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Oui}function Pui(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 Mui(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 GJr=$(St(),1),Iui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],XJr=Iui.reduce((t,e)=>{let r=JJr(`Primitive.${e}`),n=KJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,GJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var YJr=$(St(),1),nyt=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"}),Aui="VisuallyHidden",QJr=ZJr.forwardRef((t,e)=>(0,YJr.jsx)(XJr.span,{...t,ref:e,style:{...nyt,...t.style}}));QJr.displayName=Aui;var e5r=QJr;var Tm=$(St(),1),[J$e,AMs]=FWr("Tooltip",[fC]),K$e=fC(),t5r="TooltipProvider",Dui=700,oyt="tooltip.open",[jui,ayt]=J$e(t5r),r5r=t=>{let{__scopeTooltip:e,delayDuration:r=Dui,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=ni.useRef(!0),s=ni.useRef(!1),u=ni.useRef(0);return ni.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,Tm.jsx)(jui,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:ni.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:ni.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:ni.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};r5r.displayName=t5r;var gde="Tooltip",[$ui,yde]=J$e(gde),n5r=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=ayt(gde,t.__scopeTooltip),l=K$e(e),[c,d]=ni.useState(null),f=e6r(),p=ni.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,y=ni.useRef(!1),[g,b]=VJr({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent(oyt))):u.onClose(),i?.(E)},caller:gde}),_=ni.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=ni.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),T=ni.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),O=ni.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},h)},[h,b]);return ni.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,Tm.jsx)(z$,{...l,children:(0,Tm.jsx)($ui,{scope:e,contentId:f,open:g,stateAttribute:_,trigger:c,onTriggerChange:d,onTriggerEnter:ni.useCallback(()=>{u.isOpenDelayedRef.current?O():w()},[u.isOpenDelayedRef,O,w]),onTriggerLeave:ni.useCallback(()=>{m?T():(window.clearTimeout(p.current),p.current=0)},[T,m]),onOpen:w,onClose:T,disableHoverableContent:m,children:r})})};n5r.displayName=gde;var iyt="TooltipTrigger",o5r=ni.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=yde(iyt,r),i=ayt(iyt,r),a=K$e(r),s=ni.useRef(null),u=lde(e,s,o.onTriggerChange),l=ni.useRef(!1),c=ni.useRef(!1),d=ni.useCallback(()=>l.current=!1,[]);return ni.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,Tm.jsx)(V$,{asChild:!0,...a,children:(0,Tm.jsx)(zJr.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:bW(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:bW(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:bW(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:bW(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:bW(t.onBlur,o.onClose),onClick:bW(t.onClick,o.onClose)})})});o5r.displayName=iyt;var syt="TooltipPortal",[Lui,Fui]=J$e(syt,{forceMount:void 0}),i5r=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=yde(syt,e);return(0,Tm.jsx)(Lui,{scope:e,forceMount:r,children:(0,Tm.jsx)(V$e,{present:r||i.open,children:(0,Tm.jsx)(xT,{asChild:!0,container:o,children:n})})})};i5r.displayName=syt;var vZ="TooltipContent",a5r=ni.forwardRef((t,e)=>{let r=Fui(vZ,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=yde(vZ,t.__scopeTooltip);return(0,Tm.jsx)(V$e,{present:n||a.open,children:a.disableHoverableContent?(0,Tm.jsx)(s5r,{side:o,...i,ref:e}):(0,Tm.jsx)(kui,{side:o,...i,ref:e})})}),kui=ni.forwardRef((t,e)=>{let r=yde(vZ,t.__scopeTooltip),n=ayt(vZ,t.__scopeTooltip),o=ni.useRef(null),i=lde(e,o),[a,s]=ni.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=ni.useCallback(()=>{s(null),d(!1)},[d]),p=ni.useCallback((m,h)=>{let y=m.currentTarget,g={x:m.clientX,y:m.clientY},b=Vui(g,y.getBoundingClientRect()),_=Hui(g,b),w=Wui(h.getBoundingClientRect()),T=Kui([..._,...w]);s(T),d(!0)},[d]);return ni.useEffect(()=>()=>f(),[f]),ni.useEffect(()=>{if(u&&c){let m=y=>p(y,c),h=y=>p(y,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),ni.useEffect(()=>{if(a){let m=h=>{let y=h.target,g={x:h.clientX,y:h.clientY},b=u?.contains(y)||c?.contains(y),_=!Jui(g,a);b?f():_&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,Tm.jsx)(s5r,{...t,ref:i})}),[qui,Uui]=J$e(gde,{isInside:!1}),Bui=qJr("TooltipContent"),s5r=ni.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=yde(vZ,r),l=K$e(r),{onClose:c}=u;return ni.useEffect(()=>(document.addEventListener(oyt,c),()=>document.removeEventListener(oyt,c)),[c]),ni.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,Tm.jsx)(_T,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,Tm.jsxs)(yB,{"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,Tm.jsx)(Bui,{children:n}),(0,Tm.jsx)(qui,{scope:r,isInside:!0,children:(0,Tm.jsx)(e5r,{id:u.contentId,role:"tooltip",children:o||n})})]})})});a5r.displayName=vZ;var u5r="TooltipArrow",zui=ni.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=K$e(r);return Uui(u5r,r).isInside?null:(0,Tm.jsx)(bB,{...o,...n,ref:e})});zui.displayName=u5r;function Vui(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 Hui(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 Wui(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 Jui(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 Kui(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),Gui(e)}function Gui(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 G$e=r5r,l5r=n5r,c5r=o5r,d5r=i5r,uyt=a5r;$r();var y_=G$e,yn=l5r,bn=c5r,dn=bde.forwardRef(({className:t,sideOffset:e=4,...r},n)=>bde.createElement(d5r,{container:activeDocument.body},bde.createElement(uyt,{ref:n,sideOffset:e,className:we("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})));dn.displayName=uyt.displayName;Or();var TT=$(J()),p5r=require("obsidian"),to=({content:t,children:e,side:r="bottom",delayDuration:n=0,contentClassName:o,buttonClassName:i})=>{let a=p5r.Platform.isMobile,[s,u]=(0,TT.useState)(!1),l=TT.default.useRef(!1),c=()=>{a&&(l.current=!0)},d=()=>{a&&(u(!s),setTimeout(()=>{l.current=!1},100))};return TT.default.createElement(y_,{delayDuration:n},TT.default.createElement(yn,{open:s,onOpenChange:f=>{a&&l.current||u(f)}},TT.default.createElement(bn,{asChild:!0},e?TT.default.createElement("div",{onClick:d,onTouchStart:c,className:"tw-cursor-pointer"},e):TT.default.createElement(pe,{variant:"ghost",size:"sm",onClick:d,onTouchStart:c,className:`tw-inline-flex tw-size-6 tw-items-center tw-justify-center tw-p-0 hover:tw-bg-transparent hover:tw-text-normal ${i||""}`},TT.default.createElement(zF,{className:"tw-size-4"}))),TT.default.createElement(dn,{side:r,className:o},t)))};function _de({content:t,className:e}){return t?OW.createElement("div",{className:we("tw-group tw-flex tw-w-full tw-items-start tw-gap-2","tw-border-b tw-border-border tw-bg-secondary/30","tw-px-4 tw-py-2",e)},OW.createElement("span",{className:"tw-line-clamp-2 tw-min-w-0 tw-flex-1 tw-whitespace-pre-wrap tw-break-words tw-text-sm tw-text-muted"},t),OW.createElement("div",{className:"tw-group-hover:tw-opacity-100 tw-group-focus-within:tw-opacity-100 tw-flex-none tw-opacity-30 tw-transition-opacity"},OW.createElement(to,{content:t,side:"left",contentClassName:"tw-max-h-64 tw-max-w-xs tw-overflow-y-auto tw-whitespace-pre-wrap"},OW.createElement(pe,{type:"button",variant:"ghost2",size:"fit","aria-label":"View full content"},OW.createElement(dx,{className:"tw-size-4 tw-text-muted"}))))):null}var H$=$(J());$r();function lyt({state:t,editable:e=!1,value:r,onChange:n,placeholder:o="Ready to generate...",className:i,minHeight:a="180px",disableAutoGrow:s=!1}){let u=H$.useRef(null);H$.useEffect(()=>{t.type==="result"&&t.isStreaming&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},[t]);let l="",c=!0;return t.type==="idle"?(l="",c=!0):t.type==="loading"?(l="loading...",c=!0):t.type==="result"&&(l=e&&r!==void 0?r:t.text,c=t.isStreaming||!e),s?H$.createElement("div",{className:we("tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-px-4 tw-py-2",i)},H$.createElement("textarea",{ref:u,value:l,onChange:d=>n?.(d.target.value),placeholder:o,disabled:c,className:we("tw-min-w-fit tw-overflow-auto tw-border-solid","tw-min-h-0 tw-w-full tw-flex-1 tw-resize-none 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",c&&"tw-cursor-default tw-opacity-70")})):H$.createElement("div",{className:we("tw-flex-1 tw-px-4 tw-py-2",i)},H$.createElement(h_,{ref:u,value:l,onChange:d=>n?.(d.target.value),placeholder:o,disabled:c,className:we("tw-min-h-[120px] tw-resize-y",c&&"tw-cursor-default tw-opacity-70"),style:{minHeight:a}}))}var wZ=$(J());$r();Cn();Or();function cyt({value:t,onChange:e,onSubmit:r,onClear:n,placeholder:o="Enter follow-up instructions...",className:i,showClear:a=!0,disabled:s=!1,hint:u,autoFocus:l=!1}){let c=d=>{let f=d.nativeEvent;if(!(f.isComposing||f.keyCode===229)&&d.key==="Enter"&&!d.shiftKey&&!d.metaKey&&!d.ctrlKey&&!d.altKey){if(!r)return;d.preventDefault(),r()}};return wZ.createElement("div",{className:we("tw-relative tw-flex-none tw-px-4 tw-py-2",i)},wZ.createElement(h_,{value:t,onChange:d=>e(d.target.value),onKeyDown:c,placeholder:o,disabled:s,autoFocus:l,className:"tw-min-h-[36px] tw-resize-none tw-py-2 tw-pr-8"}),u&&wZ.createElement("span",{className:"tw-pointer-events-none tw-absolute tw-bottom-4 tw-right-6 tw-text-xs tw-text-muted"},u),a&&t&&n&&!u&&wZ.createElement(pe,{type:"button",variant:"ghost2",size:"fit",onClick:n,disabled:s,className:"tw-absolute tw-right-6 tw-top-4 tw-text-muted","aria-label":"Clear input"},wZ.createElement(qo,{className:"tw-size-4"})))}var mC=$(J());$r();Cn();function dyt({state:t,onStop:e,onInsert:r,onReplace:n,onSubmit:o,onCancel:i,showInsertReplace:a=!0,showSubmitCancel:s=!1,className:u}){return mC.createElement("div",{className:we("tw-flex tw-items-center tw-gap-2",u)},t==="loading"&&mC.createElement(pe,{variant:"secondary",size:"sm",onClick:e},"Stop"),t==="result"&&a&&mC.createElement(mC.Fragment,null,mC.createElement(pe,{size:"sm",variant:"secondary",onClick:r},"Insert"),mC.createElement(pe,{size:"sm",onClick:n},"Replace")),s&&t!=="loading"&&mC.createElement(mC.Fragment,null,mC.createElement(pe,{variant:"secondary",size:"sm",onClick:i},"Cancel"),mC.createElement(pe,{size:"sm",onClick:o},"Submit")))}var Ac=$(J());$r();var Zc=$(J());function X$e(t,e,r){return Math.min(Math.max(t,e),r)}function Z$e(t={}){let{initialPosition:e={x:0,y:0},bounds:r="window",dragRef:n,getPosition:o,onPositionChange:i,writeToDom:a=!0}=t,[s,u]=(0,Zc.useState)(e),[l,c]=(0,Zc.useState)(!1),d=(0,Zc.useRef)(null),f=n??d,p=(0,Zc.useRef)(e),m=(0,Zc.useRef)({x:0,y:0}),h=(0,Zc.useRef)(null),y=(0,Zc.useRef)(null),g=(0,Zc.useRef)(null),b=(0,Zc.useRef)(!0),_=(0,Zc.useRef)(null),w=(0,Zc.useCallback)(R=>{if(!a)return;let I=f.current;if(!I)return;let N=`${R.x}px`,z=`${R.y}px`;I.style.left!==N&&(I.style.left=N),I.style.top!==z&&(I.style.top=z)},[f,a]),T=(0,Zc.useCallback)(R=>{let I=R.x,N=R.y,z=f.current;if(r==="window"&&z){let k=z.ownerDocument?.defaultView??window,X=z.getBoundingClientRect(),B=k.innerWidth-X.width,Q=k.innerHeight-X.height;I=X$e(I,0,Math.max(0,B)),N=X$e(N,0,Math.max(0,Q))}else if(r==="parent"&&z?.parentElement){let k=z.getBoundingClientRect(),X=z.parentElement.getBoundingClientRect(),B=X.left,Q=X.top,Y=X.right-k.width,K=X.bottom-k.height;I=X$e(I,B,Math.max(B,Y)),N=X$e(N,Q,Math.max(Q,K))}let V={x:I,y:N};return p.current=V,w(V),i?.(V),V},[r,f,w,i]),O=(0,Zc.useCallback)(()=>{if(y.current!=null)return;let R=f.current?.ownerDocument?.defaultView??window;y.current=R.requestAnimationFrame(()=>{y.current=null;let I=h.current;I&&(h.current=null,T(I))})},[T,f]),E=(0,Zc.useCallback)(R=>{let I=p.current,N=typeof R=="function"?R(I):R;p.current=N,u(N),w(N),i?.(N)},[w,i]),P=(0,Zc.useCallback)(R=>{if(R.button!==0||(R.preventDefault(),g.current))return;c(!0);let I=o?o():p.current;p.current=I,w(I),m.current={x:R.clientX-I.x,y:R.clientY-I.y};let N=f.current?.ownerDocument??document,z=N.defaultView??window,V=N.body;_.current={userSelect:V.style.userSelect,cursor:V.style.cursor},V.style.userSelect="none",V.style.cursor="grabbing";let k=Q=>{h.current={x:Q.clientX-m.current.x,y:Q.clientY-m.current.y},O()},X=Q=>{if(g.current!==X)return;N.removeEventListener("mousemove",k,!0),N.removeEventListener("mouseup",B,!0),y.current!=null&&(z.cancelAnimationFrame(y.current),y.current=null);let Y=h.current;h.current=null;let K=Y?T(Y):p.current,oe=_.current;oe?(V.style.userSelect=oe.userSelect,V.style.cursor=oe.cursor,_.current=null):(V.style.userSelect="",V.style.cursor=""),g.current=null,Q&&b.current&&(u(K),c(!1))},B=()=>{X(!0)};g.current=X,N.addEventListener("mousemove",k,!0),N.addEventListener("mouseup",B,!0)},[T,f,o,O,w]);return(0,Zc.useEffect)(()=>()=>{b.current=!1,g.current?.(!1)},[]),(0,Zc.useLayoutEffect)(()=>{w(p.current)}),{position:s,setPosition:E,isDragging:l,dragRef:f,handleMouseDown:P}}var gb=$(J());function m5r(t){let{enabled:e=!0,getRect:r,getConstraints:n,onResize:o}=t,[i,a]=(0,gb.useState)(!1),s=(0,gb.useRef)(null),u=(0,gb.useRef)(null),l=(0,gb.useRef)(null),c=(0,gb.useRef)(null),d=(0,gb.useRef)(null),f=(0,gb.useRef)(o);(0,gb.useEffect)(()=>{f.current=o},[o]);let p=(0,gb.useRef)(n);(0,gb.useEffect)(()=>{p.current=n},[n]);let m=(0,gb.useCallback)(h=>y=>{if(!e)return;let g=r();if(!g)return;let _=y.currentTarget?.ownerDocument??document;u.current=_,l.current=_.defaultView??window,s.current={direction:h,startClientX:y.clientX,startClientY:y.clientY,width:g.width,height:g.height,left:g.left,top:g.top,right:g.right},a(!0),y.preventDefault(),y.stopPropagation()},[e,r]);return(0,gb.useEffect)(()=>{if(!i)return;let h=s.current;if(!h)return;let y=h.direction,g=y==="right"?"ew-resize":y==="bottom"?"ns-resize":y==="bottom-left"?"nesw-resize":"nwse-resize",b=u.current??document,_=l.current??window,w=b.body,T=w.style.cursor,O=w.style.userSelect;w.style.cursor=g,w.style.userSelect="none";let E=()=>{c.current!==null&&(_.cancelAnimationFrame(c.current),c.current=null)},P=()=>{let V=d.current;V&&(d.current=null,f.current(V))},R=()=>{c.current===null&&(c.current=_.requestAnimationFrame(()=>{c.current=null,P()}))},I=V=>{let k=s.current;if(!k)return;let X=V.clientX-k.startClientX,B=V.clientY-k.startClientY,Q=p.current?.()??{minWidth:0,minHeight:0},Y=Q.minWidth,K=Q.minHeight,oe=Q.maxWidth??Number.POSITIVE_INFINITY,ue=Q.maxHeight??Number.POSITIVE_INFINITY,de=k.width,L=k.height,W,ie;(y==="right"||y==="bottom-right")&&(de=Math.min(oe,Math.max(Y,k.width+X))),y==="bottom-left"&&(de=Math.min(oe,Math.max(Y,k.width-X)),W=k.right-de,ie=k.top),(y==="bottom"||y==="bottom-right"||y==="bottom-left")&&(L=Math.min(ue,Math.max(K,k.height+B))),d.current=W===void 0?{width:de,height:L}:{width:de,height:L,x:W,y:ie},R()},N=()=>{E(),P(),b.removeEventListener("mousemove",I,!0),b.removeEventListener("mouseup",z,!0),w.style.cursor=T,w.style.userSelect=O,s.current=null,a(!1)},z=()=>{N()};return b.addEventListener("mousemove",I,!0),b.addEventListener("mouseup",z,!0),()=>{E(),d.current=null,s.current=null,b.removeEventListener("mousemove",I,!0),b.removeEventListener("mouseup",z,!0),w.style.cursor=T,w.style.userSelect=O}},[i]),{isResizing:i,handleResizeStart:m}}var g5r="data-copilot-draggable-modal",h5r=`[${g5r}="true"]`;function fyt({open:t,onClose:e,children:r,className:n,initialPosition:o,width:i="min(500px, 90vw)",resizable:a=!1,minHeight:s=260,closeOnEscapeFromOutside:u=!1}){let{position:l,setPosition:c,dragRef:d,handleMouseDown:f,isDragging:p}=Z$e({initialPosition:o||{x:typeof window<"u"?(window.innerWidth-500)/2:100,y:typeof window<"u"?(window.innerHeight-400)/2:100},bounds:null}),[m,h]=(0,Ac.useState)(null),[y,g]=(0,Ac.useState)(null);(0,Ac.useLayoutEffect)(()=>{if(!t||!a||m!==null&&y!==null)return;let E=d.current;if(!E)return;let P=E.getBoundingClientRect(),R=typeof window<"u"?Math.floor(window.innerHeight*.85):P.height;m===null&&h(Math.min(R,Math.max(s,P.height))),y===null&&g(P.width)},[t,a,m,y,s,d]),(0,Ac.useEffect)(()=>{!a||m===null||m<s&&h(s)},[a,s,m]);let b=(0,Ac.useCallback)(()=>d.current?.getBoundingClientRect()??null,[d]),_=(0,Ac.useCallback)(()=>{let E=typeof window<"u"?Math.floor(window.innerHeight*.85):Number.POSITIVE_INFINITY;return{minWidth:300,minHeight:s,maxHeight:E}},[s]),w=(0,Ac.useCallback)(E=>{h(P=>P===E.height?P:E.height),g(P=>P===E.width?P:E.width),typeof E.x=="number"&&c(P=>P.x===E.x?P:{...P,x:E.x})},[c]),{isResizing:T,handleResizeStart:O}=m5r({enabled:a,getRect:b,getConstraints:_,onResize:w});return(0,Ac.useEffect)(()=>{if(!t)return;let E=d.current?.ownerDocument??document,P=R=>{if(R.key!=="Escape"||R.defaultPrevented)return;let I=d.current;if(!I)return;let N=E.activeElement,z=N instanceof Element?N.closest(h5r):null;if(z){if(z!==I)return;R.preventDefault(),R.stopPropagation(),e();return}if(!u)return;let V=Array.from(E.querySelectorAll(h5r));V[V.length-1]===I&&(R.preventDefault(),R.stopPropagation(),e())};return E.addEventListener("keydown",P),()=>{E.removeEventListener("keydown",P)}},[t,e,d,u]),t?Ac.default.createElement("div",{ref:d,[g5r]:"true",className:we("tw-fixed tw-z-popover","tw-flex tw-flex-col","tw-border tw-border-solid tw-border-border tw-bg-primary",a?"tw-rounded-t-lg tw-shadow-2xl":"tw-rounded-lg tw-shadow-2xl","tw-max-h-[85vh]",a&&"tw-group",p&&"tw-cursor-grabbing tw-select-none",T&&"tw-select-none",n),style:{left:l.x,top:l.y,width:a&&y!==null?y:i,...a&&m!==null?{height:m}:{}}},Ac.default.createElement("div",{className:"tw-relative tw-flex-none"},Ac.default.createElement(Agt,{onMouseDown:f}),Ac.default.createElement(Dgt,{onClose:e})),Ac.default.createElement("div",{className:"tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-overflow-hidden"},r),a&&Ac.default.createElement(Ac.default.Fragment,null,Ac.default.createElement("div",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-h-1 tw-w-full tw-cursor-ns-resize",onMouseDown:O("bottom")}),Ac.default.createElement("div",{className:"quick-ask-resize-indicator-left tw-absolute tw-bottom-0 tw-left-0 tw-size-3 tw-cursor-nesw-resize",onMouseDown:O("bottom-left")}),Ac.default.createElement("div",{className:"quick-ask-resize-indicator-right tw-absolute tw-bottom-0 tw-right-0 tw-z-[10] tw-size-3 tw-cursor-nwse-resize",onMouseDown:O("bottom-right")}))):null}var Xui=$(J());$r();Cn();var my=$(J());Or();var jv=$(J());Cn();var Uu=$(J());var ph=$(J(),1);var fRs=!!(typeof window<"u"&&window.document&&window.document.createElement);function vde(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Zui=$(J(),1);function y5r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Y$e(...t){return e=>{let r=!1,n=t.map(o=>{let i=y5r(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():y5r(t[o],null)}}}}var W$=$(J(),1),b5r=$(St(),1);function _5r(t,e=[]){let r=[];function n(i,a){let s=W$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=W$.useMemo(()=>m,Object.values(m));return(0,b5r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=W$.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=>W$.createContext(a));return function(s){let u=s?.[t]||i;return W$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Yui(o,...e)]}function Yui(...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 W$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var hC=$(J(),1);var v5r=$(J(),1),Q$e=globalThis?.document?v5r.useLayoutEffect:()=>{};var eLe=$(J(),1);var Qui=hC[" useInsertionEffect ".trim().toString()]||Q$e;function w5r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=eli({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=hC.useRef(t!==void 0);hC.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=hC.useCallback(c=>{if(s){let d=tli(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function eli({defaultProp:t,onChange:e}){let[r,n]=hC.useState(t),o=hC.useRef(r),i=hC.useRef(e);return Qui(()=>{i.current=e},[e]),hC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function tli(t){return typeof t=="function"}var bRs=Symbol("RADIX:SYNC_STATE");var C5r=$(J(),1),sli=$(hu(),1);var uh=$(J(),1);var tLe=$(St(),1);function S5r(t){let e=rli(t),r=uh.forwardRef((n,o)=>{let{children:i,...a}=n,s=uh.Children.toArray(i),u=s.find(oli);if(u){let l=u.props.children,c=s.map(d=>d===u?uh.Children.count(l)>1?uh.Children.only(null):uh.isValidElement(l)?l.props.children:null:d);return(0,tLe.jsx)(e,{...a,ref:o,children:uh.isValidElement(l)?uh.cloneElement(l,void 0,c):null})}return(0,tLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function rli(t){let e=uh.forwardRef((r,n)=>{let{children:o,...i}=r;if(uh.isValidElement(o)){let a=ali(o),s=ili(i,o.props);return o.type!==uh.Fragment&&(s.ref=n?Y$e(n,a):a),uh.cloneElement(o,s)}return uh.Children.count(o)>1?uh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var nli=Symbol("radix.slottable");function oli(t){return uh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nli}function ili(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 ali(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 x5r=$(St(),1),uli=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],T5r=uli.reduce((t,e)=>{let r=S5r(`Primitive.${e}`),n=C5r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,x5r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Wr=$(J(),1);var xRs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Yc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var _B=$(J(),1);var J$=$(J(),1),O5r=$(St(),1);function E5r(t,e=[]){let r=[];function n(i,a){let s=J$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=J$.useMemo(()=>m,Object.values(m));return(0,O5r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=J$.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=>J$.createContext(a));return function(s){let u=s?.[t]||i;return J$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,lli(o,...e)]}function lli(...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 J$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var M5r=$(J(),1);function P5r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pyt(...t){return e=>{let r=!1,n=t.map(o=>{let i=P5r(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():P5r(t[o],null)}}}}function myt(...t){return M5r.useCallback(pyt(...t),t)}var lh=$(J(),1);var rLe=$(St(),1);function hyt(t){let e=cli(t),r=lh.forwardRef((n,o)=>{let{children:i,...a}=n,s=lh.Children.toArray(i),u=s.find(fli);if(u){let l=u.props.children,c=s.map(d=>d===u?lh.Children.count(l)>1?lh.Children.only(null):lh.isValidElement(l)?l.props.children:null:d);return(0,rLe.jsx)(e,{...a,ref:o,children:lh.isValidElement(l)?lh.cloneElement(l,void 0,c):null})}return(0,rLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function cli(t){let e=lh.forwardRef((r,n)=>{let{children:o,...i}=r;if(lh.isValidElement(o)){let a=mli(o),s=pli(i,o.props);return o.type!==lh.Fragment&&(s.ref=n?pyt(n,a):a),lh.cloneElement(o,s)}return lh.Children.count(o)>1?lh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var dli=Symbol("radix.slottable");function fli(t){return lh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===dli}function pli(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 mli(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 nLe=$(St(),1),hli=$(J(),1);var gli=$(St(),1);function vB(t){let e=t+"CollectionProvider",[r,n]=E5r(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:g}=h,b=_B.default.useRef(null),_=_B.default.useRef(new Map).current;return(0,nLe.jsx)(o,{scope:y,itemMap:_,collectionRef:b,children:g})};a.displayName=e;let s=t+"CollectionSlot",u=hyt(s),l=_B.default.forwardRef((h,y)=>{let{scope:g,children:b}=h,_=i(s,g),w=myt(y,_.collectionRef);return(0,nLe.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=hyt(c),p=_B.default.forwardRef((h,y)=>{let{scope:g,children:b,..._}=h,w=_B.default.useRef(null),T=myt(y,w),O=i(c,g);return _B.default.useEffect(()=>(O.itemMap.set(w,{ref:w,..._}),()=>void O.itemMap.delete(w))),(0,nLe.jsx)(f,{[d]:"",ref:T,children:b})});p.displayName=c;function m(h){let y=i(t+"CollectionConsumer",h);return _B.default.useCallback(()=>{let b=y.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((O,E)=>_.indexOf(O.ref.current)-_.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var I5r=$(J(),1);function R5r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wde(...t){return e=>{let r=!1,n=t.map(o=>{let i=R5r(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():R5r(t[o],null)}}}}function wB(...t){return I5r.useCallback(wde(...t),t)}var K$=$(J(),1),A5r=$(St(),1);function N5r(t,e=[]){let r=[];function n(i,a){let s=K$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=K$.useMemo(()=>m,Object.values(m));return(0,A5r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=K$.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=>K$.createContext(a));return function(s){let u=s?.[t]||i;return K$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,yli(o,...e)]}function yli(...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 K$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var oLe=$(J(),1),bli=$(St(),1),_li=oLe.createContext(void 0);function D5r(t){let e=oLe.useContext(_li);return t||e||"ltr"}var $5r=$(J(),1),gyt=0;function SB(){$5r.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??j5r()),document.body.insertAdjacentElement("beforeend",t[1]??j5r()),gyt++,()=>{gyt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gyt--}},[])}function j5r(){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 gC=$(J(),1);var F5r=$(J(),1);function L5r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function yyt(...t){return e=>{let r=!1,n=t.map(o=>{let i=L5r(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():L5r(t[o],null)}}}}function k5r(...t){return F5r.useCallback(yyt(...t),t)}var U5r=$(J(),1),Tli=$(hu(),1);var ch=$(J(),1);var iLe=$(St(),1);function q5r(t){let e=vli(t),r=ch.forwardRef((n,o)=>{let{children:i,...a}=n,s=ch.Children.toArray(i),u=s.find(Sli);if(u){let l=u.props.children,c=s.map(d=>d===u?ch.Children.count(l)>1?ch.Children.only(null):ch.isValidElement(l)?l.props.children:null:d);return(0,iLe.jsx)(e,{...a,ref:o,children:ch.isValidElement(l)?ch.cloneElement(l,void 0,c):null})}return(0,iLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function vli(t){let e=ch.forwardRef((r,n)=>{let{children:o,...i}=r;if(ch.isValidElement(o)){let a=xli(o),s=Cli(i,o.props);return o.type!==ch.Fragment&&(s.ref=n?yyt(n,a):a),ch.cloneElement(o,s)}return ch.Children.count(o)>1?ch.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var wli=Symbol("radix.slottable");function Sli(t){return ch.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===wli}function Cli(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 xli(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 B5r=$(St(),1),Oli=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],z5r=Oli.reduce((t,e)=>{let r=q5r(`Primitive.${e}`),n=U5r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,B5r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var SZ=$(J(),1);function byt(t){let e=SZ.useRef(t);return SZ.useEffect(()=>{e.current=t}),SZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var K5r=$(St(),1),_yt="focusScope.autoFocusOnMount",vyt="focusScope.autoFocusOnUnmount",V5r={bubbles:!1,cancelable:!0},Eli="FocusScope",G$=gC.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=gC.useState(null),l=byt(o),c=byt(i),d=gC.useRef(null),f=k5r(e,h=>u(h)),p=gC.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;gC.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:CB(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||CB(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let P of O)P.removedNodes.length>0&&CB(s)};var h=b,y=_,g=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let T=new MutationObserver(w);return s&&T.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),T.disconnect()}}},[n,s,p.paused]),gC.useEffect(()=>{if(s){W5r.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(_yt,V5r);s.addEventListener(_yt,l),s.dispatchEvent(g),g.defaultPrevented||(Pli(Nli(G5r(s)),{select:!0}),document.activeElement===h&&CB(s))}return()=>{s.removeEventListener(_yt,l),setTimeout(()=>{let g=new CustomEvent(vyt,V5r);s.addEventListener(vyt,c),s.dispatchEvent(g),g.defaultPrevented||CB(h??document.body,{select:!0}),s.removeEventListener(vyt,c),W5r.remove(p)},0)}}},[s,l,c,p]);let m=gC.useCallback(h=>{if(!r&&!n||p.paused)return;let y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){let b=h.currentTarget,[_,w]=Mli(b);_&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&CB(_,{select:!0})):h.shiftKey&&g===_&&(h.preventDefault(),r&&CB(w,{select:!0})):g===b&&h.preventDefault()}},[r,n,p.paused]);return(0,K5r.jsx)(z5r.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});G$.displayName=Eli;function Pli(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(CB(n,{select:e}),document.activeElement!==r)return}function Mli(t){let e=G5r(t),r=H5r(e,t),n=H5r(e.reverse(),t);return[r,n]}function G5r(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 H5r(t,e){for(let r of t)if(!Rli(r,{upTo:e}))return r}function Rli(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 Ili(t){return t instanceof HTMLInputElement&&"select"in t}function CB(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Ili(t)&&e&&t.select()}}var W5r=Ali();function Ali(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=J5r(t,e),t.unshift(e)},remove(e){t=J5r(t,e),t[0]?.resume()}}}function J5r(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Nli(t){return t.filter(e=>e.tagName!=="A")}var wyt=$(J(),1);var X5r=$(J(),1),Sde=globalThis?.document?X5r.useLayoutEffect:()=>{};var Dli=wyt[" useId ".trim().toString()]||(()=>{}),jli=0;function Syt(t){let[e,r]=wyt.useState(Dli());return Sde(()=>{t||r(n=>n??String(jli++))},[t]),t||(e?`radix-${e}`:"")}var Av=$(J(),1);var Z5r=$(J(),1);function $li(t,e){return Z5r.useReducer((r,n)=>e[r][n]??r,t)}var CZ=t=>{let{present:e,children:r}=t,n=Lli(e),o=typeof r=="function"?r({present:n.isPresent}):Av.Children.only(r),i=wB(n.ref,Fli(o));return typeof r=="function"||n.isPresent?Av.cloneElement(o,{ref:i}):null};CZ.displayName="Presence";function Lli(t){let[e,r]=Av.useState(),n=Av.useRef(null),o=Av.useRef(t),i=Av.useRef("none"),a=t?"mounted":"unmounted",[s,u]=$li(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Av.useEffect(()=>{let l=aLe(n.current);i.current=s==="mounted"?l:"none"},[s]),Sde(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=aLe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Sde(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=aLe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=aLe(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:Av.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function aLe(t){return t?.animationName||"none"}function Fli(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 Y5r=$(J(),1),Q5r=$(hu(),1);var dh=$(J(),1);var sLe=$(St(),1);function uLe(t){let e=kli(t),r=dh.forwardRef((n,o)=>{let{children:i,...a}=n,s=dh.Children.toArray(i),u=s.find(Uli);if(u){let l=u.props.children,c=s.map(d=>d===u?dh.Children.count(l)>1?dh.Children.only(null):dh.isValidElement(l)?l.props.children:null:d);return(0,sLe.jsx)(e,{...a,ref:o,children:dh.isValidElement(l)?dh.cloneElement(l,void 0,c):null})}return(0,sLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function kli(t){let e=dh.forwardRef((r,n)=>{let{children:o,...i}=r;if(dh.isValidElement(o)){let a=zli(o),s=Bli(i,o.props);return o.type!==dh.Fragment&&(s.ref=n?wde(n,a):a),dh.cloneElement(o,s)}return dh.Children.count(o)>1?dh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var qli=Symbol("radix.slottable");function Uli(t){return dh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===qli}function Bli(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 zli(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 eKr=$(St(),1),Vli=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xZ=Vli.reduce((t,e)=>{let r=uLe(`Primitive.${e}`),n=Y5r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,eKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function tKr(t,e){t&&Q5r.flushSync(()=>t.dispatchEvent(e))}var sg=$(J(),1);var sIs=!!(typeof window<"u"&&window.document&&window.document.createElement);function EW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var nKr=$(J(),1);function rKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Cyt(...t){return e=>{let r=!1,n=t.map(o=>{let i=rKr(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():rKr(t[o],null)}}}}function oKr(...t){return nKr.useCallback(Cyt(...t),t)}var X$=$(J(),1),iKr=$(St(),1);function aKr(t,e=[]){let r=[];function n(i,a){let s=X$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=X$.useMemo(()=>m,Object.values(m));return(0,iKr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=X$.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=>X$.createContext(a));return function(s){let u=s?.[t]||i;return X$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Hli(o,...e)]}function Hli(...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 X$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var xyt=$(J(),1);var sKr=$(J(),1),lLe=globalThis?.document?sKr.useLayoutEffect:()=>{};var Wli=xyt[" useId ".trim().toString()]||(()=>{}),Jli=0;function uKr(t){let[e,r]=xyt.useState(Wli());return lLe(()=>{t||r(n=>n??String(Jli++))},[t]),t||(e?`radix-${e}`:"")}var cKr=$(J(),1),Qli=$(hu(),1);var fh=$(J(),1);var cLe=$(St(),1);function lKr(t){let e=Kli(t),r=fh.forwardRef((n,o)=>{let{children:i,...a}=n,s=fh.Children.toArray(i),u=s.find(Xli);if(u){let l=u.props.children,c=s.map(d=>d===u?fh.Children.count(l)>1?fh.Children.only(null):fh.isValidElement(l)?l.props.children:null:d);return(0,cLe.jsx)(e,{...a,ref:o,children:fh.isValidElement(l)?fh.cloneElement(l,void 0,c):null})}return(0,cLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Kli(t){let e=fh.forwardRef((r,n)=>{let{children:o,...i}=r;if(fh.isValidElement(o)){let a=Yli(o),s=Zli(i,o.props);return o.type!==fh.Fragment&&(s.ref=n?Cyt(n,a):a),fh.cloneElement(o,s)}return fh.Children.count(o)>1?fh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Gli=Symbol("radix.slottable");function Xli(t){return fh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Gli}function Zli(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 Yli(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 dKr=$(St(),1),eci=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tyt=eci.reduce((t,e)=>{let r=lKr(`Primitive.${e}`),n=cKr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,dKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var TZ=$(J(),1);function fKr(t){let e=TZ.useRef(t);return TZ.useEffect(()=>{e.current=t}),TZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var yC=$(J(),1);var dLe=$(J(),1);var tci=yC[" useInsertionEffect ".trim().toString()]||lLe;function pKr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=rci({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=yC.useRef(t!==void 0);yC.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=yC.useCallback(c=>{if(s){let d=nci(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function rci({defaultProp:t,onChange:e}){let[r,n]=yC.useState(t),o=yC.useRef(r),i=yC.useRef(e);return tci(()=>{i.current=e},[e]),yC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function nci(t){return typeof t=="function"}var vIs=Symbol("RADIX:SYNC_STATE");var fLe=$(J(),1),oci=$(St(),1),ici=fLe.createContext(void 0);function mKr(t){let e=fLe.useContext(ici);return t||e||"ltr"}var xB=$(St(),1),Oyt="rovingFocusGroup.onEntryFocus",aci={bubbles:!1,cancelable:!0},Cde="RovingFocusGroup",[Eyt,hKr,sci]=vB(Cde),[uci,Pyt]=aKr(Cde,[sci]),[lci,cci]=uci(Cde),gKr=sg.forwardRef((t,e)=>(0,xB.jsx)(Eyt.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,xB.jsx)(Eyt.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,xB.jsx)(dci,{...t,ref:e})})}));gKr.displayName=Cde;var dci=sg.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=sg.useRef(null),p=oKr(e,f),m=mKr(i),[h,y]=pKr({prop:a,defaultProp:s??null,onChange:u,caller:Cde}),[g,b]=sg.useState(!1),_=fKr(l),w=hKr(r),T=sg.useRef(!1),[O,E]=sg.useState(0);return sg.useEffect(()=>{let P=f.current;if(P)return P.addEventListener(Oyt,_),()=>P.removeEventListener(Oyt,_)},[_]),(0,xB.jsx)(lci,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:sg.useCallback(P=>y(P),[y]),onItemShiftTab:sg.useCallback(()=>b(!0),[]),onFocusableItemAdd:sg.useCallback(()=>E(P=>P+1),[]),onFocusableItemRemove:sg.useCallback(()=>E(P=>P-1),[]),children:(0,xB.jsx)(Tyt.div,{tabIndex:g||O===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:EW(t.onMouseDown,()=>{T.current=!0}),onFocus:EW(t.onFocus,P=>{let R=!T.current;if(P.target===P.currentTarget&&R&&!g){let I=new CustomEvent(Oyt,aci);if(P.currentTarget.dispatchEvent(I),!I.defaultPrevented){let N=w().filter(B=>B.focusable),z=N.find(B=>B.active),V=N.find(B=>B.id===h),X=[z,V,...N].filter(Boolean).map(B=>B.ref.current);_Kr(X,c)}}T.current=!1}),onBlur:EW(t.onBlur,()=>b(!1))})})}),yKr="RovingFocusGroupItem",bKr=sg.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,children:a,...s}=t,u=uKr(),l=i||u,c=cci(yKr,r),d=c.currentTabStopId===l,f=hKr(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=c;return sg.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,xB.jsx)(Eyt.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:(0,xB.jsx)(Tyt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...s,ref:e,onMouseDown:EW(t.onMouseDown,y=>{n?c.onItemFocus(l):y.preventDefault()}),onFocus:EW(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:EW(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let g=mci(y,c.orientation,c.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=f().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")_.reverse();else if(g==="prev"||g==="next"){g==="prev"&&_.reverse();let w=_.indexOf(y.currentTarget);_=c.loop?hci(_,w+1):_.slice(w+1)}setTimeout(()=>_Kr(_))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:h!=null}):a})})});bKr.displayName=yKr;var fci={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pci(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function mci(t,e,r){let n=pci(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return fci[n]}function _Kr(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function hci(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var vKr=gKr,wKr=bKr;var OZ=$(J(),1);function pLe(t){let e=OZ.useRef(t);return OZ.useEffect(()=>{e.current=t}),OZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var yci=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},EZ=new WeakMap,mLe=new WeakMap,hLe={},Myt=0,SKr=function(t){return t&&(t.host||SKr(t.parentNode))},bci=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=SKr(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})},_ci=function(t,e,r,n){var o=bci(e,Array.isArray(t)?t:[t]);hLe[r]||(hLe[r]=new WeakMap);var i=hLe[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=(EZ.get(f)||0)+1,y=(i.get(f)||0)+1;EZ.set(f,h),i.set(f,y),a.push(f),h===1&&m&&mLe.set(f,!0),y===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),s.clear(),Myt++,function(){a.forEach(function(d){var f=EZ.get(d)-1,p=i.get(d)-1;EZ.set(d,f),i.set(d,p),f||(mLe.has(d)||d.removeAttribute(n),mLe.delete(d)),p||d.removeAttribute(r)}),Myt--,Myt||(EZ=new WeakMap,EZ=new WeakMap,mLe=new WeakMap,hLe={})}},TB=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||yci(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),_ci(n,o,r,"aria-hidden")):function(){return null}};var Nv=function(){return Nv=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},Nv.apply(this,arguments)};function gLe(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 CKr(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 wLe=$(J());var yb=$(J());var PW="right-scroll-bar-position",MW="width-before-scroll-bar",Ryt="with-scroll-bars-hidden",Iyt="--removed-body-scroll-bar-size";function yLe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var xKr=$(J());function TKr(t,e){var r=(0,xKr.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 bLe=$(J());var vci=typeof window<"u"?bLe.useLayoutEffect:bLe.useEffect,OKr=new WeakMap;function Ayt(t,e){var r=TKr(e||null,function(n){return t.forEach(function(o){return yLe(o,n)})});return vci(function(){var n=OKr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||yLe(s,null)}),i.forEach(function(s){o.has(s)||yLe(s,a)})}OKr.set(r,t)},[t]),r}function wci(t){return t}function Sci(t,e){e===void 0&&(e=wci);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 Nyt(t){t===void 0&&(t={});var e=Sci(null);return e.options=Nv({async:!0,ssr:!1},t),e}var EKr=$(J()),PKr=function(t){var e=t.sideCar,r=gLe(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 EKr.createElement(n,Nv({},r))};PKr.isSideCarExport=!0;function Dyt(t,e){return t.useMedium(e),PKr}var _Le=Nyt();var jyt=function(){},xde=yb.forwardRef(function(t,e){var r=yb.useRef(null),n=yb.useState({onScrollCapture:jyt,onWheelCapture:jyt,onTouchMoveCapture:jyt}),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.noRelative,m=t.noIsolation,h=t.inert,y=t.allowPinchZoom,g=t.as,b=g===void 0?"div":g,_=t.gapMode,w=gLe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=f,O=Ayt([r,e]),E=Nv(Nv({},w),o);return yb.createElement(yb.Fragment,null,c&&yb.createElement(T,{sideCar:_Le,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:_}),a?yb.cloneElement(yb.Children.only(s),Nv(Nv({},E),{ref:O})):yb.createElement(b,Nv({},E,{className:u,ref:O}),s))});xde.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};xde.classNames={fullWidth:MW,zeroRight:PW};var Il=$(J());var MZ=$(J());var IKr=$(J());var MKr;var RKr=function(){if(MKr)return MKr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Cci(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=RKr();return e&&t.setAttribute("nonce",e),t}function xci(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Tci(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var $yt=function(){var t=0,e=null;return{add:function(r){t==0&&(e=Cci())&&(xci(e,r),Tci(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var Lyt=function(){var t=$yt();return function(e,r){IKr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var Tde=function(){var t=Lyt(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var Oci={left:0,top:0,right:0,gap:0},Fyt=function(t){return parseInt(t||"",10)||0},Eci=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[Fyt(r),Fyt(n),Fyt(o)]},kyt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Oci;var e=Eci(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 Pci=Tde(),PZ="data-scroll-locked",Mci=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(Ryt,` {
|
||
overflow: hidden `).concat(n,`;
|
||
padding-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
body[`).concat(PZ,`] {
|
||
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(PW,` {
|
||
right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(MW,` {
|
||
margin-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(PW," .").concat(PW,` {
|
||
right: 0 `).concat(n,`;
|
||
}
|
||
|
||
.`).concat(MW," .").concat(MW,` {
|
||
margin-right: 0 `).concat(n,`;
|
||
}
|
||
|
||
body[`).concat(PZ,`] {
|
||
`).concat(Iyt,": ").concat(s,`px;
|
||
}
|
||
`)},AKr=function(){var t=parseInt(document.body.getAttribute(PZ)||"0",10);return isFinite(t)?t:0},Rci=function(){MZ.useEffect(function(){return document.body.setAttribute(PZ,(AKr()+1).toString()),function(){var t=AKr()-1;t<=0?document.body.removeAttribute(PZ):document.body.setAttribute(PZ,t.toString())}},[])},qyt=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;Rci();var i=MZ.useMemo(function(){return kyt(o)},[o]);return MZ.createElement(Pci,{styles:Mci(i,!e,o,r?"":"!important")})};var Uyt=!1;if(typeof window<"u")try{Ode=Object.defineProperty({},"passive",{get:function(){return Uyt=!0,!0}}),window.addEventListener("test",Ode,Ode),window.removeEventListener("test",Ode,Ode)}catch{Uyt=!1}var Ode,RW=Uyt?{passive:!1}:!1;var Ici=function(t){return t.tagName==="TEXTAREA"},NKr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Ici(t)&&r[e]==="visible")},Aci=function(t){return NKr(t,"overflowY")},Nci=function(t){return NKr(t,"overflowX")},Byt=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=DKr(t,n);if(o){var i=jKr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Dci=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},jci=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},DKr=function(t,e){return t==="v"?Aci(e):Nci(e)},jKr=function(t,e){return t==="v"?Dci(e):jci(e)},$ci=function(t,e){return t==="h"&&e==="rtl"?-1:1},$Kr=function(t,e,r,n,o){var i=$ci(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{if(!s)break;var p=jKr(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&DKr(t,s)&&(d+=g,f+=m);var b=s.parentNode;s=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}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 vLe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},LKr=function(t){return[t.deltaX,t.deltaY]},FKr=function(t){return t&&"current"in t?t.current:t},Lci=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Fci=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},kci=0,RZ=[];function kKr(t){var e=Il.useRef([]),r=Il.useRef([0,0]),n=Il.useRef(),o=Il.useState(kci++)[0],i=Il.useState(Tde)[0],a=Il.useRef(t);Il.useEffect(function(){a.current=t},[t]),Il.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=CKr([t.lockRef.current],(t.shards||[]).map(FKr),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=Il.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=vLe(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-g[0],w="deltaY"in h?h.deltaY:b[1]-g[1],T,O=h.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&E==="h"&&O.type==="range")return!1;var P=Byt(E,O);if(!P)return!0;if(P?T=E:(T=E==="v"?"h":"v",P=Byt(E,O)),!P)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=T),!T)return!0;var R=n.current||T;return $Kr(R,y,h,R==="h"?_:w,!0)},[]),u=Il.useCallback(function(h){var y=h;if(!(!RZ.length||RZ[RZ.length-1]!==i)){var g="deltaY"in y?LKr(y):vLe(y),b=e.current.filter(function(T){return T.name===y.type&&(T.target===y.target||y.target===T.shadowParent)&&Lci(T.delta,g)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(FKr).filter(Boolean).filter(function(T){return T.contains(y.target)}),w=_.length>0?s(y,_[0]):!a.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=Il.useCallback(function(h,y,g,b){var _={name:h,delta:y,target:g,should:b,shadowParent:qci(g)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=Il.useCallback(function(h){r.current=vLe(h),n.current=void 0},[]),d=Il.useCallback(function(h){l(h.type,LKr(h),h.target,s(h,t.lockRef.current))},[]),f=Il.useCallback(function(h){l(h.type,vLe(h),h.target,s(h,t.lockRef.current))},[]);Il.useEffect(function(){return RZ.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,RW),document.addEventListener("touchmove",u,RW),document.addEventListener("touchstart",c,RW),function(){RZ=RZ.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,RW),document.removeEventListener("touchmove",u,RW),document.removeEventListener("touchstart",c,RW)}},[]);var p=t.removeScrollBar,m=t.inert;return Il.createElement(Il.Fragment,null,m?Il.createElement(i,{styles:Fci(o)}):null,p?Il.createElement(qyt,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function qci(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var qKr=Dyt(_Le,kKr);var UKr=wLe.forwardRef(function(t,e){return wLe.createElement(xde,Nv({},t,{ref:e,sideCar:qKr}))});UKr.classNames=xde.classNames;var Z$=UKr;var Ro=$(St(),1),zyt=["Enter"," "],Uci=["ArrowDown","PageUp","Home"],zKr=["ArrowUp","PageDown","End"],Bci=[...Uci,...zKr],zci={ltr:[...zyt,"ArrowRight"],rtl:[...zyt,"ArrowLeft"]},Vci={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Rde="Menu",[Pde,Hci,Wci]=vB(Rde),[IW,Vyt]=N5r(Rde,[Wci,fC,Pyt]),Ide=fC(),VKr=Pyt(),[HKr,OB]=IW(Rde),[Jci,Ade]=IW(Rde),WKr=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=Ide(e),[u,l]=Wr.useState(null),c=Wr.useRef(!1),d=pLe(i),f=D5r(o);return Wr.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,Ro.jsx)(z$,{...s,children:(0,Ro.jsx)(HKr,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Ro.jsx)(Jci,{scope:e,onClose:Wr.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};WKr.displayName=Rde;var Kci="MenuAnchor",Hyt=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=Ide(r);return(0,Ro.jsx)(V$,{...o,...n,ref:e})});Hyt.displayName=Kci;var Wyt="MenuPortal",[Gci,JKr]=IW(Wyt,{forceMount:void 0}),KKr=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=OB(Wyt,e);return(0,Ro.jsx)(Gci,{scope:e,forceMount:r,children:(0,Ro.jsx)(CZ,{present:r||i.open,children:(0,Ro.jsx)(xT,{asChild:!0,container:o,children:n})})})};KKr.displayName=Wyt;var bC="MenuContent",[Xci,Jyt]=IW(bC),GKr=Wr.forwardRef((t,e)=>{let r=JKr(bC,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=OB(bC,t.__scopeMenu),a=Ade(bC,t.__scopeMenu);return(0,Ro.jsx)(Pde.Provider,{scope:t.__scopeMenu,children:(0,Ro.jsx)(CZ,{present:n||i.open,children:(0,Ro.jsx)(Pde.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Ro.jsx)(Zci,{...o,ref:e}):(0,Ro.jsx)(Yci,{...o,ref:e})})})})}),Zci=Wr.forwardRef((t,e)=>{let r=OB(bC,t.__scopeMenu),n=Wr.useRef(null),o=wB(e,n);return Wr.useEffect(()=>{let i=n.current;if(i)return TB(i)},[]),(0,Ro.jsx)(Kyt,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Yc(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Yci=Wr.forwardRef((t,e)=>{let r=OB(bC,t.__scopeMenu);return(0,Ro.jsx)(Kyt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Qci=uLe("MenuContent.ScrollLock"),Kyt=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=t,y=OB(bC,r),g=Ade(bC,r),b=Ide(r),_=VKr(r),w=Hci(r),[T,O]=Wr.useState(null),E=Wr.useRef(null),P=wB(e,E,y.onContentChange),R=Wr.useRef(0),I=Wr.useRef(""),N=Wr.useRef(0),z=Wr.useRef(null),V=Wr.useRef("right"),k=Wr.useRef(0),X=m?Z$:Wr.Fragment,B=m?{as:Qci,allowPinchZoom:!0}:void 0,Q=K=>{let oe=I.current+K,ue=w().filter(A=>!A.disabled),de=document.activeElement,L=ue.find(A=>A.ref.current===de)?.textValue,W=ue.map(A=>A.textValue),ie=fdi(W,oe,L),j=ue.find(A=>A.textValue===ie)?.ref.current;(function A(U){I.current=U,window.clearTimeout(R.current),U!==""&&(R.current=window.setTimeout(()=>A(""),1e3))})(oe),j&&setTimeout(()=>j.focus())};Wr.useEffect(()=>()=>window.clearTimeout(R.current),[]),SB();let Y=Wr.useCallback(K=>V.current===z.current?.side&&mdi(K,z.current?.area),[]);return(0,Ro.jsx)(Xci,{scope:r,searchRef:I,onItemEnter:Wr.useCallback(K=>{Y(K)&&K.preventDefault()},[Y]),onItemLeave:Wr.useCallback(K=>{Y(K)||(E.current?.focus(),O(null))},[Y]),onTriggerLeave:Wr.useCallback(K=>{Y(K)&&K.preventDefault()},[Y]),pointerGraceTimerRef:N,onPointerGraceIntentChange:Wr.useCallback(K=>{z.current=K},[]),children:(0,Ro.jsx)(X,{...B,children:(0,Ro.jsx)(G$,{asChild:!0,trapped:o,onMountAutoFocus:Yc(i,K=>{K.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Ro.jsx)(_T,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Ro.jsx)(vKr,{asChild:!0,..._,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:T,onCurrentTabStopIdChange:O,onEntryFocus:Yc(u,K=>{g.isUsingKeyboardRef.current||K.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Ro.jsx)(yB,{role:"menu","aria-orientation":"vertical","data-state":d8r(y.open),"data-radix-menu-content":"",dir:g.dir,...b,...h,ref:P,style:{outline:"none",...h.style},onKeyDown:Yc(h.onKeyDown,K=>{let ue=K.target.closest("[data-radix-menu-content]")===K.currentTarget,de=K.ctrlKey||K.altKey||K.metaKey,L=K.key.length===1;ue&&(K.key==="Tab"&&K.preventDefault(),!de&&L&&Q(K.key));let W=E.current;if(K.target!==W||!Bci.includes(K.key))return;K.preventDefault();let j=w().filter(A=>!A.disabled).map(A=>A.ref.current);zKr.includes(K.key)&&j.reverse(),cdi(j)}),onBlur:Yc(t.onBlur,K=>{K.currentTarget.contains(K.target)||(window.clearTimeout(R.current),I.current="")}),onPointerMove:Yc(t.onPointerMove,Mde(K=>{let oe=K.target,ue=k.current!==K.clientX;if(K.currentTarget.contains(oe)&&ue){let de=K.clientX>k.current?"right":"left";V.current=de,k.current=K.clientX}}))})})})})})})});GKr.displayName=bC;var edi="MenuGroup",Gyt=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(xZ.div,{role:"group",...n,ref:e})});Gyt.displayName=edi;var tdi="MenuLabel",XKr=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(xZ.div,{...n,ref:e})});XKr.displayName=tdi;var SLe="MenuItem",BKr="menu.itemSelect",xLe=Wr.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Wr.useRef(null),a=Ade(SLe,t.__scopeMenu),s=Jyt(SLe,t.__scopeMenu),u=wB(e,i),l=Wr.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(BKr,{bubbles:!0,cancelable:!0});d.addEventListener(BKr,p=>n?.(p),{once:!0}),tKr(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Ro.jsx)(ZKr,{...o,ref:u,disabled:r,onClick:Yc(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Yc(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Yc(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||zyt.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});xLe.displayName=SLe;var ZKr=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=Jyt(SLe,r),s=VKr(r),u=Wr.useRef(null),l=wB(e,u),[c,d]=Wr.useState(!1),[f,p]=Wr.useState("");return Wr.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Ro.jsx)(Pde.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Ro.jsx)(wKr,{asChild:!0,...s,focusable:!n,children:(0,Ro.jsx)(xZ.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Yc(t.onPointerMove,Mde(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Yc(t.onPointerLeave,Mde(m=>a.onItemLeave(m))),onFocus:Yc(t.onFocus,()=>d(!0)),onBlur:Yc(t.onBlur,()=>d(!1))})})})}),rdi="MenuCheckboxItem",YKr=Wr.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Ro.jsx)(n8r,{scope:t.__scopeMenu,checked:r,children:(0,Ro.jsx)(xLe,{role:"menuitemcheckbox","aria-checked":CLe(r)?"mixed":r,...o,ref:e,"data-state":Yyt(r),onSelect:Yc(o.onSelect,()=>n?.(CLe(r)?!0:!r),{checkForDefaultPrevented:!1})})})});YKr.displayName=rdi;var QKr="MenuRadioGroup",[ndi,odi]=IW(QKr,{value:void 0,onValueChange:()=>{}}),e8r=Wr.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=pLe(n);return(0,Ro.jsx)(ndi,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Ro.jsx)(Gyt,{...o,ref:e})})});e8r.displayName=QKr;var t8r="MenuRadioItem",r8r=Wr.forwardRef((t,e)=>{let{value:r,...n}=t,o=odi(t8r,t.__scopeMenu),i=r===o.value;return(0,Ro.jsx)(n8r,{scope:t.__scopeMenu,checked:i,children:(0,Ro.jsx)(xLe,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":Yyt(i),onSelect:Yc(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});r8r.displayName=t8r;var Xyt="MenuItemIndicator",[n8r,idi]=IW(Xyt,{checked:!1}),o8r=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=idi(Xyt,r);return(0,Ro.jsx)(CZ,{present:n||CLe(i.checked)||i.checked===!0,children:(0,Ro.jsx)(xZ.span,{...o,ref:e,"data-state":Yyt(i.checked)})})});o8r.displayName=Xyt;var adi="MenuSeparator",i8r=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Ro.jsx)(xZ.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});i8r.displayName=adi;var sdi="MenuArrow",a8r=Wr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=Ide(r);return(0,Ro.jsx)(bB,{...o,...n,ref:e})});a8r.displayName=sdi;var Zyt="MenuSub",[udi,s8r]=IW(Zyt),ldi=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=OB(Zyt,e),a=Ide(e),[s,u]=Wr.useState(null),[l,c]=Wr.useState(null),d=pLe(o);return Wr.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Ro.jsx)(z$,{...a,children:(0,Ro.jsx)(HKr,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Ro.jsx)(udi,{scope:e,contentId:Syt(),triggerId:Syt(),trigger:s,onTriggerChange:u,children:r})})})};ldi.displayName=Zyt;var Ede="MenuSubTrigger",u8r=Wr.forwardRef((t,e)=>{let r=OB(Ede,t.__scopeMenu),n=Ade(Ede,t.__scopeMenu),o=s8r(Ede,t.__scopeMenu),i=Jyt(Ede,t.__scopeMenu),a=Wr.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Wr.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Wr.useEffect(()=>c,[c]),Wr.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Ro.jsx)(Hyt,{asChild:!0,...l,children:(0,Ro.jsx)(ZKr,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":d8r(r.open),...t,ref:wde(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Yc(t.onPointerMove,Mde(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:Yc(t.onPointerLeave,Mde(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,y=f[m?"left":"right"],g=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:y,y:f.top},{x:g,y:f.top},{x:g,y:f.bottom},{x:y,y:f.bottom}],side:p}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Yc(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||zci[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});u8r.displayName=Ede;var l8r="MenuSubContent",c8r=Wr.forwardRef((t,e)=>{let r=JKr(bC,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=OB(bC,t.__scopeMenu),a=Ade(bC,t.__scopeMenu),s=s8r(l8r,t.__scopeMenu),u=Wr.useRef(null),l=wB(e,u);return(0,Ro.jsx)(Pde.Provider,{scope:t.__scopeMenu,children:(0,Ro.jsx)(CZ,{present:n||i.open,children:(0,Ro.jsx)(Pde.Slot,{scope:t.__scopeMenu,children:(0,Ro.jsx)(Kyt,{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:Yc(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Yc(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Yc(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Vci[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});c8r.displayName=l8r;function d8r(t){return t?"open":"closed"}function CLe(t){return t==="indeterminate"}function Yyt(t){return CLe(t)?"indeterminate":t?"checked":"unchecked"}function cdi(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function ddi(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function fdi(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=ddi(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 pdi(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 mdi(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return pdi(r,e)}function Mde(t){return e=>e.pointerType==="mouse"?t(e):void 0}var f8r=WKr,p8r=Hyt,m8r=KKr,h8r=GKr,g8r=Gyt,y8r=XKr,b8r=xLe,_8r=YKr,v8r=e8r,w8r=r8r,S8r=o8r,C8r=i8r,x8r=a8r;var T8r=u8r,O8r=c8r;var Qyt=$(J(),1);var gdi=Qyt[" useId ".trim().toString()]||(()=>{}),ydi=0;function ebt(t){let[e,r]=Qyt.useState(gdi());return Q$e(()=>{t||r(n=>n??String(ydi++))},[t]),t||(e?`radix-${e}`:"")}var ug=$(St(),1),TLe="DropdownMenu",[bdi,gNs]=_5r(TLe,[Vyt]),b_=Vyt(),[_di,E8r]=bdi(TLe),Nde=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=b_(e),l=ph.useRef(null),[c,d]=w5r({prop:o,defaultProp:i??!1,onChange:a,caller:TLe});return(0,ug.jsx)(_di,{scope:e,triggerId:ebt(),triggerRef:l,contentId:ebt(),open:c,onOpenChange:d,onOpenToggle:ph.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,ug.jsx)(f8r,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};Nde.displayName=TLe;var P8r="DropdownMenuTrigger",Dde=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=E8r(P8r,r),a=b_(r);return(0,ug.jsx)(p8r,{asChild:!0,...a,children:(0,ug.jsx)(T5r.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:Y$e(e,i.triggerRef),onPointerDown:vde(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:vde(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});Dde.displayName=P8r;var vdi="DropdownMenuPortal",M8r=t=>{let{__scopeDropdownMenu:e,...r}=t,n=b_(e);return(0,ug.jsx)(m8r,{...n,...r})};M8r.displayName=vdi;var R8r="DropdownMenuContent",I8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=E8r(R8r,r),i=b_(r),a=ph.useRef(!1);return(0,ug.jsx)(h8r,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:vde(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:vde(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)"}})});I8r.displayName=R8r;var wdi="DropdownMenuGroup",Sdi=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(g8r,{...o,...n,ref:e})});Sdi.displayName=wdi;var Cdi="DropdownMenuLabel",A8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(y8r,{...o,...n,ref:e})});A8r.displayName=Cdi;var xdi="DropdownMenuItem",N8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(b8r,{...o,...n,ref:e})});N8r.displayName=xdi;var Tdi="DropdownMenuCheckboxItem",D8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(_8r,{...o,...n,ref:e})});D8r.displayName=Tdi;var Odi="DropdownMenuRadioGroup",Edi=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(v8r,{...o,...n,ref:e})});Edi.displayName=Odi;var Pdi="DropdownMenuRadioItem",j8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(w8r,{...o,...n,ref:e})});j8r.displayName=Pdi;var Mdi="DropdownMenuItemIndicator",$8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(S8r,{...o,...n,ref:e})});$8r.displayName=Mdi;var Rdi="DropdownMenuSeparator",L8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(C8r,{...o,...n,ref:e})});L8r.displayName=Rdi;var Idi="DropdownMenuArrow",Adi=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(x8r,{...o,...n,ref:e})});Adi.displayName=Idi;var Ndi="DropdownMenuSubTrigger",F8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(T8r,{...o,...n,ref:e})});F8r.displayName=Ndi;var Ddi="DropdownMenuSubContent",k8r=ph.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=b_(r);return(0,ug.jsx)(O8r,{...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)"}})});k8r.displayName=Ddi;var q8r=Nde,U8r=Dde,B8r=M8r,tbt=I8r;var rbt=A8r,nbt=N8r,obt=D8r;var ibt=j8r,abt=$8r,sbt=L8r;var ubt=F8r,lbt=k8r;Or();$r();var mN=q8r,hN=U8r;var $di=Uu.forwardRef(({className:t,inset:e,children:r,...n},o)=>Uu.createElement(ubt,{ref:o,className:we("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-modifier-hover data-[state=open]:tw-bg-modifier-hover [&_svg]:tw-pointer-events-none [&_svg]:tw-size-4 [&_svg]:tw-shrink-0",e&&"tw-pl-8",t),...n},r,Uu.createElement(ld,{className:"tw-ml-auto"})));$di.displayName=ubt.displayName;var Ldi=Uu.forwardRef(({className:t,...e},r)=>Uu.createElement(lbt,{ref:r,className:we("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}));Ldi.displayName=lbt.displayName;var Dv=Uu.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>Uu.createElement(B8r,{container:r??activeDocument.body},Uu.createElement(tbt,{ref:o,sideOffset:e,className:we("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})));Dv.displayName=tbt.displayName;var Ni=Uu.forwardRef(({className:t,inset:e,...r},n)=>Uu.createElement(nbt,{ref:n,className:we("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-modifier-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}));Ni.displayName=nbt.displayName;var Fdi=Uu.forwardRef(({className:t,children:e,checked:r,...n},o)=>Uu.createElement(obt,{ref:o,className:we("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-modifier-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),checked:r,...n},Uu.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Uu.createElement(abt,null,Uu.createElement(Yu,{className:"tw-size-4"}))),e));Fdi.displayName=obt.displayName;var kdi=Uu.forwardRef(({className:t,children:e,...r},n)=>Uu.createElement(ibt,{ref:n,className:we("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-modifier-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t),...r},Uu.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Uu.createElement(abt,null,Uu.createElement(kre,{className:"tw-size-2 tw-fill-current"}))),e));kdi.displayName=ibt.displayName;var qdi=Uu.forwardRef(({className:t,inset:e,...r},n)=>Uu.createElement(rbt,{ref:n,className:we("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));qdi.displayName=rbt.displayName;var Udi=Uu.forwardRef(({className:t,...e},r)=>Uu.createElement(sbt,{ref:r,className:we("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));Udi.displayName=sbt.displayName;var Bdi=({className:t,...e})=>Uu.createElement("span",{className:we("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Bdi.displayName="DropdownMenuShortcut";Ye();Bt();Or();$r();hF();function IZ({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,jv.useState)(null),u=Br(),l=u.activeModels.find(d=>d.enabled&&no(d)===o),c=u.activeModels.filter(d=>pye(d)||!h1t(d.provider)?!0:!!Bb(d.provider,d));return jv.default.createElement(mN,null,jv.default.createElement(hN,{asChild:!0},jv.default.createElement(pe,{variant:r,size:e,disabled:t,className:we("tw-min-w-0 tw-justify-start tw-text-muted",n)},jv.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?jv.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?jv.default.createElement(Egt,{model:l,iconSize:8}):jv.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&jv.default.createElement(Wi,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),jv.default.createElement(Dv,{align:"start",className:"tw-max-h-64 tw-overflow-y-auto"},c.filter(d=>d.enabled).map(d=>{let{hasApiKey:f,errorNotice:p}=XJ(d,u);return jv.default.createElement(Ni,{key:no(d),onSelect:async m=>{!f&&p&&s(p);try{s(null),i(no(d))}catch(h){let y="Model switch failed: "+zr(h);s(y);let g=c.find(b=>b.enabled&&no(b)===o);g&&i(no(g))}},className:f?"":"tw-opacity-70"},jv.default.createElement(Egt,{model:d,iconSize:12}))})))}Cn();function cbt({open:t,onClose:e,commandIcon:r,commandLabel:n,selectedText:o,contentState:i,editableContent:a,onEditableContentChange:s,followUpValue:u,onFollowUpChange:l,onFollowUpSubmit:c,selectedModel:d,onSelectModel:f,onStop:p,onInsert:m,onReplace:h,initialPosition:y,resizable:g=!1,hideContentAreaOnIdle:b=!1,includeNoteContext:_,onIncludeNoteContextChange:w}){let T=i.type==="loading"||i.type==="result"&&i.isStreaming?"loading":i.type==="result"?"result":"idle",O=i.type==="loading"||i.type==="result"&&!!i.isStreaming,E=i.type==="result"&&!i.isStreaming&&!!s,P=b?i.type!=="idle":!0;return my.createElement(fyt,{open:t,onClose:e,initialPosition:y,resizable:g,minHeight:g?P?400:180:void 0,closeOnEscapeFromOutside:!0},my.createElement(jgt,{icon:r,label:n,className:"tw-border-b tw-border-border"}),my.createElement(_de,{content:o}),P&&my.createElement(lyt,{state:i,editable:E,value:a,onChange:s,disableAutoGrow:g,minHeight:g?"0px":void 0}),my.createElement(cyt,{value:u,onChange:l,onSubmit:()=>{O||c()},onClear:()=>l(""),placeholder:"Enter follow-up instructions...",className:P?void 0:"tw-mt-auto",hint:O?"Generating...":void 0,autoFocus:!0}),my.createElement("div",{className:"tw-flex tw-flex-none tw-items-center tw-justify-between tw-border-t tw-border-border tw-px-4 tw-py-3"},my.createElement("div",{className:"tw-flex tw-items-center tw-gap-3"},my.createElement(IZ,{size:"sm",variant:"ghost",value:d,onChange:f,disabled:O}),w&&my.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},my.createElement(Rl,{id:"menuCommandIncludeContext",checked:_,onCheckedChange:I=>w(!!I),className:"tw-size-3.5",disabled:O}),my.createElement("label",{htmlFor:"menuCommandIncludeContext",className:"tw-cursor-pointer tw-text-xs tw-text-muted"},"Note"),my.createElement(to,{content:"Include the active note's content as context",side:"top"}))),my.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},b&&T==="idle"&&my.createElement(pe,{variant:"default",size:"sm",onClick:c,disabled:!u.trim()||O,title:"Send message"},my.createElement(Q4,{className:"tw-mr-1 tw-size-4"}),"Send"),my.createElement(dyt,{state:T,onStop:p,onInsert:m,onReplace:h}))))}Xe();var jde=require("@codemirror/state"),AW=require("@codemirror/view");function $de(t){let e=jde.StateEffect.define(),r=AW.Decoration.mark({class:t});function n(f,p,m){let h=Math.max(0,Math.min(p,f)),y=Math.max(0,Math.min(m,f));return h===y?null:{from:Math.min(h,y),to:Math.max(h,y)}}let o=jde.StateField.define({create:()=>null,update(f,p){let m=f;if(m&&!p.changes.empty){let h=p.changes.mapPos(m.from,1),y=p.changes.mapPos(m.to,-1);m=n(p.state.doc.length,h,y)}for(let h of p.effects)h.is(e)&&(m=h.value?n(p.state.doc.length,h.value.from,h.value.to):null);return m},provide:f=>AW.EditorView.decorations.from(f,p=>p?AW.Decoration.set([r.range(p.from,p.to)]):AW.Decoration.none)}),i=AW.EditorView.baseTheme({[`.${t}`]:{backgroundColor:"var(--text-selection)",borderRadius:"2px"}}),a=[o,i];function s(f){return f.state.field(o,!1)!==void 0}function u(f,p){let m=[];if(!p)return s(f)&&m.push(e.of(null)),m;let h=n(f.state.doc.length,p.from,p.to);return h?(s(f)||m.push(jde.StateEffect.appendConfig.of(a)),m.push(e.of(h)),m):(s(f)&&m.push(e.of(null)),m)}function l(f,p,m){let h=u(f,{from:p,to:m});h.length>0&&f.dispatch({effects:h})}function c(f){let p=u(f,null);p.length>0&&f.dispatch({effects:p})}function d(f){return f.state.field(o,!1)??null}return{field:o,effect:e,extension:a,show:l,hide:c,buildEffects:u,getRange:d}}var Lde=$de("copilot-selection-highlight"),zdi=Lde.extension;function z8r(t,e){try{t.dispatch(e)}catch(r){ne("SelectionHighlight dispatch failed:",r)}}function Vdi(t,e){return Lde.buildEffects(t,e)}function dbt(t,e,r){let n=Lde.buildEffects(t,{from:e,to:r});n.length>0&&z8r(t,{effects:n})}function V8r(t,e,r){dbt(t,e,r)}function H8r(t){let e=Lde.buildEffects(t,null);e.length>0&&z8r(t,{effects:e})}function Hdi(t){return Lde.getRange(t)}var $v={show:dbt,update:V8r,hide:H8r,getRange:Hdi,buildEffects:Vdi};Xe();function AZ(t){switch(t){case"no_range":return"No selection range available.";case"range_out_of_bounds":return"Selection range is out of bounds.";case"content_changed":return"Selection content has changed. Please reselect and try again.";case"file_changed":return"File has changed. Please reselect in the original file.";case"editor_changed":return"Editor has changed. Please reselect and try again.";case"leaf_changed":return"Editor pane has changed. Please reselect and try again.";case"target_unavailable":return"Editor is no longer available.";default:return"Cannot replace. Please reselect and try again."}}function W8r(t,e,r){let n=t.state.toText(r);t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:{anchor:e.from,head:e.from+n.length}}),t.focus()}function J8r(t){let{editorView:e,leafSnapshot:r,filePathSnapshot:n,selectedTextSnapshot:o,initialRange:i,getLeafState:a}=t,s={...i},u=!0,l=null,c=null,d=h=>{let y=h.mapPos(s.from,1),g=h.mapPos(s.to,-1);s={from:Math.min(y,g),to:Math.max(y,g)},u=!0},f=()=>({...s}),p=()=>{let h=a(),y=!l||h.leaf!==l.leaf||h.editorView!==l.editorView||h.filePath!==l.filePath||!e.dom.isConnected;if(!u&&!y&&c)return c;u=!1,l=h;let g=(w,T)=>({ok:!1,reason:w,range:T,message:AZ(w)});if(!h.leaf||h.leaf!==r)return c=g("leaf_changed",null),c;if(!h.editorView||h.editorView!==e)return c=g("editor_changed",null),c;if(h.filePath!==n)return c=g("file_changed",null),c;if(!e.dom.isConnected)return c=g("target_unavailable",null),c;let b=e.state.doc;return s.from<0||s.to>b.length||s.from>=s.to?(c=g("range_out_of_bounds",null),c):b.sliceString(s.from,s.to)!==o?(c=g("content_changed",{...s}),c):(c={ok:!0,reason:null,range:{...s}},c)};return{getRange:f,validate:p,onDocChanged:d,replace:h=>{let y=p();if(!y.ok||!y.range)return y;try{return W8r(e,y.range,h),{ok:!0,reason:null,range:y.range}}catch(g){return ne("MapPosReplaceGuard replace failed:",g),{ok:!1,reason:"target_unavailable",range:null,message:AZ("target_unavailable")}}}}}function K8r(t){let{editorView:e,filePathSnapshot:r,selectedTextSnapshot:n,getCurrentContext:o}=t,i=()=>{let u=$v.getRange(e);return u?{from:u.from,to:u.to}:null},a=()=>{let u=o(),l=(p,m)=>({ok:!1,reason:p,range:m,message:AZ(p)});if(!u.editorView)return l("target_unavailable",null);if(u.editorView!==e)return l("editor_changed",null);if(u.filePath!==r)return l("file_changed",null);let c=i();if(!c)return l("no_range",null);let d=e.state.doc;return c.from<0||c.to>d.length||c.from>=c.to?l("range_out_of_bounds",null):d.sliceString(c.from,c.to)!==n?l("content_changed",c):{ok:!0,reason:null,range:c}};return{getRange:i,validate:a,replace:u=>{let l=a();if(!l.ok||!l.range)return l;try{return W8r(e,l.range,u),{ok:!0,reason:null,range:l.range}}catch(c){return ne("HighlightReplaceGuard replace failed:",c),{ok:!1,reason:"target_unavailable",range:null,message:AZ("target_unavailable")}}}}}Xe();Bt();Or();var OT=require("obsidian"),Fs=$(J()),Z8r=$(jm());Ye();var Js=$(J());sw();FS();CX();function fbt(){return new r$e({returnMessages:!0,memoryKey:"history"})}async function G8r(t,e,r){let n=await tC.getInstance().createModelInstance(t),i=Ah.fromMessages([LS.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new pO("history"),$_.fromTemplate("{input}")]);return Bl.from([{input:a=>a.input,memory:()=>r.loadMemoryVariables({})},{input:a=>a.input,history:a=>a.memory.history},i,n])}mr();Xe();var Y$=$(J());function X8r(t){let e=(0,Y$.useRef)(t),r=(0,Y$.useRef)(null),n=(0,Y$.useRef)(null);return(0,Y$.useEffect)(()=>{e.current=t},[t]),(0,Y$.useEffect)(()=>()=>{r.current!==null&&(cancelAnimationFrame(r.current),r.current=null)},[]),(0,Y$.useCallback)((...o)=>{n.current=o,r.current===null&&(r.current=requestAnimationFrame(()=>{r.current=null;let i=n.current;i&&e.current(...i)}))},[])}function Wdi(t){return`${t.name}|${t.provider}`}function Jdi(t){if(!t.aborted)return!1;let e=t.reason;return typeof e!="string"?!0:e==="new-chat"||e==="component-unmount"}function OLe(t){let{model:e,systemPrompt:r,excludeThinking:n=!0,onNoModel:o,onNonAbortError:i}=t,[a,s]=(0,Js.useState)(!1),[u,l]=(0,Js.useState)(""),c=(0,Js.useRef)(!0),d=(0,Js.useRef)(!1),f=(0,Js.useRef)(null),p=(0,Js.useRef)(""),m=(0,Js.useRef)(!1),h=(0,Js.useRef)(0),y=(0,Js.useRef)(o),g=(0,Js.useRef)(i);(0,Js.useEffect)(()=>{y.current=o,g.current=i},[o,i]);let b=(0,Js.useRef)(null),_=(0,Js.useRef)(null),w=(0,Js.useRef)(null),T=(0,Js.useRef)(null),O=(0,Js.useMemo)(()=>e?Wdi(e):null,[e]),E=X8r(B=>{c.current&&l(B)}),P=(0,Js.useCallback)(B=>{c.current&&(p.current=B,E(B))},[E]),R=(0,Js.useCallback)(async B=>{if(!e||!O)return y.current?.(),null;if(!_.current||w.current!==O||T.current!==r){b.current||(b.current=fbt());let Y=await G8r(e,r,b.current);if(B.aborted)return null;_.current=Y,w.current=O,T.current=r}return!_.current||!b.current?null:{chain:_.current,memory:b.current}},[e,O,r]);(0,Js.useEffect)(()=>(c.current=!0,()=>{c.current=!1,f.current?.abort("component-unmount"),f.current=null}),[]),(0,Js.useEffect)(()=>{d.current&&f.current?.abort("new-chat"),_.current=null,w.current=null,T.current=null},[O,r]);let I=(0,Js.useCallback)(()=>!m.current,[]),N=(0,Js.useCallback)(()=>b.current,[]),z=(0,Js.useCallback)(()=>p.current,[]),V=(0,Js.useCallback)((B="user-stopped")=>{f.current?.abort(B)},[]),k=(0,Js.useCallback)(()=>{f.current?.abort("new-chat"),f.current=null,_.current=null,w.current=null,T.current=null,b.current=fbt(),m.current=!1,h.current+=1,p.current="",d.current=!1,c.current&&(l(""),E(""),s(!1))},[E]),X=(0,Js.useCallback)(async B=>{if(d.current)return null;d.current=!0,c.current&&s(!0);let Q=++h.current,Y=new AbortController;f.current=Y,p.current="",c.current&&(l(""),E(""));let K=ie=>{h.current===Q&&P(ie)},oe=new dv(K,n),ue=!1,de=null,L="",W=null;try{let ie=!m.current;if(!e)return y.current?.(),null;if(L=await B({signal:Y.signal,isFirstTurn:ie}),Y.signal.aborted||!L.trim())return null;let j=await R(Y.signal);if(!j)return null;de=j.memory;let U=await j.chain.withConfig({signal:Y.signal}).stream({input:L});for await(let H of U)if(oe.processChunk(H),Y.signal.aborted)break}catch(ie){ie instanceof Error&&ie.name==="AbortError"||Y.signal.aborted||(ue=!0,g.current?.(ie))}finally{let ie=oe.close().content.trim(),j=Jdi(Y.signal),A=h.current!==Q;if(!ue&&ie&&!j&&!A&&(W=ie,de))try{let U=sW(ie);await de.saveContext({input:L},{output:typeof U=="string"?U:ie}),m.current=!0}catch(U){ne("Error saving chat context:",U)}A||(p.current="",d.current=!1),f.current===Y&&(f.current=null),c.current&&!A&&(l(""),E(""),s(!1))}return W},[n,R,P,e,E]);return{isStreaming:a,streamingText:u,getIsFirstTurn:I,runTurn:X,stop:V,reset:k,getMemory:N,getLatestStreamingText:z}}mr();function Kdi(t,e){return{...{autoExecuteOnOpen:!0,hideContentAreaOnIdle:!1,commandLabel:t.title,commandIcon:Fs.default.createElement(YS,{className:"tw-size-4 tw-text-muted"})},...e}}function Gdi({originalText:t,command:e,onInsert:r,onReplace:n,onClose:o,systemPrompt:i,initialPosition:a,behaviorConfig:s}){let u=(0,Fs.useMemo)(()=>Kdi(e,s),[e,s]),l=(0,Fs.useRef)(!1),c=(0,Fs.useRef)(!0);(0,Fs.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let[d,f]=(0,Fs.useState)(""),[p,m]=(0,Fs.useState)(""),[h,y]=(0,Fs.useState)(u.autoExecuteOnOpen),[g,b]=(0,Fs.useState)(""),[_]=bF(),w=Br(),T=u.modelSelectionScope??"custom-command",O=(0,Fs.useMemo)(()=>T==="quick-command"?w.quickCommandModelKey??_:e.modelKey||_,[T,w.quickCommandModelKey,e.modelKey,_]),[E,P]=(0,Fs.useState)(O),R=(0,Fs.useCallback)(U=>{P(U),T==="quick-command"&&Re("quickCommandModelKey",U)},[T]),[I,N]=(0,Fs.useState)(()=>w.quickCommandIncludeNoteContext),z=(0,Fs.useCallback)(U=>{N(U),Re("quickCommandIncludeNoteContext",U)},[]),V=(0,Fs.useRef)(!1),k=(0,Fs.useMemo)(()=>{try{let U=qS(E,w.activeModels);if(!U.enabled)throw new Error(`Selected model is disabled: ${E}`);return U}catch{return w.activeModels.find(U=>U.enabled)??null}},[E,w.activeModels]),X=(0,Fs.useMemo)(()=>k?`${k.name}|${k.provider}`:null,[k]);(0,Fs.useEffect)(()=>{X&&X!==E&&(P(X),!V.current&&(V.current=!0,Te("Selected model is no longer available. Falling back to a default model.",{selectedModelKey:E,resolvedModelKey:X}),new OT.Notice("Selected model is no longer available. Falling back to a default model.")))},[X,E]);let{isStreaming:B,streamingText:Q,runTurn:Y,stop:K,getLatestStreamingText:oe}=OLe({model:k,systemPrompt:i||"",excludeThinking:!0,onNoModel:()=>{new OT.Notice("No active model is configured. Please configure a model in Copilot settings."),y(!1)},onNonAbortError:U=>{ne("Error generating response:",U),new OT.Notice("Error generating response. Please try again."),y(!1)}}),ue=(0,Fs.useRef)("");(0,Fs.useEffect)(()=>{d&&m(d)},[d]);let de=(0,Fs.useMemo)(()=>h&&!B&&!Q&&!d?{type:"loading"}:B||Q?{type:"result",text:Q||d,isStreaming:B}:d?{type:"result",text:d,isStreaming:!1}:{type:"idle"},[h,B,Q,d]),L=(0,Fs.useRef)(!1);(0,Fs.useEffect)(()=>{if(!u.autoExecuteOnOpen||L.current)return;L.current=!0;let U=!1;async function H(){try{let re=await Y(async Z=>{if(Z.signal.aborted)return"";let le=await ade(e.content,t);return ue.current=le,le});!U&&re&&(f(re),ue.current="")}catch(re){ne("Error in initial response:",re)}finally{U||y(!1)}}return H(),()=>{U=!0,K("component-unmount")}},[u.autoExecuteOnOpen,e.content,t,Y,K]);let W=async()=>{if(!g.trim()||l.current||h||B)return;l.current=!0;let U=g;b(""),f(""),m("");try{y(!0);let H=await Y(async re=>{if(re.signal.aborted)return"";let Z=re.isFirstTurn,le=U;Z&&u.firstSubmitTransform&&(le=u.firstSubmitTransform(le,I));let Ce=await ade(le,t,!Z);return ue.current=Ce,Ce});if(!c.current)return;H&&(f(H),ue.current="")}catch(H){H instanceof Error&&H.name==="AbortError"||(ne("Error in follow-up submit:",H),c.current&&new OT.Notice("Failed to send message. Please try again."))}finally{c.current&&y(!1),l.current=!1}},ie=(0,Fs.useCallback)(()=>{let U=oe().trim();K("user-stopped"),U&&f(U),ue.current=""},[K,oe]),j=()=>{let U=p||d||Q;U&&r(U)},A=()=>{let U=p||d||Q;U&&n(U)};return Fs.default.createElement(cbt,{open:!0,onClose:o,commandIcon:u.commandIcon,commandLabel:u.commandLabel,selectedText:t,contentState:de,editableContent:p,onEditableContentChange:m,followUpValue:g,onFollowUpChange:b,onFollowUpSubmit:W,selectedModel:E,onSelectModel:R,onStop:ie,onInsert:j,onReplace:A,initialPosition:a,resizable:!0,hideContentAreaOnIdle:u.hideContentAreaOnIdle,includeNoteContext:u.showIncludeNoteContext?I:void 0,onIncludeNoteContextChange:u.showIncludeNoteContext?z:void 0})}var EB=class{constructor(e,r){this.app=e;this.configs=r;this.root=null;this.container=null;this.highlightView=null;this.replaceGuard=null}resolveWindow(e){return e?.containerEl?.ownerDocument?.defaultView??window}resolveDocument(e){return e?.containerEl?.ownerDocument??document}getInitialPosition(e){let r=this.resolveWindow(e),n=Math.min(500,r.innerWidth*.9),o=440,i=12,a=6,s={x:Math.max(i,(r.innerWidth-n)/2),y:Math.max(i,(r.innerHeight-o)/2)};if(!e?.editor?.cm)return s;let u=e.editor.cm,l=u.state.selection.main,c=l.empty,d=l.head;if(!c&&d>0&&d===l.to){let E=u.state.doc.lineAt(d);d===E.from&&(d=d-1)}let f=u.coordsAtPos(d);if(!f)return s;let p=u.scrollDOM.getBoundingClientRect(),m=f.bottom>=p.top&&f.top<=p.bottom,h=f.right>=p.left&&f.left<=p.right;if(!m||!h)return s;let y;if(c)y=f.left;else{let E=u.state.doc.lineAt(l.from),P=u.state.doc.lineAt(l.to);if(E.number===P.number){let R=u.coordsAtPos(l.from),I=u.coordsAtPos(l.to);R&&I?y=(R.left+I.right)/2:y=f.left}else y=f.left}let g;c?g=y:g=y-n/2,g=Math.max(i,Math.min(g,r.innerWidth-i-n));let b=f.bottom,_=f.top,w=r.innerHeight-b-a,T=_-a,O;return w>=o+i?O=b+a:T>=o+i?O=_-a-o:w>=T?O=b+a:O=_-a-o,O=Math.max(i,Math.min(O,r.innerHeight-i-o)),{x:g,y:O}}open(){let e=this.app.workspace.getActiveViewOfType(OT.MarkdownView),r=this.resolveDocument(e);this.container=r.createElement("div"),this.container.className="copilot-menu-command-modal-container",r.body.appendChild(this.container),this.root=(0,Z8r.createRoot)(this.container);let{selectedText:n,command:o,systemPrompt:i,behaviorConfig:a}=this.configs,s=n;if(e?.editor?.cm){let f=e.editor.cm,p=f.state.selection.main,m=e.file?.path??null;s=f.state.doc.sliceString(p.from,p.to),$v.show(f,p.from,p.to),this.highlightView=f,this.replaceGuard=K8r({editorView:f,filePathSnapshot:m,selectedTextSnapshot:s,getCurrentContext:()=>{let h=this.app.workspace.getActiveViewOfType(OT.MarkdownView);return{editorView:h?.editor?.cm??null,filePath:h?.file?.path??null}}})}let u=this.getInitialPosition(e),l=f=>{KJ(f),this.close()},c=f=>{if(!this.replaceGuard){new OT.Notice("No selection to replace.");return}let p=f1(f),m=this.replaceGuard.replace(p);if(!m.ok){new OT.Notice(m.message??"Cannot replace.");return}new OT.Notice("Message replaced in the active note."),this.close()},d=()=>{this.close()};this.root.render(Fs.default.createElement(Gdi,{originalText:s,command:o,onInsert:l,onReplace:c,onClose:d,systemPrompt:i,initialPosition:u,behaviorConfig:a}))}close(){this.highlightView&&($v.hide(this.highlightView),this.highlightView=null),this.replaceGuard=null,this.root?.unmount(),this.root=null,this.container?.remove(),this.container=null}};var PLe=require("obsidian");var ELe=class extends PLe.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=Pv();this.commands=_$e(r)}onOpen(){super.onOpen(),this.commands.length===0&&this.setInstructions([{command:"",purpose:"No custom commands found. Create some custom commands first in the settings."}])}getItems(){return this.commands}getItemText(e){return e.title}onChooseItem(e,r){let n=this.app.workspace.getActiveViewOfType(PLe.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){th.getInstance().recordUsage(e),new EB(this.app,{selectedText:r,command:e}).open()}};mA();Cn();Xe();Bt();var NZ=require("obsidian"),Bu=$(J()),Y8r=$(jm());function Xdi({onClose:t}){let[e,r]=Bu.useState("input"),[n,o]=Bu.useState(""),[i,a]=Bu.useState(!1),[s,u]=Bu.useState(""),[l,c]=Bu.useState(!1),[d,f]=Bu.useState(null),p=(w,T=!0)=>{if(!w.trim())return T&&(u(""),c(!1)),{isValid:!1};let O=gWe(w);return O.isValid?(T&&(u(""),c(!0)),{isValid:!0,videoId:O.videoId}):(T&&(u(O.error||"Invalid URL"),c(!1)),{isValid:!1})},m=w=>{o(w),p(w,!0)},h=async()=>{if(i)return;let w=p(n);if(w.isValid){a(!0),u("");try{let T=await Ql.getInstance().youtube4llm(n);if(!T.response.transcript)throw new Error("Transcript not available. Only English videos with auto transcript enabled are supported.");let O={videoId:w.videoId,transcript:T.response.transcript,url:O1t(w.videoId)};f(O),r("display")}catch(T){ne("Error downloading YouTube transcript:",T);let O=T instanceof Error?T.message:"An error occurred while downloading the transcript";u(O)}finally{a(!1)}}},y=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await navigator.clipboard.writeText(w),new NZ.Notice("Transcript copied to clipboard!")}catch(w){ne("Failed to copy to clipboard:",w),new NZ.Notice("Failed to copy to clipboard")}},g=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await KJ(w,!1),t()}catch(w){ne("Failed to insert to note:",w),new NZ.Notice("Failed to insert to note")}},b=()=>{r("input"),o(""),u(""),f(null)},_=w=>{w.key==="Enter"&&!i&&l&&h()};return e==="display"&&d?Bu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Bu.createElement("div",{className:"tw-rounded tw-bg-secondary tw-p-3"},Bu.createElement("a",{href:d.url,className:"tw-text-sm tw-text-muted hover:tw-text-normal",target:"_blank",rel:"noopener noreferrer"},d.url)),Bu.createElement("div",{className:"tw-max-h-96 tw-overflow-y-auto tw-rounded tw-border tw-border-border tw-bg-primary tw-p-4"},Bu.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-sm tw-leading-relaxed"},d.transcript)),Bu.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Bu.createElement(pe,{variant:"ghost",onClick:b},"Download Another"),Bu.createElement(pe,{variant:"default",onClick:y},"Copy to Clipboard"),Bu.createElement(pe,{variant:"default",onClick:g},"Insert at Cursor"),Bu.createElement(pe,{variant:"secondary",onClick:t},"Close"))):Bu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Bu.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Bu.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enter a valid YouTube video URL"),Bu.createElement(ri,{placeholder:"https://www.youtube.com/watch?v=...",value:n,onChange:w=>m(w.target.value),onKeyDown:_,disabled:i}),s&&Bu.createElement("div",{className:"tw-text-sm tw-text-error"},s)),Bu.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Bu.createElement(pe,{variant:"secondary",onClick:t,disabled:i},"Cancel"),Bu.createElement(pe,{variant:"default",onClick:h,disabled:i||!l},i?"Downloading...":"Download Transcript")))}var MLe=class extends NZ.Modal{constructor(e){super(e),this.setTitle("Download YouTube Script (plus)")}onOpen(){let{contentEl:e}=this;this.root=(0,Y8r.createRoot)(e);let r=()=>{this.close()};this.root.render(Bu.createElement(Xdi,{onClose:r}))}onClose(){this.root.unmount()}};Fc();ob();Bt();var oi=require("obsidian");qN();mr();ra();function lg(t,e,r){t.addCommand({id:e,name:xye[e],callback:r})}function jGr(t,e,r){t.addCommand({id:e,name:xye[e],editorCallback:r})}function $Gr(t,e,r){t.addCommand({id:e,name:xye[e],checkCallback:r})}function Obt(t,e,r){jGr(t,Sn.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 oi.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),lg(t,Sn.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await Kit(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new oi.Notice(`Total tokens in your vault: ${o}`)}catch(n){ne("Error counting tokens: ",n),new oi.Notice("An error occurred while counting tokens.")}}),lg(t,Sn.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),lg(t,Sn.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),lg(t,Sn.NEW_CHAT,()=>{c9(),t.newChat()}),$Gr(t,Sn.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(oi.MarkdownView);if(n)return!!(!Ite()&&o&&o.editor);if(Ite())return new oi.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new oi.Notice("No active editor found."),!1;let a=o.editor.getSelection();if(!a.trim())return new oi.Notice("Please select some text first. Selected text is required for quick commands."),!1;let s={title:"Quick Command",content:"",showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:"",lastUsedMs:Date.now()};return new EB(t.app,{selectedText:a,command:s,systemPrompt:w$e,behaviorConfig:{autoExecuteOnOpen:!1,hideContentAreaOnIdle:!0,commandLabel:"Quick Command",commandIcon:null,showIncludeNoteContext:!0,modelSelectionScope:"quick-command",firstSubmitTransform:(l,c)=>S$e(l,c)}}).open(),!0}),lg(t,Sn.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().clearIndex(),new oi.Notice("Cleared local Copilot semantic index.")}catch(n){ne("Error clearing semantic index:",n),new oi.Notice("Failed to clear semantic index.")}}),lg(t,Sn.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().garbageCollectVectorStore();new oi.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ne("Error during garbage collection:",n),new oi.Notice("Failed to garbage collect semantic index.")}}),lg(t,Sn.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Ye(),x4));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0});new oi.Notice(`Semantic search index refreshed with ${a} documents.`)}else new oi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ne("Error building index:",n),new oi.Notice("An error occurred while building the index.")}}),lg(t,Sn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Ye(),x4));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!0,{userInitiated:!0});new oi.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new oi.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ne("Error rebuilding index:",n),new oi.Notice("An error occurred while rebuilding the index.")}}),lg(t,Sn.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),lg(t,Sn.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(ob(),Ggr)),{inclusions:s,exclusions:u}=i(),l=t.app.vault.getMarkdownFiles(),c=new Set,d=new Set,f=new Set,p=new Set(o);for(let w of l){if(!a(w,s,u)){f.add(w.path);continue}let T=await t.app.vault.cachedRead(w);!T||T.trim().length===0?c.add(w.path):p.has(w.path)||d.add(w.path)}let m=["# Copilot Files Status",`- Indexed files: ${p.size}`,`- Unindexed files: ${d.size}`,`- Empty files: ${c.size}`,`- Excluded files: ${f.size}`,"","## Indexed Files",...p.size>0?Array.from(p).sort().map(w=>`- [[${w}]]`):["No indexed files found."],"","## Unindexed Files",...d.size>0?Array.from(d).sort().map(w=>`- [[${w}]]`):["No unindexed files found."],"","## Empty Files",...c.size>0?Array.from(c).sort().map(w=>`- [[${w}]]`):["No empty files found."],"","## Excluded Files (based on settings)",...f.size>0?Array.from(f).sort().map(w=>`- [[${w}]]`):["No excluded files."]].join(`
|
||
`),h=`Copilot-Indexed-Files-${new Date().toLocaleDateString().replace(/\//g,"-")}.md`,y="copilot",g=`${y}/${h}`;await $c(y);let b=t.app.vault.getAbstractFileByPath(g);b?await t.app.vault.modify(b,m):await t.app.vault.create(g,m);let _=t.app.vault.getAbstractFileByPath(g);_&&(await t.app.workspace.getLeaf().openFile(_),new oi.Notice(`Listed ${p.size} indexed files`))}catch(n){ne("Error listing indexed files:",n),new oi.Notice("Failed to list indexed files.")}}),lg(t,Sn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,async()=>{try{let n=t.app.workspace.getActiveFile();if(!n){new oi.Notice("No active file. Please open a note first.");return}let o=(await Promise.resolve().then(()=>(Pl(),Vc))).default,{DBOperations:i}=await Promise.resolve().then(()=>(FEe(),N_r)),a=await o.getInstance().getDb(),s=await i.getDocsByPath(a,n.path);if(!s||s.length===0){new oi.Notice(`No embedding data found for: ${n.path}`);return}let u=s.map(h=>h.document),l=[`# Embedding Debug: ${n.basename}`,"",`**Path:** ${n.path}`,`**Chunks:** ${u.length}`,`**Embedding Model:** ${u[0]?.embeddingModel||"unknown"}`,"",...u.flatMap((h,y)=>{let g=h.embedding||[],b=g.slice(0,10).map(_=>_.toFixed(6)).join(", ");return[`## Chunk ${y+1}`,`- **ID:** ${h.id}`,`- **Content Preview:** "${(h.content||"").substring(0,200)}..."`,`- **Vector Length:** ${g.length}`,`- **Vector Preview:** [${b}${g.length>10?", ...":""}]`,`- **Tags:** ${(h.tags||[]).join(", ")||"none"}`,`- **Characters:** ${h.nchars||0}`,""]})].join(`
|
||
`),c=`Copilot-Embedding-Debug-${n.basename.replace(/[\\/:*?"<>|]/g,"_")}.md`,d="copilot",f=`${d}/${c}`;await $c(d);let p=t.app.vault.getAbstractFileByPath(f);p?await t.app.vault.modify(p,l):await t.app.vault.create(f,l);let m=t.app.vault.getAbstractFileByPath(f);m&&(await t.app.workspace.getLeaf().openFile(m),new oi.Notice(`Embedding debug info for ${u.length} chunk(s)`))}catch(n){ne("Error inspecting embeddings:",n),new oi.Notice("Failed to inspect embeddings. Is the index loaded?")}}),lg(t,Sn.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await Fw.getInstance().clearAllCache(),await i9.getInstance().clear(),new oi.Notice("All Copilot caches cleared successfully")}catch(n){ne("Error clearing Copilot caches:",n),new oi.Notice("Failed to clear Copilot caches")}}),lg(t,Sn.OPEN_LOG_FILE,async()=>{try{await QEe(),await Im.openLogFile()}catch(n){ne("Error creating Copilot log file:",n),new oi.Notice("Failed to create Copilot log file.")}}),lg(t,Sn.CLEAR_LOG_FILE,async()=>{try{await Im.clear(),new oi.Notice("Copilot log cleared.")}catch(n){ne("Error clearing Copilot log file:",n),new oi.Notice("Failed to clear Copilot log file.")}}),jGr(t,Sn.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=n.getSelection();if(!o){new oi.Notice("No text selected");return}let i=t.app.workspace.getActiveFile();if(!i){new oi.Notice("No active file");return}let a=n.listSelections()[0];if(!a){new oi.Notice("Could not determine selection range");return}let s=a.anchor.line+1,u=a.head.line+1,l={id:od(),content:o,sourceType:"note",noteTitle:i.basename,notePath:i.path,startLine:Math.min(s,u),endLine:Math.max(s,u)};SO([l]),t.activateView()}),lg(t,Sn.ADD_WEB_SELECTION_TO_CHAT_CONTEXT,async()=>{let{Platform:n}=await import("obsidian");if(!n.isDesktopApp){new oi.Notice("Web selection is only available on desktop");return}let{getWebViewerService:o}=await Promise.resolve().then(()=>(jW(),DGr));try{let i=o(t.app),a=i.getActiveLeaf()??i.getLastActiveLeaf();if(!a){new oi.Notice("No active Web Tab found");return}let s=await i.getSelectedMarkdown(a);if(!s.trim()){new oi.Notice("No text selected in Web Tab");return}let u=i.getPageInfo(a),l={id:od(),content:s,sourceType:"web",title:u.title||"Untitled",url:u.url,faviconUrl:u.faviconUrl||void 0};SO([l]),t.activateView()}catch(i){ne("Error adding web selection to context:",i),new oi.Notice("Failed to get web selection")}}),lg(t,Sn.ADD_CUSTOM_COMMAND,async()=>{let n=Pv(),o={...lN};new hB(t.app,n,o,async a=>{await th.getInstance().createCommand(a)}).open()}),lg(t,Sn.APPLY_CUSTOM_COMMAND,()=>{new ELe(t.app).open()}),lg(t,Sn.DOWNLOAD_YOUTUBE_SCRIPT,async()=>{if(!await E0()){new oi.Notice("Download YouTube Script (plus) is a Copilot Plus feature");return}new MLe(t.app).open()}),$Gr(t,Sn.TRIGGER_QUICK_ASK,n=>{let o=t.app.workspace.getActiveViewOfType(oi.MarkdownView);if(n)return!!(!Ite()&&o&&o.editor);if(Ite())return new oi.Notice("Quick Ask is not available in source mode."),!1;if(!o||!o.editor)return new oi.Notice("No active editor found."),!1;let i=o.editor.cm;return i?(t.quickAskController.show(o,i),!0):(new oi.Notice("Could not access CodeMirror editor."),!1)})}ra();var BZ={title:"",content:"",createdMs:0,modifiedMs:0,lastUsedMs:0},zZ="copilot-system-prompt-created",VZ="copilot-system-prompt-modified",HZ="copilot-system-prompt-last-used",Ebt="copilot-system-prompt-default";var MB=require("obsidian");Ye();Bt();Xe();function kde(t,e,r){let n=t.trim();return n?t!==n?"Prompt name cannot have leading or trailing spaces":r&&t===r?null:/[#<>:"/\\|?*[\]^\x00-\x1F]/g.test(n)?'Prompt name contains invalid characters. Avoid using: < > : " / \\ | ? * [ ] ^':e.some(i=>i.title.toLowerCase()===n.toLowerCase())?"A prompt with this name already exists":null:"Prompt name cannot be empty"}function _C(){return(0,MB.normalizePath)(te().userSystemPromptsFolder)}function vC(t){return(0,MB.normalizePath)(`${_C()}/${t}.md`)}function Mfi(t,e){let r=e?(0,MB.normalizePath)(e):_C();return(0,MB.normalizePath)(`${r}/${t}.md`)}function WZ(t){if(!(t instanceof MB.TFile)||t.extension!=="md")return!1;let e=_C();if(!t.path.startsWith(e+"/"))return!1;let r=t.path.slice(e.length+1);return!(r.startsWith("unsupported/")||r.includes("/"))}function Pbt(t,e){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){let r=Number(t);if(Number.isFinite(r))return r}return e}async function $W(t){let e=await app.vault.read(t),r=HJ(e),o=app.metadataCache.getFileCache(t)?.frontmatter,i=Pbt(o?.[zZ],BZ.createdMs),a=Pbt(o?.[VZ],BZ.modifiedMs),s=Pbt(o?.[HZ],BZ.lastUsedMs);return{title:t.basename,content:r,createdMs:i,modifiedMs:a,lastUsedMs:s}}async function Mbt(){let t=app.vault.getFiles().filter(e=>WZ(e));return await Promise.all(t.map($W))}async function JZ(){let t=await Mbt();return nje(t),t}async function LW(t,e){let r=C$(t.path),n=Date.now(),o=Number.isFinite(e.createdMs)&&e.createdMs>0?e.createdMs:n,i=Number.isFinite(e.modifiedMs)&&e.modifiedMs>0?e.modifiedMs:n,a=Number.isFinite(e.lastUsedMs)&&e.lastUsedMs>0?e.lastUsedMs:0;try{r||JU(t.path),await app.fileManager.processFrontMatter(t,s=>{s[zZ]==null&&(s[zZ]=o),s[VZ]==null&&(s[VZ]=i),s[HZ]==null&&(s[HZ]=a)})}finally{r||KU(t.path)}}function LGr(t,e){let n=`${t} (copy)`,o=1;for(;e.some(i=>i.title.toLowerCase()===n.toLowerCase());)o++,n=`${t} (copy ${o})`;return n}async function Rbt(t,e,r){let n=Mfi(t,r),o=app.vault.getAbstractFileByPath(n);if(!(o instanceof MB.TFile)){Te(`System prompt file not found for default flag update: ${n}`);return}let i=C$(o.path);try{i||JU(o.path),await app.fileManager.processFrontMatter(o,a=>{e?a[Ebt]=!0:delete a[Ebt]})}finally{i||KU(o.path)}}var qde=require("obsidian");Xe();Bt();Ye();var FW=class t{constructor(e){this.vault=e}static getInstance(e){if(!t.instance){if(!e)throw new Error("Vault is required for first initialization");t.instance=new t(e)}return t.instance}async initialize(){F("Initializing SystemPromptManager"),await JZ()}async createPrompt(e,r=!1){let n=EX(),o=kde(e.title,n);if(o)throw new Error(o);let i=vC(e.title),a=_C();try{JU(i),await $c(a),await this.vault.create(i,e.content);let s=this.vault.getAbstractFileByPath(i);s instanceof qde.TFile&&await LW(s,e),r||X3(e),F(`Created system prompt: ${e.title}`)}finally{KU(i)}}async updatePrompt(e,r,n=!1){let o=vC(e),i=vC(r.title),a=e!==r.title;if(a){let s=EX(),u=kde(r.title,s,e);if(u)throw new Error(u)}try{if(JU(i),a&&JU(o),a){let u=this.vault.getAbstractFileByPath(o);u instanceof qde.TFile&&await app.fileManager.renameFile(u,i)}let s=this.vault.getAbstractFileByPath(i);s instanceof qde.TFile&&(await this.vault.modify(s,r.content),await app.fileManager.processFrontMatter(s,u=>{u[zZ]=r.createdMs,u[VZ]=r.modifiedMs,u[HZ]=r.lastUsedMs})),n||(a&&(PX(e),te().defaultSystemPromptTitle===e&&(Re("defaultSystemPromptTitle",r.title),F(`Updated defaultSystemPromptTitle: ${e} -> ${r.title}`))),X3(r)),F(`Updated system prompt: ${e} -> ${r.title}`)}finally{KU(i),a&&KU(o)}}async deletePrompt(e){let r=vC(e);try{JU(r);let n=this.vault.getAbstractFileByPath(r);n instanceof qde.TFile&&await this.vault.delete(n),te().defaultSystemPromptTitle===e&&(Re("defaultSystemPromptTitle",""),F(`Cleared defaultSystemPromptTitle (deleted: ${e})`)),G3()===e&&(WU(""),F(`Cleared session selectedPromptTitle (deleted: ${e})`)),PX(e),F(`Deleted system prompt: ${e}`)}finally{KU(r)}}async duplicatePrompt(e){let r=EX(),n=LGr(e.title,r),o=Date.now(),i={title:n,content:e.content,createdMs:o,modifiedMs:o,lastUsedMs:0};return await this.createPrompt(i),F(`Duplicated system prompt: ${e.title} -> ${n}`),i}getPrompts(){return EX()}async reloadPrompts(){return await JZ()}async fetchPrompts(){return await Mbt()}};var KZ=require("obsidian");Ye();var Ibt=$(a9());Xe();var Ude=class{constructor(e,r){this.folderChangeRequestId=0;this.handleSettingsChange=(e,r)=>{let n=e.userSystemPromptsFolder!==r.userSystemPromptsFolder;if(e.defaultSystemPromptTitle!==r.defaultSystemPromptTitle){let i=n?e.userSystemPromptsFolder:void 0;this.handleDefaultPromptChange(e.defaultSystemPromptTitle,r.defaultSystemPromptTitle,i)}n&&this.debouncedFolderChange(r.userSystemPromptsFolder)};this.debouncedFolderChange=(0,Ibt.default)(e=>{this.handleSystemPromptsFolderChange(e)},300,{leading:!1,trailing:!0});this.handleFileModify=(0,Ibt.default)(async e=>{if(!(!WZ(e)||C$(e.path)))try{let r=await $W(e);X3(r)}catch(r){ne(`Error processing system prompt modification: ${e.path}`,r)}},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!WZ(e)||C$(e.path)))try{let r=await $W(e);await LW(e,r);let n=await $W(e);X3(n)}catch(r){ne(`Error processing system prompt creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!(!WZ(e)||C$(e.path)))try{PX(e.basename),te().defaultSystemPromptTitle===e.basename&&Re("defaultSystemPromptTitle",""),G3()===e.basename&&(WU(""),new KZ.Notice(`System prompt "${e.basename}" was deleted. Cleared current chat selection.`))}catch(r){ne(`Error processing system prompt deletion: ${e.path}`,r)}};this.handleFileRename=async(e,r)=>{if(C$(e.path)||C$(r))return;let n=_C(),o=r.startsWith(n+"/")?r.slice(n.length+1):"",i=o!==""&&!o.includes("/")&&r.endsWith(".md"),a=WZ(e)?e:null;if(!(!i&&!a))try{if(i){let s=r.split("/").pop()?.replace(/\.md$/i,"");if(s&&(PX(s),te().defaultSystemPromptTitle===s&&(a?Re("defaultSystemPromptTitle",a.basename):Re("defaultSystemPromptTitle","")),G3()===s)){let l=a?a.basename:"";WU(l),a?new KZ.Notice(`System prompt "${s}" was renamed to "${a.basename}". Updated current chat selection.`):new KZ.Notice(`System prompt "${s}" was moved out of the prompts folder. Cleared current chat selection.`)}}if(a){let s=await $W(a);await LW(a,s);let u=await $W(a);X3(u)}}catch(s){ne(`Error processing system prompt rename: ${e.path}`,s)}};this.plugin=e,this.vault=r,this.manager=FW.getInstance(r),this.initializeEventListeners()}async initialize(){await this.manager.initialize(),Q4r()}cleanup(){this.handleFileModify.cancel(),this.debouncedFolderChange.cancel(),this.settingsUnsubscriber?.(),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),this.settingsUnsubscriber=hl(this.handleSettingsChange)}async handleDefaultPromptChange(e,r,n){try{e&&await Rbt(e,!1,n),r&&await Rbt(r,!0),F(`Default system prompt changed: "${e}" -> "${r}"`)}catch(o){ne("Error updating default system prompt frontmatter",o)}}async handleSystemPromptsFolderChange(e){let r=++this.folderChangeRequestId;try{F(`System prompts folder changed to: ${e}`);let n=await this.manager.fetchPrompts();if(r!==this.folderChangeRequestId){F(`Folder change request ${r} superseded by ${this.folderChangeRequestId}, discarding results`);return}nje(n);let o=new Set(n.map(i=>i.title));this.validatePromptReferences(o)}catch(n){r===this.folderChangeRequestId&&ne(`Error reloading system prompts after folder change to: ${e}`,n)}}validatePromptReferences(e){let r=te(),n=G3();r.defaultSystemPromptTitle&&!e.has(r.defaultSystemPromptTitle)&&(Re("defaultSystemPromptTitle",""),F(`Cleared defaultSystemPromptTitle (not found in new folder): ${r.defaultSystemPromptTitle}`),new KZ.Notice(`Default system prompt "${r.defaultSystemPromptTitle}" not found in new folder. Cleared default selection.`)),n&&!e.has(n)&&(WU(""),F(`Cleared selectedPromptTitle (not found in new folder): ${n}`),new KZ.Notice(`Current system prompt "${n}" not found in new folder. Cleared chat selection.`))}};var Nc=$(J());Cn();Or();var GZ=require("obsidian"),kGr=$(jm());Ye();var gN=$(J());function FGr(){return gN.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},gN.default.createElement("li",null,gN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),gN.default.createElement("li",null,gN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),gN.default.createElement("li",null,gN.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)."),gN.default.createElement("li",null,gN.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{folder/path}")," represents notes from a specific folder path."))}Xe();function Rfi({prompts:t,onConfirm:e,onCancel:r,contentEl:n}){let o=Br(),[i,a]=(0,Nc.useState)({...BZ}),[s,u]=(0,Nc.useState)({}),l=(d,f)=>{a(p=>({...p,[d]:f})),u(p=>({...p,[d]:void 0}))},c=()=>{let d={},f=kde(i.title,t,"");if(f&&(d.title=f),i.content.trim()||(d.content="Content is required"),Object.keys(d).length>0){u(d);return}e(i)};return Nc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Nc.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"},Nc.default.createElement(px,{className:"tw-size-5 tw-shrink-0"}),Nc.default.createElement("div",{className:"tw-flex-1"},"System prompts are automatically loaded from .md files in your system prompts folder"," ",Nc.default.createElement("strong",null,o.userSystemPromptsFolder),". Modifying the files will also update the system prompt settings.")),Nc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nc.default.createElement(Xc,{htmlFor:"title"},"Name"),Nc.default.createElement(ri,{id:"title",placeholder:"Enter prompt name",value:i.title,onChange:d=>l("title",d.target.value)}),s.title&&Nc.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.title)),Nc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Nc.default.createElement(Xc,{htmlFor:"content"},"Content"),Nc.default.createElement(FGr,null),Nc.default.createElement("div",{className:"tw-relative"},Nc.default.createElement(h_,{id:"content",placeholder:"Enter your system prompt here...",value:i.content,onChange:d=>l("content",d.target.value),rows:10,className:"tw-min-h-[180px] tw-w-full tw-pr-8"})),s.content&&Nc.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.content)),Nc.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Nc.default.createElement(pe,{variant:"secondary",onClick:r},"Cancel"),Nc.default.createElement(pe,{variant:"default",onClick:c},"Save")))}var Bde=class extends GZ.Modal{constructor(r,n){super(r);this.prompts=n;this.setTitle("Add System Prompt")}onOpen(){let{contentEl:r,modalEl:n}=this;GZ.Platform.isMobile&&(n.style.height="80%"),this.root=(0,kGr.createRoot)(r);let o=async i=>{let a=Date.now(),s={...i,createdMs:a,modifiedMs:a,lastUsedMs:0};try{await FW.getInstance().createPrompt(s),this.close()}catch(u){let l=u instanceof Error?u.message:String(u);ne("Failed to create system prompt:",u),new GZ.Notice(`Failed to create prompt: ${l}`)}};this.root.render(Nc.default.createElement(Rfi,{prompts:this.prompts,onConfirm:o,onCancel:()=>this.close(),contentEl:r}))}onClose(){this.root.unmount()}};var VGr=require("obsidian");Xe();Ye();Cn();var qGr=require("obsidian"),kW=$(J()),UGr=$(jm());function Ifi({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return kW.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},kW.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),kW.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&kW.default.createElement(pe,{variant:"secondary",onClick:r},o),n&&kW.default.createElement(pe,{variant:"default",onClick:e},n)))}var zu=class extends qGr.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,UGr.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(kW.default.createElement(Ifi,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};Bt();var BGr="Migrated Custom System Prompt";function Afi(t,e){let r=t,n=1;for(;e.getAbstractFileByPath(vC(r));)n++,r=`${t} ${n}`;return r}function Abt(t){return t.replace(/\r\n/g,`
|
||
`).replace(/\r/g,`
|
||
`)}async function zGr(t,e,r){let n=_C(),o=`${n}/unsupported`;await $c(o);let i="Migrated System Prompt (Failed Verification)",a=i,s=1;for(;t.getAbstractFileByPath(`${o}/${a}.md`);)s++,a=`${i} ${s}`;let u=`${o}/${a}.md`,l=`> Migration failed: ${r}
|
||
>
|
||
> To fix: Review the content below, then move this file to ${n}
|
||
|
||
${e}`;return await t.create(u,l),u}async function Nfi(t,e,r){try{let n=await t.read(e),o=HJ(n,{trimStart:!1}),i=Abt(o).replace(/^\n+/,""),a=Abt(r).replace(/^\n+/,"");return i!==a?(Te(`Migration verification failed: content mismatch. Expected ${a.length} chars, got ${i.length} chars`),!1):!0}catch(n){return ne("Migration verification failed: unable to read back file",n),!1}}async function Nbt(t){let r=te().userSystemPrompt;if(!r||r.trim().length===0){F("No legacy userSystemPrompt to migrate");return}try{F("Migrating legacy userSystemPrompt from settings to file system");let n=_C();await $c(n);let o=Afi(BGr,t),i=vC(o);o!==BGr&&F(`Default name already exists, using unique name: "${o}"`);let a=Date.now(),s=Abt(r),u={title:o,content:s,createdMs:a,modifiedMs:a,lastUsedMs:0};await t.create(i,s);let l=t.getAbstractFileByPath(i);if(!(l instanceof VGr.TFile))throw new Error("File not found after creation");if(await LW(l,u),await Nfi(t,l,r)){Re("defaultSystemPromptTitle",o);try{await JZ()}catch(d){Te("Failed to reload prompts after migration:",d)}Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field"),new zu(app,()=>{},`We have upgraded your system prompt to the new file-based format. It is now stored as "${o}" in ${n}.
|
||
|
||
You can now:
|
||
\u2022 Edit your system prompt directly in the file
|
||
\u2022 Create multiple system prompts
|
||
\u2022 Manage prompts through the settings UI
|
||
|
||
Your migrated prompt has been set as the default system prompt.`,"\u{1F680} System Prompt Upgraded","OK","").open()}else{let d=await zGr(t,r,"content verification mismatch");try{await JZ()}catch(f){Te("Failed to reload prompts after failed migration:",f)}Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field (saved to unsupported)"),new zu(app,()=>{},`\u26A0\uFE0F System Prompt Migration Issue
|
||
|
||
Your system prompt was migrated but verification failed. Your data has been saved to:
|
||
|
||
${d}
|
||
|
||
To recover:
|
||
1. Open the file and review the content
|
||
2. Move it to ${n}
|
||
3. The prompt will be available immediately`,"Migration Verification Failed","OK","").open()}}catch(n){ne("Failed to migrate legacy userSystemPrompt:",n);try{let o=await zGr(t,r,n.message||String(n));Re("userSystemPrompt",""),F("Cleared legacy userSystemPrompt field (saved to unsupported after error)"),new zu(app,()=>{},`\u26A0\uFE0F System Prompt Migration Failed
|
||
|
||
An error occurred during migration. Your data has been saved to:
|
||
|
||
${o}
|
||
|
||
To recover:
|
||
1. Open the file and review the content
|
||
2. Move it to ${_C()}
|
||
3. The prompt will be available immediately`,"Migration Failed","OK","").open()}catch(o){ne("Failed to save to unsupported folder:",o),Te("Preserving userSystemPrompt in settings for manual recovery"),new zu(app,()=>{},`Failed to migrate system prompt: ${n.message}
|
||
|
||
Unable to save to file system. Your system prompt is still in settings and will continue to work.
|
||
|
||
Please check:
|
||
- Folder permissions for ${_C()}
|
||
- Available disk space
|
||
- Vault is accessible
|
||
|
||
You can retry by reloading the plugin.`,"Migration Failed - Data Preserved","OK","").open()}}}sd();sd();ra();function ULe(){let[t]=fw(),[e]=Dye(),[r]=s5();return(()=>{if(t!=="project")return"initial";let{total:o,success:i,failed:a,processingFiles:s}=r;return e||s.length>0?"loading":a.length>0?"error":o.length>0&&i.length===o.length?"success":"initial"})()}Xe();ra();sd();Cn();mr();Xe();Fc();Ye();Or();var sS=require("obsidian"),pr=$(J());var Ln=$(J());Or();Cn();var XZ=$(J());Cn();Or();var ZZ=({value:t,onChange:e,placeholder:r="Search..."})=>XZ.default.createElement("div",{className:"tw-relative"},XZ.default.createElement(ri,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&XZ.default.createElement(pe,{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"},XZ.default.createElement(RO,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),XZ.default.createElement(Y4,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var Hde=$(J());var dc=$(J(),1);var r$s=!!(typeof window<"u"&&window.document&&window.document.createElement);function YZ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var WGr=$(J(),1);function HGr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Dbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=HGr(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():HGr(t[o],null)}}}}function zde(...t){return WGr.useCallback(Dbt(...t),t)}var Q$=$(J(),1),JGr=$(St(),1);function KGr(t,e=[]){let r=[];function n(i,a){let s=Q$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=Q$.useMemo(()=>m,Object.values(m));return(0,JGr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=Q$.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=>Q$.createContext(a));return function(s){let u=s?.[t]||i;return Q$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Dfi(o,...e)]}function Dfi(...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 Q$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var jbt=$(J(),1);var GGr=$(J(),1),qW=globalThis?.document?GGr.useLayoutEffect:()=>{};var jfi=jbt[" useId ".trim().toString()]||(()=>{}),$fi=0;function XGr(t){let[e,r]=jbt.useState(jfi());return qW(()=>{t||r(n=>n??String($fi++))},[t]),t||(e?`radix-${e}`:"")}var Lv=$(J(),1);var ZGr=$(J(),1);function Lfi(t,e){return ZGr.useReducer((r,n)=>e[r][n]??r,t)}var zLe=t=>{let{present:e,children:r}=t,n=Ffi(e),o=typeof r=="function"?r({present:n.isPresent}):Lv.Children.only(r),i=zde(n.ref,kfi(o));return typeof r=="function"||n.isPresent?Lv.cloneElement(o,{ref:i}):null};zLe.displayName="Presence";function Ffi(t){let[e,r]=Lv.useState(),n=Lv.useRef(null),o=Lv.useRef(t),i=Lv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Lfi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Lv.useEffect(()=>{let l=BLe(n.current);i.current=s==="mounted"?l:"none"},[s]),qW(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=BLe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),qW(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=BLe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=BLe(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:Lv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function BLe(t){return t?.animationName||"none"}function kfi(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 YGr=$(J(),1),Hfi=$(hu(),1);var mh=$(J(),1);var VLe=$(St(),1);function HLe(t){let e=qfi(t),r=mh.forwardRef((n,o)=>{let{children:i,...a}=n,s=mh.Children.toArray(i),u=s.find(Bfi);if(u){let l=u.props.children,c=s.map(d=>d===u?mh.Children.count(l)>1?mh.Children.only(null):mh.isValidElement(l)?l.props.children:null:d);return(0,VLe.jsx)(e,{...a,ref:o,children:mh.isValidElement(l)?mh.cloneElement(l,void 0,c):null})}return(0,VLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function qfi(t){let e=mh.forwardRef((r,n)=>{let{children:o,...i}=r;if(mh.isValidElement(o)){let a=Vfi(o),s=zfi(i,o.props);return o.type!==mh.Fragment&&(s.ref=n?Dbt(n,a):a),mh.cloneElement(o,s)}return mh.Children.count(o)>1?mh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ufi=Symbol("radix.slottable");function Bfi(t){return mh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ufi}function zfi(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 Vfi(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 QGr=$(St(),1),Wfi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$bt=Wfi.reduce((t,e)=>{let r=HLe(`Primitive.${e}`),n=YGr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,QGr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var wC=$(J(),1);var WLe=$(J(),1);var Jfi=wC[" useInsertionEffect ".trim().toString()]||qW;function e9r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Kfi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=wC.useRef(t!==void 0);wC.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=wC.useCallback(c=>{if(s){let d=Gfi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Kfi({defaultProp:t,onChange:e}){let[r,n]=wC.useState(t),o=wC.useRef(r),i=wC.useRef(e);return Jfi(()=>{i.current=e},[e]),wC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Gfi(t){return typeof t=="function"}var y$s=Symbol("RADIX:SYNC_STATE");var Om=$(St(),1),JLe="Popover",[t9r,D$s]=KGr(JLe,[fC]),Vde=fC(),[Xfi,RB]=t9r(JLe),r9r=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=Vde(e),u=dc.useRef(null),[l,c]=dc.useState(!1),[d,f]=e9r({prop:n,defaultProp:o??!1,onChange:i,caller:JLe});return(0,Om.jsx)(z$,{...s,children:(0,Om.jsx)(Xfi,{scope:e,contentId:XGr(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:dc.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:dc.useCallback(()=>c(!0),[]),onCustomAnchorRemove:dc.useCallback(()=>c(!1),[]),modal:a,children:r})})};r9r.displayName=JLe;var n9r="PopoverAnchor",Zfi=dc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RB(n9r,r),i=Vde(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return dc.useEffect(()=>(a(),()=>s()),[a,s]),(0,Om.jsx)(V$,{...i,...n,ref:e})});Zfi.displayName=n9r;var o9r="PopoverTrigger",i9r=dc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RB(o9r,r),i=Vde(r),a=zde(e,o.triggerRef),s=(0,Om.jsx)($bt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":c9r(o.open),...n,ref:a,onClick:YZ(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,Om.jsx)(V$,{asChild:!0,...i,children:s})});i9r.displayName=o9r;var Lbt="PopoverPortal",[Yfi,Qfi]=t9r(Lbt,{forceMount:void 0}),a9r=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=RB(Lbt,e);return(0,Om.jsx)(Yfi,{scope:e,forceMount:r,children:(0,Om.jsx)(zLe,{present:r||i.open,children:(0,Om.jsx)(xT,{asChild:!0,container:o,children:n})})})};a9r.displayName=Lbt;var QZ="PopoverContent",s9r=dc.forwardRef((t,e)=>{let r=Qfi(QZ,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=RB(QZ,t.__scopePopover);return(0,Om.jsx)(zLe,{present:n||i.open,children:i.modal?(0,Om.jsx)(tpi,{...o,ref:e}):(0,Om.jsx)(rpi,{...o,ref:e})})});s9r.displayName=QZ;var epi=HLe("PopoverContent.RemoveScroll"),tpi=dc.forwardRef((t,e)=>{let r=RB(QZ,t.__scopePopover),n=dc.useRef(null),o=zde(e,n),i=dc.useRef(!1);return dc.useEffect(()=>{let a=n.current;if(a)return TB(a)},[]),(0,Om.jsx)(Z$,{as:epi,allowPinchZoom:!0,children:(0,Om.jsx)(u9r,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:YZ(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:YZ(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:YZ(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),rpi=dc.forwardRef((t,e)=>{let r=RB(QZ,t.__scopePopover),n=dc.useRef(!1),o=dc.useRef(!1);return(0,Om.jsx)(u9r,{...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()}})}),u9r=dc.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=RB(QZ,r),p=Vde(r);return SB(),(0,Om.jsx)(G$,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Om.jsx)(_T,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Om.jsx)(yB,{"data-state":c9r(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)"}})})})}),l9r="PopoverClose",npi=dc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=RB(l9r,r);return(0,Om.jsx)($bt.button,{type:"button",...n,ref:e,onClick:YZ(t.onClick,()=>o.onOpenChange(!1))})});npi.displayName=l9r;var opi="PopoverArrow",ipi=dc.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=Vde(r);return(0,Om.jsx)(bB,{...o,...n,ref:e})});ipi.displayName=opi;function c9r(t){return t?"open":"closed"}var d9r=r9r;var f9r=i9r,p9r=a9r,Fbt=s9r;$r();var IB=d9r,AB=f9r;var eL=Hde.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>Hde.createElement(p9r,{container:n??activeDocument.body},Hde.createElement(Fbt,{ref:i,align:e,sideOffset:r,className:we("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})));eL.displayName=Fbt.displayName;var bN=$(J());var on=$(J(),1);var y9r=$(J(),1),fpi=$(hu(),1);var hh=$(J(),1);var h9r=$(J(),1);function m9r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function kbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=m9r(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():m9r(t[o],null)}}}}function tL(...t){return h9r.useCallback(kbt(...t),t)}var KLe=$(St(),1);function g9r(t){let e=spi(t),r=hh.forwardRef((n,o)=>{let{children:i,...a}=n,s=hh.Children.toArray(i),u=s.find(lpi);if(u){let l=u.props.children,c=s.map(d=>d===u?hh.Children.count(l)>1?hh.Children.only(null):hh.isValidElement(l)?l.props.children:null:d);return(0,KLe.jsx)(e,{...a,ref:o,children:hh.isValidElement(l)?hh.cloneElement(l,void 0,c):null})}return(0,KLe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function spi(t){let e=hh.forwardRef((r,n)=>{let{children:o,...i}=r;if(hh.isValidElement(o)){let a=dpi(o),s=cpi(i,o.props);return o.type!==hh.Fragment&&(s.ref=n?kbt(n,a):a),hh.cloneElement(o,s)}return hh.Children.count(o)>1?hh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var upi=Symbol("radix.slottable");function lpi(t){return hh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===upi}function cpi(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 dpi(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 b9r=$(St(),1),ppi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],eY=ppi.reduce((t,e)=>{let r=g9r(`Primitive.${e}`),n=y9r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,b9r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Fv=$(J(),1);var _9r=$(J(),1),Wde=globalThis?.document?_9r.useLayoutEffect:()=>{};var v9r=$(J(),1);function mpi(t,e){return v9r.useReducer((r,n)=>e[r][n]??r,t)}var tY=t=>{let{present:e,children:r}=t,n=hpi(e),o=typeof r=="function"?r({present:n.isPresent}):Fv.Children.only(r),i=tL(n.ref,gpi(o));return typeof r=="function"||n.isPresent?Fv.cloneElement(o,{ref:i}):null};tY.displayName="Presence";function hpi(t){let[e,r]=Fv.useState(),n=Fv.useRef(null),o=Fv.useRef(t),i=Fv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=mpi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Fv.useEffect(()=>{let l=GLe(n.current);i.current=s==="mounted"?l:"none"},[s]),Wde(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=GLe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Wde(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=GLe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=GLe(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:Fv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function GLe(t){return t?.animationName||"none"}function gpi(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 rL=$(J(),1),w9r=$(St(),1);function S9r(t,e=[]){let r=[];function n(i,a){let s=rL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=rL.useMemo(()=>m,Object.values(m));return(0,w9r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=rL.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=>rL.createContext(a));return function(s){let u=s?.[t]||i;return rL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,ypi(o,...e)]}function ypi(...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 rL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var rY=$(J(),1);function NB(t){let e=rY.useRef(t);return rY.useEffect(()=>{e.current=t}),rY.useMemo(()=>(...r)=>e.current?.(...r),[])}var XLe=$(J(),1),bpi=$(St(),1),_pi=XLe.createContext(void 0);function C9r(t){let e=XLe.useContext(_pi);return t||e||"ltr"}function DB(t,[e,r]){return Math.min(r,Math.max(e,t))}var Y$s=!!(typeof window<"u"&&window.document&&window.document.createElement);function jB(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var T9r=$(J(),1),Ks=$(St(),1);function vpi(t,e){return T9r.useReducer((r,n)=>e[r][n]??r,t)}var qbt="ScrollArea",[O9r,lLs]=S9r(qbt),[wpi,SC]=O9r(qbt),E9r=on.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=on.useState(null),[l,c]=on.useState(null),[d,f]=on.useState(null),[p,m]=on.useState(null),[h,y]=on.useState(null),[g,b]=on.useState(0),[_,w]=on.useState(0),[T,O]=on.useState(!1),[E,P]=on.useState(!1),R=tL(e,N=>u(N)),I=C9r(o);return(0,Ks.jsx)(wpi,{scope:r,type:n,dir:I,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:T,onScrollbarXEnabledChange:O,scrollbarY:h,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:P,onCornerWidthChange:b,onCornerHeightChange:w,children:(0,Ks.jsx)(eY.div,{dir:I,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});E9r.displayName=qbt;var P9r="ScrollAreaViewport",M9r=on.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=SC(P9r,r),s=on.useRef(null),u=tL(e,s,a.onViewportChange);return(0,Ks.jsxs)(Ks.Fragment,{children:[(0,Ks.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,Ks.jsx)(eY.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Ks.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});M9r.displayName=P9r;var yN="ScrollAreaScrollbar",QLe=on.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=SC(yN,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return on.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Ks.jsx)(Spi,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Ks.jsx)(Cpi,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Ks.jsx)(R9r,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Ks.jsx)(Ubt,{...n,ref:e}):null});QLe.displayName=yN;var Spi=on.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=SC(yN,t.__scopeScrollArea),[i,a]=on.useState(!1);return on.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,Ks.jsx)(tY,{present:r||i,children:(0,Ks.jsx)(R9r,{"data-state":i?"visible":"hidden",...n,ref:e})})}),Cpi=on.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=SC(yN,t.__scopeScrollArea),i=t.orientation==="horizontal",a=tFe(()=>u("SCROLL_END"),100),[s,u]=vpi("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 on.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),on.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,Ks.jsx)(tY,{present:r||s!=="hidden",children:(0,Ks.jsx)(Ubt,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:jB(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:jB(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),R9r=on.forwardRef((t,e)=>{let r=SC(yN,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=on.useState(!1),s=t.orientation==="horizontal",u=tFe(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return nY(r.viewport,u),nY(r.content,u),(0,Ks.jsx)(tY,{present:n||i,children:(0,Ks.jsx)(Ubt,{"data-state":i?"visible":"hidden",...o,ref:e})})}),Ubt=on.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=SC(yN,t.__scopeScrollArea),i=on.useRef(null),a=on.useRef(0),[s,u]=on.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=D9r(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 Mpi(f,a.current,s,p)}return r==="horizontal"?(0,Ks.jsx)(xpi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=x9r(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,Ks.jsx)(Tpi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=x9r(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}),xpi=on.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=SC(yN,t.__scopeScrollArea),[a,s]=on.useState(),u=on.useRef(null),l=tL(e,u,i.onScrollbarXChange);return on.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ks.jsx)(A9r,{"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":eFe(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),$9r(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:YLe(a.paddingLeft),paddingEnd:YLe(a.paddingRight)}})}})}),Tpi=on.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=SC(yN,t.__scopeScrollArea),[a,s]=on.useState(),u=on.useRef(null),l=tL(e,u,i.onScrollbarYChange);return on.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Ks.jsx)(A9r,{"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":eFe(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),$9r(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:YLe(a.paddingTop),paddingEnd:YLe(a.paddingBottom)}})}})}),[Opi,I9r]=O9r(yN),A9r=on.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=SC(yN,r),[m,h]=on.useState(null),y=tL(e,R=>h(R)),g=on.useRef(null),b=on.useRef(""),_=p.viewport,w=n.content-n.viewport,T=NB(c),O=NB(u),E=tFe(d,10);function P(R){if(g.current){let I=R.clientX-g.current.left,N=R.clientY-g.current.top;l({x:I,y:N})}}return on.useEffect(()=>{let R=I=>{let N=I.target;m?.contains(N)&&T(I,w)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[_,m,w,T]),on.useEffect(O,[n,O]),nY(m,E),nY(p.content,E),(0,Ks.jsx)(Opi,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:NB(i),onThumbPointerUp:NB(a),onThumbPositionChange:O,onThumbPointerDown:NB(s),children:(0,Ks.jsx)(eY.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:jB(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),g.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),P(R))}),onPointerMove:jB(t.onPointerMove,P),onPointerUp:jB(t.onPointerUp,R=>{let I=R.target;I.hasPointerCapture(R.pointerId)&&I.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),ZLe="ScrollAreaThumb",Bbt=on.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=I9r(ZLe,t.__scopeScrollArea);return(0,Ks.jsx)(tY,{present:r||o.hasThumb,children:(0,Ks.jsx)(Epi,{ref:e,...n})})}),Epi=on.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=SC(ZLe,r),a=I9r(ZLe,r),{onThumbPositionChange:s}=a,u=tL(e,d=>a.onThumbChange(d)),l=on.useRef(void 0),c=tFe(()=>{l.current&&(l.current(),l.current=void 0)},100);return on.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=Rpi(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Ks.jsx)(eY.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:jB(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:jB(t.onPointerUp,a.onThumbPointerUp)})});Bbt.displayName=ZLe;var zbt="ScrollAreaCorner",N9r=on.forwardRef((t,e)=>{let r=SC(zbt,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Ks.jsx)(Ppi,{...t,ref:e}):null});N9r.displayName=zbt;var Ppi=on.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=SC(zbt,r),[i,a]=on.useState(0),[s,u]=on.useState(0),l=!!(i&&s);return nY(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),nY(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Ks.jsx)(eY.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 YLe(t){return t?parseInt(t,10):0}function D9r(t,e){let r=t/e;return isNaN(r)?0:r}function eFe(t){let e=D9r(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function Mpi(t,e,r,n="ltr"){let o=eFe(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 j9r([u,l],d)(t)}function x9r(t,e,r="ltr"){let n=eFe(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=DB(t,u);return j9r([0,a],[0,s])(l)}function j9r(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 $9r(t,e){return t>0&&t<e}var Rpi=(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 tFe(t,e){let r=NB(t),n=on.useRef(0);return on.useEffect(()=>()=>window.clearTimeout(n.current),[]),on.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function nY(t,e){let r=NB(e);Wde(()=>{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 Vbt=E9r,L9r=M9r;var F9r=N9r;$r();var $B=bN.forwardRef(({className:t,children:e,...r},n)=>bN.createElement(Vbt,{ref:n,className:we("tw-relative tw-overflow-hidden",t),...r},bN.createElement(L9r,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),bN.createElement(k9r,null),bN.createElement(F9r,null)));$B.displayName=Vbt.displayName;var k9r=bN.forwardRef(({className:t,orientation:e="vertical",...r},n)=>bN.createElement(QLe,{ref:n,orientation:e,className:we("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},bN.createElement(Bbt,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));k9r.displayName=QLe.displayName;$r();Xe();Ye();l1();var q9r=require("obsidian");function U9r({children:t,chatHistory:e,onUpdateTitle:r,onDeleteChat:n,onLoadChat:o,onOpenSourceFile:i}){let[a,s]=(0,Ln.useState)(""),[u,l]=(0,Ln.useState)(null),[c,d]=(0,Ln.useState)(""),[f,p]=(0,Ln.useState)(!1),[m,h]=(0,Ln.useState)(null),y=q9r.Platform.isMobile,g=Br(),b=(0,Ln.useMemo)(()=>a.trim()?e.filter(N=>N.title.toLowerCase().includes(a.toLowerCase())):e,[e,a]),_=(0,Ln.useMemo)(()=>mO(b,g.chatHistorySortStrategy,{getName:N=>N.title,getCreatedAtMs:N=>N.createdAt.getTime(),getLastUsedAtMs:N=>N.lastAccessedAt.getTime()}),[b,g.chatHistorySortStrategy]),w=(0,Ln.useMemo)(()=>{let N=g.chatHistorySortStrategy;if(N==="name")return[{key:"All",label:"All",chats:_,priority:0}];let z=[],V=new Map,k=new Date;return _.forEach(X=>{let B=N==="recent"?X.lastAccessedAt:X.createdAt,Q=k.getTime()-B.getTime(),Y=Math.floor(Q/(1e3*60*60*24)),K,oe;if(Y===0)K="Today",oe=0;else if(Y===1)K="Yesterday",oe=1;else if(Y<7)K=`${Y}d ago`,oe=2+Y;else if(Y<30){let ue=Math.floor(Y/7);K=ue===1?"1w ago":`${ue}w ago`,oe=10+ue}else{let ue=Math.floor(Y/30);K=ue===1?"1m ago":`${ue}m ago`,oe=50+ue}V.has(K)||(V.set(K,[]),z.push({key:K,label:K,chats:V.get(K),priority:oe})),V.get(K).push(X)}),z.sort((X,B)=>X.priority-B.priority)},[g.chatHistorySortStrategy,_]),T=(N,z)=>{l(N),d(z)},O=async()=>{if(u&&c.trim())try{await r(u,c.trim()),l(null),d("")}catch(N){ne("Error updating title:",N);return}else l(null),d("")},E=()=>{l(null),d("")},P=async N=>{if(m===N)try{await n(N),h(null)}catch(z){ne("Error deleting chat:",z),h(null)}else h(N),setTimeout(()=>{h(null)},3e3)},R=()=>{h(null)},I=async N=>{o&&await o(N),p(!1)};return Ln.default.createElement(IB,{open:f,onOpenChange:p},Ln.default.createElement(AB,{asChild:!0},t),Ln.default.createElement(eL,{className:"tw-w-80 tw-p-0",align:"end",side:"top"},Ln.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col"},Ln.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-p-1"},Ln.default.createElement(ZZ,{value:a,onChange:s})),Ln.default.createElement($B,{className:"tw-min-h-[150px] tw-flex-1 tw-overflow-y-auto"},Ln.default.createElement("div",{className:"tw-p-2"},w.length===0?Ln.default.createElement("div",{className:"tw-py-8 tw-text-center tw-text-muted"},a?"No matching chat history found.":"No chat history"):w.map(N=>Ln.default.createElement("div",{key:N.key,className:"tw-mb-3 tw-border-x-[0px] tw-border-b tw-border-t-[0px] tw-border-border tw-pb-2",style:{borderBottomStyle:"solid"}},Ln.default.createElement("div",{className:"tw-mb-2 tw-px-2 tw-text-xs tw-font-medium tw-tracking-wider tw-text-muted"},N.label),Ln.default.createElement("div",{className:"tw-space-y-1"},N.chats.map(z=>Ln.default.createElement(Api,{key:z.id,chat:z,isEditing:u===z.id,editingTitle:c,onEditingTitleChange:d,onStartEdit:T,onSaveEdit:O,onCancelEdit:E,onDelete:P,onCancelDelete:R,onLoadChat:I,onOpenSourceFile:i,isMobile:y,confirmDeleteId:m}))))))))))}function Api({chat:t,isEditing:e,editingTitle:r,onEditingTitleChange:n,onStartEdit:o,onSaveEdit:i,onCancelEdit:a,onDelete:s,onCancelDelete:u,onLoadChat:l,onOpenSourceFile:c,isMobile:d,confirmDeleteId:f}){return e?Ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2"},Ln.default.createElement(z5,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Ln.default.createElement(ri,{value:r,onChange:p=>n(p.target.value),className:"!tw-h-6 tw-flex-1",autoFocus:!0,onKeyDown:p=>{p.key==="Enter"?i():p.key==="Escape"&&a()}}),Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:i,className:"tw-size-5 tw-p-0"},Ln.default.createElement(Yu,{className:"tw-size-3"})),Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:a,className:"tw-size-5 tw-p-0"},Ln.default.createElement(qo,{className:"tw-size-3"}))):Ln.default.createElement("div",{className:we("tw-group tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-modifier-hover"),onClick:()=>l(t.id)},Ln.default.createElement(z5,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Ln.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Ln.default.createElement("span",{className:"tw-block tw-truncate tw-text-sm tw-font-medium tw-text-normal"},t.title)),Ln.default.createElement("div",{className:we("tw-flex tw-shrink-0 tw-items-center tw-gap-1.5 tw-transition-opacity",d?"tw-flex":"tw-hidden group-hover:tw-flex")},f===t.id?Ln.default.createElement(Ln.default.Fragment,null,Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),s(t.id)},className:"tw-size-5 tw-p-0 tw-text-error hover:tw-text-error",title:"Confirm Delete"},Ln.default.createElement(Yu,{className:"tw-size-3"})),Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),u()},className:"tw-size-5 tw-p-0",title:"Cancel deletion"},Ln.default.createElement(qo,{className:"tw-size-3"}))):Ln.default.createElement(Ln.default.Fragment,null,Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),c&&c(t.id)},className:"tw-size-5 tw-p-0",title:"Open the source file"},Ln.default.createElement(E1,{className:"tw-size-4"})),Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),o(t.id,t.title)},className:"tw-size-5 tw-p-0"},Ln.default.createElement(Xb,{className:"tw-size-3"})),Ln.default.createElement(pe,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),s(t.id)},className:"tw-size-5 tw-p-0 tw-text-error hover:tw-text-error",title:"delete file"},Ln.default.createElement(Vy,{className:"tw-size-3"})))))}Or();var UW=$(J()),B9r=({tokenCount:t})=>t==null?null:UW.default.createElement(yn,null,UW.default.createElement(bn,{asChild:!0},UW.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-faint"},UW.default.createElement(Bre,{className:"tw-size-3"}),UW.default.createElement("span",null,(r=>r<1e3?"<1k":`${Math.floor(r/1e3)}k`)(t)))),UW.default.createElement(dn,null,"Context used: ",t.toLocaleString()));var dr=$(J());Cn();var BW=$(J());$r();Or();function _N({options:t,placeholder:e,containerClassName:r,className:n,...o}){return BW.default.createElement("div",{className:we("tw-group tw-relative tw-w-full",r)},BW.default.createElement("select",{className:we("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&&BW.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>BW.default.createElement("option",{key:i.value,value:i.value},i.label))),BW.default.createElement("div",{className:we("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")},BW.default.createElement(Wi,{className:"tw-size-4"})))}var nFe=$(J());var X9r=$(J(),1);var W9r=$(J(),1),kpi=$(hu(),1);var gh=$(J(),1);var Npi=$(J(),1);function z9r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function V9r(...t){return e=>{let r=!1,n=t.map(o=>{let i=z9r(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():z9r(t[o],null)}}}}var rFe=$(St(),1);function H9r(t){let e=Dpi(t),r=gh.forwardRef((n,o)=>{let{children:i,...a}=n,s=gh.Children.toArray(i),u=s.find($pi);if(u){let l=u.props.children,c=s.map(d=>d===u?gh.Children.count(l)>1?gh.Children.only(null):gh.isValidElement(l)?l.props.children:null:d);return(0,rFe.jsx)(e,{...a,ref:o,children:gh.isValidElement(l)?gh.cloneElement(l,void 0,c):null})}return(0,rFe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Dpi(t){let e=gh.forwardRef((r,n)=>{let{children:o,...i}=r;if(gh.isValidElement(o)){let a=Fpi(o),s=Lpi(i,o.props);return o.type!==gh.Fragment&&(s.ref=n?V9r(n,a):a),gh.cloneElement(o,s)}return gh.Children.count(o)>1?gh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var jpi=Symbol("radix.slottable");function $pi(t){return gh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===jpi}function Lpi(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 Fpi(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 J9r=$(St(),1),qpi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],K9r=qpi.reduce((t,e)=>{let r=H9r(`Primitive.${e}`),n=W9r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,J9r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Z9r=$(St(),1),Upi="Separator",G9r="horizontal",Bpi=["horizontal","vertical"],Y9r=X9r.forwardRef((t,e)=>{let{decorative:r,orientation:n=G9r,...o}=t,i=zpi(n)?n:G9r,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,Z9r.jsx)(K9r.div,{"data-orientation":i,...s,...o,ref:e})});Y9r.displayName=Upi;function zpi(t){return Bpi.includes(t)}var Hbt=Y9r;$r();var CC=nFe.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>nFe.createElement(Hbt,{ref:o,decorative:r,orientation:e,className:we("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}));CC.displayName=Hbt.displayName;Or();var bi=$(J());var oY=$(J());var Vo=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>oY.default.createElement("div",{className:"tw-space-y-2"},t&&oY.default.createElement(Xc,{className:r?"tw-text-error":""},t," ",e&&oY.default.createElement("span",{className:"tw-text-error"},"*")),n&&oY.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&oY.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var fu=$(J());var HW=$(J());var Tu=$(J(),1);function zW(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var e7r=$(J(),1);function Q9r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Wbt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Q9r(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():Q9r(t[o],null)}}}}function VW(...t){return e7r.useCallback(Wbt(...t),t)}var nL=$(J(),1),t7r=$(St(),1);function r7r(t,e=[]){let r=[];function n(i,a){let s=nL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=nL.useMemo(()=>m,Object.values(m));return(0,t7r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=nL.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=>nL.createContext(a));return function(s){let u=s?.[t]||i;return nL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Hpi(o,...e)]}function Hpi(...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 nL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var xC=$(J(),1);var n7r=$(J(),1),oFe=globalThis?.document?n7r.useLayoutEffect:()=>{};var iFe=$(J(),1);var Wpi=xC[" useInsertionEffect ".trim().toString()]||oFe;function o7r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Jpi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=xC.useRef(t!==void 0);xC.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=xC.useCallback(c=>{if(s){let d=Kpi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Jpi({defaultProp:t,onChange:e}){let[r,n]=xC.useState(t),o=xC.useRef(r),i=xC.useRef(e);return Wpi(()=>{i.current=e},[e]),xC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Kpi(t){return typeof t=="function"}var VLs=Symbol("RADIX:SYNC_STATE");var aFe=$(J(),1),Gpi=$(St(),1),Xpi=aFe.createContext(void 0);function i7r(t){let e=aFe.useContext(Xpi);return t||e||"ltr"}var sFe=$(J(),1);function a7r(t){let e=sFe.useRef({value:t,previous:t});return sFe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var s7r=$(J(),1);function u7r(t){let[e,r]=s7r.useState(void 0);return oFe(()=>{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 c7r=$(J(),1),rmi=$(hu(),1);var yh=$(J(),1);var uFe=$(St(),1);function l7r(t){let e=Zpi(t),r=yh.forwardRef((n,o)=>{let{children:i,...a}=n,s=yh.Children.toArray(i),u=s.find(Qpi);if(u){let l=u.props.children,c=s.map(d=>d===u?yh.Children.count(l)>1?yh.Children.only(null):yh.isValidElement(l)?l.props.children:null:d);return(0,uFe.jsx)(e,{...a,ref:o,children:yh.isValidElement(l)?yh.cloneElement(l,void 0,c):null})}return(0,uFe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Zpi(t){let e=yh.forwardRef((r,n)=>{let{children:o,...i}=r;if(yh.isValidElement(o)){let a=tmi(o),s=emi(i,o.props);return o.type!==yh.Fragment&&(s.ref=n?Wbt(n,a):a),yh.cloneElement(o,s)}return yh.Children.count(o)>1?yh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ypi=Symbol("radix.slottable");function Qpi(t){return yh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ypi}function emi(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 tmi(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 d7r=$(St(),1),nmi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iY=nmi.reduce((t,e)=>{let r=l7r(`Primitive.${e}`),n=c7r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,d7r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var bh=$(St(),1),f7r=["PageUp","PageDown"],p7r=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],m7r={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},aY="Slider",[Jbt,omi,imi]=vB(aY),[h7r,cFs]=r7r(aY,[imi]),[ami,lFe]=h7r(aY),g7r=Tu.forwardRef((t,e)=>{let{name:r,min:n=0,max:o=100,step:i=1,orientation:a="horizontal",disabled:s=!1,minStepsBetweenThumbs:u=0,defaultValue:l=[n],value:c,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:p=!1,form:m,...h}=t,y=Tu.useRef(new Set),g=Tu.useRef(0),_=a==="horizontal"?smi:umi,[w=[],T]=o7r({prop:c,defaultProp:l,onChange:N=>{[...y.current][g.current]?.focus(),d(N)}}),O=Tu.useRef(w);function E(N){let z=pmi(w,N);I(N,z)}function P(N){I(N,g.current)}function R(){let N=O.current[g.current];w[g.current]!==N&&f(w)}function I(N,z,{commit:V}={commit:!1}){let k=ymi(i),X=bmi(Math.round((N-n)/i)*i+n,k),B=DB(X,[n,o]);T((Q=[])=>{let Y=dmi(Q,B,z);if(gmi(Y,u*i)){g.current=Y.indexOf(B);let K=String(Y)!==String(Q);return K&&V&&f(Y),K?Y:Q}else return Q})}return(0,bh.jsx)(ami,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:y.current,values:w,orientation:a,form:m,children:(0,bh.jsx)(Jbt.Provider,{scope:t.__scopeSlider,children:(0,bh.jsx)(Jbt.Slot,{scope:t.__scopeSlider,children:(0,bh.jsx)(_,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:zW(h.onPointerDown,()=>{s||(O.current=w)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:P,onSlideEnd:s?void 0:R,onHomeKeyDown:()=>!s&&I(n,0,{commit:!0}),onEndKeyDown:()=>!s&&I(o,w.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:z})=>{if(!s){let X=f7r.includes(N.key)||N.shiftKey&&p7r.includes(N.key)?10:1,B=g.current,Q=w[B],Y=i*X*z;I(Q+Y,B,{commit:!0})}}})})})})});g7r.displayName=aY;var[y7r,b7r]=h7r(aY,{startEdge:"left",endEdge:"right",size:"width",direction:1}),smi=Tu.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=Tu.useState(null),p=VW(e,_=>f(_)),m=Tu.useRef(void 0),h=i7r(o),y=h==="ltr",g=y&&!i||!y&&i;function b(_){let w=m.current||d.getBoundingClientRect(),T=[0,w.width],E=Xbt(T,g?[r,n]:[n,r]);return m.current=w,E(_-w.left)}return(0,bh.jsx)(y7r,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,bh.jsx)(_7r,{dir:h,"data-orientation":"horizontal",...c,ref:p,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:_=>{let w=b(_.clientX);a?.(w)},onSlideMove:_=>{let w=b(_.clientX);s?.(w)},onSlideEnd:()=>{m.current=void 0,u?.()},onStepKeyDown:_=>{let T=m7r[g?"from-left":"from-right"].includes(_.key);l?.({event:_,direction:T?-1:1})}})})}),umi=Tu.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=Tu.useRef(null),d=VW(e,c),f=Tu.useRef(void 0),p=!o;function m(h){let y=f.current||c.current.getBoundingClientRect(),g=[0,y.height],_=Xbt(g,p?[n,r]:[r,n]);return f.current=y,_(h-y.top)}return(0,bh.jsx)(y7r,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,bh.jsx)(_7r,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let y=m(h.clientY);i?.(y)},onSlideMove:h=>{let y=m(h.clientY);a?.(y)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let g=m7r[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),_7r=Tu.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=lFe(aY,r);return(0,bh.jsx)(iY.span,{...l,ref:e,onKeyDown:zW(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):f7r.concat(p7r).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:zW(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:zW(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:zW(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),v7r="SliderTrack",w7r=Tu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=lFe(v7r,r);return(0,bh.jsx)(iY.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});w7r.displayName=v7r;var Kbt="SliderRange",S7r=Tu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=lFe(Kbt,r),i=b7r(Kbt,r),a=Tu.useRef(null),s=VW(e,a),u=o.values.length,l=o.values.map(f=>T7r(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,bh.jsx)(iY.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});S7r.displayName=Kbt;var Gbt="SliderThumb",C7r=Tu.forwardRef((t,e)=>{let r=omi(t.__scopeSlider),[n,o]=Tu.useState(null),i=VW(e,s=>o(s)),a=Tu.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,bh.jsx)(lmi,{...t,ref:i,index:a})}),lmi=Tu.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=lFe(Gbt,r),s=b7r(Gbt,r),[u,l]=Tu.useState(null),c=VW(e,b=>l(b)),d=u?a.form||!!u.closest("form"):!0,f=u7r(u),p=a.values[n],m=p===void 0?0:T7r(p,a.min,a.max),h=fmi(n,a.values.length),y=f?.[s.size],g=y?mmi(y,m,s.direction):0;return Tu.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,bh.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,bh.jsx)(Jbt.ItemSlot,{scope:t.__scopeSlider,children:(0,bh.jsx)(iY.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:zW(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,bh.jsx)(x7r,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});C7r.displayName=Gbt;var cmi="RadioBubbleInput",x7r=Tu.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=Tu.useRef(null),i=VW(o,n),a=a7r(e);return Tu.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("input",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,bh.jsx)(iY.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});x7r.displayName=cmi;function dmi(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function T7r(t,e,r){let i=100/(r-e)*(t-e);return DB(i,[0,100])}function fmi(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function pmi(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 mmi(t,e,r){let n=t/2,i=Xbt([0,50],[0,n]);return(n-i(e)*r)*r}function hmi(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function gmi(t,e){if(e>0){let r=hmi(t);return Math.min(...r)>=e}return!0}function Xbt(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 ymi(t){return(String(t).split(".")[1]||"").length}function bmi(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var Zbt=g7r,O7r=w7r,E7r=S7r,P7r=C7r;$r();var Jde=HW.forwardRef(({className:t,...e},r)=>HW.createElement(Zbt,{ref:r,className:we("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},HW.createElement(O7r,{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"},HW.createElement(E7r,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),HW.createElement(P7r,{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"})));Jde.displayName=Zbt.displayName;Cn();var Ou=$(J());var tr=$(J(),1),a_t=$(hu(),1);var pFs=!!(typeof window<"u"&&window.document&&window.document.createElement);function cg(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var R7r=$(J(),1);function M7r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ybt(...t){return e=>{let r=!1,n=t.map(o=>{let i=M7r(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():M7r(t[o],null)}}}}function ET(...t){return R7r.useCallback(Ybt(...t),t)}var oL=$(J(),1),I7r=$(St(),1);function A7r(t,e=[]){let r=[];function n(i,a){let s=oL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=oL.useMemo(()=>m,Object.values(m));return(0,I7r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=oL.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=>oL.createContext(a));return function(s){let u=s?.[t]||i;return oL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,vmi(o,...e)]}function vmi(...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 oL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var cFe=$(J(),1),wmi=$(St(),1),Smi=cFe.createContext(void 0);function N7r(t){let e=cFe.useContext(Smi);return t||e||"ltr"}var Qbt=$(J(),1);var D7r=$(J(),1),aS=globalThis?.document?D7r.useLayoutEffect:()=>{};var Cmi=Qbt[" useId ".trim().toString()]||(()=>{}),xmi=0;function dFe(t){let[e,r]=Qbt.useState(Cmi());return aS(()=>{t||r(n=>n??String(xmi++))},[t]),t||(e?`radix-${e}`:"")}var j7r=$(J(),1),Rmi=$(hu(),1);var _h=$(J(),1);var fFe=$(St(),1);function pFe(t){let e=Tmi(t),r=_h.forwardRef((n,o)=>{let{children:i,...a}=n,s=_h.Children.toArray(i),u=s.find(Emi);if(u){let l=u.props.children,c=s.map(d=>d===u?_h.Children.count(l)>1?_h.Children.only(null):_h.isValidElement(l)?l.props.children:null:d);return(0,fFe.jsx)(e,{...a,ref:o,children:_h.isValidElement(l)?_h.cloneElement(l,void 0,c):null})}return(0,fFe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Tmi(t){let e=_h.forwardRef((r,n)=>{let{children:o,...i}=r;if(_h.isValidElement(o)){let a=Mmi(o),s=Pmi(i,o.props);return o.type!==_h.Fragment&&(s.ref=n?Ybt(n,a):a),_h.cloneElement(o,s)}return _h.Children.count(o)>1?_h.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Omi=Symbol("radix.slottable");function Emi(t){return _h.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Omi}function Pmi(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 Mmi(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 $7r=$(St(),1),Imi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kv=Imi.reduce((t,e)=>{let r=pFe(`Primitive.${e}`),n=j7r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,$7r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var sY=$(J(),1);function L7r(t){let e=sY.useRef(t);return sY.useEffect(()=>{e.current=t}),sY.useMemo(()=>(...r)=>e.current?.(...r),[])}var TC=$(J(),1);var mFe=$(J(),1);var Ami=TC[" useInsertionEffect ".trim().toString()]||aS;function e_t({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Nmi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=TC.useRef(t!==void 0);TC.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=TC.useCallback(c=>{if(s){let d=Dmi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Nmi({defaultProp:t,onChange:e}){let[r,n]=TC.useState(t),o=TC.useRef(r),i=TC.useRef(e);return Ami(()=>{i.current=e},[e]),TC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Dmi(t){return typeof t=="function"}var EFs=Symbol("RADIX:SYNC_STATE");var hFe=$(J(),1);function F7r(t){let e=hFe.useRef({value:t,previous:t});return hFe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Rn=$(St(),1),jmi=[" ","Enter","ArrowUp","ArrowDown"],$mi=[" ","Enter"],WW="Select",[yFe,bFe,Lmi]=vB(WW),[uY,ZFs]=A7r(WW,[Lmi,fC]),_Fe=fC(),[Fmi,LB]=uY(WW),[kmi,qmi]=uY(WW),k7r=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=_Fe(e),[y,g]=tr.useState(null),[b,_]=tr.useState(null),[w,T]=tr.useState(!1),O=N7r(l),[E,P]=e_t({prop:n,defaultProp:o??!1,onChange:i,caller:WW}),[R,I]=e_t({prop:a,defaultProp:s,onChange:u,caller:WW}),N=tr.useRef(null),z=y?m||!!y.closest("form"):!0,[V,k]=tr.useState(new Set),X=Array.from(V).map(B=>B.props.value).join(";");return(0,Rn.jsx)(z$,{...h,children:(0,Rn.jsxs)(Fmi,{required:p,scope:e,trigger:y,onTriggerChange:g,valueNode:b,onValueNodeChange:_,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:dFe(),value:R,onValueChange:I,open:E,onOpenChange:P,dir:O,triggerPointerDownPosRef:N,disabled:f,children:[(0,Rn.jsx)(yFe.Provider,{scope:e,children:(0,Rn.jsx)(kmi,{scope:t.__scopeSelect,onNativeOptionAdd:tr.useCallback(B=>{k(Q=>new Set(Q).add(B))},[]),onNativeOptionRemove:tr.useCallback(B=>{k(Q=>{let Y=new Set(Q);return Y.delete(B),Y})},[]),children:r})}),z?(0,Rn.jsxs)(lXr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:R,onChange:B=>I(B.target.value),disabled:f,form:m,children:[R===void 0?(0,Rn.jsx)("option",{value:""}):null,Array.from(V)]},X):null]})})};k7r.displayName=WW;var q7r="SelectTrigger",U7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=_Fe(r),a=LB(q7r,r),s=a.disabled||n,u=ET(e,a.onTriggerChange),l=bFe(r),c=tr.useRef("touch"),[d,f,p]=dXr(h=>{let y=l().filter(_=>!_.disabled),g=y.find(_=>_.value===a.value),b=fXr(y,h,g);b!==void 0&&a.onValueChange(b.value)}),m=h=>{s||(a.onOpenChange(!0),p()),h&&(a.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return(0,Rn.jsx)(V$,{asChild:!0,...i,children:(0,Rn.jsx)(kv.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":cXr(a.value)?"":void 0,...o,ref:u,onClick:cg(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:cg(o.onPointerDown,h=>{c.current=h.pointerType;let y=h.target;y.hasPointerCapture(h.pointerId)&&y.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:cg(o.onKeyDown,h=>{let y=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(y&&h.key===" ")&&jmi.includes(h.key)&&(m(),h.preventDefault())})})})});U7r.displayName=q7r;var B7r="SelectValue",z7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=LB(B7r,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=ET(e,u.onValueNodeChange);return aS(()=>{l(c)},[l,c]),(0,Rn.jsx)(kv.span,{...s,ref:d,style:{pointerEvents:"none"},children:cXr(u.value)?(0,Rn.jsx)(Rn.Fragment,{children:a}):i})});z7r.displayName=B7r;var Umi="SelectIcon",V7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,Rn.jsx)(kv.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});V7r.displayName=Umi;var Bmi="SelectPortal",H7r=t=>(0,Rn.jsx)(xT,{asChild:!0,...t});H7r.displayName=Bmi;var JW="SelectContent",W7r=tr.forwardRef((t,e)=>{let r=LB(JW,t.__scopeSelect),[n,o]=tr.useState();if(aS(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?a_t.createPortal((0,Rn.jsx)(J7r,{scope:t.__scopeSelect,children:(0,Rn.jsx)(yFe.Slot,{scope:t.__scopeSelect,children:(0,Rn.jsx)("div",{children:t.children})})}),i):null}return(0,Rn.jsx)(K7r,{...t,ref:e})});W7r.displayName=JW;var PT=10,[J7r,FB]=uY(JW),zmi="SelectContentImpl",Vmi=pFe("SelectContent.RemoveScroll"),K7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y,...g}=t,b=LB(JW,r),[_,w]=tr.useState(null),[T,O]=tr.useState(null),E=ET(e,A=>w(A)),[P,R]=tr.useState(null),[I,N]=tr.useState(null),z=bFe(r),[V,k]=tr.useState(!1),X=tr.useRef(!1);tr.useEffect(()=>{if(_)return TB(_)},[_]),SB();let B=tr.useCallback(A=>{let[U,...H]=z().map(le=>le.ref.current),[re]=H.slice(-1),Z=document.activeElement;for(let le of A)if(le===Z||(le?.scrollIntoView({block:"nearest"}),le===U&&T&&(T.scrollTop=0),le===re&&T&&(T.scrollTop=T.scrollHeight),le?.focus(),document.activeElement!==Z))return},[z,T]),Q=tr.useCallback(()=>B([P,_]),[B,P,_]);tr.useEffect(()=>{V&&Q()},[V,Q]);let{onOpenChange:Y,triggerPointerDownPosRef:K}=b;tr.useEffect(()=>{if(_){let A={x:0,y:0},U=re=>{A={x:Math.abs(Math.round(re.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(re.pageY)-(K.current?.y??0))}},H=re=>{A.x<=10&&A.y<=10?re.preventDefault():_.contains(re.target)||Y(!1),document.removeEventListener("pointermove",U),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",U),document.addEventListener("pointerup",H,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",U),document.removeEventListener("pointerup",H,{capture:!0})}}},[_,Y,K]),tr.useEffect(()=>{let A=()=>Y(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[Y]);let[oe,ue]=dXr(A=>{let U=z().filter(Z=>!Z.disabled),H=U.find(Z=>Z.ref.current===document.activeElement),re=fXr(U,A,H);re&&setTimeout(()=>re.ref.current.focus())}),de=tr.useCallback((A,U,H)=>{let re=!X.current&&!H;(b.value!==void 0&&b.value===U||re)&&(R(A),re&&(X.current=!0))},[b.value]),L=tr.useCallback(()=>_?.focus(),[_]),W=tr.useCallback((A,U,H)=>{let re=!X.current&&!H;(b.value!==void 0&&b.value===U||re)&&N(A)},[b.value]),ie=n==="popper"?t_t:G7r,j=ie===t_t?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y}:{};return(0,Rn.jsx)(J7r,{scope:r,content:_,viewport:T,onViewportChange:O,itemRefCallback:de,selectedItem:P,onItemLeave:L,itemTextRefCallback:W,focusSelectedItem:Q,selectedItemText:I,position:n,isPositioned:V,searchRef:oe,children:(0,Rn.jsx)(Z$,{as:Vmi,allowPinchZoom:!0,children:(0,Rn.jsx)(G$,{asChild:!0,trapped:b.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:cg(o,A=>{b.trigger?.focus({preventScroll:!0}),A.preventDefault()}),children:(0,Rn.jsx)(_T,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,Rn.jsx)(ie,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:A=>A.preventDefault(),...g,...j,onPlaced:()=>k(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:cg(g.onKeyDown,A=>{let U=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!U&&A.key.length===1&&ue(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let re=z().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);if(["ArrowUp","End"].includes(A.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){let Z=A.target,le=re.indexOf(Z);re=re.slice(le+1)}setTimeout(()=>B(re)),A.preventDefault()}})})})})})})});K7r.displayName=zmi;var Hmi="SelectItemAlignedPosition",G7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=LB(JW,r),a=FB(JW,r),[s,u]=tr.useState(null),[l,c]=tr.useState(null),d=ET(e,E=>c(E)),f=bFe(r),p=tr.useRef(!1),m=tr.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:g,focusSelectedItem:b}=a,_=tr.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&y&&g){let E=i.trigger.getBoundingClientRect(),P=l.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),I=g.getBoundingClientRect();if(i.dir!=="rtl"){let Z=I.left-P.left,le=R.left-Z,Ce=E.left-le,He=E.width+Ce,lt=Math.max(He,P.width),qe=window.innerWidth-PT,Nt=DB(le,[PT,Math.max(PT,qe-lt)]);s.style.minWidth=He+"px",s.style.left=Nt+"px"}else{let Z=P.right-I.right,le=window.innerWidth-R.right-Z,Ce=window.innerWidth-E.right-le,He=E.width+Ce,lt=Math.max(He,P.width),qe=window.innerWidth-PT,Nt=DB(le,[PT,Math.max(PT,qe-lt)]);s.style.minWidth=He+"px",s.style.right=Nt+"px"}let N=f(),z=window.innerHeight-PT*2,V=h.scrollHeight,k=window.getComputedStyle(l),X=parseInt(k.borderTopWidth,10),B=parseInt(k.paddingTop,10),Q=parseInt(k.borderBottomWidth,10),Y=parseInt(k.paddingBottom,10),K=X+B+V+Y+Q,oe=Math.min(y.offsetHeight*5,K),ue=window.getComputedStyle(h),de=parseInt(ue.paddingTop,10),L=parseInt(ue.paddingBottom,10),W=E.top+E.height/2-PT,ie=z-W,j=y.offsetHeight/2,A=y.offsetTop+j,U=X+B+A,H=K-U;if(U<=W){let Z=N.length>0&&y===N[N.length-1].ref.current;s.style.bottom="0px";let le=l.clientHeight-h.offsetTop-h.offsetHeight,Ce=Math.max(ie,j+(Z?L:0)+le+Q),He=U+Ce;s.style.height=He+"px"}else{let Z=N.length>0&&y===N[0].ref.current;s.style.top="0px";let Ce=Math.max(W,X+h.offsetTop+(Z?de:0)+j)+H;s.style.height=Ce+"px",h.scrollTop=U-W+h.offsetTop}s.style.margin=`${PT}px 0`,s.style.minHeight=oe+"px",s.style.maxHeight=z+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,y,g,i.dir,n]);aS(()=>_(),[_]);let[w,T]=tr.useState();aS(()=>{l&&T(window.getComputedStyle(l).zIndex)},[l]);let O=tr.useCallback(E=>{E&&m.current===!0&&(_(),b?.(),m.current=!1)},[_,b]);return(0,Rn.jsx)(Jmi,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:O,children:(0,Rn.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,Rn.jsx)(kv.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});G7r.displayName=Hmi;var Wmi="SelectPopperPosition",t_t=tr.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=PT,...i}=t,a=_Fe(r);return(0,Rn.jsx)(yB,{...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)"}})});t_t.displayName=Wmi;var[Jmi,s_t]=uY(JW,{}),r_t="SelectViewport",X7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=FB(r_t,r),a=s_t(r_t,r),s=ET(e,i.onViewportChange),u=tr.useRef(0);return(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.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,Rn.jsx)(yFe.Slot,{scope:r,children:(0,Rn.jsx)(kv.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:cg(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-PT*2,h=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),g=Math.max(h,y);if(g<m){let b=g+p,_=Math.min(m,b),w=b-_;d.style.height=_+"px",d.style.bottom==="0px"&&(c.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})});X7r.displayName=r_t;var Z7r="SelectGroup",[Kmi,Gmi]=uY(Z7r),Xmi=tr.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=dFe();return(0,Rn.jsx)(Kmi,{scope:r,id:o,children:(0,Rn.jsx)(kv.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Xmi.displayName=Z7r;var Y7r="SelectLabel",Q7r=tr.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Gmi(Y7r,r);return(0,Rn.jsx)(kv.div,{id:o.id,...n,ref:e})});Q7r.displayName=Y7r;var gFe="SelectItem",[Zmi,eXr]=uY(gFe),tXr=tr.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=LB(gFe,r),u=FB(gFe,r),l=s.value===n,[c,d]=tr.useState(i??""),[f,p]=tr.useState(!1),m=ET(e,b=>u.itemRefCallback?.(b,n,o)),h=dFe(),y=tr.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,Rn.jsx)(Zmi,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:tr.useCallback(b=>{d(_=>_||(b?.textContent??"").trim())},[]),children:(0,Rn.jsx)(yFe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,Rn.jsx)(kv.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:cg(a.onFocus,()=>p(!0)),onBlur:cg(a.onBlur,()=>p(!1)),onClick:cg(a.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:cg(a.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:cg(a.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:cg(a.onPointerMove,b=>{y.current=b.pointerType,o?u.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:cg(a.onPointerLeave,b=>{b.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:cg(a.onKeyDown,b=>{u.searchRef?.current!==""&&b.key===" "||($mi.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});tXr.displayName=gFe;var Kde="SelectItemText",rXr=tr.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=LB(Kde,r),s=FB(Kde,r),u=eXr(Kde,r),l=qmi(Kde,r),[c,d]=tr.useState(null),f=ET(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=tr.useMemo(()=>(0,Rn.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=l;return aS(()=>(h(m),()=>y(m)),[h,y,m]),(0,Rn.jsxs)(Rn.Fragment,{children:[(0,Rn.jsx)(kv.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?a_t.createPortal(i.children,a.valueNode):null]})});rXr.displayName=Kde;var nXr="SelectItemIndicator",oXr=tr.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return eXr(nXr,r).isSelected?(0,Rn.jsx)(kv.span,{"aria-hidden":!0,...n,ref:e}):null});oXr.displayName=nXr;var n_t="SelectScrollUpButton",iXr=tr.forwardRef((t,e)=>{let r=FB(n_t,t.__scopeSelect),n=s_t(n_t,t.__scopeSelect),[o,i]=tr.useState(!1),a=ET(e,n.onScrollButtonChange);return aS(()=>{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,Rn.jsx)(sXr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});iXr.displayName=n_t;var o_t="SelectScrollDownButton",aXr=tr.forwardRef((t,e)=>{let r=FB(o_t,t.__scopeSelect),n=s_t(o_t,t.__scopeSelect),[o,i]=tr.useState(!1),a=ET(e,n.onScrollButtonChange);return aS(()=>{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,Rn.jsx)(sXr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});aXr.displayName=o_t;var sXr=tr.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=FB("SelectScrollButton",r),a=tr.useRef(null),s=bFe(r),u=tr.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return tr.useEffect(()=>()=>u(),[u]),aS(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,Rn.jsx)(kv.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:cg(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:cg(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:cg(o.onPointerLeave,()=>{u()})})}),Ymi="SelectSeparator",uXr=tr.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,Rn.jsx)(kv.div,{"aria-hidden":!0,...n,ref:e})});uXr.displayName=Ymi;var i_t="SelectArrow",Qmi=tr.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=_Fe(r),i=LB(i_t,r),a=FB(i_t,r);return i.open&&a.position==="popper"?(0,Rn.jsx)(bB,{...o,...n,ref:e}):null});Qmi.displayName=i_t;var ehi="SelectBubbleInput",lXr=tr.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{let o=tr.useRef(null),i=ET(n,o),a=F7r(e);return tr.useEffect(()=>{let s=o.current;if(!s)return;let u=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==e&&c){let d=new Event("change",{bubbles:!0});c.call(s,e),s.dispatchEvent(d)}},[a,e]),(0,Rn.jsx)(kv.select,{...r,style:{...nyt,...r.style},ref:i,defaultValue:e})});lXr.displayName=ehi;function cXr(t){return t===""||t===void 0}function dXr(t){let e=L7r(t),r=tr.useRef(""),n=tr.useRef(0),o=tr.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=tr.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return tr.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function fXr(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=thi(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 thi(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var pXr=k7r,u_t=U7r,mXr=z7r,hXr=V7r,gXr=H7r,l_t=W7r,yXr=X7r;var c_t=Q7r,d_t=tXr,bXr=rXr,_Xr=oXr,f_t=iXr,p_t=aXr,m_t=uXr;Or();$r();var KW=pXr;var GW=mXr,kB=Ou.forwardRef(({className:t,children:e,...r},n)=>Ou.createElement(u_t,{ref:n,className:we("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,Ou.createElement(hXr,{asChild:!0},Ou.createElement(Wi,{className:"tw-size-4"}))));kB.displayName=u_t.displayName;var vXr=Ou.forwardRef(({className:t,...e},r)=>Ou.createElement(f_t,{ref:r,className:we("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Ou.createElement(jg,{className:"tw-size-4"})));vXr.displayName=f_t.displayName;var wXr=Ou.forwardRef(({className:t,...e},r)=>Ou.createElement(p_t,{ref:r,className:we("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Ou.createElement(Wi,{className:"tw-size-4"})));wXr.displayName=p_t.displayName;var qB=Ou.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>Ou.createElement(gXr,{container:n},Ou.createElement(l_t,{ref:i,className:we("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},Ou.createElement(vXr,null),Ou.createElement(yXr,{className:we("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),Ou.createElement(wXr,null))));qB.displayName=l_t.displayName;var nhi=Ou.forwardRef(({className:t,...e},r)=>Ou.createElement(c_t,{ref:r,className:we("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));nhi.displayName=c_t.displayName;var UB=Ou.forwardRef(({className:t,children:e,...r},n)=>Ou.createElement(d_t,{ref:n,className:we("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},Ou.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Ou.createElement(_Xr,null,Ou.createElement(Yu,{className:"tw-size-4"}))),Ou.createElement(bXr,null,e)));UB.displayName=d_t.displayName;var ohi=Ou.forwardRef(({className:t,...e},r)=>Ou.createElement(m_t,{ref:r,className:we("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));ohi.displayName=m_t.displayName;Or();function XW(t){let{label:e,helpText:r,disableFn:n,optional:o=!0}=t,i=t.type,a=o?t.value!==void 0:!0,[s,u]=(0,fu.useState)(a),l=()=>{o&&(u(!s),s?n?.():i==="slider"?t.onChange(t.value??t.defaultValue??0):t.onChange(t.value??t.defaultValue??t.options[0]?.value??""))},c=f=>{s&&i==="slider"&&t.onChange(f[0])},d=f=>{s&&i==="select"&&t.onChange(f)};return fu.default.createElement("div",{className:"tw-space-y-3"},fu.default.createElement(y_,{delayDuration:0},fu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},fu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},fu.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&fu.default.createElement(to,{buttonClassName:"tw-size-4 tw-text-muted",content:fu.default.createElement("div",{className:"tw-max-w-[300px]"},r)})),fu.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},fu.default.createElement("span",{className:`tw-min-w-8 tw-text-right tw-font-mono tw-text-sm ${s?"tw-text-normal":"tw-text-muted"}`},s?t.value??t.defaultValue:"\u2014"),o&&fu.default.createElement(yn,null,fu.default.createElement(bn,{asChild:!0},fu.default.createElement(pe,{variant:"ghost2",size:"sm",onClick:l,className:`tw-size-8 tw-p-0 ${s?"tw-text-accent/80 hover:tw-text-accent":"tw-text-muted hover:tw-text-normal"}`},s?fu.default.createElement(fne,{className:"tw-size-4"}):fu.default.createElement(dne,{className:"tw-size-4"}))),fu.default.createElement(dn,{side:"bottom"},fu.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),fu.default.createElement("div",{className:"tw-relative"},i==="slider"?fu.default.createElement(fu.default.Fragment,null,fu.default.createElement(Jde,{value:[s?t.value??t.defaultValue??0:t.min??0],onValueChange:c,min:t.min??0,max:t.max??1,step:t.step,disabled:!s,className:`tw-w-full ${s?"":"tw-opacity-40"}`}),!s&&o&&fu.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):fu.default.createElement(KW,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},fu.default.createElement(kB,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},fu.default.createElement(GW,{placeholder:"Select an option"})),fu.default.createElement(qB,null,t.options.map(f=>fu.default.createElement(UB,{key:f.value,value:f.value},f.label))))))}mr();mr();var SXr=[{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra High"}],CXr=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function xXr(){return Hb.REASONING_EFFORT}function TXr(){return Hb.VERBOSITY}var vh={temperature:{min:0,max:2,step:.01,default:Hb.TEMPERATURE},topP:{min:0,max:1,step:.05,default:.9},frequencyPenalty:{min:0,max:2,step:.05,default:0},maxTokens:{min:100,max:128e3,step:100,default:Hb.MAX_TOKENS}};function vFe({model:t,settings:e,onChange:r,onReset:n,showTokenLimit:o=!0}){let i=t.temperature??e.temperature,a=t.maxTokens??e.maxTokens,s=t.topP,u=t.frequencyPenalty,l=t.reasoningEffort,c=t.verbosity,d=(t.name.startsWith("o1")||t.name.startsWith("o3")||t.name.startsWith("o4")||t.name.startsWith("gpt-5"))&&t.provider==="openai",f=t.capabilities?.includes("reasoning")??!1,p=d||t.provider==="openrouterai"||t.provider==="lm_studio"||f,m=t.name.startsWith("gpt-5")&&t.provider==="openai";return bi.default.createElement("div",{className:"tw-space-y-4"},o&&bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"slider",optional:!1,label:"Token limit",value:a,onChange:h=>r("maxTokens",h),max:vh.maxTokens.max,min:vh.maxTokens.min,step:vh.maxTokens.step,defaultValue:vh.maxTokens.default,helpText:bi.default.createElement(bi.default.Fragment,null,bi.default.createElement("p",null,"The maximum number of ",bi.default.createElement("em",null,"output tokens")," to generate. Default is"," ",vh.maxTokens.default,"."),bi.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"slider",optional:!1,label:"Temperature",value:i,onChange:h=>r("temperature",h),min:vh.temperature.min,max:vh.temperature.max,step:vh.temperature.step,defaultValue:vh.temperature.default,helpText:`Default is ${vh.temperature.default}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"slider",optional:!0,label:"Top-P",value:s,onChange:h=>r("topP",h),disableFn:n?()=>n("topP"):void 0,min:vh.topP.min,max:vh.topP.max,step:vh.topP.step,defaultValue:vh.topP.default,helpText:`Default value is ${vh.topP.default}, the smaller the value, the less variety in the answers, the easier to understand, the larger the value, the larger the range of the AI's vocabulary, the more diverse`})),bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"slider",optional:!0,label:"Frequency Penalty",value:u,onChange:h=>r("frequencyPenalty",h),disableFn:n?()=>n("frequencyPenalty"):void 0,min:vh.frequencyPenalty.min,max:vh.frequencyPenalty.max,step:vh.frequencyPenalty.step,defaultValue:vh.frequencyPenalty.default,helpText:bi.default.createElement(bi.default.Fragment,null,bi.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."),bi.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),p&&bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"select",optional:!0,label:"Reasoning Effort",value:l,onChange:h=>r("reasoningEffort",h),disableFn:n?()=>n("reasoningEffort"):void 0,defaultValue:e.reasoningEffort??xXr(),options:[...t.name.startsWith("gpt-5")&&t.provider==="openai"?[{value:"minimal",label:"Minimal"}]:[],...SXr.filter(h=>h.value!=="minimal"&&h.value!=="xhigh"),...t.name.startsWith("gpt-5.2")&&t.provider==="openai"?[{value:"xhigh",label:"Extra High"}]:[]],helpText:bi.default.createElement(bi.default.Fragment,null,bi.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer."),bi.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},t.name.startsWith("gpt-5")&&t.provider==="openai"&&bi.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),bi.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),bi.default.createElement("li",null,"Medium: Balanced performance"),bi.default.createElement("li",null,"High: Thorough reasoning, slower responses"),t.name.startsWith("gpt-5.2")&&t.provider==="openai"&&bi.default.createElement("li",null,"Extra High: Maximum reasoning depth (GPT-5.2 only)")),!f&&!d&&bi.default.createElement("p",{className:"tw-mt-2 tw-text-warning"},'Enable the "Reasoning" capability above to use this feature.'))})),m&&bi.default.createElement(Vo,null,bi.default.createElement(XW,{type:"select",optional:!0,label:"Verbosity",value:c,onChange:h=>r("verbosity",h),disableFn:n?()=>n("verbosity"):void 0,defaultValue:e.verbosity??TXr(),options:CXr,helpText:bi.default.createElement(bi.default.Fragment,null,bi.default.createElement("p",null,"Controls the length and detail of the model responses."),bi.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},bi.default.createElement("li",null,"Low: Concise, brief responses"),bi.default.createElement("li",null,"Medium: Balanced detail"),bi.default.createElement("li",null,"High: Detailed, comprehensive responses")))})))}ra();Ye();var OXr=$(a9());var ahi=["topP","frequencyPenalty","reasoningEffort","verbosity"];function EXr(){let t=te(),e=B_(),r=t.activeModels.find(R=>`${R.name}|${R.provider}`===e),[n,o]=(0,dr.useState)(r),i=rje(),[a,s]=Z4r(),u=oje(),l=R=>R?i.some(I=>I.title===R):!1,c=l(a)?a:l(u)?u:"",[d,f]=(0,dr.useState)(Tle()),[p,m]=(0,dr.useState)(!1),h=(0,dr.useRef)(null);(0,dr.useEffect)(()=>{o(r)},[r]),(0,dr.useEffect)(()=>{p&&h.current&&h.current.scrollIntoView({behavior:"smooth",block:"end"})},[p]);let y=(0,dr.useMemo)(()=>(0,OXr.default)(R=>{let I=t.activeModels.map(N=>`${N.name}|${N.provider}`===e?R:N);Re("activeModels",I)},500),[t.activeModels,e]);(0,dr.useEffect)(()=>()=>{y.flush(),y.cancel()},[y]);let g=(0,dr.useCallback)(R=>{if(R||y.flush(),R){let I=Tle();f(I),I||m(!1)}},[y]),b=(0,dr.useCallback)((R,I)=>{if(!n)return;let N={...n,[R]:I};o(N),y(N)},[n,y]),_=(0,dr.useCallback)(R=>{if(!n)return;let I={...n};delete I[R],o(I),y(I)},[n,y]),w=(0,dr.useCallback)(()=>{if(n){let R={...n};ahi.forEach(I=>delete R[I]),o(R),y(R)}s(""),f(!1),m(!1),xle(!1)},[n,y,s]),T=R=>{R?m(!0):(f(!1),m(!1),xle(!1))},O=()=>{f(!0),m(!1),xle(!0)},E=()=>{m(!1)},P=()=>{if(!c)return;let R=vC(c);app.workspace.openLinkText(R,"",!0)};return n?dr.default.createElement(IB,{onOpenChange:g},dr.default.createElement(yn,null,dr.default.createElement(bn,{asChild:!0},dr.default.createElement(AB,{asChild:!0},dr.default.createElement(pe,{variant:"ghost2",size:"icon"},dr.default.createElement(lne,{className:"tw-size-4"})))),dr.default.createElement(dn,null,"Chat Settings")),dr.default.createElement(eL,{className:"tw-w-80 tw-rounded-md tw-p-0",align:"end"},dr.default.createElement("div",{className:"tw-flex tw-max-h-[500px] tw-flex-col"},dr.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-px-4"},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},dr.default.createElement("h3",{className:"tw-font-semibold"},"Chat Settings"),dr.default.createElement(pe,{variant:"ghost",size:"sm",onClick:w,className:"tw-h-8 tw-text-xs"},dr.default.createElement(Z4,{className:"tw-mr-1 tw-size-3"}),"Reset"))),dr.default.createElement(CC,null),dr.default.createElement($B,{className:"tw-flex-1 tw-overflow-y-auto"},dr.default.createElement("div",{className:"tw-space-y-4 tw-p-4"},dr.default.createElement("div",{className:"tw-space-y-2"},dr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},dr.default.createElement(Xc,{htmlFor:"system-prompt",className:"tw-text-sm sm:tw-min-w-fit"},"System Prompt"),dr.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2 sm:tw-flex-1"},dr.default.createElement(_N,{value:c,onChange:R=>{let I=R.target.value;I&&l(I)&&s(I)},options:i.map(R=>({label:R.title===u?`${R.title} (Default)`:R.title,value:R.title})),placeholder:"Select system prompt",containerClassName:"tw-flex-1"}),dr.default.createElement(pe,{variant:"ghost",size:"icon",onClick:P,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!c},dr.default.createElement(E1,{className:"tw-size-5"}))))),dr.default.createElement(vFe,{model:n,settings:t,onChange:b,onReset:_,showTokenLimit:!0}),dr.default.createElement(CC,null),dr.default.createElement("div",{className:"tw-space-y-3"},dr.default.createElement("div",{className:"tw-space-y-1.5"},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},dr.default.createElement(Xc,{htmlFor:"disable-builtin",className:"tw-text-sm tw-font-medium"},"Disable Builtin System Prompt"),dr.default.createElement(dT,{checked:d,onCheckedChange:T,disabled:p})),dr.default.createElement("div",{className:"tw-pr-12 tw-text-xs tw-leading-relaxed tw-text-muted"},"Disables the builtin system prompt and only uses your custom system prompt."," ",dr.default.createElement("span",{className:"tw-text-xs tw-text-error"},"WARNING: This may break expected functionality."))),(d||p)&&dr.default.createElement("div",{ref:h,className:"tw-rounded-md tw-border tw-bg-error/10 tw-p-3 tw-border-error/50"},dr.default.createElement("div",{className:"tw-flex tw-gap-2"},dr.default.createElement(Lg,{className:"tw-mt-0.5 tw-size-4 tw-shrink-0 tw-text-error"}),dr.default.createElement("div",{className:"tw-flex-1 tw-space-y-2"},dr.default.createElement("div",{className:"tw-space-y-1"},dr.default.createElement("div",{className:"tw-text-xs tw-font-semibold tw-text-error"},"Copilot Plus Features Will Become Unavailable"),dr.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-gap-2 tw-text-xs tw-leading-relaxed tw-text-muted"},dr.default.createElement("div",null,"When enabled, advanced features such as vault search, web search, and agent mode will become unavailable."," "),dr.default.createElement("div",{className:"tw-italic"},"Only your custom system prompt (configured in Settings) will be used."))),p&&dr.default.createElement("div",{className:"tw-flex tw-gap-2 tw-pt-1"},dr.default.createElement(pe,{size:"sm",variant:"destructive",onClick:O,className:"tw-h-7 tw-text-xs"},"Disable Builtin"),dr.default.createElement(pe,{size:"sm",variant:"ghost",onClick:E,className:"tw-h-7 tw-bg-transparent tw-text-xs"},"Cancel")))))))),dr.default.createElement(CC,null),dr.default.createElement("div",{className:"tw-shrink-0 tw-rounded-md tw-bg-primary tw-px-4 tw-py-1"},dr.default.createElement("div",{className:"tw-flex tw-flex-row tw-flex-wrap"},dr.default.createElement("span",{className:"tw-text-xs tw-text-normal"},dr.default.createElement("span",{className:" tw-italic"},"System Prompt and Disable Builtin System Prompt")," ",dr.default.createElement("strong",null,"apply to this chat session only"),";",dr.default.createElement("br",null),"other settings are ",dr.default.createElement("strong",null,"bound to the current model"),".")))))):null}async function shi(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Ye(),x4));t().enableSemanticSearchV3?await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0}):new sS.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new sS.Notice("Failed to refresh vault index. Check console for details.")}}async function uhi(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Ye(),x4));t().enableSemanticSearchV3?await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!0,{userInitiated:!0}):new sS.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new sS.Notice("Failed to force reindex vault. Check console for details.")}}async function wFe(){let t=Gu();if(!t){new sS.Notice("No project is currently selected to reload.");return}try{wO(!0),await Fw.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new sS.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ne("Error reloading project context:",e),DD(e)||new sS.Notice("Failed to reload project context. Check console for details.")}finally{wO(!1)}}async function lhi(){let t=Gu();if(!t){new sS.Notice("No project is currently selected to rebuild.");return}new zu(app,async()=>{try{wO(!0),new sS.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),Iae.resetRateLimitNoticeTimer(),await Fw.getInstance().clearForProject(t),new sS.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 sS.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ne("Error force rebuilding project context:",r),DD(r)||new sS.Notice("Failed to force rebuild project context. Check console for details.")}finally{wO(!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 PXr({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o,chatHistory:i,onUpdateChatTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l,latestTokenCount:c}){let d=Br(),[f,p]=fw(),m=o9(),h=async y=>{f==="project"&&y!=="project"&&d.autosaveChat&&await e(),p(y),n(y),y!=="project"&&(D4(null),o?.())};return pr.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},pr.default.createElement("div",{className:"tw-flex-1"},pr.default.createElement(Nde,null,pr.default.createElement(Dde,{asChild:!0},pr.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-ml-1 tw-text-sm tw-text-muted"},f==="llm_chain"&&"chat (free)",f==="vault_qa"&&"vault QA (free)",f==="copilot_plus"&&pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pr.default.createElement(zy,{className:"tw-size-4"}),"copilot plus"),f==="project"&&"projects (alpha)",pr.default.createElement(Wi,{className:"tw-mt-0.5 tw-size-5"}))),pr.default.createElement(Dv,{align:"start"},pr.default.createElement(Ni,{onSelect:()=>{h("llm_chain")}},"chat (free)"),pr.default.createElement(Ni,{onSelect:()=>{h("vault_qa")}},"vault QA (free)"),m?pr.default.createElement(Ni,{onSelect:()=>{h("copilot_plus")}},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pr.default.createElement(zy,{className:"tw-size-4"}),"copilot plus")):pr.default.createElement(Ni,{onSelect:()=>{t2(m1.CHAT_MODE_SELECT),o?.()}},"copilot plus",pr.default.createElement(I1,{className:"tw-size-3"})),m?pr.default.createElement(Ni,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{h("project")}},pr.default.createElement(X4,{className:"tw-size-4"}),"projects (alpha)"):pr.default.createElement(Ni,{onSelect:()=>{t2(m1.CHAT_MODE_SELECT),o?.()}},"copilot plus",pr.default.createElement(I1,{className:"tw-size-3"}))))),pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pr.default.createElement("div",{className:"tw-mr-2"},pr.default.createElement(B9r,{tokenCount:c??null})),pr.default.createElement(yn,null,pr.default.createElement(bn,{asChild:!0},pr.default.createElement(pe,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},pr.default.createElement(nne,{className:"tw-size-4"}))),pr.default.createElement(dn,null,"New Chat")),f!=="project"&&pr.default.createElement(EXr,null),!d.autosaveChat&&pr.default.createElement(yn,null,pr.default.createElement(bn,{asChild:!0},pr.default.createElement(pe,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},pr.default.createElement(Wre,{className:"tw-size-4"}))),pr.default.createElement(dn,null,"Save Chat as Note")),pr.default.createElement(yn,null,pr.default.createElement(U9r,{chatHistory:i,onUpdateTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l},pr.default.createElement(bn,{asChild:!0},pr.default.createElement(pe,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},pr.default.createElement(Qre,{className:"tw-size-4"})))),pr.default.createElement(dn,null,"Chat History")),pr.default.createElement(Nde,null,pr.default.createElement(Dde,{asChild:!0},pr.default.createElement(pe,{variant:"ghost2",size:"icon",title:"Advanced Settings"},pr.default.createElement(HF,{className:"tw-size-4"}))),pr.default.createElement(Dv,{align:"end",className:"tw-w-64"},pr.default.createElement(Ni,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("showSuggestedPrompts",!d.showSuggestedPrompts)}},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(zy,{className:"tw-size-4"}),"Suggested Prompt"),pr.default.createElement(dT,{checked:d.showSuggestedPrompts})),pr.default.createElement(Ni,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("showRelevantNotes",!d.showRelevantNotes)}},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(Du,{className:"tw-size-4"}),"Relevant Note"),pr.default.createElement(dT,{checked:d.showRelevantNotes})),pr.default.createElement(Ni,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Re("autoAcceptEdits",!d.autoAcceptEdits)}},pr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},pr.default.createElement(K_,{className:"tw-size-4"}),"Auto-accept Edits"),pr.default.createElement(dT,{checked:d.autoAcceptEdits})),f==="project"?pr.default.createElement(pr.default.Fragment,null,pr.default.createElement(Ni,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>wFe()},pr.default.createElement(KF,{className:"tw-size-4"}),"Reload Current Project"),pr.default.createElement(Ni,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>lhi()},pr.default.createElement(Lg,{className:"tw-size-4"}),"Force Rebuild Context")):pr.default.createElement(pr.default.Fragment,null,pr.default.createElement(Ni,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>shi()},pr.default.createElement(KF,{className:"tw-size-4"}),"Refresh Vault Index"),pr.default.createElement(Ni,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new zu(app,()=>uhi(),"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()}},pr.default.createElement(Lg,{className:"tw-size-4"}),"Force Reindex Vault"))))))}ra();sd();var SFe=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()}};Cn();var sr=$(J());Or();Cn();sd();$r();Ye();Bt();var MXr=({vaultToggle:t,setVaultToggle:e,webToggle:r,setWebToggle:n,composerToggle:o,setComposerToggle:i,autonomousAgentToggle:a,setAutonomousAgentToggle:s,onVaultToggleOff:u,onWebToggleOff:l,onComposerToggleOff:c,currentChain:d})=>{let f=zb(d),p=f&&d!=="project",m=()=>{let b=!a;s(b),Re("enableAutonomousAgent",b)},h=()=>{let b=!t;e(b),!b&&u&&u()},y=()=>{let b=!r;n(b),!b&&l&&l()},g=()=>{let b=!o;i(b),!b&&c&&c()};return f?sr.default.createElement(y_,{delayDuration:0},sr.default.createElement("div",{className:"tw-hidden tw-items-center tw-gap-1.5 @[420px]/chat-input:tw-flex"},p&&sr.default.createElement(yn,null,sr.default.createElement(bn,{asChild:!0},sr.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:m,className:we("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},sr.default.createElement(B5,{className:"tw-size-4"}))),sr.default.createElement(dn,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&sr.default.createElement(sr.default.Fragment,null,sr.default.createElement(yn,null,sr.default.createElement(bn,{asChild:!0},sr.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:h,className:we("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},sr.default.createElement(cx,{className:"tw-size-4"}))),sr.default.createElement(dn,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),sr.default.createElement(yn,null,sr.default.createElement(bn,{asChild:!0},sr.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:y,className:we("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},sr.default.createElement(vl,{className:"tw-size-4"}))),sr.default.createElement(dn,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),sr.default.createElement(yn,null,sr.default.createElement(bn,{asChild:!0},sr.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:g,className:we("tw-text-muted hover:tw-text-accent",o&&"tw-text-accent tw-bg-accent/10")},sr.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},sr.default.createElement(zy,{className:"tw-size-2"}),sr.default.createElement(Xb,{className:"tw-size-3"})))),sr.default.createElement(dn,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)")))),sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5 @[420px]/chat-input:tw-hidden"},sr.default.createElement(mN,null,sr.default.createElement(hN,{asChild:!0},sr.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},sr.default.createElement(vw,{className:"tw-size-4"}))),sr.default.createElement(Dv,{align:"end",className:"tw-w-56"},p&&sr.default.createElement(Ni,{onClick:m,className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement(B5,{className:"tw-size-4"}),sr.default.createElement("span",null,"Autonomous Agent")),a&&sr.default.createElement(Yu,{className:"tw-size-4"})),!a&&sr.default.createElement(sr.default.Fragment,null,sr.default.createElement(Ni,{onClick:h,className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement(cx,{className:"tw-size-4"}),sr.default.createElement("span",null,"Vault Search")),t&&sr.default.createElement(Yu,{className:"tw-size-4"})),sr.default.createElement(Ni,{onClick:y,className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement(vl,{className:"tw-size-4"}),sr.default.createElement("span",null,"Web Search")),r&&sr.default.createElement(Yu,{className:"tw-size-4"})),sr.default.createElement(Ni,{onClick:g,className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},sr.default.createElement(zy,{className:"tw-size-2"}),sr.default.createElement(Xb,{className:"tw-size-3"})),sr.default.createElement("span",null,"Composer")),o&&sr.default.createElement(Yu,{className:"tw-size-4"}))),a&&sr.default.createElement(sr.default.Fragment,null,sr.default.createElement(Ni,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement(cx,{className:"tw-size-4"}),sr.default.createElement("span",null,"Vault Search"))),sr.default.createElement(Ni,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement(vl,{className:"tw-size-4"}),sr.default.createElement("span",null,"Web Search"))),sr.default.createElement(Ni,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},sr.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},sr.default.createElement(zy,{className:"tw-size-2"}),sr.default.createElement(Xb,{className:"tw-size-3"})),sr.default.createElement("span",null,"Composer")))))))):null};Bt();qZ();Ye();Bt();Or();var kfe=require("obsidian"),Jt=$(J());var qvt={};En(qvt,{$addUpdateTag:()=>qYr,$applyNodeReplacement:()=>bfe,$caretFromPoint:()=>ZB,$caretRangeFromSelection:()=>evt,$cloneWithProperties:()=>JYr,$comparePointCaretNext:()=>Lvt,$copyNode:()=>Ivt,$create:()=>qgi,$createLineBreakNode:()=>yY,$createNodeSelection:()=>yvt,$createParagraphNode:()=>fL,$createPoint:()=>NT,$createRangeSelection:()=>yYr,$createRangeSelectionFromDom:()=>cgi,$createTabNode:()=>eke,$createTextNode:()=>dg,$extendCaretToRange:()=>jvt,$getAdjacentChildCaret:()=>OY,$getAdjacentNode:()=>FYr,$getAdjacentSiblingOrParentSiblingCaret:()=>Kgi,$getCaretInDirection:()=>YB,$getCaretRange:()=>XB,$getCaretRangeInDirection:()=>kvt,$getCharacterOffsets:()=>W_t,$getChildCaret:()=>hL,$getChildCaretAtIndex:()=>tQr,$getChildCaretOrSelf:()=>XYr,$getCollapsedCaretRange:()=>ZYr,$getCommonAncestor:()=>rfe,$getCommonAncestorResultBranchOrder:()=>Fvt,$getEditor:()=>Avt,$getNearestNodeFromDOMNode:()=>ake,$getNearestRootOrShadowRoot:()=>BYr,$getNodeByKey:()=>Sh,$getNodeByKeyOrThrow:()=>zYr,$getPreviousSelection:()=>s6,$getRoot:()=>Bv,$getSelection:()=>ks,$getSiblingCaret:()=>gg,$getState:()=>jFe,$getStateChange:()=>Fhi,$getTextContent:()=>pgi,$getTextNodeOffset:()=>AT,$getTextPointCaret:()=>GB,$getTextPointCaretSlice:()=>Y_t,$getWritableNodeState:()=>uvt,$hasAncestor:()=>GFe,$hasUpdateTag:()=>Dgi,$insertNodes:()=>fgi,$isBlockElementNode:()=>lgi,$isChildCaret:()=>IT,$isDecoratorNode:()=>Vu,$isElementNode:()=>et,$isExtendableTextPointCaret:()=>eQr,$isInlineElementOrDecoratorNode:()=>jgi,$isLeafNode:()=>Igi,$isLineBreakNode:()=>QW,$isNodeCaret:()=>zgi,$isNodeSelection:()=>tke,$isParagraphNode:()=>Sgi,$isRangeSelection:()=>fn,$isRootNode:()=>qv,$isRootOrShadowRoot:()=>DT,$isSiblingCaret:()=>a6,$isTabNode:()=>gvt,$isTextNode:()=>Mr,$isTextPointCaret:()=>pL,$isTextPointCaretSlice:()=>Jgi,$isTokenOrSegmented:()=>uL,$isTokenOrTab:()=>VB,$nodesOfType:()=>Ngi,$normalizeCaret:()=>MT,$normalizeSelection__EXPERIMENTAL:()=>$Fe,$onUpdate:()=>UYr,$parseSerializedNode:()=>ggi,$removeTextFromCaretRange:()=>QYr,$rewindSiblingCaret:()=>RY,$selectAll:()=>Agi,$setCompositionKey:()=>pg,$setPointFromCaret:()=>EY,$setSelection:()=>zv,$setSelectionFromCaretRange:()=>YYr,$setState:()=>khi,$splitAtPointCaretNext:()=>Zgi,$splitNode:()=>$gi,$updateRangeSelectionFromCaretRange:()=>nfe,ArtificialNode__DO_NOT_USE:()=>WFe,BLUR_COMMAND:()=>rYr,CAN_REDO_COMMAND:()=>Zhi,CAN_UNDO_COMMAND:()=>Yhi,CLEAR_EDITOR_COMMAND:()=>Ghi,CLEAR_HISTORY_COMMAND:()=>Xhi,CLICK_COMMAND:()=>FZr,COLLABORATION_TAG:()=>xYr,COMMAND_PRIORITY_CRITICAL:()=>Egi,COMMAND_PRIORITY_EDITOR:()=>Cgi,COMMAND_PRIORITY_HIGH:()=>Ogi,COMMAND_PRIORITY_LOW:()=>xgi,COMMAND_PRIORITY_NORMAL:()=>Tgi,CONTROLLED_TEXT_INSERTION_COMMAND:()=>dY,COPY_COMMAND:()=>pvt,CUT_COMMAND:()=>mvt,DELETE_CHARACTER_COMMAND:()=>cfe,DELETE_LINE_COMMAND:()=>ffe,DELETE_WORD_COMMAND:()=>dfe,DRAGEND_COMMAND:()=>eYr,DRAGOVER_COMMAND:()=>QZr,DRAGSTART_COMMAND:()=>YZr,DROP_COMMAND:()=>ZZr,DecoratorNode:()=>pfe,ElementNode:()=>KB,FOCUS_COMMAND:()=>tYr,FORMAT_ELEMENT_COMMAND:()=>Khi,FORMAT_TEXT_COMMAND:()=>BB,HISTORIC_TAG:()=>ygi,HISTORY_MERGE_TAG:()=>IFe,HISTORY_PUSH_TAG:()=>bgi,INDENT_CONTENT_COMMAND:()=>Whi,INSERT_LINE_BREAK_COMMAND:()=>Yde,INSERT_PARAGRAPH_COMMAND:()=>L_t,INSERT_TAB_COMMAND:()=>Hhi,INTERNAL_$isBlock:()=>dL,IS_ALL_FORMATTING:()=>CZr,IS_BOLD:()=>_hi,IS_CODE:()=>whi,IS_HIGHLIGHT:()=>ZFe,IS_ITALIC:()=>vhi,IS_STRIKETHROUGH:()=>ife,IS_SUBSCRIPT:()=>Shi,IS_SUPERSCRIPT:()=>Chi,IS_UNDERLINE:()=>afe,KEY_ARROW_DOWN_COMMAND:()=>HZr,KEY_ARROW_LEFT_COMMAND:()=>BZr,KEY_ARROW_RIGHT_COMMAND:()=>qZr,KEY_ARROW_UP_COMMAND:()=>VZr,KEY_BACKSPACE_COMMAND:()=>JZr,KEY_DELETE_COMMAND:()=>GZr,KEY_DOWN_COMMAND:()=>kZr,KEY_ENTER_COMMAND:()=>qFe,KEY_ESCAPE_COMMAND:()=>KZr,KEY_MODIFIER_COMMAND:()=>nYr,KEY_SPACE_COMMAND:()=>WZr,KEY_TAB_COMMAND:()=>XZr,LineBreakNode:()=>gY,MOVE_TO_END:()=>UZr,MOVE_TO_START:()=>zZr,NODE_STATE_KEY:()=>Ihi,OUTDENT_CONTENT_COMMAND:()=>Jhi,PASTE_COMMAND:()=>cvt,PASTE_TAG:()=>_gi,ParagraphNode:()=>vY,REDO_COMMAND:()=>fvt,REMOVE_TEXT_COMMAND:()=>F_t,RootNode:()=>_Y,SELECTION_CHANGE_COMMAND:()=>lvt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>Vhi,SELECT_ALL_COMMAND:()=>k_t,SKIP_COLLAB_TAG:()=>vgi,SKIP_DOM_SELECTION_TAG:()=>OYr,SKIP_SCROLL_INTO_VIEW_TAG:()=>TYr,TEXT_TYPE_TO_FORMAT:()=>vb,TabNode:()=>bY,TextNode:()=>n6,UNDO_COMMAND:()=>dvt,buildImportMap:()=>tgi,createCommand:()=>Io,createEditor:()=>Pgi,createSharedNodeState:()=>RZr,createState:()=>Lhi,flipDirection:()=>QB,getDOMOwnerDocument:()=>Mvt,getDOMSelection:()=>CN,getDOMSelectionFromTarget:()=>VYr,getDOMTextNode:()=>i6,getEditorPropertyFromDOMNode:()=>gfe,getNearestEditorFromDOMNode:()=>xvt,getRegisteredNode:()=>Svt,getRegisteredNodeOrThrow:()=>wvt,isBlockDomNode:()=>X_t,isCurrentlyReadOnlyMode:()=>PY,isDOMDocumentNode:()=>MYr,isDOMNode:()=>MY,isDOMTextNode:()=>xN,isDOMUnmanaged:()=>GYr,isDocumentFragment:()=>HYr,isExactShortcutMatch:()=>nu,isHTMLAnchorElement:()=>Lgi,isHTMLElement:()=>w_,isInlineDomNode:()=>WYr,isLexicalEditor:()=>oke,isModifierMatch:()=>LYr,isSelectionCapturedInDecoratorInput:()=>Cvt,isSelectionWithinEditor:()=>hfe,makeStepwiseIterator:()=>$vt,removeFromParent:()=>HB,resetRandomKey:()=>Mgi,setDOMUnmanaged:()=>kgi,setNodeIndentFromDOM:()=>KYr});function nt(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var jT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,chi=jT&&"documentMode"in document?document.documentMode:null,SN=jT&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),e6=jT&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),AFe=!(!jT||!("InputEvent"in window)||chi)&&"getTargetRanges"in new window.InputEvent("input"),ofe=jT&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),mY=jT&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,dhi=jT&&/Android/.test(navigator.userAgent),wZr=jT&&/^(?=.*Chrome).*/i.test(navigator.userAgent),RXr=jT&&dhi&&wZr,NFe=jT&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!wZr;function DFe(...t){let e=[];for(let r of t)if(r&&typeof r=="string")for(let[n]of r.matchAll(/\S+/g))e.push(n);return e}var fhi=1,phi=3,mhi=9,hhi=11,t6=0,SZr=1,hY=2,ghi=0,yhi=1,bhi=2,_hi=1,vhi=2,ife=4,afe=8,whi=16,Shi=32,Chi=64,ZFe=128,CZr=1792|(112|(3|ife|afe)|ZFe),tvt=1,rvt=2,nvt=3,ovt=4,ivt=5,avt=6,YFe=ofe||mY||NFe?"\xA0":"\u200B",mL=`
|
||
|
||
`,xhi=e6?"\xA0":YFe,xZr="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",TZr="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Thi=new RegExp("^[^"+TZr+"]*["+xZr+"]"),Ohi=new RegExp("^[^"+xZr+"]*["+TZr+"]"),vb={bold:1,capitalize:1024,code:16,highlight:ZFe,italic:2,lowercase:256,strikethrough:ife,subscript:32,superscript:64,underline:afe,uppercase:512},Ehi={directionless:1,unmergeable:2},IXr={center:rvt,end:avt,justify:ovt,left:tvt,right:nvt,start:ivt},Phi={[rvt]:"center",[avt]:"end",[ovt]:"justify",[tvt]:"left",[nvt]:"right",[ivt]:"start"},Mhi={normal:0,segmented:2,token:1},Rhi={[ghi]:"normal",[bhi]:"segmented",[yhi]:"token"},Ihi="$",AXr="$config";function OZr(t,e,r,n,o,i){let a=t.getFirstChild();for(;a!==null;){let s=a.__key;a.__parent===e&&(et(a)&&OZr(a,s,r,n,o,i),r.has(s)||i.delete(s),o.push(s)),a=a.getNextSibling()}}var Ahi=100,P_t=!1,svt=0;function Nhi(t){svt=t.timeStamp}function h_t(t,e,r){let n=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||n&&t.previousSibling===o)||n&&ike(t,r)!==void 0}function Dhi(t,e,r){let n=CN(OC(r)),o=null,i=null;n!==null&&n.anchorNode===t&&(o=n.anchorOffset,i=n.focusOffset);let a=t.nodeValue;a!==null&&Evt(e,a,o,i,!1)}function jhi(t,e,r){if(fn(t)){let n=t.anchor.getNode();if(n.is(r)&&t.format!==n.getFormat())return!1}return xN(e)&&r.isAttached()}function $hi(t,e,r,n){for(let o=t;o&&!GYr(o);o=yfe(o)){let i=ike(o,e);if(i!==void 0){let a=Sh(i,r);if(a)return Vu(a)||!w_(o)?void 0:[o,a]}else if(o===n)return[n,NYr(r)]}}function EZr(t,e,r){P_t=!0;let n=performance.now()-svt>Ahi;try{uS(t,()=>{let o=ks()||function(f){return f.getEditorState().read(()=>{let p=ks();return p!==null?p.clone():null})}(t),i=new Map,a=t.getRootElement(),s=t._editorState,u=t._blockCursorElement,l=!1,c="";for(let f=0;f<e.length;f++){let p=e[f],m=p.type,h=p.target,y=$hi(h,t,s,a);if(!y)continue;let[g,b]=y;if(m==="characterData")n&&Mr(b)&&xN(h)&&jhi(o,h,b)&&Dhi(h,b,t);else if(m==="childList"){l=!0;let _=p.addedNodes;for(let O=0;O<_.length;O++){let E=_[O],P=IYr(E),R=E.parentNode;if(R!=null&&E!==u&&P===null&&!h_t(E,R,t)){if(e6){let I=(w_(E)?E.innerText:null)||E.nodeValue;I&&(c+=I)}R.removeChild(E)}}let w=p.removedNodes,T=w.length;if(T>0){let O=0;for(let E=0;E<T;E++){let P=w[E];(h_t(P,h,t)||u===P)&&(h.appendChild(P),O++)}T!==O&&i.set(g,b)}}}if(i.size>0)for(let[f,p]of i)p.reconcileObservedMutation(f,t);let d=r.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){let p=d[f],m=p.addedNodes,h=p.target;for(let y=0;y<m.length;y++){let g=m[y],b=g.parentNode;b==null||g.nodeName!=="BR"||h_t(g,h,t)||b.removeChild(g)}}r.takeRecords()}o!==null&&(l&&zv(o),e6&&kYr(t)&&o.insertRawText(c))})}finally{P_t=!1}}function PZr(t){let e=t._observer;e!==null&&EZr(t,e.takeRecords(),e)}function MZr(t){(function(e){svt===0&&OC(e).addEventListener("textInput",Nhi,!0)})(t),t._observer=new MutationObserver((e,r)=>{EZr(t,e,r)})}var M_t=class{constructor(e,r){this.key=e,this.parse=r.parse.bind(r),this.unparse=(r.unparse||qhi).bind(r),this.isEqual=(r.isEqual||Object.is).bind(r),this.defaultValue=this.parse(void 0)}};function Lhi(t,e){return new M_t(t,e)}function jFe(t,e,r="latest"){let n=(r==="latest"?t.getLatest():t).__state;return n?n.getValue(e):e.defaultValue}function Fhi(t,e,r){let n=jFe(t,r,"direct"),o=jFe(e,r,"direct");return r.isEqual(n,o)?null:[n,o]}function khi(t,e,r){let n;if(fg(),typeof r=="function"){let i=t.getLatest(),a=jFe(i,e);if(n=r(a),e.isEqual(a,n))return i}else n=r;let o=t.getWritable();return uvt(o).updateFromKnown(e,n),o}function RZr(t){let e=new Map,r=new Set;for(let n=typeof t=="function"?t:t.replace;n.prototype&&n.prototype.getType!==void 0;n=Object.getPrototypeOf(n)){let{ownNodeConfig:o}=Nvt(n);if(o&&o.stateConfigs)for(let i of o.stateConfigs){let a;"stateConfig"in i?(a=i.stateConfig,i.flat&&r.add(a.key)):a=i,e.set(a.key,a)}}return{flatKeys:r,sharedConfigMap:e}}var R_t=class t{constructor(e,r,n=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=r,this.unknownState=n,this.knownState=o;let{sharedConfigMap:a}=this.sharedNodeState,s=i!==void 0?i:function(u,l,c){let d=c.size;if(l)for(let f in l){let p=u.get(f);p&&c.has(p)||d++}return d}(a,n,o);this.size=s}getValue(e){let r=this.knownState.get(e);if(r!==void 0)return r;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let o=this.unknownState[e.key];o!==void 0&&(n=e.parse(o)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},r={};for(let[n,o]of this.knownState)n.isEqual(o,n.defaultValue)?delete e[n.key]:e[n.key]=n.unparse(o);for(let n of this.sharedNodeState.flatKeys)n in e&&(r[n]=e[n],delete e[n]);return NXr(e)&&(r.$=e),r}getWritable(e){if(this.node===e)return this;let{sharedNodeState:r,unknownState:n}=this,o=new Map(this.knownState);return new t(e,r,function(i,a,s){let u;if(s)for(let[l,c]of Object.entries(s)){let d=i.get(l);d?a.has(d)||a.set(d,d.parse(c)):(u=u||{},u[l]=c)}return u}(r.sharedConfigMap,o,n),o,this.size)}updateFromKnown(e,r){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:o,unknownState:i}=this;o.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=NXr(i)),this.size++),o.set(e,r)}updateFromUnknown(e,r){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(r)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=r)}updateFromJSON(e){let{knownState:r}=this;for(let n of r.keys())r.set(n,n.defaultValue);if(this.size=r.size,this.unknownState=void 0,e)for(let[n,o]of Object.entries(e))this.updateFromUnknown(n,o)}};function uvt(t){let e=t.getWritable(),r=e.__state?e.__state.getWritable(e):new R_t(e,IZr(e));return e.__state=r,r}function IZr(t){return t.__state?t.__state.sharedNodeState:wvt(Avt(),t.getType()).sharedNodeState}function NXr(t){if(t)for(let e in t)return t}function qhi(t){return t}function DXr(t,e,r){for(let[n,o]of e.knownState){if(t.has(n.key))continue;t.add(n.key);let i=r?r.getValue(n):n.defaultValue;if(i!==o&&!n.isEqual(i,o))return!0}return!1}function jXr(t,e,r){let{unknownState:n}=e,o=r?r.unknownState:void 0;if(n){for(let[i,a]of Object.entries(n))if(!t.has(i)&&(t.add(i),a!==(o?o[i]:void 0)))return!0}return!1}function $Xr(t,e){let r=t.__state;return r&&r.node===t?r.getWritable(e):r}function LXr(t,e){let r=t.__mode,n=t.__format,o=t.__style,i=e.__mode,a=e.__format,s=e.__style,u=t.__state,l=e.__state;return(r===null||r===i)&&(n===null||n===a)&&(o===null||o===s)&&(t.__state===null||u===l||function(c,d){if(c===d)return!0;if(c&&d&&c.size!==d.size)return!1;let f=new Set;return!(c&&DXr(f,c,d)||d&&DXr(f,d,c)||c&&jXr(f,c,d)||d&&jXr(f,d,c))}(u,l))}function FXr(t,e){let r=t.mergeWithSibling(e),n=fc()._normalizedNodes;return n.add(t.__key),n.add(e.__key),r}function kXr(t){let e,r,n=t;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&Mr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(LXr(e,n)){n=FXr(e,n);break}break}e.remove()}for(;(r=n.getNextSibling())!==null&&Mr(r)&&r.isSimpleText()&&!r.isUnmergeable();){if(r.__text!==""){if(LXr(n,r)){n=FXr(n,r);break}break}r.remove()}}else n.remove()}function $Fe(t){return qXr(t.anchor),qXr(t.focus),t}function qXr(t){for(;t.type==="element";){let e=t.getNode(),r=t.offset,n,o;if(r===e.getChildrenSize()?(n=e.getChildAtIndex(r-1),o=!0):(n=e.getChildAtIndex(r),o=!1),Mr(n)){t.set(n.__key,o?n.getTextContentSize():0,"text",!0);break}if(!et(n))break;t.set(n.__key,o?n.getChildrenSize():0,"element",!0)}}var WB,v_,sfe,QFe,I_t,A_t,r6,RT,N_t,ufe,wh="",__="",vN=null,wN="",lL="",AZr=!1,lfe=!1,PFe=null;function LFe(t,e){let r=r6.get(t);if(e!==null){let n=$_t(t);n.parentNode===e&&e.removeChild(n)}if(RT.has(t)||v_._keyToDOMMap.delete(t),et(r)){let n=kFe(r,r6);D_t(n,0,n.length-1,null)}r!==void 0&&Pvt(ufe,sfe,QFe,r,"destroyed")}function D_t(t,e,r,n){let o=e;for(;o<=r;++o){let i=t[o];i!==void 0&&LFe(i,n)}}function ZW(t,e){t.setProperty("text-align",e)}var Uhi="40px";function NZr(t,e){let r=WB.theme.indent;if(typeof r=="string"){let o=t.classList.contains(r);e>0&&!o?t.classList.add(r):e<1&&o&&t.classList.remove(r)}let n=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||Uhi;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function DZr(t,e){let r=t.style;e===0?ZW(r,""):e===tvt?ZW(r,"left"):e===rvt?ZW(r,"center"):e===nvt?ZW(r,"right"):e===ovt?ZW(r,"justify"):e===ivt?ZW(r,"start"):e===avt&&ZW(r,"end")}function FFe(t,e){let r=RT.get(t);r===void 0&&nt(60);let n=r.createDOM(WB,v_);if(function(o,i,a){let s=a._keyToDOMMap;(function(u,l,c){let d=`__lexicalKey_${l._key}`;u[d]=c})(i,a,o),s.set(o,i)}(t,n,v_),Mr(r)?n.setAttribute("data-lexical-text","true"):Vu(r)&&n.setAttribute("data-lexical-decorator","true"),et(r)){let o=r.__indent,i=r.__size;if(o!==0&&NZr(n,o),i!==0){let s=i-1;(function(u,l,c,d){let f=__;__="",j_t(u,c,0,l,c.getDOMSlot(d)),$Zr(c,d),__=f})(kFe(r,RT),s,r,n)}let a=r.__format;a!==0&&DZr(n,a),r.isInline()||jZr(null,r,n),ske(r)&&(wh+=mL,lL+=mL)}else{let o=r.getTextContent();if(Vu(r)){let i=r.decorate(v_,WB);i!==null&&LZr(t,i),n.contentEditable="false"}else Mr(r)&&(r.isDirectionless()||(__+=o));wh+=o,lL+=o}return e!==null&&e.insertChild(n),Pvt(ufe,sfe,QFe,r,"created"),n}function j_t(t,e,r,n,o){let i=wh;wh="";let a=r;for(;a<=n;++a){FFe(t[a],o);let s=RT.get(t[a]);s!==null&&Mr(s)&&(vN===null&&(vN=s.getFormat()),wN===""&&(wN=s.getStyle()))}ske(e)&&(wh+=mL),o.element.__lexicalTextContent=wh,wh=i+wh}function UXr(t,e){if(t){let r=t.__last;if(r){let n=e.get(r);if(n)return QW(n)?"line-break":Vu(n)&&n.isInline()?"decorator":null}return"empty"}return null}function jZr(t,e,r){let n=UXr(t,r6),o=UXr(e,RT);n!==o&&e.getDOMSlot(r).setManagedLineBreak(o)}function $Zr(t,e){let r=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(r!==__||n!==PFe){let o=__==="",i=o?PFe:function(a){return Thi.test(a)?"rtl":Ohi.test(a)?"ltr":null}(__);if(i!==n){let a=e.classList,s=WB.theme,u=n!==null?s[n]:void 0,l=i!==null?s[i]:void 0;if(u!==void 0){if(typeof u=="string"){let c=DFe(u);u=s[n]=c}a.remove(...u)}if(i===null||o&&i==="ltr")e.removeAttribute("dir");else{if(l!==void 0){if(typeof l=="string"){let c=DFe(l);l=s[i]=c}l!==void 0&&a.add(...l)}e.dir=i}lfe||(t.getWritable().__dir=i)}PFe=i,e.__lexicalDirTextContent=__,e.__lexicalDir=i}}function Bhi(t,e,r){let n=__;var o;__="",vN=null,wN="",function(i,a,s){let u=wh,l=i.__size,c=a.__size;wh="";let d=s.element;if(l===1&&c===1){let f=i.__first,p=a.__first;if(f===p)Zde(f,d);else{let h=$_t(f),y=FFe(p,null);try{d.replaceChild(y,h)}catch(g){if(typeof g=="object"&&g!=null){let b=`${g.toString()} Parent: ${d.tagName}, new child: {tag: ${y.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(b)}throw g}LFe(f,null)}let m=RT.get(p);Mr(m)&&(vN===null&&(vN=m.getFormat()),wN===""&&(wN=m.getStyle()))}else{let f=kFe(i,r6),p=kFe(a,RT);if(f.length!==l&&nt(227),p.length!==c&&nt(228),l===0)c!==0&&j_t(p,a,0,c-1,s);else if(c===0){if(l!==0){let m=s.after==null&&s.before==null&&s.element.__lexicalLineBreak==null;D_t(f,0,l-1,m?null:d),m&&(d.textContent="")}}else(function(m,h,y,g,b,_){let w=g-1,T=b-1,O,E,P=_.getFirstChild(),R=0,I=0;for(;R<=w&&I<=T;){let V=h[R],k=y[I];if(V===k)P=g_t(Zde(k,_.element)),R++,I++;else{O===void 0&&(O=new Set(h)),E===void 0&&(E=new Set(y));let B=E.has(V),Q=O.has(k);if(B)if(Q){let Y=SY(v_,k);Y===P?P=g_t(Zde(k,_.element)):(_.withBefore(P).insertChild(Y),Zde(k,_.element)),R++,I++}else FFe(k,_.withBefore(P)),I++;else P=g_t($_t(V)),LFe(V,_.element),R++}let X=RT.get(k);X!==null&&Mr(X)&&(vN===null&&(vN=X.getFormat()),wN===""&&(wN=X.getStyle()))}let N=R>w,z=I>T;if(N&&!z){let V=y[T+1],k=V===void 0?null:v_.getElementByKey(V);j_t(y,m,I,T,_.withBefore(k))}else z&&!N&&D_t(h,R,w,_.element)})(a,f,p,l,c,s)}ske(a)&&(wh+=mL),d.__lexicalTextContent=wh,wh=u+wh}(t,e,e.getDOMSlot(r)),$Zr(e,r),o=e,vN==null||vN===o.__textFormat||lfe||o.setTextFormat(vN),function(i){wN===""||wN===i.__textStyle||lfe||i.setTextStyle(wN)}(e),__=n}function kFe(t,e){let r=[],n=t.__first;for(;n!==null;){let o=e.get(n);o===void 0&&nt(101),r.push(n),n=o.__next}return r}function Zde(t,e){let r=r6.get(t),n=RT.get(t);r!==void 0&&n!==void 0||nt(61);let o=AZr||A_t.has(t)||I_t.has(t),i=SY(v_,t);if(r===n&&!o){if(et(r)){let a=i.__lexicalTextContent;a!==void 0&&(wh+=a,lL+=a);let s=i.__lexicalDirTextContent;s!==void 0&&(__+=s)}else{let a=r.getTextContent();Mr(r)&&!r.isDirectionless()&&(__+=a),lL+=a,wh+=a}return i}if(r!==n&&o&&Pvt(ufe,sfe,QFe,n,"updated"),n.updateDOM(r,i,WB)){let a=FFe(t,null);return e===null&&nt(62),e.replaceChild(a,i),LFe(t,null),a}if(et(r)&&et(n)){let a=n.__indent;a!==r.__indent&&NZr(i,a);let s=n.__format;s!==r.__format&&DZr(i,s),o&&(Bhi(r,n,i),qv(n)||n.isInline()||jZr(r,n,i)),ske(n)&&(wh+=mL,lL+=mL)}else{let a=n.getTextContent();if(Vu(n)){let s=n.decorate(v_,WB);s!==null&&LZr(t,s)}else Mr(n)&&!n.isDirectionless()&&(__+=a);wh+=a,lL+=a}if(!lfe&&qv(n)&&n.__cachedText!==lL){let a=n.getWritable();a.__cachedText=lL,n=a}return i}function LZr(t,e){let r=v_._pendingDecorators,n=v_._decorators;if(r===null){if(n[t]===e)return;r=AYr(v_)}r[t]=e}function g_t(t){let e=t.nextSibling;return e!==null&&e===v_._blockCursorElement&&(e=e.nextSibling),e}function zhi(t,e,r,n,o,i){wh="",lL="",__="",AZr=n===hY,PFe=null,v_=r,WB=r._config,sfe=r._nodes,QFe=v_._listeners.mutation,I_t=o,A_t=i,r6=t._nodeMap,RT=e._nodeMap,lfe=e._readOnly,N_t=new Map(r._keyToDOMMap);let a=new Map;return ufe=a,Zde("root",null),v_=void 0,sfe=void 0,I_t=void 0,A_t=void 0,r6=void 0,RT=void 0,WB=void 0,N_t=void 0,ufe=void 0,a}function $_t(t){let e=N_t.get(t);return e===void 0&&nt(75,t),e}function Io(t){return{type:t}}var lvt=Io("SELECTION_CHANGE_COMMAND"),Vhi=Io("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),FZr=Io("CLICK_COMMAND"),cfe=Io("DELETE_CHARACTER_COMMAND"),Yde=Io("INSERT_LINE_BREAK_COMMAND"),L_t=Io("INSERT_PARAGRAPH_COMMAND"),dY=Io("CONTROLLED_TEXT_INSERTION_COMMAND"),cvt=Io("PASTE_COMMAND"),F_t=Io("REMOVE_TEXT_COMMAND"),dfe=Io("DELETE_WORD_COMMAND"),ffe=Io("DELETE_LINE_COMMAND"),BB=Io("FORMAT_TEXT_COMMAND"),dvt=Io("UNDO_COMMAND"),fvt=Io("REDO_COMMAND"),kZr=Io("KEYDOWN_COMMAND"),qZr=Io("KEY_ARROW_RIGHT_COMMAND"),UZr=Io("MOVE_TO_END"),BZr=Io("KEY_ARROW_LEFT_COMMAND"),zZr=Io("MOVE_TO_START"),VZr=Io("KEY_ARROW_UP_COMMAND"),HZr=Io("KEY_ARROW_DOWN_COMMAND"),qFe=Io("KEY_ENTER_COMMAND"),WZr=Io("KEY_SPACE_COMMAND"),JZr=Io("KEY_BACKSPACE_COMMAND"),KZr=Io("KEY_ESCAPE_COMMAND"),GZr=Io("KEY_DELETE_COMMAND"),XZr=Io("KEY_TAB_COMMAND"),Hhi=Io("INSERT_TAB_COMMAND"),Whi=Io("INDENT_CONTENT_COMMAND"),Jhi=Io("OUTDENT_CONTENT_COMMAND"),ZZr=Io("DROP_COMMAND"),Khi=Io("FORMAT_ELEMENT_COMMAND"),YZr=Io("DRAGSTART_COMMAND"),QZr=Io("DRAGOVER_COMMAND"),eYr=Io("DRAGEND_COMMAND"),pvt=Io("COPY_COMMAND"),mvt=Io("CUT_COMMAND"),k_t=Io("SELECT_ALL_COMMAND"),Ghi=Io("CLEAR_EDITOR_COMMAND"),Xhi=Io("CLEAR_HISTORY_COMMAND"),Zhi=Io("CAN_REDO_COMMAND"),Yhi=Io("CAN_UNDO_COMMAND"),tYr=Io("FOCUS_COMMAND"),rYr=Io("BLUR_COMMAND"),nYr=Io("KEY_MODIFIER_COMMAND"),iL=Object.freeze({}),q_t=30,U_t=[["keydown",function(t,e){if(Qde=t.timeStamp,oYr=t.key,!e.isComposing()&&!_r(e,kZr,t)&&t.key!=null){if(y_t&&hZr(t))return uS(e,()=>{CFe(e,b_t)}),y_t=!1,void(b_t="");if(function(r){return nu(r,"ArrowRight",{shiftKey:"any"})}(t))_r(e,qZr,t);else if(function(r){return nu(r,"ArrowRight",sL)}(t))_r(e,UZr,t);else if(function(r){return nu(r,"ArrowLeft",{shiftKey:"any"})}(t))_r(e,BZr,t);else if(function(r){return nu(r,"ArrowLeft",sL)}(t))_r(e,zZr,t);else if(function(r){return nu(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))_r(e,VZr,t);else if(function(r){return nu(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))_r(e,HZr,t);else if(function(r){return nu(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))efe=!0,_r(e,qFe,t);else if(function(r){return r.key===" "}(t))_r(e,WZr,t);else if(function(r){return SN&&nu(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),efe=!0,_r(e,Yde,!0);else if(function(r){return nu(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))efe=!1,_r(e,qFe,t);else if(function(r){return nu(r,"Backspace",{shiftKey:"any"})||SN&&nu(r,"h",{ctrlKey:!0})}(t))hZr(t)?_r(e,JZr,t):(t.preventDefault(),_r(e,cfe,!0));else if(function(r){return r.key==="Escape"}(t))_r(e,KZr,t);else if(function(r){return nu(r,"Delete",{})||SN&&nu(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?_r(e,GZr,t):(t.preventDefault(),_r(e,cfe,!1));else if(function(r){return nu(r,"Backspace",mZr)}(t))t.preventDefault(),_r(e,dfe,!0);else if(function(r){return nu(r,"Delete",mZr)}(t))t.preventDefault(),_r(e,dfe,!1);else if(function(r){return SN&&nu(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),_r(e,ffe,!0);else if(function(r){return SN&&(nu(r,"Delete",{metaKey:!0})||nu(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),_r(e,ffe,!1);else if(function(r){return nu(r,"b",sL)}(t))t.preventDefault(),_r(e,BB,"bold");else if(function(r){return nu(r,"u",sL)}(t))t.preventDefault(),_r(e,BB,"underline");else if(function(r){return nu(r,"i",sL)}(t))t.preventDefault(),_r(e,BB,"italic");else if(function(r){return nu(r,"Tab",{shiftKey:"any"})}(t))_r(e,XZr,t);else if(function(r){return nu(r,"z",sL)}(t))t.preventDefault(),_r(e,dvt,void 0);else if(function(r){return SN?nu(r,"z",{metaKey:!0,shiftKey:!0}):nu(r,"y",{ctrlKey:!0})||nu(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),_r(e,fvt,void 0);else{let r=e._editorState._selection;r===null||fn(r)?gZr(t)&&(t.preventDefault(),_r(e,k_t,t)):function(n){return nu(n,"c",sL)}(t)?(t.preventDefault(),_r(e,pvt,t)):function(n){return nu(n,"x",sL)}(t)?(t.preventDefault(),_r(e,mvt,t)):gZr(t)&&(t.preventDefault(),_r(e,k_t,t))}(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(t)&&_r(e,nYr,t)}}],["pointerdown",function(t,e){let r=t.target,n=t.pointerType;MY(r)&&n!=="touch"&&n!=="pen"&&t.button===0&&uS(e,()=>{dZr(r)||(z_t=!0)})}],["compositionstart",function(t,e){uS(e,()=>{let r=ks();if(fn(r)&&!e.isComposing()){let n=r.anchor,o=r.anchor.getNode();pg(n.key),(t.timeStamp<Qde+q_t||n.type==="element"||!r.isCollapsed()||o.getFormat()!==r.format||Mr(o)&&o.getStyle()!==r.style)&&_r(e,dY,xhi)}})}],["compositionend",function(t,e){e6?Gde=!0:mY||!ofe&&!NFe?uS(e,()=>{CFe(e,t.data)}):(y_t=!0,b_t=t.data)}],["input",function(t,e){t.stopPropagation(),uS(e,()=>{if(w_(t.target)&&dZr(t.target))return;let r=ks(),n=t.data,o=lYr(t);if(n!=null&&fn(r)&&sYr(r,o,n,t.timeStamp,!1)){Gde&&(CFe(e,n),Gde=!1);let i=r.anchor.getNode(),a=CN(OC(e));if(a===null)return;let s=r.isBackward(),u=s?r.anchor.offset:r.focus.offset,l=s?r.focus.offset:r.anchor.offset;AFe&&!r.isCollapsed()&&Mr(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,u)+n+i.getTextContent().slice(u+l)===$Yr(a.anchorNode)||_r(e,dY,n);let c=n.length;e6&&c>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=c),ofe||mY||NFe||!e.isComposing()||(Qde=0,pg(null))}else Ovt(!1,e,n!==null?n:void 0),Gde&&(CFe(e,n||void 0),Gde=!1);(function(){fg();let i=fc();PZr(i)})()},{event:t}),lY=null}],["click",function(t,e){uS(e,()=>{let r=ks(),n=CN(OC(e)),o=s6();if(n){if(fn(r)){let i=r.anchor,a=i.getNode();if(i.type==="element"&&i.offset===0&&r.isCollapsed()&&!qv(a)&&Bv().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&o!==null&&r.is(o))n.removeAllRanges(),r.dirty=!0;else if(t.detail===3&&!r.isCollapsed()&&a!==r.focus.getNode()){let s=function(u,l){let c=u;for(;c!==Bv()&&c!=null;){if(l(c))return c;c=c.getParent()}return null}(a,u=>et(u)&&!u.isInline());et(s)&&s.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=n.anchorNode;(w_(i)||xN(i))&&zv(rke(o,n,e,t))}}_r(e,FZr,t)})}],["cut",iL],["copy",iL],["dragstart",iL],["dragover",iL],["dragend",iL],["paste",iL],["focus",iL],["blur",iL],["drop",iL]];AFe&&U_t.push(["beforeinput",(t,e)=>function(r,n){let o=r.inputType,i=lYr(r);o==="deleteCompositionText"||e6&&kYr(n)||o!=="insertCompositionText"&&uS(n,()=>{let a=ks();if(o==="deleteContentBackward"){if(a===null){let p=s6();if(!fn(p))return;zv(p.clone())}if(fn(a)){let p=a.anchor.key===a.focus.key;if(s=r.timeStamp,oYr==="MediaLast"&&s<Qde+q_t&&n.isComposing()&&p){if(pg(null),Qde=0,setTimeout(()=>{uS(n,()=>{pg(null)})},q_t),fn(a)){let m=a.anchor.getNode();m.markDirty(),Mr(m)||nt(142),uYr(a,m)}}else{pg(null),r.preventDefault();let m=a.anchor.getNode(),h=m.getTextContent(),y=m.canInsertTextAfter(),g=a.anchor.offset===0&&a.focus.offset===h.length,b=RXr&&p&&!g&&y;if(b&&a.isCollapsed()&&(b=!Vu(FYr(a.anchor,!0))),!b){_r(n,cfe,!0);let _=ks();RXr&&fn(_)&&_.isCollapsed()&&(YW=_,setTimeout(()=>YW=null))}}return}}var s;if(!fn(a))return;let u=r.data;lY!==null&&Ovt(!1,n,lY),a.dirty&&lY===null||!a.isCollapsed()||qv(a.anchor.getNode())||i===null||a.applyDOMRange(i),lY=null;let l=a.anchor,c=a.focus,d=l.getNode(),f=c.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(r.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":_r(n,dY,r);break;case"insertFromComposition":pg(null),_r(n,dY,r);break;case"insertLineBreak":pg(null),_r(n,Yde,!1);break;case"insertParagraph":pg(null),efe&&!mY?(efe=!1,_r(n,Yde,!1)):_r(n,L_t,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":_r(n,cvt,r);break;case"deleteByComposition":(function(p,m){return p!==m||et(p)||et(m)||!VB(p)||!VB(m)})(d,f)&&_r(n,F_t,r);break;case"deleteByDrag":case"deleteByCut":_r(n,F_t,r);break;case"deleteContent":_r(n,cfe,!1);break;case"deleteWordBackward":_r(n,dfe,!0);break;case"deleteWordForward":_r(n,dfe,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":_r(n,ffe,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":_r(n,ffe,!1);break;case"formatStrikeThrough":_r(n,BB,"strikethrough");break;case"formatBold":_r(n,BB,"bold");break;case"formatItalic":_r(n,BB,"italic");break;case"formatUnderline":_r(n,BB,"underline");break;case"historyUndo":_r(n,dvt,void 0);break;case"historyRedo":_r(n,fvt,void 0)}else{if(u===`
|
||
`)r.preventDefault(),_r(n,Yde,!1);else if(u===mL)r.preventDefault(),_r(n,L_t,void 0);else if(u==null&&r.dataTransfer){let p=r.dataTransfer.getData("text/plain");r.preventDefault(),a.insertRawText(p)}else u!=null&&sYr(a,i,u,r.timeStamp,!0)?(r.preventDefault(),_r(n,dY,u)):lY=u;iYr=r.timeStamp}})}(t,e)]);var Qde=0,oYr=null,iYr=0,lY=null,UFe=new WeakMap,B_t=!1,z_t=!1,efe=!1,Gde=!1,y_t=!1,b_t="",YW=null,aYr=[0,"",0,"root",0];function sYr(t,e,r,n,o){let i=t.anchor,a=t.focus,s=i.getNode(),u=fc(),l=CN(OC(u)),c=l!==null?l.anchorNode:null,d=i.key,f=u.getElementByKey(d),p=r.length;return d!==a.key||!Mr(s)||(!o&&(!AFe||iYr<n+50)||s.isDirty()&&p<2||DYr(r))&&i.offset!==a.offset&&!s.isComposing()||uL(s)||s.isDirty()&&p>1||(o||!AFe)&&f!==null&&!s.isComposing()&&c!==i6(f)||l!==null&&e!==null&&(!e.collapsed||e.startContainer!==l.anchorNode||e.startOffset!==l.anchorOffset)||s.getFormat()!==t.format||s.getStyle()!==t.style||function(m,h){if(h.isSegmented())return!0;if(!m.isCollapsed())return!1;let y=m.anchor.offset,g=h.getParentOrThrow(),b=VB(h);return y===0?!h.canInsertTextBefore()||!g.canInsertTextBefore()&&!h.isComposing()||b||function(_){let w=_.getPreviousSibling();return(Mr(w)||et(w)&&w.isInline())&&!w.canInsertTextAfter()}(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!g.canInsertTextAfter()&&!h.isComposing()||b)}(t,s)}function BXr(t,e){return xN(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function zXr(t,e,r){let{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:a}=t;B_t&&(B_t=!1,BXr(n,o)&&BXr(i,a)&&!YW)||uS(e,()=>{if(!r)return void zv(null);if(!hfe(e,n,i))return;let s=ks();if(YW&&fn(s)&&s.isCollapsed()){let u=s.anchor,l=YW.anchor;(u.key===l.key&&u.offset===l.offset+1||u.offset===1&&l.getNode().is(u.getNode().getPreviousSibling()))&&(s=YW.clone(),zv(s))}if(YW=null,fn(s)){let u=s.anchor,l=u.getNode();if(s.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(s.dirty=!0);let c=OC(e).event,d=c?c.timeStamp:performance.now(),[f,p,m,h,y]=aYr,g=Bv(),b=e.isComposing()===!1&&g.getTextContent()==="";if(d<y+200&&u.offset===m&&u.key===h)MFe(s,f,p);else if(u.type==="text")Mr(l)||nt(141),uYr(s,l);else if(u.type==="element"&&!b){et(l)||nt(259);let _=u.getNode();_.isEmpty()?function(w,T){let O=T.getTextFormat(),E=T.getTextStyle();MFe(w,O,E)}(s,_):MFe(s,0,"")}}else{let c=u.key,d=s.focus.key,f=s.getNodes(),p=f.length,m=s.isBackward(),h=m?a:o,y=m?o:a,g=m?d:c,b=m?c:d,_=CZr,w=!1;for(let T=0;T<p;T++){let O=f[T],E=O.getTextContentSize();if(Mr(O)&&E!==0&&!(T===0&&O.__key===g&&h===E||T===p-1&&O.__key===b&&y===0)&&(w=!0,_&=O.getFormat(),_===0))break}s.format=w?_:0}}_r(e,lvt,void 0)})}function MFe(t,e,r){t.format===e&&t.style===r||(t.format=e,t.style=r,t.dirty=!0)}function uYr(t,e){MFe(t,e.getFormat(),e.getStyle())}function lYr(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function CFe(t,e){let r=t._compositionKey;if(pg(null),r!==null&&e!=null){if(e===""){let n=Sh(r),o=i6(t.getElementByKey(r));return void(o!==null&&o.nodeValue!==null&&Mr(n)&&Evt(n,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
||
`){let n=ks();if(fn(n)){let o=n.focus;return n.anchor.set(o.key,o.offset,o.type),void _r(t,qFe,null)}}}Ovt(!0,t,e)}function cYr(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var fY=new Map;function dYr(t){let e=VYr(t.target);if(e===null)return;let r=xvt(e.anchorNode);if(r===null)return;z_t&&(z_t=!1,uS(r,()=>{let u=s6(),l=e.anchorNode;(w_(l)||xN(l))&&zv(rke(u,e,r,t))}));let n=Tvt(r),o=n[n.length-1],i=o._key,a=fY.get(i),s=a||o;s!==r&&zXr(e,s,!1),zXr(e,r,!0),r!==o?fY.set(i,r):a&&fY.delete(i)}function VXr(t){t._lexicalHandled=!0}function HXr(t){return t._lexicalHandled===!0}var Qhi=()=>{};function egi(t){let e=t.ownerDocument,r=UFe.get(e);if(r===void 0)return void Qhi();let n=r-1;n>=0||nt(164),UFe.set(e,n),n===0&&e.removeEventListener("selectionchange",dYr);let o=gfe(t);oke(o)?(function(a){if(a._parentEditor!==null){let s=Tvt(a),u=s[s.length-1]._key;fY.get(u)===a&&fY.delete(u)}else fY.delete(a._key)}(o),t.__lexicalEditor=null):o&&nt(198);let i=cYr(t);for(let a=0;a<i.length;a++)i[a]();t.__lexicalEventHandles=[]}function V_t(t,e,r){fg();let n=t.__key,o=t.getParent();if(o===null)return;let i=function(s){let u=ks();if(!fn(u)||!et(s))return u;let{anchor:l,focus:c}=u,d=l.getNode(),f=c.getNode();return GFe(d,s)&&l.set(s.__key,0,"element"),GFe(f,s)&&c.set(s.__key,0,"element"),u}(t),a=!1;if(fn(i)&&e){let s=i.anchor,u=i.focus;s.key===n&&(VFe(s,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0),u.key===n&&(VFe(u,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0)}else tke(i)&&e&&t.isSelected()&&t.selectPrevious();if(fn(i)&&e&&!a){let s=t.getIndexWithinParent();HB(t),zFe(i,o,s,-1)}else HB(t);r||DT(o)||o.canBeEmpty()||!o.isEmpty()||V_t(o,e),e&&i&&qv(o)&&o.isEmpty()&&o.selectEnd()}function tgi(t){return t}var JB=class{static getType(){let{ownNodeType:e}=Nvt(this);return e===void 0&&nt(64,this.name),e}static clone(e){nt(65,this.name)}$config(){return{}}config(e,r){let n=r.extends||Object.getPrototypeOf(this.constructor);return Object.assign(r,{extends:n,type:e}),{[e]:r}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),RYr(this,e)}getType(){return this.__type}isInline(){nt(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let r=Sh(e);if(r===null)break;e=r.__parent}return!1}isSelected(e){let r=e||ks();if(r==null)return!1;let n=r.getNodes().some(o=>o.__key===this.__key);if(Mr(this))return n;if(fn(r)&&r.anchor.type==="element"&&r.focus.type==="element"){if(r.isCollapsed())return!1;let o=this.getParent();if(Vu(this)&&this.isInline()&&o){let i=r.isBackward()?r.focus:r.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let r=e.getFirstChild(),n=0;for(;r!==null;){if(this.is(r))return n;n++,r=r.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:Sh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&nt(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let r=e.getParent();if(DT(r))return et(e)||e===this&&Vu(e)||nt(194),e;e=r}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&nt(67,this.__key),e}getParents(){let e=[],r=this.getParent();for(;r!==null;)e.push(r),r=r.getParent();return e}getParentKeys(){let e=[],r=this.getParent();for(;r!==null;)e.push(r.__key),r=r.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:Sh(e)}getPreviousSiblings(){let e=[],r=this.getParent();if(r===null)return e;let n=r.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:Sh(e)}getNextSiblings(){let e=[],r=this.getNextSibling();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getCommonAncestor(e){let r=et(this)?this:this.getParent(),n=et(e)?e:e.getParent(),o=r&&n?rfe(r,n):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let r=rfe(this,e);return r!==null&&(r.type==="descendant"||(r.type==="branch"?Fvt(r)===-1:(r.type!=="same"&&r.type!=="ancestor"&&nt(279),!1)))}isParentOf(e){let r=rfe(this,e);return r!==null&&r.type==="ancestor"}getNodesBetween(e){let r=this.isBefore(e),n=[],o=new Set,i=this;for(;i!==null;){let a=i.__key;if(o.has(a)||(o.add(a),n.push(i)),i===e)break;let s=et(i)?r?i.getFirstChild():i.getLastChild():null;if(s!==null){i=s;continue}let u=r?i.getNextSibling():i.getPreviousSibling();if(u!==null){i=u;continue}let l=i.getParentOrThrow();if(o.has(l.__key)||n.push(l),l===e)break;let c=null,d=l;do{if(d===null&&nt(68),c=r?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;c!==null||o.has(d.__key)||n.push(d)}while(c===null);i=c}return r||n.reverse(),n}isDirty(){let e=fc()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=Sh(this.__key);return e===null&&nt(113),e}getWritable(){fg();let e=gL(),r=fc(),n=e._nodeMap,o=this.__key,i=this.getLatest(),a=r._cloneNotNeeded,s=ks();if(s!==null&&s.setCachedNodes(null),a.has(o))return KFe(i),i;let u=JYr(i);return a.add(o),KFe(u),n.set(o,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,r){nt(70)}updateDOM(e,r,n){nt(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){nt(18,this.name)}updateFromJSON(e){return function(r,n){let o=r.getWritable(),i=n.$,a=i;for(let s of IZr(o).flatKeys)s in n&&(a!==void 0&&a!==i||(a={...i}),a[s]=n[s]);return(o.__state||a)&&uvt(r).updateFromJSON(a),o}(this,e)}static transform(){return null}remove(e){V_t(this,!0,e)}replace(e,r){fg();let n=ks();n!==null&&(n=n.clone()),x_t(this,e);let o=this.getLatest(),i=this.__key,a=e.__key,s=e.getWritable(),u=this.getParentOrThrow().getWritable(),l=u.__size;HB(s);let c=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,p=o.__next,m=o.__parent;if(V_t(o,!1,!0),c===null?u.__first=a:c.getWritable().__next=a,s.__prev=f,d===null?u.__last=a:d.getWritable().__prev=a,s.__next=p,s.__parent=m,u.__size=l,r&&(et(this)&&et(s)||nt(139),this.getChildren().forEach(h=>{s.append(h)})),fn(n)){zv(n);let h=n.anchor,y=n.focus;h.key===i&&GXr(h,s),y.key===i&&GXr(y,s)}return zB()===i&&pg(a),s}insertAfter(e,r=!0){fg(),x_t(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.getParent(),a=ks(),s=!1,u=!1;if(i!==null){let p=e.getIndexWithinParent();if(HB(o),fn(a)){let m=i.__key,h=a.anchor,y=a.focus;s=h.type==="element"&&h.key===m&&h.offset===p+1,u=y.type==="element"&&y.key===m&&y.offset===p+1}}let l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),d=o.__key,f=n.__next;if(l===null?c.__last=d:l.getWritable().__prev=d,c.__size++,n.__next=d,o.__next=f,o.__prev=n.__key,o.__parent=n.__parent,r&&fn(a)){let p=this.getIndexWithinParent();zFe(a,c,p+1);let m=c.__key;s&&a.anchor.set(m,p+2,"element"),u&&a.focus.set(m,p+2,"element")}return e}insertBefore(e,r=!0){fg(),x_t(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.__key;HB(o);let a=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),u=n.__prev,l=this.getIndexWithinParent();a===null?s.__first=i:a.getWritable().__next=i,s.__size++,n.__prev=i,o.__prev=u,o.__next=n.__key,o.__parent=n.__parent;let c=ks();return r&&fn(c)&&zFe(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return fL()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,r){fg();let n=this.getPreviousSibling(),o=this.getParentOrThrow();if(n===null)return o.select(0,0);if(et(n))return n.select();if(!Mr(n)){let i=n.getIndexWithinParent()+1;return o.select(i,i)}return n.select(e,r)}selectNext(e,r){fg();let n=this.getNextSibling(),o=this.getParentOrThrow();if(n===null)return o.select();if(et(n))return n.select(0,0);if(!Mr(n)){let i=n.getIndexWithinParent();return o.select(i,i)}return n.select(e,r)}markDirty(){this.getWritable()}reconcileObservedMutation(e,r){this.markDirty()}},gY=class t extends JB{static getType(){return"linebreak"}static clone(e){return new t(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
||
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(r){let n=r.parentElement;if(n!==null&&X_t(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&xFe(o)){let i=n.lastChild;if(i===r||i.previousSibling===r&&xFe(i))return!0}}return!1}(e)||function(r){let n=r.parentElement;if(n!==null&&X_t(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&xFe(o))return!1;let i=n.lastChild;if(i===r||i.previousSibling===r&&xFe(i))return!0}return!1}(e)?null:{conversion:rgi,priority:0}}}static importJSON(e){return yY().updateFromJSON(e)}};function rgi(t){return{node:yY()}}function yY(){return bfe(new gY)}function QW(t){return t instanceof gY}function xFe(t){return xN(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function __t(t,e){return 16&e?"code":e&ZFe?"mark":32&e?"sub":64&e?"sup":null}function v_t(t,e){return 1&e?"strong":2&e?"em":"span"}function fYr(t,e,r,n,o){let i=n.classList,a=pY(o,"base");a!==void 0&&i.add(...a),a=pY(o,"underlineStrikethrough");let s=!1,u=e&afe&&e&ife;a!==void 0&&(r&afe&&r&ife?(s=!0,u||i.add(...a)):u&&i.remove(...a));for(let l in vb){let c=vb[l];if(a=pY(o,l),a!==void 0)if(r&c){if(s&&(l==="underline"||l==="strikethrough")){e&c&&i.remove(...a);continue}e&c&&(!u||l!=="underline")&&l!=="strikethrough"||i.add(...a)}else e&c&&i.remove(...a)}}function pYr(t,e,r){let n=e.firstChild,o=r.isComposing(),i=t+(o?YFe:"");if(n==null)e.textContent=i;else{let a=n.nodeValue;if(a!==i)if(o||e6){let[s,u,l]=function(c,d){let f=c.length,p=d.length,m=0,h=0;for(;m<f&&m<p&&c[m]===d[m];)m++;for(;h+m<f&&h+m<p&&c[f-h-1]===d[p-h-1];)h++;return[m,f-m-h,d.slice(m,p-h)]}(a,i);u!==0&&n.deleteData(s,u),n.insertData(s,l)}else n.nodeValue=i}}function WXr(t,e,r,n,o,i){pYr(o,t,e);let a=i.theme.text;a!==void 0&&fYr(0,0,n,t,a)}function TFe(t,e){let r=document.createElement(e);return r.appendChild(t),r}var n6=class t extends JB{static getType(){return"text"}static clone(e){return new t(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",r){super(r),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return Rhi[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===zB()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let r=vb[e];return!!(this.getFormat()&r)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){return JFe(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){let n=this.__format,o=__t(0,n),i=v_t(0,n),a=o===null?i:o,s=document.createElement(a),u=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),o!==null&&(u=document.createElement(i),s.appendChild(u)),WXr(u,this,0,n,this.__text,e);let l=this.__style;return l!==""&&(s.style.cssText=l),s}updateDOM(e,r,n){let o=this.__text,i=e.__format,a=this.__format,s=__t(0,i),u=__t(0,a),l=v_t(0,i),c=v_t(0,a);if((s===null?l:s)!==(u===null?c:u))return!0;if(s===u&&l!==c){let h=r.firstChild;h==null&&nt(48);let y=document.createElement(c);return WXr(y,this,0,a,o,n),r.replaceChild(y,h),!1}let d=r;u!==null&&s!==null&&(d=r.firstChild,d==null&&nt(49)),pYr(o,d,this);let f=n.theme.text;f!==void 0&&i!==a&&fYr(0,i,a,d,f);let p=e.__style,m=this.__style;return p!==m&&(r.style.cssText=m),!1}static importDOM(){return{"#text":()=>({conversion:agi,priority:0}),b:()=>({conversion:ogi,priority:0}),code:()=>({conversion:aL,priority:0}),em:()=>({conversion:aL,priority:0}),i:()=>({conversion:aL,priority:0}),mark:()=>({conversion:aL,priority:0}),s:()=>({conversion:aL,priority:0}),span:()=>({conversion:ngi,priority:0}),strong:()=>({conversion:aL,priority:0}),sub:()=>({conversion:aL,priority:0}),sup:()=>({conversion:aL,priority:0}),u:()=>({conversion:aL,priority:0})}}static importJSON(e){return dg().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:r}=super.exportDOM(e);return w_(r)||nt(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=TFe(r,"b")),this.hasFormat("italic")&&(r=TFe(r,"i")),this.hasFormat("strikethrough")&&(r=TFe(r,"s")),this.hasFormat("underline")&&(r=TFe(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,r){}setFormat(e){let r=this.getWritable();return r.__format=typeof e=="string"?vb[e]:e,r}setDetail(e){let r=this.getWritable();return r.__detail=typeof e=="string"?Ehi[e]:e,r}setStyle(e){let r=this.getWritable();return r.__style=e,r}toggleFormat(e){let r=JFe(this.getFormat(),e,null);return this.setFormat(r)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let r=Mhi[e];if(this.__mode===r)return this;let n=this.getWritable();return n.__mode=r,n}setTextContent(e){if(this.__text===e)return this;let r=this.getWritable();return r.__text=e,r}select(e,r){fg();let n=e,o=r,i=ks(),a=this.getTextContent(),s=this.__key;if(typeof a=="string"){let u=a.length;n===void 0&&(n=u),o===void 0&&(o=u)}else n=0,o=0;if(!fn(i))return gYr(s,n,s,o,"text","text");{let u=zB();u!==i.anchor.key&&u!==i.focus.key||pg(s),i.setTextNodeRange(this,n,this,o)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,r,n,o){let i=this.getWritable(),a=i.__text,s=n.length,u=e;u<0&&(u=s+u,u<0&&(u=0));let l=ks();if(o&&fn(l)){let d=e+s;l.setTextNodeRange(i,d,i,d)}let c=a.slice(0,u)+n+a.slice(u+r);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){fg();let r=this.getLatest(),n=r.getTextContent();if(n==="")return[];let o=r.__key,i=zB(),a=n.length;e.sort((P,R)=>P-R),e.push(a);let s=[],u=e.length;for(let P=0,R=0;P<a&&R<=u;R++){let I=e[R];I>P&&(s.push(n.slice(P,I)),P=I)}let l=s.length;if(l===1)return[r];let c=s[0],d=r.getParent(),f,p=r.getFormat(),m=r.getStyle(),h=r.__detail,y=!1,g=null,b=null,_=ks();if(fn(_)){let[P,R]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];P.type==="text"&&P.key===o&&(g=P),R.type==="text"&&R.key===o&&(b=R)}r.isSegmented()?(f=dg(c),f.__format=p,f.__style=m,f.__detail=h,f.__state=$Xr(r,f),y=!0):f=r.setTextContent(c);let w=[f];for(let P=1;P<l;P++){let R=dg(s[P]);R.__format=p,R.__style=m,R.__detail=h,R.__state=$Xr(r,R);let I=R.__key;i===o&&pg(I),w.push(R)}let T=g?g.offset:null,O=b?b.offset:null,E=0;for(let P of w){if(!g&&!b)break;let R=E+P.getTextContentSize();if(g!==null&&T!==null&&T<=R&&T>=E&&(g.set(P.getKey(),T-E,"text"),T<R&&(g=null)),b!==null&&O!==null&&O<=R&&O>=E){b.set(P.getKey(),O-E,"text");break}E=R}if(d!==null){(function(I){let N=I.getPreviousSibling(),z=I.getNextSibling();N!==null&&KFe(N),z!==null&&KFe(z)})(this);let P=d.getWritable(),R=this.getIndexWithinParent();y?(P.splice(R,0,w),this.remove()):P.splice(R,1,w),fn(_)&&zFe(_,d,R,l-1)}return w}mergeWithSibling(e){let r=e===this.getPreviousSibling();r||e===this.getNextSibling()||nt(50);let n=this.__key,o=e.__key,i=this.__text,a=i.length;zB()===o&&pg(n);let s=ks();if(fn(s)){let d=s.anchor,f=s.focus;d!==null&&d.key===o&&rZr(d,r,n,e,a),f!==null&&f.key===o&&rZr(f,r,n,e,a)}let u=e.__text,l=r?u+i:i+u;this.setTextContent(l);let c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}};function ngi(t){return{forChild:hvt(t.style),node:null}}function ogi(t){let e=t,r=e.style.fontWeight==="normal";return{forChild:hvt(e.style,r?void 0:"bold"),node:null}}var JXr=new WeakMap;function igi(t){if(!w_(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function agi(t){let e=t;t.parentElement===null&&nt(129);let r=e.textContent||"";if(function(n){let o,i=n.parentNode,a=[n];for(;i!==null&&(o=JXr.get(i))===void 0&&!igi(i);)a.push(i),i=i.parentNode;let s=o===void 0?i:o;for(let u=0;u<a.length;u++)JXr.set(a[u],s);return s}(e)!==null){let n=r.split(/(\r?\n|\t)/),o=[],i=n.length;for(let a=0;a<i;a++){let s=n[a];s===`
|
||
`||s===`\r
|
||
`?o.push(yY()):s===" "?o.push(eke()):s!==""&&o.push(dg(s))}return{node:o}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),r==="")return{node:null};if(r[0]===" "){let n=e,o=!0;for(;n!==null&&(n=KXr(n,!1))!==null;){let i=n.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(r=r.slice(1)),o=!1;break}}o&&(r=r.slice(1))}if(r[r.length-1]===" "){let n=e,o=!0;for(;n!==null&&(n=KXr(n,!0))!==null;)if((n.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(r=r.slice(0,r.length-1))}return r===""?{node:null}:{node:dg(r)}}function KXr(t,e){let r=t;for(;;){let n;for(;(n=e?r.nextSibling:r.previousSibling)===null;){let i=r.parentElement;if(i===null)return null;r=i}if(r=n,w_(r)){let i=r.style.display;if(i===""&&!WYr(r)||i!==""&&!i.startsWith("inline"))return null}let o=r;for(;(o=e?r.firstChild:r.lastChild)!==null;)r=o;if(xN(r))return r;if(r.nodeName==="BR")return null}}var sgi={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function aL(t){let e=sgi[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:hvt(t.style,e),node:null}}function dg(t=""){return bfe(new n6(t))}function Mr(t){return t instanceof n6}function hvt(t,e){let r=t.fontWeight,n=t.textDecoration.split(" "),o=r==="700"||r==="bold",i=n.includes("line-through"),a=t.fontStyle==="italic",s=n.includes("underline"),u=t.verticalAlign;return l=>(Mr(l)&&(o&&!l.hasFormat("bold")&&l.toggleFormat("bold"),i&&!l.hasFormat("strikethrough")&&l.toggleFormat("strikethrough"),a&&!l.hasFormat("italic")&&l.toggleFormat("italic"),s&&!l.hasFormat("underline")&&l.toggleFormat("underline"),u!=="sub"||l.hasFormat("subscript")||l.toggleFormat("subscript"),u!=="super"||l.hasFormat("superscript")||l.toggleFormat("superscript"),e&&!l.hasFormat(e)&&l.toggleFormat(e)),l)}var bY=class t extends n6{static getType(){return"tab"}static clone(e){return new t(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){let r=super.createDOM(e),n=pY(e.theme,"tab");return n!==void 0&&r.classList.add(...n),r}static importJSON(e){return eke().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&nt(126),super.setTextContent(" ")}spliceText(e,r,n,o){return n===""&&r===0||n===" "&&r===1||nt(286),this}setDetail(e){return e!==2&&nt(127),this}setMode(e){return e!=="normal"&&nt(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function eke(){return bfe(new bY)}function gvt(t){return t instanceof bY}var H_t=class{constructor(e,r,n){this._selection=null,this.key=e,this.offset=r,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Lvt(MT(ZB(this,"next")),MT(ZB(e,"next")))<0}getNode(){let e=Sh(this.key);return e===null&&nt(20),e}set(e,r,n,o){let i=this._selection,a=this.key;o&&this.key===e&&this.offset===r&&this.type===n||(this.key=e,this.offset=r,this.type=n,PY()||(zB()===a&&pg(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function NT(t,e,r){return new H_t(t,e,r)}function w_t(t,e){let r=e.__key,n=t.offset,o="element";if(Mr(e)){o="text";let i=e.getTextContentSize();n>i&&(n=i)}else if(!et(e)){let i=e.getNextSibling();if(Mr(i))r=i.__key,n=0,o="text";else{let a=e.getParent();a&&(r=a.__key,n=e.getIndexWithinParent()+1)}}t.set(r,n,o)}function GXr(t,e){if(et(e)){let r=e.getLastDescendant();et(r)||Mr(r)?w_t(t,r):w_t(t,e)}else w_t(t,e)}var BFe=class t{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!tke(e))return!1;let r=this._nodes,n=e._nodes;return r.size===n.size&&Array.from(r).every(o=>n.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new t(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let r=this.getNodes(),n=r.length,o=r[n-1],i;if(Mr(o))i=o.select();else{let a=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(a,a)}i.insertNodes(e);for(let a=0;a<n;a++)r[a].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let r=this._nodes,n=[];for(let o of r){let i=Sh(o);i!==null&&n.push(i)}return PY()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),r="";for(let n=0;n<e.length;n++)r+=e[n].getTextContent();return r}deleteNodes(){let e=this.getNodes();if((ks()||s6())===this&&e[0]){let r=gg(e[0],"next");YYr(XB(r,r))}for(let r of e)r.remove()}};function fn(t){return t instanceof o6}var o6=class t{constructor(e,r,n,o){this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.format=n,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!fn(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let r=function(n){let o=[],[i,a]=n.getTextSlices();i&&o.push(i.caret.origin);let s=new Set,u=new Set;for(let l of n)if(IT(l)){let{origin:c}=l;o.length===0?s.add(c):(u.add(c),o.push(c))}else{let{origin:c}=l;et(c)&&u.has(c)||o.push(c)}if(a&&o.push(a.caret.origin),a6(n.focus)&&et(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let l=hL(n.focus.origin,"previous");IT(l)&&s.has(l.origin)&&!l.origin.isEmpty()&&l.origin.is(o[o.length-1]);l=OY(l))s.delete(l.origin),o.pop();for(;o.length>1;){let l=o[o.length-1];if(!et(l)||u.has(l)||l.isEmpty()||s.has(l))break;o.pop()}if(o.length===0&&n.isCollapsed()){let l=MT(n.anchor),c=MT(n.anchor.getFlipped()),d=p=>pL(p)?p.origin:p.getNodeAtCaret(),f=d(l)||d(c)||(n.anchor.getNodeAtCaret()?l.origin:c.origin);o.push(f)}return o}(kvt(evt(this),"next"));return PY()||(this._cachedNodes=r),r}setTextNodeRange(e,r,n,o){this.anchor.set(e.__key,r,"text"),this.focus.set(n.__key,o,"text")}getTextContent(){let e=this.getNodes();if(e.length===0)return"";let r=e[0],n=e[e.length-1],o=this.anchor,i=this.focus,a=o.isBefore(i),[s,u]=W_t(this),l="",c=!0;for(let d=0;d<e.length;d++){let f=e[d];if(et(f)&&!f.isInline())c||(l+=`
|
||
`),c=!f.isEmpty();else if(c=!1,Mr(f)){let p=f.getTextContent();f===r?f===n?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(p=s<u?p.slice(s,u):p.slice(u,s)):p=a?p.slice(s):p.slice(u):f===n&&(p=a?p.slice(0,u):p.slice(0,s)),l+=p}else!Vu(f)&&!QW(f)||f===n&&this.isCollapsed()||(l+=f.getTextContent())}return l}applyDOMRange(e){let r=fc(),n=r.getEditorState()._selection,o=hYr(e.startContainer,e.startOffset,e.endContainer,e.endOffset,r,n);if(o===null)return;let[i,a]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),$Fe(this)}clone(){let e=this.anchor,r=this.focus;return new t(NT(e.key,e.offset,e.type),NT(r.key,r.offset,r.type),this.format,this.style)}toggleFormat(e){this.format=JFe(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let r=vb[e];return!!(this.format&r)}insertRawText(e){let r=e.split(/(\r?\n|\t)/),n=[],o=r.length;for(let i=0;i<o;i++){let a=r[i];a===`
|
||
`||a===`\r
|
||
`?n.push(yY()):a===" "?n.push(eke()):n.push(dg(a))}this.insertNodes(n)}insertText(e){let r=this.anchor,n=this.focus,o=this.format,i=this.style,a=r,s=n;!this.isCollapsed()&&n.isBefore(r)&&(a=n,s=r),a.type==="element"&&function(y,g,b,_){let w=y.getNode(),T=w.getChildAtIndex(y.offset),O=dg(),E=qv(w)?fL().append(O):O;O.setFormat(b),O.setStyle(_),T===null?w.append(E):T.insertBefore(E),y.is(g)&&g.set(O.__key,0,"text"),y.set(O.__key,0,"text")}(a,s,o,i),s.type==="element"&&EY(s,MT(ZB(s,"next")));let u=a.offset,l=s.offset,c=this.getNodes(),d=c.length,f=c[0];Mr(f)||nt(26);let p=f.getTextContent().length,m=f.getParentOrThrow(),h=c[d-1];if(d===1&&s.type==="element"&&(l=p,s.set(a.key,l,"text")),this.isCollapsed()&&u===p&&(uL(f)||!f.canInsertTextAfter()||!m.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(Mr(y)&&y.canInsertTextBefore()&&!uL(y)||(y=dg(),y.setFormat(o),y.setStyle(i),m.canInsertTextAfter()?f.insertAfter(y):m.insertAfter(y)),y.select(0,0),f=y,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(uL(f)||!f.canInsertTextBefore()||!m.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(Mr(y)&&!uL(y)||(y=dg(),y.setFormat(o),m.canInsertTextBefore()?f.insertBefore(y):m.insertBefore(y)),y.select(),f=y,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&u!==p){let y=dg(f.getTextContent());y.setFormat(o),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){let y=h.getParent();if(!m.canInsertTextBefore()||!m.canInsertTextAfter()||et(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),mYr(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(VB(f)){let _=dg(e);return _.select(),void f.replace(_)}let y=f.getFormat(),g=f.getStyle();if(u!==l||y===o&&g===i){if(gvt(f)){let _=dg(e);return _.setFormat(o),_.setStyle(i),_.select(),void f.replace(_)}}else{if(f.getTextContent()!==""){let _=dg(e);if(_.setFormat(o),_.setStyle(i),_.select(),u===0)f.insertBefore(_,!1);else{let[w]=f.splitText(u);w.insertAfter(_,!1)}return void(_.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(o),f.setStyle(i)}let b=l-u;f=f.spliceText(u,b,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=y,this.style=g))}else{let y=new Set([...f.getParentKeys(),...h.getParentKeys()]),g=et(f)?f:f.getParentOrThrow(),b=et(h)?h:h.getParentOrThrow(),_=h;if(!g.is(b)&&b.isInline())do _=b,b=b.getParentOrThrow();while(b.isInline());if(s.type==="text"&&(l!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<l)if(Mr(h)&&!VB(h)&&l!==h.getTextContentSize()){if(h.isSegmented()){let P=dg(h.getTextContent());h.replace(P),h=P}qv(s.getNode())||s.type!=="text"||(h=h.spliceText(0,l,"")),y.add(h.__key)}else{let P=h.getParentOrThrow();P.canBeEmpty()||P.getChildrenSize()!==1?h.remove():P.remove()}else y.add(h.__key);let w=b.getChildren(),T=new Set(c),O=g.is(b),E=g.isInline()&&f.getNextSibling()===null?g:f;for(let P=w.length-1;P>=0;P--){let R=w[P];if(R.is(f)||et(R)&&R.isParentOf(f))break;R.isAttached()&&(!T.has(R)||R.is(_)?O||E.insertAfter(R,!1):R.remove())}if(!O){let P=b,R=null;for(;P!==null;){let I=P.getChildren(),N=I.length;(N===0||I[N-1].is(R))&&(y.delete(P.__key),R=P),P=P.getParent()}}if(VB(f))if(u===p)f.select();else{let P=dg(e);P.select(),f.replace(P)}else f=f.spliceText(u,p-u,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let P=1;P<d;P++){let R=c[P],I=R.__key;y.has(I)||R.remove()}}}removeText(){let e=ks()===this;nfe(this,QYr(evt(this))),e&&ks()!==this&&zv(this)}formatText(e,r=null){if(this.isCollapsed())return this.toggleFormat(e),void pg(null);let n=this.getNodes(),o=[];for(let w of n)Mr(w)&&o.push(w);let i=w=>{n.forEach(T=>{if(et(T)){let O=T.getFormatFlags(e,w);T.setTextFormat(O)}})},a=o.length;if(a===0)return this.toggleFormat(e),pg(null),void i(r);let s=this.anchor,u=this.focus,l=this.isBackward(),c=l?u:s,d=l?s:u,f=0,p=o[0],m=c.type==="element"?0:c.offset;if(c.type==="text"&&m===p.getTextContentSize()&&(f=1,p=o[1],m=0),p==null)return;let h=p.getFormatFlags(e,r);i(h);let y=a-1,g=o[y],b=d.type==="text"?d.offset:g.getTextContentSize();if(p.is(g)){if(m===b)return;if(uL(p)||m===0&&b===p.getTextContentSize())p.setFormat(h);else{let w=p.splitText(m,b),T=m===0?w[0]:w[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),d.type==="text"&&d.set(T.__key,b-m,"text")}return void(this.format=h)}m===0||uL(p)||([,p]=p.splitText(m),m=0),p.setFormat(h);let _=g.getFormatFlags(e,h);b>0&&(b===g.getTextContentSize()||uL(g)||([g]=g.splitText(b)),g.setFormat(_));for(let w=f+1;w<y;w++){let T=o[w],O=T.getFormatFlags(e,_);T.setFormat(O)}c.type==="text"&&c.set(p.__key,m,"text"),d.type==="text"&&d.set(g.__key,b,"text"),this.format=h|_}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let m=ks();return fn(m)||nt(134),m.insertNodes(e)}let r=(this.isBackward()?this.focus:this.anchor).getNode(),n=O_t(r,dL),o=e[e.length-1];if(et(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let m=S_t(this);n.splice(m,0,e),o.selectEnd()}return}if(!e.some(m=>(et(m)||Vu(m))&&!m.isInline())){et(n)||nt(211,r.constructor.name,r.getType());let m=S_t(this);return n.splice(m,0,e),void o.selectEnd()}let i=function(m){let h=fL(),y=null;for(let g=0;g<m.length;g++){let b=m[g],_=QW(b);if(_||Vu(b)&&b.isInline()||et(b)&&b.isInline()||Mr(b)||b.isParentRequired()){if(y===null&&(y=b.createParentElementNode(),h.append(y),_))continue;y!==null&&y.append(b)}else h.append(b),y=null}return h}(e),a=i.getLastDescendant(),s=i.getChildren(),u=!et(n)||!n.isEmpty()?this.insertParagraph():null,l=s[s.length-1],c=s[0];var d;et(d=c)&&dL(d)&&!d.isEmpty()&&et(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(et(n)||nt(211,r.constructor.name,r.getType()),n.append(...c.getChildren()),c=s[1]),c&&(n===null&&nt(212,r.constructor.name,r.getType()),function(m,h,y){let g=h.getParentOrThrow().getLastChild(),b=h,_=[h];for(;b!==g;)b.getNextSibling()||nt(140),b=b.getNextSibling(),_.push(b);let w=m;for(let T of _)w=w.insertAfter(T)}(n,c));let f=O_t(a,dL);u&&et(f)&&(u.canMergeWhenEmpty()||dL(l))&&(f.append(...u.getChildren()),u.remove()),et(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let p=et(n)?n.getLastChild():null;QW(p)&&f!==n&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){let a=fL();return Bv().splice(this.anchor.offset,0,[a]),a.select(),a}let e=S_t(this),r=O_t(this.anchor.getNode(),dL);et(r)||nt(213);let n=r.getChildAtIndex(e),o=n?[n,...n.getNextSiblings()]:[],i=r.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(e){let r=yY();if(this.insertNodes([r]),e){let n=r.getParentOrThrow(),o=r.getIndexWithinParent();n.select(o,o)}}extract(){let e=this.getNodes(),r=e.length,n=r-1,o=this.anchor,i=this.focus,a=e[0],s=e[n],[u,l]=W_t(this);if(r===0)return[];if(r===1){if(Mr(a)&&!this.isCollapsed()){let d=u>l?l:u,f=u>l?u:l,p=a.splitText(d,f),m=d===0?p[0]:p[1];return m!=null?[m]:[]}return[a]}let c=o.isBefore(i);if(Mr(a)){let d=c?u:l;d===a.getTextContentSize()?e.shift():d!==0&&([,a]=a.splitText(d),e[0]=a)}if(Mr(s)){let d=s.getTextContent().length,f=c?l:u;f===0?e.pop():f!==d&&([s]=s.splitText(f),e[n]=s)}return e}modify(e,r,n){if(nZr(this,e,r,n))return;let o=e==="move",i=fc(),a=CN(OC(i));if(!a)return;let s=i._blockCursorElement,u=i._rootElement,l=this.focus.getNode();if(u===null||s===null||!et(l)||l.isInline()||l.canBeEmpty()||G_t(s,i,u),this.dirty){let c=SY(i,this.anchor.key),d=SY(i,this.focus.key);this.anchor.type==="text"&&(c=i6(c)),this.focus.type==="text"&&(d=i6(d)),c&&d&&bYr(a,c,this.anchor.offset,d,this.focus.offset)}if(function(c,d,f,p){c.modify(d,f,p)}(a,e,r?"backward":"forward",n),a.rangeCount>0){let c=a.getRangeAt(0),d=this.anchor.getNode(),f=qv(d)?d:BYr(d);if(this.applyDOMRange(c),this.dirty=!0,!o){let p=this.getNodes(),m=[],h=!1;for(let y=0;y<p.length;y++){let g=p[y];GFe(g,f)?m.push(g):h=!0}if(h&&m.length>0)if(r){let y=m[0];et(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=m[m.length-1];et(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}a.anchorNode===c.startContainer&&a.anchorOffset===c.startOffset||function(y){let g=y.focus,b=y.anchor,_=b.key,w=b.offset,T=b.type;b.set(g.key,g.offset,g.type,!0),g.set(_,w,T,!0)}(this)}}n==="lineboundary"&&nZr(this,e,r,n,"decorators")}forwardDeletion(e,r,n){if(!n&&(e.type==="element"&&et(r)&&e.offset===r.getChildrenSize()||e.type==="text"&&e.offset===r.getTextContentSize())){let o=r.getParent(),i=r.getNextSibling()||(o===null?null:o.getNextSibling());if(et(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){let r=this.isCollapsed();if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,e))return;let i=jvt(ZB(n,e?"previous":"next"));if(i.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let u of i.iterNodeCarets("shadowRoot"))if(IT(u)){if(!u.origin.isInline()){if(u.origin.isShadowRoot()){if(s.type==="merge-block")break;if(et(i.anchor.origin)&&i.anchor.origin.isEmpty()){let l=MT(u);nfe(this,XB(l,l)),i.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:u,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(a6(u)){if(et(u.origin)){if(u.origin.isInline()){if(!u.origin.isParentOf(i.anchor.origin))break}else s={block:u.origin,type:"merge-next-block"};continue}if(Vu(u.origin)){if(!u.origin.isIsolated())if(s.type==="merge-next-block"&&(u.origin.isKeyboardSelectable()||!u.origin.isInline())&&et(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let l=yvt();l.add(u.origin.getKey()),zv(l)}else u.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:u,block:l}=s;return nfe(this,XB(!u.origin.isEmpty()&&l.isEmpty()?RY(gg(l,u.direction)):i.anchor,u)),this.removeText()}}let a=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&n.offset===0&&ZXr(this,n.getNode()))return}else{let s=a.type==="text"?a.getNode():null;if(o=n.type==="text"?n.getNode():null,s!==null&&s.isSegmented()){let u=a.offset,l=s.getTextContentSize();if(s.is(o)||e&&u!==l||!e&&u!==0)return void YXr(s,e,u)}else if(o!==null&&o.isSegmented()){let u=n.offset,l=o.getTextContentSize();if(o.is(s)||e&&u!==0||!e&&u!==l)return void YXr(o,e,u)}(function(u,l){let c=u.anchor,d=u.focus,f=c.getNode(),p=d.getNode();if(f===p&&c.type==="text"&&d.type==="text"){let m=c.offset,h=d.offset,y=m<h,g=y?m:h,b=y?h:m,_=b-1;g!==_&&function(w){return!(DYr(w)||ugi(w))}(f.getTextContent().slice(g,b))&&(l?d.set(d.key,_,d.type):c.set(c.key,_,c.type))}})(this,e)}}if(this.removeText(),e&&!r&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let n=this.anchor.getNode();n.isEmpty()&&qv(n.getParent())&&n.getPreviousSibling()===null&&ZXr(this,n)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let r=this.anchor,n=r.getNode();if(this.forwardDeletion(r,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function tke(t){return t instanceof BFe}function XXr(t){let e=t.offset;if(t.type==="text")return e;let r=t.getNode();return e===r.getChildrenSize()?r.getTextContent().length:0}function W_t(t){let e=t.getStartEndPoints();if(e===null)return[0,0];let[r,n]=e;return r.type==="element"&&n.type==="element"&&r.key===n.key&&r.offset===n.offset?[0,0]:[XXr(r),XXr(n)]}function ZXr(t,e){for(let r=e;r;r=r.getParent()){if(et(r)){if(r.collapseAtStart(t))return!0;if(DT(r))break}if(r.getPreviousSibling())break}return!1}var ugi=(()=>{try{let t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("\u2764\uFE0F")&&e("#\uFE0F\u20E3")&&e("\u{1F44D}"))return e}catch{}return()=>!1})();function YXr(t,e,r){let n=t,o=n.getTextContent().split(/(?=\s)/g),i=o.length,a=0,s=0;for(let l=0;l<i;l++){let c=l===i-1;if(s=a,a+=o[l].length,e&&a===r||a>r||c){o.splice(l,1),c&&(s=void 0);break}}let u=o.join("").trim();u===""?n.remove():(n.setTextContent(u),n.select(s,s))}function QXr(t,e,r,n){let o,i=e;if(w_(t)){let a=!1,s=t.childNodes,u=s.length,l=n._blockCursorElement;i===u&&(a=!0,i=u-1);let c=s[i],d=!1;if(c===l)c=s[i+1],d=!0;else if(l!==null){let f=l.parentNode;t===f&&e>Array.prototype.indexOf.call(f.children,l)&&i--}if(o=cY(c),Mr(o))i=AT(o,a?"next":"previous");else{let f=cY(t);if(f===null)return null;if(et(f)){let p=n.getElementByKey(f.getKey());p===null&&nt(214),[f,i]=f.getDOMSlot(p).resolveChildIndex(f,p,t,e),et(f)||nt(215),a&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let h=f.getChildAtIndex(i);if(et(h)&&function(y,g,b){let _=y.getParent();return b===null||_===null||!_.canBeEmpty()||_!==b.getNode()}(h,0,r)){let y=a?h.getLastDescendant():h.getFirstDescendant();y===null?f=h:(h=y,f=et(h)?h:h.getParentOrThrow()),i=0}Mr(h)?(o=h,f=null,i=AT(h,a?"next":"previous")):h!==f&&a&&!d&&(et(f)||nt(216),i=Math.min(f.getChildrenSize(),i+1))}else{let p=f.getIndexWithinParent();i=e===0&&Vu(f)&&cY(t)===f?p:p+1,f=f.getParentOrThrow()}if(et(f))return NT(f.__key,i,"element")}}else o=cY(t);return Mr(o)?NT(o.__key,AT(o,i,"clamp"),"text"):null}function eZr(t,e,r){let n=t.offset,o=t.getNode();if(n===0){let i=o.getPreviousSibling(),a=o.getParent();if(e){if((r||!e)&&i===null&&et(a)&&a.isInline()){let s=a.getPreviousSibling();Mr(s)&&t.set(s.__key,s.getTextContent().length,"text")}}else et(i)&&!r&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):Mr(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(n===o.getTextContent().length){let i=o.getNextSibling(),a=o.getParent();if(e&&et(i)&&i.isInline())t.set(i.__key,0,"element");else if((r||e)&&i===null&&et(a)&&a.isInline()&&!a.canInsertTextAfter()){let s=a.getNextSibling();Mr(s)&&t.set(s.__key,0,"text")}}}function mYr(t,e,r){if(t.type==="text"&&e.type==="text"){let n=t.isBefore(e),o=t.is(e);eZr(t,n,o),eZr(e,!n,o),o&&e.set(t.key,t.offset,t.type);let i=fc();if(i.isComposing()&&i._compositionKey!==t.key&&fn(r)){let a=r.anchor,s=r.focus;t.set(a.key,a.offset,a.type,!0),e.set(s.key,s.offset,s.type,!0)}}}function hYr(t,e,r,n,o,i){if(t===null||r===null||!hfe(o,t,r))return null;let a=QXr(t,e,fn(i)?i.anchor:null,o);if(a===null)return null;let s=QXr(r,n,fn(i)?i.focus:null,o);if(s===null)return null;if(a.type==="element"&&s.type==="element"){let u=cY(t),l=cY(r);if(Vu(u)&&Vu(l))return null}return mYr(a,s,i),[a,s]}function lgi(t){return et(t)&&!t.isInline()}function gYr(t,e,r,n,o,i){let a=gL(),s=new o6(NT(t,e,o),NT(r,n,i),0,"");return s.dirty=!0,a._selection=s,s}function yYr(){let t=NT("root",0,"element"),e=NT("root",0,"element");return new o6(t,e,0,"")}function yvt(){return new BFe(new Set)}function cgi(t,e){return rke(null,t,e,null)}function rke(t,e,r,n){let o=r._window;if(o===null)return null;let i=n||o.event,a=i?i.type:void 0,s=a==="selectionchange",u=!P_t&&(s||a==="beforeinput"||a==="compositionstart"||a==="compositionend"||a==="click"&&i&&i.detail===3||a==="drop"||a===void 0),l,c,d,f;if(fn(t)&&!u)return t.clone();if(e===null)return null;if(l=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,s&&fn(t)&&!hfe(r,l,c))return t.clone();let p=hYr(l,d,c,f,r,t);if(p===null)return null;let[m,h]=p;return new o6(m,h,fn(t)?t.format:0,fn(t)?t.style:"")}function ks(){return gL()._selection}function s6(){return fc()._editorState._selection}function zFe(t,e,r,n=1){let o=t.anchor,i=t.focus,a=o.getNode(),s=i.getNode();if(!e.is(a)&&!e.is(s))return;let u=e.__key;if(t.isCollapsed()){let l=o.offset;if(r<=l&&n>0||r<l&&n<0){let c=Math.max(0,l+n);o.set(u,c,"element"),i.set(u,c,"element"),tZr(t)}}else{let l=t.isBackward(),c=l?i:o,d=c.getNode(),f=l?o:i,p=f.getNode();if(e.is(d)){let m=c.offset;(r<=m&&n>0||r<m&&n<0)&&c.set(u,Math.max(0,m+n),"element")}if(e.is(p)){let m=f.offset;(r<=m&&n>0||r<m&&n<0)&&f.set(u,Math.max(0,m+n),"element")}}tZr(t)}function tZr(t){let e=t.anchor,r=e.offset,n=t.focus,o=n.offset,i=e.getNode(),a=n.getNode();if(t.isCollapsed()){if(!et(i))return;let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Mr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text"),n.set(l.__key,c,"text")}}else{if(et(i)){let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Mr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text")}}if(et(a)){let s=a.getChildrenSize(),u=o>=s,l=u?a.getChildAtIndex(s-1):a.getChildAtIndex(o);if(Mr(l)){let c=0;u&&(c=l.getTextContentSize()),n.set(l.__key,c,"text")}}}}function VFe(t,e,r,n,o){let i=null,a=0,s=null;n!==null?(i=n.__key,Mr(n)?(a=n.getTextContentSize(),s="text"):et(n)&&(a=n.getChildrenSize(),s="element")):o!==null&&(i=o.__key,Mr(o)?s="text":et(o)&&(s="element")),i!==null&&s!==null?t.set(i,a,s):(a=e.getIndexWithinParent(),a===-1&&(a=r.getChildrenSize()),t.set(r.__key,a,"element"))}function rZr(t,e,r,n,o){t.type==="text"?t.set(r,t.offset+(e?0:o),"text"):t.offset>n.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element")}function bYr(t,e,r,n,o){try{t.setBaseAndExtent(e,r,n,o)}catch{}}function dgi(t,e,r,n,o,i,a){let s=n.anchorNode,u=n.focusNode,l=n.anchorOffset,c=n.focusOffset,d=document.activeElement;if(o.has(xYr)&&d!==i||d!==null&&Cvt(d))return;if(!fn(e))return void(t!==null&&hfe(r,s,u)&&n.removeAllRanges());let f=e.anchor,p=e.focus,m=f.key,h=p.key,y=SY(r,m),g=SY(r,h),b=f.offset,_=p.offset,w=e.format,T=e.style,O=e.isCollapsed(),E=y,P=g,R=!1;if(f.type==="text"){E=i6(y);let X=f.getNode();R=X.getFormat()!==w||X.getStyle()!==T}else fn(t)&&t.anchor.type==="text"&&(R=!0);var I,N,z,V,k;if(p.type==="text"&&(P=i6(g)),E!==null&&P!==null&&(O&&(t===null||R||fn(t)&&(t.format!==w||t.style!==T))&&(I=w,N=T,z=b,V=m,k=performance.now(),aYr=[I,N,z,V,k]),l!==b||c!==_||s!==E||u!==P||n.type==="Range"&&O||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){if(bYr(n,E,b,P,_),!o.has(TYr)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let X=fn(e)&&e.anchor.type==="element"?E.childNodes[b]||null:n.rangeCount>0?n.getRangeAt(0):null;if(X!==null){let B;if(X instanceof Text){let Q=document.createRange();Q.selectNode(X),B=Q.getBoundingClientRect()}else B=X.getBoundingClientRect();(function(Q,Y,K){let oe=Mvt(K),ue=Rvt(oe);if(oe===null||ue===null)return;let{top:de,bottom:L}=Y,W=0,ie=0,j=K;for(;j!==null;){let A=j===oe.body;if(A)W=0,ie=OC(Q).innerHeight;else{let H=j.getBoundingClientRect();W=H.top,ie=H.bottom}let U=0;if(de<W?U=-(W-de):L>ie&&(U=L-ie),U!==0)if(A)ue.scrollBy(0,U);else{let H=j.scrollTop;j.scrollTop+=U;let re=j.scrollTop-H;de-=re,L-=re}if(A)break;j=yfe(j)}})(r,B,i)}}B_t=!0}}function fgi(t){let e=ks()||s6();e===null&&(e=Bv().selectEnd()),e.insertNodes(t)}function pgi(){let t=ks();return t===null?"":t.getTextContent()}function S_t(t){let e=t;t.isCollapsed()||e.removeText();let r=ks();fn(r)&&(e=r),fn(e)||nt(161);let n=e.anchor,o=n.getNode(),i=n.offset;for(;!dL(o);){let a=o;if([o,i]=mgi(o,i),a.is(o))break}return i}function mgi(t,e){let r=t.getParent();if(!r){let o=fL();return Bv().append(o),o.select(),[Bv(),0]}if(Mr(t)){let o=t.splitText(e);if(o.length===0)return[r,t.getIndexWithinParent()];let i=e===0?0:1;return[r,o[0].getIndexWithinParent()+i]}if(!et(t)||e===0)return[r,t.getIndexWithinParent()];let n=t.getChildAtIndex(e);if(n){let o=new o6(NT(t.__key,e,"element"),NT(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(n,...n.getNextSiblings())}return[r,t.getIndexWithinParent()+1]}function nZr(t,e,r,n,o="decorators-and-blocks"){if(e==="move"&&n==="character"&&!t.isCollapsed()){let[c,d]=r===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return d.set(c.key,c.offset,c.type),!0}let i=ZB(t.focus,r?"previous":"next"),a=n==="lineboundary",s=e==="move",u=i,l=o==="decorators-and-blocks";if(!eQr(u)){for(let c of u){l=!1;let{origin:d}=c;if(!Vu(d)||d.isIsolated()||(u=c,!a||!d.isInline()))break}if(l)for(let c of jvt(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(IT(c))c.origin.isInline()||(u=c);else{if(et(c.origin))continue;Vu(c.origin)&&!c.origin.isInline()&&(u=c)}break}}if(u===i)return!1;if(s&&!a&&Vu(u.origin)&&u.origin.isKeyboardSelectable()){let c=yvt();return c.add(u.origin.getKey()),zv(c),!0}return u=MT(u),s&&EY(t.anchor,u),EY(t.focus,u),l||!a}var mg=null,hg=null,Uv=!1,C_t=!1,RFe=0,oZr={characterData:!0,childList:!0,subtree:!0};function PY(){return Uv||mg!==null&&mg._readOnly}function fg(){Uv&&nt(13)}function _Yr(){RFe>99&&nt(14)}function gL(){return mg===null&&nt(195,vYr()),mg}function fc(){return hg===null&&nt(196,vYr()),hg}function vYr(){let t=0,e=new Set,r=wY.version;if(typeof window<"u")for(let o of document.querySelectorAll("[contenteditable]")){let i=gfe(o);if(oke(i))t++;else if(i){let a=String(i.constructor.version||"<0.17.1");a===r&&(a+=" (separately built, likely a bundler configuration issue)"),e.add(a)}}let n=` Detected on the page: ${t} compatible editor(s) with version ${r}`;return e.size&&(n+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),n}function hgi(){return hg}function iZr(t,e,r){let n=e.__type,o=wvt(t,n),i=r.get(n);i===void 0&&(i=Array.from(o.transforms),r.set(n,i));let a=i.length;for(let s=0;s<a&&(i[s](e),e.isAttached());s++);}function aZr(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function wYr(t,e){if(!e)return;let r=t._updateTags,n=e;Array.isArray(e)||(n=[e]);for(let o of n)r.add(o)}function ggi(t){return bvt(t,fc()._nodes)}function bvt(t,e){let r=t.type,n=e.get(r);n===void 0&&nt(17,r);let o=n.klass;t.type!==o.getType()&&nt(18,o.name);let i=o.importJSON(t),a=t.children;if(et(i)&&Array.isArray(a))for(let s=0;s<a.length;s++){let u=bvt(a[s],e);i.append(u)}return i}function sZr(t,e,r){let n=mg,o=Uv,i=hg;mg=e,Uv=!0,hg=t;try{return r()}finally{mg=n,Uv=o,hg=i}}function cL(t,e){let r=t._pendingEditorState,n=t._rootElement,o=t._headless||n===null;if(r===null)return;let i=t._editorState,a=i._selection,s=r._selection,u=t._dirtyType!==t6,l=mg,c=Uv,d=hg,f=t._updating,p=t._observer,m=null;if(t._pendingEditorState=null,t._editorState=r,!o&&u&&p!==null){hg=t,mg=r,Uv=!1,t._updating=!0;try{let O=t._dirtyType,E=t._dirtyElements,P=t._dirtyLeaves;p.disconnect(),m=zhi(i,r,t,O,E,P)}catch(O){if(O instanceof Error&&t._onError(O),C_t)throw O;return EYr(t,null,n,r),MZr(t),t._dirtyType=hY,C_t=!0,cL(t,i),void(C_t=!1)}finally{p.observe(n,oZr),t._updating=f,mg=l,Uv=c,hg=d}}r._readOnly||(r._readOnly=!0);let h=t._dirtyLeaves,y=t._dirtyElements,g=t._normalizedNodes,b=t._updateTags,_=t._deferred;u&&(t._dirtyType=t6,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(O,E){let P=O._decorators,R=O._pendingDecorators||P,I=E._nodeMap,N;for(N in R)I.has(N)||(R===P&&(R=AYr(O)),delete R[N])}(t,r);let w=o?null:CN(OC(t));if(t._editable&&w!==null&&(u||s===null||s.dirty)&&n!==null&&!b.has(OYr)){hg=t,mg=r;try{if(p!==null&&p.disconnect(),u||s===null||s.dirty){let O=t._blockCursorElement;O!==null&&G_t(O,t,n),dgi(a,s,t,w,b,n)}(function(O,E,P){let R=O._blockCursorElement;if(fn(P)&&P.isCollapsed()&&P.anchor.type==="element"&&E.contains(document.activeElement)){let I=P.anchor,N=I.getNode(),z=I.offset,V=!1,k=null;if(z===N.getChildrenSize())T_t(N.getChildAtIndex(z-1))&&(V=!0);else{let X=N.getChildAtIndex(z);if(X!==null&&T_t(X)){let B=X.getPreviousSibling();(B===null||T_t(B))&&(V=!0,k=O.getElementByKey(X.__key))}}if(V){let X=O.getElementByKey(N.__key);return R===null&&(O._blockCursorElement=R=function(B){let Q=B.theme,Y=document.createElement("div");Y.contentEditable="false",Y.setAttribute("data-lexical-cursor","true");let K=Q.blockCursor;if(K!==void 0){if(typeof K=="string"){let oe=DFe(K);K=Q.blockCursor=oe}K!==void 0&&Y.classList.add(...K)}return Y}(O._config)),E.style.caretColor="transparent",void(k===null?X.appendChild(R):X.insertBefore(R,k))}}R!==null&&G_t(R,O,E)})(t,n,s)}finally{p!==null&&p.observe(n,oZr),hg=d,mg=l}}m!==null&&function(O,E,P,R,I){let N=Array.from(O._listeners.mutation),z=N.length;for(let V=0;V<z;V++){let[k,X]=N[V];for(let B of X){let Q=E.get(B);Q!==void 0&&k(Q,{dirtyLeaves:R,prevEditorState:I,updateTags:P})}}}(t,m,b,h,i),fn(s)||s===null||a!==null&&a.is(s)||t.dispatchCommand(lvt,void 0);let T=t._pendingDecorators;T!==null&&(t._decorators=T,t._pendingDecorators=null,tfe("decorator",t,!0,T)),function(O,E,P){let R=fZr(E),I=fZr(P);R!==I&&tfe("textcontent",O,!0,I)}(t,e||i,r),tfe("update",t,!0,{dirtyElements:y,dirtyLeaves:h,editorState:r,mutatedNodes:m,normalizedNodes:g,prevEditorState:e||i,tags:b}),function(O,E){if(O._deferred=[],E.length!==0){let P=O._updating;O._updating=!0;try{for(let R=0;R<E.length;R++)E[R]()}finally{O._updating=P}}}(t,_),function(O){let E=O._updates;if(E.length!==0){let P=E.shift();if(P){let[R,I]=P;nke(O,R,I)}}}(t)}function tfe(t,e,r,...n){let o=e._updating;e._updating=r;try{let i=Array.from(e._listeners[t]);for(let a=0;a<i.length;a++)i[a].apply(null,n)}finally{e._updating=o}}function uZr(t,e){let r=t._updates,n=e||!1;for(;r.length!==0;){let o=r.shift();if(o){let[i,a]=o,s=t._pendingEditorState,u;a!==void 0&&(u=a.onUpdate,a.skipTransforms&&(n=!0),a.discrete&&(s===null&&nt(191),s._flushSync=!0),u&&t._deferred.push(u),wYr(t,a.tag)),s==null?nke(t,i,a):i()}}return n}function nke(t,e,r){let n=t._updateTags,o,i=!1,a=!1;r!==void 0&&(o=r.onUpdate,wYr(t,r.tag),i=r.skipTransforms||!1,a=r.discrete||!1),o&&t._deferred.push(o);let s=t._editorState,u=t._pendingEditorState,l=!1;(u===null||u._readOnly)&&(u=t._pendingEditorState=SYr(u||s),l=!0),u._flushSync=a;let c=mg,d=Uv,f=hg,p=t._updating;mg=u,Uv=!1,t._updating=!0,hg=t;let m=t._headless||t.getRootElement()===null;vvt(null);try{l&&(m?s._selection!==null&&(u._selection=s._selection.clone()):u._selection=function(b,_){let w=b.getEditorState()._selection,T=CN(OC(b));return fn(w)||w==null?rke(w,T,b,_):w.clone()}(t,r&&r.event||null));let y=t._compositionKey;e(),i=uZr(t,i),function(b,_){let w=_.getEditorState()._selection,T=b._selection;if(fn(T)){let O=T.anchor,E=T.focus,P;if(O.type==="text"&&(P=O.getNode(),P.selectionTransform(w,T)),E.type==="text"){let R=E.getNode();P!==R&&R.selectionTransform(w,T)}}}(u,t),t._dirtyType!==t6&&(i?function(b,_){let w=_._dirtyLeaves,T=b._nodeMap;for(let O of w){let E=T.get(O);Mr(E)&&E.isAttached()&&E.isSimpleText()&&!E.isUnmergeable()&&kXr(E)}}(u,t):function(b,_){let w=_._dirtyLeaves,T=_._dirtyElements,O=b._nodeMap,E=zB(),P=new Map,R=w,I=R.size,N=T,z=N.size;for(;I>0||z>0;){if(I>0){_._dirtyLeaves=new Set;for(let V of R){let k=O.get(V);Mr(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&kXr(k),k!==void 0&&aZr(k,E)&&iZr(_,k,P),w.add(V)}if(R=_._dirtyLeaves,I=R.size,I>0){RFe++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map,N.delete("root")&&N.set("root",!0);for(let V of N){let k=V[0],X=V[1];if(T.set(k,X),!X)continue;let B=O.get(k);B!==void 0&&aZr(B,E)&&iZr(_,B,P)}R=_._dirtyLeaves,I=R.size,N=_._dirtyElements,z=N.size,RFe++}_._dirtyLeaves=w,_._dirtyElements=T}(u,t),uZr(t),function(b,_,w,T){let O=b._nodeMap,E=_._nodeMap,P=[];for(let[R]of T){let I=E.get(R);I!==void 0&&(I.isAttached()||(et(I)&&OZr(I,R,O,E,P,T),O.has(R)||T.delete(R),P.push(R)))}for(let R of P)E.delete(R);for(let R of w){let I=E.get(R);I===void 0||I.isAttached()||(O.has(R)||w.delete(R),E.delete(R))}}(s,u,t._dirtyLeaves,t._dirtyElements)),y!==t._compositionKey&&(u._flushSync=!0);let g=u._selection;if(fn(g)){let b=u._nodeMap,_=g.anchor.key,w=g.focus.key;b.get(_)!==void 0&&b.get(w)!==void 0||nt(19)}else tke(g)&&g._nodes.size===0&&(u._selection=null)}catch(y){return y instanceof Error&&t._onError(y),t._pendingEditorState=s,t._dirtyType=hY,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void cL(t)}finally{mg=c,Uv=d,hg=f,t._updating=p,RFe=0}t._dirtyType!==t6||t._deferred.length>0||function(y,g){let b=g.getEditorState()._selection,_=y._selection;if(_!==null){if(_.dirty||!_.is(b))return!0}else if(b!==null)return!0;return!1}(u,t)?u._flushSync?(u._flushSync=!1,cL(t)):l&&Rgi(()=>{cL(t)}):(u._flushSync=!1,l&&(n.clear(),t._deferred=[],t._pendingEditorState=null))}function uS(t,e,r){hg===t&&r===void 0?e():nke(t,e,r)}var J_t=class t{constructor(e,r,n){this.element=e,this.before=r||null,this.after=n||null}withBefore(e){return new t(this.element,e,this.after)}withAfter(e){return new t(this.element,this.before,e)}withElement(e){return this.element===e?this:new t(e,this.before,this.after)}insertChild(e){let r=this.before||this.getManagedLineBreak();return r!==null&&r.parentElement!==this.element&&nt(222),this.element.insertBefore(e,r),this}removeChild(e){return e.parentElement!==this.element&&nt(223),this.element.removeChild(e),this}replaceChild(e,r){return r.parentElement!==this.element&&nt(224),this.element.replaceChild(e,r),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let r=e==="decorator"&&(mY||ofe);this.insertManagedLineBreak(r)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let r=this.element,n=e.nodeName==="IMG"?e.nextSibling:null;n&&r.removeChild(n),r.removeChild(e),r.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let r=this.getManagedLineBreak();if(r){if(e===(r.nodeName==="IMG"))return;this.removeManagedLineBreak()}let n=this.element,o=this.before,i=document.createElement("br");if(n.insertBefore(i,o),e){let a=document.createElement("img");a.setAttribute("data-lexical-linebreak","true"),a.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",a.alt="",n.insertBefore(a,i),n.__lexicalLineBreak=a}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let r=this.after;r!==null;r=r.previousSibling)e++;return e}resolveChildIndex(e,r,n,o){if(n===this.element){let u=this.getFirstChildOffset();return[e,Math.min(u+e.getChildrenSize(),Math.max(u,o))]}let i=lZr(r,n);i.push(o);let a=lZr(r,this.element),s=e.getIndexWithinParent();for(let u=0;u<a.length;u++){let l=i[u],c=a[u];if(l===void 0||l<c)break;if(l>c){s+=1;break}}return[e.getParentOrThrow(),s]}};function lZr(t,e){let r=[],n=e;for(;n!==t&&n!==null;n=n.parentNode){let o=0;for(let i=n.previousSibling;i!==null;i=i.previousSibling)o++;r.push(o)}return n!==t&&nt(225),r.reverse()}var KB=class extends JB{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return Phi[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getChildrenKeys(){let e=[],r=this.getFirstChild();for(;r!==null;)e.push(r.__key),r=r.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=fc()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(e)}getAllTextNodes(){let e=[],r=this.getFirstChild();for(;r!==null;){if(Mr(r)&&e.push(r),et(r)){let n=r.getAllTextNodes();e.push(...n)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;et(e);){let r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;et(e);){let r=e.getLastChild();if(r===null)break;e=r}return e}getDescendantByIndex(e){let r=this.getChildren(),n=r.length;if(e>=n){let i=r[n-1];return et(i)&&i.getLastDescendant()||i||null}let o=r[e];return et(o)&&o.getFirstDescendant()||o||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:Sh(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&nt(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Sh(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&nt(96,this.__key),e}getChildAtIndex(e){let r=this.getChildrenSize(),n,o;if(e<r/2){for(n=this.getFirstChild(),o=0;n!==null&&o<=e;){if(o===e)return n;n=n.getNextSibling(),o++}return null}for(n=this.getLastChild(),o=r-1;n!==null&&o>=e;){if(o===e)return n;n=n.getPreviousSibling(),o--}return null}getTextContent(){let e="",r=this.getChildren(),n=r.length;for(let o=0;o<n;o++){let i=r[o];e+=i.getTextContent(),et(i)&&o!==n-1&&!i.isInline()&&(e+=mL)}return e}getTextContentSize(){let e=0,r=this.getChildren(),n=r.length;for(let o=0;o<n;o++){let i=r[o];e+=i.getTextContentSize(),et(i)&&o!==n-1&&!i.isInline()&&(e+=mL.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let r=IXr[e];return!!(this.getFormat()&r)}return!1}hasTextFormat(e){let r=vb[e];return!!(this.getTextFormat()&r)}getFormatFlags(e,r){return JFe(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){fg();let n=ks(),o=e,i=r,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){let u=this.getFirstChild();if(Mr(u)||et(u))return u.select(0,0)}else if(!(e!==void 0&&e!==a||r!==void 0&&r!==a)){let u=this.getLastChild();if(Mr(u)||et(u))return u.select()}}o===void 0&&(o=a),i===void 0&&(i=a);let s=this.__key;return fn(n)?(n.anchor.set(s,o,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):gYr(s,o,s,i,"element","element")}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let r=this.getWritable();return r.__dir=e,r}setFormat(e){return this.getWritable().__format=e!==""?IXr[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){let r=this.getWritable();return r.__textFormat=e,r}setTextStyle(e){let r=this.getWritable();return r.__textStyle=e,r}setIndent(e){return this.getWritable().__indent=e,this}splice(e,r,n){let o=n.length,i=this.getChildrenSize(),a=this.getWritable();e+r<=i||nt(226,String(e),String(r),String(i));let s=a.__key,u=[],l=[],c=this.getChildAtIndex(e+r),d=null,f=i-r+o;if(e!==0)if(e===i)d=this.getLastChild();else{let m=this.getChildAtIndex(e);m!==null&&(d=m.getPreviousSibling())}if(r>0){let m=d===null?this.getFirstChild():d.getNextSibling();for(let h=0;h<r;h++){m===null&&nt(100);let y=m.getNextSibling(),g=m.__key;HB(m.getWritable()),l.push(g),m=y}}let p=d;for(let m=0;m<o;m++){let h=n[m];p!==null&&h.is(p)&&(d=p=p.getPreviousSibling());let y=h.getWritable();y.__parent===s&&f--,HB(y);let g=h.__key;if(p===null)a.__first=g,y.__prev=null;else{let b=p.getWritable();b.__next=g,y.__prev=b.__key}h.__key===s&&nt(76),y.__parent=s,u.push(g),p=h}if(e+r===i)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(c!==null){let m=c.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=c.__key}else m.__prev=null}if(a.__size=f,l.length){let m=ks();if(fn(m)){let h=new Set(l),y=new Set(u),{anchor:g,focus:b}=m;cZr(g,h,y)&&VFe(g,g.getNode(),this,d,c),cZr(b,h,y)&&VFe(b,b.getNode(),this,d,c),f!==0||this.canBeEmpty()||DT(this)||this.remove()}}return a}getDOMSlot(e){return new J_t(e)}exportDOM(e){let{element:r}=super.exportDOM(e);if(w_(r)){let n=this.getIndent();n>0&&(r.style.paddingInlineStart=40*n+"px");let o=this.getDirection();o&&(r.dir=o)}return{element:r}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),n=this.getTextStyle();return r!==0&&(e.textFormat=r),n!==""&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,r){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,r,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,r){let n=this.getDOMSlot(e),o=n.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){let a=r.getElementByKey(i.getKey());a!==null&&(o==null?(n.insertChild(a),o=a):o!==a&&n.replaceChild(a,o),o=o.nextSibling)}}};function et(t){return t instanceof KB}function cZr(t,e,r){let n=t.getNode();for(;n;){let o=n.__key;if(e.has(o)&&!r.has(o))return!0;n=n.getParent()}return!1}var pfe=class extends JB{decorate(e,r){nt(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Vu(t){return t instanceof pfe}var _Y=class t extends KB{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){nt(51)}getTextContent(){let e=this.__cachedText;return!PY()&&fc()._dirtyType!==t6||e===null?super.getTextContent():e}remove(){nt(52)}replace(e){nt(53)}insertBefore(e){nt(54)}insertAfter(e){nt(55)}updateDOM(e,r){return!1}splice(e,r,n){for(let o of n)et(o)||Vu(o)||nt(282);return super.splice(e,r,n)}static importJSON(e){return Bv().updateFromJSON(e)}collapseAtStart(){return!0}};function qv(t){return t instanceof _Y}function SYr(t){return new HFe(new Map(t._nodeMap))}function _vt(){return new HFe(new Map([["root",new _Y]]))}function CYr(t){let e=t.exportJSON(),r=t.constructor;if(e.type!==r.getType()&&nt(130,r.name),et(t)){let n=e.children;Array.isArray(n)||nt(59,r.name);let o=t.getChildren();for(let i=0;i<o.length;i++){let a=CYr(o[i]);n.push(a)}}return e}var HFe=class t{constructor(e,r){this._nodeMap=e,this._selection=r||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,r){return sZr(r&&r.editor||null,this,e)}clone(e){let r=new t(this._nodeMap,e===void 0?this._selection:e);return r._readOnly=!0,r}toJSON(){return sZr(null,this,()=>({root:CYr(Bv())}))}},ygi="historic",bgi="history-push",IFe="history-merge",_gi="paste",xYr="collaboration",vgi="skip-collab",TYr="skip-scroll-into-view",OYr="skip-dom-selection",WFe=class extends KB{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},vY=class t extends KB{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let r=document.createElement("p"),n=pY(e.theme,"paragraph");return n!==void 0&&r.classList.add(...n),r}updateDOM(e,r,n){return!1}static importDOM(){return{p:e=>({conversion:wgi,priority:0})}}exportDOM(e){let{element:r}=super.exportDOM(e);if(w_(r)){this.isEmpty()&&r.append(document.createElement("br"));let n=this.getFormatType();n&&(r.style.textAlign=n)}return{element:r}}static importJSON(e){return fL().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,r){let n=fL();n.setTextFormat(e.format),n.setTextStyle(e.style);let o=this.getDirection();return n.setDirection(o),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,r),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||Mr(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function wgi(t){let e=fL();return t.style&&(e.setFormat(t.style.textAlign),KYr(t,e)),{node:e}}function fL(){return bfe(new vY)}function Sgi(t){return t instanceof vY}var Cgi=0,xgi=1,Tgi=2,Ogi=3,Egi=4;function EYr(t,e,r,n){let o=t._keyToDOMMap;o.clear(),t._editorState=_vt(),t._pendingEditorState=n,t._compositionKey=null,t._dirtyType=t6,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;let i=t._observer;i!==null&&(i.disconnect(),t._observer=null),e!==null&&(e.textContent=""),r!==null&&(r.textContent="",o.set("root",r))}function Pgi(t){let e=t||{},r=hgi(),n=e.theme||{},o=t===void 0?r:e.parentEditor||null,i=e.disableEvents||!1,a=_vt(),s=e.namespace||(o!==null?o._config.namespace:jYr()),u=e.editorState,l=[_Y,n6,gY,bY,vY,WFe,...e.nodes||[]],{onError:c,html:d}=e,f=e.editable===void 0||e.editable,p;if(t===void 0&&r!==null)p=r._nodes;else{p=new Map;for(let h=0;h<l.length;h++){let y=l[h],g=null,b=null;if(typeof y!="function"){let E=y;y=E.replace,g=E.with,b=E.withKlass||null}let{ownNodeConfig:_}=Nvt(y),w=y.getType(),T=y.transform(),O=new Set;_&&_.$transform&&O.add(_.$transform),T!==null&&O.add(T),p.set(w,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:g,replaceWithKlass:b,sharedNodeState:RZr(l[h]),transforms:O})}}let m=new wY(a,o,p,{disableEvents:i,namespace:s,theme:n},c||console.error,function(h,y){let g=new Map,b=new Set,_=w=>{Object.keys(w).forEach(T=>{let O=g.get(T);O===void 0&&(O=[],g.set(T,O)),O.push(w[T])})};return h.forEach(w=>{let T=w.klass.importDOM;if(T==null||b.has(T))return;b.add(T);let O=T.call(w.klass);O!==null&&_(O)}),y&&_(y),g}(p,d?d.import:void 0),f,t);return u!==void 0&&(m._pendingEditorState=u,m._dirtyType=hY),m}var wY=class{constructor(e,r,n,o,i,a,s,u){this._createEditorArgs=u,this._parentEditor=r,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=t6,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=jYr(),this._onError=i,this._htmlConversions=a,this._editable=s,this._headless=r!==null&&r._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let r=this._listeners.update;return r.add(e),()=>{r.delete(e)}}registerEditableListener(e){let r=this._listeners.editable;return r.add(e),()=>{r.delete(e)}}registerDecoratorListener(e){let r=this._listeners.decorator;return r.add(e),()=>{r.delete(e)}}registerTextContentListener(e){let r=this._listeners.textcontent;return r.add(e),()=>{r.delete(e)}}registerRootListener(e){let r=this._listeners.root;return e(this._rootElement,null),r.add(e),()=>{e(null,this._rootElement),r.delete(e)}}registerCommand(e,r,n){n===void 0&&nt(35);let o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=o.get(e);i===void 0&&nt(36,String(e));let a=i[n];return a.add(r),()=>{a.delete(r),i.every(s=>s.size===0)&&o.delete(e)}}registerMutationListener(e,r,n){let o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(r);a===void 0&&(a=new Set,i.set(r,a)),a.add(o);let s=n&&n.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(r,o),()=>{a.delete(o),a.size===0&&i.delete(r)}}getRegisteredNode(e){let r=this._nodes.get(e.getType());return r===void 0&&nt(37,e.name),r}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,r){let n=this._editorState,o=Z_t(n).get(r.getType());if(!o)return;let i=new Map;for(let a of o.keys())i.set(a,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,r){let n=this.getRegisteredNode(e);return n.transforms.add(r),n}registerNodeTransform(e,r){let n=this.registerNodeTransformToKlass(e,r),o=[n],i=n.replaceWithKlass;if(i!=null){let a=this.registerNodeTransformToKlass(i,r);o.push(a)}return function(a,s){let u=Z_t(a.getEditorState()),l=[];for(let c of s){let d=u.get(c);d&&l.push(d)}l.length!==0&&a.update(()=>{for(let c of l)for(let d of c.keys()){let f=Sh(d);f&&f.markDirty()}},a._pendingEditorState===null?{tag:IFe}:void 0)}(this,o.map(a=>a.klass.getType())),()=>{o.forEach(a=>a.transforms.delete(r))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,r){return _r(this,e,r)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let r=this._rootElement;if(e!==r){let n=pY(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,EYr(this,r,e,o),r!==null&&(this._config.disableEvents||egi(r),n!=null&&r.classList.remove(...n)),e!==null){let i=Rvt(e),a=e.style;a.userSelect="text",a.whiteSpace="pre-wrap",a.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=hY,MZr(this),this._updateTags.add(IFe),cL(this),this._config.disableEvents||function(s,u){let l=s.ownerDocument,c=UFe.get(l);(c===void 0||c<1)&&l.addEventListener("selectionchange",dYr),UFe.set(l,(c||0)+1),s.__lexicalEditor=u;let d=cYr(s);for(let f=0;f<U_t.length;f++){let[p,m]=U_t[f],h=typeof m=="function"?y=>{HXr(y)||(VXr(y),(u.isEditable()||p==="click")&&m(y,u))}:y=>{if(HXr(y))return;VXr(y);let g=u.isEditable();switch(p){case"cut":return g&&_r(u,mvt,y);case"copy":return _r(u,pvt,y);case"paste":return g&&_r(u,cvt,y);case"dragstart":return g&&_r(u,YZr,y);case"dragover":return g&&_r(u,QZr,y);case"dragend":return g&&_r(u,eYr,y);case"focus":return g&&_r(u,tYr,y);case"blur":return g&&_r(u,rYr,y);case"drop":return g&&_r(u,ZZr,y)}};s.addEventListener(p,h),d.push(()=>{s.removeEventListener(p,h)})}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(IFe),cL(this);tfe("root",this,!1,e,r)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,r){e.isEmpty()&&nt(38);let n=e;n._readOnly&&(n=SYr(e),n._selection=e._selection?e._selection.clone():null),PZr(this);let o=this._pendingEditorState,i=this._updateTags,a=r!==void 0?r.tag:null;o===null||o.isEmpty()||(a!=null&&i.add(a),cL(this)),this._pendingEditorState=n,this._dirtyType=hY,this._dirtyElements.set("root",!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||cL(this)}parseEditorState(e,r){return function(n,o,i){let a=_vt(),s=mg,u=Uv,l=hg,c=o._dirtyElements,d=o._dirtyLeaves,f=o._cloneNotNeeded,p=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,mg=a,Uv=!1,hg=o,vvt(null);try{let m=o._nodes;bvt(n.root,m),i&&i(),a._readOnly=!0}catch(m){m instanceof Error&&o._onError(m)}finally{o._dirtyElements=c,o._dirtyLeaves=d,o._cloneNotNeeded=f,o._dirtyType=p,mg=s,Uv=u,hg=l}return a}(typeof e=="string"?JSON.parse(e):e,this,r)}read(e){return cL(this),this.getEditorState().read(e,{editor:this})}update(e,r){(function(n,o,i){n._updating?n._updates.push([o,i]):nke(n,o,i)})(this,e,r)}focus(e,r={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),uS(this,()=>{let o=ks(),i=Bv();o!==null?o.dirty||zv(o.clone()):i.getChildrenSize()!==0&&(r.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),qYr("focus"),UYr(()=>{n.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let r=CN(this._window);r!==null&&r.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,tfe("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};wY.version="0.34.0+prod.esm";var K_t=null;function vvt(t){K_t=t}var PYr=1;function Mgi(){PYr=1}function wvt(t,e){let r=Svt(t,e);return r===void 0&&nt(30,e),r}function Svt(t,e){return t._nodes.get(e)}var Rgi=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function dZr(t){return Vu(ake(t))}function Cvt(t){let e=document.activeElement;if(!w_(e))return!1;let r=e.nodeName;return Vu(ake(t))&&(r==="INPUT"||r==="TEXTAREA"||e.contentEditable==="true"&&gfe(e)==null)}function hfe(t,e,r){let n=t.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(r)&&e!==null&&!Cvt(e)&&xvt(e)===t}catch{return!1}}function oke(t){return t instanceof wY}function xvt(t){let e=t;for(;e!=null;){let r=gfe(e);if(oke(r))return r;e=yfe(e)}return null}function gfe(t){return t?t.__lexicalEditor:null}function VB(t){return gvt(t)||t.isToken()}function uL(t){return VB(t)||t.isSegmented()}function xN(t){return MY(t)&&t.nodeType===phi}function MYr(t){return MY(t)&&t.nodeType===mhi}function i6(t){let e=t;for(;e!=null;){if(xN(e))return e;e=e.firstChild}return null}function JFe(t,e,r){let n=vb[e];if(r!==null&&(t&n)==(r&n))return t;let o=t^n;return e==="subscript"?o&=~vb.superscript:e==="superscript"?o&=~vb.subscript:e==="lowercase"?(o&=~vb.uppercase,o&=~vb.capitalize):e==="uppercase"?(o&=~vb.lowercase,o&=~vb.capitalize):e==="capitalize"&&(o&=~vb.lowercase,o&=~vb.uppercase),o}function Igi(t){return Mr(t)||QW(t)||Vu(t)}function RYr(t,e){let r=function(){let a=K_t;return K_t=null,a}();if((e=e||r&&r.__key)!=null)return void(t.__key=e);fg(),_Yr();let n=fc(),o=gL(),i=""+PYr++;o._nodeMap.set(i,t),et(t)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=SZr,t.__key=i}function HB(t){let e=t.getParent();if(e!==null){let r=t.getWritable(),n=e.getWritable(),o=t.getPreviousSibling(),i=t.getNextSibling(),a=i!==null?i.__key:null,s=o!==null?o.__key:null,u=o!==null?o.getWritable():null,l=i!==null?i.getWritable():null;o===null&&(n.__first=a),i===null&&(n.__last=s),u!==null&&(u.__next=a),l!==null&&(l.__prev=s),r.__prev=null,r.__next=null,r.__parent=null,n.__size--}}function KFe(t){_Yr();let e=t.getLatest(),r=e.__parent,n=gL(),o=fc(),i=n._nodeMap,a=o._dirtyElements;r!==null&&function(u,l,c){let d=u;for(;d!==null;){if(c.has(d))return;let f=l.get(d);if(f===void 0)break;c.set(d,!1),d=f.__parent}}(r,i,a);let s=e.__key;o._dirtyType=SZr,et(t)?a.set(s,!0):o._dirtyLeaves.add(s)}function pg(t){fg();let e=fc(),r=e._compositionKey;if(t!==r){if(e._compositionKey=t,r!==null){let n=Sh(r);n!==null&&n.getWritable()}if(t!==null){let n=Sh(t);n!==null&&n.getWritable()}}}function zB(){return PY()?null:fc()._compositionKey}function Sh(t,e){let r=(e||gL())._nodeMap.get(t);return r===void 0?null:r}function IYr(t,e){let r=ike(t,fc());return r!==void 0?Sh(r,e):null}function ike(t,e){return t[`__lexicalKey_${e._key}`]}function ake(t,e){let r=t;for(;r!=null;){let n=IYr(r,e);if(n!==null)return n;r=yfe(r)}return null}function AYr(t){let e=t._decorators,r=Object.assign({},e);return t._pendingDecorators=r,r}function fZr(t){return t.read(()=>Bv().getTextContent())}function Bv(){return NYr(gL())}function NYr(t){return t._nodeMap.get("root")}function zv(t){fg();let e=gL();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function cY(t){let e=fc(),r=function(n,o){let i=n;for(;i!=null;){let a=ike(i,o);if(a!==void 0)return a;i=yfe(i)}return null}(t,e);return r===null?t===e.getRootElement()?Sh("root"):null:Sh(r)}function DYr(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Tvt(t){let e=[],r=t;for(;r!==null;)e.push(r),r=r._parentEditor;return e}function jYr(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function $Yr(t){return xN(t)?t.nodeValue:null}function Ovt(t,e,r){let n=CN(OC(e));if(n===null)return;let o=n.anchorNode,{anchorOffset:i,focusOffset:a}=n;if(o!==null){let s=$Yr(o),u=ake(o);if(s!==null&&Mr(u)){if(s===YFe&&r){let l=r.length;s=r,i=l,a=l}s!==null&&Evt(u,s,i,a,t)}}}function Evt(t,e,r,n,o){let i=t;if(i.isAttached()&&(o||!i.isDirty())){let a=i.isComposing(),s=e;(a||o)&&e[e.length-1]===YFe&&(s=e.slice(0,-1));let u=i.getTextContent();if(o||s!==u){if(s===""){if(pg(null),ofe||mY||NFe)i.remove();else{let h=fc();setTimeout(()=>{h.update(()=>{i.isAttached()&&i.remove()})},20)}return}let l=i.getParent(),c=s6(),d=i.getTextContentSize(),f=zB(),p=i.getKey();if(i.isToken()||f!==null&&p===f&&!a||fn(c)&&(l!==null&&!l.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===t.__key&&c.anchor.offset===0&&!i.canInsertTextBefore()&&!a||c.focus.key===t.__key&&c.focus.offset===d&&!i.canInsertTextAfter()&&!a))return void i.markDirty();let m=ks();if(!fn(m)||r===null||n===null)return void pZr(i,s,m);if(m.setTextNodeRange(i,r,i,n),i.isSegmented()){let h=dg(i.getTextContent());i.replace(h),i=h}pZr(i,s,m)}}}function pZr(t,e,r){if(t.setTextContent(e),fn(r)){let n=t.getKey();for(let o of["anchor","focus"]){let i=r[o];i.type==="text"&&i.key===n&&(i.offset=AT(t,i.offset,"clamp"))}}}function OFe(t,e,r){let n=e[r]||!1;return n==="any"||n===t[r]}function LYr(t,e){return OFe(t,e,"altKey")&&OFe(t,e,"ctrlKey")&&OFe(t,e,"shiftKey")&&OFe(t,e,"metaKey")}function nu(t,e,r){return LYr(t,r)&&t.key.toLowerCase()===e.toLowerCase()}var sL={ctrlKey:!SN,metaKey:SN},mZr={altKey:SN,ctrlKey:!SN};function hZr(t){return t.key==="Backspace"}function gZr(t){return nu(t,"a",sL)}function Agi(t){let e=Bv();if(fn(t)){let r=t.anchor,n=t.focus,o=r.getNode().getTopLevelElementOrThrow().getParentOrThrow();return r.set(o.getKey(),0,"element"),n.set(o.getKey(),o.getChildrenSize(),"element"),$Fe(t),t}{let r=e.select(0,e.getChildrenSize());return zv($Fe(r)),r}}function pY(t,e){t.__lexicalClassNameCache===void 0&&(t.__lexicalClassNameCache={});let r=t.__lexicalClassNameCache,n=r[e];if(n!==void 0)return n;let o=t[e];if(typeof o=="string"){let i=DFe(o);return r[e]=i,i}return o}function Pvt(t,e,r,n,o){if(r.size===0)return;let i=n.__type,a=n.__key,s=e.get(i);s===void 0&&nt(33,i);let u=s.klass,l=t.get(u);l===void 0&&(l=new Map,t.set(u,l));let c=l.get(a),d=c==="destroyed"&&o==="created";(c===void 0||d)&&l.set(a,d?"updated":o)}function Ngi(t){let e=t.getType(),r=gL();if(r._readOnly){let i=Z_t(r).get(e);return i?Array.from(i.values()):[]}let n=r._nodeMap,o=[];for(let[,i]of n)i instanceof t&&i.__type===e&&i.isAttached()&&o.push(i);return o}function yZr(t,e,r){let n=t.getParent(),o=r,i=t;return n!==null&&(e&&r===0?(o=i.getIndexWithinParent(),i=n):e||r!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=n)),i.getChildAtIndex(e?o-1:o)}function FYr(t,e){let r=t.offset;if(t.type==="element")return yZr(t.getNode(),e,r);{let n=t.getNode();if(e&&r===0||!e&&r===n.getTextContentSize()){let o=e?n.getPreviousSibling():n.getNextSibling();return o===null?yZr(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):o}}return null}function kYr(t){let e=OC(t).event,r=e&&e.inputType;return r==="insertFromPaste"||r==="insertFromPasteAsQuotation"}function _r(t,e,r){return function(n,o,i){let a=Tvt(n);for(let s=4;s>=0;s--)for(let u=0;u<a.length;u++){let l=a[u],c=l._commands.get(o);if(c!==void 0){let d=c[s];if(d!==void 0){let f=Array.from(d),p=f.length,m=!1;if(uS(l,()=>{for(let h=0;h<p;h++)if(f[h](i,n))return void(m=!0)}),m)return m}}}return!1}(t,e,r)}function ske(t){return!qv(t)&&!t.isLastChild()&&!t.isInline()}function SY(t,e){let r=t._keyToDOMMap.get(e);return r===void 0&&nt(75,e),r}function yfe(t){let e=t.assignedSlot||t.parentElement;return HYr(e)?e.host:e}function Mvt(t){return MYr(t)?t:w_(t)?t.ownerDocument:null}function Dgi(t){return fc()._updateTags.has(t)}function qYr(t){fg(),fc()._updateTags.add(t)}function UYr(t){fg(),fc()._deferred.push(t)}function GFe(t,e){let r=t.getParent();for(;r!==null;){if(r.is(e))return!0;r=r.getParent()}return!1}function Rvt(t){let e=Mvt(t);return e?e.defaultView:null}function OC(t){let e=t._window;return e===null&&nt(78),e}function jgi(t){return et(t)&&t.isInline()||Vu(t)&&t.isInline()}function BYr(t){let e=t.getParentOrThrow();for(;e!==null;){if(DT(e))return e;e=e.getParentOrThrow()}return e}function DT(t){return qv(t)||et(t)&&t.isShadowRoot()}function Ivt(t){let e=t.constructor.clone(t);return RYr(e,null),e.afterCloneFrom(t),e}function bfe(t){let e=fc(),r=t.getType(),n=Svt(e,r);n===void 0&&nt(200,t.constructor.name,r);let{replace:o,replaceWithKlass:i}=n;if(o!==null){let a=o(t),s=a.constructor;return i!==null?a instanceof i||nt(201,i.name,i.getType(),s.name,s.getType(),t.constructor.name,r):a instanceof t.constructor&&s!==t.constructor||nt(202,s.name,s.getType(),t.constructor.name,r),a.__key===t.__key&&nt(203,t.constructor.name,r,s.name,s.getType()),a}return t}function x_t(t,e){!qv(t.getParent())||et(e)||Vu(e)||nt(99)}function zYr(t){let e=Sh(t);return e===null&&nt(63,t),e}function T_t(t){return(Vu(t)||et(t)&&!t.canBeEmpty())&&!t.isInline()}function G_t(t,e,r){r.style.removeProperty("caret-color"),e._blockCursorElement=null;let n=t.parentElement;n!==null&&n.removeChild(t)}function CN(t){return jT?(t||window).getSelection():null}function VYr(t){let e=Rvt(t);return e?e.getSelection():null}function $gi(t,e){let r=t.getChildAtIndex(e);r==null&&(r=t),DT(t)&&nt(102);let n=a=>{let s=a.getParentOrThrow(),u=DT(s),l=a!==r||u?Ivt(a):a;if(u)return et(a)&&et(l)||nt(133),a.insertAfter(l),[a,l,l];{let[c,d,f]=n(s),p=a.getNextSiblings();return f.append(l,...p),[c,d,l]}},[o,i]=n(r);return[o,i]}function Lgi(t){return w_(t)&&t.tagName==="A"}function w_(t){return MY(t)&&t.nodeType===fhi}function MY(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function HYr(t){return MY(t)&&t.nodeType===hhi}function WYr(t){let e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return t.nodeName.match(e)!==null}function X_t(t){let e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return t.nodeName.match(e)!==null}function dL(t){if(Vu(t)&&!t.isInline())return!0;if(!et(t)||DT(t))return!1;let e=t.getFirstChild(),r=e===null||QW(e)||Mr(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&r}function O_t(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}function Avt(){return fc()}var bZr=new WeakMap,Fgi=new Map;function Z_t(t){if(!t._readOnly&&t.isEmpty())return Fgi;t._readOnly||nt(192);let e=bZr.get(t);return e||(e=function(r){let n=new Map;for(let[o,i]of r._nodeMap){let a=i.__type,s=n.get(a);s||(s=new Map,n.set(a,s)),s.set(o,i)}return n}(t),bZr.set(t,e)),e}function JYr(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function KYr(t,e){let r=parseInt(t.style.paddingInlineStart,10)||0,n=Math.round(r/40);e.setIndent(n)}function kgi(t){t.__lexicalUnmanaged=!0}function GYr(t){return t.__lexicalUnmanaged===!0}function Xde(t,e){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(t,e)&&t[e]!==JB[e]}function Nvt(t){let e=AXr in t.prototype?t.prototype[AXr]():void 0,r=function(a){return a===pfe||a===KB||a===JB}(t),n=!r&&Xde(t,"getType")?t.getType():void 0,o,i=n;if(e)if(n)o=e[n];else for(let[a,s]of Object.entries(e))i=a,o=s;if(!r&&i&&(Xde(t,"getType")||(t.getType=()=>i),Xde(t,"clone")||(t.clone=a=>(vvt(a),new t)),Xde(t,"importJSON")||(t.importJSON=o&&o.$importJSON||(a=>new t().updateFromJSON(a))),!Xde(t,"importDOM")&&o)){let{importDOM:a}=o;a&&(t.importDOM=()=>a)}return{ownNodeConfig:o,ownNodeType:i}}function qgi(t){let e=Avt();return fg(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var Ugi={next:"previous",previous:"next"},CY=class{constructor(e){this.origin=e}[Symbol.iterator](){return $vt({hasNext:a6,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return gg(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return gg(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,r){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,r)),this}splice(e,r,n="next"){let o=n===this.direction?r:Array.from(r).reverse(),i=this,a=this.getParentAtCaret(),s=new Map;for(let u=i.getAdjacentCaret();u!==null&&s.size<e;u=u.getAdjacentCaret()){let l=u.origin.getWritable();s.set(l.getKey(),l)}for(let u of o){if(s.size>0){let l=i.getNodeAtCaret();if(l){if(s.delete(l.getKey()),s.delete(u.getKey()),!(l.is(u)||i.origin.is(u))){let c=u.getParent();c&&c.is(a)&&u.remove(),l.replace(u)}}else l===null&&nt(263,Array.from(s).join(" "))}else i.insert(u);i=gg(u,this.direction)}for(let u of s.values())u.remove();return this}},mfe=class t extends CY{constructor(){super(...arguments);x(this,"type","child")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:hL(r,this.direction)}getParentCaret(r="root"){return gg(Dvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=QB(this.direction);return gg(this.getNodeAtCaret(),r)||hL(this.origin,r)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)}isSamePointCaret(r){return this.isSameNodeCaret(r)}},Bgi={root:qv,shadowRoot:DT};function QB(t){return Ugi[t]}function Dvt(t,e="root"){return Bgi[e](t)?null:t}var xY=class t extends CY{constructor(){super(...arguments);x(this,"type","sibling")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:gg(r,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return et(this.origin)?hL(this.origin,this.direction):null}getParentCaret(r="root"){return gg(Dvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=QB(this.direction);return gg(this.getNodeAtCaret(),r)||hL(this.origin.getParentOrThrow(),r)}isSamePointCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)}isSameNodeCaret(r){return(r instanceof t||r instanceof TY)&&this.direction===r.direction&&this.origin.is(r.origin)}},TY=class t extends CY{constructor(r,n){super(r);x(this,"type","text");this.offset=n}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:GB(r,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(r="root"){return gg(Dvt(this.getParentAtCaret(),r),this.direction)}getFlipped(){return GB(this.origin,QB(this.direction),this.offset)}isSamePointCaret(r){return r instanceof t&&this.direction===r.direction&&this.origin.is(r.origin)&&this.offset===r.offset}isSameNodeCaret(r){return(r instanceof xY||r instanceof t)&&this.direction===r.direction&&this.origin.is(r.origin)}getSiblingCaret(){return gg(this.origin,this.direction)}};function pL(t){return t instanceof TY}function zgi(t){return t instanceof CY}function a6(t){return t instanceof xY}function IT(t){return t instanceof mfe}var Vgi={next:class extends TY{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends TY{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Hgi={next:class extends xY{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends xY{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Wgi={next:class extends mfe{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends mfe{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function gg(t,e){return t?new Hgi[e](t):null}function GB(t,e,r){return t?new Vgi[e](t,AT(t,r)):null}function AT(t,e,r="error"){let n=t.getTextContentSize(),o=e==="next"?n:e==="previous"?0:e;return(o<0||o>n)&&(r!=="clamp"&&function(i,...a){let s=new URL("https://lexical.dev/docs/error"),u=new URLSearchParams;u.append("code",i);for(let l of a)u.append("v",l);s.search=u.toString(),console.warn(`Minified Lexical warning #${i}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(284,String(e),String(n),t.getKey()),o=o<0?0:n),o}function Y_t(t,e){return new XFe(t,e)}function hL(t,e){return et(t)?new Wgi[e](t):null}function XYr(t){return t&&t.getChildCaret()||t}function OY(t){return t&&XYr(t.getAdjacentCaret())}var Q_t=class t{constructor(e,r,n){x(this,"type","node-caret-range");this.anchor=e,this.focus=r,this.direction=n}getLatest(){let e=this.anchor.getLatest(),r=this.focus.getLatest();return e===this.anchor&&r===this.focus?this:new t(e,r,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=o=>{let i=this[o].getLatest();return pL(i)?function(a,s){let{direction:u,origin:l}=a,c=AT(l,s==="focus"?QB(u):u);return Y_t(a,c-a.offset)}(i,o):null},r=e("anchor"),n=e("focus");if(r&&n){let{caret:o}=r,{caret:i}=n;if(o.isSameNodeCaret(i))return[Y_t(o,i.offset-o.offset),null]}return[r,n]}iterNodeCarets(e="root"){let r=pL(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),o=pL(n),i=a=>a.isSameNodeCaret(n)?null:OY(a)||a.getParentCaret(e);return $vt({hasNext:a=>a!==null&&!(o&&n.isSameNodeCaret(a)),initial:r.isSameNodeCaret(n)?null:i(r),map:a=>a,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}},XFe=class{constructor(e,r){x(this,"type","slice");this.caret=e,this.distance=r}getSliceIndices(){let{distance:e,caret:{offset:r}}=this,n=r+e;return n<r?[n,r]:[r,n]}getTextContent(){let[e,r]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,r)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:r}}=this,[n,o]=this.getSliceIndices(),i=e.getTextContent();return GB(e.setTextContent(i.slice(0,n)+i.slice(o)),r,n)}};function Jgi(t){return t instanceof XFe}function jvt(t){return XB(t,gg(Bv(),t.direction))}function ZYr(t){return XB(t,t)}function XB(t,e){return t.direction!==e.direction&&nt(265),new Q_t(t,e,t.direction)}function $vt(t){let{initial:e,hasNext:r,step:n,map:o}=t,i=e;return{[Symbol.iterator](){return this},next(){if(!r(i))return{done:!0,value:void 0};let a={done:!1,value:o(i)};return i=n(i),a}}}function Lvt(t,e){let r=rfe(t.origin,e.origin);switch(r===null&&nt(275,t.origin.getKey(),e.origin.getKey()),r.type){case"same":{let n=t.type==="text",o=e.type==="text";return n&&o?function(i,a){return Math.sign(i-a)}(t.offset,e.offset):t.type===e.type?0:n?-1:o?1:t.type==="child"?-1:1}case"ancestor":return t.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return Fvt(r)}}function Fvt(t){let{a:e,b:r}=t,n=e.__key,o=r.__key,i=e,a=r;for(;i&&a;i=i.getNextSibling(),a=a.getNextSibling()){if(i.__key===o)return-1;if(a.__key===n)return 1}return i===null?1:-1}function EFe(t,e){return e.is(t)}function _Zr(t){return et(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function rfe(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let r=new Map;for(let[n,o]=_Zr(t);n;o=n,n=n.getParent())r.set(n,o);for(let[n,o]=_Zr(e);n;o=n,n=n.getParent()){let i=r.get(n);if(i!==void 0)return i===null?(EFe(t,n)||nt(276),{commonAncestor:n,type:"ancestor"}):o===null?(EFe(e,n)||nt(277),{commonAncestor:n,type:"descendant"}):((et(i)||EFe(t,i))&&(et(o)||EFe(e,o))&&n.is(i.getParent())&&n.is(o.getParent())||nt(278),{a:i,b:o,commonAncestor:n,type:"branch"})}return null}function ZB(t,e){let{type:r,key:n,offset:o}=t,i=zYr(t.key);return r==="text"?(Mr(i)||nt(266,i.getType(),n),GB(i,e,o)):(et(i)||nt(267,i.getType(),n),tQr(i,t.offset,e))}function EY(t,e){let{origin:r,direction:n}=e,o=n==="next";pL(e)?t.set(r.getKey(),e.offset,"text"):a6(e)?Mr(r)?t.set(r.getKey(),AT(r,n),"text"):t.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(IT(e)&&et(r)||nt(268),t.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function YYr(t){let e=ks(),r=fn(e)?e:yYr();return nfe(r,t),zv(r),r}function nfe(t,e){EY(t.anchor,e.anchor),EY(t.focus,e.focus)}function evt(t){let{anchor:e,focus:r}=t,n=ZB(e,"next"),o=ZB(r,"next"),i=Lvt(n,o)<=0?"next":"previous";return XB(YB(n,i),YB(o,i))}function RY(t){let{direction:e,origin:r}=t,n=gg(r,QB(e)).getNodeAtCaret();return n?gg(n,e):hL(r.getParentOrThrow(),e)}function vZr(t,e="root"){let r=[t];for(let n=IT(t)?t.getParentCaret(e):t.getSiblingCaret();n!==null;n=n.getParentCaret(e))r.push(RY(n));return r}function E_t(t){return!!t&&t.origin.isAttached()}function QYr(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let r="root",n="next",o=e,i=kvt(t,n),a=vZr(i.anchor,r),s=vZr(i.focus.getFlipped(),r),u=new Set,l=[];for(let m of i.iterNodeCarets(r))if(IT(m))u.add(m.origin.getKey());else if(a6(m)){let{origin:h}=m;et(h)&&!u.has(h.getKey())||l.push(h)}for(let m of l)m.remove();for(let m of i.getTextSlices()){if(!m)continue;let{origin:h}=m.caret,y=h.getTextContentSize(),g=RY(gg(h,n)),b=h.getMode();if(Math.abs(m.distance)===y&&o==="removeEmptySlices"||b==="token"&&m.distance!==0)g.remove();else if(m.distance!==0){o="removeEmptySlices";let _=m.removeTextSlice(),w=m.caret.origin;if(b==="segmented"){let T=_.origin,O=dg(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());g.replaceOrInsert(O),_=GB(O,n,_.offset)}w.is(a[0].origin)&&(a[0]=_),w.is(s[0].origin)&&(s[0]=_.getFlipped())}}let c,d;for(let m of a)if(E_t(m)){c=MT(m);break}for(let m of s)if(E_t(m)){d=MT(m);break}let f=function(m,h,y){if(!m||!h)return null;let g=m.getParentAtCaret(),b=h.getParentAtCaret();if(!g||!b)return null;let _=g.getParents().reverse();_.push(g);let w=b.getParents().reverse();w.push(b);let T=Math.min(_.length,w.length),O;for(O=0;O<T&&_[O]===w[O];O++);let E=(I,N)=>{let z;for(let V=O;V<I.length;V++){let k=I[V];if(DT(k))return;!z&&N(k)&&(z=k)}return z},P=E(_,dL),R=P&&E(w,I=>y.has(I.getKey())&&dL(I));return P&&R?[P,R]:null}(c,d,u);if(f){let[m,h]=f;hL(m,"previous").splice(0,h.getChildren()),h.remove()}let p=[c,d,...a,...s].find(E_t);if(p)return ZYr(YB(MT(p),t.direction));nt(269,JSON.stringify(a.map(m=>m.origin.__key)))}function MT(t){let e=function(o){let i=o;for(;IT(i);){let a=OY(i);if(!IT(a))break;i=a}return i}(t.getLatest()),{direction:r}=e;if(Mr(e.origin))return pL(e)?e:GB(e.origin,r,r);let n=e.getAdjacentCaret();return a6(n)&&Mr(n.origin)?GB(n.origin,r,QB(r)):e}function eQr(t){return pL(t)&&t.offset!==AT(t.origin,t.direction)}function YB(t,e){return t.direction===e?t:t.getFlipped()}function kvt(t,e){return t.direction===e?t:XB(YB(t.focus,e),YB(t.anchor,e))}function tQr(t,e,r){let n=hL(t,"next");for(let o=0;o<e;o++){let i=n.getAdjacentCaret();if(i===null)break;n=i}return YB(n,r)}function Kgi(t,e="root"){let r=0,n=t,o=OY(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=OY(n)}return o&&[o,r]}function Ggi(t){let{origin:e,offset:r,direction:n}=t;if(r===AT(e,n))return t.getSiblingCaret();if(r===AT(e,QB(n)))return RY(t.getSiblingCaret());let[o]=e.splitText(r);return Mr(o)||nt(281),YB(gg(o,"next"),n)}function Xgi(t,e){return!0}function Zgi(t,{$copyElementNode:e=Ivt,$splitTextPointCaretNext:r=Ggi,rootMode:n="shadowRoot",$shouldSplit:o=Xgi}={}){if(pL(t))return r(t);let i=t.getParentCaret(n);if(i){let{origin:a}=i;if(IT(t)&&(!a.canBeEmpty()||!o(a,"first")))return RY(i);let s=function(u){let l=[];for(let c=u.getAdjacentCaret();c;c=c.getAdjacentCaret())l.push(c.origin);return l}(t);(s.length>0||a.canBeEmpty()&&o(a,"last"))&&i.insert(e(a).splice(0,0,s))}return i}var ye=qvt,gqs=ye.$addUpdateTag,yqs=ye.$applyNodeReplacement,IY=ye.$caretFromPoint,rQr=ye.$caretRangeFromSelection,ez=ye.$cloneWithProperties,bqs=ye.$comparePointCaretNext,_qs=ye.$copyNode,vqs=ye.$create,Uvt=ye.$createLineBreakNode,wqs=ye.$createNodeSelection,yL=ye.$createParagraphNode,Sqs=ye.$createPoint,uke=ye.$createRangeSelection,Cqs=ye.$createRangeSelectionFromDom,nQr=ye.$createTabNode,lS=ye.$createTextNode,oQr=ye.$extendCaretToRange,_fe=ye.$getAdjacentChildCaret,xqs=ye.$getAdjacentNode,Tqs=ye.$getAdjacentSiblingOrParentSiblingCaret,Bvt=ye.$getCaretInDirection,iQr=ye.$getCaretRange,Oqs=ye.$getCaretRangeInDirection,aQr=ye.$getCharacterOffsets,tz=ye.$getChildCaret,Eqs=ye.$getChildCaretAtIndex,zvt=ye.$getChildCaretOrSelf,sQr=ye.$getCollapsedCaretRange,Pqs=ye.$getCommonAncestor,Mqs=ye.$getCommonAncestorResultBranchOrder,lke=ye.$getEditor,Rqs=ye.$getNearestNodeFromDOMNode,Iqs=ye.$getNearestRootOrShadowRoot,uQr=ye.$getNodeByKey,Aqs=ye.$getNodeByKeyOrThrow,vfe=ye.$getPreviousSelection,Oi=ye.$getRoot,_n=ye.$getSelection,bL=ye.$getSiblingCaret,lQr=ye.$getState,Nqs=ye.$getStateChange,Dqs=ye.$getTextContent,jqs=ye.$getTextNodeOffset,$qs=ye.$getTextPointCaret,Lqs=ye.$getTextPointCaretSlice,Fqs=ye.$getWritableNodeState,cQr=ye.$hasAncestor,kqs=ye.$hasUpdateTag,qqs=ye.$insertNodes,cke=ye.$isBlockElementNode,wfe=ye.$isChildCaret,dke=ye.$isDecoratorNode,_i=ye.$isElementNode,dQr=ye.$isExtendableTextPointCaret,Uqs=ye.$isInlineElementOrDecoratorNode,fQr=ye.$isLeafNode,Bqs=ye.$isLineBreakNode,zqs=ye.$isNodeCaret,Vqs=ye.$isNodeSelection,pQr=ye.$isParagraphNode,Nr=ye.$isRangeSelection,AY=ye.$isRootNode,u6=ye.$isRootOrShadowRoot,mQr=ye.$isSiblingCaret,Hqs=ye.$isTabNode,Zi=ye.$isTextNode,fke=ye.$isTextPointCaret,Wqs=ye.$isTextPointCaretSlice,Vvt=ye.$isTokenOrSegmented,Jqs=ye.$isTokenOrTab,Kqs=ye.$nodesOfType,hQr=ye.$normalizeCaret,Gqs=ye.$normalizeSelection__EXPERIMENTAL,Xqs=ye.$onUpdate,gQr=ye.$parseSerializedNode,Zqs=ye.$removeTextFromCaretRange,yQr=ye.$rewindSiblingCaret,pke=ye.$selectAll,Yqs=ye.$setCompositionKey,Qqs=ye.$setPointFromCaret,l6=ye.$setSelection,bQr=ye.$setSelectionFromCaretRange,_Qr=ye.$setState,vQr=ye.$splitAtPointCaretNext,wQr=ye.$splitNode,eUs=ye.$updateRangeSelectionFromCaretRange,Hvt=ye.ArtificialNode__DO_NOT_USE,SQr=ye.BLUR_COMMAND,Sfe=ye.CAN_REDO_COMMAND,Cfe=ye.CAN_UNDO_COMMAND,CQr=ye.CLEAR_EDITOR_COMMAND,xQr=ye.CLEAR_HISTORY_COMMAND,tUs=ye.CLICK_COMMAND,rUs=ye.COLLABORATION_TAG,mke=ye.COMMAND_PRIORITY_CRITICAL,il=ye.COMMAND_PRIORITY_EDITOR,_L=ye.COMMAND_PRIORITY_HIGH,TQr=ye.COMMAND_PRIORITY_LOW,nUs=ye.COMMAND_PRIORITY_NORMAL,OQr=ye.CONTROLLED_TEXT_INSERTION_COMMAND,hke=ye.COPY_COMMAND,EQr=ye.CUT_COMMAND,NY=ye.DELETE_CHARACTER_COMMAND,PQr=ye.DELETE_LINE_COMMAND,MQr=ye.DELETE_WORD_COMMAND,oUs=ye.DRAGEND_COMMAND,iUs=ye.DRAGOVER_COMMAND,RQr=ye.DRAGSTART_COMMAND,IQr=ye.DROP_COMMAND,gke=ye.DecoratorNode,aUs=ye.ElementNode,sUs=ye.FOCUS_COMMAND,uUs=ye.FORMAT_ELEMENT_COMMAND,lUs=ye.FORMAT_TEXT_COMMAND,yke=ye.HISTORIC_TAG,DY=ye.HISTORY_MERGE_TAG,AQr=ye.HISTORY_PUSH_TAG,cUs=ye.INDENT_CONTENT_COMMAND,Wvt=ye.INSERT_LINE_BREAK_COMMAND,NQr=ye.INSERT_PARAGRAPH_COMMAND,dUs=ye.INSERT_TAB_COMMAND,xfe=ye.INTERNAL_$isBlock,fUs=ye.IS_ALL_FORMATTING,pUs=ye.IS_BOLD,mUs=ye.IS_CODE,hUs=ye.IS_HIGHLIGHT,gUs=ye.IS_ITALIC,yUs=ye.IS_STRIKETHROUGH,bUs=ye.IS_SUBSCRIPT,_Us=ye.IS_SUPERSCRIPT,vUs=ye.IS_UNDERLINE,DQr=ye.KEY_ARROW_DOWN_COMMAND,jQr=ye.KEY_ARROW_LEFT_COMMAND,$Qr=ye.KEY_ARROW_RIGHT_COMMAND,LQr=ye.KEY_ARROW_UP_COMMAND,FQr=ye.KEY_BACKSPACE_COMMAND,kQr=ye.KEY_DELETE_COMMAND,wUs=ye.KEY_DOWN_COMMAND,jY=ye.KEY_ENTER_COMMAND,qQr=ye.KEY_ESCAPE_COMMAND,SUs=ye.KEY_MODIFIER_COMMAND,CUs=ye.KEY_SPACE_COMMAND,UQr=ye.KEY_TAB_COMMAND,xUs=ye.LineBreakNode,TUs=ye.MOVE_TO_END,OUs=ye.MOVE_TO_START,EUs=ye.NODE_STATE_KEY,PUs=ye.OUTDENT_CONTENT_COMMAND,bke=ye.PASTE_COMMAND,BQr=ye.PASTE_TAG,MUs=ye.ParagraphNode,zQr=ye.REDO_COMMAND,VQr=ye.REMOVE_TEXT_COMMAND,RUs=ye.RootNode,IUs=ye.SELECTION_CHANGE_COMMAND,HQr=ye.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,WQr=ye.SELECT_ALL_COMMAND,AUs=ye.SKIP_COLLAB_TAG,NUs=ye.SKIP_DOM_SELECTION_TAG,DUs=ye.SKIP_SCROLL_INTO_VIEW_TAG,jUs=ye.TEXT_TYPE_TO_FORMAT,$Us=ye.TabNode,TN=ye.TextNode,JQr=ye.UNDO_COMMAND,LUs=ye.buildImportMap,KQr=ye.createCommand,GQr=ye.createEditor,FUs=ye.createSharedNodeState,kUs=ye.createState,qUs=ye.flipDirection,UUs=ye.getDOMOwnerDocument,Jvt=ye.getDOMSelection,BUs=ye.getDOMSelectionFromTarget,XQr=ye.getDOMTextNode,zUs=ye.getEditorPropertyFromDOMNode,VUs=ye.getNearestEditorFromDOMNode,ZQr=ye.getRegisteredNode,HUs=ye.getRegisteredNodeOrThrow,YQr=ye.isBlockDomNode,WUs=ye.isCurrentlyReadOnlyMode,JUs=ye.isDOMDocumentNode,KUs=ye.isDOMNode,GUs=ye.isDOMTextNode,XUs=ye.isDOMUnmanaged,Kvt=ye.isDocumentFragment,ZUs=ye.isExactShortcutMatch,QQr=ye.isHTMLAnchorElement,_ke=ye.isHTMLElement,Tfe=ye.isInlineDomNode,YUs=ye.isLexicalEditor,QUs=ye.isModifierMatch,eBs=ye.isSelectionCapturedInDecoratorInput,een=ye.isSelectionWithinEditor,Gvt=ye.makeStepwiseIterator,tBs=ye.removeFromParent,rBs=ye.resetRandomKey,nBs=ye.setDOMUnmanaged,oBs=ye.setNodeIndentFromDOM;var gen=$(J());Or();var men=require("obsidian"),pn=$(J());Cn();var vke=$(J());o_e();$r();var Ygi=k5("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"}}),Qc=vke.forwardRef(({className:t,variant:e,...r},n)=>vke.createElement("div",{ref:n,className:we(Ygi({variant:e}),t),...r}));Qc.displayName="Badge";var ao=$(J());Or();var $Y=$(J());$r();var wke=$(J()),Qgi=2;function eyi(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+Qgi<t.current?.scrollWidth)??!1}function tyi(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var pc=({children:t,className:e,lineClamp:r,tooltipContent:n,alwaysShowTooltip:o=!1,...i})=>{let a=(0,wke.useRef)(null),[s,u]=(0,wke.useState)(!1);return $Y.default.createElement(y_,{delayDuration:0},$Y.default.createElement(yn,{open:s,onOpenChange:c=>{u(c&&(o||eyi(a,r)))}},$Y.default.createElement(bn,{asChild:!0},$Y.default.createElement("div",{...i,ref:a,className:we("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&tyi(r),e),"data-testid":"truncatedText"},t)),$Y.default.createElement(dn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};Bt();$r();var LY=$(J());Or();$r();function ON({children:t,icon:e,onRemove:r,className:n,isClickable:o=!1,...i}){return LY.default.createElement(Qc,{variant:"default",tabIndex:r?0:void 0,className:we("tw-group/badge tw-items-center tw-gap-1 tw-border tw-border-solid tw-border-border tw-py-1 tw-pl-1.5 tw-pr-2 tw-text-xs",o&&"tw-cursor-pointer hover:tw-bg-interactive-hover",n),onKeyDown:r?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),a.stopPropagation(),r())}:void 0,...i},LY.default.createElement("span",{className:"tw-relative tw-size-4 tw-shrink-0"},LY.default.createElement("span",{className:we("tw-flex tw-size-full tw-items-center tw-justify-center",r&&"context-badge-icon-removable group-focus-within/badge:tw-invisible group-hover/badge:tw-invisible")},e),r&&LY.default.createElement("div",{"aria-hidden":"true",className:"context-badge-close tw-invisible tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-text-muted group-focus-within/badge:tw-visible group-hover/badge:tw-visible",onClick:a=>{a.stopPropagation(),r()}},LY.default.createElement(qo,{className:"tw-size-3"}))),t)}function Ske(t){return t.sourceType==="web"}function Ofe({faviconUrl:t,isLoaded:e=!0,className:r="tw-size-3"}){let[n,o]=ao.default.useState(!!t);return ao.default.useEffect(()=>{o(!!t)},[t]),e?n&&t?ao.default.createElement("img",{src:t,alt:"",referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",className:we(r,"tw-rounded-sm"),onError:()=>o(!1)}):ao.default.createElement(vl,{className:r}):ao.default.createElement(P1,{className:we(r,"tw-text-muted")})}function ten({currentActiveFile:t,onRemove:e,onClick:r}){if(!t)return null;let n=ao.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return ao.default.createElement(ON,{icon:ao.default.createElement(Du,{className:"tw-size-3"}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),o&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas"))}function ren({activeWebTab:t,onRemove:e,onClick:r}){if(!t)return null;let n=c1(t.url),o=t.title||n||t.url||"Untitled",i=ao.default.createElement("div",{className:"tw-text-left"},t.url);return ao.default.createElement(ON,{icon:ao.default.createElement(Ofe,{faviconUrl:t.faviconUrl}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},o),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"))}function Cke({note:t,onRemove:e,onClick:r}){let n=ao.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return ao.default.createElement(ON,{icon:ao.default.createElement(Du,{className:"tw-size-3"}),onRemove:e,isClickable:!!r,onClick:r},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),o&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas"))}function xke({url:t,onRemove:e}){return ao.default.createElement(ON,{icon:ao.default.createElement(M1,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:t},c1(t)))}function Tke({webTab:t,onRemove:e,onClick:r}){let n=t.isLoaded!==!1,o=c1(t.url),i=t.title||o||t.url||"Untitled",a=n?t.url:"Tab not loaded - switch to this tab to load content";return ao.default.createElement(ON,{icon:ao.default.createElement(Ofe,{faviconUrl:t.faviconUrl,isLoaded:n}),onRemove:e,isClickable:!!r,onClick:r,className:we(!n&&"tw-opacity-60")},ao.default.createElement(pc,{className:we("tw-max-w-40",!n&&"tw-italic"),tooltipContent:a},i),!n&&ao.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"(not loaded)"))}function nen({tag:t,onRemove:e}){let r=t.startsWith("#")?t.slice(1):t;return ao.default.createElement(ON,{icon:ao.default.createElement(WF,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:t},r))}function Oke({folder:t,onRemove:e}){return ao.default.createElement(ON,{icon:ao.default.createElement($m,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:t,alwaysShowTooltip:!0},t))}function oen({selectedText:t,onRemove:e}){if(Ske(t)){let o=c1(t.url),i=ao.default.createElement("div",{className:"tw-text-left"},t.url);return ao.default.createElement(ON,{icon:ao.default.createElement(Ofe,{faviconUrl:t.faviconUrl}),onRemove:e},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},t.title||o),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection"))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`,n=ao.default.createElement("div",{className:"tw-text-left"},t.notePath," (",r,")");return ao.default.createElement(ON,{icon:ao.default.createElement(Du,{className:"tw-size-3"}),onRemove:e},ao.default.createElement(pc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.noteTitle),ao.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r))}sd();ra();Bt();qZ();var Vv=$(J());var ien=$(J());var Eu=$(J());Or();$r();var ryi=120,nyi=240;function Eke({options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o="",mode:i="search",showPreview:a=!1,searchBarMode:s=!1,searchQuery:u="",onSearchChange:l,onKeyDown:c,className:d,width:f}){let p=(0,Eu.useRef)(null),m=(0,Eu.useRef)(null),[h,y]=Eu.default.useState(null);(0,Eu.useEffect)(()=>{y(null)},[e]),(0,Eu.useEffect)(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[e]);let g=w=>{let T=w.target.value;l?.(T)},b=w=>{(w.key==="ArrowDown"||w.key==="ArrowUp"||w.key==="Enter"||w.key==="Tab"||w.key==="Escape")&&(w.preventDefault(),c?.(w))},_=a&&t[e]?.content;return Eu.default.createElement("div",{className:we("tw-flex tw-flex-col",d)},_&&Eu.default.createElement("div",{className:"tw-mb-2 tw-overflow-hidden tw-rounded-md tw-bg-primary tw-p-3 tw-text-sm tw-shadow-xl",style:{minHeight:ryi,maxHeight:nyi,...f&&{width:f}}},Eu.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-text-muted"},"Preview"),t[e].subtitle&&Eu.default.createElement("div",{className:"tw-mb-2 tw-text-xs tw-text-muted"},t[e].subtitle),Eu.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-normal"},t[e].content)),Eu.default.createElement("div",{className:"tw-overflow-hidden tw-rounded-lg tw-bg-primary",style:{...f&&{width:f}}},Eu.default.createElement("div",{className:"tw-overflow-y-auto",style:{minHeight:Math.min(t.length*44+16,100),maxHeight:240}},Eu.default.createElement("div",{className:"tw-p-2 tw-text-normal"},t.map((w,T)=>{let O=T===e,E=T===h,P=w.disabled??!1,R=(O||E)&&!P,I=i==="category"&&!o&&w.icon&&!("data"in w);return Eu.default.createElement("div",{key:w.key,ref:O?p:void 0,className:we("tw-flex tw-items-center tw-rounded-md tw-px-3 tw-py-2 tw-text-sm",P?"tw-cursor-not-allowed tw-text-muted tw-opacity-50":"tw-cursor-pointer tw-text-normal",R&&"tw-bg-modifier-hover"),title:P?w.disabledReason:void 0,onMouseDown:N=>{N.preventDefault(),!P&&r(w)},onMouseEnter:()=>{P||(y(T),n(T))},onMouseLeave:()=>y(null)},I?Eu.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between"},Eu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},w.icon,Eu.default.createElement("span",{className:"tw-font-medium"},w.title)),Eu.default.createElement(ld,{className:"tw-size-4 tw-text-muted"})):Eu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center tw-gap-2"},w.icon&&Eu.default.createElement("div",{className:"tw-flex tw-h-full tw-shrink-0 tw-items-center"},w.icon),Eu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-0.5"},Eu.default.createElement("div",{className:"tw-truncate tw-font-medium tw-text-normal"},w.title),w.subtitle&&Eu.default.createElement("div",{className:"tw-truncate tw-text-xs tw-text-muted"},w.subtitle))))}))),s&&Eu.default.createElement("div",{className:"tw-border-t tw-border-solid tw-border-border tw-p-0.5"},Eu.default.createElement("input",{ref:m,type:"text",value:u,onChange:g,onKeyDown:b,placeholder:"Search...",autoFocus:!0,className:"tw-w-full tw-rounded-md !tw-border-none !tw-bg-transparent tw-px-1 tw-py-0 tw-text-sm tw-text-normal placeholder:tw-text-muted focus:!tw-shadow-none"}))))}function aen({options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o="",mode:i="search",showPreview:a=!1,searchBarMode:s=!1,searchQuery:u="",onSearchChange:l,onKeyDown:c}){return ien.default.createElement(Eke,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o,mode:i,showPreview:a,searchBarMode:s,searchQuery:u,onSearchChange:l,onKeyDown:c})}var c6=$(J()),sen=require("obsidian");Or();var oyi=[{key:"notes",title:"Notes",subtitle:"Reference notes in your vault",category:"notes",icon:c6.default.createElement(Du,{className:"tw-size-4"})},{key:"webTabs",title:"Web Tabs",subtitle:"Reference open browser tabs",category:"webTabs",icon:c6.default.createElement(vl,{className:"tw-size-4"})},{key:"tools",title:"Tools",subtitle:"AI tools and commands",category:"tools",icon:c6.default.createElement(vw,{className:"tw-size-4"})},{key:"folders",title:"Folders",subtitle:"Reference vault folders",category:"folders",icon:c6.default.createElement($m,{className:"tw-size-4"})}];function Pke(t=!1){return(0,c6.useMemo)(()=>oyi.filter(e=>e.category==="tools"?t:e.category==="webTabs"?sen.Platform.isDesktopApp:!0),[t])}var wb=$(J()),twt=require("obsidian");Or();var rwt=$(Efe());var len=$(J());XC();XC();var $T=require("obsidian"),Pfe=$(a9());Ye();Bt();Xe();var Rke=250,Xvt=bc([]),Zvt=bc([]),Yvt=bc([]),Qvt=bc([]),d6=class d6{constructor(){this.initialized=!1;this.handleFileCreate=e=>{e instanceof $T.TFile?yO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof $T.TFolder&&this.debouncedRefreshFolders()};this.handleFileDelete=e=>{e instanceof $T.TFile?yO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof $T.TFolder&&this.debouncedRefreshFolders()};this.handleFileRename=(e,r)=>{e instanceof $T.TFile?yO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof $T.TFolder&&this.debouncedRefreshFolders()};this.handleFileModify=e=>{e instanceof $T.TFile&&e.extension==="md"&&this.debouncedRefreshTagsAll()};this.handleMetadataChange=e=>{e.extension==="md"&&(this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll())};this.debouncedRefreshNotes=(0,Pfe.default)(()=>this.refreshNotes(),Rke,{leading:!0,trailing:!0});this.debouncedRefreshFolders=(0,Pfe.default)(()=>this.refreshFolders(),Rke,{leading:!0,trailing:!0});this.debouncedRefreshTagsFrontmatter=(0,Pfe.default)(()=>this.refreshTagsFrontmatter(),Rke,{leading:!0,trailing:!0});this.debouncedRefreshTagsAll=(0,Pfe.default)(()=>this.refreshTagsAll(),Rke,{leading:!0,trailing:!0});this.refreshNotes=()=>{if(!app?.vault)return;let r=app.vault.getFiles().filter(n=>n instanceof $T.TFile&&yO(n));No.set(Xvt,r)};this.refreshFolders=()=>{if(!app?.vault)return;let e=app.vault.getAllLoadedFiles().filter(r=>r instanceof $T.TFolder);No.set(Zvt,e)};this.refreshTagsFrontmatter=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{gO(n,!0).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();No.set(Yvt,r)};this.refreshTagsAll=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{gO(n,!1).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();No.set(Qvt,r)}}static getInstance(){return d6.instance||(d6.instance=new d6),d6.instance}initialize(){if(this.initialized){F("VaultDataManager: Already initialized, skipping");return}if(!app?.vault){F("VaultDataManager: app.vault not available, deferring initialization");return}F("VaultDataManager: Initializing with vault event listeners"),this.refreshNotes(),this.refreshFolders(),this.refreshTagsFrontmatter(),this.refreshTagsAll(),app.vault.on("create",this.handleFileCreate),app.vault.on("delete",this.handleFileDelete),app.vault.on("rename",this.handleFileRename),app.vault.on("modify",this.handleFileModify),app.metadataCache.on("changed",this.handleMetadataChange),this.initialized=!0}cleanup(){this.initialized&&(F("VaultDataManager: Cleaning up event listeners"),this.debouncedRefreshNotes.cancel(),this.debouncedRefreshFolders.cancel(),this.debouncedRefreshTagsFrontmatter.cancel(),this.debouncedRefreshTagsAll.cancel(),app?.vault&&(app.vault.off("create",this.handleFileCreate),app.vault.off("delete",this.handleFileDelete),app.vault.off("rename",this.handleFileRename),app.vault.off("modify",this.handleFileModify)),app?.metadataCache&&app.metadataCache.off("changed",this.handleMetadataChange),this.initialized=!1)}unload(){this.cleanup()}};d6.instance=null;var Mfe=d6;Ye();function Ike(t=!1){let e=L_(Xvt,{store:No});return(0,len.useMemo)(()=>{let r;return t?r=[...e]:r=e.filter(n=>n.extension==="md"||n.extension==="canvas"),r.sort((n,o)=>o.stat.ctime-n.stat.ctime)},[e,t])}XC();Ye();function cen(){return L_(Zvt,{store:No})}var FY=$(J()),den=require("obsidian");jW();var iyi=6e3;function ayi(){try{let t=_d(app),e=t.getLeaves(),r=[];for(let n of e){let o=t.getPageInfo(n),i=n.view,a=!!o.url?.trim(),s=!!o.title?.trim();if(!a&&!s)continue;let u=i.webviewMounted===void 0||i.webviewFirstLoadFinished===void 0?!0:!!(i.webviewMounted&&i.webviewFirstLoadFinished),l=a&&u;r.push({url:o.url||"",title:o.title||void 0,faviconUrl:o.faviconUrl||void 0,isLoaded:l})}return r.sort((n,o)=>{if(n.isLoaded!==o.isLoaded)return n.isLoaded?-1:1;let i=n.url||n.title||"",a=o.url||o.title||"";return i.localeCompare(a)}),r}catch{return[]}}function syi(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r];if(n.url!==o.url||n.title!==o.title||n.faviconUrl!==o.faviconUrl||n.isLoaded!==o.isLoaded)return!1}return!0}function fen(t={}){let{enabled:e=!0}=t,[r,n]=(0,FY.useState)([]),o=(0,FY.useRef)(null);return(0,FY.useEffect)(()=>{if(!e){n([]);return}if(!den.Platform.isDesktopApp){n([]);return}let i=!1,a=()=>{if(i)return;let p=ayi();n(m=>syi(m,p)?m:p)},s=()=>{i||o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null,a()}))};a();let l=_d(app).subscribeToWebviewLoad(s),c=app.workspace.on("layout-change",s),d=app.workspace.on("active-leaf-change",s),f=window.setInterval(s,iyi);return()=>{i=!0,o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null),window.clearInterval(f),app.workspace.offref(c),app.workspace.offref(d),l()}},[e]),r}var Nke=$(J()),ewt=require("obsidian");jW();var Ake={activeWebTabForMentions:null,activeOrLastWebTab:null};function rz(){let[t,e]=(0,Nke.useState)(()=>{if(!ewt.Platform.isDesktopApp)return Ake;try{return _d(app).getActiveWebTabState()}catch{return Ake}});return(0,Nke.useEffect)(()=>{if(!ewt.Platform.isDesktopApp){e(Ake);return}let r;try{let n=_d(app);e(n.getActiveWebTabState()),r=n.subscribeActiveWebTabState(e)}catch{e(Ake)}return()=>{r?.()}},[]),t}Ye();var Rfe=30;function Dke(t,e,r,n,o,i=null){let a=Ike(n),s=cen(),u=twt.Platform.isDesktopApp&&(e==="category"&&t.trim().length>0||e==="search"&&r==="webTabs"),l=fen({enabled:u}),{activeWebTabForMentions:c}=rz(),d=(0,wb.useMemo)(()=>a.map((h,y)=>({key:`note-${h.basename}-${y}`,title:h.basename,subtitle:h.path,category:"notes",data:h,content:void 0,icon:wb.default.createElement(Du,{className:"tw-size-4"}),searchKeyword:h.path})),[a]),f=(0,wb.useMemo)(()=>n?OX.map(h=>({key:`tool-${h}`,title:h,subtitle:zmt(h),category:"tools",data:h,content:zmt(h),icon:wb.default.createElement(vw,{className:"tw-size-4"})})):[],[n]),p=(0,wb.useMemo)(()=>s.map(h=>({key:`folder-${h.path}`,title:h.name,subtitle:h.path,category:"folders",data:h,content:void 0,icon:wb.default.createElement($m,{className:"tw-size-4"}),searchKeyword:h.path})),[s]),m=(0,wb.useMemo)(()=>twt.Platform.isDesktopApp?l.map((h,y)=>{let g=h.isLoaded!==!1;return{key:`webtab-${h.url||h.title||y}-${y}`,title:h.title||"Untitled",subtitle:g?h.url:"Tab not loaded",category:"webTabs",data:h,content:void 0,disabled:!g,disabledReason:"Switch to this tab to load it first",icon:g?wb.default.createElement(vl,{className:"tw-size-4"}):wb.default.createElement(P1,{className:"tw-size-4 tw-text-muted"}),searchKeyword:`${h.title||""} ${h.url||""}`}}):[],[l]);return(0,wb.useMemo)(()=>{if(e==="category"){if(!t){let I=o.map(z=>({...z,content:void 0})),N=[];return c&&N.push({key:"active-web-tab",title:"Active Web Tab",subtitle:void 0,category:"activeWebTab",data:c,content:void 0,icon:wb.default.createElement(vl,{className:"tw-size-4"})}),i&&N.push({key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:wb.default.createElement(R1,{className:"tw-size-4"})}),N.length>0?[...N,...I]:I}let h=t.toLowerCase(),y=f.filter(I=>I.title.toLowerCase().includes(h)),_="active note".includes(h)&&i?{key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:wb.default.createElement(R1,{className:"tw-size-4"})}:null,O="active web tab".includes(h)&&c?{key:"active-web-tab",title:"Active Web Tab",subtitle:void 0,category:"activeWebTab",data:c,content:void 0,icon:wb.default.createElement(vl,{className:"tw-size-4"})}:null,E=[...d,...p,...m],R=rwt.default.go(t,E,{keys:["searchKeyword"],limit:Rfe,threshold:-1e4}).map(I=>I.obj);return[...y,...O?[O]:[],..._?[_]:[],...R].slice(0,Rfe)}else{let h=[];switch(r){case"notes":h=d;break;case"tools":h=f;break;case"folders":h=p;break;case"webTabs":h=m;break}if(!t){if(r==="notes"){let g=te().customPromptsFolder,b=h.filter(w=>!(typeof w.data=="object"&&"path"in w.data&&typeof w.data.path=="string"&&w.data.path.startsWith(g+"/"))),_=h.filter(w=>typeof w.data=="object"&&"path"in w.data&&typeof w.data.path=="string"&&w.data.path.startsWith(g+"/"));return[...b,..._].slice(0,Rfe)}return h.slice(0,Rfe)}return rwt.default.go(t,h,{keys:["title","subtitle"],limit:Rfe,threshold:-1e4}).map(g=>g.obj)}},[e,t,r,d,f,p,m,o,c,i])}function uyi(t){return"data"in t}function lyi(t){return"icon"in t&&!("data"in t)}function pen({isOpen:t,onClose:e,onSelect:r,isCopilotPlus:n=!1,currentActiveFile:o=null}){let[i,a]=(0,Vv.useState)(""),[s,u]=(0,Vv.useState)(0),[l,c]=(0,Vv.useState)({mode:"category"}),d=Pke(n),f=Dke(i,l.mode,l.selectedCategory,n,d,o),p=(0,Vv.useCallback)(g=>{if(!g?.disabled){if(l.mode==="category"&&lyi(g)&&!i){c(b=>({...b,mode:"search",selectedCategory:g.category})),a(""),u(0);return}uyi(g)&&(r(g.category,g.data),e())}},[l.mode,i,r,e]),m=(0,Vv.useCallback)(g=>{u(g)},[]),h=(0,Vv.useCallback)(g=>{a(g),u(0)},[]),y=(0,Vv.useCallback)(g=>{switch(g.key){case"ArrowDown":{g.preventDefault();let b=s+1;for(;b<f.length&&f[b]?.disabled;)b++;b>=f.length&&(b=s),u(b);break}case"ArrowUp":{g.preventDefault();let b=s-1;for(;b>=0&&f[b]?.disabled;)b--;b<0&&(b=s),u(b);break}case"Enter":case"Tab":{g.preventDefault();let b=f[s];if(b?.disabled)break;b&&p(b);break}case"Escape":{g.preventDefault(),e();break}case"Backspace":{l.mode==="search"&&!i&&(g.preventDefault(),c({mode:"category",selectedCategory:void 0}),u(0));break}}},[s,f,p,e,l.mode,i]);return(0,Vv.useEffect)(()=>{t||(a(""),u(0),c({mode:"category",selectedCategory:void 0}))},[t]),(0,Vv.useEffect)(()=>{u(0)},[f.length]),t?Vv.default.createElement(aen,{options:f,selectedIndex:s,onSelect:p,onHighlight:m,query:i,mode:l.mode,showPreview:!1,searchBarMode:!0,searchQuery:i,onSearchChange:h,onKeyDown:y}):null}function cyi({selectedText:t,onRemoveContext:e}){if(Ske(t)){let n=c1(t.url);return pn.default.createElement(Qc,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pn.default.createElement(Ofe,{faviconUrl:t.faviconUrl}),pn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.title||n),pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection")),pn.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},pn.default.createElement(qo,{className:"tw-size-4"})))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return pn.default.createElement(Qc,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},pn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},pn.default.createElement(Du,{className:"tw-size-3"}),pn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),pn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),pn.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},pn.default.createElement(qo,{className:"tw-size-4"})))}var hen=({includeActiveNote:t,currentActiveFile:e,includeActiveWebTab:r,activeWebTab:n,contextNotes:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u=[],onRemoveContext:l,showProgressCard:c,showIndexingCard:d,onTypeaheadSelect:f,lexicalEditorRef:p})=>{let[m]=fw(),h=ULe(),[y]=l5(),[g,b]=(0,pn.useState)(!1),_=(0,pn.useRef)(null),w=zb(m),T=()=>{b(!1)},O=(B,Q)=>{f(B,Q),setTimeout(()=>{p?.current&&p.current.focus()},100)},E=B=>{j1t(B)},P=pn.default.useMemo(()=>{let B=new Map(o.map(Q=>[Q.path,Q]));return Array.from(B.values())},[o]),R=pn.default.useMemo(()=>Array.from(new Set(i)),[i]),I=pn.default.useMemo(()=>DW(s),[s]),N=u.length>0,z=t&&!N&&!!e,V=r&&!N&&!!n&&men.Platform.isDesktopApp,k=P.length>0||R.length>0||u.length>0||a.length>0||I.length>0||z||V,X=()=>{switch(h){case"success":return pn.default.createElement(K_,{className:"tw-size-4 tw-text-success"});case"loading":return pn.default.createElement(Bs,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return pn.default.createElement(Gb,{className:"tw-size-4 tw-text-error"});case"initial":return pn.default.createElement(P1,{className:"tw-size-4 tw-text-faint"})}};return pn.default.createElement("div",{className:"tw-flex tw-w-full tw-items-start tw-gap-1"},pn.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},pn.default.createElement(IB,{open:g,onOpenChange:b},pn.default.createElement(AB,{asChild:!0},pn.default.createElement(pe,{ref:_,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},pn.default.createElement("span",{className:"tw-text-base tw-font-medium tw-leading-none"},"@"),!k&&pn.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),pn.default.createElement(eL,{className:"tw-w-[400px] tw-p-0",align:"start",side:"top",sideOffset:4},pn.default.createElement(pen,{isOpen:g,onClose:T,onSelect:O,isCopilotPlus:w,currentActiveFile:e})))),pn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},z&&e&&pn.default.createElement(ten,{currentActiveFile:e,onRemove:()=>l("activeNote",""),onClick:()=>E(e)}),V&&n&&pn.default.createElement(ren,{activeWebTab:n,onRemove:()=>l("activeWebTab","")}),P.map(B=>pn.default.createElement(Cke,{key:B.path,note:B,onRemove:()=>l("notes",B.path),onClick:()=>E(B)})),R.map(B=>pn.default.createElement(xke,{key:B,url:B,onRemove:()=>l("urls",B)})),a.map(B=>pn.default.createElement(Oke,{key:B,folder:B,onRemove:()=>l("folders",B)})),I.map(B=>pn.default.createElement(Tke,{key:B.url,webTab:B,onRemove:()=>l("webTabs",B.url)})),u.map(B=>pn.default.createElement(cyi,{key:B.id,selectedText:B,onRemoveContext:l}))),m==="project"&&pn.default.createElement(pn.default.Fragment,null,pn.default.createElement(CC,{orientation:"vertical"}),pn.default.createElement("div",{className:""},pn.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>c()},X()))),m!=="project"&&y.isActive&&d&&pn.default.createElement(pn.default.Fragment,null,pn.default.createElement(CC,{orientation:"vertical"}),pn.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:d},pn.default.createElement(Bs,{className:"tw-size-3 tw-animate-spin"}),pn.default.createElement("span",{className:"tw-text-xs"},"Indexing..."))))};var yen=({contextNotes:t,includeActiveNote:e,activeNote:r,includeActiveWebTab:n,activeWebTab:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,showIndexingCard:c,lexicalEditorRef:d,onAddToContext:f,onRemoveFromContext:p})=>gen.default.createElement(hen,{includeActiveNote:e,currentActiveFile:r,includeActiveWebTab:n,activeWebTab:o,contextNotes:t,onRemoveContext:(y,g)=>{p(y,g)},contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,showIndexingCard:c,onTypeaheadSelect:(y,g)=>{f(y,g)},lexicalEditorRef:d});var nz=$(J());var _en=$(J());var ben=$(J());$r();function hy({children:t,className:e,...r}){return ben.default.createElement(Qc,{variant:"secondary",className:we("tw-mx-0.5 tw-inline-flex tw-items-center tw-gap-1 tw-border tw-border-solid tw-border-border tw-px-2 tw-py-0 tw-align-middle tw-text-xs",e),...r},t)}var Sb=class extends gke{constructor(e,r){super(r),this.__value=e}updateDOM(){return!1}isInline(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}canBeEmpty(){return!1}isKeyboardSelectable(){return!0}isIsolated(){return!0}isPill(){return!0}getValue(){return this.__value}setValue(e){let r=this.getWritable();r.__value=e}getTextContent(){return this.__value}createDOM(e){let r=document.createElement("span");return r.className=this.getClassName(),r}exportDOM(){let e=document.createElement("span");return e.setAttribute(this.getDataAttribute(),""),e.setAttribute("data-pill-value",this.__value),e.textContent=this.__value,{element:e}}exportJSON(){return{...super.exportJSON(),value:this.__value,type:this.getType(),version:1}}decorate(){return _en.default.createElement(hy,null,this.__value)}};var cS=$(J());$r();function EN({content:t,openBracket:e,closeBracket:r,className:n,maxWidth:o="tw-max-w-40",tooltipContent:i}){let a=(0,cS.useRef)(null),[s,u]=(0,cS.useState)(!1);return cS.default.createElement(y_,{delayDuration:300},cS.default.createElement(yn,{open:s,onOpenChange:c=>{let d=a.current?a.current.offsetWidth<a.current.scrollWidth:!1;u(c&&d)}},cS.default.createElement(bn,{asChild:!0},cS.default.createElement("span",{className:we("tw-inline-flex tw-items-center",o,n)},cS.default.createElement("span",{className:"tw-shrink-0"},e),cS.default.createElement("span",{ref:a,className:"tw-min-w-0 tw-truncate"},t),cS.default.createElement("span",{className:"tw-shrink-0"},r))),cS.default.createElement(dn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},i||`${e}${t}${r}`)))}var oz=class t extends Sb{static getType(){return"note-pill"}static clone(e){return new t(e.__noteTitle,e.__notePath,e.__key)}constructor(e,r,n){super(e,n),this.__noteTitle=e,this.__notePath=r}getClassName(){return"note-pill-wrapper"}getDataAttribute(){return"data-lexical-note-pill"}createDOM(e){let r=document.createElement("span");return r.className="note-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-note-pill")?{conversion:dyi,priority:1}:null}}static importJSON(e){let{noteTitle:r,notePath:n}=e;return Ife(r,n)}exportJSON(){return{...super.exportJSON(),noteTitle:this.__noteTitle,notePath:this.__notePath,type:"note-pill",version:1}}exportDOM(){let e=document.createElement("span");e.setAttribute("data-lexical-note-pill","true"),e.setAttribute("data-note-title",this.__noteTitle),e.setAttribute("data-note-path",this.__notePath);let r=this.__notePath.toLowerCase(),n=r.endsWith(".pdf")?`${this.__noteTitle}.pdf`:r.endsWith(".canvas")?`${this.__noteTitle}.canvas`:this.__noteTitle;return e.textContent=`[[${n}]]`,{element:e}}getTextContent(){let e=this.__notePath.toLowerCase();return`[[${e.endsWith(".pdf")?`${this.__noteTitle}.pdf`:e.endsWith(".canvas")?`${this.__noteTitle}.canvas`:this.__noteTitle}]]`}getNoteTitle(){return this.__noteTitle}getNotePath(){return this.__notePath}decorate(){return nz.default.createElement(fyi,{node:this})}};function dyi(t){let e=t.getAttribute("data-note-title"),r=t.getAttribute("data-note-path");return e&&r?{node:Ife(e,r)}:null}function fyi({node:t}){let e=t.getNoteTitle(),r=t.getNotePath(),n=r.toLowerCase(),o=n.endsWith(".pdf"),i=n.endsWith(".canvas");return nz.default.createElement(hy,null,nz.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nz.default.createElement(EN,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:nz.default.createElement("div",{className:"tw-text-left"},r)}),o&&nz.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&nz.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas")))}function Ife(t,e){return new oz(t,e)}function nwt(t){return t instanceof oz}function ven(t){let e=Oi(),r=0;function n(o){if(nwt(o)&&o.getNotePath()===t)o.remove(),r++;else if(typeof o.getChildren=="function"){let i=o.getChildren();for(let a of i)n(a)}}return n(e),r}var EC=$(J());var kY=$(J()),wen=(0,kY.createContext)(void 0);function Sen(){let t=(0,kY.useContext)(wen);return t===void 0?null:t.currentActiveFile}function jke({currentActiveFile:t,children:e}){return kY.default.createElement(wen.Provider,{value:{currentActiveFile:t}},e)}var iz=class t extends Sb{static getType(){return"active-note-pill"}static clone(e){return new t(e.__key)}constructor(e){super("Current Note",e)}getClassName(){return"active-note-pill-wrapper"}getDataAttribute(){return"data-lexical-active-note-pill"}createDOM(e){let r=document.createElement("span");return r.className="active-note-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-active-note-pill")?{conversion:pyi,priority:2}:null}}static importJSON(e){return Afe()}exportJSON(){return{...super.exportJSON(),type:"active-note-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-active-note-pill","true"),e.textContent="{activeNote}",{element:e}}getTextContent(){return"{activeNote}"}decorate(){return EC.default.createElement(myi,null)}};function pyi(t){return{node:Afe()}}function myi(){let t=Sen();if(!t)return EC.default.createElement(hy,null,EC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},EC.default.createElement(EN,{content:"activeNote",openBracket:"{",closeBracket:"}",tooltipContent:EC.default.createElement("div",{className:"tw-text-left"},"Will use the active note at the time the message is sent")})));let e=t.basename,r=t.path,n=r.toLowerCase().endsWith(".pdf");return EC.default.createElement(hy,null,EC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},EC.default.createElement(EN,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:EC.default.createElement("div",{className:"tw-text-left"},r)}),EC.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),n&&EC.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")))}function Afe(){return new iz}function owt(t){return t instanceof iz}function Cen(){let t=Oi(),e=0;function r(n){if(owt(n))n.remove(),e++;else if(typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}var Nfe=$(J());var f6=class t extends Sb{static getType(){return"url-pill"}static clone(e){return new t(e.__url,e.__title,e.__isActive,e.__key)}constructor(e,r,n=!1,o){super(e,o),this.__url=e,this.__title=r,this.__isActive=n}getClassName(){return"url-pill-wrapper"}getDataAttribute(){return"data-lexical-url-pill"}createDOM(e){let r=document.createElement("span");return r.className="url-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-url-pill")?{conversion:hyi,priority:1}:null}}static importJSON(e){let{url:r,title:n,isActive:o}=e;return $ke(r,n,o)}exportJSON(){return{...super.exportJSON(),url:this.__url,title:this.__title,isActive:this.__isActive,type:"url-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-url-pill","true"),e.setAttribute("data-url",this.__url),this.__title&&e.setAttribute("data-title",this.__title),e.textContent=this.__url,{element:e}}getTextContent(){return this.__url}getURL(){return this.__url}setURL(e){let r=this.getWritable();r.__url=e}getTitle(){return this.__title}setTitle(e){let r=this.getWritable();r.__title=e}setActive(e){let r=this.getWritable();r.__isActive=e}getActive(){return this.__isActive}decorate(){let e=this.__title||this.__url;return Nfe.default.createElement(hy,{className:"tw-whitespace-nowrap"},Nfe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Nfe.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e),this.__isActive&&Nfe.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Active")))}};function hyi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title");return e!==null?{node:$ke(e,r||void 0)}:null}function $ke(t,e,r=!1){return new f6(t,e,r)}function gyi(){let t=Oi(),e=[];function r(n){if(n instanceof f6&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function xen(t){let e=gyi();for(let r of e)r.getURL()===t&&r.remove()}function Ten(t){return t instanceof f6}var Lke=$(J());var vL=class t extends Sb{static getType(){return"folder-pill"}static clone(e){return new t(e.__value,e.__key)}constructor(e,r){super(e,r)}getClassName(){return"folder-pill-wrapper"}getDataAttribute(){return"data-lexical-folder-pill"}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-folder-pill")?{conversion:yyi,priority:1}:null}}static importJSON(e){let{value:r}=e;return Dfe(r)}exportJSON(){return{...super.exportJSON(),type:"folder-pill"}}decorate(){let e=Lke.default.createElement("div",{className:"tw-text-left"},this.getFolderPath());return Lke.default.createElement(hy,null,Lke.default.createElement(EN,{content:this.getFolderPath(),openBracket:"{",closeBracket:"}",tooltipContent:e}))}getTextContent(){return`{${this.getFolderPath()}}`}exportDOM(){let e=document.createElement("span");return e.setAttribute(this.getDataAttribute(),""),e.setAttribute("data-pill-value",this.__value),e.textContent=`{${this.getFolderPath()}}`,{element:e}}getFolderPath(){return this.getValue()}};function yyi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:Dfe(e)}:null}function Dfe(t){return new vL(t)}function Oen(t){return t instanceof vL}function byi(){let t=Oi(),e=[];function r(n){if(n instanceof vL&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function Een(t){let e=byi();for(let r of e)r.getValue()===t&&r.remove()}var p6=class t extends Sb{static getType(){return"tool-pill"}static clone(e){return new t(e.__value,e.__key)}constructor(e,r){super(e,r)}getClassName(){return"tool-pill-wrapper"}getDataAttribute(){return"data-lexical-tool-pill"}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-tool-pill")?{conversion:_yi,priority:1}:null}}static importJSON(e){let{value:r}=e;return m6(r)}exportJSON(){return{...super.exportJSON(),type:"tool-pill"}}getToolName(){return this.getValue()}};function _yi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:m6(e)}:null}function m6(t){return new p6(t)}function Pen(t){return t instanceof p6}function vyi(){let t=Oi(),e=[];function r(n){if(n instanceof p6&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function jfe(t){let e=vyi();for(let r of e)r.getValue()===t&&r.remove()}var gy=$(J());Or();var Men=require("obsidian");mr();var az=class t extends Sb{static getType(){return"active-web-tab-pill"}static clone(e){return new t(e.__key)}constructor(e){super("Current Web Tab",e)}getClassName(){return"active-web-tab-pill-wrapper"}getDataAttribute(){return"data-lexical-active-web-tab-pill"}createDOM(e){let r=document.createElement("span");return r.className="active-web-tab-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-active-web-tab-pill")?{conversion:wyi,priority:2}:null}}static importJSON(e){return Fke()}exportJSON(){return{...super.exportJSON(),type:"active-web-tab-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-active-web-tab-pill","true"),e.textContent=Fte,{element:e}}getTextContent(){return Fte}decorate(){return gy.default.createElement(Syi,null)}};function wyi(t){return{node:Fke()}}function Syi(){let{activeWebTabForMentions:t}=rz();return Men.Platform.isDesktopApp?t?gy.default.createElement(hy,null,gy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},gy.default.createElement(vl,{className:"tw-size-3"}),gy.default.createElement("span",{className:"tw-max-w-40 tw-truncate",title:t.url},t.title??"Untitled"),gy.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"))):gy.default.createElement(hy,null,gy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},gy.default.createElement(vl,{className:"tw-size-3"}),gy.default.createElement(EN,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:gy.default.createElement("div",{className:"tw-text-left"},"Will use the active web tab at the time the message is sent")}))):gy.default.createElement(hy,null,gy.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},gy.default.createElement(vl,{className:"tw-size-3"}),gy.default.createElement(EN,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:gy.default.createElement("div",{className:"tw-text-left"},"Web Viewer not supported on mobile")})))}function Fke(){return new az}function iwt(t){return t instanceof az}function Ren(){let t=Oi(),e=0;function r(n){if(iwt(n))n.remove(),e++;else if("getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}var $fe=$(J());Or();Bt();function Ien(t,e){return`[\u{1F310}: ${e?.trim()||c1(t)||"Untitled"}]`}var wL=class t extends Sb{static getType(){return"web-tab-pill"}static clone(e){return new t(e.__url,e.__title,e.__faviconUrl,e.__key)}constructor(e,r,n,o){super(e,o),this.__url=e,this.__title=r,this.__faviconUrl=n}getClassName(){return"web-tab-pill-wrapper"}getDataAttribute(){return"data-lexical-web-tab-pill"}createDOM(e){let r=document.createElement("span");return r.className="web-tab-pill-wrapper",r}static importDOM(){return{span:e=>e.hasAttribute("data-lexical-web-tab-pill")?{conversion:Cyi,priority:1}:null}}static importJSON(e){let{url:r,title:n,faviconUrl:o}=e;return kke(r,n,o)}exportJSON(){return{...super.exportJSON(),url:this.__url,title:this.__title,faviconUrl:this.__faviconUrl,type:"web-tab-pill",version:1}}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-lexical-web-tab-pill","true"),e.setAttribute("data-url",this.__url),this.__title&&e.setAttribute("data-title",this.__title),this.__faviconUrl&&e.setAttribute("data-favicon-url",this.__faviconUrl),e.textContent=Ien(this.__url,this.__title),{element:e}}getTextContent(){return Ien(this.__url,this.__title)}getURL(){return this.__url}getTitle(){return this.__title}getFaviconUrl(){return this.__faviconUrl}setTitle(e){let r=this.getWritable();r.__title=e}setFaviconUrl(e){let r=this.getWritable();r.__faviconUrl=e}decorate(){let e=this.__title||this.__url;return $fe.default.createElement(hy,{className:"tw-whitespace-nowrap"},$fe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},$fe.default.createElement(vl,{className:"tw-size-3"}),$fe.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e)))}};function Cyi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title"),n=t.getAttribute("data-favicon-url");return e!==null?{node:kke(e,r||void 0,n||void 0)}:null}function kke(t,e,r){return new wL(t,e,r)}function Aen(t){return t instanceof wL}function awt(){let t=Oi(),e=[];function r(n){if(n instanceof wL&&e.push(n),"getChildren"in n&&typeof n.getChildren=="function"){let o=n.getChildren();for(let i of o)r(i)}}return r(t),e}function Nen(t){let e=awt();for(let r of e)r.getURL()===t&&r.remove()}var Yi=$(J());var swt={};En(swt,{LexicalComposerContext:()=>Den,createLexicalComposerContext:()=>xyi,useLexicalComposerContext:()=>Tyi});var qke=$(J(),1),Den=(0,qke.createContext)(null);function xyi(t,e){let r=null;return t!=null&&(r=t[1]),{getTheme:function(){return e??(r!=null?r.getTheme():null)}}}function Tyi(){let t=(0,qke.useContext)(Den);return t==null&&function(e,...r){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let i of r)o.append("v",i);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t}var uwt=swt,jen=uwt.LexicalComposerContext,$en=uwt.createLexicalComposerContext,Di=uwt.useLexicalComposerContext;var lwt={};En(lwt,{LexicalComposer:()=>Eyi});var qY=$(J(),1),Len=$(St(),1),Fen=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Oyi=Fen?qY.useLayoutEffect:qY.useEffect,Uke={tag:DY};function Eyi({initialConfig:t,children:e}){let r=(0,qY.useMemo)(()=>{let{theme:n,namespace:o,nodes:i,onError:a,editorState:s,html:u}=t,l=$en(null,n),c=GQr({editable:t.editable,html:u,namespace:o,nodes:i,onError:d=>a(d,c),theme:n});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{let p=Oi();if(p.isEmpty()){let m=yL();p.append(m);let h=Fen?document.activeElement:null;(_n()!==null||h!==null&&h===d.getRootElement())&&m.select()}},Uke);else if(f!==null)switch(typeof f){case"string":{let p=d.parseEditorState(f);d.setEditorState(p,Uke);break}case"object":d.setEditorState(f,Uke);break;case"function":d.update(()=>{Oi().isEmpty()&&f(d)},Uke)}}}(c,s),[c,l]},[]);return Oyi(()=>{let n=t.editable,[o]=r;o.setEditable(n===void 0||n)},[]),(0,Len.jsx)(jen.Provider,{value:r,children:e})}var Pyi=lwt,Bke=Pyi.LexicalComposer;var cwt={};En(cwt,{useLexicalEditable:()=>Iyi});var PN=$(J(),1),Myi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?PN.useLayoutEffect:PN.useEffect;function Ryi(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function Iyi(){return function(t){let[e]=Di(),r=(0,PN.useMemo)(()=>t(e),[e,t]),[n,o]=(0,PN.useState)(()=>r.initialValueFn()),i=(0,PN.useRef)(n);return Myi(()=>{let{initialValueFn:a,subscribe:s}=r,u=a();return i.current!==u&&(i.current=u,o(u)),s(l=>{i.current=l,o(l)})},[r,t]),n}(Ryi)}var Ayi=cwt,ken=Ayi.useLexicalEditable;var fwt={};En(fwt,{$canShowPlaceholder:()=>Uen,$canShowPlaceholderCurry:()=>Dyi,$findTextIntersectionFromCharacters:()=>jyi,$isRootTextContentEmpty:()=>dwt,$isRootTextContentEmptyCurry:()=>Nyi,$rootTextContent:()=>qen,registerLexicalTextEntity:()=>Lyi});function qen(){return Oi().getTextContent()}function dwt(t,e=!0){if(t)return!1;let r=qen();return e&&(r=r.trim()),r===""}function Nyi(t,e){return()=>dwt(t,e)}function Uen(t){if(!dwt(t,!1))return!1;let e=Oi().getChildren(),r=e.length;if(r>1)return!1;for(let n=0;n<r;n++){let o=e[n];if(dke(o))return!1;if(_i(o)){if(!pQr(o)||o.__indent!==0)return!1;let i=o.getChildren(),a=i.length;for(let s=0;s<a;s++){let u=i[n];if(!Zi(u))return!1}}}return!0}function Dyi(t){return()=>Uen(t)}function jyi(t,e){let r=t.getFirstChild(),n=0;e:for(;r!==null;){if(_i(r)){let a=r.getFirstChild();if(a!==null){r=a;continue}}else if(Zi(r)){let a=r.getTextContentSize();if(n+a>e)return{node:r,offset:e-n};n+=a}let o=r.getNextSibling();if(o!==null){r=o;continue}let i=r.getParent();for(;i!==null;){let a=i.getNextSibling();if(a!==null){r=a;continue e}i=i.getParent()}break}return null}function $yi(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Lyi(t,e,r,n){let o=a=>a instanceof r,i=a=>{let s=lS(a.getTextContent());s.setFormat(a.getFormat()),a.replace(s)};return[t.registerNodeTransform(TN,a=>{if(!a.isSimpleText())return;let s,u=a.getPreviousSibling(),l=a.getTextContent(),c=a;if(Zi(u)){let f=u.getTextContent(),p=e(f+l);if(o(u)){if(p===null||(m=>m.getLatest().__mode)(u)!==0)return void i(u);{let m=p.end-f.length;if(m>0){let h=f+l.slice(0,m);if(u.select(),u.setTextContent(h),m===l.length)a.remove();else{let y=l.slice(m);a.setTextContent(y)}return}}}else if(p===null||p.start<f.length)return}let d=0;for(;;){s=e(l);let f,p=s===null?"":l.slice(s.end);if(l=p,p===""){let h=c.getNextSibling();if(Zi(h)){p=c.getTextContent()+h.getTextContent();let y=e(p);if(y===null)return void(o(h)?i(h):h.markDirty());if(y.start!==0)return}}if(s===null)return;if(s.start===0&&Zi(u)&&u.isTextEntity()){d+=s.end;continue}s.start===0?[f,c]=c.splitText(s.end):[,f,c]=c.splitText(s.start+d,s.end+d),f===void 0&&$yi(165,"nodeToReplace");let m=n(f);if(m.setFormat(f.getFormat()),f.replace(m),c==null)return;d=0,u=m}}),t.registerNodeTransform(r,a=>{let s=a.getTextContent(),u=e(s);if(u===null||u.start!==0)return void i(a);if(s.length>u.end)return void a.splitText(u.end);let l=a.getPreviousSibling();Zi(l)&&l.isTextEntity()&&(i(l),i(a));let c=a.getNextSibling();Zi(c)&&c.isTextEntity()&&(i(c),o(a)&&i(a))})]}var h6=fwt,D2s=h6.$canShowPlaceholder,zke=h6.$canShowPlaceholderCurry,j2s=h6.$findTextIntersectionFromCharacters,$2s=h6.$isRootTextContentEmpty,L2s=h6.$isRootTextContentEmptyCurry,F2s=h6.$rootTextContent,k2s=h6.registerLexicalTextEntity;var bwt={};En(bwt,{$addNodeStyle:()=>Byi,$cloneWithProperties:()=>ez,$copyBlockFormatIndent:()=>Xen,$ensureForwardRangeSelection:()=>Gen,$forEachSelectedTextNode:()=>Ken,$getSelectionStyleValueForProperty:()=>Xyi,$isAtNodeEnd:()=>Uyi,$isParentElementRTL:()=>ywt,$moveCaretSelection:()=>Yen,$moveCharacter:()=>Kyi,$patchStyleText:()=>zyi,$selectAll:()=>pke,$setBlocksType:()=>Vyi,$shouldOverrideDefaultCharacterSelection:()=>Jyi,$sliceSelectedTextNodeContent:()=>qyi,$trimTextContentFromAnchor:()=>Jen,$wrapNodes:()=>Wyi,createDOMRange:()=>Fyi,createRectsFromDOMRange:()=>kyi,getCSSFromStyleObject:()=>Wen,getStyleObjectFromCSS:()=>Hke,trimTextContentFromAnchor:()=>Zyi});function gwt(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Vke=new Map;function Ben(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function zen(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function Fyi(t,e,r,n,o){let i=e.getKey(),a=n.getKey(),s=document.createRange(),u=t.getElementByKey(i),l=t.getElementByKey(a),c=r,d=o;if(Zi(e)&&(u=Ben(u)),Zi(n)&&(l=Ben(l)),e===void 0||n===void 0||u===null||l===null)return null;u.nodeName==="BR"&&([u,c]=zen(u)),l.nodeName==="BR"&&([l,d]=zen(l));let f=u.firstChild;u===l&&f!=null&&f.nodeName==="BR"&&c===0&&d===0&&(d=1);try{s.setStart(u,c),s.setEnd(l,d)}catch{return null}return!s.collapsed||c===d&&i===a||(s.setStart(l,d),s.setEnd(u,c)),s}function kyi(t,e){let r=t.getRootElement();if(r===null)return[];let n=r.getBoundingClientRect(),o=getComputedStyle(r),i=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),a=Array.from(e.getClientRects()),s,u=a.length;a.sort((l,c)=>{let d=l.top-c.top;return Math.abs(d)<=3?l.left-c.left:d});for(let l=0;l<u;l++){let c=a[l],d=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,f=c.width+i===n.width;d||f?(a.splice(l--,1),u--):s=c}return a}function Hen(t){let e={};if(!t)return e;let r=t.split(";");for(let n of r)if(n!==""){let[o,i]=n.split(/:([^]+)/);o&&i&&(e[o.trim()]=i.trim())}return e}function Hke(t){let e=Vke.get(t);return e===void 0&&(e=Hen(t),Vke.set(t,e)),e}function Wen(t){let e="";for(let r in t)r&&(e+=`${r}: ${t[r]};`);return e}function qyi(t,e){let r=t.getStartEndPoints();if(e.isSelected(t)&&!Vvt(e)&&r!==null){let[n,o]=r,i=t.isBackward(),a=n.getNode(),s=o.getNode(),u=e.is(a),l=e.is(s);if(u||l){let[c,d]=aQr(t),f=a.is(s),p=e.is(i?s:a),m=e.is(i?a:s),h,y=0;f?(y=c>d?d:c,h=c>d?c:d):p?(y=i?d:c,h=void 0):m&&(y=0,h=i?c:d),e.__text=e.__text.slice(y,h)}}return e}function Uyi(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return _i(e)||gwt(177),t.offset===e.getChildrenSize()}function Jen(t,e,r){let n=e.getNode(),o=r;if(_i(n)){let i=n.getDescendantByIndex(e.offset);i!==null&&(n=i)}for(;o>0&&n!==null;){if(_i(n)){let l=n.getLastDescendant();l!==null&&(n=l)}let i=n.getPreviousSibling(),a=0;if(i===null){let l=n.getParentOrThrow(),c=l.getPreviousSibling();for(;c===null;){if(l=l.getParent(),l===null){i=null;break}c=l.getPreviousSibling()}l!==null&&(a=l.isInline()?0:2,i=c)}let s=n.getTextContent();s===""&&_i(n)&&!n.isInline()&&(s=`
|
||
|
||
`);let u=s.length;if(!Zi(n)||o>=u){let l=n.getParent();n.remove(),l==null||l.getChildrenSize()!==0||AY(l)||l.remove(),o-=u+a,n=i}else{let l=n.getKey(),c=t.getEditorState().read(()=>{let p=uQr(l);return Zi(p)&&p.isSimpleText()?p.getTextContent():null}),d=u-o,f=s.slice(0,d);if(c!==null&&c!==s){let p=vfe(),m=n;if(n.isSimpleText())n.setTextContent(c);else{let h=lS(c);n.replace(h),m=h}if(Nr(p)&&p.isCollapsed()){let h=p.anchor.offset;m.select(h,h)}}else if(n.isSimpleText()){let p=e.key===l,m=e.offset;m<o&&(m=u);let h=p?m-o:0,y=p?m:d;if(p&&h===0){let[g]=n.splitText(h,y);g.remove()}else{let[,g]=n.splitText(h,y);g.remove()}}else{let p=lS(f);n.replace(p)}o=0}}}function Byi(t){let e=t.getStyle(),r=Hen(e);Vke.set(e,r)}function pwt(t,e){(Nr(t)?t.isCollapsed():Zi(t)||_i(t))||gwt(280);let r=Hke(Nr(t)?t.style:Zi(t)?t.getStyle():t.getTextStyle()),n=Object.entries(e).reduce((i,[a,s])=>(typeof s=="function"?i[a]=s(r[a],t):s===null?delete i[a]:i[a]=s,i),{...r}),o=Wen(n);Nr(t)||Zi(t)?t.setStyle(o):t.setTextStyle(o),Vke.set(o,n)}function zyi(t,e){if(Nr(t)&&t.isCollapsed()){pwt(t,e);let r=t.anchor.getNode();_i(r)&&r.isEmpty()&&pwt(r,e)}Ken(r=>{pwt(r,e)})}function Ken(t){let e=_n();if(!e)return;let r=new Map;if(Nr(e))for(let i of rQr(e).getTextSlices())i&&r.set(i.caret.origin.getKey(),i.getSliceIndices());let n=e.getNodes();for(let i of n){if(!Zi(i)||!i.canHaveFormat())continue;let[a,s]=(o=i,r.get(o.getKey())||[0,o.getTextContentSize()]);s!==a&&(Vvt(i)||a===0&&s===i.getTextContentSize()?t(i):t(i.splitText(a,s)[a===0?0:1]))}var o;Nr(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&Gen(e)}function Gen(t){if(t.isBackward()){let{anchor:e,focus:r}=t,{key:n,offset:o,type:i}=e;e.set(r.key,r.offset,r.type),r.set(n,o,i)}}function Xen(t,e){let r=t.getFormatType(),n=t.getIndent();r!==e.getFormatType()&&e.setFormat(r),n!==e.getIndent()&&e.setIndent(n)}function Vyi(t,e,r=Xen){if(t===null)return;let n=t.getStartEndPoints(),o=new Map,i=null;if(n){let[a,s]=n;i=uke(),i.anchor.set(a.key,a.offset,a.type),i.focus.set(s.key,s.offset,s.type);let u=hwt(a.getNode(),xfe),l=hwt(s.getNode(),xfe);_i(u)&&o.set(u.getKey(),u),_i(l)&&o.set(l.getKey(),l)}for(let a of t.getNodes())if(_i(a)&&xfe(a))o.set(a.getKey(),a);else if(n===null){let s=hwt(a,xfe);_i(s)&&o.set(s.getKey(),s)}for(let[a,s]of o){let u=e();r(s,u),s.replace(u,!0),i&&(a===i.anchor.key&&i.anchor.set(u.getKey(),i.anchor.offset,i.anchor.type),a===i.focus.key&&i.focus.set(u.getKey(),i.focus.offset,i.focus.type))}i&&t.is(_n())&&l6(i)}function Ven(t){return t.getNode().isAttached()}function Hyi(t){let e=t;for(;e!==null&&!u6(e);){let r=e.getLatest(),n=e.getParent();r.getChildrenSize()===0&&e.remove(!0),e=n}}function Wyi(t,e,r=null){let n=t.getStartEndPoints(),o=n?n[0]:null,i=t.getNodes(),a=i.length;if(o!==null&&(a===0||a===1&&o.type==="element"&&o.getNode().getChildrenSize()===0)){let l=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),c=l.getChildren(),d=e();return d.setFormat(l.getFormatType()),d.setIndent(l.getIndent()),c.forEach(f=>d.append(f)),r&&(d=r.append(d)),void l.replace(d)}let s=null,u=[];for(let l=0;l<a;l++){let c=i[l];u6(c)?(mwt(t,u,u.length,e,r),u=[],s=c):s===null||s!==null&&cQr(c,s)?u.push(c):(mwt(t,u,u.length,e,r),u=[c])}mwt(t,u,u.length,e,r)}function mwt(t,e,r,n,o=null){if(e.length===0)return;let i=e[0],a=new Map,s=[],u=_i(i)?i:i.getParentOrThrow();u.isInline()&&(u=u.getParentOrThrow());let l=!1;for(;u!==null;){let m=u.getPreviousSibling();if(m!==null){u=m,l=!0;break}if(u=u.getParentOrThrow(),u6(u))break}let c=new Set;for(let m=0;m<r;m++){let h=e[m];_i(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let d=new Set;for(let m=0;m<r;m++){let h=e[m],y=h.getParent();if(y!==null&&y.isInline()&&(y=y.getParent()),y!==null&&fQr(h)&&!d.has(h.getKey())){let g=y.getKey();if(a.get(g)===void 0){let b=n();b.setFormat(y.getFormatType()),b.setIndent(y.getIndent()),s.push(b),a.set(g,b),y.getChildren().forEach(_=>{b.append(_),d.add(_.getKey()),_i(_)&&_.getChildrenKeys().forEach(w=>d.add(w))}),Hyi(y)}}else if(c.has(h.getKey())){_i(h)||gwt(179);let g=n();g.setFormat(h.getFormatType()),g.setIndent(h.getIndent()),s.push(g),h.remove(!0)}}if(o!==null)for(let m=0;m<s.length;m++){let h=s[m];o.append(h)}let f=null;if(u6(u))if(l)if(o!==null)u.insertAfter(o);else for(let m=s.length-1;m>=0;m--){let h=s[m];u.insertAfter(h)}else{let m=u.getFirstChild();if(_i(m)&&(u=m),m===null)if(o)u.append(o);else for(let h=0;h<s.length;h++){let y=s[h];u.append(y),f=y}else if(o!==null)m.insertBefore(o);else for(let h=0;h<s.length;h++){let y=s[h];m.insertBefore(y),f=y}}else if(o)u.insertAfter(o);else for(let m=s.length-1;m>=0;m--){let h=s[m];u.insertAfter(h),f=h}let p=vfe();Nr(p)&&Ven(p.anchor)&&Ven(p.focus)?l6(p.clone()):f!==null?f.selectEnd():t.dirty=!0}function Zen(t){let e=t.anchor.getNode(),r=AY(e)?e:e.getParentOrThrow(),n=lke().getElementByKey(r.getKey());if(n===null)return!1;let o=n.ownerDocument.defaultView;return o===null?!1:o.getComputedStyle(n).writingMode==="vertical-rl"}function Jyi(t,e){let r=Zen(t)?!e:e;ywt(t)&&(r=!r);let n=IY(t.focus,r?"previous":"next");if(dQr(n))return!1;for(let o of oQr(n)){if(wfe(o))return!o.origin.isInline();if(!_i(o.origin)){if(dke(o.origin))return!0;break}}return!1}function Yen(t,e,r,n){t.modify(e?"extend":"move",r,n)}function ywt(t){let e=t.anchor.getNode();return(AY(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Kyi(t,e,r){let n=ywt(t),o;o=Zen(t)||n?!r:r,Yen(t,e,o,"character")}function Gyi(t,e,r){let n=Hke(t.getStyle());return n!==null&&n[e]||r}function Xyi(t,e,r=""){let n=null,o=t.getNodes(),i=t.anchor,a=t.focus,s=t.isBackward(),u=s?a.offset:i.offset,l=s?a.getNode():i.getNode();if(Nr(t)&&t.isCollapsed()&&t.style!==""){let c=Hke(t.style);if(c!==null&&e in c)return c[e]}for(let c=0;c<o.length;c++){let d=o[c];if((c===0||u!==0||!d.is(l))&&Zi(d)){let f=Gyi(d,e,r);if(n===null)n=f;else if(n!==f){n="";break}}}return n===null?r:n}function hwt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}var Zyi=Jen;var ed=bwt,Qen=ed.$addNodeStyle,z2s=ed.$cloneWithProperties,V2s=ed.$copyBlockFormatIndent,H2s=ed.$ensureForwardRangeSelection,W2s=ed.$forEachSelectedTextNode,J2s=ed.$getSelectionStyleValueForProperty,K2s=ed.$isAtNodeEnd,G2s=ed.$isParentElementRTL,X2s=ed.$moveCaretSelection,_wt=ed.$moveCharacter,Z2s=ed.$patchStyleText,Y2s=ed.$selectAll,Q2s=ed.$setBlocksType,vwt=ed.$shouldOverrideDefaultCharacterSelection,Wke=ed.$sliceSelectedTextNodeContent,eVs=ed.$trimTextContentFromAnchor,tVs=ed.$wrapNodes,rVs=ed.createDOMRange,etn=ed.createRectsFromDOMRange,nVs=ed.getCSSFromStyleObject,oVs=ed.getStyleObjectFromCSS,iVs=ed.trimTextContentFromAnchor;var xwt={};En(xwt,{$descendantsMatching:()=>$bi,$dfs:()=>_bi,$dfsIterator:()=>ctn,$filter:()=>Ibi,$findMatchingParent:()=>mtn,$firstToLastIterator:()=>Lbi,$getAdjacentCaret:()=>vbi,$getAdjacentSiblingOrParentSiblingCaret:()=>Lfe,$getDepth:()=>ftn,$getNearestBlockElementAncestorOrThrow:()=>Tbi,$getNearestNodeOfType:()=>xbi,$getNextRightPreorderNode:()=>Cbi,$getNextSiblingOrParentSibling:()=>Sbi,$insertFirst:()=>Abi,$insertNodeToNearestRoot:()=>Pbi,$insertNodeToNearestRootAtCaret:()=>htn,$isEditorIsNestedEditor:()=>Dbi,$lastToFirstIterator:()=>Cwt,$restoreEditorState:()=>Ebi,$reverseDfs:()=>wbi,$reverseDfsIterator:()=>ptn,$splitNode:()=>wQr,$unwrapAndFilterDescendants:()=>jbi,$unwrapNode:()=>Fbi,$wrapNodeInElement:()=>Mbi,CAN_USE_BEFORE_INPUT:()=>ubi,CAN_USE_DOM:()=>stn,IS_ANDROID:()=>lbi,IS_ANDROID_CHROME:()=>cbi,IS_APPLE:()=>dbi,IS_APPLE_WEBKIT:()=>fbi,IS_CHROME:()=>pbi,IS_FIREFOX:()=>utn,IS_IOS:()=>mbi,IS_SAFARI:()=>hbi,addClassNamesToElement:()=>gbi,calculateZoomLevel:()=>Nbi,isBlockDomNode:()=>YQr,isHTMLAnchorElement:()=>QQr,isHTMLElement:()=>_ke,isInlineDomNode:()=>Tfe,isMimeType:()=>ltn,makeStateWrapper:()=>kbi,markSelection:()=>atn,mediaFileReader:()=>bbi,mergeRegister:()=>otn,objectKlassEquals:()=>Rbi,positionNodeOnRange:()=>itn,registerNestedElementResolver:()=>Obi,removeClassNamesFromElement:()=>ybi,selectionAlwaysOnDisplay:()=>sbi});function Jke(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var LT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Yyi=LT&&"documentMode"in document?document.documentMode:null,Qyi=LT&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ebi=LT&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),tbi=!(!LT||!("InputEvent"in window)||Yyi)&&"getTargetRanges"in new window.InputEvent("input"),rbi=LT&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),nbi=LT&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,rtn=LT&&/Android/.test(navigator.userAgent),Swt=LT&&/^(?=.*Chrome).*/i.test(navigator.userAgent),obi=LT&&rtn&&Swt,ibi=LT&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Swt;function ntn(...t){let e=[];for(let r of t)if(r&&typeof r=="string")for(let[n]of r.matchAll(/\S+/g))e.push(n);return e}function otn(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function MN(t){return`${t}px`}var abi={attributes:!0,characterData:!0,childList:!0,subtree:!0};function itn(t,e,r){let n=null,o=null,i=null,a=[],s=document.createElement("div");function u(){n===null&&Jke(182),o===null&&Jke(183);let{left:d,top:f}=o.getBoundingClientRect(),p=etn(t,e);var m,h;s.isConnected||(h=s,(m=o).insertBefore(h,m.firstChild));let y=!1;for(let g=0;g<p.length;g++){let b=p[g],_=a[g]||document.createElement("div"),w=_.style;w.position!=="absolute"&&(w.position="absolute",y=!0);let T=MN(b.left-d);w.left!==T&&(w.left=T,y=!0);let O=MN(b.top-f);w.top!==O&&(_.style.top=O,y=!0);let E=MN(b.width);w.width!==E&&(_.style.width=E,y=!0);let P=MN(b.height);w.height!==P&&(_.style.height=P,y=!0),_.parentNode!==s&&(s.append(_),y=!0),a[g]=_}for(;a.length>p.length;)a.pop();y&&r(a)}function l(){o=null,n=null,i!==null&&i.disconnect(),i=null,s.remove();for(let d of a)d.remove();a=[]}s.style.position="relative";let c=t.registerRootListener(function d(){let f=t.getRootElement();if(f===null)return l();let p=f.parentElement;if(!_ke(p))return l();l(),n=f,o=p,i=new MutationObserver(m=>{let h=t.getRootElement(),y=h&&h.parentElement;if(h!==n||y!==o)return d();for(let g of m)if(!s.contains(g.target))return u()}),i.observe(p,abi),u()});return()=>{c(),l()}}function ttn(t,e,r){if(t.type!=="text"&&_i(e)){let n=e.getDOMSlot(r);return[n.element,n.getFirstChildOffset()+t.offset]}return[XQr(r)||r,t.offset]}function atn(t,e){let r=null,n=null,o=null,i=null,a=null,s=null,u=()=>{};function l(c){c.read(()=>{let d=_n();if(!Nr(d))return r=null,o=null,i=null,s=null,u(),void(u=()=>{});let[f,p]=function(P){let R=P.getStartEndPoints();return P.isBackward()?[R[1],R[0]]:R}(d),m=f.getNode(),h=m.getKey(),y=f.offset,g=p.getNode(),b=g.getKey(),_=p.offset,w=t.getElementByKey(h),T=t.getElementByKey(b),O=r===null||w!==n||y!==o||h!==r.getKey(),E=i===null||T!==a||_!==s||b!==i.getKey();if((O||E)&&w!==null&&T!==null){let P=function(R,I,N,z,V,k,X){let B=(R._window?R._window.document:document).createRange();return B.setStart(...ttn(I,N,z)),B.setEnd(...ttn(V,k,X)),B}(t,f,m,w,p,g,T);u(),u=itn(t,P,R=>{if(e===void 0)for(let I of R){let N=I.style;N.background!=="Highlight"&&(N.background="Highlight"),N.color!=="HighlightText"&&(N.color="HighlightText"),N.marginTop!==MN(-1.5)&&(N.marginTop=MN(-1.5)),N.paddingTop!==MN(4)&&(N.paddingTop=MN(4)),N.paddingBottom!==MN(0)&&(N.paddingBottom=MN(0))}else e(R)})}r=m,n=w,o=y,i=g,a=T,s=_})}return l(t.getEditorState()),otn(t.registerUpdateListener(({editorState:c})=>l(c)),()=>{u()})}function sbi(t){let e=null,r=()=>{let n=getSelection(),o=n&&n.anchorNode,i=t.getRootElement();o!==null&&i!==null&&i.contains(o)?e!==null&&(e(),e=null):e===null&&(e=atn(t))};return document.addEventListener("selectionchange",r),()=>{e!==null&&e(),document.removeEventListener("selectionchange",r)}}var ubi=tbi,stn=LT,lbi=rtn,cbi=obi,dbi=Qyi,fbi=ibi,pbi=Swt,utn=ebi,mbi=nbi,hbi=rbi;function gbi(t,...e){let r=ntn(...e);r.length>0&&t.classList.add(...r)}function ybi(t,...e){let r=ntn(...e);r.length>0&&t.classList.remove(...r)}function ltn(t,e){for(let r of e)if(t.type.startsWith(r))return!0;return!1}function bbi(t,e){let r=t[Symbol.iterator]();return new Promise((n,o)=>{let i=[],a=()=>{let{done:s,value:u}=r.next();if(s)return n(i);let l=new FileReader;l.addEventListener("error",o),l.addEventListener("load",()=>{let c=l.result;typeof c=="string"&&i.push({file:u,result:c}),a()}),ltn(u,e)?l.readAsDataURL(u):a()};a()})}function _bi(t,e){return Array.from(ctn(t,e))}function vbi(t){return t?t.getAdjacentCaret():null}function wbi(t,e){return Array.from(ptn(t,e))}function ctn(t,e){return dtn("next",t,e)}function dtn(t,e,r){let n=Oi(),o=e||n,i=_i(o)?tz(o,t):bL(o,t),a=ftn(o),s=r?_fe(zvt(bL(r,t))):function(l,c){let d=Lfe(bL(l,c));return d&&d[0]}(o,t),u=a;return Gvt({hasNext:l=>l!==null,initial:i,map:l=>({depth:u,node:l.origin}),step:l=>{if(l.isSameNodeCaret(s))return null;wfe(l)&&u++;let c=Lfe(l);return!c||c[0].isSameNodeCaret(s)?null:(u+=c[1],c[0])}})}function Sbi(t){let e=Lfe(bL(t,"next"));return e&&[e[0].origin,e[1]]}function ftn(t){let e=-1;for(let r=t;r!==null;r=r.getParent())e++;return e}function Cbi(t){let e=Lfe(zvt(bL(t,"previous")),"root");return e&&e[0].origin}function ptn(t,e){return dtn("previous",t,e)}function xbi(t,e){let r=t;for(;r!=null;){if(r instanceof e)return r;r=r.getParent()}return null}function Tbi(t){let e=mtn(t,r=>_i(r)&&!r.isInline());return _i(e)||Jke(4,t.__key),e}var mtn=(t,e)=>{let r=t;for(;r!==Oi()&&r!=null;){if(e(r))return r;r=r.getParent()}return null};function Obi(t,e,r,n){let o=i=>i instanceof e;return t.registerNodeTransform(e,i=>{let a=(s=>{let u=s.getChildren();for(let d=0;d<u.length;d++){let f=u[d];if(o(f))return null}let l=s,c=s;for(;l!==null;)if(c=l,l=l.getParent(),o(l))return{child:c,parent:l};return null})(i);if(a!==null){let{child:s,parent:u}=a;if(s.is(i)){n(u,i);let l=s.getNextSiblings(),c=l.length;if(u.insertAfter(s),c!==0){let d=r(u);s.insertAfter(d);for(let f=0;f<c;f++)d.append(l[f])}u.canBeEmpty()||u.getChildrenSize()!==0||u.remove()}}})}function Ebi(t,e){let r=new Map,n=t._pendingEditorState;for(let[i,a]of e._nodeMap)r.set(i,ez(a));n&&(n._nodeMap=r),t._dirtyType=2;let o=e._selection;l6(o===null?null:o.clone())}function Pbi(t){let e=_n()||vfe(),r;if(Nr(e))r=IY(e.focus,"next");else{if(e!=null){let a=e.getNodes(),s=a[a.length-1];s&&(r=bL(s,"next"))}r=r||tz(Oi(),"previous").getFlipped().insert(yL())}let n=htn(t,r),o=_fe(n),i=wfe(o)?hQr(o):n;return bQr(sQr(i)),t.getLatest()}function htn(t,e,r){let n=Bvt(e,"next");for(let o=n;o;o=vQr(o,r))n=o;return fke(n)&&Jke(283),n.insert(t.isInline()?yL().append(t):t),Bvt(bL(t.getLatest(),"next"),e.direction)}function Mbi(t,e){let r=e();return t.replace(r),r.append(t),r}function Rbi(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function Ibi(t,e){let r=[];for(let n=0;n<t.length;n++){let o=e(t[n]);o!==null&&r.push(o)}return r}function Abi(t,e){tz(t,"next").insert(e)}var wwt=!(utn||!stn)&&void 0;function Nbi(t){let e=1;if(function(){if(wwt===void 0){let r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);let n=r.getBoundingClientRect();r.style.setProperty("zoom","2"),wwt=r.getBoundingClientRect().width===n.width,document.body.removeChild(r)}return wwt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Dbi(t){return t._parentEditor!==null}function jbi(t,e){return gtn(t,e,null)}function gtn(t,e,r){let n=!1;for(let o of Cwt(t))e(o)?r!==null&&r(o):(n=!0,_i(o)&>n(o,e,r||(i=>o.insertAfter(i))),o.remove());return n}function $bi(t,e){let r=[],n=Array.from(t).reverse();for(let o=n.pop();o!==void 0;o=n.pop())if(e(o))r.push(o);else if(_i(o))for(let i of Cwt(o))n.push(i);return r}function Lbi(t){return ytn(tz(t,"next"))}function Cwt(t){return ytn(tz(t,"previous"))}function ytn(t){return Gvt({hasNext:mQr,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function Fbi(t){yQr(bL(t,"next")).splice(1,t.getChildren())}function Lfe(t,e="root"){let r=0,n=t,o=_fe(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=_fe(n)}return o&&[o,r]}function kbi(t){let e=n=>lQr(n,t),r=(n,o)=>_Qr(n,t,o);return{$get:e,$set:r,accessors:[e,r],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(n){return r(this,n)},stateConfig:t}}var In=xwt,cVs=In.$descendantsMatching,dVs=In.$dfs,fVs=In.$dfsIterator,pVs=In.$filter,mVs=In.$findMatchingParent,hVs=In.$firstToLastIterator,gVs=In.$getAdjacentCaret,yVs=In.$getAdjacentSiblingOrParentSiblingCaret,bVs=In.$getDepth,_Vs=In.$getNearestBlockElementAncestorOrThrow,vVs=In.$getNearestNodeOfType,wVs=In.$getNextRightPreorderNode,SVs=In.$getNextSiblingOrParentSibling,CVs=In.$insertFirst,xVs=In.$insertNodeToNearestRoot,TVs=In.$insertNodeToNearestRootAtCaret,OVs=In.$isEditorIsNestedEditor,EVs=In.$lastToFirstIterator,PVs=In.$restoreEditorState,MVs=In.$reverseDfs,RVs=In.$reverseDfsIterator,IVs=In.$splitNode,AVs=In.$unwrapAndFilterDescendants,NVs=In.$unwrapNode,DVs=In.$wrapNodeInElement,jVs=In.CAN_USE_BEFORE_INPUT,$Vs=In.CAN_USE_DOM,LVs=In.IS_ANDROID,FVs=In.IS_ANDROID_CHROME,kVs=In.IS_APPLE,qVs=In.IS_APPLE_WEBKIT,UVs=In.IS_CHROME,BVs=In.IS_FIREFOX,zVs=In.IS_IOS,VVs=In.IS_SAFARI,HVs=In.addClassNamesToElement,WVs=In.calculateZoomLevel,Twt=In.isBlockDomNode,JVs=In.isHTMLAnchorElement,btn=In.isHTMLElement,KVs=In.isInlineDomNode,GVs=In.isMimeType,XVs=In.makeStateWrapper,ZVs=In.markSelection,YVs=In.mediaFileReader,SL=In.mergeRegister,Ffe=In.objectKlassEquals,QVs=In.positionNodeOnRange,eHs=In.registerNestedElementResolver,tHs=In.removeClassNamesFromElement,rHs=In.selectionAlwaysOnDisplay;var Owt={};En(Owt,{registerDragonSupport:()=>qbi});function qbi(t){let e=window.location.origin,r=n=>{if(n.origin!==e)return;let o=t.getRootElement();if(document.activeElement!==o)return;let i=n.data;if(typeof i=="string"){let a;try{a=JSON.parse(i)}catch{return}if(a&&a.protocol==="nuanria_messaging"&&a.type==="request"){let s=a.payload;if(s&&s.functionId==="makeChanges"){let u=s.args;if(u){let[l,c,d,f,p,m]=u;t.update(()=>{let h=_n();if(Nr(h)){let y=h.anchor,g=y.getNode(),b=0,_=0;if(Zi(g)&&l>=0&&c>=0&&(b=l,_=l+c,h.setTextNodeRange(g,b,g,_)),b===_&&d===""||(h.insertRawText(d),g=y.getNode()),Zi(g)){b=f,_=f+p;let w=g.getTextContentSize();b=b>w?w:b,_=_>w?w:_,h.setTextNodeRange(g,b,g,_)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",r,!0),()=>{window.removeEventListener("message",r,!0)}}var Ubi=Owt,_tn=Ubi.registerDragonSupport;var Ewt={};En(Ewt,{$generateHtmlFromNodes:()=>zbi,$generateNodesFromDOM:()=>Bbi});function Bbi(t,e){let r=e.body?e.body.childNodes:[],n=[],o=[];for(let i=0;i<r.length;i++){let a=r[i];if(!wtn.has(a.nodeName)){let s=Stn(a,t,o,!1);s!==null&&(n=n.concat(s))}}return function(i){for(let a of i)a.getNextSibling()instanceof Hvt&&a.insertAfter(Uvt());for(let a of i){let s=a.getChildren();for(let u of s)a.insertBefore(u);a.remove()}}(o),n}function zbi(t,e){if(typeof document>"u"||typeof window>"u"&&window.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let r=document.createElement("div"),n=Oi().getChildren();for(let o=0;o<n.length;o++)vtn(t,n[o],r,e);return r.innerHTML}function vtn(t,e,r,n=null){let o=n===null||e.isSelected(n),i=_i(e)&&e.excludeFromCopy("html"),a=e;if(n!==null){let p=ez(e);p=Zi(p)&&n!==null?Wke(n,p):p,a=p}let s=_i(a)?a.getChildren():[],u=ZQr(t,a.getType()),l;l=u&&u.exportDOM!==void 0?u.exportDOM(t,a):a.exportDOM(t);let{element:c,after:d}=l;if(!c)return!1;let f=document.createDocumentFragment();for(let p=0;p<s.length;p++){let m=s[p],h=vtn(t,m,f,n);!o&&_i(e)&&h&&e.extractWithChild(m,n,"html")&&(o=!0)}if(o&&!i){if((btn(c)||Kvt(c))&&c.append(f),r.append(c),d){let p=d.call(a,c);p&&(Kvt(c)?c.replaceChildren(p):c.replaceWith(p))}}else r.append(f);return o}var wtn=new Set(["STYLE","SCRIPT"]);function Stn(t,e,r,n,o=new Map,i){let a=[];if(wtn.has(t.nodeName))return a;let s=null,u=function(m,h){let{nodeName:y}=m,g=h._htmlConversions.get(y.toLowerCase()),b=null;if(g!==void 0)for(let _ of g){let w=_(m);w!==null&&(b===null||(b.priority||0)<=(w.priority||0))&&(b=w)}return b!==null?b.conversion:null}(t,e),l=u?u(t):null,c=null;if(l!==null){c=l.after;let m=l.node;if(s=Array.isArray(m)?m[m.length-1]:m,s!==null){for(let[,h]of o)if(s=h(s,i),!s)break;s&&a.push(...Array.isArray(m)?m:[s])}l.forChild!=null&&o.set(t.nodeName,l.forChild)}let d=t.childNodes,f=[],p=(s==null||!u6(s))&&(s!=null&&cke(s)||n);for(let m=0;m<d.length;m++)f.push(...Stn(d[m],e,r,p,new Map(o),s));return c!=null&&(f=c(f)),Twt(t)&&(f=Vbi(t,f,p?()=>{let m=new Hvt;return r.push(m),m}:yL)),s==null?f.length>0?a=a.concat(f):Twt(t)&&function(m){return m.nextSibling==null||m.previousSibling==null?!1:Tfe(m.nextSibling)&&Tfe(m.previousSibling)}(t)&&(a=a.concat(Uvt())):_i(s)&&s.append(...f),a}function Vbi(t,e,r){let n=t.style.textAlign,o=[],i=[];for(let a=0;a<e.length;a++){let s=e[a];if(cke(s))n&&!s.getFormat()&&s.setFormat(n),o.push(s);else if(i.push(s),a===e.length-1||a<e.length-1&&cke(e[a+1])){let u=r();u.setFormat(n),u.append(...i),o.push(u),i=[]}}return o}var Ctn=Ewt,xtn=Ctn.$generateHtmlFromNodes,Ttn=Ctn.$generateNodesFromDOM;var Mwt={};En(Mwt,{$generateJSONFromSelectedNodes:()=>Rtn,$generateNodesFromSerializedNodes:()=>Itn,$getClipboardDataFromSelection:()=>Atn,$getHtmlContent:()=>Etn,$getLexicalContent:()=>Ptn,$insertDataTransferForPlainText:()=>Hbi,$insertDataTransferForRichText:()=>Wbi,$insertGeneratedNodes:()=>Pwt,copyToClipboard:()=>Jbi,setLexicalClipboardDataTransfer:()=>Ntn});function Kke(t,...e){let r=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let o of e)n.append("v",o);throw r.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Etn(t,e=_n()){return e==null&&Kke(166),Nr(e)&&e.isCollapsed()||e.getNodes().length===0?"":xtn(t,e)}function Ptn(t,e=_n()){return e==null&&Kke(166),Nr(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Rtn(t,e))}function Hbi(t,e){let r=t.getData("text/plain")||t.getData("text/uri-list");r!=null&&e.insertRawText(r)}function Wbi(t,e,r){let n=t.getData("application/x-lexical-editor");if(n)try{let s=JSON.parse(n);if(s.namespace===r._config.namespace&&Array.isArray(s.nodes))return Pwt(r,Itn(s.nodes),e)}catch{}let o=t.getData("text/html"),i=t.getData("text/plain");if(o&&i!==o)try{let s=new DOMParser().parseFromString(function(u){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:l=>l}).createHTML(u):u}(o),"text/html");return Pwt(r,Ttn(r,s),e)}catch{}let a=i||t.getData("text/uri-list");if(a!=null)if(Nr(e)){let s=a.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let u=0;u<s.length;u++){let l=_n();if(Nr(l)){let c=s[u];c===`
|
||
`||c===`\r
|
||
`?l.insertParagraph():c===" "?l.insertNodes([nQr()]):l.insertText(c)}}}else e.insertRawText(a)}function Pwt(t,e,r){t.dispatchCommand(HQr,{nodes:e,selection:r})||(r.insertNodes(e),function(n){if(Nr(n)&&n.isCollapsed()){let o=n.anchor,i=null,a=IY(o,"previous");if(a)if(fke(a))i=a.origin;else{let s=iQr(a,tz(Oi(),"next").getFlipped());for(let u of s){if(Zi(u.origin)){i=u.origin;break}if(_i(u.origin)&&!u.origin.isInline())break}}if(i&&Zi(i)){let s=i.getFormat(),u=i.getStyle();n.format===s&&n.style===u||(n.format=s,n.style=u,n.dirty=!0)}}}(r))}function Mtn(t,e,r,n=[]){let o=e===null||r.isSelected(e),i=_i(r)&&r.excludeFromCopy("html"),a=r;if(e!==null){let l=ez(r);l=Zi(l)&&e!==null?Wke(e,l):l,a=l}let s=_i(a)?a.getChildren():[],u=function(l){let c=l.exportJSON(),d=l.constructor;if(c.type!==d.getType()&&Kke(58,d.name),_i(l)){let f=c.children;Array.isArray(f)||Kke(59,d.name)}return c}(a);if(Zi(a)){let l=a.__text;l.length>0?u.text=l:o=!1}for(let l=0;l<s.length;l++){let c=s[l],d=Mtn(t,e,c,u.children);!o&&_i(r)&&d&&r.extractWithChild(c,e,"clone")&&(o=!0)}if(o&&!i)n.push(u);else if(Array.isArray(u.children))for(let l=0;l<u.children.length;l++){let c=u.children[l];n.push(c)}return o}function Rtn(t,e){let r=[],n=Oi().getChildren();for(let o=0;o<n.length;o++)Mtn(t,e,n[o],r);return{namespace:t._config.namespace,nodes:r}}function Itn(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],o=gQr(n);Zi(o)&&Qen(o),e.push(o)}return e}var UY=null;async function Jbi(t,e,r){if(UY!==null)return!1;if(e!==null)return new Promise((l,c)=>{t.update(()=>{l(Otn(t,e,r))})});let n=t.getRootElement(),o=t._window||window,i=window.document,a=Jvt(o);if(n===null||a===null)return!1;let s=i.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(i.createTextNode("#")),n.append(s);let u=new Range;return u.setStart(s,0),u.setEnd(s,1),a.removeAllRanges(),a.addRange(u),new Promise((l,c)=>{let d=t.registerCommand(hke,f=>(Ffe(f,ClipboardEvent)&&(d(),UY!==null&&(window.clearTimeout(UY),UY=null),l(Otn(t,f,r))),!0),mke);UY=window.setTimeout(()=>{d(),UY=null,l(!1)},50),i.execCommand("copy"),s.remove()})}function Otn(t,e,r){if(r===void 0){let o=Jvt(t._window);if(!o)return!1;let i=o.anchorNode,a=o.focusNode;if(i!==null&&a!==null&&!een(t,i,a))return!1;let s=_n();if(s===null)return!1;r=Atn(s)}e.preventDefault();let n=e.clipboardData;return n!==null&&(Ntn(n,r),!0)}var Kbi=[["text/html",Etn],["application/x-lexical-editor",Ptn]];function Atn(t=_n()){let e={"text/plain":t?t.getTextContent():""};if(t){let r=lke();for(let[n,o]of Kbi){let i=o(r,t);i!==null&&(e[n]=i)}}return e}function Ntn(t,e){for(let r in e){let n=e[r];n!==void 0&&t.setData(r,n)}}var RN=Mwt,mHs=RN.$generateJSONFromSelectedNodes,hHs=RN.$generateNodesFromSerializedNodes,gHs=RN.$getClipboardDataFromSelection,Dtn=RN.$getHtmlContent,yHs=RN.$getLexicalContent,Rwt=RN.$insertDataTransferForPlainText,bHs=RN.$insertDataTransferForRichText,_Hs=RN.$insertGeneratedNodes,vHs=RN.copyToClipboard,wHs=RN.setLexicalClipboardDataTransfer;var Iwt={};En(Iwt,{registerPlainText:()=>e_i});var BY=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Gbi=BY&&"documentMode"in document?document.documentMode:null,Xbi=!(!BY||!("InputEvent"in window)||Gbi)&&"getTargetRanges"in new window.InputEvent("input"),Zbi=BY&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),jtn=BY&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ybi=BY&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Qbi=BY&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ybi;function $tn(t,e){e.update(()=>{if(t!==null){let r=Ffe(t,KeyboardEvent)?null:t.clipboardData,n=_n();if(n!==null&&r!=null){t.preventDefault();let o=Dtn(e);o!==null&&r.setData("text/html",o),r.setData("text/plain",n.getTextContent())}}})}function e_i(t){return SL(t.registerCommand(NY,e=>{let r=_n();return!!Nr(r)&&(r.deleteCharacter(e),!0)},il),t.registerCommand(MQr,e=>{let r=_n();return!!Nr(r)&&(r.deleteWord(e),!0)},il),t.registerCommand(PQr,e=>{let r=_n();return!!Nr(r)&&(r.deleteLine(e),!0)},il),t.registerCommand(OQr,e=>{let r=_n();if(!Nr(r))return!1;if(typeof e=="string")r.insertText(e);else{let n=e.dataTransfer;if(n!=null)Rwt(n,r);else{let o=e.data;o&&r.insertText(o)}}return!0},il),t.registerCommand(VQr,()=>{let e=_n();return!!Nr(e)&&(e.removeText(),!0)},il),t.registerCommand(Wvt,e=>{let r=_n();return!!Nr(r)&&(r.insertLineBreak(e),!0)},il),t.registerCommand(NQr,()=>{let e=_n();return!!Nr(e)&&(e.insertLineBreak(),!0)},il),t.registerCommand(jQr,e=>{let r=_n();if(!Nr(r))return!1;let n=e,o=n.shiftKey;return!!vwt(r,!0)&&(n.preventDefault(),_wt(r,o,!0),!0)},il),t.registerCommand($Qr,e=>{let r=_n();if(!Nr(r))return!1;let n=e,o=n.shiftKey;return!!vwt(r,!1)&&(n.preventDefault(),_wt(r,o,!1),!0)},il),t.registerCommand(FQr,e=>{let r=_n();return!!Nr(r)&&(!jtn||navigator.language!=="ko-KR")&&(e.preventDefault(),t.dispatchCommand(NY,!0))},il),t.registerCommand(kQr,e=>{let r=_n();return!!Nr(r)&&(e.preventDefault(),t.dispatchCommand(NY,!1))},il),t.registerCommand(jY,e=>{let r=_n();if(!Nr(r))return!1;if(e!==null){if((jtn||Zbi||Qbi)&&Xbi)return!1;e.preventDefault()}return t.dispatchCommand(Wvt,!1)},il),t.registerCommand(WQr,()=>(pke(),!0),il),t.registerCommand(hke,e=>{let r=_n();return!!Nr(r)&&($tn(e,t),!0)},il),t.registerCommand(EQr,e=>{let r=_n();return!!Nr(r)&&(function(n,o){$tn(n,o),o.update(()=>{let i=_n();Nr(i)&&i.removeText()})}(e,t),!0)},il),t.registerCommand(bke,e=>{let r=_n();return!!Nr(r)&&(function(n,o){n.preventDefault(),o.update(()=>{let i=_n(),a=Ffe(n,ClipboardEvent)?n.clipboardData:null;a!=null&&Nr(i)&&Rwt(a,i)},{tag:BQr})}(e,t),!0)},il),t.registerCommand(IQr,e=>{let r=_n();return!!Nr(r)&&(e.preventDefault(),!0)},il),t.registerCommand(RQr,e=>{let r=_n();return!!Nr(r)&&(e.preventDefault(),!0)},il))}var t_i=Iwt,Ltn=t_i.registerPlainText;var Nwt={};En(Nwt,{PlainTextPlugin:()=>r_i});var PC=$(J(),1),Gke=$(hu(),1),sz=$(St(),1);var Awt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?PC.useLayoutEffect:PC.useEffect;function Ftn(t){return t.getEditorState().read(zke(t.isComposing()))}function r_i({contentEditable:t,placeholder:e=null,ErrorBoundary:r}){let[n]=Di(),o=function(i,a){let[s,u]=(0,PC.useState)(()=>i.getDecorators());return Awt(()=>i.registerDecoratorListener(l=>{(0,Gke.flushSync)(()=>{u(l)})}),[i]),(0,PC.useEffect)(()=>{u(i.getDecorators())},[i]),(0,PC.useMemo)(()=>{let l=[],c=Object.keys(s);for(let d=0;d<c.length;d++){let f=c[d],p=(0,sz.jsx)(a,{onError:h=>i._onError(h),children:(0,sz.jsx)(PC.Suspense,{fallback:null,children:s[f]})}),m=i.getElementByKey(f);m!==null&&l.push((0,Gke.createPortal)(p,m,f))}return l},[a,s,i])}(n,r);return function(i){Awt(()=>SL(Ltn(i),_tn(i)),[i])}(n),(0,sz.jsxs)(sz.Fragment,{children:[t,(0,sz.jsx)(n_i,{content:e}),o]})}function n_i({content:t}){let[e]=Di(),r=function(o){let[i,a]=(0,PC.useState)(()=>Ftn(o));return Awt(()=>{function s(){let u=Ftn(o);a(u)}return s(),SL(o.registerUpdateListener(()=>{s()}),o.registerEditableListener(()=>{s()}))},[o]),i}(e),n=ken();return r?typeof t=="function"?t(n):t:null}var o_i=Nwt,Xke=o_i.PlainTextPlugin;var Dwt={};En(Dwt,{ContentEditable:()=>a_i,ContentEditableElement:()=>Utn});var Cb=$(J(),1),CL=$(St(),1);var qtn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Cb.useLayoutEffect:Cb.useEffect;function i_i({editor:t,ariaActiveDescendant:e,ariaAutoComplete:r,ariaControls:n,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:a,ariaInvalid:s,ariaLabel:u,ariaLabelledBy:l,ariaMultiline:c,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:y="textbox",spellCheck:g=!0,style:b,tabIndex:_,"data-testid":w,...T},O){let[E,P]=(0,Cb.useState)(t.isEditable()),R=(0,Cb.useCallback)(N=>{N&&N.ownerDocument&&N.ownerDocument.defaultView?t.setRootElement(N):t.setRootElement(null)},[t]),I=(0,Cb.useMemo)(()=>function(...N){return z=>{N.forEach(V=>{typeof V=="function"?V(z):V!=null&&(V.current=z)})}}(O,R),[R,O]);return qtn(()=>(P(t.isEditable()),t.registerEditableListener(N=>{P(N)})),[t]),(0,CL.jsx)("div",{"aria-activedescendant":E?e:void 0,"aria-autocomplete":E?r:"none","aria-controls":E?n:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":E&&y==="combobox"?!!a:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":u,"aria-labelledby":l,"aria-multiline":c,"aria-owns":E?d:void 0,"aria-readonly":!E||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:E,"data-testid":w,id:h,ref:I,role:y,spellCheck:g,style:b,tabIndex:_,...T})}var Utn=(0,Cb.forwardRef)(i_i);function ktn(t){return t.getEditorState().read(zke(t.isComposing()))}var a_i=(0,Cb.forwardRef)(s_i);function s_i(t,e){let{placeholder:r,...n}=t,[o]=Di();return(0,CL.jsxs)(CL.Fragment,{children:[(0,CL.jsx)(Utn,{editor:o,...n,ref:e}),r!=null&&(0,CL.jsx)(u_i,{editor:o,content:r})]})}function u_i({content:t,editor:e}){let r=function(a){let[s,u]=(0,Cb.useState)(()=>ktn(a));return qtn(()=>{function l(){let c=ktn(a);u(c)}return l(),SL(a.registerUpdateListener(()=>{l()}),a.registerEditableListener(()=>{l()}))},[a]),s}(e),[n,o]=(0,Cb.useState)(e.isEditable());if((0,Cb.useLayoutEffect)(()=>(o(e.isEditable()),e.registerEditableListener(a=>{o(a)})),[e]),!r)return null;let i=null;return typeof t=="function"?i=t(n):t!==null&&(i=t),i===null?null:(0,CL.jsx)("div",{"aria-hidden":!0,children:i})}var Btn=Dwt,Zke=Btn.ContentEditable,FHs=Btn.ContentEditableElement;var Lwt={};En(Lwt,{createEmptyHistoryState:()=>h_i,registerHistory:()=>m_i});var Yke=0,jwt=1,$wt=2,FT=0,l_i=1,ztn=2,c_i=3,d_i=4;function f_i(t,e,r,n,o){if(t===null||r.size===0&&n.size===0&&!o)return FT;let i=e._selection,a=t._selection;if(o)return l_i;if(!(Nr(i)&&Nr(a)&&a.isCollapsed()&&i.isCollapsed()))return FT;let s=function(g,b,_){let w=g._nodeMap,T=[];for(let O of b){let E=w.get(O);E!==void 0&&T.push(E)}for(let[O,E]of _){if(!E)continue;let P=w.get(O);P===void 0||AY(P)||T.push(P)}return T}(e,r,n);if(s.length===0)return FT;if(s.length>1){let g=e._nodeMap,b=g.get(i.anchor.key),_=g.get(a.anchor.key);return b&&_&&!t._nodeMap.has(b.__key)&&Zi(b)&&b.__text.length===1&&i.anchor.offset===1?ztn:FT}let u=s[0],l=t._nodeMap.get(u.__key);if(!Zi(l)||!Zi(u)||l.__mode!==u.__mode)return FT;let c=l.__text,d=u.__text;if(c===d)return FT;let f=i.anchor,p=a.anchor;if(f.key!==p.key||f.type!=="text")return FT;let m=f.offset,h=p.offset,y=d.length-c.length;return y===1&&h===m-1?ztn:y===-1&&h===m+1?c_i:y===-1&&h===m?d_i:FT}function p_i(t,e){let r=Date.now(),n=FT;return(o,i,a,s,u,l)=>{let c=Date.now();if(l.has(yke))return n=FT,r=c,$wt;let d=f_i(o,i,s,u,t.isComposing()),f=(()=>{let p=a===null||a.editor===t,m=l.has(AQr);if(!m&&p&&l.has(DY))return Yke;if(o===null)return jwt;let h=i._selection;return s.size>0||u.size>0?m===!1&&d!==FT&&d===n&&c<r+e&&p||s.size===1&&function(y,g,b){let _=g._nodeMap.get(y),w=b._nodeMap.get(y),T=g._selection,O=b._selection;return!(Nr(T)&&Nr(O)&&T.anchor.type==="element"&&T.focus.type==="element"&&O.anchor.type==="text"&&O.focus.type==="text"||!Zi(_)||!Zi(w)||_.__parent!==w.__parent)&&JSON.stringify(g.read(()=>_.exportJSON()))===JSON.stringify(b.read(()=>w.exportJSON()))}(Array.from(s)[0],o,i)?Yke:jwt:h!==null?Yke:$wt})();return r=c,n=d,f}}function Vtn(t){t.undoStack=[],t.redoStack=[],t.current=null}function m_i(t,e,r){let n=p_i(t,r);return SL(t.registerCommand(JQr,()=>(function(i,a){let s=a.redoStack,u=a.undoStack;if(u.length!==0){let l=a.current,c=u.pop();l!==null&&(s.push(l),i.dispatchCommand(Sfe,!0)),u.length===0&&i.dispatchCommand(Cfe,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:yke})}}(t,e),!0),il),t.registerCommand(zQr,()=>(function(i,a){let s=a.redoStack,u=a.undoStack;if(s.length!==0){let l=a.current;l!==null&&(u.push(l),i.dispatchCommand(Cfe,!0));let c=s.pop();s.length===0&&i.dispatchCommand(Sfe,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:yke})}}(t,e),!0),il),t.registerCommand(CQr,()=>(Vtn(e),!1),il),t.registerCommand(xQr,()=>(Vtn(e),t.dispatchCommand(Sfe,!1),t.dispatchCommand(Cfe,!1),!0),il),t.registerUpdateListener(({editorState:i,prevEditorState:a,dirtyLeaves:s,dirtyElements:u,tags:l})=>{let c=e.current,d=e.redoStack,f=e.undoStack,p=c===null?null:c.editorState;if(c!==null&&i===p)return;let m=n(a,i,c,s,u,l);if(m===jwt)d.length!==0&&(e.redoStack=[],t.dispatchCommand(Sfe,!1)),c!==null&&(f.push({...c}),t.dispatchCommand(Cfe,!0));else if(m===$wt)return;e.current={editor:t,editorState:i}}))}function h_i(){return{current:null,redoStack:[],undoStack:[]}}var Htn=Lwt,Qke=Htn.createEmptyHistoryState,Wtn=Htn.registerHistory;var Fwt={};En(Fwt,{HistoryPlugin:()=>g_i,createEmptyHistoryState:()=>Qke});var eqe=$(J(),1);function g_i({delay:t,externalHistoryState:e}){let[r]=Di();return function(n,o,i=1e3){let a=(0,eqe.useMemo)(()=>o||Qke(),[o]);(0,eqe.useEffect)(()=>Wtn(n,a,i),[i,n,a])}(r,e,t),null}var Jtn=Fwt,tqe=Jtn.HistoryPlugin,WHs=Jtn.createEmptyHistoryState;var kwt={};En(kwt,{OnChangePlugin:()=>b_i});var rqe=$(J(),1),y_i=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?rqe.useLayoutEffect:rqe.useEffect;function b_i({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[n]=Di();return y_i(()=>{if(r)return n.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:a,prevEditorState:s,tags:u})=>{e&&i.size===0&&a.size===0||t&&u.has(DY)||s.isEmpty()||r(o,n,u)})},[n,t,e,r]),null}var __i=kwt,nqe=__i.OnChangePlugin;var Bwt={};En(Bwt,{LexicalErrorBoundary:()=>w_i});var zY=$(J(),1),qwt=$(St(),1);function Uwt(t,e){return Uwt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Uwt(t,e)}var Ktn={error:null},v_i=function(t){var e,r;function n(){for(var i,a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return(i=t.call.apply(t,[this].concat(s))||this).state=Ktn,i.resetErrorBoundary=function(){for(var l,c=arguments.length,d=new Array(c),f=0;f<c;f++)d[f]=arguments[f];i.props.onReset==null||(l=i.props).onReset.apply(l,d),i.reset()},i}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,Uwt(e,r),n.getDerivedStateFromError=function(i){return{error:i}};var o=n.prototype;return o.reset=function(){this.setState(Ktn)},o.componentDidCatch=function(i,a){var s,u;(s=(u=this.props).onError)==null||s.call(u,i,a)},o.componentDidUpdate=function(i,a){var s,u,l,c,d=this.state.error,f=this.props.resetKeys;d!==null&&a.error!==null&&((l=i.resetKeys)===void 0&&(l=[]),(c=f)===void 0&&(c=[]),l.length!==c.length||l.some(function(p,m){return!Object.is(p,c[m])}))&&((s=(u=this.props).onResetKeysChange)==null||s.call(u,i.resetKeys,f),this.reset())},o.render=function(){var i=this.state.error,a=this.props,s=a.fallbackRender,u=a.FallbackComponent,l=a.fallback;if(i!==null){var c={error:i,resetErrorBoundary:this.resetErrorBoundary};if(zY.isValidElement(l))return l;if(typeof s=="function")return s(c);if(u)return zY.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(zY.Component);function w_i({children:t,onError:e}){return(0,qwt.jsx)(v_i,{fallback:(0,qwt.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var S_i=Bwt,oqe=S_i.LexicalErrorBoundary;var qT=$(J());var Vwt=$(Efe());var kT=$(J()),Xtn=$(hu());function Ztn(t,e){let r=e.getSelection();if(r===null||!r.isCollapsed)return null;let n=r.anchorNode,o=t,i=r.anchorOffset;if(n==null||i==null)return null;let a=e.document.createRange();try{a.setStart(n,o),a.setEnd(n,i)}catch{return null}return a}var Gtn=400,C_i=.9;function uz({options:t,selectedIndex:e,onSelect:r,onHighlight:n,range:o,query:i,showPreview:a=!1,mode:s="search",onKeyDown:u}){let[l,c]=(0,kT.useState)(null),d=(0,kT.useCallback)(()=>{let m=Math.floor(window.innerWidth*C_i);if(t.length===0)return Math.min(Gtn,m);let h=Math.max(...t.map(_=>_.title.length)),y=Math.max(...t.map(_=>_.subtitle?.length||0)),g=Math.max(h*8+32,y*6+32),b=Math.min(Math.max(g,300),Gtn);return Math.min(b,m)},[t]),f=(0,kT.useCallback)(()=>{if(!o)return;let m=o.getBoundingClientRect(),h=d(),y=m.top-4,g=8,b=window.innerWidth-h-8,_=Math.min(Math.max(m.left,g),b);c({top:y,left:_,width:h})},[o,d]);if((0,kT.useEffect)(()=>{f()},[f]),(0,kT.useEffect)(()=>{let m=()=>f();return window.addEventListener("resize",m),document.addEventListener("scroll",m,{passive:!0}),()=>{window.removeEventListener("resize",m),document.removeEventListener("scroll",m)}},[f]),!l||t.length===0)return null;let p=kT.default.createElement("div",{className:"tw-absolute tw-z-[9999] tw-flex tw-flex-col tw-items-end",style:{bottom:`calc(100vh - ${l.top}px)`,left:l.left,width:l.width}},kT.default.createElement(Eke,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:i,mode:s,showPreview:a,onKeyDown:u,className:"tw-shadow-lg",width:l.width}));return(0,Xtn.createPortal)(p,document.body)}var IN=require("obsidian");Xe();function x_i(t){let{type:e,title:r,data:n}=t;switch(e){case"active-note":return Afe();case"notes":if(n instanceof IN.TFile&&r)return Ife(r,n.path);break;case"tools":if(typeof n=="string")return m6(n);break;case"folders":if(n instanceof IN.TFolder)return Dfe(n.path);break;case"webTabs":if(n&&typeof n=="object"&&"url"in n){let o=n;return kke(o.url,o.title,o.faviconUrl)}break;case"activeWebTab":return Fke()}throw new Error(`Invalid pill data: ${JSON.stringify(t)}`)}function zwt(t,e,r){return{beforeText:t.slice(0,e),afterText:t.slice(r)}}function T_i(t,e,r=!0){if(e.length===1&&e[0].getType()==="text")t.replace(e[0]),r&&Ytn(e[0]);else{for(let n=0;n<e.length;n++)n===0?t.replace(e[n]):e[n-1].insertAfter(e[n]);if(r&&e.length>0){let n=e[e.length-1];Ytn(n)}}}function O_i(t,e,r,n,o){let i=o?n?" "+n:" ":n;e?(t.setTextContent(e),t.insertAfter(r),i&&r.insertAfter(lS(i))):(t.replace(r),i&&r.insertAfter(lS(i))),r.selectNext()}function Ytn(t){if(t.getType()==="text"){let e=t,r=e.getTextContent().length;e.select(r,r)}else{let e=t.getParent();if(e){let r=uke(),n=t.getIndexWithinParent();r.anchor.set(e.getKey(),n+1,"element"),r.focus.set(e.getKey(),n+1,"element"),l6(r)}}}var iqe=KQr("INSERT_TEXT_WITH_PILLS_COMMAND");function E_i(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function P_i(t){let e=t.startsWith("@")?t:`@${t}`;return OX.includes(e)?e:null}function M_i(t){if(!app?.vault)return null;try{let e=app.vault.getAllLoadedFiles().filter(n=>n instanceof IN.TFolder);for(let n of e)if(n.name===t)return n;for(let n of e)if(n.path===t)return n;let r=t.toLowerCase();for(let n of e)if(n.name.toLowerCase()===r||n.path.toLowerCase()===r)return n;return null}catch(e){return F("Error resolving folder reference:",e),null}}function R_i(t){if(!app?.vault||!app?.metadataCache)return null;try{let e=app.metadataCache.getFirstLinkpathDest(t,"");if(e&&e instanceof IN.TFile)return e;if(!t.endsWith(".md")){let i=app.metadataCache.getFirstLinkpathDest(t+".md","");if(i&&i instanceof IN.TFile)return i}if(!t.endsWith(".pdf")){let i=app.metadataCache.getFirstLinkpathDest(t+".pdf","");if(i&&i instanceof IN.TFile)return i}let r=app.vault.getMarkdownFiles();for(let i of r)if(i.basename===t||i.name===t)return i;let o=app.vault.getFiles().filter(i=>i instanceof IN.TFile&&i.extension==="pdf");for(let i of o)if(i.basename===t||i.name===t)return i;return null}catch(e){return F("Error resolving note reference:",e),null}}function aqe(t,e={}){let{includeNotes:r=!0,includeURLs:n=!1,includeTools:o=!1,includeCustomTemplates:i=!1}=e,a=[],s=[],u=[],l=1;if(r&&(s.push("(\\[\\[([^\\]]+)\\]\\])"),u.push({type:"notes",groupCount:2,startIndex:l}),l+=2),n&&(s.push(`(https?:\\/\\/[^\\s"'<>]+)`),u.push({type:"urls",groupCount:1,startIndex:l}),l+=1),o&&(s.push("(@[a-zA-Z][a-zA-Z0-9_]*)"),u.push({type:"tools",groupCount:1,startIndex:l}),l+=1),i&&(s.push("(\\{([^}]+)\\})"),u.push({type:"customTemplates",groupCount:2,startIndex:l}),l+=2),s.length===0)return[{type:"text",content:t}];let c=new RegExp(s.join("|"),"g"),d=0,f;for(;(f=c.exec(t))!==null;){if(f.index>d){let m=t.slice(d,f.index);m&&a.push({type:"text",content:m})}let p=null;for(let m of u)if(f[m.startIndex]){p=m;break}if(!p)a.push({type:"text",content:f[0]});else if(p.type==="notes"){let m=f[p.startIndex+1].trim(),h=R_i(m);if(h&&h instanceof IN.TFile){let g=app?.workspace.getActiveFile()?.path===h.path;a.push({type:"note-pill",content:h.basename,file:h,isActive:g})}else a.push({type:"text",content:f[0]})}else if(p.type==="urls"){let m=f[p.startIndex].replace(/,+$/,"");E_i(m)?a.push({type:"url-pill",content:m,url:m}):a.push({type:"text",content:f[0]})}else if(p.type==="tools"){let m=f[p.startIndex],h=P_i(m);h?a.push({type:"tool-pill",content:h,toolName:h}):a.push({type:"text",content:f[0]})}else if(p.type==="customTemplates"){let m=f[p.startIndex+1].trim();if(m==="activeNote")a.push({type:"active-note-pill",content:"activeNote"});else{let h=M_i(m);h?a.push({type:"folder-pill",content:h.path,folder:h}):a.push({type:"text",content:f[0]})}}d=c.lastIndex}if(d<t.length){let p=t.slice(d);p&&a.push({type:"text",content:p})}return a}function sqe(t){let e=[];for(let r of t)r.type==="text"&&r.content?e.push(lS(r.content)):r.type==="active-note-pill"?e.push(Afe()):r.type==="note-pill"&&r.file?e.push(Ife(r.content,r.file.path)):r.type==="url-pill"&&r.url?e.push($ke(r.url)):r.type==="tool-pill"&&r.toolName?e.push(m6(r.toolName)):r.type==="folder-pill"&&r.folder&&e.push(Dfe(r.folder.path));return e}function Qtn(t,e={}){let{enableURLPills:r=!1,insertAtSelection:n=!0}=e;if(!t)return;let o=_n();if(!Nr(o)){F("No range selection available for text insertion");return}let i=aqe(t,{includeNotes:!0,includeURLs:r}),a=sqe(i);a.length>0&&(n||o.removeText(),o.insertNodes(a))}function ern(t,e,r,n={}){let{enableURLPills:o=!1,enableToolPills:i=!1,enableCustomTemplatePills:a=!1}=n,s=_n();if(!Nr(s))return;let l=s.anchor.getNode();if(l.getType()!=="text")return;let c=l,d=c.getTextContent(),f=aqe(r,{includeNotes:!0,includeURLs:o,includeTools:i,includeCustomTemplates:a});if(f.length===1&&f[0].type==="text"){let{beforeText:p,afterText:m}=zwt(d,t,e),h=p+f[0].content+m;c.setTextContent(h);let y=p.length+f[0].content.length;c.select(y,y)}else{let{beforeText:p,afterText:m}=zwt(d,t,e),h=[];p&&h.push(lS(p)),h.push(...sqe(f)),m&&h.push(lS(m)),T_i(c,h)}}function VY(t,e,r=!0){let n=_n();if(!Nr(n))return;let o=n.anchor,i=o.getNode();if(!(i instanceof TN))return;let a=i.getTextContent(),s=o.offset,u=-1;if(t==="[["?u=a.lastIndexOf("[[",s):u=a.lastIndexOf(t,s),u===-1)return;let{beforeText:l,afterText:c}=zwt(a,u,s),d=x_i(e);O_i(i,l,d,c,r)}var dS=$(J());function lz({triggerConfig:t,options:e,onSelect:r,onStateChange:n,onHighlight:o}){let[i]=Di(),[a,s]=(0,dS.useState)({isOpen:!1,query:"",selectedIndex:0,range:null});(0,dS.useEffect)(()=>{n?.(a)},[a,n]);let u=(0,dS.useCallback)(()=>{s({isOpen:!1,query:"",selectedIndex:0,range:null})},[]),l=(0,dS.useCallback)(f=>{s(p=>({...p,selectedIndex:f})),o&&e[f]&&o(f,e[f])},[o,e]),c=(0,dS.useCallback)(f=>{if(!f||!a.isOpen)return!1;switch(f.key){case"ArrowDown":{if(e.length===0)return!1;f.preventDefault();let p=a.selectedIndex+1;for(;p<e.length&&e[p]?.disabled;)p++;return p>=e.length&&(p=a.selectedIndex),l(p),!0}case"ArrowUp":{if(e.length===0)return!1;f.preventDefault();let p=a.selectedIndex-1;for(;p>=0&&e[p]?.disabled;)p--;return p<0&&(p=a.selectedIndex),l(p),!0}case"Enter":case"Tab":return e.length===0?(u(),!1):(e[a.selectedIndex]?.disabled||(f.preventDefault(),e[a.selectedIndex]&&r(e[a.selectedIndex])),!0);case"Escape":return f.preventDefault(),u(),!0;default:return!1}},[a.isOpen,a.selectedIndex,e,r,u,l]);(0,dS.useEffect)(()=>{let f=i.registerCommand(DQr,b=>c(b),_L),p=i.registerCommand(LQr,b=>c(b),_L),m=i.registerCommand(jY,b=>c(b),_L),h=i.registerCommand(UQr,b=>c(b),_L),y=i.registerCommand(qQr,b=>c(b),_L),g=i.registerCommand(SQr,()=>(a.isOpen&&u(),!1),_L);return()=>{f(),p(),m(),h(),y(),g()}},[i,c,a.isOpen,u]);let d=(0,dS.useCallback)((f,p)=>{let{char:m,multiChar:h=!1,allowWhitespace:y=!1}=t;if(h){let g=m.length,b=-1;for(let _=p-1;_>=g-1;_--)if(f.slice(_-g+1,_+1)===m){if(_-g+1===0||/\s/.test(f[_-g])){b=_-g+1;break}}else if(!y&&/\s/.test(f[_]))break;if(b!==-1){let _=f.slice(b+g,p);return _.startsWith(" ")?null:{triggerIndex:b,query:_}}}else{let g=-1;for(let b=p-1;b>=0;b--){let _=f[b];if(_===m){if(b===0||/\s/.test(f[b-1])){g=b;break}}else if(!y&&/\s/.test(_))break}if(g!==-1){let b=f.slice(g+1,p);return b.startsWith(" ")?null:{triggerIndex:g,query:b}}}return null},[t]);return(0,dS.useEffect)(()=>i.registerUpdateListener(({editorState:f})=>{f.read(()=>{let p=_n();if(!Nr(p)||!p.isCollapsed()){a.isOpen&&u();return}let m=p.anchor,h=m.getNode();if(!(h instanceof TN)){a.isOpen&&u();return}let y=h.getTextContent(),g=m.offset,b=d(y,g);if(b){let{triggerIndex:_,query:w}=b,T=i._window??window,O=Ztn(_,T);O&&s(E=>({...E,isOpen:!0,query:w,selectedIndex:0,range:O}))}else a.isOpen&&u()})}),[i,a.isOpen,u,d]),(0,dS.useEffect)(()=>{s(f=>({...f,selectedIndex:0}))},[e.length]),(0,dS.useEffect)(()=>{s(f=>f.selectedIndex>=e.length&&e.length>0?{...f,selectedIndex:Math.max(0,e.length-1)}:f)},[e.length]),{state:a,setState:s,closeMenu:u,detectTrigger:d,handleHighlight:l}}function trn(){let[t]=Di(),e=g$e(),[r,n]=(0,qT.useState)(""),o=(0,qT.useMemo)(()=>_$e(e.filter(c=>c.showInSlashMenu)).map((c,d)=>({key:`${c.title}-${d}`,title:c.title,content:c.content,command:c})),[e]),i=(0,qT.useMemo)(()=>{if(!r)return o;let l=r,c=Vwt.default.go(l,o,{key:"title",threshold:-1e4});return c.length>0?c.map(f=>f.obj):Vwt.default.go(l,o,{key:"content",threshold:-1e4}).map(f=>f.obj)},[o,r]),a=(0,qT.useCallback)(l=>{th.getInstance().recordUsage(l.command),t.update(()=>{let c=_n();if(!Nr(c))return;let d=c.anchor,f=d.getNode();if(f instanceof TN){let m=f.getTextContent().lastIndexOf("/",d.offset);if(m!==-1){let h=l.content||l.title;ern(m,d.offset,h,{enableURLPills:!0,enableToolPills:!0,enableCustomTemplatePills:!0})}}})},[t]),{state:s,handleHighlight:u}=lz({triggerConfig:{char:"/",allowWhitespace:!0},options:i,onSelect:a,onStateChange:l=>{n(l.query)}});return qT.default.createElement(qT.default.Fragment,null,s.isOpen&&qT.default.createElement(uz,{options:i,selectedIndex:s.selectedIndex,onSelect:a,onHighlight:u,range:s.range,query:s.query,showPreview:!0}))}var fS=$(J());var g6=$(J());Or();var rrn=$(Efe());Ye();var I_i={limit:30,threshold:-1e4};function nrn(t,e=!1,r={},n=null){let o=Ike(e),i=(0,g6.useMemo)(()=>o.map((s,u)=>({key:`${s.basename}-${u}`,title:s.basename,subtitle:s.path,content:"",icon:g6.default.createElement(Du,{className:"tw-size-4"}),file:s})),[o]);return(0,g6.useMemo)(()=>{let s={...I_i,...r},u=te().customPromptsFolder;if(!t.trim()){let g=i.filter(w=>!w.file.path.startsWith(u+"/")),b=i.filter(w=>w.file.path.startsWith(u+"/"));if(n){let w={key:`active-note-${n.path}`,title:"Active Note",subtitle:n.path,content:"",category:"activeNote",icon:g6.default.createElement(R1,{className:"tw-size-4"}),file:n},T=[...g,...b].slice(0,s.limit-1);return[w,...T]}return[...g,...b].slice(0,s.limit)}let l=t.trim(),c=l.toLowerCase(),p="active note".includes(c)&&n?{key:`active-note-${n.path}`,title:"Active Note",subtitle:n.path,content:"",category:"activeNote",icon:g6.default.createElement(R1,{className:"tw-size-4"}),file:n}:null,m=p?s.limit-1:s.limit,y=rrn.default.go(l,i,{keys:["subtitle"],limit:m,threshold:s.threshold}).map(g=>g.obj);return p?[p,...y]:y},[i,t,r,n])}async function A_i(t,e=500){try{if(t.extension==="pdf"||t.extension==="canvas")return"";let n=(await app.vault.cachedRead(t)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim();return n.length>e?n.slice(0,e)+"...":n}catch(r){return console.warn("Failed to read note content:",r),"Failed to load content"}}var uqe=class{constructor(){this.cache=new Map}async getOrLoadContent(e,r=500){let n=this.cache.get(e.path);if(n!==void 0)return n;let o=await A_i(e,r);return this.cache.set(e.path,o),o}clear(){this.cache.clear()}remove(e){this.cache.delete(e)}has(e){return this.cache.has(e)}};function orn({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Di(),[n,o]=(0,fS.useState)(""),[i]=(0,fS.useState)(()=>new uqe),[a,s]=(0,fS.useState)(new Map),u=(0,fS.useCallback)(async m=>{try{let h=await i.getOrLoadContent(m,500);return s(y=>{let g=new Map(y);return g.set(m.path,h),g}),h}catch{let h="Failed to load content";return s(y=>{let g=new Map(y);return g.set(m.path,h),g}),h}},[i]),c=nrn(n,t,{},e).map(m=>({...m,content:a.get(m.file.path)||""})),d=(0,fS.useCallback)(m=>{if(m.category==="activeNote")r.update(()=>{VY("[[",{type:"active-note"})});else{let h={type:"notes",title:m.title,data:m.file};r.update(()=>{VY("[[",h)})}},[r]),{state:f,handleHighlight:p}=lz({triggerConfig:{char:"[[",multiChar:!0,allowWhitespace:!0},options:c,onSelect:d,onStateChange:m=>{o(m.query)},onHighlight:(m,h)=>{h&&!a.has(h.file.path)&&u(h.file)}});return(0,fS.useEffect)(()=>{c.length>0&&!a.has(c[0].file.path)&&u(c[0].file)},[c,a,u]),fS.default.createElement(fS.default.Fragment,null,f.isOpen&&fS.default.createElement(uz,{options:c,selectedIndex:f.selectedIndex,onSelect:d,onHighlight:p,range:f.range,query:f.query,showPreview:!0}))}var cz=$(J());var lqe=$(J()),arn=$(Efe());XC();Ye();function irn(t=!1){let e=L_(Yvt,{store:No}),r=L_(Qvt,{store:No});return t?e:r}var N_i={limit:10,threshold:-1e4,frontmatterOnly:!1};function srn(t,e={}){let r=(0,lqe.useMemo)(()=>({...N_i,...e}),[e]),n=irn(r.frontmatterOnly),o=(0,lqe.useMemo)(()=>n.map((a,s)=>{let u=a.startsWith("#")?a.slice(1):a;return{key:`tag-${u}-${s}`,title:a,subtitle:void 0,content:"",tag:u}}),[n]);return(0,lqe.useMemo)(()=>{if(!t.trim())return o.slice(0,r.limit);let a=t.trim();return arn.default.go(a,o,{key:"title",limit:r.limit,threshold:r.threshold}).map(u=>u.obj)},[o,t,r])}function urn({onTagSelected:t}){let[e]=Di(),[r,n]=(0,cz.useState)(""),o=srn(r,{limit:10}),i=(0,cz.useCallback)(u=>{e.update(()=>{let l=_n();if(!Nr(l))return;let c=l.anchor,d=c.getNode();if(!(d instanceof TN))return;let f=d.getTextContent(),p=c.offset,m=f.lastIndexOf("#",p);if(m===-1)return;let h=f.slice(0,m),y=f.slice(p),g=`#${u.tag} `;d.setTextContent(h+g+y);let b=h.length+g.length;d.select(b,b)}),t?.()},[e,t]),{state:a,handleHighlight:s}=lz({triggerConfig:{char:"#",multiChar:!1,allowWhitespace:!1},options:o,onSelect:i,onStateChange:u=>{n(u.query)}});return cz.default.createElement(cz.default.Fragment,null,a.isOpen&&cz.default.createElement(uz,{options:o,selectedIndex:a.selectedIndex,onSelect:i,onHighlight:s,range:a.range,query:a.query,showPreview:!1}))}var yg=$(J());var Hwt=require("obsidian");function cqe({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Di(),[n,o]=(0,yg.useState)({mode:"category"}),[i,a]=(0,yg.useState)(""),s=Pke(t),u=(0,yg.useCallback)(async _=>{try{if(_.extension==="pdf"||_.extension==="canvas"){a("");return}let T=(await app.vault.cachedRead(_)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim(),O=T.length>300?T.slice(0,300)+"...":T;a(O)}catch{a("Failed to load content")}},[]),[l,c]=(0,yg.useState)(""),d=Dke(l,n.mode,n.selectedCategory,t,s,e),f=(0,yg.useCallback)(_=>"data"in _,[]),p=(0,yg.useCallback)(_=>"icon"in _&&!("data"in _),[]),m=(0,yg.useCallback)(_=>{if(n.mode==="category"&&p(_)&&!l){o(w=>({...w,mode:"search",selectedCategory:_.category}));return}if(f(_))if(_.category==="activeNote")r.update(()=>{VY("@",{type:"active-note"})});else{let w={type:_.category,title:_.title,data:_.data};r.update(()=>{VY("@",w)})}},[n.mode,l,p,f,r]),h=(0,yg.useCallback)(_=>{c(_.query),_.isOpen||o({mode:"category",selectedCategory:void 0})},[]),{state:y,handleHighlight:g}=lz({triggerConfig:{char:"@",allowWhitespace:!0},options:d,onSelect:m,onStateChange:h});(0,yg.useEffect)(()=>{let _=d[y.selectedIndex];_&&f(_)&&_.category==="notes"&&_.data instanceof Hwt.TFile?u(_.data):a("")},[y.selectedIndex,d,f,u]);let b=(0,yg.useMemo)(()=>d.map((_,w)=>w===y.selectedIndex&&f(_)&&_.category==="notes"&&_.data instanceof Hwt.TFile?{..._,content:i}:_),[d,y.selectedIndex,i,f]);return yg.default.createElement(yg.default.Fragment,null,y.isOpen&&yg.default.createElement(uz,{options:b,selectedIndex:y.selectedIndex,onSelect:m,onHighlight:g,range:y.range,query:y.query,showPreview:d[y.selectedIndex]&&f(d[y.selectedIndex])&&d[y.selectedIndex].category==="notes",mode:n.mode}))}var lrn=$(J());function Wwt(t){return t instanceof gke?typeof t.isPill=="function"&&t.isPill()===!0:!1}function dqe(){let[t]=Di();return lrn.default.useEffect(()=>{let e=t.registerCommand(NY,r=>{let n=!1;return t.update(()=>{let o=_n();if(!Nr(o)||!o.isCollapsed()){n=!1;return}let i=o.anchor,a=i.getNode();if(Wwt(a)){(r&&i.offset===1||!r&&i.offset===0)&&(a.remove(),n=!0);return}if(_i(a)&&r&&i.offset>0){let u=a.getChildren()[i.offset-1];if(Wwt(u)){u.remove(),n=!0;return}}if(r&&i.offset===0){let s=a.getPreviousSibling();if(Wwt(s)){s.remove(),n=!0;return}}n=!1}),n},mke);return()=>{e()}},[t]),null}var HY=$(J());mr();function fqe({onSubmit:t,sendShortcut:e}){let[r]=Di(),n=(0,HY.useRef)(!1),o=(0,HY.useRef)(null);return(0,HY.useEffect)(()=>{let i=null,a=()=>{o.current&&(clearTimeout(o.current),o.current=null),n.current=!0},s=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n.current=!1,o.current=null},100)},u=d=>{d.addEventListener("compositionstart",a),d.addEventListener("compositionend",s)},l=d=>{d.removeEventListener("compositionstart",a),d.removeEventListener("compositionend",s)},c=r.registerRootListener((d,f)=>{f&&l(f),d&&u(d),i=d});return()=>{c(),i&&(l(i),i=null),o.current&&(clearTimeout(o.current),o.current=null)}},[r]),(0,HY.useEffect)(()=>r.registerCommand(jY,i=>i?n.current||i.isComposing||i.keyCode===229?(i.preventDefault(),!0):D_i(i,e)?(i.preventDefault(),t(),!0):!1:!1,TQr),[r,t,e]),null}function D_i(t,e){switch(e){case"enter":return!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&!t.altKey;case"shift+enter":return t.shiftKey&&!t.metaKey&&!t.ctrlKey&&!t.altKey;default:return!1}}var crn=$(J());function pqe({value:t}){let[e]=Di();return crn.default.useEffect(()=>{e.update(()=>{let r=Oi();if(r.getTextContent()!==t){r.clear();let o=yL();t&&o.append(lS(t)),r.append(o)}})},[e,t]),null}var drn=$(J());function mqe({onFocus:t,onEditorReady:e}){let[r]=Di();return drn.default.useEffect(()=>{t(()=>{r.focus()}),e&&e(r)},[r,t,e]),null}var frn=$(J());var hqe=$(J());function UT({config:t,onChange:e,onRemoved:r}){let[n]=Di(),o=hqe.default.useRef([]),{isPillNode:i,extractData:a,getKey:s=c=>String(c),getChangeKey:u}=t,l=hqe.default.useMemo(()=>u??s,[u,s]);return hqe.default.useEffect(()=>{if(!(!e&&!r))return n.registerUpdateListener(({editorState:c})=>{c.read(()=>{let d=[],f=Oi();function p(R){if(i(R)){let I=a(R);d.push(I)}if(typeof R.getChildren=="function"){let I=R.getChildren();for(let N of I)p(N)}}p(f);let m=new Set,y=d.filter(R=>{let I=s(R);return m.has(I)?!1:(m.add(I),!0)}).sort((R,I)=>s(R).localeCompare(s(I))),g=o.current,b=y.map(s),_=g.map(s),w=y.map(l),T=g.map(l),O=b.length!==_.length||b.some((R,I)=>R!==_[I]),E=w.length!==T.length||w.some((R,I)=>R!==T[I]);if(O||E){if(r){let R=new Set(b),I=g.filter(N=>!R.has(s(N)));I.length>0&&r(I)}o.current=y,e&&e(y)}})})},[n,e,r,i,a,s,l]),null}var j_i={isPillNode:nwt,extractData:t=>({path:t.getNotePath(),basename:t.getNoteTitle()}),getKey:t=>t.path};function gqe({onNotesChange:t,onNotesRemoved:e}){return frn.default.createElement(UT,{config:j_i,onChange:t,onRemoved:e})}var prn=$(J());var $_i={isPillNode:Ten,extractData:t=>t.getURL()};function mrn({onURLsChange:t,onURLsRemoved:e}){return prn.default.createElement(UT,{config:$_i,onChange:t,onRemoved:e})}var hrn=$(J());var L_i={isPillNode:Pen,extractData:t=>t.getToolName()};function grn({onToolsChange:t,onToolsRemoved:e}){return hrn.default.createElement(UT,{config:L_i,onChange:t,onRemoved:e})}var yrn=$(J());var F_i={isPillNode:Oen,extractData:t=>t.getFolderPath()};function yqe({onFoldersChange:t,onFoldersRemoved:e}){return yrn.default.createElement(UT,{config:F_i,onChange:t,onRemoved:e})}var brn=$(J());function bqe({onActiveNoteAdded:t,onActiveNoteRemoved:e}){let[r]=Di();return(0,brn.useEffect)(()=>{let n=!1,o=r.registerUpdateListener(({editorState:i})=>{i.read(()=>{let a=Oi(),s=!1;function u(l){if(owt(l)){s=!0;return}if(typeof l.getChildren=="function"){let c=l.getChildren();for(let d of c){if(s)return;u(d)}}}u(a),s&&!n?(n=!0,t?.()):!s&&n&&(n=!1,e?.())})});return()=>{o()}},[r,t,e]),null}var dz=$(J());var k_i={isPillNode:Aen,extractData:t=>({url:t.getURL(),title:t.getTitle(),faviconUrl:t.getFaviconUrl()}),getKey:t=>t.url,getChangeKey:t=>[t.url,t.title??"",t.faviconUrl??""].join(`
|
||
`)};function _rn({onWebTabsChange:t,onWebTabsRemoved:e,onActiveWebTabAdded:r,onActiveWebTabRemoved:n}){return dz.default.createElement(dz.default.Fragment,null,dz.default.createElement(UT,{config:k_i,onChange:t,onRemoved:e}),(r||n)&&dz.default.createElement(q_i,{onActiveWebTabAdded:r,onActiveWebTabRemoved:n}))}function q_i({onActiveWebTabAdded:t,onActiveWebTabRemoved:e}){let r={isPillNode:iwt,extractData:()=>!0,getKey:()=>"active-web-tab"},n=dz.default.useCallback(i=>{i.length>0&&t&&t()},[t]),o=dz.default.useCallback(i=>{i.length>0&&e&&e()},[e]);return dz.default.createElement(UT,{config:r,onChange:n,onRemoved:o})}var vrn=$(J());function wrn({enableURLPills:t=!1,onImagePaste:e}){let[r]=Di();return vrn.default.useEffect(()=>r.registerCommand(bke,n=>{let o=n.clipboardData;if(!o)return!1;if(e){let p=o.items;if(p){let m=Array.from(p).filter(h=>h.type.indexOf("image")!==-1);if(m.length>0)return n.preventDefault(),Promise.all(m.map(h=>h.getAsFile())).then(h=>{let y=h.filter(g=>g!==null);y.length>0&&e(y)}),!0}}let i=o.getData("text/plain"),a=i.includes("[["),s=t&&i.includes("http"),u=i.includes("@"),l=i.includes("#"),c=i.includes("{")&&i.includes("}");if(!i||!a&&!s&&!u&&!l&&!c)return!1;let d=aqe(i,{includeNotes:!0,includeURLs:t,includeTools:!0,includeCustomTemplates:!0});return d.some(p=>p.type==="note-pill"||p.type==="active-note-pill"||t&&p.type==="url-pill"||p.type==="tool-pill"||p.type==="folder-pill")?(n.preventDefault(),r.update(()=>{let p=_n();if(!Nr(p))return;let m=sqe(d);m.length>0&&p.insertNodes(m)}),!0):!1},_L),[r,t,e]),null}var Srn=$(J());function Crn(){let[t]=Di();return Srn.default.useEffect(()=>t.registerCommand(iqe,e=>{let{text:r,options:n={}}=e;return t.update(()=>{Qtn(r,n)}),!0},il),[t]),null}var Hv=$(J());var xrn=(0,Hv.createContext)(void 0);function fz(){let t=(0,Hv.useContext)(xrn);if(t===void 0)throw new Error("useChatInput must be used within a ChatInputProvider");return t}function Trn({children:t}){let[e,r]=(0,Hv.useState)(null),[n,o]=(0,Hv.useState)(null),i=(0,Hv.useCallback)(c=>{r(c)},[]),a=(0,Hv.useCallback)(c=>{o(()=>c)},[]),s=(0,Hv.useCallback)((c,d=!1)=>{e&&e.dispatchCommand(iqe,{text:c,options:{enableURLPills:d,insertAtSelection:!0}})},[e]),u=(0,Hv.useCallback)(()=>{n&&n()},[n]),l={insertTextWithPills:s,focusInput:u,registerEditor:i,registerFocusHandler:a};return Hv.default.createElement(xrn.Provider,{value:l},t)}$r();Xe();sd();Ye();var U_i=({value:t,onChange:e,onSubmit:r,placeholder:n="Type a message...",disabled:o=!1,className:i="",onNotesChange:a,onNotesRemoved:s,onURLsChange:u,onURLsRemoved:l,onToolsChange:c,onToolsRemoved:d,onFoldersChange:f,onFoldersRemoved:p,onActiveNoteAdded:m,onActiveNoteRemoved:h,onWebTabsChange:y,onWebTabsRemoved:g,onActiveWebTabAdded:b,onActiveWebTabRemoved:_,onEditorReady:w,onImagePaste:T,onTagSelected:O,isCopilotPlus:E=!1,currentActiveFile:P=null,currentChain:R})=>{let[I,N]=Yi.default.useState(null),[z,V]=Yi.default.useState(null),k=fz(),X=Br(),B=Yi.default.useCallback(oe=>{N(()=>oe)},[]);(0,Yi.useEffect)(()=>{z&&k.registerEditor(z)},[z,k]),(0,Yi.useEffect)(()=>{I&&k.registerFocusHandler(I)},[I,k]);let Q=Yi.default.useMemo(()=>({namespace:"ChatEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[oz,iz,p6,vL,wL,az,...u?[f6]:[]],onError:oe=>{ne("Lexical error:",oe)},editable:!o}),[u,o]),Y=(0,Yi.useCallback)(oe=>{oe.read(()=>{let de=Oi().getTextContent();e(de)})},[e]),K=(0,Yi.useCallback)(oe=>{V(oe),w?.(oe)},[w]);return Yi.default.createElement(Bke,{initialConfig:Q},Yi.default.createElement(jke,{currentActiveFile:P},Yi.default.createElement("div",{className:we("tw-relative",i)},Yi.default.createElement(Xke,{contentEditable:Yi.default.createElement(Zke,{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 tw-outline-none focus-visible:tw-ring-0","aria-label":"Chat input"}),placeholder:Yi.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-left-2 tw-top-0 tw-select-none tw-text-sm tw-text-muted/60"},n),ErrorBoundary:oqe}),Yi.default.createElement(nqe,{onChange:Y}),Yi.default.createElement(tqe,null),Yi.default.createElement(fqe,{onSubmit:r,sendShortcut:X.defaultSendShortcut}),Yi.default.createElement(pqe,{value:t}),Yi.default.createElement(mqe,{onFocus:B,onEditorReady:K}),Yi.default.createElement(gqe,{onNotesChange:a,onNotesRemoved:s}),u&&Yi.default.createElement(mrn,{onURLsChange:u,onURLsRemoved:l}),Yi.default.createElement(grn,{onToolsChange:c,onToolsRemoved:d}),Yi.default.createElement(yqe,{onFoldersChange:f,onFoldersRemoved:p}),Yi.default.createElement(bqe,{onActiveNoteAdded:m,onActiveNoteRemoved:h}),Yi.default.createElement(_rn,{onWebTabsChange:y,onWebTabsRemoved:g,onActiveWebTabAdded:b,onActiveWebTabRemoved:_}),Yi.default.createElement(dqe,null),Yi.default.createElement(wrn,{enableURLPills:!!u,onImagePaste:T}),Yi.default.createElement(trn,null),Yi.default.createElement(orn,{isCopilotPlus:E,currentActiveFile:P}),R&&R!=="llm_chain"&&Yi.default.createElement(urn,{onTagSelected:O}),Yi.default.createElement(cqe,{isCopilotPlus:E,currentActiveFile:P}),Yi.default.createElement(Crn,null))))},Orn=U_i;var Ern=({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,includeActiveWebTab:c,setIncludeActiveWebTab:d,activeWebTab:f,selectedImages:p,onAddImage:m,setSelectedImages:h,disableModelSwitch:y,selectedTextContexts:g,onRemoveSelectedText:b,showProgressCard:_,showIndexingCard:w,editMode:T=!1,onEditSave:O,onEditCancel:E,initialContext:P})=>{let[R,I]=(0,Jt.useState)(P?.urls||[]),[N,z]=(0,Jt.useState)(P?.folders||[]),[V,k]=(0,Jt.useState)([]),X=(0,Jt.useRef)(null),B=(0,Jt.useRef)(null),[Q,Y]=bF(),[K]=fw(),[oe]=Dye(),ue=Br(),[de,L]=(0,Jt.useState)(()=>{let Be=i.workspace.getActiveFile();return yO(Be)?Be:null}),[W,ie]=(0,Jt.useState)(null),[j,A]=(0,Jt.useState)([]),[U,H]=(0,Jt.useState)([]),[re,Z]=(0,Jt.useState)([]),[le,Ce]=(0,Jt.useState)([]),[He,lt]=(0,Jt.useState)([]),qe=zb(K),Nt=(0,Jt.useMemo)(()=>DW([...V,...He]),[V,He]),mt=()=>{let Be=B.current;return Be?Be.read(()=>awt().map(It=>({url:It.getURL(),title:It.getTitle(),faviconUrl:It.getFaviconUrl()}))):He},[Ot,je]=(0,Jt.useState)(!1),[Gr,ct]=(0,Jt.useState)(!1),[ze,ht]=(0,Jt.useState)(!1),[$e,Ue]=(0,Jt.useState)(ue.enableAutonomousAgent),[Ve,Kt]=(0,Jt.useState)(0),so=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,Jt.useEffect)(()=>{K==="project"?Ue(!1):Ue(ue.enableAutonomousAgent)},[ue.enableAutonomousAgent,K]),(0,Jt.useEffect)(()=>{if(K==="project"){ie(Gu());let Be=i5(Ee=>{ie(Ee)});return()=>{Be()}}else ie(null)},[K]),(0,Jt.useEffect)(()=>{if(!oe)return;let Be=setInterval(()=>{Kt(Ee=>(Ee+1)%so.length)},3e3);return()=>clearInterval(Be)},[oe,so.length]);let iu=()=>W&&K==="project"&&W.projectModelKey?W.projectModelKey:Q,An=()=>{if(T&&O){O(t,{notes:a,urls:R,folders:N});return}let Be=mt(),Ee=DW([...V,...Be]);if(!qe){r({webTabs:Ee});return}let It=[];if(!$e){let Qt=t.toLowerCase();Ot&&!Qt.includes("@vault")&&It.push("@vault"),Gr&&!Qt.includes("@websearch")&&!Qt.includes("@web")&&It.push("@websearch"),ze&&!Qt.includes("@composer")&&It.push("@composer")}r({toolCalls:It,contextNotes:a,urls:R,contextFolders:N,webTabs:Ee})},Si=Be=>{let Ee=new Set(Be.map(It=>It.path));s(It=>It.filter(Qt=>!Ee.has(Qt.path)))},Dl=Be=>{let Ee=new Set(Be);I(It=>It.filter(Qt=>!Ee.has(Qt)))},Vi=Be=>{!qe||$e||Be.forEach(Ee=>{switch(Ee){case"@vault":je(!1);break;case"@websearch":case"@web":ct(!1);break;case"@composer":ht(!1);break}})};(0,Jt.useEffect)(()=>{if(!qe||$e)return;let Be=le.includes("@vault"),Ee=le.includes("@websearch")||le.includes("@web"),It=le.includes("@composer");je(Be),ct(Ee),ht(It)},[le,qe,$e]);let O_=Be=>{B.current&&B.current.update(()=>{ven(Be)}),A(Ee=>Ee.filter(It=>It.path!==Be))},wg=Be=>{B.current&&B.current.update(()=>{xen(Be)}),H(Ee=>Ee.filter(It=>It!==Be))},yS=Be=>{B.current&&B.current.update(()=>{Een(Be)}),Z(Ee=>Ee.filter(It=>It!==Be))},ji=(Be,Ee)=>{switch(Be){case"activeNote":l(!0);break;case"notes":if(Ee instanceof kfe.TFile){let It=i.workspace.getActiveFile();It&&Ee.path===It.path?(l(!0),s(Qt=>Qt.filter(Fn=>Fn.path!==Ee.path))):s(Qt=>Qt.find(cl=>cl.path===Ee.path)?Qt:[...Qt,Ee])}break;case"tools":typeof Ee=="string"&&B.current&&B.current.update(()=>{let It=_n();if(Nr(It)){let Qt=m6(Ee);It.insertNodes([Qt])}});break;case"folders":if(Ee&&Ee.path){let It=Ee.path;z(Qt=>Qt.find(cl=>cl===It)?Qt:[...Qt,It])}break;case"webTabs":if(Ee&&typeof Ee.url=="string"){let It=xbt(Ee);if(!It)break;let Qt=_b(f?.url);if(Qt&&It.url===Qt){d(!0),k(Fn=>Fn.filter(cl=>_b(cl.url)!==Qt));break}k(Fn=>DW([...Fn,It]))}break;case"activeWebTab":d(!0);{let It=_b(f?.url);It&&k(Qt=>Qt.filter(Fn=>_b(Fn.url)!==It))}break}},KT=(Be,Ee)=>{switch(Be){case"activeNote":l(!1),B.current&&B.current.update(()=>{Cen()});break;case"notes":typeof Ee=="string"&&(de?.path===Ee&&u?l(!1):s(It=>It.filter(Qt=>Qt.path!==Ee)),O_(Ee));break;case"urls":typeof Ee=="string"&&(I(It=>It.filter(Qt=>Qt!==Ee)),wg(Ee));break;case"folders":typeof Ee=="string"&&(z(It=>It.filter(Qt=>Qt!==Ee)),yS(Ee));break;case"selectedText":typeof Ee=="string"&&b?.(Ee);break;case"activeWebTab":d(!1),B.current&&B.current.update(()=>{Ren()});break;case"webTabs":if(typeof Ee=="string"){let It=_b(Ee);if(!It)break;k(Qt=>Qt.filter(Fn=>_b(Fn.url)!==It)),lt(Qt=>Qt.filter(Fn=>_b(Fn.url)!==It)),B.current&&B.current.update(()=>{Nen(It)})}break}},LC=Be=>{let Ee=new Set(Be);z(It=>It.filter(Qt=>!Ee.has(Qt)))};(0,Jt.useEffect)(()=>{s(Be=>{let Ee=new Set(Be.map(Fn=>Fn.path)),It=j.filter(Fn=>!Ee.has(Fn.path)),Qt=[];return It.forEach(Fn=>{let cl=i.vault.getAbstractFileByPath(Fn.path);cl instanceof kfe.TFile&&Qt.push(cl)}),[...Be,...Qt]})},[j,i.vault,s]),(0,Jt.useEffect)(()=>{zb(K)?I(Be=>{let Ee=new Set(Be),It=U.filter(Qt=>!Ee.has(Qt));return It.length>0?Array.from(new Set([...Be,...It])):Be}):I([])},[U,K]),(0,Jt.useEffect)(()=>{z(Be=>{let Ee=new Set(Be),It=re.filter(Qt=>!Ee.has(Qt));return[...Be,...It]})},[re]),(0,Jt.useEffect)(()=>{let Be,Ee=()=>{clearTimeout(Be),Be=setTimeout(()=>{let Qt=i.workspace.getActiveFile();L(yO(Qt)?Qt:null)},100)},It=i.workspace.on("active-leaf-change",Ee);return()=>{clearTimeout(Be),i.workspace.offref(It)}},[i.workspace]);let bS=(0,Jt.useCallback)(Be=>{B.current=Be},[]);(0,Jt.useEffect)(()=>{if(!T||!E)return;let Be=Ee=>{Ee.key==="Escape"&&(Ee.preventDefault(),E())};return document.addEventListener("keydown",Be),()=>document.removeEventListener("keydown",Be)},[T,E]);let Gs=(0,Jt.useCallback)(()=>{B.current&&qe&&B.current.update(()=>{jfe("@vault")})},[qe]),jl=(0,Jt.useCallback)(()=>{B.current&&qe&&B.current.update(()=>{jfe("@websearch"),jfe("@web")})},[qe]),Mu=(0,Jt.useCallback)(()=>{B.current&&qe&&B.current.update(()=>{jfe("@composer")})},[qe]),Mm=(0,Jt.useCallback)(()=>{l(!0)},[l]),xd=(0,Jt.useCallback)(()=>{l(!1)},[l]),ll=(0,Jt.useCallback)(()=>{d(!0)},[d]),rt=(0,Jt.useCallback)(()=>{d(!1)},[d]),Rr=(0,Jt.useCallback)(()=>{qe&&!$e&&!Ot&&(je(!0),new kfe.Notice("Vault search enabled for tag query"))},[qe,$e,Ot]);return Jt.default.createElement("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-0.5 tw-rounded-md tw-border tw-border-solid tw-border-border tw-px-1 tw-pb-1 tw-pt-2 tw-@container/chat-input",ref:X},!T&&Jt.default.createElement(yen,{contextNotes:a,includeActiveNote:u,activeNote:de,includeActiveWebTab:c,activeWebTab:f,contextUrls:R,contextFolders:N,contextWebTabs:Nt,selectedTextContexts:g,showProgressCard:_,showIndexingCard:w,lexicalEditorRef:B,onAddToContext:ji,onRemoveFromContext:KT}),p.length>0&&Jt.default.createElement("div",{className:"selected-images"},p.map((Be,Ee)=>Jt.default.createElement("div",{key:Ee,className:"image-preview-container"},Jt.default.createElement("img",{src:URL.createObjectURL(Be),alt:Be.name,className:"selected-image-preview"}),Jt.default.createElement("button",{className:"remove-image-button",onClick:()=>h(It=>It.filter((Qt,Fn)=>Fn!==Ee)),title:"Remove image"},Jt.default.createElement(qo,{className:"tw-size-4"}))))),Jt.default.createElement("div",{className:"tw-relative"},oe&&Jt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-bg-primary tw-opacity-80 tw-backdrop-blur-sm"},Jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Jt.default.createElement(Bs,{className:"tw-size-4 tw-animate-spin"}),Jt.default.createElement("span",{className:"tw-text-sm"},so[Ve]))),Jt.default.createElement(Orn,{value:t,onChange:Be=>e(Be),onSubmit:An,onNotesChange:A,onNotesRemoved:Si,onActiveNoteAdded:Mm,onActiveNoteRemoved:xd,onURLsChange:qe?H:void 0,onURLsRemoved:qe?Dl:void 0,onToolsChange:qe?Ce:void 0,onToolsRemoved:qe?Vi:void 0,onFoldersChange:Z,onFoldersRemoved:LC,onWebTabsChange:lt,onActiveWebTabAdded:ll,onActiveWebTabRemoved:rt,onEditorReady:bS,onImagePaste:m,onTagSelected:Rr,placeholder:"Your AI assistant for Obsidian \u2022 @ to add context \u2022 / for custom prompts",disabled:oe,isCopilotPlus:qe,currentActiveFile:de,currentChain:K})),Jt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?Jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},Jt.default.createElement(Bs,{className:"tw-size-3 tw-animate-spin"}),Jt.default.createElement("span",null,"Generating...")):Jt.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Jt.default.createElement(IZ,{variant:"ghost2",size:"fit",disabled:y,value:iu(),onChange:Be=>{K!=="project"&&Y(Be)},className:"tw-max-w-full tw-truncate"})),Jt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?Jt.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},Jt.default.createElement(VF,{className:"tw-size-4"}),"Stop"):Jt.default.createElement(Jt.default.Fragment,null,Jt.default.createElement(MXr,{vaultToggle:Ot,setVaultToggle:je,webToggle:Gr,setWebToggle:ct,composerToggle:ze,setComposerToggle:ht,autonomousAgentToggle:$e,setAutonomousAgentToggle:Ue,currentChain:K,onVaultToggleOff:Gs,onWebToggleOff:jl,onComposerToggleOff:Mu}),Jt.default.createElement(y_,{delayDuration:0},Jt.default.createElement(yn,null,Jt.default.createElement(bn,{asChild:!0},Jt.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new SFe(i,m).open()}},Jt.default.createElement(ene,{className:"tw-size-4"}))),Jt.default.createElement(dn,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),T&&E&&Jt.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:E},Jt.default.createElement("span",null,"cancel")),Jt.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>An()},Jt.default.createElement(Vre,{className:"!tw-size-3"}),Jt.default.createElement("span",null,T?"save":"chat"))))))};Ern.displayName="ChatInput";var _qe=Ern;Cn();mr();$r();Or();var Prn=require("obsidian"),ro=$(J()),Mrn=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>ro.default.createElement("div",{className:we("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!Prn.Platform.isMobile})},t.sender===Zs?ro.default.createElement(ro.default.Fragment,null,ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?ro.default.createElement(Yu,{className:"tw-size-4"}):ro.default.createElement($g,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Copy")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},ro.default.createElement(G_,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Edit")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},ro.default.createElement(Vy,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Delete"))):ro.default.createElement(ro.default.Fragment,null,u&&ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},ro.default.createElement(X4,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Show Sources")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},ro.default.createElement(cne,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Insert / Replace at cursor")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?ro.default.createElement(Yu,{className:"tw-size-4"}):ro.default.createElement($g,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Copy")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},ro.default.createElement(une,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Regenerate")),ro.default.createElement(yn,null,ro.default.createElement(bn,{asChild:!0},ro.default.createElement(pe,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},ro.default.createElement(Vy,{className:"tw-size-4"}))),ro.default.createElement(dn,null,"Delete"))));var Rrn=require("obsidian"),vqe=class extends Rrn.Modal{constructor(e,r){super(e),this.sources=r}onOpen(){let{contentEl:e}=this;e.empty(),e.createEl("h2",{text:"Sources"}),this.createSourceList(e,this.sources)}createSourceList(e,r){let n=e.createEl("ul");n.style.listStyleType="none",n.style.padding="0",r.forEach(o=>{let i=n.createEl("li");i.style.marginBottom="1em";let a=i.createDiv();a.style.cursor="pointer";let s=a.createSpan();s.style.marginRight="0.5em",s.style.display="inline-block",s.style.width="1em",s.style.transition="transform 0.2s",s.textContent=o.explanation?"\u25B6":"";let u=o.path&&o.path!==o.title?`${o.title} (${o.path})`:o.title,l=a.createEl("a",{href:`obsidian://open?vault=${encodeURIComponent(this.app.vault.getName())}&file=${encodeURIComponent(o.path||o.title)}`,text:u});l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this.app.workspace.openLinkText(o.path||o.title,"")}),typeof o.score=="number"&&a.appendChild(document.createTextNode(` - Relevance score: ${o.score.toFixed(4)}`));let c=null;o.explanation&&(c=this.addExplanation(i,o.explanation),c.style.display="none",a.addEventListener("click",d=>{if(d.target!==l&&c){let f=c.style.display!=="none";c.style.display=f?"none":"block",s.style.transform=f?"":"rotate(90deg)"}}))})}addExplanation(e,r){let n=e.createDiv({cls:"search-explanation"});n.style.marginTop="0.5em",n.style.marginLeft="2.5em",n.style.fontSize="0.9em",n.style.color="var(--text-muted)",n.style.borderLeft="2px solid var(--background-modifier-border)",n.style.paddingLeft="0.5em";let o=[];if(r.lexicalMatches&&r.lexicalMatches.length>0){let i=new Set(r.lexicalMatches.map(s=>s.field)),a=new Set(r.lexicalMatches.map(s=>s.query));o.push(`Lexical: matched "${Array.from(a).join('", "')}" in ${Array.from(i).join(", ")}`)}if(r.semanticScore!==void 0&&r.semanticScore>0&&o.push(`Semantic: ${(r.semanticScore*100).toFixed(1)}% similarity`),r.folderBoost&&o.push(`Folder boost: ${r.folderBoost.boostFactor.toFixed(2)}x (${r.folderBoost.documentCount} docs in ${r.folderBoost.folder||"root"})`),r.graphConnections){let i=r.graphConnections,a=[];i.backlinks>0&&a.push(`${i.backlinks} backlinks`),i.coCitations>0&&a.push(`${i.coCitations} co-citations`),i.sharedTags>0&&a.push(`${i.sharedTags} shared tags`),a.length>0&&o.push(`Graph connections: ${i.score.toFixed(1)} score (${a.join(", ")})`)}return r.graphBoost&&!r.graphConnections&&o.push(`Graph boost: ${r.graphBoost.boostFactor.toFixed(2)}x (${r.graphBoost.connections} connections)`),r.baseScore!==r.finalScore&&o.push(`Score: ${r.baseScore.toFixed(4)} \u2192 ${r.finalScore.toFixed(4)}`),o.length>0&&o.forEach(i=>{let a=n.createEl("div");a.style.marginBottom="0.25em",a.textContent=`\u2022 ${i}`}),n}onClose(){let{contentEl:e}=this;e.empty()}};var xb=$(J());var Irn=({initialValue:t,initialContext:e,onSave:r,onCancel:n,app:o})=>{let[i,a]=(0,xb.useState)(t),[s,u]=(0,xb.useState)(e?.notes?.map(P=>P)||[]),[l,c]=(0,xb.useState)(!1),[d,f]=(0,xb.useState)(!1),[p,m]=(0,xb.useState)([]),{activeWebTabForMentions:h}=rz(),y=(0,xb.useCallback)((P,R)=>{let I={notes:R.notes,urls:R.urls,tags:R.tags,folders:R.folders,selectedTextContexts:e?.selectedTextContexts||[]};r(P,I)},[r,e?.selectedTextContexts]),g=(0,xb.useCallback)(()=>{n()},[n]),b=(0,xb.useCallback)(()=>{},[]),_=(0,xb.useCallback)(()=>{},[]),w=(0,xb.useCallback)(P=>{m(R=>[...R,...P])},[]),T=(0,xb.useCallback)(P=>{},[]),O=(0,xb.useCallback)(()=>{},[]),E={notes:s,urls:e?.urls||[],tags:e?.tags||[],folders:e?.folders||[]};return xb.default.createElement(_qe,{inputMessage:i,setInputMessage:a,handleSendMessage:b,isGenerating:!1,onStopGenerating:_,app:o,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,includeActiveWebTab:d,setIncludeActiveWebTab:f,activeWebTab:h,selectedImages:p,onAddImage:w,setSelectedImages:m,disableModelSwitch:!1,selectedTextContexts:e?.selectedTextContexts,onRemoveSelectedText:T,showProgressCard:O,editMode:!0,onEditSave:y,onEditCancel:g,initialContext:E})};ra();Cn();Ye();Cn();var pS=$(J());$r();Or();vO();Xe();Bt();function AN({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,pS.useState)(!1),s=(0,pS.useRef)(null),u=(0,pS.useRef)(!0);return(0,pS.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await oo(t)}catch(c){ne("Failed to decrypt value:"+zr(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),pS.default.createElement("div",{className:we("tw-relative",o)},pS.default.createElement(ri,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:we("tw-w-full !tw-pr-7")}),pS.default.createElement("div",{onClick:()=>!n&&a(!i),className:we("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?pS.default.createElement(Jre,{className:we("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):pS.default.createElement(dx,{className:we("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}mr();Ye();Bt();hF();var wqe=require("obsidian"),kr=$(J()),Arn=$(jm());var B_i=({model:t,onUpdate:e,isEmbeddingModel:r,onCancel:n})=>{let[o,i]=(0,kr.useState)(t),[a,s]=(0,kr.useState)(t),[u,l]=(0,kr.useState)({}),c=te(),d=o.provider==="amazon-bedrock";(0,kr.useEffect)(()=>{i(t),s(t),t.provider&&l(d1(t.provider))},[t]);let f=(0,kr.useMemo)(()=>yye((_,w)=>{e(r,_,w)},500),[r,e]),p=(0,kr.useCallback)((_,w)=>{i(T=>{let O={...T,[_]:w};return f(a,O),O})},[a,f]),m=(0,kr.useCallback)(_=>{i(w=>{let T={...w};return delete T[_],f(a,T),T})},[f,a]);if(!o)return null;let h=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let _=o.azureOpenAIApiInstanceName||"[instance]",w=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",T=o.azureOpenAIApiVersion||"[api-version]",O=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${_}.openai.azure.com/openai/deployments/${w}/${O}?api-version=${T}`},y=Object.entries(gF).map(([_,w])=>({id:_,label:_.charAt(0).toUpperCase()+_.slice(1),description:w})),g=Bb(o.provider,o),b=!r&&o.provider!=="copilot-plus-jina";return kr.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},kr.default.createElement("div",{className:"tw-space-y-3"},kr.default.createElement(Vo,{label:"Model Name",required:!0},kr.default.createElement(ri,{type:"text",disabled:o.core,value:o.name,onChange:_=>p("name",_.target.value),placeholder:"Enter model name"})),kr.default.createElement(Vo,{label:kr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},kr.default.createElement("span",{className:"tw-leading-none"},"Display Name"),kr.default.createElement(to,{content:kr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},kr.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),kr.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),kr.default.createElement("div",{className:"tw-text-[12px]"},"Example:",kr.default.createElement("li",null,"Direct-Paid:Ds-r1"),kr.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),kr.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},kr.default.createElement(ri,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:_=>p("displayName",_.target.value)})),kr.default.createElement(Vo,{label:"Provider"},kr.default.createElement(ri,{type:"text",value:Rg(o.provider),disabled:!0})),kr.default.createElement(Vo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},kr.default.createElement(ri,{type:"text",placeholder:h(),value:o.baseUrl||"",onChange:_=>p("baseUrl",_.target.value)})),d&&kr.default.createElement(Vo,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},kr.default.createElement(ri,{type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:o.bedrockRegion||"",onChange:_=>p("bedrockRegion",_.target.value)})),kr.default.createElement(Vo,{label:"API Key"},kr.default.createElement(AN,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:g,onChange:_=>p("apiKey",_)}),u.keyManagementURL&&kr.default.createElement("p",{className:"tw-text-xs tw-text-muted"},kr.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),b&&kr.default.createElement(kr.default.Fragment,null,kr.default.createElement(Vo,{label:kr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},kr.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),kr.default.createElement(to,{content:kr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},kr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},y.map(({id:_,label:w,description:T})=>kr.default.createElement("div",{key:_,className:"tw-flex tw-items-center tw-gap-2"},kr.default.createElement(Rl,{id:_,checked:o.capabilities?.includes(_),onCheckedChange:O=>{let E=o.capabilities||[],P=O?[...E,_]:E.filter(R=>R!==_);p("capabilities",P)}}),kr.default.createElement(to,{content:T},kr.default.createElement(Xc,{htmlFor:_,className:"tw-text-sm"},w)))))),(o.provider==="3rd party (openai-format)"||o.provider==="lm-studio")&&kr.default.createElement(Vo,{label:"Stream Options"},kr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kr.default.createElement(Rl,{id:"stream-usage",checked:o.streamUsage||!1,onCheckedChange:_=>p("streamUsage",_)}),kr.default.createElement(to,{content:kr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enable if your provider supports stream_options for token usage tracking. Disable for providers that do not support it (e.g., Databricks, MLFlow).")},kr.default.createElement(Xc,{htmlFor:"stream-usage",className:"tw-cursor-pointer tw-text-sm"},"Stream Usage")))),kr.default.createElement(vFe,{model:o,settings:c,onChange:p,onReset:m,showTokenLimit:!0}))),kr.default.createElement("div",{className:"tw-mt-6 tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-border tw-pt-4"},kr.default.createElement(pe,{variant:"secondary",onClick:n},"Close")))},WY=class extends wqe.Modal{constructor(r,n,o,i){super(r);this.model=n;this.isEmbeddingModel=o;this.onUpdate=i;this.setTitle(`Model Settings - ${this.model.name}`)}onOpen(){let{contentEl:r,modalEl:n}=this;wqe.Platform.isMobile&&(n.style.height="80%"),this.root=(0,Arn.createRoot)(r);let o=(a,s,u)=>{this.onUpdate(a,s,u)},i=()=>{this.close()};this.root.render(kr.default.createElement(B_i,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:o,onCancel:i}))}onClose(){this.root.unmount()}};Or();var Nrn=require("obsidian"),xL=$(J()),Drn=({message:t,app:e})=>{let r=()=>{let n=te(),o=B_(),i=n.activeModels.find(u=>no(u)===o);if(!i){new Nrn.Notice("Could not find the current model settings");return}let a=(u,l,c)=>{let d=n.activeModels.map(f=>f===l?c:f);Re("activeModels",d)};new WY(e,i,!1,a).open()};return xL.default.createElement("div",{className:"tw-mt-3 tw-rounded-md tw-border tw-border-border tw-bg-callout-warning/20 tw-p-4"},xL.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-3"},xL.default.createElement(Lg,{className:"tw-size-5 tw-shrink-0 tw-text-warning"}),xL.default.createElement("div",{className:"tw-flex-1"},xL.default.createElement("div",{className:"tw-mb-2 tw-font-semibold tw-text-warning"},"Response Truncated"),xL.default.createElement("div",{className:"tw-mb-3 tw-text-normal"},"The AI response was cut off because it reached the token limit. You can increase the 'Token Limit' in model settings for longer responses."),t.responseMetadata?.tokenUsage&&xL.default.createElement("div",{className:"tw-mb-3 tw-text-sm tw-text-muted"},"Output tokens used: ",t.responseMetadata.tokenUsage.outputTokens||"N/A"),xL.default.createElement(pe,{variant:"secondary",size:"sm",onClick:r,className:"tw-text-warning hover:tw-bg-callout-warning/10"},"Open Model Settings"))))};var oSt=$(J()),iSt=$(jm());var Sqe=$(J()),jrn=({errorContent:t})=>Sqe.default.createElement("div",{className:"tw-my-2 tw-mb-6 tw-max-h-[180px] tw-overflow-y-scroll tw-rounded-xl tw-bg-modifier-error-rgb/5 tw-p-3"},Sqe.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-semibold tw-text-error"},"\u26A0\uFE0F Error occurred"),Sqe.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-xs tw-text-error"},t.trim()));var by=$(J(),1);function $rn(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var TL=$(J(),1),Lrn=$(St(),1);function Frn(t,e=[]){let r=[];function n(i,a){let s=TL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=TL.useMemo(()=>m,Object.values(m));return(0,Lrn.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=TL.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=>TL.createContext(a));return function(s){let u=s?.[t]||i;return TL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,z_i(o,...e)]}function z_i(...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 TL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var pz=$(J(),1);var JY=$(J(),1);function Jwt(t){let e=JY.useRef(t);return JY.useEffect(()=>{e.current=t}),JY.useMemo(()=>(...r)=>e.current?.(...r),[])}function krn({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=V_i({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=Jwt(r),u=pz.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 V_i({defaultProp:t,onChange:e}){let r=pz.useState(t),[n]=r,o=pz.useRef(n),i=Jwt(e);return pz.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var qrn=$(J(),1),y6=globalThis?.document?qrn.useLayoutEffect:()=>{};var Brn=$(J(),1);function Urn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Kwt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Urn(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():Urn(t[o],null)}}}}function zrn(...t){return Brn.useCallback(Kwt(...t),t)}var Vrn=$(J(),1),G_i=$(hu(),1);var yy=$(J(),1);var KY=$(St(),1),Xwt=yy.forwardRef((t,e)=>{let{children:r,...n}=t,o=yy.Children.toArray(r),i=o.find(W_i);if(i){let a=i.props.children,s=o.map(u=>u===i?yy.Children.count(a)>1?yy.Children.only(null):yy.isValidElement(a)?a.props.children:null:u);return(0,KY.jsx)(Gwt,{...n,ref:e,children:yy.isValidElement(a)?yy.cloneElement(a,void 0,s):null})}return(0,KY.jsx)(Gwt,{...n,ref:e,children:r})});Xwt.displayName="Slot";var Gwt=yy.forwardRef((t,e)=>{let{children:r,...n}=t;if(yy.isValidElement(r)){let o=K_i(r);return yy.cloneElement(r,{...J_i(n,r.props),ref:e?Kwt(e,o):o})}return yy.Children.count(r)>1?yy.Children.only(null):null});Gwt.displayName="SlotClone";var H_i=({children:t})=>(0,KY.jsx)(KY.Fragment,{children:t});function W_i(t){return yy.isValidElement(t)&&t.type===H_i}function J_i(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 K_i(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 Hrn=$(St(),1),X_i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Cqe=X_i.reduce((t,e)=>{let r=Vrn.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?Xwt:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Hrn.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var Wv=$(J(),1);var Jrn=$(J(),1);function Wrn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Z_i(...t){return e=>{let r=!1,n=t.map(o=>{let i=Wrn(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():Wrn(t[o],null)}}}}function Krn(...t){return Jrn.useCallback(Z_i(...t),t)}var Grn=$(J(),1);function Y_i(t,e){return Grn.useReducer((r,n)=>e[r][n]??r,t)}var Zwt=t=>{let{present:e,children:r}=t,n=Q_i(e),o=typeof r=="function"?r({present:n.isPresent}):Wv.Children.only(r),i=Krn(n.ref,evi(o));return typeof r=="function"||n.isPresent?Wv.cloneElement(o,{ref:i}):null};Zwt.displayName="Presence";function Q_i(t){let[e,r]=Wv.useState(),n=Wv.useRef({}),o=Wv.useRef(t),i=Wv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Y_i(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Wv.useEffect(()=>{let l=xqe(n.current);i.current=s==="mounted"?l:"none"},[s]),y6(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=xqe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),y6(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=xqe(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=xqe(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:Wv.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function xqe(t){return t?.animationName||"none"}function evi(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 Tqe=$(J(),1);var tvi=Tqe.useId||(()=>{}),rvi=0;function Xrn(t){let[e,r]=Tqe.useState(tvi());return y6(()=>{t||r(n=>n??String(rvi++))},[t]),t||(e?`radix-${e}`:"")}var b6=$(St(),1),Ywt="Collapsible",[nvi,k5s]=Frn(Ywt),[ovi,Qwt]=nvi(Ywt),Zrn=by.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=krn({prop:n,defaultProp:o,onChange:a});return(0,b6.jsx)(ovi,{scope:r,disabled:i,contentId:Xrn(),open:u,onOpenToggle:by.useCallback(()=>l(c=>!c),[l]),children:(0,b6.jsx)(Cqe.div,{"data-state":nSt(u),"data-disabled":i?"":void 0,...s,ref:e})})});Zrn.displayName=Ywt;var Yrn="CollapsibleTrigger",eSt=by.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=Qwt(Yrn,r);return(0,b6.jsx)(Cqe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":nSt(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:$rn(t.onClick,o.onOpenToggle)})});eSt.displayName=Yrn;var tSt="CollapsibleContent",rSt=by.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=Qwt(tSt,t.__scopeCollapsible);return(0,b6.jsx)(Zwt,{present:r||o.open,children:({present:i})=>(0,b6.jsx)(ivi,{...n,ref:e,present:i})})});rSt.displayName=tSt;var ivi=by.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=Qwt(tSt,r),[s,u]=by.useState(n),l=by.useRef(null),c=zrn(e,l),d=by.useRef(0),f=d.current,p=by.useRef(0),m=p.current,h=a.open||s,y=by.useRef(h),g=by.useRef(void 0);return by.useEffect(()=>{let b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),y6(()=>{let b=l.current;if(b){g.current=g.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";let _=b.getBoundingClientRect();d.current=_.height,p.current=_.width,y.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),u(n)}},[a.open,n]),(0,b6.jsx)(Cqe.div,{"data-state":nSt(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 nSt(t){return t?"open":"closed"}var Qrn=Zrn;var _y=Qrn,BT=eSt,vy=rSt;$r();Or();var al=$(J()),svi="shimmer 2s ease-in-out infinite",qfe=5e3,uvi=(t,e)=>{if(!e)return null;if(e.length>qfe)return`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`;try{let r=P$.format(t,e);return r.length>qfe?r.slice(0,qfe)+`
|
||
|
||
\u2026 (truncated ${(r.length-qfe).toLocaleString()} characters for display)`:r}catch{return e.length>qfe?`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`:e}},enn=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,al.useState)(!1),c=(0,al.useMemo)(()=>uvi(t,o),[t,o]),d=n&&!o,f=!d&&c!==null;return al.default.createElement(_y,{open:f?u:!1,onOpenChange:l,disabled:!f,"aria-disabled":!f,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},al.default.createElement("div",{className:we("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",d&&"tw-relative tw-overflow-hidden")},d&&al.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},al.default.createElement("div",{className:"tw-absolute tw-inset-0 -tw-translate-x-full",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%)",animation:svi}})),al.default.createElement(BT,{className:we("tw-flex tw-w-full tw-items-center tw-justify-between tw-px-3 tw-py-2.5 tw-text-sm sm:tw-px-4 sm:tw-py-3",f&&"hover:tw-bg-secondary/70",!f&&"tw-cursor-default")},al.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},al.default.createElement("span",{className:"tw-text-base"},r),al.default.createElement("span",{className:"tw-font-medium"},t==="readNote"?`${d?"Reading":"Read"} ${e}`:`${d?"Calling":"Called"} ${e}`,d&&t!=="readNote"&&"..."),d&&i&&al.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),al.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!d&&a&&s&&al.default.createElement(al.default.Fragment,null,al.default.createElement("button",{onClick:p=>{p.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},al.default.createElement(Yu,{className:"tw-size-4 tw-text-success"})),al.default.createElement("button",{onClick:p=>{p.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},al.default.createElement(qo,{className:"tw-size-4 tw-text-error"}))),f&&al.default.createElement(ld,{className:we("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),al.default.createElement(vy,null,al.default.createElement("div",{className:"tw-border-t tw-border-border tw-px-3 tw-py-2.5 sm:tw-px-4 sm:tw-py-3"},al.default.createElement("div",{className:"tw-text-sm tw-text-muted"},al.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},c??"No result available"))))))};Xe();var tnn=60*60*1e3,GY=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),XY=()=>(window.__copilotErrorBlocks||(window.__copilotErrorBlocks=new Map),window.__copilotErrorBlocks),aSt=(t,e,r)=>{if(e.size>0)return;r.get(t)===e&&r.delete(t)},sSt=(t,e,r,n,o,i)=>{try{n.root.unmount()}catch(a){Te(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,e.get(r)===n&&e.delete(r),aSt(t,e,i)},rnn=(t,e,r,n,o,i)=>{e.delete(r),n.isUnmounting=!0,setTimeout(()=>{try{n.root.unmount()}catch(a){Te(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,aSt(t,e,i)},0)},mz=(t,e,r,n,o,i)=>{n.isUnmounting||(n.isUnmounting=!0,setTimeout(()=>{let a=i.get(t),s=a?.get(r);if(!a||s!==n){n.isUnmounting=!1,aSt(t,e,i);return}sSt(t,a,r,s,o,i)},0))},nnn=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(sSt(t,e,r,i,`${o} (finalizing stale root)`,GY()),i=void 0),i&&i.container&&i.container!==n&&(rnn(t,e,r,i,`${o} (container changed)`,GY()),i=void 0),i||(i={root:(0,iSt.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},onn=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(sSt(t,e,r,i,`${o} (finalizing stale error root)`,XY()),i=void 0),i&&i.container&&i.container!==n&&(rnn(t,e,r,i,`${o} (container changed)`,XY()),i=void 0),i||(i={root:(0,iSt.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},inn=(t,e)=>{t.root.render(oSt.default.createElement(enn,{toolName:e.toolName,displayName:e.displayName,emoji:e.emoji,isExecuting:e.isExecuting,result:e.result||null,confirmationMessage:e.confirmationMessage}))},ann=(t,e)=>{t.root.render(oSt.default.createElement(jrn,{errorContent:e.errorContent}))},snn=(t,e,r,n)=>{let o=e.get(r);o&&mz(t,e,r,o,n,GY())},unn=(t,e,r,n)=>{let o=e.get(r);o&&mz(t,e,r,o,n,XY())},lnn=t=>{let e=GY(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},cnn=t=>{let e=XY(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},dnn=(t=Date.now())=>{let e=GY();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;mz(n,r,i,o,"stale cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<tnn||mz(n,r,i,o,"stale cleanup (legacy record)",e)})})},fnn=(t=Date.now())=>{let e=XY();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;mz(n,r,i,o,"stale error cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<tnn||mz(n,r,i,o,"stale error cleanup (legacy record)",e)})})},pnn=(t,e,r)=>{let n=GY();e.forEach((o,i)=>{mz(t,e,i,o,r,n)})},mnn=(t,e,r)=>{let n=XY();e.forEach((o,i)=>{mz(t,e,i,o,r,n)})};$r();Or();var bg=$(J()),lvi=t=>{if(t<60)return`${t}s`;let e=Math.floor(t/60),r=t%60;return`${e}m ${r}s`},cvi=()=>{let t=[{row:0,col:0,animIndex:2},{row:0,col:1,animIndex:1},{row:0,col:2,animIndex:0},{row:1,col:1,animIndex:3},{row:2,col:0,animIndex:4},{row:2,col:1,animIndex:5},{row:2,col:2,animIndex:6}],e=2.5,r=3,n=e*3+r*2;return bg.default.createElement("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:"copilot-spinner"},t.map((o,i)=>{let a=o.col*(e+r)+e/2,s=o.row*(e+r)+e/2;return bg.default.createElement("circle",{key:i,cx:a,cy:s,r:e/2,className:`copilot-spinner-dot copilot-spinner-dot-${o.animIndex}`})}))},hnn=({status:t,elapsedSeconds:e,steps:r,isStreaming:n})=>{let[o,i]=(0,bg.useState)(t==="reasoning");if((0,bg.useEffect)(()=>{t==="reasoning"?i(!0):(t==="collapsed"||t==="complete")&&i(!1)},[t]),t==="idle")return null;let a=t==="reasoning",s=!a&&r.length>0;return bg.default.createElement(_y,{open:s?o:a,onOpenChange:s?i:void 0,disabled:!s,className:"agent-reasoning-block"},bg.default.createElement(BT,{asChild:!0,disabled:!s},bg.default.createElement("div",{className:we("agent-reasoning-header",s&&"tw-cursor-pointer",!s&&"tw-cursor-default")},bg.default.createElement("span",{className:"agent-reasoning-icon"},a?bg.default.createElement(cvi,null):bg.default.createElement(ld,{className:we("tw-size-3 tw-text-muted tw-transition-transform",o&&"tw-rotate-90")})),bg.default.createElement("span",{className:"agent-reasoning-title"},a?"Reasoning":"Thought for"),bg.default.createElement("span",{className:"agent-reasoning-timer"},lvi(e)))),bg.default.createElement(vy,null,r.length>0&&bg.default.createElement("ul",{className:"agent-reasoning-steps"},r.map((u,l)=>bg.default.createElement("li",{key:l,className:"agent-reasoning-step"},u)))))};mr();$r();dst();Bt();var _6=require("obsidian"),ur=$(J());Ye();var Oqe="copilot-collapsible",dvi=()=>(window.__copilotCollapsibleStates||(window.__copilotCollapsibleStates=new Map),window.__copilotCollapsibleStates),gnn=t=>{let e=dvi(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},uSt=(t,e)=>{let r=t.replace(/[^a-zA-Z0-9_-]/g,"_");return`${Oqe}-${r}-${e}`},ynn=(t,e,r={})=>{let n=r.overwriteExisting??!0;t.querySelectorAll(`details[id^="${Oqe}-"]`).forEach(i=>{let a=i.id;a&&(!n&&e.has(a)||e.set(a,i.open))})},Eqe=(t,e)=>{let r=typeof t.composedPath=="function"?t.composedPath():[];for(let i of r)if(i instanceof HTMLElement&&i.tagName==="DETAILS"){let a=i;if(a.id.startsWith(`${Oqe}-`)&&e.contains(a))return a}let n=t.target;if(!(n instanceof Element))return null;let o=n.closest(`details[id^="${Oqe}-"]`);return o instanceof HTMLElement&&o.tagName==="DETAILS"&&e.contains(o)?o:null},lSt=(t,e)=>{let r=e.querySelector("summary");if(!r)return!1;let n=t.target;return n instanceof Node?r.contains(n):(typeof t.composedPath=="function"?t.composedPath():[]).includes(r)};var fvi=/^\d+-\d+$/,pvi=t=>{let e=t.querySelector(".footnotes");e?(e.querySelectorAll("hr, hr.footnotes-sep").forEach(r=>r.remove()),e.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove())):t.querySelectorAll("a.footnote-backref, a.footnote-link.footnote-backref").forEach(r=>r.remove()),t.querySelectorAll('a.footnote-ref, sup a[href^="#fn"], sup a[href^="#fn-"], a[href^="#fn"], a[href^="#fn-"]').forEach(r=>{let n=r.textContent?.trim()??"";if(!n||!fvi.test(n))return;let[o]=n.split("-");o&&o!==n&&(r.textContent=o)})};function mvi({context:t}){return!t||!t.notes?.length&&!t.urls?.length&&!t.webTabs?.length&&!t.tags?.length&&!t.folders?.length&&!t.selectedTextContexts?.length?null:ur.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>ur.default.createElement(yn,{key:`note-${r}-${e.path}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(Cke,{note:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e.path))),t.urls.map((e,r)=>ur.default.createElement(yn,{key:`url-${r}-${e}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(xke,{url:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e))),t.webTabs?.map((e,r)=>ur.default.createElement(yn,{key:`webTab-${r}-${e.url}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(Tke,{webTab:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e.title?ur.default.createElement("div",{className:"tw-text-left"},ur.default.createElement("div",{className:"tw-font-medium"},e.title),ur.default.createElement("div",null,e.url)):e.url))),t.tags?.map((e,r)=>ur.default.createElement(yn,{key:`tag-${r}-${e}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(nen,{tag:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e))),t.folders?.map((e,r)=>ur.default.createElement(yn,{key:`folder-${r}-${e}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(Oke,{folder:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e))),t.selectedTextContexts?.map((e,r)=>ur.default.createElement(yn,{key:`selectedText-${r}-${e.id}`},ur.default.createElement(bn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(oen,{selectedText:e}))),ur.default.createElement(dn,{className:"tw-max-w-sm tw-break-words"},e.sourceType==="web"?e.url:e.notePath))))}var hvi=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,ur.useState)(!1),[u,l]=(0,ur.useState)(!1),[c,d]=(0,ur.useState)(null),f=(0,ur.useRef)(null),p=(0,ur.useRef)(null),m=(0,ur.useRef)(!1),h=(0,ur.useRef)(t.id||(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`)),y=(0,ur.useRef)(lnn(h.current)),g=(0,ur.useRef)(cnn(h.current)),_=(0,ur.useRef)(gnn(h.current)).current,w=Br(),T=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let V=f1(t.message);navigator.clipboard.writeText(V).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},O=(0,ur.useCallback)(V=>{let k=e.workspace.getActiveFile(),X=k?k.path:"",B=Z=>(Z=Z.replace(/```dataview(\s*(?:\n|$))/g,"```text$1"),Z=Z.replace(/```dataviewjs(\s*(?:\n|$))/g,"```javascript$1"),Z),Q=Z=>(Z=Z.replace(/```tasks(\s*(?:\n|$))/g,"```text$1"),Z),Y=(Z,le,Ce,He)=>{let lt="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",qe="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",Nt="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",mt=`<${le}>`,Ot=0;if(r&&Z.includes(mt)){let Gr=new RegExp(`<${le}>([\\s\\S]*?)<\\/${le}>`,"g");Z=Z.replace(Gr,(ze,ht)=>{let $e=`${le}-${Ot}`;Ot+=1;let Ue=uSt(h.current,$e),Ve=_.get(Ue)?" open":"";return`<details id="${Ue}"${Ve} style="${lt}">
|
||
<summary style="${qe}">${Ce}</summary>
|
||
<div class="tw-text-muted" style="${Nt}">${ht.trim()}</div>
|
||
</details>
|
||
|
||
`});let ct=new RegExp(`<${le}>([\\s\\S]*)$`);return Z=Z.replace(ct,(ze,ht)=>`<div style="${lt}">
|
||
<div style="${qe}">${He}</div>
|
||
<div class="tw-text-muted" style="${Nt}">${ht.trim()}</div>
|
||
</div>`),Z}let je=new RegExp(`<${le}>([\\s\\S]*?)<\\/${le}>`,"g");return Z.replace(je,(Gr,ct)=>{let ze=`${le}-${Ot}`;Ot+=1;let ht=uSt(h.current,ze),$e=_.get(ht)?" open":"";return`<details id="${ht}"${$e} style="${lt}">
|
||
<summary style="${qe}">${Ce}</summary>
|
||
<div class="tw-text-muted" style="${Nt}">${ct.trim()}</div>
|
||
</details>
|
||
|
||
`})},K=Z=>Y(Z,"think","Thought for a while","Thinking..."),oe=Z=>{let le=lt=>{let qe=/```(?:xml)?\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return lt.replace(qe,(Nt,mt)=>mt.trim())},Ce=lt=>{if(!r)return lt;let qe=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return lt.replace(qe,(Nt,mt)=>mt.trim())},He=le(Z);return He=Ce(He),Y(He,"writeToFile","Generated new content","Generating changes...")},ue=(Z,le,Ce)=>Z.split(/(```[\s\S]*?```|`[^`]*`)/g).map((lt,qe)=>qe%2===0?lt.replace(le,(Nt,mt)=>{let Ot=e.metadataCache.getFirstLinkpathDest(mt,X);return Ot?Ce(Ot):Nt}):lt).join(""),de=B(V),W=Q(de).replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),ie=ue(W,/!\[\[(.*?)]]/g,Z=>`})`),j=K(ie),A=oe(j),U=G4r(A,w.enableInlineCitations),H=ue(U,/(?<!!)\[\[([^\]]+)]]/g,Z=>`<a href="obsidian://open?file=${encodeURIComponent(Z.path)}">${Z.basename}</a>`);return(Z=>{if(!r)return Z;let le=/!\[([^\]]*)\]\(([^)]+)\)/g;return Z.replace(le,(Ce,He,lt)=>{let qe=yWe(lt);if(!qe)return Ce;let Nt=He||"YouTube Video",mt=`https://i.ytimg.com/vi/${qe}/hqdefault.jpg`;return`[](${lt})`})})(H)},[e,r,w.enableInlineCitations,_]);(0,ur.useEffect)(()=>{let V=f.current;if(!V||t.sender===Zs||!r)return;let k=Q=>{if(Q instanceof PointerEvent&&(Q.button!==0||!Q.isPrimary))return;let Y=Eqe(Q,V);if(!Y||!lSt(Q,Y))return;let K=!Y.open;Y.open=K,_.set(Y.id,K)},X=Q=>{let Y=Eqe(Q,V);!Y||!lSt(Q,Y)||Q.preventDefault()},B=Q=>{let Y=Eqe(Q,V);Y&&_.set(Y.id,Y.open)};return V.addEventListener("pointerdown",k,!0),V.addEventListener("click",X,!0),V.addEventListener("toggle",B,!0),()=>{V.removeEventListener("pointerdown",k,!0),V.removeEventListener("click",X,!0),V.removeEventListener("toggle",B,!0)}},[r,t.sender,_]),(0,ur.useEffect)(()=>{if(m.current=!1,f.current&&t.sender!==Zs){p.current||(p.current=new _6.Component),ynn(f.current,_,{overwriteExisting:!r});let V=t.message,k=Bce(V);k?.hasReasoning&&k.status!=="idle"?d({status:k.status,elapsedSeconds:k.elapsedSeconds,steps:k.steps}):d(null);let X=k?.contentAfter??V,B=O(X),Q=cst(B,h.current);if(!m.current){let Y=new Set,K=new Set;f.current.querySelectorAll('[id^="tool-call-"]').forEach(j=>{let A=j.id.replace("tool-call-","");Y.add(A)}),f.current.querySelectorAll('[id^="error-block-"]').forEach(j=>{let A=j.id.replace("error-block-","");K.add(A)}),f.current.querySelectorAll(".message-segment").forEach(j=>j.remove());let L=0;Q.segments.forEach(j=>{if(j.type==="text"&&j.content.trim()){let A=f.current.children[L],U=document.createElement("div");U.className="message-segment",A?f.current.insertBefore(U,A):f.current.appendChild(U),_6.MarkdownRenderer.renderMarkdown(j.content,U,"",p.current),pvi(U),L++}else if(j.type==="toolCall"&&j.toolCall){let A=j.toolCall.id,U=document.getElementById(`tool-call-${A}`);if(!U){let re=f.current.children[L],Z=document.createElement("div");Z.className="tool-call-container",Z.id=`tool-call-${A}`,re?f.current.insertBefore(Z,re):f.current.appendChild(Z),U=Z}let H=nnn(h.current,y.current,A,U,"render refresh");!m.current&&!H.isUnmounting&&inn(H,j.toolCall),L++}else if(j.type==="error"&&j.error){let A=j.error.id,U=document.getElementById(`error-block-${A}`);if(!U){let re=f.current.children[L],Z=document.createElement("div");Z.className="error-block-container",Z.id=`error-block-${A}`,re?f.current.insertBefore(Z,re):f.current.appendChild(Z),U=Z}let H=onn(h.current,g.current,A,U,"error render");!m.current&&!H.isUnmounting&&ann(H,j.error),L++}});let W=new Set(Q.segments.filter(j=>j.type==="toolCall"&&j.toolCall).map(j=>j.toolCall.id));Y.forEach(j=>{if(!W.has(j)){let A=document.getElementById(`tool-call-${j}`);A&&(snn(h.current,y.current,j,"tool call removal"),A.remove())}});let ie=new Set(Q.segments.filter(j=>j.type==="error"&&j.error).map(j=>j.error.id));K.forEach(j=>{if(!ie.has(j)){let A=document.getElementById(`error-block-${j}`);A&&(unn(h.current,g.current,j,"error block removal"),A.remove())}})}}return()=>{m.current=!0}},[t,e,p,r,O,_]),(0,ur.useEffect)(()=>{let V=p,k=h.current,X=y.current,B=g.current;return(()=>{dnn(),fnn()})(),()=>{m.current=!0,setTimeout(()=>{V.current&&(V.current.unload(),V.current=null),k.startsWith("temp-")&&(pnn(k,X,"component cleanup"),mnn(k,B,"component cleanup"))},0)}},[]);let E=()=>{l(!0)},P=()=>{l(!1)},R=V=>{l(!1),o&&o(V)},I=()=>{t.sources&&t.sources.length>0&&new vqe(e,t.sources).open()},N=()=>{let V=e.workspace.getMostRecentLeaf();if((!V||!(V.view instanceof _6.MarkdownView))&&(V=e.workspace.getLeaf(!1),!V||!(V.view instanceof _6.MarkdownView)))return;let X=V.view.editor.getSelection().length>0;KJ(t.message,X)},z=()=>t.content?ur.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((V,k)=>V.type==="text"?ur.default.createElement("div",{key:k},t.sender===Zs?ur.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):ur.default.createElement("div",{ref:f,className:t.isErrorMessage?"tw-text-error":""})):V.type==="image_url"?ur.default.createElement("div",{key:k,className:"message-image-content"},ur.default.createElement("img",{src:V.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Zs?ur.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):ur.default.createElement("div",{ref:f,className:t.isErrorMessage?"tw-text-error":""});return u&&t.sender===Zs?ur.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},ur.default.createElement(Irn,{initialValue:t.message,initialContext:t.context,onSave:R,onCancel:P,app:e})):ur.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},ur.default.createElement("div",{className:we("tw-group tw-mx-2 tw-rounded-md tw-p-2",t.sender===Zs&&"tw-border tw-border-solid tw-border-border"),style:t.sender===Zs?{backgroundColor:"var(--background-modifier-hover)"}:void 0},ur.default.createElement("div",{className:"tw-flex tw-max-w-full tw-flex-col tw-gap-2 tw-overflow-hidden"},!u&&ur.default.createElement(mvi,{context:t.context}),c&&t.sender!==Zs&&ur.default.createElement(hnn,{status:c.status,elapsedSeconds:c.elapsedSeconds,steps:c.steps,isStreaming:r}),ur.default.createElement("div",{className:"message-content"},z()),t.responseMetadata?.wasTruncated&&t.sender!==Zs&&ur.default.createElement(Drn,{message:t,app:e}),!r&&ur.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},ur.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),ur.default.createElement(Mrn,{message:t,onCopy:T,isCopied:a,onInsertIntoEditor:N,onRegenerate:n,onEdit:E,onDelete:i,onShowSources:I,hasSources:!!(t.sources&&t.sources.length>0)})))))},cSt=hvi;Cn();mr();var dSt=$(J()),Pqe=dSt.createContext(void 0),ZY=dSt.createContext(void 0);var YY=$(J());function fSt(){let[t,e]=(0,YY.useState)(null),r=(0,YY.useContext)(ZY);return(0,YY.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(US.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(US.ACTIVE_LEAF_CHANGE,n)}},[r]),t}$r();Xe();var QY=class extends zu{constructor(e,r,n){let o=n?`Semantic search requires building an embedding index for your vault.
|
||
|
||
Use 'Refresh Vault Index' or 'Force Reindex Vault' commands to build the index after enabling. Pick your embedding model below.`:`Disabling semantic search will fall back to index-free lexical search (less resource-intensive, could be less accurate).
|
||
|
||
Your existing index will be preserved but not used.`,i=n?"Enable Semantic Search":"Disable Semantic Search",a=n?"Enable":"Disable";super(e,r,o,i,a,"Cancel")}};Xe();BG();NOe();Nte();var bnn=require("obsidian");function _nn(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 vnn(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 bnn.TFile&&(r.push(i),r.length>=e))break}return r}FEe();Pl();Ye();Fc();var pSt=require("obsidian"),Rqe=20,wnn=.7,Mqe=.3;function gvi(){let t=te();return t.enableMiyo&&t.enableSemanticSearchV3&&yH()}function yvi(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}function Cnn(t){if(t.size<=Rqe)return t;let e=Array.from(t.entries()).sort((r,n)=>n[1]-r[1]).slice(0,Rqe);return new Map(e)}function bvi(t){return Array.isArray(t.embedding)&&t.embedding.length>0}function _vi(t){return t.some(e=>e.content.trim().length>0)}async function vvi({db:t,filePath:e,currentNoteEmbeddings:r}){let n=r.map(s=>wq.getDocsByEmbedding(t,s,{limit:Rqe,similarity:0})),i=(await Promise.all(n)).flat(),a=yvi(i,e);return Cnn(a)}async function Snn(t){try{let e=te(),r=new S0,n=await r.resolveBaseUrl(e.selfHostUrl),o=zG(app),i=await r.searchRelated(n,t,{sourceId:o,limit:Rqe}),a=new Map,s=i.results||[];for(let u of s){if(u.path===t||typeof u.score!="number"||Number.isNaN(u.score))continue;let l=a.get(u.path);(l===void 0||u.score>l)&&a.set(u.path,u.score)}return te().debug&&F(`RelevantNotes(Miyo): received ${s.length} chunks, collected ${a.size} note scores`),Cnn(a)}catch(e){return Te("RelevantNotes(Miyo): failed to compute similarity scores",e),new Map}}async function wvi(t){if(gvi())return Snn(t);let e=await O0.getInstance().getDocumentsByPath(t);if(e.length===0)return new Map;let r=e.filter(n=>bvi(n)).map(n=>n.embedding);if(r.length>0)try{let n=await O0.getInstance().getDb();return vvi({db:n,filePath:t,currentNoteEmbeddings:r})}catch(n){return Te("RelevantNotes(Orama): failed to compute similarity scores",n),new Map}return _vi(e)?Snn(t):new Map}function Svi(t){let e=new Map,n=_nn(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=vnn(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 Cvi(t,e){let r=new Map,n=wnn+Mqe;for(let[o,i]of t)r.set(o,i*wnn/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=Mqe:(i.links||i.backlinks)&&(a=Mqe*.8),r.set(o,(r.get(o)??0)+a)}return r}async function xnn({filePath:t}){let e=app.vault.getAbstractFileByPath(t);if(!(e instanceof pSt.TFile))return[];let r=await wvi(t),n=Svi(e),o=Cvi(r,n);return Array.from(o.entries()).sort((a,s)=>{let u=a[0],l=s[0],c=Iqe(r.get(u)??0),d=Iqe(r.get(l)??0);return c!==d?d-c:s[1]-a[1]}).map(([a,s])=>{let u=app.vault.getAbstractFileByPath(a);return!(u instanceof pSt.TFile)||u.extension!=="md"?null:{document:{path:a,title:u.basename},metadata:{score:s,similarityScore:r.get(a),hasOutgoingLinks:n.get(a)?.links??!1,hasBacklinks:n.get(a)?.backlinks??!1}}}).filter(a=>a!==null)}function Iqe(t){return t>.7?3:t>.55?2:1}Bat();Or();var Ufe=require("obsidian"),At=$(J()),xvi=15*24*60*60*1e3;function Tvi(t){return!t.enableMiyo||!t.enableSemanticSearchV3||t.selfHostModeValidatedAt==null?!1:(t.selfHostValidationCount??0)>=3?!0:Date.now()-t.selfHostModeValidatedAt<xvi}function Ovi(t){let[e,r]=(0,At.useState)([]),[n,o]=(0,At.useState)(0),i=fSt();return(0,At.useEffect)(()=>Uat(()=>o(a=>a+1)),[]),(0,At.useEffect)(()=>{async function a(){if(i?.path)try{let s=await xnn({filePath:i.path});r(s)}catch(s){Te("Failed to fetch relevant notes",s),r([])}}a()},[i?.path,t,n]),e}function Evi(t,e){let[r,n]=(0,At.useState)(!0),[o,i]=(0,At.useState)(0);return(0,At.useEffect)(()=>Uat(()=>i(a=>a+1)),[]),(0,At.useEffect)(()=>{if(!t)return;async function a(){try{let s=(await Promise.resolve().then(()=>(Pl(),Vc))).default,{getSettings:u}=await Promise.resolve().then(()=>(Ye(),x4)),l=u();if(Tvi(l)){let f=await s.getInstance().isIndexEmpty();n(!f);return}let d=await s.getInstance().hasIndex(t);n(d)}catch{n(!1)}}a()},[t,e,o]),r}function Pvi({score:t}){let e=Iqe(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),At.default.createElement("span",{className:"tw-text-sm"},r)}function Mvi({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,At.useState)(!1),[i,a]=(0,At.useState)(null),s=(0,At.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof Ufe.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,At.useEffect)(()=>{n&&s()},[n,s]),At.default.createElement(_y,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},At.default.createElement("div",{className:we("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},At.default.createElement(pe,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},At.default.createElement(BT,null,At.default.createElement(ld,{className:we("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),At.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},At.default.createElement(Pvi,{score:t.metadata.similarityScore??0})),At.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},At.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal",title:t.document.title},t.document.title)),At.default.createElement(yn,null,At.default.createElement(bn,{asChild:!0},At.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},At.default.createElement(_w,{className:"tw-size-4"}))),At.default.createElement(dn,null,"Add to Chat"))),At.default.createElement(vy,null,At.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},At.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&&At.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)),At.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&&At.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},At.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&At.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},At.default.createElement(Zre,{className:"tw-size-4"}),At.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&At.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},At.default.createElement(Xre,{className:"tw-size-4"}),At.default.createElement("span",null,"Backlinks")))))}function Rvi({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return At.default.createElement(IB,{key:t.document.path},At.default.createElement(AB,{asChild:!0},n),At.default.createElement(eL,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},At.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),At.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),At.default.createElement("div",{className:"tw-flex tw-gap-2"},At.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 ",At.default.createElement(_w,{className:"tw-size-4"})),At.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 ",At.default.createElement(Fre,{className:"tw-size-4"})))))}var Aqe=(0,At.memo)(({className:t,defaultOpen:e=!1})=>{let[r,n]=(0,At.useState)(0),[o,i]=(0,At.useState)(e),a=Ovi(r),s=fSt(),u=fz(),l=Evi(s?.path??"",r),c=(m,h=!1)=>{let y=app.vault.getAbstractFileByPath(m);y instanceof Ufe.TFile&&app.workspace.getLeaf(h).openFile(y)},d=m=>{u.insertTextWithPills(`[[${m}]]`,!0)},f=async()=>{s&&(await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().reindexFile(s),new Ufe.Notice(`Refreshed index for ${s.basename}`),n(r+1))},p=async()=>{let{getSettings:m,updateSetting:h}=await Promise.resolve().then(()=>(Ye(),x4));m().enableSemanticSearchV3?(await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0}),n(r+1)):new QY(app,async()=>{h("enableSemanticSearchV3",!0),await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0}),n(r+1)},!0).open()};return At.default.createElement("div",{className:we("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},At.default.createElement(_y,{open:o,onOpenChange:i},At.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},At.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},At.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),At.default.createElement(to,{content:"Relevance is a combination of semantic similarity and links. Requires semantic search setting on.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),At.default.createElement("div",{className:"tw-flex tw-items-center"},l?At.default.createElement(yn,null,At.default.createElement(bn,{asChild:!0},At.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:f},At.default.createElement(ane,{className:"tw-size-4"}))),At.default.createElement(dn,{side:"bottom"},"Reindex Current Note")):At.default.createElement(pe,{variant:"secondary",size:"sm",onClick:p},"Build Index"),a.length>0&&At.default.createElement(BT,{asChild:!0},At.default.createElement(pe,{variant:"ghost2",size:"icon"},o?At.default.createElement(jg,{className:"tw-size-5"}):At.default.createElement(Wi,{className:"tw-size-5"}))))),a.length===0&&l&&At.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-items-center tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},At.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"No relevant notes found")),!o&&a.length>0&&At.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"},a.map(m=>At.default.createElement(Rvi,{key:m.document.path,note:m,onAddToChat:()=>d(m.document.title),onNavigateToNote:h=>c(m.document.path,h)},At.default.createElement(Qc,{variant:"outline",key:m.document.path,className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover"},At.default.createElement("span",{className:"tw-truncate"},m.document.title))))),At.default.createElement(vy,null,At.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"},a.map(m=>At.default.createElement(Mvi,{note:m,key:m.document.path,onAddToChat:()=>d(m.document.title),onNavigateToNote:h=>c(m.document.path,h)}))))))});Aqe.displayName="RelevantNotes";ra();sd();Cn();var Jv=$(J());$r();var OL=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));OL.displayName="Card";var EL=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));EL.displayName="CardHeader";var v6=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));v6.displayName="CardTitle";var Ivi=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-text-sm tw-text-muted",t),...e}));Ivi.displayName="CardDescription";var PL=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-p-6 tw-pt-0",t),...e}));PL.displayName="CardContent";var Avi=Jv.forwardRef(({className:t,...e},r)=>Jv.createElement("div",{ref:r,className:we("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));Avi.displayName="CardFooter";mr();Ye();Or();var sl=$(J());var mSt={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","Summarize <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>]]"]}},Tnn={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function Nvi(t="llm_chain"){let e=Tnn[t]||Tnn.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...mSt[n].prompts].sort(()=>Math.random()-.5)),{title:mSt[n].title,text:r[n].pop()||mSt[n].prompts[0]}))}var Onn=({onClick:t})=>{let[e]=fw(),r=(0,sl.useMemo)(()=>Nvi(e),[e]),o=Br().indexVaultToVectorStore;return sl.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},sl.default.createElement(OL,{className:"tw-w-full tw-bg-transparent"},sl.default.createElement(EL,{className:"tw-px-2"},sl.default.createElement(v6,null,"Suggested Prompts")),sl.default.createElement(PL,{className:"tw-p-2 tw-pt-0"},sl.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>sl.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"},sl.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},sl.default.createElement("div",{className:"tw-text-muted"},i.title),sl.default.createElement("div",null,i.text)),sl.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},sl.default.createElement(yn,null,sl.default.createElement(bn,{asChild:!0},sl.default.createElement(pe,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},sl.default.createElement(_w,{className:"tw-size-4"}))),sl.default.createElement(dn,null,"Add to Chat")))))))),e==="vault_qa"&&sl.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"&&sl.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},sl.default.createElement("div",null,sl.default.createElement(Lg,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",sl.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",sl.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",sl.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};mr();mr();var S_=$(J()),Enn=({chatHistory:t})=>{let[e,r]=(0,S_.useState)(0),n=(0,S_.useRef)(null),o=(0,S_.useRef)(null),i=(0,S_.useCallback)((l,c)=>`message-${l.id||l.timestamp?.epoch||c}`,[]),a=(0,S_.useCallback)(()=>{if(!n.current)return 0;let l=n.current,c=l.clientHeight,d=t.map((m,h)=>({msg:m,idx:h})).filter(({msg:m})=>m.isVisible&&m.sender===Zs).pop()?.idx,f=0;if(d!==void 0){let m=i(t[d],d),h=l.querySelector(`[data-message-key="${m}"]`);if(h)f=h.getBoundingClientRect().height;else{let y=t[d].message.length,g=Math.ceil(y/80);f=Math.max(60,g*24)}}return Math.max(100,c-f)},[t,i]),s=(0,S_.useCallback)(l=>{if(l!==n.current&&(o.current&&(o.current.disconnect(),o.current=null),n.current=l,l)){let c=a();r(c);let d=new ResizeObserver(()=>{if(n.current){let f=a();r(f)}});d.observe(l),o.current=d}},[a]);(0,S_.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,S_.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,S_.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,S_.useEffect)(()=>{u("instant")},[u]),(0,S_.useEffect)(()=>{if(t.length>0){let l=t[t.length-1];l&&l.sender===Zs&&u()}},[t.length,t,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};Ye();var wy=$(J()),Pnn=(0,wy.memo)(({chatHistory:t,currentAiMessage:e,streamingMessageId:r,loading:n,loadingMessage:o,app:i,onRegenerate:a,onEdit:s,onDelete:u,onReplaceChat:l,showHelperComponents:c=!0})=>{let[d,f]=(0,wy.useState)(""),p=Br(),{containerMinHeight:m,scrollContainerCallbackRef:h,getMessageKey:y}=Enn({chatHistory:t});if((0,wy.useEffect)(()=>{let b;return n?b=setInterval(()=>{f(_=>_.length<6?_+".":"")},200):f(""),()=>clearInterval(b)},[n]),!t.filter(b=>b.isVisible).length&&!e)return wy.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&wy.default.createElement(Aqe,{defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&wy.default.createElement(Onn,{onClick:l}));let g=()=>o?`${o} ${d}`:d;return wy.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&wy.default.createElement(Aqe,{className:"tw-mb-4",defaultOpen:!1,key:"relevant-notes-in-chat"}),wy.default.createElement("div",{ref:h,"data-testid":"chat-messages",className:"tw-relative tw-flex tw-w-full tw-flex-1 tw-select-text tw-flex-col tw-items-start tw-justify-start tw-overflow-y-auto tw-scroll-smooth tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)]"},t.map((b,_)=>{let w=t.filter(E=>E.isVisible),O=_===w.length-1&&b.sender!==Zs;return b.isVisible&&wy.default.createElement("div",{key:y(b,_),"data-message-key":y(b,_),className:"tw-w-full",style:{minHeight:O?`${m}px`:"auto"}},wy.default.createElement(cSt,{message:b,app:i,isStreaming:!1,onRegenerate:()=>a(_),onEdit:E=>s(_,E),onDelete:()=>u(_)}))}),(e||n)&&wy.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${m}px`}},wy.default.createElement(cSt,{key:r??"ai_message_streaming",message:{id:r??void 0,sender:"AI",message:e||g(),isVisible:!0,timestamp:null},app:i,isStreaming:!0,onDelete:()=>{}}))))});Pnn.displayName="ChatMessages";var Mnn=Pnn;Cn();Bt();var Nqe=$(J());function Dqe(t){let[e,r]=(0,Nqe.useState)(null);(0,Nqe.useEffect)(()=>{(async()=>{let i=await I1t();i.version&&r(i.version)})()},[]);let n=e!==null&&bye(e,t);return{latestVersion:e,hasUpdate:n}}$r();Ye();Bt();Or();var MC=$(J());function Rnn({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=Dqe(t),n=Br().lastDismissedVersion,[o,i]=(0,MC.useState)(!0),a=r&&e&&bye(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{Re("lastDismissedVersion",e)},300))};return a?MC.default.createElement("div",{className:we("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")},MC.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"},MC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},MC.default.createElement("span",{className:"tw-font-medium"},"Update available:"),MC.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),MC.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},MC.default.createElement(pe,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),MC.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:s},MC.default.createElement(qo,{className:"tw-size-4"}))))):null}ra();ra();ra();var Inn=require("obsidian");ob();var eQ=class extends Inn.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=Git(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 hSt=require("obsidian");var jqe=require("obsidian");Bt();sd();var tQ=class extends jqe.FuzzySuggestModal{constructor(e,r="copilot_plus"){super(e),this.activeNote=e.workspace.getActiveFile(),this.chainType=r}getOrderedNotes(e=[]){let r=this.app.workspace.getLastOpenFiles().map(a=>this.app.vault.getAbstractFileByPath(a)).filter(a=>a instanceof jqe.TFile&&JJ(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>JJ(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&JJ(this.activeNote,this.chainType)?[this.activeNote]:[],...r,...o]}formatNoteTitle(e,r,n){let o=e;return r&&(o+=" (current)"),n==="pdf"?o+=" (PDF)":n==="canvas"&&(o+=" (Canvas)"),o}};var Bfe=class extends tQ{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 hSt.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 hSt.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}};Bt();var Ann=require("obsidian"),rQ=class extends Ann.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)gO(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};Cn();var Jfe=$(J());Or();var Unn=$(J(),1),xr=$(J(),1),qqe=(0,xr.createContext)(null);qqe.displayName="PanelGroupContext";var td={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"},SSt=10,S6=xr.useLayoutEffect,Nnn=Unn.useId,Dvi=typeof Nnn=="function"?Nnn:()=>null,jvi=0;function CSt(t=null){let e=Dvi(),r=(0,xr.useRef)(t||e||null);return r.current===null&&(r.current=""+jvi++),t??r.current}function Bnn({children:t,className:e="",collapsedSize:r,collapsible:n,defaultSize:o,forwardedRef:i,id:a,maxSize:s,minSize:u,onCollapse:l,onExpand:c,onResize:d,order:f,style:p,tagName:m="div",...h}){let y=(0,xr.useContext)(qqe);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:b,getPanelSize:_,getPanelStyle:w,groupId:T,isPanelCollapsed:O,reevaluatePanelConstraints:E,registerPanel:P,resizePanel:R,unregisterPanel:I}=y,N=CSt(a),z=(0,xr.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,xr.useRef)({didLogMissingDefaultSizeWarning:!1}),S6(()=>{let{callbacks:k,constraints:X}=z.current,B={...X};z.current.id=N,z.current.idIsFromProps=a!==void 0,z.current.order=f,k.onCollapse=l,k.onExpand=c,k.onResize=d,X.collapsedSize=r,X.collapsible=n,X.defaultSize=o,X.maxSize=s,X.minSize=u,(B.collapsedSize!==X.collapsedSize||B.collapsible!==X.collapsible||B.maxSize!==X.maxSize||B.minSize!==X.minSize)&&E(z.current,B)}),S6(()=>{let k=z.current;return P(k),()=>{I(k)}},[f,N,P,I]),(0,xr.useImperativeHandle)(i,()=>({collapse:()=>{g(z.current)},expand:k=>{b(z.current,k)},getId(){return N},getSize(){return _(z.current)},isCollapsed(){return O(z.current)},isExpanded(){return!O(z.current)},resize:k=>{R(z.current,k)}}),[g,b,_,O,N,R]);let V=w(z.current,o);return(0,xr.createElement)(m,{...h,children:t,className:e,id:N,style:{...V,...p},[td.groupId]:T,[td.panel]:"",[td.panelCollapsible]:n||void 0,[td.panelId]:N,[td.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}var xSt=(0,xr.forwardRef)((t,e)=>(0,xr.createElement)(Bnn,{...t,forwardedRef:e}));Bnn.displayName="Panel";xSt.displayName="forwardRef(Panel)";var $vi;function Lvi(){return $vi}var wSt=null,Fvi=!0,Lqe=-1,ML=null;function kvi(t,e){if(e){let r=(e&Jnn)!==0,n=(e&Knn)!==0,o=(e&Gnn)!==0,i=(e&Xnn)!==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 qvi(){ML!==null&&(document.head.removeChild(ML),wSt=null,ML=null,Lqe=-1)}function gSt(t,e){var r,n;if(!Fvi)return;let o=kvi(t,e);if(wSt!==o){if(wSt=o,ML===null){ML=document.createElement("style");let a=Lvi();a&&ML.setAttribute("nonce",a),document.head.appendChild(ML)}if(Lqe>=0){var i;(i=ML.sheet)===null||i===void 0||i.removeRule(Lqe)}Lqe=(r=(n=ML.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function znn(t){return t.type==="keydown"}function Vnn(t){return t.type.startsWith("pointer")}function Hnn(t){return t.type.startsWith("mouse")}function Uqe(t){if(Vnn(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Hnn(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Uvi(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Bvi(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 zvi(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:$nn(t),b:$nn(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;vi(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:jnn(Dnn(r.a)),b:jnn(Dnn(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 Vvi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Hvi(t){var e;let r=getComputedStyle((e=Wnn(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Wvi(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Hvi(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"||Vvi.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Dnn(t){let e=t.length;for(;e--;){let r=t[e];if(vi(r,"Missing node"),Wvi(r))return r}return null}function jnn(t){return t&&Number(getComputedStyle(t).zIndex)||0}function $nn(t){let e=[];for(;t;)e.push(t),t=Wnn(t);return e}function Wnn(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var Jnn=1,Knn=2,Gnn=4,Xnn=8,Jvi=Uvi()==="coarse",zT=[],aQ=!1,hz=new Map,Bqe=new Map,Hfe=new Set;function Kvi(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=hz.get(a))!==null&&i!==void 0?i:0;return hz.set(a,u+1),Hfe.add(s),Fqe(),function(){var c;Bqe.delete(t),Hfe.delete(s);let d=(c=hz.get(a))!==null&&c!==void 0?c:1;if(hz.set(a,d-1),Fqe(),d===1&&hz.delete(a),zT.includes(s)){let f=zT.indexOf(s);f>=0&&zT.splice(f,1),OSt(),o("up",!0,null)}}}function Gvi(t){let{target:e}=t,{x:r,y:n}=Uqe(t);aQ=!0,TSt({target:e,x:r,y:n}),Fqe(),zT.length>0&&(kqe("down",t),t.preventDefault(),Znn(e)||t.stopImmediatePropagation())}function ySt(t){let{x:e,y:r}=Uqe(t);if(aQ&&t.buttons===0&&(aQ=!1,kqe("up",t)),!aQ){let{target:n}=t;TSt({target:n,x:e,y:r})}kqe("move",t),OSt(),zT.length>0&&t.preventDefault()}function bSt(t){let{target:e}=t,{x:r,y:n}=Uqe(t);Bqe.clear(),aQ=!1,zT.length>0&&(t.preventDefault(),Znn(e)||t.stopImmediatePropagation()),kqe("up",t),TSt({target:e,x:r,y:n}),OSt(),Fqe()}function Znn(t){let e=t;for(;e;){if(e.hasAttribute(td.resizeHandle))return!0;e=e.parentElement}return!1}function TSt({target:t,x:e,y:r}){zT.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Hfe.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=Jvi?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)&&zvi(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(Bvi(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}zT.push(o)}})}function _St(t,e){Bqe.set(t,e)}function OSt(){let t=!1,e=!1;zT.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;Bqe.forEach(n=>{r|=n}),t&&e?gSt("intersection",r):t?gSt("horizontal",r):e?gSt("vertical",r):qvi()}var vSt=new AbortController;function Fqe(){vSt.abort(),vSt=new AbortController;let t={capture:!0,signal:vSt.signal};Hfe.size&&(aQ?(zT.length>0&&hz.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",bSt,t),n.addEventListener("pointerleave",ySt,t),n.addEventListener("pointermove",ySt,t))}),hz.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",bSt,t),n.addEventListener("pointercancel",bSt,t)})):hz.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",Gvi,t),n.addEventListener("pointermove",ySt,t))}))}function kqe(t,e){Hfe.forEach(r=>{let{setResizeHandlerState:n}=r,o=zT.includes(r);n(t,o,e)})}function Xvi(){let[t,e]=(0,xr.useState)(0);return(0,xr.useCallback)(()=>e(r=>r+1),[])}function vi(t,e){if(!t)throw console.error(e),Error(e)}function C6(t,e,r=SSt){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function RL(t,e,r=SSt){return C6(t,e,r)===0}function mS(t,e,r){return C6(t,e,r)===0}function Zvi(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(!mS(o,i,r))return!1}return!0}function iQ({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];vi(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(C6(r,s)<0)if(i){let u=(o+s)/2;C6(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(SSt)),r}function zfe({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(mS(t,0))return e;let a=[...e],[s,u]=n;vi(s!=null,"Invalid first pivot index"),vi(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];vi(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(vi(y!=null,`Previous layout not found for panel index ${d}`),mS(y,p)){let g=h-y;C6(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];vi(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let y=e[d];if(vi(y!=null,`Previous layout not found for panel index ${d}`),mS(y,h)){let g=y-p;C6(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];vi(h!=null,`Previous layout not found for panel index ${f}`);let g=iQ({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];vi(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,y=iQ({panelConstraints:r,panelIndex:f,size:h});if(!mS(m,y)&&(l+=m-y,a[f]=y,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(Zvi(o,a))return o;{let d=t<0?u:s,f=e[d];vi(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=iQ({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!mS(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let b=a[g];vi(b!=null,`Previous layout not found for panel index ${g}`);let _=b+h,w=iQ({panelConstraints:r,panelIndex:g,size:_});if(mS(b,w)||(h-=w-b,a[g]=w),mS(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return mS(c,100)?a:o}function Yvi({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];vi(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 Wfe(t,e=document){return Array.from(e.querySelectorAll(`[${td.resizeHandleId}][data-panel-group-id="${t}"]`))}function Ynn(t,e,r=document){let o=Wfe(t,r).findIndex(i=>i.getAttribute(td.resizeHandleId)===e);return o??null}function Qnn(t,e,r){let n=Ynn(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function Qvi(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function eon(t,e=document){if(Qvi(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function zqe(t,e=document){let r=e.querySelector(`[${td.resizeHandleId}="${t}"]`);return r||null}function ewi(t,e,r,n=document){var o,i,a,s;let u=zqe(e,n),l=Wfe(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 twi({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,xr.useRef)({didWarnAboutMissingResizeHandle:!1}),S6(()=>{if(!i)return;let s=Wfe(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=Yvi({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];vi(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,xr.useEffect)(()=>{if(!i)return;let s=e.current;vi(s,"Eager values not found");let{panelDataArray:u}=s,l=eon(r,i);vi(l!=null,`No group found for id "${r}"`);let c=Wfe(r,i);vi(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(td.resizeHandleId);vi(p,"Resize handle element has no handle id attribute");let[m,h]=ewi(r,p,u,i);if(m==null||h==null)return()=>{};let y=g=>{if(!g.defaultPrevented)switch(g.key){case"Enter":{g.preventDefault();let b=u.findIndex(_=>_.id===m);if(b>=0){let _=u[b];vi(_,`No panel data found for index ${b}`);let w=n[b],{collapsedSize:T=0,collapsible:O,minSize:E=0}=_.constraints;if(w!=null&&O){let P=zfe({delta:mS(w,T)?E-T:T-w,initialLayout:n,panelConstraints:u.map(R=>R.constraints),pivotIndices:Qnn(r,p,i),prevLayout:n,trigger:"keyboard"});n!==P&&a(P)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function Lnn(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 ton(t,e){let r=t==="horizontal",{x:n,y:o}=Uqe(e);return r?n:o}function rwi(t,e,r,n,o){let i=r==="horizontal",a=zqe(e,o);vi(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(td.groupId);vi(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=ton(r,t),c=eon(s,o);vi(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function nwi(t,e,r,n,o,i){if(znn(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:rwi(t,e,r,n,i)}function owi({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];vi(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];vi(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 nQ(t,e,r){e.forEach((n,o)=>{let i=t[o];vi(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||RL(d,l))&&!RL(n,l)&&p(),f&&(d==null||!RL(d,l))&&RL(n,l)&&f())}})}function $qe(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 iwi({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 awi(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function Fnn(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 ron(t){return`react-resizable-panels:${t}`}function non(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 oon(t,e){try{let r=ron(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function swi(t,e,r){var n,o;let i=(n=oon(t,r))!==null&&n!==void 0?n:{},a=non(e);return(o=i[a])!==null&&o!==void 0?o:null}function uwi(t,e,r,n,o){var i;let a=ron(t),s=non(e),u=(i=oon(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 knn({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(!mS(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];vi(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];vi(a!=null,`No layout data found for index ${i}`);let s=iQ({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!mS(o,0))for(let i=0;i<e.length;i++){let a=r[i];vi(a!=null,`No layout data found for index ${i}`);let s=a+o,u=iQ({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,mS(o,0)))break}return r}var lwi=100,Vfe={getItem:t=>(Fnn(Vfe),Vfe.getItem(t)),setItem:(t,e)=>{Fnn(Vfe),Vfe.setItem(t,e)}},qnn={};function ion({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=Vfe,style:l,tagName:c="div",...d}){let f=CSt(i),p=(0,xr.useRef)(null),[m,h]=(0,xr.useState)(null),[y,g]=(0,xr.useState)([]),b=Xvi(),_=(0,xr.useRef)({}),w=(0,xr.useRef)(new Map),T=(0,xr.useRef)(0),O=(0,xr.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,xr.useRef)({layout:y,panelDataArray:[],panelDataArrayChanged:!1});(0,xr.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,xr.useImperativeHandle)(o,()=>({getId:()=>O.current.id,getLayout:()=>{let{layout:L}=E.current;return L},setLayout:L=>{let{onLayout:W}=O.current,{layout:ie,panelDataArray:j}=E.current,A=knn({layout:L,panelConstraints:j.map(U=>U.constraints)});Lnn(ie,A)||(g(A),E.current.layout=A,W&&W(A),nQ(j,A,_.current))}}),[]),S6(()=>{O.current.autoSaveId=t,O.current.direction=n,O.current.dragState=m,O.current.id=f,O.current.onLayout=a,O.current.storage=u}),twi({committedValuesRef:O,eagerValuesRef:E,groupId:f,layout:y,panelDataArray:E.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,xr.useEffect)(()=>{let{panelDataArray:L}=E.current;if(t){if(y.length===0||y.length!==L.length)return;let W=qnn[t];W==null&&(W=awi(uwi,lwi),qnn[t]=W);let ie=[...L],j=new Map(w.current);W(t,ie,j,y,u)}},[t,y,u]),(0,xr.useEffect)(()=>{});let P=(0,xr.useCallback)(L=>{let{onLayout:W}=O.current,{layout:ie,panelDataArray:j}=E.current;if(L.constraints.collapsible){let A=j.map(Z=>Z.constraints),{collapsedSize:U=0,panelSize:H,pivotIndices:re}=w6(j,L,ie);if(vi(H!=null,`Panel size not found for panel "${L.id}"`),!RL(H,U)){w.current.set(L.id,H);let le=oQ(j,L)===j.length-1?H-U:U-H,Ce=zfe({delta:le,initialLayout:ie,panelConstraints:A,pivotIndices:re,prevLayout:ie,trigger:"imperative-api"});$qe(ie,Ce)||(g(Ce),E.current.layout=Ce,W&&W(Ce),nQ(j,Ce,_.current))}}},[]),R=(0,xr.useCallback)((L,W)=>{let{onLayout:ie}=O.current,{layout:j,panelDataArray:A}=E.current;if(L.constraints.collapsible){let U=A.map(He=>He.constraints),{collapsedSize:H=0,panelSize:re=0,minSize:Z=0,pivotIndices:le}=w6(A,L,j),Ce=W??Z;if(RL(re,H)){let He=w.current.get(L.id),lt=He!=null&&He>=Ce?He:Ce,Nt=oQ(A,L)===A.length-1?re-lt:lt-re,mt=zfe({delta:Nt,initialLayout:j,panelConstraints:U,pivotIndices:le,prevLayout:j,trigger:"imperative-api"});$qe(j,mt)||(g(mt),E.current.layout=mt,ie&&ie(mt),nQ(A,mt,_.current))}}},[]),I=(0,xr.useCallback)(L=>{let{layout:W,panelDataArray:ie}=E.current,{panelSize:j}=w6(ie,L,W);return vi(j!=null,`Panel size not found for panel "${L.id}"`),j},[]),N=(0,xr.useCallback)((L,W)=>{let{panelDataArray:ie}=E.current,j=oQ(ie,L);return iwi({defaultSize:W,dragState:m,layout:y,panelData:ie,panelIndex:j})},[m,y]),z=(0,xr.useCallback)(L=>{let{layout:W,panelDataArray:ie}=E.current,{collapsedSize:j=0,collapsible:A,panelSize:U}=w6(ie,L,W);return vi(U!=null,`Panel size not found for panel "${L.id}"`),A===!0&&RL(U,j)},[]),V=(0,xr.useCallback)(L=>{let{layout:W,panelDataArray:ie}=E.current,{collapsedSize:j=0,collapsible:A,panelSize:U}=w6(ie,L,W);return vi(U!=null,`Panel size not found for panel "${L.id}"`),!A||C6(U,j)>0},[]),k=(0,xr.useCallback)(L=>{let{panelDataArray:W}=E.current;W.push(L),W.sort((ie,j)=>{let A=ie.order,U=j.order;return A==null&&U==null?0:A==null?-1:U==null?1:A-U}),E.current.panelDataArrayChanged=!0,b()},[b]);S6(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:L,onLayout:W,storage:ie}=O.current,{layout:j,panelDataArray:A}=E.current,U=null;if(L){let re=swi(L,A,ie);re&&(w.current=new Map(Object.entries(re.expandToSizes)),U=re.layout)}U==null&&(U=owi({panelDataArray:A}));let H=knn({layout:U,panelConstraints:A.map(re=>re.constraints)});Lnn(j,H)||(g(H),E.current.layout=H,W&&W(H),nQ(A,H,_.current))}}),S6(()=>{let L=E.current;return()=>{L.layout=[]}},[]);let X=(0,xr.useCallback)(L=>{let W=!1,ie=p.current;return ie&&window.getComputedStyle(ie,null).getPropertyValue("direction")==="rtl"&&(W=!0),function(A){A.preventDefault();let U=p.current;if(!U)return()=>null;let{direction:H,dragState:re,id:Z,keyboardResizeBy:le,onLayout:Ce}=O.current,{layout:He,panelDataArray:lt}=E.current,{initialLayout:qe}=re??{},Nt=Qnn(Z,L,U),mt=nwi(A,L,H,re,le,U),Ot=H==="horizontal";Ot&&W&&(mt=-mt);let je=lt.map(ze=>ze.constraints),Gr=zfe({delta:mt,initialLayout:qe??He,panelConstraints:je,pivotIndices:Nt,prevLayout:He,trigger:znn(A)?"keyboard":"mouse-or-touch"}),ct=!$qe(He,Gr);(Vnn(A)||Hnn(A))&&T.current!=mt&&(T.current=mt,!ct&&mt!==0?Ot?_St(L,mt<0?Jnn:Knn):_St(L,mt<0?Gnn:Xnn):_St(L,0)),ct&&(g(Gr),E.current.layout=Gr,Ce&&Ce(Gr),nQ(lt,Gr,_.current))}},[]),B=(0,xr.useCallback)((L,W)=>{let{onLayout:ie}=O.current,{layout:j,panelDataArray:A}=E.current,U=A.map(He=>He.constraints),{panelSize:H,pivotIndices:re}=w6(A,L,j);vi(H!=null,`Panel size not found for panel "${L.id}"`);let le=oQ(A,L)===A.length-1?H-W:W-H,Ce=zfe({delta:le,initialLayout:j,panelConstraints:U,pivotIndices:re,prevLayout:j,trigger:"imperative-api"});$qe(j,Ce)||(g(Ce),E.current.layout=Ce,ie&&ie(Ce),nQ(A,Ce,_.current))},[]),Q=(0,xr.useCallback)((L,W)=>{let{layout:ie,panelDataArray:j}=E.current,{collapsedSize:A=0,collapsible:U}=W,{collapsedSize:H=0,collapsible:re,maxSize:Z=100,minSize:le=0}=L.constraints,{panelSize:Ce}=w6(j,L,ie);Ce!=null&&(U&&re&&RL(Ce,A)?RL(A,H)||B(L,H):Ce<le?B(L,le):Ce>Z&&B(L,Z))},[B]),Y=(0,xr.useCallback)((L,W)=>{let{direction:ie}=O.current,{layout:j}=E.current;if(!p.current)return;let A=zqe(L,p.current);vi(A,`Drag handle element not found for id "${L}"`);let U=ton(ie,W);h({dragHandleId:L,dragHandleRect:A.getBoundingClientRect(),initialCursorPosition:U,initialLayout:j})},[]),K=(0,xr.useCallback)(()=>{h(null)},[]),oe=(0,xr.useCallback)(L=>{let{panelDataArray:W}=E.current,ie=oQ(W,L);ie>=0&&(W.splice(ie,1),delete _.current[L.id],E.current.panelDataArrayChanged=!0,b())},[b]),ue=(0,xr.useMemo)(()=>({collapsePanel:P,direction:n,dragState:m,expandPanel:R,getPanelSize:I,getPanelStyle:N,groupId:f,isPanelCollapsed:z,isPanelExpanded:V,reevaluatePanelConstraints:Q,registerPanel:k,registerResizeHandle:X,resizePanel:B,startDragging:Y,stopDragging:K,unregisterPanel:oe,panelGroupElement:p.current}),[P,m,n,R,I,N,f,z,V,Q,k,X,B,Y,K,oe]),de={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,xr.createElement)(qqe.Provider,{value:ue},(0,xr.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...de,...l},[td.group]:"",[td.groupDirection]:n,[td.groupId]:f}))}var ESt=(0,xr.forwardRef)((t,e)=>(0,xr.createElement)(ion,{...t,forwardedRef:e}));ion.displayName="PanelGroup";ESt.displayName="forwardRef(PanelGroup)";function oQ(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function w6(t,e,r){let n=oQ(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function cwi({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,xr.useEffect)(()=>{if(t||r==null||n==null)return;let o=zqe(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(td.groupId);vi(s,`No group element found for id "${s}"`);let u=Wfe(s,n),l=Ynn(s,e,n);vi(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 PSt({children:t=null,className:e="",disabled:r=!1,hitAreaMargins:n,id:o,onBlur:i,onClick:a,onDragging:s,onFocus:u,onPointerDown:l,onPointerUp:c,style:d={},tabIndex:f=0,tagName:p="div",...m}){var h,y;let g=(0,xr.useRef)(null),b=(0,xr.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,xr.useEffect)(()=>{b.current.onClick=a,b.current.onDragging=s,b.current.onPointerDown=l,b.current.onPointerUp=c});let _=(0,xr.useContext)(qqe);if(_===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:w,groupId:T,registerResizeHandle:O,startDragging:E,stopDragging:P,panelGroupElement:R}=_,I=CSt(o),[N,z]=(0,xr.useState)("inactive"),[V,k]=(0,xr.useState)(!1),[X,B]=(0,xr.useState)(null),Q=(0,xr.useRef)({state:N});S6(()=>{Q.current.state=N}),(0,xr.useEffect)(()=>{if(r)B(null);else{let ue=O(I);B(()=>ue)}},[r,I,O]);let Y=(h=n?.coarse)!==null&&h!==void 0?h:15,K=(y=n?.fine)!==null&&y!==void 0?y:5;return(0,xr.useEffect)(()=>{if(r||X==null)return;let ue=g.current;vi(ue,"Element ref not attached");let de=!1;return Kvi(I,ue,w,{coarse:Y,fine:K},(W,ie,j)=>{if(!ie){z("inactive");return}switch(W){case"down":{z("drag"),de=!1,vi(j,'Expected event to be defined for "down" action'),E(I,j);let{onDragging:A,onPointerDown:U}=b.current;A?.(!0),U?.();break}case"move":{let{state:A}=Q.current;de=!0,A!=="drag"&&z("hover"),vi(j,'Expected event to be defined for "move" action'),X(j);break}case"up":{z("hover"),P();let{onClick:A,onDragging:U,onPointerUp:H}=b.current;U?.(!1),H?.(),de||A?.();break}}})},[Y,w,r,K,O,I,X,E,P]),cwi({disabled:r,handleId:I,resizeHandler:X,panelGroupElement:R}),(0,xr.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,[td.groupDirection]:w,[td.groupId]:T,[td.resizeHandle]:"",[td.resizeHandleActive]:N==="drag"?"pointer":V?"keyboard":void 0,[td.resizeHandleEnabled]:!r,[td.resizeHandleId]:I,[td.resizeHandleState]:N})}PSt.displayName="PanelResizeHandle";$r();var aon=({className:t,...e})=>Jfe.createElement(ESt,{className:we("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),MSt=xSt,son=({withHandle:t,className:e,...r})=>Jfe.createElement(PSt,{className:we("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&&Jfe.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"},Jfe.createElement(fx,{className:"tw-size-2.5"})));$r();ob();Bt();Or();var uQ=require("obsidian"),Ke=$(J()),don=$(jm());function fwi({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ke.default.createElement(Gre,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ke.default.createElement(Kre,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ke.default.createElement(Yre,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ke.default.createElement(Du,{className:`${e}`}):Ke.default.createElement(Du,{className:`tw-text-faint ${e}`})}var RSt=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Ke.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Ke.default.createElement("div",{className:"tw-flex tw-items-center"},Ke.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Ke.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Ke.default.createElement(to,{buttonClassName:"tw-ml-2 tw-size-4 tw-text-muted",content:Ke.default.createElement("div",{className:"tw-max-w-80"},o)})),Ke.default.createElement(pe,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ke.default.createElement(_w,{className:`tw-size-4 ${r}`}))),uon=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Ke.default.createElement("div",null,Ke.default.createElement(RSt,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Ke.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Ke.default.createElement("div",{key:f.id,className:we("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)},Ke.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Ke.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Ke.default.createElement(pc,{className:"tw-flex-1 tw-text-sm"},f.name)),Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ke.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Ke.default.createElement(qo,{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 pwi(t,e){if(e.isCurrentProject){if(e.processingFiles.has(t))return{status:"processing"};let r=e.failedByPath.get(t);return r?{status:"failed",failedItem:r}:e.success.has(t)?{status:"success"}:{status:"notStarted"}}return e.cachedFiles.has(t)?{status:"success"}:{status:"notStarted"}}var lon={success:"Processed",failed:"Failed",processing:"Processing",notStarted:"Not started"};function mwi({item:t,viewMode:e,loadStatus:r,onDelete:n}){let o=t.id.split(".").pop()||"",i=t.isIgnored?Zb:qo;return Ke.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"},Ke.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ke.default.createElement(fwi,{extension:o,size:"tw-size-8"})),Ke.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ke.default.createElement(pc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Ke.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Ke.default.createElement(pc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Ke.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},r&&Ke.default.createElement(Qc,{variant:"outline",className:we("tw-flex tw-items-center tw-gap-1 tw-whitespace-nowrap",r.status==="success"&&"tw-text-success",r.status==="failed"&&"tw-text-error",r.status==="processing"&&"tw-text-accent",r.status==="notStarted"&&"tw-text-muted"),title:r.status==="failed"&&r.failedItem?.error?`Failed: ${r.failedItem.error}`:lon[r.status]},r.status==="processing"?Ke.default.createElement(Bs,{className:"tw-size-3 tw-animate-spin"}):r.status==="success"?Ke.default.createElement(K_,{className:"tw-size-3"}):r.status==="failed"?Ke.default.createElement(Gb,{className:"tw-size-3"}):Ke.default.createElement("div",{className:"tw-size-2 tw-rounded-full tw-border tw-border-solid tw-border-border"}),Ke.default.createElement("span",{className:"tw-hidden md:tw-inline"},lon[r.status])),Ke.default.createElement(i,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:a=>n(a,t)})))}function hwi({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=A1,n="tw-text-context-manager-orange";break;case"folder":r=$m,n="tw-text-context-manager-yellow";break;case"files":r=Du,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=qo,n="tw-text-context-manager-red";break}return Ke.default.createElement("div",{className:"tw-group tw-flex tw-cursor-pointer tw-items-center tw-rounded-lg tw-border tw-border-solid tw-border-border tw-p-2 tw-transition-shadow hover:tw-shadow-md",onClick:()=>e(t)},Ke.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ke.default.createElement(r,{className:`tw-size-6 ${n}`})),Ke.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ke.default.createElement(pc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&Ke.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),Ke.default.createElement(pc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function con(t){return"type"in t}function gwi({initialProject:t,onSave:e,onCancel:r,app:n}){let o=uQ.Platform.isMobile,[i]=s5(),[a,s]=(0,Ke.useState)(null);(0,Ke.useEffect)(()=>{let U=!0;return(async()=>{let re=await Fw.getInstance().get(t);U&&s(re)})(),()=>{U=!1}},[t]);let u=(0,Ke.useMemo)(()=>Gu()?.id===t.id,[t.id]),l=(0,Ke.useMemo)(()=>a?.fileContexts?new Set(Object.entries(a.fileContexts).filter(([,U])=>U?.cacheKey).map(([U])=>U)):new Set,[a]),c=(0,Ke.useMemo)(()=>({success:new Set(i.success),failedByPath:new Map(i.failed.map(U=>[U.path,U])),processingFiles:new Set(i.processingFiles),total:new Set(i.total),cachedFiles:l,isCurrentProject:u}),[i.success,i.failed,i.processingFiles,i.total,l,u]),{inclusions:d,exclusions:f}=(0,Ke.useMemo)(()=>el({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),p=(0,Ke.useMemo)(()=>n.vault.getFiles(),[n.vault]),m=(0,Ke.useCallback)((U,H,re)=>{let Z=U.filter(Nt=>Hs(Nt,H,re,!0)),le=(Nt,mt,Ot,je)=>{mt&&mt.forEach(Gr=>{let ct={[Ot]:[Gr]};Hs(Nt,ct,null,!0)&&!je[Gr].some(ze=>ze.id===Nt.path)&&je[Gr].push({id:Nt.path,name:Nt.basename})})},Ce={},He={},lt={},qe=[];return(H?.tagPatterns??[]).forEach(Nt=>{Ce[Nt]=[]}),(H?.folderPatterns??[]).forEach(Nt=>{He[Nt]=[]}),(H?.extensionPatterns??[]).forEach(Nt=>{lt[Nt]=[]}),Z.forEach(Nt=>{le(Nt,H?.tagPatterns,"tagPatterns",Ce),le(Nt,H?.folderPatterns,"folderPatterns",He),le(Nt,H?.extensionPatterns,"extensionPatterns",lt),H?.notePatterns&&Hs(Nt,{notePatterns:H.notePatterns},null,!0)&&!qe.some(mt=>mt.id===Nt.path)&&qe.push({id:Nt.path,name:Nt.basename})}),{tags:Ce,folders:He,extensions:lt,notes:qe}},[]),[h,y]=(0,Ke.useState)(()=>m(p,d,f)),[g,b]=(0,Ke.useState)(()=>{let U=p.filter(H=>f&&Hs(H,f,null,!0));return{files:new Set(U)}}),_=(0,Ke.useRef)(h),w=(0,Ke.useRef)(g),[T,O]=(0,Ke.useState)(""),[E,P]=(0,Ke.useState)(null),[R,I]=(0,Ke.useState)(null),N=(0,Ke.useCallback)((U,H)=>{let re=Object.keys(U.tags),Z=Object.keys(U.folders),le=Object.keys(U.extensions),Ce=U.notes.map(He=>{let lt=H.find(qe=>qe.path===He.id);if(lt)return VG(lt)}).filter(Boolean);return hq({tagPatterns:re,folderPatterns:Z,extensionPatterns:le,notePatterns:Ce})},[]),z=(0,Ke.useCallback)(U=>{let H=new Array(...U.files).map(re=>VG(re));return hq({notePatterns:H})||""},[]);(0,Ke.useEffect)(()=>{_.current=h,w.current=g},[h,g]);let V=(0,Ke.useMemo)(()=>{let U=[],H=(Z,le)=>{le.forEach(Ce=>{Z.some(He=>He.id===Ce.id)||Z.push({id:Ce.id,name:Ce.name})})};return[h.tags,h.folders,h.extensions,{notes:h.notes}].forEach(Z=>{Object.values(Z).forEach(le=>{H(U,le)})}),U},[h]),k=(0,Ke.useCallback)(U=>{let H=[],re=[],Z=[];return U.split(",").map(Ce=>Ce.trim()).filter(Ce=>Ce).forEach(Ce=>{Ce.startsWith("#")?H.push(Ce.substring(1)):Ce.startsWith(".")||Ce.startsWith("*.")?Z.push(Ce.replace("*","")):re.push(Ce)}),{tags:H,titles:re,extensions:Z}},[]),X=(0,Ke.useCallback)(U=>[...U].sort((H,re)=>H.name.toLowerCase().localeCompare(re.name.toLowerCase())),[]),B=(0,Ke.useMemo)(()=>{if(T){let U=k(T);return V.filter(H=>{let re=p.find(qe=>qe.path===H.id);if(!re)return!1;let Z=re.extension==="md",le=U.tags.length>0&&Z&&U.tags.some(qe=>gO(re).some(mt=>(mt.startsWith("#")?mt.substring(1):mt).toLowerCase().includes(qe.toLowerCase()))),Ce=U.titles.length>0&&U.titles.some(qe=>re.basename.toLowerCase().includes(qe.toLowerCase())),He=U.extensions.length>0&&U.extensions.some(qe=>`.${re.extension}`.toLowerCase()===qe.toLowerCase());return U.tags.length>0||U.titles.length>0||U.extensions.length>0?le||Ce||He:!1}).map(H=>({id:H.id,name:H.name}))}if(E==="tags"&&R){let U=h.tags[R];return U||[]}if(E==="folders"&&R){let U=h.folders[R];return U||[]}if(E==="files")return h.notes;if(E==="extensions"&&R){let U=h.extensions[R];return U||[]}if(E==="ignoreFiles")return Array.from(g.files).map(U=>({id:U.path,name:U.basename}));if(!E){let U=X(Object.entries(h.tags).map(([le,Ce])=>({id:`tag:${le}`,name:le.slice(1),type:"tag",originalId:le,count:Ce.length}))),H=X(Object.entries(h.folders).map(([le,Ce])=>({id:`folder:${le}`,name:le,type:"folder",originalId:le,count:Ce.length}))),re=h.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:h.notes.length}]:[],Z=g.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:g.files.size}]:[];return[...U,...H,...re,...Z]}return[]},[T,E,R,k,V,p,h.tags,h.folders,h.notes,h.extensions,g.files,X]),Q=(0,Ke.useCallback)((U,H)=>Object.entries(U).sort(([re],[Z])=>re.localeCompare(Z)).map(([re,Z])=>({id:re,name:H?H(re):re,count:Z.length})),[]),Y=(0,Ke.useCallback)((U,H,re)=>{let Z=He=>p.filter(lt=>Hs(lt,He,null,!0)).map(lt=>({id:lt.path,name:lt.basename})),le=[...w.current.files],Ce=Z(re).map(He=>({...He,isIgnored:le.some(lt=>lt.path===He.id)}));y(He=>({...He,[U]:{...He[U],[H]:Ce}}))},[p]),K=(0,Ke.useCallback)((U,H)=>{let re={tags:{...U.tags},folders:{...U.folders},extensions:{...U.extensions},notes:[...U.notes]},Z=le=>{Object.keys(le).forEach(Ce=>{le[Ce]=le[Ce].filter(He=>He.id!==H)})};return Z(re.tags),Z(re.folders),Z(re.extensions),re.notes=re.notes.filter(le=>le.id!==H),re},[]),oe=(0,Ke.useCallback)((U,H=null,re=!0)=>{P(U),I(H),re&&O("")},[]),ue=(0,Ke.useMemo)(()=>{let U=H=>(re,Z)=>{re.stopPropagation(),y(le=>{let Ce={...le[H]};return delete Ce[Z.id],{...le,[H]:Ce}})};return{delete:{tag:U("tags"),folder:U("folders"),extension:U("extensions")},add:{tag:()=>{new rQ(n,H=>{let re=pae(H);Y("tags",re,{tagPatterns:[re]})}).open()},folder:()=>{new eQ(n,H=>{Y("folders",H,{folderPatterns:[H]})}).open()},file:()=>{new Bfe({app:n,onFileSelect:H=>{h.notes.find(Z=>Z.id===H.path)||(b(Z=>{let le=new Set(Z.files);return le.delete(H),{...Z,files:le}}),y(Z=>({...Z,notes:[...Z.notes,{id:H.path,name:H.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new uQ.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new Bfe({app:n,onFileSelect:H=>{g.files.has(H)||(b(Z=>{let le=new Set(Z.files);return le.add(H),{...Z,files:le}}),y(Z=>K(Z,H.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:H=>{oe("tags",H)},folder:H=>{oe("folders",H)},extension:H=>{oe("extensions",H)},files:()=>{oe("files")},ignoreFiles:()=>{oe("ignoreFiles")}}}},[n,h.notes,g.files,Y,K,oe]),de=(0,Ke.useCallback)(U=>{U.type==="tag"&&U.originalId?ue.click.tag(U.originalId):U.type==="folder"&&U.originalId?ue.click.folder(U.originalId):U.type==="files"?ue.click.files():U.type==="ignoreFiles"&&ue.click.ignoreFiles()},[ue]),L=()=>T?`Search Results for: "${T}"`:E==="tags"&&R?`Tag: ${R}`:E==="folders"&&R?`Folder: ${R}`:E==="files"?"Files":E==="extensions"&&R?`Extension: ${R}`:E==="ignoreFiles"?"Ignore Files":"All Categories",W=(U,H)=>{U.stopPropagation();let re=p.find(Z=>Z.path===H.id);re&&(b(Z=>{let le=new Set(Z.files);return le.add(re),{...Z,files:le}}),y(Z=>K(Z,H.id)))},ie=(0,Ke.useCallback)(()=>{let U=N(_.current,p),H=z(w.current),{inclusions:re,exclusions:Z}=el({inclusions:U,exclusions:H,isProject:!0}),le=m(p,re,Z);y(le)},[p,z,N,m]),j=(U,H)=>{U.stopPropagation();let re=p.find(Z=>Z.path===H.id);re&&(b(Z=>{let le=new Set(Z.files);return le.delete(re),{...Z,files:le}}),ie())},A=()=>{let U=N(h,p),H=z(g);e({...t,contextSource:{...t.contextSource,inclusions:U,exclusions:H}})};return Ke.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ke.default.createElement(aon,{direction:"horizontal",className:"tw-flex-1"},Ke.default.createElement(MSt,{defaultSize:o?35:30,minSize:20,maxSize:40},Ke.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ke.default.createElement("div",{className:"tw-border-b tw-p-4"},Ke.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Ke.default.createElement($B,{className:"tw-max-h-[500px] tw-flex-1"},Ke.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ke.default.createElement(uon,{title:"Tags",IconComponent:A1,iconColorClassName:"tw-text-context-manager-orange",items:Q(h.tags,U=>U.slice(1)),activeItem:R,activeSection:E,sectionType:"tags",renderIcon:U=>Ke.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:ue.click.tag,onAddClick:ue.add.tag,onDeleteItem:(U,H)=>ue.delete.tag(U,H),tooltip:"must be in note property"}),Ke.default.createElement(CC,null),Ke.default.createElement(uon,{title:"Folders",IconComponent:$m,iconColorClassName:"tw-text-context-manager-yellow",items:Q(h.folders),activeItem:R,activeSection:E,sectionType:"folders",onItemClick:ue.click.folder,onAddClick:ue.add.folder,onDeleteItem:(U,H)=>ue.delete.folder(U,H)}),Ke.default.createElement(CC,null),Ke.default.createElement("div",null,Ke.default.createElement(RSt,{IconComponent:Du,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:ue.add.file}),Ke.default.createElement("div",{className:we("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",E==="files"&&"tw-bg-secondary tw-text-normal"),onClick:ue.click.files},"Files (",h.notes.length,")")),Ke.default.createElement(CC,null),Ke.default.createElement("div",null,Ke.default.createElement(RSt,{IconComponent:qo,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:ue.add.ignoreFile}),Ke.default.createElement("div",{className:we("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",E==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:ue.click.ignoreFiles},"Files (",g.files.size,")")))))),Ke.default.createElement(son,{withHandle:!0}),Ke.default.createElement(MSt,{defaultSize:o?65:70},Ke.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ke.default.createElement("div",{className:"tw-border-b tw-p-4"},Ke.default.createElement(ZZ,{placeholder:"Custom search: title, #tag1, .jpg",value:T,onChange:U=>{O(U),U&&oe("search",null,!1)}})),Ke.default.createElement("div",{className:"tw-p-4"},Ke.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},L())),Ke.default.createElement($B,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},B.length===0?Ke.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},E?"No items found.":"No categories found. Add tags, folders, or files using the sidebar."):Ke.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},E||T?X(B).map(U=>con(U)?null:Ke.default.createElement(mwi,{key:U.id,item:U,viewMode:"list",loadStatus:E==="ignoreFiles"||U.isIgnored?void 0:pwi(U.id,c),onDelete:E==="ignoreFiles"||U.isIgnored?j:W})).filter(Boolean):B.map(U=>con(U)?Ke.default.createElement(hwi,{key:U.id,item:U,onClick:de}):null).filter(Boolean)))))),Ke.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ke.default.createElement(pe,{variant:"ghost",onClick:r},"Cancel"),Ke.default.createElement(pe,{onClick:A},"Save")))}var sQ=class extends uQ.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,don.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ke.default.createElement(gwi,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};Cn();var gz=$(J());$r();function Kfe({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,gz.useState)(t);return(0,gz.useEffect)(()=>{l(t)},[t]),gz.default.createElement("div",{className:we("tw-flex tw-items-center tw-gap-4",a)},gz.default.createElement(Jde,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),gz.default.createElement("div",{className:"tw-min-w-[60px] tw-text-right tw-text-sm tw-tabular-nums"},u>=1e3?`${u%1e3===0?u/1e3:(u/1e3).toFixed(1)}k`:u,s))}mr();ob();Ye();Bt();var Gfe=require("obsidian"),vn=$(J()),fon=$(jm());function ywi({initialProject:t,onSave:e,onCancel:r}){let n=Br(),[o,i]=(0,vn.useState)(!1),[a,s]=(0,vn.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,vn.useState)(t||{id:A1t(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:Hb.TEMPERATURE,maxTokens:Hb.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=hA(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{let y=h;if(t?.id){let b=Gu();b?.id===h.id&&(y=b)}new sQ(app,async b=>{l(b)},y).open()},f=()=>u.name&&u.projectModelKey,p=(h,y)=>{l(g=>{if(typeof y=="string"&&h==="projectModelKey"&&(y=y.trim()),Array.isArray(y)&&y.every(b=>typeof b=="string")&&(y=y.map(b=>b.trim()).filter(Boolean)),h.includes(".")){let[b,_]=h.split("."),T=g[b];if(typeof T=="object"&&T!==null)return{...g,[b]:{...T,[_]:y}}}return{...g,[h]:y}})},m=async()=>{u.name&&(u.name=u.name.trim());let y=["name","projectModelKey"].filter(g=>!u[g]);if(y.length>0){s(g=>({...g,...Object.fromEntries(y.map(b=>[b,!0]))})),new Gfe.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new Gfe.Notice(zr(g)),s(b=>({...b,name:!0}))}finally{i(!1)}};return vn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},vn.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),vn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},vn.default.createElement(Vo,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},vn.default.createElement(ri,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),vn.default.createElement(Vo,{label:"Description",description:"Briefly describe the purpose and goals of the project"},vn.default.createElement(ri,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),vn.default.createElement(Vo,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},vn.default.createElement(h_,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),vn.default.createElement(Vo,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},vn.default.createElement(_N,{value:u.projectModelKey,onChange:h=>{let y=h.target.value,g=n.activeModels.find(w=>w.enabled&&no(w)===y);if(!g)return;let{hasApiKey:b,errorNotice:_}=XJ(g,n);p("projectModelKey",y)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:uZ(h),value:no(h)}))})),vn.default.createElement("div",{className:"tw-space-y-4"},vn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),vn.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},vn.default.createElement(Vo,{label:"Temperature"},vn.default.createElement(Kfe,{value:u.modelConfigs?.temperature??Hb.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),vn.default.createElement(Vo,{label:"Token Limit"},vn.default.createElement(Kfe,{value:u.modelConfigs?.maxTokens??Hb.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),vn.default.createElement("div",{className:"tw-space-y-4"},vn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),vn.default.createElement(Vo,{label:vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement("span",null,"File Context"),vn.default.createElement(to,{buttonClassName:"tw-size-4 tw-text-muted",content:vn.default.createElement("div",{className:"tw-max-w-80"},vn.default.createElement("strong",null,"Supported File Types:"),vn.default.createElement("br",null),vn.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",vn.default.createElement("br",null),vn.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",vn.default.createElement("br",null),vn.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",vn.default.createElement("br",null),vn.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",vn.default.createElement("br",null),vn.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."},vn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},vn.default.createElement(pc,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),vn.default.createElement(pe,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),vn.default.createElement(Vo,{label:"Web URLs"},vn.default.createElement(h_,{value:u.contextSource?.webUrls,onChange:h=>{let g=h.target.value.split(`
|
||
`).map(b=>{if(!b.trim())return b;try{return new URL(b.trim()),b}catch{return b}});p("contextSource.webUrls",g.join(`
|
||
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),vn.default.createElement(Vo,{label:"YouTube URLs"},vn.default.createElement(h_,{value:u.contextSource?.youtubeUrls,onChange:h=>{let g=h.target.value.split(`
|
||
`).map(b=>{if(!b.trim())return b;try{let _=new URL(b.trim());return _.hostname.includes("youtube.com")||_.hostname.includes("youtu.be"),b}catch{return b}});p("contextSource.youtubeUrls",g.join(`
|
||
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),vn.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},vn.default.createElement(pe,{variant:"ghost",onClick:r,disabled:o},"Cancel"),vn.default.createElement(pe,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var Xfe=class extends Gfe.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,fon.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(vn.default.createElement(ywi,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};Cn();$r();Xe();Ye();l1();Or();var mon=require("obsidian"),ot=$(J());function bwi(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 pon(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>bwi(n,e,r)):t}function _wi(t){let[e,r]=(0,ot.useState)(()=>t?.getRevision()??0);return(0,ot.useEffect)(()=>{if(!t){r(0);return}return r(t.getRevision()),t.subscribe(()=>{r(t.getRevision())})},[t]),e}function vwi({project:t,loadContext:e,onEdit:r,onDelete:n}){return ot.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)},ot.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},ot.default.createElement("div",{className:"tw-text-accent"},ot.default.createElement($m,{className:"tw-size-4"})),ot.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},ot.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&ot.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),ot.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},ot.default.createElement(yn,null,ot.default.createElement(bn,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},ot.default.createElement(Xb,{className:"tw-size-4"}))),ot.default.createElement(dn,{side:"bottom"},"Edit Project")),ot.default.createElement(yn,null,ot.default.createElement(bn,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},ot.default.createElement(V5,{className:"tw-size-4"}))),ot.default.createElement(dn,{side:"bottom"},"Start Chat")),ot.default.createElement(yn,null,ot.default.createElement(bn,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new zu(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},ot.default.createElement(Vy,{className:"tw-size-4"}))),ot.default.createElement(dn,{side:"bottom"},"Delete Project"))))}var ISt=(0,ot.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,plugin:o,onProjectAdded:i,onEditProject:a,hasMessages:s=!1,showChatUI:u,onClose:l,onProjectClose:c})=>{let[d,f]=(0,ot.useState)(r),[p,m]=(0,ot.useState)(!1),[h,y]=(0,ot.useState)(null),[g,b]=(0,ot.useState)(""),_=fz(),w=Br(),T=o?.projectManager?.getProjectUsageTimestampsManager?.(),O=_wi(T);(0,ot.useEffect)(()=>{s&&f(!1)},[s]);let E=(0,ot.useMemo)(()=>mO(e,w.projectListSortStrategy,{getName:k=>k.name,getCreatedAtMs:k=>k.created,getLastUsedAtMs:k=>T?T.getEffectiveLastUsedAt(k.id,k.UsageTimestamps):k.UsageTimestamps}),[e,w.projectListSortStrategy,T,O]),P=(0,ot.useMemo)(()=>pon(E,g),[E,g]),R=()=>{new Xfe(n,async X=>{i(X)}).open()},I=k=>{new Xfe(n,async B=>{a(k,B),h&&h.name===k.name&&y(B)},k).open()},N=k=>{let B=(e||[]).filter(Q=>Q.name!==k.name);h?.name===k.name&&z(!1),Re("projectList",B),new mon.Notice(`Project "${k.name}" deleted successfully`)},z=(k,X)=>{if(k){if(!X){ne("Must be exist one project.");return}y(X),m(!0),f(!1)}else{y(null),m(!1),f(!0),u(!1),D4(null);return}},V=k=>{y(k),m(!0),f(!1),u(!0),D4(k),setTimeout(()=>{_.focusInput()},0)};return ot.default.createElement("div",{className:we("tw-flex tw-flex-col",t)},ot.default.createElement("div",{className:"tw-overflow-y-auto"},ot.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&h?ot.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},ot.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},ot.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),ot.default.createElement(KW,{value:h.name,onValueChange:k=>{let X=E.find(B=>B.name===k);X&&V(X)}},ot.default.createElement(kB,{className:"tw-truncate"},ot.default.createElement(GW,null,ot.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},ot.default.createElement($m,{className:"tw-size-4 tw-shrink-0 tw-text-accent/70"}),ot.default.createElement("span",{className:"tw-flex-1 tw-truncate"},h.name)))),ot.default.createElement(qB,{className:"tw-truncate"},E.map(k=>ot.default.createElement(UB,{key:k.name,value:k.name,className:"tw-flex tw-items-center tw-gap-2"},ot.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},ot.default.createElement($m,{className:"tw-size-4 tw-shrink-0"}),ot.default.createElement("span",{className:"tw-truncate"},k.name))))))),ot.default.createElement("div",{className:"tw-ml-1 tw-flex tw-items-center tw-gap-2"},ot.default.createElement(pe,{variant:"secondary",onClick:()=>I(h),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},ot.default.createElement(Xb,{className:"tw-mr-1 tw-size-4"}),"Edit"),ot.default.createElement(yn,null,ot.default.createElement(bn,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:()=>{z(!1),c()},"aria-label":"Close Current Project"},ot.default.createElement(qo,{className:"tw-size-4"}))),ot.default.createElement(dn,{side:"bottom"},"Close Current Project")))):ot.default.createElement(_y,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},ot.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},ot.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},ot.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),ot.default.createElement(to,{content:"Manage your projects with different contexts and configurations.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),ot.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ot.default.createElement(pe,{className:"tw-px-2",variant:"secondary",onClick:R},"Create",ot.default.createElement(Zb,{className:"tw-size-3"})),e.length>0&&ot.default.createElement(BT,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon"},d?ot.default.createElement(jg,{className:"tw-size-5"}):ot.default.createElement(Wi,{className:"tw-size-5"}))),ot.default.createElement(yn,null,ot.default.createElement(bn,{asChild:!0},ot.default.createElement(pe,{variant:"ghost2",size:"icon",onClick:()=>l(),"aria-label":"close project mode"},ot.default.createElement(qo,{className:"tw-size-4"}))),ot.default.createElement(dn,{side:"bottom"},"Close Project Mode")))),e.length===0&&ot.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),ot.default.createElement(vy,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},ot.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&ot.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},ot.default.createElement(ZZ,{value:g,onChange:b,placeholder:"Search projects..."})),ot.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},ot.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"},P.map(k=>ot.default.createElement(vwi,{key:k.name,project:k,loadContext:V,onEdit:I,onDelete:N}))),g.trim()&&P.length===0&&ot.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},ot.default.createElement(Y4,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),ot.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),ot.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&ot.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!p&&ot.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"},ot.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},ot.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),ot.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},ot.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ot.default.createElement(V5,{className:"tw-size-4"}),ot.default.createElement("span",null,"Click a project card to start chatting")))))))});ISt.displayName="ProjectList";var Qi=$(J()),Jqe=$(J());var Zfe=$(J());var NSt=$(J(),1);var IL=$(J(),1),hon=$(St(),1);function gon(t,e=[]){let r=[];function n(i,a){let s=IL.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=IL.useMemo(()=>m,Object.values(m));return(0,hon.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=IL.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=>IL.createContext(a));return function(s){let u=s?.[t]||i;return IL.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,wwi(o,...e)]}function wwi(...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 IL.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var von=$(J(),1),Pwi=$(hu(),1);var Ch=$(J(),1);var Swi=$(J(),1);function yon(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bon(...t){return e=>{let r=!1,n=t.map(o=>{let i=yon(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():yon(t[o],null)}}}}var Vqe=$(St(),1);function _on(t){let e=Cwi(t),r=Ch.forwardRef((n,o)=>{let{children:i,...a}=n,s=Ch.Children.toArray(i),u=s.find(Twi);if(u){let l=u.props.children,c=s.map(d=>d===u?Ch.Children.count(l)>1?Ch.Children.only(null):Ch.isValidElement(l)?l.props.children:null:d);return(0,Vqe.jsx)(e,{...a,ref:o,children:Ch.isValidElement(l)?Ch.cloneElement(l,void 0,c):null})}return(0,Vqe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Cwi(t){let e=Ch.forwardRef((r,n)=>{let{children:o,...i}=r;if(Ch.isValidElement(o)){let a=Ewi(o),s=Owi(i,o.props);return o.type!==Ch.Fragment&&(s.ref=n?bon(n,a):a),Ch.cloneElement(o,s)}return Ch.Children.count(o)>1?Ch.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var xwi=Symbol("radix.slottable");function Twi(t){return Ch.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===xwi}function Owi(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 Ewi(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 won=$(St(),1),Mwi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ASt=Mwi.reduce((t,e)=>{let r=_on(`Primitive.${e}`),n=von.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,won.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Hqe=$(St(),1),DSt="Progress",jSt=100,[Rwi,m9s]=gon(DSt),[Iwi,Awi]=Rwi(DSt),xon=NSt.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=Nwi,...a}=t;(o||o===0)&&!Son(o)&&console.error(Dwi(`${o}`,"Progress"));let s=Son(o)?o:jSt;n!==null&&!Con(n,s)&&console.error(jwi(`${n}`,"Progress"));let u=Con(n,s)?n:null,l=Wqe(u)?i(u,s):void 0;return(0,Hqe.jsx)(Iwi,{scope:r,value:u,max:s,children:(0,Hqe.jsx)(ASt.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Wqe(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":Eon(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});xon.displayName=DSt;var Ton="ProgressIndicator",Oon=NSt.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=Awi(Ton,r);return(0,Hqe.jsx)(ASt.div,{"data-state":Eon(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});Oon.displayName=Ton;function Nwi(t,e){return`${Math.round(t/e*100)}%`}function Eon(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function Wqe(t){return typeof t=="number"}function Son(t){return Wqe(t)&&!isNaN(t)&&t>0}function Con(t,e){return Wqe(t)&&!isNaN(t)&&t<=e&&t>=0}function Dwi(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${jSt}\`.`}function jwi(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
|
||
- a positive number
|
||
- less than the value passed to \`max\` (or ${jSt} if no \`max\` prop is set)
|
||
- \`null\` or \`undefined\` if the progress is indeterminate.
|
||
|
||
Defaulting to \`null\`.`}var $St=xon,Pon=Oon;$r();var Yfe=Zfe.forwardRef(({className:t,value:e,...r},n)=>Zfe.createElement($St,{ref:n,className:we("tw-relative tw-h-2 tw-w-full tw-overflow-hidden tw-rounded-full tw-bg-interactive-accent/20 tw-border-interactive-accent/30",t),...r},Zfe.createElement(Pon,{className:"tw-size-full tw-flex-1 tw-bg-interactive-accent tw-transition-all",style:{transform:`translateX(-${100-Math.min(Math.max(e||0,0),100)}%)`}})));Yfe.displayName=$St.displayName;Cn();Or();ra();function LSt({onClose:t,onPause:e,onResume:r,onStop:n}){let[o]=l5(),i=(0,Jqe.useRef)(null),{isActive:a,isPaused:s,indexedCount:u,totalFiles:l,errors:c,completionStatus:d}=o,f=l>0?Math.round(u/l*100):0;(0,Jqe.useEffect)(()=>(i.current&&(clearTimeout(i.current),i.current=null),!a&&d!=="none"&&!(d==="error"&&l===0)&&(i.current=setTimeout(()=>{t()},3e3)),()=>{i.current&&(clearTimeout(i.current),i.current=null)}),[a,d,l,t]);let p=()=>d==="success"?l===0?"Index Up to Date":"Indexing Complete":d==="cancelled"?"Indexing Cancelled":d==="error"?l===0?"Indexing Failed":"Indexing Complete (with errors)":s?"Indexing Paused":"Indexing Vault";return Qi.createElement(OL,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},Qi.createElement(EL,null,Qi.createElement(v6,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Qi.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!a&&d!=="none"?d==="error"?Qi.createElement(Gb,{className:"tw-size-4 tw-text-error"}):d==="success"?Qi.createElement(K_,{className:"tw-size-4 tw-text-success"}):Qi.createElement(cx,{className:"tw-size-4"}):s?Qi.createElement(H5,{className:"tw-size-4 tw-text-warning"}):Qi.createElement(Bs,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),Qi.createElement("span",{className:"tw-text-sm"},p())),Qi.createElement(pe,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close",onClick:t},Qi.createElement(qo,{className:"tw-size-4"})))),Qi.createElement(PL,{className:"tw-space-y-3"},l>0&&Qi.createElement("div",{className:"tw-space-y-2"},Qi.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},Qi.createElement("span",{className:"tw-text-muted"},u,"/",l," files"),Qi.createElement("span",{className:"tw-font-medium"},f,"%")),Qi.createElement(Yfe,{value:f,className:"tw-h-2"})),c.length>0&&Qi.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Qi.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qi.createElement(Gb,{className:"tw-size-3 tw-text-error"}),Qi.createElement(Qc,{variant:"destructive",className:"tw-text-xs"},c.length," ",c.length===1?"error":"errors")),l===0&&c[0]&&Qi.createElement("span",{className:"tw-text-xs tw-text-error"},c[0])),a&&Qi.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qi.createElement(pe,{size:"sm",variant:"ghost",className:"tw-h-6 tw-px-2 tw-text-xs",onClick:s?r:e},s?Qi.createElement(Qi.Fragment,null,Qi.createElement(ine,{className:"tw-mr-1 tw-size-3"}),"Resume"):Qi.createElement(Qi.Fragment,null,Qi.createElement(H5,{className:"tw-mr-1 tw-size-3"}),"Pause")),Qi.createElement(pe,{size:"sm",variant:"ghost",className:"tw-h-6 tw-px-2 tw-text-xs",onClick:n},Qi.createElement(e2,{className:"tw-mr-1 tw-size-3"}),"Stop"))))}var Tn=$(J()),FSt=$(J());Or();ra();Cn();Xe();function kSt({plugin:t,setHiddenCard:e,onEditContext:r}){let[n]=s5(),o=n.total,i=n.success,a=n.failed,s=n.processingFiles,[u,l]=(0,FSt.useState)(!1),[c,d]=(0,FSt.useState)(!1),f=i.length+a.length,p=o.length>0?Math.round(f/o.length*100):0,m=y=>y.path,h=async y=>{if(!t?.projectManager){ne("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(y)}catch(g){ne(`Error retrying failed item: ${g}`)}};return Tn.createElement(OL,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},Tn.createElement(EL,null,Tn.createElement(v6,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Tn.createElement(Du,{className:"tw-size-5"}),"Context Loading",Tn.createElement(pe,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Edit Context",onClick:()=>r?.()},Tn.createElement(ld,{className:"tw-size-4"}),Tn.createElement("span",{className:"tw-sr-only"},"Edit Context"))),Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded tw-p-1"},Tn.createElement(pe,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},Tn.createElement(qo,{className:"tw-size-4"}))))),Tn.createElement(PL,{className:"tw-space-y-6"},Tn.createElement("div",{className:"tw-space-y-2"},Tn.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Tn.createElement("span",{className:"tw-text-muted"},"Total progress"),Tn.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",Tn.createElement("span",{className:"tw-font-medium tw-text-success"},i.length),", Failed: ",Tn.createElement("span",{className:"tw-font-medium tw-text-error"},a.length),")")),Tn.createElement("span",{className:"tw-font-medium"},f,"/",o.length," (",p,"%)")),Tn.createElement(Yfe,{value:p,className:"tw-h-2"})),s.length>0&&Tn.createElement("div",{className:"tw-space-y-3"},Tn.createElement("div",{className:"tw--m-1 tw-flex tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>l(!u)},Tn.createElement(Bs,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),Tn.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),u?Tn.createElement(Wi,{className:"tw-ml-auto tw-size-4"}):Tn.createElement(ld,{className:"tw-ml-auto tw-size-4"})),u&&Tn.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},s.map((y,g)=>Tn.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},Tn.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),Tn.createElement(pc,{className:"tw-flex-1",title:y},y))))),a.length>0&&Tn.createElement("div",{className:"tw-space-y-3"},Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Tn.createElement("div",{className:"-tw-m-1 tw-flex tw-flex-1 tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded-md tw-p-1 tw-transition-colors hover:tw-bg-muted/10",onClick:()=>d(!c)},Tn.createElement(Gb,{className:"tw-size-4 tw-text-error"}),Tn.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),Tn.createElement(Qc,{variant:"destructive",className:"tw-text-xs"},a.length," files"),c?Tn.createElement(Wi,{className:"tw-ml-auto tw-size-4"}):Tn.createElement(ld,{className:"tw-ml-auto tw-size-4"}))),c&&Tn.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((y,g)=>Tn.createElement("div",{key:g,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},Tn.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Tn.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),Tn.createElement(pc,{className:"tw-flex-1 tw-font-bold",title:y.path},m(y))),Tn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Tn.createElement("div",{className:"tw-size-2 tw-rounded-full"}),y.error&&Tn.createElement(pc,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:y.error},Tn.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),y.error))),Tn.createElement(pe,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${y.type} item`,onClick:async b=>{b.stopPropagation(),await h(y)}},Tn.createElement(Z4,{className:"tw-size-3"}))))))))}mr();var Tb=$(J());function Mon(t){let[e,r]=(0,Tb.useState)([]);(0,Tb.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,Tb.useCallback)(async(m,h,y,g=!1,b=!1)=>await t.sendMessage(m,h,y,g,b),[t]),o=(0,Tb.useCallback)(async(m,h,y,g=!1)=>await t.editMessage(m,h,y,g),[t]),i=(0,Tb.useCallback)(async(m,h,y)=>await t.regenerateMessage(m,h,y),[t]),a=(0,Tb.useCallback)(async m=>await t.deleteMessage(m),[t]),s=(0,Tb.useCallback)(()=>{t.clearMessages()},[t]),u=(0,Tb.useCallback)(async m=>{await t.truncateAfterMessageId(m)},[t]),l=(0,Tb.useCallback)(m=>{t.addMessage(m)},[t]),c=(0,Tb.useCallback)(m=>{t.loadMessages(m)},[t]),d=(0,Tb.useCallback)(m=>t.getMessage(m),[t]),f=(0,Tb.useCallback)(()=>t.getLLMMessages(),[t]),p=(0,Tb.useCallback)(()=>t.getDebugInfo(),[t]);return{messages:e,sendMessage:n,editMessage:o,regenerateMessage:i,deleteMessage:a,addMessage:l,clearMessages:s,truncateAfterMessageId:u,loadMessages:c,getMessage:d,getLLMMessages:f,getDebugInfo:p}}Bt();var x6=require("obsidian"),Kqe=$(J());function Lwi(t,e){let r=e.match(/obsidian:\/\/open\?vault=.*?&file=(.*)$/);if(!r)return null;let n=decodeURIComponent(r[1]),o=t.vault.getAbstractFileByPath(n);return o instanceof x6.TFile||(o=t.vault.getAbstractFileByPath(n+".md"),o instanceof x6.TFile)?o:null}function Fwi(t,e){let r=e.split(`
|
||
`).filter(o=>o.trim()),n=[];for(let o of r){let i=Lwi(t,o.trim());i&&n.push(i)}return n}function Ron(t){let{app:e,contextNotes:r,setContextNotes:n,selectedImages:o,onAddImage:i,containerRef:a}=t,[s,u]=(0,Kqe.useState)(!1);return(0,Kqe.useEffect)(()=>{let l=a.current;if(!l)return;let c=p=>{if(p.preventDefault(),p.dataTransfer){p.dataTransfer.dropEffect="copy";let m=Array.from(p.dataTransfer.items).some(y=>y.kind==="string"),h=Array.from(p.dataTransfer.items).some(y=>y.kind==="file");(m||h)&&u(!0)}},d=p=>{let m=l.getBoundingClientRect(),h=p.clientX,y=p.clientY;(h<m.left||h>=m.right||y<m.top||y>=m.bottom)&&u(!1)},f=async p=>{if(!p.dataTransfer)return;p.preventDefault(),u(!1);let m=p.dataTransfer.items,h=[],y=[];for(let g=0;g<m.length;g++){let b=m[g];b.kind==="string"?h.push(b):b.kind==="file"&&y.push(b)}if(h.length>0){p.stopPropagation();let g=h.map(w=>new Promise(T=>{w.getAsString(O=>T(O))})),b=await Promise.all(g),_=new Map;for(let w of b){let T=Fwi(e,w);for(let O of T)_.set(O.path,O)}for(let w of _.values())if(["png","gif","jpeg","jpg","webp"].includes(w.extension)){if(o.some(I=>I.name===w.name)){new x6.Notice("This image is already in the context");continue}let E=await e.vault.readBinary(w),P=new Blob([E]),R=new File([P],w.name,{type:`image/${w.extension}`});i([R])}else if(yO(w)){if(r.some(E=>E.path===w.path)){new x6.Notice("This note is already in the context");continue}n(E=>[...E,w])}else new x6.Notice(`Unsupported file type: ${w.extension}. Supported types: md, pdf, canvas, and images.`)}else if(y.length>0){let g=[];for(let b of y){let _=b.getAsFile();_&&_.type.startsWith("image/")&&g.push(_)}g.length>0&&i(g)}};return l.addEventListener("dragover",c),l.addEventListener("dragleave",d),l.addEventListener("drop",f),()=>{l.removeEventListener("dragover",c),l.removeEventListener("dragleave",d),l.removeEventListener("drop",f)}},[e,r,o,i,n,a]),{isDragActive:s}}mr();Bt();Xe();qN();var qSt=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ne("Model request failed:",s);let u=ePe("Model request failed: "+zr(s));r({id:od(),sender:cw,isErrorMessage:!0,message:u,isVisible:!0,timestamp:Mg(new Date)})}};O4();Fc();Ye();Bt();HEe();var Al=require("obsidian");var qt=$(J());qN();var kwi=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i,chatInput:a})=>{let s=Br(),u=(0,qt.useContext)(ZY),{messages:l,addMessage:c}=Mon(i),[d]=bF(),[f]=fw(),[p,m]=(0,qt.useState)(""),[h,y]=(0,qt.useState)(""),[g,b]=(0,qt.useState)(null),_=(0,qt.useRef)(null),w=(0,qt.useRef)(null),T=(0,qt.useCallback)(rt=>{let Rr=w.current,Ee=Rr&&rt.sender===cw&&!rt.isErrorMessage&&!rt.id?{...rt,id:Rr}:rt;c(Ee),Ee.sender===cw&&Ee.responseMetadata?.tokenUsage?.totalTokens&&b(Ee.responseMetadata.tokenUsage.totalTokens)},[c]),O=(0,qt.useCallback)(rt=>{_.current=rt},[]),[E,P]=(0,qt.useState)(!1),[R,I]=(0,qt.useState)(dw.DEFAULT),[N,z]=(0,qt.useState)([]),[V,k]=(0,qt.useState)(!1),[X,B]=(0,qt.useState)(!1),[Q,Y]=(0,qt.useState)([]),[K,oe]=(0,qt.useState)(!1),[ue,de]=(0,qt.useState)([]),[L,W]=(0,qt.useState)(null),[ie,j]=(0,qt.useState)(null),[A]=l5(),U=(0,qt.useRef)(!1),H=(0,qt.useRef)(null),re=(0,qt.useCallback)(()=>{o.chatSelectionHighlightController.persistFromPointerDown()},[o]),Z=(0,qt.useMemo)(()=>({setCurrentAiMessage:rt=>U.current&&m(rt),setLoadingMessage:rt=>U.current&&I(rt),setLoading:rt=>U.current&&P(rt)}),[]),[le]=bDt(),Ce=le.length>0,He=V&&!Ce,lt=X&&!Ce,{activeWebTabForMentions:qe}=rz(),Nt=ULe(),mt=()=>Ue!=="project"?!1:L!==null?L:Nt==="loading"||Nt==="error";(0,qt.useEffect)(()=>{W(null)},[Nt]);let Ot=()=>Ue==="project"||ie===!1?!1:A.isActive||A.completionStatus!=="none";(0,qt.useEffect)(()=>{(A.isActive||A.completionStatus!=="none")&&j(null)},[A.isActive,A.completionStatus]);let je=(0,qt.useCallback)(()=>{j(!1),A.isActive||Ig({completionStatus:"none"})},[A.isActive]),Gr=(0,qt.useCallback)(async()=>{(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().pauseIndexing()},[]),ct=(0,qt.useCallback)(async()=>{(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().resumeIndexing()},[]),ze=(0,qt.useCallback)(async()=>{await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().cancelIndexing()},[]);(0,qt.useEffect)(()=>{l.length===0&&b(null)},[l]);let[ht,$e]=(0,qt.useState)(null),[Ue,Ve]=fw(),Kt=o9(),so=(0,qt.useContext)(Pqe),iu=o.app||so,{isDragActive:An}=Ron({app:iu,contextNotes:N,setContextNotes:z,selectedImages:Q,onAddImage:rt=>Y(Rr=>[...Rr,...rt]),containerRef:H}),Si=async({toolCalls:rt,urls:Rr,contextNotes:Be,contextTags:Ee,contextFolders:It,webTabs:Qt}={})=>{if(!h&&Q.length===0)return;Rr&&Rr.length>0&&!zb(f)&&new Al.Notice(YJ.URL_PROCESSING_RESTRICTED);try{let cl=[];h&&cl.push({type:"text",text:h});for(let $l of Q){let Eb=await $l.arrayBuffer(),Yv=Cq(Eb);cl.push({type:"image_url",image_url:{url:`data:${$l.type};base64,${Yv}`}})}let Xv=[...Be||[],...N].filter(($l,Eb,Yv)=>Yv.findIndex(NN=>NN.path===$l.path)===Eb),DL=h.trim();rt&&(DL+=" "+rt.join(`
|
||
`));let Eh={notes:Xv,urls:zb(f)?Rr||[]:[],tags:Ee||[],folders:It||[],selectedTextContexts:le,webTabs:Qt||[]};y(""),Y([]),w.current=`msg-${od()}`,Z.setLoading(!0),Z.setLoadingMessage(dw.DEFAULT);let FC=await i.sendMessage(DL,Eh,f,He,lt,cl.length>0?cl:void 0,Z.setLoadingMessage);h&&r(h),s.autosaveChat&&Dl();let Zv=i.getLLMMessage(FC);Zv&&await qSt(Zv,t,T,Z.setCurrentAiMessage,O,{debug:s.debug,updateLoadingMessage:Z.setLoadingMessage}),s.autosaveChat&&Dl()}catch(cl){ne("Error sending message:",cl),new Al.Notice("Failed to send message. Please try again.")}finally{Z.setLoading(!1),Z.setLoadingMessage(dw.DEFAULT),w.current=null}},Dl=(0,qt.useCallback)(async()=>{if(!iu){ne("App instance is not available.");return}try{await i.saveChat(d)}catch(rt){ne("Error saving chat as note:",zr(rt)),new Al.Notice("Failed to save chat as note. Check console for details.")}},[iu,i,d]),Vi=(0,qt.useCallback)(rt=>{_.current&&(F(`stopping generation..., reason: ${rt}`),_.current.abort(rt),Z.setLoading(!1),Z.setLoadingMessage(dw.DEFAULT))},[Z]);(0,qt.useEffect)(()=>(U.current=!0,()=>{U.current=!1,_.current&&_.current.abort("component-unmount")}),[]);let O_=(0,qt.useCallback)(async rt=>{if(rt<=0){new Al.Notice("Cannot regenerate the first message.");return}let Rr=l[rt];if(!Rr){new Al.Notice("Message not found.");return}Z.setCurrentAiMessage(""),w.current=`msg-${od()}`,Z.setLoading(!0);try{await i.regenerateMessage(Rr.id,Z.setCurrentAiMessage,T)?s.debug&&console.log("Message regenerated successfully"):new Al.Notice("Failed to regenerate message. Please try again."),s.autosaveChat&&Dl()}catch(Be){ne("Error regenerating message:",Be),new Al.Notice("Failed to regenerate message. Please try again.")}finally{Z.setLoading(!1),w.current=null}},[l,i,s.debug,s.autosaveChat,Dl,T,Z]),wg=(0,qt.useCallback)(async(rt,Rr)=>{let Be=l[rt];if(!(!Be||Be.message===Rr))try{if(!await i.editMessage(Be.id,Rr,f,He)){new Al.Notice("Failed to edit message. Please try again.");return}if(Be.sender===Zs){let It=rt<l.length-1;if(await i.truncateAfterMessageId(Be.id),It){w.current=`msg-${od()}`,Z.setLoading(!0);try{let Qt=i.getLLMMessage(Be.id);Qt&&await qSt(Qt,t,T,Z.setCurrentAiMessage,O,{debug:s.debug,updateLoadingMessage:Z.setLoadingMessage})}catch(Qt){ne("Error regenerating AI response:",Qt),new Al.Notice("Failed to regenerate AI response. Please try again.")}finally{Z.setLoading(!1),w.current=null}}}s.autosaveChat&&Dl()}catch(Ee){ne("Error editing message:",Ee),new Al.Notice("Failed to edit message. Please try again.")}},[l,i,f,He,T,t,s.debug,s.autosaveChat,Dl,Z,O]);(0,qt.useEffect)(()=>{e&&e(Dl)},[e,Dl]);let yS=(0,qt.useCallback)(rt=>{let Rr=s.projectList||[];if(Rr.findIndex(Qt=>Qt.name===rt.name)>=0)throw new Error(`Project "${rt.name}" already exists, please use a different name`);let Ee=[...Rr,rt];return Re("projectList",Ee),Gu()?.id===rt.id?wFe().then(()=>{new Al.Notice(`${rt.name} added and context loaded`)}).catch(Qt=>{ne("Error loading project context:",Qt),new Al.Notice(`${rt.name} added but context loading failed`)}):new Al.Notice(`${rt.name} added successfully`),!0},[s.projectList]),ji=(0,qt.useCallback)((rt,Rr)=>{let Be=s.projectList||[];if(!Be.find(Fn=>Fn.name===rt.name))throw new Error(`Project "${rt.name}" does not exist`);let It=Be.map(Fn=>Fn.name===rt.name?Rr:Fn);return Re("projectList",It),Gu()?.id===rt.id?(D4(Rr),wFe().then(()=>{new Al.Notice(`${rt.name} updated and context reloaded`)}).catch(Fn=>{ne("Error reloading project context:",Fn),new Al.Notice(`${rt.name} updated but context reload failed`)})):new Al.Notice(`${rt.name} updated successfully`),!0},[s.projectList]),KT=(0,qt.useCallback)(rt=>{let Be=tx().find(Ee=>Ee.id===rt);gDt(rt),Be?.sourceType==="web"&&o.suppressCurrentWebSelection(Be.url)},[o]);(0,qt.useEffect)(()=>{o.chatSelectionHighlightController.clearIfNoNoteContexts(le)},[le,o]),(0,qt.useEffect)(()=>{let rt=()=>{a.focusInput()};return u?.addEventListener(US.CHAT_IS_VISIBLE,rt),()=>{u?.removeEventListener(US.CHAT_IS_VISIBLE,rt)}},[u,a]);let LC=(0,qt.useCallback)(async rt=>{let Rr=l[rt];if(!Rr){new Al.Notice("Message not found.");return}try{await i.deleteMessage(Rr.id)||new Al.Notice("Failed to delete message. Please try again.")}catch(Be){ne("Error deleting message:",Be),new Al.Notice("Failed to delete message. Please try again.")}},[l,i]),bS=(0,qt.useCallback)(async()=>{if(c9(),await Im.clear(),Vi("new-chat"),s.enableRecentConversations)try{let Rr=t.chatModelManager.getChatModel();o.userMemoryManager.addRecentConversation(i.getMessages(),Rr)}catch(Rr){F("Failed to analyze chat messages for memory:",Rr)}s.autosaveChat&&await Dl(),i.clearMessages(),Fmt(),Z.setCurrentAiMessage(""),z([]),b(null);let rt=le.find(Rr=>Rr.sourceType==="web")?.url;yDt(),o.chatSelectionHighlightController.clearForNewChat(),o.suppressCurrentWebSelection(rt),Ue==="project"?(k(!1),B(!1)):(k(s.autoAddActiveContentToContext),B(s.autoAddActiveContentToContext))},[Vi,t.chatModelManager,i,s.autosaveChat,s.enableRecentConversations,s.autoAddActiveContentToContext,Ue,Dl,Z,o,le]),Gs=(0,qt.useCallback)(async()=>{try{let rt=await o.getChatHistoryItems();de(rt)}catch(rt){ne("Error loading chat history:",rt),new Al.Notice("Failed to load chat history.")}},[o]),jl=(0,qt.useCallback)(async(rt,Rr)=>{try{await o.updateChatTitle(rt,Rr),await Gs()}catch(Be){throw ne("Error updating chat title:",Be),new Al.Notice("Failed to update chat title."),Be}},[o,Gs]),Mu=(0,qt.useCallback)(async rt=>{try{await o.deleteChatHistory(rt),await Gs()}catch(Rr){throw ne("Error deleting chat:",Rr),new Al.Notice("Failed to delete chat."),Rr}},[o,Gs]),Mm=(0,qt.useCallback)(async rt=>{try{await o.loadChatById(rt),Fmt()}catch(Rr){ne("Error loading chat:",Rr),new Al.Notice("Failed to load chat.")}},[o]),xd=(0,qt.useCallback)(async rt=>{try{await o.openChatSourceFile(rt)}catch(Rr){ne("Error opening source file:",Rr),new Al.Notice("Failed to open source file.")}},[o]);(0,qt.useEffect)(()=>{let rt=Rr=>{let Be=Rr.detail?.reason||"new-chat";Vi(Be)};return u?.addEventListener(US.ABORT_STREAM,rt),()=>{u?.removeEventListener(US.ABORT_STREAM,rt)}},[u,Vi]),(0,qt.useEffect)(()=>{s.autoAddActiveContentToContext!==void 0&&(Ue==="project"?(k(!1),B(!1)):(k(s.autoAddActiveContentToContext),B(s.autoAddActiveContentToContext)))},[s.autoAddActiveContentToContext,Ue]);let ll=()=>qt.default.createElement(qt.default.Fragment,null,qt.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},qt.default.createElement(Rnn,{currentVersion:o.manifest.version}),qt.default.createElement(Mnn,{chatHistory:l,currentAiMessage:p,streamingMessageId:w.current,loading:E,loadingMessage:R,app:iu,onRegenerate:O_,onEdit:wg,onDelete:LC,onReplaceChat:y,showHelperComponents:Ue!=="project"}),mt()?qt.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},qt.default.createElement(kSt,{plugin:o,setHiddenCard:()=>{W(!1)},onEditContext:()=>{let rt=Gu();rt&&new sQ(iu,Rr=>{ji(rt,Rr)},rt).open()}})):Ot()?qt.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},qt.default.createElement(LSt,{onClose:je,onPause:Gr,onResume:ct,onStop:ze})):qt.default.createElement(qt.default.Fragment,null,qt.default.createElement(PXr,{onNewChat:bS,onSaveAsNote:()=>Dl(),onLoadHistory:Gs,onModeChange:rt=>{$e(Ue),rt==="project"&&oe(!1)},chatHistory:ue,onUpdateChatTitle:jl,onDeleteChat:Mu,onLoadChat:Mm,onOpenSourceFile:xd,latestTokenCount:g}),qt.default.createElement(_qe,{inputMessage:h,setInputMessage:y,handleSendMessage:Si,isGenerating:E,onStopGenerating:()=>Vi("user-stopped"),app:iu,contextNotes:N,setContextNotes:z,includeActiveNote:V,setIncludeActiveNote:k,includeActiveWebTab:X,setIncludeActiveWebTab:B,activeWebTab:qe,selectedImages:Q,onAddImage:rt=>Y(Rr=>[...Rr,...rt]),setSelectedImages:Y,disableModelSwitch:Ue==="project",selectedTextContexts:le,onRemoveSelectedText:KT,showProgressCard:()=>{W(!0)},showIndexingCard:()=>{j(!0)}}))));return qt.default.createElement("div",{ref:H,onPointerDownCapture:re,className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},qt.default.createElement("div",{className:"tw-h-full"},qt.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},An&&qt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary tw-opacity-80"},qt.default.createElement("span",null,"Drop files here...")),Ue==="project"&&qt.default.createElement("div",{className:`${Ue==="project"?"tw-z-modal":""}`},qt.default.createElement(ISt,{projects:s.projectList||[],defaultOpen:!0,app:iu,plugin:o,hasMessages:!1,onProjectAdded:yS,onEditProject:ji,onClose:()=>{ht?(Ve(ht),$e(null)):Ve(Kt?"copilot_plus":"llm_chain")},showChatUI:rt=>oe(rt),onProjectClose:()=>{W(null)}})),(Ue!=="project"||Ue==="project"&&K)&&ll())))},qwi=t=>qt.default.createElement(Trn,null,qt.default.createElement(Uwi,{...t})),Uwi=t=>{let e=fz();return qt.default.createElement(kwi,{...t,chatInput:e})},Ion=qwi;mr();var Gqe=require("obsidian"),Qfe=$(J()),Aon=$(jm()),yz=class extends Gqe.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=null;this.keyboardObserver=null;this.lastDrawerEl=null;this.app=n.app,this.fileParserManager=n.fileParserManager,this.eventTarget=new EventTarget,this.plugin=n}get chainManager(){return this.plugin.projectManager.getCurrentChainManager()}getViewType(){return Nu}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Aon.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n),this.setupMobileKeyboardObserver()}setupMobileKeyboardObserver(){if(!Gqe.Platform.isMobile)return;this.keyboardObserver?.disconnect();let r=()=>{let n=this.containerEl.closest(".workspace-drawer");if(this.lastDrawerEl&&this.lastDrawerEl!==n&&this.lastDrawerEl.classList.remove("copilot-keyboard-open"),this.lastDrawerEl=n,!n)return;let o=!!this.containerEl.closest(".workspace-drawer-active-tab-content"),i=parseFloat(document.documentElement.style.getPropertyValue("--keyboard-height")||"0");n.classList.toggle("copilot-keyboard-open",o&&i>0)};this.keyboardObserver=new MutationObserver(r),this.keyboardObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["style"]}),r()}renderView(r,n){this.root&&this.root.render(Qfe.createElement(Pqe.Provider,{value:this.app},Qfe.createElement(ZY.Provider,{value:this.eventTarget},Qfe.createElement(G$e,{delayDuration:0},Qfe.createElement(Ion,{chainManager:this.chainManager,updateUserMessageHistory:n,fileParserManager:this.fileParserManager,plugin:this.plugin,onSaveChat:r,chatUIState:this.plugin.chatUIState})))))}async saveChat(){this.handleSaveAsNote&&await this.handleSaveAsNote()}updateView(){let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}async onClose(){this.keyboardObserver?.disconnect(),this.keyboardObserver=null,this.lastDrawerEl?.classList.remove("copilot-keyboard-open"),this.lastDrawerEl=null,this.root&&(this.root.unmount(),this.root=null)}};Bt();function epe(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e?.topic&&typeof e.topic=="string"&&e.topic.trim()?e.topic.trim():t.basename.replace(/^[a-zA-Z0-9-]+__/,"").replace(/\{\$date\}|\d{8}/g,"").replace(/\{\$time\}|\d{6}/g,"").replace(/[@_]/g," ").replace(/\s+/g," ").trim()}function tpe(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e&&e.epoch?new Date(e.epoch):new Date(t.stat.ctime)}function rpe(t){let r=app.metadataCache.getFileCache(t)?.frontmatter?.lastAccessedAt;if(typeof r=="number"&&Number.isFinite(r)&&r>0)return r;if(typeof r=="string"){let n=Number(r);if(Number.isFinite(n)&&n>0)return n;let o=Date.parse(r);if(Number.isFinite(o))return o}return null}function Non(t){let e=epe(t),r=tpe(t),n=Mg(r);return`${e} - ${n.display}`}Ye();l1();var Don=require("obsidian"),Xqe=class extends Don.FuzzySuggestModal{constructor(r,n,o,i){super(r);this.chatFiles=n;this.chatHistoryLastAccessedAtManager=o;this.onChooseFile=i}getItems(){let r=te().chatHistorySortStrategy;return mO(this.chatFiles,r,{getName:n=>epe(n),getCreatedAtMs:n=>tpe(n).getTime(),getLastUsedAtMs:n=>{let o=rpe(n);return this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,o)}})}getItemText(r){return Non(r)}onChooseItem(r,n){this.onChooseFile(r)}};mr();function Bwi(t){return typeof t.commands?.executeCommandById=="function"}function jon(t,e){if(!Bwi(e))return;let r=n=>{e.commands.executeCommandById(n)};t.addItem(n=>{n.setTitle("Copilot"),n.setSubmenu();let o=n.submenu;if(!o)return;o.addItem(s=>{s.setTitle("Add selection to chat context").onClick(()=>{r(`copilot:${Sn.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),o.addItem(s=>{s.setTitle("Quick Ask").onClick(()=>{r(`copilot:${Sn.TRIGGER_QUICK_ASK}`)})}),o.addItem(s=>{s.setTitle("Trigger quick command").onClick(()=>{r(`copilot:${Sn.TRIGGER_QUICK_COMMAND}`)})});let a=Pv().filter(s=>s.showInContextMenu);a.length>0&&o.addSeparator(),ide(a).forEach(s=>{o.addItem(u=>{u.setTitle(s.title).onClick(()=>{r(`copilot:${cZ(s.title)}`)})})})})}var $on=$(a9());Xe();var Zqe=class{constructor(e,r){this.handleFileModify=(0,$on.default)(async e=>{if(!fZ(e)||rde(e.path))return;let r=await ode(e);this.registerCommand(r),yW(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!fZ(e)||rde(e.path)))try{let r=await ode(e);if(!IWr(e)){let n=v$e();r={...r,order:n}}await Rgt(e,r),yW(r,r.title),this.registerCommand(r)}catch(r){ne(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!fZ(e)||rde(e.path))return;let r=cZ(e.basename);this.plugin.removeCommand(r),nde(e.basename)};this.handleFileRename=async(e,r)=>{if(rde(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=cZ(n);this.plugin.removeCommand(o),nde(n)}if(fZ(e)){let o=await ode(e);this.registerCommand(o),yW(o,o.title),await Rgt(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await b$e(),this.registerCommands()}async registerCommands(){Pv().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=cZ(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new EB(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),th.getInstance().recordUsage(e)}})}};Ye();Bt();async function zwi(t){let r=`${mB()}/unsupported`;return await $c(r),Promise.all(t.map(async n=>{let o=`${r}/${n.title}.md`,i=await app.vault.create(o,n.content);await app.fileManager.processFrontMatter(i,a=>{a[$$]=n.showInContextMenu,a[L$]=n.showInSlashMenu,a[cN]=n.order,a[F$]=n.modelKey,a[k$]=0})}))}async function Lon(){let t=te().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=Pv(),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=y$e(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
|
||
|
||
Original name: ${a.title}
|
||
|
||
${a.content}`}):e.push(a)}await th.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 ${mB()}.`;r.length>0&&(await zwi(r),i+=`
|
||
|
||
We found ${r.length} unsupported commands. They are saved in ${mB()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),Re("inlineEditCommands",[]),new zu(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function USt(){let t=Pv(),e=RWr.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];th.getInstance().updateCommands(r)}async function Fon(){if(te().suggestedDefaultCommands)return;Pv().length===0&&(new zu(app,()=>{USt()},"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(),Re("suggestedDefaultCommands",!0))}mr();Ye();sd();ra();Xe();mr();async function kon(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Zs){let o=t[r+1];o?.sender===cw&&await e.saveContext({input:n.message},{output:o.message})}}}ra();sd();mr();var Bon=$(gH());Xe();var qon=["L1_SYSTEM","L2_PREVIOUS","L3_TURN","L4_STRIP","L5_USER"],Uon={L1_SYSTEM:"System Instructions",L2_PREVIOUS:"Previous Turn Context",L3_TURN:"Current Turn Context",L4_STRIP:"Conversation Strip",L5_USER:"User Message"};var bz=class bz{constructor(){}static getInstance(){return bz.instance||(bz.instance=new bz),bz.instance}buildEnvelope(e){let r=qon.map(s=>this.buildLayer(s,e.layerSegments[s]??[])),n=this.serializeLayers(r),o=this.collectLayerHashes(r),i=this.hash(n),a=typeof e.metadata?.debugLabel=="string"?e.metadata.debugLabel:void 0;return a&&F(`[PromptContextEngine] Built envelope for ${a}`,o),{version:bz.ENVELOPE_VERSION,conversationId:e.conversationId,messageId:e.messageId,layers:r,serializedText:n,layerHashes:o,combinedHash:i,debug:{warnings:this.collectWarnings(r)}}}buildLayer(e,r){let n=r.map((i,a)=>({...i,id:i.id||`${e}-segment-${a}`,content:this.normalizeWhitespace(i.content),stable:i.stable??!0})),o=this.normalizeWhitespace(n.map(i=>i.content).filter(Boolean).join(`
|
||
|
||
`));return{id:e,label:Uon[e],text:o,segments:n,stable:n.every(i=>i.stable),metadata:n.length===1?n[0].metadata:void 0,hash:this.hash(o)}}serializeLayers(e){return e.map(r=>r.text).filter(r=>r.length>0).join(`
|
||
|
||
`)}collectLayerHashes(e){return e.reduce((r,n)=>(r[n.id]=n.hash,r),{})}hash(e){return(0,Bon.SHA256)(e||"").toString()}normalizeWhitespace(e){return e.replace(/\s+$/g,"").trim()}collectWarnings(e){let r=[];return e.forEach(n=>{if(!n.text)return;n.text.includes("\0")&&r.push(`Layer ${n.id} contains control characters and was normalized`)}),r}};bz.ENVELOPE_VERSION=1;var Yqe=bz;function Vwi(t){let e=/<path>([^<]+)<\/path>/.exec(t);if(e)return e[1];let r=/<url>([^<]+)<\/url>/.exec(t);if(r)return r[1];let n=/<name>([^<]+)<\/name>/.exec(t);return n?n[1]:""}function Hwi(t,e,r,n={}){let o=n.verbatimThreshold??nS.verbatimThreshold;if(t.length<=o)return t;let i=n.previewCharsPerSection??nS.previewCharsPerSection,a=n.maxSections??nS.maxSections,s=aW(t,i,a);return`<prior_context source="${Gje(e)}" type="${r}">
|
||
${s}
|
||
</prior_context>`}function BSt(t,e,r={}){if(!Kje(e))return t;let n=r.verbatimThreshold??nS.verbatimThreshold;if(t.length<=n)return t;let o=tZ(t,e)||Vwi(t),i=Hce(t),a=iW(e);return Hwi(i,o,a,r)}function zon(){return`<prior_context_note>
|
||
The above prior_context blocks contain previews of content from earlier turns.
|
||
To access full content: use [[note title]] for notes, or ask to read a specific URL/video.
|
||
</prior_context_note>`}function Von(t,e){if(!t.trim())return[];let r=[],o=[...Vce.map(u=>u.tag),"prior_context"],i=new RegExp(`<(${o.join("|")})(\\s[^>]*)?>[\\s\\S]*?</\\1>`,"g"),a=new Map,s;for(;(s=i.exec(t))!==null;){let u=s[0],l=s[1];if(l==="prior_context"){let d=/source="([^"]+)"/.exec(u)?.[1]??"prior_context";r.push({id:d,content:u,stable:e,metadata:{source:"previous_turns_compacted",notePath:d}})}else{let c=tZ(u,l),d;if(c)d=c;else{let p=(a.get(l)||0)+1;a.set(l,p),d=p===1?l:`${l}:${p}`}let f=iW(l)==="note";r.push({id:d,content:u,stable:e,metadata:{source:e?"previous_turns":"current_turn",...f?{notePath:d}:{}}})}}return r}ra();mr();Xe();jW();jZ();Bt();qZ();var npe=require("obsidian");mr();var Qqe=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 npe.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
|
||
|
||
<${$te}>
|
||
<name>${s}</name>
|
||
<content>
|
||
${l}
|
||
</content>
|
||
</${$te}>
|
||
|
||
`)}catch(l){ne(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
|
||
|
||
<${$te}>
|
||
<name>${s}</name>
|
||
<error>Could not process PDF</error>
|
||
</${$te}>
|
||
|
||
`)}}return e}async processDataviewBlocks(e,r){let n=app.plugins?.plugins?.dataview;if(!n)return e;let o=n.api;if(!o)return e;let i=/```(dataview|dataviewjs)\s*\n([\s\S]*?)```/g,a=[...e.matchAll(i)];for(let s=a.length-1;s>=0;s--){let u=a[s],l=u[1],c=u[2].trim(),d=u.index,f=d+u[0].length;try{let p=await Promise.race([this.executeDataviewQuery(o,c,l,r),new Promise((h,y)=>setTimeout(()=>y(new Error("Query timeout")),5e3))]),m=`
|
||
|
||
<${Lte}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<executed_result>
|
||
${p}
|
||
</executed_result>
|
||
</${Lte}>
|
||
|
||
`;e=e.slice(0,d)+m+e.slice(f)}catch(p){ne("Error executing Dataview query:",p);let m=`
|
||
|
||
<${Lte}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<error>${p instanceof Error?p.message:"Query execution failed"}</error>
|
||
</${Lte}>
|
||
|
||
`;e=e.slice(0,d)+m+e.slice(f)}}return e}async executeDataviewQuery(e,r,n,o){if(n==="dataviewjs")return"[DataviewJS execution not yet supported - showing original query]";let i=await e.query(r,o);if(!i.successful)throw new Error(i.error||"Query failed");return this.formatDataviewResult(i.value)}formatDataviewResult(e){return e?e.type==="list"?this.formatDataviewList(e.values):e.type==="table"?this.formatDataviewTable(e.headers,e.values):e.type==="task"?this.formatDataviewTasks(e.values):Array.isArray(e)?e.map(r=>this.formatDataviewValue(r)).join(`
|
||
`):String(e):"No results"}formatDataviewList(e){return!e||e.length===0?"No results":e.map(r=>`- ${this.formatDataviewValue(r)}`).join(`
|
||
`)}formatDataviewTable(e,r){if(!r||r.length===0)return"No results";let n=`| ${e.join(" | ")} |
|
||
`;n+=`| ${e.map(()=>"---").join(" | ")} |
|
||
`;for(let o of r)n+=`| ${o.map(i=>this.formatDataviewValue(i)).join(" | ")} |
|
||
`;return n}formatDataviewTasks(e){return!e||e.length===0?"No results":e.map(r=>`- ${r.completed?"[x]":"[ ]"} ${this.formatDataviewValue(r.text||r)}`).join(`
|
||
`)}formatDataviewValue(e){return e==null?"":e&&typeof e=="object"&&e.path?`[[${e.path}]]`:Array.isArray(e)?e.map(r=>this.formatDataviewValue(r)).join(", "):String(e)}async buildMarkdownContextContent(e,r,n,o){let i=await n.parseFile(e,r);return i=await this.processEmbeddedNotes(i,e,r,n,o),zb(o)&&(i=await this.processEmbeddedPDFs(i,r,n)),await this.processDataviewBlocks(i,e.path)}async processEmbeddedNotes(e,r,n,o,i){let a=/!\[\[([^\]]+)\]\]/g,s,u=0,l="";for(;(s=a.exec(e))!==null;){l+=e.slice(u,s.index);let c=s[1].trim(),d=await this.buildEmbeddedNoteBlock(c,s[0],r,n,o,i);l+=d,u=s.index+s[0].length}return l+=e.slice(u),l}async buildEmbeddedNoteBlock(e,r,n,o,i,a){let s=this.parseEmbeddedLinkTarget(e);if(!s)return r;let u=s.path===null?n:app.metadataCache.getFirstLinkpathDest(s.path,n.path);if(!(u instanceof npe.TFile))return this.formatEmbeddedNoteBlock({title:s.path??n.basename,path:s.path??n.path,heading:s.heading,blockId:s.blockId,error:"Embedded note not found"});if(u.extension!=="md")return r;try{let l=await i.parseFile(u,o);if(s.heading||s.blockId){let c=this.extractMarkdownSegment(u,l,s);if(!c.found){let d=s.blockId?`block reference "${s.blockId}"`:`heading "${s.heading??""}"`;throw new Error(`Embedded note ${d} not found in ${u.path}`)}l=c.content}return zb(a)&&(l=await this.processEmbeddedPDFs(l,o,i)),l=await this.processDataviewBlocks(l,u.path),this.formatEmbeddedNoteBlock({title:u.basename,path:u.path,heading:s.heading,blockId:s.blockId,content:l})}catch(l){Te("Failed to process embedded note",l);let c=l instanceof Error?l.message:"Could not process embedded note";return this.formatEmbeddedNoteBlock({title:u.basename,path:u.path,heading:s.heading,blockId:s.blockId,error:c})}}parseEmbeddedLinkTarget(e){if(!e)return null;let r=e.indexOf("|"),o=(r>=0?e.slice(0,r):e).trim();if(!o)return{path:null};let i,a,s=o.indexOf("#^");s!==-1&&(i=o.slice(s+2).trim(),o=o.slice(0,s));let u=o.indexOf("#");return u!==-1&&(a=o.slice(u+1).trim(),o=o.slice(0,u)),{path:o.length>0?o:null,heading:a&&a.length>0?a:void 0,blockId:i&&i.length>0?i:void 0}}extractMarkdownSegment(e,r,n){let o=app.metadataCache.getFileCache(e);if(n.blockId){let i=o?.blocks?.[n.blockId],a=i?.position?.start?.offset,s=i?.position?.end?.offset;return a===void 0||s===void 0?{content:"",found:!1}:{content:r.slice(a,s),found:!0}}if(n.heading){let i=o?.headings??[],a=this.normalizeHeadingForMatch(n.heading),s=i.findIndex(d=>this.normalizeHeadingForMatch(d.heading)===a);if(s===-1)return{content:"",found:!1};let u=i[s],l=u.position?.start?.offset??0,c=r.length;for(let d=s+1;d<i.length;d++)if(i[d].level<=u.level){c=i[d].position?.start?.offset??c;break}return{content:r.slice(l,c),found:!0}}return{content:r,found:!0}}normalizeHeadingForMatch(e){return e.trim().toLowerCase().replace(/\s+/g," ")}formatEmbeddedNoteBlock(e){let{title:r,path:n,heading:o,blockId:i,content:a,error:s}=e,u=`
|
||
|
||
<${SWe}>
|
||
<title>${r}</title>
|
||
<path>${n}</path>`;return o&&(u+=`
|
||
<heading>${o}</heading>`),i&&(u+=`
|
||
<block_id>${i}</block_id>`),s?u+=`
|
||
<error>${s}</error>`:u+=`
|
||
<content>
|
||
${a??""}
|
||
</content>`,u+=`
|
||
</${SWe}>
|
||
|
||
`,u}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=Dte)=>{try{if(e.has(d.path)){F(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(!r.supportsExtension(d.extension)){Te(`Unsupported file type: ${d.extension}`);return}if(!zb(s)&&d.extension!=="md"&&d.extension!=="canvas"){Te(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new npe.Notice(YJ.NON_MARKDOWN_FILES_RESTRICTED);return}let p=d.extension==="md"?await this.buildMarkdownContextContent(d,n,r,s):await r.parseFile(d,n),m=await n.adapter.stat(d.path),h=m?new Date(m.ctime).toISOString():"Unknown",y=m?new Date(m.mtime).toISOString():"Unknown";u+=`
|
||
|
||
<${f}>
|
||
<title>${Rc(d.basename)}</title>
|
||
<path>${d.path}</path>
|
||
<ctime>${h}</ctime>
|
||
<mtime>${y}</mtime>
|
||
<content>
|
||
${p}
|
||
</content>
|
||
</${f}>`}catch(p){ne(`Error processing file ${d.path}:`,p),u+=`
|
||
|
||
<${f}_error>
|
||
<title>${Rc(d.basename)}</title>
|
||
<path>${d.path}</path>
|
||
<error>[Error: Could not process file]</error>
|
||
</${f}_error>`}},c=new Set;i&&a&&(await l(a,"active_note"),c.add(a.path));for(let d of o)c.has(d.path)||(await l(d),c.add(d.path));return u}async hasEmbeddedPDFs(e){return/!\[\[(.*?\.pdf)\]\]/g.test(e)}async addNoteToContext(e,r,n,o,i,a){if(n.some(l=>l.path===e.path))return;let s=await r.read(e),u=await this.hasEmbeddedPDFs(s);o&&e.path===o.path&&a(!0),i(l=>[...l,Object.assign(e,{wasAddedViaReference:!0,hasEmbeddedPDFs:u})])}processSelectedTextContexts(){let e=tx();if(!e||e.length===0)return"";let r="";for(let n of e)n.sourceType==="web"?r+=`
|
||
|
||
<${wWe}>
|
||
<title>${Rc(n.title)}</title>
|
||
<url>${Rc(n.url)}</url>
|
||
<content>
|
||
${Rc(n.content)}
|
||
</content>
|
||
</${wWe}>`:r+=`
|
||
|
||
<${q_}>
|
||
<title>${Rc(n.noteTitle)}</title>
|
||
<path>${Rc(n.notePath)}</path>
|
||
<start_line>${n.startLine.toString()}</start_line>
|
||
<end_line>${n.endLine.toString()}</end_line>
|
||
<content>
|
||
${n.content}
|
||
</content>
|
||
</${q_}>`;return r}async processContextWebTabs(e){if(!e||e.length===0)return"";let r=2500,n=8e3,o=15e3,i=2,a=(b,_)=>{let w=[`
|
||
|
||
<${b}>`,`
|
||
<title>${Rc(_.title)}</title>`,`
|
||
<url>${Rc(_.url)}</url>`];return _.mode&&w.push(`
|
||
<mode>${Rc(_.mode)}</mode>`),_.error?w.push(`
|
||
<error>${Rc(_.error)}</error>`):_.content!==void 0&&w.push(`
|
||
<content>
|
||
${Rc(_.content)}
|
||
</content>`),w.push(`
|
||
</${b}>`),w.join("")},s=b=>{let _=[`
|
||
|
||
<${TWe}>`,`
|
||
<title>${Rc(b.title)}</title>`,`
|
||
<url>${Rc(b.url)}</url>`,`
|
||
<video_id>${Rc(b.videoId)}</video_id>`];b.isActive&&_.push(`
|
||
<is_active>true</is_active>`),b.channel&&_.push(`
|
||
<channel>${Rc(b.channel)}</channel>`),b.uploadDate&&_.push(`
|
||
<upload_date>${Rc(b.uploadDate)}</upload_date>`),b.duration&&_.push(`
|
||
<duration>${Rc(b.duration)}</duration>`),b.genre&&_.push(`
|
||
<genre>${Rc(b.genre)}</genre>`),b.description&&_.push(`
|
||
<description>${Rc(b.description)}</description>`),b.error&&_.push(`
|
||
<error>${Rc(b.error)}</error>`);let w=b.transcript||"No transcript available for this video";return _.push(`
|
||
<content>
|
||
${Rc(w)}
|
||
</content>`),_.push(`
|
||
</${TWe}>`),_.join("")},u=null,l=[],c=new Set,d=new Set,f=_d(app),p=b=>{let _=f.getYouTubeVideoId(b);return _?d.has(_)?!0:(d.add(_),!1):c.has(b)?!0:(c.add(b),!1)};for(let b of e){let _=_b(b.url);_&&b.isActive&&!u&&(u={...b,url:_},p(_))}for(let b of e){let _=_b(b.url);!_||p(_)||l.push({...b,url:_})}if(!u&&l.length===0)return"";let m=f.getAvailability();if(!m.supported||!m.available){let b=m.reason??(m.supported?"Web Viewer is not available.":"Web Viewer is not supported on this platform."),_=[];u&&_.push(a(vye,{title:u.title||"Unknown",url:u.url,error:b}));for(let w of l)_.push(a(xWe,{title:w.title||"Unknown",url:w.url,error:b}));return _.join("")}let h=async(b,_)=>{try{let w=b.url,T=f.getYouTubeVideoId(w);if(T)return await y(b,T,_===vye);let O=f.findLeafByUrl(w,{title:b.title});if(!O)return a(_,{title:b.title||"Unknown",url:w,error:"Web tab not found or closed"});let E=f.getPageInfo(O),P=O.view;if(!(P.webviewMounted===void 0||P.webviewFirstLoadFinished===void 0?!0:!!(P.webviewMounted&&P.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(O,r),E=f.getPageInfo(O)}catch(z){return Te(`Web tab content not loaded yet for ${w}:`,z),a(_,{title:E.title||b.title||"Untitled",url:E.url||w,mode:E.mode,error:"Web tab content not loaded yet"})}let I=new AbortController,N=setTimeout(()=>{I.abort()},n);try{let z=await f.getReaderModeMarkdown(O,{signal:I.signal});return E=f.getPageInfo(O),a(_,{title:E.title||b.title||"Untitled",url:E.url||w,mode:E.mode,content:z})}finally{clearTimeout(N)}}catch(w){return ne(`Error processing web tab ${b.url}:`,w),a(_,{title:b.title||"Unknown",url:b.url,error:w instanceof PB?"Web tab content extraction timed out":"Could not process web tab"})}},y=async(b,_,w)=>{try{let T=null,O=b.url;for(let N of f.getLeaves()){let z=f.getPageInfo(N).url;if(f.getYouTubeVideoId(z)===_){T=N,O=z;break}}if(!T)return s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:"Web tab not found or closed"});let E=T.view;if(!(E.webviewMounted===void 0||E.webviewFirstLoadFinished===void 0?!0:!!(E.webviewMounted&&E.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(T,r)}catch(N){return Te(`YouTube tab content not loaded yet for ${O}:`,N),s({title:b.title||"YouTube Video",url:O,videoId:_,isActive:w,error:"Web tab content not loaded yet"})}let R=await f.getYouTubeTranscript(T,{timeoutMs:o}),I=R.transcript.length>0?R.transcript.map(N=>`${N.timestamp}: ${N.text}`).join(`
|
||
`):void 0;return s({title:R.title||b.title||"YouTube Video",url:O,videoId:R.videoId,channel:R.channel,description:R.description,uploadDate:R.uploadDate,duration:R.duration,genre:R.genre,transcript:I,isActive:w})}catch(T){return Te(`YouTube transcript extraction failed for ${b.url}:`,T),s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:T instanceof Error?T.message:"Failed to extract video info"})}},g=[];if(u){let b=await h(u,vye);g.push(b)}for(let b=0;b<l.length;b+=i){let _=l.slice(b,b+i),w=await Promise.all(_.map(T=>h(T,xWe)));g.push(...w)}return g.join("")}};Xe();Ye();Bt();var VSt=null;async function Wwi(){return VSt||(VSt=(await Promise.resolve().then(()=>(Won(),Hon))).ContextCompactor),VSt.getInstance()}var eUe=class t{constructor(){this.contextProcessor=Qqe.getInstance(),this.mention=s9.getInstance(),this.promptContextEngine=Yqe.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a,s,u,l=[],c){try{F(`[ContextManager] Processing context for message ${e.id}`);let d=e.originalMessage||e.message,{processedPrompt:f,includedFiles:p}=await sde(d,"",n,a),{l2Context:m,l2Paths:h}=this.buildL2ContextFromPreviousTurns(e.id,s),y=e.context?.urls||[],g=o==="copilot_plus"?await this.mention.processUrlList(y):{urlContext:"",imageUrls:[]},b=new Set([...p.map(W=>W.path),...l.map(W=>W.path),...h]),_=new Set,T=(e.context?.notes||[]).filter(W=>!h.has(W.path));i&&o!=="project"&&a&&!b.has(a.path)&&!T.some(W=>W.path===a.path)&&T.push(a);let O=await this.contextProcessor.processContextNotes(b,r,n,T,i,a,o);T.forEach(W=>{b.add(W.path),_.add(W.path)});let E=e.context?.tags||[],P="",R=[];if(E.length>0){let ie=mye(n,E).filter(j=>!b.has(j.path));ie.length>0&&(P=await this.contextProcessor.processContextNotes(new Set,r,n,ie,!1,null,o),ie.forEach(j=>{b.add(j.path),_.add(j.path),R.push(j.path)}))}let I=e.context?.folders||[],N="",z=[];if(I.length>0){let ie=I.flatMap(j=>Ote(n,j)).filter(j=>!b.has(j.path));ie.length>0&&(N=await this.contextProcessor.processContextNotes(new Set,r,n,ie,!1,null,o),ie.forEach(j=>{b.add(j.path),_.add(j.path),z.push(j.path)}))}let V=this.contextProcessor.processSelectedTextContexts(),k=e.context?.webTabs||[],X=await this.contextProcessor.processContextWebTabs(k),B=m+O+P+N+g.urlContext+V+X,Q=f+B,oe=(o==="project"?1e6:te().autoCompactThreshold)*4,ue=!1,de=B;if(Q.length>oe){c?.(dw.COMPACTING);let ie=await(await Wwi()).compact(B);ie.wasCompacted&&(de=ie.content,Q=f+de,ue=!0,F(`[ContextManager] Compacted context: ${ie.originalCharCount} -> ${ie.compactedCharCount} chars`)),c?.(dw.DEFAULT)}F(`[ContextManager] Successfully processed context for message ${e.id}`);let L=ue?this.buildCompactedEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,compactedContext:de,compactedPaths:Array.from(_)}):this.buildPromptContextEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,l2PreviousContext:m,noteContextAddition:O,tagContextAddition:P,tagNotePaths:R,folderContextAddition:N,folderNotePaths:z,urlContext:g.urlContext,selectedText:V,webTabContext:X});return{processedContent:Q,contextEnvelope:L}}catch(d){return F(`[ContextManager] Error processing context for message ${e.id}:`,d),{processedContent:e.originalMessage||e.message,contextEnvelope:void 0}}}async reprocessMessageContext(e,r,n,o,i,a,s,u,l=[]){let c=r.getMessage(e);if(!c||c.sender!=="user"||!c.id)return;F(`[ContextManager] Reprocessing context for message ${e}`);let{processedContent:d,contextEnvelope:f}=await this.processMessageContext(c,n,o,i,a,s,r,u,l);r.updateProcessedText(c.id,d,f),F(`[ContextManager] Completed context reprocessing for message ${e}`)}buildL2ContextFromPreviousTurns(e,r){let n=r.getDisplayMessages(),o=n.findIndex(p=>p.id===e);if(o===-1||o===0)return{l2Context:"",l2Paths:new Set};let i=n.slice(0,o).filter(p=>p.sender==="user"),a=new Map,s=[],u=new Set,l=-1;for(let p=i.length-1;p>=0;p--)if(i[p].contextEnvelope?.layers?.find(g=>g.id==="L3_TURN")?.segments?.some(g=>g.metadata?.wasCompacted)){l=p;break}for(let p=0;p<i.length;p++){let h=i[p].contextEnvelope?.layers?.find(y=>y.id==="L3_TURN");if(h){if(p>=l){for(let y of h.segments||[])if(y.content){let g=this.compactSegmentForL2(y.content);a.has(y.id)||s.push(y.id),a.set(y.id,g)}}for(let y of h.segments||[]){if(y.metadata?.notePath&&u.add(y.metadata.notePath),y.metadata?.compactedPaths)for(let g of y.metadata.compactedPaths)u.add(g);if(y.metadata?.notePaths)for(let g of y.metadata.notePaths)u.add(g)}}}let c=s.map(p=>a.get(p)).join(`
|
||
`);return{l2Context:c.includes("<prior_context ")?c+`
|
||
|
||
`+zon():c,l2Paths:u}}buildPromptContextEnvelope(e){let r=e.message.id;if(!r)return;let n={};if(e.systemPrompt&&(n.L1_SYSTEM=[{id:"system",content:e.systemPrompt,stable:!0,metadata:{source:"system_prompt"}}]),e.l2PreviousContext){let i=this.parseContextIntoSegments(e.l2PreviousContext,!0);i.length>0&&(n.L2_PREVIOUS=i)}let o=[];if(e.noteContextAddition){let i=this.parseContextIntoSegments(e.noteContextAddition,!1);o.push(...i)}return this.appendParsedSegments(o,e.tagContextAddition,{source:"tags",notePaths:e.tagNotePaths}),this.appendParsedSegments(o,e.folderContextAddition,{source:"folders",notePaths:e.folderNotePaths}),this.appendParsedSegments(o,e.urlContext),this.appendParsedSegments(o,e.selectedText),this.appendParsedSegments(o,e.webTabContext),o.length>0&&(n.L3_TURN=o),n.L5_USER=[{id:`${r}-user`,content:e.processedUserMessage,stable:!1,metadata:{source:"user_input"}}],this.promptContextEngine.buildEnvelope({conversationId:null,messageId:r,layerSegments:n,metadata:{debugLabel:`message:${r}`,chainType:e.chainType}})}buildCompactedEnvelope(e){let r=e.message.id;if(!r)return;let n={};return e.systemPrompt&&(n.L1_SYSTEM=[{id:"system",content:e.systemPrompt,stable:!0,metadata:{source:"system_prompt"}}]),e.compactedContext.trim()&&(n.L3_TURN=[{id:"compacted_context",content:e.compactedContext,stable:!1,metadata:{source:"compacted",wasCompacted:!0,compactedPaths:e.compactedPaths}}]),n.L5_USER=[{id:`${r}-user`,content:e.processedUserMessage,stable:!1,metadata:{source:"user_input"}}],this.promptContextEngine.buildEnvelope({conversationId:null,messageId:r,layerSegments:n,metadata:{debugLabel:`message:${r}:compacted`,chainType:e.chainType}})}parseContextIntoSegments(e,r){return Von(e,r)}appendParsedSegments(e,r,n){let o=(r||"").trim();if(!o)return;let i=this.parseContextIntoSegments(o,!1);if(i.length>0)for(let a of i)n&&(a.metadata={...a.metadata,...n}),e.push(a);else e.push({id:`unparsed-${Date.now()}`,content:o,stable:!1,metadata:{source:"unparsed",...n}})}createMessageContext(e,r,n=tx()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await kS(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return tx()}compactSegmentForL2(e){let r=Vce.map(a=>a.tag).join("|"),n=new RegExp(`<(${r})[^>]*>[\\s\\S]*?</\\1>`,"g"),o=e.match(n);if(!o||o.length===0)return e;if(o.length===1){let a=pgt(o[0]);return a?BSt(o[0],a):e}return o.map(a=>{let s=pgt(a);return s?BSt(a,s):a}).join(`
|
||
|
||
`)}};Bt();Xe();var lQ=class{constructor(){this.messages=[]}generateId(){return`msg-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}addMessage(e,r,n,o,i){if(typeof e=="object"){let c=e,d=c.id||this.generateId(),f=c.timestamp||Mg(new Date),p={id:d,displayText:c.message,processedText:c.originalMessage||c.message,sender:c.sender,timestamp:f,context:c.context,contextEnvelope:c.contextEnvelope,isVisible:c.isVisible!==!1,isErrorMessage:c.isErrorMessage,sources:c.sources,content:c.content,responseMetadata:c.responseMetadata};return this.messages.push(p),F(`[MessageRepository] Added message with ID: ${d}`),d}if(r===void 0||n===void 0)throw new Error("processedText and sender are required when using string-based addMessage");let a=e,s=this.generateId(),u=Mg(new Date),l={id:s,displayText:a,processedText:r,sender:n,timestamp:u,context:o,contextEnvelope:void 0,isVisible:!0,isErrorMessage:!1,content:i};return this.messages.push(l),F(`[MessageRepository] Added message with ID: ${s}`),s}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(F(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?F(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,F(`[MessageRepository] Edited AI message ${e}`)),!0):(F(`[MessageRepository] Message not found for edit: ${e}`),!1)}updateProcessedText(e,r,n){let o=this.messages.find(i=>i.id===e);return o?(o.processedText=r,o.contextEnvelope=n,F(`[MessageRepository] Updated processed text for message ${e}`),!0):(F(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(F(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),F(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],F("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),F(`[MessageRepository] Truncated messages after index ${e}`)}truncateAfterMessageId(e){let r=this.messages.findIndex(n=>n.id===e);r!==-1&&(this.messages=this.messages.slice(0,r+1),F(`[MessageRepository] Truncated messages after message ${e}`))}getDisplayMessages(){return this.messages.filter(e=>e.isVisible).map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!0,context:e.context,contextEnvelope:e.contextEnvelope,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content,responseMetadata:e.responseMetadata}))}getLLMMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.processedText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:!1,context:r.context,contextEnvelope:r.contextEnvelope,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content,responseMetadata:r.responseMetadata}}getLLMMessages(){return this.messages.map(e=>({id:e.id,message:e.displayText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!1,context:e.context,contextEnvelope:e.contextEnvelope,isErrorMessage:e.isErrorMessage,sources:e.sources,content:e.content}))}getMessage(e){let r=this.messages.find(n=>n.id===e);if(r)return{id:r.id,message:r.displayText,originalMessage:r.displayText,sender:r.sender,timestamp:r.timestamp,isVisible:r.isVisible,context:r.context,contextEnvelope:r.contextEnvelope,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content}}loadMessages(e){this.clear(),e.forEach(r=>{this.messages.push({id:r.id||this.generateId(),displayText:r.message,processedText:r.originalMessage||r.message,sender:r.sender,timestamp:r.timestamp||Mg(new Date),context:r.context,contextEnvelope:r.contextEnvelope,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),F(`[MessageRepository] Loaded ${e.length} messages`)}getDebugInfo(){return{totalMessages:this.messages.length,visibleMessages:this.messages.filter(e=>e.isVisible).length,userMessages:this.messages.filter(e=>e.sender==="user"||e.sender==="USER").length,aiMessages:this.messages.filter(e=>e.sender==="AI"||e.sender==="assistant").length}}};ra();mr();Xe();Ye();Bt();var Jon=require("obsidian");async function HSt(t,e){let r=t.vault.getAbstractFileByPath(e);return r||(await t.vault.adapter.exists(e)?Kon(t,e):null)}function WSt(t,e){return t.vault.getAbstractFileByPath(e)!=null}async function tUe(t,e){let r=t.vault.getAbstractFileByPath(e);if(r instanceof Jon.TFolder)return t.vault.getMarkdownFiles().filter(n=>n.path.startsWith(r.path));if(await t.vault.adapter.exists(e)){let o=(await t.vault.adapter.list(e)).files.filter(a=>a.endsWith(".md")),i=[];for(let a of o)i.push(await Kon(t,a));return i}return[]}async function ope(t,e,r){let n=t.vault.getAbstractFileByPath(e);if(n&&t.fileManager?.processFrontMatter){await t.fileManager.processFrontMatter(n,a=>{for(let[s,u]of Object.entries(r))a[s]=u});return}if(!await t.vault.adapter.exists(e))return;let o=await t.vault.adapter.read(e),i=o.replace(/^(---\n[\s\S]*?)(---)/,(a,s,u)=>{let l=s;for(let[c,d]of Object.entries(r)){let f=typeof d=="string"?`"${d.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:String(d),p=new RegExp(`^${c}:\\s*.+`,"m");p.test(l)?l=l.replace(p,`${c}: ${f}`):l+=`${c}: ${f}
|
||
`}return l+u});i!==o&&await t.vault.adapter.write(e,i)}async function JSt(t,e){let n=(await t.vault.adapter.read(e)).match(/^---\n([\s\S]*?)\n---/)?.[1];if(!n)return null;let o={};for(let i of n.split(`
|
||
`)){let a=i.match(/^(\w+):\s*(.+)/);a&&(o[a[1]]=a[2].trim().replace(/^["']|["']$/g,""))}return o}async function Kon(t,e){let r=await t.vault.adapter.stat(e),n=e.split("/").pop()??"";return{path:e,name:n,basename:n.replace(/\.md$/,""),extension:"md",stat:r??{ctime:Date.now(),mtime:Date.now(),size:0},vault:t.vault,parent:null}}var C_=require("obsidian"),KSt=100;function Jwi(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}var ipe=class{constructor(e,r,n){this.app=e;this.messageRepo=r;this.chainManager=n}async saveChat(e){try{let r=this.messageRepo.getDisplayMessages();if(r.length===0){new C_.Notice("No messages to save.");return}let n=te(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();await $c(n.defaultSaveFolder);let a=await this.findFileByEpoch(i),s=a?this.app.metadataCache.getFileCache(a)?.frontmatter:void 0,u=s?.topic,l=s?.lastAccessedAt;if(a&&!s)try{let m=await JSt(this.app,a.path);m&&(m.topic&&(u=m.topic),m.lastAccessedAt&&(l=Number(m.lastAccessedAt)))}catch{}let c=a?a.path:this.generateFileName(r,i,u),d=this.generateNoteContent(o,i,e,u,l),f=a,p=a!=null&&WSt(this.app,a.path);if(a&&p)await this.app.vault.modify(a,d),F(`[ChatPersistenceManager] Updated existing chat file: ${a.path}`);else if(!WSt(this.app,c)&&await this.app.vault.adapter.exists(c))await this.app.vault.adapter.write(c,d),new C_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Updated existing chat file via adapter: ${c}`);else try{f=await this.app.vault.create(c,d),new C_.Notice(`Chat saved as note: ${c}`),F(`[ChatPersistenceManager] Created new chat file: ${c}`)}catch(m){if(this.isFileAlreadyExistsError(m)){let h=this.app.vault.getAbstractFileByPath(c);if(h&&h instanceof C_.TFile){let y=this.app.metadataCache.getFileCache(h)?.frontmatter;u=y?.topic??u;let g=y?.lastAccessedAt,b=this.generateNoteContent(o,i,e,u,g);await this.app.vault.modify(h,b),f=h,new C_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved save conflict by updating existing chat file: ${h.path}`)}else await this.app.vault.adapter.write(c,d),new C_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved save conflict via adapter: ${c}`)}else if(this.isNameTooLongError(m)){let h=Gu(),y=h?`${h.id}__`:"",g=`${n.defaultSaveFolder}/${y}chat-${i}.md`;try{f=await this.app.vault.create(g,d),new C_.Notice(`Chat saved as note: ${g}`),Te(`[ChatPersistenceManager] Used minimal filename due to length constraints: ${g}`)}catch(b){if(this.isFileAlreadyExistsError(b)){let _=this.app.vault.getAbstractFileByPath(g);if(_&&_ instanceof C_.TFile){let w=this.app.metadataCache.getFileCache(_)?.frontmatter,T=w?.lastAccessedAt,O=w?.topic,E=this.generateNoteContent(o,i,e,O,T);await this.app.vault.modify(_,E),f=_,new C_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved fallback save conflict by updating existing chat file: ${_.path}`)}else await this.app.vault.adapter.write(g,d),new C_.Notice("Existing chat note found - updating it now."),F(`[ChatPersistenceManager] Resolved fallback save conflict via adapter: ${g}`)}else throw b}}else throw m}this.generateTopicAsyncIfNeeded(r,f,u)}catch(r){ne("[ChatPersistenceManager] Error saving chat:",r),new C_.Notice("Failed to save chat as note. Check console for details.")}}async loadChat(e){try{let r;try{r=await this.app.vault.read(e)}catch{r=await this.app.vault.adapter.read(e.path)}let n=this.parseChatContent(r);return F(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ne("[ChatPersistenceManager] Error loading chat:",r),new C_.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=te(),r=await tUe(this.app,e.defaultSaveFolder);if(r.length===0)return[];let n=Gu();return r.filter(o=>n?o.basename.startsWith(`${n.id}__`):!o.basename.includes("__")||!o.basename.split("__")[0])}formatChatContent(e){return e.map(r=>{let n=r.timestamp?r.timestamp.display:"Unknown time",o=r.message;if(r.sender===cw){let a=Bce(o);a&&(o=a.contentAfter)}let i=`**${r.sender}**: ${o}`;if(r.context){let a=[];r.context.notes?.length&&a.push(`Notes: ${r.context.notes.map(s=>s.path).join(", ")}`),r.context.urls?.length&&a.push(`URLs: ${r.context.urls.join(", ")}`),r.context.webTabs?.length&&a.push(`Web Tabs: ${r.context.webTabs.map(s=>s.url).join(", ")}`),r.context.tags?.length&&a.push(`Tags: ${r.context.tags.join(", ")}`),r.context.folders?.length&&a.push(`Folders: ${r.context.folders.join(", ")}`),a.length>0&&(i+=`
|
||
[Context: ${a.join(" | ")}]`)}return i+=`
|
||
[Timestamp: ${n}]`,i}).join(`
|
||
|
||
`)}parseChatContent(e){let r=[],n=e.match(/^---\n([\s\S]*?)\n---/),o=e;n&&(o=e.slice(n[0].length).trim());let i=/\*\*(user|ai)\*\*: ([\s\S]*?)(?=(?:\n\*\*(?:user|ai)\*\*: )|$)/g,a;for(;(a=i.exec(o))!==null;){let s=a[1]==="user"?Zs:cw,u=a[2].trim(),l=u.split(`
|
||
`),c=u,d="Unknown time",f,p=l.length;if(l[p-1]?.startsWith("[Timestamp: ")){let h=l[p-1].match(/\[Timestamp: (.*?)\]/);h&&(d=h[1],p--)}if(p>0&&l[p-1]?.startsWith("[Context: ")){let h=l[p-1].match(/\[Context: (.*?)\]/);if(h){let y=h[1];f=this.parseContextString(y),p--}}if(c=l.slice(0,p).join(`
|
||
`).trim(),s===cw){c=c.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,"");let h=Bce(c);h&&(c=h.contentAfter),c=c.replace(/\n{3,}/g,`
|
||
|
||
`).trim()}let m;if(d!=="Unknown time"){let h=new Date(d);isNaN(h.getTime())||(m=h.getTime())}r.push({message:c,sender:s,isVisible:!0,timestamp:m?{epoch:m,display:d,fileName:""}:null,context:f})}return r}parseContextString(e){let r={notes:[],urls:[],tags:[],folders:[],webTabs:[]},n=e.split(" | ");for(let o of n){let i=o.trim();if(i.startsWith("Notes: ")){let a=i.substring(7);a&&(r.notes=a.split(", ").map(s=>{let u=s.trim(),l=this.app.vault.getAbstractFileByPath(u);if(l instanceof C_.TFile)return l;let c=u.includes("/")?u.split("/").pop():u,d=this.app.vault.getMarkdownFiles().filter(f=>f.basename===c);return d.length===1?(F(`[ChatPersistenceManager] Resolved legacy basename "${c}" to ${d[0].path}`),d[0]):(d.length>1?Te(`[ChatPersistenceManager] Ambiguous basename "${c}", skipping. Matches: ${d.map(f=>f.path).join(", ")}`):Te(`[ChatPersistenceManager] Note not found: ${u}`),null)}).filter(s=>s!==null))}else if(i.startsWith("URLs: ")){let a=i.substring(6);a&&(r.urls=a.split(", ").map(s=>s.trim()))}else if(i.startsWith("Web Tabs: ")||i.startsWith("WebTabs: ")){let a=i.startsWith("Web Tabs: ")?i.substring(10):i.substring(9);a&&(r.webTabs=a.split(", ").map(s=>s.trim()).filter(s=>s.length>0).map(s=>({url:s})))}else if(i.startsWith("Tags: ")){let a=i.substring(6);a&&(r.tags=a.split(", ").map(s=>s.trim()))}else if(i.startsWith("Folders: ")){let a=i.substring(9);a&&(r.folders=a.split(", ").map(s=>s.trim()))}}if(r.notes.length>0||r.urls.length>0||r.tags.length>0||r.folders.length>0||r.webTabs.length>0)return r}async findFileByEpoch(e){let r=await this.getChatHistoryFiles();for(let n of r){let o=this.app.metadataCache.getFileCache(n)?.frontmatter?.epoch;if(o===void 0)try{let a=await JSt(this.app,n.path);a?.epoch&&(o=Number(a.epoch))}catch{continue}let i=typeof o=="number"?o:typeof o=="string"?Number(o):void 0;if(typeof i=="number"&&!Number.isNaN(i)&&i===e)return n}return null}async generateAITopic(e){if(this.chainManager)try{let r=this.chainManager.chatModelManager.getChatModel();if(!r)return;let n=6,o=200,a=`Generate a concise title (max 5 words) for this conversation based on its content. Return only the title without any explanation or quotes.
|
||
|
||
Conversation:
|
||
${e.reduce((c,d,f)=>f>=n?c:c+(c?`
|
||
`:"")+`${d.sender}: ${d.message.slice(0,o)}`,"")}`,s=await r.invoke(a),u=typeof s=="string"?s:s.content??s.text??s;return M4(u).trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ne("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n){let o=te(),a=Mg(new Date(r)).fileName,s;if(n)s=n;else{let w=e.find(T=>T.sender===Zs);s=w&&w.message.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"").split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|\x00-\x1F]/g,"").trim()||"Untitled Chat"}let u=o.defaultConversationNoteName||"{$date}_{$time}__{$topic}",l=Gu(),c=l?`${l.id}__`:"",d=P4(".md"),f=P4(c),p=u.replace("{$topic}","").replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]),m=P4(p),h=Math.max(20,KSt-d-f-m),y=s.replace(/\s+/g,"_"),g=Tte(y,h);u=u.replace("{$topic}",g).replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]);let b=u.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"_").replace(/[\\/:*?"<>|\x00-\x1F]/g,"_"),_=`${c}${b}.md`;if(P4(_)>KSt){let w=KSt-d-f,T=Tte(b,w);return`${o.defaultSaveFolder}/${c}${T}.md`}return`${o.defaultSaveFolder}/${_}`}generateNoteContent(e,r,n,o,i){let a=te(),s=Gu();return`---
|
||
epoch: ${r}
|
||
modelKey: "${Jwi(n)}"
|
||
${o?`topic: "${o}"`:""}
|
||
${i?`lastAccessedAt: ${i}`:""}
|
||
${s?`projectId: ${s.id}`:""}
|
||
${s?`projectName: ${s.name}`:""}
|
||
tags:
|
||
- ${a.defaultConversationTag}
|
||
---
|
||
|
||
${e}`}generateTopicAsyncIfNeeded(e,r,n){!te().generateAIChatTitleOnSave||!r||n||(async()=>{try{let i=await this.generateAITopic(e);if(!i)return;await this.applyTopicToFrontmatter(r,i)}catch(i){ne("[ChatPersistenceManager] Error during async topic generation:",i)}})()}async applyTopicToFrontmatter(e,r){try{await ope(this.app,e.path,{topic:r.trim()}),F(`[ChatPersistenceManager] Applied AI topic to chat file: ${e.path}`)}catch(n){ne("[ChatPersistenceManager] Error applying AI topic to file:",n)}}isNameTooLongError(e){if(!e)return!1;let n=(e instanceof Error?e.message:String(e)).toLowerCase();return n.includes("enametoolong")||n.includes("name too long")}isFileAlreadyExistsError(e){return e?(e instanceof Error?e.message:String(e)).toLowerCase().includes("already exists"):!1}};mr();jW();qZ();var rUe=class{constructor(e,r,n,o){this.messageRepo=e;this.chainManager=r;this.fileParserManager=n;this.plugin=o;this.projectMessageRepos=new Map;this.defaultProjectKey="defaultProjectKey";this.lastKnownProjectId=null;this.contextManager=eUe.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new ipe(o.app,e,r)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(F(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){F(`[ChatManager] Creating new message repository for project: ${r}`);let o=new lQ;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new ipe(this.plugin.app,n,this.chainManager),n}setOnMessageCreatedCallback(e){this.onMessageCreatedCallback=e}async processSystemPromptTemplates(e,r,n){if(!e.includes("{")||!e.includes("}"))return{processedPrompt:e,includedFiles:[]};if(!te().enableCustomPromptTemplating)return{processedPrompt:e,includedFiles:[]};try{let i=await sde(e,"",r,n,!0);return{processedPrompt:i.processedPrompt.trimEnd(),includedFiles:i.includedFiles}}catch(i){return Te("[ChatManager] Error processing system prompt templates:",i),{processedPrompt:e,includedFiles:[]}}}injectProcessedUserCustomPromptIntoSystemPrompt(e){let{systemPromptWithoutMemory:r,userCustomPrompt:n,processedUserCustomPrompt:o}=e,i=/<user_custom_instructions>\n[\s\S]*?\n<\/user_custom_instructions>/;return i.test(r)?r.replace(i,()=>`<user_custom_instructions>
|
||
${o}
|
||
</user_custom_instructions>`):r===n?o:(F("[ChatManager] Could not locate <user_custom_instructions> block for injection; returning original system prompt."),r)}replaceSystemPromptWithoutMemoryInBasePrompt(e){let{basePromptWithMemory:r,systemPromptWithoutMemory:n,processedSystemPromptWithoutMemory:o}=e;return r.endsWith(n)?`${r.slice(0,r.length-n.length)}${o}`:(F("[ChatManager] basePromptWithMemory does not end with systemPromptWithoutMemory; returning original base prompt."),r)}async getSystemPromptForMessage(e,r,n){let o=ije(),i=[],a=await T$(this.chainManager.userMemoryManager),s=x$(),u=a;if(o){let l=await this.processSystemPromptTemplates(o,r,n),c=this.injectProcessedUserCustomPromptIntoSystemPrompt({systemPromptWithoutMemory:s,userCustomPrompt:o,processedUserCustomPrompt:l.processedPrompt}),d=this.replaceSystemPromptWithoutMemoryInBasePrompt({basePromptWithMemory:a,systemPromptWithoutMemory:s,processedSystemPromptWithoutMemory:c});d!==a&&i.push(...l.includedFiles),u=d}if(e==="project"){let l=Gu();if(l){let c=await ry.instance.getProjectContext(l.id),d=await this.processSystemPromptTemplates(l.systemPrompt,r,n);i.push(...d.includedFiles);let f=`${u}
|
||
|
||
<project_system_prompt>
|
||
${d.processedPrompt}
|
||
</project_system_prompt>`;if(c){let m=c;c.length>24e5&&(m=c.substring(0,24e5),Te(`Project context truncated from ${Math.round(c.length/4e3)}k to ${Math.round(24e5/4e3)}k estimated tokens to stay within token budget`)),f+=`
|
||
|
||
<project_context>
|
||
${m}
|
||
</project_context>`}return{processedPrompt:f,includedFiles:i}}}return{processedPrompt:u,includedFiles:i}}buildWebTabsWithActiveSnapshot(e,r){let n=MGr(e);if(!r)return n;try{let a=_d(this.plugin.app).getActiveWebTabState().activeWebTabForMentions,s=kZ(a?.url);if(!s)return n;let u=n.map(c=>{if(c.isActive){let{isActive:d,...f}=c;return f}return c}),l=u.findIndex(c=>kZ(c.url)===s);if(l>=0){let c=u[l];return u[l]={...c,url:_b(a?.url)??c.url,title:a?.title??c.title,faviconUrl:a?.faviconUrl??c.faviconUrl,isActive:!0},u}return[...u,{url:_b(a?.url)??s,title:a?.title,faviconUrl:a?.faviconUrl,isActive:!0}]}catch(o){return Te("[ChatManager] Failed to resolve active web tab:",o),n}}async sendMessage(e,r,n,o=!1,i=!1,a,s){try{F(`[ChatManager] Sending message: "${e}"`);let u=this.plugin.app.workspace.getActiveFile(),l={...r};if(o&&u){let _=r.notes||[],w=_.some(T=>T.path===u.path);l.notes=w?_:[..._,u]}let d=!((l.selectedTextContexts||[]).length>0)&&(i||e.includes(Fte));l.webTabs=this.buildWebTabsWithActiveSnapshot(l.webTabs||[],d);let f=this.getCurrentMessageRepo(),p=f.addMessage(e,e,Zs,l,a);this.onMessageCreatedCallback&&this.onMessageCreatedCallback(p);let m=f.getMessage(p);if(!m)throw new Error(`Failed to retrieve message ${p}`);let{processedPrompt:h,includedFiles:y}=await this.getSystemPromptForMessage(n,this.plugin.app.vault,u),{processedContent:g,contextEnvelope:b}=await this.contextManager.processMessageContext(m,this.fileParserManager,this.plugin.app.vault,n,o,u,f,h,y,s);return f.updateProcessedText(p,g,b),F(`[ChatManager] Successfully sent message ${p}`),p}catch(u){throw F("[ChatManager] Error sending message:",u),u}}async editMessage(e,r,n,o=!1){try{F(`[ChatManager] Editing message ${e}: "${r}"`);let i=this.getCurrentMessageRepo();if(!i.editMessage(e,r))return!1;let s=this.plugin.app.workspace.getActiveFile(),{processedPrompt:u,includedFiles:l}=await this.getSystemPromptForMessage(n,this.plugin.app.vault,s);return await this.contextManager.reprocessMessageContext(e,i,this.fileParserManager,this.plugin.app.vault,n,o,s,u,l),await this.updateChainMemory(),F(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return F(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{F(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return F(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return F("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==Zs)return F("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return F("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return F("[ChatManager] LLM message not found for regeneration"),!1;if(!c.contextEnvelope){F("[ChatManager] Context envelope missing, reprocessing context for regeneration");let f=ex(),p=this.plugin.app.workspace.getActiveFile(),{processedPrompt:m,includedFiles:h}=await this.getSystemPromptForMessage(f,this.plugin.app.vault,p);await this.contextManager.reprocessMessageContext(l.id,i,this.fileParserManager,this.plugin.app.vault,f,!1,p,m,h),c=i.getLLMMessage(l.id)}let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:te().debug}),F(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return F(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return F(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),F(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return F(`[ChatManager] Error deleting message ${e}:`,r),!1}}addMessage(e){return this.getCurrentMessageRepo().addMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),F("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),F(`[ChatManager] Truncated messages after ${e}`)}getDisplayMessages(){return this.getCurrentMessageRepo().getDisplayMessages()}getLLMMessages(){return this.getCurrentMessageRepo().getLLMMessages()}getMessage(e){return this.getCurrentMessageRepo().getMessage(e)}getLLMMessage(e){return this.getCurrentMessageRepo().getLLMMessage(e)}async updateChainMemory(){try{let r=this.getCurrentMessageRepo().getLLMMessages();await kon(r,this.chainManager.memoryManager),F(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){F("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addMessage(n)}),await this.updateChainMemory(),F(`[ChatManager] Loaded ${e.length} messages`)}async saveChat(e){await this.persistenceManager.saveChat(e)}getDebugInfo(){return{...this.getCurrentMessageRepo().getDebugInfo(),currentProject:this.plugin.projectManager.getCurrentProjectId(),totalProjects:this.projectMessageRepos.size}}async handleProjectSwitch(){let e=this.plugin.projectManager.getCurrentProjectId();F(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),F(`[ChatManager] Project switch complete. Messages: ${r.getDisplayMessages().length}`)}async loadChatHistory(e){this.clearMessages();let r=await this.persistenceManager.loadChat(e),n=this.getCurrentMessageRepo();for(let o of r)n.addMessage(o);await this.updateChainMemory(),F(`[ChatManager] Loaded ${r.length} messages from chat history`)}};vO();Xe();O4();Fc();jW();Cbt();qN();var nUe=class{constructor(e){this.timeoutId=null;this.isRunning=!1;this.leafState=new WeakMap;this.suppressedSelectionsByUrl=new Map;this.intervalMs=e.intervalMs??500;let r=e.emptySelectionDebounceCount??2;this.emptySelectionDebounceCount=Number.isFinite(r)&&r>0?Math.floor(r):2,this.isEnabled=e.isEnabled,this.getLeaf=e.getLeaf,this.getActiveLeaf=e.getActiveLeaf,this.onSelectionChange=e.onSelectionChange,this.onSelectionClear=e.onSelectionClear}start(){this.isRunning||(this.isRunning=!0,this.scheduleNext())}stop(){this.isRunning=!1,this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.leafState=new WeakMap,this.suppressedSelectionsByUrl=new Map}scheduleNext(){this.isRunning&&(this.timeoutId=setTimeout(async()=>{await this.checkSelection(),this.scheduleNext()},this.intervalMs))}async checkSelection(){if(this.isEnabled())try{let e=this.getLeaf();if(!e)return;let r=this.getOrCreateLeafState(e),n=FZ(e),o=n.url;if(this.isValidUrl(o))r.consecutiveInvalidUrlChecks=0;else{r.consecutiveEmptyChecks=0,this.maybeClearSelectionForInvalidUrl(e,r);return}let i=await $Le(e);if(!i.trim()){this.handleEmptySelection(e,r);return}if(r.consecutiveEmptyChecks=0,this.shouldSuppressSelectionForUrl(o,i)||r.lastSelection&&r.lastSelection.url===o&&r.lastSelection.text===i)return;let a=await LLe(e);if(!a.trim()||this.shouldSuppressSelectionForUrl(o,i))return;r.lastSelection={url:o,text:i};let s={id:od(),content:a,sourceType:"web",title:n.title||"Untitled",url:o,faviconUrl:n.faviconUrl||void 0};this.onSelectionChange(s)}catch{}}getOrCreateLeafState(e){let r=this.leafState.get(e);if(r)return r;let n={lastSelection:null,consecutiveEmptyChecks:0,consecutiveInvalidUrlChecks:0};return this.leafState.set(e,n),n}isValidUrl(e){let r=e.trim();if(!r)return!1;try{return new URL(r),!0}catch{return!1}}isActiveWebViewerLeaf(e){let r=this.getActiveLeaf();return!!(r&&r===e)}handleEmptySelection(e,r){if(!r.lastSelection||!this.isActiveWebViewerLeaf(e)||(r.consecutiveEmptyChecks+=1,r.consecutiveEmptyChecks<this.emptySelectionDebounceCount))return;let n=r.lastSelection.url;r.lastSelection=null,r.consecutiveEmptyChecks=0,this.clearSuppressionForUrl(n),this.onSelectionClear({url:n,reason:"selection-cleared"})}maybeClearSelectionForInvalidUrl(e,r){if(!r.lastSelection||!this.isActiveWebViewerLeaf(e)||(r.consecutiveInvalidUrlChecks+=1,r.consecutiveInvalidUrlChecks<this.emptySelectionDebounceCount))return;let n=r.lastSelection.url;r.lastSelection=null,r.consecutiveEmptyChecks=0,r.consecutiveInvalidUrlChecks=0,this.clearSuppressionForUrl(n),this.onSelectionClear({url:n,reason:"invalid-url"})}clearSuppressionForUrl(e){this.suppressedSelectionsByUrl.delete(e.trim())}shouldSuppressSelectionForUrl(e,r){let n=e.trim(),o=this.suppressedSelectionsByUrl.get(n);return o===void 0?!1:o===null?(this.suppressedSelectionsByUrl.set(n,r),!0):o===r?!0:(this.suppressedSelectionsByUrl.delete(n),!1)}suppressSelectionForUrl(e){let r=e.trim();this.isValidUrl(r)&&this.suppressedSelectionsByUrl.set(r,null)}suppressCurrentSelection(){let e=this.getLeaf();if(!e)return;let r=FZ(e);this.suppressSelectionForUrl(r.url)}};Pl();mr();Ye();Xe();var Tpe=require("obsidian"),w0t=$(J()),Xan=$(jm());var oUe=class extends zu{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")}};Cn();var ape=$(J());$r();var Gon=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>ape.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:we("tw-flex tw-flex-row tw-items-center","tw-h-8","tw-px-2 tw-py-1","tw-gap-1.5","tw-cursor-pointer","tw-overflow-hidden","tw-whitespace-nowrap","tw-text-sm","tw-border tw-border-solid tw-border-border","tw-rounded-b-[2px] tw-rounded-t-sm","tw-bg-primary","tw-transition-all tw-duration-300 tw-ease-in-out","hover:tw-border-interactive-accent",e&&["!tw-bg-interactive-accent","tw-text-on-accent","!tw-max-w-full","tw-transition-all tw-duration-300 tw-ease-in-out","tw-delay-100"],"lg:tw-max-w-32","md:tw-max-w-32")},ape.default.createElement("div",{className:we("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),ape.default.createElement("span",{className:we("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)),Xon=({id:t,children:e,isSelected:r})=>r?ape.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:we("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 hS=$(J()),Zon=(0,hS.createContext)(void 0),Yon=({children:t})=>{let[e,r]=(0,hS.useState)("basic"),[n,o]=(0,hS.useState)(null),i=(0,hS.useRef)(!1);return(0,hS.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),hS.default.createElement(Zon.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},_z=()=>{let t=(0,hS.useContext)(Zon);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};Ye();var Rt=$(J());Cn();var ou=$(J());Cn();$r();var wd=$(J());var Ge=$(J()),I6=$(hu());var vd=$(J());function ein(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,vd.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var spe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function T6(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function iUe(t){return"nodeType"in t}function x_(t){var e,r;return t?T6(t)?t:iUe(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function aUe(t){let{Document:e}=x_(t);return t instanceof e}function cQ(t){return T6(t)?!1:t instanceof x_(t).HTMLElement}function XSt(t){return t instanceof x_(t).SVGElement}function O6(t){return t?T6(t)?t.document:iUe(t)?aUe(t)?t:cQ(t)||XSt(t)?t.ownerDocument:document:document:document}var IC=spe?vd.useLayoutEffect:vd.useEffect;function sUe(t){let e=(0,vd.useRef)(t);return IC(()=>{e.current=t}),(0,vd.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 tin(){let t=(0,vd.useRef)(null),e=(0,vd.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,vd.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function dQ(t,e){e===void 0&&(e=[t]);let r=(0,vd.useRef)(t);return IC(()=>{r.current!==t&&(r.current=t)},e),r}function fQ(t,e){let r=(0,vd.useRef)();return(0,vd.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function upe(t){let e=sUe(t),r=(0,vd.useRef)(null),n=(0,vd.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function uUe(t){let e=(0,vd.useRef)();return(0,vd.useEffect)(()=>{e.current=t},[t]),e.current}var GSt={};function E6(t,e){return(0,vd.useMemo)(()=>{if(e)return e;let r=GSt[t]==null?0:GSt[t]+1;return GSt[t]=r,t+"-"+r},[t,e])}function rin(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 P6=rin(1),M6=rin(-1);function Kwi(t){return"clientX"in t&&"clientY"in t}function lpe(t){if(!t)return!1;let{KeyboardEvent:e}=x_(t.target);return e&&t instanceof e}function Gwi(t){if(!t)return!1;let{TouchEvent:e}=x_(t.target);return e&&t instanceof e}function lUe(t){if(Gwi(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 Kwi(t)?{x:t.clientX,y:t.clientY}:null}var RC=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[RC.Translate.toString(t),RC.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),Qon="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nin(t){return t.matches(Qon)?t:t.querySelector(Qon)}var R6=$(J()),Xwi={display:"none"};function oin(t){let{id:e,value:r}=t;return R6.default.createElement("div",{id:e,style:Xwi},r)}function iin(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 R6.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function ain(){let[t,e]=(0,R6.useState)("");return{announce:(0,R6.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var _in=(0,Ge.createContext)(null);function Zwi(t){let e=(0,Ge.useContext)(_in);(0,Ge.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Ywi(){let[t]=(0,Ge.useState)(()=>new Set),e=(0,Ge.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,Ge.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 Qwi={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.
|
||
`},eSi={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 tSi(t){let{announcements:e=eSi,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Qwi}=t,{announce:i,announcement:a}=ain(),s=E6("DndLiveRegion"),[u,l]=(0,Ge.useState)(!1);if((0,Ge.useEffect)(()=>{l(!0)},[]),Zwi((0,Ge.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=Ge.default.createElement(Ge.default.Fragment,null,Ge.default.createElement(oin,{id:n,value:o.draggable}),Ge.default.createElement(iin,{id:s,announcement:a}));return r?(0,I6.createPortal)(c,r):c}var xh;(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"})(xh||(xh={}));function dUe(){}function pQ(t,e){return(0,Ge.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function pUe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,Ge.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var VT=Object.freeze({x:0,y:0});function vin(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function win(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function rSi(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function sin(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 i0t(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function uin(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 mQ=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=uin(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=vin(uin(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(win)},Sin=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=sin(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=sin(u),c=o.reduce((f,p,m)=>f+vin(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(win)};function nSi(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 oSi=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=nSi(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(rSi)};function iSi(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function Cin(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:VT}function aSi(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 sSi=aSi(1);function uSi(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 lSi(t,e,r){let n=uSi(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 cSi={ignoreTransform:!1};function D6(t,e){e===void 0&&(e=cSi);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=x_(t).getComputedStyle(t);l&&(r=lSi(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 lin(t){return D6(t,{ignoreTransform:!0})}function dSi(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function fSi(t,e){return e===void 0&&(e=x_(t).getComputedStyle(t)),e.position==="fixed"}function pSi(t,e){e===void 0&&(e=x_(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 mpe(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(aUe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!cQ(o)||XSt(o)||r.includes(o))return r;let i=x_(t).getComputedStyle(o);return o!==t&&pSi(o,i)&&r.push(o),fSi(o,i)?r:n(o.parentNode)}return t?n(t):r}function xin(t){let[e]=mpe(t,1);return e??null}function ZSt(t){return!spe||!t?null:T6(t)?t:iUe(t)?aUe(t)||t===O6(t).scrollingElement?window:cQ(t)?t:null:null}function Tin(t){return T6(t)?t.scrollX:t.scrollLeft}function Oin(t){return T6(t)?t.scrollY:t.scrollTop}function e0t(t){return{x:Tin(t),y:Oin(t)}}var _g;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(_g||(_g={}));function Ein(t){return!spe||!t?!1:t===document.scrollingElement}function Pin(t){let e={x:0,y:0},r=Ein(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 mSi={x:.2,y:.2};function hSi(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=mSi);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=Pin(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=_g.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=_g.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=_g.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=_g.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function gSi(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 Min(t){return t.reduce((e,r)=>P6(e,e0t(r)),VT)}function ySi(t){return t.reduce((e,r)=>e+Tin(r),0)}function bSi(t){return t.reduce((e,r)=>e+Oin(r),0)}function _Si(t,e){if(e===void 0&&(e=D6),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);xin(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var vSi=[["x",["left","right"],ySi],["y",["top","bottom"],bSi]],dpe=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=mpe(r),o=Min(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of vSi)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})}},A6=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 wSi(t){let{EventTarget:e}=x_(t);return t instanceof e?t:O6(t)}function YSt(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 AC;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(AC||(AC={}));function cin(t){t.preventDefault()}function SSi(t){t.stopPropagation()}var Bi;(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"})(Bi||(Bi={}));var Rin={start:[Bi.Space,Bi.Enter],cancel:[Bi.Esc],end:[Bi.Space,Bi.Enter,Bi.Tab]},CSi=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case Bi.Right:return{...r,x:r.x+25};case Bi.Left:return{...r,x:r.x-25};case Bi.Down:return{...r,y:r.y+25};case Bi.Up:return{...r,y:r.y-25}}},wz=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 A6(O6(r)),this.windowListeners=new A6(x_(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(AC.Resize,this.handleCancel),this.windowListeners.add(AC.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(AC.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&_Si(n),r(VT)}handleKeyDown(e){if(lpe(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=Rin,coordinateGetter:a=CSi,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}:VT;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=M6(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let y=e.code,{isTop:g,isRight:b,isLeft:_,isBottom:w,maxScroll:T,minScroll:O}=Pin(h),E=gSi(h),P={x:Math.min(y===Bi.Right?E.right-E.width/2:E.right,Math.max(y===Bi.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(y===Bi.Down?E.bottom-E.height/2:E.bottom,Math.max(y===Bi.Down?E.top:E.top+E.height/2,d.y))},R=y===Bi.Right&&!b||y===Bi.Left&&!_,I=y===Bi.Down&&!w||y===Bi.Up&&!g;if(R&&P.x!==d.x){let N=h.scrollLeft+f.x,z=y===Bi.Right&&N<=T.x||y===Bi.Left&&N>=O.x;if(z&&!f.y){h.scrollTo({left:N,behavior:s});return}z?p.x=h.scrollLeft-N:p.x=y===Bi.Right?h.scrollLeft-T.x:h.scrollLeft-O.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(I&&P.y!==d.y){let N=h.scrollTop+f.y,z=y===Bi.Down&&N<=T.y||y===Bi.Up&&N>=O.y;if(z&&!f.x){h.scrollTo({top:N,behavior:s});return}z?p.y=h.scrollTop-N:p.y=y===Bi.Down?h.scrollTop-T.y:h.scrollTop-O.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,P6(M6(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()}};wz.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=Rin,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 din(t){return!!(t&&"distance"in t)}function fin(t){return!!(t&&"delay"in t)}var fpe=class{constructor(e,r,n){var o;n===void 0&&(n=wSi(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=O6(a),this.documentListeners=new A6(this.document),this.listeners=new A6(n),this.windowListeners=new A6(x_(a)),this.initialCoordinates=(o=lUe(i))!=null?o:VT,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(AC.Resize,this.handleCancel),this.windowListeners.add(AC.DragStart,cin),this.windowListeners.add(AC.VisibilityChange,this.handleCancel),this.windowListeners.add(AC.ContextMenu,cin),this.documentListeners.add(AC.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fin(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(din(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(AC.Click,SSi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(AC.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=lUe(e))!=null?r:VT,l=M6(o,u);if(!n&&s){if(din(s)){if(s.tolerance!=null&&YSt(l,s.tolerance))return this.handleCancel();if(YSt(l,s.distance))return this.handleStart()}if(fin(s)&&YSt(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===Bi.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},xSi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Sz=class extends fpe{constructor(e){let{event:r}=e,n=O6(r.target);super(e,xSi,n)}};Sz.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 TSi={move:{name:"mousemove"},end:{name:"mouseup"}},t0t;(function(t){t[t.RightClick=2]="RightClick"})(t0t||(t0t={}));var r0t=class extends fpe{constructor(e){super(e,TSi,O6(e.event.target))}};r0t.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===t0t.RightClick?!1:(n?.({event:r}),!0)}}];var QSt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},n0t=class extends fpe{constructor(e){super(e,QSt)}static setup(){return window.addEventListener(QSt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(QSt.move.name,e)};function e(){}}};n0t.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 cpe;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(cpe||(cpe={}));var fUe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(fUe||(fUe={}));function OSi(t){let{acceleration:e,activator:r=cpe.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=fUe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=PSi({delta:d,disabled:!i}),[m,h]=tin(),y=(0,Ge.useRef)({x:0,y:0}),g=(0,Ge.useRef)({x:0,y:0}),b=(0,Ge.useMemo)(()=>{switch(r){case cpe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case cpe.DraggableRect:return o}},[r,o,u]),_=(0,Ge.useRef)(null),w=(0,Ge.useCallback)(()=>{let O=_.current;if(!O)return;let E=y.current.x*g.current.x,P=y.current.y*g.current.y;O.scrollBy(E,P)},[]),T=(0,Ge.useMemo)(()=>s===fUe.TreeOrder?[...l].reverse():l,[s,l]);(0,Ge.useEffect)(()=>{if(!i||!l.length||!b){h();return}for(let O of T){if(n?.(O)===!1)continue;let E=l.indexOf(O),P=c[E];if(!P)continue;let{direction:R,speed:I}=hSi(O,P,b,e,f);for(let N of["x","y"])p[N][R[N]]||(I[N]=0,R[N]=0);if(I.x>0||I.y>0){h(),_.current=O,m(w,a),y.current=I,g.current=R;return}}y.current={x:0,y:0},g.current={x:0,y:0},h()},[e,w,n,h,i,a,JSON.stringify(b),JSON.stringify(p),m,l,T,c,JSON.stringify(f)])}var ESi={x:{[_g.Backward]:!1,[_g.Forward]:!1},y:{[_g.Backward]:!1,[_g.Forward]:!1}};function PSi(t){let{delta:e,disabled:r}=t,n=uUe(e);return fQ(o=>{if(r||!n||!o)return ESi;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[_g.Backward]:o.x[_g.Backward]||i.x===-1,[_g.Forward]:o.x[_g.Forward]||i.x===1},y:{[_g.Backward]:o.y[_g.Backward]||i.y===-1,[_g.Forward]:o.y[_g.Forward]||i.y===1}}},[r,e,n])}function MSi(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return fQ(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function RSi(t,e){return(0,Ge.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 ppe;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ppe||(ppe={}));var o0t;(function(t){t.Optimized="optimized"})(o0t||(o0t={}));var pin=new Map;function ISi(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,Ge.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,Ge.useRef)(t),d=y(),f=dQ(d),p=(0,Ge.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(b=>b===null?g:b.concat(g.filter(_=>!b.includes(_))))},[f]),m=(0,Ge.useRef)(null),h=fQ(g=>{if(d&&!r)return pin;if(!g||g===pin||c.current!==t||i!=null){let b=new Map;for(let _ of t){if(!_)continue;if(i&&i.length>0&&!i.includes(_.id)&&_.rect.current){b.set(_.id,_.rect.current);continue}let w=_.node.current,T=w?new dpe(u(w),w):null;_.rect.current=T,T&&b.set(_.id,T)}return b}return g},[t,i,r,d,u]);return(0,Ge.useEffect)(()=>{c.current=t},[t]),(0,Ge.useEffect)(()=>{d||p()},[r,d]),(0,Ge.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,Ge.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function y(){switch(l){case ppe.Always:return!1;case ppe.BeforeDragging:return r;default:return!r}}}function Iin(t,e){return fQ(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function ASi(t,e){return Iin(t,e)}function NSi(t){let{callback:e,disabled:r}=t,n=sUe(e),o=(0,Ge.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,Ge.useEffect)(()=>()=>o?.disconnect(),[o]),o}function mUe(t){let{callback:e,disabled:r}=t,n=sUe(e),o=(0,Ge.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,Ge.useEffect)(()=>()=>o?.disconnect(),[o]),o}function DSi(t){return new dpe(D6(t),t)}function min(t,e,r){e===void 0&&(e=DSi);let[n,o]=(0,Ge.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=NSi({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=mUe({callback:i});return IC(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function jSi(t){let e=Iin(t);return Cin(t,e)}var hin=[];function $Si(t){let e=(0,Ge.useRef)(t),r=fQ(n=>t?n&&n!==hin&&t&&e.current&&t.parentNode===e.current.parentNode?n:mpe(t):hin,[t]);return(0,Ge.useEffect)(()=>{e.current=t},[t]),r}function LSi(t){let[e,r]=(0,Ge.useState)(null),n=(0,Ge.useRef)(t),o=(0,Ge.useCallback)(i=>{let a=ZSt(i.target);a&&r(s=>s?(s.set(a,e0t(a)),new Map(s)):null)},[]);return(0,Ge.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=ZSt(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,e0t(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=ZSt(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,Ge.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>P6(i,a),VT):Min(t):VT,[t,e])}function gin(t,e){e===void 0&&(e=[]);let r=(0,Ge.useRef)(null);return(0,Ge.useEffect)(()=>{r.current=null},e),(0,Ge.useEffect)(()=>{let n=t!==VT;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?M6(t,r.current):VT}function FSi(t){(0,Ge.useEffect)(()=>{if(!spe)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 kSi(t,e){return(0,Ge.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function Ain(t){return(0,Ge.useMemo)(()=>t?dSi(t):null,[t])}var yin=[];function qSi(t,e){e===void 0&&(e=D6);let[r]=t,n=Ain(r?x_(r):null),[o,i]=(0,Ge.useState)(yin);function a(){i(()=>t.length?t.map(u=>Ein(u)?n:new dpe(e(u),u)):yin)}let s=mUe({callback:a});return IC(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function USi(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return cQ(e)?e:t}function BSi(t){let{measure:e}=t,[r,n]=(0,Ge.useState)(null),o=(0,Ge.useCallback)(l=>{for(let{target:c}of l)if(cQ(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=mUe({callback:o}),a=(0,Ge.useCallback)(l=>{let c=USi(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=upe(a);return(0,Ge.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var zSi=[{sensor:Sz,options:{}},{sensor:wz,options:{}}],VSi={current:{}},cUe={draggable:{measure:lin},droppable:{measure:lin,strategy:ppe.WhileDragging,frequency:o0t.Optimized},dragOverlay:{measure:D6}},N6=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}},HSi={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new N6,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dUe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cUe,measureDroppableContainers:dUe,windowRect:null,measuringScheduled:!1},WSi={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dUe,draggableNodes:new Map,over:null,measureDroppableContainers:dUe},hUe=(0,Ge.createContext)(WSi),Nin=(0,Ge.createContext)(HSi);function JSi(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new N6}}}function KSi(t,e){switch(e.type){case xh.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case xh.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 xh.DragEnd:case xh.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case xh.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new N6(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case xh.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 N6(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case xh.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new N6(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function GSi(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,Ge.useContext)(hUe),i=uUe(n),a=uUe(r?.id);return(0,Ge.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!lpe(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=nin(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function XSi(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function ZSi(t){return(0,Ge.useMemo)(()=>({draggable:{...cUe.draggable,...t?.draggable},droppable:{...cUe.droppable,...t?.droppable},dragOverlay:{...cUe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function YSi(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,Ge.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;IC(()=>{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=Cin(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=xin(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Din=(0,Ge.createContext)({...VT,scaleX:1,scaleY:1}),vz;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(vz||(vz={}));var hQ=(0,Ge.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=zSi,collisionDetection:d=oSi,measuring:f,modifiers:p,...m}=e,h=(0,Ge.useReducer)(KSi,void 0,JSi),[y,g]=h,[b,_]=Ywi(),[w,T]=(0,Ge.useState)(vz.Uninitialized),O=w===vz.Initialized,{draggable:{active:E,nodes:P,translate:R},droppable:{containers:I}}=y,N=E!=null?P.get(E):null,z=(0,Ge.useRef)({initial:null,translated:null}),V=(0,Ge.useMemo)(()=>{var Gs;return E!=null?{id:E,data:(Gs=N?.data)!=null?Gs:VSi,rect:z}:null},[E,N]),k=(0,Ge.useRef)(null),[X,B]=(0,Ge.useState)(null),[Q,Y]=(0,Ge.useState)(null),K=dQ(m,Object.values(m)),oe=E6("DndDescribedBy",a),ue=(0,Ge.useMemo)(()=>I.getEnabled(),[I]),de=ZSi(f),{droppableRects:L,measureDroppableContainers:W,measuringScheduled:ie}=ISi(ue,{dragging:O,dependencies:[R.x,R.y],config:de.droppable}),j=MSi(P,E),A=(0,Ge.useMemo)(()=>Q?lUe(Q):null,[Q]),U=bS(),H=ASi(j,de.draggable.measure);YSi({activeNode:E!=null?P.get(E):null,config:U.layoutShiftCompensation,initialRect:H,measure:de.draggable.measure});let re=min(j,de.draggable.measure,H),Z=min(j?j.parentElement:null),le=(0,Ge.useRef)({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:L,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ce=I.getNodeFor((r=le.current.over)==null?void 0:r.id),He=BSi({measure:de.dragOverlay.measure}),lt=(n=He.nodeRef.current)!=null?n:j,qe=O?(o=He.rect)!=null?o:re:null,Nt=!!(He.nodeRef.current&&He.rect),mt=jSi(Nt?null:re),Ot=Ain(lt?x_(lt):null),je=$Si(O?Ce??j:null),Gr=qSi(je),ct=XSi(p,{transform:{x:R.x-mt.x,y:R.y-mt.y,scaleX:1,scaleY:1},activatorEvent:Q,active:V,activeNodeRect:re,containerNodeRect:Z,draggingNodeRect:qe,over:le.current.over,overlayNodeRect:He.rect,scrollableAncestors:je,scrollableAncestorRects:Gr,windowRect:Ot}),ze=A?P6(A,R):null,ht=LSi(je),$e=gin(ht),Ue=gin(ht,[re]),Ve=P6(ct,$e),Kt=qe?sSi(qe,ct):null,so=V&&Kt?d({active:V,collisionRect:Kt,droppableRects:L,droppableContainers:ue,pointerCoordinates:ze}):null,iu=i0t(so,"id"),[An,Si]=(0,Ge.useState)(null),Dl=Nt?ct:P6(ct,Ue),Vi=iSi(Dl,(i=An?.rect)!=null?i:null,re),O_=(0,Ge.useRef)(null),wg=(0,Ge.useCallback)((Gs,jl)=>{let{sensor:Mu,options:Mm}=jl;if(k.current==null)return;let xd=P.get(k.current);if(!xd)return;let ll=Gs.nativeEvent,rt=new Mu({active:k.current,activeNode:xd,event:ll,options:Mm,context:le,onAbort(Be){if(!P.get(Be))return;let{onDragAbort:It}=K.current,Qt={id:Be};It?.(Qt),b({type:"onDragAbort",event:Qt})},onPending(Be,Ee,It,Qt){if(!P.get(Be))return;let{onDragPending:cl}=K.current,Ei={id:Be,constraint:Ee,initialCoordinates:It,offset:Qt};cl?.(Ei),b({type:"onDragPending",event:Ei})},onStart(Be){let Ee=k.current;if(Ee==null)return;let It=P.get(Ee);if(!It)return;let{onDragStart:Qt}=K.current,Fn={activatorEvent:ll,active:{id:Ee,data:It.data,rect:z}};(0,I6.unstable_batchedUpdates)(()=>{Qt?.(Fn),T(vz.Initializing),g({type:xh.DragStart,initialCoordinates:Be,active:Ee}),b({type:"onDragStart",event:Fn}),B(O_.current),Y(ll)})},onMove(Be){g({type:xh.DragMove,coordinates:Be})},onEnd:Rr(xh.DragEnd),onCancel:Rr(xh.DragCancel)});O_.current=rt;function Rr(Be){return async function(){let{active:It,collisions:Qt,over:Fn,scrollAdjustedTranslate:cl}=le.current,Ei=null;if(It&&cl){let{cancelDrop:Xv}=K.current;Ei={activatorEvent:ll,active:It,collisions:Qt,delta:cl,over:Fn},Be===xh.DragEnd&&typeof Xv=="function"&&await Promise.resolve(Xv(Ei))&&(Be=xh.DragCancel)}k.current=null,(0,I6.unstable_batchedUpdates)(()=>{g({type:Be}),T(vz.Uninitialized),Si(null),B(null),Y(null),O_.current=null;let Xv=Be===xh.DragEnd?"onDragEnd":"onDragCancel";if(Ei){let DL=K.current[Xv];DL?.(Ei),b({type:Xv,event:Ei})}})}}},[P]),yS=(0,Ge.useCallback)((Gs,jl)=>(Mu,Mm)=>{let xd=Mu.nativeEvent,ll=P.get(Mm);if(k.current!==null||!ll||xd.dndKit||xd.defaultPrevented)return;let rt={active:ll};Gs(Mu,jl.options,rt)===!0&&(xd.dndKit={capturedBy:jl.sensor},k.current=Mm,wg(Mu,jl))},[P,wg]),ji=RSi(c,yS);FSi(c),IC(()=>{re&&w===vz.Initializing&&T(vz.Initialized)},[re,w]),(0,Ge.useEffect)(()=>{let{onDragMove:Gs}=K.current,{active:jl,activatorEvent:Mu,collisions:Mm,over:xd}=le.current;if(!jl||!Mu)return;let ll={active:jl,activatorEvent:Mu,collisions:Mm,delta:{x:Ve.x,y:Ve.y},over:xd};(0,I6.unstable_batchedUpdates)(()=>{Gs?.(ll),b({type:"onDragMove",event:ll})})},[Ve.x,Ve.y]),(0,Ge.useEffect)(()=>{let{active:Gs,activatorEvent:jl,collisions:Mu,droppableContainers:Mm,scrollAdjustedTranslate:xd}=le.current;if(!Gs||k.current==null||!jl||!xd)return;let{onDragOver:ll}=K.current,rt=Mm.get(iu),Rr=rt&&rt.rect.current?{id:rt.id,rect:rt.rect.current,data:rt.data,disabled:rt.disabled}:null,Be={active:Gs,activatorEvent:jl,collisions:Mu,delta:{x:xd.x,y:xd.y},over:Rr};(0,I6.unstable_batchedUpdates)(()=>{Si(Rr),ll?.(Be),b({type:"onDragOver",event:Be})})},[iu]),IC(()=>{le.current={activatorEvent:Q,active:V,activeNode:j,collisionRect:Kt,collisions:so,droppableRects:L,draggableNodes:P,draggingNode:lt,draggingNodeRect:qe,droppableContainers:I,over:An,scrollableAncestors:je,scrollAdjustedTranslate:Ve},z.current={initial:qe,translated:Kt}},[V,j,so,Kt,P,lt,qe,L,I,An,je,Ve]),OSi({...U,delta:R,draggingRect:Kt,pointerCoordinates:ze,scrollableAncestors:je,scrollableAncestorRects:Gr});let KT=(0,Ge.useMemo)(()=>({active:V,activeNode:j,activeNodeRect:re,activatorEvent:Q,collisions:so,containerNodeRect:Z,dragOverlay:He,draggableNodes:P,droppableContainers:I,droppableRects:L,over:An,measureDroppableContainers:W,scrollableAncestors:je,scrollableAncestorRects:Gr,measuringConfiguration:de,measuringScheduled:ie,windowRect:Ot}),[V,j,re,Q,so,Z,He,P,I,L,An,W,je,Gr,de,ie,Ot]),LC=(0,Ge.useMemo)(()=>({activatorEvent:Q,activators:ji,active:V,activeNodeRect:re,ariaDescribedById:{draggable:oe},dispatch:g,draggableNodes:P,over:An,measureDroppableContainers:W}),[Q,ji,V,re,g,oe,P,An,W]);return Ge.default.createElement(_in.Provider,{value:_},Ge.default.createElement(hUe.Provider,{value:LC},Ge.default.createElement(Nin.Provider,{value:KT},Ge.default.createElement(Din.Provider,{value:Vi},l)),Ge.default.createElement(GSi,{disabled:s?.restoreFocus===!1})),Ge.default.createElement(tSi,{...s,hiddenTextDescribedById:oe}));function bS(){let Gs=X?.autoScrollEnabled===!1,jl=typeof u=="object"?u.enabled===!1:u===!1,Mu=O&&!Gs&&!jl;return typeof u=="object"?{...u,enabled:Mu}:{enabled:Mu}}}),QSi=(0,Ge.createContext)(null),bin="button",e0i="Draggable";function jin(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=E6(e0i),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,Ge.useContext)(hUe),{role:p=bin,roleDescription:m="draggable",tabIndex:h=0}=o??{},y=u?.id===e,g=(0,Ge.useContext)(y?Din:QSi),[b,_]=upe(),[w,T]=upe(),O=kSi(a,e),E=dQ(r);IC(()=>(d.set(e,{id:e,key:i,node:b,activatorNode:w,data:E}),()=>{let R=d.get(e);R&&R.key===i&&d.delete(e)}),[d,e]);let P=(0,Ge.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===bin?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,y,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:P,isDragging:y,listeners:n?void 0:O,node:b,over:f,setNodeRef:_,setActivatorNodeRef:T,transform:g}}function $in(){return(0,Ge.useContext)(Nin)}var t0i="Droppable",r0i={timeout:25};function Lin(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=E6(t0i),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,Ge.useContext)(hUe),c=(0,Ge.useRef)({disabled:r}),d=(0,Ge.useRef)(!1),f=(0,Ge.useRef)(null),p=(0,Ge.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:y}={...r0i,...o},g=dQ(h??n),b=(0,Ge.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(g.current)?g.current:[g.current]),p.current=null},y)},[y]),_=mUe({callback:b,disabled:m||!a}),w=(0,Ge.useCallback)((P,R)=>{_&&(R&&(_.unobserve(R),d.current=!1),P&&_.observe(P))},[_]),[T,O]=upe(w),E=dQ(e);return(0,Ge.useEffect)(()=>{!_||!T.current||(_.disconnect(),d.current=!1,_.observe(T.current))},[T,_]),(0,Ge.useEffect)(()=>(s({type:xh.RegisterDroppable,element:{id:n,key:i,disabled:r,node:T,rect:f,data:E}}),()=>s({type:xh.UnregisterDroppable,key:i,id:n})),[n]),(0,Ge.useEffect)(()=>{r!==c.current.disabled&&(s({type:xh.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:T,over:u,setNodeRef:O}}function _Ue(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function n0i(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function gUe(t){return t!==null&&t>=0}function o0i(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 i0i(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Fin=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=_Ue(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 yUe={scaleX:1,scaleY:1},gQ=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,...yUe}:null}let u=a0i(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...yUe}:o<r&&o>=a?{x:0,y:s.height+u,...yUe}:{x:0,y:0,...yUe}};function a0i(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 kin="Sortable",qin=wd.default.createContext({activeIndex:-1,containerId:kin,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fin,disabled:{draggable:!1,droppable:!1}});function yQ(t){let{children:e,id:r,items:n,strategy:o=Fin,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=$in(),d=E6(kin,r),f=s.rect!==null,p=(0,wd.useMemo)(()=>n.map(O=>typeof O=="object"&&"id"in O?O.id:O),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,y=l?p.indexOf(l.id):-1,g=(0,wd.useRef)(p),b=!o0i(p,g.current),_=y!==-1&&h===-1||b,w=i0i(i);IC(()=>{b&&m&&c(p)},[b,p,m,c]),(0,wd.useEffect)(()=>{g.current=p},[p]);let T=(0,wd.useMemo)(()=>({activeIndex:h,containerId:d,disabled:w,disableTransforms:_,items:p,overIndex:y,useDragOverlay:f,sortedRects:n0i(p,u),strategy:o}),[h,d,w.draggable,w.droppable,_,p,y,u,f,o]);return wd.default.createElement(qin.Provider,{value:T},e)}var s0i=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return _Ue(r,n,o).indexOf(e)},u0i=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},l0i={duration:200,easing:"ease"},Uin="transform",c0i=RC.Transition.toString({property:Uin,duration:0,easing:"linear"}),d0i={roleDescription:"sortable"};function f0i(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,wd.useState)(null),s=(0,wd.useRef)(r);return IC(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=D6(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,wd.useEffect)(()=>{i&&a(null)},[i]),i}function bQ(t){let{animateLayoutChanges:e=u0i,attributes:r,disabled:n,data:o,getNewIndex:i=s0i,id:a,strategy:s,resizeObserverConfig:u,transition:l=l0i}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:y,useDragOverlay:g,strategy:b}=(0,wd.useContext)(qin),_=p0i(n,p),w=c.indexOf(a),T=(0,wd.useMemo)(()=>({sortable:{containerId:d,index:w,items:c},...o}),[d,o,w,c]),O=(0,wd.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:P,isOver:R,setNodeRef:I}=Lin({id:a,data:T,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:N,activatorEvent:z,activeNodeRect:V,attributes:k,setNodeRef:X,listeners:B,isDragging:Q,over:Y,setActivatorNodeRef:K,transform:oe}=jin({id:a,data:T,attributes:{...d0i,...r},disabled:_.draggable}),ue=ein(I,X),de=!!N,L=de&&!m&&gUe(f)&&gUe(y),W=!g&&Q,ie=W&&L?oe:null,A=L?ie??(s??b)({rects:h,activeNodeRect:V,activeIndex:f,overIndex:y,index:w}):null,U=gUe(f)&&gUe(y)?i({id:a,items:c,activeIndex:f,overIndex:y}):w,H=N?.id,re=(0,wd.useRef)({activeId:H,items:c,newIndex:U,containerId:d}),Z=c!==re.current.items,le=e({active:N,containerId:d,isDragging:Q,isSorting:de,id:a,index:w,items:c,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),Ce=f0i({disabled:!le,index:w,node:P,rect:E});return(0,wd.useEffect)(()=>{de&&re.current.newIndex!==U&&(re.current.newIndex=U),d!==re.current.containerId&&(re.current.containerId=d),c!==re.current.items&&(re.current.items=c)},[de,U,d,c]),(0,wd.useEffect)(()=>{if(H===re.current.activeId)return;if(H!=null&&re.current.activeId==null){re.current.activeId=H;return}let lt=setTimeout(()=>{re.current.activeId=H},50);return()=>clearTimeout(lt)},[H]),{active:N,activeIndex:f,attributes:k,data:T,rect:E,index:w,newIndex:U,items:c,isOver:R,isSorting:de,isDragging:Q,listeners:B,node:P,overIndex:y,over:Y,setNodeRef:ue,setActivatorNodeRef:K,setDroppableNodeRef:I,setDraggableNodeRef:X,transform:Ce??A,transition:He()};function He(){if(Ce||Z&&re.current.newIndex===w)return c0i;if(!(W&&!lpe(z)||!l)&&(de||le))return RC.Transition.toString({...l,property:Uin})}}function p0i(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 bUe(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 m0i=[Bi.Down,Bi.Right,Bi.Up,Bi.Left],vUe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(m0i.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 Bi.Down:n.top<f.top&&u.push(d);break;case Bi.Up:n.top>f.top&&u.push(d);break;case Bi.Left:n.left>f.left&&u.push(d);break;case Bi.Right:n.left<f.left&&u.push(d);break}});let l=Sin({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=i0t(l,"id");if(c===a?.id&&l.length>1&&(c=l[1].id),c!=null){let d=i.get(r.id),f=i.get(c),p=f?o.get(f.id):null,m=f?.node.current;if(m&&p&&d&&f){let y=mpe(m).some((O,E)=>s[E]!==O),g=Bin(d,f),b=h0i(d,f),_=y||!g?{x:0,y:0}:{x:b?n.width-p.width:0,y:b?n.height-p.height:0},w={x:p.left,y:p.top};return _.x&&_.y?w:M6(w,_)}}}};function Bin(t,e){return!bUe(t)||!bUe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function h0i(t,e){return!bUe(t)||!bUe(e)||!Bin(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}Or();function wUe({id:t,item:e,title:r,subtitle:n,badge:o,icon:i,isDraggable:a=!1,isExpandable:s=!1,defaultExpanded:u=!1,expandedContent:l,primaryAction:c,dropdownActions:d=[],containerRef:f,className:p,onExpandToggle:m}){let[h,y]=(0,ou.useState)(u),{attributes:g,listeners:b,setNodeRef:_,transform:w,transition:T,isDragging:O}=bQ({id:t,disabled:!a}),E={transform:RC.Transform.toString(w),transition:T},P=()=>{if(s){let I=!h;y(I),m?.(I)}},R=d.length>0;return ou.default.createElement(OL,{ref:_,style:E,className:we("tw-mb-2",O&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],a&&"tw-touch-manipulation",p)},ou.default.createElement(EL,{className:"tw-p-3"},ou.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},a&&ou.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...g,...b},ou.default.createElement(fx,{className:"tw-size-4"})),ou.default.createElement("div",{className:"tw-flex-1 tw-touch-auto",onClick:s?P:void 0,style:{cursor:s?"pointer":"default"}},ou.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},s&&ou.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},h?ou.default.createElement(Wi,{className:"tw-size-3 tw-stroke-[7]"}):ou.default.createElement(ld,{className:"tw-size-3 tw-stroke-[7]"})),i&&ou.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},i),ou.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},ou.default.createElement("div",{className:"tw-break-words tw-font-medium tw-leading-relaxed"},r,o&&ou.default.createElement("span",{className:"tw-ml-1 tw-inline-flex tw-items-center"},o)),n&&ou.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ou.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},n))))),ou.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},c&&ou.default.createElement(pe,{variant:"ghost",size:"icon",onClick:I=>{I.stopPropagation(),c.onClick(e)},title:c.tooltip},c.icon),R&&ou.default.createElement(mN,null,ou.default.createElement(hN,{asChild:!0},ou.default.createElement(pe,{variant:"ghost",size:"icon"},ou.default.createElement(IO,{className:"tw-size-4"}))),ou.default.createElement(Dv,{align:"end",container:f?.current},d.map((I,N)=>ou.default.createElement(Ni,{key:N,onClick:z=>{z.stopPropagation(),I.onClick(e)},className:we(I.variant==="destructive"&&"tw-text-error")},ou.default.createElement("span",{className:"tw-mr-2 tw-flex tw-size-4 tw-items-center tw-justify-center"},I.icon),I.label))))))),s&&ou.default.createElement("div",{className:we("tw-transition-all tw-duration-300 tw-ease-in-out",h?"tw-max-h-96 tw-opacity-100":"tw-max-h-0 tw-overflow-hidden tw-opacity-0")},ou.default.createElement(PL,{className:"tw-p-3 tw-pt-0"},l)))}Or();var Th=$(J());$r();var hpe=Th.forwardRef(({className:t,...e},r)=>Th.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Th.createElement("table",{ref:r,className:we("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));hpe.displayName="Table";var gpe=Th.forwardRef(({className:t,...e},r)=>Th.createElement("thead",{ref:r,className:we("[&_tr]:tw-border-b",t),...e}));gpe.displayName="TableHeader";var ype=Th.forwardRef(({className:t,...e},r)=>Th.createElement("tbody",{ref:r,className:t,...e}));ype.displayName="TableBody";var g0i=Th.forwardRef(({className:t,...e},r)=>Th.createElement("tfoot",{ref:r,className:we("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));g0i.displayName="TableFooter";var Cz=Th.forwardRef(({className:t,...e},r)=>Th.createElement("tr",{ref:r,className:we("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));Cz.displayName="TableRow";var T_=Th.forwardRef(({className:t,...e},r)=>Th.createElement("th",{ref:r,className:we("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}));T_.displayName="TableHead";var Ob=Th.forwardRef(({className:t,...e},r)=>Th.createElement("td",{ref:r,className:we("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));Ob.displayName="TableCell";var y0i=Th.forwardRef(({className:t,...e},r)=>Th.createElement("caption",{ref:r,className:we("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));y0i.displayName="TableCaption";$r();Xe();Ye();Nte();var Nl=$(J());$r();Or();var Sy=$(J());var ul=$(J(),1);var ZZs=!!(typeof window<"u"&&window.document&&window.document.createElement);function _Q(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Vin=$(J(),1);function zin(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function a0t(...t){return e=>{let r=!1,n=t.map(o=>{let i=zin(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():zin(t[o],null)}}}}function vQ(...t){return Vin.useCallback(a0t(...t),t)}var NC=$(J(),1),s0t=$(St(),1);function Hin(t,e){let r=NC.createContext(e),n=i=>{let{children:a,...s}=i,u=NC.useMemo(()=>s,Object.values(s));return(0,s0t.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=NC.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 Win(t,e=[]){let r=[];function n(i,a){let s=NC.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=NC.useMemo(()=>m,Object.values(m));return(0,s0t.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=NC.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=>NC.createContext(a));return function(s){let u=s?.[t]||i;return NC.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,b0i(o,...e)]}function b0i(...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 NC.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var u0t=$(J(),1);var Jin=$(J(),1),j6=globalThis?.document?Jin.useLayoutEffect:()=>{};var _0i=u0t[" useId ".trim().toString()]||(()=>{}),v0i=0;function SUe(t){let[e,r]=u0t.useState(_0i());return j6(()=>{t||r(n=>n??String(v0i++))},[t]),t||(e?`radix-${e}`:"")}var DC=$(J(),1);var CUe=$(J(),1);var w0i=DC[" useInsertionEffect ".trim().toString()]||j6;function Kin({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=S0i({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=DC.useRef(t!==void 0);DC.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=DC.useCallback(c=>{if(s){let d=C0i(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function S0i({defaultProp:t,onChange:e}){let[r,n]=DC.useState(t),o=DC.useRef(r),i=DC.useRef(e);return w0i(()=>{i.current=e},[e]),DC.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function C0i(t){return typeof t=="function"}var iYs=Symbol("RADIX:SYNC_STATE");var Kv=$(J(),1);var Gin=$(J(),1);function x0i(t,e){return Gin.useReducer((r,n)=>e[r][n]??r,t)}var bpe=t=>{let{present:e,children:r}=t,n=T0i(e),o=typeof r=="function"?r({present:n.isPresent}):Kv.Children.only(r),i=vQ(n.ref,O0i(o));return typeof r=="function"||n.isPresent?Kv.cloneElement(o,{ref:i}):null};bpe.displayName="Presence";function T0i(t){let[e,r]=Kv.useState(),n=Kv.useRef(null),o=Kv.useRef(t),i=Kv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=x0i(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Kv.useEffect(()=>{let l=xUe(n.current);i.current=s==="mounted"?l:"none"},[s]),j6(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=xUe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),j6(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=xUe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let y=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=p=>{p.target===e&&(i.current=xUe(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:Kv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function xUe(t){return t?.animationName||"none"}function O0i(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 Xin=$(J(),1),A0i=$(hu(),1);var Oh=$(J(),1);var TUe=$(St(),1);function OUe(t){let e=E0i(t),r=Oh.forwardRef((n,o)=>{let{children:i,...a}=n,s=Oh.Children.toArray(i),u=s.find(M0i);if(u){let l=u.props.children,c=s.map(d=>d===u?Oh.Children.count(l)>1?Oh.Children.only(null):Oh.isValidElement(l)?l.props.children:null:d);return(0,TUe.jsx)(e,{...a,ref:o,children:Oh.isValidElement(l)?Oh.cloneElement(l,void 0,c):null})}return(0,TUe.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function E0i(t){let e=Oh.forwardRef((r,n)=>{let{children:o,...i}=r;if(Oh.isValidElement(o)){let a=I0i(o),s=R0i(i,o.props);return o.type!==Oh.Fragment&&(s.ref=n?a0t(n,a):a),Oh.cloneElement(o,s)}return Oh.Children.count(o)>1?Oh.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var P0i=Symbol("radix.slottable");function M0i(t){return Oh.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===P0i}function R0i(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 I0i(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 Zin=$(St(),1),N0i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wQ=N0i.reduce((t,e)=>{let r=OUe(`Primitive.${e}`),n=Xin.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Zin.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Pu=$(St(),1),PUe="Dialog",[Yin,PYs]=Win(PUe),[D0i,HT]=Yin(PUe),Qin=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=ul.useRef(null),u=ul.useRef(null),[l,c]=Kin({prop:n,defaultProp:o??!1,onChange:i,caller:PUe});return(0,Pu.jsx)(D0i,{scope:e,triggerRef:s,contentRef:u,contentId:SUe(),titleId:SUe(),descriptionId:SUe(),open:l,onOpenChange:c,onOpenToggle:ul.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};Qin.displayName=PUe;var ean="DialogTrigger",tan=ul.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=HT(ean,r),i=vQ(e,o.triggerRef);return(0,Pu.jsx)(wQ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":d0t(o.open),...n,ref:i,onClick:_Q(t.onClick,o.onOpenToggle)})});tan.displayName=ean;var l0t="DialogPortal",[j0i,ran]=Yin(l0t,{forceMount:void 0}),nan=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=HT(l0t,e);return(0,Pu.jsx)(j0i,{scope:e,forceMount:r,children:ul.Children.map(n,a=>(0,Pu.jsx)(bpe,{present:r||i.open,children:(0,Pu.jsx)(xT,{asChild:!0,container:o,children:a})}))})};nan.displayName=l0t;var EUe="DialogOverlay",oan=ul.forwardRef((t,e)=>{let r=ran(EUe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=HT(EUe,t.__scopeDialog);return i.modal?(0,Pu.jsx)(bpe,{present:n||i.open,children:(0,Pu.jsx)(L0i,{...o,ref:e})}):null});oan.displayName=EUe;var $0i=OUe("DialogOverlay.RemoveScroll"),L0i=ul.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=HT(EUe,r);return(0,Pu.jsx)(Z$,{as:$0i,allowPinchZoom:!0,shards:[o.contentRef],children:(0,Pu.jsx)(wQ.div,{"data-state":d0t(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),$6="DialogContent",ian=ul.forwardRef((t,e)=>{let r=ran($6,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=HT($6,t.__scopeDialog);return(0,Pu.jsx)(bpe,{present:n||i.open,children:i.modal?(0,Pu.jsx)(F0i,{...o,ref:e}):(0,Pu.jsx)(k0i,{...o,ref:e})})});ian.displayName=$6;var F0i=ul.forwardRef((t,e)=>{let r=HT($6,t.__scopeDialog),n=ul.useRef(null),o=vQ(e,r.contentRef,n);return ul.useEffect(()=>{let i=n.current;if(i)return TB(i)},[]),(0,Pu.jsx)(aan,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_Q(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:_Q(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:_Q(t.onFocusOutside,i=>i.preventDefault())})}),k0i=ul.forwardRef((t,e)=>{let r=HT($6,t.__scopeDialog),n=ul.useRef(!1),o=ul.useRef(!1);return(0,Pu.jsx)(aan,{...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()}})}),aan=ul.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=HT($6,r),u=ul.useRef(null),l=vQ(e,u);return SB(),(0,Pu.jsxs)(Pu.Fragment,{children:[(0,Pu.jsx)(G$,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,Pu.jsx)(_T,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":d0t(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,Pu.jsxs)(Pu.Fragment,{children:[(0,Pu.jsx)(q0i,{titleId:s.titleId}),(0,Pu.jsx)(B0i,{contentRef:u,descriptionId:s.descriptionId})]})]})}),c0t="DialogTitle",san=ul.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=HT(c0t,r);return(0,Pu.jsx)(wQ.h2,{id:o.titleId,...n,ref:e})});san.displayName=c0t;var uan="DialogDescription",lan=ul.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=HT(uan,r);return(0,Pu.jsx)(wQ.p,{id:o.descriptionId,...n,ref:e})});lan.displayName=uan;var can="DialogClose",dan=ul.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=HT(can,r);return(0,Pu.jsx)(wQ.button,{type:"button",...n,ref:e,onClick:_Q(t.onClick,()=>o.onOpenChange(!1))})});dan.displayName=can;function d0t(t){return t?"open":"closed"}var fan="DialogTitleWarning",[MYs,pan]=Hin(fan,{contentName:$6,titleName:c0t,docsSlug:"dialog"}),q0i=({titleId:t})=>{let e=pan(fan),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 ul.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},U0i="DialogDescriptionWarning",B0i=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pan(U0i).contentName}}.`;return ul.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},man=Qin,han=tan,gan=nan,f0t=oan,p0t=ian,m0t=san,h0t=lan,yan=dan;Or();$r();var MUe=man,ban=han,V0i=gan;var _an=Sy.forwardRef(({className:t,...e},r)=>Sy.createElement(f0t,{ref:r,className:we("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}));_an.displayName=f0t.displayName;var _pe=Sy.forwardRef(({className:t,children:e,container:r,...n},o)=>Sy.createElement(V0i,{container:r},Sy.createElement(_an,null),Sy.createElement(p0t,{ref:o,className:we("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,Sy.createElement(yan,{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"},Sy.createElement(qo,{className:"tw-size-4"}),Sy.createElement("span",{className:"tw-sr-only"},"Close")))));_pe.displayName=p0t.displayName;var vpe=({className:t,...e})=>Sy.createElement("div",{className:we("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});vpe.displayName="DialogHeader";var H0i=({className:t,...e})=>Sy.createElement("div",{className:we("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});H0i.displayName="DialogFooter";var wpe=Sy.forwardRef(({className:t,...e},r)=>Sy.createElement(m0t,{ref:r,className:we("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));wpe.displayName=m0t.displayName;var Spe=Sy.forwardRef(({className:t,...e},r)=>Sy.createElement(h0t,{ref:r,className:we("tw-text-sm tw-text-muted",t),...e}));Spe.displayName=h0t.displayName;Bt();function qr(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=_z(),a="onChange"in t?t.onChange:void 0,s=(0,Nl.useMemo)(()=>{if(a)return yye(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Nl.default.createElement(ri,{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 Nl.default.createElement(AN,{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 Nl.default.createElement(h_,{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 Nl.default.createElement(dT,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Nl.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},Nl.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:we("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&&Nl.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Nl.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Nl.default.createElement("div",{className:we("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")},Nl.default.createElement(Wi,{className:"tw-size-4"})));case"slider":return Nl.default.createElement(Kfe,{value:t.value||0,onChange:t.onChange,min:t.min,max:t.max,step:t.step,suffix:t.suffix,disabled:o,className:"tw-w-full sm:tw-w-[300px]"});case"dialog":return Nl.default.createElement(MUe,null,Nl.default.createElement(ban,{asChild:!0},t.trigger),Nl.default.createElement(_pe,{container:i},(t.dialogTitle||t.dialogDescription)&&Nl.default.createElement(vpe,null,t.dialogTitle&&Nl.default.createElement(wpe,null,t.dialogTitle),t.dialogDescription&&Nl.default.createElement(Spe,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Nl.default.createElement("div",{className:we("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)},Nl.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},Nl.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&Nl.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),Nl.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var RUe=require("obsidian"),W0i=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o,containerRef:i})=>{let a=l=>{new hB(app,e,l,async d=>{await r(d,l.title)}).open()},s=[{icon:Rt.default.createElement(YS,{className:"tw-size-4"}),label:"Edit",onClick:a},{icon:Rt.default.createElement($g,{className:"tw-size-4"}),label:"Copy",onClick:o},{icon:Rt.default.createElement(Vy,{className:"tw-size-4"}),label:"Delete",onClick:l=>{new zu(app,()=>n(l),`Are you sure you want to delete the command "${l.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()},variant:"destructive"}],u=Rt.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-justify-around"},Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Rt.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Menu"),Rt.default.createElement(to,{content:Rt.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")})),Rt.default.createElement(Rl,{checked:t.showInContextMenu,onCheckedChange:l=>{r({...t,showInContextMenu:l===!0},t.title)}})),Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Rt.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Slash"),Rt.default.createElement(to,{content:Rt.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")})),Rt.default.createElement(Rl,{checked:t.showInSlashMenu,onCheckedChange:l=>r({...t,showInSlashMenu:l===!0},t.title)})));return Rt.default.createElement(wUe,{id:t.title,item:t,title:t.title,isDraggable:!0,isExpandable:!0,expandedContent:u,primaryAction:{icon:Rt.default.createElement(YS,{className:"tw-size-4"}),onClick:a,tooltip:"Edit Command"},dropdownActions:s,containerRef:i})},J0i=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=bQ({id:t.title}),d={transform:RC.Transform.toString(u),transition:l},f=()=>{n(t)};return Rt.default.createElement(Cz,{ref:s,style:d,className:we("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},Rt.default.createElement(Ob,{className:"tw-w-10"},Rt.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},Rt.default.createElement(fx,{className:"tw-size-4"}))),Rt.default.createElement(Ob,null,t.title),Rt.default.createElement(Ob,{className:"tw-text-center"},Rt.default.createElement(Rl,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Rt.default.createElement(Ob,{className:"tw-text-center"},Rt.default.createElement(Rl,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Rt.default.createElement(Ob,{className:"tw-text-center"},Rt.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Rt.default.createElement(pe,{variant:"ghost",size:"icon",onClick:()=>{new hB(app,e,t,async m=>{await r(m,t.title)}).open()}},Rt.default.createElement(YS,{className:"tw-size-4"})),Rt.default.createElement(pe,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Rt.default.createElement($g,{className:"tw-size-4"})),Rt.default.createElement(pe,{variant:"ghost",size:"icon",onClick:()=>{new zu(app,f,`Are you sure you want to delete the command "${t.title}"? This will permanently remove the command file and cannot be undone.`,"Delete Command","Delete","Cancel").open()}},Rt.default.createElement(Vy,{className:"tw-size-4"})))))},van=()=>{let t=g$e(),e=(0,Rt.useMemo)(()=>ide([...t]),[t]),r=Br(),n=(0,Rt.useRef)(null),o=pUe(pQ(Sz,{activationConstraint:{distance:8}}),pQ(wz,{coordinateGetter:vUe})),i=async(d,f)=>{await th.getInstance().updateCommand(d,f)},a=async d=>{await th.getInstance().createCommand(d)},s=async d=>{try{await th.getInstance().deleteCommand(d),new RUe.Notice(`Command "${d.title}" deleted successfully!`)}catch(f){throw ne("Failed to delete command:",f),new RUe.Notice("Failed to delete command. Please try again."),f}},u=async d=>{try{let f=AWr(d.title,e),p={...d,title:f};await th.getInstance().createCommand(p,{autoOrder:!1})}catch(f){ne("Failed to copy command:",f),new RUe.Notice("Failed to copy command. Please try again.")}},l=async d=>{let{active:f,over:p}=d;if(!p||f.id===p.id)return;let m=e.findIndex(b=>b.title===f.id),h=e.findIndex(b=>b.title===p.id);if(m===-1||h===-1)return;let y=[...e],[g]=y.splice(m,1);y.splice(h,0,g),await th.getInstance().reorderCommands(y)},c=()=>Rt.default.createElement("div",{className:"tw-relative md:tw-hidden"},Rt.default.createElement(hQ,{sensors:o,collisionDetection:mQ,onDragEnd:l},Rt.default.createElement(yQ,{items:e.map(d=>d.title),strategy:gQ},Rt.default.createElement("div",{className:"tw-space-y-2"},e.length===0?Rt.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-border tw-bg-primary tw-p-8 tw-text-center tw-text-muted"},"No custom prompt files found."):e.map(d=>Rt.default.createElement(W0i,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u,containerRef:n}))))));return Rt.default.createElement("div",{className:"tw-space-y-4",ref:n},Rt.default.createElement("section",null,Rt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},Rt.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),Rt.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 ",Rt.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),Rt.default.createElement(qr,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:d=>{Re("customPromptsFolder",d),b$e()},placeholder:"copilot/copilot-custom-prompts"}),Rt.default.createElement(qr,{type:"switch",title:"Custom Prompt Templating",description:"Process variables like {activenote}, {foldername}, or {#tag} in prompts. Disable for raw prompts.",checked:r.enableCustomPromptTemplating,onCheckedChange:d=>{Re("enableCustomPromptTemplating",d)}}),Rt.default.createElement(qr,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:d=>Re("promptSortStrategy",d),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),Rt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-items-start tw-gap-2 tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4 tw-text-muted"},Rt.default.createElement(px,{className:"tw-size-5"})," ",Rt.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",Rt.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),Rt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Rt.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between tw-gap-2 md:tw-justify-end"},Rt.default.createElement("div",null,Rt.default.createElement(pe,{variant:"secondary",onClick:()=>new zu(app,USt,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default")),Rt.default.createElement(pe,{variant:"default",className:"tw-gap-2",onClick:()=>{let d={...lN};new hB(app,e,d,async p=>{await a(p)}).open()}},Rt.default.createElement(Zb,{className:"tw-size-2 md:tw-size-4"}),"Add Cmd")),Rt.default.createElement("div",{className:"tw-hidden md:tw-block"},Rt.default.createElement(hQ,{sensors:o,collisionDetection:mQ,onDragEnd:l},Rt.default.createElement(hpe,null,Rt.default.createElement(gpe,null,Rt.default.createElement(Cz,null,Rt.default.createElement(T_,{className:"tw-w-10"}),Rt.default.createElement(T_,null,"Name"),Rt.default.createElement(T_,{className:"tw-w-24 tw-text-center"},Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",Rt.default.createElement(to,{content:Rt.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available in the context menu when you right-click in the editor.")}))),Rt.default.createElement(T_,{className:"tw-w-28 tw-text-center"},Rt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",Rt.default.createElement(to,{content:Rt.default.createElement("div",{className:"tw-max-w-xs tw-text-xs"},"If enabled, the command will be available as a slash command in the chat.")}))),Rt.default.createElement(T_,{className:"tw-w-32 tw-text-center"},"Actions"))),Rt.default.createElement(yQ,{items:e.map(d=>d.title),strategy:gQ},Rt.default.createElement(ype,null,e.length===0?Rt.default.createElement(Cz,null,Rt.default.createElement(Ob,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(d=>Rt.default.createElement(J0i,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u}))))))),c())))};Or();var zi=$(J());Cn();O4();Ye();Or();var vg=$(J());var wan=()=>{let t=Br(),e=rje(),n=e.some(s=>s.title===t.defaultSystemPromptTitle)?t.defaultSystemPromptTitle:"",o=s=>{s&&Re("defaultSystemPromptTitle",s)},i=()=>{if(!n)return;let s=vC(n);app.setting.close(),app.workspace.openLinkText(s,"",!0)},a=()=>{new Bde(app,e).open()};return vg.default.createElement("div",{className:"tw-space-y-4"},vg.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},vg.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"User System Prompt"),vg.default.createElement(qr,{type:"custom",title:"Default System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!"},vg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vg.default.createElement(_N,{value:n,onChange:s=>o(s.target.value),options:e.map(s=>({label:s.title===t.defaultSystemPromptTitle?`${s.title} (Default)`:s.title,value:s.title})),placeholder:"Select system prompt",containerClassName:"tw-flex-1"}),vg.default.createElement(pe,{variant:"ghost",size:"icon",onClick:i,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!n},vg.default.createElement(E1,{className:"tw-size-5"})),vg.default.createElement(pe,{variant:"default",size:"icon",onClick:a,title:"Add new prompt"},vg.default.createElement(Zb,{className:"tw-size-4"})))),vg.default.createElement(qr,{type:"text",title:"System Prompts Folder Name",description:"Folder where system prompts are stored.",value:t.userSystemPromptsFolder,onChange:s=>Re("userSystemPromptsFolder",s),placeholder:"copilot/system-prompts"})),vg.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},vg.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"Others"),vg.default.createElement(qr,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:s=>{Re("enableEncryption",s)}}),vg.default.createElement(qr,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:s=>{Re("debug",s)}}),vg.default.createElement(qr,{type:"custom",title:"Create Log File",description:`Open the Copilot log file (${Im.getLogPath()}) for easy sharing when reporting issues.`},vg.default.createElement(pe,{variant:"secondary",size:"sm",onClick:async()=>{await QEe(),await Im.flush(),await Im.openLogFile()}},"Create Log File"))))};sd();Cn();mr();$r();Fc();Ye();var Em=$(J()),San=require("obsidian"),Can=$(jm());Cn();Fc();Ye();Or();function K0i({onConfirm:t,onCancel:e}){let r=te();return Em.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Em.default.createElement("div",null,Em.default.createElement("p",null,"Thanks for purchasing ",Em.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!"),Em.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),Em.default.createElement("ul",{className:"tw-pl-4"},Em.default.createElement("li",null,"Default mode: ",Em.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),Em.default.createElement("li",null,"Chat model: ",Em.default.createElement("b",{className:"tw-text-accent"},Gat)),Em.default.createElement("li",null,Em.default.createElement("div",null,"Embedding model:"," ",Em.default.createElement("b",{className:"tw-text-accent"},Xat)),r.embeddingModelKey!==Zat&&Em.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},Em.default.createElement(Lg,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),Em.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},Em.default.createElement(pe,{variant:"ghost",onClick:e},"Apply Later"),Em.default.createElement(pe,{variant:"default",onClick:t},"Apply Now")))}var IUe=class extends San.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Can.createRoot)(e);let r=()=>{J_r(),this.close()},n=()=>{this.close()};this.root.render(Em.default.createElement(K0i,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};Cn();mr();Fc();Ye();Or();var rd=$(J());function xan(){let t=Br(),[e,r]=(0,rd.useState)(null),[n,o]=(0,rd.useState)(!1),i=o9(),[a,s]=(0,rd.useState)(t.plusLicenseKey);return(0,rd.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),rd.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},rd.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},rd.default.createElement("span",null,"Copilot Plus"),i&&rd.default.createElement(Qc,{variant:"outline",className:"tw-text-success"},"Active")),rd.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},rd.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:"," ",rd.default.createElement("strong",null," ","including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more.")),rd.default.createElement("div",null,"Copilot Plus is evolving fast, with new features and improvements rolling out regularly. Join now to secure the lowest price and get early access!")),rd.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},rd.default.createElement(AN,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),rd.default.createElement(pe,{disabled:n,onClick:async()=>{Re("plusLicenseKey",a),o(!0);let u=await E0();o(!1),u?(r(null),new IUe(app).open()):r("Invalid license key")},className:"tw-min-w-10 tw-text-xs md:tw-text-sm"},n?rd.default.createElement(Bs,{className:"tw-size-2 tw-animate-spin md:tw-size-4"}):"Apply"),rd.default.createElement(pe,{className:"tw-text-xs md:tw-text-sm",variant:"secondary",onClick:()=>t2(m1.SETTINGS)},"Join Now ",rd.default.createElement(M1,{className:"tw-size-2 md:tw-size-4"}))),rd.default.createElement("div",{className:"tw-text-error"},e))}Bt();l1();Or();var Cpe=require("obsidian"),pt=$(J());Cn();mr();Ye();Cn();mr();KDe();Imt();Ye();Cn();Xe();Ye();mr();vO();KDe();Xe();mr();Xe();var G0i={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"}))||[],"amazon-bedrock":t=>[],openrouterai:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"openrouterai"}))||[],siliconflow:t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"siliconflow"}))||[],"github-copilot":t=>t.data?.map(e=>({id:e.id,name:e.id,provider:"github-copilot"}))||[]},X0i=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})):[],Z0i=t=>G0i[t]||X0i(t),g0t=(t,e)=>{let r=Z0i(t);try{return r(e)}catch(n){return ne(`Error parsing ${t} model data:`,n),[]}};Bt();hF();async function Tan(t){try{if(t==="github-copilot"){let l=await BU.getInstance().listModels();return{success:!0,models:g0t(t,l)}}let e=Bb(t);if(!e)return{success:!1,models:[],error:"API key not configured"};e=await oo(e);let r=d1(t).listModelURL;if(!r)return{success:!1,models:[],error:"Provider does not support model listing"};let n={Authorization:`Bearer ${e}`};t==="google"?(r+=`?key=${e}`,n={}):t==="anthropic"&&(n={"x-api-key":e,"anthropic-version":"2023-06-01"});let o=async u=>{let l=new AbortController,c=setTimeout(()=>l.abort(),3e3);try{let d=await(u?gl:fetch)(r,{headers:n,signal:l.signal,method:"GET"});if(!d.ok){let f=zr(await d.json());throw ne(f),new Error(`Failed to fetch models: ${d.statusText}
|
||
detail: `+f)}return d}finally{clearTimeout(c)}},i;try{i=await o(!1)}catch(u){Te("First fetch attempt failed, trying with safeFetch...");try{i=await o(!0)}catch(l){let c=`
|
||
without CORS Error: `+zr(u)+`
|
||
with CORS Error: `+zr(l);throw new Error(c)}}let a=await i.json();return{success:!0,models:g0t(t,a)}}catch(e){return ne(`Error fetching models for ${t}:`,e),{success:!1,models:[],error:zr(e)}}}async function Oan(t,e,r){let n=r?.skipVerification??!1,i=!!e.find(c=>c.name===t.name&&c.provider===t.provider),a=t.provider==="github-copilot"?void 0:Bb(t.provider),s={name:t.name,provider:t.provider,apiKey:a,enabled:!0},u=!1,l;if(!n)try{await ry.instance.getCurrentChainManager().chatModelManager.ping(s)}catch(c){u=!0,l=zr(c),ne("Model verification failed:",c)}return{success:!0,alreadyExists:i,verificationFailed:u,verificationError:l}}function Ean(t){return{name:t.name,provider:t.provider,enabled:!0}}Bt();Or();var AL=require("obsidian"),Hu=$(J());function AUe({provider:t,isReady:e,expanded:r=!1,skipVerification:n=!1,credentialVersion:o}){let i=Br(),[a,s]=(0,Hu.useState)(null),[u,l]=(0,Hu.useState)(!1),[c,d]=(0,Hu.useState)(null),[f,p]=(0,Hu.useState)(null),[m,h]=(0,Hu.useState)(!1),y=(0,Hu.useRef)(!1),g=(0,Hu.useCallback)(async()=>{if(!(y.current||!e)){y.current=!0,l(!0),d(null);try{let w=await Tan(t);w.success?s(w.models):(d(w.error||"Failed to load models"),new AL.Notice(`Failed to load models for ${Rg(t)}: ${w.error}`,5e3))}catch(w){let T=zr(w);d(T),new AL.Notice(`Failed to load models for ${Rg(t)}: ${T}`,5e3)}finally{l(!1),y.current=!1}}},[t,e]);(0,Hu.useEffect)(()=>{s(null),p(null),d(null)},[t,o]),(0,Hu.useEffect)(()=>{r&&e&&a===null&&!u&&!c&&g()},[r,e,a,u,c,g]);let b=async()=>{if(!f){new AL.Notice("Please select a model first");return}h(!0);try{let w=await Oan({id:f.id,name:f.name,provider:t},i.activeModels,{skipVerification:n});if(w.alreadyExists)w.verificationFailed?new AL.Notice(`Model ${f.name} already exists (verification failed: ${w.verificationError})`,1e4):new AL.Notice(`Model ${f.name} verified successfully! It already exists in your models list.`);else{let T=Ean({id:f.id,name:f.name,provider:t}),O=[...i.activeModels,T];Re("activeModels",O),w.verificationFailed?new AL.Notice(`Model ${f.name} added (verification failed: ${w.verificationError})`,1e4):new AL.Notice(`Model ${f.name} verified and added to your models list!`)}}catch(w){ne("Error adding model:",w),new AL.Notice(`Failed to add model: ${zr(w)}`)}finally{h(!1)}},_=a?.filter((w,T,O)=>O.findIndex(E=>E.id===w.id)===T).sort((w,T)=>w.name.localeCompare(T.name));return Hu.default.createElement(Vo,{label:"Model",description:"Add the selected model to your models list. After adding, check the Model Tab."},Hu.default.createElement("div",null,Hu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hu.default.createElement("div",{className:"tw-flex-1"},Hu.default.createElement(_N,{options:_?.map(w=>({label:w.name,value:w.id}))||[],onChange:w=>{let T=w.target.value,O=a?.find(E=>E.id===T);O&&p(O)},onClick:()=>{a===null&&!u&&g()},value:f?.id||"",placeholder:"Select Model",disabled:!e||u})),Hu.default.createElement("div",{className:"tw-w-[72px]"},Hu.default.createElement(pe,{onClick:b,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?Hu.default.createElement(Bs,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Hu.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&Hu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&Hu.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models. ",c),a&&a.length===0&&Hu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available."),a===null&&!u&&!c&&Hu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load available models."))))}Or();var L6=require("obsidian"),vr=$(J());function Pan(){let t=Br(),[e]=(0,vr.useState)(()=>BU.getInstance()),[r,n]=(0,vr.useState)("idle"),[o,i]=(0,vr.useState)(null),[a,s]=(0,vr.useState)(0),[u,l]=(0,vr.useState)(null),[c,d]=(0,vr.useState)(!1),f=(0,vr.useRef)(0),p=(0,vr.useRef)(!0);(0,vr.useEffect)(()=>(p.current=!0,()=>{p.current=!1,f.current+=1,e.abortPolling()}),[e]),(0,vr.useEffect)(()=>{e.getAuthState().status==="authenticated"&&n("done")},[e]),(0,vr.useEffect)(()=>{e.getAuthState().status==="authenticated"?r!=="pending"&&r!=="polling"&&n("done"):r==="done"&&n("idle")},[t.githubCopilotToken,t.githubCopilotAccessToken,t.githubCopilotTokenExpiresAt,e,r]);let m=async(O,E)=>{await e.pollForAccessToken(O.deviceCode,O.interval,O.expiresIn,P=>{p.current&&E===f.current&&s(P)}),await e.fetchCopilotToken(),!(!p.current||E!==f.current)&&(n("done"),i(null),new L6.Notice("GitHub Copilot connected successfully!"))},h=async()=>{let O=++f.current;n("pending"),l(null),s(0);try{let E=await e.startDeviceCodeFlow();if(!p.current||O!==f.current)return;i(E),n("polling"),d(!0);try{await m(E,O)}catch(P){if(!p.current||O!==f.current||Rmt(P))return;throw P}}catch(E){if(!p.current||O!==f.current)return;let P=E instanceof Error?E.message:String(E);l(P),n("error"),new L6.Notice(`Authentication failed: ${P}`)}},y=()=>{let O=r==="pending"||r==="polling"||r==="error"&&o;f.current+=1,e.resetAuth(),n("idle"),i(null),l(null),s(0),d(!1),new L6.Notice(O?"Authentication cancelled":"GitHub Copilot disconnected")},g=async O=>{try{await navigator.clipboard.writeText(O),new L6.Notice("Copied to clipboard!")}catch{new L6.Notice("Failed to copy to clipboard")}},b=r==="done",_=r==="pending"||r==="polling",w=(r==="polling"||r==="error")&&o!==null,T=async()=>{if(!o)return;let O=++f.current;n("polling"),l(null),s(0);try{await m(o,O)}catch(E){if(!p.current||O!==f.current||Rmt(E))return;let P=E instanceof Error?E.message:String(E);l(P),n("error"),new L6.Notice(`Authentication failed: ${P}`)}};return vr.default.createElement(vr.default.Fragment,null,vr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-font-medium"},vr.default.createElement("div",{className:"tw-truncate"},"GitHub Copilot"),vr.default.createElement(to,{content:vr.default.createElement("div",{className:"tw-max-w-[250px]"},vr.default.createElement("div",{className:"tw-font-semibold"},"Unofficial Integration"),vr.default.createElement("p",{className:"tw-mt-1"},"This uses GitHub Copilot's internal API, which is not officially supported for third-party apps. It may stop working at any time.")),side:"bottom"},vr.default.createElement("span",{className:"tw-cursor-help tw-text-warning"},"\u26A0\uFE0F"))),vr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center"},vr.default.createElement("div",{className:`tw-flex tw-h-9 tw-flex-1 tw-items-center tw-rounded-md tw-border tw-border-border tw-px-3 tw-text-sm ${b?"tw-text-success":_?"tw-text-warning":r==="error"?"tw-text-error":"tw-text-muted"}`},b?"\u2713 Connected":_?"Authenticating...":r==="error"?"Error - Click Setup to retry":"Not connected"),vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},b&&vr.default.createElement(pe,{onClick:y,variant:"ghost",className:"tw-flex tw-flex-1 tw-items-center tw-justify-center tw-whitespace-nowrap tw-px-4 tw-py-2 tw-text-warning hover:tw-text-warning sm:tw-flex-none"},"Disconnect"),vr.default.createElement(pe,{onClick:()=>{!b&&!_?h():d(!c)},disabled:_,variant:"secondary",className:"tw-flex tw-flex-1 tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2 sm:tw-flex-none"},_?vr.default.createElement(Bs,{className:"tw-size-4 tw-animate-spin"}):b?vr.default.createElement(vr.default.Fragment,null,"Add Model",c?vr.default.createElement(jg,{className:"tw-ml-1 tw-size-4"}):vr.default.createElement(Wi,{className:"tw-ml-1 tw-size-4"})):"Setup"))),vr.default.createElement("div",null,vr.default.createElement("a",{href:"https://github.com/settings/apps/authorizations",target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Manage GitHub Authorizations"))),vr.default.createElement(_y,{open:c},vr.default.createElement(vy,{className:"tw-rounded-md tw-p-3"},vr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},w&&o&&vr.default.createElement("div",{className:"tw-space-y-2.5 tw-rounded-lg tw-border tw-border-border tw-p-3.5 tw-bg-muted/10"},vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},vr.default.createElement("span",{className:"tw-font-semibold"},"1."),vr.default.createElement("span",{className:"tw-text-muted"},"Go to:"),vr.default.createElement("a",{href:o.verificationUri,target:"_blank",rel:"noopener noreferrer",className:"tw-break-all tw-text-accent tw-underline hover:tw-text-accent-hover"},o.verificationUri),vr.default.createElement(pe,{variant:"ghost",size:"sm",onClick:()=>g(o.verificationUri),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy URL"},vr.default.createElement($g,{className:"tw-size-3.5"}))),vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},vr.default.createElement("span",{className:"tw-font-semibold"},"2."),vr.default.createElement("span",{className:"tw-text-muted"},"Enter code:"),vr.default.createElement("code",{className:"tw-rounded-md tw-border-border tw-px-3 tw-py-1.5 tw-font-mono tw-text-base tw-font-bold tw-tracking-widest tw-bg-accent/10 tw-border-accent/30"},o.userCode),vr.default.createElement(pe,{variant:"ghost",size:"sm",onClick:()=>g(o.userCode),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy code"},vr.default.createElement($g,{className:"tw-size-3.5"}))),vr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-border-t tw-pt-2 tw-border-border/50"},r==="polling"?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-2 tw-py-1 tw-text-xs tw-text-muted"},vr.default.createElement(Bs,{className:"tw-size-3.5 tw-animate-spin"}),vr.default.createElement("span",null,"Waiting for authorization...",a>0&&` (Attempt ${a})`)),vr.default.createElement(pe,{onClick:y,variant:"ghost",size:"sm",className:"tw-w-full"},"Cancel")):vr.default.createElement(vr.default.Fragment,null,vr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-2 tw-py-1 tw-text-xs tw-text-error"},vr.default.createElement("span",null,"Polling failed - you can retry with the same code")),vr.default.createElement("div",{className:"tw-flex tw-gap-2"},vr.default.createElement(pe,{onClick:T,variant:"secondary",size:"sm",className:"tw-flex-1"},"Retry"),vr.default.createElement(pe,{onClick:y,variant:"ghost",size:"sm",className:"tw-flex-1"},"Start Over"))))),b&&vr.default.createElement(AUe,{provider:"github-copilot",isReady:b,expanded:c,credentialVersion:t.githubCopilotToken}),u&&vr.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-border tw-p-3.5 tw-text-xs tw-text-error tw-bg-muted/10"},u)))))}Cn();mr();Xe();Ye();Bt();Or();var NL=require("obsidian"),wi=$(J());function Man(t){return t.trim().replace(/\/+$/,"").replace(/\/v1$/i,"")}async function Y0i(t,e){let r=Man(t);return e==="ollama"?((await(0,NL.requestUrl)({url:`${r}/api/tags`,method:"GET"})).json?.models||[]).map(s=>({id:s.name,name:s.name})):((await(0,NL.requestUrl)({url:`${r}/v1/models`,method:"GET"})).json?.data||[]).map(i=>({id:i.id,name:i.id}))}function Q0i({service:t,expanded:e,onToggleExpand:r}){let n=Br(),[o,i]=(0,wi.useState)(t.url),[a,s]=(0,wi.useState)(null),[u,l]=(0,wi.useState)(!1),[c,d]=(0,wi.useState)(null),[f,p]=(0,wi.useState)(""),[m,h]=(0,wi.useState)(!1),y=async()=>{l(!0),d(null);try{let _=await Y0i(o,t.kind);s(_)}catch(_){ne(`Error fetching models for ${t.name}:`,_),d(zr(_)),s(null)}finally{l(!1)}},g=()=>{r(),!e&&!a&&!u&&y()},b=async()=>{if(!f||!a)return;let _=a.find(O=>O.id===f);if(!_)return;h(!0);let w=!1,T="";try{let O=t.kind,E=Man(o),P=t.kind==="ollama"?E:`${E}/v1`,R={name:_.name,provider:O,baseUrl:P,enabled:!0};try{await ry.instance.getCurrentChainManager().chatModelManager.ping(R)}catch(N){w=!0,T=zr(N),ne("Model verification failed:",N)}n.activeModels.find(N=>N.name===R.name&&N.provider===R.provider)?w?new NL.Notice(`Model ${_.name} already exists (verification failed: ${T})`,5e3):new NL.Notice(`Model ${_.name} already exists.`):(Re("activeModels",[...n.activeModels,R]),w?new NL.Notice(`Model ${_.name} added (verification failed: ${T})`,5e3):new NL.Notice(`Model ${_.name} added!`))}catch(O){new NL.Notice(`Failed to add model: ${zr(O)}`)}finally{h(!1)}};return wi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},wi.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},wi.default.createElement("div",{className:"tw-truncate"},t.name)),wi.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},wi.default.createElement("div",{className:"tw-flex-1"},wi.default.createElement(ri,{className:"tw-max-w-full",value:o,onChange:_=>{i(_.target.value),s(null),p(""),d(null)}})),wi.default.createElement("div",null,wi.default.createElement(pe,{onClick:g,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",e?wi.default.createElement(jg,{className:"tw-ml-1 tw-size-4"}):wi.default.createElement(Wi,{className:"tw-ml-1 tw-size-4"})))),wi.default.createElement(_y,{open:e,className:"tw-mt-2"},wi.default.createElement(vy,{className:"tw-rounded-md tw-p-3"},wi.default.createElement(Vo,{label:"Model",description:"Add the currently selected model to model List."},wi.default.createElement("div",null,wi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},wi.default.createElement("div",{className:"tw-flex-1"},wi.default.createElement(_N,{options:a?[...a].sort((_,w)=>_.name.localeCompare(w.name)).map(_=>({label:_.name,value:_.id})):[],onChange:_=>p(_.target.value),value:f,placeholder:"Select Model",disabled:u||!!c})),wi.default.createElement("div",{className:"tw-w-[72px]"},wi.default.createElement(pe,{onClick:b,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?wi.default.createElement(Bs,{className:"tw-size-4 tw-animate-spin"}):"Add"))),wi.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&wi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&wi.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed: ",c),a&&a.length===0&&wi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models found.")))))))}function Ran(){let[t,e]=(0,wi.useState)(null),r=[{id:"ollama",name:"Ollama",url:"http://localhost:11434",kind:"ollama"},{id:"lm-studio",name:"LM Studio",url:"http://localhost:1234",kind:"lm-studio"}];return wi.default.createElement("div",{className:"tw-mt-6 tw-border-t tw-border-border tw-pt-4"},wi.default.createElement("div",{className:"tw-mb-3"},wi.default.createElement("h3",{className:"tw-m-0 tw-text-base tw-font-bold"},"Local Services"),wi.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-muted"},"Need help?"," ",wi.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/blob/master/local_copilot.md",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent hover:tw-text-accent-hover"},"Setup guide"))),wi.default.createElement("div",{className:"tw-space-y-4"},r.map(n=>wi.default.createElement(Q0i,{key:n.id,service:n,expanded:t===n.id,onToggleExpand:()=>e(o=>o===n.id?null:n.id)}))))}Bt();Or();hF();var Ian=require("obsidian"),Ho=$(J()),Aan=$(jm());function eCi({onClose:t,onGoToModelTab:e}){let[r,n]=(0,Ho.useState)(null);(0,Ho.useEffect)(()=>{n(null)},[]);let o=bWe().map(a=>{let s=a,u=Bb(s);return{provider:s,apiKey:u}}),i=(a,s)=>{Bb(a)!==s&&Re(Ste[a],s)};return Ho.default.createElement("div",{className:"tw-p-4 sm:tw-max-w-[500px]"},Ho.default.createElement("div",{className:"tw-mb-4"},Ho.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Ho.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Ho.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Ho.default.createElement("div",{className:"tw-space-y-4"},o.map(a=>{let s=d1(a.provider),u=!!s.listModelURL,l=r===a.provider;return Ho.default.createElement(Ho.default.Fragment,{key:a.provider},Ho.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ho.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Ho.default.createElement("div",{className:"tw-truncate"},Rg(a.provider))),Ho.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ho.default.createElement("div",{className:"tw-flex-1"},Ho.default.createElement(AN,{className:"tw-max-w-full",value:a.apiKey,onChange:c=>i(a.provider,c)})),u&&Ho.default.createElement("div",null,Ho.default.createElement(pe,{onClick:()=>{n(l?null:a.provider)},disabled:!a.apiKey,variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 tw-whitespace-nowrap tw-px-4 tw-py-2"},"Add Model",l?Ho.default.createElement(jg,{className:"tw-ml-1 tw-size-4"}):Ho.default.createElement(Wi,{className:"tw-ml-1 tw-size-4"})))),Ho.default.createElement("div",null,s.keyManagementURL&&Ho.default.createElement("a",{href:s.keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",Rg(a.provider)," Key"))),u&&Ho.default.createElement(_y,{open:l,className:"tw-mt-2"},Ho.default.createElement(vy,{className:"tw-rounded-md tw-p-3"},Ho.default.createElement(AUe,{provider:a.provider,isReady:!!a.apiKey,expanded:l,credentialVersion:a.apiKey}))))})),Ho.default.createElement(Pan,null),Ho.default.createElement(Ran,null),e&&Ho.default.createElement("div",{className:"tw-mt-4 tw-border-t tw-border-border tw-pt-4"},Ho.default.createElement("div",{className:"tw-rounded-lg tw-border tw-p-4 tw-bg-secondary/30 tw-border-border/60"},Ho.default.createElement("div",{className:"tw-flex tw-gap-3"},Ho.default.createElement("div",{className:"tw-mt-0.5 tw-shrink-0"},Ho.default.createElement(tne,{className:"tw-size-5 tw-text-accent"})),Ho.default.createElement("div",{className:"tw-flex-1"},Ho.default.createElement("h4",{className:"tw-mb-1 tw-text-sm tw-font-semibold"},"Looking for Azure OpenAI or Custom Providers?"),Ho.default.createElement("p",{className:"tw-mb-3 tw-text-xs tw-leading-relaxed tw-text-muted"},"Providers like Azure OpenAI, OpenAI Format, or Local LLMs require additional configuration (Base URL, Deployment Name, etc.)."),Ho.default.createElement("button",{onClick:()=>{e(),t()},className:"tw-group tw-flex tw-items-center tw-gap-1 tw-text-sm tw-font-medium tw-text-accent hover:tw-text-accent-hover"},"Go to Model Settings",Ho.default.createElement(ld,{className:"tw-size-4 tw-transition-transform group-hover:tw-translate-x-0.5"}))))))),Ho.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Ho.default.createElement(pe,{onClick:t},"Close")))}var NUe=class extends Ian.Modal{constructor(e,r){super(e),this.onGoToModelTab=r}onOpen(){let{contentEl:e}=this;this.root=(0,Aan.createRoot)(e),this.root.render(Ho.default.createElement(eCi,{onClose:()=>this.close(),onGoToModelTab:this.onGoToModelTab}))}onClose(){this.root.unmount()}};var rCi={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},Nan=()=>{let t=Br(),{setSelectedTab:e}=_z(),[r,n]=(0,pt.useState)(!1),[o,i]=(0,pt.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),a=()=>{n(!0);try{let l=o||"{$date}_{$time}__{$topic}",d=["{$date}","{$time}","{$topic}"].filter(g=>!l.includes(g));if(d.length>0){new Cpe.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 Cpe.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=Mg(new Date),y=l.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",m.split("_")[0]).replace("{$time}",m.split("_")[1]);Re("defaultConversationNoteName",l),i(l),new Cpe.Notice(`Format applied successfully! Example: ${y}`,4e3)}catch(l){new Cpe.Notice(`Error applying format: ${l.message}`,4e3)}finally{n(!1)}},s=!!t.activeModels.find(l=>l.enabled&&no(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:uZ(l),value:no(l)}));return pt.default.createElement("div",{className:"tw-space-y-4"},pt.default.createElement(xan,null),pt.default.createElement("section",null,pt.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),pt.default.createElement("div",{className:"tw-space-y-4"},pt.default.createElement("div",{className:"tw-space-y-4"},pt.default.createElement(qr,{type:"custom",title:"API Keys",description:pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pt.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),pt.default.createElement(to,{content:pt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},pt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),pt.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."))}))},pt.default.createElement(pe,{onClick:()=>{new NUe(app,()=>e("model")).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",pt.default.createElement(rne,{className:"tw-size-4"})))),pt.default.createElement(qr,{type:"select",title:"Default Chat Model",description:pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pt.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),pt.default.createElement(to,{content:pt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},pt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),pt.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Set your OpenRouter API key in 'API keys' to use this model, or select a different model from another provider."))})),value:s?t.defaultModelKey:"Select Model",onChange:l=>{let c=t.activeModels.find(p=>p.enabled&&no(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=XJ(c,t);Re("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),pt.default.createElement(qr,{type:"select",title:"Default Mode",description:pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pt.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),pt.default.createElement(to,{content:pt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},pt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},pt.default.createElement("li",null,pt.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",pt.default.createElement("i",null,"Free to use with your own API key.")),pt.default.createElement("li",null,pt.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",pt.default.createElement("i",null,"Free to use with your own API key.")),pt.default.createElement("li",null,pt.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"," ",pt.default.createElement("a",{href:est(m1.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=>Re("defaultChainType",l),options:Object.entries(rCi).map(([l,c])=>({label:c,value:l}))}),pt.default.createElement(qr,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>Re("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),pt.default.createElement(qr,{type:"select",title:"Send Shortcut",description:pt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},pt.default.createElement("span",{className:"tw-leading-none"},"Choose keyboard shortcut to send messages"),pt.default.createElement(to,{content:pt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},pt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Shortcut not working?"),pt.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"If your selected shortcut doesn't work, check",pt.default.createElement("strong",null," Obsidian's Settings \u2192 Hotkeys")," to see if another command is using the same key combination. ",pt.default.createElement("br",null),"You may need to remove or change the conflicting hotkey first."))})),value:t.defaultSendShortcut,onChange:l=>Re("defaultSendShortcut",l),options:[{label:"Enter",value:"enter"},{label:"Shift + Enter",value:"shift+enter"}]}),pt.default.createElement(qr,{type:"switch",title:"Auto-Add Active Content to Context",description:"Automatically add the active note or Web Viewer tab (Desktop only) to chat context when sending messages.",checked:t.autoAddActiveContentToContext,onCheckedChange:l=>{Re("autoAddActiveContentToContext",l)}}),pt.default.createElement(qr,{type:"switch",title:"Auto-Add Selection to Context",description:"Automatically add selected text from notes or Web Viewer (Desktop only) to chat context. Disable to use manual command instead.",checked:t.autoAddSelectionToContext,onCheckedChange:l=>{Re("autoAddSelectionToContext",l)}}),pt.default.createElement(qr,{type:"switch",title:"Images in Markdown",description:"Pass embedded images in markdown to the AI along with the text. Only works with multimodal models.",checked:t.passMarkdownImages,onCheckedChange:l=>{Re("passMarkdownImages",l)}}),pt.default.createElement(qr,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>Re("showSuggestedPrompts",l)}),pt.default.createElement(qr,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>Re("showRelevantNotes",l)}))),pt.default.createElement("section",null,pt.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Saving Conversations"),pt.default.createElement("div",{className:"tw-space-y-4"},pt.default.createElement(qr,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>Re("autosaveChat",l)}),pt.default.createElement(qr,{type:"switch",title:"Generate AI Chat Title on Save",description:"When enabled, uses an AI model to generate a concise title for saved chat notes. When disabled, uses the first 10 words of the first user message.",checked:t.generateAIChatTitleOnSave,onCheckedChange:l=>Re("generateAIChatTitleOnSave",l)}),pt.default.createElement(qr,{type:"text",title:"Default Conversation Folder Name",description:"The default folder name where chat conversations will be saved. Default is 'copilot/copilot-conversations'",value:t.defaultSaveFolder,onChange:l=>Re("defaultSaveFolder",l),placeholder:"copilot/copilot-conversations"}),pt.default.createElement(qr,{type:"text",title:"Default Conversation Tag",description:"The default tag to be used when saving a conversation. Default is 'ai-conversations'",value:t.defaultConversationTag,onChange:l=>Re("defaultConversationTag",l),placeholder:"ai-conversations"}),pt.default.createElement(qr,{type:"custom",title:"Conversation Filename Template",description:pt.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},pt.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),pt.default.createElement(to,{content:pt.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},pt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),pt.default.createElement("div",null,pt.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),pt.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},pt.default.createElement("li",null,pt.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),pt.default.createElement("li",null,pt.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),pt.default.createElement("li",null,pt.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),pt.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]")))}))},pt.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},pt.default.createElement(ri,{type:"text",className:we("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",r?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:o,onChange:l=>i(l.target.value),disabled:r}),pt.default.createElement(pe,{onClick:()=>a(),disabled:r,variant:"secondary"},r?pt.default.createElement(pt.default.Fragment,null,pt.default.createElement(Bs,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))))),pt.default.createElement("section",null,pt.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Sorting"),pt.default.createElement("div",{className:"tw-space-y-4"},pt.default.createElement(qr,{type:"select",title:"Chat History Sort Strategy",description:"Sort order for the chat history list",value:t.chatHistorySortStrategy,onChange:l=>{qJ(l)&&Re("chatHistorySortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}),pt.default.createElement(qr,{type:"select",title:"Project List Sort Strategy",description:"Sort order for the project list",value:t.projectListSortStrategy,onChange:l=>{qJ(l)&&Re("projectListSortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}))))};mr();BG();Fc();Ye();var jan=require("obsidian"),Wo=$(J());var WT=$(J());mr();Ye();var Dan=()=>{let t=Br(),e=yd.getInstance(),r=new Set(t.autonomousAgentEnabledToolIds||[]),n=e.getToolsByCategory(),o=e.getConfigurableTools(),i=(s,u)=>{let l=new Set(r);u?l.add(s):l.delete(s),Re("autonomousAgentEnabledToolIds",Array.from(l))},a=()=>Array.from(n.entries()).filter(([u,l])=>l.some(c=>o.includes(c))).map(([u,l])=>{let c=l.filter(d=>o.includes(d));return c.length===0?null:WT.default.createElement(WT.default.Fragment,{key:u},c.map(({metadata:d})=>WT.default.createElement(qr,{key:d.id,type:"switch",title:d.displayName,description:d.description,checked:r.has(d.id),onCheckedChange:f=>i(d.id,f)})))});return WT.default.createElement(WT.default.Fragment,null,WT.default.createElement(qr,{type:"slider",title:"Max Iterations",description:"Maximum number of reasoning iterations the autonomous agent can perform. Higher values allow for more complex reasoning but may take longer.",value:t.autonomousAgentMaxIterations??4,onChange:s=>{Re("autonomousAgentMaxIterations",s)},min:4,max:dye,step:1}),WT.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},WT.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),WT.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),WT.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};var $an=()=>{let t=Br(),[e,r]=(0,Wo.useState)(!1),n=H_r(),o=async a=>{if(a){r(!0);let s=await Qat();if(r(!1),!s)return;Re("enableSelfHostMode",!0)}else Re("enableSelfHostMode",!1),Re("enableMiyo",!1)},i=async a=>{if(a===t.enableMiyo)return;if(!a){Re("enableMiyo",!1);return}r(!0);try{if(!await new S0().isBackendAvailable(t.selfHostUrl)){new jan.Notice("Miyo app is not available. Please start the Miyo app and try again.");return}if(!await Qat())return}finally{r(!1)}let s=async()=>{a&&t.embeddingBatchSize!==ko.embeddingBatchSize&&Re("embeddingBatchSize",ko.embeddingBatchSize),Re("enableMiyo",a),a&&!t.enableSemanticSearchV3&&Re("enableSemanticSearchV3",!0),(t.enableSemanticSearchV3||a)&&await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})};new zu(app,s,`Enabling Miyo Search will refresh your vault index to store data in Miyo. Embedding Batch Size will be reset to the default (${ko.embeddingBatchSize}) for local stability. If your hardware is strong, you can increase this later in QA settings. Continue?`,"Refresh Index").open()};return Wo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Wo.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Wo.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Wo.default.createElement(Qc,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Wo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Wo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),Wo.default.createElement(qr,{type:"switch",title:"Enable Autonomous Agent",description:"Enable autonomous agent mode in Plus chat. The AI will reason step-by-step and decide which tools to use automatically, improving response quality for complex queries.",checked:t.enableAutonomousAgent,onCheckedChange:a=>{Re("enableAutonomousAgent",a)}}),t.enableAutonomousAgent&&Wo.default.createElement(Wo.default.Fragment,null,Wo.default.createElement(Dan,null)),Wo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Memory (experimental)"),Wo.default.createElement(qr,{type:"text",title:"Memory Folder Name",description:"Specify the folder where memory data is stored.",value:t.memoryFolderName,onChange:a=>{Re("memoryFolderName",a)},placeholder:"copilot/memory"}),Wo.default.createElement(qr,{type:"switch",title:"Reference Recent Conversation",description:"When enabled, Copilot references your recent conversation history to provide more contextually relevant responses. All history data is stored locally in your vault.",checked:t.enableRecentConversations,onCheckedChange:a=>{Re("enableRecentConversations",a)}}),t.enableRecentConversations&&Wo.default.createElement(qr,{type:"slider",title:"Max Recent Conversations",description:"Number of recent conversations to remember for context. Higher values provide more context but may slow down responses.",min:10,max:50,step:1,value:t.maxRecentConversations,onChange:a=>Re("maxRecentConversations",a)}),Wo.default.createElement(qr,{type:"switch",title:"Reference Saved Memories",description:"When enabled, Copilot can access memories that you explicitly asked it to remember. Use this to store important facts, preferences, or context for future conversations.",checked:t.enableSavedMemory,onCheckedChange:a=>{Re("enableSavedMemory",a)}}),n&&Wo.default.createElement(Wo.default.Fragment,null,Wo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5 tw-pt-4 tw-text-xl tw-font-semibold"},"Self-Host Mode",Wo.default.createElement(to,{content:"Lifetime license required"})),Wo.default.createElement(qr,{type:"switch",title:"Enable Self-Host Mode",description:Wo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Wo.default.createElement("span",{className:"tw-leading-none"},"Use your own infrastructure for LLMs, embeddings (and local document understanding soon with our upcoming desktop app)."),Wo.default.createElement(to,{content:Wo.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},Wo.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Self-Host Mode (Believer/Supporter only)"),Wo.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Connect to your own self-hosted backend (e.g., Miyo) for complete control over your AI infrastructure. This allows offline usage and custom model deployments."),Wo.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"Requires re-validation every 15 days when online."))})),checked:t.enableSelfHostMode,onCheckedChange:o,disabled:e}),t.enableSelfHostMode&&Wo.default.createElement(Wo.default.Fragment,null,Wo.default.createElement(qr,{type:"switch",title:"Enable Miyo",description:"Use Miyo as your local search, PDF parsing, and context hub. Enabling this will prompt a one-time index refresh.",checked:t.enableMiyo,onCheckedChange:i,disabled:e}),Wo.default.createElement(qr,{type:"select",title:"Web Search Provider",description:"Choose which service to use for self-host web search.",value:t.selfHostSearchProvider,onChange:a=>Re("selfHostSearchProvider",a),options:[{label:"Firecrawl (default)",value:"firecrawl"},{label:"Perplexity Sonar",value:"perplexity"}]}),t.selfHostSearchProvider==="firecrawl"&&Wo.default.createElement(qr,{type:"password",title:"Firecrawl API Key",description:Wo.default.createElement("span",null,"API key for web search via Firecrawl."," ",Wo.default.createElement("a",{href:"https://firecrawl.link/logan-yang",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Sign up \u2192")),value:t.firecrawlApiKey,onChange:a=>Re("firecrawlApiKey",a),placeholder:"fc-..."}),t.selfHostSearchProvider==="perplexity"&&Wo.default.createElement(qr,{type:"password",title:"Perplexity API Key",description:Wo.default.createElement("span",null,"API key for web search via Perplexity Sonar."," ",Wo.default.createElement("a",{href:"https://docs.perplexity.ai",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Get API key \u2192")),value:t.perplexityApiKey,onChange:a=>Re("perplexityApiKey",a),placeholder:"pplx-..."}),Wo.default.createElement(qr,{type:"password",title:"Supadata API Key",description:Wo.default.createElement("span",null,"API key for YouTube transcripts via Supadata."," ",Wo.default.createElement("a",{href:"https://supadata.ai/?ref=obcopilot",target:"_blank",rel:"noopener noreferrer",className:"tw-text-accent"},"Sign up \u2192")),value:t.supadataApiKey,onChange:a=>Re("supadataApiKey",a),placeholder:"sd-..."}))))))};mr();sH();Xe();Ye();Cn();mr();Xe();Ye();Bt();mr();vO();var nCi="2023-06-01",oCi="bedrock-2023-05-31",SQ="Hello!",DUe="Hello!",Lan=64,iCi=256,aCi=256,sCi=256,uCi=new Set(["openai","openai","openrouterai","groq","xai","siliconflow","siliconflow","3rd party (openai-format)","3rd party (openai-format)","lm-studio","lm-studio","mistralai","deepseek"]);function xz(t){return t.replace(/\/+$/g,"")}function lCi(t){try{return new URL(t)}catch{return null}}function xpe(t){return t.replace(/'/g,`'"'"'`)}function jUe(t){let e=QC[t];return(e?.curlBaseURL??e?.host??"").trim()}async function CQ(t){let e=[],r=t?.trim()??"";if(!r)return e.push("API key is empty; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e};try{let n=(await oo(r))?.trim();return!n||n==="Copilot failed to decrypt API keys!"?(e.push("API key could not be decrypted; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e}):{apiKey:n,warnings:e}}catch{return e.push("API key could not be decrypted; using placeholder."),{apiKey:"<YOUR_API_KEY>",warnings:e}}}function cCi(t){let e=xz(t),r=["/chat/completions","/embeddings","/responses"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function dCi(t){let e=xz(t);return e.endsWith("/models")&&(e=e.slice(0,-7)),!e.includes("/v1beta")&&!e.includes("/v1")&&(e=`${e}/v1beta`),e}function fCi(t){let e=xz(t),r=["/api/v1","/v1","/api"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function F6(t){let e=[],r=xpe(t.url);e.push(`curl --request ${t.method} '${r}'`);for(let a of t.curlArgs??[])e.push(` ${a}`);let n=["Content-Type","Accept","Authorization","x-goog-api-key","api-key","x-api-key","anthropic-version","OpenAI-Organization"],o=t.headers??{},i=new Set;for(let a of n)o[a]!==void 0&&(i.add(a),e.push(` --header '${xpe(`${a}: ${o[a]}`)}'`));for(let a of Object.keys(o).sort())i.has(a)||e.push(` --header '${xpe(`${a}: ${o[a]}`)}'`);if(t.body!==void 0){let a=JSON.stringify(t.body,null,2);e.push(` --data-raw '${xpe(a)}'`)}return e.join(` \\
|
||
`)}async function pCi(t,e){let r=[],n=t.provider?.trim()??"",o=jUe(n),i=t.baseUrl?.trim()??"",a=xz(i||o||"https://api.example.com/v1"),s=cCi(a),u=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let l=await CQ(t.apiKey);r.push(...l.warnings);let c={"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${l.apiKey}`};return t.openAIOrgId?.trim()&&(c["OpenAI-Organization"]=t.openAIOrgId.trim()),n==="openrouterai"&&(c["HTTP-Referer"]="https://obsidiancopilot.com",c["X-Title"]="Obsidian Copilot"),e?{ok:!0,warnings:r,spec:{method:"POST",url:`${s}/embeddings`,headers:c,body:{model:u,input:DUe}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${s}/chat/completions`,headers:c,body:{model:u,messages:[{role:"user",content:SQ}],stream:!1,max_tokens:Lan}}}}function mCi(t,e,r,n){let o=[],i=t.azureOpenAIApiInstanceName?.trim()||"[instance]";t.azureOpenAIApiInstanceName?.trim()||o.push("Azure instance name is empty; using placeholder.");let a=t.baseUrl?.trim();if(a){let s=lCi(a);if(s){let u=xz(s.pathname||"");u.includes("/openai/deployments/")&&(u=u.split("/openai/deployments/")[0]);let l=`${s.origin}${u}`;return{warnings:o,url:`${l}/openai/deployments/${encodeURIComponent(e)}/${r}?api-version=${encodeURIComponent(n)}`}}}return{warnings:o,url:`https://${i}.openai.azure.com/openai/deployments/${encodeURIComponent(e)}/${r}?api-version=${encodeURIComponent(n)}`}}async function hCi(t,e){let r=[],n=await CQ(t.apiKey);r.push(...n.warnings);let o=e?t.azureOpenAIApiEmbeddingDeploymentName?.trim()||"[deployment]":t.azureOpenAIApiDeploymentName?.trim()||"[deployment]";(!o||o==="[deployment]")&&r.push("Azure deployment name is empty; using placeholder.");let i=t.azureOpenAIApiVersion?.trim()||"[api-version]";t.azureOpenAIApiVersion?.trim()||r.push("Azure api-version is empty; using placeholder.");let s=mCi(t,o,e?"embeddings":"chat/completions",i);r.push(...s.warnings);let u=e?{input:DUe}:{messages:[{role:"user",content:SQ}],stream:!1,max_tokens:Lan};return{ok:!0,warnings:r,spec:{method:"POST",url:s.url,headers:{"Content-Type":"application/json",Accept:"application/json","api-key":n.apiKey},body:u}}}async function gCi(t){let e=[],r=t.baseUrl?.trim()??"",n=jUe("anthropic"),o=xz(r||n||"https://api.anthropic.com"),i=["/v1/messages","/v1"];for(let l of i)if(o.endsWith(l)){o=o.slice(0,-l.length);break}let a=`${o}/v1/messages`,s=await CQ(t.apiKey);e.push(...s.warnings);let u=t.name?.trim()||"<MODEL_NAME>";return t.name?.trim()||e.push("Model name is empty; using placeholder."),{ok:!0,warnings:e,spec:{method:"POST",url:a,headers:{"Content-Type":"application/json",Accept:"application/json","x-api-key":s.apiKey,"anthropic-version":nCi},body:{model:u,max_tokens:iCi,messages:[{role:"user",content:SQ}]}}}}async function yCi(t,e){let r=[],n=t.baseUrl?.trim()??"",o=jUe("google"),a=dCi(n||o||"https://generativelanguage.googleapis.com"),s=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let u=s.includes("/")?s:`models/${s}`,l=await CQ(t.apiKey);r.push(...l.warnings);let c={"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":l.apiKey};return e?{ok:!0,warnings:r,spec:{method:"POST",url:`${a}/${u}:embedContent`,headers:c,body:{content:{parts:[{text:DUe}]}}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${a}/${u}:generateContent`,headers:c,body:{contents:[{role:"user",parts:[{text:SQ}]}],generationConfig:{maxOutputTokens:sCi}}}}}function bCi(t){return/(^|\.)anthropic\./.test(t)}async function _Ci(t){let e=[],r=t.name?.trim()||"<MODEL_ID>";t.name?.trim()||e.push("Model name is empty; using placeholder.");let n=t.bedrockRegion?.trim()||"us-east-1";t.bedrockRegion?.trim()||e.push("Bedrock region is empty; defaulting to us-east-1.");let o=t.baseUrl?.trim(),a=`${xz(o||`https://bedrock-runtime.${n}.amazonaws.com`)}/model/${encodeURIComponent(r)}/invoke`,s={messages:[{role:"user",content:[{type:"text",text:SQ}]}],max_tokens:aCi};bCi(r)?s.anthropic_version=oCi:e.push("Model ID does not look like Anthropic; request body may need adjustment.");let u=await CQ(t.apiKey);e.push(...u.warnings);let l={method:"POST",url:a,headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${u.apiKey}`},body:s},c={method:"POST",url:a,curlArgs:[`--aws-sigv4 'aws:amz:${xpe(n)}:bedrock'`,"--user '<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>'"],headers:{"Content-Type":"application/json",Accept:"application/json"},body:s};return{ok:!0,command:["# Amazon Bedrock InvokeModel","# Option A: Bearer token auth (matches Obsidian Copilot)",F6(l),"","# Option B: IAM auth (AWS SigV4)",F6(c)].join(`
|
||
`),warnings:e}}async function vCi(t,e){let r=[],n=t.baseUrl?.trim()??"",o=jUe("ollama"),i=fCi(xz(n||o||"http://localhost:11434")),a=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let s={"Content-Type":"application/json",Accept:"application/json"};if(t.apiKey?.trim()){let l=await CQ(t.apiKey),c=l.warnings.filter(d=>!d.includes("API key is empty"));r.push(...c),s.Authorization=`Bearer ${l.apiKey}`}return e?{ok:!0,warnings:r,spec:{method:"POST",url:`${i}/api/embed`,headers:s,body:{model:a,input:DUe,truncate:!0}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${i}/api/chat`,headers:s,body:{model:a,messages:[{role:"user",content:SQ}],stream:!1}}}}async function Fan(t){let e=[],r=t.provider?.trim();if(!r)return{ok:!1,error:"Provider is required to build a curl command.",warnings:e};let n=!!t.isEmbeddingModel;if(r==="azure openai"){let o=await hCi(t,n);return o.ok?{ok:!0,command:F6(o.spec),warnings:o.warnings}:o}if(r==="anthropic"){if(n)return{ok:!1,error:"Anthropic does not support embeddings.",warnings:e};let o=await gCi(t);return o.ok?{ok:!0,command:F6(o.spec),warnings:o.warnings}:o}if(r==="amazon-bedrock")return n?{ok:!1,error:"Bedrock embeddings are not supported by this generator.",warnings:e}:await _Ci(t);if(r==="google"||r==="google"){let o=await yCi(t,n);return o.ok?{ok:!0,command:F6(o.spec),warnings:o.warnings}:o}if(r==="ollama"||r==="ollama"){let o=await vCi(t,n);return o.ok?{ok:!0,command:F6(o.spec),warnings:o.warnings}:o}if(uCi.has(r)){let o=await pCi(t,n);return o.ok?{ok:!0,command:F6(o.spec),warnings:o.warnings}:o}return{ok:!1,error:`Provider "${r}" is not supported for curl generation.`,warnings:e}}Or();hF();var Tz=require("obsidian"),Ze=$(J()),y0t=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=_z(),a=te(),s=o?"openai":"openrouterai",u=L=>L==="azure openai",[l,c]=(0,Ze.useState)(null),[d,f]=(0,Ze.useState)(u(s)),[p,m]=(0,Ze.useState)(!1),[h,y]=(0,Ze.useState)("idle"),[g,b]=(0,Ze.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1}),_=(L,W)=>{b(ie=>({...ie,[L]:W}))},w=()=>{b({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1})},T=()=>{let L=!0,W={...g};return W.name=!E.name,E.name||(L=!1),E.provider==="azure openai"&&(W.instanceName=!E.azureOpenAIApiInstanceName,W.apiVersion=!E.azureOpenAIApiVersion,o?(W.embeddingDeploymentName=!E.azureOpenAIApiEmbeddingDeploymentName,E.azureOpenAIApiEmbeddingDeploymentName||(L=!1)):(W.deploymentName=!E.azureOpenAIApiDeploymentName,E.azureOpenAIApiDeploymentName||(L=!1)),(!E.azureOpenAIApiInstanceName||!E.azureOpenAIApiVersion)&&(L=!1)),E.provider,"amazon-bedrock",W.bedrockRegion=!1,b(W),L},O=(L=s)=>{let W={name:"",provider:L,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:Bb(L),isEmbeddingModel:o,capabilities:[]};if(!o){let ie={...W,stream:!0};return L==="amazon-bedrock"?{...ie,bedrockRegion:a.amazonBedrockRegion}:ie}return W},[E,P]=(0,Ze.useState)(O()),R=L=>{P(W=>({...W,...L})),y("idle")},I=L=>({...L,name:L.name?.trim(),baseUrl:L.baseUrl?.trim(),apiKey:L.apiKey?.trim(),openAIOrgId:L.openAIOrgId?.trim(),azureOpenAIApiInstanceName:L.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:L.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:L.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:L.azureOpenAIApiVersion?.trim(),bedrockRegion:L.bedrockRegion?.trim()}),[N,z]=(0,Ze.useState)(d1(s)),V=()=>!!(E.name&&E.provider),k=()=>p||!V(),X=()=>{if(!T()){new Tz.Notice("Please fill in all required fields");return}let L=I(E);r(L),e(!1),P(O()),w(),y("idle"),f(!1)},B=L=>{z(d1(L)),y("idle"),P({...E,provider:L,apiKey:Bb(L),...L==="openai"?{openAIOrgId:a.openAIOrgId}:{},...L==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{},...L==="amazon-bedrock"?{bedrockRegion:a.amazonBedrockRegion}:{bedrockRegion:void 0}}),f(u(L))},Q=L=>{L||(P(O()),w(),y("idle"),f(!1)),e(L)},Y=async()=>{if(!T()){new Tz.Notice("Please fill in all required fields");return}m(!0),y("idle");try{let L=I(E);await n(L),y("success"),new Tz.Notice("Model verification successful!")}catch(L){ne(L);let W=zr(L);y("failed"),new Tz.Notice("Model verification failed: "+W)}finally{m(!1)}},K=async()=>{try{let L=I(E),W=await Fan(L);if(!W.ok){new Tz.Notice(W.error);return}await navigator.clipboard.writeText(W.command);let j=!W.warnings.some(H=>H.includes("placeholder"))?" Warning: contains real API key!":"",A=W.warnings.filter(H=>!H.includes("placeholder")),U=A.length>0?` (${A[0]})`:"";new Tz.Notice(`Copied curl command.${j}${U}`)}catch(L){ne(L),new Tz.Notice("Failed to copy curl command: "+zr(L))}},oe=()=>{let W=(()=>{switch(E.provider){case"openai":return Ze.default.createElement(Vo,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Ze.default.createElement(ri,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:E.openAIOrgId||"",onChange:ie=>R({openAIOrgId:ie.target.value})}));case"azure openai":return Ze.default.createElement(Ze.default.Fragment,null,Ze.default.createElement(Vo,{label:"Instance Name",required:!0,error:g.instanceName,errorMessage:"Instance name is required"},Ze.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:E.azureOpenAIApiInstanceName||"",onChange:ie=>{R({azureOpenAIApiInstanceName:ie.target.value}),_("instanceName",!1)}})),o?Ze.default.createElement(Vo,{label:"Embedding Deployment Name",required:!0,error:g.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Ze.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:E.azureOpenAIApiEmbeddingDeploymentName||"",onChange:ie=>{R({azureOpenAIApiEmbeddingDeploymentName:ie.target.value}),_("embeddingDeploymentName",!1)}})):Ze.default.createElement(Vo,{label:"Deployment Name",required:!0,error:g.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},Ze.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:E.azureOpenAIApiDeploymentName||"",onChange:ie=>{R({azureOpenAIApiDeploymentName:ie.target.value}),_("deploymentName",!1)}})),Ze.default.createElement(Vo,{label:"API Version",required:!0,error:g.apiVersion,errorMessage:"API version is required"},Ze.default.createElement(ri,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:E.azureOpenAIApiVersion||"",onChange:ie=>{R({azureOpenAIApiVersion:ie.target.value}),_("apiVersion",!1)}})));case"amazon-bedrock":return Ze.default.createElement(Vo,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},Ze.default.createElement("div",{className:"tw-flex tw-gap-2"},Ze.default.createElement(ri,{className:"tw-flex-1",type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:E.bedrockRegion||"",onChange:ie=>{R({bedrockRegion:ie.target.value}),_("bedrockRegion",!1)}}),Ze.default.createElement(KW,{onValueChange:ie=>{R({bedrockRegion:ie}),_("bedrockRegion",!1)}},Ze.default.createElement(kB,{className:"tw-w-[140px]"},Ze.default.createElement(GW,{placeholder:"Presets"})),Ze.default.createElement(qB,{container:l},["us-east-1","us-west-2","eu-west-1","ap-northeast-1","ap-southeast-1"].map(ie=>Ze.default.createElement(UB,{key:ie,value:ie},ie))))));default:return null}})();return W?Ze.default.createElement(_y,{open:d,onOpenChange:f,className:"tw-rounded-lg tw-border tw-bg-secondary/30 tw-border-border/60"},Ze.default.createElement(BT,{asChild:!0},Ze.default.createElement("button",{type:"button",className:"tw-flex tw-w-full tw-cursor-pointer tw-items-center tw-justify-between tw-rounded-lg tw-p-3 tw-text-left hover:tw-bg-modifier-hover"},Ze.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"Additional ",Rg(E.provider)," Settings"),Ze.default.createElement(Wi,{className:`tw-size-4 tw-text-muted tw-transition-transform tw-duration-200 ${d?"tw-rotate-180":""}`}))),Ze.default.createElement(vy,{className:"tw-space-y-4 tw-px-3 tw-pb-3"},W)):null},ue=()=>{if(E.provider!=="azure openai")return N.host;let L=E.azureOpenAIApiInstanceName||"[instance]",W=o?E.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":E.azureOpenAIApiDeploymentName||"[deployment]",ie=E.azureOpenAIApiVersion||"[api-version]";return`https://${L}.openai.azure.com/openai/deployments/${W}/${o?"embeddings":"chat/completions"}?api-version=${ie}`},de=Object.entries(gF).map(([L,W])=>({id:L,label:L.charAt(0).toUpperCase()+L.slice(1),description:W}));return Ze.default.createElement(MUe,{open:t,onOpenChange:Q},Ze.default.createElement(_pe,{className:"tw-max-h-[80vh] tw-overflow-y-auto sm:tw-max-w-[425px]",container:i,ref:L=>c(L)},Ze.default.createElement(vpe,null,Ze.default.createElement(wpe,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Ze.default.createElement(Spe,null,"Add a new model to your collection.")),Ze.default.createElement("div",{className:"tw-space-y-3"},Ze.default.createElement(Vo,{label:"Model Name",required:!0,error:g.name,errorMessage:"Model name is required",description:E.provider==="amazon-bedrock"&&!o?"For Bedrock, use cross-region inference profile IDs (global., us., eu., or apac. prefix) for better reliability. Regional IDs without prefixes may fail.":void 0},Ze.default.createElement(ri,{type:"text",placeholder:`Enter model name (e.g. ${E.provider==="amazon-bedrock"&&!o?"global.anthropic.claude-sonnet-4-5-20250929-v1:0":o?"text-embedding-3-small":"gpt-4"})`,value:E.name,onChange:L=>{R({name:L.target.value}),_("name",!1)}})),Ze.default.createElement(Vo,{label:Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ze.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ze.default.createElement(to,{content:Ze.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ze.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ze.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ze.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ze.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ze.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ze.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},Ze.default.createElement(ri,{type:"text",placeholder:"Custom display name (optional)",value:E.displayName||"",onChange:L=>{P({...E,displayName:L.target.value})}})),Ze.default.createElement(Vo,{label:"Provider"},Ze.default.createElement(KW,{value:E.provider,onValueChange:B},Ze.default.createElement(kB,null,Ze.default.createElement(GW,{placeholder:"Select provider"})),Ze.default.createElement(qB,{container:l},Object.values(o?Ete(YC,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Ete(k_,["COPILOT_PLUS"])).map(L=>Ze.default.createElement(UB,{key:L,value:L},Rg(L)))))),Ze.default.createElement(Vo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ze.default.createElement(ri,{type:"text",placeholder:ue()||"https://api.example.com/v1",value:E.baseUrl||"",onChange:L=>R({baseUrl:L.target.value})})),Ze.default.createElement(Vo,{label:"API Key"},Ze.default.createElement(AN,{placeholder:`Enter ${N.label} API Key`,value:E.apiKey||"",onChange:L=>R({apiKey:L})}),N.keyManagementURL&&Ze.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ze.default.createElement("a",{href:N.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",N.label," API Key"))),!o&&Ze.default.createElement(Vo,{label:Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ze.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ze.default.createElement(to,{content:Ze.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only used to display model capabilities, does not affect model functionality"),contentClassName:"tw-max-w-96"}))},Ze.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-items-center tw-gap-x-6 tw-gap-y-2"},de.map(({id:L,label:W,description:ie})=>Ze.default.createElement("div",{key:L,className:"tw-flex tw-items-center tw-gap-2"},Ze.default.createElement(Rl,{id:L,checked:E.capabilities?.includes(L),onCheckedChange:j=>{let A=E.capabilities||[];P({...E,capabilities:j?[...A,L]:A.filter(U=>U!==L)})}}),Ze.default.createElement(to,{content:ie},Ze.default.createElement(Xc,{htmlFor:L,className:"tw-text-sm"},W)))))),oe()),Ze.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-3"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ze.default.createElement(Rl,{id:"enable-cors",checked:E.enableCors||!1,onCheckedChange:L=>P({...E,enableCors:L})}),Ze.default.createElement(Xc,{htmlFor:"enable-cors",className:"tw-cursor-pointer"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ze.default.createElement("span",{className:"tw-text-sm"},"CORS"),Ze.default.createElement(to,{content:Ze.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Only check this option when prompted that CORS is needed"),contentClassName:"tw-max-w-96"})))),(E.provider==="3rd party (openai-format)"||E.provider==="lm-studio")&&Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ze.default.createElement(Rl,{id:"stream-usage",checked:E.streamUsage||!1,onCheckedChange:L=>P({...E,streamUsage:L})}),Ze.default.createElement(Xc,{htmlFor:"stream-usage",className:"tw-cursor-pointer"},Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ze.default.createElement("span",{className:"tw-text-sm"},"Stream Usage"),Ze.default.createElement(to,{content:Ze.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enable if your provider supports stream_options for token usage tracking. Disable for providers that do not support it (e.g., Databricks, MLFlow)."),contentClassName:"tw-max-w-96"})))),Ze.default.createElement(y_,null,Ze.default.createElement(yn,null,Ze.default.createElement(bn,{asChild:!0},Ze.default.createElement(pe,{variant:"ghost",size:"sm",onClick:K,disabled:!E.name,className:"tw-text-muted hover:tw-text-normal"},"CURL")),Ze.default.createElement(dn,null,Ze.default.createElement("p",null,"Copy curl command for testing"))))),Ze.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-2"},h==="success"&&Ze.default.createElement(BF,{className:"tw-size-5 tw-text-success"}),h==="failed"&&Ze.default.createElement(RO,{className:"tw-size-5 tw-text-error"}),Ze.default.createElement(y_,null,Ze.default.createElement(yn,null,Ze.default.createElement(bn,{asChild:!0},Ze.default.createElement(pe,{variant:"secondary",size:"sm",onClick:Y,disabled:k(),className:"tw-min-w-[72px]"},p?Ze.default.createElement(Ze.default.Fragment,null,Ze.default.createElement(Bs,{className:"tw-mr-1.5 tw-size-3.5 tw-animate-spin"}),"Test"):"Test")),Ze.default.createElement(dn,null,Ze.default.createElement("p",null,"Optional: test API call")))),Ze.default.createElement(pe,{variant:"default",size:"sm",onClick:X,disabled:k()},"Add Model")))))};Cn();mr();$r();Ye();Bt();Or();var Ht=$(J());hF();var wCi={reasoning:{icon:px,color:"tw-text-model-capabilities-blue",tooltip:gF.reasoning},vision:{icon:dx,color:"tw-text-model-capabilities-green",tooltip:gF.vision},websearch:{icon:vl,color:"tw-text-model-capabilities-blue",tooltip:gF.websearch}},SCi=["reasoning","vision","websearch"],CCi=({title:t,onRefresh:e,onAdd:r})=>Ht.default.createElement("div",{className:"tw-mb-3 tw-flex tw-flex-col tw-gap-2 md:tw-flex-row md:tw-items-center md:tw-justify-between"},Ht.default.createElement("h3",{className:"tw-text-xl tw-font-bold"},t),Ht.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-end"},e&&Ht.default.createElement(pe,{onClick:e,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(KF,{className:"tw-size-2 md:tw-size-4"}),"Refresh Built-ins"),Ht.default.createElement(pe,{onClick:r,variant:"default",className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement(Zb,{className:"tw-size-2 md:tw-size-4"}),"Add Model"))),xCi=t=>Ht.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},SCi.map(e=>{let r=wCi[e];if(!r)return Ht.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Ht.default.createElement(to,{key:e,content:r.tooltip,side:"bottom"},Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Ht.default.createElement(n,{className:we("tw-size-4",r.color)}))):Ht.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Ht.default.createElement("div",{className:"tw-size-4"}))})),TCi=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i,containerRef:a})=>{let s=[];e&&s.push({icon:Ht.default.createElement(W5,{className:"tw-size-4"}),label:"Edit",onClick:e}),r&&!t.core&&s.push({icon:Ht.default.createElement($g,{className:"tw-size-4"}),label:"Copy",onClick:r}),t.core||s.push({icon:Ht.default.createElement(Vy,{className:"tw-size-4"}),label:"Delete",onClick:()=>n(no(t)),variant:"destructive"});let u=Ht.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Ht.default.createElement(Rl,{checked:t.enabled,onCheckedChange:l=>o({...t,enabled:l})})),Ht.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ht.default.createElement("span",{className:"tw-text-sm"},"CORS"),Ht.default.createElement(Rl,{checked:t.enableCors,onCheckedChange:l=>o({...t,enableCors:l})})));return Ht.default.createElement(wUe,{id:i,item:t,title:t.displayName||t.name,subtitle:Rg(t.provider,t),badge:t.capabilities&&t.capabilities.length>0?Ht.default.createElement(Ogt,{capabilities:t.capabilities,iconSize:14}):void 0,isDraggable:!t.core,isExpandable:!0,expandedContent:u,primaryAction:e?{icon:Ht.default.createElement(JF,{className:"tw-size-4"}),onClick:e,tooltip:"Edit Model"}:void 0,dropdownActions:s,containerRef:a})},OCi=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,isEmbeddingModel:i,containerRef:a})=>{let{attributes:s,listeners:u,setNodeRef:l,transform:c,transition:d,isDragging:f}=bQ({id:no(t),disabled:t.core}),p={transform:RC.Transform.toString(c),transition:d},m=e||!t.core||r&&!t.core;return Ht.default.createElement(Cz,{ref:l,style:p,className:we("tw-transition-colors tw-duration-200 hover:tw-bg-interactive-accent/10",f&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50 tw-bg-primary/90")},Ht.default.createElement(Ob,{className:"tw-w-6 tw-px-2"},!t.core&&Ht.default.createElement(pe,{variant:"ghost",size:"icon",className:"tw-size-6 tw-cursor-grab tw-touch-none tw-p-0 hover:tw-cursor-grab active:tw-cursor-grabbing",...s,...u},Ht.default.createElement(fx,{className:"tw-size-4 tw-transition-colors"}))),Ht.default.createElement(Ob,{className:"tw-pl-0"},t.displayName||t.name),Ht.default.createElement(Ob,null,Rg(t.provider,t)),Ht.default.createElement(Ob,null,xCi(t)),!i&&Ht.default.createElement(Ob,{className:"tw-text-center"},Ht.default.createElement(Rl,{id:`${no(t)}-enabled`,checked:t.enabled,disabled:t.enabled&&pye(t),onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Ht.default.createElement(Ob,{className:"tw-text-center"},Ht.default.createElement(Rl,{id:`${no(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Ht.default.createElement(Ob,{className:"tw-text-center"},Ht.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Ht.default.createElement(pe,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Ht.default.createElement(JF,{className:"tw-size-4"})),m&&Ht.default.createElement(mN,null,Ht.default.createElement(hN,{asChild:!0},Ht.default.createElement(pe,{variant:"ghost",size:"icon"},Ht.default.createElement(IO,{className:"tw-size-4"}))),Ht.default.createElement(Dv,{align:"end",container:a.current},e&&Ht.default.createElement(Ni,{onClick:()=>e(t)},Ht.default.createElement(W5,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Ht.default.createElement(Ni,{onClick:()=>r(t)},Ht.default.createElement($g,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Ht.default.createElement(Ni,{onClick:()=>n(no(t)),className:"tw-text-error"},Ht.default.createElement(Vy,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},b0t=({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=pUe(pQ(Sz),pQ(wz,{coordinateGetter:vUe})),d=(0,Ht.useRef)(null),f=t.findIndex(y=>!y.core),p=y=>g=>{let{transform:b,active:_,activeNodeRect:w,over:T}=g;if(!_||!w)return b;let O=t.findIndex(N=>no(N)===_.id),E=t.filter(N=>!N.core).length,P=w.height,R=(f-O)*P,I=(f+E-1-O)*P;if(y&&T){let N=t.findIndex(V=>no(V)===T.id);if(t[N].core||N<f)return{...b,x:0,y:0}}return{...b,x:0,y:Math.min(Math.max(R,b.y),I)}},m=y=>{let{active:g,over:b}=y;if(b&&g.id!==b.id){let _=t.findIndex(E=>no(E)===g.id),w=t.findIndex(E=>no(E)===b.id),T=t[w];if(w<f||T.core)return;let O=_Ue(t,_,w);a?.(O)}},h=()=>Ht.default.createElement("div",{className:"tw-relative md:tw-hidden"},Ht.default.createElement(hQ,{sensors:c,collisionDetection:mQ,onDragEnd:m,modifiers:[p(!0)],autoScroll:{enabled:!0,acceleration:10,threshold:{x:0,y:.2}}},Ht.default.createElement(yQ,{items:t.map(y=>no(y)),strategy:gQ},Ht.default.createElement("div",{className:"tw-relative tw-touch-auto tw-space-y-2 tw-overflow-auto tw-pb-2"},t.map(y=>Ht.default.createElement(TCi,{key:no(y),id:no(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Ht.default.createElement("div",{ref:d,className:"tw-mb-4"},Ht.default.createElement(CCi,{title:u,onRefresh:s,onAdd:o}),Ht.default.createElement("div",{className:"tw-hidden md:tw-block"},Ht.default.createElement(hQ,{sensors:c,collisionDetection:mQ,onDragEnd:m,modifiers:[p(!1)]},Ht.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Ht.default.createElement(hpe,null,Ht.default.createElement(gpe,null,Ht.default.createElement(Cz,null,Ht.default.createElement(T_,{className:"tw-w-6 tw-px-2"}),Ht.default.createElement(T_,{className:"tw-pl-0"},"Model"),Ht.default.createElement(T_,null,"Provider"),Ht.default.createElement(T_,{className:"tw-text-center"},"Capabilities"),!l&&Ht.default.createElement(T_,{className:"tw-text-center"},"Enable"),Ht.default.createElement(T_,{className:"tw-text-center"},"CORS"),Ht.default.createElement(T_,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Ht.default.createElement(ype,{className:"tw-relative"},Ht.default.createElement(yQ,{items:t.map(y=>no(y)),strategy:gQ},t.map(y=>Ht.default.createElement(OCi,{key:no(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h())};Bt();var $Ue=require("obsidian"),Gv=$(J()),kan=()=>{let t=Br(),[e,r]=(0,Gv.useState)(!1),[n,o]=(0,Gv.useState)(!1),i=(h,y=!1)=>{let g={...Ete(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},b=y?"activeEmbeddingModels":"activeModels";Re(b,[...t[b],g])},a=(h,y=!1)=>{Re(y?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[y,g]=h.split("|"),b=t.activeModels.filter(w=>!(w.name===y&&w.provider===g)),_=t.defaultModelKey;if(h===t.defaultModelKey){let w=b.find(T=>T.enabled);_=w?`${w.name}|${w.provider}`:""}F_({activeModels:b,defaultModelKey:_})},u=(h,y,g)=>{let b=h?"activeEmbeddingModels":"activeModels",_=t[b].findIndex(w=>w.name===y.name&&w.provider===y.provider);if(_!==-1){let w=[...t[b]];w[_]=g,Re(b,w)}else new $Ue.Notice("Could not find model to update"),ne("Could not find model to update:",y)},l=h=>{let y=t.activeModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Re("activeModels",y)},c=h=>{let[y,g]=h.split("|"),b=t.activeEmbeddingModels.filter(_=>!(_.name===y&&_.provider===g));Re("activeEmbeddingModels",b)},d=h=>{let y=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Re("activeEmbeddingModels",y)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),y=[...hO,...h];Re("activeModels",y),new $Ue.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),y=[...T4,...h];Re("activeEmbeddingModels",y),new $Ue.Notice("Embedding models refreshed successfully")},m=(h,y=!1)=>{new WY(app,h,y,u).open()};return Gv.default.createElement("div",{className:"tw-space-y-4"},Gv.default.createElement("section",null,Gv.default.createElement(b0t,{models:t.activeModels,onEdit:h=>m(h),onCopy:h=>i(h),onDelete:s,onAdd:()=>r(!0),onUpdateModel:l,onReorderModels:h=>a(h),onRefresh:f,title:"Chat Models"}),Gv.default.createElement(y0t,{open:e,onOpenChange:r,onAdd:h=>{let y=[...t.activeModels,h];Re("activeModels",y)},ping:h=>ry.instance.getCurrentChainManager().chatModelManager.ping(h)}),Gv.default.createElement("div",{className:"tw-space-y-4"},Gv.default.createElement(qr,{type:"slider",title:"Conversation turns in context",description:"The number of previous conversation turns to include in the context. Default is 15 turns, i.e. 30 messages.",value:t.contextTurns,onChange:h=>Re("contextTurns",h),min:1,max:50,step:1}),Gv.default.createElement(qr,{type:"slider",title:"Auto-compact threshold",description:"Automatically summarize context when it exceeds this token count. Set to maximum to make it less aggressive.",min:64e3,max:1e6,step:64e3,value:t.autoCompactThreshold,onChange:h=>Re("autoCompactThreshold",h)}))),Gv.default.createElement("section",null,Gv.default.createElement(b0t,{models:t.activeEmbeddingModels,onEdit:h=>m(h,!0),onDelete:c,onCopy:h=>i(h,!0),onAdd:()=>o(!0),onUpdateModel:d,onReorderModels:h=>a(h,!0),onRefresh:p,title:"Embedding Models"}),Gv.default.createElement(y0t,{open:n,onOpenChange:o,onAdd:h=>{let y=[...t.activeEmbeddingModels,h];Re("activeEmbeddingModels",y)},isEmbeddingModel:!0,ping:h=>hd.getInstance().ping(h)})))};var On=$(J()),Van=require("obsidian");var LUe=class extends zu{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")}};mr();Ye();var ln=$(J());Or();var kUe=require("obsidian");sd();Bt();mr();var FUe=class extends tQ{constructor({app:e,onNoteSelect:r,excludeNotePaths:n,titleOnly:o=!1,chainType:i="copilot_plus"}){super(e,i),this.onNoteSelect=r,this.availableNotes=this.getOrderedNotes(n),this.titleOnly=o}getItems(){if(this.titleOnly){let e=new Map;return this.availableNotes.forEach(r=>{e.set(r.basename,r)}),Array.from(e.values())}return this.availableNotes}getItemText(e){let r=e.path===this.activeNote?.path;return this.formatNoteTitle(e.basename,r,e.extension)}onChooseItem(e,r){if(!JJ(e,this.chainType)){new kUe.Notice(YJ.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof kUe.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 qan=require("obsidian"),JT=$(J()),Uan=$(jm());Cn();function ECi({onConfirm:t,onCancel:e}){let[r,n]=(0,JT.useState)("");return JT.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},JT.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},JT.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"),JT.default.createElement(ri,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),JT.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},JT.default.createElement(pe,{variant:"secondary",onClick:e},"Cancel"),JT.default.createElement(pe,{variant:"default",onClick:()=>t(r)},"Confirm")))}var qUe=class extends qan.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,Uan.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(JT.default.createElement(ECi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Ban=require("obsidian"),jC=$(J()),zan=$(jm());Cn();function PCi({onConfirm:t,onCancel:e}){let[r,n]=(0,jC.useState)(""),[o,i]=(0,jC.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return jC.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},jC.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},jC.default.createElement(ri,{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&&jC.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),jC.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},jC.default.createElement(pe,{variant:"secondary",onClick:e},"Cancel"),jC.default.createElement(pe,{variant:"default",onClick:()=>a(r)},"Confirm")))}var UUe=class extends Ban.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,zan.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(jC.default.createElement(PCi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};Cn();$r();ob();var MCi={folder:{icon:$m,label:"Folder",colorClass:"tw-text-context-manager-yellow"},tag:{icon:A1,label:"Tag",colorClass:"tw-text-context-manager-orange"},note:{icon:Du,label:"Note",colorClass:"tw-text-context-manager-blue"},extension:{icon:WF,label:"Extension",colorClass:"tw-text-context-manager-green"}},_0t=({value:t,onChange:e,maxCollapsedHeight:r=84})=>{let[n,o]=(0,ln.useState)(!1),[i,a]=(0,ln.useState)(!1),[s,u]=(0,ln.useState)(0),l=(0,ln.useRef)(null),c=(0,ln.useRef)(null),d=(0,ln.useRef)(t);d.current=t;let f=B=>[...new Set(hA(B))],p=(0,ln.useMemo)(()=>f(t),[t]),{tagPatterns:m,extensionPatterns:h,folderPatterns:y,notePatterns:g}=(0,ln.useMemo)(()=>uH(p),[p]);(0,ln.useLayoutEffect)(()=>{let B=l.current;if(!B)return;let Q=()=>{let K=B.scrollHeight;u(K),a(K>r)};if(Q(),typeof ResizeObserver>"u")return;let Y=new ResizeObserver(Q);return Y.observe(B),()=>Y.disconnect()},[r,p]);let b=i&&!n,_=n?s:r,w=B=>{let Q=hq({tagPatterns:B.tagPatterns??m,extensionPatterns:B.extensionPatterns??h,folderPatterns:B.folderPatterns??y,notePatterns:B.notePatterns??g});e(Q)},T=(B,Q)=>{let Y=K=>K!==B;switch(Q){case"folder":w({folderPatterns:y.filter(Y)});break;case"tag":w({tagPatterns:m.filter(Y)});break;case"note":w({notePatterns:g.filter(Y)});break;case"extension":w({extensionPatterns:h.filter(Y)});break}},O=()=>uH(f(d.current)),E=(B,Q)=>{let Y=O();if(!Y[B].includes(Q)){let K=hq({...Y,[B]:[...Y[B],Q]});e(K)}},P=()=>{new eQ(app,B=>{E("folderPatterns",B)}).open()},R=()=>{new rQ(app,B=>{E("tagPatterns",pae(B))}).open()},I=()=>{new FUe({app,onNoteSelect:B=>{E("notePatterns",VG(B))},excludeNotePaths:[],titleOnly:!0}).open()},N=()=>{new UUe(app,B=>{E("extensionPatterns",Xit(B))}).open()},z=()=>{new qUe(app,B=>{let Q=O(),Y=f(B),{tagPatterns:K,extensionPatterns:oe,folderPatterns:ue,notePatterns:de}=uH(Y),L=hq({tagPatterns:[...Q.tagPatterns,...K.filter(W=>!Q.tagPatterns.includes(W))],extensionPatterns:[...Q.extensionPatterns,...oe.filter(W=>!Q.extensionPatterns.includes(W))],folderPatterns:[...Q.folderPatterns,...ue.filter(W=>!Q.folderPatterns.includes(W))],notePatterns:[...Q.notePatterns,...de.filter(W=>!Q.notePatterns.includes(W))]});e(L)}).open()},V=(B,Q)=>{let Y=MCi[Q],K=Y.icon;return ln.default.createElement(Qc,{key:`${Q}:${B}`,variant:"secondary",className:"tw-group tw-flex tw-h-7 tw-items-center tw-gap-1.5 tw-py-1 tw-pl-2 tw-pr-1.5 sm:tw-h-6 sm:tw-py-0.5 sm:tw-pl-1.5"},ln.default.createElement(K,{className:we("tw-size-4 tw-shrink-0 sm:tw-size-3",Y.colorClass)}),ln.default.createElement(pc,{className:"tw-max-w-[100px] sm:tw-max-w-[120px]"},B),ln.default.createElement(pe,{variant:"ghost2",size:"fit","aria-label":`Remove ${B}`,className:"tw-h-auto tw-p-0",onClick:()=>T(B,Q)},ln.default.createElement(qo,{className:"tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning sm:tw-size-3"})))},k=(0,ln.useMemo)(()=>{let B=[];return y.forEach(Q=>B.push({pattern:Q,type:"folder"})),m.forEach(Q=>B.push({pattern:Q,type:"tag"})),g.forEach(Q=>B.push({pattern:Q,type:"note"})),h.forEach(Q=>B.push({pattern:Q,type:"extension"})),B},[y,m,g,h]),X=p.length>0;return ln.default.createElement("div",{ref:c,className:"tw-flex tw-w-full tw-flex-col tw-gap-2"},ln.default.createElement("div",{className:"tw-relative tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2"},ln.default.createElement("div",{ref:l,className:"tw-overflow-hidden tw-transition-[max-height] tw-duration-300 tw-ease-in-out",style:{maxHeight:i?_:void 0}},!X&&ln.default.createElement("div",{className:"tw-py-2 tw-text-center tw-text-sm tw-italic tw-text-muted"},"No patterns configured"),X&&ln.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-1.5"},k.map(B=>V(B.pattern,B.type)))),b&&ln.default.createElement("div",{className:"copilot-fade-mask-bottom tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-10 tw-rounded-b-md"})),ln.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-justify-between"},i?ln.default.createElement(pe,{variant:"ghost2",size:"sm",onClick:()=>o(B=>!B),className:"tw-h-9 tw-gap-1 tw-px-3 tw-text-accent sm:tw-h-auto sm:tw-px-2"},n?ln.default.createElement(ln.default.Fragment,null,"Show less ",ln.default.createElement(jg,{className:"tw-size-4 sm:tw-size-3"})):ln.default.createElement(ln.default.Fragment,null,"Show ",k.length," items ",ln.default.createElement(Wi,{className:"tw-size-4 sm:tw-size-3"}))):ln.default.createElement("div",null),ln.default.createElement(mN,null,ln.default.createElement(hN,{asChild:!0},ln.default.createElement(pe,{size:"sm",className:"tw-h-9 tw-gap-1 tw-px-3 sm:tw-h-auto sm:tw-px-2"},ln.default.createElement(Zb,{className:"tw-size-5 sm:tw-size-4"}),"Add...")),ln.default.createElement(Dv,{align:"end",container:c.current},ln.default.createElement(Ni,{onSelect:P,className:"tw-py-2.5 sm:tw-py-1.5"},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement($m,{className:"tw-size-5 tw-text-context-manager-yellow sm:tw-size-4"}),"Folder")),ln.default.createElement(Ni,{onSelect:R,className:"tw-py-2.5 sm:tw-py-1.5"},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement(A1,{className:"tw-size-5 tw-text-context-manager-orange sm:tw-size-4"}),"Tag")),ln.default.createElement(Ni,{onSelect:I,className:"tw-py-2.5 sm:tw-py-1.5"},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement(Du,{className:"tw-size-5 tw-text-context-manager-blue sm:tw-size-4"}),"Note")),ln.default.createElement(Ni,{onSelect:N,className:"tw-py-2.5 sm:tw-py-1.5"},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement(WF,{className:"tw-size-5 tw-text-context-manager-green sm:tw-size-4"}),"Extension")),ln.default.createElement(Ni,{onSelect:z,className:"tw-py-2.5 sm:tw-py-1.5"},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement(vw,{className:"tw-size-5 tw-text-context-manager-purple sm:tw-size-4"}),"Custom"))))))};var Han=()=>{let t=Br(),e=t.enableMiyo,r=t.activeEmbeddingModels,n=async o=>{if(o!==t.embeddingModelKey){if(t.enableSemanticSearchV3){new LUe(app,async()=>{Re("embeddingModelKey",o),await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})}).open();return}Re("embeddingModelKey",o),new Van.Notice("Embedding model saved. Enable Semantic Search to build the index.")}};return On.default.createElement("div",{className:"tw-space-y-4"},On.default.createElement("section",null,On.default.createElement("div",{className:"tw-space-y-4"},On.default.createElement(qr,{type:"switch",title:"Enable Semantic Search",description:"Enable semantic search for meaning-based document retrieval. When disabled, uses fast lexical search only. Use 'Refresh Vault Index' or 'Force Reindex Vault' to build the embedding index.",checked:t.enableSemanticSearchV3,onCheckedChange:o=>{new QY(app,async()=>{Re("enableSemanticSearchV3",o),!o&&t.enableMiyo&&Re("enableMiyo",!1),o&&await(await Promise.resolve().then(()=>(Pl(),Vc))).default.getInstance().indexVaultToVectorStore(!1,{userInitiated:!0})},o).open()}}),On.default.createElement(qr,{type:"switch",title:"Enable Inline Citations (experimental)",description:"When enabled, AI responses will include footnote-style citations within the text and numbered sources at the end. This is an experimental feature and may not work as expected for all models.",checked:t.enableInlineCitations,onCheckedChange:o=>Re("enableInlineCitations",o)}),On.default.createElement(qr,{type:"select",title:"Embedding Model",description:On.default.createElement("div",{className:"tw-space-y-2"},On.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},On.default.createElement("span",{className:"tw-font-medium tw-leading-none tw-text-accent"},"Powers Semantic Vault Search and Relevant Notes. Enable Semantic Search to use it."),On.default.createElement(to,{content:On.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},On.default.createElement("div",{className:"tw-pt-2 tw-text-sm tw-text-muted"},"This model converts text into vector representations, essential for semantic search and Question Answering (QA) functionality. Changing the embedding model will:"),On.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},On.default.createElement("li",null,"Require rebuilding your vault's vector index"),On.default.createElement("li",null,"Affect semantic search quality"),On.default.createElement("li",null,"Impact Question Answering feature performance")))})),e&&On.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Miyo search is enabled, so embeddings are generated by Miyo and this setting is ignored.")),value:t.embeddingModelKey,onChange:n,options:r.map(o=>({label:uZ(o),value:no(o)})),placeholder:"Model",disabled:e}),On.default.createElement(qr,{type:"select",title:"Auto-Index Strategy",description:On.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},On.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),On.default.createElement(to,{content:On.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},On.default.createElement("div",{className:"tw-space-y-1"},On.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),On.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},On.default.createElement("li",null,On.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},On.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),On.default.createElement("span",null,"Manual indexing via command or refresh only"))),On.default.createElement("li",null,On.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},On.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),On.default.createElement("span",null,"Index updates when plugin loads or reloads"))),On.default.createElement("li",null,On.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},On.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),On.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),On.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models"))})),value:t.indexVaultToVectorStore,onChange:o=>{Re("indexVaultToVectorStore",o)},options:k1t.map(o=>({label:o,value:o})),placeholder:"Strategy"}),t.enableSemanticSearchV3&&On.default.createElement(On.default.Fragment,null,On.default.createElement(qr,{type:"slider",title:"Requests per Minute",description:"Default is 60. Decrease if you are rate limited by your embedding provider.",min:10,max:60,step:10,value:Math.min(t.embeddingRequestsPerMin,60),onChange:o=>Re("embeddingRequestsPerMin",o)}),On.default.createElement(qr,{type:"slider",title:"Embedding Batch Size",description:"Default is 16. Increase if you are rate limited by your embedding provider.",min:1,max:128,step:1,value:t.embeddingBatchSize,onChange:o=>Re("embeddingBatchSize",o)}),On.default.createElement(qr,{type:"select",title:"Number of Partitions",description:"Number of partitions for Copilot index. Default is 1. Increase if you have issues indexing large vaults. Warning: Changes require clearing and rebuilding the index!",value:String(t.numPartitions||1),onChange:o=>Re("numPartitions",Number(o)),options:[{label:"1",value:"1"},{label:"2",value:"2"},{label:"4",value:"4"},{label:"8",value:"8"},{label:"16",value:"16"},{label:"32",value:"32"},{label:"40",value:"40"}],placeholder:"Select partitions"})),On.default.createElement(qr,{type:"slider",title:"Lexical Search RAM Limit",description:"Maximum RAM usage for full-text search index. Lower values use less memory but may limit search performance on large vaults. Default is 100 MB.",min:20,max:1e3,step:20,value:t.lexicalSearchRamLimit||100,onChange:o=>Re("lexicalSearchRamLimit",o),suffix:" MB"}),On.default.createElement(qr,{type:"switch",title:"Enable Folder and Graph Boosts",description:"Enable folder and graph-based relevance boosts for lexical search results. When disabled, provides pure keyword-based relevance scoring without folder or connection-based adjustments.",checked:t.enableLexicalBoosts,onCheckedChange:o=>Re("enableLexicalBoosts",o)}),On.default.createElement(qr,{type:"custom",title:"Exclusions",description:"Exclude folders, tags, note titles or file extensions from being indexed. Previously indexed files will remain until a force re-index is performed."},On.default.createElement(_0t,{value:t.qaExclusions,onChange:o=>Re("qaExclusions",o)})),On.default.createElement(qr,{type:"custom",title:"Inclusions",description:"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."},On.default.createElement(_0t,{value:t.qaInclusions,onChange:o=>Re("qaInclusions",o)})),On.default.createElement(qr,{type:"switch",title:"Enable Obsidian Sync for Copilot index",description:"If enabled, store the semantic index in .obsidian so it syncs with Obsidian Sync. If disabled, store it under .copilot/ at the vault root.",checked:t.enableIndexSync,onCheckedChange:o=>Re("enableIndexSync",o)}),On.default.createElement(qr,{type:"switch",title:"Disable index loading on mobile",description:"When enabled, Copilot index won't be loaded on mobile devices to save resources. Only chat mode will be available. Any existing index from desktop sync will be preserved. Uncheck to enable QA modes on mobile.",checked:t.disableIndexOnMobile,onCheckedChange:o=>Re("disableIndexOnMobile",o)}))))};var Jan=["basic","model","QA","command","plus","advanced"],RCi={basic:zi.default.createElement(Ure,{className:"tw-size-5"}),model:zi.default.createElement(Hre,{className:"tw-size-5"}),QA:zi.default.createElement(cx,{className:"tw-size-5"}),command:zi.default.createElement(zre,{className:"tw-size-5"}),plus:zi.default.createElement(zy,{className:"tw-size-5"}),advanced:zi.default.createElement(vw,{className:"tw-size-5"})},ICi={basic:()=>zi.default.createElement(Nan,null),model:()=>zi.default.createElement(kan,null),QA:()=>zi.default.createElement(Han,null),command:()=>zi.default.createElement(van,null),plus:()=>zi.default.createElement($an,null),advanced:()=>zi.default.createElement(wan,null)},Wan=Jan.map(t=>({id:t,icon:RCi[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),ACi=()=>{let{selectedTab:t,setSelectedTab:e}=_z();return zi.default.createElement("div",{className:"tw-flex tw-flex-col"},zi.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-rounded-lg"},Wan.map((r,n)=>zi.default.createElement(Gon,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===Wan.length-1}))),zi.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),zi.default.createElement("div",null,Jan.map(r=>{let n=ICi[r];return zi.default.createElement(Xon,{key:r,id:r,isSelected:t===r},zi.default.createElement(n,null))})))},NCi=({plugin:t})=>{let[e,r]=zi.default.useState(0),{latestVersion:n,hasUpdate:o}=Dqe(t.manifest.version),i=async()=>{new oUe(app,async()=>{sWe(),r(s=>s+1)}).open()};return zi.default.createElement(Yon,null,zi.default.createElement("div",null,zi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},zi.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},zi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zi.default.createElement("span",null,"Copilot Settings"),zi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},zi.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&zi.default.createElement(zi.default.Fragment,null,o?zi.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,")"):zi.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),zi.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},zi.default.createElement(pe,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),zi.default.createElement(ACi,{key:e})))},Kan=NCi;var v0t=$(J()),Gan=(0,v0t.createContext)(null);var BUe=class extends Tpe.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{let e=this.app.workspace.getLeavesOfType(Nu)[0]?.view;if(e&&te().enableRecentConversations)try{let o=this.plugin.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.plugin.userMemoryManager.addRecentConversation(this.plugin.chatUIState.getMessages(),o)}catch(n){F("Failed to analyze chat messages for memory:",n)}e&&te().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 Tpe.Notice("Plugin reloaded successfully.")}catch(e){new Tpe.Notice("Failed to reload the plugin. Please reload manually."),ne("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,Xan.createRoot)(r).render(w0t.default.createElement(Gan.Provider,{value:e},w0t.default.createElement(Kan,{plugin:this.plugin})))}};Ye();Xe();var zUe=class{constructor(e){this.chatManager=e;this.listeners=new Set;this.chatManager.setOnMessageCreatedCallback(()=>{this.notifyListeners()})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e()}catch(r){F("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1,i=!1,a,s){let u=await this.chatManager.sendMessage(e,r,n,o,i,a,s);return this.notifyListeners(),u}async editMessage(e,r,n,o=!1){let i=await this.chatManager.editMessage(e,r,n,o);return i&&this.notifyListeners(),i}async regenerateMessage(e,r,n){let o=await this.chatManager.regenerateMessage(e,r,i=>{n(i),this.notifyListeners()},()=>{this.notifyListeners()});return o&&this.notifyListeners(),o}async deleteMessage(e){let r=await this.chatManager.deleteMessage(e);return r&&this.notifyListeners(),r}clearMessages(){this.chatManager.clearMessages(),this.notifyListeners()}async truncateAfterMessageId(e){await this.chatManager.truncateAfterMessageId(e),this.notifyListeners()}getMessages(){return this.chatManager.getDisplayMessages()}getMessage(e){return this.chatManager.getMessage(e)}getLLMMessage(e){return this.chatManager.getLLMMessage(e)}getLLMMessages(){return this.chatManager.getLLMMessages()}get chatHistory(){return this.getMessages()}addMessage(e){this.chatManager.addMessage(e),this.notifyListeners()}clearChatHistory(){this.clearMessages()}replaceMessages(e){this.chatManager.loadMessages(e),this.notifyListeners()}getDebugInfo(){return this.chatManager.getDebugInfo()}async loadMessages(e){await this.chatManager.loadMessages(e),this.notifyListeners()}async handleProjectSwitch(){await this.chatManager.handleProjectSwitch(),this.notifyListeners()}async saveChat(e){await this.chatManager.saveChat(e)}async loadChatHistory(e){await this.chatManager.loadChatHistory(e),this.notifyListeners()}};var msn=require("obsidian");var fsn=require("@codemirror/state"),psn=require("@codemirror/view");var csn=$(J()),dsn=$(jm());var Ope=new WeakMap;function DCi(t){return t.startsWith("--")?t:t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}var Zan=new Set(["z-index","zIndex","opacity","flex","flex-grow","flexGrow","flex-shrink","flexShrink","font-weight","fontWeight","line-height","lineHeight","order","orphans","widows","tab-size","tabSize","column-count","columnCount"]);function jCi(t){let e=new Map;for(let[r,n]of Object.entries(t)){if(n==null)continue;let o=DCi(r),i;typeof n=="number"&&!r.startsWith("--")?i=Zan.has(r)||Zan.has(o)?String(n):`${n}px`:i=String(n),e.set(o,i)}return e}function Yan(t,e){if(!e)return;let r=`${e}-`;Array.from(t.classList).filter(o=>o.startsWith(r)).forEach(o=>{t.classList.remove(o)})}function VUe(t,e,r){if(!t)return;let n=jCi(r),o=Ope.get(t);o&&o.prefix&&o.prefix!==e&&Yan(t,o.prefix);let i=o?.properties??new Set,a=new Set;if(i.forEach(s=>{n.has(s)||t.style.removeProperty(s)}),n.forEach((s,u)=>{t.style.setProperty(u,s),a.add(u)}),a.size===0){Ope.delete(t);return}Ope.set(t,{properties:a,prefix:e})}function Qan(t){let e=Ope.get(t);e&&(e.properties.forEach(r=>{t.style.removeProperty(r)}),e.prefix&&Yan(t,e.prefix),Ope.delete(t))}var an=$(J()),k6=require("obsidian");Or();ra();Ye();Bt();var gS=$(J()),S0t=require("obsidian");qN();Bt();Xe();function esn(t){let{selectedText:e,selectedModelKey:r,includeNoteContext:n,settings:o}=t,[i,a]=(0,gS.useState)([]),s=(0,gS.useRef)(!0);(0,gS.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let u=(0,gS.useMemo)(()=>{try{let b=qS(r,o.activeModels);return b.enabled?b:(Te("Selected model is disabled; falling back to first enabled model.",{selectedModelKey:r}),o.activeModels.find(_=>_.enabled)??null)}catch{return Te("Selected model not found; falling back to first enabled model."),o.activeModels.find(b=>b.enabled)??null}},[r,o.activeModels]),{isStreaming:l,streamingText:c,runTurn:d,stop:f,reset:p}=OLe({model:u,systemPrompt:w$e,excludeThinking:!0,onNoModel:()=>{ne("No active model is configured. Please configure a model in Copilot settings."),new S0t.Notice("No active model configured. Please configure a model in Copilot settings.")},onNonAbortError:b=>{ne("Error generating response:",b),new S0t.Notice("Error generating response. Please try again.")}}),m=(0,gS.useCallback)(async b=>{if(!b.trim())return;let _={id:od(),role:"user",content:b,timestamp:Date.now()};a(T=>[...T,_]);let w=await d(async T=>{let O=b;return T.isFirstTurn&&(O=S$e(b,n)),T.signal.aborted?"":await ade(O,e,!T.isFirstTurn)});if(s.current)if(w){let T={id:od(),role:"assistant",content:w,timestamp:Date.now()};a(O=>[...O,T])}else a(T=>T[T.length-1]?.id===_.id?T.slice(0,-1):T)},[n,d,e]),h=(0,gS.useCallback)(()=>{f()},[f]),y=(0,gS.useCallback)(()=>{a([]),p()},[p]);return{messages:(0,gS.useMemo)(()=>!l||!c?i:[...i,{id:"streaming",role:"assistant",content:c,timestamp:Date.now()}],[i,l,c]),isStreaming:l,sendMessage:m,stop:h,clear:y}}var Sd=$(J()),tsn=require("obsidian");Or();Cn();Xe();var rsn=Sd.default.memo(function({message:e,isStreaming:r,isLastAssistantMessage:n,onCopy:o,onInsert:i,onReplace:a,hasSelection:s,isReplaceValid:u,replaceInvalidReason:l,isDisabledDueToStreaming:c,filePathSnapshot:d,plugin:f}){let p=(0,Sd.useRef)(null);if((0,Sd.useEffect)(()=>{if(e.role!=="assistant"||r)return;let h=!1;return(async()=>{let g=p.current;if(!g)return;g.empty();let b=d??"";try{await tsn.MarkdownRenderer.renderMarkdown(e.content,g,b,f)}catch(_){if(ne("Failed to render markdown:",_),h)return;g.empty(),g.textContent=e.content}h||g.classList.add("markdown-rendered")})(),()=>{h=!0}},[e.content,e.role,r,d,f]),e.role==="user")return Sd.default.createElement("div",{className:"tw-max-w-[85%] tw-self-end tw-rounded-lg tw-rounded-br-sm tw-bg-interactive-accent tw-px-3 tw-py-2 tw-text-on-accent"},Sd.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-sm"},e.content));if(r)return Sd.default.createElement("div",{className:"tw-max-w-[95%] tw-self-start tw-rounded-lg tw-rounded-bl-sm tw-bg-secondary tw-px-3 tw-py-2"},Sd.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-sm tw-text-normal"},e.content,Sd.default.createElement("span",{className:"tw-animate-pulse tw-text-accent"},"\u258A")));let m=n?"tw-opacity-100":"tw-opacity-0 group-hover/message:tw-opacity-100";return Sd.default.createElement("div",{className:"tw-group/message tw-max-w-[95%] tw-self-start"},Sd.default.createElement("div",{className:"tw-rounded-lg tw-rounded-bl-sm tw-bg-secondary tw-px-3 tw-py-2"},Sd.default.createElement("div",{ref:p,className:"tw-text-sm [&.markdown-rendered]:tw-text-sm [&_code]:tw-text-xs [&_p]:tw-my-1 [&_pre]:tw-my-2"})),e.content&&Sd.default.createElement("div",{className:`tw-mt-1 tw-flex tw-items-center tw-gap-0.5 tw-transition-opacity ${m}`},Sd.default.createElement(pe,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>o(e.id),title:"Copy to clipboard"},Sd.default.createElement($g,{className:"tw-size-3"})),Sd.default.createElement(pe,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>i(e.id),title:"Insert at cursor"},Sd.default.createElement(qre,{className:"tw-size-3"})),s&&Sd.default.createElement(pe,{variant:"ghost2",size:"icon",className:"tw-size-5 hover:tw-bg-modifier-hover",onClick:()=>a(e.id),disabled:!u,title:c?"Stop generating to replace":u?"Replace selection":AZ(l)},Sd.default.createElement(sne,{className:"tw-size-3"}))))});var Wu=$(J());$r();Xe();mr();var nsn=Wu.default.memo(function({value:e,onChange:r,onSubmit:n,sendShortcut:o="enter",placeholder:i="Ask a question...",disabled:a=!1,className:s="",onNotesChange:u,onNotesRemoved:l,onFoldersChange:c,onFoldersRemoved:d,onActiveNoteAdded:f,onActiveNoteRemoved:p,onEditorReady:m,currentActiveFile:h=null}){let[y,g]=(0,Wu.useState)(null),b=(0,Wu.useCallback)(O=>{g(()=>O)},[]);(0,Wu.useEffect)(()=>{if(y){let O=setTimeout(()=>{y()},50);return()=>clearTimeout(O)}},[y]);let _=Wu.default.useMemo(()=>({namespace:"QuickAskEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[oz,iz,vL,wL,az],onError:O=>{ne("QuickAskInput Lexical error:",O)},editable:!a}),[a]),w=(0,Wu.useCallback)(O=>{O.read(()=>{let P=Oi().getTextContent();r(P)})},[r]),T=(0,Wu.useCallback)(O=>{m?.(O)},[m]);return Wu.default.createElement(Bke,{initialConfig:_},Wu.default.createElement(jke,{currentActiveFile:h},Wu.default.createElement("div",{className:we("tw-relative",s)},Wu.default.createElement(Xke,{contentEditable:Wu.default.createElement(Zke,{className:"tw-max-h-48 tw-min-h-12 tw-w-full tw-resize-none tw-overflow-y-auto tw-border-none tw-bg-transparent tw-px-1 tw-py-2 tw-pr-8 tw-text-sm tw-text-normal tw-outline-none","aria-label":"Quick Ask input"}),placeholder:Wu.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-left-1 tw-top-2 tw-select-none tw-text-sm tw-text-muted/60"},i),ErrorBoundary:oqe}),Wu.default.createElement(nqe,{onChange:w}),Wu.default.createElement(tqe,null),Wu.default.createElement(fqe,{onSubmit:n,sendShortcut:o}),Wu.default.createElement(pqe,{value:e}),Wu.default.createElement(mqe,{onFocus:b,onEditorReady:T}),Wu.default.createElement(gqe,{onNotesChange:u,onNotesRemoved:l}),Wu.default.createElement(yqe,{onFoldersChange:c,onFoldersRemoved:d}),Wu.default.createElement(bqe,{onActiveNoteAdded:f,onActiveNoteRemoved:p}),Wu.default.createElement(dqe,null),Wu.default.createElement(cqe,{isCopilotPlus:!1,currentActiveFile:h}))))});Cn();function osn({plugin:t,view:e,selectedText:r,replaceGuard:n,onClose:o,onDragOffset:i,onResizeStart:a,hasCustomHeight:s}){let[u,l]=(0,an.useState)(""),c=(0,an.useRef)(null),d=(0,an.useRef)(null),f=(0,an.useRef)(!0),p=t.app.workspace.getActiveFile(),h=(0,an.useRef)(p?.path??null).current,y=Br(),[g]=bF(),b=y.quickCommandModelKey??g,[_,w]=(0,an.useState)(()=>y.quickCommandIncludeNoteContext),{messages:T,isStreaming:O,sendMessage:E,stop:P,clear:R}=esn({selectedText:r,selectedModelKey:b,includeNoteContext:_,settings:y}),I=T.length>0,N=n.getRange(),z=!!N&&N.from!==N.to,V=T[T.length-1]?.id,k=(0,an.useMemo)(()=>T.reduce((Z,le,Ce)=>le.role==="assistant"?Ce:Z,-1),[T]),X=(0,an.useCallback)(()=>{let Z=d.current?.getBoundingClientRect();return Z?{x:Z.left,y:Z.top}:{x:0,y:0}},[]),B=(0,an.useCallback)(Z=>{i?.(Z)},[i]),{handleMouseDown:Q}=Z$e({dragRef:d,bounds:null,writeToDom:!1,getPosition:X,onPositionChange:B}),Y=(0,an.useCallback)(Z=>le=>{le.preventDefault(),le.stopPropagation(),a?.(Z,{x:le.clientX,y:le.clientY})},[a]),K=(0,an.useCallback)(async()=>{if(!u.trim()||O)return;let Z=u;l(""),await E(Z)},[u,O,E]),oe=(0,an.useCallback)(Z=>{Z.stopPropagation(),Z.key==="Escape"&&!Z.defaultPrevented&&(Z.preventDefault(),o())},[o]),ue=(0,an.useCallback)(Z=>{Z.stopPropagation()},[]);(0,an.useEffect)(()=>{let Z=c.current;if(!Z)return;let le=24,Ce=()=>Z.scrollHeight-Z.scrollTop-Z.clientHeight<=le,He=()=>{f.current=Ce()};return f.current=Ce(),Z.addEventListener("scroll",He),()=>{Z.removeEventListener("scroll",He)}},[I]),(0,an.useEffect)(()=>{let Z=c.current;Z&&f.current&&(Z.scrollTop=Z.scrollHeight)},[T]);let de=(0,an.useCallback)(async Z=>{let le=T.find(Ce=>Ce.id===Z);if(le&&le.role==="assistant"){let Ce=f1(le.content);try{await navigator.clipboard.writeText(Ce),new k6.Notice("Copied to clipboard")}catch{new k6.Notice("Failed to copy to clipboard")}}},[T]),L=(0,an.useCallback)(Z=>{let le=T.find(Ce=>Ce.id===Z);if(!(!le||le.role!=="assistant"))try{let Ce=f1(le.content),He=e.state.selection.main.to,lt=e.state.toText(Ce);e.dispatch({changes:{from:He,to:He,insert:lt},selection:{anchor:He,head:He+lt.length}}),e.focus(),new k6.Notice("Inserted"),o()}catch{new k6.Notice("Failed to insert. Editor may have changed.")}},[T,e,o]),W=(0,an.useCallback)(Z=>{let le=T.find(lt=>lt.id===Z);if(!le||le.role!=="assistant")return;let Ce=f1(le.content),He=n.replace(Ce);if(!He.ok){new k6.Notice(He.message??"Cannot replace.");return}new k6.Notice("Replaced"),o()},[T,n,o]),ie=(0,an.useCallback)(Z=>{Re("quickCommandModelKey",Z)},[]),j=(0,an.useCallback)(Z=>{w(Z),Re("quickCommandIncludeNoteContext",Z)},[]),A=z&&!O?n.validate():null,U=!!A?.ok,H=A?.reason??null,re=z&&O;return an.default.createElement("div",{ref:d,className:`tw-group tw-relative tw-flex tw-size-full tw-flex-col tw-rounded-lg tw-rounded-b-none tw-border tw-border-solid tw-border-border tw-bg-primary tw-shadow-lg${I&&!s?" tw-max-h-[min(500px,70vh)]":""}`,onKeyDown:oe,onKeyUp:ue,onBeforeInput:ue,onInput:ue,onMouseDown:ue,onMouseUp:ue,onClick:ue},an.default.createElement("div",{className:"tw-relative tw-flex-none"},an.default.createElement("div",{className:"tw-flex tw-h-4 tw-cursor-grab tw-items-center tw-justify-center hover:tw-bg-[color-mix(in_srgb,var(--background-modifier-hover)_20%,transparent)] active:tw-cursor-grabbing",onMouseDown:Q},an.default.createElement("div",{className:"tw-h-[5px] tw-w-16 tw-rounded-sm tw-bg-[color-mix(in_srgb,var(--text-muted)_40%,transparent)] hover:tw-bg-[color-mix(in_srgb,var(--text-muted)_65%,transparent)]"})),an.default.createElement(pe,{className:"tw-absolute tw-right-2 tw-top-1 tw-rounded tw-p-1 tw-text-normal",variant:"ghost2",onClick:o,title:"Close"},an.default.createElement(qo,{className:"tw-size-4"}))),an.default.createElement(_de,{content:r.trim(),className:"tw-mt-3 tw-px-3"}),I&&an.default.createElement("div",{ref:c,"data-quick-ask-scroll":"true",className:"tw-flex tw-min-h-0 tw-flex-1 tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-3 tw-py-2"},T.map((Z,le)=>an.default.createElement(rsn,{key:Z.id,message:Z,isStreaming:O&&Z.id===V&&Z.role==="assistant",isLastAssistantMessage:Z.role==="assistant"&&le===k,onCopy:de,onInsert:L,onReplace:W,hasSelection:z,isReplaceValid:U,replaceInvalidReason:H,isDisabledDueToStreaming:re,filePathSnapshot:h,plugin:t}))),!I&&s&&an.default.createElement("div",{className:"tw-flex-1"}),an.default.createElement("div",{className:"tw-px-3 tw-pb-1 tw-pt-2"},an.default.createElement(nsn,{value:u,onChange:l,onSubmit:K,sendShortcut:y.defaultSendShortcut,placeholder:O?"Generating...":"Ask a question... ",currentActiveFile:p})),an.default.createElement("div",{className:"tw-mt-auto tw-flex tw-items-center tw-justify-between tw-gap-2 tw-border-t tw-border-solid tw-border-border tw-px-3 tw-py-1.5"},an.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},an.default.createElement(IZ,{size:"sm",variant:"ghost",value:b,onChange:ie,disabled:O}),an.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},an.default.createElement(Rl,{id:"quickAskIncludeContext",checked:_,onCheckedChange:Z=>j(!!Z),className:"tw-size-3.5",disabled:O}),an.default.createElement("label",{htmlFor:"quickAskIncludeContext",className:"tw-cursor-pointer tw-text-xs tw-text-muted"},"Note"),an.default.createElement(to,{content:"Include the active note's content as context",side:"top"}))),an.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},I&&an.default.createElement(pe,{variant:"ghost2",size:"icon",className:"hover:tw-bg-modifier-hover",onClick:R,title:"Clear conversation"},an.default.createElement(one,{className:"tw-size-4"})),O?an.default.createElement(pe,{variant:"destructive",size:"icon",onClick:P,title:"Stop generating"},an.default.createElement(e2,{className:"tw-size-4"})):an.default.createElement(pe,{variant:"default",size:"icon",onClick:K,disabled:!u.trim(),title:"Send message"},an.default.createElement(Q4,{className:"tw-size-4"})))),an.default.createElement("div",{className:"tw-absolute tw-right-0 tw-top-4 tw-h-[calc(100%-16px)] tw-w-1 tw-cursor-ew-resize",onMouseDown:Y("right")}),an.default.createElement("div",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-h-1 tw-w-full tw-cursor-ns-resize",onMouseDown:Y("bottom")}),an.default.createElement("div",{className:"quick-ask-resize-indicator-left tw-absolute tw-bottom-0 tw-left-0 tw-size-3 tw-cursor-nesw-resize",onMouseDown:Y("bottom-left")}),an.default.createElement("div",{className:"quick-ask-resize-indicator-right tw-absolute tw-bottom-0 tw-right-0 tw-z-[10] tw-size-3 tw-cursor-nwse-resize",onMouseDown:Y("bottom-right")}))}var $C=12,$Ci=6,isn=.83,asn=.9,ssn=420,usn=560,C0t=300,lsn=200,Pm=class Pm{constructor(e){this.options=e;this.root=null;this.overlayContainer=null;this.cleanupCallbacks=[];this.overlayHost=null;this.ownerDocument=null;this.ownerWindow=null;this.rafId=null;this.panelRerenderRafId=null;this.resizeObserver=null;this.isClosing=!1;this.closeAnimationTimeout=null;this.dragPosition=null;this.resizeSize=null;this.hasUserResizedHeight=!1;this.pos=null;this.fallbackPos=null;this.isResizing=!1;this.resizeDirection=null;this.resizeStartRect=null;this.resizeStartMouse=null;this.resizeRafId=null;this.savedBodyUserSelect="";this.savedBodyCursor="";this.closeWithAnimation=()=>{if(!this.isClosing)if(this.isClosing=!0,this.overlayContainer){this.overlayContainer.classList.add("closing");let e=n=>{n.target!==this.overlayContainer||n.animationName!=="copilot-quick-ask-fade-out"||(this.overlayContainer?.removeEventListener("animationend",e),this.closeAnimationTimeout!==null&&(window.clearTimeout(this.closeAnimationTimeout),this.closeAnimationTimeout=null),this.options.onClose())};this.overlayContainer.addEventListener("animationend",e);let r=this.ownerWindow??window;this.closeAnimationTimeout=r.setTimeout(()=>{this.overlayContainer?.removeEventListener("animationend",e),this.closeAnimationTimeout=null,this.options.onClose()},300)}else this.options.onClose()};this.handleDragOffset=e=>{this.dragPosition=e,this.updateDragPosition()};this.handleResizeStart=(e,r)=>{if(this.isResizing)return;let n=this.overlayContainer?.getBoundingClientRect();if(!n)return;this.isResizing=!0,this.resizeDirection=e,this.resizeStartRect=n,this.resizeStartMouse=r;let o=this.ownerDocument??document,i=o.body;this.savedBodyUserSelect=i.style.userSelect,this.savedBodyCursor=i.style.cursor,i.classList.add("copilot-quick-ask-resizing"),i.style.userSelect="none";let a={right:"ew-resize",bottom:"ns-resize","bottom-left":"nesw-resize","bottom-right":"nwse-resize"};i.style.cursor=a[e]??"default",o.addEventListener("mousemove",this.handleResizeMove,!0),o.addEventListener("mouseup",this.handleResizeEnd,!0)};this.handleResizeMove=e=>{if(!this.isResizing||!this.resizeStartRect||!this.resizeStartMouse)return;let r=this.ownerWindow??window;this.resizeRafId!==null&&r.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=r.requestAnimationFrame(()=>{this.resizeRafId=null,this.applyResize(e.clientX,e.clientY)})};this.handleResizeEnd=()=>{this.cleanupResize(),this.renderPanel()}}mount(e,r){this.pos=e,this.fallbackPos=typeof r=="number"?r:null,Pm.currentInstance=this,this.mountOverlay(),this.setupGlobalListeners(),this.schedulePositionUpdate()}destroy(){Pm.currentInstance===this&&(Pm.currentInstance=null);let e=this.ownerWindow??window;this.closeAnimationTimeout!==null&&(e.clearTimeout(this.closeAnimationTimeout),this.closeAnimationTimeout=null),this.cleanupResize();for(let n of this.cleanupCallbacks)try{n()}catch{}this.cleanupCallbacks=[],this.rafId!==null&&(e.cancelAnimationFrame(this.rafId),this.rafId=null),this.panelRerenderRafId!==null&&(e.cancelAnimationFrame(this.panelRerenderRafId),this.panelRerenderRafId=null),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.root?.unmount(),this.root=null,this.overlayContainer?.parentNode&&this.overlayContainer.parentNode.removeChild(this.overlayContainer),this.overlayContainer&&Qan(this.overlayContainer),this.overlayContainer=null;let r=Pm.overlayRoot;if(r&&r.childElementCount===0){let n=r.parentElement;r.remove(),Pm.overlayRoot=null,n?.classList.remove("copilot-quick-ask-overlay-host")}this.pos=null,this.fallbackPos=null,this.ownerDocument=null,this.ownerWindow=null}updatePosition(e,r){typeof e=="number"&&(this.pos=e),typeof r=="number"?this.fallbackPos=r:r===null&&(this.fallbackPos=null),this.schedulePositionUpdate()}getReplaceGuard(){return this.options.replaceGuard}schedulePanelRerender(){if(this.panelRerenderRafId!==null)return;let e=this.ownerWindow??window;this.panelRerenderRafId=e.requestAnimationFrame(()=>{this.panelRerenderRafId=null,this.renderPanel()})}renderPanel(){this.root&&this.root.render(csn.default.createElement(osn,{plugin:this.options.plugin,editor:this.options.editor,view:this.options.view,selectedText:this.options.selectedText,replaceGuard:this.options.replaceGuard,onClose:this.closeWithAnimation,onDragOffset:this.handleDragOffset,onResizeStart:this.handleResizeStart,hasCustomHeight:this.hasUserResizedHeight}))}static closeCurrentWithAnimation(){return Pm.currentInstance?(Pm.currentInstance.closeWithAnimation(),!0):!1}static getOverlayRoot(e){if(Pm.overlayRoot&&Pm.overlayRoot.parentElement!==e&&(Pm.overlayRoot.parentElement?.classList.remove("copilot-quick-ask-overlay-host"),Pm.overlayRoot.remove(),Pm.overlayRoot=null),Pm.overlayRoot)return Pm.overlayRoot;let n=(e.ownerDocument??document).createElement("div");return n.className="copilot-quick-ask-overlay-root",e.appendChild(n),e.classList.add("copilot-quick-ask-overlay-host"),Pm.overlayRoot=n,n}mountOverlay(){let e=this.options.view.dom??document.body;this.overlayHost=e;let r=e.ownerDocument??document,n=r.defaultView??window;this.ownerDocument=r,this.ownerWindow=n;let o=Pm.getOverlayRoot(e),i=r.createElement("div");i.className="copilot-quick-ask-overlay",o.appendChild(i),this.overlayContainer=i,this.root=(0,dsn.createRoot)(i),this.renderPanel();let a=()=>this.schedulePositionUpdate();n.addEventListener("scroll",a,!0),this.cleanupCallbacks.push(()=>n.removeEventListener("scroll",a,!0));let s=()=>this.schedulePositionUpdate();n.addEventListener("resize",s),this.cleanupCallbacks.push(()=>n.removeEventListener("resize",s));let u=this.options.view?.scrollDOM;u&&(u.addEventListener("scroll",a),this.cleanupCallbacks.push(()=>u.removeEventListener("scroll",a))),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.schedulePositionUpdate()),u&&this.resizeObserver.observe(u))}setupGlobalListeners(){let e=n=>{if(n.key!=="Escape"||n.defaultPrevented)return;let i=(this.ownerDocument??document).activeElement;i&&this.overlayContainer?.contains(i)||(n.preventDefault(),n.stopPropagation(),this.closeWithAnimation())},r=this.ownerWindow??window;r.addEventListener("keydown",e),this.cleanupCallbacks.push(()=>r.removeEventListener("keydown",e))}schedulePositionUpdate(){if(this.rafId!==null)return;let e=this.ownerWindow??window;this.rafId=e.requestAnimationFrame(()=>{this.rafId=null,this.updateOverlayPosition()})}isAnchorRectVisible(e,r){return e.bottom>=r.top&&e.top<=r.bottom&&e.right>=r.left&&e.left<=r.right}resolveVisibleAnchorRect(e,r){let n=r??e,o=[this.pos,this.fallbackPos];for(let i of o){if(typeof i!="number")continue;let a=this.options.view.coordsAtPos(i);if(a&&this.isAnchorRectVisible(a,n))return a}return null}updateOverlayPosition(){if(!this.overlayContainer||this.pos===null)return;if(this.dragPosition){this.updateDragPosition();return}let e=this.ownerDocument??document,r=this.overlayHost?.getBoundingClientRect()??e.body.getBoundingClientRect(),n=r.width,o=this.options.view.scrollDOM,i=o?.getBoundingClientRect(),s=o?.querySelector(".cm-sizer")?.getBoundingClientRect(),u=this.resolveVisibleAnchorRect(r,i),l=Math.min(ssn,n*isn),c=Math.min(usn,n*asn),d=Math.min(C0t,n-$C*2),f=this.resizeSize?.width??Math.max(d,Math.min(l,c)),p=this.resizeSize?.height,m=(s?.left??i?.left??r.left+$C)-r.left,h=s?.width??i?.width??n-$C*2,y=m+h,g=u?u.left-r.left:m+(h-f)/2;g=Math.min(g,y-f),g=Math.max(g,m),g=Math.min(g,n-$C-f),g=Math.max(g,$C);let b=(i?.top??r.top)-r.top,_=(i?.bottom??r.bottom)-r.top,w=_-b,T=b+$C;VUe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:f,...typeof p=="number"?{height:p}:{},left:Math.round(g),top:Math.round(T)});let O=typeof p=="number"?p:this.overlayContainer.getBoundingClientRect().height||lsn,E=u?u.bottom-r.top+$Ci:b+(w-O)/2;E=Math.max(E,T);let P=_-$C-O,R=Math.max(T,P),I=Math.max(T,Math.min(E,R));VUe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:f,...typeof p=="number"?{height:p}:{},left:Math.round(g),top:Math.round(I)})}cleanupResize(){let e=this.ownerWindow??window;if(this.resizeRafId!==null&&(e.cancelAnimationFrame(this.resizeRafId),this.resizeRafId=null),this.isResizing){let r=this.ownerDocument??document,n=r.body;r.removeEventListener("mousemove",this.handleResizeMove,!0),r.removeEventListener("mouseup",this.handleResizeEnd,!0),n.classList.remove("copilot-quick-ask-resizing"),n.style.userSelect=this.savedBodyUserSelect,n.style.cursor=this.savedBodyCursor}this.isResizing=!1,this.resizeDirection=null,this.resizeStartRect=null,this.resizeStartMouse=null}applyResize(e,r){if(!this.resizeStartRect||!this.resizeStartMouse||!this.resizeDirection)return;let n=this.ownerDocument??document,o=this.overlayHost?.getBoundingClientRect()??n.body.getBoundingClientRect(),i=e-this.resizeStartMouse.x,a=r-this.resizeStartMouse.y,s=this.resizeStartRect,u=this.resizeDirection,l=o.width,c=Math.min(C0t,l-$C*2),d=lsn,f=o.left+$C,p=o.right-$C,m=o.bottom-$C,h=s.width,y=s.height,g,b,_=u!=="right";switch(u){case"right":h=s.width+i;break;case"bottom":y=s.height+a;break;case"bottom-right":h=s.width+i,y=s.height+a;break;case"bottom-left":h=s.width-i,y=s.height+a,g=s.left+i,b=s.top;break}let w=p-s.left,T=s.right-f,O=m-s.top;u==="bottom-left"?(h=Math.max(c,Math.min(h,T)),g=s.right-h,g<f&&(g=f,h=s.right-f)):h=Math.max(c,Math.min(h,w)),_&&(y=Math.max(d,Math.min(y,O)));let E=this.resizeSize?.height,P={width:h};_?P.height=y:this.hasUserResizedHeight&&typeof E=="number"&&(P.height=E),this.resizeSize=P;let R=this.hasUserResizedHeight;_&&(this.hasUserResizedHeight=!0),this.hasUserResizedHeight!==R&&this.renderPanel(),u==="bottom-left"&&g!==void 0?(this.dragPosition={x:g,y:b??s.top},this.updateDragPosition()):this.dragPosition?this.updateDragPosition():this.schedulePositionUpdate()}updateDragPosition(){if(!this.overlayContainer||!this.dragPosition)return;let e=this.ownerDocument??document,r=this.overlayHost?.getBoundingClientRect()??e.body.getBoundingClientRect(),n=r.width,o=Math.min(ssn,n*isn),i=Math.min(usn,n*asn),a=Math.min(C0t,n-$C*2),s=this.resizeSize?.width??Math.max(a,Math.min(o,i)),u=this.resizeSize?.height;VUe(this.overlayContainer,"copilot-quick-ask-overlay-pos",{width:s,...u?{height:u}:{},left:Math.round(this.dragPosition.x-r.left),top:Math.round(this.dragPosition.y-r.top)})}};Pm.overlayRoot=null,Pm.currentInstance=null;var xQ=Pm;var Oz=fsn.StateEffect.define(),x0t=psn.ViewPlugin.fromClass(class{constructor(t){this.view=t;this.overlay=null;this.pos=null;this.fallbackPos=null}update(t){for(let e of t.transactions)for(let r of e.effects){if(!r.is(Oz))continue;let n=r.value;if(!n){this.overlay?.destroy(),this.overlay=null,this.pos=null,this.fallbackPos=null;continue}this.overlay?.destroy(),this.pos=n.pos,this.fallbackPos=typeof n.fallbackPos=="number"?n.fallbackPos:null,this.overlay=new xQ(n.options),this.overlay.mount(n.pos,this.fallbackPos)}if(this.overlay&&t.docChanged){let e=this.overlay.getReplaceGuard();e?.onDocChanged&&e.onDocChanged(t.changes),this.pos!==null&&(this.pos=t.changes.mapPos(this.pos)),this.fallbackPos!==null&&(this.fallbackPos=t.changes.mapPos(this.fallbackPos)),this.pos!==null&&this.overlay.updatePosition(this.pos,this.fallbackPos),this.overlay.schedulePanelRerender()}}destroy(){this.overlay?.destroy(),this.overlay=null,this.pos=null,this.fallbackPos=null}});Xe();var Epe=class{constructor(e){this.quickAskWidgetState=null;this.plugin=e}close(e=!0){let r=this.quickAskWidgetState;if(!r)return;if(!e){this.quickAskWidgetState=null;try{let o=[Oz.of(null),...$v.buildEffects(r.view,null)];r.view.dispatch({effects:o})}catch(o){Te("Failed to dispatch close effect:",o)}return}if(this.quickAskWidgetState=null,!xQ.closeCurrentWithAnimation())try{let o=[Oz.of(null),...$v.buildEffects(r.view,null)];r.view.dispatch({effects:o}),r.view.focus()}catch(o){Te("Failed to dispatch close effect or focus:",o)}}show(e,r){let n=r.state.selection.main,o=e.editor,i=e.leaf,a=e.file?.path??null,s=r.state.doc.sliceString(n.from,n.to),u=n.from,l=n.to;this.close(!1);let c=J8r({editorView:r,leafSnapshot:i,filePathSnapshot:a,selectedTextSnapshot:s,initialRange:{from:u,to:l},getLeafState:()=>{let f=i.view;return f instanceof msn.MarkdownView?{leaf:i,editorView:f.editor?.cm??null,filePath:f.file?.path??null}:{leaf:null,editorView:null,filePath:null}}}),d=(f=!0)=>{let p=!this.quickAskWidgetState||this.quickAskWidgetState.view===r;p&&(this.quickAskWidgetState=null);try{let m=[Oz.of(null),...$v.buildEffects(r,null)];r.dispatch({effects:m}),p&&f&&r.focus()}catch(m){Te("Failed to dispatch close effect or focus:",m)}};try{r.dispatch({effects:[Oz.of(null),...$v.buildEffects(r,null),Oz.of({pos:n.head,fallbackPos:n.anchor,options:{plugin:this.plugin,editor:o,view:r,selectedText:s,selectionFrom:u,selectionTo:l,replaceGuard:c,onClose:()=>d(!0)}}),...$v.buildEffects(r,{from:u,to:l})]}),this.quickAskWidgetState={view:r,pos:n.head,close:d}}catch(f){Te("Failed to show Quick Ask panel:",f),this.quickAskWidgetState=null}}isOpen(){return this.quickAskWidgetState!==null}createExtension(){return[x0t]}};var Ppe=require("obsidian");mr();Xe();var HUe=$de("copilot-chat-selection-highlight");function T0t(t){try{let e=HUe.buildEffects(t,null);e.length>0&&t.dispatch({effects:e})}catch{}}var Mpe=class{constructor(e,r){this.lastActiveMarkdownLeaf=null;this.lastActiveLeafWasMarkdown=!1;this.snapshot=null;this.plugin=e,this.closeQuickAskOnChatFocus=r?.closeQuickAskOnChatFocus??!1}initialize(){let e=this.plugin.app.workspace.activeLeaf??null;this.lastActiveLeafWasMarkdown=e?.view instanceof Ppe.MarkdownView,this.lastActiveLeafWasMarkdown&&e&&(this.lastActiveMarkdownLeaf=e)}cleanup(){this.clear(),this.lastActiveMarkdownLeaf=null,this.lastActiveLeafWasMarkdown=!1}handleActiveLeafChange(e){let r=this.lastActiveLeafWasMarkdown,n=e?.getViewState().type??null,o=e?.view instanceof Ppe.MarkdownView;this.lastActiveLeafWasMarkdown=o,o&&e&&(this.lastActiveMarkdownLeaf=e),this.snapshot&&n!==Nu&&this.clear(),n===Nu&&r&&(this.closeQuickAskOnChatFocus&&this.plugin.quickAskController?.close(!1),this.persist({useFallback:!0}))}persistFromPointerDown(){this.plugin.app.workspace.activeLeaf?.getViewState().type!==Nu&&this.persist({useFallback:!1})}clearIfNoNoteContexts(e){e.some(r=>r.sourceType==="note")||this.clear()}clearForNewChat(){this.clear()}persist(e){let r=this.getEditorView(e.useFallback);if(!r)return;let n=r.state.selection.main;if(n.from===n.to)return;let o=n.from,i=n.to,a=this.getHighlightRange(r);if(this.snapshot?.view===r&&this.snapshot.from===o&&this.snapshot.to===i&&a?.from===o&&a?.to===i)return;this.snapshot&&this.snapshot.view!==r&&(this.hideHighlight(this.snapshot.view),this.snapshot=null),this.showHighlight(r,o,i)&&(this.snapshot={view:r,from:o,to:i})}clear(){this.snapshot&&(this.hideHighlight(this.snapshot.view),this.snapshot=null)}getEditorView(e){let r=this.plugin.app.workspace.getActiveViewOfType(Ppe.MarkdownView);return r?.editor?.cm?r.editor.cm:e&&this.lastActiveMarkdownLeaf?.view instanceof Ppe.MarkdownView?this.lastActiveMarkdownLeaf.view.editor?.cm??null:null}showHighlight(e,r,n){try{let o=HUe.buildEffects(e,{from:r,to:n});return o.length===0?!1:(e.dispatch({effects:o}),!0)}catch(o){return ne("ChatSelectionHighlight show failed:",o),!1}}hideHighlight(e){try{let r=HUe.buildEffects(e,null);r.length>0&&e.dispatch({effects:r})}catch(r){Te("ChatSelectionHighlight hide failed (view may be destroyed):",r)}}getHighlightRange(e){return HUe.getRange(e)}};var Cd=require("obsidian");l1();qN();var WUe=class extends Cd.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.chatHistoryLastAccessedAtManager=new kJ}async onload(){await this.loadSettings(),this.settingsUnsubscriber=hl(async(a,s)=>{s.enableEncryption?await this.saveData(await sDt(s)):await this.saveData(s),Obt(this,a,s)}),this.addSettingTab(new BUe(this.app,this)),eZ(this.app.vault),this.brevilabsClient=Ql.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),E0(),W_r(),this.projectManager=ry.getInstance(this.app,this),this.vectorStoreManager=O0.getInstance(),Mfe.getInstance().initialize(),this.fileParserManager=new Tq(this.brevilabsClient,this.app.vault);let n=new lQ,o=this.projectManager.getCurrentChainManager(),i=new rUe(n,o,this.fileParserManager,this);if(this.chatUIState=new zUe(i),this.userMemoryManager=new GU(this.app),this.quickAskController=new Epe(this),this.registerEditorExtension(this.quickAskController.createExtension()),this.chatSelectionHighlightController=new Mpe(this,{closeQuickAskOnChatFocus:!1}),this.chatSelectionHighlightController.initialize(),Cd.Platform.isDesktopApp){let{activeLeafRef:a,layoutRef:s}=Tbt(this.app,{preserveOnViewTypes:[Nu]});this.registerEvent(a),this.registerEvent(s)}this.registerView(Nu,a=>new yz(a,this)),this.registerView(Ile,a=>new dje(a)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",a=>{this.activateView()}),Obt(this,void 0,te()),this.registerEvent(this.app.workspace.on("editor-menu",a=>{jon(a,this.app)})),this.registerEvent(this.app.workspace.on("active-leaf-change",a=>{if(this.chatSelectionHighlightController.handleActiveLeafChange(a??null),a&&a.view instanceof Cd.MarkdownView&&a.view.file){let u=this.app.workspace.getLeavesOfType(Nu).find(l=>l.view instanceof yz)?.view;if(u){let l=new CustomEvent(US.ACTIVE_LEAF_CHANGE);u.eventTarget.dispatchEvent(l)}}})),this.customCommandRegister=new Zqe(this,this.app.vault),this.systemPromptRegister=new Ude(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(Lon).then(Fon),this.systemPromptRegister.initialize().then(()=>Nbt(this.app.vault))}),this.initSelectionHandler(),this.initWebSelectionWatcher()}async onunload(){this.clearAllPersistentSelectionHighlights(),this.chatSelectionHighlightController?.cleanup(),this.projectManager&&this.projectManager.onunload(),Mfe.getInstance().cleanup(),this.customCommandRegister.cleanup(),this.systemPromptRegister.cleanup(),this.settingsUnsubscriber?.(),this.cleanupSelectionHandler(),this.cleanupWebSelectionWatcher(),this.clearSelectionContext();try{_d(this.app).stopActiveWebTabTracking()}catch{}await Im.flush(),F("Copilot plugin unloaded")}clearAllPersistentSelectionHighlights(){try{let r=this.app.workspace.getLeavesOfType("markdown");for(let n of r){let o=n.view;if(!(o instanceof Cd.MarkdownView))continue;let i=o.editor?.cm;i&&($v.hide(i),T0t(i))}}catch(r){Te("Failed to clear persistent selection highlights:",r)}}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(te().autosaveChat){let r=this.app.workspace.getLeavesOfType(Nu)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Nu).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Nu).find(l=>l.view instanceof yz)?.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(Nu).find(n=>n.view instanceof yz)?.view;if(r){let n=new CustomEvent(US.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Nu&&this.emitChatIsVisible()}))}initSelectionHandler(){this.selectionChangeHandler=()=>{this.selectionDebounceTimer&&window.clearTimeout(this.selectionDebounceTimer),this.selectionDebounceTimer=window.setTimeout(()=>{this.handleSelectionChange()},500)},document.addEventListener("selectionchange",this.selectionChangeHandler)}cleanupSelectionHandler(){this.selectionDebounceTimer&&window.clearTimeout(this.selectionDebounceTimer),this.selectionChangeHandler&&document.removeEventListener("selectionchange",this.selectionChangeHandler)}clearSelectionContext(){SO([])}clearWebSelectionContextForUrl(r){let n=tx(),o=n.filter(i=>i.sourceType!=="web"||i.url!==r);o.length!==n.length&&SO(o)}setSelectionContext(r){SO([r])}handleSelectionChange(){if(!te().autoAddSelectionToContext)return;let n=this.app.workspace.getActiveViewOfType(Cd.MarkdownView);if(!n||!n.editor)return;let o=n.editor,i=this.app.workspace.getActiveFile(),a=o.listSelections()[0];if(!a)return;let s=i?`${i.path}:${a.anchor.line}:${a.anchor.ch}:${a.head.line}:${a.head.ch}`:"";if(s===this.lastSelectionSignature)return;this.lastSelectionSignature=s;let u=o.getSelection();if(!u||!u.trim()){let m=tx(),h=m.filter(y=>y.sourceType!=="note");m.length!==h.length&&SO(h);return}if(!i)return;let l=a.anchor.line+1,c=a.head.line+1,d=Math.min(l,c),f=Math.max(l,c),p={id:od(),content:u,sourceType:"note",noteTitle:i.basename,notePath:i.path,startLine:d,endLine:f};this.setSelectionContext(p)}initWebSelectionWatcher(){if(!Cd.Platform.isDesktopApp)return;let r=_d(this.app);this.webSelectionTracker=new nUe({intervalMs:500,emptySelectionDebounceCount:2,isEnabled:()=>te().autoAddSelectionToContext,getLeaf:()=>r.getActiveLeaf()??r.getLastActiveLeaf(),getActiveLeaf:()=>r.getActiveLeaf(),onSelectionChange:n=>{this.setSelectionContext(n)},onSelectionClear:({url:n})=>{this.clearWebSelectionContextForUrl(n)}}),this.webSelectionTracker.start()}cleanupWebSelectionWatcher(){this.webSelectionTracker?.stop(),this.webSelectionTracker=void 0}suppressCurrentWebSelection(r){if(r&&r.trim()){this.webSelectionTracker?.suppressSelectionForUrl(r);return}this.webSelectionTracker?.suppressCurrentSelection()}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(Cd.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(Nu).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Nu);r.length===0?te().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Nu,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Nu,active:!0}):this.app.workspace.revealLeaf(r[0]),setTimeout(()=>{this.emitChatIsVisible()},50)}async deactivateView(){this.app.workspace.detachLeavesOfType(Nu)}async loadSettings(){let r=await this.loadData(),n=uWe(r);F_(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=no(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 Cd.Notice("No chat history found.");return}new Xqe(this.app,r,this.chatHistoryLastAccessedAtManager,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=await tUe(this.app,te().defaultSaveFolder);if(r.length===0)return[];let o=Gu()?.id;if(o){let i=`${o}__`;return r.filter(a=>a.basename.startsWith(i))}else return r.filter(i=>!i.basename.match(/^[a-zA-Z0-9-]+__/))}async getChatHistoryItems(){return(await this.getChatHistoryFiles()).map(n=>{let o=tpe(n),i=rpe(n),a=this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,i??o.getTime()),s=new Date(a);return{id:n.path,title:epe(n),createdAt:o,lastAccessedAt:s}})}async touchChatHistoryLastAccessedAt(r){try{this.chatHistoryLastAccessedAtManager.touch(r.path);let n=rpe(r),o=this.chatHistoryLastAccessedAtManager.shouldPersist(r.path,n);if(o===null)return;let i=o;this.app.fileManager?.processFrontMatter&&this.app.vault.getAbstractFileByPath(r.path)!=null?await this.app.fileManager.processFrontMatter(r,a=>{let s=Number(a.lastAccessedAt),u=Number.isFinite(s)&&s>0?s:0;i=Math.max(u,o),u!==i&&(a.lastAccessedAt=i)}):await ope(this.app,r.path,{lastAccessedAt:i}),this.chatHistoryLastAccessedAtManager.markPersisted(r.path,i)}catch(n){Te(`[CopilotPlugin] Failed to update chat lastAccessedAt for ${r.path}`,n)}}getChatHistoryLastAccessedAtManager(){return this.chatHistoryLastAccessedAtManager}async loadChatHistory(r){await this.autosaveCurrentChat();let n=this.app.workspace.getLeavesOfType(Nu)[0];n||this.activateView(),await this.chatUIState.loadChatHistory(r),this.touchChatHistoryLastAccessedAt(r);let o=(n||this.app.workspace.getLeavesOfType(Nu)[0])?.view;o&&o.updateView()}async loadChatById(r){let n=await HSt(this.app,r);if(n)await this.loadChatHistory(n);else throw new Error("Chat file not found.")}async openChatSourceFile(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof Cd.TFile)await this.app.workspace.getLeaf(!0).openFile(n);else if(await this.app.vault.adapter.exists(r))new Cd.Notice("Cannot open source files from hidden directories. To open chat notes in the editor, save them to a non-hidden folder in settings.");else throw new Error("Chat file not found.")}async updateChatTitle(r,n){let o=this.app.vault.getAbstractFileByPath(r);if(o instanceof Cd.TFile)await this.app.fileManager.processFrontMatter(o,i=>{i.topic=n}),await new Promise(i=>{let a=u=>{u.path===r&&(this.app.metadataCache.off("changed",a),clearTimeout(s),i())};this.app.metadataCache.on("changed",a);let s=setTimeout(()=>{this.app.metadataCache.off("changed",a),i()},500)}),new Cd.Notice("Chat title updated.");else if(await HSt(this.app,r))await ope(this.app,r,{topic:n.trim()}),new Cd.Notice("Chat title updated.");else throw new Error("Chat file not found.")}async deleteChatHistory(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof Cd.TFile)await this.app.vault.delete(n),new Cd.Notice("Chat deleted.");else if(await this.app.vault.adapter.exists(r))await this.app.vault.adapter.remove(r),new Cd.Notice("Chat deleted.");else throw new Error("Chat file not found.")}async handleNewChat(){if(c9(),await Im.clear(),te().enableRecentConversations)try{let o=this.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.userMemoryManager.addRecentConversation(this.chatUIState.getMessages(),o)}catch(n){F("Failed to analyze chat messages for memory:",n)}await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Nu)[0];if(r){let n=r.view,o=new CustomEvent(US.ABORT_STREAM,{detail:{reason:"new-chat"}});n.eventTarget.dispatchEvent(o)}this.chatUIState.clearMessages(),r?r.view.updateView():await this.activateView()}async newChat(){await this.handleNewChat()}async customSearchDB(r,n,o){let i=te(),{FilterRetriever:a}=await Promise.resolve().then(()=>(ZDe(),U4r)),{mergeFilterAndSearchResults:s}=await Promise.resolve().then(()=>(YDe(),B4r)),l=await new a(this.app,{salientTerms:n,maxK:20}).getRelevantDocuments(r),d=await(i.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(jmt(),k4r))).MergedSemanticRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1}):new(await Promise.resolve().then(()=>(xX(),Dmt))).TieredLexicalRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(r),{filterResults:f,searchResults:p}=s(l,d);return[...f,...p].map(h=>({content:h.pageContent,metadata:h.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/sax-js/sax.js:
|
||
(*! http://mths.be/fromcodepoint v0.1.0 by @mathias *)
|
||
|
||
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-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/arrow-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/brain.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/check.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/chevron-down.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/chevron-right.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/chevron-up.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-alert.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-check-big.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-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/circle-dashed.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-help.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-plus.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-stop.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle-x.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/circle.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/clipboard-paste.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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/coins.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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-clock.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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/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/hash.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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-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-square-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/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/pause.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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/play.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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/replace.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/rotate-ccw.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/rotate-cw.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/search.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/send.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/settings.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source 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/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/tag.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/text-cursor-input.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/trash-2.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/triangle-alert.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/wrench.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/x.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/zap-off.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/zap.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/lucide-react.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
safe-buffer/index.js:
|
||
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||
|
||
@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 */ |