/* 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 swt=Object.create;var nD=Object.defineProperty;var awt=Object.getOwnPropertyDescriptor;var lwt=Object.getOwnPropertyNames;var cwt=Object.getPrototypeOf,uwt=Object.prototype.hasOwnProperty;var oPe=t=>{throw TypeError(t)};var dwt=(t,e,n)=>e in t?nD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var C=(t,e)=>()=>(t&&(e=t(t=0)),e);var Tt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zn=(t,e)=>{for(var n in e)nD(t,n,{get:e[n],enumerable:!0})},iPe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of lwt(e))!uwt.call(t,o)&&o!==n&&nD(t,o,{get:()=>e[o],enumerable:!(r=awt(e,o))||r.enumerable});return t};var N=(t,e,n)=>(n=t!=null?swt(cwt(t)):{},iPe(e||!t||!t.__esModule?nD(n,"default",{value:t,enumerable:!0}):n,t)),fwt=t=>iPe(nD({},"__esModule",{value:!0}),t);var I=(t,e,n)=>dwt(t,typeof e!="symbol"?e+"":e,n),pwt=(t,e,n)=>e.has(t)||oPe("Cannot "+n);var GQ=(t,e,n)=>e.has(t)?oPe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n);var sPe=(t,e,n)=>(pwt(t,e,"access private method"),n);function aPe(t,e=0){return(al[t[e+0]]+al[t[e+1]]+al[t[e+2]]+al[t[e+3]]+"-"+al[t[e+4]]+al[t[e+5]]+"-"+al[t[e+6]]+al[t[e+7]]+"-"+al[t[e+8]]+al[t[e+9]]+"-"+al[t[e+10]]+al[t[e+11]]+al[t[e+12]]+al[t[e+13]]+al[t[e+14]]+al[t[e+15]]).toLowerCase()}var al,lPe=C(()=>{al=[];for(let t=0;t<256;++t)al.push((t+256).toString(16).slice(1))});function ZQ(){if(!YQ){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");YQ=crypto.getRandomValues.bind(crypto)}return YQ(mwt)}var YQ,mwt,cPe=C(()=>{mwt=new Uint8Array(16)});var hwt,JQ,uPe=C(()=>{hwt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),JQ={randomUUID:hwt}});function gwt(t,e,n){if(JQ.randomUUID&&!e&&!t)return JQ.randomUUID();t=t||{};let r=t.random??t.rng?.()??ZQ();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(n=n||0,n<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)e[n+o]=r[o];return e}return aPe(r)}var si,dPe=C(()=>{uPe();cPe();lPe();si=gwt});var qh=C(()=>{dPe()});var Qi=C(()=>{});var rD=C(()=>{});var XQ,jy,No,uo,Sd,Af,ywt,wwt,vwt,xwt,bwt,Cwt,QQ,pPe,mPe,oD,bu,eee,iD,NS,sD,tee,aD,nee,ree,ZV,oee,lD,JV,XV,iee,QV,_wt,see,eW,Td,Vy,Pc,ZE,Ec,Ex,Gh,um,OS,aee,Cu,tW,hPe,JE,bt,nW,rW,lee,gPe,XE,Hn,kf,It=C(()=>{qh();Qi();rD();XQ="https://api.brevilabs.com/v1",jy="https://models.brevilabs.com/v1",No="copilot-chat-view",uo="user",Sd="ai",Af="copilot",ywt=`${Af}/copilot-conversations`,wwt=`${Af}/copilot-custom-prompts`,vwt=`${Af}/memory`,xwt=`${Af}/system-prompts`,bwt=`${Af}/projects`,Cwt="",QQ=Af,pPe=`You are Obsidian Copilot, a helpful assistant that integrates AI to Obsidian note-taking. 1. Never mention that you do not have access to something. Always rely on the user provided context. 2. Always answer to the best of your knowledge. If you are unsure about something, say so and ask the user to provide more context. 3. If the user mentions "note", it most likely means an Obsidian note in the vault, not the generic meaning of a note. 4. If the user mentions "@vault", it means the user wants you to search the Obsidian vault for information relevant to the query. The search results will be provided to you in the context along with the user query, read it carefully and answer the question based on the information provided. If there's no relevant information in the vault, just say so. 5. If the user mentions any other tool with the @ symbol, check the context for their results. If nothing is found, just ignore the @ symbol in the query. 6. Always use $'s instead of \\[ etc. for LaTeX equations. 7. When showing note titles, use [[title]] format and do not wrap them in \` \`. 8. When showing **Obsidian internal** image links, use ![[link]] format and do not wrap them in \` \`. 9. When showing **web** image links, use ![link](url) format and do not wrap them in \` \`. 10. When generating a table, format as github markdown tables, however, for table headings, immediately add ' |' after the table heading. 11. Always respond in the language of the user's query. 12. Do NOT mention the additional context provided such as getCurrentTime and getTimeRangeMs if it's irrelevant to the user message. 13. If the user mentions "tags", it most likely means tags in Obsidian note properties. 14. YouTube URLs: If the user provides YouTube URLs in their message, transcriptions will be automatically fetched and provided to you. You don't need to do anything special - just use the transcription content if available. 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.`,mPe=`Return the new note content or canvas JSON in 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 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: path/to/file.md The FULL CONTENT of the note A with added section goes here Input: Create a new canvas with "Hello, world!" Output: path/to/file.canvas { "nodes": [ { "id": "1", "type": "text", "text": "Hello, world!", "x": 0, "y": 0, "width": 200, "height": 50 } ], "edges": [] } Input: Create a canvas with a file node and a group Output: path/to/file.canvas { "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"} ] } # 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. `,oD="note_context",bu="selected_text",eee="web_selected_text",iD="variable",NS="variable_note",sD="embedded_pdf",tee="embedded_note",aD="dataview_block",nee="retrieved_document",ree="web_tab_context",ZV="active_web_tab",oee="youtube_video_context",lD="{activeWebTab}",JV=6e3,XV=.4,iee=448e3,QV=3e4,_wt=30,see=5*60*1e3,eW=16,Td={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree",COMPACTING:"Compacting"},Vy={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},Pc={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},ZE=131072,Ec=(y=>(y.OPENROUTERAI="openrouterai",y.OPENAI="openai",y.OPENAI_FORMAT="3rd party (openai-format)",y.ANTHROPIC="anthropic",y.GOOGLE="google",y.XAI="xai",y.AMAZON_BEDROCK="amazon-bedrock",y.AZURE_OPENAI="azure openai",y.GROQ="groq",y.OLLAMA="ollama",y.LM_STUDIO="lm-studio",y.COPILOT_PLUS="copilot-plus",y.MISTRAL="mistralai",y.DEEPSEEK="deepseek",y.COHEREAI="cohereai",y.SILICONFLOW="siliconflow",y.GITHUB_COPILOT="github-copilot",y))(Ec||{}),Ex={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},Gh=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-2.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-3.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision","reasoning"]},{name:"gpt-5.5",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"gpt-5.4-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,capabilities:["vision"]},{name:"claude-sonnet-4-6",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.1-flash-lite",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-3.1-pro-preview",provider:"openrouterai",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"google/gemini-2.5-pro",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5.5",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-5.4-mini",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"grok-4.3",provider:"xai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"x-ai/grok-4.3",provider:"openrouterai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1",provider:"openai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!1,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"claude-opus-4-7",provider:"anthropic",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-haiku-4-5",provider:"anthropic",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-3.1-pro-preview",provider:"google",enabled:!1,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-2.5-pro",provider:"google",enabled:!1,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"deepseek-chat",provider:"deepseek",enabled:!1,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!1,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"]}],um=(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))(um||{}),OS=[{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:"gemini-embedding-2-preview",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"}],aee="nomic-embed-text",Cu={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.4-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-6"},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.5"},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.3"},"azure openai":{label:"Azure",host:"https://.services.ai.azure.com/models",curlBaseURL:"https://.services.ai.azure.com/models",keyManagementURL:"https://ai.azure.com",listModelURL:""},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.ai/compatibility/v1",curlBaseURL:"https://api.cohere.ai/compatibility/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:jy,curlBaseURL:jy,keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:jy,curlBaseURL:jy,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:""}},tW={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"},hPe=["NEVER","ON STARTUP","ON MODE SWITCH"],JE=(n=>(n.ENTER="enter",n.SHIFT_ENTER="shift+enter",n))(JE||{}),bt={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",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"},nW={[bt.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[bt.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[bt.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[bt.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[bt.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[bt.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[bt.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[bt.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[bt.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[bt.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[bt.LIST_INDEXED_FILES]:"List all indexed files (debug)",[bt.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[bt.NEW_CHAT]:"New Copilot Chat",[bt.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[bt.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[bt.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[bt.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[bt.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"Add web selection to chat context",[bt.ADD_CUSTOM_COMMAND]:"Add new custom command",[bt.APPLY_CUSTOM_COMMAND]:"Apply custom command",[bt.OPEN_LOG_FILE]:"Create log file",[bt.CLEAR_LOG_FILE]:"Clear log file",[bt.DOWNLOAD_YOUTUBE_SCRIPT]:"Download YouTube Script (plus)",[bt.TRIGGER_QUICK_ASK]:"Quick Ask"},rW={[bt.NEW_CHAT]:"message-square-plus",[bt.OPEN_COPILOT_CHAT_WINDOW]:"message-square",[bt.TOGGLE_COPILOT_CHAT_WINDOW]:"message-square",[bt.LOAD_COPILOT_CHAT_CONVERSATION]:"history",[bt.TRIGGER_QUICK_COMMAND]:"terminal-square",[bt.TRIGGER_QUICK_ASK]:"sparkles",[bt.ADD_SELECTION_TO_CHAT_CONTEXT]:"text-cursor-input",[bt.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"globe",[bt.ADD_CUSTOM_COMMAND]:"plus-circle",[bt.APPLY_CUSTOM_COMMAND]:"play-circle",[bt.INDEX_VAULT_TO_COPILOT_INDEX]:"refresh-cw",[bt.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"rotate-cw",[bt.CLEAR_LOCAL_COPILOT_INDEX]:"trash-2",[bt.CLEAR_COPILOT_CACHE]:"eraser",[bt.GARBAGE_COLLECT_COPILOT_INDEX]:"filter-x",[bt.COUNT_TOTAL_VAULT_TOKENS]:"calculator",[bt.COUNT_WORD_AND_TOKENS_SELECTION]:"hash",[bt.OPEN_LOG_FILE]:"file-text",[bt.CLEAR_LOG_FILE]:"file-x",[bt.DOWNLOAD_YOUTUBE_SCRIPT]:"youtube"},lee=["md","canvas","base"],gPe=[...lee,"pdf"],XE={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.`},Hn={userId:si(),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:Pc.TEMPERATURE,maxTokens:Pc.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:ywt,defaultConversationTag:"copilot-conversation",autosaveChat:!0,generateAIChatTitleOnSave:!0,autoAddActiveContentToContext:!0,defaultOpenArea:"view",defaultSendShortcut:"enter",customPromptsFolder:wwt,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:QQ,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,maxSourceChunks:_wt,enableInlineCitations:!0,groqApiKey:"",activeModels:Gh,activeEmbeddingModels:OS,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",chatHistorySortStrategy:"recent",projectListSortStrategy:"recent",projectsFolder:bwt,defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!0,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableSelfHostMode:!1,enableMiyo:!1,miyoSearchAll:!1,selfHostModeValidatedAt:null,selfHostValidationCount:0,selfHostUrl:"",selfHostApiKey:"",miyoServerUrl:"",selfHostSearchProvider:"firecrawl",firecrawlApiKey:"",perplexityApiKey:"",supadataApiKey:"",enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","readNote","webSearch","pomodoro","youtubeTranscription","writeFile","editFile","updateMemory"],reasoningEffort:Pc.REASONING_EFFORT,verbosity:Pc.VERBOSITY,memoryFolderName:vwt,enableRecentConversations:!0,maxRecentConversations:30,enableSavedMemory:!0,quickCommandModelKey:void 0,quickCommandIncludeNoteContext:!0,autoIncludeTextSelection:!1,autoAddSelectionToContext:!1,autoAcceptEdits:!1,diffViewMode:"split",userSystemPromptsFolder:xwt,defaultSystemPromptTitle:"",autoCompactThreshold:128e3,convertedDocOutputFolder:Cwt},kf={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var uee=Tt(oW=>{"use strict";oW.byteLength=Twt;oW.toByteArray=Pwt;oW.fromByteArray=kwt;var Yh=[],Mf=[],Swt=typeof Uint8Array<"u"?Uint8Array:Array,cee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(RS=0,yPe=cee.length;RS0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function Twt(t){var e=wPe(t),n=e[0],r=e[1];return(n+r)*3/4-r}function Iwt(t,e,n){return(e+n)*3/4-n}function Pwt(t){var e,n=wPe(t),r=n[0],o=n[1],i=new Swt(Iwt(t,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l>16&255,i[s++]=e>>8&255,i[s++]=e&255;return o===2&&(e=Mf[t.charCodeAt(l)]<<2|Mf[t.charCodeAt(l+1)]>>4,i[s++]=e&255),o===1&&(e=Mf[t.charCodeAt(l)]<<10|Mf[t.charCodeAt(l+1)]<<4|Mf[t.charCodeAt(l+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function Ewt(t){return Yh[t>>18&63]+Yh[t>>12&63]+Yh[t>>6&63]+Yh[t&63]}function Awt(t,e,n){for(var r,o=[],i=e;ia?a:s+i));return r===1?(e=t[n-1],o.push(Yh[e>>2]+Yh[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],o.push(Yh[e>>10]+Yh[e>>4&63]+Yh[e<<2&63]+"=")),o.join("")}});var vPe=Tt(dee=>{dee.read=function(t,e,n,r,o){var i,s,a=o*8-r-1,l=(1<>1,u=-7,d=n?o-1:0,f=n?-1:1,p=t[e+d];for(d+=f,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+t[e+d],d+=f,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+t[e+d],d+=f,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};dee.write=function(t,e,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<>1,f=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,m=r?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=f/l:e+=f*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(e*l-1)*Math.pow(2,o),s=s+d):(a=e*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;t[n+p]=a&255,p+=m,a/=256,o-=8);for(s=s<0;t[n+p]=s&255,p+=m,s/=256,c-=8);t[n+p-m]|=h*128}});var uD=Tt(nA=>{"use strict";var fee=uee(),eA=vPe(),xPe=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;nA.Buffer=xe;nA.SlowBuffer=Dwt;nA.INSPECT_MAX_BYTES=50;var iW=2147483647;nA.kMaxLength=iW;xe.TYPED_ARRAY_SUPPORT=Mwt();!xe.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 Mwt(){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(xe.prototype,"parent",{enumerable:!0,get:function(){if(xe.isBuffer(this))return this.buffer}});Object.defineProperty(xe.prototype,"offset",{enumerable:!0,get:function(){if(xe.isBuffer(this))return this.byteOffset}});function Wy(t){if(t>iW)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,xe.prototype),e}function xe(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return gee(t)}return SPe(t,e,n)}xe.poolSize=8192;function SPe(t,e,n){if(typeof t=="string")return Owt(t,e);if(ArrayBuffer.isView(t))return Rwt(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(Zh(t,ArrayBuffer)||t&&Zh(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Zh(t,SharedArrayBuffer)||t&&Zh(t.buffer,SharedArrayBuffer)))return mee(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return xe.from(r,e,n);let o=Lwt(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return xe.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}xe.from=function(t,e,n){return SPe(t,e,n)};Object.setPrototypeOf(xe.prototype,Uint8Array.prototype);Object.setPrototypeOf(xe,Uint8Array);function TPe(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 Nwt(t,e,n){return TPe(t),t<=0?Wy(t):e!==void 0?typeof n=="string"?Wy(t).fill(e,n):Wy(t).fill(e):Wy(t)}xe.alloc=function(t,e,n){return Nwt(t,e,n)};function gee(t){return TPe(t),Wy(t<0?0:yee(t)|0)}xe.allocUnsafe=function(t){return gee(t)};xe.allocUnsafeSlow=function(t){return gee(t)};function Owt(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!xe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=IPe(t,e)|0,r=Wy(n),o=r.write(t,e);return o!==n&&(r=r.slice(0,o)),r}function pee(t){let e=t.length<0?0:yee(t.length)|0,n=Wy(e);for(let r=0;r=iW)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+iW.toString(16)+" bytes");return t|0}function Dwt(t){return+t!=t&&(t=0),xe.alloc(+t)}xe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==xe.prototype};xe.compare=function(e,n){if(Zh(e,Uint8Array)&&(e=xe.from(e,e.offset,e.byteLength)),Zh(n,Uint8Array)&&(n=xe.from(n,n.offset,n.byteLength)),!xe.isBuffer(e)||!xe.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,o=n.length;for(let i=0,s=Math.min(r,o);io.length?(xe.isBuffer(s)||(s=xe.from(s)),s.copy(o,i)):Uint8Array.prototype.set.call(o,s,i);else if(xe.isBuffer(s))s.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=s.length}return o};function IPe(t,e){if(xe.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Zh(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 n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return hee(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return LPe(t).length;default:if(o)return r?-1:hee(t).length;e=(""+e).toLowerCase(),o=!0}}xe.byteLength=IPe;function $wt(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return qwt(this,e,n);case"utf8":case"utf-8":return EPe(this,e,n);case"ascii":return Hwt(this,e,n);case"latin1":case"binary":return Kwt(this,e,n);case"base64":return Vwt(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gwt(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}xe.prototype._isBuffer=!0;function LS(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}xe.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 n=0;nn&&(e+=" ... "),""};xPe&&(xe.prototype[xPe]=xe.prototype.inspect);xe.prototype.compare=function(e,n,r,o,i){if(Zh(e,Uint8Array)&&(e=xe.from(e,e.offset,e.byteLength)),!xe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),n<0||r>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&n>=r)return 0;if(o>=i)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,o>>>=0,i>>>=0,this===e)return 0;let s=i-o,a=r-n,l=Math.min(s,a),c=this.slice(o,i),u=e.slice(n,r);for(let d=0;d2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,vee(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0)if(o)n=0;else return-1;if(typeof e=="string"&&(e=xe.from(e,r)),xe.isBuffer(e))return e.length===0?-1:bPe(t,e,n,r,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):bPe(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function bPe(t,e,n,r,o){let i=1,s=t.length,a=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,s/=2,a/=2,n/=2}function l(u,d){return i===1?u[d]:u.readUInt16BE(d*i)}let c;if(o){let u=-1;for(c=n;cs&&(n=s-a),c=n;c>=0;c--){let u=!0;for(let d=0;do&&(r=o)):r=o;let i=e.length;r>i/2&&(r=i/2);let s;for(s=0;s>>0,isFinite(r)?(r=r>>>0,o===void 0&&(o="utf8")):(o=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-n;if((r===void 0||r>i)&&(r=i),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let s=!1;for(;;)switch(o){case"hex":return Fwt(this,e,n,r);case"utf8":case"utf-8":return Uwt(this,e,n,r);case"ascii":case"latin1":case"binary":return Bwt(this,e,n,r);case"base64":return zwt(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jwt(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),s=!0}};xe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Vwt(t,e,n){return e===0&&n===t.length?fee.fromByteArray(t):fee.fromByteArray(t.slice(e,n))}function EPe(t,e,n){n=Math.min(t.length,n);let r=[],o=e;for(;o239?4:i>223?3:i>191?2:1;if(o+a<=n){let l,c,u,d;switch(a){case 1:i<128&&(s=i);break;case 2:l=t[o+1],(l&192)===128&&(d=(i&31)<<6|l&63,d>127&&(s=d));break;case 3:l=t[o+1],c=t[o+2],(l&192)===128&&(c&192)===128&&(d=(i&15)<<12|(l&63)<<6|c&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:l=t[o+1],c=t[o+2],u=t[o+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(d=(i&15)<<18|(l&63)<<12|(c&63)<<6|u&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),o+=a}return Wwt(r)}var CPe=4096;function Wwt(t){let e=t.length;if(e<=CPe)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr)&&(n=r);let o="";for(let i=e;ir&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),nn)throw new RangeError("Trying to access beyond buffer length")}xe.prototype.readUintLE=xe.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||Ia(e,n,this.length);let o=this[e],i=1,s=0;for(;++s>>0,n=n>>>0,r||Ia(e,n,this.length);let o=this[e+--n],i=1;for(;n>0&&(i*=256);)o+=this[e+--n]*i;return o};xe.prototype.readUint8=xe.prototype.readUInt8=function(e,n){return e=e>>>0,n||Ia(e,1,this.length),this[e]};xe.prototype.readUint16LE=xe.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||Ia(e,2,this.length),this[e]|this[e+1]<<8};xe.prototype.readUint16BE=xe.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||Ia(e,2,this.length),this[e]<<8|this[e+1]};xe.prototype.readUint32LE=xe.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||Ia(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};xe.prototype.readUint32BE=xe.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||Ia(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};xe.prototype.readBigUInt64LE=Ax(function(e){e=e>>>0,tA(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&cD(e,this.length-8);let o=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(o)+(BigInt(i)<>>0,tA(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&cD(e,this.length-8);let o=n*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+r;return(BigInt(o)<>>0,n=n>>>0,r||Ia(e,n,this.length);let o=this[e],i=1,s=0;for(;++s=i&&(o-=Math.pow(2,8*n)),o};xe.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||Ia(e,n,this.length);let o=n,i=1,s=this[e+--o];for(;o>0&&(i*=256);)s+=this[e+--o]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*n)),s};xe.prototype.readInt8=function(e,n){return e=e>>>0,n||Ia(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};xe.prototype.readInt16LE=function(e,n){e=e>>>0,n||Ia(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};xe.prototype.readInt16BE=function(e,n){e=e>>>0,n||Ia(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};xe.prototype.readInt32LE=function(e,n){return e=e>>>0,n||Ia(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};xe.prototype.readInt32BE=function(e,n){return e=e>>>0,n||Ia(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};xe.prototype.readBigInt64LE=Ax(function(e){e=e>>>0,tA(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&cD(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(o)<>>0,tA(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&cD(e,this.length-8);let o=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(o)<>>0,n||Ia(e,4,this.length),eA.read(this,e,!0,23,4)};xe.prototype.readFloatBE=function(e,n){return e=e>>>0,n||Ia(e,4,this.length),eA.read(this,e,!1,23,4)};xe.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||Ia(e,8,this.length),eA.read(this,e,!0,52,8)};xe.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||Ia(e,8,this.length),eA.read(this,e,!1,52,8)};function _u(t,e,n,r,o,i){if(!xe.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}xe.prototype.writeUintLE=xe.prototype.writeUIntLE=function(e,n,r,o){if(e=+e,n=n>>>0,r=r>>>0,!o){let a=Math.pow(2,8*r)-1;_u(this,e,n,r,a,0)}let i=1,s=0;for(this[n]=e&255;++s>>0,r=r>>>0,!o){let a=Math.pow(2,8*r)-1;_u(this,e,n,r,a,0)}let i=r-1,s=1;for(this[n+i]=e&255;--i>=0&&(s*=256);)this[n+i]=e/s&255;return n+r};xe.prototype.writeUint8=xe.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,1,255,0),this[n]=e&255,n+1};xe.prototype.writeUint16LE=xe.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};xe.prototype.writeUint16BE=xe.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};xe.prototype.writeUint32LE=xe.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};xe.prototype.writeUint32BE=xe.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function APe(t,e,n,r,o){RPe(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i=i>>8,t[n++]=i,i=i>>8,t[n++]=i,i=i>>8,t[n++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,n}function kPe(t,e,n,r,o){RPe(e,r,o,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i=i>>8,t[n+6]=i,i=i>>8,t[n+5]=i,i=i>>8,t[n+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s=s>>8,t[n+2]=s,s=s>>8,t[n+1]=s,s=s>>8,t[n]=s,n+8}xe.prototype.writeBigUInt64LE=Ax(function(e,n=0){return APe(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});xe.prototype.writeBigUInt64BE=Ax(function(e,n=0){return kPe(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});xe.prototype.writeIntLE=function(e,n,r,o){if(e=+e,n=n>>>0,!o){let l=Math.pow(2,8*r-1);_u(this,e,n,r,l-1,-l)}let i=0,s=1,a=0;for(this[n]=e&255;++i>0)-a&255;return n+r};xe.prototype.writeIntBE=function(e,n,r,o){if(e=+e,n=n>>>0,!o){let l=Math.pow(2,8*r-1);_u(this,e,n,r,l-1,-l)}let i=r-1,s=1,a=0;for(this[n+i]=e&255;--i>=0&&(s*=256);)e<0&&a===0&&this[n+i+1]!==0&&(a=1),this[n+i]=(e/s>>0)-a&255;return n+r};xe.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};xe.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};xe.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};xe.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};xe.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||_u(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};xe.prototype.writeBigInt64LE=Ax(function(e,n=0){return APe(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});xe.prototype.writeBigInt64BE=Ax(function(e,n=0){return kPe(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function MPe(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function NPe(t,e,n,r,o){return e=+e,n=n>>>0,o||MPe(t,e,n,4,34028234663852886e22,-34028234663852886e22),eA.write(t,e,n,r,23,4),n+4}xe.prototype.writeFloatLE=function(e,n,r){return NPe(this,e,n,!0,r)};xe.prototype.writeFloatBE=function(e,n,r){return NPe(this,e,n,!1,r)};function OPe(t,e,n,r,o){return e=+e,n=n>>>0,o||MPe(t,e,n,8,17976931348623157e292,-17976931348623157e292),eA.write(t,e,n,r,52,8),n+8}xe.prototype.writeDoubleLE=function(e,n,r){return OPe(this,e,n,!0,r)};xe.prototype.writeDoubleBE=function(e,n,r){return OPe(this,e,n,!1,r)};xe.prototype.copy=function(e,n,r,o){if(!xe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!o&&o!==0&&(o=this.length),n>=e.length&&(n=e.length),n||(n=0),o>0&&o=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-n>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let i;if(typeof e=="number")for(i=n;i2**32?o=_Pe(String(n)):typeof n=="bigint"&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=_Pe(o)),o+="n"),r+=` It must be ${e}. Received ${o}`,r},RangeError);function _Pe(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function Ywt(t,e,n){tA(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&cD(e,t.length-(n+1))}function RPe(t,e,n,r,o,i){if(t>n||t3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(i+1)*8}${s}`:a=`>= -(2${s} ** ${(i+1)*8-1}${s}) and < 2 ** ${(i+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${n}${s}`,new QE.ERR_OUT_OF_RANGE("value",a,t)}Ywt(r,o,i)}function tA(t,e){if(typeof t!="number")throw new QE.ERR_INVALID_ARG_TYPE(e,"number",t)}function cD(t,e,n){throw Math.floor(t)!==t?(tA(t,n),new QE.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new QE.ERR_BUFFER_OUT_OF_BOUNDS:new QE.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var Zwt=/[^+/0-9A-Za-z-_]/g;function Jwt(t){if(t=t.split("=")[0],t=t.trim().replace(Zwt,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function hee(t,e){e=e||1/0;let n,r=t.length,o=null,i=[];for(let s=0;s55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=(o-55296<<10|n-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return i}function Xwt(t){let e=[];for(let n=0;n>8,o=n%256,i.push(o),i.push(r);return i}function LPe(t){return fee.toByteArray(Jwt(t))}function sW(t,e,n,r){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function Zh(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function vee(t){return t!==t}var evt=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let o=0;o<16;++o)e[r+o]=t[n]+t[o]}return e}();function Ax(t){return typeof BigInt>"u"?tvt:t}function tvt(){throw new Error("BigInt not supported")}});function xee(){if(!Cee.Platform.isDesktopApp&&!Cee.Platform.isDesktop)return null;if(aW)return aW;try{return aW=require("electron")?.remote?.safeStorage??null,aW}catch{return null}}function kx(t){return t.startsWith(_ee)||t.startsWith(See)||t.startsWith(Pee)}function ivt(){if(!window.crypto?.subtle)throw new Error("WebCrypto API is not available in this environment.")}function svt(){try{return window.localStorage??null}catch{return null}}async function avt(){try{let t=svt();if(!t)return null;let e=t.getItem(nvt);if(!e)return null;let n=Iee(e);return await crypto.subtle.importKey("raw",n,"AES-GCM",!1,["encrypt","decrypt"])}catch(t){return console.warn("Failed to load WebCrypto key from localStorage.",t),null}}async function FPe(){let t=await crypto.subtle.digest("SHA-256",rvt);return await crypto.subtle.importKey("raw",t,"AES-GCM",!1,["encrypt","decrypt"])}function UPe(t,e){if(t.length{bee=N(uD()),Cee=require("obsidian"),aW=null;_ee="enc_desk_",See="enc_web_",Pee="enc_",Eee="dec_";Tee=12,nvt="obsidian-copilot:webcrypto-key:v1",DPe=new Uint8Array([67,80,48,48]),$Pe=new Uint8Array([67,80,48,49]),rvt=new TextEncoder().encode("obsidian-copilot-v1"),ovt=new Uint8Array(Tee)});var zPe={};zn(zPe,{CustomError:()=>Gn,MissingApiKeyError:()=>fD,MissingModelKeyError:()=>rA,MissingPlusLicenseError:()=>DS,TimeoutError:()=>dD});var Gn,dD,fD,DS,rA,Nf=C(()=>{Gn=class t extends Error{constructor(e,n){super(e),this.code=n,Object.setPrototypeOf(this,t.prototype)}},dD=class t extends Error{constructor(e,n){super(`${e} timed out after ${n}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}},fD=class t extends Error{constructor(e="API key is not configured."){super(e),this.name="MissingApiKeyError",Object.setPrototypeOf(this,t.prototype)}},DS=class t extends Error{constructor(e="Copilot Plus license key is not configured."){super(e),this.name="MissingPlusLicenseError",Object.setPrototypeOf(this,t.prototype)}},rA=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 Oo(t,e){let n=`atom${++uvt}`,r={toString(){return(ai.env?ai.env.MODE:void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=dvt,r.write=fvt),e&&(r.write=e),r}function dvt(t){return t(this)}function fvt(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}var ai,uvt,jPe,Aee,kee,cW,Nee,pvt,mvt,Oee,VPe,lW,KPe,WPe,oA,Mee,hvt,gvt,HPe,Nx,qPe,Jh,pD,GPe,Ree=C(()=>{ai={},uvt=0;jPe=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,Aee=t=>"init"in t,kee=t=>!!t.write,cW=new WeakMap,Nee=t=>{var e;return Oee(t)&&!((e=cW.get(t))!=null&&e[1])},pvt=(t,e)=>{let n=cW.get(t);if(n)n[1]=!0,n[0].forEach(r=>r(e));else if((ai.env?ai.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},mvt=t=>{if(cW.has(t))return;let e=[new Set,!1];cW.set(t,e);let n=()=>{e[1]=!0};t.then(n,n),t.onCancel=r=>{e[0].add(r)}},Oee=t=>typeof t?.then=="function",VPe=t=>"v"in t||"e"in t,lW=t=>{if("e"in t)throw t.e;if((ai.env?ai.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},KPe=(t,e,n)=>{n.p.has(t)||(n.p.add(t),e.then(()=>{n.p.delete(t)},()=>{n.p.delete(t)}))},WPe=(t,e,n,r,o)=>{var i;if((ai.env?ai.env.MODE:void 0)!=="production"&&r===e)throw new Error("[Bug] atom cannot depend on itself");n.d.set(r,o.n),Nee(n.v)&&KPe(e,n.v,o),(i=o.m)==null||i.t.add(e),t&&hvt(t,r,e)},oA=()=>[new Map,new Map,new Set],Mee=(t,e,n)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,n)},hvt=(t,e,n)=>{let r=t[0].get(e);r&&r.add(n)},gvt=(t,e)=>t[0].get(e),HPe=(t,e)=>{t[2].add(e)},Nx=t=>{let e,n=!1,r=o=>{try{o()}catch(i){n||(e=i,n=!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(s=>{var a;return(a=s.m)==null?void 0:a.l.forEach(r)}),i.forEach(r)}if(n)throw e},qPe=(...[t,e,n,r])=>{let o;(ai.env?ai.env.MODE:void 0)!=="production"&&(o=new Set);let i=(v,x,b)=>{let _="v"in x,T=x.v,S=Nee(x.v)?x.v:null;if(Oee(b)){mvt(b);for(let P of x.d.keys())KPe(v,b,t(P));x.v=b,delete x.e}else x.v=b,delete x.e;(!_||!Object.is(T,x.v))&&(++x.n,S&&pvt(S,b))},s=(v,x,b)=>{var _;let T=t(x);if(VPe(T)&&(T.m&&!b?.has(x)||Array.from(T.d).every(([$,B])=>s(v,$,b).n===B)))return T;T.d.clear();let S=!0,P=$=>{if(jPe(x,$)){let W=t($);if(!VPe(W))if(Aee($))i($,W,$.init);else throw new Error("no atom init");return lW(W)}let B=s(v,$,b);try{return lW(B)}finally{if(S)WPe(v,x,T,$,B);else{let W=oA();WPe(W,x,T,$,B),p(W,x,T),Nx(W)}}},A,O,D={get signal(){return A||(A=new AbortController),A.signal},get setSelf(){return(ai.env?ai.env.MODE:void 0)!=="production"&&!kee(x)&&console.warn("setSelf function cannot be used with read-only atom"),!O&&kee(x)&&(O=(...$)=>{if((ai.env?ai.env.MODE:void 0)!=="production"&&S&&console.warn("setSelf function cannot be called in sync"),!S)return f(x,...$)}),O}};try{let $=e(x,P,D);if(i(x,T,$),Oee($)){(_=$.onCancel)==null||_.call($,()=>A?.abort());let B=()=>{if(T.m){let W=oA();p(W,x,T),Nx(W)}};$.then(B,B)}return T}catch($){return delete T.v,T.e=$,++T.n,T}finally{S=!1}},a=v=>lW(s(void 0,v)),l=(v,x,b)=>{var _,T;let S=new Map;for(let P of((_=b.m)==null?void 0:_.t)||[])S.set(P,t(P));for(let P of b.p)S.set(P,t(P));return(T=gvt(v,x))==null||T.forEach(P=>{S.set(P,t(P))}),S};function c(v,x,b){let _=[],T=new Set,S=new Set,P=[[x,b]];for(;P.length>0;){let[A,O]=P[P.length-1];if(S.has(A)){P.pop();continue}if(T.has(A)){_.push([A,O,O.n]),S.add(A),P.pop();continue}T.add(A);for(let[D,$]of l(v,A,O))A!==D&&!T.has(D)&&P.push([D,$])}return[_,S]}let u=(v,x,b)=>{let[_,T]=c(v,x,b),S=new Set([x]);for(let P=_.length-1;P>=0;--P){let[A,O,D]=_[P],$=!1;for(let B of O.d.keys())if(B!==A&&S.has(B)){$=!0;break}$&&(s(v,A,T),p(v,A,O),D!==O.n&&(Mee(v,A,O),S.add(A))),T.delete(A)}},d=(v,x,...b)=>{let _=!0,T=P=>lW(s(v,P)),S=(P,...A)=>{let O=t(P);try{if(jPe(x,P)){if(!Aee(P))throw new Error("atom not writable");let D=O.n,$=A[0];i(P,O,$),p(v,P,O),D!==O.n&&(Mee(v,P,O),u(v,P,O));return}else return d(v,P,...A)}finally{_||Nx(v)}};try{return n(x,T,S,...b)}finally{_=!1}},f=(v,...x)=>{let b=oA();try{return d(b,v,...x)}finally{Nx(b)}},p=(v,x,b)=>{if(b.m&&!Nee(b.v)){for(let _ of b.d.keys())b.m.d.has(_)||(m(v,_,t(_)).t.add(x),b.m.d.add(_));for(let _ of b.m.d||[])if(!b.d.has(_)){b.m.d.delete(_);let T=h(v,_,t(_));T?.t.delete(x)}}},m=(v,x,b)=>{if(!b.m){s(v,x);for(let _ of b.d.keys())m(v,_,t(_)).t.add(x);if(b.m={l:new Set,d:new Set(b.d.keys()),t:new Set},(ai.env?ai.env.MODE:void 0)!=="production"&&o.add(x),kee(x)){let _=b.m,T,S=(P,A)=>{let O=!0;T=(...D)=>{try{return d(P,x,...D)}finally{O||Nx(P)}};try{return A()}finally{O=!1}};HPe(v,()=>{let P=S(v,()=>r(x,(...A)=>T(...A)));P&&(_.u=A=>S(A,P))})}}return b.m},h=(v,x,b)=>{if(b.m&&!b.m.l.size&&!Array.from(b.m.t).some(_=>{var T;return(T=t(_).m)==null?void 0:T.d.has(x)})){let _=b.m.u;_&&HPe(v,()=>_(v)),delete b.m,(ai.env?ai.env.MODE:void 0)!=="production"&&o.delete(x);for(let T of b.d.keys()){let S=h(v,T,t(T));S?.t.delete(x)}return}return b.m},w={get:a,set:f,sub:(v,x)=>{let b=oA(),_=t(v),S=m(b,v,_).l;return S.add(x),Nx(b),()=>{S.delete(x);let P=oA();h(P,v,_),Nx(P)}},unstable_derive:v=>qPe(...v(t,e,n,r))};return(ai.env?ai.env.MODE:void 0)!=="production"&&Object.assign(w,{dev4_get_internal_weak_map:()=>({get:x=>{let b=t(x);if(b.n!==0)return b}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:x=>{let b=oA();for(let[_,T]of x)if(Aee(_)){let S=t(_),P=S.n;i(_,S,T),p(b,_,S),P!==S.n&&(Mee(b,_,S),u(b,_,S))}Nx(b)}}),w},Jh=()=>{let t=new WeakMap;return qPe(n=>{if((ai.env?ai.env.MODE:void 0)!=="production"&&!n)throw new Error("Atom is undefined or null");let r=t.get(n);return r||(r={d:new Map,p:new Set,n:0},t.set(n,r)),r},(n,...r)=>n.read(...r),(n,...r)=>n.write(...r),(n,...r)=>{var o;return(o=n.onMount)==null?void 0:o.call(n,...r)})},GPe=()=>(pD||(pD=Jh(),(ai.env?ai.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=pD),globalThis.__JOTAI_DEFAULT_STORE__!==pD&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),pD)});var iEe=Tt(xr=>{"use strict";var mD=Symbol.for("react.element"),yvt=Symbol.for("react.portal"),wvt=Symbol.for("react.fragment"),vvt=Symbol.for("react.strict_mode"),xvt=Symbol.for("react.profiler"),bvt=Symbol.for("react.provider"),Cvt=Symbol.for("react.context"),_vt=Symbol.for("react.forward_ref"),Svt=Symbol.for("react.suspense"),Tvt=Symbol.for("react.memo"),Ivt=Symbol.for("react.lazy"),YPe=Symbol.iterator;function Pvt(t){return t===null||typeof t!="object"?null:(t=YPe&&t[YPe]||t["@@iterator"],typeof t=="function"?t:null)}var XPe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},QPe=Object.assign,eEe={};function iA(t,e,n){this.props=t,this.context=e,this.refs=eEe,this.updater=n||XPe}iA.prototype.isReactComponent={};iA.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")};iA.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tEe(){}tEe.prototype=iA.prototype;function Dee(t,e,n){this.props=t,this.context=e,this.refs=eEe,this.updater=n||XPe}var $ee=Dee.prototype=new tEe;$ee.constructor=Dee;QPe($ee,iA.prototype);$ee.isPureReactComponent=!0;var ZPe=Array.isArray,nEe=Object.prototype.hasOwnProperty,Fee={current:null},rEe={key:!0,ref:!0,__self:!0,__source:!0};function oEe(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)nEe.call(e,r)&&!rEe.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{"use strict";sEe.exports=iEe()});function Wl(t,e){let n=lEe(e),[[r,o,i],s]=(0,Vl.useReducer)(c=>{let u=n.get(t);return Object.is(c[0],u)&&c[1]===n&&c[2]===t?c:[u,n,t]},void 0,()=>[n.get(t),n,t]),a=r;(o!==n||i!==t)&&(s(),a=n.get(t));let l=e?.delay;if((0,Vl.useEffect)(()=>{let c=n.sub(t,()=>{if(typeof l=="number"){let u=n.get(t);zee(u)&&cEe(aEe(u)),setTimeout(s,l);return}s()});return s(),c},[n,t,l]),(0,Vl.useDebugValue)(a),zee(a)){let c=aEe(a);return Ovt(c)}return a}function Rvt(t,e){let n=lEe(e);return(0,Vl.useCallback)((...o)=>{if((pW.env?pW.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function Hy(t,e){return[Wl(t,e),Rvt(t,e)]}var Vl,pW,Nvt,lEe,zee,cEe,Ovt,Bee,aEe,uEe=C(()=>{"use client";Vl=N(U(),1);Ree();pW={},Nvt=(0,Vl.createContext)(void 0),lEe=t=>{let e=(0,Vl.useContext)(Nvt);return t?.store||e||GPe()},zee=t=>typeof t?.then=="function",cEe=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Ovt=Vl.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(cEe(t),t)}),Bee=new WeakMap,aEe=t=>{let e=Bee.get(t);return e||(e=new Promise((n,r)=>{let o=t,i=l=>c=>{o===l&&n(c)},s=l=>c=>{o===l&&r(c)},a=l=>{"onCancel"in l&&typeof l.onCancel=="function"&&l.onCancel(c=>{if((pW.env?pW.env.MODE:void 0)!=="production"&&c===l)throw new Error("[Bug] p is not updated even after cancelation");zee(c)?(Bee.set(c,e),o=c,c.then(i(c),s(c)),a(c)):n(c)})};t.then(i(t),s(t)),a(t)}),Bee.set(t,e)),e}});var Id=C(()=>{Ree();uEe()});function aA(t){return typeof t=="string"&&Lvt.includes(t)}function Dvt(t){return typeof t=="string"?t.trim():""}function mW(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 n=Date.parse(t);if(Number.isFinite(n))return n}return null}function $vt(t,e){let n=new Intl.Collator(void 0),r=l=>Dvt(e.getName(l)),o=l=>{let c=e.getCreatedAtMs(l);return Number.isFinite(c)?c:0},i=l=>{let c=o(l);return mW(e.getLastUsedAtMs(l))??c},s=typeof e.getManualOrder=="function"?l=>{let c=e.getManualOrder?.(l);return typeof c=="number"&&Number.isFinite(c)?c:0}:null,a=t==="manual"&&!s?"name":t;return(l,c)=>{let u=r(l),d=r(c),f=o(l),p=o(c),m=i(l),h=i(c);if(a==="manual"){let v=s(l),x=s(c);if(v!==x)return v-x}else if(a==="name"){let v=n.compare(u,d);if(v!==0)return v}else if(a==="created"){let v=p-f;if(v!==0)return v}else{let v=h-m;if(v!==0)return v}let g=n.compare(u,d);if(g!==0)return g;let y=p-f;if(y!==0)return y;let w=h-m;return w!==0?w:0}}function Xh(t,e,n){return[...t].sort($vt(e,n))}var Lvt,sA,Ky=C(()=>{Lvt=["recent","created","name","manual"];sA=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 n=this.nowMs();return this.lastTouchedAtMsByKey.set(e,n),this.notifyChange(),n}shouldPersist(e,n){let r=this.lastTouchedAtMsByKey.get(e);if(!r)return null;let o=mW(n),i=this.lastPersistedAtMsByKey.get(e),s=Math.max(o??0,i??0);return s===0?r:r-sln,getSettings:()=>q,normalizeModelProvider:()=>pEe,resetSettings:()=>jee,sanitizeQaExclusions:()=>fEe,sanitizeSettings:()=>Vee,setSettings:()=>Ls,settingsAtom:()=>Ox,settingsStore:()=>Kn,subscribeToSettingsChange:()=>Ho,updateSetting:()=>pe,useSettingsValue:()=>Ht});function Fvt(t){let e=new Set((t.activeEmbeddingModels||[]).map(n=>ln(n)));return t.embeddingModelKey&&e.has(t.embeddingModelKey)?t.embeddingModelKey:Hn.embeddingModelKey}function Ls(t){let e=Uvt({...q(),...t});e.embeddingModelKey=Fvt(e),Kn.set(Ox,e)}function fEe(t){let n=(typeof t=="string"?t:QQ).split(",").map(o=>decodeURIComponent(o.trim())).filter(o=>o.length>0),r=new Map;return n.forEach(o=>{let i=o.replace(/\/+$/,""),s=i.length>0?i:o;if(s===Af){r.set(Af,Af);return}if(!r.has(s)){let a=i.length>0&&o.endsWith("/")?`${i}/`:o;r.set(s,a)}}),r.set(Af,Af),Array.from(r.values()).map(o=>encodeURIComponent(o)).join(",")}function pe(t,e){let n=q();Ls({...n,[t]:e})}function q(){return Kn.get(Ox)}function jee(){let t={...Hn,activeModels:Gh.map(e=>({...e,enabled:!0})),activeEmbeddingModels:OS.map(e=>({...e,enabled:!0}))};Ls(t)}function Ho(t){let e=q();return Kn.sub(Ox,()=>{let n=q();t(e,n),e=n})}function Ht(){return Wl(Ox,{store:Kn})}function pEe(t){return t==="azure_openai"?"azure openai":t}function Vee(t){let e=t||Hn,n=e,{enableSelfHostedSearch:r,selfHostedSearchUrl:o,selfHostedSearchApiKey:i,enableMiyoSearch:s}=n;e.userId||(e.userId=si()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(P=>({...P,provider:pEe(P.provider)})):e.activeEmbeddingModels=OS.map(P=>({...P,enabled:!0}));let a={...e},l=a;delete l.miyoRemoteVaultPath,delete l.miyoVaultName,delete l.enableMiyoSearch,r!==void 0&&a.enableSelfHostMode===void 0&&(a.enableSelfHostMode=r),o!==void 0&&!a.selfHostUrl&&(a.selfHostUrl=o),i!==void 0&&!a.selfHostApiKey&&(a.selfHostApiKey=i),s!==void 0&&a.enableMiyo===void 0&&(a.enableMiyo=s);let c=Number(e.temperature);a.temperature=isNaN(c)?Hn.temperature:c;let u=Number(e.maxTokens);a.maxTokens=isNaN(u)?Hn.maxTokens:u;let d=Number(e.contextTurns);a.contextTurns=isNaN(d)?Hn.contextTurns:d;let f=Number(e.embeddingRequestsPerMin);a.embeddingRequestsPerMin=isNaN(f)?Hn.embeddingRequestsPerMin:f;let p=Number(e.embeddingBatchSize);a.embeddingBatchSize=isNaN(p)?Hn.embeddingBatchSize:p;let m=Number(e.lexicalSearchRamLimit);if(isNaN(m)?a.lexicalSearchRamLimit=Hn.lexicalSearchRamLimit:a.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,m)),typeof a.autoAddActiveContentToContext!="boolean"){let P=e.includeActiveNoteAsContext;typeof P=="boolean"?a.autoAddActiveContentToContext=P:a.autoAddActiveContentToContext=Hn.autoAddActiveContentToContext}typeof a.generateAIChatTitleOnSave!="boolean"&&(a.generateAIChatTitleOnSave=Hn.generateAIChatTitleOnSave),typeof a.enableMiyo!="boolean"&&(a.enableMiyo=Hn.enableMiyo),typeof a.miyoSearchAll!="boolean"&&(a.miyoSearchAll=Hn.miyoSearchAll),typeof a.miyoServerUrl!="string"&&(a.miyoServerUrl=Hn.miyoServerUrl),["firecrawl","perplexity"].includes(a.selfHostSearchProvider)||(a.selfHostSearchProvider=Hn.selfHostSearchProvider),typeof a.passMarkdownImages!="boolean"&&(a.passMarkdownImages=Hn.passMarkdownImages),typeof a.enableInlineCitations!="boolean"&&(a.enableInlineCitations=Hn.enableInlineCitations),typeof a.enableCustomPromptTemplating!="boolean"&&(a.enableCustomPromptTemplating=Hn.enableCustomPromptTemplating);let g=Number(e.autonomousAgentMaxIterations);isNaN(g)||g<4||g>eW?a.autonomousAgentMaxIterations=Hn.autonomousAgentMaxIterations:a.autonomousAgentMaxIterations=g,Array.isArray(a.autonomousAgentEnabledToolIds)||(a.autonomousAgentEnabledToolIds=Hn.autonomousAgentEnabledToolIds);let y={writeToFile:"writeFile",replaceInFile:"editFile"};a.autonomousAgentEnabledToolIds=a.autonomousAgentEnabledToolIds.map(P=>y[P]??P),(!a.memoryFolderName||typeof a.memoryFolderName!="string")&&(a.memoryFolderName=Hn.memoryFolderName),typeof a.enableRecentConversations!="boolean"&&(a.enableRecentConversations=Hn.enableRecentConversations),typeof a.enableSavedMemory!="boolean"&&(a.enableSavedMemory=Hn.enableSavedMemory);let w=Number(e.maxRecentConversations);isNaN(w)||w<10||w>50?a.maxRecentConversations=Hn.maxRecentConversations:a.maxRecentConversations=w,typeof a.autosaveChat!="boolean"&&(a.autosaveChat=Hn.autosaveChat);let v=Number(e.autoCompactThreshold);if(isNaN(v)?a.autoCompactThreshold=Hn.autoCompactThreshold:a.autoCompactThreshold=Math.min(1e6,Math.max(64e3,v)),typeof a.quickCommandIncludeNoteContext!="boolean"&&(a.quickCommandIncludeNoteContext=Hn.quickCommandIncludeNoteContext),e.quickCommandModelKey!==void 0&&typeof e.quickCommandModelKey!="string"&&(a.quickCommandModelKey=Hn.quickCommandModelKey),typeof a.autoAddSelectionToContext!="boolean"){let P=e.autoIncludeTextSelection;typeof P=="boolean"?a.autoAddSelectionToContext=P:a.autoAddSelectionToContext=Hn.autoAddSelectionToContext}typeof a.autoAcceptEdits!="boolean"&&(a.autoAcceptEdits=Hn.autoAcceptEdits),Object.values(JE).includes(a.defaultSendShortcut)||(a.defaultSendShortcut=Hn.defaultSendShortcut);let x=(e.defaultSaveFolder||"").trim();a.defaultSaveFolder=x.length>0?x:Hn.defaultSaveFolder;let b=(e.customPromptsFolder||"").trim();a.customPromptsFolder=b.length>0?b:Hn.customPromptsFolder;let _=(e.projectsFolder||"").trim(),T=/(^|[/\\])\.\.[/\\]?/.test(_)||/^[a-zA-Z]:/.test(_)||/^[/\\]/.test(_);a.projectsFolder=_.length>0&&!T?_:Hn.projectsFolder,(!aA(a.chatHistorySortStrategy)||a.chatHistorySortStrategy==="manual")&&(a.chatHistorySortStrategy=Hn.chatHistorySortStrategy),(!aA(a.projectListSortStrategy)||a.projectListSortStrategy==="manual")&&(a.projectListSortStrategy=Hn.projectListSortStrategy);let S=(e.userSystemPromptsFolder||"").trim();return a.userSystemPromptsFolder=S.length>0?S:Hn.userSystemPromptsFolder,a.qaExclusions=fEe(e.qaExclusions),a}function Uvt(t){return t.activeModels=dEe(t.activeModels,Gh),t.activeEmbeddingModels=Bvt(dEe(t.activeEmbeddingModels,OS)),t}function ln(t){return`${t.name}|${t.provider}`}function dEe(t,e){let n=new Map;return e.filter(r=>r.core).forEach(r=>{n.set(ln(r),{...r})}),t.forEach(r=>{let o=ln(r),i=n.get(o);if(i){let s=e.find(a=>a.name===r.name&&a.provider===r.provider);s?n.set(o,{...s,...r,isBuiltIn:!0,believerExclusive:s.believerExclusive}):n.set(o,{...r,isBuiltIn:i.isBuiltIn})}else n.set(o,r)}),Array.from(n.values())}function Bvt(t){let e=new Set(Object.values(um));return t.filter(n=>e.has(n.provider))}var Kn,Ox,Se=C(()=>{Id();qh();Ky();It();Kn=Jh(),Ox=Oo(Hn)});function Xt(t,e=!1){try{if(t instanceof Error){let r=t.cause,o=r instanceof Error?r.message:r!=null?typeof r=="string"?r:JSON.stringify(r)??"":"",i=e&&t.stack?t.stack:"",s=[t.message];return o&&s.push(`more message: ${o}`),i&&s.push(i),s.join(` `)}return JSON.stringify(t)??String(t)}catch{return String(t)}}var Wee=C(()=>{});var Gy,hW,gW,yW,dm,lA,Ri,fm,Rx=C(()=>{Gy=class extends Error{},hW=class extends Gy{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},gW=class extends Gy{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},yW=class extends Gy{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},dm=class extends Gy{},lA=class extends Gy{constructor(e){super(`Invalid unit ${e}`)}},Ri=class extends Gy{},fm=class extends Gy{constructor(){super("Zone is an abstract class")}}});var ft,pm,Pd,Lx,hD,Hee,gD,yD,wD,vD,xD,bD,CD,_D,SD,TD,ID,PD,ED,AD,Kee,kD,MD,ND,OD,RD=C(()=>{ft="numeric",pm="short",Pd="long",Lx={year:ft,month:ft,day:ft},hD={year:ft,month:pm,day:ft},Hee={year:ft,month:pm,day:ft,weekday:pm},gD={year:ft,month:Pd,day:ft},yD={year:ft,month:Pd,day:ft,weekday:Pd},wD={hour:ft,minute:ft},vD={hour:ft,minute:ft,second:ft},xD={hour:ft,minute:ft,second:ft,timeZoneName:pm},bD={hour:ft,minute:ft,second:ft,timeZoneName:Pd},CD={hour:ft,minute:ft,hourCycle:"h23"},_D={hour:ft,minute:ft,second:ft,hourCycle:"h23"},SD={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:pm},TD={hour:ft,minute:ft,second:ft,hourCycle:"h23",timeZoneName:Pd},ID={year:ft,month:ft,day:ft,hour:ft,minute:ft},PD={year:ft,month:ft,day:ft,hour:ft,minute:ft,second:ft},ED={year:ft,month:pm,day:ft,hour:ft,minute:ft},AD={year:ft,month:pm,day:ft,hour:ft,minute:ft,second:ft},Kee={year:ft,month:pm,day:ft,weekday:pm,hour:ft,minute:ft},kD={year:ft,month:Pd,day:ft,hour:ft,minute:ft,timeZoneName:pm},MD={year:ft,month:Pd,day:ft,hour:ft,minute:ft,second:ft,timeZoneName:pm},ND={year:ft,month:Pd,day:ft,weekday:Pd,hour:ft,minute:ft,timeZoneName:Pd},OD={year:ft,month:Pd,day:ft,weekday:Pd,hour:ft,minute:ft,second:ft,timeZoneName:Pd}});var Tu,$S=C(()=>{Rx();Tu=class{get type(){throw new fm}get name(){throw new fm}get ianaName(){return this.name}get isUniversal(){throw new fm}offsetName(e,n){throw new fm}formatOffset(e,n){throw new fm}offset(e){throw new fm}equals(e){throw new fm}get isValid(){throw new fm}}});var qee,Dx,vW=C(()=>{kc();$S();qee=null,Dx=class t extends Tu{static get instance(){return qee===null&&(qee=new t),qee}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:n,locale:r}){return xW(e,n,r)}formatOffset(e,n){return $x(this.offset(e),n)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function zvt(t){return CW[t]||(CW[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"})),CW[t]}function Vvt(t,e){let n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,o,i,s,a,l,c,u]=r;return[s,o,i,a,l,c,u]}function Wvt(t,e){let n=t.formatToParts(e),r=[];for(let o=0;o{kc();$S();CW={};jvt={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};bW={},Hl=class t extends Tu{static create(e){return bW[e]||(bW[e]=new t(e)),bW[e]}static resetCache(){bW={},CW={}}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:n,locale:r}){return xW(e,n,r,this.name)}formatOffset(e,n){return $x(this.offset(e),n)}offset(e){let n=new Date(e);if(isNaN(n))return NaN;let r=zvt(this.name),[o,i,s,a,l,c,u]=r.formatToParts?Wvt(r,n):Vvt(r,n);a==="BC"&&(o=-Math.abs(o)+1);let f=cA({year:o,month:i,day:s,hour:l===24?0:l,minute:c,second:u,millisecond:0}),p=+n,m=p%1e3;return p-=m>=0?m:1e3+m,(f-p)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}});function Hvt(t,e={}){let n=JSON.stringify([t,e]),r=mEe[n];return r||(r=new Intl.ListFormat(t,e),mEe[n]=r),r}function Yee(t,e={}){let n=JSON.stringify([t,e]),r=Gee[n];return r||(r=new Intl.DateTimeFormat(t,e),Gee[n]=r),r}function Kvt(t,e={}){let n=JSON.stringify([t,e]),r=Zee[n];return r||(r=new Intl.NumberFormat(t,e),Zee[n]=r),r}function qvt(t,e={}){let{base:n,...r}=e,o=JSON.stringify([t,r]),i=Jee[o];return i||(i=new Intl.RelativeTimeFormat(t,e),Jee[o]=i),i}function Gvt(){return LD||(LD=new Intl.DateTimeFormat().resolvedOptions().locale,LD)}function Yvt(t){let e=hEe[t];if(!e){let n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,hEe[t]=e}return e}function Zvt(t){let e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));let n=t.indexOf("-u-");if(n===-1)return[t];{let r,o;try{r=Yee(t).resolvedOptions(),o=t}catch{let l=t.substring(0,n);r=Yee(l).resolvedOptions(),o=l}let{numberingSystem:i,calendar:s}=r;return[o,i,s]}}function Jvt(t,e,n){return(n||e)&&(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`)),t}function Xvt(t){let e=[];for(let n=1;n<=12;n++){let r=hn.utc(2009,n,1);e.push(t(r))}return e}function Qvt(t){let e=[];for(let n=1;n<=7;n++){let r=hn.utc(2016,11,13+n);e.push(t(r))}return e}function _W(t,e,n,r){let o=t.listingMode();return o==="error"?null:o==="en"?n(e):r(e)}function ext(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 mEe,Gee,Zee,Jee,LD,hEe,Xee,Qee,ete,txt,Wr,$D=C(()=>{kc();IW();Ux();Bx();Fx();mEe={};Gee={};Zee={};Jee={};LD=null;hEe={};Xee=class{constructor(e,n,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;let{padTo:o,floor:i,...s}=r;if(!n||Object.keys(s).length>0){let a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=Kvt(e,a)}}format(e){if(this.inf){let n=this.floor?Math.floor(e):e;return this.inf.format(n)}else{let n=this.floor?Math.floor(e):uA(e,3);return vi(n,this.padTo)}}},Qee=class{constructor(e,n,r){this.opts=r,this.originalZone=void 0;let o;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){let s=-1*(e.offset/60),a=s>=0?`Etc/GMT+${s}`:`Etc/GMT${s}`;e.offset!==0&&Hl.create(a).valid?(o=a,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=Yee(n,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(n=>{if(n.type==="timeZoneName"){let r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...n,value:r}}else return n}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},ete=class{constructor(e,n,r){this.opts={style:"long",...r},!n&&SW()&&(this.rtf=qvt(e,r))}format(e,n){return this.rtf?this.rtf.format(e,n):gEe(n,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,n){return this.rtf?this.rtf.formatToParts(e,n):[]}},txt={firstDay:1,minimalDays:4,weekend:[6,7]},Wr=class t{static fromOpts(e){return t.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,n,r,o,i=!1){let s=e||Vr.defaultLocale,a=s||(i?"en-US":Gvt()),l=n||Vr.defaultNumberingSystem,c=r||Vr.defaultOutputCalendar,u=DD(o)||Vr.defaultWeekSettings;return new t(a,l,c,u,s)}static resetCache(){LD=null,Gee={},Zee={},Jee={}}static fromObject({locale:e,numberingSystem:n,outputCalendar:r,weekSettings:o}={}){return t.create(e,n,r,o)}constructor(e,n,r,o,i){let[s,a,l]=Zvt(e);this.locale=s,this.numberingSystem=n||a||null,this.outputCalendar=r||l||null,this.weekSettings=o,this.intl=Jvt(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=ext(this)),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),n=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&n?"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,DD(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,n=!1){return _W(this,e,tte,()=>{let r=n?{month:e,day:"numeric"}:{month:e},o=n?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Xvt(i=>this.extract(i,r,"month"))),this.monthsCache[o][e]})}weekdays(e,n=!1){return _W(this,e,nte,()=>{let r=n?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},o=n?"format":"standalone";return this.weekdaysCache[o][e]||(this.weekdaysCache[o][e]=Qvt(i=>this.extract(i,r,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return _W(this,void 0,()=>rte,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[hn.utc(2016,11,13,9),hn.utc(2016,11,13,19)].map(n=>this.extract(n,e,"dayperiod"))}return this.meridiemCache})}eras(e){return _W(this,e,ote,()=>{let n={era:e};return this.eraCache[e]||(this.eraCache[e]=[hn.utc(-40,1,1),hn.utc(2017,1,1)].map(r=>this.extract(r,n,"era"))),this.eraCache[e]})}extract(e,n,r){let o=this.dtFormatter(e,n),i=o.formatToParts(),s=i.find(a=>a.type.toLowerCase()===r);return s?s.value:null}numberFormatter(e={}){return new Xee(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,n={}){return new Qee(e,this.intl,n)}relFormatter(e={}){return new ete(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Hvt(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:TW()?Yvt(this.locale):txt}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 ste,Pa,dA=C(()=>{kc();$S();ste=null,Pa=class t extends Tu{static get utcInstance(){return ste===null&&(ste=new t(0)),ste}static instance(e){return e===0?t.utcInstance:new t(e)}static parseSpecifier(e){if(e){let n=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new t(FS(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${$x(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${$x(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,n){return $x(this.fixed,n)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}});var fA,ate=C(()=>{$S();fA=class extends Tu{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 mm(t,e){let n;if(mn(t)||t===null)return e;if(t instanceof Tu)return t;if(yEe(t)){let r=t.toLowerCase();return r==="default"?e:r==="local"||r==="system"?Dx.instance:r==="utc"||r==="gmt"?Pa.utcInstance:Pa.parseSpecifier(r)||Hl.create(t)}else return hm(t)?Pa.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new fA(t)}var PW=C(()=>{$S();Fx();dA();ate();kc();vW()});function vEe(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n=i&&r<=s&&(e+=r-i)}}return parseInt(e,10)}else return e}function xEe(){pA={}}function Of({numberingSystem:t},e=""){let n=t||"latn";return pA[n]||(pA[n]={}),pA[n][e]||(pA[n][e]=new RegExp(`${lte[n]}${e}`)),pA[n][e]}var lte,wEe,nxt,pA,cte=C(()=>{lte={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"},wEe={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]},nxt=lte.hanidec.replace(/[\[|\]]/g,"").split("");pA={}});var bEe,CEe,_Ee,SEe,TEe,IEe,PEe,EEe,Vr,Ux=C(()=>{vW();Fx();$D();Bx();PW();kc();cte();bEe=()=>Date.now(),CEe="system",_Ee=null,SEe=null,TEe=null,IEe=60,EEe=null,Vr=class{static get now(){return bEe}static set now(e){bEe=e}static set defaultZone(e){CEe=e}static get defaultZone(){return mm(CEe,Dx.instance)}static get defaultLocale(){return _Ee}static set defaultLocale(e){_Ee=e}static get defaultNumberingSystem(){return SEe}static set defaultNumberingSystem(e){SEe=e}static get defaultOutputCalendar(){return TEe}static set defaultOutputCalendar(e){TEe=e}static get defaultWeekSettings(){return EEe}static set defaultWeekSettings(e){EEe=DD(e)}static get twoDigitCutoffYear(){return IEe}static set twoDigitCutoffYear(e){IEe=e%100}static get throwOnInvalid(){return PEe}static set throwOnInvalid(e){PEe=e}static resetCaches(){Wr.resetCache(),Hl.resetCache(),hn.resetCache(),xEe()}}});var Ea,FD=C(()=>{Ea=class{constructor(e,n){this.reason=e,this.explanation=n}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function Rf(t,e){return new Ea("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function EW(t,e,n){let r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let o=r.getUTCDay();return o===0?7:o}function MEe(t,e,n){return n+(BS(t)?kEe:AEe)[e-1]}function NEe(t,e){let n=BS(t)?kEe:AEe,r=n.findIndex(i=>iUS(r,e,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...zD(t)}}function ute(t,e=4,n=1){let{weekYear:r,weekNumber:o,weekday:i}=t,s=AW(EW(r,1,e),n),a=zx(r),l=o*7+i-s-7+e,c;l<1?(c=r-1,l+=zx(c)):l>a?(c=r+1,l-=zx(r)):c=r;let{month:u,day:d}=NEe(c,l);return{year:c,month:u,day:d,...zD(t)}}function kW(t){let{year:e,month:n,day:r}=t,o=MEe(e,n,r);return{year:e,ordinal:o,...zD(t)}}function dte(t){let{year:e,ordinal:n}=t,{month:r,day:o}=NEe(e,n);return{year:e,month:r,day:o,...zD(t)}}function fte(t,e){if(!mn(t.localWeekday)||!mn(t.localWeekNumber)||!mn(t.localWeekYear)){if(!mn(t.weekday)||!mn(t.weekNumber)||!mn(t.weekYear))throw new dm("Cannot mix locale-based week fields with ISO-based week fields");return mn(t.localWeekday)||(t.weekday=t.localWeekday),mn(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),mn(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 OEe(t,e=4,n=1){let r=BD(t.weekYear),o=Ed(t.weekNumber,1,US(t.weekYear,e,n)),i=Ed(t.weekday,1,7);return r?o?i?!1:Rf("weekday",t.weekday):Rf("week",t.weekNumber):Rf("weekYear",t.weekYear)}function REe(t){let e=BD(t.year),n=Ed(t.ordinal,1,zx(t.year));return e?n?!1:Rf("ordinal",t.ordinal):Rf("year",t.year)}function pte(t){let e=BD(t.year),n=Ed(t.month,1,12),r=Ed(t.day,1,mA(t.year,t.month));return e?n?r?!1:Rf("day",t.day):Rf("month",t.month):Rf("year",t.year)}function mte(t){let{hour:e,minute:n,second:r,millisecond:o}=t,i=Ed(e,0,23)||e===24&&n===0&&r===0&&o===0,s=Ed(n,0,59),a=Ed(r,0,59),l=Ed(o,0,999);return i?s?a?l?!1:Rf("millisecond",o):Rf("second",r):Rf("minute",n):Rf("hour",e)}var AEe,kEe,hte=C(()=>{kc();FD();Rx();AEe=[0,31,59,90,120,151,181,212,243,273,304,334],kEe=[0,31,60,91,121,152,182,213,244,274,305,335]});function mn(t){return typeof t>"u"}function hm(t){return typeof t=="number"}function BD(t){return typeof t=="number"&&t%1===0}function yEe(t){return typeof t=="string"}function DEe(t){return Object.prototype.toString.call(t)==="[object Date]"}function SW(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function TW(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function $Ee(t){return Array.isArray(t)?t:[t]}function gte(t,e,n){if(t.length!==0)return t.reduce((r,o)=>{let i=[e(o),o];return r&&n(r[0],i[0])===r[0]?r:i},null)[1]}function FEe(t,e){return e.reduce((n,r)=>(n[r]=t[r],n),{})}function jx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function DD(t){if(t==null)return null;if(typeof t!="object")throw new Ri("Week settings must be an object");if(!Ed(t.firstDay,1,7)||!Ed(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Ed(e,1,7)))throw new Ri("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Ed(t,e,n){return BD(t)&&t>=e&&t<=n}function rxt(t,e){return t-e*Math.floor(t/e)}function vi(t,e=2){let n=t<0,r;return n?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Yy(t){if(!(mn(t)||t===null||t===""))return parseInt(t,10)}function Vx(t){if(!(mn(t)||t===null||t===""))return parseFloat(t)}function jD(t){if(!(mn(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function uA(t,e,n=!1){let r=10**e;return(n?Math.trunc:Math.round)(t*r)/r}function BS(t){return t%4===0&&(t%100!==0||t%400===0)}function zx(t){return BS(t)?366:365}function mA(t,e){let n=rxt(e-1,12)+1,r=t+(e-n)/12;return n===2?BS(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function cA(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 LEe(t,e,n){return-AW(EW(t,1,e),n)+e-1}function US(t,e=4,n=1){let r=LEe(t,e,n),o=LEe(t+1,e,n);return(zx(t)-r+o)/7}function VD(t){return t>99?t:t>Vr.twoDigitCutoffYear?1900+t:2e3+t}function xW(t,e,n,r=null){let o=new Date(t),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(i.timeZone=r);let s={timeZoneName:e,...i},a=new Intl.DateTimeFormat(n,s).formatToParts(o).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function FS(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);let r=parseInt(e,10)||0,o=n<0||Object.is(n,-0)?-r:r;return n*60+o}function yte(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Ri(`Invalid unit value ${t}`);return e}function hA(t,e){let n={};for(let r in t)if(jx(t,r)){let o=t[r];if(o==null)continue;n[e(r)]=yte(o)}return n}function $x(t,e){let n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),o=t>=0?"+":"-";switch(e){case"short":return`${o}${vi(n,2)}:${vi(r,2)}`;case"narrow":return`${o}${n}${r>0?`:${r}`:""}`;case"techie":return`${o}${vi(n,2)}${vi(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function zD(t){return FEe(t,["hour","minute","second","millisecond"])}var kc=C(()=>{Rx();Ux();hte()});function tte(t){switch(t){case"narrow":return[...ixt];case"short":return[...wte];case"long":return[...oxt];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}function nte(t){switch(t){case"narrow":return[...sxt];case"short":return[...xte];case"long":return[...vte];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function ote(t){switch(t){case"narrow":return[...cxt];case"short":return[...lxt];case"long":return[...axt];default:return null}}function UEe(t){return rte[t.hour<12?0:1]}function BEe(t,e){return nte(e)[t.weekday-1]}function zEe(t,e){return tte(e)[t.month-1]}function jEe(t,e){return ote(e)[t.year<0?0:1]}function gEe(t,e,n="always",r=!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(n==="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 s=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=o[t],u=r?l?c[1]:c[2]||c[1]:l?o[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}var oxt,wte,ixt,vte,xte,sxt,rte,axt,lxt,cxt,IW=C(()=>{RD();kc();oxt=["January","February","March","April","May","June","July","August","September","October","November","December"],wte=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ixt=["J","F","M","A","M","J","J","A","S","O","N","D"];vte=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],xte=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],sxt=["M","T","W","T","F","S","S"];rte=["AM","PM"],axt=["Before Christ","Anno Domini"],lxt=["BC","AD"],cxt=["B","A"]});function VEe(t,e){let n="";for(let r of t)r.literal?n+=r.val:n+=e(r.val);return n}var uxt,Aa,WD=C(()=>{IW();RD();kc();uxt={D:Lx,DD:hD,DDD:gD,DDDD:yD,t:wD,tt:vD,ttt:xD,tttt:bD,T:CD,TT:_D,TTT:SD,TTTT:TD,f:ID,ff:ED,fff:kD,ffff:ND,F:PD,FF:AD,FFF:MD,FFFF:OD},Aa=class t{static create(e,n={}){return new t(e,n)}static parseFormat(e){let n=null,r="",o=!1,i=[];for(let s=0;s0&&i.push({literal:o||/^\s+$/.test(r),val:r}),n=null,r="",o=!o):o||a===n?r+=a:(r.length>0&&i.push({literal:/^\s+$/.test(r),val:r}),r=a,n=a)}return r.length>0&&i.push({literal:o||/^\s+$/.test(r),val:r}),i}static macroTokenToFormatOpts(e){return uxt[e]}constructor(e,n){this.opts=n,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,n){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...n}).format()}dtFormatter(e,n={}){return this.loc.dtFormatter(e,{...this.opts,...n})}formatDateTime(e,n){return this.dtFormatter(e,n).format()}formatDateTimeParts(e,n){return this.dtFormatter(e,n).formatToParts()}formatInterval(e,n){return this.dtFormatter(e.start,n).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,n){return this.dtFormatter(e,n).resolvedOptions()}num(e,n=0){if(this.opts.forceSimple)return vi(e,n);let r={...this.opts};return n>0&&(r.padTo=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,n){let r=this.loc.listingMode()==="en",o=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(p,m)=>this.loc.extract(e,p,m),s=p=>e.isOffsetFixed&&e.offset===0&&p.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,p.format):"",a=()=>r?UEe(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(p,m)=>r?zEe(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),c=(p,m)=>r?BEe(e,p):i(m?{weekday:p}:{weekday:p,month:"long",day:"numeric"},"weekday"),u=p=>{let m=t.macroTokenToFormatOpts(p);return m?this.formatWithSystemDefault(e,m):p},d=p=>r?jEe(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 s({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return s({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return s({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 a();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 c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("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 l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("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 l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("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 u(p)}};return VEe(t.parseFormat(n),f)}formatDurationFromString(e,n){let r=l=>{switch(l[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=l=>c=>{let u=r(c);return u?this.num(l.get(u),c.length):c},i=t.parseFormat(n),s=i.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),a=e.shiftTo(...s.map(r).filter(l=>l));return VEe(i,o(a))}}});function yA(...t){let e=t.reduce((n,r)=>n+r.source,"");return RegExp(`^${e}$`)}function wA(...t){return e=>t.reduce(([n,r,o],i)=>{let[s,a,l]=i(e,o);return[{...n,...s},a||r,l]},[{},null,1]).slice(0,2)}function vA(t,...e){if(t==null)return[null,null];for(let[n,r]of e){let o=n.exec(t);if(o)return r(o)}return[null,null]}function KEe(...t){return(e,n)=>{let r={},o;for(o=0;op!==void 0&&(m||p&&u)?-p:p;return[{years:f(Vx(n)),months:f(Vx(r)),weeks:f(Vx(o)),days:f(Vx(i)),hours:f(Vx(s)),minutes:f(Vx(a)),seconds:f(Vx(l),l==="-0"),milliseconds:f(jD(c),d)}]}function _te(t,e,n,r,o,i,s){let a={year:e.length===2?VD(Yy(e)):Yy(e),month:wte.indexOf(n)+1,day:Yy(r),hour:Yy(o),minute:Yy(i)};return s&&(a.second=Yy(s)),t&&(a.weekday=t.length>3?vte.indexOf(t)+1:xte.indexOf(t)+1),a}function Txt(t){let[,e,n,r,o,i,s,a,l,c,u,d]=t,f=_te(e,o,r,n,i,s,a),p;return l?p=_xt[l]:c?p=0:p=FS(u,d),[f,new Pa(p)]}function Ixt(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function WEe(t){let[,e,n,r,o,i,s,a]=t;return[_te(e,o,r,n,i,s,a),Pa.utcInstance]}function kxt(t){let[,e,n,r,o,i,s,a]=t;return[_te(e,a,n,r,o,i,s),Pa.utcInstance]}function JEe(t){return vA(t,[Mxt,ZEe],[Nxt,Lxt],[Oxt,Dxt],[Rxt,$xt])}function XEe(t){return vA(Ixt(t),[Sxt,Txt])}function QEe(t){return vA(t,[Pxt,WEe],[Ext,WEe],[Axt,kxt])}function eAe(t){return vA(t,[bxt,Cxt])}function tAe(t){return vA(t,[xxt,Fxt])}function nAe(t){return vA(t,[Uxt,ZEe],[Bxt,zxt])}var HEe,qEe,dxt,bte,GEe,Cte,fxt,pxt,mxt,hxt,gxt,yxt,YEe,wxt,xxt,bxt,_xt,Sxt,Pxt,Ext,Axt,Mxt,Nxt,Oxt,Rxt,ZEe,Lxt,Dxt,$xt,Fxt,Uxt,Bxt,zxt,Ste=C(()=>{kc();IW();dA();Fx();HEe=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;qEe=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dxt=`(?:${qEe.source}?(?:\\[(${HEe.source})\\])?)?`,bte=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,GEe=RegExp(`${bte.source}${dxt}`),Cte=RegExp(`(?:T${GEe.source})?`),fxt=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,pxt=/(\d{4})-?W(\d\d)(?:-?(\d))?/,mxt=/(\d{4})-?(\d{3})/,hxt=KEe("weekYear","weekNumber","weekDay"),gxt=KEe("year","ordinal"),yxt=/(\d{4})-(\d\d)-(\d\d)/,YEe=RegExp(`${bte.source} ?(?:${qEe.source}|(${HEe.source}))?`),wxt=RegExp(`(?: ${YEe.source})?`);xxt=RegExp(`^T?${bte.source}$`),bxt=/^-?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)?)?)$/;_xt={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};Sxt=/^(?:(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)))$/;Pxt=/^(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$/,Ext=/^(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$/,Axt=/^(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})$/;Mxt=yA(fxt,Cte),Nxt=yA(pxt,Cte),Oxt=yA(mxt,Cte),Rxt=yA(GEe),ZEe=wA(vxt,xA,HD,KD),Lxt=wA(hxt,xA,HD,KD),Dxt=wA(gxt,xA,HD,KD),$xt=wA(xA,HD,KD);Fxt=wA(xA);Uxt=yA(yxt,wxt),Bxt=yA(YEe),zxt=wA(xA,HD,KD)});function Wx(t,e,n=!1){let r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new xi(r)}function sAe(t,e){let n=e.milliseconds??0;for(let r of Wxt.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function oAe(t,e){let n=sAe(t,e)<0?-1:1;zS.reduceRight((r,o)=>{if(mn(e[o]))return r;if(r){let i=e[r]*n,s=t[o][r],a=Math.floor(i/s);e[o]+=a*n,e[r]-=a*s*n}return o},null),zS.reduce((r,o)=>{if(mn(e[o]))return r;if(r){let i=e[r]%1;e[r]-=i,e[o]+=i*t[r][o]}return o},null)}function Hxt(t){let e={};for(let[n,r]of Object.entries(t))r!==0&&(e[n]=r);return e}var rAe,iAe,jxt,Lf,bA,Vxt,zS,Wxt,xi,qD=C(()=>{Rx();WD();FD();$D();Ste();kc();Ux();Bx();rAe="Invalid Duration",iAe={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}},jxt={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},...iAe},Lf=146097/400,bA=146097/4800,Vxt={years:{quarters:4,months:12,weeks:Lf/7,days:Lf,hours:Lf*24,minutes:Lf*24*60,seconds:Lf*24*60*60,milliseconds:Lf*24*60*60*1e3},quarters:{months:3,weeks:Lf/28,days:Lf/4,hours:Lf*24/4,minutes:Lf*24*60/4,seconds:Lf*24*60*60/4,milliseconds:Lf*24*60*60*1e3/4},months:{weeks:bA/7,days:bA,hours:bA*24,minutes:bA*24*60,seconds:bA*24*60*60,milliseconds:bA*24*60*60*1e3},...iAe},zS=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Wxt=zS.slice(0).reverse();xi=class t{constructor(e){let n=e.conversionAccuracy==="longterm"||!1,r=n?Vxt:jxt;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Wr.create(),this.conversionAccuracy=n?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,n){return t.fromObject({milliseconds:e},n)}static fromObject(e,n={}){if(e==null||typeof e!="object")throw new Ri(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:hA(e,t.normalizeUnit),loc:Wr.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(e){if(hm(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Ri(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,n){let[r]=eAe(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,n){let[r]=tAe(e);return r?t.fromObject(r,n):t.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,n=null){if(!e)throw new Ri("need to specify a reason the Duration is invalid");let r=e instanceof Ea?e:new Ea(e,n);if(Vr.throwOnInvalid)throw new yW(r);return new t({invalid:r})}static normalizeUnit(e){let n={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(!n)throw new lA(e);return n}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,n={}){let r={...n,floor:n.round!==!1&&n.floor!==!1};return this.isValid?Aa.create(this.loc,r).formatDurationFromString(this,e):rAe}toHuman(e={}){if(!this.isValid)return rAe;let n=zS.map(r=>{let o=this.values[r];return mn(o)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(o)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}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+=uA(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;let n=this.toMillis();return n<0||n>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},hn.fromMillis(n,{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?sAe(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e),r={};for(let o of zS)(jx(n.values,o)||jx(this.values,o))&&(r[o]=n.get(o)+this.get(o));return Wx(this,{values:r},!0)}minus(e){if(!this.isValid)return this;let n=t.fromDurationLike(e);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let n={};for(let r of Object.keys(this.values))n[r]=yte(e(this.values[r],r));return Wx(this,{values:n},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let n={...this.values,...hA(e,t.normalizeUnit)};return Wx(this,{values:n})}reconfigure({locale:e,numberingSystem:n,conversionAccuracy:r,matrix:o}={}){let s={loc:this.loc.clone({locale:e,numberingSystem:n}),matrix:o,conversionAccuracy:r};return Wx(this,s)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return oAe(this.matrix,e),Wx(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=Hxt(this.normalize().shiftToAll().toObject());return Wx(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(s=>t.normalizeUnit(s));let n={},r={},o=this.toObject(),i;for(let s of zS)if(e.indexOf(s)>=0){i=s;let a=0;for(let c in r)a+=this.matrix[c][s]*r[c],r[c]=0;hm(o[s])&&(a+=o[s]);let l=Math.trunc(a);n[s]=l,r[s]=(a*1e3-l*1e3)/1e3}else hm(o[s])&&(r[s]=o[s]);for(let s in r)r[s]!==0&&(n[i]+=s===i?r[s]:r[s]/this.matrix[i][s]);return oAe(this.matrix,n),Wx(this,{values:n},!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 n of Object.keys(this.values))e[n]=this.values[n]===0?0:-this.values[n];return Wx(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 n(r,o){return r===void 0||r===0?o===void 0||o===0:r===o}for(let r of zS)if(!n(this.values[r],e.values[r]))return!1;return!0}}});function Kxt(t,e){return!t||!t.isValid?Zy.invalid("missing or invalid start"):!e||!e.isValid?Zy.invalid("missing or invalid end"):e{Bx();qD();Ux();Rx();FD();WD();RD();CA="Invalid Interval";Zy=class t{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,n=null){if(!e)throw new Ri("need to specify a reason the Interval is invalid");let r=e instanceof Ea?e:new Ea(e,n);if(Vr.throwOnInvalid)throw new gW(r);return new t({invalid:r})}static fromDateTimes(e,n){let r=_A(e),o=_A(n),i=Kxt(r,o);return i??new t({start:r,end:o})}static after(e,n){let r=xi.fromDurationLike(n),o=_A(e);return t.fromDateTimes(o,o.plus(r))}static before(e,n){let r=xi.fromDurationLike(n),o=_A(e);return t.fromDateTimes(o.minus(r),o)}static fromISO(e,n){let[r,o]=(e||"").split("/",2);if(r&&o){let i,s;try{i=hn.fromISO(r,n),s=i.isValid}catch{s=!1}let a,l;try{a=hn.fromISO(o,n),l=a.isValid}catch{l=!1}if(s&&l)return t.fromDateTimes(i,a);if(s){let c=xi.fromISO(o,n);if(c.isValid)return t.after(i,c)}else if(l){let c=xi.fromISO(r,n);if(c.isValid)return t.before(a,c)}}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",n){if(!this.isValid)return NaN;let r=this.start.startOf(e,n),o;return n?.useLocaleWeeks?o=this.end.reconfigure({locale:r.locale}):o=this.end,o=o.startOf(e,n),Math.floor(o.diff(r,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:n}={}){return this.isValid?t.fromDateTimes(e||this.s,n||this.e):this}splitAt(...e){if(!this.isValid)return[];let n=e.map(_A).filter(s=>this.contains(s)).sort((s,a)=>s.toMillis()-a.toMillis()),r=[],{s:o}=this,i=0;for(;o+this.e?this.e:s;r.push(t.fromDateTimes(o,a)),o=a,i+=1}return r}splitBy(e){let n=xi.fromDurationLike(e);if(!this.isValid||!n.isValid||n.as("milliseconds")===0)return[];let{s:r}=this,o=1,i,s=[];for(;rl*o));i=+a>+this.e?this.e:a,s.push(t.fromDateTimes(r,i)),r=i,o+=1}return s}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=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 n=this.s>e.s?this.s:e.s,r=this.e=r?null:t.fromDateTimes(n,r)}union(e){if(!this.isValid)return this;let n=this.se.e?this.e:e.e;return t.fromDateTimes(n,r)}static merge(e){let[n,r]=e.sort((o,i)=>o.s-i.s).reduce(([o,i],s)=>i?i.overlaps(s)||i.abutsStart(s)?[o,i.union(s)]:[o.concat([i]),s]:[o,s],[[],null]);return r&&n.push(r),n}static xor(e){let n=null,r=0,o=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),s=Array.prototype.concat(...i),a=s.sort((l,c)=>l.time-c.time);for(let l of a)r+=l.type==="s"?1:-1,r===1?n=l.time:(n&&+n!=+l.time&&o.push(t.fromDateTimes(n,l.time)),n=null);return t.merge(o)}difference(...e){return t.xor([this].concat(e)).map(n=>this.intersection(n)).filter(n=>n&&!n.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:CA}[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=Lx,n={}){return this.isValid?Aa.create(this.s.loc.clone(n),e).formatInterval(this):CA}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:CA}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:CA}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:CA}toFormat(e,{separator:n=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${n}${this.e.toFormat(e)}`:CA}toDuration(e,n){return this.isValid?this.e.diff(this.s,e,n):xi.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var Jy,Ite=C(()=>{Bx();Ux();$D();Fx();PW();kc();Jy=class{static hasDST(e=Vr.defaultZone){let n=hn.now().setZone(e).set({month:12});return!e.isUniversal&&n.offset!==n.set({month:6}).offset}static isValidIANAZone(e){return Hl.isValidZone(e)}static normalizeZone(e){return mm(e,Vr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:n=null}={}){return(n||Wr.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:n=null}={}){return(n||Wr.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:n=null}={}){return(n||Wr.create(e)).getWeekendDays().slice()}static months(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Wr.create(n,r,i)).months(e)}static monthsFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Wr.create(n,r,i)).months(e,!0)}static weekdays(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null}={}){return(o||Wr.create(n,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:n=null,numberingSystem:r=null,locObj:o=null}={}){return(o||Wr.create(n,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Wr.create(e).meridiems()}static eras(e="short",{locale:n=null}={}){return Wr.create(n,null,"gregory").eras(e)}static features(){return{relative:SW(),localeWeek:TW()}}}});function aAe(t,e){let n=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(xi.fromMillis(r).as("days"))}function qxt(t,e,n){let r=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{let u=aAe(l,c);return(u-u%7)/7}],["days",aAe]],o={},i=t,s,a;for(let[l,c]of r)n.indexOf(l)>=0&&(s=l,o[l]=c(t,e),a=i.plus(o),a>e?(o[l]--,t=i.plus(o),t>e&&(a=t,o[l]--,t=i.plus(o))):t=a);return[t,o,a,s]}function lAe(t,e,n,r){let[o,i,s,a]=qxt(t,e,n),l=e-o,c=n.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);c.length===0&&(s0?xi.fromMillis(l,r).shiftTo(...c).plus(u):u}var cAe=C(()=>{qD()});function Yr(t,e=n=>n){return{regex:t,deser:([n])=>e(vEe(n))}}function Zxt(t){return t.replace(/\./g,"\\.?").replace(pAe,fAe)}function uAe(t){return t.replace(/\./g,"").replace(pAe," ").toLowerCase()}function gm(t,e){return t===null?null:{regex:RegExp(t.map(Zxt).join("|")),deser:([n])=>t.findIndex(r=>uAe(n)===uAe(r))+e}}function dAe(t,e){return{regex:t,deser:([,n,r])=>FS(n,r),groups:e}}function MW(t){return{regex:t,deser:([e])=>e}}function Jxt(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Xxt(t,e){let n=Of(e),r=Of(e,"{2}"),o=Of(e,"{3}"),i=Of(e,"{4}"),s=Of(e,"{6}"),a=Of(e,"{1,2}"),l=Of(e,"{1,3}"),c=Of(e,"{1,6}"),u=Of(e,"{1,9}"),d=Of(e,"{2,4}"),f=Of(e,"{4,6}"),p=g=>({regex:RegExp(Jxt(g.val)),deser:([y])=>y,literal:!0}),h=(g=>{if(t.literal)return p(g);switch(g.val){case"G":return gm(e.eras("short"),0);case"GG":return gm(e.eras("long"),0);case"y":return Yr(c);case"yy":return Yr(d,VD);case"yyyy":return Yr(i);case"yyyyy":return Yr(f);case"yyyyyy":return Yr(s);case"M":return Yr(a);case"MM":return Yr(r);case"MMM":return gm(e.months("short",!0),1);case"MMMM":return gm(e.months("long",!0),1);case"L":return Yr(a);case"LL":return Yr(r);case"LLL":return gm(e.months("short",!1),1);case"LLLL":return gm(e.months("long",!1),1);case"d":return Yr(a);case"dd":return Yr(r);case"o":return Yr(l);case"ooo":return Yr(o);case"HH":return Yr(r);case"H":return Yr(a);case"hh":return Yr(r);case"h":return Yr(a);case"mm":return Yr(r);case"m":return Yr(a);case"q":return Yr(a);case"qq":return Yr(r);case"s":return Yr(a);case"ss":return Yr(r);case"S":return Yr(l);case"SSS":return Yr(o);case"u":return MW(u);case"uu":return MW(a);case"uuu":return Yr(n);case"a":return gm(e.meridiems(),0);case"kkkk":return Yr(i);case"kk":return Yr(d,VD);case"W":return Yr(a);case"WW":return Yr(r);case"E":case"c":return Yr(n);case"EEE":return gm(e.weekdays("short",!1),1);case"EEEE":return gm(e.weekdays("long",!1),1);case"ccc":return gm(e.weekdays("short",!0),1);case"cccc":return gm(e.weekdays("long",!0),1);case"Z":case"ZZ":return dAe(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return dAe(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return MW(/[a-z_+-/]{1,256}?/i);case" ":return MW(/[^\S\n\r]/);default:return p(g)}})(t)||{invalidReason:Gxt};return h.token=t,h}function ebt(t,e,n){let{type:r,value:o}=t;if(r==="literal"){let l=/^\s+$/.test(o);return{literal:!l,val:l?" ":o}}let i=e[r],s=r;r==="hour"&&(e.hour12!=null?s=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?s="hour12":s="hour24":s=n.hour12?"hour12":"hour24");let a=Qxt[s];if(typeof a=="object"&&(a=a[i]),a)return{literal:!1,val:a}}function tbt(t){return[`^${t.map(n=>n.regex).reduce((n,r)=>`${n}(${r.source})`,"")}$`,t]}function nbt(t,e,n){let r=t.match(e);if(r){let o={},i=1;for(let s in n)if(jx(n,s)){let a=n[s],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(o[a.token.val[0]]=a.deser(r.slice(i,i+l))),i+=l}return[r,o]}else return[r,{}]}function rbt(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}},n=null,r;return mn(t.z)||(n=Hl.create(t.z)),mn(t.Z)||(n||(n=new Pa(t.Z)),r=t.Z),mn(t.q)||(t.M=(t.q-1)*3+1),mn(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),mn(t.u)||(t.S=jD(t.u)),[Object.keys(t).reduce((i,s)=>{let a=e(s);return a&&(i[a]=t[s]),i},{}),n,r]}function obt(){return Pte||(Pte=hn.fromMillis(1555555555555)),Pte}function ibt(t,e){if(t.literal)return t;let n=Aa.macroTokenToFormatOpts(t.val),r=kte(n,e);return r==null||r.includes(void 0)?t:r}function Ete(t,e){return Array.prototype.concat(...t.map(n=>ibt(n,e)))}function Ate(t,e,n){return new GD(t,n).explainFromTokens(e)}function mAe(t,e,n){let{result:r,zone:o,specificOffset:i,invalidReason:s}=Ate(t,e,n);return[r,o,i,s]}function kte(t,e){if(!t)return null;let r=Aa.create(e,t).dtFormatter(obt()),o=r.formatToParts(),i=r.resolvedOptions();return o.map(s=>ebt(s,t,i))}var Gxt,Yxt,fAe,pAe,Qxt,Pte,GD,hAe=C(()=>{kc();WD();dA();Fx();Bx();cte();Rx();Gxt="missing Intl.DateTimeFormat.formatToParts support";Yxt="\xA0",fAe=`[ ${Yxt}]`,pAe=new RegExp(fAe,"g");Qxt={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"}};Pte=null;GD=class{constructor(e,n){if(this.locale=e,this.format=n,this.tokens=Ete(Aa.parseFormat(n),e),this.units=this.tokens.map(r=>Xxt(r,e)),this.disqualifyingUnit=this.units.find(r=>r.invalidReason),!this.disqualifyingUnit){let[r,o]=tbt(this.units);this.regex=RegExp(r,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[n,r]=nbt(e,this.regex,this.handlers),[o,i,s]=r?rbt(r):[null,null,void 0];if(jx(r,"a")&&jx(r,"H"))throw new dm("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:n,matches:r,result:o,zone:i,specificOffset:s}}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 YD(t){return new Ea("unsupported zone",`the zone "${t.name}" is not supported`)}function Nte(t){return t.weekData===null&&(t.weekData=UD(t.c)),t.weekData}function Ote(t){return t.localWeekData===null&&(t.localWeekData=UD(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function jS(t,e){let n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new hn({...n,...e,old:n})}function _Ae(t,e,n){let r=t-e*60*1e3,o=n.offset(r);if(e===o)return[r,e];r-=(o-e)*60*1e3;let i=n.offset(r);return o===i?[r,o]:[t-Math.min(o,i)*60*1e3,Math.max(o,i)]}function NW(t,e){t+=e*60*1e3;let n=new Date(t);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function RW(t,e,n){return _Ae(cA(t),e,n)}function yAe(t,e){let n=t.o,r=t.c.year+Math.trunc(e.years),o=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...t.c,year:r,month:o,day:Math.min(t.c.day,mA(r,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},s=xi.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"),a=cA(i),[l,c]=_Ae(a,n,t.zone);return s!==0&&(l+=s,c=t.zone.offset(l)),{ts:l,o:c}}function SA(t,e,n,r,o,i){let{setZone:s,zone:a}=n;if(t&&Object.keys(t).length!==0||e){let l=e||a,c=hn.fromObject(t,{...n,zone:l,specificOffset:i});return s?c:c.setZone(a)}else return hn.invalid(new Ea("unparsable",`the input "${o}" can't be parsed as ${r}`))}function OW(t,e,n=!0){return t.isValid?Aa.create(Wr.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Rte(t,e){let n=t.c.year>9999||t.c.year<0,r="";return n&&t.c.year>=0&&(r+="+"),r+=vi(t.c.year,n?6:4),e?(r+="-",r+=vi(t.c.month),r+="-",r+=vi(t.c.day)):(r+=vi(t.c.month),r+=vi(t.c.day)),r}function wAe(t,e,n,r,o,i){let s=vi(t.c.hour);return e?(s+=":",s+=vi(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(s+=":")):s+=vi(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!n)&&(s+=vi(t.c.second),(t.c.millisecond!==0||!r)&&(s+=".",s+=vi(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?s+="Z":t.o<0?(s+="-",s+=vi(Math.trunc(-t.o/60)),s+=":",s+=vi(Math.trunc(-t.o%60))):(s+="+",s+=vi(Math.trunc(t.o/60)),s+=":",s+=vi(Math.trunc(t.o%60)))),i&&(s+="["+t.zone.ianaName+"]"),s}function ubt(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 lA(t);return e}function vAe(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return ubt(t)}}function dbt(t){return DW[t]||(LW===void 0&&(LW=Vr.now()),DW[t]=t.offset(LW)),DW[t]}function xAe(t,e){let n=mm(e.zone,Vr.defaultZone);if(!n.isValid)return hn.invalid(YD(n));let r=Wr.fromObject(e),o,i;if(mn(t.year))o=Vr.now();else{for(let l of TAe)mn(t[l])&&(t[l]=SAe[l]);let s=pte(t)||mte(t);if(s)return hn.invalid(s);let a=dbt(n);[o,i]=RW(t,a,n)}return new hn({ts:o,zone:n,loc:r,o:i})}function bAe(t,e,n){let r=mn(n.round)?!0:n.round,o=(s,a)=>(s=uA(s,r||n.calendary?0:2,!0),e.loc.clone(n).relFormatter(n).format(s,a)),i=s=>n.calendary?e.hasSame(t,s)?0:e.startOf(s).diff(t.startOf(s),s).get(s):e.diff(t,s).get(s);if(n.unit)return o(i(n.unit),n.unit);for(let s of n.units){let a=i(s);if(Math.abs(a)>=1)return o(a,s)}return o(t>e?-0:0,n.units[n.units.length-1])}function CAe(t){let e={},n;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],n=Array.from(t).slice(0,t.length-1)):n=Array.from(t),[e,n]}function _A(t){if(hn.isDateTime(t))return t;if(t&&t.valueOf&&hm(t.valueOf()))return hn.fromJSDate(t);if(t&&typeof t=="object")return hn.fromObject(t);throw new Ri(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Mte,gAe,SAe,sbt,abt,TAe,lbt,cbt,LW,DW,hn,Bx=C(()=>{qD();Tte();Ux();Ite();WD();dA();$D();kc();PW();cAe();Ste();hAe();hte();RD();Rx();FD();Mte="Invalid DateTime",gAe=864e13;SAe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},sbt={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},abt={ordinal:1,hour:0,minute:0,second:0,millisecond:0},TAe=["year","month","day","hour","minute","second","millisecond"],lbt=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],cbt=["year","ordinal","hour","minute","second","millisecond"];DW={},hn=class t{constructor(e){let n=e.zone||Vr.defaultZone,r=e.invalid||(Number.isNaN(e.ts)?new Ea("invalid input"):null)||(n.isValid?null:YD(n));this.ts=mn(e.ts)?Vr.now():e.ts;let o=null,i=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(n))[o,i]=[e.old.c,e.old.o];else{let a=hm(e.o)&&!e.old?e.o:n.offset(this.ts);o=NW(this.ts,a),r=Number.isNaN(o.year)?new Ea("invalid input"):null,o=r?null:o,i=r?null:a}this._zone=n,this.loc=e.loc||Wr.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=o,this.o=i,this.isLuxonDateTime=!0}static now(){return new t({})}static local(){let[e,n]=CAe(arguments),[r,o,i,s,a,l,c]=n;return xAe({year:r,month:o,day:i,hour:s,minute:a,second:l,millisecond:c},e)}static utc(){let[e,n]=CAe(arguments),[r,o,i,s,a,l,c]=n;return e.zone=Pa.utcInstance,xAe({year:r,month:o,day:i,hour:s,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,n={}){let r=DEe(e)?e.valueOf():NaN;if(Number.isNaN(r))return t.invalid("invalid input");let o=mm(n.zone,Vr.defaultZone);return o.isValid?new t({ts:r,zone:o,loc:Wr.fromObject(n)}):t.invalid(YD(o))}static fromMillis(e,n={}){if(hm(e))return e<-gAe||e>gAe?t.invalid("Timestamp out of range"):new t({ts:e,zone:mm(n.zone,Vr.defaultZone),loc:Wr.fromObject(n)});throw new Ri(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,n={}){if(hm(e))return new t({ts:e*1e3,zone:mm(n.zone,Vr.defaultZone),loc:Wr.fromObject(n)});throw new Ri("fromSeconds requires a numerical input")}static fromObject(e,n={}){e=e||{};let r=mm(n.zone,Vr.defaultZone);if(!r.isValid)return t.invalid(YD(r));let o=Wr.fromObject(n),i=hA(e,vAe),{minDaysInFirstWeek:s,startOfWeek:a}=fte(i,o),l=Vr.now(),c=mn(n.specificOffset)?r.offset(l):n.specificOffset,u=!mn(i.ordinal),d=!mn(i.year),f=!mn(i.month)||!mn(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||u)&&m)throw new dm("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&u)throw new dm("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,g,y,w=NW(l,c);h?(g=lbt,y=sbt,w=UD(w,s,a)):u?(g=cbt,y=abt,w=kW(w)):(g=TAe,y=SAe);let v=!1;for(let A of g){let O=i[A];mn(O)?v?i[A]=y[A]:i[A]=w[A]:v=!0}let x=h?OEe(i,s,a):u?REe(i):pte(i),b=x||mte(i);if(b)return t.invalid(b);let _=h?ute(i,s,a):u?dte(i):i,[T,S]=RW(_,c,r),P=new t({ts:T,zone:r,o:S,loc:o});return i.weekday&&p&&e.weekday!==P.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${P.toISO()}`):P.isValid?P:t.invalid(P.invalid)}static fromISO(e,n={}){let[r,o]=JEe(e);return SA(r,o,n,"ISO 8601",e)}static fromRFC2822(e,n={}){let[r,o]=XEe(e);return SA(r,o,n,"RFC 2822",e)}static fromHTTP(e,n={}){let[r,o]=QEe(e);return SA(r,o,n,"HTTP",n)}static fromFormat(e,n,r={}){if(mn(e)||mn(n))throw new Ri("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=r,s=Wr.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[a,l,c,u]=mAe(s,e,n);return u?t.invalid(u):SA(a,l,r,`format ${n}`,e,c)}static fromString(e,n,r={}){return t.fromFormat(e,n,r)}static fromSQL(e,n={}){let[r,o]=nAe(e);return SA(r,o,n,"SQL",e)}static invalid(e,n=null){if(!e)throw new Ri("need to specify a reason the DateTime is invalid");let r=e instanceof Ea?e:new Ea(e,n);if(Vr.throwOnInvalid)throw new hW(r);return new t({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,n={}){let r=kte(e,Wr.fromObject(n));return r?r.map(o=>o?o.val:null).join(""):null}static expandFormat(e,n={}){return Ete(Aa.parseFormat(e),Wr.fromObject(n)).map(o=>o.val).join("")}static resetCache(){LW=void 0,DW={}}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?Nte(this).weekYear:NaN}get weekNumber(){return this.isValid?Nte(this).weekNumber:NaN}get weekday(){return this.isValid?Nte(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Ote(this).weekday:NaN}get localWeekNumber(){return this.isValid?Ote(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Ote(this).weekYear:NaN}get ordinal(){return this.isValid?kW(this.c).ordinal:NaN}get monthShort(){return this.isValid?Jy.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Jy.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Jy.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Jy.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,n=6e4,r=cA(this.c),o=this.zone.offset(r-e),i=this.zone.offset(r+e),s=this.zone.offset(r-o*n),a=this.zone.offset(r-i*n);if(s===a)return[this];let l=r-s*n,c=r-a*n,u=NW(l,s),d=NW(c,a);return u.hour===d.hour&&u.minute===d.minute&&u.second===d.second&&u.millisecond===d.millisecond?[jS(this,{ts:l}),jS(this,{ts:c})]:[this]}get isInLeapYear(){return BS(this.year)}get daysInMonth(){return mA(this.year,this.month)}get daysInYear(){return this.isValid?zx(this.year):NaN}get weeksInWeekYear(){return this.isValid?US(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?US(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:n,numberingSystem:r,calendar:o}=Aa.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:n,numberingSystem:r,outputCalendar:o}}toUTC(e=0,n={}){return this.setZone(Pa.instance(e),n)}toLocal(){return this.setZone(Vr.defaultZone)}setZone(e,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(e=mm(e,Vr.defaultZone),e.equals(this.zone))return this;if(e.isValid){let o=this.ts;if(n||r){let i=e.offset(this.ts),s=this.toObject();[o]=RW(s,i,e)}return jS(this,{ts:o,zone:e})}else return t.invalid(YD(e))}reconfigure({locale:e,numberingSystem:n,outputCalendar:r}={}){let o=this.loc.clone({locale:e,numberingSystem:n,outputCalendar:r});return jS(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let n=hA(e,vAe),{minDaysInFirstWeek:r,startOfWeek:o}=fte(n,this.loc),i=!mn(n.weekYear)||!mn(n.weekNumber)||!mn(n.weekday),s=!mn(n.ordinal),a=!mn(n.year),l=!mn(n.month)||!mn(n.day),c=a||l,u=n.weekYear||n.weekNumber;if((c||s)&&u)throw new dm("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&s)throw new dm("Can't mix ordinal dates with month/day");let d;i?d=ute({...UD(this.c,r,o),...n},r,o):mn(n.ordinal)?(d={...this.toObject(),...n},mn(n.day)&&(d.day=Math.min(mA(d.year,d.month),d.day))):d=dte({...kW(this.c),...n});let[f,p]=RW(d,this.o,this.zone);return jS(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let n=xi.fromDurationLike(e);return jS(this,yAe(this,n))}minus(e){if(!this.isValid)return this;let n=xi.fromDurationLike(e).negate();return jS(this,yAe(this,n))}startOf(e,{useLocaleWeeks:n=!1}={}){if(!this.isValid)return this;let r={},o=xi.normalizeUnit(e);switch(o){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break;case"milliseconds":break}if(o==="weeks")if(n){let i=this.loc.getStartOfWeek(),{weekday:s}=this;sthis.valueOf(),a=s?this:e,l=s?e:this,c=lAe(a,l,i,o);return s?c.negate():c}diffNow(e="milliseconds",n={}){return this.diff(t.now(),e,n)}until(e){return this.isValid?Zy.fromDateTimes(this,e):this}hasSame(e,n,r){if(!this.isValid)return!1;let o=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(n,r)<=o&&o<=i.endOf(n,r)}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 n=e.base||t.fromObject({},{zone:this.zone}),r=e.padding?thisn.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Ri("max requires all arguments be DateTimes");return gte(e,n=>n.valueOf(),Math.max)}static fromFormatExplain(e,n,r={}){let{locale:o=null,numberingSystem:i=null}=r,s=Wr.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return Ate(s,e,n)}static fromStringExplain(e,n,r={}){return t.fromFormatExplain(e,n,r)}static buildFormatParser(e,n={}){let{locale:r=null,numberingSystem:o=null}=n,i=Wr.fromOpts({locale:r,numberingSystem:o,defaultToEN:!0});return new GD(i,e)}static fromFormatParser(e,n,r={}){if(mn(e)||mn(n))throw new Ri("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=r,s=Wr.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!s.equals(n.locale))throw new Ri(`fromFormatParser called with a locale of ${s}, but the format parser was created for ${n.locale}`);let{result:a,zone:l,specificOffset:c,invalidReason:u}=n.explainFromTokens(e);return u?t.invalid(u):SA(a,l,r,`format ${n.format}`,e,c)}static get DATE_SHORT(){return Lx}static get DATE_MED(){return hD}static get DATE_MED_WITH_WEEKDAY(){return Hee}static get DATE_FULL(){return gD}static get DATE_HUGE(){return yD}static get TIME_SIMPLE(){return wD}static get TIME_WITH_SECONDS(){return vD}static get TIME_WITH_SHORT_OFFSET(){return xD}static get TIME_WITH_LONG_OFFSET(){return bD}static get TIME_24_SIMPLE(){return CD}static get TIME_24_WITH_SECONDS(){return _D}static get TIME_24_WITH_SHORT_OFFSET(){return SD}static get TIME_24_WITH_LONG_OFFSET(){return TD}static get DATETIME_SHORT(){return ID}static get DATETIME_SHORT_WITH_SECONDS(){return PD}static get DATETIME_MED(){return ED}static get DATETIME_MED_WITH_SECONDS(){return AD}static get DATETIME_MED_WITH_WEEKDAY(){return Kee}static get DATETIME_FULL(){return kD}static get DATETIME_FULL_WITH_SECONDS(){return MD}static get DATETIME_HUGE(){return ND}static get DATETIME_HUGE_WITH_SECONDS(){return OD}}});var Lte=C(()=>{Bx();qD();Tte();Ite();$S();dA();Fx();ate();vW();Ux()});function Ad(t,e){let n=q();return e?.apiKey||n[tW[t]]||""}function pbt(){return[{name:"copilot-plus-flash",provider:"copilot-plus"},{name:"google/gemini-2.5-flash",provider:"openrouterai"}]}function IAe(t){return pbt().some(e=>e.name===t.name&&e.provider===t.provider)}var VS=C(()=>{It();Se()});function Li(t,e,n={}){let r=n.leading??!1,o=n.trailing??!0,i,s,a,l=!1,c=()=>{let f=s;return s=void 0,l=!1,f&&(a=t(...f)),a},u=()=>{i=window.setTimeout(()=>{i=void 0,o&&l&&c()},e)},d=(...f)=>{s=f,l=!0;let p=i===void 0;return i!==void 0&&window.clearTimeout(i),p&&r&&c(),u(),a};return d.cancel=()=>{i!==void 0&&(window.clearTimeout(i),i=void 0),s=void 0,l=!1},d.flush=()=>i===void 0?a:(window.clearTimeout(i),i=void 0,l?c():a),d}var Hx=C(()=>{});function Xy(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function EAe(t){let e=t,n=e?.detail||{};return{status:n.status,message:n.message||e?.message,reason:n.reason}}function mbt(t){let e=EAe(t),r=t?.message;return!!(e.reason==="Invalid license key"||r==="Invalid license key"||r?.includes("status 403")||e.status===403)}function AAe(t){let e=EAe(t);return mbt(t)?$te.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:$te.UNKNOWN_ERROR)}function TA(t){return t.replace(/^#/,"").trim()}function Qh(t,e={}){let{trimStart:n=!0}=e;if(t.startsWith("---")){let r=t.indexOf("---",3);if(r!==-1){let o=t.slice(r+3);return n?o.trimStart():o.startsWith(`\r `)?o.slice(2):o.startsWith(` `)||o.startsWith("\r")?o.slice(1):o}}return t}function eg(t,e=!0){let n=app.metadataCache.getFileCache(t),r=n?.frontmatter?.tags,o=new Set;if(!e){let i=n?.tags?.map(s=>s.tag);i&&i.forEach(s=>o.add(TA(s)))}return r&&(Array.isArray(r)?r.forEach(i=>{typeof i=="string"&&o.add(TA(i))}):typeof r=="string"&&o.add(TA(r))),Array.from(o)}function $W(t,e,n){if(e.length===0)return[];e=e.map(i=>TA(i));let r=n&&n.length>0?n:JD(t,"/"),o=[];for(let i of r){let s=eg(i);e.some(a=>s.includes(a))&&o.push(i)}return o}async function Fr(t){let e=(0,Kl.normalizePath)(t).replace(/^\/+/,"").replace(/\/+$/,"");if(!e)return;let n=e.split("/").filter(Boolean),r="";for(let o of n){r=r?`${r}/${o}`:o;let i=app.vault.getAbstractFileByPath(r);if(i){if(i instanceof Kl.TFile)throw new Error(`Path conflict: "${r}" exists as a file, expected folder.`);continue}await app.vault.adapter.mkdir(r)}}function FW(t){return t?lee.includes(t.extension):!1}async function IA(t,e){return FW(t)?await e.read(t):null}function UW(t){return t.basename}function tg(t){return t?gPe.includes(t.extension):!1}function Mc(t){return t==="copilot_plus"||t==="project"}function PA(t,e){return t?FW(t)?!0:Mc(e):!1}function kAe(t,e){return!t||!e?!1:t.includes(aee)&&e.includes(aee)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function BW(t){let e=[],n=t.history;for(let r=0;r{let o=e.getAbstractFileByPath(r);if(o instanceof Kl.TFile)n.set(o.path,o);else{let s=e.getMarkdownFiles().filter(a=>a.basename===r);s.length>0&&(hbt(r,e)?n.set(s[0].path,s[0]):console.warn(`Found multiple files with title "${r}". Expected a full path for duplicate titles.`))}}),Array.from(n.values())}function Df(t,e){let n=/\[\[(.*?)\]\]/g,r=t.match(n);if(!r)return[];let o=r.map(i=>i.slice(2,-2));return MAe(o,e)}function NAe(t,e){let n=/\{\[\[(.*?)\]\]\}/g,r=t.match(n);if(!r)return[];let o=r.map(i=>i.slice(3,-3));return MAe(o,e)}function hbt(t,e){return e.getMarkdownFiles().filter(r=>r.basename===t).length===1}function OAe(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function RAe(t){let e=new Set;return t.forEach(n=>{n.metadata?.title&&e.add(n.metadata.title)}),Array.from(e)}function Fte(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 n=Ute(e);return n?/^[a-zA-Z0-9_-]{11}$/.test(n)?{isValid:!0,videoId:n}:{isValid:!1,error:"Invalid YouTube video ID"}:{isValid:!1,error:"Invalid YouTube URL format"}}function Ute(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 n of e){let r=t.match(n);if(r&&r[1])return r[1]}return null}catch{return null}}function LAe(t){return`https://www.youtube.com/watch?v=${t}`}function DAe(t){return Fte(t).isValid}function $Ae(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 FAe(t){let e=t.matchAll(new RegExp(gbt,"g"));return Array.from(e,n=>n[0])}async function fo(t,e={}){let{throwOnHttpError:n=!0}=e,r=new Headers(e.headers),o=Object.fromEntries(r.entries());delete o["content-length"],k("safeFetch request");let i=e.method?.toUpperCase()||"POST",a=await(0,Kl.requestUrl)({url:t,contentType:"application/json",headers:o,method:i,...["POST","PUT","PATCH"].includes(i)&&typeof e.body=="string"&&{body:e.body},throw:!1});if(n&&a.status>=400){let l=null;try{l=typeof a.json=="string"?JSON.parse(a.json):a.json}catch{try{l=typeof a.text=="string"?JSON.parse(a.text):a.text}catch{l=null}}let c=new Error($te.REQUEST_FAILED(a.status));c.json=l;let u=l&&typeof l.detail=="object"?l.detail:void 0;if(u?.reason==="Invalid license key"||l?.reason==="Invalid license key")c.message="Invalid license key";else if(u?.message||l?.message){let d=u?.message||l?.message,f=u?.reason||l?.reason;c.message=f?`${d}: ${f}`:d??""}else l?.detail?c.message=JSON.stringify(l.detail):l&&(c.message+=". "+JSON.stringify(l));throw c}return{ok:a.status>=200&&a.status<300,status:a.status,statusText:a.status.toString(),headers:new Headers(a.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:ybt(a.text),bodyUsed:!0,json:()=>Promise.resolve(a.json),text:async()=>a.text,arrayBuffer:async()=>{if(a.arrayBuffer)return a.arrayBuffer;let l=a.text.replace(/^data:.*;base64,/,""),c=PAe.Buffer.from(l,"base64");return c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function Qy(t,e={}){return fo(t,{...e,throwOnHttpError:!1})}function ybt(t){return new ReadableStream({start(e){let r=new TextEncoder().encode(t);e.enqueue(r),e.close()}})}function XD(t,e){let n={...t};return e.forEach(r=>{delete n[r]}),n}function $f(t,e){let[n,r]=t.split("|"),o=e.find(i=>i.name===n&&i.provider===r);if(!o)throw new Error(`No model configuration found for: ${t}`);return o}function ew(t){let e=Cu[t];return{...e,label:e.label||t}}function cl(t,e){let n=Cu[t]?.label||t;return n+(e?.believerExclusive&&n==="Copilot Plus"?"(Believer)":"")}function ng(t){let e=t;return e=jte(e),e=e.replace(/```xml\s*[\s\S]*?[\s\S]*?<\/write(?:File|ToFile)>[\s\S]*?```/g,""),e=e.replace(/[\s\S]*?<\/write(?:File|ToFile)>/g,""),e=e.replace(/[\s\S]*?/g,""),e=e.replace(//g,""),e=e.replace(/\n{3,}/g,` `),e=e.trim(),e}async function EA(t,e=!1){let n=app.workspace.getMostRecentLeaf();if(!n){new Kl.Notice("No active leaf found.");return}if(n.view instanceof Kl.MarkdownView||(n=app.workspace.getLeaf(!1),await n.setViewState({type:"markdown",state:n.view.getState()})),!(n.view instanceof Kl.MarkdownView)){new Kl.Notice("Failed to open a markdown view.");return}let r=n.view.editor,o=r.getCursor("from"),i=r.getCursor("to"),s=ng(t),a=s.split(` `),l=(w,v)=>{let x=v.length-1;return x===0?{line:w.line,ch:w.ch+(v[0]?.length??0)}:{line:w.line+x,ch:v[v.length-1]?.length??0}},c=()=>{let w=e?o:i;r.replaceRange(s,w,i),r.setSelection(w,l(w,a))},u=()=>{r.focus(),new Kl.Notice("Message inserted into the active note.")},d=r.cm;if(!(d?.state?.doc&&typeof d.dispatch=="function")){c(),u();return}let{from:p,to:m}=d.state.selection.main,h=e?p:m,g=d.state.toText(s),y=h+g.length;try{d.dispatch({changes:{from:h,to:m,insert:g},selection:{anchor:h,head:y}})}catch(w){ee("CM6 dispatch failed, falling back to Obsidian API",w),c()}u()}function zW(t,e){let n=t.split(".").map(Number),r=e.split(".").map(Number);for(let o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]=7:!1;return{isOSeries:r,isGPT5:o,isThinkingEnabled:i,usesAdaptiveThinking:a}}function e$(t,e="system"){return QD(t)?"human":e}function zte(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","github-copilot","copilot-plus","copilot-plus-jina"];return Object.keys(Cu).filter(e=>!t.includes(e))}function kA(t,e){let n=t.provider;if(n==="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(n==="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=!!zte().find(i=>i===n),o=!Ad(t.provider,t);return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first. Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function Kx(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text??"").join(""):""}function jte(t){let n=Kx(t).replace(/[\s\S]*?<\/think>/g,"");return n=n.replace(/[\s\S]*$/g,""),n.trim()}function BAe(t){return Kx(t).replace(/[\s\S]*?<\/errorChunk>/g,"").trim()}function zAe(){return crypto.randomUUID()}async function Nc(t){let e=console.warn;try{return console.warn=function(...n){let r=n[0];typeof r=="string"&&(r.includes("Failed to calculate number of tokens")||r.includes("Unknown model"))||e.apply(console,n)},await t()}finally{console.warn=e}}async function jAe(t,e,n="Operation"){let{TimeoutError:r}=await Promise.resolve().then(()=>(Nf(),zPe)),o=new AbortController,i=window.setTimeout(()=>{o.abort()},e);try{return await Promise.race([t(o.signal),new Promise((s,a)=>{o.signal.addEventListener("abort",()=>{a(new r(n,e))})})])}finally{window.clearTimeout(i)}}function t$(){let t=app.workspace.getActiveViewOfType(Kl.MarkdownView);return t?t.getState().source===!0:!0}function WS(t){return new TextEncoder().encode(t).length}function ZD(t,e){if(e<=0)return"";let n=new TextEncoder;if(n.encode(t).length<=e)return t;let o=0,i=t.length,s="";for(;o<=i;){let a=Math.floor((o+i)/2),l=t.substring(0,a);n.encode(l).length<=e?(s=l,o=a+1):i=a-1}return s}function Vte(t){let e=t.split("/"),n=e[e.length-1];if(WS(n)<=Dte)return t;let r=n.lastIndexOf("."),o=r>=0?n.substring(r):"",i=r>=0?n.substring(0,r):n,s=WS(o),a=Dte-s;return a<=0?e[e.length-1]=ZD(n,Dte):e[e.length-1]=ZD(i,a)+o,e.join("/")}async function VAe(t,e=!0){let n=null;app.workspace.iterateAllLeaves(r=>{if(r.view.getViewType()==="markdown"||r.view.getViewType()==="pdf"||r.view.getViewType()==="canvas"){let o=r.view.file;o&&o.path===t.path&&(n=r)}}),n&&e?app.workspace.setActiveLeaf(n,{focus:!0}):n||await app.workspace.getLeaf("tab").openFile(t)}var PAe,Kl,$te,JD,ll,gbt,Dte,qe=C(()=>{PAe=N(uD());Qi();It();ye();Lte();Kl=require("obsidian");VS();Wee();Hx();$te={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}`};JD=(t,e)=>{let n=t.getMarkdownFiles();if(e==="/")return n;let r=e.toLowerCase().replace(/^\/|\/$/g,"");return n.filter(o=>{let s=o.path.toLowerCase().split("/"),a=r.split("/"),l=0;for(let c of a){for(;l=s.length)return!1}return!0})};ll=(t,e="local")=>{let n=e==="utc"?hn.fromJSDate(t).toUTC():hn.fromJSDate(t);return{fileName:n.toFormat("yyyyMMdd_HHmmss"),display:n.toFormat("yyyy/MM/dd HH:mm:ss"),epoch:n.toMillis()}};gbt=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/;Dte=255});var WAe,Wte,Ds,HS=C(()=>{Wee();WAe=require("obsidian");qe();Se();Su();Wte=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 n=Xt(e,!0);return this.escapeAngleBrackets(this.collapseToSingleLine(n))}if(typeof e=="string")return this.escapeAngleBrackets(this.collapseToSingleLine(e));try{let n=JSON.stringify(e);return this.escapeAngleBrackets(this.collapseToSingleLine(n??String(e)))}catch{return this.escapeAngleBrackets(this.collapseToSingleLine(String(e)))}}collapseToSingleLine(e){let n=e.replace(/[\r\n]+/g,"\\n").replace(/\t/g," ");return n.length<=this.maxLineChars?n:n.slice(0,this.maxLineChars)+` \u2026 [truncated ${n.length-this.maxLineChars} chars]`}async append(e,...n){await this.ensureInitialized();let r=new Date().toISOString(),o=n.map(s=>this.sanitizeForSingleLine(s)),i=`${r} ${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,">")}async appendMarkdownBlock(e){if(await this.ensureInitialized(),!(!Array.isArray(e)||e.length===0))for(let n of e){let r=typeof n=="string"?n:String(n??"");this.buffer.push(r),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 n=this.buffer.join(` `)+(this.buffer.length?` `:"");await app.vault.adapter.write(e,n)}}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=q();return this.removeKeysRecursive(e)}removeKeysRecursive(e){if(e==null)return e;if(Array.isArray(e))return e.map(n=>this.removeKeysRecursive(n));if(typeof e=="object"&&e.constructor===Object){let n={},r=e;for(let[o,i]of Object.entries(r))Mx(o)||/orgId$/i.test(o)||/instanceName$/i.test(o)||/deploymentName$/i.test(o)||/apiVersion$/i.test(o)||(n[o]=this.removeKeysRecursive(i));return n}return e}async openLogFile(){if(!this.hasVault())return;let e=this.getLogPath(),n=[...this.buffer];try{let i=this.sanitizeSettingsForLog(),a=["","## Settings","```json",...JSON.stringify(i,null,2).split(` `),"```"];n.push(...a)}catch{}try{let i=n.join(` `)+(n.length?` `:""),s=e.includes("/")?e.split("/").slice(0,-1).join("/"):"";s&&await Fr(s),await app.vault.adapter.exists(e)?await app.vault.adapter.write(e,i):await app.vault.create(e,i)}catch{}let r=app.vault.getAbstractFileByPath(e),o=r instanceof WAe.TFile?r:null;try{o&&await app.workspace.getLeaf(!0).openFile(o)}catch{}}},Ds=Wte.getInstance()});function k(...t){q().debug&&console.log(...t),Ds.append("INFO",...t)}function z(...t){q().debug&&console.error(...t),Ds.append("ERROR",...t)}function ee(...t){q().debug&&console.warn(...t),Ds.append("WARN",...t)}function jW(t){Ds.appendMarkdownBlock(t)}function HAe(t,e){if(q().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}k("Table:",JSON.stringify(t))}var ye=C(()=>{Se();HS()});function ZAe(t){Kn.set(WW,t)}function Iu(){return Kn.get(WW)}function JAe(t){return Kn.sub(WW,t)}function qx(){return Hy(WW,{store:Kn})}function ym(){return Kn.get(HW)}function XAe(t){Kn.set(HW,t)}function QAe(t){return Kn.sub(HW,t)}function kd(){return Hy(HW,{store:Kn})}function Gx(t){Kn.set(VW,t)}function br(){return Kn.get(VW)}function OA(t){return Kn.sub(VW,()=>{t(Kn.get(VW))})}function rg(t){Kn.set(YAe,t)}function KW(){return Hy(YAe,{store:Kn})}function RA(){return ym()==="project"}function og(t){Kn.set(Hte,t)}function wm(){return Kn.get(Hte)}function eke(t){let e=wm();og(e.filter(n=>n.id!==t))}function tke(){og([])}function nke(){return Hy(Hte,{store:Kn})}function rke(t){Kn.set(n$,t)}function ig(t,e){Kn.set(n$,n=>({...n,[t]:e(n[t])}))}function Yx(){return Hy(n$,{store:Kn})}function LA(){return Kn.get(r$)}function Kte(t){Kn.set(r$,t)}function ul(t){Kn.set(r$,e=>({...e,...t}))}function qte(){Ff!==null&&(window.clearTimeout(Ff),Ff=null),MA=0,NA=0,Kn.set(r$,{isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"})}function oke(t){NA=t;let e=Date.now();e-MA>=GAe?(MA=e,Ff!==null&&(window.clearTimeout(Ff),Ff=null),ul({indexedCount:NA})):Ff===null&&(Ff=window.setTimeout(()=>{MA=Date.now(),Ff=null,ul({indexedCount:NA})},GAe-(e-MA)))}function ike(){Ff!==null&&(window.clearTimeout(Ff),Ff=null),ul({indexedCount:NA}),MA=0,NA=0}function DA(){return Hy(r$,{store:Kn})}var KAe,WW,qAe,HW,VW,YAe,n$,r$,Hte,MA,NA,Ff,GAe,Ir=C(()=>{Qi();Se();Id();KAe=Oo(null),WW=Oo(t=>{let e=t(KAe);return e!==null?e:t(Ox).defaultModelKey},(t,e,n)=>{e(KAe,n)}),qAe=Oo(null),HW=Oo(t=>{let e=t(qAe);return e!==null?e:t(Ox).defaultChainType},(t,e,n)=>{e(qAe,n)}),VW=Oo(null),YAe=Oo(!1),n$=Oo({success:[],failed:[],processingFiles:[],total:[]}),r$=Oo({isActive:!1,isPaused:!1,isCancelled:!1,indexedCount:0,totalFiles:0,errors:[],completionStatus:"none"}),Hte=Oo([]);MA=0,NA=0,Ff=null,GAe=500});function ske(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ake(...t){return e=>{let n=!1,r=t.map(o=>{let i=ske(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o{xbt=N(U(),1)});var uke=Tt(qW=>{"use strict";var bbt=U(),Cbt=Symbol.for("react.element"),_bt=Symbol.for("react.fragment"),Sbt=Object.prototype.hasOwnProperty,Tbt=bbt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ibt={key:!0,ref:!0,__self:!0,__source:!0};function cke(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)Sbt.call(e,r)&&!Ibt.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:Cbt,type:t,key:i,ref:s,props:o,_owner:Tbt.current}}qW.Fragment=_bt;qW.jsx=cke;qW.jsxs=cke});var Ve=Tt((Wan,dke)=>{"use strict";dke.exports=uke()});function Ebt(t){return typeof t=="object"&&t!==null&&"then"in t}function fke(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Pbt&&"_payload"in t&&Ebt(t._payload)}function Abt(t){let e=kbt(t),n=gs.forwardRef((r,o)=>{let{children:i,...s}=r;fke(i)&&typeof YW=="function"&&(i=YW(i._payload));let a=gs.Children.toArray(i),l=a.find(Nbt);if(l){let c=l.props.children,u=a.map(d=>d===l?gs.Children.count(c)>1?gs.Children.only(null):gs.isValidElement(c)?c.props.children:null:d);return(0,GW.jsx)(e,{...s,ref:o,children:gs.isValidElement(c)?gs.cloneElement(c,void 0,u):null})}return(0,GW.jsx)(e,{...s,ref:o,children:i})});return n.displayName=`${t}.Slot`,n}function kbt(t){let e=gs.forwardRef((n,r)=>{let{children:o,...i}=n;if(fke(o)&&typeof YW=="function"&&(o=YW(o._payload)),gs.isValidElement(o)){let s=Rbt(o),a=Obt(i,o.props);return o.type!==gs.Fragment&&(a.ref=r?ake(r,s):s),gs.cloneElement(o,a)}return gs.Children.count(o)>1?gs.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function Nbt(t){return gs.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Mbt}function Obt(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{let l=i(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...t,...n}}function Rbt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gs,GW,Pbt,YW,pke,Mbt,mke=C(()=>{gs=N(U(),1);lke();GW=N(Ve(),1),Pbt=Symbol.for("react.lazy"),YW=gs[" use ".trim().toString()];pke=Abt("Slot");Mbt=Symbol("radix.slottable")});function hke(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e{});var gke,yke,$A,JW=C(()=>{Gte();gke=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,yke=ZW,$A=(t,e)=>n=>{var r;if(e?.variants==null)return yke(t,n?.class,n?.className);let{variants:o,defaultVariants:i}=e,s=Object.keys(o).map(c=>{let u=n?.[c],d=i?.[c];if(u===null)return null;let f=gke(u)||gke(d);return o[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[h,g]=m;return Array.isArray(g)?g.includes({...i,...a}[h]):{...i,...a}[h]===g})?[...c,d,f]:c},[]);return yke(t,s,l,n?.class,n?.className)}});function Kbt(){let t=0,e,n,r="";for(;td(u),t());return n=Vbt(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){let c=r(l);if(c)return c;let u=Hbt(l,n);return o(l,u),u}return function(){return i(Kbt.apply(null,arguments))}}var Jte,Lbt,Cke,wke,Dbt,$bt,Zte,vke,Fbt,Ubt,Bbt,_ke,zbt,jbt,Vbt,Wbt,Hbt,Ske,Ko,Tke,qbt,Gbt,Ybt,Zbt,Jbt,Xbt,Qbt,tw,Zx,FA,Yte,o$,eCt,er,Jx,tCt,nCt,rCt,oCt,iCt,sCt,i$,UA,aCt,Ike,lCt,cCt,bke,uCt,s$,dCt,fCt,Pke,Eke=C(()=>{Jte="-",Lbt=t=>{let e=$bt(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{let a=s.split(Jte);return a[0]===""&&a.length!==1&&a.shift(),Cke(a,e)||Dbt(s)},getConflictingClassGroupIds:(s,a)=>{let l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},Cke=(t,e)=>{if(t.length===0)return e.classGroupId;let n=t[0],r=e.nextPart.get(n),o=r?Cke(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(Jte);return e.validators.find(({validator:s})=>s(i))?.classGroupId},wke=/^\[(.+)\]$/,Dbt=t=>{if(wke.test(t)){let e=wke.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},$bt=t=>{let{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return Ubt(Object.entries(t.classGroups),n).forEach(([i,s])=>{Zte(s,r,i,e)}),r},Zte=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:vke(e,o);i.classGroupId=n;return}if(typeof o=="function"){if(Fbt(o)){Zte(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Zte(s,vke(e,i),n,r)})})},vke=(t,e)=>{let n=t;return e.split(Jte).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Fbt=t=>t.isThemeGetter,Ubt=(t,e)=>e?t.map(([n,r])=>{let o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[e+s,a])):i);return[n,o]}):t,Bbt=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map,o=(i,s)=>{n.set(i,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},_ke="!",zbt=t=>{let{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],i=e.length,s=a=>{let l=[],c=0,u=0,d;for(let g=0;gu?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}};return n?a=>n({className:a,parseClassName:s}):s},jbt=t=>{if(t.length<=1)return t;let e=[],n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},Vbt=t=>({cache:Bbt(t.cacheSize),parseClassName:zbt(t),...Lbt(t)}),Wbt=/\s+/,Hbt=(t,e)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=t.trim().split(Wbt),a="";for(let l=s.length-1;l>=0;l-=1){let c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(c),m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){a=c+(a.length>0?" "+a:a);continue}if(h=r(f),!h){a=c+(a.length>0?" "+a:a);continue}m=!1}let g=jbt(u).join(":"),y=d?g+_ke:g,w=y+h;if(i.includes(w))continue;i.push(w);let v=o(h,m);for(let x=0;x0?" "+a:a)}return a};Ske=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let e=n=>n[t]||[];return e.isThemeGetter=!0,e},Tke=/^\[(?:([a-z-]+):)?(.+)\]$/i,qbt=/^\d+\/\d+$/,Gbt=new Set(["px","full","screen"]),Ybt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zbt=/\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$/,Jbt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Xbt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qbt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tw=t=>FA(t)||Gbt.has(t)||qbt.test(t),Zx=t=>UA(t,"length",aCt),FA=t=>!!t&&!Number.isNaN(Number(t)),Yte=t=>UA(t,"number",FA),o$=t=>!!t&&Number.isInteger(Number(t)),eCt=t=>t.endsWith("%")&&FA(t.slice(0,-1)),er=t=>Tke.test(t),Jx=t=>Ybt.test(t),tCt=new Set(["length","size","percentage"]),nCt=t=>UA(t,tCt,Ike),rCt=t=>UA(t,"position",Ike),oCt=new Set(["image","url"]),iCt=t=>UA(t,oCt,cCt),sCt=t=>UA(t,"",lCt),i$=()=>!0,UA=(t,e,n)=>{let r=Tke.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},aCt=t=>Zbt.test(t)&&!Jbt.test(t),Ike=()=>!1,lCt=t=>Xbt.test(t),cCt=t=>Qbt.test(t),bke=()=>{let t=Ko("colors"),e=Ko("spacing"),n=Ko("blur"),r=Ko("brightness"),o=Ko("borderColor"),i=Ko("borderRadius"),s=Ko("borderSpacing"),a=Ko("borderWidth"),l=Ko("contrast"),c=Ko("grayscale"),u=Ko("hueRotate"),d=Ko("invert"),f=Ko("gap"),p=Ko("gradientColorStops"),m=Ko("gradientColorStopPositions"),h=Ko("inset"),g=Ko("margin"),y=Ko("opacity"),w=Ko("padding"),v=Ko("saturate"),x=Ko("scale"),b=Ko("sepia"),_=Ko("skew"),T=Ko("space"),S=Ko("translate"),P=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",er,e],D=()=>[er,e],$=()=>["",tw,Zx],B=()=>["auto",FA,er],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",er],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[FA,er];return{cacheSize:500,separator:":",theme:{colors:[i$],spacing:[tw,Zx],blur:["none","",Jx,er],brightness:fe(),borderColor:[t],borderRadius:["none","","full",Jx,er],borderSpacing:D(),borderWidth:$(),contrast:fe(),grayscale:H(),hueRotate:fe(),invert:H(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[eCt,Zx],inset:O(),margin:O(),opacity:fe(),padding:D(),saturate:fe(),scale:fe(),sepia:H(),skew:fe(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",er]}],container:["container"],columns:[{columns:[Jx]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"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:[...W(),er]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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",o$,er]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",er]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",o$,er]}],"grid-cols":[{"grid-cols":[i$]}],"col-start-end":[{col:["auto",{span:["full",o$,er]},er]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[i$]}],"row-start-end":[{row:["auto",{span:[o$,er]},er]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",er]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",er]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...V()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...V(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...V(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",er,e]}],"min-w":[{"min-w":[er,e,"min","max","fit"]}],"max-w":[{"max-w":[er,e,"none","full","min","max","fit","prose",{screen:[Jx]},Jx]}],h:[{h:[er,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[er,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[er,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[er,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Jx,Zx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Yte]}],"font-family":[{font:[i$]}],"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",er]}],"line-clamp":[{"line-clamp":["none",FA,Yte]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",tw,er]}],"list-image":[{"list-image":["none",er]}],"list-style-type":[{list:["none","disc","decimal",er]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",tw,Zx]}],"underline-offset":[{"underline-offset":["auto",tw,er]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",er]}],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",er]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),rCt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nCt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iCt]}],"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:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:F()}],"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:["",...F()]}],"outline-offset":[{"outline-offset":[tw,er]}],"outline-w":[{outline:[tw,Zx]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[tw,Zx]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Jx,sCt]}],"shadow-color":[{shadow:[i$]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Jx,er]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[b]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[b]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",er]}],duration:[{duration:fe()}],ease:[{ease:["linear","in","out","in-out",er]}],delay:[{delay:fe()}],animate:[{animate:["none","spin","ping","pulse","bounce",er]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[o$,er]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",er]}],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",er]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",er]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[tw,Zx,Yte]}],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"]}}},uCt=(t,{cacheSize:e,prefix:n,separator:r,experimentalParseClassName:o,extend:i={},override:s={}})=>{s$(t,"cacheSize",e),s$(t,"prefix",n),s$(t,"separator",r),s$(t,"experimentalParseClassName",o);for(let a in s)dCt(t[a],s[a]);for(let a in i)fCt(t[a],i[a]);return t},s$=(t,e,n)=>{n!==void 0&&(t[e]=n)},dCt=(t,e)=>{if(e)for(let n in e)s$(t,n,e[n])},fCt=(t,e)=>{if(e)for(let n in e){let r=e[n];r!==void 0&&(t[n]=(t[n]||[]).concat(r))}},Pke=(t,...e)=>typeof t=="function"?xke(bke,t,...e):xke(()=>uCt(bke(),t),...e)});function oe(...t){return pCt(ZW(t))}var pCt,Kt=C(()=>{Gte();Eke();pCt=Pke({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 XW,mCt,X,rn=C(()=>{XW=N(U());mke();JW();Kt();mCt=$A("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"}}),X=XW.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...o},i)=>XW.createElement(r?pke:"button",{className:oe(mCt({variant:e,size:n,className:t})),ref:i,...o}));X.displayName="Button"});var Ake,QW,Xte=C(()=>{Ake=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),QW=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim()});var kke,Mke=C(()=>{kke={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 a$,Nke,Oke=C(()=>{a$=N(U());Mke();Xte();Nke=(0,a$.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>(0,a$.createElement)("svg",{ref:l,...kke,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:QW("lucide",o),...a},[...s.map(([c,u])=>(0,a$.createElement)(c,u)),...Array.isArray(i)?i:[i]]))});var eH,ie,je=C(()=>{eH=N(U());Xte();Oke();ie=(t,e)=>{let n=(0,eH.forwardRef)(({className:r,...o},i)=>(0,eH.createElement)(Nke,{ref:i,iconNode:e,className:QW(`lucide-${Ake(t)}`,r),...o}));return n.displayName=`${t}`,n}});var BA,Rke=C(()=>{je();BA=ie("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var l$,Lke=C(()=>{je();l$=ie("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var Oc,Dke=C(()=>{je();Oc=ie("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])});var c$,$ke=C(()=>{je();c$=ie("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])});var zA,Fke=C(()=>{je();zA=ie("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 Ro,Uke=C(()=>{je();Ro=ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var hr,Bke=C(()=>{je();hr=ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var Di,zke=C(()=>{je();Di=ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var $s,jke=C(()=>{je();$s=ie("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var Fs,Vke=C(()=>{je();Fs=ie("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 Pu,Wke=C(()=>{je();Pu=ie("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 vm,Hke=C(()=>{je();vm=ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])});var nw,Kke=C(()=>{je();nw=ie("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 Uf,qke=C(()=>{je();Uf=ie("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 Md,Gke=C(()=>{je();Md=ie("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var Xx,Yke=C(()=>{je();Xx=ie("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var sg,Zke=C(()=>{je();sg=ie("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 u$,Jke=C(()=>{je();u$=ie("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var KS,Xke=C(()=>{je();KS=ie("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 jA,Qke=C(()=>{je();jA=ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])});var d$,eMe=C(()=>{je();d$=ie("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 f$,tMe=C(()=>{je();f$=ie("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 Qx,nMe=C(()=>{je();Qx=ie("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 VA,rMe=C(()=>{je();VA=ie("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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 Eu,oMe=C(()=>{je();Eu=ie("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 ag,iMe=C(()=>{je();ag=ie("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var p$,sMe=C(()=>{je();p$=ie("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 xm,aMe=C(()=>{je();xm=ie("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 m$,lMe=C(()=>{je();m$=ie("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 lg,cMe=C(()=>{je();lg=ie("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 eb,uMe=C(()=>{je();eb=ie("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 rw,dMe=C(()=>{je();rw=ie("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 h$,fMe=C(()=>{je();h$=ie("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 ow,pMe=C(()=>{je();ow=ie("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 g$,mMe=C(()=>{je();g$=ie("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 iw,hMe=C(()=>{je();iw=ie("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 qS,gMe=C(()=>{je();qS=ie("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 y$,yMe=C(()=>{je();y$=ie("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 w$,wMe=C(()=>{je();w$=ie("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 Ur,vMe=C(()=>{je();Ur=ie("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 GS,xMe=C(()=>{je();GS=ie("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 v$,bMe=C(()=>{je();v$=ie("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])});var es,CMe=C(()=>{je();es=ie("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 Br,_Me=C(()=>{je();Br=ie("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 bm,SMe=C(()=>{je();bm=ie("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 cg,TMe=C(()=>{je();cg=ie("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 x$,IMe=C(()=>{je();x$=ie("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 b$,PMe=C(()=>{je();b$=ie("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 ug,EMe=C(()=>{je();ug=ie("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 C$,AMe=C(()=>{je();C$=ie("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 YS,kMe=C(()=>{je();YS=ie("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 Cm,MMe=C(()=>{je();Cm=ie("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 _$,NMe=C(()=>{je();_$=ie("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]])});var Pr,OMe=C(()=>{je();Pr=ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var tb,RMe=C(()=>{je();tb=ie("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]])});var S$,LMe=C(()=>{je();S$=ie("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 WA,DMe=C(()=>{je();WA=ie("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])});var T$,$Me=C(()=>{je();T$=ie("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 HA,FMe=C(()=>{je();HA=ie("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 KA,UMe=C(()=>{je();KA=ie("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 Bf,BMe=C(()=>{je();Bf=ie("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 Rc,zMe=C(()=>{je();Rc=ie("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 nb,jMe=C(()=>{je();nb=ie("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 rb,VMe=C(()=>{je();rb=ie("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 I$,WMe=C(()=>{je();I$=ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])});var Lc,HMe=C(()=>{je();Lc=ie("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var P$,KMe=C(()=>{je();P$=ie("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 zf,qMe=C(()=>{je();zf=ie("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 E$,GMe=C(()=>{je();E$=ie("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 A$,YMe=C(()=>{je();A$=ie("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 k$,ZMe=C(()=>{je();k$=ie("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 ZS,JMe=C(()=>{je();ZS=ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var JS,XMe=C(()=>{je();JS=ie("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 XS,QMe=C(()=>{je();XS=ie("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 sw,eNe=C(()=>{je();sw=ie("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])});var M$,tNe=C(()=>{je();M$=ie("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]])});var ql,nNe=C(()=>{je();ql=ie("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 aw,rNe=C(()=>{je();aw=ie("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 Au,oNe=C(()=>{je();Au=ie("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 QS,iNe=C(()=>{je();QS=ie("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])});var _m,sNe=C(()=>{je();_m=ie("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 N$,aNe=C(()=>{je();N$=ie("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 ka,lNe=C(()=>{je();ka=ie("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 dl,cNe=C(()=>{je();dl=ie("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 Nd,uNe=C(()=>{je();Nd=ie("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 Sn,dNe=C(()=>{je();Sn=ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var O$,fNe=C(()=>{je();O$=ie("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 R$,pNe=C(()=>{je();R$=ie("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 vt=C(()=>{Vke();Wke();Hke();qke();Gke();Yke();Zke();cMe();uMe();OMe();RMe();BMe();zMe();nNe();rNe();oNe();cNe();Rke();Lke();Dke();$ke();Fke();Uke();Bke();zke();jke();Kke();Jke();Xke();Qke();eMe();tMe();nMe();rMe();oMe();iMe();sMe();aMe();lMe();dMe();fMe();pMe();mMe();hMe();gMe();yMe();wMe();vMe();xMe();bMe();CMe();_Me();SMe();TMe();IMe();PMe();EMe();AMe();kMe();MMe();NMe();LMe();DMe();$Me();FMe();UMe();jMe();VMe();WMe();HMe();KMe();qMe();GMe();YMe();ZMe();JMe();XMe();QMe();eNe();tNe();iNe();sNe();aNe();lNe();uNe();dNe();fNe();pNe();});function tr(){let t=L$.useContext(D$);if(!t)throw new Error("useApp() called outside of an ");return t}var L$,D$,qA,bi=C(()=>{L$=N(U()),D$=L$.createContext(void 0),qA=L$.createContext(void 0)});var _Ne=Tt(Lo=>{"use strict";function nne(t,e){var n=t.length;t.push(e);e:for(;0>>1,o=t[r];if(0>>1;rtH(a,n))ltH(c,a)?(t[r]=c,t[l]=n,r=l):(t[r]=a,t[s]=n,r=s);else if(ltH(c,n))t[r]=c,t[l]=n,r=l;else break e}}return e}function tH(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(mNe=performance,Lo.unstable_now=function(){return mNe.now()}):(Qte=Date,hNe=Qte.now(),Lo.unstable_now=function(){return Qte.now()-hNe});var mNe,Qte,hNe,dg=[],ob=[],hCt=1,jf=null,Gl=3,oH=!1,eT=!1,F$=!1,wNe=typeof setTimeout=="function"?setTimeout:null,vNe=typeof clearTimeout=="function"?clearTimeout:null,gNe=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function rne(t){for(var e=Sm(ob);e!==null;){if(e.callback===null)rH(ob);else if(e.startTime<=t)rH(ob),e.sortIndex=e.expirationTime,nne(dg,e);else break;e=Sm(ob)}}function one(t){if(F$=!1,rne(t),!eT)if(Sm(dg)!==null)eT=!0,sne(ine);else{var e=Sm(ob);e!==null&&ane(one,e.startTime-t)}}function ine(t,e){eT=!1,F$&&(F$=!1,vNe(U$),U$=-1),oH=!0;var n=Gl;try{for(rne(e),jf=Sm(dg);jf!==null&&(!(jf.expirationTime>e)||t&&!CNe());){var r=jf.callback;if(typeof r=="function"){jf.callback=null,Gl=jf.priorityLevel;var o=r(jf.expirationTime<=e);e=Lo.unstable_now(),typeof o=="function"?jf.callback=o:jf===Sm(dg)&&rH(dg),rne(e)}else rH(dg);jf=Sm(dg)}if(jf!==null)var i=!0;else{var s=Sm(ob);s!==null&&ane(one,s.startTime-e),i=!1}return i}finally{jf=null,Gl=n,oH=!1}}var iH=!1,nH=null,U$=-1,xNe=5,bNe=-1;function CNe(){return!(Lo.unstable_now()-bNet||125r?(t.sortIndex=n,nne(ob,t),Sm(dg)===null&&t===Sm(ob)&&(F$?(vNe(U$),U$=-1):F$=!0,ane(one,n-r))):(t.sortIndex=o,nne(dg,t),eT||oH||(eT=!0,sne(ine))),t};Lo.unstable_shouldYield=CNe;Lo.unstable_wrapCallback=function(t){var e=Gl;return function(){var n=Gl;Gl=e;try{return t.apply(this,arguments)}finally{Gl=n}}}});var TNe=Tt((upn,SNe)=>{"use strict";SNe.exports=_Ne()});var MLe=Tt(Fd=>{"use strict";var NOe=U(),Dd=TNe();function Be(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kne=Object.prototype.hasOwnProperty,gCt=/^[: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]*$/,INe={},PNe={};function yCt(t){return kne.call(PNe,t)?!0:kne.call(INe,t)?!1:gCt.test(t)?PNe[t]=!0:(INe[t]=!0,!1)}function wCt(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function vCt(t,e,n,r){if(e===null||typeof e>"u"||wCt(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 Fc(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var ml={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ml[t]=new Fc(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ml[e]=new Fc(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ml[t]=new Fc(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ml[t]=new Fc(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){ml[t]=new Fc(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ml[t]=new Fc(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ml[t]=new Fc(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ml[t]=new Fc(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ml[t]=new Fc(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cre=/[\-:]([a-z])/g;function _re(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(Cre,_re);ml[e]=new Fc(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(Cre,_re);ml[e]=new Fc(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(Cre,_re);ml[e]=new Fc(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ml[t]=new Fc(t,1,!1,t.toLowerCase(),null,!1,!1)});ml.xlinkHref=new Fc("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ml[t]=new Fc(t,1,!1,t.toLowerCase(),null,!0,!0)});function Sre(t,e,n,r){var o=ml.hasOwnProperty(e)?ml[e]:null;(o!==null?o.type!==0:r||!(2a||o[s]!==i[a]){var l=` `+o[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{cne=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?G$(t):""}function xCt(t){switch(t.tag){case 5:return G$(t.type);case 16:return G$("Lazy");case 13:return G$("Suspense");case 19:return G$("SuspenseList");case 0:case 2:case 15:return t=une(t.type,!1),t;case 11:return t=une(t.type.render,!1),t;case 1:return t=une(t.type,!0),t;default:return""}}function Rne(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 JA:return"Fragment";case ZA:return"Portal";case Mne:return"Profiler";case Tre:return"StrictMode";case Nne:return"Suspense";case One:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case LOe:return(t.displayName||"Context")+".Consumer";case ROe:return(t._context.displayName||"Context")+".Provider";case Ire:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pre:return e=t.displayName||null,e!==null?e:Rne(t.type)||"Memo";case sb:e=t._payload,t=t._init;try{return Rne(t(e))}catch{}}return null}function bCt(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 Rne(e);case 8:return e===Tre?"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 xb(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function $Oe(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function CCt(t){var e=$Oe(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function aH(t){t._valueTracker||(t._valueTracker=CCt(t))}function FOe(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=$Oe(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function LH(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 Lne(t,e){var n=e.checked;return Si({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ANe(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=xb(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function UOe(t,e){e=e.checked,e!=null&&Sre(t,"checked",e,!1)}function Dne(t,e){UOe(t,e);var n=xb(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?$ne(t,e.type,n):e.hasOwnProperty("defaultValue")&&$ne(t,e.type,xb(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function kNe(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function $ne(t,e,n){(e!=="number"||LH(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Y$=Array.isArray;function lk(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o"+e.valueOf().toString()+"",e=lH.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function lF(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var X$={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},_Ct=["Webkit","ms","Moz","O"];Object.keys(X$).forEach(function(t){_Ct.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),X$[e]=X$[t]})});function VOe(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||X$.hasOwnProperty(t)&&X$[t]?(""+e).trim():e+"px"}function WOe(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=VOe(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var SCt=Si({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 Bne(t,e){if(e){if(SCt[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Be(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Be(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Be(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Be(62))}}function zne(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 jne=null;function Ere(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vne=null,ck=null,uk=null;function ONe(t){if(t=IF(t)){if(typeof Vne!="function")throw Error(Be(280));var e=t.stateNode;e&&(e=c6(e),Vne(t.stateNode,t.type,e))}}function HOe(t){ck?uk?uk.push(t):uk=[t]:ck=t}function KOe(){if(ck){var t=ck,e=uk;if(uk=ck=null,ONe(t),e)for(t=0;t>>=0,t===0?32:31-(LCt(t)/DCt|0)|0}var cH=64,uH=4194304;function Z$(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 UH(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Z$(a):(i&=s,i!==0&&(r=Z$(i)))}else s=n&~o,s!==0?r=Z$(s):i!==0&&(r=Z$(i));if(r===0)return 0;if(e!==0&&e!==r&&(e&o)===0&&(o=r&-r,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if((r&4)!==0&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function SF(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Am(e),t[e]=n}function BCt(t,e){var n=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 r=t.eventTimes;for(t=t.expirationTimes;0=eF),jNe=" ",VNe=!1;function fRe(t,e){switch(t){case"keyup":return m_t.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pRe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var XA=!1;function g_t(t,e){switch(t){case"compositionend":return pRe(e);case"keypress":return e.which!==32?null:(VNe=!0,jNe);case"textInput":return t=e.data,t===jNe&&VNe?null:t;default:return null}}function y_t(t,e){if(XA)return t==="compositionend"||!Dre&&fRe(t,e)?(t=uRe(),IH=Ore=ub=null,XA=!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)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=KNe(n)}}function yRe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?yRe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function wRe(){for(var t=window,e=LH();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=LH(t.document)}return e}function $re(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 I_t(t){var e=wRe(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&yRe(n.ownerDocument.documentElement,n)){if(r!==null&&$re(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=qNe(n,i);var s=qNe(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,QA=null,Yne=null,nF=null,Zne=!1;function GNe(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zne||QA==null||QA!==LH(r)||(r=QA,"selectionStart"in r&&$re(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),nF&&mF(nF,r)||(nF=r,r=jH(Yne,"onSelect"),0nk||(t.current=nre[nk],nre[nk]=null,nk--)}function Do(t,e){nk++,nre[nk]=t.current,t.current=e}var bb={},Xl=_b(bb),Nu=_b(!1),lT=bb;function hk(t,e){var n=t.type.contextTypes;if(!n)return bb;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Ou(t){return t=t.childContextTypes,t!=null}function WH(){Go(Nu),Go(Xl)}function rOe(t,e,n){if(Xl.current!==bb)throw Error(Be(168));Do(Xl,e),Do(Nu,n)}function PRe(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error(Be(108,bCt(t)||"Unknown",o));return Si({},n,r)}function HH(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||bb,lT=Xl.current,Do(Xl,t),Do(Nu,Nu.current),!0}function oOe(t,e,n){var r=t.stateNode;if(!r)throw Error(Be(169));n?(t=PRe(t,e,lT),r.__reactInternalMemoizedMergedChildContext=t,Go(Nu),Go(Xl),Do(Xl,t)):Go(Nu),Do(Nu,n)}var cw=null,u6=!1,bne=!1;function ERe(t){cw===null?cw=[t]:cw.push(t)}function D_t(t){u6=!0,ERe(t)}function Sb(){if(!bne&&cw!==null){bne=!0;var t=0,e=po;try{var n=cw;for(po=1;t>=s,o-=s,uw=1<<32-Am(e)+o|n<S?(P=T,T=null):P=T.sibling;var A=f(y,T,v[S],x);if(A===null){T===null&&(T=P);break}t&&T&&A.alternate===null&&e(y,T),w=i(A,w,S),_===null?b=A:_.sibling=A,_=A,T=P}if(S===v.length)return n(y,T),li&&tT(y,S),b;if(T===null){for(;SS?(P=T,T=null):P=T.sibling;var O=f(y,T,A.value,x);if(O===null){T===null&&(T=P);break}t&&T&&O.alternate===null&&e(y,T),w=i(O,w,S),_===null?b=O:_.sibling=O,_=O,T=P}if(A.done)return n(y,T),li&&tT(y,S),b;if(T===null){for(;!A.done;S++,A=v.next())A=d(y,A.value,x),A!==null&&(w=i(A,w,S),_===null?b=A:_.sibling=A,_=A);return li&&tT(y,S),b}for(T=r(y,T);!A.done;S++,A=v.next())A=p(T,y,S,A.value,x),A!==null&&(t&&A.alternate!==null&&T.delete(A.key===null?S:A.key),w=i(A,w,S),_===null?b=A:_.sibling=A,_=A);return t&&T.forEach(function(D){return e(y,D)}),li&&tT(y,S),b}function g(y,w,v,x){if(typeof v=="object"&&v!==null&&v.type===JA&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case sH:e:{for(var b=v.key,_=w;_!==null;){if(_.key===b){if(b=v.type,b===JA){if(_.tag===7){n(y,_.sibling),w=o(_,v.props.children),w.return=y,y=w;break e}}else if(_.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===sb&&dOe(b)===_.type){n(y,_.sibling),w=o(_,v.props),w.ref=W$(y,_,v),w.return=y,y=w;break e}n(y,_);break}else e(y,_);_=_.sibling}v.type===JA?(w=aT(v.props.children,y.mode,x,v.key),w.return=y,y=w):(x=RH(v.type,v.key,v.props,null,y.mode,x),x.ref=W$(y,w,v),x.return=y,y=x)}return s(y);case ZA:e:{for(_=v.key;w!==null;){if(w.key===_)if(w.tag===4&&w.stateNode.containerInfo===v.containerInfo&&w.stateNode.implementation===v.implementation){n(y,w.sibling),w=o(w,v.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=Ane(v,y.mode,x),w.return=y,y=w}return s(y);case sb:return _=v._init,g(y,w,_(v._payload),x)}if(Y$(v))return m(y,w,v,x);if(B$(v))return h(y,w,v,x);bH(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,w!==null&&w.tag===6?(n(y,w.sibling),w=o(w,v),w.return=y,y=w):(n(y,w),w=Ene(v,y.mode,x),w.return=y,y=w),s(y)):n(y,w)}return g}var yk=DRe(!0),$Re=DRe(!1),PF={},gg=_b(PF),wF=_b(PF),vF=_b(PF);function iT(t){if(t===PF)throw Error(Be(174));return t}function Kre(t,e){switch(Do(vF,e),Do(wF,t),Do(gg,PF),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Une(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Une(e,t)}Go(gg),Do(gg,e)}function wk(){Go(gg),Go(wF),Go(vF)}function FRe(t){iT(vF.current);var e=iT(gg.current),n=Une(e,t.type);e!==n&&(Do(wF,t),Do(gg,n))}function qre(t){wF.current===t&&(Go(gg),Go(wF))}var Ci=_b(0);function JH(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 Cne=[];function Gre(){for(var t=0;tn?n:4,t(!0);var r=_ne.transition;_ne.transition={};try{t(!1),e()}finally{po=n,_ne.transition=r}}function eLe(){return Gf().memoizedState}function B_t(t,e,n){var r=wb(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tLe(t))nLe(e,n);else if(n=NRe(t,e,n,r),n!==null){var o=$c();km(n,t,r,o),rLe(n,e,r)}}function z_t(t,e,n){var r=wb(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tLe(t))nLe(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Mm(a,s)){var l=e.interleaved;l===null?(o.next=o,Wre(e)):(o.next=l.next,l.next=o),e.interleaved=o;return}}catch{}finally{}n=NRe(t,e,o,r),n!==null&&(o=$c(),km(n,t,r,o),rLe(n,e,r))}}function tLe(t){var e=t.alternate;return t===_i||e!==null&&e===_i}function nLe(t,e){rF=XH=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function rLe(t,e,n){if((n&4194240)!==0){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,kre(t,n)}}var QH={readContext:qf,useCallback:Yl,useContext:Yl,useEffect:Yl,useImperativeHandle:Yl,useInsertionEffect:Yl,useLayoutEffect:Yl,useMemo:Yl,useReducer:Yl,useRef:Yl,useState:Yl,useDebugValue:Yl,useDeferredValue:Yl,useTransition:Yl,useMutableSource:Yl,useSyncExternalStore:Yl,useId:Yl,unstable_isNewReconciler:!1},j_t={readContext:qf,useCallback:function(t,e){return pg().memoizedState=[t,e===void 0?null:e],t},useContext:qf,useEffect:pOe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,kH(4194308,4,YRe.bind(null,e,t),n)},useLayoutEffect:function(t,e){return kH(4194308,4,t,e)},useInsertionEffect:function(t,e){return kH(4,2,t,e)},useMemo:function(t,e){var n=pg();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=pg();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=B_t.bind(null,_i,t),[r.memoizedState,t]},useRef:function(t){var e=pg();return t={current:t},e.memoizedState=t},useState:fOe,useDebugValue:Qre,useDeferredValue:function(t){return pg().memoizedState=t},useTransition:function(){var t=fOe(!1),e=t[0];return t=U_t.bind(null,t[1]),pg().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=_i,o=pg();if(li){if(n===void 0)throw Error(Be(407));n=n()}else{if(n=e(),Na===null)throw Error(Be(349));(uT&30)!==0||zRe(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,pOe(VRe.bind(null,r,i,t),[t]),r.flags|=2048,CF(9,jRe.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=pg(),e=Na.identifierPrefix;if(li){var n=dw,r=uw;n=(r&~(1<<32-Am(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=xF++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[mg]=e,t[yF]=r,fLe(t,e,!1,!1),e.stateNode=t;e:{switch(s=zne(n,r),n){case"dialog":qo("cancel",t),qo("close",t),o=r;break;case"iframe":case"object":case"embed":qo("load",t),o=r;break;case"video":case"audio":for(o=0;oxk&&(e.flags|=128,r=!0,H$(i,!1),e.lanes=4194304)}else{if(!r)if(t=JH(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),H$(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!li)return Zl(e),null}else 2*ts()-i.renderingStartTime>xk&&n!==1073741824&&(e.flags|=128,r=!0,H$(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=ts(),e.sibling=null,n=Ci.current,Do(Ci,r?n&1|2:n&1),e):(Zl(e),null);case 22:case 23:return ioe(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&(e.mode&1)!==0?(Od&1073741824)!==0&&(Zl(e),e.subtreeFlags&6&&(e.flags|=8192)):Zl(e),null;case 24:return null;case 25:return null}throw Error(Be(156,e.tag))}function Z_t(t,e){switch(Ure(e),e.tag){case 1:return Ou(e.type)&&WH(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return wk(),Go(Nu),Go(Xl),Gre(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return qre(e),null;case 13:if(Go(Ci),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Be(340));gk()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Go(Ci),null;case 4:return wk(),null;case 10:return Vre(e.type._context),null;case 22:case 23:return ioe(),null;case 24:return null;default:return null}}var _H=!1,Jl=!1,J_t=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function sk(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$i(t,e,r)}else n.current=null}function mre(t,e,n){try{n()}catch(r){$i(t,e,r)}}var COe=!1;function X_t(t,e){if(Jne=BH,t=wRe(),$re(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++c===o&&(a=s),f===i&&++u===r&&(l=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Xne={focusedElem:t,selectionRange:n},BH=!1,Lt=e;Lt!==null;)if(e=Lt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Lt=t;else for(;Lt!==null;){e=Lt;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,g=m.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?h:Im(e.type,h),g);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Be(163))}}catch(x){$i(e,e.return,x)}if(t=e.sibling,t!==null){t.return=e.return,Lt=t;break}Lt=e.return}return m=COe,COe=!1,m}function oF(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&mre(e,n,i)}o=o.next}while(o!==r)}}function p6(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function hre(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function hLe(t){var e=t.alternate;e!==null&&(t.alternate=null,hLe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[mg],delete e[yF],delete e[tre],delete e[R_t],delete e[L_t])),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 gLe(t){return t.tag===5||t.tag===3||t.tag===4}function _Oe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gLe(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 gre(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=VH));else if(r!==4&&(t=t.child,t!==null))for(gre(t,e,n),t=t.sibling;t!==null;)gre(t,e,n),t=t.sibling}function yre(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(yre(t,e,n),t=t.sibling;t!==null;)yre(t,e,n),t=t.sibling}var fl=null,Pm=!1;function ib(t,e,n){for(n=n.child;n!==null;)yLe(t,e,n),n=n.sibling}function yLe(t,e,n){if(hg&&typeof hg.onCommitFiberUnmount=="function")try{hg.onCommitFiberUnmount(i6,n)}catch{}switch(n.tag){case 5:Jl||sk(n,e);case 6:var r=fl,o=Pm;fl=null,ib(t,e,n),fl=r,Pm=o,fl!==null&&(Pm?(t=fl,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):fl.removeChild(n.stateNode));break;case 18:fl!==null&&(Pm?(t=fl,n=n.stateNode,t.nodeType===8?xne(t.parentNode,n):t.nodeType===1&&xne(t,n),fF(t)):xne(fl,n.stateNode));break;case 4:r=fl,o=Pm,fl=n.stateNode.containerInfo,Pm=!0,ib(t,e,n),fl=r,Pm=o;break;case 0:case 11:case 14:case 15:if(!Jl&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&((i&2)!==0||(i&4)!==0)&&mre(n,e,s),o=o.next}while(o!==r)}ib(t,e,n);break;case 1:if(!Jl&&(sk(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){$i(n,e,a)}ib(t,e,n);break;case 21:ib(t,e,n);break;case 22:n.mode&1?(Jl=(r=Jl)||n.memoizedState!==null,ib(t,e,n),Jl=r):ib(t,e,n);break;default:ib(t,e,n)}}function SOe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new J_t),e.forEach(function(r){var o=aSt.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Tm(t,e){var n=e.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=ts()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*eSt(r/1960))-r,10t?16:t,db===null)var r=!1;else{if(t=db,db=null,n6=0,(zr&6)!==0)throw Error(Be(331));var o=zr;for(zr|=4,Lt=t.current;Lt!==null;){var i=Lt,s=i.child;if((Lt.flags&16)!==0){var a=i.deletions;if(a!==null){for(var l=0;lts()-roe?sT(t,0):noe|=n),Ru(t,e)}function TLe(t,e){e===0&&((t.mode&1)===0?e=1:(e=uH,uH<<=1,(uH&130023424)===0&&(uH=4194304)));var n=$c();t=hw(t,e),t!==null&&(SF(t,e,n),Ru(t,n))}function sSt(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),TLe(t,n)}function aSt(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Be(314))}r!==null&&r.delete(e),TLe(t,n)}var ILe;ILe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Nu.current)Mu=!0;else{if((t.lanes&n)===0&&(e.flags&128)===0)return Mu=!1,G_t(t,e,n);Mu=(t.flags&131072)!==0}else Mu=!1,li&&(e.flags&1048576)!==0&&ARe(e,qH,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;MH(t,e),t=e.pendingProps;var o=hk(e,Xl.current);fk(e,n),o=Zre(null,e,r,t,o,n);var i=Jre();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,Ou(r)?(i=!0,HH(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Hre(e),o.updater=d6,e.stateNode=o,o._reactInternals=e,are(e,r,t,n),e=ure(null,e,r,!0,i,n)):(e.tag=0,li&&i&&Fre(e),Dc(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(MH(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=cSt(r),t=Im(r,t),o){case 0:e=cre(null,e,r,t,n);break e;case 1:e=vOe(null,e,r,t,n);break e;case 11:e=yOe(null,e,r,t,n);break e;case 14:e=wOe(null,e,r,Im(r.type,t),n);break e}throw Error(Be(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Im(r,o),cre(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Im(r,o),vOe(t,e,r,o,n);case 3:e:{if(cLe(e),t===null)throw Error(Be(387));r=e.pendingProps,i=e.memoizedState,o=i.element,ORe(t,e),ZH(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=vk(Error(Be(423)),e),e=xOe(t,e,r,n,o);break e}else if(r!==o){o=vk(Error(Be(424)),e),e=xOe(t,e,r,n,o);break e}else for(Rd=hb(e.stateNode.containerInfo.firstChild),Ld=e,li=!0,Em=null,n=$Re(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(gk(),r===o){e=gw(t,e,n);break e}Dc(t,e,r,n)}e=e.child}return e;case 5:return FRe(e),t===null&&ore(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,Qne(r,o)?s=null:i!==null&&Qne(r,i)&&(e.flags|=32),lLe(t,e),Dc(t,e,s,n),e.child;case 6:return t===null&&ore(e),null;case 13:return uLe(t,e,n);case 4:return Kre(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=yk(e,null,r,n):Dc(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Im(r,o),yOe(t,e,r,o,n);case 7:return Dc(t,e,e.pendingProps,n),e.child;case 8:return Dc(t,e,e.pendingProps.children,n),e.child;case 12:return Dc(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Do(GH,r._currentValue),r._currentValue=s,i!==null)if(Mm(i.value,s)){if(i.children===o.children&&!Nu.current){e=gw(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=fw(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),ire(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Be(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ire(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Dc(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,fk(e,n),o=qf(o),r=r(o),e.flags|=1,Dc(t,e,r,n),e.child;case 14:return r=e.type,o=Im(r,e.pendingProps),o=Im(r.type,o),wOe(t,e,r,o,n);case 15:return sLe(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Im(r,o),MH(t,e),e.tag=1,Ou(r)?(t=!0,HH(e)):t=!1,fk(e,n),LRe(e,r,o),are(e,r,o,n),ure(null,e,r,!0,t,n);case 19:return dLe(t,e,n);case 22:return aLe(t,e,n)}throw Error(Be(156,e.tag))};function PLe(t,e){return QOe(t,e)}function lSt(t,e,n,r){this.tag=t,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hf(t,e,n,r){return new lSt(t,e,n,r)}function aoe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function cSt(t){if(typeof t=="function")return aoe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Ire)return 11;if(t===Pre)return 14}return 2}function vb(t,e){var n=t.alternate;return n===null?(n=Hf(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function RH(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")aoe(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case JA:return aT(n.children,o,i,e);case Tre:s=8,o|=8;break;case Mne:return t=Hf(12,n,e,o|2),t.elementType=Mne,t.lanes=i,t;case Nne:return t=Hf(13,n,e,o),t.elementType=Nne,t.lanes=i,t;case One:return t=Hf(19,n,e,o),t.elementType=One,t.lanes=i,t;case DOe:return h6(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ROe:s=10;break e;case LOe:s=9;break e;case Ire:s=11;break e;case Pre:s=14;break e;case sb:s=16,r=null;break e}throw Error(Be(130,t==null?t:typeof t,""))}return e=Hf(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function aT(t,e,n,r){return t=Hf(7,t,r,e),t.lanes=n,t}function h6(t,e,n,r){return t=Hf(22,t,r,e),t.elementType=DOe,t.lanes=n,t.stateNode={isHidden:!1},t}function Ene(t,e,n){return t=Hf(6,t,null,e),t.lanes=n,t}function Ane(t,e,n){return e=Hf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function uSt(t,e,n,r,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=fne(0),this.expirationTimes=fne(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fne(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function loe(t,e,n,r,o,i,s,a,l){return t=new uSt(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Hf(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hre(i),t}function dSt(t,e,n){var r=3{"use strict";function NLe(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(NLe)}catch(t){console.error(t)}}NLe(),OLe.exports=MLe()});var LLe=Tt(foe=>{"use strict";var RLe=yo();foe.createRoot=RLe.createRoot,foe.hydrateRoot=RLe.hydrateRoot;var ppn});function sr(t,e){let n=(0,$Le.createRoot)(t);return{render(r){n.render(DLe.default.createElement(D$.Provider,{value:e},r))},unmount(){n.unmount()}}}var DLe,$Le,ws=C(()=>{bi();DLe=N(U()),$Le=N(LLe())});function gSt({onCancel:t}){let e=q(),n=poe(e.defaultModelKey)&&poe(e.embeddingModelKey);return yg.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},yg.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},yg.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),n&&yg.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.")),yg.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},yg.default.createElement(X,{variant:"ghost",onClick:t},"Close"),yg.default.createElement(X,{variant:"default",onClick:()=>{hT(Vy.EXPIRED_MODAL)}},"Renew Now ",yg.default.createElement(rw,{className:"tw-size-4"}))))}var yg,FLe,x6,ULe=C(()=>{yg=N(U()),FLe=require("obsidian");rn();ns();It();vt();Se();ws();x6=class extends FLe.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=sr(e,this.app);let n=()=>{this.close()};this.root.render(yg.default.createElement(gSt,{onCancel:n}))}onClose(){this.root.unmount()}}});var BLe,Dn,$n=C(()=>{BLe=Object.defineProperty,Dn=(t,e)=>{let n={};for(var r in t)BLe(n,r,{get:t[r],enumerable:!0});return e||BLe(n,Symbol.toStringTag,{value:"Module"}),n}});function ce(t,e,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(t),e(a,l);for(let u in s.prototype)u in a||Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}let o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function s(a){var l;let c=n?.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function vs(t){return t&&Object.assign(EF,t),EF}var moe,hoe,wg,EF,_k=C(()=>{moe=Object.freeze({status:"aborted"});hoe=Symbol("zod_brand"),wg=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},EF={}});var Qe={};zn(Qe,{BIGINT_FORMAT_RANGES:()=>Toe,Class:()=>yoe,NUMBER_FORMAT_RANGES:()=>Soe,aborted:()=>yT,allowsEval:()=>boe,assert:()=>bSt,assertEqual:()=>ySt,assertIs:()=>vSt,assertNever:()=>xSt,assertNotEqual:()=>wSt,assignProp:()=>xoe,cached:()=>MF,captureStackTrace:()=>b6,cleanEnum:()=>RSt,cleanRegex:()=>NF,clone:()=>xs,createTransparentProxy:()=>PSt,defineLazy:()=>Zr,esc:()=>gT,escapeRegex:()=>ww,extend:()=>kSt,finalizeIssue:()=>Ud,floatSafeRemainder:()=>voe,getElementAtPath:()=>CSt,getEnumValues:()=>kF,getLengthableOrigin:()=>LF,getParsedType:()=>ISt,getSizableOrigin:()=>RF,isObject:()=>Sk,isPlainObject:()=>Tk,issue:()=>Ioe,joinValues:()=>be,jsonStringifyReplacer:()=>woe,merge:()=>MSt,normalizeParams:()=>We,nullish:()=>Tb,numKeys:()=>TSt,omit:()=>ASt,optionalKeys:()=>_oe,partial:()=>NSt,pick:()=>ESt,prefixIssues:()=>Lu,primitiveTypes:()=>Coe,promiseAllObject:()=>_St,propertyKeyTypes:()=>OF,randomString:()=>SSt,required:()=>OSt,stringifyPrimitive:()=>ot,unwrapMessage:()=>AF});function ySt(t){return t}function wSt(t){return t}function vSt(t){}function xSt(t){throw new Error}function bSt(t){}function kF(t){let e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,o])=>e.indexOf(+r)===-1).map(([r,o])=>o)}function be(t,e="|"){return t.map(n=>ot(n)).join(e)}function woe(t,e){return typeof e=="bigint"?e.toString():e}function MF(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function Tb(t){return t==null}function NF(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function voe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}function Zr(t,e,n){Object.defineProperty(t,e,{get(){{let o=n();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function xoe(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function CSt(t,e){return e?e.reduce((n,r)=>n?.[r],t):t}function _St(t){let e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;ie};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 PSt(t){let e;return new Proxy({},{get(n,r,o){return e??(e=t()),Reflect.get(e,r,o)},set(n,r,o,i){return e??(e=t()),Reflect.set(e,r,o,i)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,o){return e??(e=t()),Reflect.defineProperty(e,r,o)}})}function ot(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _oe(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function ESt(t,e){let n={},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(n[o]=r.shape[o])}return xs(t,{...t._zod.def,shape:n,checks:[]})}function ASt(t,e){let n={...t._zod.def.shape},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete n[o]}return xs(t,{...t._zod.def,shape:n,checks:[]})}function kSt(t,e){if(!Tk(e))throw new Error("Invalid input to extend: expected a plain object");let n={...t._zod.def,get shape(){let r={...t._zod.def.shape,...e};return xoe(this,"shape",r),r},checks:[]};return xs(t,n)}function MSt(t,e){return xs(t,{...t._zod.def,get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return xoe(this,"shape",n),n},catchall:e._zod.def.catchall,checks:[]})}function NSt(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=t?new t({type:"optional",innerType:r[i]}):r[i])}else for(let i in r)o[i]=t?new t({type:"optional",innerType:r[i]}):r[i];return xs(e,{...e._zod.def,shape:o,checks:[]})}function OSt(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new t({type:"nonoptional",innerType:r[i]}))}else for(let i in r)o[i]=new t({type:"nonoptional",innerType:r[i]});return xs(e,{...e._zod.def,shape:o,checks:[]})}function yT(t,e=0){for(let n=e;n{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function AF(t){return typeof t=="string"?t:t?.message}function Ud(t,e,n){let r={...t,path:t.path??[]};if(!t.message){let o=AF(t.inst?._zod.def?.error?.(t))??AF(e?.error?.(t))??AF(n.customError?.(t))??AF(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function RF(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function LF(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ioe(...t){let[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function RSt(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var b6,boe,ISt,OF,Coe,Soe,Toe,yoe,An=C(()=>{b6=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};boe=MF(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});ISt=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}`)}},OF=new Set(["string","number","symbol"]),Coe=new Set(["string","number","bigint","boolean","symbol","undefined"]);Soe={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]},Toe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};yoe=class{constructor(...e){}}});function $F(t,e=n=>n.message){let n={},r=[];for(let o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}function FF(t,e){let n=e||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l{var a,l;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else{let u=[...s,...c.path];if(u.length===0){r.errors.push(n(c));continue}let d=r,f=0;for(;fr.path.length-o.path.length);for(let r of n)e.push(`\u2716 ${r.message}`),r.path?.length&&e.push(` \u2192 at ${jLe(r.path)}`);return e.join(` `)}var zLe,DF,Ik,Aoe=C(()=>{_k();An();zLe=(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,woe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},DF=ce("$ZodError",zLe),Ik=ce("$ZodError",zLe,{Parent:Error})});var C6,wT,_6,vT,S6,koe,T6,Moe,I6=C(()=>{_k();Aoe();An();C6=t=>(e,n,r,o)=>{let i=r?Object.assign(r,{async:!1}):{async:!1},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new wg;if(s.issues.length){let a=new(o?.Err??t)(s.issues.map(l=>Ud(l,i,vs())));throw b6(a,o?.callee),a}return s.value},wT=C6(Ik),_6=t=>async(e,n,r,o)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},s=e._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??t)(s.issues.map(l=>Ud(l,i,vs())));throw b6(a,o?.callee),a}return s.value},vT=_6(Ik),S6=t=>(e,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new wg;return i.issues.length?{success:!1,error:new(t??DF)(i.issues.map(s=>Ud(s,o,vs())))}:{success:!0,data:i.value}},koe=S6(Ik),T6=t=>async(e,n,r)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},i=e._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>Ud(s,o,vs())))}:{success:!0,data:i.value}},Moe=T6(Ik)});var bT={};zn(bT,{_emoji:()=>VLe,base64:()=>Koe,base64url:()=>P6,bigint:()=>Qoe,boolean:()=>nie,browserEmail:()=>VSt,cidrv4:()=>Woe,cidrv6:()=>Hoe,cuid:()=>Noe,cuid2:()=>Ooe,date:()=>Yoe,datetime:()=>Joe,domain:()=>WSt,duration:()=>Foe,e164:()=>Goe,email:()=>Boe,emoji:()=>zoe,extendedDuration:()=>DSt,guid:()=>Uoe,hostname:()=>qoe,html5Email:()=>BSt,integer:()=>eie,ipv4:()=>joe,ipv6:()=>Voe,ksuid:()=>Doe,lowercase:()=>iie,nanoid:()=>$oe,null:()=>rie,number:()=>tie,rfc5322Email:()=>zSt,string:()=>Xoe,time:()=>Zoe,ulid:()=>Roe,undefined:()=>oie,unicodeEmail:()=>jSt,uppercase:()=>sie,uuid:()=>xT,uuid4:()=>$St,uuid6:()=>FSt,uuid7:()=>USt,xid:()=>Loe});function zoe(){return new RegExp(VLe,"u")}function HLe(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 Zoe(t){return new RegExp(`^${HLe(t)}$`)}function Joe(t){let e=HLe({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");let r=`${e}(?:${n.join("|")})`;return new RegExp(`^${WLe}T(?:${r})$`)}var Noe,Ooe,Roe,Loe,Doe,$oe,Foe,DSt,Uoe,xT,$St,FSt,USt,Boe,BSt,zSt,jSt,VSt,VLe,joe,Voe,Woe,Hoe,Koe,P6,qoe,WSt,Goe,WLe,Yoe,Xoe,Qoe,eie,tie,nie,rie,oie,iie,sie,E6=C(()=>{Noe=/^[cC][^\s-]{8,}$/,Ooe=/^[0-9a-z]+$/,Roe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Loe=/^[0-9a-vA-V]{20}$/,Doe=/^[A-Za-z0-9]{27}$/,$oe=/^[a-zA-Z0-9_-]{21}$/,Foe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,DSt=/^[-+]?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)?)??$/,Uoe=/^([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})$/,xT=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)$/,$St=xT(4),FSt=xT(6),USt=xT(7),Boe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,BSt=/^[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])?)*$/,zSt=/^(([^<>()\[\]\\.,;:\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,}))$/,jSt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,VSt=/^[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])?)*$/,VLe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";joe=/^(?:(?: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])$/,Voe=/^(([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})$/,Woe=/^((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])$/,Hoe=/^(([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])$/,Koe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,P6=/^[A-Za-z0-9_-]*$/,qoe=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,WSt=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Goe=/^\+(?:[0-9]){6,14}[0-9]$/,WLe="(?:(?:\\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])))",Yoe=new RegExp(`^${WLe}$`);Xoe=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Qoe=/^\d+n?$/,eie=/^\d+$/,tie=/^-?\d+(?:\.\d+)?/i,nie=/true|false/i,rie=/null/i,oie=/undefined/i,iie=/^[^A-Z]*$/,sie=/^[^a-z]*$/});function KLe(t,e,n){t.issues.length&&e.issues.push(...Lu(n,t.issues))}var Ti,qLe,A6,k6,aie,lie,cie,uie,die,fie,pie,mie,hie,Pk,gie,yie,wie,vie,xie,bie,Cie,_ie,Sie,M6=C(()=>{_k();E6();An();Ti=ce("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),qLe={number:"number",bigint:"bigint",object:"date"},A6=ce("$ZodCheckLessThan",(t,e)=>{Ti.init(t,e);let n=qLe[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?r.value<=e.value:r.value{Ti.init(t,e);let n=qLe[typeof e.value];t._zod.onattach.push(r=>{let o=r._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=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),aie=ce("$ZodCheckMultipleOf",(t,e)=>{Ti.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):voe(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),lie=ce("$ZodCheckNumberFormat",(t,e)=>{Ti.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),r=n?"int":"number",[o,i]=Soe[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=o,a.maximum=i,n&&(a.pattern=eie)}),t._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}ai&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:t})}}),cie=ce("$ZodCheckBigIntFormat",(t,e)=>{Ti.init(t,e);let[n,r]=Toe[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=n,i.maximum=r}),t._zod.check=o=>{let i=o.value;ir&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inst:t})}}),uie=ce("$ZodCheckMaxSize",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.size!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=r.value;o.size<=e.maximum||r.issues.push({origin:RF(o),code:"too_big",maximum:e.maximum,input:o,inst:t,continue:!e.abort})}}),die=ce("$ZodCheckMinSize",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.size!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let o=r.value;o.size>=e.minimum||r.issues.push({origin:RF(o),code:"too_small",minimum:e.minimum,input:o,inst:t,continue:!e.abort})}}),fie=ce("$ZodCheckSizeEquals",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.size!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=r=>{let o=r.value,i=o.size;if(i===e.size)return;let s=i>e.size;r.issues.push({origin:RF(o),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),pie=ce("$ZodCheckMaxLength",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let o=r.value;if(o.length<=e.maximum)return;let s=LF(o);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),mie=ce("$ZodCheckMinLength",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let o=r.value;if(o.length>=e.minimum)return;let s=LF(o);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),hie=ce("$ZodCheckLengthEquals",(t,e)=>{var n;Ti.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Tb(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=r=>{let o=r.value,i=o.length;if(i===e.length)return;let s=LF(o),a=i>e.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),Pk=ce("$ZodCheckStringFormat",(t,e)=>{var n,r;Ti.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?(n=t._zod).check??(n.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})}):(r=t._zod).check??(r.check=()=>{})}),gie=ce("$ZodCheckRegex",(t,e)=>{Pk.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),yie=ce("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=iie),Pk.init(t,e)}),wie=ce("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=sie),Pk.init(t,e)}),vie=ce("$ZodCheckIncludes",(t,e)=>{Ti.init(t,e);let n=ww(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),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})}}),xie=ce("$ZodCheckStartsWith",(t,e)=>{Ti.init(t,e);let n=new RegExp(`^${ww(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),bie=ce("$ZodCheckEndsWith",(t,e)=>{Ti.init(t,e);let n=new RegExp(`.*${ww(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});Cie=ce("$ZodCheckProperty",(t,e)=>{Ti.init(t,e),t._zod.check=n=>{let r=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>KLe(o,n,e.property));KLe(r,n,e.property)}}),_ie=ce("$ZodCheckMimeType",(t,e)=>{Ti.init(t,e);let n=new Set(e.mime);t._zod.onattach.push(r=>{r._zod.bag.mime=e.mime}),t._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:e.mime,input:r.value.type,inst:t})}}),Sie=ce("$ZodCheckOverwrite",(t,e)=>{Ti.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}})});var UF,Tie=C(()=>{UF=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 r=e.split(` `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...n,o.join(` `))}}});var Iie,Pie=C(()=>{Iie={major:4,minor:0,patch:0}});function Gie(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function s1e(t){if(!P6.test(t))return!1;let e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Gie(n)}function a1e(t,e=null){try{let n=t.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}function YLe(t,e,n){t.issues.length&&e.issues.push(...Lu(n,t.issues)),e.value[n]=t.value}function N6(t,e,n){t.issues.length&&e.issues.push(...Lu(n,t.issues)),e.value[n]=t.value}function ZLe(t,e,n,r){t.issues.length?r[n]===void 0?n in r?e.value[n]=void 0:e.value[n]=t.value:e.issues.push(...Lu(n,t.issues)):t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}function JLe(t,e,n,r){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:n,errors:t.map(o=>o.issues.map(i=>Ud(i,r,vs())))}),e}function Eie(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(Tk(t)&&Tk(e)){let n=Object.keys(e),r=Object.keys(t).filter(i=>n.indexOf(i)!==-1),o={...t,...e};for(let i of r){let s=Eie(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;rUd(a,s,vs()))})),e.issues.length&&(OF.has(typeof r)?n.issues.push(...Lu(r,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:e.issues.map(a=>Ud(a,s,vs()))})),n.value.set(t.value,e.value)}function e1e(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function t1e(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function n1e(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 r1e(t,e,n){return yT(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}function o1e(t){return t.value=Object.freeze(t.value),t}function i1e(t,e,n,r){if(!t){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),e.issues.push(Ioe(o))}}var jn,CT,_o,Aie,kie,Mie,Nie,Oie,Rie,Lie,Die,$ie,Fie,Uie,Bie,zie,jie,Vie,Wie,Hie,Kie,qie,Yie,Zie,Jie,Xie,Qie,R6,ese,BF,L6,tse,nse,rse,ose,ise,_T,zF,sse,ase,jF,lse,D6,cse,use,ST,dse,fse,pse,mse,hse,gse,VF,$6,yse,wse,vse,xse,bse,Cse,_se,WF,Sse,Tse,Ise,Pse,Ese,HF=C(()=>{M6();_k();Tie();I6();E6();An();Pie();An();jn=ce("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Iie;let r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(let o of r)for(let i of o._zod.onattach)i(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,s,a)=>{let l=yT(i),c;for(let u of s){if(u._zod.def.when){if(!u._zod.def.when(i))continue}else if(l)continue;let d=i.issues.length,f=u._zod.check(i);if(f instanceof Promise&&a?.async===!1)throw new wg;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(l||(l=yT(i,d)))});else{if(i.issues.length===d)continue;l||(l=yT(i,d))}}return c?c.then(()=>i):i};t._zod.run=(i,s)=>{let a=t._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new wg;return a.then(l=>o(l,r,s))}return o(a,r,s)}}t["~standard"]={validate:o=>{try{let i=koe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Moe(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),CT=ce("$ZodString",(t,e)=>{jn.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Xoe(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),_o=ce("$ZodStringFormat",(t,e)=>{Pk.init(t,e),CT.init(t,e)}),Aie=ce("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Uoe),_o.init(t,e)}),kie=ce("$ZodUUID",(t,e)=>{if(e.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=xT(r))}else e.pattern??(e.pattern=xT());_o.init(t,e)}),Mie=ce("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Boe),_o.init(t,e)}),Nie=ce("$ZodURL",(t,e)=>{_o.init(t,e),t._zod.check=n=>{try{let r=n.value,o=new URL(r),i=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:qoe.source,input:n.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)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),Oie=ce("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=zoe()),_o.init(t,e)}),Rie=ce("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=$oe),_o.init(t,e)}),Lie=ce("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Noe),_o.init(t,e)}),Die=ce("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Ooe),_o.init(t,e)}),$ie=ce("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Roe),_o.init(t,e)}),Fie=ce("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Loe),_o.init(t,e)}),Uie=ce("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Doe),_o.init(t,e)}),Bie=ce("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Joe(e)),_o.init(t,e)}),zie=ce("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Yoe),_o.init(t,e)}),jie=ce("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Zoe(e)),_o.init(t,e)}),Vie=ce("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Foe),_o.init(t,e)}),Wie=ce("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=joe),_o.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv4"})}),Hie=ce("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Voe),_o.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Kie=ce("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Woe),_o.init(t,e)}),qie=ce("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Hoe),_o.init(t,e),t._zod.check=n=>{let[r,o]=n.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://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});Yie=ce("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Koe),_o.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{Gie(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});Zie=ce("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=P6),_o.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{s1e(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Jie=ce("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Goe),_o.init(t,e)});Xie=ce("$ZodJWT",(t,e)=>{_o.init(t,e),t._zod.check=n=>{a1e(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),Qie=ce("$ZodCustomStringFormat",(t,e)=>{_o.init(t,e),t._zod.check=n=>{e.fn(n.value)||n.issues.push({code:"invalid_format",format:e.format,input:n.value,inst:t,continue:!e.abort})}}),R6=ce("$ZodNumber",(t,e)=>{jn.init(t,e),t._zod.pattern=t._zod.bag.pattern??tie,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),n}}),ese=ce("$ZodNumber",(t,e)=>{lie.init(t,e),R6.init(t,e)}),BF=ce("$ZodBoolean",(t,e)=>{jn.init(t,e),t._zod.pattern=nie,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),n}}),L6=ce("$ZodBigInt",(t,e)=>{jn.init(t,e),t._zod.pattern=Qoe,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n}}),tse=ce("$ZodBigInt",(t,e)=>{cie.init(t,e),L6.init(t,e)}),nse=ce("$ZodSymbol",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),n}}),rse=ce("$ZodUndefined",(t,e)=>{jn.init(t,e),t._zod.pattern=oie,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),n}}),ose=ce("$ZodNull",(t,e)=>{jn.init(t,e),t._zod.pattern=rie,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),n}}),ise=ce("$ZodAny",(t,e)=>{jn.init(t,e),t._zod.parse=n=>n}),_T=ce("$ZodUnknown",(t,e)=>{jn.init(t,e),t._zod.parse=n=>n}),zF=ce("$ZodNever",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)}),sse=ce("$ZodVoid",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),n}}),ase=ce("$ZodDate",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),n}});jF=ce("$ZodArray",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);let i=[];for(let s=0;sYLe(c,n,s))):YLe(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});lse=ce("$ZodObject",(t,e)=>{jn.init(t,e);let n=MF(()=>{let d=Object.keys(e.shape);for(let p of d)if(!(e.shape[p]instanceof jn))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);let f=_oe(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});Zr(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 r=d=>{let f=new UF(["shape","payload","ctx"]),p=n.value,m=w=>{let v=gT(w);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),g=0;for(let w of p.keys)h[w]=`key_${g++}`;f.write("const newResult = {}");for(let w of p.keys)if(p.optionalKeys.has(w)){let v=h[w];f.write(`const ${v} = ${m(w)};`);let x=gT(w);f.write(` if (${v}.issues.length) { if (input[${x}] === undefined) { if (${x} in input) { newResult[${x}] = undefined; } } else { payload.issues = payload.issues.concat( ${v}.issues.map((iss) => ({ ...iss, path: iss.path ? [${x}, ...iss.path] : [${x}], })) ); } } else if (${v}.value === undefined) { if (${x} in input) newResult[${x}] = undefined; } else { newResult[${x}] = ${v}.value; } `)}else{let v=h[w];f.write(`const ${v} = ${m(w)};`),f.write(` if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({ ...iss, path: iss.path ? [${gT(w)}, ...iss.path] : [${gT(w)}] })));`),f.write(`newResult[${gT(w)}] = ${v}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let y=f.compile();return(w,v)=>y(d,w,v)},o,i=Sk,s=!EF.jitless,l=s&&boe.value,c=e.catchall,u;t._zod.parse=(d,f)=>{u??(u=n.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(s&&l&&f?.async===!1&&f.jitless!==!0)o||(o=r(e.shape)),d=o(d,f);else{d.value={};let v=u.shape;for(let x of u.keys){let b=v[x],_=b._zod.run({value:p[x],issues:[]},f),T=b._zod.optin==="optional"&&b._zod.optout==="optional";_ instanceof Promise?m.push(_.then(S=>T?ZLe(S,d,x,p):N6(S,d,x))):T?ZLe(_,d,x,p):N6(_,d,x)}}if(!c)return m.length?Promise.all(m).then(()=>d):d;let h=[],g=u.keySet,y=c._zod,w=y.def.type;for(let v of Object.keys(p)){if(g.has(v))continue;if(w==="never"){h.push(v);continue}let x=y.run({value:p[v],issues:[]},f);x instanceof Promise?m.push(x.then(b=>N6(b,d,v))):N6(x,d,v)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:p,inst:t}),m.length?Promise.all(m).then(()=>d):d}});D6=ce("$ZodUnion",(t,e)=>{jn.init(t,e),Zr(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Zr(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Zr(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),Zr(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>NF(r.source)).join("|")})$`)}}),t._zod.parse=(n,r)=>{let o=!1,i=[];for(let s of e.options){let a=s._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>JLe(s,n,t,r)):JLe(i,n,t,r)}}),cse=ce("$ZodDiscriminatedUnion",(t,e)=>{D6.init(t,e);let n=t._zod.parse;Zr(t._zod,"propValues",()=>{let o={};for(let i of e.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){o[a]||(o[a]=new Set);for(let c of l)o[a].add(c)}}return o});let r=MF(()=>{let o=e.options,i=new Map;for(let s of o){let a=s._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});t._zod.parse=(o,i)=>{let s=o.value;if(!Sk(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let a=r.value.get(s?.[e.discriminator]);return a?a._zod.run(o,i):e.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[e.discriminator],inst:t}),o)}}),use=ce("$ZodIntersection",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value,i=e.left._zod.run({value:o,issues:[]},r),s=e.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>XLe(n,l,c)):XLe(n,i,s)}});ST=ce("$ZodTuple",(t,e)=>{jn.init(t,e);let n=e.items,r=n.length-[...n].reverse().findIndex(o=>o._zod.optin!=="optional");t._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:t,expected:"tuple",code:"invalid_type"}),o;o.value=[];let a=[];if(!e.rest){let c=s.length>n.length,u=s.length=s.length&&l>=r)continue;let u=c._zod.run({value:s[l],issues:[]},i);u instanceof Promise?a.push(u.then(d=>O6(d,o,l))):O6(u,o,l)}if(e.rest){let c=s.slice(n.length);for(let u of c){l++;let d=e.rest._zod.run({value:u,issues:[]},i);d instanceof Promise?a.push(d.then(f=>O6(f,o,l))):O6(d,o,l)}}return a.length?Promise.all(a).then(()=>o):o}});dse=ce("$ZodRecord",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Tk(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let i=[];if(e.keyType._zod.values){let s=e.keyType._zod.values;n.value={};for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){let c=e.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&n.issues.push(...Lu(l,u.issues)),n.value[l]=u.value})):(c.issues.length&&n.issues.push(...Lu(l,c.issues)),n.value[l]=c.value)}let a;for(let l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{n.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let a=e.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>Ud(c,r,vs())),input:s,path:[s],inst:t}),n.value[a.value]=a.value;continue}let l=e.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...Lu(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...Lu(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),fse=ce("$ZodMap",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!(o instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),n;let i=[];n.value=new Map;for(let[s,a]of o){let l=e.keyType._zod.run({value:s,issues:[]},r),c=e.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise||c instanceof Promise?i.push(Promise.all([l,c]).then(([u,d])=>{QLe(u,d,n,s,o,t,r)})):QLe(l,c,n,s,o,t,r)}return i.length?Promise.all(i).then(()=>n):n}});pse=ce("$ZodSet",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!(o instanceof Set))return n.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),n;let i=[];n.value=new Set;for(let s of o){let a=e.valueType._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(l=>e1e(l,n))):e1e(a,n)}return i.length?Promise.all(i).then(()=>n):n}});mse=ce("$ZodEnum",(t,e)=>{jn.init(t,e);let n=kF(e.entries);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(r=>OF.has(typeof r)).map(r=>typeof r=="string"?ww(r):r.toString()).join("|")})$`),t._zod.parse=(r,o)=>{let i=r.value;return t._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:t}),r}}),hse=ce("$ZodLiteral",(t,e)=>{jn.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?ww(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,r)=>{let o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}}),gse=ce("$ZodFile",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),n}}),VF=ce("$ZodTransform",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=e.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new wg;return n.value=o,n}}),$6=ce("$ZodOptional",(t,e)=>{jn.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Zr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Zr(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${NF(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(n,r):n.value===void 0?n:e.innerType._zod.run(n,r)}),yse=ce("$ZodNullable",(t,e)=>{jn.init(t,e),Zr(t._zod,"optin",()=>e.innerType._zod.optin),Zr(t._zod,"optout",()=>e.innerType._zod.optout),Zr(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${NF(n.source)}|null)$`):void 0}),Zr(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),wse=ce("$ZodDefault",(t,e)=>{jn.init(t,e),t._zod.optin="optional",Zr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=e.defaultValue,n;let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>t1e(i,e)):t1e(o,e)}});vse=ce("$ZodPrefault",(t,e)=>{jn.init(t,e),t._zod.optin="optional",Zr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),xse=ce("$ZodNonOptional",(t,e)=>{jn.init(t,e),Zr(t._zod,"values",()=>{let n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>n1e(i,t)):n1e(o,t)}});bse=ce("$ZodSuccess",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}}),Cse=ce("$ZodCatch",(t,e)=>{jn.init(t,e),t._zod.optin="optional",Zr(t._zod,"optout",()=>e.innerType._zod.optout),Zr(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=e.catchValue({...n,error:{issues:i.issues.map(s=>Ud(s,r,vs()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(i=>Ud(i,r,vs()))},input:n.value}),n.issues=[]),n)}}),_se=ce("$ZodNaN",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:t,expected:"nan",code:"invalid_type"}),n)}),WF=ce("$ZodPipe",(t,e)=>{jn.init(t,e),Zr(t._zod,"values",()=>e.in._zod.values),Zr(t._zod,"optin",()=>e.in._zod.optin),Zr(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(n,r)=>{let o=e.in._zod.run(n,r);return o instanceof Promise?o.then(i=>r1e(i,e,r)):r1e(o,e,r)}});Sse=ce("$ZodReadonly",(t,e)=>{jn.init(t,e),Zr(t._zod,"propValues",()=>e.innerType._zod.propValues),Zr(t._zod,"values",()=>e.innerType._zod.values),Zr(t._zod,"optin",()=>e.innerType._zod.optin),Zr(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(o1e):o1e(o)}});Tse=ce("$ZodTemplateLiteral",(t,e)=>{jn.init(t,e);let n=[];for(let r of e.parts)if(r instanceof jn){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);let o=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${r._zod.traits}`);let i=o.startsWith("^")?1:0,s=o.endsWith("$")?o.length-1:o.length;n.push(o.slice(i,s))}else if(r===null||Coe.has(typeof r))n.push(ww(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);t._zod.pattern=new RegExp(`^${n.join("")}$`),t._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:t,expected:"template_literal",code:"invalid_type"}),r):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),r)}),Ise=ce("$ZodPromise",(t,e)=>{jn.init(t,e),t._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>e.innerType._zod.run({value:o,issues:[]},r))}),Pse=ce("$ZodLazy",(t,e)=>{jn.init(t,e),Zr(t._zod,"innerType",()=>e.getter()),Zr(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),Zr(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),Zr(t._zod,"optin",()=>t._zod.innerType._zod.optin),Zr(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),Ese=ce("$ZodCustom",(t,e)=>{Ti.init(t,e),jn.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{let r=n.value,o=e.fn(r);if(o instanceof Promise)return o.then(i=>i1e(i,n,r,t));i1e(o,n,r,t)}})});function c1e(){return{localeError:HSt()}}var HSt,u1e=C(()=>{An();HSt=()=>{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 n=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},r={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 ${n(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 ${ot(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: ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?` \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()} ${s.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?">=":">",s=e(o.origin);return s?`\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()} ${s.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}`:`${r[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":""}: ${be(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 d1e(){return{localeError:KSt()}}var KSt,f1e=C(()=>{An();KSt=()=>{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 n=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},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 o=>{switch(o.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o.expected}, daxil olan ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${ot(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 p1e(t,e,n,r){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?r:i===1?e:i>=2&&i<=4?n:r}function m1e(){return{localeError:qSt()}}var qSt,h1e=C(()=>{An();qSt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),l=p1e(a,s.unit.one,s.unit.few,s.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 ${s.verb} ${i}${o.maximum.toString()} ${l}`}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?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),l=p1e(a,s.unit.one,s.unit.few,s.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 ${s.verb} ${i}${o.minimum.toString()} ${l}`}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 ${r[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"}: ${be(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 g1e(){return{localeError:GSt()}}var GSt,y1e=C(()=>{An();GSt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${ot(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${be(o.values," o ")}`;case"too_big":{let i=o.inclusive?"com a m\xE0xim":"menys de",s=e(o.origin);return s?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${i} ${o.maximum.toString()} ${s.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",s=e(o.origin);return s?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${i} ${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 w1e(){return{localeError:YSt()}}var YSt,v1e=C(()=>{An();YSt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${ot(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${i}${o.minimum.toString()} ${s.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 ${r[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: ${be(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 x1e(){return{localeError:ZSt()}}var ZSt,b1e=C(()=>{An();ZSt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${ot(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${i}${o.maximum.toString()} ist`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Zu klein: erwartet, dass ${o.origin} ${i}${o.minimum.toString()} ${s.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: ${r[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"}: ${be(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 F6(){return{localeError:XSt()}}var JSt,XSt,Ase=C(()=>{An();JSt=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},XSt=()=>{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(r){return t[r]??null}let 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 r=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${JSt(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${ot(r.values[0])}`:`Invalid option: expected one of ${be(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",i=e(r.origin);return i?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",i=e(r.origin);return i?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${i.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;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 ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${be(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}}});function C1e(){return{localeError:eTt()}}var QSt,eTt,_1e=C(()=>{An();QSt=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},eTt=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(r){return t[r]??null}let n={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 r=>{switch(r.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${r.expected}, ricevi\u011Dis ${QSt(r.input)}`;case"invalid_value":return r.values.length===1?`Nevalida enigo: atendi\u011Dis ${ot(r.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${be(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",i=e(r.origin);return i?`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${r.origin??"valoro"} havu ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",i=e(r.origin);return i?`Tro malgranda: atendi\u011Dis ke ${r.origin} havu ${o}${r.minimum.toString()} ${i.unit}`:`Tro malgranda: atendi\u011Dis ke ${r.origin} estu ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;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 ${n[o.format]??r.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${r.divisor}`;case"unrecognized_keys":return`Nekonata${r.keys.length>1?"j":""} \u015Dlosilo${r.keys.length>1?"j":""}: ${be(r.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${r.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${r.origin}`;default:return"Nevalida enigo"}}}});function S1e(){return{localeError:tTt()}}var tTt,T1e=C(()=>{An();tTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: se esperaba ${ot(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Demasiado grande: se esperaba que ${o.origin??"valor"} tuviera ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${o.origin??"valor"} fuera ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Demasiado peque\xF1o: se esperaba que ${o.origin} tuviera ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 I1e(){return{localeError:nTt()}}var nTt,P1e=C(()=>{An();nTt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.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`:`${r[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: ${be(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 E1e(){return{localeError:rTt()}}var rTt,A1e=C(()=>{An();rTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${ot(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${o.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${o.minimum.toString()} ${s.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 ${r[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"}: ${be(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 k1e(){return{localeError:oTt()}}var oTt,M1e=C(()=>{An();oTt=()=>{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 n=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},r={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, ${n(o.input)} re\xE7u`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${ot(o.values[0])} attendu`:`Option invalide : une valeur parmi ${be(o.values,"|")} attendue`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Trop grand : ${o.origin??"valeur"} doit ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${o.origin??"valeur"} doit \xEAtre ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Trop petit : ${o.origin} doit ${s.verb} ${i}${o.minimum.toString()} ${s.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}`:`${r[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":""} : ${be(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 N1e(){return{localeError:iTt()}}var iTt,O1e=C(()=>{An();iTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${ot(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u2264":"<",s=e(o.origin);return s?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${i}${o.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?"\u2265":">",s=e(o.origin);return s?`Trop petit : attendu que ${o.origin} ait ${i}${o.minimum.toString()} ${s.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}`:`${r[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":""} : ${be(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 R1e(){return{localeError:sTt()}}var sTt,L1e=C(()=>{An();sTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${o.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${o.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${i}${o.minimum.toString()} ${s.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}`:`${r[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"}: ${be(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 D1e(){return{localeError:aTt()}}var aTt,$1e=C(()=>{An();aTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${ot(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 F1e(){return{localeError:lTt()}}var lTt,U1e=C(()=>{An();lTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${ot(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: diharapkan ${o.origin} memiliki ${i}${o.minimum.toString()} ${s.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}`:`${r[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":""}: ${be(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 B1e(){return{localeError:cTt()}}var cTt,z1e=C(()=>{An();cTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Input non valido: atteso ${ot(o.values[0])}`:`Opzione non valida: atteso uno tra ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Troppo grande: ${o.origin??"valore"} deve avere ${i}${o.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Troppo piccolo: ${o.origin} deve avere ${i}${o.minimum.toString()} ${s.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 ${r[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"}: ${be(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 j1e(){return{localeError:uTt()}}var uTt,V1e=C(()=>{An();uTt=()=>{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 n=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},r={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${n(o.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${ot(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${be(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",s=e(o.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s.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",s=e(o.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s.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${r[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":""}: ${be(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 W1e(){return{localeError:dTt()}}var dTt,H1e=C(()=>{An();dTt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\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()} ${s.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?">=":">",s=e(o.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${i} ${o.minimum.toString()} ${s.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 ${r[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 ${be(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 K1e(){return{localeError:fTt()}}var fTt,q1e=C(()=>{An();fTt=()=>{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 n=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},r={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 ${n(o.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${ot(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${be(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),l=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${l} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${i}${s}`}case"too_small":{let i=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(o.origin),l=a?.unit??"\uC694\uC18C";return a?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${l} ${i}${s}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${i}${s}`}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 ${r[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: ${be(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 G1e(){return{localeError:pTt()}}var pTt,Y1e=C(()=>{An();pTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\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()} ${s.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?">=":">",s=e(o.origin);return s?`\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()} ${s.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 ${r[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"}: ${be(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 Z1e(){return{localeError:mTt()}}var mTt,J1e=C(()=>{An();mTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${ot(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Terlalu besar: dijangka ${o.origin??"nilai"} ${s.verb} ${i}${o.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Terlalu kecil: dijangka ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.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}`:`${r[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: ${be(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 X1e(){return{localeError:hTt()}}var hTt,Q1e=C(()=>{An();hTt=()=>{let t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(o){return t[o]??null}let n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${ot(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} ${s.unit??"elementen"} bevat`:`Te lang: verwacht dat ${o.origin??"waarde"} ${i}${o.maximum.toString()} is`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Te kort: verwacht dat ${o.origin} ${i}${o.minimum.toString()} ${s.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: ${r[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":""}: ${be(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 eDe(){return{localeError:gTt()}}var gTt,tDe=C(()=>{An();gTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${ot(o.values[0])}`:`Ugyldig valg: forventet en av ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`For lite(n): forventet ${o.origin} til \xE5 ha ${i}${o.minimum.toString()} ${s.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 ${r[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"}: ${be(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 nDe(){return{localeError:yTt()}}var yTt,rDe=C(()=>{An();yTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${ot(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 oDe(){return{localeError:wTt()}}var wTt,iDe=C(()=>{An();wTt=()=>{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 n=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},r={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 ${n(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 ${ot(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${be(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${i}${o.minimum.toString()} ${s.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`:`${r[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"}: ${be(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 sDe(){return{localeError:vTt()}}var vTt,aDe=C(()=>{An();vTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${ot(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${o.minimum.toString()} ${s.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) ${r[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":""}: ${be(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 lDe(){return{localeError:xTt()}}var xTt,cDe=C(()=>{An();xTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${ot(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${i}${o.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Muito pequeno: esperado que ${o.origin} tivesse ${i}${o.minimum.toString()} ${s.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}`:`${r[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":""}: ${be(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 uDe(t,e,n,r){let o=Math.abs(t),i=o%10,s=o%100;return s>=11&&s<=19?r:i===1?e:i>=2&&i<=4?n:r}function dDe(){return{localeError:bTt()}}var bTt,fDe=C(()=>{An();bTt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);if(s){let a=Number(o.maximum),l=uDe(a,s.unit.one,s.unit.few,s.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()} ${l}`}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?">=":">",s=e(o.origin);if(s){let a=Number(o.minimum),l=uDe(a,s.unit.one,s.unit.few,s.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()} ${l}`}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 ${r[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":""}: ${be(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 pDe(){return{localeError:CTt()}}var CTt,mDe=C(()=>{An();CTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${ot(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${i}${o.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",s=e(o.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${i}${o.minimum.toString()} ${s.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 ${r[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"}: ${be(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 hDe(){return{localeError:_Tt()}}var _Tt,gDe=C(()=>{An();_Tt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${ot(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${i}${o.minimum.toString()} ${s.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) ${r[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"}: ${be(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 yDe(){return{localeError:STt()}}var STt,wDe=C(()=>{An();STt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\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()} ${s.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?">=":">",s=e(o.origin);return s?`\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()} ${s.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 ${r[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":""}: ${be(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 vDe(){return{localeError:TTt()}}var TTt,xDe=C(()=>{An();TTt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(o.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.maximum.toString()} ${s.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",s=e(o.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${o.minimum.toString()} ${s.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: ${r[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: ${be(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 bDe(){return{localeError:PTt()}}var ITt,PTt,CDe=C(()=>{An();ITt=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},PTt=()=>{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(r){return t[r]??null}let n={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 r=>{switch(r.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${r.expected}, al\u0131nan ${ITt(r.input)}`;case"invalid_value":return r.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${ot(r.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${be(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",i=e(r.origin);return i?`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()} ${i.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${r.origin??"de\u011Fer"} ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",i=e(r.origin);return i?`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()} ${i.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${r.origin} ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;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 ${n[o.format]??r.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${r.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${r.keys.length>1?"lar":""}: ${be(r.keys,", ")}`;case"invalid_key":return`${r.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${r.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function _De(){return{localeError:ETt()}}var ETt,SDe=C(()=>{An();ETt=()=>{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 n=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},r={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 ${n(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 ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\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"} ${s.verb} ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\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} ${s.verb} ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 TDe(){return{localeError:ATt()}}var ATt,IDe=C(()=>{An();ATt=()=>{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 n=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},r={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 ${n(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: ${ot(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${be(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?"<=":"<",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${i}${o.minimum.toString()} ${s.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 ${r[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":""}: ${be(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 PDe(){return{localeError:kTt()}}var kTt,EDe=C(()=>{An();kTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${ot(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 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s.verb} ${i}${o.minimum.toString()} ${s.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}`:`${r[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: ${be(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 ADe(){return{localeError:MTt()}}var MTt,kDe=C(()=>{An();MTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${ot(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${i}${o.minimum.toString()} ${s.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${r[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): ${be(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 MDe(){return{localeError:NTt()}}var NTt,NDe=C(()=>{An();NTt=()=>{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 n=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},r={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 ${n(o.input)}`;case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${ot(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",s=e(o.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${i}${o.maximum.toString()} ${s.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?">=":">",s=e(o.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${i}${o.minimum.toString()} ${s.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 ${r[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${be(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 KF={};zn(KF,{ar:()=>c1e,az:()=>d1e,be:()=>m1e,ca:()=>g1e,cs:()=>w1e,de:()=>x1e,en:()=>F6,eo:()=>C1e,es:()=>S1e,fa:()=>I1e,fi:()=>E1e,fr:()=>k1e,frCA:()=>N1e,he:()=>R1e,hu:()=>D1e,id:()=>F1e,it:()=>B1e,ja:()=>j1e,kh:()=>W1e,ko:()=>K1e,mk:()=>G1e,ms:()=>Z1e,nl:()=>X1e,no:()=>eDe,ota:()=>nDe,pl:()=>sDe,ps:()=>oDe,pt:()=>lDe,ru:()=>dDe,sl:()=>pDe,sv:()=>hDe,ta:()=>yDe,th:()=>vDe,tr:()=>bDe,ua:()=>_De,ur:()=>TDe,vi:()=>PDe,zhCN:()=>ADe,zhTW:()=>MDe});var kse=C(()=>{u1e();f1e();h1e();y1e();v1e();b1e();Ase();_1e();T1e();P1e();A1e();M1e();O1e();L1e();$1e();U1e();z1e();V1e();H1e();q1e();Y1e();J1e();Q1e();tDe();rDe();iDe();aDe();cDe();fDe();mDe();gDe();wDe();xDe();CDe();SDe();IDe();EDe();kDe();NDe()});function U6(){return new Ek}var Mse,Nse,Ek,Oa,Ose=C(()=>{Mse=Symbol("ZodOutput"),Nse=Symbol("ZodInput"),Ek=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...n){let r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};Oa=U6()});function Rse(t,e){return new t({type:"string",...We(e)})}function Lse(t,e){return new t({type:"string",coerce:!0,...We(e)})}function B6(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...We(e)})}function qF(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...We(e)})}function z6(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...We(e)})}function j6(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...We(e)})}function V6(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...We(e)})}function W6(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...We(e)})}function H6(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...We(e)})}function K6(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...We(e)})}function q6(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...We(e)})}function G6(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...We(e)})}function Y6(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...We(e)})}function Z6(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...We(e)})}function J6(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...We(e)})}function X6(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...We(e)})}function Q6(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...We(e)})}function e3(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...We(e)})}function t3(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...We(e)})}function n3(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...We(e)})}function r3(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...We(e)})}function o3(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...We(e)})}function i3(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...We(e)})}function s3(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...We(e)})}function $se(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...We(e)})}function Fse(t,e){return new t({type:"string",format:"date",check:"string_format",...We(e)})}function Use(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...We(e)})}function Bse(t,e){return new t({type:"string",format:"duration",check:"string_format",...We(e)})}function zse(t,e){return new t({type:"number",checks:[],...We(e)})}function jse(t,e){return new t({type:"number",coerce:!0,checks:[],...We(e)})}function Vse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...We(e)})}function Wse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...We(e)})}function Hse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...We(e)})}function Kse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...We(e)})}function qse(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...We(e)})}function Gse(t,e){return new t({type:"boolean",...We(e)})}function Yse(t,e){return new t({type:"boolean",coerce:!0,...We(e)})}function Zse(t,e){return new t({type:"bigint",...We(e)})}function Jse(t,e){return new t({type:"bigint",coerce:!0,...We(e)})}function Xse(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...We(e)})}function Qse(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...We(e)})}function eae(t,e){return new t({type:"symbol",...We(e)})}function tae(t,e){return new t({type:"undefined",...We(e)})}function nae(t,e){return new t({type:"null",...We(e)})}function rae(t){return new t({type:"any"})}function TT(t){return new t({type:"unknown"})}function GF(t,e){return new t({type:"never",...We(e)})}function oae(t,e){return new t({type:"void",...We(e)})}function iae(t,e){return new t({type:"date",...We(e)})}function sae(t,e){return new t({type:"date",coerce:!0,...We(e)})}function aae(t,e){return new t({type:"nan",...We(e)})}function vw(t,e){return new A6({check:"less_than",...We(e),value:t,inclusive:!1})}function Yf(t,e){return new A6({check:"less_than",...We(e),value:t,inclusive:!0})}function xw(t,e){return new k6({check:"greater_than",...We(e),value:t,inclusive:!1})}function Du(t,e){return new k6({check:"greater_than",...We(e),value:t,inclusive:!0})}function lae(t){return xw(0,t)}function cae(t){return vw(0,t)}function uae(t){return Yf(0,t)}function dae(t){return Du(0,t)}function IT(t,e){return new aie({check:"multiple_of",...We(e),value:t})}function Ak(t,e){return new uie({check:"max_size",...We(e),maximum:t})}function PT(t,e){return new die({check:"min_size",...We(e),minimum:t})}function YF(t,e){return new fie({check:"size_equals",...We(e),size:t})}function kk(t,e){return new pie({check:"max_length",...We(e),maximum:t})}function Ib(t,e){return new mie({check:"min_length",...We(e),minimum:t})}function Mk(t,e){return new hie({check:"length_equals",...We(e),length:t})}function ZF(t,e){return new gie({check:"string_format",format:"regex",...We(e),pattern:t})}function JF(t){return new yie({check:"string_format",format:"lowercase",...We(t)})}function XF(t){return new wie({check:"string_format",format:"uppercase",...We(t)})}function QF(t,e){return new vie({check:"string_format",format:"includes",...We(e),includes:t})}function e2(t,e){return new xie({check:"string_format",format:"starts_with",...We(e),prefix:t})}function t2(t,e){return new bie({check:"string_format",format:"ends_with",...We(e),suffix:t})}function fae(t,e,n){return new Cie({check:"property",property:t,schema:e,...We(n)})}function n2(t,e){return new _ie({check:"mime_type",mime:t,...We(e)})}function bw(t){return new Sie({check:"overwrite",tx:t})}function r2(t){return bw(e=>e.normalize(t))}function o2(){return bw(t=>t.trim())}function i2(){return bw(t=>t.toLowerCase())}function s2(){return bw(t=>t.toUpperCase())}function a2(t,e,n){return new t({type:"array",element:e,...We(n)})}function OTt(t,e,n){return new t({type:"union",options:e,...We(n)})}function RTt(t,e,n,r){return new t({type:"union",options:n,discriminator:e,...We(r)})}function LTt(t,e,n){return new t({type:"intersection",left:e,right:n})}function pae(t,e,n,r){let o=n instanceof jn,i=o?r:n,s=o?n:null;return new t({type:"tuple",items:e,rest:s,...We(i)})}function DTt(t,e,n,r){return new t({type:"record",keyType:e,valueType:n,...We(r)})}function $Tt(t,e,n,r){return new t({type:"map",keyType:e,valueType:n,...We(r)})}function FTt(t,e,n){return new t({type:"set",valueType:e,...We(n)})}function UTt(t,e,n){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:r,...We(n)})}function BTt(t,e,n){return new t({type:"enum",entries:e,...We(n)})}function zTt(t,e,n){return new t({type:"literal",values:Array.isArray(e)?e:[e],...We(n)})}function mae(t,e){return new t({type:"file",...We(e)})}function jTt(t,e){return new t({type:"transform",transform:e})}function VTt(t,e){return new t({type:"optional",innerType:e})}function WTt(t,e){return new t({type:"nullable",innerType:e})}function HTt(t,e,n){return new t({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():n}})}function KTt(t,e,n){return new t({type:"nonoptional",innerType:e,...We(n)})}function qTt(t,e){return new t({type:"success",innerType:e})}function GTt(t,e,n){return new t({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}function YTt(t,e,n){return new t({type:"pipe",in:e,out:n})}function ZTt(t,e){return new t({type:"readonly",innerType:e})}function JTt(t,e,n){return new t({type:"template_literal",parts:e,...We(n)})}function XTt(t,e){return new t({type:"lazy",getter:e})}function QTt(t,e){return new t({type:"promise",innerType:e})}function hae(t,e,n){let r=We(n);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function gae(t,e,n){return new t({type:"custom",check:"custom",fn:e,...We(n)})}function yae(t,e){let n=We(e),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(r),s=new Set(o),a=t.Pipe??WF,l=t.Boolean??BF,c=t.String??CT,u=t.Transform??VF,d=new u({type:"transform",transform:(m,h)=>{let g=m;return n.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:s.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:d}),{})},error:n.error}),f=new a({type:"pipe",in:new c({type:"string",error:n.error}),out:d,error:n.error});return new a({type:"pipe",in:f,out:new l({type:"boolean",error:n.error}),error:n.error})}function wae(t,e,n,r={}){let o=We(r),i={...We(r),check:"string_format",type:"string",format:e,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new t(i)}var Dse,vae=C(()=>{M6();HF();An();Dse={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function xae(t){return new a3({type:"function",input:Array.isArray(t?.input)?pae(ST,t?.input):t?.input??a2(jF,TT(_T)),output:t?.output??TT(_T)})}var a3,ODe=C(()=>{vae();I6();HF();HF();a3=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 n=(...r)=>{let o=this._def.input?wT(this._def.input,r,void 0,{callee:n}):r;if(!Array.isArray(o))throw new Error("Invalid arguments schema: not an array or tuple schema.");let i=e(...o);return this._def.output?wT(this._def.output,i,void 0,{callee:n}):i};return n}implementAsync(e){if(typeof e!="function")throw new Error("implement() must be called with a function");let n=async(...r)=>{let o=this._def.input?await vT(this._def.input,r,void 0,{callee:n}):r;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?vT(this._def.output,i,void 0,{callee:n}):i};return n}input(...e){let n=this.constructor;return Array.isArray(e[0])?new n({type:"function",input:new ST({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new n({type:"function",input:e[0],output:this._def.output})}output(e){let n=this.constructor;return new n({type:"function",input:this._def.input,output:e})}}});function Pb(t,e){if(t instanceof Ek){let r=new l2(e),o={};for(let a of t._idmap.entries()){let[l,c]=a;r.process(c)}let i={},s={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[l,c]=a;i[l]=r.emit(c,{...e,external:s})}if(Object.keys(o).length>0){let a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let n=new l2(e);return n.process(t),n.emit(t,e)}function zs(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return!1;n.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 zs(o.element,n);case"object":{for(let i in o.shape)if(zs(o.shape[i],n))return!0;return!1}case"union":{for(let i of o.options)if(zs(i,n))return!0;return!1}case"intersection":return zs(o.left,n)||zs(o.right,n);case"tuple":{for(let i of o.items)if(zs(i,n))return!0;return!!(o.rest&&zs(o.rest,n))}case"record":return zs(o.keyType,n)||zs(o.valueType,n);case"map":return zs(o.keyType,n)||zs(o.valueType,n);case"set":return zs(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return zs(o.innerType,n);case"lazy":return zs(o.getter(),n);case"default":return zs(o.innerType,n);case"prefault":return zs(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return zs(o.in,n)||zs(o.out,n);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var l2,RDe=C(()=>{Ose();An();l2=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Oa,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,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,a);let l=e._zod.toJSONSchema?.();if(l)a.schema=l;else{let d={...n,schemaPath:[...n.schemaPath,e],path:n.path},f=e._zod.parent;if(f)a.ref=f,this.process(f,d),this.seen.get(f).isParent=!0;else{let p=a.schema;switch(o.type){case"string":{let m=p;m.type="string";let{minimum:h,maximum:g,format:y,patterns:w,contentEncoding:v}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof g=="number"&&(m.maxLength=g),y&&(m.format=i[y]??y,m.format===""&&delete m.format),v&&(m.contentEncoding=v),w&&w.size>0){let x=[...w];x.length===1?m.pattern=x[0].source:x.length>1&&(a.schema.allOf=[...x.map(b=>({...this.target==="draft-7"?{type:"string"}:{},pattern:b.source}))])}break}case"number":{let m=p,{minimum:h,maximum:g,format:y,multipleOf:w,exclusiveMaximum:v,exclusiveMinimum:x}=e._zod.bag;typeof y=="string"&&y.includes("int")?m.type="integer":m.type="number",typeof x=="number"&&(m.exclusiveMinimum=x),typeof h=="number"&&(m.minimum=h,typeof x=="number"&&(x>=h?delete m.minimum:delete m.exclusiveMinimum)),typeof v=="number"&&(m.exclusiveMaximum=v),typeof g=="number"&&(m.maximum=g,typeof v=="number"&&(v<=g?delete m.maximum:delete m.exclusiveMaximum)),typeof w=="number"&&(m.multipleOf=w);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:g}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof g=="number"&&(m.maxItems=g),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 w in h)m.properties[w]=this.process(h[w],{...d,path:[...d.path,"properties",w]});let g=new Set(Object.keys(h)),y=new Set([...g].filter(w=>{let v=o.shape[w]._zod;return this.io==="input"?v.optin===void 0:v.optout===void 0}));y.size>0&&(m.required=Array.from(y)),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,g)=>this.process(h,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=v=>"allOf"in v&&Object.keys(v).length===1,w=[...y(h)?h.allOf:[h],...y(g)?g.allOf:[g]];m.allOf=w;break}case"tuple":{let m=p;m.type="array";let h=o.items.map((w,v)=>this.process(w,{...d,path:[...d.path,"prefixItems",v]}));if(this.target==="draft-2020-12"?m.prefixItems=h:m.items=h,o.rest){let w=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?m.items=w:m.additionalItems=w}o.rest&&(m.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:y}=e._zod.bag;typeof g=="number"&&(m.minItems=g),typeof y=="number"&&(m.maxItems=y);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=kF(o.entries);h.every(g=>typeof g=="number")&&(m.type="number"),h.every(g=>typeof g=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(g))}else h.push(g);if(h.length!==0)if(h.length===1){let g=h[0];m.type=g===null?"null":typeof g,m.const=g}else h.every(g=>typeof g=="number")&&(m.type="number"),h.every(g=>typeof g=="string")&&(m.type="string"),h.every(g=>typeof g=="boolean")&&(m.type="string"),h.every(g=>g===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:w}=e._zod.bag;g!==void 0&&(h.minLength=g),y!==void 0&&(h.maxLength=y),w?w.length===1?(h.contentMediaType=w[0],Object.assign(m,h)):m.anyOf=w.map(v=>({...h,contentMediaType:v})):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),a.ref=o.innerType;break}case"success":{let m=p;m.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,p.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.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),a.ref=m;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,p.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,d),a.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let c=this.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),this.io==="input"&&zs(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,n){let r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=u=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let h=r.external.registry.get(u[0])?.id,g=r.external.uri??(w=>w);if(h)return{ref:g(h)};let y=u[1].defId??u[1].schema.id??`schema${this.counter++}`;return u[1].defId=y,{defId:y,ref:`${g("__shared")}#/${d}/${y}`}}if(u[1]===o)return{ref:"#"};let p=`#/${d}/`,m=u[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:p+m}},s=u=>{if(u[1].schema.$ref)return;let d=u[1],{ref:f,defId:p}=i(u);d.def={...d.schema},p&&(d.defId=p);let m=d.schema;for(let h in m)delete m[h];m.$ref=f};if(r.cycles==="throw")for(let u of this.seen.entries()){let d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of this.seen.entries()){let d=u[1];if(e===u[0]){s(u);continue}if(r.external){let p=r.external.registry.get(u[0])?.id;if(e!==u[0]&&p){s(u);continue}}if(this.metadataRegistry.get(u[0])?.id){s(u);continue}if(d.cycle){s(u);continue}if(d.count>1&&r.reused==="ref"){s(u);continue}}let a=(u,d)=>{let f=this.seen.get(u),p=f.def??f.schema,m={...p};if(f.ref===null)return;let h=f.ref;if(f.ref=null,h){a(h,d);let g=this.seen.get(h).schema;g.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(g)):(Object.assign(p,g),Object.assign(p,m))}f.isParent||this.override({zodSchema:u,jsonSchema:p,path:f.path??[]})};for(let u of[...this.seen.entries()].reverse())a(u[0],{target:this.target});let l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){let u=r.external.registry.get(e)?.id;if(!u)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(u)}Object.assign(l,o.def);let c=r.external?.defs??{};for(let u of this.seen.entries()){let d=u[1];d.def&&d.defId&&(c[d.defId]=d.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}});var LDe={};var DDe=C(()=>{});var Cw={};zn(Cw,{$ZodAny:()=>ise,$ZodArray:()=>jF,$ZodAsyncError:()=>wg,$ZodBase64:()=>Yie,$ZodBase64URL:()=>Zie,$ZodBigInt:()=>L6,$ZodBigIntFormat:()=>tse,$ZodBoolean:()=>BF,$ZodCIDRv4:()=>Kie,$ZodCIDRv6:()=>qie,$ZodCUID:()=>Lie,$ZodCUID2:()=>Die,$ZodCatch:()=>Cse,$ZodCheck:()=>Ti,$ZodCheckBigIntFormat:()=>cie,$ZodCheckEndsWith:()=>bie,$ZodCheckGreaterThan:()=>k6,$ZodCheckIncludes:()=>vie,$ZodCheckLengthEquals:()=>hie,$ZodCheckLessThan:()=>A6,$ZodCheckLowerCase:()=>yie,$ZodCheckMaxLength:()=>pie,$ZodCheckMaxSize:()=>uie,$ZodCheckMimeType:()=>_ie,$ZodCheckMinLength:()=>mie,$ZodCheckMinSize:()=>die,$ZodCheckMultipleOf:()=>aie,$ZodCheckNumberFormat:()=>lie,$ZodCheckOverwrite:()=>Sie,$ZodCheckProperty:()=>Cie,$ZodCheckRegex:()=>gie,$ZodCheckSizeEquals:()=>fie,$ZodCheckStartsWith:()=>xie,$ZodCheckStringFormat:()=>Pk,$ZodCheckUpperCase:()=>wie,$ZodCustom:()=>Ese,$ZodCustomStringFormat:()=>Qie,$ZodDate:()=>ase,$ZodDefault:()=>wse,$ZodDiscriminatedUnion:()=>cse,$ZodE164:()=>Jie,$ZodEmail:()=>Mie,$ZodEmoji:()=>Oie,$ZodEnum:()=>mse,$ZodError:()=>DF,$ZodFile:()=>gse,$ZodFunction:()=>a3,$ZodGUID:()=>Aie,$ZodIPv4:()=>Wie,$ZodIPv6:()=>Hie,$ZodISODate:()=>zie,$ZodISODateTime:()=>Bie,$ZodISODuration:()=>Vie,$ZodISOTime:()=>jie,$ZodIntersection:()=>use,$ZodJWT:()=>Xie,$ZodKSUID:()=>Uie,$ZodLazy:()=>Pse,$ZodLiteral:()=>hse,$ZodMap:()=>fse,$ZodNaN:()=>_se,$ZodNanoID:()=>Rie,$ZodNever:()=>zF,$ZodNonOptional:()=>xse,$ZodNull:()=>ose,$ZodNullable:()=>yse,$ZodNumber:()=>R6,$ZodNumberFormat:()=>ese,$ZodObject:()=>lse,$ZodOptional:()=>$6,$ZodPipe:()=>WF,$ZodPrefault:()=>vse,$ZodPromise:()=>Ise,$ZodReadonly:()=>Sse,$ZodRealError:()=>Ik,$ZodRecord:()=>dse,$ZodRegistry:()=>Ek,$ZodSet:()=>pse,$ZodString:()=>CT,$ZodStringFormat:()=>_o,$ZodSuccess:()=>bse,$ZodSymbol:()=>nse,$ZodTemplateLiteral:()=>Tse,$ZodTransform:()=>VF,$ZodTuple:()=>ST,$ZodType:()=>jn,$ZodULID:()=>$ie,$ZodURL:()=>Nie,$ZodUUID:()=>kie,$ZodUndefined:()=>rse,$ZodUnion:()=>D6,$ZodUnknown:()=>_T,$ZodVoid:()=>sse,$ZodXID:()=>Fie,$brand:()=>hoe,$constructor:()=>ce,$input:()=>Nse,$output:()=>Mse,Doc:()=>UF,JSONSchema:()=>LDe,JSONSchemaGenerator:()=>l2,NEVER:()=>moe,TimePrecision:()=>Dse,_any:()=>rae,_array:()=>a2,_base64:()=>r3,_base64url:()=>o3,_bigint:()=>Zse,_boolean:()=>Gse,_catch:()=>GTt,_cidrv4:()=>t3,_cidrv6:()=>n3,_coercedBigint:()=>Jse,_coercedBoolean:()=>Yse,_coercedDate:()=>sae,_coercedNumber:()=>jse,_coercedString:()=>Lse,_cuid:()=>G6,_cuid2:()=>Y6,_custom:()=>hae,_date:()=>iae,_default:()=>HTt,_discriminatedUnion:()=>RTt,_e164:()=>i3,_email:()=>B6,_emoji:()=>K6,_endsWith:()=>t2,_enum:()=>UTt,_file:()=>mae,_float32:()=>Wse,_float64:()=>Hse,_gt:()=>xw,_gte:()=>Du,_guid:()=>qF,_includes:()=>QF,_int:()=>Vse,_int32:()=>Kse,_int64:()=>Xse,_intersection:()=>LTt,_ipv4:()=>Q6,_ipv6:()=>e3,_isoDate:()=>Fse,_isoDateTime:()=>$se,_isoDuration:()=>Bse,_isoTime:()=>Use,_jwt:()=>s3,_ksuid:()=>X6,_lazy:()=>XTt,_length:()=>Mk,_literal:()=>zTt,_lowercase:()=>JF,_lt:()=>vw,_lte:()=>Yf,_map:()=>$Tt,_max:()=>Yf,_maxLength:()=>kk,_maxSize:()=>Ak,_mime:()=>n2,_min:()=>Du,_minLength:()=>Ib,_minSize:()=>PT,_multipleOf:()=>IT,_nan:()=>aae,_nanoid:()=>q6,_nativeEnum:()=>BTt,_negative:()=>cae,_never:()=>GF,_nonnegative:()=>dae,_nonoptional:()=>KTt,_nonpositive:()=>uae,_normalize:()=>r2,_null:()=>nae,_nullable:()=>WTt,_number:()=>zse,_optional:()=>VTt,_overwrite:()=>bw,_parse:()=>C6,_parseAsync:()=>_6,_pipe:()=>YTt,_positive:()=>lae,_promise:()=>QTt,_property:()=>fae,_readonly:()=>ZTt,_record:()=>DTt,_refine:()=>gae,_regex:()=>ZF,_safeParse:()=>S6,_safeParseAsync:()=>T6,_set:()=>FTt,_size:()=>YF,_startsWith:()=>e2,_string:()=>Rse,_stringFormat:()=>wae,_stringbool:()=>yae,_success:()=>qTt,_symbol:()=>eae,_templateLiteral:()=>JTt,_toLowerCase:()=>i2,_toUpperCase:()=>s2,_transform:()=>jTt,_trim:()=>o2,_tuple:()=>pae,_uint32:()=>qse,_uint64:()=>Qse,_ulid:()=>Z6,_undefined:()=>tae,_union:()=>OTt,_unknown:()=>TT,_uppercase:()=>XF,_url:()=>H6,_uuid:()=>z6,_uuidv4:()=>j6,_uuidv6:()=>V6,_uuidv7:()=>W6,_void:()=>oae,_xid:()=>J6,clone:()=>xs,config:()=>vs,flattenError:()=>$F,formatError:()=>FF,function:()=>xae,globalConfig:()=>EF,globalRegistry:()=>Oa,isValidBase64:()=>Gie,isValidBase64URL:()=>s1e,isValidJWT:()=>a1e,locales:()=>KF,parse:()=>wT,parseAsync:()=>vT,prettifyError:()=>Eoe,regexes:()=>bT,registry:()=>U6,safeParse:()=>koe,safeParseAsync:()=>Moe,toDotPath:()=>jLe,toJSONSchema:()=>Pb,treeifyError:()=>Poe,util:()=>Qe,version:()=>Iie});var Ql=C(()=>{_k();I6();Aoe();HF();M6();Pie();An();E6();kse();Ose();Tie();ODe();vae();RDe();DDe()});function hl(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_zod"in e))return!1;let n=e._zod;return typeof n=="object"&&n!==null&&"def"in n}function Zf(t){if(typeof t!="object"||t===null)return!1;let e=t;if(!("_def"in e)||"_zod"in e)return!1;let n=e._def;return typeof n=="object"&&n!=null&&"typeName"in n}function jr(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(hl(t)||Zf(t))}async function kT(t,e){if(hl(t))try{return{success:!0,data:await vT(t,e)}}catch(n){return{success:!1,error:n}}if(Zf(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function MT(t,e){if(hl(t))return await vT(t,e);if(Zf(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function NT(t){if(hl(t))return Oa.get(t)?.description;if(Zf(t)||"description"in t&&typeof t.description=="string")return t.description}function u2(t){return jr(t)?Zf(t)?t._def.typeName==="ZodString":hl(t)?t._zod.def.type==="string":!1:!1}function $De(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 AT(t){return hl(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 bae(t){return hl(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 FDe(t){return hl(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 UDe(t){return hl(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 c2(t,e=!1){if($De(t))return t.strict();if(AT(t)){let n=t._zod.def.shape;if(e)for(let[i,s]of Object.entries(t._zod.def.shape)){if(AT(s))n[i]=c2(s,e);else if(bae(s)){let l=s._zod.def.element;AT(l)&&(l=c2(l,e)),n[i]=xs(s,{...s._zod.def,element:l})}else n[i]=s;let a=Oa.get(s);a&&Oa.add(n[i],a)}let r=xs(t,{...t._zod.def,shape:n,catchall:GF(zF)}),o=Oa.get(t);return o&&Oa.add(r,o),r}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function eIt(t){return Zf(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function tIt(t){return hl(t)&&t._zod.def.type==="pipe"}function ET(t,e,n){let r=n.get(t);if(r!==void 0)return r;if(Zf(t))return eIt(t)?ET(t._def.schema,e,n):t;if(hl(t)){let o=t;if(tIt(t)&&(o=ET(t._zod.def.in,e,n)),e){if(AT(o)){let s={};for(let[a,l]of Object.entries(o._zod.def.shape))s[a]=ET(l,e,n);o=xs(o,{...o._zod.def,shape:s})}else if(bae(o)){let s=ET(o._zod.def.element,e,n);o=xs(o,{...o._zod.def,element:s})}else if(FDe(o)){let s=ET(o._zod.def.innerType,e,n);o=xs(o,{...o._zod.def,innerType:s})}else if(UDe(o)){let s=ET(o._zod.def.innerType,e,n);o=xs(o,{...o._zod.def,innerType:s})}}let i=Oa.get(t);return i&&Oa.add(o,i),n.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Cae(t,e=!1){return ET(t,e,new WeakMap)}function _ae(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}var vg=C(()=>{Ql()});var Bd=C(()=>{$n();vg()});var zDe,BDe,jDe,l3=C(()=>{zDe=Symbol("Let zodToJsonSchema decide on which parser to use"),BDe={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"},jDe=t=>typeof t=="string"?{...BDe,name:t}:{...BDe,...t}});var VDe,Sae=C(()=>{l3();VDe=t=>{let e=jDe(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}}});var c3,u3=C(()=>{c3=(t,e)=>{let n=0;for(;n{u3()});function Tae(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage={...t.errorMessage,[e]:n})}function Er(t,e,n,r,o){t[e]=n,Tae(t,e,r,o)}var Eb=C(()=>{});var yr,Iae,Ct,xg,d2=C(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},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 s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(yr||(yr={}));(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Iae||(Iae={}));Ct=yr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xg=t=>{switch(typeof t){case"undefined":return Ct.undefined;case"string":return Ct.string;case"number":return Number.isNaN(t)?Ct.nan:Ct.number;case"boolean":return Ct.boolean;case"function":return Ct.function;case"bigint":return Ct.bigint;case"symbol":return Ct.symbol;case"object":return Array.isArray(t)?Ct.array:t===null?Ct.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ct.promise:typeof Map<"u"&&t instanceof Map?Ct.map:typeof Set<"u"&&t instanceof Set?Ct.set:typeof Date<"u"&&t instanceof Date?Ct.date:Ct.object;default:return Ct.unknown}}});var $e,nIt,$u,d3=C(()=>{d2();$e=yr.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"]),nIt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$u=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];n[i]=n[i]||[],n[i].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};$u.create=t=>new $u(t)});var rIt,_w,Pae=C(()=>{d3();d2();rIt=(t,e)=>{let n;switch(t.code){case $e.invalid_type:t.received===Ct.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case $e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,yr.jsonStringifyReplacer)}`;break;case $e.unrecognized_keys:n=`Unrecognized key(s) in object: ${yr.joinValues(t.keys,", ")}`;break;case $e.invalid_union:n="Invalid input";break;case $e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${yr.joinValues(t.options)}`;break;case $e.invalid_enum_value:n=`Invalid enum value. Expected ${yr.joinValues(t.options)}, received '${t.received}'`;break;case $e.invalid_arguments:n="Invalid function arguments";break;case $e.invalid_return_type:n="Invalid function return type";break;case $e.invalid_date:n="Invalid date";break;case $e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:yr.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case $e.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case $e.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case $e.custom:n="Invalid input";break;case $e.invalid_intersection_types:n="Intersection results could not be merged";break;case $e.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case $e.not_finite:n="Number must be finite";break;default:n=e.defaultError,yr.assertNever(t)}return{message:n}},_w=rIt});function oIt(t){WDe=t}function Nk(){return WDe}var WDe,f3=C(()=>{Pae();WDe=_w});function ut(t,e){let n=Nk(),r=f2({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===_w?void 0:_w].filter(o=>!!o)});t.common.issues.push(r)}var f2,iIt,gl,wn,OT,ec,p3,m3,Ab,Ok,Eae=C(()=>{f3();Pae();f2=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},iIt=[];gl=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return wn;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let i=await o.key,s=await o.value;r.push({key:i,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return wn;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:e.value,value:r}}},wn=Object.freeze({status:"aborted"}),OT=t=>({status:"dirty",value:t}),ec=t=>({status:"valid",value:t}),p3=t=>t.status==="aborted",m3=t=>t.status==="dirty",Ab=t=>t.status==="valid",Ok=t=>typeof Promise<"u"&&t instanceof Promise});var HDe=C(()=>{});var Vt,KDe=C(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Vt||(Vt={}))});function Jn(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))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:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}function ZDe(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function CIt(t){return new RegExp(`^${ZDe(t)}$`)}function JDe(t){let e=`${YDe}T${ZDe(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function _It(t,e){return!!((e==="v4"||!e)&&hIt.test(t)||(e==="v6"||!e)&&yIt.test(t))}function SIt(t,e){if(!dIt.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function TIt(t,e){return!!((e==="v4"||!e)&&gIt.test(t)||(e==="v6"||!e)&&wIt.test(t))}function IIt(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}function Rk(t){if(t instanceof Fu){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Xf.create(Rk(r))}return new Fu({...t._def,shape:()=>e})}else return t instanceof Iw?new Iw({...t._def,type:Rk(t.element)}):t instanceof Xf?Xf.create(Rk(t.unwrap())):t instanceof Cg?Cg.create(Rk(t.unwrap())):t instanceof bg?bg.create(t.items.map(e=>Rk(e))):t}function kae(t,e){let n=xg(t),r=xg(e);if(t===e)return{valid:!0,data:t};if(n===Ct.object&&r===Ct.object){let o=yr.objectKeys(e),i=yr.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let l=kae(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===Ct.array&&r===Ct.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{let i=t(r);if(i instanceof Promise)return i.then(s=>{if(!s){let a=GDe(e,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!i){let s=GDe(e,r),a=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Mb.create()}var Qf,qDe,ar,sIt,aIt,lIt,cIt,uIt,dIt,fIt,pIt,mIt,Aae,hIt,gIt,yIt,wIt,vIt,xIt,YDe,bIt,kb,RT,LT,DT,$T,Lk,FT,UT,Mb,Tw,Nm,Dk,Iw,Fu,BT,Sw,h3,zT,bg,g3,$k,Fk,y3,jT,VT,WT,HT,Nb,ep,Xf,Cg,KT,qT,Uk,PIt,p2,m2,GT,EIt,he,AIt,e$e,t$e,kIt,MIt,n$e,NIt,OIt,RIt,LIt,DIt,$It,FIt,UIt,BIt,zIt,jIt,VIt,WIt,HIt,KIt,qIt,GIt,YIt,ZIt,JIt,XIt,QIt,e0t,t0t,n0t,r0t,o0t,i0t,s0t,a0t,l0t,c0t,u0t,d0t,r$e=C(()=>{d3();f3();KDe();Eae();d2();Qf=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,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}},qDe=(t,e)=>{if(Ab(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 n=new $u(t.common.issues);return this._error=n,this._error}}};ar=class{get description(){return this._def.description}_getType(e){return xg(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:xg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gl,ctx:{common:e.parent.common,data:e.data,parsedType:xg(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ok(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xg(e)},o=this._parseSync({data:e,path:r.path,parent:r});return qDe(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xg(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Ab(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Ab(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xg(e)},o=this._parse({data:e,path:r.path,parent:r}),i=await(Ok(o)?o:Promise.resolve(o));return qDe(r,i)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:$e.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new ep({schema:this,typeName:he.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:n=>this["~validate"](n)}}optional(){return Xf.create(this,this._def)}nullable(){return Cg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Iw.create(this)}promise(){return Nb.create(this,this._def)}or(e){return BT.create([this,e],this._def)}and(e){return zT.create(this,e,this._def)}transform(e){return new ep({...Jn(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new KT({...Jn(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new p2({typeName:he.ZodBranded,type:this,...Jn(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new qT({...Jn(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return m2.create(this,e)}readonly(){return GT.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sIt=/^c[^\s-]{8,}$/i,aIt=/^[0-9a-z]+$/,lIt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cIt=/^[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,uIt=/^[a-z0-9_-]{21}$/i,dIt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fIt=/^[-+]?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)?)??$/,pIt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mIt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hIt=/^(?:(?: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])$/,gIt=/^(?:(?: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])$/,yIt=/^(([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]))$/,wIt=/^(([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])$/,vIt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xIt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,YDe="((\\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])))",bIt=new RegExp(`^${YDe}$`);kb=class t extends ar{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ct.string){let i=this._getOrReturnCtx(e);return ut(i,{code:$e.invalid_type,expected:Ct.string,received:i.parsedType}),wn}let r=new gl,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:$e.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.lengthe.test(o),{validation:n,code:$e.invalid_string,...Vt.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Vt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Vt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Vt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Vt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Vt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Vt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Vt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Vt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Vt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Vt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Vt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Vt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Vt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Vt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Vt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Vt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Vt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Vt.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Vt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Vt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Vt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Vt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Vt.errToObj(n)})}nonempty(e){return this.min(1,Vt.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew kb({checks:[],typeName:he.ZodString,coerce:t?.coerce??!1,...Jn(t)});RT=class t extends ar{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)!==Ct.number){let i=this._getOrReturnCtx(e);return ut(i,{code:$e.invalid_type,expected:Ct.number,received:i.parsedType}),wn}let r,o=new gl;for(let i of this._def.checks)i.kind==="int"?yr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?IIt(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.not_finite,message:i.message}),o.dirty()):yr.assertNever(i);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Vt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Vt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Vt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Vt.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Vt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Vt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Vt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Vt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Vt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Vt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Vt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Vt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Vt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Vt.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&yr.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.valuenew RT({checks:[],typeName:he.ZodNumber,coerce:t?.coerce||!1,...Jn(t)});LT=class t extends ar{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)!==Ct.bigint)return this._getInvalidInput(e);let r,o=new gl;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ut(r,{code:$e.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):yr.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return ut(n,{code:$e.invalid_type,expected:Ct.bigint,received:n.parsedType}),wn}gte(e,n){return this.setLimit("min",e,!0,Vt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Vt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Vt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Vt.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Vt.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Vt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Vt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Vt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Vt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Vt.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew LT({checks:[],typeName:he.ZodBigInt,coerce:t?.coerce??!1,...Jn(t)});DT=class extends ar{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ct.boolean){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.boolean,received:r.parsedType}),wn}return ec(e.data)}};DT.create=t=>new DT({typeName:he.ZodBoolean,coerce:t?.coerce||!1,...Jn(t)});$T=class t extends ar{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ct.date){let i=this._getOrReturnCtx(e);return ut(i,{code:$e.invalid_type,expected:Ct.date,received:i.parsedType}),wn}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return ut(i,{code:$e.invalid_date}),wn}let r=new gl,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),ut(o,{code:$e.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):yr.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Vt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Vt.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew $T({checks:[],coerce:t?.coerce||!1,typeName:he.ZodDate,...Jn(t)});Lk=class extends ar{_parse(e){if(this._getType(e)!==Ct.symbol){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.symbol,received:r.parsedType}),wn}return ec(e.data)}};Lk.create=t=>new Lk({typeName:he.ZodSymbol,...Jn(t)});FT=class extends ar{_parse(e){if(this._getType(e)!==Ct.undefined){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.undefined,received:r.parsedType}),wn}return ec(e.data)}};FT.create=t=>new FT({typeName:he.ZodUndefined,...Jn(t)});UT=class extends ar{_parse(e){if(this._getType(e)!==Ct.null){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.null,received:r.parsedType}),wn}return ec(e.data)}};UT.create=t=>new UT({typeName:he.ZodNull,...Jn(t)});Mb=class extends ar{constructor(){super(...arguments),this._any=!0}_parse(e){return ec(e.data)}};Mb.create=t=>new Mb({typeName:he.ZodAny,...Jn(t)});Tw=class extends ar{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ec(e.data)}};Tw.create=t=>new Tw({typeName:he.ZodUnknown,...Jn(t)});Nm=class extends ar{_parse(e){let n=this._getOrReturnCtx(e);return ut(n,{code:$e.invalid_type,expected:Ct.never,received:n.parsedType}),wn}};Nm.create=t=>new Nm({typeName:he.ZodNever,...Jn(t)});Dk=class extends ar{_parse(e){if(this._getType(e)!==Ct.undefined){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.void,received:r.parsedType}),wn}return ec(e.data)}};Dk.create=t=>new Dk({typeName:he.ZodVoid,...Jn(t)});Iw=class t extends ar{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==Ct.array)return ut(n,{code:$e.invalid_type,expected:Ct.array,received:n.parsedType}),wn;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,a=n.data.lengtho.maxLength.value&&(ut(n,{code:$e.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new Qf(n,s,n.path,a)))).then(s=>gl.mergeArray(r,s));let i=[...n.data].map((s,a)=>o.type._parseSync(new Qf(n,s,n.path,a)));return gl.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Vt.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Vt.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Vt.toString(n)}})}nonempty(e){return this.min(1,e)}};Iw.create=(t,e)=>new Iw({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...Jn(e)});Fu=class t extends ar{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(),n=yr.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ct.object){let c=this._getOrReturnCtx(e);return ut(c,{code:$e.invalid_type,expected:Ct.object,received:c.parsedType}),wn}let{status:r,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Nm&&this._def.unknownKeys==="strip"))for(let c in o.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qf(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Nm){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(ut(o,{code:$e.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Qf(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>gl.mergeObjectSync(r,c)):gl.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Vt.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Vt.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of yr.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of yr.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Rk(this)}partial(e){let n={};for(let r of yr.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of yr.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Xf;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return XDe(yr.objectKeys(this.shape))}};Fu.create=(t,e)=>new Fu({shape:()=>t,unknownKeys:"strip",catchall:Nm.create(),typeName:he.ZodObject,...Jn(e)});Fu.strictCreate=(t,e)=>new Fu({shape:()=>t,unknownKeys:"strict",catchall:Nm.create(),typeName:he.ZodObject,...Jn(e)});Fu.lazycreate=(t,e)=>new Fu({shape:t,unknownKeys:"strip",catchall:Nm.create(),typeName:he.ZodObject,...Jn(e)});BT=class extends ar{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new $u(a.ctx.common.issues));return ut(n,{code:$e.invalid_union,unionErrors:s}),wn}if(n.common.async)return Promise.all(r.map(async i=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(l=>new $u(l));return ut(n,{code:$e.invalid_union,unionErrors:a}),wn}}get options(){return this._def.options}};BT.create=(t,e)=>new BT({options:t,typeName:he.ZodUnion,...Jn(e)});Sw=t=>t instanceof jT?Sw(t.schema):t instanceof ep?Sw(t.innerType()):t instanceof VT?[t.value]:t instanceof WT?t.options:t instanceof HT?yr.objectValues(t.enum):t instanceof KT?Sw(t._def.innerType):t instanceof FT?[void 0]:t instanceof UT?[null]:t instanceof Xf?[void 0,...Sw(t.unwrap())]:t instanceof Cg?[null,...Sw(t.unwrap())]:t instanceof p2||t instanceof GT?Sw(t.unwrap()):t instanceof qT?Sw(t._def.innerType):[],h3=class t extends ar{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ct.object)return ut(n,{code:$e.invalid_type,expected:Ct.object,received:n.parsedType}),wn;let r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ut(n,{code:$e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),wn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let i of n){let s=Sw(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...Jn(r)})}};zT=class extends ar{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(i,s)=>{if(p3(i)||p3(s))return wn;let a=kae(i.value,s.value);return a.valid?((m3(i)||m3(s))&&n.dirty(),{status:n.value,value:a.data}):(ut(r,{code:$e.invalid_intersection_types}),wn)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};zT.create=(t,e,n)=>new zT({left:t,right:e,typeName:he.ZodIntersection,...Jn(n)});bg=class t extends ar{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ct.array)return ut(r,{code:$e.invalid_type,expected:Ct.array,received:r.parsedType}),wn;if(r.data.lengththis._def.items.length&&(ut(r,{code:$e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Qf(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>gl.mergeArray(n,s)):gl.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};bg.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bg({items:t,typeName:he.ZodTuple,rest:null,...Jn(e)})};g3=class t extends ar{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ct.object)return ut(r,{code:$e.invalid_type,expected:Ct.object,received:r.parsedType}),wn;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in r.data)o.push({key:i._parse(new Qf(r,a,r.path,a)),value:s._parse(new Qf(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?gl.mergeObjectAsync(n,o):gl.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof ar?new t({keyType:e,valueType:n,typeName:he.ZodRecord,...Jn(r)}):new t({keyType:kb.create(),valueType:e,typeName:he.ZodRecord,...Jn(n)})}},$k=class extends ar{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ct.map)return ut(r,{code:$e.invalid_type,expected:Ct.map,received:r.parsedType}),wn;let o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Qf(r,a,r.path,[c,"key"])),value:i._parse(new Qf(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return wn;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return wn;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};$k.create=(t,e,n)=>new $k({valueType:e,keyType:t,typeName:he.ZodMap,...Jn(n)});Fk=class t extends ar{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ct.set)return ut(r,{code:$e.invalid_type,expected:Ct.set,received:r.parsedType}),wn;let o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(ut(r,{code:$e.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return wn;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>i._parse(new Qf(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:Vt.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Vt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Fk.create=(t,e)=>new Fk({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...Jn(e)});y3=class t extends ar{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ct.function)return ut(n,{code:$e.invalid_type,expected:Ct.function,received:n.parsedType}),wn;function r(a,l){return f2({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nk(),_w].filter(c=>!!c),issueData:{code:$e.invalid_arguments,argumentsError:l}})}function o(a,l){return f2({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Nk(),_w].filter(c=>!!c),issueData:{code:$e.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Nb){let a=this;return ec(async function(...l){let c=new $u([]),u=await a._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(r(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(o(d,p)),c})})}else{let a=this;return ec(function(...l){let c=a._def.args.safeParse(l,i);if(!c.success)throw new $u([r(l,c.error)]);let u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new $u([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:bg.create(e).rest(Tw.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,n,r){return new t({args:e||bg.create([]).rest(Tw.create()),returns:n||Tw.create(),typeName:he.ZodFunction,...Jn(r)})}},jT=class extends ar{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};jT.create=(t,e)=>new jT({getter:t,typeName:he.ZodLazy,...Jn(e)});VT=class extends ar{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return ut(n,{received:n.data,code:$e.invalid_literal,expected:this._def.value}),wn}return{status:"valid",value:e.data}}get value(){return this._def.value}};VT.create=(t,e)=>new VT({value:t,typeName:he.ZodLiteral,...Jn(e)});WT=class t extends ar{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return ut(n,{expected:yr.joinValues(r),received:n.parsedType,code:$e.invalid_type}),wn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return ut(n,{received:n.data,code:$e.invalid_enum_value,options:r}),wn}return ec(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};WT.create=XDe;HT=class extends ar{_parse(e){let n=yr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ct.string&&r.parsedType!==Ct.number){let o=yr.objectValues(n);return ut(r,{expected:yr.joinValues(o),received:r.parsedType,code:$e.invalid_type}),wn}if(this._cache||(this._cache=new Set(yr.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=yr.objectValues(n);return ut(r,{received:r.data,code:$e.invalid_enum_value,options:o}),wn}return ec(e.data)}get enum(){return this._def.values}};HT.create=(t,e)=>new HT({values:t,typeName:he.ZodNativeEnum,...Jn(e)});Nb=class extends ar{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ct.promise&&n.common.async===!1)return ut(n,{code:$e.invalid_type,expected:Ct.promise,received:n.parsedType}),wn;let r=n.parsedType===Ct.promise?n.data:Promise.resolve(n.data);return ec(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Nb.create=(t,e)=>new Nb({type:t,typeName:he.ZodPromise,...Jn(e)});ep=class extends ar{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{ut(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return wn;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?wn:l.status==="dirty"?OT(l.value):n.value==="dirty"?OT(l.value):l});{if(n.value==="aborted")return wn;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?wn:a.status==="dirty"?OT(a.value):n.value==="dirty"?OT(a.value):a}}if(o.type==="refinement"){let s=a=>{let l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?wn:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?wn:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ab(s))return wn;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Ab(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):wn);yr.assertNever(o)}};ep.create=(t,e,n)=>new ep({schema:t,typeName:he.ZodEffects,effect:e,...Jn(n)});ep.createWithPreprocess=(t,e,n)=>new ep({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...Jn(n)});Xf=class extends ar{_parse(e){return this._getType(e)===Ct.undefined?ec(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xf.create=(t,e)=>new Xf({innerType:t,typeName:he.ZodOptional,...Jn(e)});Cg=class extends ar{_parse(e){return this._getType(e)===Ct.null?ec(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Cg.create=(t,e)=>new Cg({innerType:t,typeName:he.ZodNullable,...Jn(e)});KT=class extends ar{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===Ct.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};KT.create=(t,e)=>new KT({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Jn(e)});qT=class extends ar{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ok(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new $u(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new $u(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};qT.create=(t,e)=>new qT({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Jn(e)});Uk=class extends ar{_parse(e){if(this._getType(e)!==Ct.nan){let r=this._getOrReturnCtx(e);return ut(r,{code:$e.invalid_type,expected:Ct.nan,received:r.parsedType}),wn}return{status:"valid",value:e.data}}};Uk.create=t=>new Uk({typeName:he.ZodNaN,...Jn(t)});PIt=Symbol("zod_brand"),p2=class extends ar{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},m2=class t extends ar{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?wn:i.status==="dirty"?(n.dirty(),OT(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?wn:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:he.ZodPipeline})}},GT=class extends ar{_parse(e){let n=this._def.innerType._parse(e),r=o=>(Ab(o)&&(o.value=Object.freeze(o.value)),o);return Ok(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};GT.create=(t,e)=>new GT({innerType:t,typeName:he.ZodReadonly,...Jn(e)});EIt={object:Fu.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"})(he||(he={}));AIt=(t,e={message:`Input not instance of ${t.name}`})=>QDe(n=>n instanceof t,e),e$e=kb.create,t$e=RT.create,kIt=Uk.create,MIt=LT.create,n$e=DT.create,NIt=$T.create,OIt=Lk.create,RIt=FT.create,LIt=UT.create,DIt=Mb.create,$It=Tw.create,FIt=Nm.create,UIt=Dk.create,BIt=Iw.create,zIt=Fu.create,jIt=Fu.strictCreate,VIt=BT.create,WIt=h3.create,HIt=zT.create,KIt=bg.create,qIt=g3.create,GIt=$k.create,YIt=Fk.create,ZIt=y3.create,JIt=jT.create,XIt=VT.create,QIt=WT.create,e0t=HT.create,t0t=Nb.create,n0t=ep.create,r0t=Xf.create,o0t=Cg.create,i0t=ep.createWithPreprocess,s0t=m2.create,a0t=()=>e$e().optional(),l0t=()=>t$e().optional(),c0t=()=>n$e().optional(),u0t={string:t=>kb.create({...t,coerce:!0}),number:t=>RT.create({...t,coerce:!0}),boolean:t=>DT.create({...t,coerce:!0}),bigint:t=>LT.create({...t,coerce:!0}),date:t=>$T.create({...t,coerce:!0})},d0t=wn});var we={};zn(we,{BRAND:()=>PIt,DIRTY:()=>OT,EMPTY_PATH:()=>iIt,INVALID:()=>wn,NEVER:()=>d0t,OK:()=>ec,ParseStatus:()=>gl,Schema:()=>ar,ZodAny:()=>Mb,ZodArray:()=>Iw,ZodBigInt:()=>LT,ZodBoolean:()=>DT,ZodBranded:()=>p2,ZodCatch:()=>qT,ZodDate:()=>$T,ZodDefault:()=>KT,ZodDiscriminatedUnion:()=>h3,ZodEffects:()=>ep,ZodEnum:()=>WT,ZodError:()=>$u,ZodFirstPartyTypeKind:()=>he,ZodFunction:()=>y3,ZodIntersection:()=>zT,ZodIssueCode:()=>$e,ZodLazy:()=>jT,ZodLiteral:()=>VT,ZodMap:()=>$k,ZodNaN:()=>Uk,ZodNativeEnum:()=>HT,ZodNever:()=>Nm,ZodNull:()=>UT,ZodNullable:()=>Cg,ZodNumber:()=>RT,ZodObject:()=>Fu,ZodOptional:()=>Xf,ZodParsedType:()=>Ct,ZodPipeline:()=>m2,ZodPromise:()=>Nb,ZodReadonly:()=>GT,ZodRecord:()=>g3,ZodSchema:()=>ar,ZodSet:()=>Fk,ZodString:()=>kb,ZodSymbol:()=>Lk,ZodTransformer:()=>ep,ZodTuple:()=>bg,ZodType:()=>ar,ZodUndefined:()=>FT,ZodUnion:()=>BT,ZodUnknown:()=>Tw,ZodVoid:()=>Dk,addIssueToContext:()=>ut,any:()=>DIt,array:()=>BIt,bigint:()=>MIt,boolean:()=>n$e,coerce:()=>u0t,custom:()=>QDe,date:()=>NIt,datetimeRegex:()=>JDe,defaultErrorMap:()=>_w,discriminatedUnion:()=>WIt,effect:()=>n0t,enum:()=>QIt,function:()=>ZIt,getErrorMap:()=>Nk,getParsedType:()=>xg,instanceof:()=>AIt,intersection:()=>HIt,isAborted:()=>p3,isAsync:()=>Ok,isDirty:()=>m3,isValid:()=>Ab,late:()=>EIt,lazy:()=>JIt,literal:()=>XIt,makeIssue:()=>f2,map:()=>GIt,nan:()=>kIt,nativeEnum:()=>e0t,never:()=>FIt,null:()=>LIt,nullable:()=>o0t,number:()=>t$e,object:()=>zIt,objectUtil:()=>Iae,oboolean:()=>c0t,onumber:()=>l0t,optional:()=>r0t,ostring:()=>a0t,pipeline:()=>s0t,preprocess:()=>i0t,promise:()=>t0t,quotelessJson:()=>nIt,record:()=>qIt,set:()=>YIt,setErrorMap:()=>oIt,strictObject:()=>jIt,string:()=>e$e,symbol:()=>OIt,transformer:()=>n0t,tuple:()=>KIt,undefined:()=>RIt,union:()=>VIt,unknown:()=>$It,util:()=>yr,void:()=>UIt});var h2=C(()=>{f3();Eae();HDe();d2();r$e();d3()});var _g=C(()=>{h2();h2()});function o$e(t,e){let n={type:"array"};return t.type?._def&&t.type?._def?.typeName!==he.ZodAny&&(n.items=Tn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Er(n,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Er(n,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Er(n,"minItems",t.exactLength.value,t.exactLength.message,e),Er(n,"maxItems",t.exactLength.value,t.exactLength.message,e)),n}var Mae=C(()=>{Eb();bs();_g()});function i$e(t,e){let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Er(n,"minimum",r.value,r.message,e):Er(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Er(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Er(n,"maximum",r.value,r.message,e):Er(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Er(n,"maximum",r.value,r.message,e));break;case"multipleOf":Er(n,"multipleOf",r.value,r.message,e);break}return n}var Nae=C(()=>{Eb()});function s$e(){return{type:"boolean"}}var Oae=C(()=>{});function w3(t,e){return Tn(t.type._def,e)}var v3=C(()=>{bs()});var a$e,Rae=C(()=>{bs();a$e=(t,e)=>Tn(t.innerType._def,e)});function Lae(t,e,n){let r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(o=>Lae(t,e,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return f0t(t,e)}}var f0t,Dae=C(()=>{Eb();f0t=(t,e)=>{let n={type:"integer",format:"unix-time"};if(e.target==="openApi3")return n;for(let r of t.checks)switch(r.kind){case"min":Er(n,"minimum",r.value,r.message,e);break;case"max":Er(n,"maximum",r.value,r.message,e);break}return n}});function l$e(t,e){return{...Tn(t.innerType._def,e),default:t.defaultValue()}}var $ae=C(()=>{bs()});function c$e(t,e){return e.effectStrategy==="input"?Tn(t.schema._def,e):ci(e)}var Fae=C(()=>{Jf();bs()});function u$e(t){return{type:"string",enum:Array.from(t.values)}}var Uae=C(()=>{});function d$e(t,e){let n=[Tn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Tn(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(i=>{if(p0t(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(r=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...l}=i;s=l}else r=void 0;o.push(s)}}),o.length?{allOf:o,...r}:void 0}var p0t,Bae=C(()=>{bs();p0t=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function f$e(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}var zae=C(()=>{});function x3(t,e){let n={type:"string"};if(t.checks)for(let r of t.checks)switch(r.kind){case"min":Er(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e);break;case"max":Er(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Rm(n,"email",r.message,e);break;case"format:idn-email":Rm(n,"idn-email",r.message,e);break;case"pattern:zod":Uc(n,Om.email,r.message,e);break}break;case"url":Rm(n,"uri",r.message,e);break;case"uuid":Rm(n,"uuid",r.message,e);break;case"regex":Uc(n,r.regex,r.message,e);break;case"cuid":Uc(n,Om.cuid,r.message,e);break;case"cuid2":Uc(n,Om.cuid2,r.message,e);break;case"startsWith":Uc(n,RegExp(`^${Vae(r.value,e)}`),r.message,e);break;case"endsWith":Uc(n,RegExp(`${Vae(r.value,e)}$`),r.message,e);break;case"datetime":Rm(n,"date-time",r.message,e);break;case"date":Rm(n,"date",r.message,e);break;case"time":Rm(n,"time",r.message,e);break;case"duration":Rm(n,"duration",r.message,e);break;case"length":Er(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e),Er(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"includes":Uc(n,RegExp(Vae(r.value,e)),r.message,e);break;case"ip":r.version!=="v6"&&Rm(n,"ipv4",r.message,e),r.version!=="v4"&&Rm(n,"ipv6",r.message,e);break;case"base64url":Uc(n,Om.base64url,r.message,e);break;case"jwt":Uc(n,Om.jwt,r.message,e);break;case"cidr":r.version!=="v6"&&Uc(n,Om.ipv4Cidr,r.message,e),r.version!=="v4"&&Uc(n,Om.ipv6Cidr,r.message,e);break;case"emoji":Uc(n,Om.emoji(),r.message,e);break;case"ulid":Uc(n,Om.ulid,r.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Rm(n,"binary",r.message,e);break;case"contentEncoding:base64":Er(n,"contentEncoding","base64",r.message,e);break;case"pattern:zod":Uc(n,Om.base64,r.message,e);break}break;case"nanoid":Uc(n,Om.nanoid,r.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function Vae(t,e){return e.patternStrategy==="escape"?h0t(t):t}function h0t(t){let e="";for(let n=0;no.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&r.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,...n&&r.errorMessages&&{errorMessage:{format:n}}})):Er(t,"format",e,n,r)}function Uc(t,e,n,r){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&r.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:p$e(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Er(t,"pattern",p$e(e,r),n,r)}function p$e(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let n={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=n.i?t.source.toLowerCase():t.source,o="",i=!1,s=!1,a=!1;for(let l=0;l{Eb();Om={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:()=>(jae===void 0&&(jae=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jae),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-_]*$/};m0t=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function C3(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===he.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((r,o)=>({...r,[o]:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??ci(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let n={type:"object",additionalProperties:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return n;if(t.keyType?._def.typeName===he.ZodString&&t.keyType._def.checks?.length){let{type:r,...o}=x3(t.keyType._def,e);return{...n,propertyNames:o}}else{if(t.keyType?._def.typeName===he.ZodEnum)return{...n,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===he.ZodBranded&&t.keyType._def.type._def.typeName===he.ZodString&&t.keyType._def.type._def.checks?.length){let{type:r,...o}=w3(t.keyType._def,e);return{...n,propertyNames:o}}}return n}var _3=C(()=>{Jf();v3();b3();bs();_g()});function m$e(t,e){return e.mapStrategy==="record"?C3(t,e):{type:"array",maxItems:125,items:{type:"array",items:[Tn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ci(e),Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ci(e)],minItems:2,maxItems:2}}}var Wae=C(()=>{Jf();_3();bs()});function h$e(t){let e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),r=Array.from(new Set(n.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}var Hae=C(()=>{});function g$e(t){return t.target==="openAi"?void 0:{not:ci({...t,currentPath:[...t.currentPath,"not"]})}}var Kae=C(()=>{Jf()});function y$e(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var qae=C(()=>{});function v$e(t,e){if(e.target==="openApi3")return w$e(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in g2&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,i)=>{let s=g2[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":return i._def.value===null?[...o,"null"]:o;default:return o}},[]);if(r.length===n.length){let o=r.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:n.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(i=>!r.includes(i))],[])};return w$e(t,e)}var g2,w$e,S3=C(()=>{bs();g2={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};w$e=(t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,o)=>Tn(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0}});function x$e(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:g2[t.innerType._def.typeName],nullable:!0}:{type:[g2[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let r=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let n=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}var Gae=C(()=>{S3();bs()});function b$e(t,e){let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Tae(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Er(n,"minimum",r.value,r.message,e):Er(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Er(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Er(n,"maximum",r.value,r.message,e):Er(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Er(n,"maximum",r.value,r.message,e));break;case"multipleOf":Er(n,"multipleOf",r.value,r.message,e);break}return n}var Yae=C(()=>{Eb()});function C$e(t,e){let n=e.target==="openAi",r={type:"object",properties:{}},o=[],i=t.shape();for(let a in i){let l=i[a];if(l===void 0||l._def===void 0)continue;let c=y0t(l);c&&n&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);let u=Tn(l._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});u!==void 0&&(r.properties[a]=u,c||o.push(a))}o.length&&(r.required=o);let s=g0t(t,e);return s!==void 0&&(r.additionalProperties=s),r}function g0t(t,e){if(t.catchall._def.typeName!=="ZodNever")return Tn(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 y0t(t){try{return t.isOptional()}catch{return!0}}var Zae=C(()=>{bs()});var _$e,Jae=C(()=>{Jf();bs();_$e=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Tn(t.innerType._def,e);let n=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return n?{anyOf:[{not:ci(e)},n]}:ci(e)}});var S$e,Xae=C(()=>{bs();S$e=(t,e)=>{if(e.pipeStrategy==="input")return Tn(t.in._def,e);if(e.pipeStrategy==="output")return Tn(t.out._def,e);let n=Tn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]});return{allOf:[n,Tn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]})].filter(r=>r!==void 0)}}});function T$e(t,e){return Tn(t.type._def,e)}var Qae=C(()=>{bs()});function I$e(t,e){let n={type:"array",uniqueItems:!0,items:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Er(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Er(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var ele=C(()=>{Eb();bs()});function P$e(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Tn(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Tn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Tn(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}var tle=C(()=>{bs()});function E$e(t){return{not:ci(t)}}var nle=C(()=>{Jf()});function A$e(t){return ci(t)}var rle=C(()=>{Jf()});var k$e,ole=C(()=>{bs();k$e=(t,e)=>Tn(t.innerType._def,e)});var M$e,ile=C(()=>{Jf();Mae();Nae();Oae();v3();Rae();Dae();$ae();Fae();Uae();Bae();zae();b3();_3();Wae();Hae();Kae();qae();S3();Gae();Yae();Zae();Jae();Xae();Qae();ele();tle();nle();rle();ole();_g();M$e=(t,e,n)=>{switch(e){case he.ZodString:return x3(t,n);case he.ZodNumber:return b$e(t,n);case he.ZodObject:return C$e(t,n);case he.ZodBigInt:return i$e(t,n);case he.ZodBoolean:return s$e();case he.ZodDate:return Lae(t,n);case he.ZodUndefined:return E$e(n);case he.ZodNull:return y$e(n);case he.ZodArray:return o$e(t,n);case he.ZodUnion:case he.ZodDiscriminatedUnion:return v$e(t,n);case he.ZodIntersection:return d$e(t,n);case he.ZodTuple:return P$e(t,n);case he.ZodRecord:return C3(t,n);case he.ZodLiteral:return f$e(t,n);case he.ZodEnum:return u$e(t);case he.ZodNativeEnum:return h$e(t);case he.ZodNullable:return x$e(t,n);case he.ZodOptional:return _$e(t,n);case he.ZodMap:return m$e(t,n);case he.ZodSet:return I$e(t,n);case he.ZodLazy:return()=>t.getter()._def;case he.ZodPromise:return T$e(t,n);case he.ZodNaN:case he.ZodNever:return g$e(n);case he.ZodEffects:return c$e(t,n);case he.ZodAny:return ci(n);case he.ZodUnknown:return A$e(n);case he.ZodDefault:return l$e(t,n);case he.ZodBranded:return w3(t,n);case he.ZodReadonly:return k$e(t,n);case he.ZodCatch:return a$e(t,n);case he.ZodPipeline:return S$e(t,n);case he.ZodFunction:case he.ZodVoid:case he.ZodSymbol:return;default:return(r=>{})(e)}}});function Tn(t,e,n=!1){let r=e.seen.get(t);if(e.override){let a=e.override?.(t,e,r,n);if(a!==zDe)return a}if(r&&!n){let a=w0t(r,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=M$e(t,t.typeName,e),s=typeof i=="function"?Tn(i(),e):i;if(s&&v0t(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var w0t,v0t,bs=C(()=>{l3();u3();Jf();ile();w0t=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:c3(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ci(e)):e.$refStrategy==="seen"?ci(e):void 0}},v0t=(t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),n)});var N$e,sle=C(()=>{Sae();Jf();bs();N$e=(t,e)=>{let n=VDe(e),r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[c,u])=>({...l,[c]:Tn(u._def,{...n,currentPath:[...n.basePath,n.definitionPath,c]},!0)??ci(n)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=Tn(t._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??ci(n),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(i.title=s),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let a=o===void 0?r?{...i,[n.definitionPath]:r}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:i}};return n.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a}});var O$e=C(()=>{l3();Sae();Eb();u3();Jf();Mae();Nae();Oae();v3();Rae();Dae();$ae();Fae();Uae();Bae();zae();b3();_3();Wae();Hae();Kae();qae();S3();Gae();Yae();Zae();Jae();Xae();Qae();ele();tle();nle();rle();ole();ile();bs();sle()});function x0t(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"~standard"in t&&typeof t["~standard"]=="object"&&t["~standard"]!==null&&"validate"in t["~standard"]}function ale(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"~standard"in t&&typeof t["~standard"]=="object"&&t["~standard"]!==null&&"jsonSchema"in t["~standard"]}function Ob(t){return x0t(t)&&ale(t)}var y2=C(()=>{$n()});function Pw(t,e){let n=typeof t;if(n!==typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let o=0;o{});function zd(t){return encodeURI(b0t(t))}function b0t(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var T3=C(()=>{});function Ew(t,e=Object.create(null),n=T0t,r=""){if(t&&typeof t=="object"&&!Array.isArray(t)){let i=t.$id||t.id;if(i){let s=new URL(i,n.href);s.hash.length>1?e[s.href]=t:(s.hash="",r===""?n=s:Ew(t,e,n))}}else if(t!==!0&&t!==!1)return e;let o=n.href+(r?"#"+r:"");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,n.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,n.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,n.href);e[i.href]=t}for(let i in t){if(S0t[i])continue;let s=`${r}/${zd(i)}`,a=t[i];if(Array.isArray(a)){if(C0t[i]){let l=a.length;for(let c=0;c{T3();C0t={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},_0t={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},S0t={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},T0t=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 Uu(t){return t.test.bind(t)}function K0t(t){return t%4===0&&(t%100!==0||t%400===0)}function R$e(t){let e=t.match(I0t);if(!e)return!1;let n=+e[1],r=+e[2],o=+e[3];return r>=1&&r<=12&&o>=1&&o<=(r==2&&K0t(n)?29:P0t[r])}function L$e(t,e){let n=e.match(E0t);if(!n)return!1;let r=+n[1],o=+n[2],i=+n[3],s=!!n[5];return(r<=23&&o<=59&&i<=59||r==23&&o==59&&i==60)&&(!t||s)}function G0t(t){let e=t.split(q0t);return e.length==2&&R$e(e[0])&&L$e(!0,e[1])}function J0t(t){return Y0t.test(t)&&Z0t.test(t)}function Q0t(t){if(X0t.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var I0t,P0t,E0t,A0t,k0t,M0t,N0t,O0t,R0t,L0t,D0t,$0t,F0t,U0t,B0t,z0t,j0t,V0t,W0t,H0t,cle,q0t,Y0t,Z0t,X0t,ule=C(()=>{I0t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,P0t=[0,31,28,31,30,31,30,31,31,30,31,30,31],E0t=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,A0t=/^(?=.{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,k0t=/^(?:[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,M0t=/^(?:(?:[^\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,N0t=/^(?:(?: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,O0t=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,R0t=/^(?:\/(?:[^~/]|~0|~1)*)*$/,L0t=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,D0t=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,$0t=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F0t=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,U0t=/^\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,B0t=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,z0t=t=>{if(t[0]==='"')return!1;let[e,n,...r]=t.split("@");return!e||!n||r.length!==0||e.length>64||n.length>253||e[0]==="."||e.endsWith(".")||e.includes("..")||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(e)?!1:n.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},j0t=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,V0t=/^((([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,W0t=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));H0t={date:R$e,time:L$e.bind(void 0,!1),"date-time":G0t,duration:W0t,uri:J0t,"uri-reference":Uu(k0t),"uri-template":Uu(M0t),url:Uu(N0t),email:z0t,hostname:Uu(A0t),ipv4:Uu(j0t),ipv6:Uu(V0t),regex:Q0t,uuid:Uu(O0t),"json-pointer":Uu(R0t),"json-pointer-uri-fragment":Uu(L0t),"relative-json-pointer":Uu(D0t)},cle={...H0t,date:Uu($0t),time:Uu(F0t),"date-time":Uu(U0t),"uri-reference":Uu(B0t)};q0t=/t|\s/i;Y0t=/\/|:/,Z0t=/^(?:[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;X0t=/[^\\]\\Z/});var D$e,$$e=C(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(D$e||(D$e={}))});function F$e(t){let e=0,n=t.length,r=0,o;for(;r=55296&&o<=56319&&r{});function Yo(t,e,n="2019-09",r=Ew(e),o=!0,i=null,s="#",a="#",l=Object.create(null)){if(e===!0)return{valid:!0,errors:[]};if(e===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let c=typeof t,u;switch(c){case"boolean":case"number":case"string":u=c;break;case"object":t===null?u="null":Array.isArray(t)?u="array":u="object";break;default:throw new Error(`Instances of "${c}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:y,not:w,anyOf:v,allOf:x,oneOf:b,if:_,then:T,else:S,format:P,properties:A,patternProperties:O,additionalProperties:D,unevaluatedProperties:$,minProperties:B,maxProperties:W,propertyNames:F,dependentRequired:Z,dependentSchemas:V,dependencies:H,prefixItems:te,items:fe,additionalItems:me,unevaluatedItems:j,contains:G,minContains:J,maxContains:M,minItems:E,maxItems:R,uniqueItems:L,minimum:K,maximum:Y,exclusiveMinimum:re,exclusiveMaximum:ae,multipleOf:ve,minLength:Te,maxLength:Ee,pattern:nt,__absolute_ref__:rt,__absolute_recursive_ref__:Jt}=e,ke=[];if(p===!0&&i===null&&(i=e),f==="#"){let He=i===null?r[Jt]:i,Ie=`${a}/$recursiveRef`,dt=Yo(t,i===null?e:i,n,r,o,He,s,Ie,l);dt.valid||ke.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:Ie,error:"A subschema had errors."},...dt.errors)}if(d!==void 0){let Ie=r[rt||d];if(Ie===void 0){let Ue=`Unresolved $ref "${d}".`;throw rt&&rt!==d&&(Ue+=` Absolute URI "${rt}".`),Ue+=` Known schemas: - ${Object.keys(r).join(` - `)}`,new Error(Ue)}let dt=`${a}/$ref`,Me=Yo(t,Ie,n,r,o,i,s,dt,l);if(Me.valid||ke.push({instanceLocation:s,keyword:"$ref",keywordLocation:dt,error:"A subschema had errors."},...Me.errors),n==="4"||n==="7")return{valid:ke.length===0,errors:ke}}if(Array.isArray(m)){let He=m.length,Ie=!1;for(let dt=0;dtPw(t,He))||ke.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(He=>t===He)||ke.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),w!==void 0){let He=`${a}/not`;Yo(t,w,n,r,o,i,s,He).valid&&ke.push({instanceLocation:s,keyword:"not",keywordLocation:He,error:'Instance matched "not" schema.'})}let Ln=[];if(v!==void 0){let He=`${a}/anyOf`,Ie=ke.length,dt=!1;for(let Me=0;Me{let it=Object.create(l),St=Yo(t,Me,n,r,o,p===!0?i:null,s,`${He}/${Ue}`,it);return ke.push(...St.errors),St.valid&&Ln.push(it),St.valid}).length;dt===1?ke.length=Ie:ke.splice(Ie,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:He,error:`Instance does not match exactly one subschema (${dt} matches).`})}if((u==="object"||u==="array")&&Object.assign(l,...Ln),_!==void 0){let He=`${a}/if`;if(Yo(t,_,n,r,o,i,s,He,l).valid){if(T!==void 0){let dt=Yo(t,T,n,r,o,i,s,`${a}/then`,l);dt.valid||ke.push({instanceLocation:s,keyword:"if",keywordLocation:He,error:'Instance does not match "then" schema.'},...dt.errors)}}else if(S!==void 0){let dt=Yo(t,S,n,r,o,i,s,`${a}/else`,l);dt.valid||ke.push({instanceLocation:s,keyword:"if",keywordLocation:He,error:'Instance does not match "else" schema.'},...dt.errors)}}if(u==="object"){if(y!==void 0)for(let Me of y)Me in t||ke.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${Me}".`});let He=Object.keys(t);if(B!==void 0&&He.lengthW&&ke.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${W} properties.`}),F!==void 0){let Me=`${a}/propertyNames`;for(let Ue in t){let it=`${s}/${zd(Ue)}`,St=Yo(Ue,F,n,r,o,i,it,Me);St.valid||ke.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:Me,error:`Property name "${Ue}" does not match schema.`},...St.errors)}}if(Z!==void 0){let Me=`${a}/dependantRequired`;for(let Ue in Z)if(Ue in t){let it=Z[Ue];for(let St of it)St in t||ke.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:Me,error:`Instance has "${Ue}" but does not have "${St}".`})}}if(V!==void 0)for(let Me in V){let Ue=`${a}/dependentSchemas`;if(Me in t){let it=Yo(t,V[Me],n,r,o,i,s,`${Ue}/${zd(Me)}`,l);it.valid||ke.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:Ue,error:`Instance has "${Me}" but does not match dependant schema.`},...it.errors)}}if(H!==void 0){let Me=`${a}/dependencies`;for(let Ue in H)if(Ue in t){let it=H[Ue];if(Array.isArray(it))for(let St of it)St in t||ke.push({instanceLocation:s,keyword:"dependencies",keywordLocation:Me,error:`Instance has "${Ue}" but does not have "${St}".`});else{let St=Yo(t,it,n,r,o,i,s,`${Me}/${zd(Ue)}`);St.valid||ke.push({instanceLocation:s,keyword:"dependencies",keywordLocation:Me,error:`Instance has "${Ue}" but does not match dependant schema.`},...St.errors)}}}let Ie=Object.create(null),dt=!1;if(A!==void 0){let Me=`${a}/properties`;for(let Ue in A){if(!(Ue in t))continue;let it=`${s}/${zd(Ue)}`,St=Yo(t[Ue],A[Ue],n,r,o,i,it,`${Me}/${zd(Ue)}`);if(St.valid)l[Ue]=Ie[Ue]=!0;else if(dt=o,ke.push({instanceLocation:s,keyword:"properties",keywordLocation:Me,error:`Property "${Ue}" does not match schema.`},...St.errors),dt)break}}if(!dt&&O!==void 0){let Me=`${a}/patternProperties`;for(let Ue in O){let it=new RegExp(Ue,"u"),St=O[Ue];for(let $r in t){if(!it.test($r))continue;let oo=`${s}/${zd($r)}`,Bn=Yo(t[$r],St,n,r,o,i,oo,`${Me}/${zd(Ue)}`);Bn.valid?l[$r]=Ie[$r]=!0:(dt=o,ke.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:Me,error:`Property "${$r}" matches pattern "${Ue}" but does not match associated schema.`},...Bn.errors))}}}if(!dt&&D!==void 0){let Me=`${a}/additionalProperties`;for(let Ue in t){if(Ie[Ue])continue;let it=`${s}/${zd(Ue)}`,St=Yo(t[Ue],D,n,r,o,i,it,Me);St.valid?l[Ue]=!0:(dt=o,ke.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:Me,error:`Property "${Ue}" does not match additional properties schema.`},...St.errors))}}else if(!dt&&$!==void 0){let Me=`${a}/unevaluatedProperties`;for(let Ue in t)if(!l[Ue]){let it=`${s}/${zd(Ue)}`,St=Yo(t[Ue],$,n,r,o,i,it,Me);St.valid?l[Ue]=!0:ke.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:Me,error:`Property "${Ue}" does not match unevaluated properties schema.`},...St.errors)}}}else if(u==="array"){R!==void 0&&t.length>R&&ke.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${t.length} > ${R}).`}),E!==void 0&&t.length=(J||0)&&(ke.length=Ue),J===void 0&&M===void 0&&it===0?ke.splice(Ue,0,{instanceLocation:s,keyword:"contains",keywordLocation:Me,error:"Array does not contain item matching schema."}):J!==void 0&&itM&&ke.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${M} items matching schema. ${it} items were found.`})}if(!dt&&j!==void 0){let Me=`${a}/unevaluatedItems`;for(Ie;Ie=Y||t>Y)&&ke.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${ae?"or equal to ":""} ${Y}.`})):(K!==void 0&&tY&&ke.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${t} is greater than ${Y}.`}),re!==void 0&&t<=re&&ke.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than ${re}.`}),ae!==void 0&&t>=ae&&ke.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${ae}.`})),ve!==void 0){let He=t%ve;Math.abs(0-He)>=11920929e-14&&Math.abs(ve-He)>=11920929e-14&&ke.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${ve}.`})}}else if(u==="string"){let He=Te===void 0&&Ee===void 0?0:F$e(t);Te!==void 0&&HeEe&&ke.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${He} > ${Ee}).`}),nt!==void 0&&!new RegExp(nt,"u").test(t)&&ke.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),P!==void 0&&cle[P]&&!cle[P](t)&&ke.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${P}".`})}return{valid:ke.length===0,errors:ke}}var fle=C(()=>{lle();I3();ule();T3();dle()});var U$e=C(()=>{I3();fle()});var P3=C(()=>{lle();I3();ule();T3();$$e();dle();fle();U$e()});function Hr(t,e){let n=!e&&t!=null&&typeof t=="object";if(n){let o=B$e.get(t);if(o)return o}let r;if(ale(t)&&!hl(t))r=t["~standard"].jsonSchema.input({target:"draft-07"});else if(hl(t)){let o=Cae(t,!0);AT(o)?r=Pb(c2(o,!0),e):r=Pb(t,e)}else Zf(t)?r=N$e(t):r=t;return n&&r!=null&&typeof r=="object"&&B$e.set(t,r),r}function w2(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=>w2(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(n=>w2(n))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,n=Ew(t);return n[e]?w2(n[e]):!1}return!1}var B$e,Bu=C(()=>{$n();vg();sle();O$e();y2();Ql();P3();B$e=new WeakMap});function Aw(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 n in e)n in e&&(Array.isArray(e[n])?e[n]=e[n].map(Aw):typeof e[n]=="object"&&e[n]!==null&&(e[n]=Aw(e[n])));return e}return t}function v2(t){let{$schema:e,...n}=Aw(jr(t)?Hr(t):t);return n}function z$e(t){let{$schema:e,...n}=Aw(t);return n}var E3=C(()=>{Bd();Bu()});function YT(t,e,n=[]){if(t==null||typeof t!="object")return;let r=t;if(Array.isArray(r.enum)&&r.enum.some(o=>o==="")){let o=n.length?` at path "${n.join(".")}"`:"",i=e?` in tool "${e}"`:"";throw new Error(`Invalid enum: empty string not allowed${i}${o}. Gemini API rejects empty strings in enums.`)}if(r.type==="object"&&r.properties&&typeof r.properties=="object")for(let[o,i]of Object.entries(r.properties))YT(i,e,[...n,o]);r.items&&YT(r.items,e,[...n,"[]"]);for(let o of["anyOf","oneOf","allOf"]){let i=r[o];Array.isArray(i)&&i.forEach((s,a)=>YT(s,e,[...n,`${o}[${a}]`]))}r.additionalProperties&&typeof r.additionalProperties=="object"&&YT(r.additionalProperties,e,[...n,"additionalProperties"])}var j$e=C(()=>{});function tc(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 x2(t){return tc(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function b2(t){return tc(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function ple(t){return tc(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function mle(t){if(tc(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 A3(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 n=e[0].trim(),r=e[1].trim();if(n===""||r==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let o={};for(let i of t.split(";").slice(1)){let s=i.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let a=s[0].trim(),l=s[1].trim();if(a==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);o[a]=l}return{type:n,subtype:r,parameters:o}}function Bc({dataUrl:t,asTypedArray:e=!1}){let n=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),r;if(n){r=n[1].toLowerCase();let o=e?Uint8Array.from(atob(n[2]),i=>i.charCodeAt(0)):n[2];return{mime_type:r,data:o}}}function kw(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 C2=C(()=>{});function hle(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var gle=C(()=>{});function rPt(t){return t.replace(ePt,"$1_$2").replace(tPt,"$1_$2").replace(nPt,"_").toLowerCase()}function V$e(t,e){return e?.[t]||rPt(t)}function W$e(t,e,n){let r={};for(let o in t)Object.hasOwn(t,o)&&(r[e(o,n)]=t[o]);return r}var ePt,tPt,nPt,H$e=C(()=>{ePt=/([A-Z]+)([A-Z][a-z0-9]+)/g,tPt=/([a-z0-9])([A-Z])/g,nPt=/[-_\s]+/g});function iPt(t){return"lc"in t||Object.keys(t).length===1&&"__lc_escaped__"in t}function sPt(t){return{[oPt]:t}}function aPt(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function lPt(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 k3(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return lPt(t);if(aPt(t))return t;e.add(t);let n=t;if(iPt(n))return e.delete(t),sPt(n);let r={};for(let[o,i]of Object.entries(n))r[o]=k3(i,e);return e.delete(t),r}return Array.isArray(t)?t.map(n=>k3(n,e)):t}var oPt,K$e=C(()=>{oPt="__lc_escaped__"});function q$e(t){return Array.isArray(t)?[...t]:{...t}}function cPt(t,e){let n=q$e(t);for(let[r,o]of Object.entries(e)){let[i,...s]=r.split(".").reverse(),a=n;for(let l of s.reverse()){if(a[l]===void 0)break;a[l]=q$e(a[l]),a=a[l]}a[i]!==void 0&&(a[i]={lc:1,type:"secret",id:[o]})}return n}function yle(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 zu,Rb=C(()=>{$n();H$e();K$e();zu=class G$e{constructor(e,...n){I(this,"lc_serializable",!1);I(this,"lc_kwargs");this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([r])=>this.lc_serializable_keys?.includes(r))):this.lc_kwargs=e??{}}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,yle(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 G$e||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},n={},r=Object.keys(this.lc_kwargs).reduce((a,l)=>(a[l]=l in this?this[l]:this.lc_kwargs[l],a),{});for(let a=Object.getPrototypeOf(this);a;a=Object.getPrototypeOf(a))Object.assign(e,Reflect.get(a,"lc_aliases",this)),Object.assign(n,Reflect.get(a,"lc_secrets",this)),Object.assign(r,Reflect.get(a,"lc_attributes",this));Object.keys(n).forEach(a=>{let l=this,c=r,[u,...d]=a.split(".").reverse();for(let f of d.reverse()){if(!(f in l)||l[f]===void 0)return;(!(f in c)||c[f]===void 0)&&(typeof l[f]=="object"&&l[f]!=null?c[f]={}:Array.isArray(l[f])&&(c[f]=[])),l=l[f],c=c[f]}u in l&&l[u]!==void 0&&(c[u]=c[u]||l[u])});let o={},i=new WeakSet;i.add(this);for(let[a,l]of Object.entries(r))o[a]=k3(l,i);let s=W$e(Object.keys(n).length?cPt(o,n):o,V$e,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function yt(t,e){return Wt(t)&&t.type===e}function Wt(t){return typeof t=="object"&&t!==null}function js(t){return Array.isArray(t)}function Oe(t){return typeof t=="string"}function jd(t){return typeof t=="number"}function M3(t){return t instanceof Uint8Array}function wle(t){try{return JSON.parse(t)}catch{return}}var Vd,tp=C(()=>{Vd=t=>t()});function uPt(t){if(t.type==="char_location"&&Oe(t.document_title)&&jd(t.start_char_index)&&jd(t.end_char_index)&&Oe(t.cited_text)){let{document_title:e,start_char_index:n,end_char_index:r,cited_text:o,...i}=t;return{...i,type:"citation",source:"char",title:e??void 0,startIndex:n,endIndex:r,citedText:o}}if(t.type==="page_location"&&Oe(t.document_title)&&jd(t.start_page_number)&&jd(t.end_page_number)&&Oe(t.cited_text)){let{document_title:e,start_page_number:n,end_page_number:r,cited_text:o,...i}=t;return{...i,type:"citation",source:"page",title:e??void 0,startIndex:n,endIndex:r,citedText:o}}if(t.type==="content_block_location"&&Oe(t.document_title)&&jd(t.start_block_index)&&jd(t.end_block_index)&&Oe(t.cited_text)){let{document_title:e,start_block_index:n,end_block_index:r,cited_text:o,...i}=t;return{...i,type:"citation",source:"block",title:e??void 0,startIndex:n,endIndex:r,citedText:o}}if(t.type==="web_search_result_location"&&Oe(t.url)&&Oe(t.title)&&Oe(t.encrypted_index)&&Oe(t.cited_text)){let{url:e,title:n,encrypted_index:r,cited_text:o,...i}=t;return{...i,type:"citation",source:"url",url:e,title:n,startIndex:Number(r),endIndex:Number(r),citedText:o}}if(t.type==="search_result_location"&&Oe(t.source)&&Oe(t.title)&&jd(t.start_block_index)&&jd(t.end_block_index)&&Oe(t.cited_text)){let{source:e,title:n,start_block_index:r,end_block_index:o,cited_text:i,...s}=t;return{...s,type:"citation",source:"search",url:e,title:n??void 0,startIndex:r,endIndex:o,citedText:i}}}function Z$e(t){if(yt(t,"document")&&Wt(t.source)&&"type"in t.source){if(t.source.type==="base64"&&Oe(t.source.media_type)&&Oe(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&Oe(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&Oe(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&Oe(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(yt(t,"image")&&Wt(t.source)&&"type"in t.source){if(t.source.type==="base64"&&Oe(t.source.media_type)&&Oe(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&Oe(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&Oe(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function J$e(t){function*e(){for(let n of t){let r=Z$e(n);r?yield r:yield n}}return Array.from(e())}function Y$e(t){function*e(){let n=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let r of n){if(yt(r,"text")&&Oe(r.text)){let{text:o,citations:i,...s}=r;if(js(i)&&i.length){let a=i.reduce((l,c)=>{let u=uPt(c);return u?[...l,u]:l},[]);yield{...s,type:"text",text:o,annotations:a};continue}else{yield{...s,type:"text",text:o};continue}}else if(yt(r,"thinking")&&Oe(r.thinking)){let{thinking:o,signature:i,...s}=r;yield{...s,type:"reasoning",reasoning:o,signature:i};continue}else if(yt(r,"redacted_thinking")){yield{type:"non_standard",value:r};continue}else if(yt(r,"tool_use")&&Oe(r.name)&&Oe(r.id)){yield{type:"tool_call",id:r.id,name:r.name,args:r.input};continue}else if(yt(r,"input_json_delta")){if(dPt(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(yt(r,"server_tool_use")&&Oe(r.name)&&Oe(r.id)){let{name:o,id:i}=r;if(o==="web_search"){yield{id:i,type:"server_tool_call",name:"web_search",args:{query:Vd(()=>{if(typeof r.input=="string")return r.input;if(Wt(r.input)&&Oe(r.input.query))return r.input.query;if(Oe(r.partial_json)){let s=wle(r.partial_json);if(s?.query)return s.query}return""})}};continue}else if(r.name==="code_execution"){yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:Vd(()=>{if(typeof r.input=="string")return r.input;if(Wt(r.input)&&Oe(r.input.code))return r.input.code;if(Oe(r.partial_json)){let s=wle(r.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(yt(r,"web_search_tool_result")&&Oe(r.tool_use_id)&&js(r.content)){let{content:o,tool_use_id:i}=r;yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:o.reduce((s,a)=>yt(a,"web_search_result")?[...s,a.url]:s,[])}};continue}else if(yt(r,"code_execution_tool_result")&&Oe(r.tool_use_id)&&Wt(r.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(yt(r,"mcp_tool_use")){yield{id:r.id,type:"server_tool_call",name:"mcp_tool_use",args:r.input};continue}else if(yt(r,"mcp_tool_result")&&Oe(r.tool_use_id)&&Wt(r.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:r.tool_use_id,status:"success",output:r.content};continue}else if(yt(r,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:r.input};continue}else if(yt(r,"search_result")){yield{id:r.id,type:"non_standard",value:r};continue}else if(yt(r,"tool_result")){yield{id:r.id,type:"non_standard",value:r};continue}else{let o=Z$e(r);if(o){yield o;continue}}yield{type:"non_standard",value:r}}}return Array.from(e())}function dPt(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}var X$e,vle=C(()=>{tp();X$e={translateContent:Y$e,translateContentChunk:Y$e}});function fPt(t){return x2(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:b2(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:ple(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Q$e(t){return t.map(fPt)}function eFe(t){return!!(yt(t,"image_url")&&Wt(t.image_url)||yt(t,"input_audio")&&Wt(t.input_audio)||yt(t,"file")&&Wt(t.file))}function tFe(t){if(yt(t,"image_url")&&Wt(t.image_url)&&Oe(t.image_url.url)){let e=Bc({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(yt(t,"input_audio")&&Wt(t.input_audio)&&Oe(t.input_audio.data)&&Oe(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(yt(t,"file")&&Wt(t.file)&&Oe(t.file.data)){let e=Bc({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(Oe(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}var xle=C(()=>{C2();tp()});function pPt(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...N3(t.content));for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}function mPt(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...N3(t.content));for(let n of t.tool_calls??[])e.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return e}function N3(t){let e=[];for(let n of t)eFe(n)?e.push(tFe(n)):e.push(n);return e}function hPt(t){if(t.type==="url_citation"){let{url:e,title:n,start_index:r,end_index:o}=t;return{type:"citation",url:e,title:n,startIndex:r,endIndex:o}}if(t.type==="file_citation"){let{file_id:e,filename:n,index:r}=t;return{type:"citation",title:n,startIndex:r,endIndex:r,fileId:e}}return t}function nFe(t){function*e(){Wt(t.additional_kwargs?.reasoning)&&js(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((r,o)=>Wt(o)&&Oe(o.text)?`${r}${o.text}`:r,"")});let n=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let r of n)if(yt(r,"text")){let{text:o,annotations:i,phase:s,extras:a,...l}=r,c=Wt(a)?{...a}:{};Oe(s)&&(c.phase=s);let u=Object.keys(c).length>0?{extras:c}:{};Array.isArray(i)?yield{...l,...u,type:"text",text:String(o),annotations:i.map(hPt)}:yield{...l,...u,type:"text",text:String(o)}}for(let r of t.tool_calls??[])yield{type:"tool_call",id:r.id,name:r.name,args:r.args};if(Wt(t.additional_kwargs)&&js(t.additional_kwargs.tool_outputs))for(let r of t.additional_kwargs.tool_outputs){if(yt(r,"web_search_call")){let o={};if(Wt(r.action)&&Oe(r.action.query)&&(o.query=r.action.query),yield{id:r.id,type:"server_tool_call",name:"web_search",args:o},r.status==="completed"||r.status==="failed"){let i={};Wt(r.action)&&(i.action=r.action),yield{type:"server_tool_call_result",toolCallId:Oe(r.id)?r.id:"",status:r.status==="completed"?"success":"error",output:i}}continue}else if(yt(r,"file_search_call")){yield{id:r.id,type:"server_tool_call",name:"file_search",args:{queries:js(r.queries)?r.queries:[]}},(r.status==="completed"||r.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:Oe(r.id)?r.id:"",status:r.status==="completed"?"success":"error",output:js(r.results)?{results:r.results}:{}});continue}else if(yt(r,"computer_call")){yield{type:"non_standard",value:r};continue}else if(yt(r,"code_interpreter_call")){if(Oe(r.code)&&(yield{id:r.id,type:"server_tool_call",name:"code_interpreter",args:{code:r.code}}),js(r.outputs)){let o=Vd(()=>{if(r.status!=="in_progress"){if(r.status==="completed")return 0;if(r.status==="incomplete")return 127;if(r.status!=="interpreting"&&r.status==="failed")return 1}});for(let i of r.outputs)if(yt(i,"logs")){yield{type:"server_tool_call_result",toolCallId:r.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(yt(r,"mcp_call")){yield{id:r.id,type:"server_tool_call",name:"mcp_call",args:r.input};continue}else if(yt(r,"mcp_list_tools")){yield{id:r.id,type:"server_tool_call",name:"mcp_list_tools",args:r.input};continue}else if(yt(r,"mcp_approval_request")){yield{type:"non_standard",value:r};continue}else if(yt(r,"tool_search_call")){let o={};Wt(r.arguments)&&Object.assign(o,r.arguments);let i={};Oe(r.execution)&&(i.execution=r.execution),Oe(r.status)&&(i.status=r.status),Oe(r.call_id)&&(i.call_id=r.call_id),yield{id:Oe(r.id)?r.id:"",type:"server_tool_call",name:"tool_search",args:o,...Object.keys(i).length>0?{extras:i}:{}};continue}else if(yt(r,"tool_search_output")){let o={name:"tool_search"};Oe(r.execution)&&(o.execution=r.execution),yield{type:"server_tool_call_result",toolCallId:Oe(r.id)?r.id:"",status:r.status==="completed"?"success":r.status==="failed"?"error":"success",output:{tools:js(r.tools)?r.tools:[]},extras:o};continue}else if(yt(r,"image_generation_call")){Oe(r.result)&&(yield{type:"image",mimeType:"image/png",data:r.result,id:Oe(r.id)?r.id:void 0,metadata:{status:Oe(r.status)?r.status:void 0}}),yield{type:"non_standard",value:r};continue}Wt(r)&&(yield{type:"non_standard",value:r})}}return Array.from(e())}function gPt(t){function*e(){yield*nFe(t);for(let n of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:n.id,name:n.name,args:n.args}}return Array.from(e())}var rFe,ble=C(()=>{tp();xle();rFe={translateContent:t=>typeof t.content=="string"?pPt(t):nFe(t),translateContentChunk:t=>typeof t.content=="string"?mPt(t):gPt(t)}});function oFe(t,e="pretty"){return e==="pretty"?yPt(t):JSON.stringify(t)}function yPt(t){let e=[],n=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,r=Math.floor((80-n.length)/2),o="=".repeat(r),i=n.length%2===0?o:`${o}=`;if(e.push(`${o}${n}${i}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let a of s.tool_calls){e.push(` ${a.name} (${a.id})`),e.push(` Call ID: ${a.id}`),e.push(" Args:");for(let[l,c]of Object.entries(a.args))e.push(` ${l}: ${typeof c=="object"?JSON.stringify(c):c}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(` `)}var iFe=C(()=>{});function sFe(t){return Array.isArray(t)?t:typeof t=="string"?t===""?[]:[{type:"text",text:t}]:t==null?[]:[t]}function zc(t,e){if(typeof t=="string")return t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(n=>tc(n))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e];if(Array.isArray(e)){let n=sFe(t);return ZT(n,e)??[...n,...e]}else return e===""?t:Array.isArray(t)&&t.some(n=>tc(n))?[...t,{type:"file",source_type:"text",text:e}]:[...sFe(t),{type:"text",text:e}]}function _le(t,e){return t==="error"||e==="error"?"error":"success"}function wPt(t,e){function n(r,o){if(typeof r!="object"||r===null||r===void 0)return r;if(o>=e)return Array.isArray(r)?"[Array]":"[Object]";if(Array.isArray(r))return r.map(s=>n(s,o+1));let i={};for(let s of Object.keys(r))i[s]=n(r[s],o+1);return i}return JSON.stringify(n(t,0),null,2)}function Ii(t,e,n){let r=n?.ignoreKeys??dFe;if(t==null&&e==null)return;if(t==null||e==null)return t??e;let o={...t};for(let[i,s]of Object.entries(e))if(o[i]==null)o[i]=s;else{if(s==null)continue;if(typeof o[i]!=typeof s||Array.isArray(o[i])!==Array.isArray(s))throw new Error(`field[${i}] already exists in the message chunk, but with a different type.`);if(typeof o[i]=="string"){if(i==="type")continue;if(["id","name","output_version","model_provider"].includes(i))s&&(o[i]=s);else{if(r.includes(i))continue;o[i]+=s}}else if(typeof o[i]=="number"){if(r.includes(i))continue;o[i]=o[i]+s}else if(typeof o[i]=="object"&&!Array.isArray(o[i]))o[i]=Ii(o[i],s,n);else if(Array.isArray(o[i]))o[i]=ZT(o[i],s,n);else{if(o[i]===s)continue;console.warn(`field[${i}] already exists in this message chunk and value has unsupported type.`)}}return o}function vPt(t){return typeof t=="number"||typeof t=="string"}function aFe(t){return typeof t!="object"||t===null||!("index"in t)?!1:vPt(t.index)}function lFe(t){if(typeof t!="object"||t===null||!("id"in t))return!1;let e=t.id;return e!=null&&e!==""}function cFe(t){return t.endsWith("_delta")?t.slice(0,-6):t}function xPt(t,e){return typeof t!="object"||t===null||typeof e!="object"||e===null||!("type"in t)||!("type"in e)?!1:typeof t.type=="string"&&typeof e.type=="string"&&cFe(t.type)!==cFe(e.type)}function bPt(t,e){let n=aFe(e),r=lFe(e);return!n&&!r?-1:t.findIndex(o=>{let i=aFe(o),s=lFe(o);return n&&i?o.index!==e.index||xPt(o,e)?!1:s&&r?o.id===e.id:!0:!n&&!i&&r&&s?o.id===e.id:!1})}function ZT(t,e,n){if(!(t==null&&e==null)){if(t==null||e==null)return t||e;{let r=[...t];for(let o of e){let i=bPt(r,o);if(i!==-1)r[i]=Ii(r[i],o,n);else{if(typeof o=="object"&&o!==null&&"text"in o&&o.text==="")continue;r.push(o)}}return r}}}function Sle(t,e,n){if(!(t==null&&e==null)){if(t==null||e==null)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 ZT(t,e,n);if(typeof t=="object"&&typeof e=="object")return Ii(t,e,n);if(t===e)return t;throw new Error(`Can not merge objects of different types. Left ${t} Right ${e}`)}}function Tle(t){return typeof t.role=="string"}function np(t){return typeof t?._getType=="function"}function O3(t){return ju.isInstance(t)}var Cle,uFe,Vs,dFe,ju,nc=C(()=>{Rb();C2();vle();xle();ble();gle();iFe();Cle=Symbol.for("langchain.message");Vs=class extends zu{constructor(e){let n=typeof e=="string"||Array.isArray(e)?{content:e}:e;n.additional_kwargs||(n.additional_kwargs={}),n.response_metadata||(n.response_metadata={});super(n);I(this,"lc_namespace",["langchain_core","messages"]);I(this,"lc_serializable",!0);I(this,uFe,!0);I(this,"id");I(this,"name");I(this,"content");I(this,"additional_kwargs");I(this,"response_metadata");this.name=n.name,n.content===void 0&&n.contentBlocks!==void 0?(this.content=n.contentBlocks,this.response_metadata={output_version:"v1",...n.response_metadata}):n.content!==void 0?(this.content=n.content??[],this.response_metadata=n.response_metadata):(this.content=[],this.response_metadata=n.response_metadata),this.additional_kwargs=n.additional_kwargs,this.id=n.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[Q$e,N3,J$e].reduce((n,r)=>r(n),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&&Cle in e&&e[Cle]===!0&&hle(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[(uFe=Cle,Symbol.toStringTag)](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let n=wPt(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${n}`}toFormattedString(e="pretty"){return oFe(this,e)}},dFe=["index","created","timestamp"];ju=class fFe extends Vs{static isInstance(e){if(!super.isInstance(e))return!1;let n=Object.getPrototypeOf(e);for(;n!==null;){if(n===fFe.prototype)return!0;n=Object.getPrototypeOf(n)}return!1}}});function Ile(t,e){return Ii(t,e)??{}}function pFe(t,e){let n={};return(t?.audio!==void 0||e?.audio!==void 0)&&(n.audio=(t?.audio??0)+(e?.audio??0)),(t?.image!==void 0||e?.image!==void 0)&&(n.image=(t?.image??0)+(e?.image??0)),(t?.video!==void 0||e?.video!==void 0)&&(n.video=(t?.video??0)+(e?.video??0)),(t?.document!==void 0||e?.document!==void 0)&&(n.document=(t?.document??0)+(e?.document??0)),(t?.text!==void 0||e?.text!==void 0)&&(n.text=(t?.text??0)+(e?.text??0)),n}function CPt(t,e){let n={...pFe(t,e)};return(t?.cache_read!==void 0||e?.cache_read!==void 0)&&(n.cache_read=(t?.cache_read??0)+(e?.cache_read??0)),(t?.cache_creation!==void 0||e?.cache_creation!==void 0)&&(n.cache_creation=(t?.cache_creation??0)+(e?.cache_creation??0)),n}function _Pt(t,e){let n={...pFe(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(n.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),n}function _2(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:CPt(t?.input_token_details,e?.input_token_details),output_token_details:_Pt(t?.output_token_details,e?.output_token_details)}}var R3=C(()=>{nc()});function Ple(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function Ele(t){let e=[],n=[];for(let r of t)if(r.function){let o=r.function.name;try{let i=JSON.parse(r.function.arguments);e.push({name:o||"",args:i||{},id:r.id})}catch{n.push({name:o,args:r.function.arguments,id:r.id,error:"Malformed args."})}}else continue;return[e,n]}function Ale(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}var Wd,Bk,zk=C(()=>{$n();nc();Wd=class extends Vs{constructor(e,n,r){let o=typeof e=="string"||Array.isArray(e)?{content:e,name:r,tool_call_id:n}:e;super(o);I(this,"lc_direct_tool_output",!0);I(this,"type","tool");I(this,"status");I(this,"tool_call_id");I(this,"metadata");I(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}}},Bk=class extends ju{constructor(e){super(e);I(this,"type","tool");I(this,"tool_call_id");I(this,"status");I(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 n=this.constructor;return new n({content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ii(this.response_metadata,e.response_metadata),artifact:Sle(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:_le(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function kle(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 SPt(t){if(Wt(t.document)&&Wt(t.document.source)){let e=kle(Wt(t.document)&&Oe(t.document.format)?t.document.format:"");if(Wt(t.document.source)){if(Wt(t.document.source.s3Location)&&Oe(t.document.source.s3Location.uri))return{type:"file",mimeType:e,fileId:t.document.source.s3Location.uri};if(M3(t.document.source.bytes))return{type:"file",mimeType:e,data:t.document.source.bytes};if(Oe(t.document.source.text))return{type:"file",mimeType:e,data:Buffer.from(t.document.source.text).toString("base64")};if(js(t.document.source.content))return{type:"file",mimeType:e,data:t.document.source.content.reduce((n,r)=>Wt(r)&&Oe(r.text)?n+r.text:n,"")}}}return{type:"non_standard",value:t}}function TPt(t){if(yt(t,"image")&&Wt(t.image)){let e=kle(Wt(t.image)&&Oe(t.image.format)?t.image.format:"");if(Wt(t.image.source)){if(Wt(t.image.source.s3Location)&&Oe(t.image.source.s3Location.uri))return{type:"image",mimeType:e,fileId:t.image.source.s3Location.uri};if(M3(t.image.source.bytes))return{type:"image",mimeType:e,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function IPt(t){if(yt(t,"video")&&Wt(t.video)){let e=kle(Wt(t.video)&&Oe(t.video.format)?t.video.format:"");if(Wt(t.video.source)){if(Wt(t.video.source.s3Location)&&Oe(t.video.source.s3Location.uri))return{type:"video",mimeType:e,fileId:t.video.source.s3Location.uri};if(M3(t.video.source.bytes))return{type:"video",mimeType:e,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function mFe(t){function*e(){let n=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let r of n){if(yt(r,"cache_point")){yield{type:"non_standard",value:r};continue}else if(yt(r,"citations_content")&&Wt(r.citationsContent)){yield{type:"text",text:js(r.citationsContent.content)?r.citationsContent.content.reduce((o,i)=>Wt(i)&&Oe(i.text)?o+i.text:o,""):"",annotations:js(r.citationsContent.citations)?r.citationsContent.citations.reduce((o,i)=>{if(Wt(i)){let s=js(i.sourceContent)?i.sourceContent.reduce((l,c)=>Wt(c)&&Oe(c.text)?l+c.text:l,""):"",a=Vd(()=>{if(Wt(i.location)){let l=i.location.documentChar||i.location.documentPage||i.location.documentChunk;if(Wt(l))return{source:jd(l.documentIndex)?l.documentIndex.toString():void 0,startIndex:jd(l.start)?l.start:void 0,endIndex:jd(l.end)?l.end:void 0}}return{}});o.push({type:"citation",citedText:s,...a})}return o},[]):[]};continue}else if(yt(r,"document")&&Wt(r.document)){yield SPt(r);continue}else if(yt(r,"guard_content")){yield{type:"non_standard",value:r};continue}else if(yt(r,"image")&&Wt(r.image)){yield TPt(r);continue}else if(yt(r,"reasoning_content")&&Oe(r.reasoningText)){yield{type:"reasoning",reasoning:r.reasoningText};continue}else if(yt(r,"text")&&Oe(r.text)){yield{type:"text",text:r.text};continue}else if(yt(r,"tool_result")){yield{type:"non_standard",value:r};continue}else{if(yt(r,"tool_call"))continue;if(yt(r,"video")&&Wt(r.video)){yield IPt(r);continue}}yield{type:"non_standard",value:r}}}return Array.from(e())}var hFe,gFe=C(()=>{tp();hFe={translateContent:mFe,translateContentChunk:mFe}});function yFe(t){let e=[],n=t.additional_kwargs?.reasoning_content;if(Oe(n)&&n.length>0&&e.push({type:"reasoning",reasoning:n}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let r of t.content)typeof r=="object"&&"type"in r&&r.type==="text"&&"text"in r&&Oe(r.text)&&e.push({type:"text",text:r.text});for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}var wFe,vFe=C(()=>{tp();wFe={translateContent:yFe,translateContentChunk:yFe}});function xFe(t){function*e(){let n=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let r of n){if(yt(r,"text")&&Oe(r.text)){yield{type:"text",text:r.text};continue}else if(yt(r,"thinking")&&Oe(r.thinking)){yield{type:"reasoning",reasoning:r.thinking,...r.signature?{signature:r.signature}:{}};continue}else if(yt(r,"inlineData")&&Wt(r.inlineData)&&Oe(r.inlineData.mimeType)&&Oe(r.inlineData.data)){yield{type:"file",mimeType:r.inlineData.mimeType,data:r.inlineData.data};continue}else if(yt(r,"functionCall")&&Wt(r.functionCall)&&Oe(r.functionCall.name)&&Wt(r.functionCall.args)){yield{type:"tool_call",id:t.id,name:r.functionCall.name,args:r.functionCall.args};continue}else if(yt(r,"functionResponse")){yield{type:"non_standard",value:r};continue}else if(yt(r,"fileData")&&Wt(r.fileData)&&Oe(r.fileData.mimeType)&&Oe(r.fileData.fileUri)){yield{type:"file",mimeType:r.fileData.mimeType,fileId:r.fileData.fileUri};continue}else if(yt(r,"executableCode")){yield{type:"non_standard",value:r};continue}else if(yt(r,"codeExecutionResult")){yield{type:"non_standard",value:r};continue}yield{type:"non_standard",value:r}}}return Array.from(e())}var bFe,CFe=C(()=>{tp();bFe={translateContent:xFe,translateContentChunk:xFe}});function _Fe(t){function*e(){let n=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let r of n){if(yt(r,"reasoning")&&Oe(r.reasoning)){let o=Vd(()=>{let i=n.indexOf(r);if(js(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});Oe(o)?yield{type:"reasoning",reasoning:r.reasoning,signature:o}:yield{type:"reasoning",reasoning:r.reasoning};continue}else if(yt(r,"thinking")&&Oe(r.thinking)){yield{type:"reasoning",reasoning:r.thinking,...r.signature?{signature:r.signature}:{}};continue}else if(yt(r,"text")&&Oe(r.text)){yield{type:"text",text:r.text};continue}else if(yt(r,"image_url")){if(Oe(r.image_url))if(r.image_url.startsWith("data:")){let o=r.image_url.match(/^data:([^;]+);base64,(.+)$/);o?yield{type:"image",data:o[2],mimeType:o[1]}:yield{type:"image",url:r.image_url}}else yield{type:"image",url:r.image_url};continue}else if(yt(r,"media")&&Oe(r.mimeType)&&Oe(r.data)){yield{type:"file",mimeType:r.mimeType,data:r.data};continue}yield{type:"non_standard",value:r}}}return Array.from(e())}var SFe,TFe=C(()=>{tp();SFe={translateContent:_Fe,translateContentChunk:_Fe}});function IFe(t){let e=[],n=t.additional_kwargs?.reasoning;if(Oe(n)&&n.length>0&&e.push({type:"reasoning",reasoning:n}),typeof t.content=="string"){let r=t.content,o=r.match(/([\s\S]*?)<\/think>/);if(o){let i=o[1].trim();i.length>0&&e.push({type:"reasoning",reasoning:i}),r=r.replace(/[\s\S]*?<\/think>/,"").trim()}r.length>0&&e.push({type:"text",text:r})}else for(let r of t.content)if(typeof r=="object"&&"type"in r&&r.type==="text"&&"text"in r&&Oe(r.text)){let o=r.text,i=o.match(/([\s\S]*?)<\/think>/);if(i){let s=i[1].trim();s.length>0&&e.push({type:"reasoning",reasoning:s}),o=o.replace(/[\s\S]*?<\/think>/,"").trim()}o.length>0&&e.push({type:"text",text:o})}for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}var PFe,EFe=C(()=>{tp();PFe={translateContent:IFe,translateContentChunk:IFe}});function AFe(t){let e=[],n=t.additional_kwargs?.reasoning_content;if(Oe(n)&&n.length>0&&e.push({type:"reasoning",reasoning:n}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let r of t.content)typeof r=="object"&&"type"in r&&r.type==="text"&&"text"in r&&Oe(r.text)&&e.push({type:"text",text:r.text});for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}var kFe,MFe=C(()=>{tp();kFe={translateContent:AFe,translateContentChunk:AFe}});function NFe(t){let e=[];if(Wt(t.additional_kwargs?.reasoning)){let r=t.additional_kwargs.reasoning;if(js(r.summary)){let o=r.summary.reduce((i,s)=>Wt(s)&&Oe(s.text)?`${i}${s.text}`:i,"");o.length>0&&e.push({type:"reasoning",reasoning:o})}}let n=t.additional_kwargs?.reasoning_content;if(Oe(n)&&n.length>0&&e.push({type:"reasoning",reasoning:n}),typeof t.content=="string")t.content.length>0&&e.push({type:"text",text:t.content});else for(let r of t.content)typeof r=="object"&&"type"in r&&r.type==="text"&&"text"in r&&Oe(r.text)&&e.push({type:"text",text:r.text});for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}var OFe,RFe=C(()=>{tp();OFe={translateContent:NFe,translateContentChunk:NFe}});function LFe(t){function*e(){let n=Vd(()=>{if(typeof t.content=="string")return t.additional_kwargs.originalTextContentBlock?[{...t.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:t.content}];{let r=t.additional_kwargs?.originalTextContentBlock;if(r?.thoughtSignature&&!t.content.some(o=>"thoughtSignature"in o)){let o=[...t.content];for(let i=o.length-1;i>=0;i--){let s=o[i];if(s.type==="text"&&!s.thought)return s.thoughtSignature=r.thoughtSignature,o}}return t.content}});for(let r of n){let o=Vd(()=>yt(r,"text")&&Oe(r.text)?{type:"text",text:r.text}:yt(r,"inlineData")&&Wt(r.inlineData)&&Oe(r.inlineData.mimeType)&&Oe(r.inlineData.data)?{type:"file",mimeType:r.inlineData.mimeType,data:r.inlineData.data}:yt(r,"functionCall")&&Wt(r.functionCall)&&Oe(r.functionCall.name)&&Wt(r.functionCall.args)?{type:"tool_call",id:t.id,name:r.functionCall.name,args:r.functionCall.args}:yt(r,"functionResponse")?{type:"non_standard",value:r}:yt(r,"fileData")&&Wt(r.fileData)&&Oe(r.fileData.mimeType)&&Oe(r.fileData.fileUri)?{type:"file",mimeType:r.fileData.mimeType,fileId:r.fileData.fileUri}:yt(r,"executableCode")?{type:"non_standard",value:r}:yt(r,"codeExecutionResult")?{type:"non_standard",value:r}:{type:"non_standard",value:r}),i=Vd(()=>"thought"in r&&r.thought?{type:"reasoning",reasoning:o.type==="text"?o.text:"",reasoningContentBlock:o}:o),s={thought:r.thought,thoughtSignature:r.thoughtSignature,partMetadata:r.partMetadata,...i};for(let a in s)s[a]===void 0&&delete s[a];yield s}}return Array.from(e())}var DFe,$Fe=C(()=>{tp();DFe={translateContent:LFe,translateContentChunk:LFe}});function Mle(t){return globalThis.lc_block_translators_registry.get(t)}var FFe=C(()=>{vle();ble();gFe();vFe();CFe();TFe();EFe();MFe();RFe();$Fe();globalThis.lc_block_translators_registry??(globalThis.lc_block_translators_registry=new Map([["anthropic",X$e],["bedrock-converse",hFe],["deepseek",wFe],["google",DFe],["google-genai",bFe],["google-vertexai",SFe],["groq",PFe],["ollama",kFe],["openai",rFe],["xai",OFe]]))});function UFe(t){let e=Symbol.for(t);return{brand(n,r){var s,a;let o=r?Symbol.for(`${t}.${r}`):e;class i extends(a=n,s=o,a){constructor(...u){super(...u);I(this,s,!0)}static isInstance(u){return typeof u=="object"&&u!==null&&o in u&&u[o]===!0}}return Object.defineProperty(i,"name",{value:n.name}),i},sub(n){return UFe(`${t}.${n}`)},isInstance(n){return typeof n=="object"&&n!==null&&e in n&&n[e]===!0}}}var BFe,zFe=C(()=>{BFe=UFe("langchain")});function Lb(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 Nle,jFe,Ole,VFe,JT=C(()=>{$n();zFe();Nle=BFe.sub("error"),jFe=class extends Nle.brand(Error){constructor(e){super(e);I(this,"name","LangChainError");Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Ole=class extends Nle.brand(jFe,"model-abort"){constructor(e,n){super(e);I(this,"name","ModelAbortError");I(this,"partialOutput");this.partialOutput=n}},VFe=class WFe extends Nle.brand(jFe,"context-overflow"){constructor(n){super(n??"Input exceeded the model's context window.");I(this,"name","ContextOverflowError");I(this,"cause")}static fromError(n){let r=new WFe(n.message);return r.cause=n,r}}});function Db(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function HFe(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 S2,L3=C(()=>{S2=class extends Error{constructor(e,n){super(e);I(this,"output");this.output=n}}});function jk(t,e=Vk){t=t.trim();let n=t.indexOf("```");if(n===-1)return e(t);let r=t.substring(n+3);r.startsWith(`json `)?r=r.substring(5):r.startsWith("json")?r=r.substring(4):r.startsWith(` `)&&(r=r.substring(1));let o=r.indexOf("```"),i=r;return o!==-1&&(i=r.substring(0,o)),e(i.trim())}function PPt(t){try{return JSON.parse(t)}catch{}let e=t.trim();if(e.length===0)throw new Error("Unexpected end of JSON input");let n=0;function r(){for(;n="0"&&e[n]<="9"))throw new Error(`Invalid number at position ${u}`);if(n="1"&&e[n]<="9")for(;n="0"&&e[n]<="9";)d+=e[n],n+=1;if(n="0"&&e[n]<="9";)d+=e[n],n+=1;if(n="0"&&e[n]<="9";)d+=e[n],n+=1;if(d==="-")return-0;let f=Number.parseFloat(d);if(Number.isNaN(f))throw n=u,new Error(`Invalid number '${d}' at position ${u}`);return f}function s(){if(r(),n>=e.length)throw new Error(`Unexpected end of input at position ${n}`);let u=e[n];if(u==="{")return l();if(u==="[")return a();if(u==='"')return o();if("null".startsWith(e.substring(n,n+4)))return n+=Math.min(4,e.length-n),null;if("true".startsWith(e.substring(n,n+4)))return n+=Math.min(4,e.length-n),!0;if("false".startsWith(e.substring(n,n+5)))return n+=Math.min(5,e.length-n),!1;if(u==="-"||u>="0"&&u<="9")return i();throw new Error(`Unexpected character '${u}' at position ${n}`)}function a(){if(e[n]!=="[")throw new Error(`Expected '[' at position ${n}, got '${e[n]}'`);let u=[];if(n+=1,r(),n>=e.length)return u;if(e[n]==="]")return n+=1,u;for(;n=e.length||(u.push(s()),r(),n>=e.length))return u;if(e[n]==="]")return n+=1,u;if(e[n]===","){n+=1;continue}throw new Error(`Expected ',' or ']' at position ${n}, got '${e[n]}'`)}return u}function l(){if(e[n]!=="{")throw new Error(`Expected '{' at position ${n}, got '${e[n]}'`);let u={};if(n+=1,r(),n>=e.length)return u;if(e[n]==="}")return n+=1,u;for(;n=e.length)return u;let d=o();if(r(),n>=e.length)return u;if(e[n]!==":")throw new Error(`Expected ':' at position ${n}, got '${e[n]}'`);if(n+=1,r(),n>=e.length||(u[d]=s(),r(),n>=e.length))return u;if(e[n]==="}")return n+=1,u;if(e[n]===","){n+=1;continue}throw new Error(`Expected ',' or '}' at position ${n}, got '${e[n]}'`)}return u}let c=s();if(r(),n"u"?null:PPt(t)}catch{return null}}var Wk=C(()=>{});var rc,$b,T2=C(()=>{nc();rc=class KFe extends Vs{constructor(n,r){(typeof n=="string"||Array.isArray(n))&&(n={content:n,role:r});super(n);I(this,"type","generic");I(this,"role");this.role=n.role}static lc_name(){return"ChatMessage"}static _chatMessageClass(){return KFe}static isInstance(n){return super.isInstance(n)&&n.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},$b=class extends ju{constructor(e,n){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:n});super(e);I(this,"type","generic");I(this,"role");this.role=e.role}static lc_name(){return"ChatMessageChunk"}concat(e){let n=this.constructor;return new n({content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ii(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}}}});var Fb,D3=C(()=>{nc();Fb=class extends ju{constructor(){super(...arguments);I(this,"type","function")}static lc_name(){return"FunctionMessageChunk"}concat(e){let n=this.constructor;return new n({content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ii(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});var Zo,Ub,Bb=C(()=>{nc();Zo=class extends Vs{constructor(e){super(e);I(this,"type","human")}static lc_name(){return"HumanMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="human"}},Ub=class extends ju{constructor(e){super(e);I(this,"type","human")}static lc_name(){return"HumanMessageChunk"}concat(e){let n=this.constructor;return new n({content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ii(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}}});var $3,F3=C(()=>{nc();$3=class extends Vs{constructor(e){super({...e,content:[]});I(this,"type","remove");I(this,"id");this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&e.type==="remove"}}});var Vu,Sg,I2=C(()=>{nc();Vu=class U3 extends Vs{constructor(n){super(n);I(this,"type","system")}static lc_name(){return"SystemMessage"}concat(n){if(typeof n=="string")return new U3({content:zc(this.content,n),additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata,id:this.id,name:this.name});if(U3.isInstance(n))return new U3({content:zc(this.content,n.content),additional_kwargs:{...this.additional_kwargs,...n.additional_kwargs},response_metadata:{...this.response_metadata,...n.response_metadata},id:this.id??n.id,name:this.name??n.name});throw new Error("Unexpected chunk type for system message")}static isInstance(n){return super.isInstance(n)&&n.type==="system"}},Sg=class extends ju{constructor(e){super(e);I(this,"type","system")}static lc_name(){return"SystemMessageChunk"}concat(e){let n=this.constructor;return new n({content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ii(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}}});function EPt(t){return Db(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 APt(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function Rle(t){let e,n;if(APt(t)){let r=t.id.at(-1);r==="HumanMessage"||r==="HumanMessageChunk"?e="user":r==="AIMessage"||r==="AIMessageChunk"?e="assistant":r==="SystemMessage"||r==="SystemMessageChunk"?e="system":r==="FunctionMessage"||r==="FunctionMessageChunk"?e="function":r==="ToolMessage"||r==="ToolMessageChunk"?e="tool":e="unknown",n=t.kwargs}else{let{type:r,...o}=t;e=r,n=o}if(e==="human"||e==="user")return new Zo(n);if(e==="ai"||e==="assistant"){let{tool_calls:r,...o}=n;if(!Array.isArray(r))return new kn(n);let i=r.map(EPt);return new kn({...o,tool_calls:i})}else{if(e==="system")return new Vu(n);if(e==="developer")return new Vu({...n,additional_kwargs:{...n.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in n)return new Wd({...n,content:n.content,tool_call_id:n.tool_call_id,name:n.name});if(e==="remove"&&"id"in n&&typeof n.id=="string")return new $3({...n,id:n.id});throw Lb(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 Lm(t){if(typeof t=="string")return new Zo(t);if(np(t))return t;if(Array.isArray(t)){let[e,n]=t;return Rle({type:e,content:n})}else if(Tle(t)){let{role:e,...n}=t;return Rle({...n,type:e})}else return Rle(t)}function kPt(t){if(typeof t=="string")return t;switch(t.type){case"text":return t.text??"";case"text-plain":return t.text??"[text-plain file]";case"image":case"image_url":return"[image]";case"audio":case"input_audio":return"[audio]";case"video":return"[video]";case"file":return"[file]";case"reasoning":case"tool_call":case"tool_call_chunk":case"invalid_tool_call":case"server_tool_call":case"server_tool_call_chunk":case"server_tool_call_result":case"non_standard":return"";default:return t.type?`[${t.type}]`:""}}function ui(t,e="Human",n="AI"){let r=[];for(let o of t){let i;if(o.type==="human")i=e;else if(o.type==="ai")i=n;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 s=o.name?`${o.name}, `:"",a=typeof o.content=="string"?o.content:Array.isArray(o.content)?o.content.map(kPt).filter(Boolean).join(""):"",l=`${i}: ${s}${a}`;if(o.type==="ai"){let c=o;c.tool_calls&&c.tool_calls.length>0?l+=JSON.stringify(c.tool_calls):c.additional_kwargs&&"function_call"in c.additional_kwargs&&(l+=JSON.stringify(c.additional_kwargs.function_call))}r.push(l)}return r.join(` `)}function B3(t){let e=t._getType();if(e==="human")return new Ub({...t});if(e==="ai"){let n={...t};return"tool_calls"in n&&(n={...n,tool_call_chunks:n.tool_calls?.map(r=>({...r,type:"tool_call_chunk",index:void 0,args:JSON.stringify(r.args)}))}),new Yt({...n})}else{if(e==="system")return new Sg({...t});if(e==="function")return new Fb({...t});if(rc.isInstance(t))return new $b({...t});throw new Error("Unknown message type.")}}function Dle(t){let e=t.reduce((o,i)=>{let s=o.findIndex(([a])=>"id"in i&&i.id&&"index"in i&&i.index!==void 0?i.id===a.id&&i.index===a.index:"id"in i&&i.id?i.id===a.id:"index"in i&&i.index!==void 0?i.index===a.index:!1);return s!==-1?o[s].push(i):o.push([i]),o},[]),n=[],r=[];for(let o of e){let i=null,s=o[0]?.name??"",a=o.map(u=>u.args||"").join("").trim(),l=a.length?a:"{}",c=o[0]?.id;try{if(i=Vk(l),!c||i===null||typeof i!="object"||Array.isArray(i))throw new Error("Malformed tool call chunk args.");n.push({name:s,args:i,id:c,type:"tool_call"})}catch{r.push({name:s,args:l,id:c,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:t,tool_calls:n,invalid_tool_calls:r}}var Lle,Dm=C(()=>{JT();L3();Wk();nc();zk();Wu();T2();D3();Bb();F3();I2();Lle=t=>t()});function rp(t){return t._getType()==="ai"}function z3(t){return t._getType()==="ai"}var kn,Yt,Wu=C(()=>{nc();FFe();R3();zk();Dm();kn=class extends Vs{constructor(e){let n;if(typeof e=="string"||Array.isArray(e))n={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{n=e;let r=n.additional_kwargs?.tool_calls,o=n.tool_calls;r!=null&&r.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(r!=null&&o===void 0){let[i,s]=Ele(r);n.tool_calls=i??[],n.invalid_tool_calls=s??[]}else n.tool_calls=n.tool_calls??[],n.invalid_tool_calls=n.invalid_tool_calls??[]}catch{n.tool_calls=[],n.invalid_tool_calls=[]}if(n.response_metadata!==void 0&&"output_version"in n.response_metadata&&n.response_metadata.output_version==="v1"&&(n.contentBlocks=n.content,n.content=void 0),n.contentBlocks!==void 0){if(n.tool_calls){let s=n.tool_calls.filter(a=>!n.contentBlocks?.some(l=>l.type==="tool_call"&&l.id===a.id&&l.name===a.name));n.contentBlocks.push(...s.map(a=>({type:"tool_call",id:a.id,name:a.name,args:a.args})))}let i=n.contentBlocks.filter(s=>s.type==="tool_call").filter(s=>!n.tool_calls?.some(a=>a.id===s.id&&a.name===s.name));i.length>0&&(n.tool_calls=[...n.tool_calls??[],...i.map(s=>({type:"tool_call",id:s.id,name:s.name,args:s.args}))])}}super(n);I(this,"type","ai");I(this,"tool_calls",[]);I(this,"invalid_tool_calls",[]);I(this,"usage_metadata");typeof n!="string"&&(this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=n.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",usage_metadata:"usage_metadata"}}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 n=Mle(this.response_metadata.model_provider);if(n)return n.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls){let n=this.tool_calls.filter(r=>!e.some(o=>o.id===r.id&&o.name===r.name));e.push(...n.map(r=>({type:"tool_call",id:r.id,name:r.name,args:r.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"}};Yt=class extends ju{constructor(e){let n;if(typeof e=="string"||Array.isArray(e))n={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(e.tool_call_chunks===void 0||e.tool_call_chunks.length===0)n={...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 r=Dle(e.tool_call_chunks??[]);n={...e,tool_call_chunks:r.tool_call_chunks,tool_calls:r.tool_calls,invalid_tool_calls:r.invalid_tool_calls,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(n);I(this,"type","ai");I(this,"tool_calls",[]);I(this,"invalid_tool_calls",[]);I(this,"tool_call_chunks",[]);I(this,"usage_metadata");this.tool_call_chunks=n.tool_call_chunks??this.tool_call_chunks,this.tool_calls=n.tool_calls??this.tool_calls,this.invalid_tool_calls=n.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=n.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks",usage_metadata:"usage_metadata"}}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 n=Mle(this.response_metadata.model_provider);if(n)return n.translateContent(this)}let e=super.contentBlocks;if(this.tool_calls&&typeof this.content!="string"){let n=this.content.filter(r=>r.type==="tool_call").map(r=>r.id);for(let r of this.tool_calls)r.id&&!n.includes(r.id)&&e.push({...r,type:"tool_call",id:r.id,name:r.name,args:r.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 n={content:zc(this.content,e.content),additional_kwargs:Ii(this.additional_kwargs,e.additional_kwargs),response_metadata:Ile(this.response_metadata,e.response_metadata),tool_call_chunks:[],tool_calls:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let o=ZT(this.tool_call_chunks,e.tool_call_chunks);o!==void 0&&o.length>0&&(n.tool_call_chunks=o)}if(this.tool_calls!==void 0||e.tool_calls!==void 0){let o=ZT(this.tool_calls,e.tool_calls);o!==void 0&&o.length>0&&(n.tool_calls=o)}(this.usage_metadata!==void 0||e.usage_metadata!==void 0)&&(n.usage_metadata=_2(this.usage_metadata,e.usage_metadata));let r=this.constructor;return new r(n)}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}}});var GFe,YFe=C(()=>{GFe=/^(?:[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 Tg(t){return typeof t=="string"&&GFe.test(t)}var Hk=C(()=>{YFe()});function XT(t,e=0){return(yl[t[e+0]]+yl[t[e+1]]+yl[t[e+2]]+yl[t[e+3]]+"-"+yl[t[e+4]]+yl[t[e+5]]+"-"+yl[t[e+6]]+yl[t[e+7]]+"-"+yl[t[e+8]]+yl[t[e+9]]+"-"+yl[t[e+10]]+yl[t[e+11]]+yl[t[e+12]]+yl[t[e+13]]+yl[t[e+14]]+yl[t[e+15]]).toLowerCase()}var yl,Kk=C(()=>{Hk();yl=[];for(let t=0;t<256;++t)yl.push((t+256).toString(16).slice(1))});function qk(){return crypto.getRandomValues(MPt)}var MPt,j3=C(()=>{MPt=new Uint8Array(16)});function op(t,e,n){let r;if(t)r=ZFe(t.random??t.rng?.()??qk(),t.msecs,t.seq,e,n);else{let o=Date.now(),i=qk();NPt($le,o,i),r=ZFe(i,$le.msecs,$le.seq,e,n)}return e??XT(r)}function NPt(t,e,n){return t.msecs??(t.msecs=-1/0),t.seq??(t.seq=0),e>t.msecs?(t.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}function ZFe(t,e,n,r,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),o=0;else if(o<0||o+16>r.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return e??(e=Date.now()),n??(n=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),r[o++]=e/1099511627776&255,r[o++]=e/4294967296&255,r[o++]=e/16777216&255,r[o++]=e/65536&255,r[o++]=e/256&255,r[o++]=e&255,r[o++]=112|n>>>28&15,r[o++]=n>>>20&255,r[o++]=128|n>>>14&63,r[o++]=n>>>6&255,r[o++]=n<<2&255|t[10]&3,r[o++]=t[11],r[o++]=t[12],r[o++]=t[13],r[o++]=t[14],r[o++]=t[15],r}var $le,P2=C(()=>{Kk();j3();$le={}});var JFe=C(()=>{});var XFe=C(()=>{});function V3(t){if(!Tg(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}var Fle=C(()=>{Hk()});var QFe=C(()=>{Kk();j3()});function Ule(t,e,n){return!e&&!t&&crypto.randomUUID?crypto.randomUUID():OPt(t,e,n)}function OPt(t,e,n){t=t||{};let r=t.random??t.rng?.()??qk();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){if(n=n||0,n<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)e[n+o]=r[o];return e}return XT(r)}var Ble=C(()=>{Kk();j3()});function RPt(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:return e^n^r;case 2:return e&n^e&r^n&r;case 3:return e^n^r}}function zle(t,e){return t<>>32-e}function e2e(t){let e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(t.length+1);r.set(t),r[t.length]=128,t=r;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a>>0;p=f,f=d,d=zle(u,30)>>>0,u=c,c=g}n[0]=n[0]+c>>>0,n[1]=n[1]+u>>>0,n[2]=n[2]+d>>>0,n[3]=n[3]+f>>>0,n[4]=n[4]+p>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}var t2e=C(()=>{});function LPt(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let n=0;no.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let c=0;c<16;++c)o[i+c]=l[c];return o}return XT(l)}var n2e,r2e,i2e=C(()=>{Fle();Kk();n2e="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r2e="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function jle(t,e,n,r){return o2e(80,e2e,t,e,n,r)}var s2e=C(()=>{t2e();i2e();jle.DNS=n2e;jle.URL=r2e});var a2e=C(()=>{Hk()});var E2=C(()=>{$n();JFe();XFe();Hk();Fle();Kk();QFe();Ble();s2e();P2();a2e()});var l2e,QT,c2e,zb,A2=C(()=>{l2e=Symbol.for("ls:tracing_async_local_storage"),QT=Symbol.for("lc:context_variables"),c2e=t=>{globalThis[l2e]=t},zb=()=>globalThis[l2e]});function u2e(){return Vle===void 0&&(Vle={library:"langchain-js",runtime:Hle()}),Vle}function In(t){try{return typeof process<"u"?process.env?.[t]:Wle()?Deno?.env.get(t):void 0}catch{return}}var DPt,$Pt,FPt,Wle,UPt,Hle,Vle,Jo=C(()=>{$n();DPt=()=>typeof window<"u"&&typeof window.document<"u",$Pt=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",FPt=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),Wle=()=>typeof Deno<"u",UPt=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Wle(),Hle=()=>{let t;return DPt()?t="browser":UPt()?t="node":$Pt()?t="webworker":FPt()?t="jsdom":Wle()?t="deno":t="other",t}});function Kle(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}function d2e(t){return"lc_prefer_chat_model_stream_events"in t&&t.lc_prefer_chat_model_stream_events}var BPt,Gk,f2e,k2=C(()=>{$n();Rb();P2();E2();Jo();BPt=class{};Gk=class extends BPt{constructor(e){super();I(this,"lc_serializable",!1);I(this,"lc_kwargs");I(this,"ignoreLLM",!1);I(this,"ignoreChain",!1);I(this,"ignoreAgent",!1);I(this,"ignoreRetriever",!1);I(this,"ignoreCustomEvent",!1);I(this,"raiseError",!1);I(this,"awaitHandlers",In("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,yle(this.constructor)]}copy(){return new this.constructor(this)}toJSON(){return zu.prototype.toJSON.call(this)}toJSONNotImplemented(){return zu.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class n extends Gk{constructor(){super();I(this,"name",op());Object.assign(this,e)}}return new n}},f2e=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});var p2e,m2e=C(()=>{p2e=/^(?:[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 zPt(t){return typeof t=="string"&&p2e.test(t)}var h2e,g2e=C(()=>{m2e();h2e=zPt});function jPt(t){if(!h2e(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}var y2e,w2e=C(()=>{g2e();y2e=jPt});function Yk(t,e=0){return(wl[t[e+0]]+wl[t[e+1]]+wl[t[e+2]]+wl[t[e+3]]+"-"+wl[t[e+4]]+wl[t[e+5]]+"-"+wl[t[e+6]]+wl[t[e+7]]+"-"+wl[t[e+8]]+wl[t[e+9]]+"-"+wl[t[e+10]]+wl[t[e+11]]+wl[t[e+12]]+wl[t[e+13]]+wl[t[e+14]]+wl[t[e+15]]).toLowerCase()}var wl,W3,H3=C(()=>{wl=[];for(W3=0;W3<256;++W3)wl.push((W3+256).toString(16).slice(1))});function M2(){if(!K3&&(K3=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!K3))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return K3(VPt)}var K3,VPt,qle=C(()=>{VPt=new Uint8Array(16)});function WPt(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n{H3();w2e();HPt="6ba7b810-9dad-11d1-80b4-00c04fd430c8",KPt="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var qPt,Yle,x2e=C(()=>{qPt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Yle={randomUUID:qPt}});function GPt(t,e,n){if(Yle.randomUUID&&!e&&!t)return Yle.randomUUID();t=t||{};var r=t.random||(t.rng||M2)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return Yk(r)}var eI,b2e=C(()=>{x2e();qle();H3();eI=GPt});function YPt(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:return e^n^r;case 2:return e&n^e&r^n&r;case 3:return e^n^r}}function Zle(t,e){return t<>>32-e}function ZPt(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var r=unescape(encodeURIComponent(t));t=[];for(var o=0;o>>0;v=w,w=y,y=Zle(g,30)>>>0,g=h,h=_}n[0]=n[0]+h>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+w>>>0,n[4]=n[4]+v>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var C2e,_2e=C(()=>{C2e=ZPt});var JPt,Jle,S2e=C(()=>{v2e();_2e();JPt=Gle("v5",80,C2e),Jle=JPt});function XPt(t,e,n){t=t||{};var r=e&&n||0,o=e||new Uint8Array(16),i=t.random||(t.rng||M2)(),s=t.msecs!==void 0?t.msecs:Date.now(),a=t.seq!==void 0?t.seq:null,l=I2e,c=T2e;return s>$m&&t.msecs===void 0&&($m=s,a!==null&&(l=null,c=null)),a!==null&&(a>2147483647&&(a=2147483647),l=a>>>19&4095,c=a&524287),(l===null||c===null)&&(l=i[6]&127,l=l<<8|i[7],c=i[8]&63,c=c<<8|i[9],c=c<<5|i[10]>>>3),s+1e4>$m&&a===null?++c>524287&&(c=0,++l>4095&&(l=0,$m++)):$m=s,I2e=l,T2e=c,o[r++]=$m/1099511627776&255,o[r++]=$m/4294967296&255,o[r++]=$m/16777216&255,o[r++]=$m/65536&255,o[r++]=$m/256&255,o[r++]=$m&255,o[r++]=l>>>4&15|112,o[r++]=l&255,o[r++]=c>>>13&63|128,o[r++]=c>>>5&255,o[r++]=c<<3&255|i[10]&7,o[r++]=i[11],o[r++]=i[12],o[r++]=i[13],o[r++]=i[14],o[r++]=i[15],e||Yk(o)}var T2e,I2e,$m,Xle,P2e=C(()=>{qle();H3();T2e=null,I2e=null,$m=0;Xle=XPt});var q3=C(()=>{b2e();S2e();P2e()});var E2e,A2e,Qle,k2e,ece,tce,nce,M2e,N2e,O2e,R2e,L2e,D2e,$2e,F2e,U2e,B2e,z2e,j2e,V2e,W2e,H2e,K2e,q2e,G2e,Y2e,Z2e,J2e,X2e,Q2e,rce,eUe,tUe,nUe=C(()=>{E2e="gen_ai.operation.name",A2e="gen_ai.system",Qle="gen_ai.request.model",k2e="gen_ai.response.model",ece="gen_ai.usage.input_tokens",tce="gen_ai.usage.output_tokens",nce="gen_ai.usage.total_tokens",M2e="gen_ai.request.max_tokens",N2e="gen_ai.request.temperature",O2e="gen_ai.request.top_p",R2e="gen_ai.request.frequency_penalty",L2e="gen_ai.request.presence_penalty",D2e="gen_ai.response.finish_reasons",$2e="gen_ai.prompt",F2e="gen_ai.completion",U2e="gen_ai.request.extra_query",B2e="gen_ai.request.extra_body",z2e="gen_ai.serialized.name",j2e="gen_ai.serialized.signature",V2e="gen_ai.serialized.doc",W2e="gen_ai.response.id",H2e="gen_ai.response.service_tier",K2e="gen_ai.response.system_fingerprint",q2e="gen_ai.usage.input_token_details",G2e="gen_ai.usage.output_token_details",Y2e="langsmith.trace.session_id",Z2e="langsmith.trace.session_name",J2e="langsmith.span.kind",X2e="langsmith.trace.name",Q2e="langsmith.metadata",rce="langsmith.span.tags",eUe="langsmith.request.streaming",tUe="langsmith.request.headers"});var tEt,nEt,rUe,oUe,iUe,oce=C(()=>{Mw();tEt=(...t)=>fetch(...t),rUe=Symbol.for("ls:fetch_implementation"),oUe=()=>globalThis[rUe]===void 0?!0:nEt??!1,iUe=t=>async(...e)=>{if(t||rs("DEBUG")==="true"){let[r,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${r}`)}let n=await(globalThis[rUe]??tEt)(...e);return(t||rs("DEBUG")==="true")&&console.log(`\u2190 ${n.status} ${n.statusText} ${n.url}`),n}});var N2,ice=C(()=>{Mw();N2=()=>rs("PROJECT")??Hd("LANGCHAIN_SESSION")??"default"});function tI(t){sUe[t]||(console.warn(t),sUe[t]=!0)}var sUe,G3=C(()=>{sUe={}});function aEt(t){let e=new Uint8Array(t.length/2);for(let n=0;n>Re(32)-e)&X3}function mUe(t,e,n){for(let r=0;r>Re(32))}return t}function aUe(t,e,n,r){for(let o=0;o128),r=mEt(r,t,e,mUe,pEt),Xk(r.length*8==64);{let o=lUe(r,$o(e,11),Re(t.byteLength)*jb&nr);return lUe(r,$o(e,e.byteLength-Nw-11),~(Re(t.byteLength)*nI)&nr)<>Re(64)}function cUe(t,e,n){return hUe((Xo(t,0)^Xo(e,0)+n)&nr,(Xo(t,8)^Xo(e,8)-n)&nr)}function J3(t,e,n,r,o){let i=t&nr,s=t>>Re(64)&nr;return i+=cUe(e,r,o),i^=Xo(n,0)+Xo(n,8),i&=nr,s+=cUe(n,$o(r,16),o),s^=Xo(e,0)+Xo(e,8),s&=nr,s<>Re(37),t*=iEt,t&=nr,t^=t>>Re(32),t}function Q3(t){return t^=t>>Re(33),t*=nI,t&=nr,t^=t>>Re(29),t*=fUe,t&=nr,t^=t>>Re(32),t}function gEt(t,e,n){let r=t.byteLength;Xk(r>0&&r<=3);let o=Re(sce(t,r-1))|Re(r<<8)|Re(sce(t,0)<<16)|Re(sce(t,r>>1)<<24),i=(Re(Zk(e,0))^Re(Zk(e,4)))+n,s=(o^i)&nr,a=(Re(Zk(e,8))^Re(Zk(e,12)))-n,l=(fEt(uEt(o),Re(13))^a)&nr;return(Q3(l)&nr)<>e}function yEt(t,e,n){let r=t.byteLength;Xk(r>=4&&r<=8);{let o=Zk(t,0),i=Zk(t,r-4),s=Re(o)|Re(i)<>Re(67),ace(ace(c&nr,Re(35))*sEt&nr,Re(28))|Pg(c>>Re(64))<=9&&r<=16);{let o=(Xo(e,32)^Xo(e,40))+n&nr,i=(Xo(e,48)^Xo(e,56))-n&nr,s=Xo(t),a=Xo(t,r-8),l=(s^a^o)*jb,c=(l&nr)+(Re(r-1)<>Re(64));let u=(l&nr)*nI;return u+=(l>>Re(64))*nI<>Re(64))<8?wEt(t,Ig,e):n>=4?yEt(t,Ig,e):n>0?gEt(t,Ig,e):Q3(e^Xo(Ig,64)^Xo(Ig,72))|Q3(e^Xo(Ig,80)^Xo(Ig,88))<=0;){let a=Number(o);r=J3(r,$o(t,16*a),$o(t,t.byteLength-16*(a+1)),$o(e,32*a),n),o--}let i=r+(r>>Re(64))&nr;i=Pg(i);let s=(r&nr)*jb+(r>>Re(64))*cce+(Re(t.byteLength)-n&nr)*nI;return s&=nr,s=lce(Pg(s)),i|s<>Re(64))<>Re(64))&nr;o=Pg(o);let i=(r&nr)*jb+(r>>Re(64))*cce+(Re(t.byteLength)-n&nr)*nI;return i&=nr,i=lce(Pg(i)),o|i<>Re(64);return n.setBigUint64(0,o,!1),n.setBigUint64(8,r,!1),e}var Re,uUe,dUe,rEt,jb,nI,fUe,cce,oEt,iEt,sEt,Ig,Jk,nr,X3,Nw,pUe,lEt,Y3,cEt,uEt,dEt,Xk,wUe=C(()=>{Re=t=>BigInt(t),uUe=Re("0x9E3779B1"),dUe=Re("0x85EBCA77"),rEt=Re("0xC2B2AE3D"),jb=Re("0x9E3779B185EBCA87"),nI=Re("0xC2B2AE3D27D4EB4F"),fUe=Re("0x165667B19E3779F9"),cce=Re("0x85EBCA77C2B2AE63"),oEt=Re("0x27D4EB2F165667C5"),iEt=Re("0x165667919E3779F9"),sEt=Re("0x9FB21C651E98DF25");Ig=aEt("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),Jk=(Re(1)<(t&Re(255))<>Re(8)|(t&Re(0xff0000000000))>>Re(24)|(t&Re(0xff000000000000))>>Re(40)|(t&Re(0xff00000000000000))>>Re(56),uEt=t=>(t=(t&Re(65535))<>Re(16),t=(t&Re(16711935))<>Re(8),t),dEt=(t,e)=>(t&X3)*(e&X3)&nr,Xk=t=>{if(!t)throw new Error("Assert failed")}});function qn(t,e){if(!vUe.test(t)){let n=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(n)}return t}function eK(t){let e=typeof t=="string"?Date.parse(t):t;return Xle({msecs:e,seq:0})}function CEt(t){if(!vUe.test(t))return null;let e=t[14];return parseInt(e,16)}function _Et(t){let e=t.replace(/-/g,""),n=new Uint8Array(16);for(let r=0;r<16;r++)n[r]=parseInt(e.slice(r*2,r*2+2),16);return n}function SEt(t){let e=Array.from(t).map(n=>n.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 IEt(t){let e=TEt.encode(t),n=gUe(e);return yUe(n)}function O2(t,e){let n=`${t}:${e}`,r=IEt(n),o=new Uint8Array(16);if(CEt(t)===7){let s=_Et(t);o.set(s.slice(0,6),0)}else{let s=Date.now();o[0]=s/1099511627776&255,o[1]=s/4294967296&255,o[2]=s/16777216&255,o[3]=s/65536&255,o[4]=s/256&255,o[5]=s&255}return o[6]=112|r[0]&15,o[7]=r[1],o[8]=128|r[2]&63,o.set(r.slice(3,10),9),SEt(o)}var vUe,TEt,tK=C(()=>{q3();G3();wUe();vUe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;TEt=new TextEncoder});var xUe=C(()=>{tK()});function bUe(t,e){throw new Error("dump() is not supported in browser environments.")}function CUe(t){throw new Error("load() is not supported in browser environments.")}var _Ue=C(()=>{});function PEt(t,e){return e===null?!1:Date.now()-t.createdAt>e*1e3}var nK,rK,uce=C(()=>{_Ue();nK=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,n){if(this.maxSize===0)return;let r=this.cache.get(e);if(!r){this._metrics.misses+=1;return}return this.cache.delete(e),this.cache.set(e,{...r,refreshFunc:n}),this._metrics.hits+=1,r.value}set(e,n,r){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:n,createdAt:Date.now(),refreshFunc:r};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 n={};for(let[r,o]of this.cache.entries())n[r]=o.value;bUe(e,n)}load(e){let n=CUe(e);if(!n)return 0;let r=0,o=Date.now();for(let[i,s]of Object.entries(n)){if(this.cache.size>=this.maxSize)break;let a={value:s,createdAt:o};this.cache.set(i,a),r+=1}return r}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[n,r]of this.cache.entries())PEt(r,this.ttlSeconds)&&e.push([n,r]);return e}async refreshStaleEntries(){let e=this.getStaleEntries();if(e.length!==0){for(let[n,r]of e)if(r.refreshFunc!==void 0)try{let o=await r.refreshFunc();this.set(n,o,r.refreshFunc),this._metrics.refreshes+=1}catch(o){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${n}:`,o)}}}configure(e){this.stop(),this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??5*60}},rK=new nK});var oK,iK=C(()=>{dce();fce();oce();ice();xUe();uce();oK="0.5.4"});function sK(){if(pce===void 0){let t=hce(),e=OEt();pce={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:oK,...e}}return pce}function gce(){let t=NEt(),e={},n=["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[r,o]of Object.entries(t))typeof o=="string"&&!n.includes(r)&&!r.toLowerCase().includes("key")&&!r.toLowerCase().includes("secret")&&!r.toLowerCase().includes("token")&&(r==="LANGCHAIN_REVISION_ID"?e.revision_id=o:e[r]=o);return e}function NEt(){let t={};try{if(typeof process<"u"&&process.env)for(let[e,n]of Object.entries(process.env))(e.startsWith("LANGCHAIN_")||e.startsWith("LANGSMITH_"))&&n!=null&&((e.toLowerCase().includes("key")||e.toLowerCase().includes("secret")||e.toLowerCase().includes("token"))&&typeof n=="string"?t[e]=n.slice(0,2)+"*".repeat(n.length-4)+n.slice(-2):t[e]=n)}catch{}return t}function Hd(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function rs(t){return Hd(`LANGSMITH_${t}`)||Hd(`LANGCHAIN_${t}`)}function OEt(){if(mce!==void 0)return mce;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 n of t){let r=Hd(n);r!==void 0&&(e[n]=r)}return mce=e,e}function aK(){return Hd("OTEL_ENABLED")==="true"||rs("OTEL_ENABLED")==="true"}var Eg,EEt,AEt,kEt,SUe,MEt,hce,pce,mce,Mw=C(()=>{iK();EEt=()=>typeof window<"u"&&typeof window.document<"u",AEt=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",kEt=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),SUe=()=>typeof Deno<"u",MEt=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!SUe(),hce=()=>Eg||(typeof Bun<"u"?Eg="bun":EEt()?Eg="browser":MEt()?Eg="node":AEt()?Eg="webworker":kEt()?Eg="jsdom":SUe()?Eg="deno":Eg="other",Eg)});function lK(){return _ce.getTraceInstance()}function IUe(){return _ce.getContextInstance()}function PUe(){return _ce.getDefaultOTLPTracerComponents()}var vce,xce,bce,yce,wce,TUe,REt,LEt,Cce,_ce,Sce=C(()=>{Mw();vce=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...n){!this.hasWarned&&aK()&&(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 r;if(n.length===1&&typeof n[0]=="function"?r=n[0]:n.length===2&&typeof n[1]=="function"?r=n[1]:n.length===3&&typeof n[2]=="function"&&(r=n[2]),typeof r=="function")return r()}},xce=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new vce})}getTracer(e,n){return this.mockTracer}getActiveSpan(){}setSpan(e,n){return e}getSpan(e){}setSpanContext(e,n){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},bce=class{active(){return{}}with(e,n){return n()}},yce=Symbol.for("ls:otel_trace"),wce=Symbol.for("ls:otel_context"),TUe=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),REt=new xce,LEt=new bce,Cce=class{getTraceInstance(){return globalThis[yce]??REt}getContextInstance(){return globalThis[wce]??LEt}initializeGlobalInstances(e){globalThis[yce]===void 0&&(globalThis[yce]=e.trace),globalThis[wce]===void 0&&(globalThis[wce]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[TUe]=e}getDefaultOTLPTracerComponents(){return globalThis[TUe]??void 0}},_ce=new Cce});function $Et(t){return DEt[t]||t}var DEt,cK,EUe=C(()=>{nUe();Sce();DEt={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};cK=class{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}exportBatch(e,n){for(let r of e)try{if(!r.run)continue;if(r.operation==="post"){let o=this.createSpanForRun(r,r.run,n.get(r.id));o&&!r.run.end_time&&this.spans.set(r.id,o)}else this.updateSpanForRun(r,r.run)}catch(o){console.error(`Error processing operation ${r.id}:`,o)}}createSpanForRun(e,n,r){let o=r&&lK().getSpan(r);if(o)try{return this.finishSpanSetup(o,n,e)}catch(i){console.error(`Failed to create span for run ${e.id}:`,i);return}}finishSpanSetup(e,n,r){return this.setSpanAttributes(e,n,r),n.error?(e.setStatus({code:2}),e.recordException(new Error(n.error))):e.setStatus({code:1}),n.end_time&&e.end(new Date(n.end_time)),e}updateSpanForRun(e,n){try{let r=this.spans.get(e.id);if(!r){console.debug(`No span found for run ${e.id} during update`);return}this.setSpanAttributes(r,n,e),n.error?(r.setStatus({code:2}),r.recordException(new Error(n.error))):r.setStatus({code:1});let o=n.end_time;o&&(r.end(new Date(o)),this.spans.delete(e.id))}catch(r){console.error(`Failed to update span for run ${e.id}:`,r)}}extractModelName(e){if(e.extra?.metadata){let n=e.extra.metadata;if(n.ls_model_name)return n.ls_model_name;if(n.invocation_params){let r=n.invocation_params;if(r.model)return r.model;if(r.model_name)return r.model_name}}}setSpanAttributes(e,n,r){if("run_type"in n&&n.run_type){e.setAttribute(J2e,n.run_type);let a=$Et(n.run_type||"chain");e.setAttribute(E2e,a)}"name"in n&&n.name&&e.setAttribute(X2e,n.name),"session_id"in n&&n.session_id&&e.setAttribute(Y2e,n.session_id),"session_name"in n&&n.session_name&&e.setAttribute(Z2e,n.session_name),this.setGenAiSystem(e,n);let o=this.extractModelName(n);o&&e.setAttribute(Qle,o),"prompt_tokens"in n&&typeof n.prompt_tokens=="number"&&e.setAttribute(ece,n.prompt_tokens),"completion_tokens"in n&&typeof n.completion_tokens=="number"&&e.setAttribute(tce,n.completion_tokens),"total_tokens"in n&&typeof n.total_tokens=="number"&&e.setAttribute(nce,n.total_tokens),this.setInvocationParameters(e,n);let i=n.extra?.metadata||{};for(let[a,l]of Object.entries(i))l!=null&&e.setAttribute(`${Q2e}.${a}`,String(l));let s=n.tags;if(s&&Array.isArray(s)?e.setAttribute(rce,s.join(", ")):s&&e.setAttribute(rce,String(s)),"serialized"in n&&typeof n.serialized=="object"){let a=n.serialized;a.name&&e.setAttribute(z2e,String(a.name)),a.signature&&e.setAttribute(j2e,String(a.signature)),a.doc&&e.setAttribute(V2e,String(a.doc))}this.setIOAttributes(e,r)}setGenAiSystem(e,n){let r="langchain",o=this.extractModelName(n);if(o){let i=o.toLowerCase();i.includes("anthropic")||i.startsWith("claude")?r="anthropic":i.includes("bedrock")?r="aws.bedrock":i.includes("azure")&&i.includes("openai")?r="az.ai.openai":i.includes("azure")&&i.includes("inference")?r="az.ai.inference":i.includes("cohere")?r="cohere":i.includes("deepseek")?r="deepseek":i.includes("gemini")?r="gemini":i.includes("groq")?r="groq":i.includes("watson")||i.includes("ibm")?r="ibm.watsonx.ai":i.includes("mistral")?r="mistral_ai":i.includes("gpt")||i.includes("openai")?r="openai":i.includes("perplexity")||i.includes("sonar")?r="perplexity":i.includes("vertex")?r="vertex_ai":(i.includes("xai")||i.includes("grok"))&&(r="xai")}e.setAttribute(A2e,r)}setInvocationParameters(e,n){if(!n.extra?.metadata?.invocation_params)return;let r=n.extra.metadata.invocation_params;r.max_tokens!==void 0&&e.setAttribute(M2e,r.max_tokens),r.temperature!==void 0&&e.setAttribute(N2e,r.temperature),r.top_p!==void 0&&e.setAttribute(O2e,r.top_p),r.frequency_penalty!==void 0&&e.setAttribute(R2e,r.frequency_penalty),r.presence_penalty!==void 0&&e.setAttribute(L2e,r.presence_penalty)}setIOAttributes(e,n){if(n.run.inputs)try{let r=n.run.inputs;typeof r=="object"&&r!==null&&(r.model&&Array.isArray(r.messages)&&e.setAttribute(Qle,r.model),r.stream!==void 0&&e.setAttribute(eUe,r.stream),r.extra_headers&&e.setAttribute(tUe,JSON.stringify(r.extra_headers)),r.extra_query&&e.setAttribute(U2e,JSON.stringify(r.extra_query)),r.extra_body&&e.setAttribute(B2e,JSON.stringify(r.extra_body))),e.setAttribute($2e,JSON.stringify(r))}catch(r){console.debug(`Failed to process inputs for run ${n.id}`,r)}if(n.run.outputs)try{let r=n.run.outputs,o=this.getUnifiedRunTokens(r);if(o&&(e.setAttribute(ece,o[0]),e.setAttribute(tce,o[1]),e.setAttribute(nce,o[0]+o[1])),r&&typeof r=="object"){if(r.model&&e.setAttribute(k2e,String(r.model)),r.id&&e.setAttribute(W2e,r.id),r.choices&&Array.isArray(r.choices)){let i=r.choices.map(s=>s.finish_reason).filter(s=>s).map(String);i.length>0&&e.setAttribute(D2e,i.join(", "))}if(r.service_tier&&e.setAttribute(H2e,r.service_tier),r.system_fingerprint&&e.setAttribute(K2e,r.system_fingerprint),r.usage_metadata&&typeof r.usage_metadata=="object"){let i=r.usage_metadata;i.input_token_details&&e.setAttribute(q2e,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(G2e,JSON.stringify(i.output_token_details))}}e.setAttribute(F2e,JSON.stringify(r))}catch(r){console.debug(`Failed to process outputs for run ${n.id}`,r)}}getUnifiedRunTokens(e){if(!e)return null;let n=this.extractUnifiedRunTokens(e.usage_metadata);if(n)return n;let r=Object.keys(e);for(let s of r){let a=e[s];if(!(!a||typeof a!="object")&&(n=this.extractUnifiedRunTokens(a.usage_metadata),n||a.lc===1&&a.kwargs&&typeof a.kwargs=="object"&&(n=this.extractUnifiedRunTokens(a.kwargs.usage_metadata),n)))return n}let o=e.generations||[];if(!Array.isArray(o))return null;let i=Array.isArray(o[0])?o.flat():o;for(let s of i)if(typeof s=="object"&&s.message&&typeof s.message=="object"&&s.message.kwargs&&typeof s.message.kwargs=="object"&&(n=this.extractUnifiedRunTokens(s.message.kwargs.usage_metadata),n))return n;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 Tce(t){if(!(t&&UEt(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:n,stack:r}=t;return n==="Load failed"?r===void 0||"__sentry_captured__"in t:n.startsWith("error sending request for url")?!0:BEt.has(n)}var FEt,UEt,BEt,AUe=C(()=>{FEt=Object.prototype.toString,UEt=t=>FEt.call(t)==="[object Error]",BEt=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 zEt(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 uK(t,e,{min:n=0,allowInfinity:r=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(g),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},g=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&g.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function Pce(t,e={}){if(e={...e},zEt(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),uK("factor",e.factor,{min:0,allowInfinity:!1}),uK("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),uK("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),uK("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let n=0,r=0,o=performance.now();for(;!Number.isFinite(e.retries)||r<=e.retries;){n++;try{e.signal?.throwIfAborted();let i=await t(n);return e.signal?.throwIfAborted(),i}catch(i){await VEt({error:i,attemptNumber:n,retriesConsumed:r,startTime:o,options:e})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}var Ice,MUe=C(()=>{AUe();Ice=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 Ace=Tt((uSn,Ece)=>{"use strict";var WEt=Object.prototype.hasOwnProperty,jc="~";function R2(){}Object.create&&(R2.prototype=Object.create(null),new R2().__proto__||(jc=!1));function HEt(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function NUe(t,e,n,r,o){if(typeof n!="function")throw new TypeError("The listener must be a function");var i=new HEt(n,r||t,o),s=jc?jc+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],i]:t._events[s].push(i):(t._events[s]=i,t._eventsCount++),t}function dK(t,e){--t._eventsCount===0?t._events=new R2:delete t._events[e]}function oc(){this._events=new R2,this._eventsCount=0}oc.prototype.eventNames=function(){var e=[],n,r;if(this._eventsCount===0)return e;for(r in n=this._events)WEt.call(n,r)&&e.push(jc?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(n)):e};oc.prototype.listeners=function(e){var n=jc?jc+e:e,r=this._events[n];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o{"use strict";OUe.exports=(t,e)=>(e=e||(()=>{}),t.then(n=>new Promise(r=>{r(e())}).then(()=>n),n=>new Promise(r=>{r(e())}).then(()=>{throw n})))});var LUe=Tt((fSn,pK)=>{"use strict";var KEt=kce(),fK=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},RUe=(t,e,n)=>new Promise((r,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){r(t);return}let i=setTimeout(()=>{if(typeof n=="function"){try{r(n())}catch(l){o(l)}return}let s=typeof n=="string"?n:`Promise timed out after ${e} milliseconds`,a=n instanceof Error?n:new fK(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);KEt(t.then(r,o),()=>{clearTimeout(i)})});pK.exports=RUe;pK.exports.default=RUe;pK.exports.TimeoutError=fK});var DUe=Tt(Mce=>{"use strict";Object.defineProperty(Mce,"__esModule",{value:!0});function qEt(t,e,n){let r=0,o=t.length;for(;o>0;){let i=o/2|0,s=r+i;n(t[s],e)<=0?(r=++s,o-=i+1):o=i}return r}Mce.default=qEt});var $Ue=Tt(Oce=>{"use strict";Object.defineProperty(Oce,"__esModule",{value:!0});var GEt=DUe(),Nce=class{constructor(){this._queue=[]}enqueue(e,n){n=Object.assign({priority:0},n);let r={priority:n.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=n.priority){this._queue.push(r);return}let o=GEt.default(this._queue,r,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,r)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(n=>n.priority===e.priority).map(n=>n.run)}get size(){return this._queue.length}};Oce.default=Nce});var UUe=Tt(Lce=>{"use strict";Object.defineProperty(Lce,"__esModule",{value:!0});var YEt=Ace(),FUe=LUe(),ZEt=$Ue(),mK=()=>{},JEt=new FUe.TimeoutError,Rce=class extends YEt{constructor(e){var n,r,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=mK,this._resolveIdle=mK,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:ZEt.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(n=e.intervalCap)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:""}\` (${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._onResumeInterval()},n)),!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 n=this._queue.dequeue();return n?(this.emit("active"),n(),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,n={}){return new Promise((r,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&n.timeout===void 0?e():FUe.default(Promise.resolve(e()),n.timeout===void 0?this._timeout:n.timeout,()=>{(n.throwOnTimeout===void 0?this._throwOnTimeout:n.throwOnTimeout)&&o(JEt)});r(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,n),this._tryToStartAnother(),this.emit("add")})}async addAll(e,n){return Promise.all(e.map(async r=>this.add(r,n)))}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 n=this._resolveEmpty;this._resolveEmpty=()=>{n(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let n=this._resolveIdle;this._resolveIdle=()=>{n(),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}};Lce.default=Rce});var hK,BUe,zUe=C(()=>{hK=N(UUe(),1),BUe="default"in hK.default?hK.default.default:hK.default});var XEt,L2,jUe=C(()=>{MUe();zUe();XEt=[408,425,429,500,502,503,504],L2=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 BUe({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...n){return this.callWithOptions({},e,...n)}callWithOptions(e,n,...r){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,s=this.queue.add(()=>Pce(()=>n(...r).catch(a=>{throw a instanceof Error?a:new Error(a)}),{async onFailedAttempt({error:a}){if(typeof a!="object"||a==null)throw a;let l="message"in a&&typeof a.message=="string"?a.message:void 0;if(l?.startsWith("Cancel")||l?.startsWith("TimeoutError")||l?.startsWith("AbortError")||"name"in a&&a.name==="TimeoutError"||"code"in a&&a.code==="ECONNABORTED")throw a;let c="response"in a?a.response:void 0;if(i&&await i(c))return;let u=c?.status??("status"in a?a.status:void 0);if(u!=null&&(typeof u=="number"||typeof u=="string")&&!XEt.includes(+u))throw a},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return o>0&&(s=s.finally(()=>{this.queueSizeBytes-=o})),e.signal?Promise.race([s,new Promise((a,l)=>{e.signal?.addEventListener("abort",()=>{l(new Error("AbortError"))})})]):s}}});function Dce(t){return typeof t?._getType=="function"}function $ce(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 VUe=C(()=>{});var D2=Tt((bSn,WUe)=>{"use strict";var QEt="2.0.0",eAt=Number.MAX_SAFE_INTEGER||9007199254740991,tAt=16,nAt=250,rAt=["major","premajor","minor","preminor","patch","prepatch","prerelease"];WUe.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:tAt,MAX_SAFE_BUILD_LENGTH:nAt,MAX_SAFE_INTEGER:eAt,RELEASE_TYPES:rAt,SEMVER_SPEC_VERSION:QEt,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var $2=Tt((CSn,HUe)=>{"use strict";var oAt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};HUe.exports=oAt});var Qk=Tt((Ag,KUe)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Fce,MAX_SAFE_BUILD_LENGTH:iAt,MAX_LENGTH:sAt}=D2(),aAt=$2();Ag=KUe.exports={};var lAt=Ag.re=[],cAt=Ag.safeRe=[],At=Ag.src=[],uAt=Ag.safeSrc=[],kt=Ag.t={},dAt=0,Uce="[a-zA-Z0-9-]",fAt=[["\\s",1],["\\d",sAt],[Uce,iAt]],pAt=t=>{for(let[e,n]of fAt)t=t.split(`${e}*`).join(`${e}{0,${n}}`).split(`${e}+`).join(`${e}{1,${n}}`);return t},Yn=(t,e,n)=>{let r=pAt(e),o=dAt++;aAt(t,o,e),kt[t]=o,At[o]=e,uAt[o]=r,lAt[o]=new RegExp(e,n?"g":void 0),cAt[o]=new RegExp(r,n?"g":void 0)};Yn("NUMERICIDENTIFIER","0|[1-9]\\d*");Yn("NUMERICIDENTIFIERLOOSE","\\d+");Yn("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Uce}*`);Yn("MAINVERSION",`(${At[kt.NUMERICIDENTIFIER]})\\.(${At[kt.NUMERICIDENTIFIER]})\\.(${At[kt.NUMERICIDENTIFIER]})`);Yn("MAINVERSIONLOOSE",`(${At[kt.NUMERICIDENTIFIERLOOSE]})\\.(${At[kt.NUMERICIDENTIFIERLOOSE]})\\.(${At[kt.NUMERICIDENTIFIERLOOSE]})`);Yn("PRERELEASEIDENTIFIER",`(?:${At[kt.NONNUMERICIDENTIFIER]}|${At[kt.NUMERICIDENTIFIER]})`);Yn("PRERELEASEIDENTIFIERLOOSE",`(?:${At[kt.NONNUMERICIDENTIFIER]}|${At[kt.NUMERICIDENTIFIERLOOSE]})`);Yn("PRERELEASE",`(?:-(${At[kt.PRERELEASEIDENTIFIER]}(?:\\.${At[kt.PRERELEASEIDENTIFIER]})*))`);Yn("PRERELEASELOOSE",`(?:-?(${At[kt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${At[kt.PRERELEASEIDENTIFIERLOOSE]})*))`);Yn("BUILDIDENTIFIER",`${Uce}+`);Yn("BUILD",`(?:\\+(${At[kt.BUILDIDENTIFIER]}(?:\\.${At[kt.BUILDIDENTIFIER]})*))`);Yn("FULLPLAIN",`v?${At[kt.MAINVERSION]}${At[kt.PRERELEASE]}?${At[kt.BUILD]}?`);Yn("FULL",`^${At[kt.FULLPLAIN]}$`);Yn("LOOSEPLAIN",`[v=\\s]*${At[kt.MAINVERSIONLOOSE]}${At[kt.PRERELEASELOOSE]}?${At[kt.BUILD]}?`);Yn("LOOSE",`^${At[kt.LOOSEPLAIN]}$`);Yn("GTLT","((?:<|>)?=?)");Yn("XRANGEIDENTIFIERLOOSE",`${At[kt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Yn("XRANGEIDENTIFIER",`${At[kt.NUMERICIDENTIFIER]}|x|X|\\*`);Yn("XRANGEPLAIN",`[v=\\s]*(${At[kt.XRANGEIDENTIFIER]})(?:\\.(${At[kt.XRANGEIDENTIFIER]})(?:\\.(${At[kt.XRANGEIDENTIFIER]})(?:${At[kt.PRERELEASE]})?${At[kt.BUILD]}?)?)?`);Yn("XRANGEPLAINLOOSE",`[v=\\s]*(${At[kt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${At[kt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${At[kt.XRANGEIDENTIFIERLOOSE]})(?:${At[kt.PRERELEASELOOSE]})?${At[kt.BUILD]}?)?)?`);Yn("XRANGE",`^${At[kt.GTLT]}\\s*${At[kt.XRANGEPLAIN]}$`);Yn("XRANGELOOSE",`^${At[kt.GTLT]}\\s*${At[kt.XRANGEPLAINLOOSE]}$`);Yn("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Fce}})(?:\\.(\\d{1,${Fce}}))?(?:\\.(\\d{1,${Fce}}))?`);Yn("COERCE",`${At[kt.COERCEPLAIN]}(?:$|[^\\d])`);Yn("COERCEFULL",At[kt.COERCEPLAIN]+`(?:${At[kt.PRERELEASE]})?(?:${At[kt.BUILD]})?(?:$|[^\\d])`);Yn("COERCERTL",At[kt.COERCE],!0);Yn("COERCERTLFULL",At[kt.COERCEFULL],!0);Yn("LONETILDE","(?:~>?)");Yn("TILDETRIM",`(\\s*)${At[kt.LONETILDE]}\\s+`,!0);Ag.tildeTrimReplace="$1~";Yn("TILDE",`^${At[kt.LONETILDE]}${At[kt.XRANGEPLAIN]}$`);Yn("TILDELOOSE",`^${At[kt.LONETILDE]}${At[kt.XRANGEPLAINLOOSE]}$`);Yn("LONECARET","(?:\\^)");Yn("CARETTRIM",`(\\s*)${At[kt.LONECARET]}\\s+`,!0);Ag.caretTrimReplace="$1^";Yn("CARET",`^${At[kt.LONECARET]}${At[kt.XRANGEPLAIN]}$`);Yn("CARETLOOSE",`^${At[kt.LONECARET]}${At[kt.XRANGEPLAINLOOSE]}$`);Yn("COMPARATORLOOSE",`^${At[kt.GTLT]}\\s*(${At[kt.LOOSEPLAIN]})$|^$`);Yn("COMPARATOR",`^${At[kt.GTLT]}\\s*(${At[kt.FULLPLAIN]})$|^$`);Yn("COMPARATORTRIM",`(\\s*)${At[kt.GTLT]}\\s*(${At[kt.LOOSEPLAIN]}|${At[kt.XRANGEPLAIN]})`,!0);Ag.comparatorTrimReplace="$1$2$3";Yn("HYPHENRANGE",`^\\s*(${At[kt.XRANGEPLAIN]})\\s+-\\s+(${At[kt.XRANGEPLAIN]})\\s*$`);Yn("HYPHENRANGELOOSE",`^\\s*(${At[kt.XRANGEPLAINLOOSE]})\\s+-\\s+(${At[kt.XRANGEPLAINLOOSE]})\\s*$`);Yn("STAR","(<|>)?=?\\s*\\*");Yn("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Yn("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var gK=Tt((_Sn,qUe)=>{"use strict";var mAt=Object.freeze({loose:!0}),hAt=Object.freeze({}),gAt=t=>t?typeof t!="object"?mAt:t:hAt;qUe.exports=gAt});var Bce=Tt((SSn,ZUe)=>{"use strict";var GUe=/^[0-9]+$/,YUe=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:tYUe(e,t);ZUe.exports={compareIdentifiers:YUe,rcompareIdentifiers:yAt}});var ic=Tt((TSn,XUe)=>{"use strict";var yK=$2(),{MAX_LENGTH:JUe,MAX_SAFE_INTEGER:wK}=D2(),{safeRe:vK,t:xK}=Qk(),wAt=gK(),{compareIdentifiers:zce}=Bce(),jce=class t{constructor(e,n){if(n=wAt(n),e instanceof t){if(e.loose===!!n.loose&&e.includePrerelease===!!n.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>JUe)throw new TypeError(`version is longer than ${JUe} characters`);yK("SemVer",e,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let r=e.trim().match(n.loose?vK[xK.LOOSE]:vK[xK.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>wK||this.major<0)throw new TypeError("Invalid major version");if(this.minor>wK||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>wK||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&ie.major?1:this.minore.minor?1:this.patche.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 n=0;do{let r=this.prerelease[n],o=e.prerelease[n];if(yK("prerelease compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return zce(r,o)}while(++n)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let n=0;do{let r=this.build[n],o=e.build[n];if(yK("build compare",n,r,o),r===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(r===void 0)return-1;if(r===o)continue;return zce(r,o)}while(++n)}inc(e,n,r){if(e.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){let o=`-${n}`.match(this.options.loose?vK[xK.PRERELEASELOOSE]:vK[xK.PRERELEASE]);if(!o||o[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);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(r)?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(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let i=[n,o];r===!1&&(i=[n]),zce(this.prerelease[0],n)===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}};XUe.exports=jce});var oI=Tt((ISn,eBe)=>{"use strict";var QUe=ic(),vAt=(t,e,n=!1)=>{if(t instanceof QUe)return t;try{return new QUe(t,e)}catch(r){if(!n)return null;throw r}};eBe.exports=vAt});var nBe=Tt((PSn,tBe)=>{"use strict";var xAt=oI(),bAt=(t,e)=>{let n=xAt(t,e);return n?n.version:null};tBe.exports=bAt});var oBe=Tt((ESn,rBe)=>{"use strict";var CAt=oI(),_At=(t,e)=>{let n=CAt(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null};rBe.exports=_At});var aBe=Tt((ASn,sBe)=>{"use strict";var iBe=ic(),SAt=(t,e,n,r,o)=>{typeof n=="string"&&(o=r,r=n,n=void 0);try{return new iBe(t instanceof iBe?t.version:t,n).inc(e,r,o).version}catch{return null}};sBe.exports=SAt});var uBe=Tt((kSn,cBe)=>{"use strict";var lBe=oI(),TAt=(t,e)=>{let n=lBe(t,null,!0),r=lBe(e,null,!0),o=n.compare(r);if(o===0)return null;let i=o>0,s=i?n:r,a=i?r:n,l=!!s.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let u=l?"pre":"";return n.major!==r.major?u+"major":n.minor!==r.minor?u+"minor":n.patch!==r.patch?u+"patch":"prerelease"};cBe.exports=TAt});var fBe=Tt((MSn,dBe)=>{"use strict";var IAt=ic(),PAt=(t,e)=>new IAt(t,e).major;dBe.exports=PAt});var mBe=Tt((NSn,pBe)=>{"use strict";var EAt=ic(),AAt=(t,e)=>new EAt(t,e).minor;pBe.exports=AAt});var gBe=Tt((OSn,hBe)=>{"use strict";var kAt=ic(),MAt=(t,e)=>new kAt(t,e).patch;hBe.exports=MAt});var wBe=Tt((RSn,yBe)=>{"use strict";var NAt=oI(),OAt=(t,e)=>{let n=NAt(t,e);return n&&n.prerelease.length?n.prerelease:null};yBe.exports=OAt});var ip=Tt((LSn,xBe)=>{"use strict";var vBe=ic(),RAt=(t,e,n)=>new vBe(t,n).compare(new vBe(e,n));xBe.exports=RAt});var CBe=Tt((DSn,bBe)=>{"use strict";var LAt=ip(),DAt=(t,e,n)=>LAt(e,t,n);bBe.exports=DAt});var SBe=Tt(($Sn,_Be)=>{"use strict";var $At=ip(),FAt=(t,e)=>$At(t,e,!0);_Be.exports=FAt});var bK=Tt((FSn,IBe)=>{"use strict";var TBe=ic(),UAt=(t,e,n)=>{let r=new TBe(t,n),o=new TBe(e,n);return r.compare(o)||r.compareBuild(o)};IBe.exports=UAt});var EBe=Tt((USn,PBe)=>{"use strict";var BAt=bK(),zAt=(t,e)=>t.sort((n,r)=>BAt(n,r,e));PBe.exports=zAt});var kBe=Tt((BSn,ABe)=>{"use strict";var jAt=bK(),VAt=(t,e)=>t.sort((n,r)=>jAt(r,n,e));ABe.exports=VAt});var F2=Tt((zSn,MBe)=>{"use strict";var WAt=ip(),HAt=(t,e,n)=>WAt(t,e,n)>0;MBe.exports=HAt});var CK=Tt((jSn,NBe)=>{"use strict";var KAt=ip(),qAt=(t,e,n)=>KAt(t,e,n)<0;NBe.exports=qAt});var Vce=Tt((VSn,OBe)=>{"use strict";var GAt=ip(),YAt=(t,e,n)=>GAt(t,e,n)===0;OBe.exports=YAt});var Wce=Tt((WSn,RBe)=>{"use strict";var ZAt=ip(),JAt=(t,e,n)=>ZAt(t,e,n)!==0;RBe.exports=JAt});var _K=Tt((HSn,LBe)=>{"use strict";var XAt=ip(),QAt=(t,e,n)=>XAt(t,e,n)>=0;LBe.exports=QAt});var SK=Tt((KSn,DBe)=>{"use strict";var ekt=ip(),tkt=(t,e,n)=>ekt(t,e,n)<=0;DBe.exports=tkt});var Hce=Tt((qSn,$Be)=>{"use strict";var nkt=Vce(),rkt=Wce(),okt=F2(),ikt=_K(),skt=CK(),akt=SK(),lkt=(t,e,n,r)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t===n;case"!==":return typeof t=="object"&&(t=t.version),typeof n=="object"&&(n=n.version),t!==n;case"":case"=":case"==":return nkt(t,n,r);case"!=":return rkt(t,n,r);case">":return okt(t,n,r);case">=":return ikt(t,n,r);case"<":return skt(t,n,r);case"<=":return akt(t,n,r);default:throw new TypeError(`Invalid operator: ${e}`)}};$Be.exports=lkt});var UBe=Tt((GSn,FBe)=>{"use strict";var ckt=ic(),ukt=oI(),{safeRe:TK,t:IK}=Qk(),dkt=(t,e)=>{if(t instanceof ckt)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let n=null;if(!e.rtl)n=t.match(e.includePrerelease?TK[IK.COERCEFULL]:TK[IK.COERCE]);else{let l=e.includePrerelease?TK[IK.COERCERTLFULL]:TK[IK.COERCERTL],c;for(;(c=l.exec(t))&&(!n||n.index+n[0].length!==t.length);)(!n||c.index+c[0].length!==n.index+n[0].length)&&(n=c),l.lastIndex=c.index+c[1].length+c[2].length;l.lastIndex=-1}if(n===null)return null;let r=n[2],o=n[3]||"0",i=n[4]||"0",s=e.includePrerelease&&n[5]?`-${n[5]}`:"",a=e.includePrerelease&&n[6]?`+${n[6]}`:"";return ukt(`${r}.${o}.${i}${s}${a}`,e)};FBe.exports=dkt});var zBe=Tt((YSn,BBe)=>{"use strict";var Kce=class{constructor(){this.max=1e3,this.map=new Map}get(e){let n=this.map.get(e);if(n!==void 0)return this.map.delete(e),this.map.set(e,n),n}delete(e){return this.map.delete(e)}set(e,n){if(!this.delete(e)&&n!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,n)}return this}};BBe.exports=Kce});var sp=Tt((ZSn,HBe)=>{"use strict";var fkt=/\s+/g,qce=class t{constructor(e,n){if(n=mkt(n),e instanceof t)return e.loose===!!n.loose&&e.includePrerelease===!!n.includePrerelease?e:new t(e.raw,n);if(e instanceof Gce)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=e.trim().replace(fkt," "),this.set=this.raw.split("||").map(r=>this.parseRange(r.trim())).filter(r=>r.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter(o=>!VBe(o[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&bkt(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e0&&(this.formatted+="||");let n=this.set[e];for(let r=0;r0&&(this.formatted+=" "),this.formatted+=n[r].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let r=((this.options.includePrerelease&&vkt)|(this.options.loose&&xkt))+":"+e,o=jBe.get(r);if(o)return o;let i=this.options.loose,s=i?Vc[sc.HYPHENRANGELOOSE]:Vc[sc.HYPHENRANGE];e=e.replace(s,Mkt(this.options.includePrerelease)),Qo("hyphen replace",e),e=e.replace(Vc[sc.COMPARATORTRIM],gkt),Qo("comparator trim",e),e=e.replace(Vc[sc.TILDETRIM],ykt),Qo("tilde trim",e),e=e.replace(Vc[sc.CARETTRIM],wkt),Qo("caret trim",e);let a=e.split(" ").map(d=>Ckt(d,this.options)).join(" ").split(/\s+/).map(d=>kkt(d,this.options));i&&(a=a.filter(d=>(Qo("loose invalid filter",d,this.options),!!d.match(Vc[sc.COMPARATORLOOSE])))),Qo("range list",a);let l=new Map,c=a.map(d=>new Gce(d,this.options));for(let d of c){if(VBe(d))return[d];l.set(d.value,d)}l.size>1&&l.has("")&&l.delete("");let u=[...l.values()];return jBe.set(r,u),u}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(r=>WBe(r,n)&&e.set.some(o=>WBe(o,n)&&r.every(i=>o.every(s=>i.intersects(s,n)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new hkt(e,this.options)}catch{return!1}for(let n=0;nt.value==="<0.0.0-0",bkt=t=>t.value==="",WBe=(t,e)=>{let n=!0,r=t.slice(),o=r.pop();for(;n&&r.length;)n=r.every(i=>o.intersects(i,e)),o=r.pop();return n},Ckt=(t,e)=>(t=t.replace(Vc[sc.BUILD],""),Qo("comp",t,e),t=Tkt(t,e),Qo("caret",t),t=_kt(t,e),Qo("tildes",t),t=Pkt(t,e),Qo("xrange",t),t=Akt(t,e),Qo("stars",t),t),Wc=t=>!t||t.toLowerCase()==="x"||t==="*",_kt=(t,e)=>t.trim().split(/\s+/).map(n=>Skt(n,e)).join(" "),Skt=(t,e)=>{let n=e.loose?Vc[sc.TILDELOOSE]:Vc[sc.TILDE];return t.replace(n,(r,o,i,s,a)=>{Qo("tilde",t,r,o,i,s,a);let l;return Wc(o)?l="":Wc(i)?l=`>=${o}.0.0 <${+o+1}.0.0-0`:Wc(s)?l=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(Qo("replaceTilde pr",a),l=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):l=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,Qo("tilde return",l),l})},Tkt=(t,e)=>t.trim().split(/\s+/).map(n=>Ikt(n,e)).join(" "),Ikt=(t,e)=>{Qo("caret",t,e);let n=e.loose?Vc[sc.CARETLOOSE]:Vc[sc.CARET],r=e.includePrerelease?"-0":"";return t.replace(n,(o,i,s,a,l)=>{Qo("caret",t,o,i,s,a,l);let c;return Wc(i)?c="":Wc(s)?c=`>=${i}.0.0${r} <${+i+1}.0.0-0`:Wc(a)?i==="0"?c=`>=${i}.${s}.0${r} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.0${r} <${+i+1}.0.0-0`:l?(Qo("replaceCaret pr",l),i==="0"?s==="0"?c=`>=${i}.${s}.${a}-${l} <${i}.${s}.${+a+1}-0`:c=`>=${i}.${s}.${a}-${l} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.${a}-${l} <${+i+1}.0.0-0`):(Qo("no pr"),i==="0"?s==="0"?c=`>=${i}.${s}.${a}${r} <${i}.${s}.${+a+1}-0`:c=`>=${i}.${s}.${a}${r} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),Qo("caret return",c),c})},Pkt=(t,e)=>(Qo("replaceXRanges",t,e),t.split(/\s+/).map(n=>Ekt(n,e)).join(" ")),Ekt=(t,e)=>{t=t.trim();let n=e.loose?Vc[sc.XRANGELOOSE]:Vc[sc.XRANGE];return t.replace(n,(r,o,i,s,a,l)=>{Qo("xRange",t,r,o,i,s,a,l);let c=Wc(i),u=c||Wc(s),d=u||Wc(a),f=d;return o==="="&&f&&(o=""),l=e.includePrerelease?"-0":"",c?o===">"||o==="<"?r="<0.0.0-0":r="*":o&&f?(u&&(s=0),a=0,o===">"?(o=">=",u?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",u?i=+i+1:s=+s+1),o==="<"&&(l="-0"),r=`${o+i}.${s}.${a}${l}`):u?r=`>=${i}.0.0${l} <${+i+1}.0.0-0`:d&&(r=`>=${i}.${s}.0${l} <${i}.${+s+1}.0-0`),Qo("xRange return",r),r})},Akt=(t,e)=>(Qo("replaceStars",t,e),t.trim().replace(Vc[sc.STAR],"")),kkt=(t,e)=>(Qo("replaceGTE0",t,e),t.trim().replace(Vc[e.includePrerelease?sc.GTE0PRE:sc.GTE0],"")),Mkt=t=>(e,n,r,o,i,s,a,l,c,u,d,f)=>(Wc(r)?n="":Wc(o)?n=`>=${r}.0.0${t?"-0":""}`:Wc(i)?n=`>=${r}.${o}.0${t?"-0":""}`:s?n=`>=${n}`:n=`>=${n}${t?"-0":""}`,Wc(c)?l="":Wc(u)?l=`<${+c+1}.0.0-0`:Wc(d)?l=`<${c}.${+u+1}.0-0`:f?l=`<=${c}.${u}.${d}-${f}`:t?l=`<${c}.${u}.${+d+1}-0`:l=`<=${l}`,`${n} ${l}`.trim()),Nkt=(t,e,n)=>{for(let r=0;r0){let o=t[r].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var U2=Tt((JSn,JBe)=>{"use strict";var B2=Symbol("SemVer ANY"),Jce=class t{static get ANY(){return B2}constructor(e,n){if(n=KBe(n),e instanceof t){if(e.loose===!!n.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Zce("comparator",e,n),this.options=n,this.loose=!!n.loose,this.parse(e),this.semver===B2?this.value="":this.value=this.operator+this.semver.version,Zce("comp",this)}parse(e){let n=this.options.loose?qBe[GBe.COMPARATORLOOSE]:qBe[GBe.COMPARATOR],r=e.match(n);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=r[1]!==void 0?r[1]:"",this.operator==="="&&(this.operator=""),r[2]?this.semver=new YBe(r[2],this.options.loose):this.semver=B2}toString(){return this.value}test(e){if(Zce("Comparator.test",e,this.options.loose),this.semver===B2||e===B2)return!0;if(typeof e=="string")try{e=new YBe(e,this.options)}catch{return!1}return Yce(e,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new ZBe(e.value,n).test(this.value):e.operator===""?e.value===""?!0:new ZBe(this.value,n).test(e.semver):(n=KBe(n),n.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!n.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("=")||Yce(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Yce(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};JBe.exports=Jce;var KBe=gK(),{safeRe:qBe,t:GBe}=Qk(),Yce=Hce(),Zce=$2(),YBe=ic(),ZBe=sp()});var z2=Tt((XSn,XBe)=>{"use strict";var Okt=sp(),Rkt=(t,e,n)=>{try{e=new Okt(e,n)}catch{return!1}return e.test(t)};XBe.exports=Rkt});var eze=Tt((QSn,QBe)=>{"use strict";var Lkt=sp(),Dkt=(t,e)=>new Lkt(t,e).set.map(n=>n.map(r=>r.value).join(" ").trim().split(" "));QBe.exports=Dkt});var nze=Tt((eTn,tze)=>{"use strict";var $kt=ic(),Fkt=sp(),Ukt=(t,e,n)=>{let r=null,o=null,i=null;try{i=new Fkt(e,n)}catch{return null}return t.forEach(s=>{i.test(s)&&(!r||o.compare(s)===-1)&&(r=s,o=new $kt(r,n))}),r};tze.exports=Ukt});var oze=Tt((tTn,rze)=>{"use strict";var Bkt=ic(),zkt=sp(),jkt=(t,e,n)=>{let r=null,o=null,i=null;try{i=new zkt(e,n)}catch{return null}return t.forEach(s=>{i.test(s)&&(!r||o.compare(s)===1)&&(r=s,o=new Bkt(r,n))}),r};rze.exports=jkt});var aze=Tt((nTn,sze)=>{"use strict";var Xce=ic(),Vkt=sp(),ize=F2(),Wkt=(t,e)=>{t=new Vkt(t,e);let n=new Xce("0.0.0");if(t.test(n)||(n=new Xce("0.0.0-0"),t.test(n)))return n;n=null;for(let r=0;r{let a=new Xce(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||ize(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!n||ize(n,i))&&(n=i)}return n&&t.test(n)?n:null};sze.exports=Wkt});var cze=Tt((rTn,lze)=>{"use strict";var Hkt=sp(),Kkt=(t,e)=>{try{return new Hkt(t,e).range||"*"}catch{return null}};lze.exports=Kkt});var PK=Tt((oTn,pze)=>{"use strict";var qkt=ic(),fze=U2(),{ANY:Gkt}=fze,Ykt=sp(),Zkt=z2(),uze=F2(),dze=CK(),Jkt=SK(),Xkt=_K(),Qkt=(t,e,n,r)=>{t=new qkt(t,r),e=new Ykt(e,r);let o,i,s,a,l;switch(n){case">":o=uze,i=Jkt,s=dze,a=">",l=">=";break;case"<":o=dze,i=Xkt,s=uze,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Zkt(t,e,r))return!1;for(let c=0;c{p.semver===Gkt&&(p=new fze(">=0.0.0")),d=d||p,f=f||p,o(p.semver,d.semver,r)?d=p:s(p.semver,f.semver,r)&&(f=p)}),d.operator===a||d.operator===l||(!f.operator||f.operator===a)&&i(t,f.semver))return!1;if(f.operator===l&&s(t,f.semver))return!1}return!0};pze.exports=Qkt});var hze=Tt((iTn,mze)=>{"use strict";var eMt=PK(),tMt=(t,e,n)=>eMt(t,e,">",n);mze.exports=tMt});var yze=Tt((sTn,gze)=>{"use strict";var nMt=PK(),rMt=(t,e,n)=>nMt(t,e,"<",n);gze.exports=rMt});var xze=Tt((aTn,vze)=>{"use strict";var wze=sp(),oMt=(t,e,n)=>(t=new wze(t,n),e=new wze(e,n),t.intersects(e,n));vze.exports=oMt});var Cze=Tt((lTn,bze)=>{"use strict";var iMt=z2(),sMt=ip();bze.exports=(t,e,n)=>{let r=[],o=null,i=null,s=t.sort((u,d)=>sMt(u,d,n));for(let u of s)iMt(u,e,n)?(i=u,o||(o=u)):(i&&r.push([o,i]),i=null,o=null);o&&r.push([o,null]);let a=[];for(let[u,d]of r)u===d?a.push(u):!d&&u===s[0]?a.push("*"):d?u===s[0]?a.push(`<=${d}`):a.push(`${u} - ${d}`):a.push(`>=${u}`);let l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{"use strict";var _ze=sp(),eue=U2(),{ANY:Qce}=eue,j2=z2(),tue=ip(),aMt=(t,e,n={})=>{if(t===e)return!0;t=new _ze(t,n),e=new _ze(e,n);let r=!1;e:for(let o of t.set){for(let i of e.set){let s=cMt(o,i,n);if(r=r||s!==null,s)continue e}if(r)return!1}return!0},lMt=[new eue(">=0.0.0-0")],Sze=[new eue(">=0.0.0")],cMt=(t,e,n)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Qce){if(e.length===1&&e[0].semver===Qce)return!0;n.includePrerelease?t=lMt:t=Sze}if(e.length===1&&e[0].semver===Qce){if(n.includePrerelease)return!0;e=Sze}let r=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=Tze(o,p,n):p.operator==="<"||p.operator==="<="?i=Ize(i,p,n):r.add(p.semver);if(r.size>1)return null;let s;if(o&&i){if(s=tue(o.semver,i.semver,n),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let p of r){if(o&&!j2(p,String(o),n)||i&&!j2(p,String(i),n))return null;for(let m of e)if(!j2(p,String(m),n))return!1;return!0}let a,l,c,u,d=i&&!n.includePrerelease&&i.semver.prerelease.length?i.semver:!1,f=o&&!n.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(u=u||p.operator===">"||p.operator===">=",c=c||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(a=Tze(o,p,n),a===p&&a!==o)return!1}else if(o.operator===">="&&!j2(o.semver,String(p),n))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(l=Ize(i,p,n),l===p&&l!==i)return!1}else if(i.operator==="<="&&!j2(i.semver,String(p),n))return!1}if(!p.operator&&(i||o)&&s!==0)return!1}return!(o&&c&&!i&&s!==0||i&&u&&!o&&s!==0||f||d)},Tze=(t,e,n)=>{if(!t)return e;let r=tue(t.semver,e.semver,n);return r>0?t:r<0||e.operator===">"&&t.operator===">="?e:t},Ize=(t,e,n)=>{if(!t)return e;let r=tue(t.semver,e.semver,n);return r<0?t:r>0||e.operator==="<"&&t.operator==="<="?e:t};Pze.exports=aMt});var Nze=Tt((uTn,Mze)=>{"use strict";var nue=Qk(),Aze=D2(),uMt=ic(),kze=Bce(),dMt=oI(),fMt=nBe(),pMt=oBe(),mMt=aBe(),hMt=uBe(),gMt=fBe(),yMt=mBe(),wMt=gBe(),vMt=wBe(),xMt=ip(),bMt=CBe(),CMt=SBe(),_Mt=bK(),SMt=EBe(),TMt=kBe(),IMt=F2(),PMt=CK(),EMt=Vce(),AMt=Wce(),kMt=_K(),MMt=SK(),NMt=Hce(),OMt=UBe(),RMt=U2(),LMt=sp(),DMt=z2(),$Mt=eze(),FMt=nze(),UMt=oze(),BMt=aze(),zMt=cze(),jMt=PK(),VMt=hze(),WMt=yze(),HMt=xze(),KMt=Cze(),qMt=Eze();Mze.exports={parse:dMt,valid:fMt,clean:pMt,inc:mMt,diff:hMt,major:gMt,minor:yMt,patch:wMt,prerelease:vMt,compare:xMt,rcompare:bMt,compareLoose:CMt,compareBuild:_Mt,sort:SMt,rsort:TMt,gt:IMt,lt:PMt,eq:EMt,neq:AMt,gte:kMt,lte:MMt,cmp:NMt,coerce:OMt,Comparator:RMt,Range:LMt,satisfies:DMt,toComparators:$Mt,maxSatisfying:FMt,minSatisfying:UMt,minVersion:BMt,validRange:zMt,outside:jMt,gtr:VMt,ltr:WMt,intersects:HMt,simplifyRange:KMt,subset:qMt,SemVer:uMt,re:nue.re,src:nue.src,tokens:nue.t,SEMVER_SPEC_VERSION:Aze.SEMVER_SPEC_VERSION,RELEASE_TYPES:Aze.RELEASE_TYPES,compareIdentifiers:kze.compareIdentifiers,rcompareIdentifiers:kze.rcompareIdentifiers}});function Ow(t){if(!t||t.split("/").length>2||t.startsWith("/")||t.endsWith("/")||t.split(":").length>2)throw new Error(`Invalid identifier format: ${t}`);let[e,n]=t.split(":"),r=n||"latest";if(e.includes("/")){let[o,i]=e.split("/",2);if(!o||!i)throw new Error(`Invalid identifier format: ${t}`);return[o,i,r]}else{if(!e)throw new Error(`Invalid identifier format: ${t}`);return["-",e,r]}}var GMt,Oze=C(()=>{GMt=N(Nze(),1)});function iue(t){return t!=null&&typeof t=="object"&&"name"in t&&t?.name==="LangSmithNotFoundError"}async function zt(t,e,n){let r;if(t.ok){n&&(r=await t.text());return}if(t.status===403)try{(await t.json())?.error==="org_scoped_key_requires_workspace"&&(r="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch{let a=new Error(`${t.status} ${t.statusText}`);throw a.status=t?.status,a}if(r===void 0)try{r=await t.text()}catch{r=""}let o=`Failed to ${e}. Received status [${t.status}]: ${t.statusText}. Message: ${r}`;if(t.status===404)throw new oue(o);if(t.status===409)throw new rue(o);let i=new Error(o);throw i.status=t.status,i}function Lze(t){return typeof t=="object"&&t!==null&&t.code===Rze}var rue,oue,Rze,EK,sue=C(()=>{rue=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}},oue=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}};Rze="ERR_CONFLICTING_ENDPOINTS",EK=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:Rze}),this.name="ConflictingEndpointsError"}}});function JMt(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function AK(t){return ZMt.encode(t)}function $ze(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 XMt(t){return function(e,n){if(t){let r=t.call(this,e,n);if(r!==void 0)return r}return $ze(n)}}function Hu(t,e,n,r,o){try{let i=JSON.stringify(t,XMt(n),r);return AK(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?` Context: ${e}`:""}`),AK("[Unserializable]");rs("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?` Context: ${e}`:""}`),typeof o>"u"&&(o=JMt()),lue(t,"",0,[],void 0,0,o);let s;try{eM.length===0?s=JSON.stringify(t,n,r):s=JSON.stringify(t,QMt(n),r)}catch{return AK("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;kK.length!==0;){let a=kK.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return AK(s)}}function aue(t,e,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get!==void 0?o.configurable?(Object.defineProperty(r,n,{value:t}),kK.push([r,n,e,o])):eM.push([e,n,t]):(r[n]=t,kK.push([r,n,e]))}function lue(t,e,n,r,o,i,s){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;as.depthLimit){aue(Dze,t,e,o);return}if(typeof s.edgesLimit<"u"&&n+1>s.edgesLimit){aue(Dze,t,e,o);return}if(r.push(t),Array.isArray(t))for(a=0;a0)for(var r=0;r{Mw();Dze="[...]",YMt={result:"[Circular]"},kK=[],eM=[],ZMt=new TextEncoder});function Uze(t,e,n){if(n)return t;let r=sK(),o=e??gce(),i=t.extra??{},s=i.metadata;return t.extra={...i,runtime:{...r,...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}:{},...s}},t}async function nNt(t){let e=[];for await(let n of t)e.push(n);return e}function MK(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function Bze(t){return typeof t=="number"?Number(t.toFixed(4)):t}function jze(t){return"dataset_id"in t||"dataset_name"in t}var eNt,tNt,rNt,oNt,Vze,iNt,sNt,zze,cue,rI,dce=C(()=>{q3();EUe();Sce();jUe();VUe();Mw();iK();tK();G3();Oze();sue();uce();oce();Fze();eNt=t=>{let e=t?.toString()??rs("TRACING_SAMPLING_RATE");if(e===void 0)return;let n=parseFloat(e);if(n<0||n>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${n}`);return n},tNt=t=>{let n=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return n==="localhost"||n==="127.0.0.1"||n==="::1"};rNt=async t=>{if(t?.status===429){let e=parseInt(t.headers.get("retry-after")??"10",10)*1e3;if(e>0)return await new Promise(n=>setTimeout(n,e)),!0}return!1};oNt=24*1024*1024,Vze=1024*1024*1024,iNt=1e4,sNt=100,zze="https://api.smith.langchain.com",cue=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??Vze}peek(){return this.items[0]}push(e){let n,r=new Promise(i=>{n=i}),o=Hu(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.`),n(),r):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,itemPromiseResolve:n,itemPromise:r,size:o}),this.sizeBytes+=o,r)}pop({upToSizeBytes:e,upToSize:n}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");let r=[],o=0;for(;o+(this.peek()?.size??0)0&&r.length0){let i=this.items.shift();r.push(i),o+=i.size,this.sizeBytes-=i.size}return[r.map(i=>({action:i.action,item:i.payload,otelContext:i.otelContext,apiKey:i.apiKey,apiUrl:i.apiUrl,size:i.size})),()=>r.forEach(i=>i.itemPromiseResolve())]}},rI=class t{get _fetch(){return this.fetchImplementation||iUe(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:Hd("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:rs("DISABLE_RUN_COMPRESSION")==="true"}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:Hd("LANGSMITH_DEBUG")==="true"});let n=t.getDefaultClientConfig();if(this.tracingSampleRate=eNt(e.tracingSamplingRate),this.apiUrl=MK(e.apiUrl??n.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=MK(e.apiKey??n.apiKey),this.webUrl=MK(e.webUrl??n.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=MK(e.workspaceId??rs("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new L2({...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 r=e.maxIngestMemoryBytes??Vze;this.batchIngestCaller=new L2({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:r,...e.callerOptions??{},onFailedResponseHook:rNt,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??n.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??n.hideOutputs,this.omitTracedRuntimeInfo=e.omitTracedRuntimeInfo??!1,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new cue(r),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,aK()&&(this.langSmithToOTELTranslator=new cK),this.cachedLSEnvVarsForMetadata=gce(),e.cache!==void 0&&e.disablePromptCache&&tI("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?(tI("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=rK:this._promptCache=e.cache):e.disablePromptCache||(this._promptCache=rK)}static getDefaultClientConfig(){let e=rs("API_KEY"),n=rs("ENDPOINT")??zze,r=rs("HIDE_INPUTS")==="true",o=rs("HIDE_OUTPUTS")==="true";return{apiUrl:n,apiKey:e,webUrl:void 0,hideInputs:r,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:tNt(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/${oK}`};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 n={...e};return n.inputs!==void 0&&(n.inputs=await this.processInputs(n.inputs)),n.outputs!==void 0&&(n.outputs=await this.processOutputs(n.outputs)),n}async _getResponse(e,n){let r=n?.toString()??"",o=`${this.apiUrl}${e}?${r}`;return await this.caller.call(async()=>{let s=await this._fetch(o,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(s,`fetch ${e}`),s})}async _get(e,n){return(await this._getResponse(e,n)).json()}async*_getPaginated(e,n=new URLSearchParams,r){let o=Number(n.get("offset"))||0,i=Number(n.get("limit"))||100;for(;;){n.set("offset",String(o)),n.set("limit",String(i));let s=`${this.apiUrl}${e}?${n}`,a=await this.caller.call(async()=>{let c=await this._fetch(s,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(c,`fetch ${e}`),c}),l=r?r(await a.json()):await a.json();if(l.length===0||(yield l,l.length{let u=await this._fetch(`${this.apiUrl}${e}`,{method:r,headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await zt(u,`fetch ${e}`),u})).json();if(!l||!l[o])break;yield l[o];let c=l.cursors;if(!c||!c.next)break;i.cursor=c.next}}_shouldSample(){return this.tracingSampleRate===void 0?!0:Math.random()0;){let[o,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:n});if(!o.length){i();break}let s=o.reduce((c,u)=>{let d=u.apiUrl??this.apiUrl,f=u.apiKey??this.apiKey,m=u.apiKey===this.apiKey&&u.apiUrl===this.apiUrl?"default":`${d}|${f}`;return c[m]||(c[m]=[]),c[m].push(u),c},{}),a=[];for(let[c,u]of Object.entries(s)){let d=this._processBatch(u,{apiUrl:c==="default"?void 0:c.split("|")[0],apiKey:c==="default"?void 0:c.split("|")[1]});a.push(d)}let l=Promise.all(a).finally(i);r.push(l)}return Promise.all(r)}async _processBatch(e,n){if(!e.length)return;let r=e.reduce((o,i)=>o+(i.size??0),0);try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let o={runCreates:e.filter(a=>a.action==="create").map(a=>a.item),runUpdates:e.filter(a=>a.action==="update").map(a=>a.item)},i=await this._ensureServerInfo();if(!this._multipartDisabled&&(i?.batch_ingest_config?.use_multipart_endpoint??!0)){let a=!this._runCompressionDisabled&&i?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(o,{...n,useGzip:a,sizeBytes:r})}catch(l){if(iue(l))this._multipartDisabled=!0,await this.batchIngestRuns(o,{...n,sizeBytes:r});else throw l}}else await this.batchIngestRuns(o,{...n,sizeBytes:r})}}catch(o){console.error("Error exporting batch:",o)}}_sendBatchToOTELTranslator(e){if(this.langSmithToOTELTranslator!==void 0){let n=new Map,r=[];for(let o of e)o.item.id&&o.otelContext&&(n.set(o.item.id,o.otelContext),o.action==="create"?r.push({operation:"post",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}):r.push({operation:"patch",id:o.item.id,trace_id:o.item.trace_id??o.item.id,run:o.item}));this.langSmithToOTELTranslator.exportBatch(r,n)}}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=Uze(e.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);let n=this.autoBatchQueue.push(e);if(this.manualFlushMode)return n;let r=await this._getBatchSizeLimitBytes(),o=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>r||this.autoBatchQueue.items.length>o)&&this.drainAutoBatchQueue({batchSizeLimitBytes:r,batchSizeLimit:o}),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this.drainAutoBatchQueue({batchSizeLimitBytes:r,batchSizeLimit:o})},this.autoBatchAggregationDelayMs)),n}async _getServerInfo(){let n=await(await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(iNt),...this.fetchOptions});return await zt(r,"get server info"),r})).json();return this.debug&&console.log(` === LangSmith Server Configuration === `+JSON.stringify(n,null,2)+` `),n}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(),n=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:n})}_cloneCurrentOTELContext(){let e=lK(),n=IUe();if(this.langSmithToOTELTranslator!==void 0){let r=e.getActiveSpan();if(r)return e.setSpan(n.active(),r)}}async createRun(e,n){if(!this._filterForSampling([e]).length)return;let r={...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 l=this._cloneCurrentOTELContext();this.processRunOperation({action:"create",item:i,otelContext:l,apiKey:n?.apiKey,apiUrl:n?.apiUrl}).catch(console.error);return}let s=Uze(i,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);n?.apiKey!==void 0&&(r["x-api-key"]=n.apiKey),n?.workspaceId!==void 0&&(r["x-tenant-id"]=n.workspaceId);let a=Hu(s,`Creating run with id: ${s.id}`);await this.caller.call(async()=>{let l=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:r,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await zt(l,"create run",!0),l})}async batchIngestRuns({runCreates:e,runUpdates:n},r){if(e===void 0&&n===void 0)return;let o=await Promise.all(e?.map(l=>this.prepareRunCreateOrUpdateInputs(l))??[]),i=await Promise.all(n?.map(l=>this.prepareRunCreateOrUpdateInputs(l))??[]);if(o.length>0&&i.length>0){let l=o.reduce((u,d)=>(d.id&&(u[d.id]=d),u),{}),c=[];for(let u of i)u.id!==void 0&&l[u.id]?l[u.id]={...l[u.id],...u}:c.push(u);o=Object.values(l),i=c}let s={post:o,patch:i};if(!s.post.length&&!s.patch.length)return;let a={post:[],patch:[]};for(let l of["post","patch"]){let c=l,u=s[c].reverse(),d=u.pop();for(;d!==void 0;)a[c].push(d),d=u.pop()}if(a.post.length>0||a.patch.length>0){let l=a.post.map(c=>c.id).concat(a.patch.map(c=>c.id)).join(",");await this._postBatchIngestRuns(Hu(a,`Ingesting runs with ids: ${l}`),r)}}async _postBatchIngestRuns(e,n){let r={...this.headers,"Content-Type":"application/json",Accept:"application/json"};n?.apiKey!==void 0&&(r["x-api-key"]=n.apiKey),await this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let o=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:r,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await zt(o,"batch create run",!0),o})}async multipartIngestRuns({runCreates:e,runUpdates:n},r){if(e===void 0&&n===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 s=[];for(let d of n??[])s.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(s.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&&s.length>0){let d=i.reduce((p,m)=>(m.id&&(p[m.id]=m),p),{}),f=[];for(let p of s)p.id!==void 0&&d[p.id]?d[p.id]={...d[p.id],...p}:f.push(p);i=Object.values(d),s=f}if(i.length===0&&s.length===0)return;let c=[],u=[];for(let[d,f]of[["post",i],["patch",s]])for(let p of f){let{inputs:m,outputs:h,events:g,extra:y,error:w,serialized:v,attachments:x,...b}=p,_={inputs:m,outputs:h,events:g,extra:y,error:w,serialized:v},T=Hu(b,`Serializing for multipart ingestion of run with id: ${b.id}`);u.push({name:`${d}.${b.id}`,payload:new Blob([T],{type:`application/json; length=${T.length}`})});for(let[S,P]of Object.entries(_)){if(P===void 0)continue;let A=Hu(P,`Serializing ${S} for multipart ingestion of run with id: ${b.id}`);u.push({name:`${d}.${b.id}.${S}`,payload:new Blob([A],{type:`application/json; length=${A.length}`})})}if(b.id!==void 0){let S=o[b.id];if(S){delete o[b.id];for(let[P,A]of Object.entries(S)){let O,D;if(Array.isArray(A)?[O,D]=A:(O=A.mimeType,D=A.data),P.includes(".")){console.warn(`Skipping attachment '${P}' for run ${b.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}u.push({name:`attachment.${b.id}.${P}`,payload:new Blob([D],{type:`${O}; length=${D.byteLength}`})})}}}c.push(`trace=${b.trace_id},id=${b.id}`)}await this._sendMultipartRequest(u,c.join("; "),r)}async _createNodeFetchBody(e,n){let r=[];for(let s of e)r.push(new Blob([`--${n}\r `])),r.push(new Blob([`Content-Disposition: form-data; name="${s.name}"\r `,`Content-Type: ${s.payload.type}\r \r `])),r.push(s.payload),r.push(new Blob([`\r `]));return r.push(new Blob([`--${n}--\r `])),await new Blob(r).arrayBuffer()}async _createMultipartStream(e,n){let r=new TextEncoder;return new ReadableStream({async start(i){let s=async a=>{typeof a=="string"?i.enqueue(r.encode(a)):i.enqueue(a)};for(let a of e){await s(`--${n}\r `),await s(`Content-Disposition: form-data; name="${a.name}"\r `),await s(`Content-Type: ${a.payload.type}\r \r `);let c=a.payload.stream().getReader();try{let u;for(;!(u=await c.read()).done;)i.enqueue(u.value)}finally{c.releaseLock()}await s(`\r `)}await s(`--${n}--\r `),i.close()}})}async _sendMultipartRequest(e,n,r){let o="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=()=>this._createNodeFetchBody(e,o),s=()=>this._createMultipartStream(e,o),a=async l=>this.batchIngestCaller.callWithOptions({sizeBytes:r?.sizeBytes},async()=>{let c=await l(),u={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};r?.apiKey!==void 0&&(u["x-api-key"]=r.apiKey);let d=c;r?.useGzip&&typeof c=="object"&&"pipeThrough"in c&&(d=c.pipeThrough(new CompressionStream("gzip")),u["Content-Encoding"]="gzip");let f=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:u,body:d,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(f,"Failed to send multipart request",!0),f});try{let l,c=!1;oUe()&&!this.multipartStreamingDisabled&&hce()!=="bun"?(c=!0,l=await a(s)):l=await a(i),(!this.multipartStreamingDisabled||c)&&l.status===422&&(r?.apiUrl??this.apiUrl)!==zze&&(console.warn(`Streaming multipart upload to ${r?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${n}".`),this.multipartStreamingDisabled=!0,l=await a(i))}catch(l){if(iue(l))throw l;console.warn(`${l.message.trim()} Context: ${n}`)}}async updateRun(e,n,r){qn(e),n.inputs&&(n.inputs=await this.processInputs(n.inputs)),n.outputs&&(n.outputs=await this.processOutputs(n.outputs));let o={...n,id:e};if(!this._filterForSampling([o],!0).length)return;if(this.autoBatchTracing&&o.trace_id!==void 0&&o.dotted_order!==void 0){let a=this._cloneCurrentOTELContext();if(n.end_time!==void 0&&o.parent_run_id===void 0&&this.blockOnRootRunFinalization&&!this.manualFlushMode){await this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}else this.processRunOperation({action:"update",item:o,otelContext:a,apiKey:r?.apiKey,apiUrl:r?.apiUrl}).catch(console.error);return}let i={...this.headers,"Content-Type":"application/json"};r?.apiKey!==void 0&&(i["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(i["x-tenant-id"]=r.workspaceId);let s=Hu(n,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{let a=await this._fetch(`${r?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await zt(a,"update run",!0),a})}async readRun(e,{loadChildRuns:n}={loadChildRuns:!1}){qn(e);let r=await this._get(`/runs/${e}`);return n&&(r=await this._loadChildRuns(r)),r}async getRunUrl({runId:e,run:n,projectOpts:r}){if(n!==void 0){let o;n.session_id?o=n.session_id:r?.projectName?o=(await this.readProject({projectName:r?.projectName})).id:r?.projectId?o=r?.projectId:o=(await this.readProject({projectName:rs("PROJECT")||"default"})).id;let i=await this._getTenantId();return`${this.getHostUrl()}/o/${i}/projects/p/${o}/r/${n.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 n=await nNt(this.listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),r={},o={};n.sort((i,s)=>(i?.dotted_order??"").localeCompare(s?.dotted_order??""));for(let i of n){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 r||(r[i.parent_run_id]=[]),r[i.parent_run_id].push(i),o[i.id]=i)}e.child_runs=r[e.id]||[];for(let i in r)i!==e.id&&(o[i].child_runs=r[i]);return e}async*listRuns(e){let{projectId:n,projectName:r,parentRunId:o,traceId:i,referenceExampleId:s,startTime:a,executionOrder:l,isRoot:c,runType:u,error:d,id:f,query:p,filter:m,traceFilter:h,treeFilter:g,limit:y,select:w,order:v}=e,x=[];if(n&&(x=Array.isArray(n)?n:[n]),r){let S=Array.isArray(r)?r:[r],P=await Promise.all(S.map(A=>this.readProject({projectName:A}).then(O=>O.id)));x.push(...P)}let b=["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"],_={session:x.length?x:null,run_type:u,reference_example:s,query:p,filter:m,trace_filter:h,tree_filter:g,execution_order:l,parent_run:o,start_time:a?a.toISOString():null,error:d,id:f,limit:y,trace:i,select:w||b,is_root:c,order:v};_.select.includes("child_run_ids")&&tI("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let T=0;for await(let S of this._getCursorPaginatedList("/runs/query",_))if(y){if(T>=y)break;if(S.length+T>y){yield*S.slice(0,y-T);break}T+=S.length,yield*S}else yield*S}async*listGroupRuns(e){let{projectId:n,projectName:r,groupBy:o,filter:i,startTime:s,endTime:a,limit:l,offset:c}=e,d={session_id:n||(await this.readProject({projectName:r})).id,group_by:o,filter:i,start_time:s?s.toISOString():null,end_time:a?a.toISOString():null,limit:Number(l)||100},f=Number(c)||0,p="/runs/group",m=`${this.apiUrl}${p}`;for(;;){let h={...d,offset:f},g=Object.fromEntries(Object.entries(h).filter(([_,T])=>T!==void 0)),y=JSON.stringify(g),v=await(await this.caller.call(async()=>{let _=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:y});return await zt(_,`Failed to fetch ${p}`),_})).json(),{groups:x,total:b}=v;if(x.length===0)break;for(let _ of x)yield _;if(f+=x.length,f>=b)break}}async getRunStats({id:e,trace:n,parentRun:r,runType:o,projectNames:i,projectIds:s,referenceExampleIds:a,startTime:l,endTime:c,error:u,query:d,filter:f,traceFilter:p,treeFilter:m,isRoot:h,dataSourceType:g}){let y=s||[];i&&(y=[...s||[],...await Promise.all(i.map(T=>this.readProject({projectName:T}).then(S=>S.id)))]);let v=Object.fromEntries(Object.entries({id:e,trace:n,parent_run:r,run_type:o,session:y,reference_example:a,start_time:l,end_time:c,error:u,query:d,filter:f,trace_filter:p,tree_filter:m,is_root:h,data_source_type:g}).filter(([T,S])=>S!==void 0)),x=JSON.stringify(v);return await(await this.caller.call(async()=>{let T=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:x});return await zt(T,"get run stats"),T})).json()}async shareRun(e,{shareId:n}={}){let r={run_id:e,share_token:n||eI()};qn(e);let o=JSON.stringify(r),s=await(await this.caller.call(async()=>{let a=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 zt(a,"share run"),a})).json();if(s===null||!("share_token"in s))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${s.share_token}/r`}async unshareRun(e){qn(e),await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(n,"unshare run",!0),n})}async readRunSharedLink(e){qn(e);let r=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 zt(o,"read run shared link"),o})).json();if(!(r===null||!("share_token"in r)))return`${this.getHostUrl()}/public/${r.share_token}/r`}async listSharedRuns(e,{runIds:n}={}){let r=new URLSearchParams({share_token:e});if(n!==void 0)for(let s of n)r.append("id",s);return qn(e),await(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/public/${e}/runs${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(s,"list shared runs"),s})).json()}async readDatasetSharedSchema(e,n){if(!e&&!n)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:n})).id),qn(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 zt(i,"read dataset shared schema"),i})).json();return o.url=`${this.getHostUrl()}/public/${o.share_token}/d`,o}async shareDataset(e,n){if(!e&&!n)throw new Error("Either datasetId or datasetName must be given");e||(e=(await this.readDataset({datasetName:n})).id);let r={dataset_id:e};qn(e);let o=JSON.stringify(r),s=await(await this.caller.call(async()=>{let a=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 zt(a,"share dataset"),a})).json();return s.url=`${this.getHostUrl()}/public/${s.share_token}/d`,s}async unshareDataset(e){qn(e),await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(n,"unshare dataset",!0),n})}async readSharedDataset(e){return qn(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 zt(o,"read shared dataset"),o})).json()}async listSharedExamples(e,n){let r={};n?.exampleIds&&(r.id=n.exampleIds);let o=new URLSearchParams;Object.entries(r).forEach(([a,l])=>{Array.isArray(l)?l.forEach(c=>o.append(a,c)):o.append(a,l)});let i=await this.caller.call(async()=>{let a=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 zt(a,"list shared examples"),a}),s=await i.json();if(!i.ok)throw"detail"in s?new Error(`Failed to list shared examples. Status: ${i.status} Message: ${Array.isArray(s.detail)?s.detail.join(` `):"Unspecified error"}`):new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`);return s.map(a=>({...a,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:n=null,metadata:r=null,upsert:o=!1,projectExtra:i=null,referenceDatasetId:s=null}){let a=o?"?upsert=true":"",l=`${this.apiUrl}/sessions${a}`,c=i||{};r&&(c.metadata=r);let u={name:e,extra:c,description:n};s!==null&&(u.reference_dataset_id=s);let d=JSON.stringify(u);return await(await this.caller.call(async()=>{let m=await this._fetch(l,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:d});return await zt(m,"create project"),m})).json()}async updateProject(e,{name:n=null,description:r=null,metadata:o=null,projectExtra:i=null,endTime:s=null}){let a=`${this.apiUrl}/sessions/${e}`,l=i;o&&(l={...l||{},metadata:o});let c=JSON.stringify({name:n,extra:l,description:r,end_time:s?new Date(s).toISOString():null});return await(await this.caller.call(async()=>{let f=await this._fetch(a,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await zt(f,"update project"),f})).json()}async hasProject({projectId:e,projectName:n}){let r="/sessions",o=new URLSearchParams;if(e!==void 0&&n!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)qn(e),r+=`/${e}`;else if(n!==void 0)o.append("name",n);else throw new Error("Must provide projectName or projectId");let i=await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${r}?${o}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(s,"has project"),s});try{let s=await i.json();return i.ok?Array.isArray(s)?s.length>0:!0:!1}catch{return!1}}async readProject({projectId:e,projectName:n,includeStats:r}){let o="/sessions",i=new URLSearchParams;if(e!==void 0&&n!==void 0)throw new Error("Must provide either projectName or projectId, not both");if(e!==void 0)qn(e),o+=`/${e}`;else if(n!==void 0)i.append("name",n);else throw new Error("Must provide projectName or projectId");r!==void 0&&i.append("include_stats",r.toString());let s=await this._get(o,i),a;if(Array.isArray(s)){if(s.length===0)throw new Error(`Project[id=${e}, name=${n}] not found`);a=s[0]}else a=s;return a}async getProjectUrl({projectId:e,projectName:n}){if(e===void 0&&n===void 0)throw new Error("Must provide either projectName or projectId");let r=await this.readProject({projectId:e,projectName:n}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/projects/p/${r.id}`}async getDatasetUrl({datasetId:e,datasetName:n}){if(e===void 0&&n===void 0)throw new Error("Must provide either datasetName or datasetId");let r=await this.readDataset({datasetId:e,datasetName:n}),o=await this._getTenantId();return`${this.getHostUrl()}/o/${o}/datasets/${r.id}`}async _getTenantId(){if(this._tenantId!==null)return this._tenantId;let e=new URLSearchParams({limit:"1"});for await(let n of this._getPaginated("/sessions",e))return this._tenantId=n[0].tenant_id,n[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:n,nameContains:r,referenceDatasetId:o,referenceDatasetName:i,includeStats:s,datasetVersion:a,referenceFree:l,metadata:c}={}){let u=new URLSearchParams;if(e!==void 0)for(let d of e)u.append("id",d);if(n!==void 0&&u.append("name",n),r!==void 0&&u.append("name_contains",r),o!==void 0)u.append("reference_dataset",o);else if(i!==void 0){let d=await this.readDataset({datasetName:i});u.append("reference_dataset",d.id)}s!==void 0&&u.append("include_stats",s.toString()),a!==void 0&&u.append("dataset_version",a),l!==void 0&&u.append("reference_free",l.toString()),c!==void 0&&u.append("metadata",JSON.stringify(c));for await(let d of this._getPaginated("/sessions",u))yield*d}async deleteProject({projectId:e,projectName:n}){let r;if(e===void 0&&n===void 0)throw new Error("Must provide projectName or projectId");if(e!==void 0&&n!==void 0)throw new Error("Must provide either projectName or projectId, not both");e===void 0?r=(await this.readProject({projectName:n})).id:r=e,qn(r),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/sessions/${r}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(o,`delete session ${r} (${n})`,!0),o})}async uploadCsv({csvFile:e,fileName:n,inputKeys:r,outputKeys:o,description:i,dataType:s,name:a}){let l=`${this.apiUrl}/datasets/upload`,c=new FormData,u=new Blob([e],{type:"text/csv"});return c.append("file",u,n),r.forEach(p=>{c.append("input_keys",p)}),o.forEach(p=>{c.append("output_keys",p)}),i&&c.append("description",i),s&&c.append("data_type",s),a&&c.append("name",a),await(await this.caller.call(async()=>{let p=await this._fetch(l,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await zt(p,"upload CSV"),p})).json()}async createDataset(e,{description:n,dataType:r,inputsSchema:o,outputsSchema:i,metadata:s}={}){let a={name:e,description:n,extra:s?{metadata:s}:void 0};r&&(a.data_type=r),o&&(a.inputs_schema_definition=o),i&&(a.outputs_schema_definition=i);let l=JSON.stringify(a);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:l});return await zt(d,"create dataset"),d})).json()}async readDataset({datasetId:e,datasetName:n}){let r="/datasets",o=new URLSearchParams({limit:"1"});if(e&&n)throw new Error("Must provide either datasetName or datasetId, not both");if(e)qn(e),r+=`/${e}`;else if(n)o.append("name",n);else throw new Error("Must provide datasetName or datasetId");let i=await this._get(r,o),s;if(Array.isArray(i)){if(i.length===0)throw new Error(`Dataset[id=${e}, name=${n}] not found`);s=i[0]}else s=i;return s}async hasDataset({datasetId:e,datasetName:n}){try{return await this.readDataset({datasetId:e,datasetName:n}),!0}catch(r){if(r instanceof Error&&r.message.toLocaleLowerCase().includes("not found"))return!1;throw r}}async diffDatasetVersions({datasetId:e,datasetName:n,fromVersion:r,toVersion:o}){let i=e;if(i===void 0&&n===void 0)throw new Error("Must provide either datasetName or datasetId");if(i!==void 0&&n!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");i===void 0&&(i=(await this.readDataset({datasetName:n})).id);let s=new URLSearchParams({from_version:typeof r=="string"?r:r.toISOString(),to_version:typeof o=="string"?o:o.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,s)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:n}){let r="/datasets";if(e===void 0)if(n!==void 0)e=(await this.readDataset({datasetName:n})).id;else throw new Error("Must provide either datasetName or datasetId");return(await(await this._getResponse(`${r}/${e}/openai_ft`)).text()).trim().split(` `).map(a=>JSON.parse(a))}async*listDatasets({limit:e=100,offset:n=0,datasetIds:r,datasetName:o,datasetNameContains:i,metadata:s}={}){let a="/datasets",l=new URLSearchParams({limit:e.toString(),offset:n.toString()});if(r!==void 0)for(let c of r)l.append("id",c);o!==void 0&&l.append("name",o),i!==void 0&&l.append("name_contains",i),s!==void 0&&l.append("metadata",JSON.stringify(s));for await(let c of this._getPaginated(a,l))yield*c}async updateDataset(e){let{datasetId:n,datasetName:r,...o}=e;if(!n&&!r)throw new Error("Must provide either datasetName or datasetId");let i=n??(await this.readDataset({datasetName:r})).id;qn(i);let s=JSON.stringify(o);return await(await this.caller.call(async()=>{let l=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:s});return await zt(l,"update dataset"),l})).json()}async updateDatasetTag(e){let{datasetId:n,datasetName:r,asOf:o,tag:i}=e;if(!n&&!r)throw new Error("Must provide either datasetName or datasetId");let s=n??(await this.readDataset({datasetName:r})).id;qn(s);let a=JSON.stringify({as_of:typeof o=="string"?o:o.toISOString(),tag:i});await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${s}/tags`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await zt(l,"update dataset tags",!0),l})}async deleteDataset({datasetId:e,datasetName:n}){let r="/datasets",o=e;if(e!==void 0&&n!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(n!==void 0&&(o=(await this.readDataset({datasetName:n})).id),o!==void 0)qn(o),r+=`/${o}`;else throw new Error("Must provide datasetName or datasetId");await this.caller.call(async()=>{let i=await this._fetch(this.apiUrl+r,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(i,`delete ${r}`,!0),i})}async indexDataset({datasetId:e,datasetName:n,tag:r}){let o=e;if(!o&&!n)throw new Error("Must provide either datasetName or datasetId");if(o&&n)throw new Error("Must provide either datasetName or datasetId, not both");o||(o=(await this.readDataset({datasetName:n})).id),qn(o);let s=JSON.stringify({tag:r});await(await this.caller.call(async()=>{let l=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:s});return await zt(l,"index dataset"),l})).json()}async similarExamples(e,n,r,{filter:o}={}){let i={limit:r,inputs:e};o!==void 0&&(i.filter=o),qn(n);let s=JSON.stringify(i);return(await(await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${n}/search`,{headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,method:"POST",body:s});return await zt(c,"fetch similar examples"),c})).json()).examples}async createExample(e,n,r){if(jze(e)&&(n!==void 0||r!==void 0))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let o=n?r?.datasetId:e.dataset_id,i=n?r?.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 s=(n?r?.createdAt:e.created_at)||new Date,a;jze(e)?a=e:a={inputs:e,outputs:n,created_at:s?.toISOString(),id:r?.exampleId,metadata:r?.metadata,split:r?.split,source_run_id:r?.sourceRunId,use_source_run_io:r?.useSourceRunIO,use_source_run_attachments:r?.useSourceRunAttachments,attachments:r?.attachments};let l=await this._uploadExamplesMultipart(o,[a]);return await this.readExample(l.example_ids?.[0]??eI())}async createExamples(e){if(Array.isArray(e)){if(e.length===0)return[];let w=e,v=w[0].dataset_id,x=w[0].dataset_name;if(v===void 0&&x===void 0)throw new Error("Must provide either datasetName or datasetId");if(v!==void 0&&x!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");v===void 0&&(v=(await this.readDataset({datasetName:x})).id);let b=await this._uploadExamplesMultipart(v,w);return await Promise.all(b.example_ids.map(T=>this.readExample(T)))}let{inputs:n,outputs:r,metadata:o,splits:i,sourceRunIds:s,useSourceRunIOs:a,useSourceRunAttachments:l,attachments:c,exampleIds:u,datasetId:d,datasetName:f}=e;if(n===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=n.map((w,v)=>({dataset_id:p,inputs:w,outputs:r?.[v],metadata:o?.[v],split:i?.[v],id:u?.[v],attachments:c?.[v],source_run_id:s?.[v],use_source_run_io:a?.[v],use_source_run_attachments:l?.[v]})),g=await this._uploadExamplesMultipart(p,h);return await Promise.all(g.example_ids.map(w=>this.readExample(w)))}async createLLMExample(e,n,r){return this.createExample({input:e},{output:n},r)}async createChatExample(e,n,r){let o=e.map(s=>Dce(s)?$ce(s):s),i=Dce(n)?$ce(n):n;return this.createExample({input:o},{output:i},r)}async readExample(e){qn(e);let n=`/examples/${e}`,r=await this._get(n),{attachment_urls:o,...i}=r,s=i;return o&&(s.attachments=Object.entries(o).reduce((a,[l,c])=>(a[l.slice(11)]={presigned_url:c.presigned_url,mime_type:c.mime_type},a),{})),s}async*listExamples({datasetId:e,datasetName:n,exampleIds:r,asOf:o,splits:i,inlineS3Urls:s,metadata:a,limit:l,offset:c,filter:u,includeAttachments:d}={}){let f;if(e!==void 0&&n!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");if(e!==void 0)f=e;else if(n!==void 0)f=(await this.readDataset({datasetName:n})).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=s??!0;if(p.append("inline_s3_urls",h.toString()),r!==void 0)for(let y of r)p.append("id",y);if(i!==void 0)for(let y of i)p.append("splits",y);if(a!==void 0){let y=JSON.stringify(a);p.append("metadata",y)}l!==void 0&&p.append("limit",l.toString()),c!==void 0&&p.append("offset",c.toString()),u!==void 0&&p.append("filter",u),d===!0&&["attachment_urls","outputs","metadata"].forEach(y=>p.append("select",y));let g=0;for await(let y of this._getPaginated("/examples",p)){for(let w of y){let{attachment_urls:v,...x}=w,b=x;v&&(b.attachments=Object.entries(v).reduce((_,[T,S])=>(_[T.slice(11)]={presigned_url:S.presigned_url,mime_type:S.mime_type||void 0},_),{})),yield b,g++}if(l!==void 0&&g>=l)break}}async deleteExample(e){qn(e);let n=`/examples/${e}`;await this.caller.call(async()=>{let r=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,`delete ${n}`,!0),r})}async deleteExamples(e,n){if(e.forEach(r=>qn(r)),n?.hardDelete){let r=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}${r}`,{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 zt(o,"hard delete examples",!0),o})}else{let r=new URLSearchParams;e.forEach(o=>r.append("example_ids",o)),await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/examples?${r.toString()}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(o,"delete examples",!0),o})}}async updateExample(e,n){let r;n?r=e:r=e.id,qn(r);let o;n?o={id:r,...n}:o=e;let i;return o.dataset_id!==void 0?i=o.dataset_id:i=(await this.readExample(r)).dataset_id,this._updateExamplesMultipart(i,[o])}async updateExamples(e){let n;return e[0].dataset_id===void 0?n=(await this.readExample(e[0].id)).dataset_id:n=e[0].dataset_id,this._updateExamplesMultipart(n,e)}async readDatasetVersion({datasetId:e,datasetName:n,asOf:r,tag:o}){let i;if(e?i=e:i=(await this.readDataset({datasetName:n})).id,qn(i),r&&o||!r&&!o)throw new Error("Exactly one of asOf and tag must be specified.");let s=new URLSearchParams;return r!==void 0&&s.append("as_of",typeof r=="string"?r:r.toISOString()),o!==void 0&&s.append("tag",o),await(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${s.toString()}`,{method:"GET",headers:{...this.headers},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(l,"read dataset version"),l})).json()}async listDatasetSplits({datasetId:e,datasetName:n,asOf:r}){let o;if(e===void 0&&n===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&n!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?o=(await this.readDataset({datasetName:n})).id:o=e,qn(o);let i=new URLSearchParams,s=r?typeof r=="string"?r:r?.toISOString():void 0;return s&&i.append("as_of",s),await this._get(`/datasets/${o}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:n,splitName:r,exampleIds:o,remove:i=!1}){let s;if(e===void 0&&n===void 0)throw new Error("Must provide dataset name or ID");if(e!==void 0&&n!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");e===void 0?s=(await this.readDataset({datasetName:n})).id:s=e,qn(s);let a={split_name:r,examples:o.map(c=>(qn(c),c)),remove:i},l=JSON.stringify(a);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/datasets/${s}/splits`,{method:"PUT",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await zt(c,"update dataset splits",!0),c})}async createFeedback(e,n,{score:r,value:o,correction:i,comment:s,sourceInfo:a,feedbackSourceType:l="api",sourceRunId:c,feedbackId:u,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 g={type:l??"api",metadata:a??{}};c!==void 0&&g?.metadata!==void 0&&!g.metadata.__run&&(g.metadata.__run={run_id:c}),g?.metadata!==void 0&&g.metadata.__run?.run_id!==void 0&&qn(g.metadata.__run.run_id);let y={id:u??eI(),run_id:e,key:n,score:Bze(r),value:o,correction:i,comment:s,feedback_source:g,comparative_experiment_id:p,feedbackConfig:d,session_id:m??f,start_time:h},w=JSON.stringify(y),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let x=await this._fetch(v,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:w});return await zt(x,"create feedback",!0),x}),y}async updateFeedback(e,{score:n,value:r,correction:o,comment:i}){let s={};n!=null&&(s.score=Bze(n)),r!=null&&(s.value=r),o!=null&&(s.correction=o),i!=null&&(s.comment=i),qn(e);let a=JSON.stringify(s);await this.caller.call(async()=>{let l=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:a});return await zt(l,"update feedback",!0),l})}async readFeedback(e){qn(e);let n=`/feedback/${e}`;return await this._get(n)}async deleteFeedback(e){qn(e);let n=`/feedback/${e}`;await this.caller.call(async()=>{let r=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,`delete ${n}`,!0),r})}async*listFeedback({runIds:e,feedbackKeys:n,feedbackSourceTypes:r}={}){let o=new URLSearchParams;if(e)for(let i of e)qn(i),o.append("run",i);if(n)for(let i of n)o.append("key",i);if(r)for(let i of r)o.append("source",i);for await(let i of this._getPaginated("/feedback",o))yield*i}async createPresignedFeedbackToken(e,n,{expiration:r,feedbackConfig:o}={}){let i={run_id:e,feedback_key:n,feedback_config:o};r?typeof r=="string"?i.expires_at=r:(r?.hours||r?.minutes||r?.days)&&(i.expires_in=r):i.expires_in={hours:3};let s=JSON.stringify(i);return await(await this.caller.call(async()=>{let l=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:s});return await zt(l,"create presigned feedback token"),l})).json()}async createComparativeExperiment({name:e,experimentIds:n,referenceDatasetId:r,createdAt:o,description:i,metadata:s,id:a}){if(n.length===0)throw new Error("At least one experiment is required");if(r||(r=(await this.readProject({projectId:n[0]})).reference_dataset_id),!r==null)throw new Error("A reference dataset is required");let l={id:a,name:e,experiment_ids:n,reference_dataset_id:r,description:i,created_at:(o??new Date)?.toISOString(),extra:{}};s&&(l.extra.metadata=s);let c=JSON.stringify(l);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:c});return await zt(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){qn(e);let n=new URLSearchParams({run_id:e});for await(let r of this._getPaginated("/feedback/tokens",n))yield*r}_selectEvalResults(e){let n;return"results"in e?n=e.results:Array.isArray(e)?n=e:n=[e],n}async _logEvaluationFeedback(e,n,r){let o=this._selectEvalResults(e),i=[];for(let s of o){let a=r||{};s.evaluatorInfo&&(a={...s.evaluatorInfo,...a});let l=null;s.targetRunId?l=s.targetRunId:n&&(l=n.id),i.push(await this.createFeedback(l,s.key,{score:s.score,value:s.value,comment:s.comment,correction:s.correction,sourceInfo:a,sourceRunId:s.sourceRunId,feedbackConfig:s.feedbackConfig,feedbackSourceType:"model",sessionId:n?.session_id,startTime:n?.start_time}))}return[o,i]}async logEvaluationFeedback(e,n,r){let[o]=await this._logEvaluationFeedback(e,n,r);return o}async createFeedbackConfig(e){let{feedbackKey:n,feedbackConfig:r,isLowerScoreBetter:o=!1}=e,i={feedback_key:n,feedback_config:r,is_lower_score_better:o};return(await this.caller.call(async()=>{let a=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 zt(a,"create feedback config"),a})).json()}async*listFeedbackConfigs(e={}){let{feedbackKeys:n,nameContains:r,limit:o}=e,i=new URLSearchParams;n&&n.forEach(a=>{i.append("key",a)}),r&&i.append("name_contains",r),i.append("limit",(o!==void 0?Math.min(o,100):100).toString());let s=0;for await(let a of this._getPaginated("/feedback-configs",i))if(yield*a,s+=a.length,o!==void 0&&s>=o)break}async updateFeedbackConfig(e,n={}){let{feedbackConfig:r,isLowerScoreBetter:o}=n,i={feedback_key:e};return r!==void 0&&(i.feedback_config=r),o!==void 0&&(i.is_lower_score_better=o),(await this.caller.call(async()=>{let a=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 zt(a,"update feedback config"),a})).json()}async deleteFeedbackConfig(e){let n=new URLSearchParams({feedback_key:e});await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/feedback-configs?${n}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,"delete feedback config",!0),r})}async*listAnnotationQueues(e={}){let{queueIds:n,name:r,nameContains:o,limit:i}=e,s=new URLSearchParams;n&&n.forEach((l,c)=>{qn(l,`queueIds[${c}]`),s.append("ids",l)}),r&&s.append("name",r),o&&s.append("name_contains",o),s.append("limit",(i!==void 0?Math.min(i,100):100).toString());let a=0;for await(let l of this._getPaginated("/annotation-queues",s))if(yield*l,a++,i!==void 0&&a>=i)break}async createAnnotationQueue(e){let{name:n,description:r,queueId:o,rubricInstructions:i,rubricItems:s}=e,a={name:n,description:r,id:o||eI(),rubric_instructions:i,rubric_items:s},l=JSON.stringify(Object.fromEntries(Object.entries(a).filter(([u,d])=>d!==void 0)));return(await this.caller.call(async()=>{let u=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:l});return await zt(u,"create annotation queue"),u})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,"read annotation queue"),r})).json()}async updateAnnotationQueue(e,n){let{name:r,description:o,rubricInstructions:i,rubricItems:s}=n,a={};r!==void 0&&(a.name=r),o!==void 0&&(a.description=o),i!==void 0&&(a.rubric_instructions=i),s!==void 0&&(a.rubric_items=s);let l=JSON.stringify(a);await this.caller.call(async()=>{let c=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await zt(c,"update annotation queue",!0),c})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(n,"delete annotation queue",!0),n})}async addRunsToAnnotationQueue(e,n){let r=JSON.stringify(n.map((o,i)=>qn(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await zt(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,n){let r=`/annotation-queues/${qn(e,"queueId")}/run`;return(await this.caller.call(async()=>{let i=await this._fetch(`${this.apiUrl}${r}/${n}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(i,"get run from annotation queue"),i})).json()}async deleteRunFromAnnotationQueue(e,n){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}/runs/${qn(n,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,"delete run from annotation queue",!0),r})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${qn(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(r,"get size from annotation queue"),r})).json()}async _currentTenantIsOwner(e){let n=await this._getSettings();return e=="-"||n.tenant_handle===e}async _ownerConflictError(e,n){let r=await this._getSettings();return new Error(`Cannot ${e} for another tenant. Current tenant: ${r.tenant_handle} Requested tenant: ${n}`)}async _getLatestCommitHash(e){let r=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 zt(o,"get latest commit hash"),o})).json();if(r.commits.length!==0)return r.commits[0].commit_hash}async _likeOrUnlikePrompt(e,n){let[r,o,i]=Ow(e),s=JSON.stringify({like:n});return(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/likes/${r}/${o}`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await zt(l,`${n?"like":"unlike"} prompt`),l})).json()}async _getPromptUrl(e){let[n,r,o]=Ow(e);if(await this._currentTenantIsOwner(n)){let i=await this._getSettings();return o!=="latest"?`${this.getHostUrl()}/prompts/${r}/${o.substring(0,8)}?organizationId=${i.id}`:`${this.getHostUrl()}/prompts/${r}?organizationId=${i.id}`}else return o!=="latest"?`${this.getHostUrl()}/hub/${n}/${r}/${o.substring(0,8)}`:`${this.getHostUrl()}/hub/${n}/${r}`}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 n of this._getPaginated(`/commits/${e}/`,new URLSearchParams,r=>r.commits))yield*n}async*listPrompts(e){let n=new URLSearchParams;n.append("sort_field",e?.sortField??"updated_at"),n.append("sort_direction","desc"),n.append("is_archived",(!!e?.isArchived).toString()),e?.isPublic!==void 0&&n.append("is_public",e.isPublic.toString()),e?.query&&n.append("query",e.query);for await(let r of this._getPaginated("/repos",n,o=>o.repos))yield*r}async getPrompt(e){let[n,r,o]=Ow(e),s=await(await this.caller.call(async()=>{let a=await this._fetch(`${this.apiUrl}/repos/${n}/${r}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return a?.status===404?null:(await zt(a,"get prompt"),a)}))?.json();return s?.repo?s.repo:null}async createPrompt(e,n){let r=await this._getSettings();if(n?.isPublic&&!r.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,s]=Ow(e);if(!await this._currentTenantIsOwner(o))throw await this._ownerConflictError("create a prompt",o);let a={repo_handle:i,...n?.description&&{description:n.description},...n?.readme&&{readme:n.readme},...n?.tags&&{tags:n.tags},is_public:!!n?.isPublic},l=JSON.stringify(a),c=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:l});return await zt(d,"create prompt"),d}),{repo:u}=await c.json();return u}async createCommit(e,n,r){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[o,i,s]=Ow(e),a=r?.parentCommitHash==="latest"||!r?.parentCommitHash?await this._getLatestCommitHash(`${o}/${i}`):r?.parentCommitHash,l={manifest:JSON.parse(JSON.stringify(n)),parent_commit:a},c=JSON.stringify(l),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:c});return await zt(f,"create commit"),f})).json();return this._getPromptUrl(`${o}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,n=[]){return this._updateExamplesMultipart(e,n)}async _updateExamplesMultipart(e,n=[]){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 r=new FormData;for(let s of n){let a=s.id,l={...s.metadata&&{metadata:s.metadata},...s.split&&{split:s.split}},c=Hu(l,`Serializing body for example with id: ${a}`),u=new Blob([c],{type:"application/json"});if(r.append(a,u),s.inputs){let d=Hu(s.inputs,`Serializing inputs for example with id: ${a}`),f=new Blob([d],{type:"application/json"});r.append(`${a}.inputs`,f)}if(s.outputs){let d=Hu(s.outputs,`Serializing outputs whle updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});r.append(`${a}.outputs`,f)}if(s.attachments)for(let[d,f]of Object.entries(s.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}`});r.append(`${a}.attachment.${d}`,h)}if(s.attachments_operations){let d=Hu(s.attachments_operations,`Serializing attachments while updating example with id: ${a}`),f=new Blob([d],{type:"application/json"});r.append(`${a}.attachments_operations`,f)}}let o=e??n[0]?.dataset_id;return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${o}/examples`)}`,{method:"PATCH",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await zt(s,"update examples"),s})).json()}async uploadExamplesMultipart(e,n=[]){return this._uploadExamplesMultipart(e,n)}async _uploadExamplesMultipart(e,n=[]){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 r=new FormData;for(let i of n){let s=(i.id??eI()).toString(),a={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}},l=Hu(a,`Serializing body for uploaded example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(r.append(s,c),i.inputs){let u=Hu(i.inputs,`Serializing inputs for uploaded example with id: ${s}`),d=new Blob([u],{type:"application/json"});r.append(`${s}.inputs`,d)}if(i.outputs){let u=Hu(i.outputs,`Serializing outputs for uploaded example with id: ${s}`),d=new Blob([u],{type:"application/json"});r.append(`${s}.outputs`,d)}if(i.attachments)for(let[u,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}`});r.append(`${s}.attachment.${u}`,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:r});return await zt(i,"upload examples"),i})).json()}async updatePrompt(e,n){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[r,o]=Ow(e);if(!await this._currentTenantIsOwner(r))throw await this._ownerConflictError("update a prompt",r);let i={};if(n?.description!==void 0&&(i.description=n.description),n?.readme!==void 0&&(i.readme=n.readme),n?.tags!==void 0&&(i.tags=n.tags),n?.isPublic!==void 0&&(i.is_public=n.isPublic),n?.isArchived!==void 0&&(i.is_archived=n.isArchived),Object.keys(i).length===0)throw new Error("No valid update options provided");let s=JSON.stringify(i);return(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/repos/${r}/${o}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await zt(l,"update prompt"),l})).json()}async deletePrompt(e){if(!await this.promptExists(e))throw new Error("Prompt does not exist, you must create it first.");let[n,r,o]=Ow(e);if(!await this._currentTenantIsOwner(n))throw await this._ownerConflictError("delete a prompt",n);return(await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/repos/${n}/${r}`,{method:"DELETE",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(s,"delete prompt"),s})).json()}_getPromptCacheKey(e,n){return`${e}${n?":with_model":""}`}async _fetchPromptFromApi(e,n){let[r,o,i]=Ow(e),a=await(await this.caller.call(async()=>{let l=await this._fetch(`${this.apiUrl}/commits/${r}/${o}/${i}${n?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await zt(l,"pull prompt commit"),l})).json();return{owner:r,repo:o,commit_hash:a.commit_hash,manifest:a.manifest,examples:a.examples}}async pullPromptCommit(e,n){let r=this._fetchPromptFromApi.bind(this,e,n);if(!n?.skipCache&&this._promptCache){let o=this._getPromptCacheKey(e,n?.includeModel),i=this._promptCache.get(o,r);if(i)return i;let s=await r();return this._promptCache.set(o,s,r),s}return this._fetchPromptFromApi(e,n)}async _pullPrompt(e,n){let r=await this.pullPromptCommit(e,{includeModel:n?.includeModel,skipCache:n?.skipCache});return JSON.stringify(r.manifest)}async pushPrompt(e,n){return await this.promptExists(e)?n&&Object.keys(n).some(o=>o!=="object")&&await this.updatePrompt(e,{description:n?.description,readme:n?.readme,tags:n?.tags,isPublic:n?.isPublic}):await this.createPrompt(e,{description:n?.description,readme:n?.readme,tags:n?.tags,isPublic:n?.isPublic}),n?.object?await this.createCommit(e,n?.object,{parentCommitHash:n?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,n={}){let{sourceApiUrl:r=this.apiUrl,datasetName:o}=n,[i,s]=this.parseTokenOrUrl(e,r),a=new t({apiUrl:i,apiKey:"placeholder"}),l=await a.readSharedDataset(s),c=o||l.name;try{if(await this.hasDataset({datasetId:c})){console.log(`Dataset ${c} already exists in your tenant. Skipping.`);return}}catch{}let u=await a.listSharedExamples(s),d=await this.createDataset(c,{description:l.description,dataType:l.data_type||"kv",inputsSchema:l.inputs_schema_definition??void 0,outputsSchema:l.outputs_schema_definition??void 0});try{await this.createExamples({inputs:u.map(f=>f.inputs),outputs:u.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${c}. You should delete it manually.`),f}}parseTokenOrUrl(e,n,r=2,o="dataset"){try{return qn(e),[n,e]}catch{}try{let s=new URL(e).pathname.split("/").filter(a=>a!=="");if(s.length>=r){let a=s[s.length-r];return[n,a]}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 PUe()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var Wze,Hze=C(()=>{Mw();Wze=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(n=>rs(n)==="true")});var kg,MTn,NK,uue=C(()=>{kg=Symbol.for("lc:context_variables"),MTn=Symbol.for("lc:child_run_end_promises"),NK=Symbol.for("langsmith:replica_trace_roots")});function due(t,e){if(kg in t)return t[kg][e]}function Kze(t,e,n){let r=kg in t?t[kg]:{};r[e]=n,t[kg]=r}var qze=C(()=>{uue()});function Gze(t){let n=Object.keys(t).sort().map(r=>`${r}:${t[r]??""}`).join("|");return Jle(n,aNt)}function lNt(t){return t.replace(/[-:.]/g,"")}function Zze(t,e=1){let n=e.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(t).toISOString().slice(0,-1)}${n}Z`}function fue(t,e,n=1){let r=Zze(t,n);return{dottedOrder:lNt(r)+e,microsecondPrecisionDatestring:r}}function uNt(t){let e={};for(let n of Object.keys(t))cNt.has(n)&&(e[n]=t[n]);return e}function Jze(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function Xze(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function Yze(t){return Array.isArray(t)&&t.some(e=>Xze(e))}function dNt(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function fNt(t){let e=t?.callbacks;return t!=null&&typeof e=="object"&&(Yze(e?.handlers)||Yze(e))}function pNt(){let t=Hd("LANGSMITH_RUNS_ENDPOINTS");if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e)){let n=[];for(let r of e){if(typeof r!="object"||r===null){console.warn(`Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got ${typeof r}`);continue}if(typeof r.api_url!="string"){console.warn(`Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof r.api_url}`);continue}if(typeof r.api_key!="string"){console.warn(`Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got ${typeof r.api_key}`);continue}n.push({apiUrl:r.api_url.replace(/\/$/,""),apiKey:r.api_key})}return n}else if(typeof e=="object"&&e!==null){hNt(e);let n=[];for(let[r,o]of Object.entries(e)){let i=r.replace(/\/$/,"");if(typeof o=="string")n.push({apiUrl:i,apiKey:o});else{console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${r}: expected string, got ${typeof o}`);continue}}return n}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(Lze(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 mNt(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):pNt()}function hNt(t){if(Object.keys(t).length>0&&rs("ENDPOINT"))throw new EK}var V2,aNt,cNt,OK,Fm,fce=C(()=>{dce();Hze();sue();uue();qze();Mw();ice();Mw();G3();tK();q3();V2=36,aNt="6ba7b810-9dad-11d1-80b4-00c04fd430c8";cNt=new Set(["projectName","updates","reroot"]);OK=class t{constructor(e,n,r,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=n,this.project_name=r,this.replicas=o}static fromHeader(e){let n=e.split(","),r={},o=[],i,s;for(let a of n){let[l,c]=a.split("="),u=decodeURIComponent(c);l==="langsmith-metadata"?r=JSON.parse(u):l==="langsmith-tags"?o=u.split(","):l==="langsmith-project"?i=u:l==="langsmith-replicas"&&(s=JSON.parse(u).map(f=>Array.isArray(f)?f:uNt(f)))}return new t(r,o,i,s)}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(",")}},Fm=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}),Jze(e)){Object.assign(this,{...e});return}let n=t.getDefaultConfig(),{metadata:r,...o}=e,i=o.client??t.getSharedClient(),s={...r,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:s},"id"in o&&o.id==null&&delete o.id,Object.assign(this,{...n,...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=Zze(this.start_time,this.execution_order)),this.id||(this.id=eK(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=mNt(this.replicas),!this.dotted_order){let{dottedOrder:a}=fue(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+a:this.dotted_order=a}}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:N2(),child_runs:[],api_url:Hd("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Hd("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new rI),t.sharedClient}createChild(e){let n=this.child_execution_order+1,r=this.replicas?.map(u=>{let{reroot:d,...f}=u;return f}),o=e.replicas??r,i=new t({...e,parent_run:this,project_name:this.project_name,replicas:o,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:n,child_execution_order:n});kg in this&&(i[kg]=this[kg]);let s=Symbol.for("lc:child_config"),a=e.extra?.[s]??this.extra[s];if(fNt(a)){let u={...a},d=dNt(u.callbacks)?u.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(Xze)?.updateFromRunTree?.(i),u.callbacks=d),i.extra[s]=u}let l=new Set,c=this;for(;c!=null&&!l.has(c.id);)l.add(c.id),c.child_execution_order=Math.max(c.child_execution_order,n),c=c.parent_run;return this.child_runs.push(i),i}async end(e,n,r=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??n,this.end_time=this.end_time??r,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,n,r=!0){let o=e.extra??{};if(o?.runtime?.library===void 0&&(o.runtime||(o.runtime={}),n))for(let[a,l]of Object.entries(n))o.runtime[a]||(o.runtime[a]=l);let i,s;return r?(s=e.parent_run?.id??e.parent_run_id,i=[]):(i=e.child_runs.map(a=>this._convertToCreate(a,n,r)),s=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:s,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,n){if(n.dotted_order){let r=n.dotted_order.split("."),o=null;for(let i=0;i0?n.trace_id=i[0].slice(-V2):n.trace_id=n.id}}n.parent_run_id===e&&(n.parent_run_id=void 0)}_setReplicaTraceRoot(e,n){let r=due(this,NK)??{};r[e]=n,Kze(this,NK,r);for(let o of this.child_runs)o._setReplicaTraceRoot(e,n)}_remapForProject(e){let{projectName:n,runtimeEnv:r,excludeChildRuns:o=!0,reroot:i=!1,distributedParentId:s,apiUrl:a,apiKey:l,workspaceId:c}=e,u=this._convertToCreate(this,r,o);if(n===this.project_name)return{...u,session_name:n};if(i){if(s)this._sliceParentId(s,u);else if(u.parent_run_id=void 0,u.dotted_order){let w=u.dotted_order.split(".");w.length>0&&(u.dotted_order=w[w.length-1],u.trace_id=u.id)}let y=Gze({projectName:n,apiUrl:a,apiKey:l,workspaceId:c});this._setReplicaTraceRoot(y,u.id)}let d;if(!i){let y=due(this,NK)??{},w=Gze({projectName:n,apiUrl:a,apiKey:l,workspaceId:c});if(d=y[w],d&&(u.trace_id=d,u.dotted_order)){let v=u.dotted_order.split("."),x=null;for(let b=0;b{let x=v.slice(-V2),b=O2(x,n);return v.slice(0,-V2)+b}).join(".")),{...u,id:p,trace_id:m,parent_run_id:h,dotted_order:g,session_name:n}}async postRun(e=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{let n=sK();if(this.replicas&&this.replicas.length>0)for(let{projectName:r,apiKey:o,apiUrl:i,workspaceId:s,reroot:a}of this.replicas){let l=this._remapForProject({projectName:r??this.project_name,runtimeEnv:n,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:o,workspaceId:s});await this.client.createRun(l,{apiKey:o,apiUrl:i,workspaceId:s})}else{let r=this._convertToCreate(this,n,e);await this.client.createRun(r)}if(!e){tI("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(let r of this.child_runs)await r.postRun(!1)}this.child_runs=[]}catch(n){console.error(`Error in postRun for run ${this.id}:`,n)}}async patchRun(e){if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:r,apiUrl:o,workspaceId:i,updates:s,reroot:a}of this.replicas){let l=this._remapForProject({projectName:n??this.project_name,runtimeEnv:void 0,excludeChildRuns:!0,reroot:a,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:r,workspaceId:i}),c={id:l.id,name:l.name,run_type:l.run_type,start_time:l.start_time,outputs:l.outputs,error:l.error,parent_run_id:l.parent_run_id,session_name:l.session_name,reference_example_id:l.reference_example_id,end_time:l.end_time,dotted_order:l.dotted_order,trace_id:l.trace_id,events:l.events,tags:l.tags,extra:l.extra,attachments:this.attachments,...s};e?.excludeInputs||(c.inputs=l.inputs),await this.client.updateRun(l.id,c,{apiKey:r,apiUrl:o,workspaceId:i})}else try{let n={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||(n.inputs=this.inputs),await this.client.updateRun(this.id,n)}catch(n){console.error(`Error in patchRun for run ${this.id}`,n)}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,n){let r=e?.callbacks,o,i,s,a=Wze();if(r){let c=r?.getParentRunId?.()??"",u=r?.handlers?.find(d=>d?.name=="langchain_tracer");o=u?.getRun?.(c),i=u?.projectName,s=u?.client,a=a||!!u}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:s,tracingEnabled:a,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(n):new t({...n,client:s,tracingEnabled:a,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,n){let r="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=r["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),s=i.split(".").map(u=>{let[d,f]=u.split("Z");return{strTime:d,time:Date.parse(d+"Z"),uuid:f}}),a=s[0].uuid,l={...n,name:n?.name??"parent",run_type:n?.run_type??"chain",start_time:n?.start_time??Date.now(),id:s.at(-1)?.uuid,trace_id:a,dotted_order:i};if(r.baggage&&typeof r.baggage=="string"){let u=OK.fromHeader(r.baggage);l.metadata=u.metadata,l.tags=u.tags,l.project_name=u.project_name,l.replicas=u.replicas}let c=new t(l);return c.distributedParentId=c.id,c}toHeaders(e){let n={"langsmith-trace":this.dotted_order,baggage:new OK(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(let[r,o]of Object.entries(n))e.set(r,o);return n}};Object.defineProperty(Fm,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var RK=C(()=>{fce()});function mue(t,e){if(t)return new Fm({...t,start_time:t._serialized_start_time??t.start_time,parent_run:mue(e),child_runs:t.child_runs.map(n=>mue(n)).filter(n=>n!==void 0),extra:{...t.extra,runtime:u2e()},tracingEnabled:!1})}function pue(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function tM(t){return typeof t._addRunToRunMap=="function"}var gNt,Mg,iI=C(()=>{$n();Jo();k2();RK();gNt=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};Mg=class extends Gk{constructor(e){super(...arguments);I(this,"runMap",new Map);I(this,"runTreeMap",new Map);I(this,"usesRunTreeMap",!1)}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?gNt(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,n){e.child_runs.push(n)}_addRunToRunMap(e){let{dottedOrder:n,microsecondPrecisionDatestring:r}=fue(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,n].join("."),o._serialized_start_time=r)):o.parent_run_id=void 0:(o.trace_id=o.id,o.dotted_order=n,o._serialized_start_time=r),this.usesRunTreeMap){let s=mue(o,i);s!==void 0&&this.runTreeMap.set(o.id,s)}else this.runMap.set(o.id,o);return o}async _endTrace(e){let n=e.parent_run_id!==void 0&&this.getRunById(e.parent_run_id);n?n.child_execution_order=Math.max(n.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 n=e!==void 0&&this.getRunById(e);return n?n.child_execution_order+1:1}_createRunForLLMStart(e,n,r,o,i,s,a,l){let c=this._getExecutionOrder(o),u=Date.now(),d=a?{...i,metadata:a}:i,f={id:r,name:l??e.id[e.id.length-1],parent_run_id:o,start_time:u,serialized:e,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{prompts:n},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:d??{},tags:s||[]};return this._addRunToRunMap(f)}async handleLLMStart(e,n,r,o,i,s,a,l){let c=this.getRunById(r)??this._createRunForLLMStart(e,n,r,o,i,s,a,l);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}_createRunForChatModelStart(e,n,r,o,i,s,a,l){let c=this._getExecutionOrder(o),u=Date.now(),d=a?{...i,metadata:a}:i,f={id:r,name:l??e.id[e.id.length-1],parent_run_id:o,start_time:u,serialized:e,events:[{name:"start",time:new Date(u).toISOString()}],inputs:{messages:n},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:d??{},tags:s||[]};return this._addRunToRunMap(f)}async handleChatModelStart(e,n,r,o,i,s,a,l){let c=this.getRunById(r)??this._createRunForChatModelStart(e,n,r,o,i,s,a,l);return await this.onRunCreate?.(c),await this.onLLMStart?.(c),c}async handleLLMEnd(e,n,r,o,i){let s=this.getRunById(n);if(!s||s?.run_type!=="llm")throw new Error("No LLM run to end.");return s.end_time=Date.now(),s.outputs=e,s.events.push({name:"end",time:new Date(s.end_time).toISOString()}),s.extra={...s.extra,...i},await this.onLLMEnd?.(s),await this._endTrace(s),s}async handleLLMError(e,n,r,o,i){let s=this.getRunById(n);if(!s||s?.run_type!=="llm")throw new Error("No LLM run to end.");return s.end_time=Date.now(),s.error=this.stringifyError(e),s.events.push({name:"error",time:new Date(s.end_time).toISOString()}),s.extra={...s.extra,...i},await this.onLLMError?.(s),await this._endTrace(s),s}_createRunForChainStart(e,n,r,o,i,s,a,l,c){let u=this._getExecutionOrder(o),d=Date.now(),f={id:r,name:l??e.id[e.id.length-1],parent_run_id:o,start_time:d,serialized:e,events:[{name:"start",time:new Date(d).toISOString()}],inputs:n,execution_order:u,child_execution_order:u,run_type:a??"chain",child_runs:[],extra:s?{...c,metadata:s}:{...c},tags:i||[]};return this._addRunToRunMap(f)}async handleChainStart(e,n,r,o,i,s,a,l){let c=this.getRunById(r)??this._createRunForChainStart(e,n,r,o,i,s,a,l);return await this.onRunCreate?.(c),await this.onChainStart?.(c),c}async handleChainEnd(e,n,r,o,i){let s=this.getRunById(n);if(!s)throw new Error("No chain run to end.");return s.end_time=Date.now(),s.outputs=pue(e,"output"),s.events.push({name:"end",time:new Date(s.end_time).toISOString()}),i?.inputs!==void 0&&(s.inputs=pue(i.inputs,"input")),await this.onChainEnd?.(s),await this._endTrace(s),s}async handleChainError(e,n,r,o,i){let s=this.getRunById(n);if(!s)throw new Error("No chain run to end.");return s.end_time=Date.now(),s.error=this.stringifyError(e),s.events.push({name:"error",time:new Date(s.end_time).toISOString()}),i?.inputs!==void 0&&(s.inputs=pue(i.inputs,"input")),await this.onChainError?.(s),await this._endTrace(s),s}_createRunForToolStart(e,n,r,o,i,s,a){let l=this._getExecutionOrder(o),c=Date.now(),u={id:r,name:a??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:n},execution_order:l,child_execution_order:l,run_type:"tool",child_runs:[],extra:s?{metadata:s}:{},tags:i||[]};return this._addRunToRunMap(u)}async handleToolStart(e,n,r,o,i,s,a){let l=this.getRunById(r)??this._createRunForToolStart(e,n,r,o,i,s,a);return await this.onRunCreate?.(l),await this.onToolStart?.(l),l}async handleToolEnd(e,n){let r=this.getRunById(n);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.outputs={output:e},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onToolEnd?.(r),await this._endTrace(r),r}async handleToolError(e,n){let r=this.getRunById(n);if(!r||r?.run_type!=="tool")throw new Error("No tool run to end");return r.end_time=Date.now(),r.error=this.stringifyError(e),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onToolError?.(r),await this._endTrace(r),r}async handleAgentAction(e,n){let r=this.getRunById(n);if(!r||r?.run_type!=="chain")return;let o=r;o.actions=o.actions||[],o.actions.push(e),o.events.push({name:"agent_action",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentAction?.(r)}async handleAgentEnd(e,n){let r=this.getRunById(n);!r||r?.run_type!=="chain"||(r.events.push({name:"agent_end",time:new Date().toISOString(),kwargs:{action:e}}),await this.onAgentEnd?.(r))}_createRunForRetrieverStart(e,n,r,o,i,s,a){let l=this._getExecutionOrder(o),c=Date.now(),u={id:r,name:a??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:n},execution_order:l,child_execution_order:l,run_type:"retriever",child_runs:[],extra:s?{metadata:s}:{},tags:i||[]};return this._addRunToRunMap(u)}async handleRetrieverStart(e,n,r,o,i,s,a){let l=this.getRunById(r)??this._createRunForRetrieverStart(e,n,r,o,i,s,a);return await this.onRunCreate?.(l),await this.onRetrieverStart?.(l),l}async handleRetrieverEnd(e,n){let r=this.getRunById(n);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.outputs={documents:e},r.events.push({name:"end",time:new Date(r.end_time).toISOString()}),await this.onRetrieverEnd?.(r),await this._endTrace(r),r}async handleRetrieverError(e,n){let r=this.getRunById(n);if(!r||r?.run_type!=="retriever")throw new Error("No retriever run to end");return r.end_time=Date.now(),r.error=this.stringifyError(e),r.events.push({name:"error",time:new Date(r.end_time).toISOString()}),await this.onRetrieverError?.(r),await this._endTrace(r),r}async handleText(e,n){let r=this.getRunById(n);!r||r?.run_type!=="chain"||(r.events.push({name:"text",time:new Date().toISOString(),kwargs:{text:e}}),await this.onText?.(r))}async handleLLMNewToken(e,n,r,o,i,s){let a=this.getRunById(r);if(!a||a?.run_type!=="llm")throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return a.events.push({name:"new_token",time:new Date().toISOString(),kwargs:{token:e,idx:n,chunk:s?.chunk}}),await this.onLLMNewToken?.(a,e,{chunk:s?.chunk}),a}}});function Hc(t,e){return`${t.open}${e}${t.close}`}function ap(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function Qze(t){return typeof t=="string"?t.trim():t==null?t:ap(t,t.toString())}function Vb(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 eje,Ku,hue,tje=C(()=>{$n();iI();eje={bold:{open:"\x1B[1m",close:"\x1B[22m"},color:{grey:{open:"\x1B[90m",close:"\x1B[39m"},green:{open:"\x1B[32m",close:"\x1B[39m"},cyan:{open:"\x1B[36m",close:"\x1B[39m"},red:{open:"\x1B[31m",close:"\x1B[39m"},blue:{open:"\x1B[34m",close:"\x1B[39m"}}};({color:Ku}=eje),hue=class extends Mg{constructor(){super(...arguments);I(this,"name","console_callback_handler")}persistRun(e){return Promise.resolve()}getParents(e){let n=[],r=e;for(;r.parent_run_id;){let o=this.runMap.get(r.parent_run_id);if(o)n.push(o),r=o;else break}return n}getBreadcrumbs(e){let n=[...this.getParents(e).reverse(),e].map((r,o,i)=>{let s=`${r.execution_order}:${r.run_type}:${r.name}`;return o===i.length-1?Hc(eje.bold,s):s}).join(" > ");return Hc(Ku.grey,n)}onChainStart(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.green,"[chain/start]")} [${n}] Entering Chain run with input: ${ap(e.inputs,"[inputs]")}`)}onChainEnd(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.cyan,"[chain/end]")} [${n}] [${Vb(e)}] Exiting Chain run with output: ${ap(e.outputs,"[outputs]")}`)}onChainError(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.red,"[chain/error]")} [${n}] [${Vb(e)}] Chain run errored with error: ${ap(e.error,"[error]")}`)}onLLMStart(e){let n=this.getBreadcrumbs(e),r="prompts"in e.inputs?{prompts:e.inputs.prompts.map(o=>o.trim())}:e.inputs;console.log(`${Hc(Ku.green,"[llm/start]")} [${n}] Entering LLM run with input: ${ap(r,"[inputs]")}`)}onLLMEnd(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.cyan,"[llm/end]")} [${n}] [${Vb(e)}] Exiting LLM run with output: ${ap(e.outputs,"[response]")}`)}onLLMError(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.red,"[llm/error]")} [${n}] [${Vb(e)}] LLM run errored with error: ${ap(e.error,"[error]")}`)}onToolStart(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.green,"[tool/start]")} [${n}] Entering Tool run with input: "${Qze(e.inputs.input)}"`)}onToolEnd(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.cyan,"[tool/end]")} [${n}] [${Vb(e)}] Exiting Tool run with output: "${Qze(e.outputs?.output)}"`)}onToolError(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.red,"[tool/error]")} [${n}] [${Vb(e)}] Tool run errored with error: ${ap(e.error,"[error]")}`)}onRetrieverStart(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.green,"[retriever/start]")} [${n}] Entering Retriever run with input: ${ap(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.cyan,"[retriever/end]")} [${n}] [${Vb(e)}] Exiting Retriever run with output: ${ap(e.outputs,"[outputs]")}`)}onRetrieverError(e){let n=this.getBreadcrumbs(e);console.log(`${Hc(Ku.red,"[retriever/error]")} [${n}] [${Vb(e)}] Retriever run errored with error: ${ap(e.error,"[error]")}`)}onAgentAction(e){let n=e,r=this.getBreadcrumbs(e);console.log(`${Hc(Ku.blue,"[agent/action]")} [${r}] Agent selected action: ${ap(n.actions[n.actions.length-1],"[action]")}`)}}});var LK=C(()=>{iK()});var gue,yue,wue=C(()=>{Jo();LK();yue=()=>(gue===void 0&&(gue=new rI(In("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{})),gue)});function nje(t=!1){let e=wNt.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 DK(t){return typeof t=="function"&&"langsmith:traceable"in t}var xue,vue,yNt,bue,wNt,fIn,rje=C(()=>{xue=class{getStore(){}run(e,n){return n()}},vue=Symbol.for("ls:tracing_async_local_storage"),yNt=new xue,bue=class{getInstance(){return globalThis[vue]??yNt}initializeGlobalInstance(e){globalThis[vue]===void 0&&(globalThis[vue]=e)}},wNt=new bue;fIn=Symbol.for("langsmith:traceable:root")});var Cue=C(()=>{rje()});function vNt(t){let e;for(let n of t)for(let r of n)kn.isInstance(r.message)&&r.message.usage_metadata!==void 0&&(e=_2(e,r.message.usage_metadata));return e}function oje(t,e){if(t.tracingMetadata){e.extra??(e.extra={});let n=e.extra.metadata??{},r=!1;for(let[o,i]of Object.entries(t.tracingMetadata))(!Object.prototype.hasOwnProperty.call(n,o)||ije.has(o))&&n[o]!==i&&(n[o]=i,r=!0);r&&(e.extra.metadata=n)}t.tracingTags.length>0&&(e.tags=Array.from(new Set([...e.tags??[],...t.tracingTags])))}var ije,W2,sje=C(()=>{$n();R3();Wu();iI();wue();RK();LK();Cue();ije=new Set(["ls_agent_type"]);W2=class _ue extends Mg{constructor(n={}){super(n);I(this,"name","langchain_tracer");I(this,"projectName");I(this,"exampleId");I(this,"client");I(this,"replicas");I(this,"usesRunTreeMap",!0);I(this,"tracingMetadata");I(this,"tracingTags",[]);this.fields=n;let{exampleId:r,projectName:o,client:i,replicas:s,metadata:a,tags:l}=n;this.projectName=o??N2(),this.replicas=s,this.exampleId=r,this.client=i??yue(),this.tracingMetadata=a?{...a}:void 0,this.tracingTags=l??[];let c=_ue.getTraceableRunTree();c&&this.updateFromRunTree(c)}async persistRun(n){}async onRunCreate(n){oje(this,n),n.extra?.lc_defers_inputs||await this.getRunTreeWithTracingConfig(n.id)?.postRun()}async onRunUpdate(n){oje(this,n);let r=this.getRunTreeWithTracingConfig(n.id);n.extra?.lc_defers_inputs?await r?.postRun():await r?.patchRun()}onLLMEnd(n){let r=n.outputs;if(r?.generations){let o=vNt(r.generations);if(o!==void 0){n.extra=n.extra??{};let i=n.extra.metadata??{};i.usage_metadata=o,n.extra.metadata=i}}}copyWithTracingConfig({metadata:n,tags:r}){let o;if(n===void 0)o=this.tracingMetadata?{...this.tracingMetadata}:void 0;else if(this.tracingMetadata===void 0)o={...n};else{o={...this.tracingMetadata};for(let[a,l]of Object.entries(n))(!Object.prototype.hasOwnProperty.call(o,a)||ije.has(a))&&(o[a]=l)}let i=r?Array.from(new Set([...this.tracingTags,...r])):[...this.tracingTags],s=new _ue({...this.fields,metadata:o,tags:i});return s.runMap=this.runMap,s.runTreeMap=this.runTreeMap,s}getRun(n){return this.runTreeMap.get(n)}updateFromRunTree(n){this.runTreeMap.set(n.id,n);let r=n,o=new Set;for(;r.parent_run&&!(o.has(r.id)||(o.add(r.id),!r.parent_run));)r=r.parent_run;o.clear();let i=[r];for(;i.length>0;){let s=i.shift();!s||o.has(s.id)||(o.add(s.id),this.runTreeMap.set(s.id,s),s.child_runs&&i.push(...s.child_runs))}this.client=n.client??this.client,this.replicas=n.replicas??this.replicas,this.projectName=n.project_name??this.projectName,this.exampleId=n.reference_example_id??this.exampleId,this.fields={...this.fields,client:this.client,replicas:this.replicas,projectName:this.projectName,exampleId:this.exampleId}}getRunTreeWithTracingConfig(n){let r=this.runTreeMap.get(n);if(r)return new Fm({...r,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return nje(!0)}catch{return}}static[Symbol.hasInstance](n){if(typeof n!="object"||n===null)return!1;let r=n;return"name"in r&&r.name==="langchain_tracer"&&"copyWithTracingConfig"in r&&typeof r.copyWithTracingConfig=="function"&&"getRunTreeWithTracingConfig"in r&&typeof r.getRunTreeWithTracingConfig=="function"}}});var lje=Tt((IIn,FK)=>{"use strict";var xNt=kce(),$K=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},aje=(t,e,n)=>new Promise((r,o)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){r(t);return}let i=setTimeout(()=>{if(typeof n=="function"){try{r(n())}catch(l){o(l)}return}let s=typeof n=="string"?n:`Promise timed out after ${e} milliseconds`,a=n instanceof Error?n:new $K(s);typeof t.cancel=="function"&&t.cancel(),o(a)},e);xNt(t.then(r,o),()=>{clearTimeout(i)})});FK.exports=aje;FK.exports.default=aje;FK.exports.TimeoutError=$K});var cje=Tt(Sue=>{"use strict";Object.defineProperty(Sue,"__esModule",{value:!0});function bNt(t,e,n){let r=0,o=t.length;for(;o>0;){let i=o/2|0,s=r+i;n(t[s],e)<=0?(r=++s,o-=i+1):o=i}return r}Sue.default=bNt});var uje=Tt(Iue=>{"use strict";Object.defineProperty(Iue,"__esModule",{value:!0});var CNt=cje(),Tue=class{constructor(){this._queue=[]}enqueue(e,n){n=Object.assign({priority:0},n);let r={priority:n.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=n.priority){this._queue.push(r);return}let o=CNt.default(this._queue,r,(i,s)=>s.priority-i.priority);this._queue.splice(o,0,r)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(n=>n.priority===e.priority).map(n=>n.run)}get size(){return this._queue.length}};Iue.default=Tue});var Aue=Tt(Eue=>{"use strict";Object.defineProperty(Eue,"__esModule",{value:!0});var _Nt=Ace(),dje=lje(),SNt=uje(),UK=()=>{},TNt=new dje.TimeoutError,Pue=class extends _Nt{constructor(e){var n,r,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=UK,this._resolveIdle=UK,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:SNt.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(r=(n=e.intervalCap)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:""}\` (${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._onResumeInterval()},n)),!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 n=this._queue.dequeue();return n?(this.emit("active"),n(),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,n={}){return new Promise((r,o)=>{let i=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&n.timeout===void 0?e():dje.default(Promise.resolve(e()),n.timeout===void 0?this._timeout:n.timeout,()=>{(n.throwOnTimeout===void 0?this._throwOnTimeout:n.throwOnTimeout)&&o(TNt)});r(await s)}catch(s){o(s)}this._next()};this._queue.enqueue(i,n),this._tryToStartAnother(),this.emit("add")})}async addAll(e,n){return Promise.all(e.map(async r=>this.add(r,n)))}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 n=this._resolveEmpty;this._resolveEmpty=()=>{n(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let n=this._resolveIdle;this._resolveIdle=()=>{n(),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}};Eue.default=Pue});function INt(){return new("default"in BK.default?BK.default.default:BK.default)({autoStart:!0,concurrency:1})}function PNt(){return typeof H2>"u"&&(H2=INt()),H2}async function Pi(t,e){if(e===!0){let n=zb();n!==void 0?await n.run(void 0,async()=>t()):await t()}else H2=PNt(),H2.add(async()=>{let n=zb();n!==void 0?await n.run(void 0,async()=>t()):await t()})}var BK,H2,kue=C(()=>{wue();A2();BK=N(Aue(),1)});var fje=C(()=>{$n();kue()});var pje,mje=C(()=>{Jo();pje=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(e=>In(e)==="true")});function Mue(t){let e=zb();if(e!==void 0)return e.getStore()?.[QT]?.[t]}var ENt,hje,gje=C(()=>{A2();RK();ENt=Symbol("lc:configure_hooks"),hje=()=>Mue(ENt)||[]});function Wb(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function q2(t){return"name"in t?t:Gk.fromMethods(t)}var ANt,zK,kNt,yje,MNt,NNt,Ws,Hb=C(()=>{$n();Dm();P2();E2();Jo();k2();iI();tje();sje();kue();fje();mje();gje();ANt=class{setHandler(t){return this.setHandlers([t])}},zK=class{constructor(t,e,n,r,o,i,s,a){this.runId=t,this.handlers=e,this.inheritableHandlers=n,this.tags=r,this.inheritableTags=o,this.metadata=i,this.inheritableMetadata=s,this._parentRunId=a}get parentRunId(){return this._parentRunId}async handleText(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{try{await e.handleText?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleText: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}async handleCustomEvent(t,e,n,r,o){await Promise.all(this.handlers.map(i=>Pi(async()=>{try{await i.handleCustomEvent?.(t,e,this.runId,this.tags,this.metadata)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleCustomEvent: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},kNt=class extends zK{getChild(t){let e=new Ws(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=>Pi(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetriever`),e.raiseError)throw n}},e.awaitHandlers)))}async handleRetrieverError(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreRetriever)try{await e.handleRetrieverError?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleRetrieverError: ${n}`),e.raiseError)throw t}},e.awaitHandlers)))}},yje=class extends zK{async handleLLMNewToken(t,e,n,r,o,i){await Promise.all(this.handlers.map(s=>Pi(async()=>{if(!s.ignoreLLM)try{await s.handleLLMNewToken?.(t,e??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,i)}catch(a){if((s.raiseError?console.error:console.warn)(`Error in handler ${s.constructor.name}, handleLLMNewToken: ${a}`),s.raiseError)throw a}},s.awaitHandlers)))}async handleChatModelStreamEvent(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreLLM)try{await e.handleChatModelStreamEvent?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleChatModelStreamEvent: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}async handleLLMError(t,e,n,r,o){await Promise.all(this.handlers.map(i=>Pi(async()=>{if(!i.ignoreLLM)try{await i.handleLLMError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleLLMEnd(t,e,n,r,o){await Promise.all(this.handlers.map(i=>Pi(async()=>{if(!i.ignoreLLM)try{await i.handleLLMEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleLLMEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}},MNt=class extends zK{getChild(t){let e=new Ws(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,n,r,o){await Promise.all(this.handlers.map(i=>Pi(async()=>{if(!i.ignoreChain)try{await i.handleChainError?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainError: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleChainEnd(t,e,n,r,o){await Promise.all(this.handlers.map(i=>Pi(async()=>{if(!i.ignoreChain)try{await i.handleChainEnd?.(t,this.runId,this._parentRunId,this.tags,o)}catch(s){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainEnd: ${s}`),i.raiseError)throw s}},i.awaitHandlers)))}async handleAgentAction(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreAgent)try{await e.handleAgentAction?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentAction: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}async handleAgentEnd(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreAgent)try{await e.handleAgentEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleAgentEnd: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}},NNt=class extends zK{getChild(t){let e=new Ws(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=>Pi(async()=>{if(!e.ignoreAgent)try{await e.handleToolError?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolError: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}async handleToolEvent(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreAgent)try{await e.handleToolEvent?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if(e.raiseError)throw n}},e.awaitHandlers)))}async handleToolEnd(t){await Promise.all(this.handlers.map(e=>Pi(async()=>{if(!e.ignoreAgent)try{await e.handleToolEnd?.(t,this.runId,this._parentRunId,this.tags)}catch(n){if((e.raiseError?console.error:console.warn)(`Error in handler ${e.constructor.name}, handleToolEnd: ${n}`),e.raiseError)throw n}},e.awaitHandlers)))}},Ws=class K2 extends ANt{constructor(n,r){super();I(this,"handlers",[]);I(this,"inheritableHandlers",[]);I(this,"tags",[]);I(this,"inheritableTags",[]);I(this,"metadata",{});I(this,"inheritableMetadata",{});I(this,"name","callback_manager");I(this,"_parentRunId");this.handlers=r?.handlers??this.handlers,this.inheritableHandlers=r?.inheritableHandlers??this.inheritableHandlers,this.tags=r?.tags??this.tags,this.inheritableTags=r?.inheritableTags??this.inheritableTags,this.metadata=r?.metadata??this.metadata,this.inheritableMetadata=r?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=n}getParentRunId(){return this._parentRunId}async handleLLMStart(n,r,o=void 0,i=void 0,s=void 0,a=void 0,l=void 0,c=void 0){return Promise.all(r.map(async(u,d)=>{let f=d===0&&o?o:op();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return tM(p)&&p._createRunForLLMStart(n,[u],f,this._parentRunId,s,this.tags,this.metadata,c),Pi(async()=>{try{await p.handleLLMStart?.(n,[u],f,this._parentRunId,s,this.tags,this.metadata,c)}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new yje(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(n,r,o=void 0,i=void 0,s=void 0,a=void 0,l=void 0,c=void 0){return Promise.all(r.map(async(u,d)=>{let f=d===0&&o?o:op();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return tM(p)&&p._createRunForChatModelStart(n,[u],f,this._parentRunId,s,this.tags,this.metadata,c),Pi(async()=>{try{if(p.handleChatModelStart)await p.handleChatModelStart?.(n,[u],f,this._parentRunId,s,this.tags,this.metadata,c);else if(p.handleLLMStart){let m=ui(u);await p.handleLLMStart?.(n,[m],f,this._parentRunId,s,this.tags,this.metadata,c)}}catch(m){if((p.raiseError?console.error:console.warn)(`Error in handler ${p.constructor.name}, handleLLMStart: ${m}`),p.raiseError)throw m}},p.awaitHandlers)})),new yje(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(n,r,o=op(),i=void 0,s=void 0,a=void 0,l=void 0,c=void 0,u=void 0){return await Promise.all(this.handlers.map(d=>{if(!d.ignoreChain)return tM(d)&&d._createRunForChainStart(n,r,o,this._parentRunId,this.tags,this.metadata,i,l,u),Pi(async()=>{try{await d.handleChainStart?.(n,r,o,this._parentRunId,this.tags,this.metadata,i,l,u)}catch(f){if((d.raiseError?console.error:console.warn)(`Error in handler ${d.constructor.name}, handleChainStart: ${f}`),d.raiseError)throw f}},d.awaitHandlers)})),new MNt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(n,r,o=op(),i=void 0,s=void 0,a=void 0,l=void 0,c=void 0){return await Promise.all(this.handlers.map(u=>{if(!u.ignoreAgent)return tM(u)&&u._createRunForToolStart(n,r,o,this._parentRunId,this.tags,this.metadata,l),Pi(async()=>{try{await u.handleToolStart?.(n,r,o,this._parentRunId,this.tags,this.metadata,l,c)}catch(d){if((u.raiseError?console.error:console.warn)(`Error in handler ${u.constructor.name}, handleToolStart: ${d}`),u.raiseError)throw d}},u.awaitHandlers)})),new NNt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(n,r,o=op(),i=void 0,s=void 0,a=void 0,l=void 0){return await Promise.all(this.handlers.map(c=>{if(!c.ignoreRetriever)return tM(c)&&c._createRunForRetrieverStart(n,r,o,this._parentRunId,this.tags,this.metadata,l),Pi(async()=>{try{await c.handleRetrieverStart?.(n,r,o,this._parentRunId,this.tags,this.metadata,l)}catch(u){if((c.raiseError?console.error:console.warn)(`Error in handler ${c.constructor.name}, handleRetrieverStart: ${u}`),c.raiseError)throw u}},c.awaitHandlers)})),new kNt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(n,r,o,i,s){await Promise.all(this.handlers.map(a=>Pi(async()=>{if(!a.ignoreCustomEvent)try{await a.handleCustomEvent?.(n,r,o,this.tags,this.metadata)}catch(l){if((a.raiseError?console.error:console.warn)(`Error in handler ${a.constructor.name}, handleCustomEvent: ${l}`),a.raiseError)throw l}},a.awaitHandlers)))}addHandler(n,r=!0){this.handlers.push(n),r&&this.inheritableHandlers.push(n)}removeHandler(n){this.handlers=this.handlers.filter(r=>r!==n),this.inheritableHandlers=this.inheritableHandlers.filter(r=>r!==n)}setHandlers(n,r=!0){this.handlers=[],this.inheritableHandlers=[];for(let o of n)this.addHandler(o,r)}addTags(n,r=!0){this.removeTags(n),this.tags.push(...n),r&&this.inheritableTags.push(...n)}removeTags(n){this.tags=this.tags.filter(r=>!n.includes(r)),this.inheritableTags=this.inheritableTags.filter(r=>!n.includes(r))}addMetadata(n,r=!0){this.metadata={...this.metadata,...n},r&&(this.inheritableMetadata={...this.inheritableMetadata,...n})}removeMetadata(n){for(let r of Object.keys(n))delete this.metadata[r],delete this.inheritableMetadata[r]}copy(n=[],r=!0){let o=new K2(this._parentRunId);for(let i of this.handlers){let s=this.inheritableHandlers.includes(i);o.addHandler(i,s)}for(let i of this.tags){let s=this.inheritableTags.includes(i);o.addTags([i],s)}for(let i of Object.keys(this.metadata)){let s=Object.keys(this.inheritableMetadata).includes(i);o.addMetadata({[i]:this.metadata[i]},s)}for(let i of n)o.handlers.filter(s=>s.name==="console_callback_handler").some(s=>s.name===i.name)||o.addHandler(i,r);return o}static fromHandlers(n){class r extends Gk{constructor(){super();I(this,"name",op());Object.assign(this,n)}}let o=new this;return o.addHandler(new r),o}static configure(n,r,o,i,s,a,l){return this._configureSync(n,r,o,i,s,a,l)}static _configureSync(n,r,o,i,s,a,l){let c;(n||r)&&(Array.isArray(n)||!n?(c=new K2,c.setHandlers(n?.map(q2)??[],!0)):c=n,c=c.copy(Array.isArray(r)?r.map(q2):r?.handlers,!1));let u=In("LANGCHAIN_VERBOSE")==="true"||l?.verbose,d=W2.getTraceableRunTree(),f=d?.tracingEnabled??pje();if(d?.tracingEnabled===!1&&c){let g=c.handlers.filter(y=>y.name==="langchain_tracer");for(let y of g)c.removeHandler(y)}let p=f||(In("LANGCHAIN_TRACING")??!1);if(u||p){if(c||(c=new K2),u&&!c.handlers.some(g=>g.name===hue.prototype.name)){let g=new hue;c.addHandler(g,!0)}if(p&&!c.handlers.some(g=>g.name==="langchain_tracer")&&f){let g=new W2;c.addHandler(g,!0)}f&&d&&c._parentRunId===void 0&&(c._parentRunId=d.id,c.handlers.find(g=>g.name==="langchain_tracer")?.updateFromRunTree(d))}for(let{contextVar:g,inheritable:y=!0,handlerClass:w,envVar:v}of hje()){let x=v&&In(v)==="true"&&w,b,_=g!==void 0?Mue(g):void 0;_&&f2e(_)?b=_:x&&(b=new w({})),b!==void 0&&(c||(c=new K2),c.handlers.some(T=>T.name===b.name)||c.addHandler(b,y))}(o||i)&&c&&(c.addTags(o??[]),c.addTags(i??[],!1)),(s||a)&&c&&(c.addMetadata(s??{}),c.addMetadata(a??{},!1));let m=l?.tracerInheritableMetadata,h=l?.tracerInheritableTags;return c&&(m||h)&&(c.handlers=c.handlers.map(g=>g instanceof W2?g.copyWithTracingConfig({metadata:m,tags:h}):g),c.inheritableHandlers=c.inheritableHandlers.map(g=>g instanceof W2?g.copyWithTracingConfig({metadata:m,tags:h}):g)),c}}});var vje,ONt,wje,RNt,vl,sI=C(()=>{A2();Hb();LK();vje=class{getStore(){}run(t,e){return e()}enterWith(t){}},ONt=new vje,wje=Symbol.for("lc:child_config"),RNt=class{getInstance(){return zb()??ONt}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[wje]}runWithConfig(t,e,n){let r=Ws._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata),o=this.getInstance(),i=o.getStore(),s=r?.getParentRunId(),a=r?.handlers?.find(c=>c?.name==="langchain_tracer"),l;return a&&s?l=a.getRunTreeWithTracingConfig(s):n||(l=new Fm({name:"",tracingEnabled:!1})),l&&(l.extra={...l.extra,[wje]:t}),i!==void 0&&i[QT]!==void 0&&(l===void 0&&(l={}),l[QT]=i[QT]),o.run(l,e)}initializeGlobalInstance(t){zb()===void 0&&c2e(t)}},vl=new RNt});var aI=C(()=>{$n();A2();sI()});function $Nt(t){let e=t.configurable??{},n=t.metadata??{},r={};for(let[o,i]of Object.entries(e))!o.startsWith("__")&&!Object.prototype.hasOwnProperty.call(n,o)&&!LNt.has(o)&&DNt.has(typeof i)&&(r[o]=i);return Object.keys(r).length>0?r:void 0}async function qu(t){return Ws._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata,void 0,{tracerInheritableMetadata:t?$Nt(t):void 0})}function nM(...t){let e={};for(let n of t.filter(r=>!!r))for(let r of Object.keys(n))if(r==="metadata")e[r]={...e[r],...n[r]};else if(r==="tags"){let o=e[r]??[];e[r]=[...new Set(o.concat(n[r]??[]))]}else if(r==="configurable")e[r]={...e[r],...n[r]};else if(r==="timeout")e.timeout===void 0?e.timeout=n.timeout:n.timeout!==void 0&&(e.timeout=Math.min(e.timeout,n.timeout));else if(r==="signal")e.signal===void 0?e.signal=n.signal:n.signal!==void 0&&("any"in AbortSignal?e.signal=AbortSignal.any([e.signal,n.signal]):e.signal=n.signal);else if(r==="callbacks"){let o=e.callbacks,i=n.callbacks;if(Array.isArray(i))if(!o)e.callbacks=i;else if(Array.isArray(o))e.callbacks=o.concat(i);else{let s=o.copy();for(let a of i)s.addHandler(q2(a),!0);e.callbacks=s}else if(i)if(!o)e.callbacks=i;else if(Array.isArray(o)){let s=i.copy();for(let a of o)s.addHandler(q2(a),!0);e.callbacks=s}else e.callbacks=new Ws(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=r;e[o]=n[o]??e[o]}return e}function fr(t){let e=vl.getRunnableConfig(),n={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(e){let{runId:r,runName:o,...i}=e;n=Object.entries(i).reduce((s,[a,l])=>(l!==void 0&&(s[a]=l),s),n)}if(t&&(n=Object.entries(t).reduce((r,[o,i])=>(i!==void 0&&(r[o]=i),r),n)),n?.configurable&&typeof n.configurable.model=="string"&&n.metadata?.model===void 0&&(n.metadata||(n.metadata={}),n.metadata.model=n.configurable.model),n.timeout!==void 0){if(n.timeout<=0)throw new Error("Timeout must be a positive number");let r=n.timeout,o=AbortSignal.timeout(r);n.metadata||(n.metadata={}),n.metadata.timeoutMs===void 0&&(n.metadata.timeoutMs=r),n.signal!==void 0?"any"in AbortSignal&&(n.signal=AbortSignal.any([n.signal,o])):n.signal=o,delete n.timeout}return n}function Fi(t={},{callbacks:e,maxConcurrency:n,recursionLimit:r,runName:o,configurable:i,runId:s}={}){let a=fr(t);return e!==void 0&&(delete a.runName,a.callbacks=e),r!==void 0&&(a.recursionLimit=r),n!==void 0&&(a.maxConcurrency=n),o!==void 0&&(a.runName=o),i!==void 0&&(a.configurable={...a.configurable,...i}),s!==void 0&&delete a.runId,a}function Gu(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 LNt,DNt,Ng=C(()=>{Hb();sI();aI();LNt=new Set(["api_key"]),DNt=new Set(["string","number","boolean"])});async function lp(t,e){if(e===void 0)return t;let n;return Promise.race([t.catch(r=>{if(!e?.aborted)throw r}),new Promise((r,o)=>{n=()=>{o(Kb(e))},e.addEventListener("abort",n,{once:!0}),e.aborted&&o(Kb(e))})]).finally(()=>e.removeEventListener("abort",n))}function Kb(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var rM=C(()=>{});function Oue(t,e=2){let n=Array.from({length:e},()=>[]);return n.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let s of n)s.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function Um(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 n={...t};for(let[r,o]of Object.entries(e))r in n&&!Array.isArray(n[r])?n[r]=Um(n[r],o):n[r]=o;return n}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function xje(t,e,n,r,...o){let i=new lI({generator:e,startSetup:n,signal:r}),s=await i.setup;return{output:t(i,s,...o),setup:s}}var Yu,lI,Og=C(()=>{$n();sI();aI();Ng();rM();Yu=class Nue extends ReadableStream{constructor(){super(...arguments);I(this,"reader")}ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{let n=await this.reader.read();return n.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:n.value}}catch(n){throw this.reader.releaseLock(),n}}async return(){if(this.ensureReader(),this.locked){let n=this.reader.cancel();this.reader.releaseLock(),await n}return{done:!0,value:void 0}}async throw(n){if(this.ensureReader(),this.locked){let r=this.reader.cancel();this.reader.releaseLock(),await r}throw n}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(n){let r=n.getReader();return new Nue({start(o){return i();function i(){return r.read().then(({done:s,value:a})=>{if(s){o.close();return}return o.enqueue(a),i()})}},cancel(){r.releaseLock()}})}static fromAsyncGenerator(n){return new Nue({async pull(r){let{value:o,done:i}=await n.next();i&&r.close(),r.enqueue(o)},async cancel(r){await n.return(r)}})}};lI=class{constructor(t){I(this,"generator");I(this,"setup");I(this,"config");I(this,"signal");I(this,"firstResult");I(this,"firstResultUsed",!1);this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,n)=>{vl.runWithConfig(Gu(t.config),async()=>{this.firstResult=this.signal?lp(t.generator.next(),this.signal):t.generator.next(),t.startSetup?this.firstResult.then(t.startSetup).then(e,n):this.firstResult.then(r=>e(void 0),n)},!0)})}async next(...t){return this.signal?.throwIfAborted(),this.firstResultUsed?vl.runWithConfig(Gu(this.config),this.signal?async()=>lp(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 VK(t,e){return FNt.call(t,e)}function WK(t){if(Array.isArray(t)){let n=new Array(t.length);for(let r=0;r=48&&r<=57){e++;continue}return!1}return!0}function cI(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Cje(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function jK(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let n=0,r=t.length;n{FNt=Object.prototype.hasOwnProperty;_je=class extends Error{constructor(t,e,n,r,o){super(bje(t,{name:e,index:n,operation:r,tree:o})),this.name=e,this.index=n,this.operation=r,this.tree=o,Object.setPrototypeOf(this,new.target.prototype),this.message=bje(t,{name:e,index:n,operation:r,tree:o})}}});function qK(t,e){if(e=="")return t;var n={op:"_get",path:e};return uI(t,n),n.value}function uI(t,e,n=!1,r=!0,o=!0,i=0){if(n&&(typeof n=="function"?n(e,0,t,e.path):GK(e,0)),e.path===""){let s={newDocument:t};if(e.op==="add")return s.newDocument=e.value,s;if(e.op==="replace")return s.newDocument=e.value,s.removed=t,s;if(e.op==="move"||e.op==="copy")return s.newDocument=qK(t,e.from),e.op==="move"&&(s.removed=t),s;if(e.op==="test"){if(s.test=G2(t,e.value),s.test===!1)throw new Ui("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return s.newDocument=t,s}else{if(e.op==="remove")return s.removed=t,s.newDocument=null,s;if(e.op==="_get")return e.value=t,s;if(n)throw new Ui("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return s}}else{r||(t=Kd(t));let s=(e.path||"").split("/"),a=t,l=1,c=s.length,u,d,f;for(typeof n=="function"?f=n:f=GK;;){if(d=s[l],d&&d.indexOf("~")!=-1&&(d=Cje(d)),o&&(d=="__proto__"||d=="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(n&&u===void 0&&(a[d]===void 0?u=s.slice(0,l).join("/"):l==c-1&&(u=e.path),u!==void 0&&f(e,0,t,u)),l++,Array.isArray(a)){if(d==="-")d=a.length;else{if(n&&!HK(d))throw new Ui("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);HK(d)&&(d=~~d)}if(l>=c){if(n&&e.op==="add"&&d>a.length)throw new Ui("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let p=BNt[e.op].call(e,a,d,t);if(p.test===!1)throw new Ui("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return p}}else if(l>=c){let p=oM[e.op].call(e,a,d,t);if(p.test===!1)throw new Ui("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return p}if(a=a[d],n&&l0)throw new Ui('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,n);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new Ui("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,n);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new Ui("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,n);if((t.op==="add"||t.op==="replace"||t.op==="test")&&jK(t.value))throw new Ui("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,n);if(n){if(t.op=="add"){var o=t.path.split("/").length,i=r.split("/").length;if(o!==i+1&&o!==i)throw new Ui("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,n)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==r)throw new Ui("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,n)}else if(t.op==="move"||t.op==="copy"){var s=Tje([{op:"_get",path:t.from,value:void 0}],n);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ui("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,n)}}}else throw new Ui("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,n)}function Tje(t,e,n){try{if(!Array.isArray(t))throw new Ui("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)dI(Kd(e),Kd(t),n||!0);else{n=n||GK;for(var r=0;r{$n();KK();Sje=Dn({JsonPatchError:()=>Ui,_areEquals:()=>G2,applyOperation:()=>uI,applyPatch:()=>dI,applyReducer:()=>zNt,deepClone:()=>UNt,getValueByPointer:()=>qK,validate:()=>Tje,validator:()=>GK}),Ui=_je,UNt=Kd,oM={add:function(t,e,n){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");return t[e]=this.value,{newDocument:n}},remove:function(t,e,n){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=t[e];return delete t[e],{newDocument:n,removed:r}},replace:function(t,e,n){if(e==="__proto__"||e==="constructor")throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=t[e];return t[e]=this.value,{newDocument:n,removed:r}},move:function(t,e,n){let r=qK(n,this.path);r&&(r=Kd(r));let o=uI(n,{op:"remove",path:this.from}).removed;return uI(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(t,e,n){let r=qK(n,this.from);return uI(n,{op:"add",path:this.path,value:Kd(r)}),{newDocument:n}},test:function(t,e,n){return{newDocument:n,test:G2(t[e],this.value)}},_get:function(t,e,n){return this.value=t[e],{newDocument:n}}},BNt={add:function(t,e,n){return HK(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:n,index:e}},remove:function(t,e,n){return{newDocument:n,removed:t.splice(e,1)[0]}},replace:function(t,e,n){var r=t[e];return t[e]=this.value,{newDocument:n,removed:r}},move:oM.move,copy:oM.copy,test:oM.test,_get:oM._get}});function Ije(t,e,n,r,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=WK(e),s=WK(t),a=!1,l=s.length-1;l>=0;l--){var c=s[l],u=t[c];if(VK(e,c)&&!(e[c]===void 0&&u!==void 0&&Array.isArray(e)===!1)){var d=e[c];typeof u=="object"&&u!=null&&typeof d=="object"&&d!=null&&Array.isArray(u)===Array.isArray(d)?Ije(u,d,n,r+"/"+cI(c),o):u!==d&&(o&&n.push({op:"test",path:r+"/"+cI(c),value:Kd(u)}),n.push({op:"replace",path:r+"/"+cI(c),value:Kd(d)}))}else Array.isArray(t)===Array.isArray(e)?(o&&n.push({op:"test",path:r+"/"+cI(c),value:Kd(u)}),n.push({op:"remove",path:r+"/"+cI(c)}),a=!0):(o&&n.push({op:"test",path:r,value:t}),n.push({op:"replace",path:r,value:e}))}if(!(!a&&i.length==s.length))for(var l=0;l{KK();Y2();});var Rue=C(()=>{KK();Y2();Z2();({...Sje})});async function Pje(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:n}=t;if(["retriever","llm","prompt"].includes(t.run_type))return n;if(!(Object.keys(n).length===1&&n?.input===""))return n.input}async function Eje(t,e){let{outputs:n}=t;return e==="original"||["retriever","llm","prompt"].includes(t.run_type)?n:n!==void 0&&Object.keys(n).length===1&&n?.output!==void 0?n.output:n}function jNt(t){return t!==void 0&&t.message!==void 0}var Rw,Due,Aje,$ue,kje=C(()=>{$n();Wu();iI();Y2();Rue();Og();Rw=class{constructor(t){I(this,"ops");this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),n=dI({},e);return new Due({ops:e,state:n[n.length-1].newDocument})}},Due=class Lue extends Rw{constructor(n){super(n);I(this,"state");this.state=n.state}concat(n){let r=this.ops.concat(n.ops),o=dI(this.state,n.ops);return new Lue({ops:r,state:o[o.length-1].newDocument})}static fromRunLogPatch(n){let r=dI({},n.ops);return new Lue({ops:n.ops,state:r[r.length-1].newDocument})}},Aje=t=>t.name==="log_stream_tracer";$ue=class extends Mg{constructor(e){super({_awaitHandler:!0,...e});I(this,"autoClose",!0);I(this,"includeNames");I(this,"includeTypes");I(this,"includeTags");I(this,"excludeNames");I(this,"excludeTypes");I(this,"excludeTags");I(this,"_schemaFormat","original");I(this,"rootId");I(this,"keyMapByRunId",{});I(this,"counterMapByRunName",{});I(this,"transformStream");I(this,"writer");I(this,"receiveStream");I(this,"name","log_stream_tracer");I(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=Yu.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;let n=e.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e.run_type)),this.includeTags!==void 0&&(r=r||n.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e.run_type)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}async*tapOutputIterable(e,n){for await(let r of n){if(e!==this.rootId){let o=this.keyMapByRunId[e];o&&await this.writer.write(new Rw({ops:[{op:"add",path:`/logs/${o}/streamed_output/-`,value:r}]}))}yield r}}async onRunCreate(e){if(this.rootId===void 0&&(this.rootId=e.id,await this.writer.write(new Rw({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 n=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=n===1?e.name:`${e.name}:${n}`;let r={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"&&(r.inputs=await Pje(e,this._schemaFormat)),await this.writer.write(new Rw({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:r}]}))}async onRunUpdate(e){try{let n=this.keyMapByRunId[e.id];if(n===void 0)return;let r=[];this._schemaFormat==="streaming_events"&&r.push({op:"replace",path:`/logs/${n}/inputs`,value:await Pje(e,this._schemaFormat)}),r.push({op:"add",path:`/logs/${n}/final_output`,value:await Eje(e,this._schemaFormat)}),e.end_time!==void 0&&r.push({op:"add",path:`/logs/${n}/end_time`,value:new Date(e.end_time).toISOString()});let o=new Rw({ops:r});await this.writer.write(o)}finally{if(e.id===this.rootId){let n=new Rw({ops:[{op:"replace",path:"/final_output",value:await Eje(e,this._schemaFormat)}]});await this.writer.write(n),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,n,r){let o=this.keyMapByRunId[e.id];if(o===void 0)return;let i=e.inputs.messages!==void 0,s;i?jNt(r?.chunk)?s=r?.chunk:s=new Yt({id:`run-${e.id}`,content:n}):s=n;let a=new Rw({ops:[{op:"add",path:`/logs/${o}/streamed_output_str/-`,value:n},{op:"add",path:`/logs/${o}/streamed_output/-`,value:s}]});await this.writer.write(a)}}});var iM,Lw,Jr,ac=C(()=>{$n();iM="__run",Lw=class Mje{constructor(e){I(this,"text");I(this,"generationInfo");this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new Mje({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Jr=class Nje extends Lw{constructor(n){super(n);I(this,"message");this.message=n.message}concat(n){return new Nje({text:this.text+n.text,generationInfo:{...this.generationInfo,...n.generationInfo},message:this.message.concat(n.message)})}}});function ZK({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 Oje,Rje,Lje=C(()=>{Wu();iI();Og();ac();Oje=t=>t.name==="event_stream_tracer",Rje=class extends Mg{constructor(e){super({_awaitHandler:!0,...e});I(this,"autoClose",!0);I(this,"includeNames");I(this,"includeTypes");I(this,"includeTags");I(this,"excludeNames");I(this,"excludeTypes");I(this,"excludeTags");I(this,"runInfoMap",new Map);I(this,"tappedPromises",new Map);I(this,"transformStream");I(this,"writer");I(this,"receiveStream");I(this,"readableStreamClosed",!1);I(this,"name","event_stream_tracer");I(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=Yu.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){let n=e.tags??[],r=this.includeNames===void 0&&this.includeTags===void 0&&this.includeTypes===void 0;return this.includeNames!==void 0&&(r=r||this.includeNames.includes(e.name)),this.includeTypes!==void 0&&(r=r||this.includeTypes.includes(e.runType)),this.includeTags!==void 0&&(r=r||n.find(o=>this.includeTags?.includes(o))!==void 0),this.excludeNames!==void 0&&(r=r&&!this.excludeNames.includes(e.name)),this.excludeTypes!==void 0&&(r=r&&!this.excludeTypes.includes(e.runType)),this.excludeTags!==void 0&&(r=r&&n.every(o=>!this.excludeTags?.includes(o))),r}async*tapOutputIterable(e,n){let r=await n.next();if(r.done)return;let o=this.runInfoMap.get(e);if(o===void 0){yield r.value;return}function i(a,l){return a==="llm"&&typeof l=="string"?new Lw({text:l}):l}let s=this.tappedPromises.get(e);if(s===void 0){let a;s=new Promise(l=>{a=l}),this.tappedPromises.set(e,s);try{let l={event:`on_${o.runType}_stream`,run_id:e,name:o.name,tags:o.tags,metadata:o.metadata,data:{}};await this.send({...l,data:{chunk:i(o.runType,r.value)}},o),yield r.value;for await(let c of n)o.runType!=="tool"&&o.runType!=="retriever"&&await this.send({...l,data:{chunk:i(o.runType,c)}},o),yield c}finally{a?.()}}else{yield r.value;for await(let a of n)yield a}}async send(e,n){this.readableStreamClosed||this._includeRun(n)&&await this.writer.write(e)}async sendEndEvent(e,n){let r=this.tappedPromises.get(e.run_id);r!==void 0?r.then(()=>{this.send(e,n)}):await this.send(e,n)}async onLLMStart(e){let n=ZK(e),r=e.inputs.messages!==void 0?"chat_model":"llm",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:n,runType:r,inputs:e.inputs};this.runInfoMap.set(e.id,o);let i=`on_${r}_start`;await this.send({event:i,data:{input:e.inputs},name:n,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onLLMNewToken(e,n,r){let o=this.runInfoMap.get(e.id),i,s;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")s="on_chat_model_stream",r?.chunk===void 0?i=new Yt({content:n,id:`run-${e.id}`}):i=r.chunk.message;else if(o.runType==="llm")s="on_llm_stream",r?.chunk===void 0?i=new Lw({text:n}):i=r.chunk;else throw new Error(`Unexpected run type ${o.runType}`);await this.send({event:s,data:{chunk:i},run_id:e.id,name:o.name,tags:o.tags,metadata:o.metadata},o)}}async onLLMEnd(e){let n=this.runInfoMap.get(e.id);this.runInfoMap.delete(e.id);let r;if(n===void 0)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);let o=e.outputs?.generations,i;if(n.runType==="chat_model"){for(let s of o??[]){if(i!==void 0)break;i=s[0]?.message}r="on_chat_model_end"}else if(n.runType==="llm")i={generations:o?.map(s=>s.map(a=>({text:a.text,generationInfo:a.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},r="on_llm_end";else throw new Error(`onLLMEnd: Unexpected run type: ${n.runType}`);await this.sendEndEvent({event:r,data:{output:i,input:n.inputs},run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}async onChainStart(e){let n=ZK(e),r=e.run_type??"chain",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:n,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_${r}_start`,data:i,name:n,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onChainEnd(e){let n=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),n===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let r=`on_${e.run_type}_end`,o=e.inputs??n.inputs??{},i={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(i.input=o.input,n.inputs=o.input),await this.sendEndEvent({event:r,data:i,run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata??{}},n)}async onToolStart(e){let n=ZK(e),r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:n,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,r),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:n,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},r)}async onToolEnd(e){let n=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),n===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(n.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let r=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:r,input:n.inputs},run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}async onToolError(e){let n=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),n===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(n.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);await this.sendEndEvent({event:"on_tool_error",data:{input:n.inputs,error:e.error},run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}async onRetrieverStart(e){let n=ZK(e),r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:n,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,r),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:n,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onRetrieverEnd(e){let n=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),n===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:n.inputs},run_id:e.id,name:n.name,tags:n.tags,metadata:n.metadata},n)}async handleCustomEvent(e,n,r){let o=this.runInfoMap.get(r);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${r} not found in run map.`);await this.send({event:"on_custom_event",run_id:r,name:e,tags:o.tags,metadata:o.metadata,data:n},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});function Dje(t){if(!(t&&WNt(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:e,stack:n}=t;return e==="Load failed"?n===void 0||"__sentry_captured__"in t:e.startsWith("error sending request for url")?!0:HNt.has(e)}var VNt,WNt,HNt,$je=C(()=>{VNt=Object.prototype.toString,WNt=t=>VNt.call(t)==="[object Error]",HNt=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 KNt(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 JK(t,e,{min:n=0,allowInfinity:r=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e0&&await new Promise((p,m)=>{let h=()=>{clearTimeout(g),o.signal?.removeEventListener("abort",h),m(o.signal.reason)},g=setTimeout(()=>{o.signal?.removeEventListener("abort",h),p()},f);o.unref&&g.unref?.(),o.signal?.addEventListener("abort",h,{once:!0})}),o.signal?.throwIfAborted(),!0}async function J2(t,e={}){if(e={...e},KNt(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),JK("factor",e.factor,{min:0,allowInfinity:!1}),JK("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),JK("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),JK("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let n=0,r=0,o=performance.now();for(;!Number.isFinite(e.retries)||r<=e.retries;){n++;try{e.signal?.throwIfAborted();let i=await t(n);return e.signal?.throwIfAborted(),i}catch(i){await YNt({error:i,attemptNumber:n,retriesConsumed:r,startTime:o,options:e})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}var qNt,Fue=C(()=>{$je();qNt=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 XK,ZNt,JNt,qb,X2=C(()=>{$n();rM();Fue();XK=N(Aue(),1),ZNt=[400,401,402,403,404,405,406,407,409],JNt=t=>{if(typeof t!="object"||t===null)return;if("message"in t&&typeof t.message=="string"&&(t.message.startsWith("Cancel")||t.message.startsWith("AbortError"))||"name"in t&&typeof t.name=="string"&&t.name==="AbortError"||"code"in t&&typeof t.code=="string"&&t.code==="ECONNABORTED")throw t;let e="response"in t&&typeof t.response=="object"&&t.response!==null&&"status"in t.response&&typeof t.response.status=="number"?t.response.status:void 0,n="status"in t&&typeof t.status=="number"?t.status:void 0,r=e??n;if(r&&ZNt.includes(+r))throw t;if(("error"in t&&typeof t.error=="object"&&t.error!==null&&"code"in t.error&&typeof t.error.code=="string"?t.error.code:void 0)==="insufficient_quota"){let o=new Error("message"in t&&typeof t.message=="string"?t.message:"Insufficient quota");throw o.name="InsufficientQuotaError",o}},qb=class{constructor(t){I(this,"maxConcurrency");I(this,"maxRetries");I(this,"onFailedAttempt");I(this,"queue");this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??JNt;let e="default"in XK.default?XK.default.default:XK.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>J2(()=>t(...e).catch(n=>{throw n instanceof Error?n:new Error(n)}),{onFailedAttempt:({error:n})=>this.onFailedAttempt?.(n),retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...n){if(t.signal){let r;return Promise.race([this.call(e,...n),new Promise((o,i)=>{r=()=>{i(Kb(t.signal))},t.signal?.addEventListener("abort",r,{once:!0})})]).finally(()=>{t.signal&&r&&t.signal.removeEventListener("abort",r)})}return this.call(e,...n)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}}});var Uue,Uje=C(()=>{iI();Uue=class extends Mg{constructor({config:e,onStart:n,onEnd:r,onError:o}){super({_awaitHandler:!0});I(this,"name","RootListenersTracer");I(this,"rootId");I(this,"config");I(this,"argOnStart");I(this,"argOnEnd");I(this,"argOnError");this.config=e,this.argOnStart=n,this.argOnEnd=r,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 Q2(t){return t?t.lc_runnable:!1}var Bje,zje,QK=C(()=>{Bje=class{constructor(t){I(this,"includeNames");I(this,"includeTypes");I(this,"includeTags");I(this,"excludeNames");I(this,"excludeTypes");I(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 n=this.includeNames===void 0&&this.includeTypes===void 0&&this.includeTags===void 0,r=t.tags??[];return this.includeNames!==void 0&&(n=n||this.includeNames.includes(t.name)),this.includeTypes!==void 0&&(n=n||this.includeTypes.includes(e)),this.includeTags!==void 0&&(n=n||r.some(o=>this.includeTags?.includes(o))),this.excludeNames!==void 0&&(n=n&&!this.excludeNames.includes(t.name)),this.excludeTypes!==void 0&&(n=n&&!this.excludeTypes.includes(e)),this.excludeTags!==void 0&&(n=n&&r.every(o=>!this.excludeTags?.includes(o))),n}},zje=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")});function Bue(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function QNt(t){let e="";for(let[n,r]of Object.entries(t))e+=` classDef ${n} ${r}; `;return e}function jje(t,e,n){let{firstNode:r,lastNode:o,nodeColors:i,withStyles:s=!0,curveStyle:a="linear",wrapLabelNWords:l=9}=n??{},c=s?`%%{init: {'flowchart': {'curve': '${a}'}}}%% graph TD; `:`graph TD; `;if(s){let m="default",h={[m]:"{0}({1})"};r!==void 0&&(h[r]="{0}([{1}]):::first"),o!==void 0&&(h[o]="{0}([{1}]):::last");for(let[g,y]of Object.entries(t)){let w=y.name.split(":").pop()??"",v=XNt.some(b=>w.startsWith(b)&&w.endsWith(b))?`

${w}

`:w;Object.keys(y.metadata??{}).length&&(v+=`
${Object.entries(y.metadata??{}).map(([b,_])=>`${b} = ${_}`).join(` `)}`);let x=(h[g]??h[m]).replace("{0}",Bue(g)).replace("{1}",v);c+=` ${x} `}}let u={};for(let m of e){let h=m.source.split(":"),g=m.target.split(":"),y=h.filter((w,v)=>w===g[v]).join(":");u[y]||(u[y]=[]),u[y].push(m)}let d=new Set;function f(m){return[...m].sort((h,g)=>h.split(":").length-g.split(":").length)}function p(m,h){let g=m.length===1&&m[0].source===m[0].target;if(h&&!g){let w=h.split(":").pop();if(d.has(h))throw new Error(`Found duplicate subgraph '${w}' 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),c+=` subgraph ${w} `}let y=f(Object.keys(u).filter(w=>w.startsWith(`${h}:`)&&w!==h&&w.split(":").length===h.split(":").length+1));for(let w of y)p(u[w],w);for(let w of m){let{source:v,target:x,data:b,conditional:_}=w,T="";if(b!==void 0){let S=b,P=S.split(" ");P.length>l&&(S=Array.from({length:Math.ceil(P.length/l)},(A,O)=>P.slice(O*l,(O+1)*l).join(" ")).join(" 
 ")),T=_?` -.  ${S}  .-> `:` --  ${S}  --> `}else T=_?" -.-> ":" --> ";c+=` ${Bue(v)}${T}${Bue(x)}; `}h&&!g&&(c+=` end `)}p(u[""]??[],"");for(let m in u)!m.includes(":")&&m!==""&&p(u[m],m);return s&&(c+=QNt(i??{})),c}async function Vje(t,e){let n=e?.backgroundColor??"white",r=e?.imageType??"png",o=zje(t);n!==void 0&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(n)||(n=`!${n}`));let i=`https://mermaid.ink/img/${o}?bgColor=${n}&type=${r}`,s=await fetch(i);if(!s.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${s.status}`,`Status text: ${s.statusText}`].join(` `));return await s.blob()}var XNt,Wje=C(()=>{QK();XNt=["*","_","`"]});function eOt(t,e){if(t!==void 0&&!Tg(t))return t;if(Q2(e))try{let n=e.getName();return n=n.startsWith("Runnable")?n.slice(8):n,n}catch{return e.getName()}else return e.name??"UnknownSchema"}function tOt(t){return Q2(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Hr(t.data.schema),title:t.data.name}}}function Hje(t,e=[]){let n=new Set(t.edges.filter(o=>!e.includes(o.source)).map(o=>o.target)),r=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!n.has(o.id)&&r.push(o);return r.length===1?r[0]:void 0}function Kje(t,e=[]){let n=new Set(t.edges.filter(o=>!e.includes(o.target)).map(o=>o.source)),r=[];for(let o of Object.values(t.nodes))!e.includes(o.id)&&!n.has(o.id)&&r.push(o);return r.length===1?r[0]:void 0}var zue,Gje=C(()=>{$n();Hk();Ble();E2();QK();Wje();Bu();zue=class qje{constructor(e){I(this,"nodes",{});I(this,"edges",[]);this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){let e={};return Object.values(this.nodes).forEach((n,r)=>{e[n.id]=Tg(n.id)?r:n.id}),{nodes:Object.values(this.nodes).map(n=>({id:e[n.id],...tOt(n)})),edges:this.edges.map(n=>{let r={source:e[n.source],target:e[n.target]};return typeof n.data<"u"&&(r.data=n.data),typeof n.conditional<"u"&&(r.conditional=n.conditional),r})}}addNode(e,n,r){if(n!==void 0&&this.nodes[n]!==void 0)throw new Error(`Node with id ${n} already exists`);let o=n??Ule(),i={id:o,data:e,name:eOt(n,e),metadata:r};return this.nodes[o]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(n=>n.source!==e.id&&n.target!==e.id)}addEdge(e,n,r,o){if(this.nodes[e.id]===void 0)throw new Error(`Source node ${e.id} not in graph`);if(this.nodes[n.id]===void 0)throw new Error(`Target node ${n.id} not in graph`);let i={source:e.id,target:n.id,data:r,conditional:o};return this.edges.push(i),i}firstNode(){return Hje(this)}lastNode(){return Kje(this)}extend(e,n=""){let r=n;Object.values(e.nodes).map(l=>l.id).every(Tg)&&(r="");let o=l=>r?`${r}:${l}`:l;Object.entries(e.nodes).forEach(([l,c])=>{this.nodes[o(l)]={...c,id:o(l)}});let i=e.edges.map(l=>({...l,source:o(l.source),target:o(l.target)}));this.edges=[...this.edges,...i];let s=e.firstNode(),a=e.lastNode();return[s?{id:o(s.id),data:s.data}:void 0,a?{id:o(a.id),data:a.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&Hje(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&Kje(this,[e.id])&&this.removeNode(e)}reid(){let e=Object.fromEntries(Object.values(this.nodes).map(o=>[o.id,o.name])),n=new Map;Object.values(e).forEach(o=>{n.set(o,(n.get(o)||0)+1)});let r=o=>{let i=e[o];return Tg(o)&&n.get(i)===1?i:o};return new qje({nodes:Object.fromEntries(Object.entries(this.nodes).map(([o,i])=>[r(o),{...i,id:r(o)}])),edges:this.edges.map(o=>({...o,source:r(o.source),target:r(o.target)}))})}drawMermaid(e){let{withStyles:n,curveStyle:r,nodeColors:o={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},s=this.reid(),a=s.firstNode(),l=s.lastNode();return jje(s.nodes,s.edges,{firstNode:a?.id,lastNode:l?.id,withStyles:n,curveStyle:r,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){return Vje(this.drawMermaid(e),{backgroundColor:e?.backgroundColor})}}});function Yje(t){let e=new TextEncoder,n=new ReadableStream({async start(r){for await(let o of t)r.enqueue(e.encode(`event: data data: ${JSON.stringify(o)} `));r.enqueue(e.encode(`event: end `)),r.close()}});return Yu.fromReadableStream(n)}var Zje=C(()=>{Og()});function jue(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function e5(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function Vue(t){return t!=null&&typeof t=="object"&&typeof t.next=="function"}async function Xje(t,e){try{let n=await t.next();for(;!n.done;)await e?.(n.value),n=await t.next();return n.value}finally{await t.return?.(void 0)}}function*Wue(t,e){for(;;){let{value:n,done:r}=vl.runWithConfig(Gu(t),e.next.bind(e),!0);if(r)break;yield n}}async function*t5(t,e){let n=e[Symbol.asyncIterator]();for(;;){let{value:r,done:o}=await vl.runWithConfig(Gu(t),n.next.bind(e),!0);if(o)break;yield r}}var Jje,Hue=C(()=>{sI();aI();Ng();Jje=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function Hs(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function rOt(t){if(DK(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function Dw(t){if(typeof t=="function")return new $w({func:t});if(gr.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[n,r]of Object.entries(t))e[n]=Dw(r);return new sM({steps:e})}else throw new Error(`Expected a Runnable, function or object. Instead got an unsupported type.`)}function oOt(t,e){let n=e.name??t.getName(),r=e.description??NT(e.schema);return u2(e.schema)?new Kue({name:n,description:r,schema:we.object({input:we.string()}).transform(o=>o.input),bound:t}):new Kue({name:n,description:r,schema:e.schema,bound:t})}var gr,fI,que,Kc,sM,nOt,$w,r4e,n5,o4e,Kue,Ra=C(()=>{L3();Rb();P2();E2();sI();aI();Ng();rM();Og();kje();Lje();Fue();X2();Uje();QK();vg();Gje();Zje();Hue();Cue();_g();gr=class extends zu{constructor(){super(...arguments);I(this,"lc_runnable",!0);I(this,"name")}getName(e){let n=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${n}${e}`:n}withRetry(e){return new que({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new fI({bound:this,config:e,kwargs:{}})}withFallbacks(e){let n=Array.isArray(e)?e:e.fallbacks;return new r4e({runnable:this,fallbacks:n})}_getOptionsList(e,n=0){if(Array.isArray(e)&&e.length!==n)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${n} inputs`);if(Array.isArray(e))return e.map(fr);if(n>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(e).filter(([o])=>o!=="runId"));return Array.from({length:n},(o,i)=>fr(i===0?e:r))}return Array.from({length:n},()=>fr(e))}async batch(e,n,r){let o=this._getOptionsList(n??{},e.length),i=new qb({maxConcurrency:o[0]?.maxConcurrency??r?.maxConcurrency,onFailedAttempt:a=>{throw a}}),s=e.map((a,l)=>i.call(async()=>{try{return await this.invoke(a,o[l])}catch(c){if(r?.returnExceptions)return c;throw c}}));return Promise.all(s)}async*_streamIterator(e,n){yield this.invoke(e,n)}async stream(e,n){let r=fr(n),o=new lI({generator:this._streamIterator(e,r),config:r});return await o.setup,Yu.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let n;e===void 0?n=fr(e):n=fr({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 r={...e};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[n,r]}async _callWithConfig(e,n,r){let o=fr(r),i=await(await qu(o))?.handleChainStart(this.toJSON(),Hs(n,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{s=await lp(e.call(this,n,o,i),o.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(Hs(s,"output")),s}async _batchWithConfig(e,n,r,o){let i=this._getOptionsList(r??{},n.length),s=await Promise.all(i.map(qu)),a=await Promise.all(s.map(async(c,u)=>{let d=await c?.handleChainStart(this.toJSON(),Hs(n[u],"input"),i[u].runId,i[u].runType,void 0,void 0,i[u].runName??this.getName());return delete i[u].runId,d})),l;try{l=await lp(e.call(this,n,i,a,o),i?.[0]?.signal)}catch(c){throw await Promise.all(a.map(u=>u?.handleChainError(c))),c}return await Promise.all(a.map(c=>c?.handleChainEnd(Hs(l,"output")))),l}_concatOutputChunks(e,n){return Um(e,n)}async*_transformStreamWithConfig(e,n,r){let o,i=!0,s,a=!0,l=fr(r),c=await qu(l),u=this;async function*d(){for await(let p of e){if(i)if(o===void 0)o=p;else try{o=u._concatOutputChunks(o,p)}catch{o=void 0,i=!1}yield p}}let f;try{let p=await xje(n.bind(this),d(),async()=>c?.handleChainStart(this.toJSON(),{input:""},l.runId,l.runType,void 0,void 0,l.runName??this.getName(),void 0,{lc_defers_inputs:!0}),l.signal,l);delete l.runId,f=p.setup;let m=f?.handlers.find(Oje),h=p.output;m!==void 0&&f!==void 0&&(h=m.tapOutputIterable(f.runId,h));let g=f?.handlers.find(Aje);g!==void 0&&f!==void 0&&(h=g.tapOutputIterable(f.runId,h));for await(let y of h)if(yield y,a)if(s===void 0)s=y;else try{s=this._concatOutputChunks(s,y)}catch{s=void 0,a=!1}}catch(p){throw await f?.handleChainError(p,void 0,void 0,void 0,{inputs:Hs(o,"input")}),p}await f?.handleChainEnd(s??{},void 0,void 0,void 0,{inputs:Hs(o,"input")})}getGraph(e){let n=new zue,r=n.addNode({name:`${this.getName()}Input`,schema:we.any()}),o=n.addNode(this),i=n.addNode({name:`${this.getName()}Output`,schema:we.any()});return n.addEdge(r,o),n.addEdge(o,i),n}pipe(e){return new Kc({first:this,last:Dw(e)})}pick(e){return this.pipe(new o4e(e))}assign(e){return this.pipe(new n5(new sM({steps:e})))}async*transform(e,n){let r;for await(let o of e)r===void 0?r=o:r=this._concatOutputChunks(r,o);yield*this._streamIterator(r,fr(n))}async*streamLog(e,n,r){let o=new $ue({...r,autoClose:!1,_schemaFormat:"original"}),i=fr(n);yield*this._streamLog(e,o,i)}async*_streamLog(e,n,r){let{callbacks:o}=r;if(o===void 0)r.callbacks=[n];else if(Array.isArray(o))r.callbacks=o.concat([n]);else{let l=o.copy();l.addHandler(n,!0),r.callbacks=l}let i=this.stream(e,r);async function s(){try{let l=await i;for await(let c of l){let u=new Rw({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await n.writer.write(u)}}finally{await n.writer.close()}}let a=s();try{for await(let l of n)yield l}finally{await a}}streamEvents(e,n,r){let o;if(n.version==="v1")o=this._streamEventsV1(e,n,r);else if(n.version==="v2")o=this._streamEventsV2(e,n,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return n.encoding==="text/event-stream"?Yje(o):Yu.fromAsyncGenerator(o)}async*_streamEventsV2(e,n,r){let o=new Rje({...r,autoClose:!1}),i=fr(n),s=i.runId??op();i.runId=s;let a=i.callbacks;if(a===void 0)i.callbacks=[o];else if(Array.isArray(a))i.callbacks=a.concat(o);else{let m=a.copy();m.addHandler(o,!0),i.callbacks=m}let l=new AbortController,c=this;async function u(){let m;try{if(i.signal)if("any"in AbortSignal)m=AbortSignal.any([l.signal,i.signal]);else{let y=new AbortController;i.signal.addEventListener("abort",()=>y.abort(),{once:!0}),l.signal.addEventListener("abort",()=>y.abort(),{once:!0}),m=y.signal}else m=l.signal;let h=await c.stream(e,{...i,signal:m}),g=o.tapOutputIterable(s,h);for await(let y of g)if(l.signal.aborted)break}finally{await o.finish()}}let d=u(),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{l.abort(),await d}}async*_streamEventsV1(e,n,r){let o,i=!1,s=fr(n),a=s.tags??[],l=s.metadata??{},c=s.runName??this.getName(),u=new $ue({...r,autoClose:!1,_schemaFormat:"streaming_events"}),d=new Bje({...r}),f=this._streamLog(e,u,s);for await(let m of f){if(o?o=o.concat(m):o=Due.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 w={...o.state},v={run_id:w.id,event:`on_${w.type}_start`,name:c,tags:a,metadata:l,data:{input:e}};d.includeEvent(v,w.type)&&(yield v)}let h=m.ops.filter(w=>w.path.startsWith("/logs/")).map(w=>w.path.split("/")[2]),g=[...new Set(h)];for(let w of g){let v,x={},b=o.state.logs[w];if(b.end_time===void 0?b.streamed_output.length>0?v="stream":v="start":v="end",v==="start")b.inputs!==void 0&&(x.input=b.inputs);else if(v==="end")b.inputs!==void 0&&(x.input=b.inputs),x.output=b.final_output;else if(v==="stream"){let _=b.streamed_output.length;if(_!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${_} instead. Encountered in: "${b.name}"`);x={chunk:b.streamed_output[0]},b.streamed_output=[]}yield{event:`on_${b.type}_${v}`,name:b.name,run_id:b.id,tags:b.tags,metadata:b.metadata,data:x}}let{state:y}=o;if(y.streamed_output.length>0){let w=y.streamed_output.length;if(w!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${w} instead. Encountered in: "${y.name}"`);let v={chunk:y.streamed_output[0]};y.streamed_output=[];let x={event:`on_${y.type}_stream`,run_id:y.id,tags:a,metadata:l,name:c,data:v};d.includeEvent(x,y.type)&&(yield x)}}let p=o?.state;if(p!==void 0){let m={event:`on_${p.type}_end`,name:c,run_id:p.id,tags:a,metadata:l,data:{output:p.final_output}};d.includeEvent(m,p.type)&&(yield m)}}static isRunnable(e){return Q2(e)}withListeners({onStart:e,onEnd:n,onError:r}){return new fI({bound:this,config:{},configFactories:[o=>({callbacks:[new Uue({config:o,onStart:e,onEnd:n,onError:r})]})]})}asTool(e){return oOt(this,e)}},fI=class Qje extends gr{constructor(n){super(n);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"bound");I(this,"config");I(this,"kwargs");I(this,"configFactories");this.bound=n.bound,this.kwargs=n.kwargs,this.config=n.config,this.configFactories=n.configFactories}static lc_name(){return"RunnableBinding"}getName(n){return this.bound.getName(n)}async _mergeConfig(...n){let r=nM(this.config,...n);return nM(r,...this.configFactories?await Promise.all(this.configFactories.map(async o=>await o(r))):[])}withConfig(n){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...n}})}withRetry(n){return new que({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:n?.stopAfterAttempt,...n})}async invoke(n,r){return this.bound.invoke(n,await this._mergeConfig(r,this.kwargs))}async batch(n,r,o){let i=Array.isArray(r)?await Promise.all(r.map(async s=>this._mergeConfig(fr(s),this.kwargs))):await this._mergeConfig(fr(r),this.kwargs);return this.bound.batch(n,i,o)}_concatOutputChunks(n,r){return this.bound._concatOutputChunks(n,r)}async*_streamIterator(n,r){yield*this.bound._streamIterator(n,await this._mergeConfig(fr(r),this.kwargs))}async stream(n,r){return this.bound.stream(n,await this._mergeConfig(fr(r),this.kwargs))}async*transform(n,r){yield*this.bound.transform(n,await this._mergeConfig(fr(r),this.kwargs))}streamEvents(n,r,o){let i=this,s=async function*(){yield*i.bound.streamEvents(n,{...await i._mergeConfig(fr(r),i.kwargs),version:r.version},o)};return Yu.fromAsyncGenerator(s())}static isRunnableBinding(n){return n.bound&&gr.isRunnable(n.bound)}withListeners({onStart:n,onEnd:r,onError:o}){return new Qje({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new Uue({config:i,onStart:n,onEnd:r,onError:o})]})]})}},que=class extends fI{constructor(e){super(e);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"maxAttemptNumber",3);I(this,"onFailedAttempt",()=>{});this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}static lc_name(){return"RunnableRetry"}_patchConfigForRetry(e,n,r){let o=e>1?`retry:attempt:${e}`:void 0;return Fi(n,{callbacks:r?.getChild(o)})}async _invoke(e,n,r){return J2(o=>super.invoke(e,this._patchConfigForRetry(o,n,r)),{onFailedAttempt:({error:o})=>this.onFailedAttempt(o,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,n){return this._callWithConfig(this._invoke.bind(this),e,n)}async _batch(e,n,r,o){let i={};try{await J2(async s=>{let a=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),l=a.map(f=>e[f]),c=a.map(f=>this._patchConfigForRetry(s,n?.[f],r?.[f])),u=await super.batch(l,c,{...o,returnExceptions:!0}),d;for(let f=0;fthis.onFailedAttempt(s,s.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(s){if(o?.returnExceptions!==!0)throw s}return Object.keys(i).sort((s,a)=>parseInt(s,10)-parseInt(a,10)).map(s=>i[parseInt(s,10)])}async batch(e,n,r){return this._batchWithConfig(this._batch.bind(this),e,n,r)}},Kc=class eU extends gr{constructor(n){super(n);I(this,"first");I(this,"middle",[]);I(this,"last");I(this,"omitSequenceTags",!1);I(this,"lc_serializable",!0);I(this,"lc_namespace",["langchain_core","runnables"]);this.first=n.first,this.middle=n.middle??this.middle,this.last=n.last,this.name=n.name,this.omitSequenceTags=n.omitSequenceTags??this.omitSequenceTags}static lc_name(){return"RunnableSequence"}get steps(){return[this.first,...this.middle,this.last]}async invoke(n,r){let o=fr(r),i=await(await qu(o))?.handleChainStart(this.toJSON(),Hs(n,"input"),o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s=n,a;try{let l=[this.first,...this.middle];for(let c=0;c{let d=await c?.handleChainStart(this.toJSON(),Hs(n[u],"input"),i[u].runId,void 0,void 0,void 0,i[u].runName);return delete i[u].runId,d})),l=n;try{for(let c=0;c{let f=u?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return Fi(i[d],{callbacks:f})}),o),i[0]?.signal)}catch(c){throw await Promise.all(a.map(u=>u?.handleChainError(c))),c}return await Promise.all(a.map(c=>c?.handleChainEnd(Hs(l,"output")))),l}_concatOutputChunks(n,r){return this.last._concatOutputChunks(n,r)}async*_streamIterator(n,r){let o=await qu(r),{runId:i,...s}=r??{},a=await o?.handleChainStart(this.toJSON(),Hs(n,"input"),i,void 0,void 0,void 0,s?.runName),l=[this.first,...this.middle,this.last],c=!0,u;async function*d(){yield n}try{let f=l[0].transform(d(),Fi(s,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let p=1;p{let a=i.getGraph(n);s!==0&&a.trimFirstNode(),s!==this.steps.length-1&&a.trimLastNode(),r.extend(a);let l=a.firstNode();if(!l)throw new Error(`Runnable ${i} has no first node`);o&&r.addEdge(o,l),o=a.lastNode()}),r}pipe(n){return eU.isRunnableSequence(n)?new eU({first:this.first,middle:this.middle.concat([this.last,n.first,...n.middle]),last:n.last,name:this.name??n.name}):new eU({first:this.first,middle:[...this.middle,this.last],last:Dw(n),name:this.name})}static isRunnableSequence(n){return Array.isArray(n.middle)&&gr.isRunnable(n)}static from([n,...r],o){let i={};return typeof o=="string"?i.name=o:o!==void 0&&(i=o),new eU({...i,first:Dw(n),middle:r.slice(0,-1).map(Dw),last:Dw(r[r.length-1])})}},sM=class e4e extends gr{constructor(n){super(n);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"steps");this.steps={};for(let[r,o]of Object.entries(n.steps))this.steps[r]=Dw(o)}static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}static from(n){return new e4e({steps:n})}async invoke(n,r){let o=fr(r),i=await(await qu(o))?.handleChainStart(this.toJSON(),{input:n},o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s={};try{let a=Object.entries(this.steps).map(async([l,c])=>{s[l]=await c.invoke(n,Fi(o,{callbacks:i?.getChild(`map:key:${l}`)}))});await lp(Promise.all(a),o.signal)}catch(a){throw await i?.handleChainError(a),a}return await i?.handleChainEnd(s),s}async*_transform(n,r,o){let i={...this.steps},s=Oue(n,Object.keys(i).length),a=new Map(Object.entries(i).map(([l,c],u)=>{let d=c.transform(s[u],Fi(o,{callbacks:r?.getChild(`map:key:${l}`)}));return[l,d.next().then(f=>({key:l,gen:d,result:f}))]}));for(;a.size;){let{key:l,result:c,gen:u}=await lp(Promise.race(a.values()),o?.signal);a.delete(l),c.done||(yield{[l]:c.value},a.set(l,u.next().then(d=>({key:l,gen:u,result:d}))))}}transform(n,r){return this._transformStreamWithConfig(n,this._transform.bind(this),r)}async stream(n,r){async function*o(){yield n}let i=fr(r),s=new lI({generator:this.transform(o(),i),config:i});return await s.setup,Yu.fromAsyncGenerator(s)}},nOt=class t4e extends gr{constructor(n){super(n);I(this,"lc_serializable",!1);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"func");if(!DK(n.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=n.func}async invoke(n,r){let[o]=this._getOptionsList(r??{},1),i=await qu(o);return lp(this.func(Fi(o,{callbacks:i}),n),o?.signal)}async*_streamIterator(n,r){let[o]=this._getOptionsList(r??{},1),i=await this.invoke(n,r);if(e5(i)){for await(let s of i)o?.signal?.throwIfAborted(),yield s;return}if(Jje(i)){for(;;){o?.signal?.throwIfAborted();let s=i.next();if(s.done)break;yield s.value}return}yield i}static from(n){return new t4e({func:n})}};$w=class n4e extends gr{constructor(n){if(DK(n.func))return nOt.from(n.func);super(n);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"func");rOt(n.func),this.func=n.func}static lc_name(){return"RunnableLambda"}static from(n){return new n4e({func:n})}async _invoke(n,r,o){return new Promise((i,s)=>{let a=Fi(r,{callbacks:o?.getChild(),recursionLimit:(r?.recursionLimit??25)-1});vl.runWithConfig(Gu(a),async()=>{try{let l=await this.func(n,{...a});if(l&&gr.isRunnable(l)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");l=await l.invoke(n,{...a,recursionLimit:(a.recursionLimit??25)-1})}else if(e5(l)){let c;for await(let u of t5(a,l))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}l=c}else if(jue(l)){let c;for(let u of Wue(a,l))if(r?.signal?.throwIfAborted(),c===void 0)c=u;else try{c=this._concatOutputChunks(c,u)}catch{c=u}l=c}i(l)}catch(l){s(l)}})})}async invoke(n,r){return this._callWithConfig(this._invoke.bind(this),n,r)}async*_transform(n,r,o){let i;for await(let l of n)if(i===void 0)i=l;else try{i=this._concatOutputChunks(i,l)}catch{i=l}let s=Fi(o,{callbacks:r?.getChild(),recursionLimit:(o?.recursionLimit??25)-1}),a=await new Promise((l,c)=>{vl.runWithConfig(Gu(s),async()=>{try{l(await this.func(i,{...s,config:s}))}catch(u){c(u)}})});if(a&&gr.isRunnable(a)){if(o?.recursionLimit===0)throw new Error("Recursion limit reached.");let l=await a.stream(i,s);for await(let c of l)yield c}else if(e5(a))for await(let l of t5(s,a))o?.signal?.throwIfAborted(),yield l;else if(jue(a))for(let l of Wue(s,a))o?.signal?.throwIfAborted(),yield l;else yield a}transform(n,r){return this._transformStreamWithConfig(n,this._transform.bind(this),r)}async stream(n,r){async function*o(){yield n}let i=fr(r),s=new lI({generator:this.transform(o(),i),config:i});return await s.setup,Yu.fromAsyncGenerator(s)}},r4e=class extends gr{constructor(e){super(e);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"runnable");I(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,n){let r=fr(n),o=await qu(r),{runId:i,...s}=r,a=await o?.handleChainStart(this.toJSON(),Hs(e,"input"),i,void 0,void 0,void 0,s?.runName),l=Fi(s,{callbacks:a?.getChild()});return await vl.runWithConfig(l,async()=>{let c;for(let u of this.runnables()){r?.signal?.throwIfAborted();try{let d=await u.invoke(e,l);return await a?.handleChainEnd(Hs(d,"output")),d}catch(d){c===void 0&&(c=d)}}throw c===void 0?new Error("No error stored at end of fallback."):(await a?.handleChainError(c),c)})}async*_streamIterator(e,n){let r=fr(n),o=await qu(r),{runId:i,...s}=r,a=await o?.handleChainStart(this.toJSON(),Hs(e,"input"),i,void 0,void 0,void 0,s?.runName),l,c;for(let d of this.runnables()){r?.signal?.throwIfAborted();let f=Fi(s,{callbacks:a?.getChild()});try{c=t5(f,await d.stream(e,f));break}catch(p){l===void 0&&(l=p)}}if(c===void 0){let d=l??new Error("No error stored at end of fallback.");throw await a?.handleChainError(d),d}let u;try{for await(let d of c){yield d;try{u=u===void 0?u:this._concatOutputChunks(u,d)}catch{u=void 0}}}catch(d){throw await a?.handleChainError(d),d}await a?.handleChainEnd(Hs(u,"output"))}async batch(e,n,r){if(r?.returnExceptions)throw new Error("Not implemented.");let o=this._getOptionsList(n??{},e.length),i=await Promise.all(o.map(l=>qu(l))),s=await Promise.all(i.map(async(l,c)=>{let u=await l?.handleChainStart(this.toJSON(),Hs(e[c],"input"),o[c].runId,void 0,void 0,void 0,o[c].runName);return delete o[c].runId,u})),a;for(let l of this.runnables()){o[0].signal?.throwIfAborted();try{let c=await l.batch(e,s.map((u,d)=>Fi(o[d],{callbacks:u?.getChild()})),r);return await Promise.all(s.map((u,d)=>u?.handleChainEnd(Hs(c[d],"output")))),c}catch(c){a===void 0&&(a=c)}}throw a?(await Promise.all(s.map(l=>l?.handleChainError(a))),a):new Error("No error stored at end of fallbacks.")}};n5=class extends gr{constructor(e){e instanceof sM&&(e={mapper:e});super(e);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"mapper");this.mapper=e.mapper}static lc_name(){return"RunnableAssign"}async invoke(e,n){let r=await this.mapper.invoke(e,n);return{...e,...r}}async*_transform(e,n,r){let o=this.mapper.getStepsKeys(),[i,s]=Oue(e),a=this.mapper.transform(s,Fi(r,{callbacks:n?.getChild()})),l=a.next();for await(let c of i){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let u=Object.fromEntries(Object.entries(c).filter(([d])=>!o.includes(d)));Object.keys(u).length>0&&(yield u)}yield(await l).value;for await(let c of a)yield c}transform(e,n){return this._transformStreamWithConfig(e,this._transform.bind(this),n)}async stream(e,n){async function*r(){yield e}let o=fr(n),i=new lI({generator:this.transform(r(),o),config:o});return await i.setup,Yu.fromAsyncGenerator(i)}},o4e=class extends gr{constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e});super(e);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"keys");this.keys=e.keys}static lc_name(){return"RunnablePick"}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let n=this.keys.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0);return n.length===0?void 0:Object.fromEntries(n)}}async invoke(e,n){return this._callWithConfig(this._pick.bind(this),e,n)}async*_transform(e){for await(let n of e){let r=await this._pick(n);r!==void 0&&(yield r)}}transform(e,n){return this._transformStreamWithConfig(e,this._transform.bind(this),n)}async stream(e,n){async function*r(){yield e}let o=fr(n),i=new lI({generator:this.transform(r(),o),config:o});return await i.setup,Yu.fromAsyncGenerator(i)}},Kue=class extends fI{constructor(e){let n=Kc.from([$w.from(async r=>{let o;if(Db(r))try{o=await MT(this.schema,r.args)}catch{throw new S2("Received tool input did not match expected schema",JSON.stringify(r.args))}else o=r;return o}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:n,config:e.config??{}});I(this,"name");I(this,"description");I(this,"schema");this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var i4e=C(()=>{nc();zk();Wu();T2();D3();Bb();F3();I2();Dm();Ra()});var s4e,a4e=C(()=>{s4e=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"]});var l4e,c4e=C(()=>{l4e=["image","video","audio","text-plain","file"]});var iOt,u4e=C(()=>{a4e();c4e();iOt=["text","reasoning",...s4e,...l4e]});var Kr=C(()=>{$n();C2();gle();nc();R3();zk();Wu();T2();D3();Bb();F3();I2();Dm();i4e();u4e()});function Gue(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function Yue(t){return t!==void 0&&gr.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function Zue(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(jr(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 cp(t){return Zue(t)||Yue(t)||Gue(t)}var Jue=C(()=>{vg();Ra()});function aOt(t,e){let n=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Hr(t.schema),...n?.strict!==void 0?{strict:n.strict}:{}}}function Gb(t,e){let n=typeof e=="number"?void 0:e,r;return cp(t)?r={type:"function",function:aOt(t)}:r=t,n?.strict!==void 0&&(r.function.strict=n.strict),r}var pI=C(()=>{$n();Bu();Jue()});function zm(t,e){e?(La[0]=La[16]=La[1]=La[2]=La[3]=La[4]=La[5]=La[6]=La[7]=La[8]=La[9]=La[10]=La[11]=La[12]=La[13]=La[14]=La[15]=0,this.blocks=La):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=t}var Ft,lOt,Bm,r5,La,Xue,Que=C(()=>{Ft="0123456789abcdef".split(""),lOt=[-2147483648,8388608,32768,128],Bm=[24,16,8,0],r5=[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],La=[];zm.prototype.update=function(t){if(!this.finalized){var e,n=typeof t;if(n!=="string"){if(n==="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 r,o=0,i,s=t.length,a=this.blocks;o>>2]|=t[o]<>>2]|=r<>>2]|=(192|r>>>6)<>>2]|=(128|r&63)<=57344?(a[i>>>2]|=(224|r>>>12)<>>2]|=(128|r>>>6&63)<>>2]|=(128|r&63)<>>2]|=(240|r>>>18)<>>2]|=(128|r>>>12&63)<>>2]|=(128|r>>>6&63)<>>2]|=(128|r&63)<=64?(this.block=a[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}};zm.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=lOt[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()}};zm.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,l=this.blocks,c,u,d,f,p,m,h,g,y,w,v;for(c=16;c<64;++c)p=l[c-15],u=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=l[c-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,l[c]=l[c-16]+u+l[c-7]+d<<0;for(v=e&n,c=0;c<64;c+=4)this.first?(this.is224?(g=300032,p=l[0]-1413257819,a=p-150054599<<0,r=p+24177077<<0):(g=704751109,p=l[0]-210244248,a=p-1521486534<<0,r=p+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),g=t&e,f=g^t&n^v,h=o&i^~o&s,p=a+d+h+r5[c]+l[c],m=u+f,a=r+p<<0,r=p+m<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),y=r&t,f=y^r&e^g,h=s&a^~s&o,p=i+d+h+r5[c+1]+l[c+1],m=u+f,s=n+p<<0,n=p+m<<0,u=(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),w=n&r,f=w^n&t^y,h=i&s^~i&a,p=o+d+h+r5[c+2]+l[c+2],m=u+f,i=e+p<<0,e=p+m<<0,u=(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),v=e&n,f=v^e&r^w,h=i&s^~i&a,p=o+d+h+r5[c+3]+l[c+3],m=u+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+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+o<<0,this.h5=this.h5+i<<0,this.h6=this.h6+s<<0,this.h7=this.h7+a<<0};zm.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,l=Ft[t>>>28&15]+Ft[t>>>24&15]+Ft[t>>>20&15]+Ft[t>>>16&15]+Ft[t>>>12&15]+Ft[t>>>8&15]+Ft[t>>>4&15]+Ft[t&15]+Ft[e>>>28&15]+Ft[e>>>24&15]+Ft[e>>>20&15]+Ft[e>>>16&15]+Ft[e>>>12&15]+Ft[e>>>8&15]+Ft[e>>>4&15]+Ft[e&15]+Ft[n>>>28&15]+Ft[n>>>24&15]+Ft[n>>>20&15]+Ft[n>>>16&15]+Ft[n>>>12&15]+Ft[n>>>8&15]+Ft[n>>>4&15]+Ft[n&15]+Ft[r>>>28&15]+Ft[r>>>24&15]+Ft[r>>>20&15]+Ft[r>>>16&15]+Ft[r>>>12&15]+Ft[r>>>8&15]+Ft[r>>>4&15]+Ft[r&15]+Ft[o>>>28&15]+Ft[o>>>24&15]+Ft[o>>>20&15]+Ft[o>>>16&15]+Ft[o>>>12&15]+Ft[o>>>8&15]+Ft[o>>>4&15]+Ft[o&15]+Ft[i>>>28&15]+Ft[i>>>24&15]+Ft[i>>>20&15]+Ft[i>>>16&15]+Ft[i>>>12&15]+Ft[i>>>8&15]+Ft[i>>>4&15]+Ft[i&15]+Ft[s>>>28&15]+Ft[s>>>24&15]+Ft[s>>>20&15]+Ft[s>>>16&15]+Ft[s>>>12&15]+Ft[s>>>8&15]+Ft[s>>>4&15]+Ft[s&15];return this.is224||(l+=Ft[a>>>28&15]+Ft[a>>>24&15]+Ft[a>>>20&15]+Ft[a>>>16&15]+Ft[a>>>12&15]+Ft[a>>>8&15]+Ft[a>>>4&15]+Ft[a&15]),l};zm.prototype.toString=zm.prototype.hex;zm.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,o=this.h4,i=this.h5,s=this.h6,a=this.h7,l=[t>>>24&255,t>>>16&255,t>>>8&255,t&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255];return this.is224||l.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),l};zm.prototype.array=zm.prototype.digest;zm.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};Xue=(...t)=>new zm(!1,!0).update(t.join("")).hex()});var d4e=C(()=>{$n();Que()});var cOt,uOt,dOt,f4e,m4e=C(()=>{$n();Que();d4e();Dm();cOt=(...t)=>Xue(t.join("_")),uOt=class{constructor(){I(this,"keyEncoder",cOt)}makeDefaultKeyEncoder(t){this.keyEncoder=t}},dOt=new Map,f4e=class p4e extends uOt{constructor(n){super();I(this,"cache");this.cache=n??new Map}lookup(n,r){return Promise.resolve(this.cache.get(this.keyEncoder(n,r))??null)}async update(n,r,o){this.cache.set(this.keyEncoder(n,r),o)}static global(){return new p4e(dOt)}}});var ede,o5,i5,h4e,tU=C(()=>{$n();Rb();Bb();Dm();ede=class extends zu{},o5=class extends ede{constructor(e){super({value:e});I(this,"lc_namespace",["langchain_core","prompt_values"]);I(this,"lc_serializable",!0);I(this,"value");this.value=e}static lc_name(){return"StringPromptValue"}toString(){return this.value}toChatMessages(){return[new Zo(this.value)]}},i5=class extends ede{constructor(e){Array.isArray(e)&&(e={messages:e});super(e);I(this,"lc_namespace",["langchain_core","prompt_values"]);I(this,"lc_serializable",!0);I(this,"messages");this.messages=e.messages}static lc_name(){return"ChatPromptValue"}toString(){return ui(this.messages)}toChatMessages(){return this.messages}},h4e=class extends ede{constructor(e){"imageUrl"in e||(e={imageUrl:e});super(e);I(this,"lc_namespace",["langchain_core","prompt_values"]);I(this,"lc_serializable",!0);I(this,"imageUrl");I(this,"value");this.imageUrl=e.imageUrl}static lc_name(){return"ImagePromptValue"}toString(){return this.imageUrl.url}toChatMessages(){return[new Zo({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});function hOt(t,e){let n=Array.from({length:t.length},(r,o)=>({start:o,end:o+1}));for(;n.length>1;){let r=null;for(let o=0;oe.get(t.slice(n.start,n.end).join(","))).filter(n=>n!=null)}function yOt(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function nde(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 g4e,fOt,pOt,mOt,tde,s5,y4e=C(()=>{g4e=N(uee(),1),fOt=Object.defineProperty,pOt=(t,e,n)=>e in t?fOt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mOt=(t,e,n)=>(pOt(t,typeof e!="symbol"?e+"":e,n),n);tde=class{constructor(t,e){I(this,"specialTokens");I(this,"inverseSpecialTokens");I(this,"patStr");I(this,"textEncoder",new TextEncoder);I(this,"textDecoder",new TextDecoder("utf-8"));I(this,"rankMap",new Map);I(this,"textMap",new Map);this.patStr=t.pat_str;let n=t.bpe_ranks.split(` `).filter(Boolean).reduce((r,o)=>{let[i,s,...a]=o.split(" "),l=Number.parseInt(s,10);return a.forEach((c,u)=>r[c]=l+u),r},{});for(let[r,o]of Object.entries(n)){let i=g4e.default.toByteArray(r);this.rankMap.set(i.join(","),o),this.textMap.set(o,i)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((r,[o,i])=>(r[i]=this.textEncoder.encode(o),r),{})}encode(t,e=[],n="all"){let r=new RegExp(this.patStr,"ug"),o=tde.specialTokenRegex(Object.keys(this.specialTokens)),i=[],s=new Set(e==="all"?Object.keys(this.specialTokens):e),a=new Set(n==="all"?Object.keys(this.specialTokens).filter(c=>!s.has(c)):n);if(a.size>0){let c=tde.specialTokenRegex([...a]),u=t.match(c);if(u!=null)throw new Error(`The text contains a special token that is not allowed: ${u[0]}`)}let l=0;for(;;){let c=null,u=l;for(;o.lastIndex=u,c=o.exec(t),!(c==null||s.has(c[0]));)u=c.index+1;let d=c?.index??t.length;for(let p of t.substring(l,d).matchAll(r)){let m=this.textEncoder.encode(p[0]),h=this.rankMap.get(m.join(","));if(h!=null){i.push(h);continue}i.push(...gOt(m,this.rankMap))}if(c==null)break;let f=this.specialTokens[c[0]];i.push(f),l=c.index+c[0].length}return i}decode(t){let e=[],n=0;for(let i=0;inew RegExp(t.map(e=>yOt(e)).join("|"),"g"))});var w4e=C(()=>{y4e()});async function v4e(t){return t in a5||(a5[t]=wOt.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new s5(e)).catch(e=>{throw delete a5[t],e})),await a5[t]}async function x4e(t){return v4e(nde(t))}var a5,wOt,rde=C(()=>{$n();X2();w4e();a5={},wOt=new qb({})});function Rg(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 vOt,xOt,nU,mI,qd=C(()=>{$n();Dm();m4e();X2();Ra();tU();rde();vOt=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;xOt=()=>!1,nU=class extends gr{constructor(e){super(e);I(this,"verbose");I(this,"callbacks");I(this,"tags");I(this,"metadata");this.verbose=e.verbose??xOt(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.1.46")}get lc_attributes(){return{callbacks:void 0,verbose:void 0}}_addVersion(e,n){let r=this.metadata?.versions;this.metadata={...this.metadata,versions:{...typeof r=="object"&&r!==null?r:{},[e]:n}}}},mI=class extends nU{constructor({callbacks:e,callbackManager:n,...r}){let{cache:o,...i}=r;super({callbacks:e??n,...i});I(this,"caller");I(this,"cache");I(this,"_encoding");typeof o=="object"?this.cache=o:o?this.cache=f4e.global():this.cache=void 0,this.caller=new qb(r??{})}get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}async getNumTokens(e){let n;typeof e=="string"?n=e:n=e.map(o=>typeof o=="string"?o:o.type==="text"&&"text"in o?o.text:"").join("");let r=Math.ceil(n.length/4);if(!this._encoding)try{this._encoding=await x4e("modelName"in this?vOt(this.modelName):"gpt2")}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}if(this._encoding)try{r=this._encoding.encode(n).length}catch(o){console.warn("Failed to calculate number of tokens, falling back to approximate count",o)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new o5(e):Array.isArray(e)?new i5(e.map(Lm)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...n}){let r={...this._identifyingParams(),...n,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([o,i])=>i!==void 0).map(([o,i])=>`${o}:${JSON.stringify(i)}`).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{}}_filterInvocationParamsForTracing(e){let{tools:n,functions:r,messages:o,response_format:i,...s}=e;return s}}});function _Ot(t){return rc.isInstance(t)?t.role:t.type}function SOt(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 TOt(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 IOt(t,e){return e.map(n=>rp(n)?n.tool_calls??[]:[]).flat().find(n=>n.id===t.tool_call_id)?.name}function POt(t){return{providerName:"Google Gemini",fromStandardTextBlock(e){return{text:e.text}},fromStandardImageBlock(e){if(!t)throw new Error("This model does not support images");if(e.source_type==="url"){let n=Bc({dataUrl:e.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)},fromStandardAudioBlock(e){if(!t)throw new Error("This model does not support audio");if(e.source_type==="url"){let n=Bc({dataUrl:e.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)},fromStandardFileBlock(e){if(!t)throw new Error("This model does not support files");if(e.source_type==="text")return{text:e.text};if(e.source_type==="url"){let n=Bc({dataUrl:e.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:e.mime_type??"",fileUri:e.url}}}if(e.source_type==="base64")return{inlineData:{mimeType:e.mime_type??"",data:e.data}};throw new Error(`Unsupported source type: ${e.source_type}`)}}}function b4e(t,e){if(tc(t))return kw(t,POt(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 n;if(typeof t.image_url=="string")n=t.image_url;else if(typeof t.image_url=="object"&&"url"in t.image_url)n=t.image_url.url;else throw new Error("Please provide image as base64 encoded data URL");let[r,o]=n.split(",");if(!r.startsWith("data:"))throw new Error("Please provide image as base64 encoded data URL");let[i,s]=r.replace(/^data:/,"").split(";");if(s!=="base64")throw new Error("Please provide image as base64 encoded data URL");return{inlineData:{data:o,mimeType:i}}}else{if(t.type==="media")return TOt(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};if(t.type==="tool_call")return{functionCall:{name:t.name,args:t.args}};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 EOt(t,e,n,r){if(Ale(t)){let a=t.name??IOt(t,n);if(a===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 l=Array.isArray(t.content)?t.content.map(c=>b4e(c,e)).filter(c=>c!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:a,response:{error:{details:l}}}}]:[{functionResponse:{name:a,response:{result:l}}}]}let o=[],i=[];typeof t.content=="string"&&t.content&&i.push({text:t.content}),Array.isArray(t.content)&&i.push(...t.content.map(a=>b4e(a,e)).filter(a=>a!==void 0));let s=t.additional_kwargs?.[ode];return rp(t)&&t.tool_calls?.length&&(o=t.tool_calls.map(a=>{let l=COt(()=>{if(a.id){let c=s?.[a.id];if(c)return c}return r?.includes("gemini-3")?bOt:""});return{functionCall:{name:a.name,args:a.args},...l?{thoughtSignature:l}:{}}})),[...i,...o]}function ide(t,e,n=!1,r){return t.reduce((o,i,s)=>{if(!np(i))throw new Error("Unsupported message input");let a=_Ot(i);if(a==="system"&&s!==0)throw new Error("System message should be the first one");let l=SOt(a),c=o.content[o.content.length];if(!o.mergeWithPreviousContent&&c&&c.role===l)throw new Error("Google Generative AI requires alternate messages between authors");let u=EOt(i,e,t.slice(0,s),r);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(...u),{mergeWithPreviousContent:!1,content:o.content}}let d=l;(d==="function"||d==="system"&&!n)&&(d="user");let f={role:d,parts:u};return{mergeWithPreviousContent:a==="system"&&!n,content:[...o.content,f]}},{content:[],mergeWithPreviousContent:!1}).content}function C4e(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let[n]=t.candidates,{content:r,...o}=n,i=r.parts?.reduce((u,d)=>("functionCall"in d&&d.functionCall&&u.push({...d,id:"id"in d.functionCall&&typeof d.functionCall.id=="string"?d.functionCall.id:si()}),u),[]),s,a=r?.parts;Array.isArray(a)&&a.length===1&&"text"in a[0]&&a[0].text&&!a[0].thought?s=a[0].text:Array.isArray(a)&&a.length>0?s=a.map(u=>u.thought&&"text"in u&&u.text?{type:"thinking",thinking:u.text,...u.thoughtSignature?{signature:u.thoughtSignature}:{}}:"text"in u?{type:"text",text:u.text}:"inlineData"in u?{type:"inlineData",inlineData:u.inlineData}:"functionCall"in u?{type:"functionCall",functionCall:u.functionCall}:"functionResponse"in u?{type:"functionResponse",functionResponse:u.functionResponse}:"fileData"in u?{type:"fileData",fileData:u.fileData}:"executableCode"in u?{type:"executableCode",executableCode:u.executableCode}:"codeExecutionResult"in u?{type:"codeExecutionResult",codeExecutionResult:u.codeExecutionResult}:u):s=[];let l=i?.reduce((u,d)=>("thoughtSignature"in d&&typeof d.thoughtSignature=="string"&&(u[d.id]=d.thoughtSignature),u),{}),c="";return typeof s=="string"?c=s:Array.isArray(s)&&s.length>0&&(c=s.find(u=>"text"in u)?.text??c),{generations:[{text:c,message:new kn({content:s??"",tool_calls:i?.map(u=>({type:"tool_call",id:u.id,name:u.functionCall.name,args:u.functionCall.args})),additional_kwargs:{...o,[ode]:l},usage_metadata:e?.usageMetadata}),generationInfo:o}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function _4e(t,e){if(!t.candidates||t.candidates.length===0)return null;let[n]=t.candidates,{content:r,...o}=n,i=r.parts?.reduce((d,f)=>("functionCall"in f&&f.functionCall&&d.push({...f,id:"id"in f.functionCall&&typeof f.functionCall.id=="string"?f.functionCall.id:si()}),d),[]),s,a=r?.parts;Array.isArray(a)&&a.every(d=>"text"in d&&!d.thought)?s=a.map(d=>d.text).join(""):Array.isArray(a)?s=a.map(d=>d.thought&&"text"in d&&d.text?{type:"thinking",thinking:d.text,...d.thoughtSignature?{signature:d.thoughtSignature}:{}}:"text"in d?{type:"text",text:d.text}:"inlineData"in d?{type:"inlineData",inlineData:d.inlineData}:"functionCall"in d?{type:"functionCall",functionCall:d.functionCall}:"functionResponse"in d?{type:"functionResponse",functionResponse:d.functionResponse}:"fileData"in d?{type:"fileData",fileData:d.fileData}:"executableCode"in d?{type:"executableCode",executableCode:d.executableCode}:"codeExecutionResult"in d?{type:"codeExecutionResult",codeExecutionResult:d.codeExecutionResult}:d):s=[];let l="";s&&typeof s=="string"?l=s:Array.isArray(s)&&(l=s.find(d=>"text"in d)?.text??"");let c=[];i&&c.push(...i.map(d=>({type:"tool_call_chunk",id:d.id,name:d.functionCall.name,args:JSON.stringify(d.functionCall.args)})));let u=i?.reduce((d,f)=>("thoughtSignature"in f&&typeof f.thoughtSignature=="string"&&(d[f.id]=f.thoughtSignature),d),{});return new Jr({text:l,message:new Yt({content:s||"",name:r?r.role:void 0,tool_call_chunks:c,additional_kwargs:{[ode]:u},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:o})}function S4e(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(cp(e)){let n=v2(e.schema);return n.type==="object"&&"properties"in n&&Object.keys(n.properties).length===0?{name:e.name,description:e.description}:(YT(n,e.name),{name:e.name,description:e.description,parameters:n})}if(Rg(e)){let n=z$e(e.function.parameters);return YT(n,e.function.name),{name:e.function.name,description:e.function.description??"A function available to call.",parameters:n}}return e})}]}function sde(t,e){let n={input_tokens:t?.promptTokenCount??0,output_tokens:t?.candidatesTokenCount??0,total_tokens:t?.totalTokenCount??0};if(t?.cachedContentTokenCount&&(n.input_token_details??(n.input_token_details={}),n.input_token_details.cache_read=t.cachedContentTokenCount),e==="gemini-3-pro-preview"){let r=Math.max(0,t?.promptTokenCount??-2e5),o=Math.max(0,t?.cachedContentTokenCount??-2e5);r&&(n.input_token_details={...n.input_token_details,over_200k:r}),o&&(n.input_token_details={...n.input_token_details,cache_read_over_200k:o})}return n}var ode,bOt,COt,ade=C(()=>{E3();j$e();Kr();ac();pI();qd();qh();ode="__gemini_function_call_thought_signatures__",bOt="ErYCCrMCAdHtim9kOoOkrPiCNVsmlpMIKd7ZMxgiFbVQOkgp7nlLcDMzVsZwIzvuT7nQROivoXA72ccC2lSDvR0Gh7dkWaGuj7ctv6t7ZceHnecx0QYa+ix8tYpRfjhyWozQ49lWiws6+YGjCt10KRTyWsZ2h6O7iHTYJwKIRwGUHRKy/qK/6kFxJm5ML00gLq4D8s5Z6DBpp2ZlR+uF4G8jJgeWQgyHWVdx2wGYElaceVAc66tZdPQRdOHpWtgYSI1YdaXgVI8KHY3/EfNc2YqqMIulvkDBAnuMhkAjV9xmBa54Tq+ih3Im4+r3DzqhGqYdsSkhS0kZMwte4Hjs65dZzCw9lANxIqYi1DJ639WNPYihp/DCJCos7o+/EeSPJaio5sgWDyUnMGkY1atsJZ+m7pj7DD5tvQ==",COt=t=>t()});var xl,l5=C(()=>{Ng();Og();Ra();xl=class extends gr{constructor(e){super(e);I(this,"lc_namespace",["langchain_core","runnables"]);I(this,"lc_serializable",!0);I(this,"func");e&&(this.func=e.func)}static lc_name(){return"RunnablePassthrough"}async invoke(e,n){let r=fr(n);return this.func&&await this.func(e,r),this._callWithConfig(o=>Promise.resolve(o),e,r)}async*transform(e,n){let r=fr(n),o,i=!0;for await(let s of this._transformStreamWithConfig(e,a=>a,r))if(yield s,i)if(o===void 0)o=s;else try{o=Um(o,s)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,r)}static assign(e){return new n5(new sM({steps:e}))}}});var T4e=C(()=>{Ng();Ra()});var I4e=C(()=>{Ng();Og();Ra()});var P4e=C(()=>{nc();Wu();Bb();Ra();Kr();l5()});var jm=C(()=>{$n();Ng();rM();Ra();l5();T4e();I4e();P4e()});var aM,Fw,lc,hI=C(()=>{JT();Ra();jm();aM=class extends gr{parseResultWithPrompt(t,e,n){return this.parseResult(t,n)}_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(n,r)=>this.parseResult([{text:n}],r?.callbacks),t,{...e,runType:"parser"}):this._callWithConfig(async(n,r)=>this.parseResult([{message:n,text:this._baseMessageToString(n)}],r?.callbacks),t,{...e,runType:"parser"})}},Fw=class extends aM{parseResult(t,e){return this.parse(t[0].text,e)}async parseWithPrompt(t,e,n){return this.parse(t,n)}_type(){throw new Error("_type not implemented")}},lc=class extends Error{constructor(e,n,r,o=!1){super(e);I(this,"llmOutput");I(this,"observation");I(this,"sendToLLM");if(this.llmOutput=n,this.observation=r,this.sendToLLM=o,o&&(r===void 0||n===void 0))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");Lb(this,"OUTPUT_PARSING_FAILURE")}}});var rU,lM,Yb=C(()=>{nc();Dm();ac();hI();P3();rU=class extends Fw{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"})}},lM=class extends rU{constructor(e){super(e);I(this,"diff",!1);this.diff=e?.diff??this.diff}async*_transform(e){let n,r;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(O3(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Jr({message:o,text:o.content})}else if(np(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Jr({message:B3(o),text:o.content})}else i=new Lw({text:o});r===void 0?r=i:r=r.concat(i);let s=await this.parsePartialResult([r]);s!=null&&!Pw(s,n)&&(this.diff?yield this._diff(n,s):yield s,n=s)}}getFormatInstructions(){return""}}});var E4e=C(()=>{Yb()});var A4e=C(()=>{hI();Yb()});var k4e=C(()=>{Yb()});var lde=C(()=>{$n();Y2();Z2();Rue()});var Gd,oU=C(()=>{Wk();Z2();Yb();lde();Gd=class extends lM{constructor(){super(...arguments);I(this,"lc_namespace",["langchain_core","output_parsers"]);I(this,"lc_serializable",!0)}static lc_name(){return"JsonOutputParser"}_concatOutputChunks(e,n){return this.diff?super._concatOutputChunks(e,n):n}_diff(e,n){if(n)return e?YK(e,n):[{op:"replace",path:"",value:n}]}async parsePartialResult(e){return jk(e[0].text)}async parse(e){return jk(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}}});var cde,ude=C(()=>{Wk();hI();oU();cde=class extends Fw{constructor(e){super();I(this,"lc_namespace",["langchain","output_parsers","standard_schema"]);I(this,"schema");this.schema=e}static lc_name(){return"StandardSchemaOutputParser"}static fromSerializableSchema(e){return new this(e)}async parse(e){try{let n=jk(e,JSON.parse),r=await this.schema["~standard"].validate(n);if(r.issues)throw new Error(`Validation failed: ${JSON.stringify(r.issues)}`);return r.value}catch(n){throw new lc(`Failed to parse. Text: "${e}". Error: ${n}`,e)}}_baseMessageToString(e){return e.text}getFormatInstructions(){return""}}});var Vm,dde=C(()=>{vg();Bu();hI();_g();Vm=class extends Fw{constructor(e){super(e);I(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 n=we.object(Object.fromEntries(Object.entries(e).map(([r,o])=>[r,we.string().describe(o)])));return new this(n)}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(Hr(this.schema))} \`\`\` `}async parse(e){try{let n=e.trim(),r=(n.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||n.match(/```json\s*([\s\S]*?)```/)?.[1]||n).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(o,i)=>`"${i.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await MT(this.schema,JSON.parse(r))}catch(n){throw new lc(`Failed to parse. Text: "${e}". Error: ${n}`,e)}}_baseMessageToString(e){return e.text}}});var AOt,kOt,M4e=C(()=>{AOt=function(){let t={};t.parser=function(M,E){return new n(M,E)},t.SAXParser=n,t.SAXStream=c,t.createStream=l,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 n(M,E){if(!(this instanceof n))return new n(M,E);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=E||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!M,R.noscript=!!(M||R.opt.noscript),R.state=S.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(m)),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),A(R,"onready")}Object.create||(Object.create=function(M){function E(){}return E.prototype=M,new E}),Object.keys||(Object.keys=function(M){var E=[];for(var R in M)M.hasOwnProperty(R)&&E.push(R);return E});function r(M){for(var E=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,L=0,K=e.length;LE)switch(e[L]){case"textNode":D(M);break;case"cdata":O(M,"oncdata",M.cdata),M.cdata="";break;case"script":O(M,"onscript",M.script),M.script="";break;default:B(M,"Max buffer length exceeded: "+e[L])}R=Math.max(R,Y)}M.bufferCheckPosition=t.MAX_BUFFER_LENGTH-R+M.position}function o(M){for(var E=0,R=e.length;E"||v(M)}function _(M,E){return M.test(E)}function T(M,E){return!_(M,E)}var S=0;t.STATE={BEGIN:S++,BEGIN_WHITESPACE:S++,TEXT:S++,TEXT_ENTITY:S++,OPEN_WAKA:S++,SGML_DECL:S++,SGML_DECL_QUOTED:S++,DOCTYPE:S++,DOCTYPE_QUOTED:S++,DOCTYPE_DTD:S++,DOCTYPE_DTD_QUOTED:S++,COMMENT_STARTING:S++,COMMENT:S++,COMMENT_ENDING:S++,COMMENT_ENDED:S++,CDATA:S++,CDATA_ENDING:S++,CDATA_ENDING_2:S++,PROC_INST:S++,PROC_INST_BODY:S++,PROC_INST_ENDING:S++,OPEN_TAG:S++,OPEN_TAG_SLASH:S++,ATTRIB:S++,ATTRIB_NAME:S++,ATTRIB_NAME_SAW_WHITE:S++,ATTRIB_VALUE:S++,ATTRIB_VALUE_QUOTED:S++,ATTRIB_VALUE_CLOSED:S++,ATTRIB_VALUE_UNQUOTED:S++,ATTRIB_VALUE_ENTITY_Q:S++,ATTRIB_VALUE_ENTITY_U:S++,CLOSE_TAG:S++,CLOSE_TAG_SAW_WHITE:S++,SCRIPT:S++,SCRIPT_ENDING:S++},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(M){var E=t.ENTITIES[M],R=typeof E=="number"?String.fromCharCode(E):E;t.ENTITIES[M]=R});for(var P in t.STATE)t.STATE[t.STATE[P]]=P;S=t.STATE;function A(M,E,R){M[E]&&M[E](R)}function O(M,E,R){M.textNode&&D(M),A(M,E,R)}function D(M){M.textNode=$(M.opt,M.textNode),M.textNode&&A(M,"ontext",M.textNode),M.textNode=""}function $(M,E){return M.trim&&(E=E.trim()),M.normalize&&(E=E.replace(/\s+/g," ")),E}function B(M,E){return D(M),M.trackPosition&&(E+=` Line: `+M.line+` Column: `+M.column+` Char: `+M.c),E=new Error(E),M.error=E,A(M,"onerror",E),M}function W(M){return M.sawRoot&&!M.closedRoot&&F(M,"Unclosed root tag"),M.state!==S.BEGIN&&M.state!==S.BEGIN_WHITESPACE&&M.state!==S.TEXT&&B(M,"Unexpected end"),D(M),M.c="",M.closed=!0,A(M,"onend"),n.call(M,M.strict,M.opt),M}function F(M,E){if(typeof M!="object"||!(M instanceof n))throw new Error("bad call to strictFail");M.strict&&B(M,E)}function Z(M){M.strict||(M.tagName=M.tagName[M.looseCase]());var E=M.tags[M.tags.length-1]||M,R=M.tag={name:M.tagName,attributes:{}};M.opt.xmlns&&(R.ns=E.ns),M.attribList.length=0,O(M,"onopentagstart",R)}function V(M,E){var R=M.indexOf(":")<0?["",M]:M.split(":"),L=R[0],K=R[1];return E&&M==="xmlns"&&(L="xmlns",K=""),{prefix:L,local:K}}function H(M){if(M.strict||(M.attribName=M.attribName[M.looseCase]()),M.attribList.indexOf(M.attribName)!==-1||M.tag.attributes.hasOwnProperty(M.attribName)){M.attribName=M.attribValue="";return}if(M.opt.xmlns){var E=V(M.attribName,!0),R=E.prefix,L=E.local;if(R==="xmlns")if(L==="xml"&&M.attribValue!==f)F(M,"xml: prefix must be bound to "+f+` Actual: `+M.attribValue);else if(L==="xmlns"&&M.attribValue!==p)F(M,"xmlns: prefix must be bound to "+p+` Actual: `+M.attribValue);else{var K=M.tag,Y=M.tags[M.tags.length-1]||M;K.ns===Y.ns&&(K.ns=Object.create(Y.ns)),K.ns[L]=M.attribValue}M.attribList.push([M.attribName,M.attribValue])}else M.tag.attributes[M.attribName]=M.attribValue,O(M,"onattribute",{name:M.attribName,value:M.attribValue});M.attribName=M.attribValue=""}function te(M,E){if(M.opt.xmlns){var R=M.tag,L=V(M.tagName);R.prefix=L.prefix,R.local=L.local,R.uri=R.ns[L.prefix]||"",R.prefix&&!R.uri&&(F(M,"Unbound namespace prefix: "+JSON.stringify(M.tagName)),R.uri=L.prefix);var K=M.tags[M.tags.length-1]||M;R.ns&&K.ns!==R.ns&&Object.keys(R.ns).forEach(function(Ln){O(M,"onopennamespace",{prefix:Ln,uri:R.ns[Ln]})});for(var Y=0,re=M.attribList.length;Y",M.tagName="",M.state=S.SCRIPT;return}O(M,"onscript",M.script),M.script=""}var E=M.tags.length,R=M.tagName;M.strict||(R=R[M.looseCase]());for(var L=R;E--&&M.tags[E].name!==L;)F(M,"Unexpected close tag");if(E<0){F(M,"Unmatched closing tag: "+M.tagName),M.textNode+="",M.state=S.TEXT;return}M.tagName=R;for(var K=M.tags.length;K-- >E;){var Y=M.tag=M.tags.pop();M.tagName=M.tag.name,O(M,"onclosetag",M.tagName);var re={};for(var ae in Y.ns)re[ae]=Y.ns[ae];var ve=M.tags[M.tags.length-1]||M;M.opt.xmlns&&Y.ns!==ve.ns&&Object.keys(Y.ns).forEach(function(Te){var Ee=Y.ns[Te];O(M,"onclosenamespace",{prefix:Te,uri:Ee})})}E===0&&(M.closedRoot=!0),M.tagName=M.attribValue=M.attribName="",M.attribList.length=0,M.state=S.TEXT}function me(M){var E=M.entity,R=E.toLowerCase(),L,K="";return M.ENTITIES[E]?M.ENTITIES[E]:M.ENTITIES[R]?M.ENTITIES[R]:(E=R,E.charAt(0)==="#"&&(E.charAt(1)==="x"?(E=E.slice(2),L=parseInt(E,16),K=L.toString(16)):(E=E.slice(1),L=parseInt(E,10),K=L.toString(10))),E=E.replace(/^0+/,""),isNaN(L)||K.toLowerCase()!==E?(F(M,"Invalid character entity"),"&"+M.entity+";"):String.fromCodePoint(L))}function j(M,E){E==="<"?(M.state=S.OPEN_WAKA,M.startTagPosition=M.position):v(E)||(F(M,"Non-whitespace before first tag."),M.textNode=E,M.state=S.TEXT)}function G(M,E){var R="";return E"?(O(E,"onsgmldeclaration",E.sgmlDecl),E.sgmlDecl="",E.state=S.TEXT):(x(L)&&(E.state=S.SGML_DECL_QUOTED),E.sgmlDecl+=L);continue;case S.SGML_DECL_QUOTED:L===E.q&&(E.state=S.SGML_DECL,E.q=""),E.sgmlDecl+=L;continue;case S.DOCTYPE:L===">"?(E.state=S.TEXT,O(E,"ondoctype",E.doctype),E.doctype=!0):(E.doctype+=L,L==="["?E.state=S.DOCTYPE_DTD:x(L)&&(E.state=S.DOCTYPE_QUOTED,E.q=L));continue;case S.DOCTYPE_QUOTED:E.doctype+=L,L===E.q&&(E.q="",E.state=S.DOCTYPE);continue;case S.DOCTYPE_DTD:E.doctype+=L,L==="]"?E.state=S.DOCTYPE:x(L)&&(E.state=S.DOCTYPE_DTD_QUOTED,E.q=L);continue;case S.DOCTYPE_DTD_QUOTED:E.doctype+=L,L===E.q&&(E.state=S.DOCTYPE_DTD,E.q="");continue;case S.COMMENT:L==="-"?E.state=S.COMMENT_ENDING:E.comment+=L;continue;case S.COMMENT_ENDING:L==="-"?(E.state=S.COMMENT_ENDED,E.comment=$(E.opt,E.comment),E.comment&&O(E,"oncomment",E.comment),E.comment=""):(E.comment+="-"+L,E.state=S.COMMENT);continue;case S.COMMENT_ENDED:L!==">"?(F(E,"Malformed comment"),E.comment+="--"+L,E.state=S.COMMENT):E.state=S.TEXT;continue;case S.CDATA:L==="]"?E.state=S.CDATA_ENDING:E.cdata+=L;continue;case S.CDATA_ENDING:L==="]"?E.state=S.CDATA_ENDING_2:(E.cdata+="]"+L,E.state=S.CDATA);continue;case S.CDATA_ENDING_2:L===">"?(E.cdata&&O(E,"oncdata",E.cdata),O(E,"onclosecdata"),E.cdata="",E.state=S.TEXT):L==="]"?E.cdata+="]":(E.cdata+="]]"+L,E.state=S.CDATA);continue;case S.PROC_INST:L==="?"?E.state=S.PROC_INST_ENDING:v(L)?E.state=S.PROC_INST_BODY:E.procInstName+=L;continue;case S.PROC_INST_BODY:if(!E.procInstBody&&v(L))continue;L==="?"?E.state=S.PROC_INST_ENDING:E.procInstBody+=L;continue;case S.PROC_INST_ENDING:L===">"?(O(E,"onprocessinginstruction",{name:E.procInstName,body:E.procInstBody}),E.procInstName=E.procInstBody="",E.state=S.TEXT):(E.procInstBody+="?"+L,E.state=S.PROC_INST_BODY);continue;case S.OPEN_TAG:_(g,L)?E.tagName+=L:(Z(E),L===">"?te(E):L==="/"?E.state=S.OPEN_TAG_SLASH:(v(L)||F(E,"Invalid character in tag name"),E.state=S.ATTRIB));continue;case S.OPEN_TAG_SLASH:L===">"?(te(E,!0),fe(E)):(F(E,"Forward-slash in opening tag not followed by >"),E.state=S.ATTRIB);continue;case S.ATTRIB:if(v(L))continue;L===">"?te(E):L==="/"?E.state=S.OPEN_TAG_SLASH:_(h,L)?(E.attribName=L,E.attribValue="",E.state=S.ATTRIB_NAME):F(E,"Invalid attribute name");continue;case S.ATTRIB_NAME:L==="="?E.state=S.ATTRIB_VALUE:L===">"?(F(E,"Attribute without value"),E.attribValue=E.attribName,H(E),te(E)):v(L)?E.state=S.ATTRIB_NAME_SAW_WHITE:_(g,L)?E.attribName+=L:F(E,"Invalid attribute name");continue;case S.ATTRIB_NAME_SAW_WHITE:if(L==="=")E.state=S.ATTRIB_VALUE;else{if(v(L))continue;F(E,"Attribute without value"),E.tag.attributes[E.attribName]="",E.attribValue="",O(E,"onattribute",{name:E.attribName,value:""}),E.attribName="",L===">"?te(E):_(h,L)?(E.attribName=L,E.state=S.ATTRIB_NAME):(F(E,"Invalid attribute name"),E.state=S.ATTRIB)}continue;case S.ATTRIB_VALUE:if(v(L))continue;x(L)?(E.q=L,E.state=S.ATTRIB_VALUE_QUOTED):(F(E,"Unquoted attribute value"),E.state=S.ATTRIB_VALUE_UNQUOTED,E.attribValue=L);continue;case S.ATTRIB_VALUE_QUOTED:if(L!==E.q){L==="&"?E.state=S.ATTRIB_VALUE_ENTITY_Q:E.attribValue+=L;continue}H(E),E.q="",E.state=S.ATTRIB_VALUE_CLOSED;continue;case S.ATTRIB_VALUE_CLOSED:v(L)?E.state=S.ATTRIB:L===">"?te(E):L==="/"?E.state=S.OPEN_TAG_SLASH:_(h,L)?(F(E,"No whitespace between attributes"),E.attribName=L,E.attribValue="",E.state=S.ATTRIB_NAME):F(E,"Invalid attribute name");continue;case S.ATTRIB_VALUE_UNQUOTED:if(!b(L)){L==="&"?E.state=S.ATTRIB_VALUE_ENTITY_U:E.attribValue+=L;continue}H(E),L===">"?te(E):E.state=S.ATTRIB;continue;case S.CLOSE_TAG:if(E.tagName)L===">"?fe(E):_(g,L)?E.tagName+=L:E.script?(E.script+=""?fe(E):F(E,"Invalid characters in closing tag");continue;case S.TEXT_ENTITY:case S.ATTRIB_VALUE_ENTITY_Q:case S.ATTRIB_VALUE_ENTITY_U:var re,ae;switch(E.state){case S.TEXT_ENTITY:re=S.TEXT,ae="textNode";break;case S.ATTRIB_VALUE_ENTITY_Q:re=S.ATTRIB_VALUE_QUOTED,ae="attribValue";break;case S.ATTRIB_VALUE_ENTITY_U:re=S.ATTRIB_VALUE_UNQUOTED,ae="attribValue";break}if(L===";")if(E.opt.unparsedEntities){var ve=me(E);E.entity="",E.state=re,E.write(ve)}else E[ae]+=me(E),E.entity="",E.state=re;else _(E.entity.length?w:y,L)?E.entity+=L:(F(E,"Invalid character in entity name"),E[ae]+="&"+E.entity+L,E.entity="",E.state=re);continue;default:throw new Error(E,"Unknown state: "+E.state)}return E.position>=E.bufferCheckPosition&&r(E),E}return String.fromCodePoint||function(){var M=String.fromCharCode,E=Math.floor,R=function(){var L=16384,K=[],Y,re,ae=-1,ve=arguments.length;if(!ve)return"";for(var Te="";++ae1114111||E(Ee)!==Ee)throw RangeError("Invalid code point: "+Ee);Ee<=65535?K.push(Ee):(Ee-=65536,Y=(Ee>>10)+55296,re=Ee%1024+56320,K.push(Y,re)),(ae+1===ve||K.length>L)&&(Te+=M.apply(null,K),K.length=0)}return Te};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R}(),t},kOt=AOt()});var N4e=C(()=>{Z2();Yb();lde();M4e()});var Uw=C(()=>{$n();Wk();hI();Yb();E4e();A4e();k4e();oU();ude();dde();N4e()});var fde,O4e=C(()=>{Bd();Uw();fde=class extends aM{constructor(e){super(e);I(this,"lc_namespace",["langchain","google_genai","output_parsers"]);I(this,"returnId",!1);I(this,"keyName");I(this,"returnSingle",!1);I(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 n=await kT(this.zodSchema,e);if(n.success)return n.data;throw new lc(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error.issues)}`,JSON.stringify(e,null,2))}async parseResult(e){let n=e.flatMap(o=>{let{message:i}=o;return!("tool_calls"in i)||!Array.isArray(i.tool_calls)?[]:i.tool_calls});if(n[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[r]=n;return await this._validateResult(r.args)}}});function LOt(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${ROt}/${OOt}`),e.join(" ")}async function DOt(t){var e;let n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",LOt(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let r=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(r){if(!(r instanceof Headers))try{r=new Headers(r)}catch(o){throw new Lg(`unable to convert customHeaders value ${JSON.stringify(r)} to Headers: ${o.message}`)}for(let[o,i]of r.entries()){if(o==="x-goog-api-key")throw new Lg(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new Lg(`Header name ${o} can only be set using the apiClient field`);n.append(o,i)}}return n}async function $Ot(t,e,n,r,o,i){let s=new pde(t,e,n,r,i);return{url:s.toString(),fetchOptions:Object.assign(Object.assign({},zOt(i)),{method:"POST",headers:await DOt(s),body:o})}}async function lU(t,e,n,r,o,i={},s=fetch){let{url:a,fetchOptions:l}=await $Ot(t,e,n,r,o,i);return FOt(a,l,s)}async function FOt(t,e,n=fetch){let r;try{r=await n(t,e)}catch(o){UOt(o,t)}return r.ok||await BOt(r,t),r}function UOt(t,e){let n=t;throw n.name==="AbortError"?(n=new d5(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof u5||t instanceof Lg||(n=new Da(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function BOt(t,e){let n="",r;try{let o=await t.json();n=o.error.message,o.error.details&&(n+=` ${JSON.stringify(o.error.details)}`,r=o.error.details)}catch{}throw new u5(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,r)}function zOt(t){let e={};if(t?.signal!==void 0||t?.timeout>=0){let n=new AbortController;t?.timeout>=0&&setTimeout(()=>n.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}function hde(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.`),c5(t.candidates[0]))throw new Zb(`${Jb(t)}`,t);return jOt(t)}else if(t.promptFeedback)throw new Zb(`Text not available. ${Jb(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.`),c5(t.candidates[0]))throw new Zb(`${Jb(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),W4e(t)[0]}else if(t.promptFeedback)throw new Zb(`Function call not available. ${Jb(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.`),c5(t.candidates[0]))throw new Zb(`${Jb(t)}`,t);return W4e(t)}else if(t.promptFeedback)throw new Zb(`Function call not available. ${Jb(t)}`,t)},t}function jOt(t){var e,n,r,o;let i=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(let s of(o=(r=t.candidates)===null||r===void 0?void 0:r[0].content)===null||o===void 0?void 0:o.parts)s.text&&i.push(s.text),s.executableCode&&i.push("\n```"+s.executableCode.language+` `+s.executableCode.code+"\n```\n"),s.codeExecutionResult&&i.push("\n```\n"+s.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function W4e(t){var e,n,r,o;let i=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(let s of(o=(r=t.candidates)===null||r===void 0?void 0:r[0].content)===null||o===void 0?void 0:o.parts)s.functionCall&&i.push(s.functionCall);if(i.length>0)return i}function c5(t){return!!t.finishReason&&VOt.includes(t.finishReason)}function Jb(t){var e,n,r;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}`),!((n=t.promptFeedback)===null||n===void 0)&&n.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((r=t.candidates)===null||r===void 0)&&r[0]){let i=t.candidates[0];c5(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function sU(t){return this instanceof sU?(this.v=t,this):new sU(t)}function WOt(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(f){r[f]&&(o[f]=function(p){return new Promise(function(m,h){i.push([f,p,m,h])>1||a(f,p)})})}function a(f,p){try{l(r[f](p))}catch(m){d(i[0][3],m)}}function l(f){f.value instanceof sU?Promise.resolve(f.value.v).then(c,u):d(i[0][2],f)}function c(f){a("next",f)}function u(f){a("throw",f)}function d(f,p){f(p),i.shift(),i.length&&a(i[0][0],i[0][1])}}function HOt(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),n=GOt(e),[r,o]=n.tee();return{stream:qOt(r),response:KOt(o)}}async function KOt(t){let e=[],n=t.getReader();for(;;){let{done:r,value:o}=await n.read();if(r)return hde(YOt(e));e.push(o)}}function qOt(t){return WOt(this,arguments,function*(){let n=t.getReader();for(;;){let{value:r,done:o}=yield sU(n.read());if(o)break;yield yield sU(hde(r))}})}function GOt(t){let e=t.getReader();return new ReadableStream({start(r){let o="";return i();function i(){return e.read().then(({value:s,done:a})=>{if(a){if(o.trim()){r.error(new Da("Failed to parse stream"));return}r.close();return}o+=s;let l=o.match(H4e),c;for(;l;){try{c=JSON.parse(l[1])}catch{r.error(new Da(`Error parsing JSON response: "${l[1]}"`));return}r.enqueue(c),o=o.substring(l[0].length),l=o.match(H4e)}return i()}).catch(s=>{let a=s;throw a.stack=s.stack,a.name==="AbortError"?a=new d5("Request aborted when reading from the stream"):a=new Da("Error reading from the stream"),a})}}})}function YOt(t){let e=t[t.length-1],n={promptFeedback:e?.promptFeedback};for(let r of t){if(r.candidates){let o=0;for(let i of r.candidates)if(n.candidates||(n.candidates=[]),n.candidates[o]||(n.candidates[o]={index:o}),n.candidates[o].citationMetadata=i.citationMetadata,n.candidates[o].groundingMetadata=i.groundingMetadata,n.candidates[o].finishReason=i.finishReason,n.candidates[o].finishMessage=i.finishMessage,n.candidates[o].safetyRatings=i.safetyRatings,i.content&&i.content.parts){n.candidates[o].content||(n.candidates[o].content={role:i.content.role||"user",parts:[]});let s={};for(let a of i.content.parts)a.text&&(s.text=a.text),a.functionCall&&(s.functionCall=a.functionCall),a.executableCode&&(s.executableCode=a.executableCode),a.codeExecutionResult&&(s.codeExecutionResult=a.codeExecutionResult),Object.keys(s).length===0&&(s.text=""),n.candidates[o].content.parts.push(s)}o++}r.usageMetadata&&(n.usageMetadata=r.usageMetadata)}return n}async function Z4e(t,e,n,r){let o=await lU(e,yI.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(n),r);return HOt(o)}async function J4e(t,e,n,r){let i=await(await lU(e,yI.GENERATE_CONTENT,t,!1,JSON.stringify(n),r)).json();return{response:hde(i)}}function X4e(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 aU(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(let n of t)typeof n=="string"?e.push({text:n}):e.push(n);return ZOt(e)}function ZOt(t){let e={role:"user",parts:[]},n={role:"function",parts:[]},r=!1,o=!1;for(let i of t)"functionResponse"in i?(n.parts.push(i),o=!0):(e.parts.push(i),r=!0);if(r&&o)throw new Da("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!r&&!o)throw new Da("No content is provided for sending chat message.");return r?e:n}function JOt(t,e){var n;let r={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(n=e?.cachedContent)===null||n===void 0?void 0:n.name,contents:[]},o=t.generateContentRequest!=null;if(t.contents){if(o)throw new Lg("CountTokensRequest must have one of contents or generateContentRequest, not both.");r.contents=t.contents}else if(o)r=Object.assign(Object.assign({},r),t.generateContentRequest);else{let i=aU(t);r.contents=[i]}return{generateContentRequest:r}}function K4e(t){let e;return t.contents?e=t:e={contents:[aU(t)]},t.systemInstruction&&(e.systemInstruction=X4e(t.systemInstruction)),e}function XOt(t){return typeof t=="string"||Array.isArray(t)?{content:aU(t)}:t}function eRt(t){let e=!1;for(let n of t){let{role:r,parts:o}=n;if(!e&&r!=="user")throw new Da(`First content should be with role 'user', got ${r}`);if(!$4e.includes(r))throw new Da(`Each item should include role field. Got ${r} but valid roles are: ${JSON.stringify($4e)}`);if(!Array.isArray(o))throw new Da("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new Da("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 a of o)for(let l of q4e)l in a&&(i[l]+=1);let s=QOt[r];for(let a of q4e)if(!s.includes(a)&&i[a]>0)throw new Da(`Content with role '${r}' can't contain '${a}' part`);e=!0}}function G4e(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;let n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(n===void 0||n.parts===void 0||n.parts.length===0)return!1;for(let r of n.parts)if(r===void 0||Object.keys(r).length===0||r.text!==void 0&&r.text==="")return!1;return!0}async function tRt(t,e,n,r){return(await lU(e,yI.COUNT_TOKENS,t,!1,JSON.stringify(n),r)).json()}async function nRt(t,e,n,r){return(await lU(e,yI.EMBED_CONTENT,t,!1,JSON.stringify(n),r)).json()}async function rRt(t,e,n,r){let o=n.requests.map(s=>Object.assign(Object.assign({},s),{model:e}));return(await lU(e,yI.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),r)).json()}var R4e,L4e,D4e,$4e,F4e,U4e,B4e,z4e,iU,j4e,gI,V4e,Da,Zb,u5,Lg,d5,MOt,NOt,OOt,ROt,yI,pde,VOt,H4e,q4e,QOt,Y4e,mde,f5,wI,p5=C(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(R4e||(R4e={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(L4e||(L4e={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(D4e||(D4e={}));$4e=["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"})(F4e||(F4e={}));(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"})(U4e||(U4e={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(B4e||(B4e={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(z4e||(z4e={}));(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"})(iU||(iU={}));(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"})(j4e||(j4e={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(gI||(gI={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(V4e||(V4e={}));Da=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},Zb=class extends Da{constructor(e,n){super(e),this.response=n}},u5=class extends Da{constructor(e,n,r,o){super(e),this.status=n,this.statusText=r,this.errorDetails=o}},Lg=class extends Da{},d5=class extends Da{};MOt="https://generativelanguage.googleapis.com",NOt="v1beta",OOt="0.24.1",ROt="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"})(yI||(yI={}));pde=class{constructor(e,n,r,o,i){this.model=e,this.task=n,this.apiKey=r,this.stream=o,this.requestOptions=i}toString(){var e,n;let r=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||NOt,i=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||MOt}/${r}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};VOt=[iU.RECITATION,iU.SAFETY,iU.LANGUAGE];H4e=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;q4e=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],QOt={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};Y4e="SILENT_ERROR",mde=class{constructor(e,n,r,o={}){this.model=n,this.params=r,this._requestOptions=o,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,r?.history&&(eRt(r.history),this._history=r.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,n={}){var r,o,i,s,a,l;await this._sendPromise;let c=aU(e),u={safetySettings:(r=this.params)===null||r===void 0?void 0:r.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:(s=this.params)===null||s===void 0?void 0:s.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(l=this.params)===null||l===void 0?void 0:l.cachedContent,contents:[...this._history,c]},d=Object.assign(Object.assign({},this._requestOptions),n),f;return this._sendPromise=this._sendPromise.then(()=>J4e(this._apiKey,this.model,u,d)).then(p=>{var m;if(G4e(p.response)){this._history.push(c);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=Jb(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,n={}){var r,o,i,s,a,l;await this._sendPromise;let c=aU(e),u={safetySettings:(r=this.params)===null||r===void 0?void 0:r.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:(s=this.params)===null||s===void 0?void 0:s.toolConfig,systemInstruction:(a=this.params)===null||a===void 0?void 0:a.systemInstruction,cachedContent:(l=this.params)===null||l===void 0?void 0:l.cachedContent,contents:[...this._history,c]},d=Object.assign(Object.assign({},this._requestOptions),n),f=Z4e(this._apiKey,this.model,u,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(Y4e)}).then(p=>p.response).then(p=>{if(G4e(p)){this._history.push(c);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=Jb(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==Y4e&&console.error(p)}),f}};f5=class{constructor(e,n,r={}){this.apiKey=e,this._requestOptions=r,n.model.includes("/")?this.model=n.model:this.model=`models/${n.model}`,this.generationConfig=n.generationConfig||{},this.safetySettings=n.safetySettings||[],this.tools=n.tools,this.toolConfig=n.toolConfig,this.systemInstruction=X4e(n.systemInstruction),this.cachedContent=n.cachedContent}async generateContent(e,n={}){var r;let o=K4e(e),i=Object.assign(Object.assign({},this._requestOptions),n);return J4e(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},o),i)}async generateContentStream(e,n={}){var r;let o=K4e(e),i=Object.assign(Object.assign({},this._requestOptions),n);return Z4e(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},o),i)}startChat(e){var n;return new mde(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},e),this._requestOptions)}async countTokens(e,n={}){let r=JOt(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),n);return tRt(this.apiKey,this.model,r,o)}async embedContent(e,n={}){let r=XOt(e),o=Object.assign(Object.assign({},this._requestOptions),n);return nRt(this.apiKey,this.model,r,o)}async batchEmbedContents(e,n={}){let r=Object.assign(Object.assign({},this._requestOptions),n);return rRt(this.apiKey,this.model,e,r)}};wI=class{constructor(e){this.apiKey=e}getGenerativeModel(e,n){if(!e.model)throw new Da("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new f5(this.apiKey,e,n)}getGenerativeModelFromCachedContent(e,n,r){if(!e.name)throw new Lg("Cached content must contain a `name` field.");if(!e.model)throw new Lg("Cached content must contain a `model` field.");let o=["model","systemInstruction"];for(let s of o)if(n?.[s]&&e[s]&&n?.[s]!==e[s]){if(s==="model"){let a=n.model.startsWith("models/")?n.model.replace("models/",""):n.model,l=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(a===l)continue}throw new Lg(`Different value for "${s}" specified in modelParams (${n[s]}) and cachedContent (${e[s]})`)}let i=Object.assign(Object.assign({},n),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new f5(this.apiKey,i,r)}}});function gde(t,e){let n=oRt(t);return{tools:n,toolConfig:sRt(n,e)}}function oRt(t){let e=[],n=[];return t.forEach(r=>{if(cp(r)){let[o]=S4e([r]);o.functionDeclarations&&e.push(...o.functionDeclarations)}else if(Rg(r)){let{functionDeclarations:o}=iRt(r);if(o)e.push(...o);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else n.push(r)}),n.find(r=>"functionDeclarations"in r)?n.map(r=>{if(e?.length>0&&"functionDeclarations"in r){let o={functionDeclarations:[...r.functionDeclarations||[],...e]};return e=[],o}return r}):[...n,...e.length>0?[{functionDeclarations:e}]:[]]}function iRt(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:Aw(t.function.parameters)}]}}function sRt(t,e){if(!t.length||!e)return;let{toolChoice:n,allowedFunctionNames:r}=e,o={any:gI.ANY,auto:gI.AUTO,none:gI.NONE};if(n&&["any","auto","none"].includes(n))return{functionCallingConfig:{mode:o[n]??"MODE_UNSPECIFIED",allowedFunctionNames:r}};if(typeof n=="string"||r)return{functionCallingConfig:{mode:gI.ANY,allowedFunctionNames:[...r??[],...n&&typeof n=="string"?[n]:[]]}}}var Q4e=C(()=>{E3();ade();p5();pI();qd()});var eVe,tVe=C(()=>{eVe={"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-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-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-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-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-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-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-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-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-3-flash-preview":{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-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.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-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-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-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":{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-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-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-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-3-pro-preview":{maxInputTokens:1e6,imageInputs:!0,audioInputs:!0,pdfInputs:!0,videoInputs:!0,maxOutputTokens:64e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"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-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-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-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-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-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}}});function m5(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var nVe,rVe=C(()=>{nVe=t=>t()});function Xb(t,e){if(t.function===void 0)return;let n;if(e?.partial)try{n=Vk(t.function.arguments??"{}")}catch{return}else try{n=JSON.parse(t.function.arguments)}catch(o){throw new lc([`Function "${t.function.name}" arguments:`,"",t.function.arguments,"","are not valid JSON.",`Error: ${o.message}`].join(` `))}let r={name:t.function.name,args:n,type:"tool_call"};return e?.returnId&&(r.id=t.id),r}function cU(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 Bw(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var oVe,up,yde=C(()=>{Wk();Wu();vg();hI();Yb();oU();oVe=class extends lM{constructor(e){super(e);I(this,"returnId",!1);I(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);I(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,n=!0){let r=e[0].message,o;if(rp(r)&&r.tool_calls?.length?o=r.tool_calls.map(s=>{let{id:a,...l}=s;return this.returnId?{id:a,...l}:l}):r.additional_kwargs.tool_calls!==void 0&&(o=JSON.parse(JSON.stringify(r.additional_kwargs.tool_calls)).map(s=>Xb(s,{returnId:this.returnId,partial:n}))),!o)return[];let i=[];for(let s of o)if(s!==void 0){let a={type:s.name,args:s.args,id:s.id};i.push(a)}return i}},up=class extends oVe{constructor(e){super(e);I(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);I(this,"lc_serializable",!0);I(this,"returnId",!1);I(this,"keyName");I(this,"returnSingle",!1);I(this,"zodSchema");I(this,"serializableSchema");this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,"zodSchema"in e&&(this.zodSchema=e.zodSchema),"serializableSchema"in e&&(this.serializableSchema=e.serializableSchema)}static lc_name(){return"JsonOutputKeyToolsParser"}async _validateResult(e){if(this.serializableSchema!==void 0){let r=await this.serializableSchema["~standard"].validate(e);if(r.issues)throw new lc(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.issues)}`,JSON.stringify(e,null,2));return r.value}if(this.zodSchema===void 0)return e;let n=await kT(this.zodSchema,e);if(n.success)return n.data;throw new lc(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(n.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(o=>o.type===this.keyName),r=n;if(n.length)return this.returnId||(r=n.map(o=>o.args)),this.returnSingle?r[0]:r}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(o=>o.type===this.keyName),r=n;if(n.length)return this.returnId||(r=n.map(o=>o.args)),this.returnSingle?this._validateResult(r[0]):await Promise.all(r.map(o=>this._validateResult(o)))}}});function iVe(t){return jr(t)?Vm.fromZodSchema(t):Ob(t)?cde.fromSerializableSchema(t):new Gd}function sVe(t,e,n){let r=n??up;return jr(t)?new r({returnSingle:!0,keyName:e,zodSchema:t}):Ob(t)?new r({returnSingle:!0,keyName:e,serializableSchema:t}):new r({returnSingle:!0,keyName:e})}function h5(t,e,n,r){if(!n){let l=t.pipe(e);return r?l.withConfig({runName:r}):l}let o=xl.assign({parsed:(l,c)=>e.invoke(l.raw,c)}),i=xl.assign({parsed:()=>null}),s=o.withFallbacks({fallbacks:[i]}),a=Kc.from([{raw:t},s]);return r?a.withConfig({runName:r}):a}var wde=C(()=>{$n();vg();y2();Ra();l5();jm();oU();ude();dde();Uw();yde();Bd()});function lRt(t,e){switch(e.type){case"text-delta":return t.type==="text"?{...t,text:(t.text??"")+e.text}:t;case"reasoning-delta":return t.type==="thinking"?{...t,thinking:(t.thinking??"")+e.reasoning}:t.type==="reasoning"?{...t,reasoning:(t.reasoning??"")+e.reasoning}:t;case"data-delta":return{...t,data:(t.data??"")+e.data};case"block-delta":return{...t,...e.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(e)}`)}}function uU(t){if(t.event!=="content-block-delta")return;if("delta"in t&&t.delta)return t.delta;let e=t.content;if(e==null||typeof e!="object")return;let n=e;if(n.type==="text"&&typeof n.text=="string")return{type:"text-delta",text:n.text};if(n.type==="reasoning"&&typeof n.reasoning=="string")return{type:"reasoning-delta",reasoning:n.reasoning};if(n.type==="thinking"&&typeof n.thinking=="string")return{type:"reasoning-delta",reasoning:n.thinking};if(typeof n.data=="string")return{type:"data-delta",data:n.data,encoding:"base64"};if(typeof n.type=="string")return{type:"block-delta",fields:{...n,type:n.type}}}function aVe(t){if(t==null||typeof t!="object")return;let e=t;if(e.type==="reasoning"&&typeof e.reasoning=="string")return e.reasoning;if(e.type==="thinking"&&typeof e.thinking=="string")return e.thinking}function g5(t){if(t==null||typeof t!="object")return!1;let e=t.type;return e==="reasoning"||e==="thinking"}function cM(t){if(t)return{...t,input_tokens:t.input_tokens??0,output_tokens:t.output_tokens??0,total_tokens:t.total_tokens??0}}function cRt(t){if(t!=null&&typeof t=="object"&&!Array.isArray(t))return t;if(typeof t!="string"||t.length===0)return{};try{let e=JSON.parse(t);return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function uRt(t){let e=t;if(t.type==="tool_call"||t.type!=="tool_call_chunk"&&t.type!=="tool_use"&&t.type!=="input_json_delta")return t;let n=typeof e.name=="string"?e.name:void 0;if(n==null)return t;let r=e.args??e.input;return{...e,type:"tool_call",name:n,args:cRt(r)}}var aRt,dRt,fRt,pRt,mRt,vde,lVe=C(()=>{$n();Wu();aRt=class{constructor(){I(this,"events",[]);I(this,"finished",!1);I(this,"waiters",[]);I(this,"error",null)}push(t){this.events.push(t);let e=this.waiters.splice(0);for(let n of e)n()}finish(){this.finished=!0;let t=this.waiters.splice(0);for(let e of t)e()}setError(t){this.error=t,this.finished=!0;let e=this.waiters.splice(0);for(let n of e)n()}async*iterate(){if(this.finished){if(this.error)throw this.error;yield*this.events;return}let t=0;for(;;){for(;t{if(t{let n="";for await(let r of this)n+=r;return n})().then(t,e)}},fRt=class{constructor(t){I(this,"_buffer");this._buffer=t}get full(){let t=this._buffer;return{async*[Symbol.asyncIterator](){let e=[];for await(let n of t.iterate())n.event==="content-block-finish"&&n.content.type==="tool_call"&&(e.push(n.content),yield[...e])}}}[Symbol.asyncIterator](){let t=this._buffer;async function*e(){for await(let n of t.iterate())n.event==="content-block-finish"&&n.content.type==="tool_call"&&(yield n.content)}return e()}then(t,e){return(async()=>{let n=[];for await(let r of this)n.push(r);return n})().then(t,e)}},pRt=class{constructor(t){I(this,"_buffer");this._buffer=t}get full(){let t=this._buffer;return{async*[Symbol.asyncIterator](){let e="",n=!1;for await(let r of t.iterate())if(r.event==="content-block-start"){if(!g5(r.content)){if(n)return;continue}n=!0;let o=aVe(r.content);if(o==null||o.length===0)continue;e+=o,yield e}else if(r.event==="content-block-delta"){let o=uU(r);if(o?.type!=="reasoning-delta")continue;n=!0;let i=o.reasoning;if(i==null||i.length===0)continue;e+=i,yield e}else{if(r.event==="content-block-finish"&&g5(r.content))return;if(r.event==="message-finish")return}}}}[Symbol.asyncIterator](){let t=this._buffer;async function*e(){let n=!1;for await(let r of t.iterate())if(r.event==="content-block-start"){if(!g5(r.content)){if(n)return;continue}n=!0;let o=aVe(r.content);o!=null&&o.length>0&&(yield o)}else if(r.event==="content-block-delta"){let o=uU(r);if(o?.type!=="reasoning-delta")continue;n=!0;let i=o.reasoning;i!=null&&i.length>0&&(yield i)}else{if(r.event==="content-block-finish"&&g5(r.content))return;if(r.event==="message-finish")return}}return e()}then(t,e){return(async()=>{let n="";for await(let r of this)n+=r;return n})().then(t,e)}},mRt=class{constructor(t){I(this,"_buffer");this._buffer=t}[Symbol.asyncIterator](){let t=this._buffer;async function*e(){for await(let n of t.iterate())if(n.event==="usage"){let r=cM(n.usage);r&&(yield r)}else if(n.event==="message-start"&&n.usage){let r=cM(n.usage);r&&(yield r)}else if(n.event==="message-finish"&&n.usage){let r=cM(n.usage);r&&(yield r)}}return e()}then(t,e){return(async()=>{let n;for await(let r of this)n=r;return n})().then(t,e)}},vde=class{constructor(t){I(this,"_buffer");this._buffer=new aRt,this._consume(t)}async _consume(t){try{for await(let e of t)this._buffer.push(e);this._buffer.finish()}catch(e){this._buffer.setError(e instanceof Error?e:new Error(String(e)))}}[Symbol.asyncIterator](){return this._buffer.iterate()}get text(){return new dRt(this._buffer)}get toolCalls(){return new fRt(this._buffer)}get reasoning(){return new pRt(this._buffer)}get usage(){return new mRt(this._buffer)}get output(){return this._assembleMessage()}then(t,e){return this._assembleMessage().then(t,e)}async _assembleMessage(){let t=[],e,n,r={},o;for await(let s of this._buffer.iterate())switch(s.event){case"message-start":e=s.id??e,s.usage&&(n=cM(s.usage));break;case"content-block-start":t[s.index]=s.content;break;case"content-block-delta":{let a=t[s.index],l=uU(s);a&&l&&(t[s.index]=lRt(a,l));break}case"content-block-finish":t[s.index]=s.content;break;case"usage":n=cM(s.usage);break;case"message-finish":o=s.reason,s.usage&&(n=cM(s.usage)),s.responseMetadata&&(r={...r,...s.responseMetadata});break;default:break}let i=t.filter(s=>s!=null).map(uRt);return new kn({id:e,content:i,usage_metadata:n,response_metadata:{...r,...o?{finish_reason:o}:{},output_version:"v1"}})}}});function cVe(t){let e=0;for(let n of t.keys())n>=e&&(e=n+1);return e}function uVe(t){let e=t.additional_kwargs;return e!=null&&typeof e=="object"?e:{}}function yRt(t){let e=uVe(t).tool_outputs;if(!Array.isArray(e))return[];let n=[];for(let r of e){if(r==null||typeof r!="object")continue;let o=r;if(o.type!=="image_generation_call")continue;let i=typeof o.result=="string"?o.result:void 0,s=typeof o.url=="string"?o.url:void 0;if(i==null&&s==null)continue;let a=typeof o.output_format=="string"?o.output_format.toLowerCase():void 0,l=(a!=null?gRt[a]:void 0)??"image/png";n.push({type:"image",...typeof o.id=="string"?{id:o.id}:{},...s!=null?{url:s}:{},...i!=null?{data:i}:{},mimeType:l})}return n}function wRt(t){let e=uVe(t).audio;if(e==null||typeof e!="object")return;let n=e,r=typeof n.data=="string"?n.data:void 0,o=typeof n.url=="string"?n.url:void 0,i=typeof n.transcript=="string"?n.transcript:void 0;if(r==null&&o==null&&i==null)return;let s=typeof n.mime_type=="string"?n.mime_type:typeof n.mimeType=="string"?n.mimeType:void 0,a=typeof n.format=="string"?n.format.toLowerCase():void 0,l=s??(a!=null?hRt[a]:void 0)??(r!=null?"audio/wav":"audio/pcm");return{...typeof n.id=="string"?{id:n.id}:{},...r!=null?{data:r}:{},...o!=null?{url:o}:{},...i!=null?{transcript:i}:{},mimeType:l}}async function*dVe(t,e){let n=new Map,r=!1,o,i,s=new Set;for await(let a of t){e?.signal?.throwIfAborted();let l=a.message,c=!1;if(!r){r=!0;let f={event:"message-start",id:l.id??void 0};Yt.isInstance(l)&&l.usage_metadata&&(f.usage=l.usage_metadata,o={...l.usage_metadata},c=!0),yield f}let u=l.content;if(typeof u=="string"){if(u!==""){if(!n.has(0)){let m={type:"text",text:""};n.set(0,{type:"text",accumulated:m}),yield{event:"content-block-start",index:0,content:m}}let p=n.get(0);p.accumulated={...p.accumulated,text:(p.accumulated.text??"")+u},yield{event:"content-block-delta",index:0,delta:{type:"text-delta",text:u}}}}else if(Array.isArray(u))for(let f of u){let p=typeof f.index=="number"?f.index:n.size;if(!n.has(p))n.set(p,{type:f.type,accumulated:{...f}}),yield{event:"content-block-start",index:p,content:{...f}};else{let m=n.get(p),h=xRt(f);m.accumulated=vRt(m.accumulated,h),yield{event:"content-block-delta",index:p,delta:h}}}if(Yt.isInstance(l)&&l.tool_call_chunks&&l.tool_call_chunks.length>0)for(let f of l.tool_call_chunks){let p=typeof f.index=="number"?f.index:n.size;if(!n.has(p)){let h={type:"tool_call_chunk",id:f.id,name:f.name,args:"",index:p};n.set(p,{type:"tool_call_chunk",accumulated:h}),yield{event:"content-block-start",index:p,content:h}}let m=n.get(p).accumulated;f.id!=null&&(m.id=f.id),f.name!=null&&(m.name=f.name),m.args=(m.args??"")+(f.args??""),yield{event:"content-block-delta",index:p,delta:{type:"block-delta",fields:{type:"tool_call_chunk",..."id"in m&&m.id!=null?{id:m.id}:{},..."name"in m&&m.name!=null?{name:m.name}:{},args:m.args}}}}let d=wRt(l);if(d!=null){if(i==null){let p=cVe(n);i={index:p,id:d.id,mimeType:d.mimeType,transcript:""};let m={type:"audio",...d.id!=null?{id:d.id}:{},...d.url!=null?{url:d.url}:{},data:"",mimeType:d.mimeType};n.set(p,{type:"audio",accumulated:m}),yield{event:"content-block-start",index:p,content:m}}let f=n.get(i.index);if(f!=null){let p=f.accumulated;d.id!=null&&i.id==null&&(i.id=d.id,p.id=d.id),d.transcript!=null&&(i.transcript+=d.transcript,p.transcript=i.transcript,yield{event:"content-block-delta",index:i.index,delta:{type:"block-delta",fields:{type:"audio",transcript:i.transcript}}}),d.data!=null&&d.data.length>0&&(p.data=(p.data??"")+d.data,yield{event:"content-block-delta",index:i.index,delta:{type:"data-delta",data:d.data,encoding:"base64"}})}}for(let f of yRt(l)){let p=f,m=p.id??p.url??(p.data!=null?`${p.data.length}:${p.data.slice(0,32)}`:void 0);if(m!=null&&s.has(m))continue;m!=null&&s.add(m);let h=cVe(n);n.set(h,{type:"image",accumulated:f}),yield{event:"content-block-start",index:h,content:f}}if(!c&&Yt.isInstance(l)&&l.usage_metadata){let f=l.usage_metadata;o?o={input_tokens:o.input_tokens+f.input_tokens,output_tokens:o.output_tokens+f.output_tokens,total_tokens:o.total_tokens+f.total_tokens}:o={...f},yield{event:"usage",usage:{...o}}}}for(let[a,l]of n)yield{event:"content-block-finish",index:a,content:bRt(l.accumulated)};yield{event:"message-finish",reason:"stop",...o?{usage:o}:{}}}function vRt(t,e){switch(e.type){case"text-delta":return t.type==="text"?{...t,text:(t.text??"")+e.text}:t;case"reasoning-delta":return t.type==="thinking"?{...t,thinking:(t.thinking??"")+e.reasoning}:t.type==="reasoning"?{...t,reasoning:(t.reasoning??"")+e.reasoning}:t;case"data-delta":return{...t,data:(t.data??"")+e.data};case"block-delta":return{...t,...e.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(e)}`)}}function xRt(t){if(t.type==="text")return{type:"text-delta",text:t.text};if(t.type==="reasoning")return{type:"reasoning-delta",reasoning:t.reasoning};if(t.type==="thinking"&&typeof t.thinking=="string")return{type:"reasoning-delta",reasoning:t.thinking};if(typeof t.data=="string")return{type:"data-delta",data:t.data,encoding:"base64"};if(typeof t.type=="string")return{type:"block-delta",fields:{...t}};throw new Error(`Unsupported content block delta: ${JSON.stringify(t)}`)}function bRt(t){if(t.type==="tool_call_chunk"){let e=t,n;try{n=JSON.parse(e.args??"{}")}catch{return{type:"invalid_tool_call",id:e.id,name:e.name,args:e.args,error:"Failed to parse tool call arguments as JSON"}}return{type:"tool_call",id:e.id,name:e.name,args:n}}return t}var hRt,gRt,fVe=C(()=>{$n();Wu();hRt={wav:"audio/wav",mp3:"audio/mpeg",flac:"audio/flac",opus:"audio/opus",aac:"audio/aac",pcm16:"audio/pcm"},gRt={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif"}});function xde(t){let e=[];for(let n of t){let r=n;if(Array.isArray(n.content))for(let o=0;o{$n();JT();C2();nc();Wu();Dm();Jo();k2();Hb();Og();ac();vg();y2();Bu();Ra();Kr();qd();rVe();wde();lVe();fVe();dp=class Dg extends mI{constructor(n){super(n);I(this,"lc_namespace",["langchain","chat_models",this._llmType()]);I(this,"disableStreaming",!1);I(this,"outputVersion");this.outputVersion=nVe(()=>{let r=n.outputVersion??In("LC_OUTPUT_VERSION");return r&&["v0","v1"].includes(r)?r:"v0"})}get callKeys(){return[...super.callKeys,"outputVersion"]}_separateRunnableConfigFromCallOptionsCompat(n){let[r,o]=super._separateRunnableConfigFromCallOptions(n);return o.signal=r.signal,[r,o]}async invoke(n,r){let o=Dg._convertInputToPromptValue(n);return(await this.generatePrompt([o],r,r?.callbacks)).generations[0][0].message}async*_streamResponseChunks(n,r,o){throw new Error("Not implemented.")}async*_streamChatModelEvents(n,r,o){yield*dVe(this._streamResponseChunks(n,r,o),{signal:r.signal})}streamV2(n,r){let o=Dg._convertInputToPromptValue(n).toChatMessages(),[,i]=this._separateRunnableConfigFromCallOptionsCompat(r);return new vde(this._streamChatModelEvents(o,i))}async*_streamIterator(n,r){if(this._streamResponseChunks===Dg.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(n,r);else{let o=Dg._convertInputToPromptValue(n).toChatMessages(),[i,s]=this._separateRunnableConfigFromCallOptionsCompat(r),a={...i.metadata,...this.getLsParamsWithDefaults(s)},l=this.invocationParams(s),c=await Ws.configure(i.callbacks,this.callbacks,i.tags,this.tags,a,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(l)}),u={options:s,invocation_params:l,batch_size:1},d=s.outputVersion??this.outputVersion,f=await c?.handleChatModelStart(this.toJSON(),[xde(o)],i.runId,void 0,u,void 0,void 0,i.runName),p,m;try{for await(let h of this._streamResponseChunks(o,s,f?.[0])){if(s.signal?.throwIfAborted(),h.message.id==null){let g=f?.at(0)?.runId;g!=null&&h.message._updateId(`run-${g}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata},d==="v1"?yield m5(h.message):yield h.message,p?p=p.concat(h):p=h,z3(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}})}s.signal?.throwIfAborted()}catch(h){throw await Promise.all((f??[]).map(g=>g?.handleLLMError(h))),h}await Promise.all((f??[]).map(h=>h?.handleLLMEnd({generations:[[p]],llmOutput:m})))}}getLsParams(n){let r=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:n.stop,ls_provider:r}}getLsParamsWithDefaults(n){return{...this.getLsParams(n),ls_integration:"langchain_chat_model"}}async _generateUncached(n,r,o,i){let s=n.map(m=>m.map(Lm)),a;if(i!==void 0&&i.length===s.length)a=i;else{let m={...o.metadata,...this.getLsParamsWithDefaults(r)},h=this.invocationParams(r),g=await Ws.configure(o.callbacks,this.callbacks,o.tags,this.tags,m,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(h)}),y={options:r,invocation_params:h,batch_size:1};a=await g?.handleChatModelStart(this.toJSON(),s.map(xde),o.runId,void 0,y,void 0,void 0,o.runName)}let l=r.outputVersion??this.outputVersion,c=[],u=[],d=!!a?.[0].handlers.find(d2e),f=!!a?.[0].handlers.find(Kle);if(d&&!this.disableStreaming&&s.length===1&&(this._streamChatModelEvents!==Dg.prototype._streamChatModelEvents||this._streamResponseChunks!==Dg.prototype._streamResponseChunks))try{let m=!1,h=a?.[0],g=this._streamChatModelEvents(s[0],r),y=await new vde({async*[Symbol.asyncIterator](){for await(let x of g){r.signal?.throwIfAborted(),m=!0;let b=x.event==="message-start"&&x.id==null&&h?.runId!=null?{...x,id:`run-${h.runId}`}:x;await h?.handleChatModelStreamEvent(b),yield b}}});if(r.signal?.throwIfAborted(),!m)throw new Error("Received empty response from chat model call.");if(y.id==null){let x=a?.at(0)?.runId;x!=null&&y._updateId(`run-${x}`)}let w={text:y.text,message:y};c.push([w]);let v=y.usage_metadata!==void 0?{tokenUsage:{promptTokens:y.usage_metadata.input_tokens,completionTokens:y.usage_metadata.output_tokens,totalTokens:y.usage_metadata.total_tokens}}:void 0;await a?.[0].handleLLMEnd({generations:c,llmOutput:v})}catch(m){throw await a?.[0].handleLLMError(m),m}else if(f&&!this.disableStreaming&&s.length===1&&this._streamResponseChunks!==Dg.prototype._streamResponseChunks)try{let m=await this._streamResponseChunks(s[0],r,a?.[0]),h,g;for await(let y of m){if(r.signal?.aborted){let w=h?.message;throw new Ole("Model invocation was aborted.",w)}if(y.message.id==null){let w=a?.at(0)?.runId;w!=null&&y.message._updateId(`run-${w}`)}h===void 0?h=y:h=Um(h,y),z3(y.message)&&y.message.usage_metadata!==void 0&&(g={tokenUsage:{promptTokens:y.message.usage_metadata.input_tokens,completionTokens:y.message.usage_metadata.output_tokens,totalTokens:y.message.usage_metadata.total_tokens}})}if(r.signal?.aborted){let y=h?.message;throw new Ole("Model invocation was aborted.",y)}if(h===void 0)throw new Error("Received empty response from chat model call.");c.push([h]),await a?.[0].handleLLMEnd({generations:c,llmOutput:g})}catch(m){throw await a?.[0].handleLLMError(m),m}else{let m=await Promise.allSettled(s.map(async(h,g)=>{let y=await this._generate(h,{...r,promptIndex:g},a?.[g]);if(l==="v1")for(let w of y.generations)w.message=m5(w.message);return y}));await Promise.all(m.map(async(h,g)=>{if(h.status==="fulfilled"){let y=h.value;for(let w of y.generations){if(w.message.id==null){let v=a?.at(0)?.runId;v!=null&&w.message._updateId(`run-${v}`)}w.message.response_metadata={...w.generationInfo,...w.message.response_metadata}}return y.generations.length===1&&(y.generations[0].message.response_metadata={...y.llmOutput,...y.generations[0].message.response_metadata}),c[g]=y.generations,u[g]=y.llmOutput,a?.[g]?.handleLLMEnd({generations:[y.generations],llmOutput:y.llmOutput})}else return await a?.[g]?.handleLLMError(h.reason),Promise.reject(h.reason)}))}let p={generations:c,llmOutput:u.length?this._combineLLMOutput?.(...u):void 0};return Object.defineProperty(p,iM,{value:a?{runIds:a?.map(m=>m.runId)}:void 0,configurable:!0}),p}async _generateCached({messages:n,cache:r,llmStringKey:o,parsedOptions:i,handledOptions:s}){let a=n.map(w=>w.map(Lm)),l={...s.metadata,...this.getLsParamsWithDefaults(i)},c=this.invocationParams(i),u=await Ws.configure(s.callbacks,this.callbacks,s.tags,this.tags,l,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),d={options:i,invocation_params:c,batch_size:1},f=await u?.handleChatModelStart(this.toJSON(),a.map(xde),s.runId,void 0,d,void 0,void 0,s.runName),p=[],m=(await Promise.allSettled(a.map(async(w,v)=>{let x=Dg._convertInputToPromptValue(w).toString(),b=await r.lookup(x,o);return b==null&&p.push(v),b}))).map((w,v)=>({result:w,runManager:f?.[v]})).filter(({result:w})=>w.status==="fulfilled"&&w.value!=null||w.status==="rejected"),h=i.outputVersion??this.outputVersion,g=[];await Promise.all(m.map(async({result:w,runManager:v},x)=>{if(w.status==="fulfilled"){let b=w.value;return g[x]=b.map(_=>("message"in _&&np(_.message)&&rp(_.message)&&(_.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},h==="v1"&&(_.message=m5(_.message))),_.generationInfo={..._.generationInfo,tokenUsage:{}},_)),b.length&&await v?.handleLLMNewToken(b[0].text),v?.handleLLMEnd({generations:[b]},void 0,void 0,void 0,{cached:!0})}else return await v?.handleLLMError(w.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(w.reason)}));let y={generations:g,missingPromptIndices:p,startedRunManagers:f};return Object.defineProperty(y,iM,{value:f?{runIds:f?.map(w=>w.runId)}:void 0,configurable:!0}),y}async generate(n,r,o){let i;Array.isArray(r)?i={stop:r}:i=r;let s=n.map(h=>h.map(Lm)),[a,l]=this._separateRunnableConfigFromCallOptionsCompat(i);if(a.callbacks=a.callbacks??o,!this.cache)return this._generateUncached(s,l,a);let{cache:c}=this,u=this._getSerializedCacheKeyParametersForCall(l),{generations:d,missingPromptIndices:f,startedRunManagers:p}=await this._generateCached({messages:s,cache:c,llmStringKey:u,parsedOptions:l,handledOptions:a}),m={};if(f.length>0){let h=await this._generateUncached(f.map(g=>s[g]),l,a,p!==void 0?f.map(g=>p?.[g]):void 0);await Promise.all(h.generations.map(async(g,y)=>{let w=f[y];d[w]=g;let v=Dg._convertInputToPromptValue(s[w]).toString();return c.update(v,u,g)})),m=h.llmOutput??{}}return{generations:d,llmOutput:m}}invocationParams(n){return{}}_modelType(){return"base_chat_model"}async generatePrompt(n,r,o){let i=n.map(s=>s.toChatMessages());return this.generate(i,r,o)}withStructuredOutput(n,r){if(typeof this.bindTools!="function")throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(r?.strict)throw new Error('"strict" mode is not supported for this model by default.');let o=n,i=r?.name,s=NT(o)??"A function available to call.",a=r?.method,l=r?.includeRaw;if(a==="jsonMode")throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let c=i??"extract";!jr(o)&&!Ob(o)&&"name"in o&&(c=o.name);let u=jr(o)||Ob(o)?Hr(o):o,d=[{type:"function",function:{name:c,description:s,parameters:u}}];return h5(this.bindTools(d),$w.from(f=>{if(!Yt.isInstance(f))throw new Error("Input is not an AIMessageChunk.");if(!f.tool_calls||f.tool_calls.length===0)throw new Error("No tool calls found in the response.");let p=f.tool_calls.find(m=>m.name===c);if(!p)throw new Error(`No tool call found with name ${c}.`);return p.args}),l,l?"StructuredOutputRunnable":"StructuredOutput")}}});var bde,pVe=C(()=>{E3();ade();O4e();Q4e();tVe();p5();Jo();vI();jm();Bd();Uw();bde=class extends dp{constructor(e,n){let r=typeof e=="string"?{...n??{},model:e}:e;super(r);I(this,"lc_serializable",!0);I(this,"lc_namespace",["langchain","chat_models","google_genai"]);I(this,"model");I(this,"temperature");I(this,"maxOutputTokens");I(this,"topP");I(this,"topK");I(this,"stopSequences",[]);I(this,"safetySettings");I(this,"apiKey");I(this,"streaming",!1);I(this,"json");I(this,"streamUsage",!0);I(this,"convertSystemMessageToHumanContent");I(this,"thinkingConfig");I(this,"client");if(this._addVersion("@langchain/google-genai","2.1.23"),this.model=r.model.replace(/^models\//,""),this.maxOutputTokens=r.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=r.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=r.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=r.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=r.stopSequences??this.stopSequences,this.apiKey=r.apiKey??In("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=r.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(o=>o.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=r.streaming??this.streaming,this.json=r.json,this.thinkingConfig=r.thinkingConfig??this.thinkingConfig,this.client=new wI(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"}:{},...this.thinkingConfig?{thinkingConfig:this.thinkingConfig}:{}}},{apiVersion:r.apiVersion,baseUrl:r.baseUrl,customHeaders:r.customHeaders}),this.streamUsage=r.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,n,r){this.apiKey&&(this.client=new wI(this.apiKey).getGenerativeModelFromCachedContent(e,n,r))}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,n){return this.withConfig({tools:gde(e)?.tools,...n})}invocationParams(e){let n=e?.tools?.length?gde(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),{...n?.tools?{tools:n.tools}:{},...n?.toolConfig?{toolConfig:n.toolConfig}:{}}}async _generate(e,n,r){n.signal?.throwIfAborted();let o=ide(e,this._isMultimodalModel,this.useSystemInstruction,this.model),i=o;if(o[0].role==="system"){let[u]=o;this.client.systemInstruction=u,i=o.slice(1)}let s=this.invocationParams(n);if(this.streaming){let u={},d=this._streamResponseChunks(e,n,r),f=[];for await(let p of d){let m=p.generationInfo?.completion??0;f[m]===void 0?f[m]=p:f[m]=f[m].concat(p)}return{generations:f.filter(p=>p!==void 0),llmOutput:{estimatedTokenUsage:u}}}let a=await this.completionWithRetry({...s,contents:i}),l;"usageMetadata"in a.response&&(l=sde(a.response.usageMetadata,this.model));let c=C4e(a.response,{usageMetadata:l});return c.generations?.length>0&&await r?.handleLLMNewToken(c.generations[0]?.text??""),c}async*_streamResponseChunks(e,n,r){let o=ide(e,this._isMultimodalModel,this.useSystemInstruction,this.model),i=o;if(o[0].role==="system"){let[p]=o;this.client.systemInstruction=p,i=o.slice(1)}let s={...this.invocationParams(n),contents:i},a=await this.caller.callWithOptions({signal:n?.signal},async()=>{let{stream:p}=await this.client.generateContentStream(s,{signal:n?.signal});return p}),l,c=0,u=0,d=0,f=0;for await(let p of a){if(n.signal?.aborted)return;if("usageMetadata"in p&&p.usageMetadata!==void 0&&this.streamUsage!==!1&&n.streamUsage!==!1){l=sde(p.usageMetadata,this.model);let h=p.usageMetadata.promptTokenCount??0;l.input_tokens=Math.max(0,h-c),c=h;let g=p.usageMetadata.candidatesTokenCount??0;l.output_tokens=Math.max(0,g-u),u=g;let y=p.usageMetadata.totalTokenCount??0;l.total_tokens=Math.max(0,y-d),d=y}let m=_4e(p,{usageMetadata:l,index:f});f+=1,m&&(yield m,await r?.handleLLMNewToken(m.text??""))}}async completionWithRetry(e,n){return this.caller.callWithOptions({signal:n?.signal},async()=>{try{return await this.client.generateContent(e,{signal:n?.signal})}catch(r){throw r.message?.includes("400 Bad Request")&&(r.status=400),r}})}get profile(){return eVe[this.model]??{}}withStructuredOutput(e,n){let r=e,o=n?.name,i=n?.method,s=n?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let a,l;if(i==="functionCalling"){let f=o??"extract",p;if(jr(r)){let m=v2(r);p=[{functionDeclarations:[{name:f,description:m.description??"A function available to call.",parameters:m}]}],l=new fde({returnSingle:!0,keyName:f,zodSchema:r})}else{let m;typeof r.name=="string"&&typeof r.parameters=="object"&&r.parameters!=null?(m=r,m.parameters=Aw(r.parameters),f=r.name):m={name:f,description:r.description??"",parameters:Aw(r)},p=[{functionDeclarations:[m]}],l=new fde({returnSingle:!0,keyName:f})}a=this.bindTools(p).withConfig({allowedFunctionNames:[f]})}else{let f=v2(r);a=this.withConfig({responseSchema:f}),l=new Gd}if(!s)return a.pipe(l).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let c=xl.assign({parsed:(f,p)=>l.invoke(f.raw,p)}),u=xl.assign({parsed:()=>null}),d=c.withFallbacks({fallbacks:[u]});return Kc.from([{raw:a},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var Qb,dU=C(()=>{$n();X2();Qb=class{constructor(t){I(this,"caller");this.caller=new qb(t??{})}}});var xI,fU=C(()=>{$n();xI=(t,e)=>t.reduce((n,r,o)=>{let i=Math.floor(o/e);return n[i]=(n[i]||[]).concat([r]),n},[])});var Cde,mVe=C(()=>{p5();Jo();dU();fU();Cde=class extends Qb{constructor(e){super(e??{});I(this,"apiKey");I(this,"modelName","embedding-001");I(this,"model","embedding-001");I(this,"taskType");I(this,"title");I(this,"stripNewLines",!0);I(this,"maxBatchSize",100);I(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??In("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 wI(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 n=this._convertToContent(e);return(await this.client.embedContent(n)).embedding.values??[]}async _embedDocumentsContent(e){let n=xI(e,this.maxBatchSize),r=n.map(o=>({requests:o.map(i=>this._convertToContent(i))}));return(await Promise.allSettled(r.map(o=>this.client.batchEmbedContents(o)))).flatMap((o,i)=>o.status==="fulfilled"?o.value.embeddings.map(s=>s.values||[]):Array(n[i].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 _de=C(()=>{pVe();mVe()});function hVe(t,e=0){return(bl[t[e+0]]+bl[t[e+1]]+bl[t[e+2]]+bl[t[e+3]]+"-"+bl[t[e+4]]+bl[t[e+5]]+"-"+bl[t[e+6]]+bl[t[e+7]]+"-"+bl[t[e+8]]+bl[t[e+9]]+"-"+bl[t[e+10]]+bl[t[e+11]]+bl[t[e+12]]+bl[t[e+13]]+bl[t[e+14]]+bl[t[e+15]]).toLowerCase()}var bl,y5,gVe=C(()=>{bl=[];for(y5=0;y5<256;++y5)bl.push((y5+256).toString(16).slice(1))});function Sde(){if(!w5&&(w5=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!w5))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w5(CRt)}var w5,CRt,yVe=C(()=>{CRt=new Uint8Array(16)});var _Rt,Tde,wVe=C(()=>{_Rt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Tde={randomUUID:_Rt}});function SRt(t,e,n){if(Tde.randomUUID&&!e&&!t)return Tde.randomUUID();t=t||{};var r=t.random||(t.rng||Sde)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return hVe(r)}var Ide,vVe=C(()=>{wVe();yVe();gVe();Ide=SRt});var xVe=C(()=>{vVe()});function CVe(t,e){return new Yt({content:t.content??"",additional_kwargs:t.thinking&&t.thinking!==""?{reasoning_content:t.thinking}:{},tool_call_chunks:t.tool_calls?.map(n=>({name:n.function.name,args:JSON.stringify(n.function.arguments),type:"tool_call_chunk",index:0,id:Ide()})),response_metadata:{...e?.responseMetadata,model_provider:"ollama"},usage_metadata:e?.usageMetadata})}function bVe(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function TRt(t){if(typeof t.content=="string")return[{role:"assistant",content:t.content}];let n=t.content.filter(o=>o.type==="text"&&typeof o.text=="string").map(o=>({role:"assistant",content:o.text})),r;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&&(r={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[...n,...r?[r]:[]]}function IRt(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:[bVe(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[bVe(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function PRt(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 ERt(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function _Ve(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return IRt(e);if(e._getType()==="ai")return TRt(e);if(e._getType()==="system")return PRt(e);if(e._getType()==="tool")return ERt(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var SVe=C(()=>{Kr();xVe()});function ARt(t){return t&&DataView.prototype.isPrototypeOf(t)}function uM(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 Ede(t){return typeof t!="string"&&(t=String(t)),t}function Ade(t){var e={next:function(){var n=t.shift();return{done:n===void 0,value:n}}};return qc.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Ks(t){this.map={},t instanceof Ks?t.forEach(function(e,n){this.append(n,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 Pde(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function EVe(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function kRt(t){var e=new FileReader,n=EVe(e);return e.readAsArrayBuffer(t),n}function MRt(t){var e=new FileReader,n=EVe(e),r=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=r?r[1]:"utf-8";return e.readAsText(t,o),n}function NRt(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r-1?e:t}function CI(t,e){if(!(this instanceof CI))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e=e||{};var n=e.body;if(t instanceof CI){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Ks(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!n&&t._bodyInit!=null&&(n=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 Ks(e.headers)),this.method=RRt(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Cl){var i=new AbortController;return i.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),(this.method==="GET"||this.method==="HEAD")&&(e.cache==="no-store"||e.cache==="no-cache")){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+new Date().getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}function LRt(t){var e=new FormData;return t.trim().split("&").forEach(function(n){if(n){var r=n.split("="),o=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(i))}}),e}function DRt(t){var e=new Ks,n=t.replace(/\r?\n[\t ]+/g," ");return n.split("\r").map(function(r){return r.indexOf(` `)===0?r.substr(1,r.length):r}).forEach(function(r){var o=r.split(":"),i=o.shift().trim();if(i){var s=o.join(":").trim();try{e.append(i,s)}catch(a){console.warn("Response "+a.message)}}}),e}function $g(t,e){if(!(this instanceof $g))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 Ks(e.headers),this.url=e.url||"",this._initBody(t)}function kVe(t,e){return new Promise(function(n,r){var o=new CI(t,e);if(o.signal&&o.signal.aborted)return r(new bI("Aborted","AbortError"));var i=new XMLHttpRequest;function s(){i.abort()}i.onload=function(){var c={statusText:i.statusText,headers:DRt(i.getAllResponseHeaders()||"")};o.url.indexOf("file://")===0&&(i.status<200||i.status>599)?c.status=200:c.status=i.status,c.url="responseURL"in i?i.responseURL:c.headers.get("X-Request-URL");var u="response"in i?i.response:i.responseText;setTimeout(function(){n(new $g(u,c))},0)},i.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},i.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request timed out"))},0)},i.onabort=function(){setTimeout(function(){r(new bI("Aborted","AbortError"))},0)};function a(c){try{return c===""&&Cl.location.href?Cl.location.href:c}catch{return c}}if(i.open(o.method,a(o.url),!0),o.credentials==="include"?i.withCredentials=!0:o.credentials==="omit"&&(i.withCredentials=!1),"responseType"in i&&(qc.blob?i.responseType="blob":qc.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Ks||Cl.Headers&&e.headers instanceof Cl.Headers)){var l=[];Object.getOwnPropertyNames(e.headers).forEach(function(c){l.push(uM(c)),i.setRequestHeader(c,Ede(e.headers[c]))}),o.headers.forEach(function(c,u){l.indexOf(u)===-1&&i.setRequestHeader(u,c)})}else o.headers.forEach(function(c,u){i.setRequestHeader(u,c)});o.signal&&(o.signal.addEventListener("abort",s),i.onreadystatechange=function(){i.readyState===4&&o.signal.removeEventListener("abort",s)}),i.send(typeof o._bodyInit>"u"?null:o._bodyInit)})}var Cl,qc,TVe,PVe,ORt,$Rt,bI,MVe=C(()=>{Cl=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},qc={searchParams:"URLSearchParams"in Cl,iterable:"Symbol"in Cl&&"iterator"in Symbol,blob:"FileReader"in Cl&&"Blob"in Cl&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Cl,arrayBuffer:"ArrayBuffer"in Cl};qc.arrayBuffer&&(TVe=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],PVe=ArrayBuffer.isView||function(t){return t&&TVe.indexOf(Object.prototype.toString.call(t))>-1});Ks.prototype.append=function(t,e){t=uM(t),e=Ede(e);var n=this.map[t];this.map[t]=n?n+", "+e:e};Ks.prototype.delete=function(t){delete this.map[uM(t)]};Ks.prototype.get=function(t){return t=uM(t),this.has(t)?this.map[t]:null};Ks.prototype.has=function(t){return this.map.hasOwnProperty(uM(t))};Ks.prototype.set=function(t,e){this.map[uM(t)]=Ede(e)};Ks.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)};Ks.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),Ade(t)};Ks.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),Ade(t)};Ks.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),Ade(t)};qc.iterable&&(Ks.prototype[Symbol.iterator]=Ks.prototype.entries);ORt=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];CI.prototype.clone=function(){return new CI(this,{body:this._bodyInit})};AVe.call(CI.prototype);AVe.call($g.prototype);$g.prototype.clone=function(){return new $g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Ks(this.headers),url:this.url})};$g.error=function(){var t=new $g(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};$Rt=[301,302,303,307,308];$g.redirect=function(t,e){if($Rt.indexOf(e)===-1)throw new RangeError("Invalid status code");return new $g(null,{status:e,headers:{location:t}})};bI=Cl.DOMException;try{new bI}catch{bI=function(e,n){this.message=e,this.name=n;var r=Error(e);this.stack=r.stack},bI.prototype=Object.create(Error.prototype),bI.prototype.constructor=bI}kVe.polyfill=!0;Cl.fetch||(Cl.fetch=kVe,Cl.Headers=Ks,Cl.Request=CI,Cl.Response=$g)});function zRt(){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 jRt(t){if(t instanceof Headers){let e={};return t.forEach((n,r)=>{e[r]=n}),e}else return Array.isArray(t)?Object.fromEntries(t):t||{}}var NVe,OVe,FRt,URt,BRt,kde,Ode,Rde,Lde,VRt,Dde,Mde,eC,WRt,HRt,KRt,qRt,GRt,Nde,dM,FRn,v5=C(()=>{MVe();NVe="11434",OVe=`http://127.0.0.1:${NVe}`,FRt="0.6.3",URt=Object.defineProperty,BRt=(t,e,n)=>e in t?URt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kde=(t,e,n)=>(BRt(t,typeof e!="symbol"?e+"":e,n),n),Ode=class t extends Error{constructor(e,n){super(e),this.error=e,this.status_code=n,this.name="ResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,t)}},Rde=class{constructor(e,n,r){kde(this,"abortController"),kde(this,"itr"),kde(this,"doneCallback"),this.abortController=e,this.itr=n,this.doneCallback=r}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.")}},Lde=async t=>{if(t.ok)return;let e=`Error ${t.status}: ${t.statusText}`,n=null;if(t.headers.get("content-type")?.includes("application/json"))try{n=await t.json(),e=n.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 Ode(e,t.status)};VRt=(t,e)=>t[e],Dde=async(t,e,n={})=>{let r={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${FRt} (${zRt()})`};n.headers=jRt(n.headers);try{let i=new URL(e);if(i.protocol==="https:"&&i.hostname==="ollama.com"){let s=typeof process=="object"&&process!==null&&typeof process.env=="object"&&process.env!==null?VRt(process.env,"OLLAMA_API_KEY"):void 0;!(n.headers.authorization||n.headers.Authorization)&&s&&(n.headers.Authorization=`Bearer ${s}`)}}catch(i){console.error("error parsing url",i)}let o=Object.fromEntries(Object.entries(n.headers).filter(([i])=>!Object.keys(r).some(s=>s.toLowerCase()===i.toLowerCase())));return n.headers={...r,...o},t(e,n)},Mde=async(t,e,n)=>{let r=await Dde(t,e,{headers:n?.headers});return await Lde(r),r},eC=async(t,e,n,r)=>{let i=(a=>a!==null&&typeof a=="object"&&!Array.isArray(a))(n)?JSON.stringify(n):n,s=await Dde(t,e,{method:"POST",body:i,signal:r?.signal,headers:r?.headers});return await Lde(s),s},WRt=async(t,e,n,r)=>{let o=await Dde(t,e,{method:"DELETE",body:JSON.stringify(n),headers:r?.headers});return await Lde(o),o},HRt=async function*(t){let e=new TextDecoder("utf-8"),n="",r=t.getReader();for(;;){let{done:o,value:i}=await r.read();if(o)break;n+=e.decode(i,{stream:!0});let s=n.split(` `);n=s.pop()??"";for(let a of s)try{yield JSON.parse(a)}catch{console.warn("invalid json: ",a)}}n+=e.decode();for(let o of n.split(` `).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},KRt=t=>{if(!t)return OVe;let e=t.includes("://");t.startsWith(":")&&(t=`http://127.0.0.1${t}`,e=!0),e||(t=`http://${t}`);let n=new URL(t),r=n.port;r||(e?r=n.protocol==="https:"?"443":"80":r=NVe);let o="";n.username&&(o=n.username,n.password&&(o+=`:${n.password}`),o+="@");let i=`${n.protocol}//${o}${n.hostname}:${r}${n.pathname}`;return i.endsWith("/")&&(i=i.slice(0,-1)),i},qRt=Object.defineProperty,GRt=(t,e,n)=>e in t?qRt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nde=(t,e,n)=>(GRt(t,typeof e!="symbol"?e+"":e,n),n),dM=class{constructor(e){Nde(this,"config"),Nde(this,"fetch"),Nde(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=KRt(e?.host??OVe)),this.fetch=e?.fetch??fetch}abort(){for(let e of this.ongoingStreamedRequests)e.abort();this.ongoingStreamedRequests.length=0}async processStreamableRequest(e,n){n.stream=n.stream??!1;let r=`${this.config.host}/api/${e}`;if(n.stream){let i=new AbortController,s=await eC(this.fetch,r,n,{signal:i.signal,headers:this.config.headers});if(!s.body)throw new Error("Missing body");let a=HRt(s.body),l=new Rde(i,a,()=>{let c=this.ongoingStreamedRequests.indexOf(l);c>-1&&this.ongoingStreamedRequests.splice(c,1)});return this.ongoingStreamedRequests.push(l),l}return await(await eC(this.fetch,r,n,{headers:this.config.headers})).json()}async encodeImage(e){if(typeof e!="string"){let n=new Uint8Array(e),r="",o=n.byteLength;for(let i=0;i{$n();yde()});var $de,RVe=C(()=>{SVe();Kr();vI();v5();ac();jm();pI();Og();Uw();fM();Jo();Bd();Bu();$de=class extends dp{constructor(e){super(e??{});I(this,"model","llama3");I(this,"numa");I(this,"numCtx");I(this,"numBatch");I(this,"numGpu");I(this,"mainGpu");I(this,"lowVram");I(this,"f16Kv");I(this,"logitsAll");I(this,"vocabOnly");I(this,"useMmap");I(this,"useMlock");I(this,"embeddingOnly");I(this,"numThread");I(this,"numKeep");I(this,"seed");I(this,"numPredict");I(this,"topK");I(this,"topP");I(this,"tfsZ");I(this,"typicalP");I(this,"repeatLastN");I(this,"temperature");I(this,"repeatPenalty");I(this,"presencePenalty");I(this,"frequencyPenalty");I(this,"mirostat");I(this,"mirostatTau");I(this,"mirostatEta");I(this,"penalizeNewline");I(this,"streaming");I(this,"format");I(this,"keepAlive");I(this,"client");I(this,"checkOrPullModel",!1);I(this,"baseUrl","http://127.0.0.1:11434");I(this,"think");this.baseUrl=e?.baseUrl??In("OLLAMA_BASE_URL")??this.baseUrl,this.client=new dM({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,n){let{stream:r,insecure:o,logProgress:i}={stream:!0,...n};if(r)for await(let s of await this.client.pull({model:e,insecure:o,stream:r}))i&&console.log(s);else{let s=await this.client.pull({model:e,insecure:o});i&&console.log(s)}}bindTools(e,n){return this.withConfig({tools:e.map(r=>Gb(r)),...n})}getLsParams(e){let n=this.invocationParams(e);return{ls_provider:"ollama",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:n.options?.temperature??void 0,ls_max_tokens:n.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(n=>Gb(n)):void 0}}async checkModelExistsOnMachine(e){let{models:n}=await this.client.list();return!!n.find(r=>r.name===e||r.name===`${e}:latest`)}async _generate(e,n,r){n.signal?.throwIfAborted(),this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let s of this._streamResponseChunks(e,n,r))o?o=Um(o,s.message):o=s.message;let i=new kn({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,n,r){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(n),i=_Ve(e),s={input_tokens:0,output_tokens:0,total_tokens:0},a=await this.client.chat({...o,messages:i,stream:!0}),l;for await(let c of a){if(n.signal?.aborted){this.client.abort();return}let{message:u,...d}=c;s.input_tokens+=d.prompt_eval_count??0,s.output_tokens+=d.eval_count??0,s.total_tokens=s.input_tokens+s.output_tokens,l=d;let f=this.think?u.thinking??u.content??"":u.content??"",p=new Jr({text:f,message:CVe(u)});yield p,await r?.handleLLMNewToken(f,void 0,void 0,void 0,void 0,{chunk:p})}yield new Jr({text:"",message:new Yt({content:"",response_metadata:{...l,model_provider:"ollama"},usage_metadata:s})})}withStructuredOutput(e,n){let r,o,{schema:i,name:s,includeRaw:a}={...n,schema:e},l=n?.method??"jsonSchema";if(l==="functionCalling"){let f=s??"extract";if(jr(i)){let p=Hr(i);r=this.bindTools([{type:"function",function:{name:f,description:p.description,parameters:p}}]).withConfig({ls_structured_output_format:{kwargs:{method:l},schema:p}}),o=new up({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},r=this.bindTools([{type:"function",function:p}]).withConfig({ls_structured_output_format:{kwargs:{method:l},schema:i}}),o=new up({returnSingle:!0,keyName:f})}}else if(l==="jsonMode"){o=jr(i)?Vm.fromZodSchema(i):new Gd;let f=Hr(i);r=this.withConfig({format:"json",ls_structured_output_format:{kwargs:{method:l},schema:f}})}else if(l==="jsonSchema"){o=jr(i)?Vm.fromZodSchema(i):new Gd;let f=Hr(i);r=this.withConfig({format:f,ls_structured_output_format:{kwargs:{method:l},schema:f}})}else throw new TypeError(`Unrecognized structured output method '${l}'. Expected one of 'functionCalling', 'jsonMode', or 'jsonSchema'`);if(!a)return r.pipe(o).withConfig({runName:"ChatOllamaStructuredOutput"});let c=xl.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),u=xl.assign({parsed:()=>null}),d=c.withFallbacks({fallbacks:[u]});return Kc.from([{raw:r},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var Fde,LVe=C(()=>{v5();Jo();dU();Fde=class extends Qb{constructor(e){super({maxConcurrency:1,...e});I(this,"model","mxbai-embed-large");I(this,"baseUrl","http://localhost:11434");I(this,"dimensions");I(this,"keepAlive");I(this,"requestOptions");I(this,"client");I(this,"truncate",!1);this.baseUrl=e?.baseUrl??In("OLLAMA_BASE_URL")??this.baseUrl,this.client=new dM({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 n={},r={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 s=r[o];s?n[s]=i:n[o]=i}return n}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 Ude=C(()=>{$n();k2();Hb();Og();ac();qd()});var DVe=C(()=>{v5();ac();Jo();Ude()});var Bde=C(()=>{RVe();LVe();DVe()});function pU(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 $Ve=C(()=>{});function Zt(t,e,n,r,o){if(r==="m")throw new TypeError("Private method is not writable");if(r==="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 r==="a"?o.call(t,n):o?o.value=n:e.set(t,n),n}function de(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}var fp=C(()=>{});var zde,jde=C(()=>{zde=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return zde=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),n=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^n()&15>>+r/4).toString(16))}});function mU(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var hU,x5=C(()=>{hU=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 st,Bi,zi,tC,Fg,pM,mM,hM,gM,yM,wM,vM,xM,bM,CM,Ug,_I,gU,pp=C(()=>{x5();st=class extends Error{},Bi=class t extends st{constructor(e,n,r,o){super(`${t.makeMessage(e,n,r)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=n;let i=n;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,n,r){let o=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):r;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,n,r,o){if(!e||!o)return new tC({message:r,cause:hU(n)});let i=n?.error;return e===400?new pM(e,i,r,o):e===401?new mM(e,i,r,o):e===403?new hM(e,i,r,o):e===404?new gM(e,i,r,o):e===409?new yM(e,i,r,o):e===422?new wM(e,i,r,o):e===429?new vM(e,i,r,o):e>=500?new xM(e,i,r,o):new t(e,i,r,o)}},zi=class extends Bi{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},tC=class extends Bi{constructor({message:e,cause:n}){super(void 0,void 0,e||"Connection error.",void 0),n&&(this.cause=n)}},Fg=class extends tC{constructor({message:e}={}){super({message:e??"Request timed out."})}},pM=class extends Bi{},mM=class extends Bi{},hM=class extends Bi{},gM=class extends Bi{},yM=class extends Bi{},wM=class extends Bi{},vM=class extends Bi{},xM=class extends Bi{},bM=class extends st{constructor(){super("Could not parse response content as the length limit was reached")}},CM=class extends st{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ug=class extends Error{constructor(e){super(e)}},_I=class extends Bi{constructor(e,n,r){let o="OAuth2 authentication error",i;if(n&&typeof n=="object"){let s=n;i=s.error;let a=s.error_description;a&&typeof a=="string"?o=a:i&&(o=i)}super(e,n,o,r),this.error_code=i}},gU=class extends st{constructor(e,n,r){super(e),this.provider=n,this.cause=r}}});function b5(t){return typeof t!="object"?{}:t??{}}function Wde(t){if(!t)return!0;for(let e in t)return!1;return!0}function UVe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _M(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var ZRt,FVe,cc,Vde,BVe,zVe,zw=C(()=>{pp();ZRt=/^[a-z][a-z0-9+.-]*:/i,FVe=t=>ZRt.test(t),cc=t=>(cc=Array.isArray,cc(t)),Vde=cc;BVe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new st(`${t} must be an integer`);if(e<0)throw new st(`${t} must be a positive integer`);return e},zVe=t=>{try{return JSON.parse(t)}catch{return}}});var Bg,SM=C(()=>{Bg=t=>new Promise(e=>setTimeout(e,t))});var nC,Hde=C(()=>{nC="6.37.0"});function JRt(){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 QRt(){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:n}of t){let r=n.exec(navigator.userAgent);if(r){let o=r[1]||0,i=r[2]||0,s=r[3]||0;return{browser:e,version:`${o}.${i}.${s}`}}}return null}var HVe,XRt,jVe,VVe,WVe,KVe,Kde=C(()=>{Hde();HVe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";XRt=()=>{let t=JRt();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":nC,"X-Stainless-OS":VVe(Deno.build.os),"X-Stainless-Arch":jVe(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":nC,"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":nC,"X-Stainless-OS":VVe(globalThis.process.platform??"unknown"),"X-Stainless-Arch":jVe(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=QRt();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":nC,"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":nC,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};jVe=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",VVe=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"),KVe=()=>WVe??(WVe=XRt())});function C5(){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 qde(...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 _5(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return qde({start(){},async pull(n){let{done:r,value:o}=await e.next();r?n.close():n.enqueue(o)},async cancel(){await e.return?.()}})}function Gde(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let n=await e.read();return n?.done&&e.releaseLock(),n}catch(n){throw e.releaseLock(),n}},async return(){let n=e.cancel();return e.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Yde(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),n=e.cancel();e.releaseLock(),await n}var TM=C(()=>{});var GVe,YVe=C(()=>{GVe=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var Zde,Jde,Xde,ZVe,Qde=C(()=>{Zde="RFC3986",Jde=t=>String(t),Xde={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Jde},ZVe="RFC1738"});function XVe(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function tfe(t,e){if(cc(t)){let n=[];for(let r=0;r{Qde();zw();S5=(t,e)=>(S5=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),S5(t,e)),zg=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),efe=1024,JVe=(t,e,n,r,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)),n==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a=efe?i.slice(a,a+efe):i,c=[];for(let u=0;u=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===ZVe&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=zg[d];continue}if(d<2048){c[c.length]=zg[192|d>>6]+zg[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=zg[224|d>>12]+zg[128|d>>6&63]+zg[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=zg[240|d>>18]+zg[128|d>>12&63]+zg[128|d>>6&63]+zg[128|d&63]}s+=c.join("")}return s}});function tLt(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function rWe(t,e,n,r,o,i,s,a,l,c,u,d,f,p,m,h,g,y){let w=t,v=y,x=0,b=!1;for(;(v=v.get(nfe))!==void 0&&!b;){let A=v.get(t);if(x+=1,typeof A<"u"){if(A===x)throw new RangeError("Cyclic object value");b=!0}typeof v.get(nfe)>"u"&&(x=0)}if(typeof c=="function"?w=c(e,w):w instanceof Date?w=f?.(w):n==="comma"&&cc(w)&&(w=tfe(w,function(A){return A instanceof Date?f?.(A):A})),w===null){if(i)return l&&!h?l(e,qs.encoder,g,"key",p):e;w=""}if(tLt(w)||XVe(w)){if(l){let A=h?e:l(e,qs.encoder,g,"key",p);return[m?.(A)+"="+m?.(l(w,qs.encoder,g,"value",p))]}return[m?.(e)+"="+m?.(String(w))]}let _=[];if(typeof w>"u")return _;let T;if(n==="comma"&&cc(w))h&&l&&(w=tfe(w,l)),T=[{value:w.length>0?w.join(",")||null:void 0}];else if(cc(c))T=c;else{let A=Object.keys(w);T=u?A.sort(u):A}let S=a?String(e).replace(/\./g,"%2E"):String(e),P=r&&cc(w)&&w.length===1?S+"[]":S;if(o&&cc(w)&&w.length===0)return P+"[]";for(let A=0;A"u"?t.encodeDotInKeys?!0:qs.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:qs.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:qs.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:qs.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?qs.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:qs.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:qs.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:qs.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:qs.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:qs.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:qs.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:qs.strictNullHandling}}function oWe(t,e={}){let n=t,r=nLt(e),o,i;typeof r.filter=="function"?(i=r.filter,n=i("",n)):cc(r.filter)&&(i=r.filter,o=i);let s=[];if(typeof n!="object"||n===null)return"";let a=tWe[r.arrayFormat],l=a==="comma"&&r.commaRoundTrip;o||(o=Object.keys(n)),r.sort&&o.sort(r.sort);let c=new WeakMap;for(let f=0;f0?d+u:""}var tWe,nWe,eWe,qs,nfe,iWe=C(()=>{QVe();Qde();zw();tWe={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},nWe=function(t,e){Array.prototype.push.apply(t,cc(e)?e:[e])},qs={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:JVe,encodeValuesOnly:!1,format:Zde,formatter:Jde,indices:!1,serializeDate(t){return(eWe??(eWe=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};nfe={}});function sWe(t){return oWe(t,{arrayFormat:"brackets"})}var rfe=C(()=>{iWe()});function cWe(t){let e=0;for(let o of t)e+=o.length;let n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function IM(t){let e;return(aWe??(e=new globalThis.TextEncoder,aWe=e.encode.bind(e)))(t)}function ofe(t){let e;return(lWe??(e=new globalThis.TextDecoder,lWe=e.decode.bind(e)))(t)}var aWe,lWe,T5=C(()=>{});function oLt(t,e){for(let o=e??0;o{fp();T5();SI=class{constructor(){Yd.set(this,void 0),Zd.set(this,void 0),Zt(this,Yd,new Uint8Array,"f"),Zt(this,Zd,null,"f")}decode(e){if(e==null)return[];let n=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?IM(e):e;Zt(this,Yd,cWe([de(this,Yd,"f"),n]),"f");let r=[],o;for(;(o=oLt(de(this,Yd,"f"),de(this,Zd,"f")))!=null;){if(o.carriage&&de(this,Zd,"f")==null){Zt(this,Zd,o.index,"f");continue}if(de(this,Zd,"f")!=null&&(o.index!==de(this,Zd,"f")+1||o.carriage)){r.push(ofe(de(this,Yd,"f").subarray(0,de(this,Zd,"f")-1))),Zt(this,Yd,de(this,Yd,"f").subarray(de(this,Zd,"f")),"f"),Zt(this,Zd,null,"f");continue}let i=de(this,Zd,"f")!==null?o.preceding-1:o.preceding,s=ofe(de(this,Yd,"f").subarray(0,i));r.push(s),Zt(this,Yd,de(this,Yd,"f").subarray(o.index),"f"),Zt(this,Zd,null,"f")}return r}flush(){return de(this,Yd,"f").length?this.decode(` `):[]}};Yd=new WeakMap,Zd=new WeakMap;SI.NEWLINE_CHARS=new Set([` `,"\r"]);SI.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function yU(){}function I5(t,e,n){return!e||P5[t]>P5[n]?yU:e[t].bind(e)}function os(t){let e=t.logger,n=t.logLevel??"off";if(!e)return iLt;let r=fWe.get(e);if(r&&r[0]===n)return r[1];let o={error:I5("error",e,n),warn:I5("warn",e,n),info:I5("info",e,n),debug:I5("debug",e,n)};return fWe.set(e,[n,o]),o}var P5,ife,iLt,fWe,jw,wU=C(()=>{zw();P5={off:0,error:200,warn:300,info:400,debug:500},ife=(t,e,n)=>{if(t){if(UVe(P5,t))return t;os(n).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(P5))}`)}};iLt={error:yU,warn:yU,info:yU,debug:yU},fWe=new WeakMap;jw=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,n])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="api-key"||e.toLowerCase()==="x-api-key"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t)});async function*sLt(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new st("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 st("Attempted to iterate over a response with no body");let n=new sfe,r=new SI,o=Gde(t.body);for await(let i of aLt(o))for(let s of r.decode(i)){let a=n.decode(s);a&&(yield a)}for(let i of r.flush()){let s=n.decode(i);s&&(yield s)}}async function*aLt(t){let e=new Uint8Array;for await(let n of t){if(n==null)continue;let r=n instanceof ArrayBuffer?new Uint8Array(n):typeof n=="string"?IM(n):n,o=new Uint8Array(e.length+r.length);o.set(e),o.set(r,e.length),e=o;let i;for(;(i=uWe(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function lLt(t,e){let n=t.indexOf(e);return n!==-1?[t.substring(0,n),e,t.substring(n+e.length)]:[t,"",""]}var vU,jg,sfe,afe=C(()=>{fp();pp();TM();dWe();TM();x5();T5();wU();pp();jg=class t{constructor(e,n,r){this.iterator=e,vU.set(this,void 0),this.controller=n,Zt(this,vU,r,"f")}static fromSSEResponse(e,n,r,o){let i=!1,s=r?os(r):console;async function*a(){if(i)throw new st("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let l=!1;try{for await(let c of sLt(e,n))if(!l){if(c.data.startsWith("[DONE]")){l=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let u;try{u=JSON.parse(c.data)}catch(d){throw s.error("Could not parse message into JSON:",c.data),s.error("From chunk:",c.raw),d}if(u&&u.error)throw new Bi(void 0,u.error,void 0,e.headers);yield o?{event:c.event,data:u}:u}else{let u;try{u=JSON.parse(c.data)}catch(d){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),d}if(c.event=="error")throw new Bi(void 0,u.error,u.message,void 0);yield{event:c.event,data:u}}}l=!0}catch(c){if(mU(c))return;throw c}finally{l||n.abort()}}return new t(a,n,r)}static fromReadableStream(e,n,r){let o=!1;async function*i(){let a=new SI,l=Gde(e);for await(let c of l)for(let u of a.decode(c))yield u;for(let c of a.flush())yield c}async function*s(){if(o)throw new st("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let l of i())a||l&&(yield JSON.parse(l));a=!0}catch(l){if(mU(l))return;throw l}finally{a||n.abort()}}return new t(s,n,r)}[(vU=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],n=[],r=this.iterator(),o=i=>({next:()=>{if(i.length===0){let s=r.next();e.push(s),n.push(s)}return i.shift()}});return[new t(()=>o(e),this.controller,de(this,vU,"f")),new t(()=>o(n),this.controller,de(this,vU,"f"))]}toReadableStream(){let e=this,n;return qde({async start(){n=e[Symbol.asyncIterator]()},async pull(r){try{let{value:o,done:i}=await n.next();if(i)return r.close();let s=IM(JSON.stringify(o)+` `);r.enqueue(s)}catch(o){r.error(o)}},async cancel(){await n.return?.()}})}};sfe=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[n,r,o]=lLt(e,":");return o.startsWith(" ")&&(o=o.substring(1)),n==="event"?this.event=o:n==="data"&&this.data.push(o),null}}});async function E5(t,e){let{response:n,requestLogID:r,retryOfRequestLogID:o,startTime:i}=e,s=await(async()=>{if(e.options.stream)return os(t).debug("response",n.status,n.url,n.headers,n.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(n,e.controller,t,e.options.__synthesizeEventData):jg.fromSSEResponse(n,e.controller,t,e.options.__synthesizeEventData);if(n.status===204)return null;if(e.options.__binaryResponse)return n;let l=n.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){if(n.headers.get("content-length")==="0")return;let f=await n.json();return lfe(f,n)}return await n.text()})();return os(t).debug(`[${r}] response parsed`,jw({retryOfRequestLogID:o,url:n.url,status:n.status,body:s,durationMs:Date.now()-i})),s}function lfe(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 cfe=C(()=>{afe();wU()});var xU,TI,A5=C(()=>{fp();cfe();TI=class t extends Promise{constructor(e,n,r=E5){super(o=>{o(null)}),this.responsePromise=n,this.parseResponse=r,xU.set(this,void 0),Zt(this,xU,e,"f")}_thenUnwrap(e){return new t(de(this,xU,"f"),this.responsePromise,async(n,r)=>lfe(e(await this.parseResponse(n,r),r),r.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,n]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:n,request_id:n.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(de(this,xU,"f"),e))),this.parsedPromise}then(e,n){return this.parse().then(e,n)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};xU=new WeakMap});var k5,PM,bU,uc,Fn,Xr,Cs,Pn=C(()=>{fp();pp();cfe();A5();zw();PM=class{constructor(e,n,r,o){k5.set(this,void 0),Zt(this,k5,e,"f"),this.options=o,this.response=n,this.body=r}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new st("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await de(this,k5,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(k5=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let n of e.getPaginatedItems())yield n}},bU=class extends TI{constructor(e,n,r){super(e,n,async(o,i)=>new r(o,i.response,await E5(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let n of e)yield n}},uc=class extends PM{constructor(e,n,r,o){super(e,n,r,o),this.data=r.data||[],this.object=r.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},Fn=class extends PM{constructor(e,n,r,o){super(e,n,r,o),this.data=r.data||[],this.has_more=r.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),n=e[e.length-1]?.id;return n?{...this.options,query:{...b5(this.options.query),after:n}}:null}},Xr=class extends PM{constructor(e,n,r,o){super(e,n,r,o),this.data=r.data||[],this.has_more=r.has_more||!1,this.last_id=r.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:{...b5(this.options.query),after:e}}:null}},Cs=class extends PM{constructor(e,n,r,o){super(e,n,r,o),this.data=r.data||[],this.has_more=r.has_more||!1,this.next=r.next||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next;return e?{...this.options,query:{...b5(this.options.query),after:e}}:null}}});var uLt,dLt,M5,pWe=C(()=>{TM();pp();uLt={jwt:"urn:ietf:params:oauth:token-type:jwt",id:"urn:ietf:params:oauth:token-type:id_token"},dLt="urn:ietf:params:oauth:grant-type:token-exchange",M5=class{constructor(e,n){this.cachedToken=null,this.refreshPromise=null,this.tokenExchangeUrl="https://auth.openai.com/oauth/token",this.config=e,this.fetch=n??C5()}async getToken(){if(!this.cachedToken||this.isTokenExpired(this.cachedToken)){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.refreshToken();try{return await this.refreshPromise}finally{this.refreshPromise=null}}return this.needsRefresh(this.cachedToken)&&!this.refreshPromise&&(this.refreshPromise=this.refreshToken().finally(()=>{this.refreshPromise=null})),this.cachedToken.token}async refreshToken(){let e=await this.config.provider.getToken(),n=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:dLt,client_id:this.config.clientId,subject_token:e,subject_token_type:uLt[this.config.provider.tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId})});if(!n.ok){let s=await n.text(),a;try{a=JSON.parse(s)}catch{}throw n.status===400||n.status===401||n.status===403?new _I(n.status,a,n.headers):Bi.generate(n.status,a,`Token exchange failed with status ${n.status}`,n.headers)}let r=await n.json(),o=r.expires_in||3600,i=Date.now()+o*1e3;return this.cachedToken={token:r.access_token,expiresAt:i},r.access_token}isTokenExpired(e){return Date.now()>=e.expiresAt}needsRefresh(e){let r=(this.config.refreshBufferSeconds??1200)*1e3;return Date.now()>=e.expiresAt-r}invalidateToken(){this.cachedToken=null,this.refreshPromise=null}}});function EM(t,e,n){return ffe(),new File(t,e??"unknown_file",n)}function CU(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 fLt(t){let e=typeof t=="function"?t:t.fetch,n=mWe.get(e);if(n)return n;let r=(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 mWe.set(e,r),r}var ffe,N5,rC,dc,mWe,hWe,gWe,pLt,ufe,dfe,mp=C(()=>{TM();ffe=()=>{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`.":""))}};N5=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",rC=async(t,e)=>ufe(t.body)?{...t,body:await hWe(t.body,e)}:t,dc=async(t,e)=>({...t,body:await hWe(t.body,e)}),mWe=new WeakMap;hWe=async(t,e)=>{if(!await fLt(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let n=new FormData;return await Promise.all(Object.entries(t||{}).map(([r,o])=>dfe(n,r,o))),n},gWe=t=>t instanceof Blob&&"name"in t,pLt=t=>typeof t=="object"&&t!==null&&(t instanceof Response||N5(t)||gWe(t)),ufe=t=>{if(pLt(t))return!0;if(Array.isArray(t))return t.some(ufe);if(t&&typeof t=="object"){for(let e in t)if(ufe(t[e]))return!0}return!1},dfe=async(t,e,n)=>{if(n!==void 0){if(n==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")t.append(e,String(n));else if(n instanceof Response)t.append(e,EM([await n.blob()],CU(n)));else if(N5(n))t.append(e,EM([await new Response(_5(n)).blob()],CU(n)));else if(gWe(n))t.append(e,n,CU(n));else if(Array.isArray(n))await Promise.all(n.map(r=>dfe(t,e+"[]",r)));else if(typeof n=="object")await Promise.all(Object.entries(n).map(([r,o])=>dfe(t,`${e}[${r}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}}});async function _U(t,e,n){if(ffe(),t=await t,mLt(t))return t instanceof File?t:EM([await t.arrayBuffer()],t.name);if(hLt(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),EM(await pfe(o),e,n)}let r=await pfe(t);if(e||(e=CU(t)),!n?.type){let o=r.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(n={...n,type:o})}return EM(r,e,n)}async function pfe(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(yWe(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(N5(t))for await(let n of t)e.push(...await pfe(n));else{let n=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${n?`; constructor: ${n}`:""}${gLt(t)}`)}return e}function gLt(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(n=>`"${n}"`).join(", ")}]`}var yWe,mLt,hLt,wWe=C(()=>{mp();mp();yWe=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",mLt=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&yWe(t),hLt=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var mfe=C(()=>{wWe()});var le,Ge=C(()=>{le=class{constructor(e){this._client=e}}});function xWe(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var vWe,wLt,Q,Qt=C(()=>{pp();vWe=Object.freeze(Object.create(null)),wLt=(t=xWe)=>function(n,...r){if(n.length===1)return n[0];let o=!1,i=[],s=n.reduce((u,d,f)=>{/[?#]/.test(d)&&(o=!0);let p=r[f],m=(o?encodeURIComponent:t)(""+p);return f!==r.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??vWe)??vWe)?.toString)&&(m=p+"",i.push({start:u.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),u+d+(f===r.length?"":m)},""),a=s.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(a))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((u,d)=>u.start-d.start),i.length>0){let u=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-u),h="^".repeat(p.length);return u=p.start+p.length,f+m+h},"");throw new st(`Path parameters result in path with invalid segments: ${i.map(f=>f.error).join(` `)} ${s} ${d}`)}return s},Q=wLt(xWe)});var II,O5=C(()=>{Ge();Pn();Qt();II=class extends le{list(e,n={},r){return this._client.getAPIList(Q`/chat/completions/${e}/messages`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}}});var Wm=C(()=>{pp()});function SU(t){return t!==void 0&&"function"in t&&t.function!==void 0}function bWe(t,e){let n={...t};return Object.defineProperties(n,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),n}function TU(t){return t?.$brand==="auto-parseable-response-format"}function PI(t){return t?.$brand==="auto-parseable-tool"}function CWe(t,e){return!e||!hfe(e)?{...t,choices:t.choices.map(n=>(SWe(n.message.tool_calls),{...n,message:{...n.message,parsed:null,...n.message.tool_calls?{tool_calls:n.message.tool_calls}:void 0}}))}:IU(t,e)}function IU(t,e){let n=t.choices.map(r=>{if(r.finish_reason==="length")throw new bM;if(r.finish_reason==="content_filter")throw new CM;return SWe(r.message.tool_calls),{...r,message:{...r.message,...r.message.tool_calls?{tool_calls:r.message.tool_calls?.map(o=>CLt(e,o))??void 0}:void 0,parsed:r.message.content&&!r.message.refusal?bLt(e,r.message.content):null}}});return{...t,choices:n}}function bLt(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 CLt(t,e){let n=t.tools?.find(r=>SU(r)&&r.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:PI(n)?n.$parseRaw(e.function.arguments):n?.function.strict?JSON.parse(e.function.arguments):null}}}function _We(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let n=t.tools?.find(r=>SU(r)&&r.function?.name===e.function.name);return SU(n)&&(PI(n)||n?.function.strict||!1)}function hfe(t){return TU(t.response_format)?!0:t.tools?.some(e=>PI(e)||e.type==="function"&&e.function.strict===!0)??!1}function SWe(t){for(let e of t||[])if(e.type!=="function")throw new st(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function TWe(t){for(let e of t??[]){if(e.type!=="function")throw new st(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new st(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var AM=C(()=>{Wm()});var kM,gfe,yfe=C(()=>{kM=t=>t?.role==="assistant",gfe=t=>t?.role==="tool"});var wfe,R5,L5,PU,EU,D5,AU,Vw,kU,$5,F5,MM,IWe,oC,U5=C(()=>{fp();Wm();oC=class{constructor(){wfe.add(this),this.controller=new AbortController,R5.set(this,void 0),L5.set(this,()=>{}),PU.set(this,()=>{}),EU.set(this,void 0),D5.set(this,()=>{}),AU.set(this,()=>{}),Vw.set(this,{}),kU.set(this,!1),$5.set(this,!1),F5.set(this,!1),MM.set(this,!1),Zt(this,R5,new Promise((e,n)=>{Zt(this,L5,e,"f"),Zt(this,PU,n,"f")}),"f"),Zt(this,EU,new Promise((e,n)=>{Zt(this,D5,e,"f"),Zt(this,AU,n,"f")}),"f"),de(this,R5,"f").catch(()=>{}),de(this,EU,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},de(this,wfe,"m",IWe).bind(this))},0)}_connected(){this.ended||(de(this,L5,"f").call(this),this._emit("connect"))}get ended(){return de(this,kU,"f")}get errored(){return de(this,$5,"f")}get aborted(){return de(this,F5,"f")}abort(){this.controller.abort()}on(e,n){return(de(this,Vw,"f")[e]||(de(this,Vw,"f")[e]=[])).push({listener:n}),this}off(e,n){let r=de(this,Vw,"f")[e];if(!r)return this;let o=r.findIndex(i=>i.listener===n);return o>=0&&r.splice(o,1),this}once(e,n){return(de(this,Vw,"f")[e]||(de(this,Vw,"f")[e]=[])).push({listener:n,once:!0}),this}emitted(e){return new Promise((n,r)=>{Zt(this,MM,!0,"f"),e!=="error"&&this.once("error",r),this.once(e,n)})}async done(){Zt(this,MM,!0,"f"),await de(this,EU,"f")}_emit(e,...n){if(de(this,kU,"f"))return;e==="end"&&(Zt(this,kU,!0,"f"),de(this,D5,"f").call(this));let r=de(this,Vw,"f")[e];if(r&&(de(this,Vw,"f")[e]=r.filter(o=>!o.once),r.forEach(({listener:o})=>o(...n))),e==="abort"){let o=n[0];!de(this,MM,"f")&&!r?.length&&Promise.reject(o),de(this,PU,"f").call(this,o),de(this,AU,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=n[0];!de(this,MM,"f")&&!r?.length&&Promise.reject(o),de(this,PU,"f").call(this,o),de(this,AU,"f").call(this,o),this._emit("end")}}_emitFinal(){}};R5=new WeakMap,L5=new WeakMap,PU=new WeakMap,EU=new WeakMap,D5=new WeakMap,AU=new WeakMap,Vw=new WeakMap,kU=new WeakMap,$5=new WeakMap,F5=new WeakMap,MM=new WeakMap,wfe=new WeakSet,IWe=function(e){if(Zt(this,$5,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new zi),e instanceof zi)return Zt(this,F5,!0,"f"),this._emit("abort",e);if(e instanceof st)return this._emit("error",e);if(e instanceof Error){let n=new st(e.message);return n.cause=e,this._emit("error",n)}return this._emit("error",new st(String(e)))}});function PWe(t){return typeof t.parse=="function"}var vfe=C(()=>{});var Gc,xfe,B5,bfe,Cfe,_fe,EWe,AWe,_Lt,NM,Sfe=C(()=>{fp();Wm();AM();yfe();U5();vfe();_Lt=10,NM=class extends oC{constructor(){super(...arguments),Gc.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let n=e.choices[0]?.message;return n&&this._addMessage(n),e}_addMessage(e,n=!0){if("content"in e||(e.content=null),this.messages.push(e),n){if(this._emit("message",e),gfe(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(kM(e)&&e.tool_calls)for(let r of e.tool_calls)r.type==="function"&&this._emit("functionToolCall",r.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new st("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),de(this,Gc,"m",xfe).call(this)}async finalMessage(){return await this.done(),de(this,Gc,"m",B5).call(this)}async finalFunctionToolCall(){return await this.done(),de(this,Gc,"m",bfe).call(this)}async finalFunctionToolCallResult(){return await this.done(),de(this,Gc,"m",Cfe).call(this)}async totalUsage(){return await this.done(),de(this,Gc,"m",_fe).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let n=de(this,Gc,"m",B5).call(this);n&&this._emit("finalMessage",n);let r=de(this,Gc,"m",xfe).call(this);r&&this._emit("finalContent",r);let o=de(this,Gc,"m",bfe).call(this);o&&this._emit("finalFunctionToolCall",o);let i=de(this,Gc,"m",Cfe).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(s=>s.usage)&&this._emit("totalUsage",de(this,Gc,"m",_fe).call(this))}async _createChatCompletion(e,n,r){let o=r?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,Gc,"m",EWe).call(this,n);let i=await e.chat.completions.create({...n,stream:!1},{...r,signal:this.controller.signal});return this._connected(),this._addChatCompletion(IU(i,n))}async _runChatCompletion(e,n,r){for(let o of n.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,n,r)}async _runTools(e,n,r){let o="tool",{tool_choice:i="auto",stream:s,...a}=n,l=typeof i!="string"&&i.type==="function"&&i?.function?.name,{maxChatCompletions:c=_Lt}=r||{},u=n.tools.map(p=>{if(PI(p)){if(!p.$callback)throw new st("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 u)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in n?u.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 n.messages)this._addMessage(p,!1);for(let p=0;pJSON.stringify(P)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:S});continue}let b;try{b=PWe(x)?await x.parse(v):v}catch(S){let P=S instanceof Error?S.message:String(S);this._addMessage({role:o,tool_call_id:y,content:P});continue}let _=await x.function(b,this),T=de(this,Gc,"m",AWe).call(this,_);if(this._addMessage({role:o,tool_call_id:y,content:T}),l)return}}}};Gc=new WeakSet,xfe=function(){return de(this,Gc,"m",B5).call(this).content??null},B5=function(){let e=this.messages.length;for(;e-- >0;){let n=this.messages[e];if(kM(n))return{...n,content:n.content??null,refusal:n.refusal??null}}throw new st("stream ended without producing a ChatCompletionMessage with role=assistant")},bfe=function(){for(let e=this.messages.length-1;e>=0;e--){let n=this.messages[e];if(kM(n)&&n?.tool_calls?.length)return n.tool_calls.filter(r=>r.type==="function").at(-1)?.function}},Cfe=function(){for(let e=this.messages.length-1;e>=0;e--){let n=this.messages[e];if(gfe(n)&&n.content!=null&&typeof n.content=="string"&&this.messages.some(r=>r.role==="assistant"&&r.tool_calls?.some(o=>o.type==="function"&&o.id===n.tool_call_id)))return n.content}},_fe=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:n}of this._chatCompletions)n&&(e.completion_tokens+=n.completion_tokens,e.prompt_tokens+=n.prompt_tokens,e.total_tokens+=n.total_tokens);return e},EWe=function(e){if(e.n!=null&&e.n>1)throw new st("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},AWe=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var MU,Tfe=C(()=>{Sfe();yfe();MU=class t extends NM{static runTools(e,n,r){let o=new t,i={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,n,i)),o}_addMessage(e,n=!0){super._addMessage(e,n),kM(e)&&e.content&&this._emit("content",e.content)}}});function SLt(t,e=$a.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return TLt(t.trim(),e)}var $a,Ife,Pfe,TLt,Efe,kWe=C(()=>{$a={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},Ife=class extends Error{},Pfe=class extends Error{};TLt=(t,e)=>{let n=t.length,r=0,o=f=>{throw new Ife(`${f} at position ${r}`)},i=f=>{throw new Pfe(`${f} at position ${r}`)},s=()=>(d(),r>=n&&o("Unexpected end of input"),t[r]==='"'?a():t[r]==="{"?l():t[r]==="["?c():t.substring(r,r+4)==="null"||$a.NULL&e&&n-r<4&&"null".startsWith(t.substring(r))?(r+=4,null):t.substring(r,r+4)==="true"||$a.BOOL&e&&n-r<4&&"true".startsWith(t.substring(r))?(r+=4,!0):t.substring(r,r+5)==="false"||$a.BOOL&e&&n-r<5&&"false".startsWith(t.substring(r))?(r+=5,!1):t.substring(r,r+8)==="Infinity"||$a.INFINITY&e&&n-r<8&&"Infinity".startsWith(t.substring(r))?(r+=8,1/0):t.substring(r,r+9)==="-Infinity"||$a.MINUS_INFINITY&e&&1{let f=r,p=!1;for(r++;r{r++,d();let f={};try{for(;t[r]!=="}";){if(d(),r>=n&&$a.OBJ&e)return f;let p=a();d(),r++;try{let m=s();Object.defineProperty(f,p,{value:m,writable:!0,enumerable:!0,configurable:!0})}catch(m){if($a.OBJ&e)return f;throw m}d(),t[r]===","&&r++}}catch{if($a.OBJ&e)return f;o("Expected '}' at end of object")}return r++,f},c=()=>{r++;let f=[];try{for(;t[r]!=="]";)f.push(s()),d(),t[r]===","&&r++}catch{if($a.ARR&e)return f;o("Expected ']' at end of array")}return r++,f},u=()=>{if(r===0){t==="-"&&$a.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if($a.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=r;for(t[r]==="-"&&r++;t[r]&&!",]}".includes(t[r]);)r++;r==n&&!($a.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,r))}catch{t.substring(f,r)==="-"&&$a.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(m){i(String(m))}}},d=()=>{for(;rSLt(t,$a.ALL^$a.NUM)});var Afe=C(()=>{afe()});function ILt(t,e){let{id:n,choices:r,created:o,model:i,system_fingerprint:s,...a}=t,l={...a,id:n,choices:r.map(({message:c,finish_reason:u,index:d,logprobs:f,...p})=>{if(!u)throw new st(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:g,...y}=c,w=c.role;if(!w)throw new st(`missing role for choice ${d}`);if(h){let{arguments:v,name:x}=h;if(v==null)throw new st(`missing function_call.arguments for choice ${d}`);if(!x)throw new st(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:v,name:x},role:w,refusal:c.refusal??null},finish_reason:u,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:u,logprobs:f,message:{...y,role:w,content:m,refusal:c.refusal??null,tool_calls:g.map((v,x)=>{let{function:b,type:_,id:T,...S}=v,{arguments:P,name:A,...O}=b||{};if(T==null)throw new st(`missing choices[${d}].tool_calls[${x}].id ${V5(t)}`);if(_==null)throw new st(`missing choices[${d}].tool_calls[${x}].type ${V5(t)}`);if(A==null)throw new st(`missing choices[${d}].tool_calls[${x}].function.name ${V5(t)}`);if(P==null)throw new st(`missing choices[${d}].tool_calls[${x}].function.arguments ${V5(t)}`);return{...S,id:T,type:_,function:{...O,name:A,arguments:P}}})}}:{...p,message:{...y,content:m,role:w,refusal:c.refusal??null},finish_reason:u,index:d,logprobs:f}}),created:o,model:i,object:"chat.completion",...s?{system_fingerprint:s}:{}};return CWe(l,e)}function V5(t){return JSON.stringify(t)}var Gs,Ww,OM,iC,kfe,z5,Mfe,Nfe,Ofe,j5,Rfe,MWe,EI,W5=C(()=>{fp();kWe();Wm();AM();Afe();Sfe();EI=class t extends NM{constructor(e){super(),Gs.add(this),Ww.set(this,void 0),OM.set(this,void 0),iC.set(this,void 0),Zt(this,Ww,e,"f"),Zt(this,OM,[],"f")}get currentChatCompletionSnapshot(){return de(this,iC,"f")}static fromReadableStream(e){let n=new t(null);return n._run(()=>n._fromReadableStream(e)),n}static createChatCompletion(e,n,r){let o=new t(n);return o._run(()=>o._runChatCompletion(e,{...n,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,n,r){super._createChatCompletion;let o=r?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,Gs,"m",kfe).call(this);let i=await e.chat.completions.create({...n,stream:!0},{...r,signal:this.controller.signal});this._connected();for await(let s of i)de(this,Gs,"m",Mfe).call(this,s);if(i.controller.signal?.aborted)throw new zi;return this._addChatCompletion(de(this,Gs,"m",j5).call(this))}async _fromReadableStream(e,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),de(this,Gs,"m",kfe).call(this),this._connected();let o=jg.fromReadableStream(e,this.controller),i;for await(let s of o)i&&i!==s.id&&this._addChatCompletion(de(this,Gs,"m",j5).call(this)),de(this,Gs,"m",Mfe).call(this,s),i=s.id;if(o.controller.signal?.aborted)throw new zi;return this._addChatCompletion(de(this,Gs,"m",j5).call(this))}[(Ww=new WeakMap,OM=new WeakMap,iC=new WeakMap,Gs=new WeakSet,kfe=function(){this.ended||Zt(this,iC,void 0,"f")},z5=function(n){let r=de(this,OM,"f")[n.index];return r||(r={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},de(this,OM,"f")[n.index]=r,r)},Mfe=function(n){if(this.ended)return;let r=de(this,Gs,"m",MWe).call(this,n);this._emit("chunk",n,r);for(let o of n.choices){let i=r.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 s=de(this,Gs,"m",z5).call(this,i);i.finish_reason&&(de(this,Gs,"m",Ofe).call(this,i),s.current_tool_call_index!=null&&de(this,Gs,"m",Nfe).call(this,i,s.current_tool_call_index));for(let a of o.delta.tool_calls??[])s.current_tool_call_index!==a.index&&(de(this,Gs,"m",Ofe).call(this,i),s.current_tool_call_index!=null&&de(this,Gs,"m",Nfe).call(this,i,s.current_tool_call_index)),s.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let l=i.message.tool_calls?.[a.index];l?.type&&(l?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:l.function?.name,index:a.index,arguments:l.function.arguments,parsed_arguments:l.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(l?.type,void 0))}}},Nfe=function(n,r){if(de(this,Gs,"m",z5).call(this,n).done_tool_calls.has(r))return;let i=n.message.tool_calls?.[r];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 s=de(this,Ww,"f")?.tools?.find(a=>SU(a)&&a.function.name===i.function.name);this._emit("tool_calls.function.arguments.done",{name:i.function.name,index:r,arguments:i.function.arguments,parsed_arguments:PI(s)?s.$parseRaw(i.function.arguments):s?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Ofe=function(n){let r=de(this,Gs,"m",z5).call(this,n);if(n.message.content&&!r.content_done){r.content_done=!0;let o=de(this,Gs,"m",Rfe).call(this);this._emit("content.done",{content:n.message.content,parsed:o?o.$parseRaw(n.message.content):null})}n.message.refusal&&!r.refusal_done&&(r.refusal_done=!0,this._emit("refusal.done",{refusal:n.message.refusal})),n.logprobs?.content&&!r.logprobs_content_done&&(r.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:n.logprobs.content})),n.logprobs?.refusal&&!r.logprobs_refusal_done&&(r.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:n.logprobs.refusal}))},j5=function(){if(this.ended)throw new st("stream has ended, this shouldn't happen");let n=de(this,iC,"f");if(!n)throw new st("request ended without sending any chunks");return Zt(this,iC,void 0,"f"),Zt(this,OM,[],"f"),ILt(n,de(this,Ww,"f"))},Rfe=function(){let n=de(this,Ww,"f")?.response_format;return TU(n)?n:null},MWe=function(n){var r,o,i,s;let a=de(this,iC,"f"),{choices:l,...c}=n;a?Object.assign(a,c):a=Zt(this,iC,{...c,choices:[]},"f");for(let{delta:u,finish_reason:d,index:f,logprobs:p=null,...m}of n.choices){let h=a.choices[f];if(h||(h=a.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:_,refusal:T,...S}=p;Object.assign(h.logprobs,S),_&&((r=h.logprobs).content??(r.content=[]),h.logprobs.content.push(..._)),T&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...T))}if(d&&(h.finish_reason=d,de(this,Ww,"f")&&hfe(de(this,Ww,"f")))){if(d==="length")throw new bM;if(d==="content_filter")throw new CM}if(Object.assign(h,m),!u)continue;let{content:g,refusal:y,function_call:w,role:v,tool_calls:x,...b}=u;if(Object.assign(h.message,b),y&&(h.message.refusal=(h.message.refusal||"")+y),v&&(h.message.role=v),w&&(h.message.function_call?(w.name&&(h.message.function_call.name=w.name),w.arguments&&((i=h.message.function_call).arguments??(i.arguments=""),h.message.function_call.arguments+=w.arguments)):h.message.function_call=w),g&&(h.message.content=(h.message.content||"")+g,!h.message.refusal&&de(this,Gs,"m",Rfe).call(this)&&(h.message.parsed=Efe(h.message.content))),x){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:_,id:T,type:S,function:P,...A}of x){let O=(s=h.message.tool_calls)[_]??(s[_]={});Object.assign(O,A),T&&(O.id=T),S&&(O.type=S),P&&(O.function??(O.function={name:P.name??"",arguments:""})),P?.name&&(O.function.name=P.name),P?.arguments&&(O.function.arguments+=P.arguments,_We(de(this,Ww,"f"),O)&&(O.function.parsed_arguments=Efe(O.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],n=[],r=!1;return this.on("chunk",o=>{let i=n.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{r=!0;for(let o of n)o.resolve(void 0);n.length=0}),this.on("abort",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),this.on("error",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((i,s)=>n.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new jg(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var NU,Lfe=C(()=>{W5();NU=class t extends EI{static fromReadableStream(e){let n=new t(null);return n._run(()=>n._fromReadableStream(e)),n}static runTools(e,n,r){let o=new t(n),i={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,n,i)),o}}});var Hw,OU=C(()=>{Ge();O5();O5();Pn();Qt();Tfe();Lfe();W5();AM();Lfe();vfe();W5();Tfe();Hw=class extends le{constructor(){super(...arguments),this.messages=new II(this._client)}create(e,n){return this._client.post("/chat/completions",{body:e,...n,stream:e.stream??!1,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/chat/completions/${e}`,{...n,__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/chat/completions/${e}`,{body:n,...r,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/chat/completions",Fn,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/chat/completions/${e}`,{...n,__security:{bearerAuth:!0}})}parse(e,n){return TWe(e.tools),this._client.chat.completions.create(e,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(r=>IU(r,e))}runTools(e,n){return e.stream?NU.runTools(this._client,e,n):MU.runTools(this._client,e,n)}stream(e,n){return EI.createChatCompletion(this._client,e,n)}};Hw.Messages=II});var sC,Dfe=C(()=>{Ge();OU();OU();sC=class extends le{constructor(){super(...arguments),this.completions=new Hw(this._client)}};sC.Completions=Hw});var NWe=C(()=>{OU();OU();O5()});var OWe=C(()=>{Dfe();NWe()});var RWe=C(()=>{});var RM,$fe=C(()=>{Ge();Pn();Qt();RM=class extends le{create(e,n){return this._client.post("/organization/admin_api_keys",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n){return this._client.get(Q`/organization/admin_api_keys/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/admin_api_keys",Fn,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/admin_api_keys/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}}});var LM,Ffe=C(()=>{Ge();Pn();LM=class extends le{list(e={},n){return this._client.getAPIList("/organization/audit_logs",Xr,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}}});var DM,Ufe=C(()=>{Ge();Pn();Qt();DM=class extends le{create(e,n){return this._client.post("/organization/certificates",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n={},r){return this._client.get(Q`/organization/certificates/${e}`,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){return this._client.post(Q`/organization/certificates/${e}`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/certificates",Xr,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/certificates/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}activate(e,n){return this._client.getAPIList("/organization/certificates/activate",uc,{body:e,method:"post",...n,__security:{adminAPIKeyAuth:!0}})}deactivate(e,n){return this._client.getAPIList("/organization/certificates/deactivate",uc,{body:e,method:"post",...n,__security:{adminAPIKeyAuth:!0}})}}});var $M,Bfe=C(()=>{Ge();Pn();Qt();$M=class extends le{create(e,n){return this._client.post("/organization/invites",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n){return this._client.get(Q`/organization/invites/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/invites",Xr,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/invites/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}}});var FM,zfe=C(()=>{Ge();Pn();Qt();FM=class extends le{create(e,n){return this._client.post("/organization/roles",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){return this._client.post(Q`/organization/roles/${e}`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/roles",Cs,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}}});var UM,jfe=C(()=>{Ge();UM=class extends le{audioSpeeches(e,n){return this._client.get("/organization/usage/audio_speeches",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}audioTranscriptions(e,n){return this._client.get("/organization/usage/audio_transcriptions",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}codeInterpreterSessions(e,n){return this._client.get("/organization/usage/code_interpreter_sessions",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}completions(e,n){return this._client.get("/organization/usage/completions",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}costs(e,n){return this._client.get("/organization/costs",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}embeddings(e,n){return this._client.get("/organization/usage/embeddings",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}images(e,n){return this._client.get("/organization/usage/images",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}moderations(e,n){return this._client.get("/organization/usage/moderations",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}vectorStores(e,n){return this._client.get("/organization/usage/vector_stores",{query:e,...n,__security:{adminAPIKeyAuth:!0}})}}});var BM,Vfe=C(()=>{Ge();Pn();Qt();BM=class extends le{create(e,n,r){return this._client.post(Q`/organization/groups/${e}/roles`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/groups/${e}/roles`,Cs,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{group_id:o}=n;return this._client.delete(Q`/organization/groups/${o}/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var zM,Wfe=C(()=>{Ge();Pn();Qt();zM=class extends le{create(e,n,r){return this._client.post(Q`/organization/groups/${e}/users`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/groups/${e}/users`,Cs,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{group_id:o}=n;return this._client.delete(Q`/organization/groups/${o}/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var aC,Hfe=C(()=>{Ge();Vfe();Vfe();Wfe();Wfe();Pn();Qt();aC=class extends le{constructor(){super(...arguments),this.users=new zM(this._client),this.roles=new BM(this._client)}create(e,n){return this._client.post("/organization/groups",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){return this._client.post(Q`/organization/groups/${e}`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/groups",Cs,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/groups/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};aC.Users=zM;aC.Roles=BM});var jM,Kfe=C(()=>{Ge();Pn();Qt();jM=class extends le{retrieve(e,n,r){let{project_id:o}=n;return this._client.get(Q`/organization/projects/${o}/api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/api_keys`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o}=n;return this._client.delete(Q`/organization/projects/${o}/api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var VM,qfe=C(()=>{Ge();Pn();Qt();VM=class extends le{list(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/certificates`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}activate(e,n,r){return this._client.getAPIList(Q`/organization/projects/${e}/certificates/activate`,uc,{body:n,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}deactivate(e,n,r){return this._client.getAPIList(Q`/organization/projects/${e}/certificates/deactivate`,uc,{body:n,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}}});var WM,Gfe=C(()=>{Ge();Pn();Qt();WM=class extends le{listRateLimits(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/rate_limits`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}updateRateLimit(e,n,r){let{project_id:o,...i}=n;return this._client.post(Q`/organization/projects/${o}/rate_limits/${e}`,{body:i,...r,__security:{adminAPIKeyAuth:!0}})}}});var HM,Yfe=C(()=>{Ge();Pn();Qt();HM=class extends le{create(e,n,r){return this._client.post(Q`/projects/${e}/roles`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){let{project_id:o,...i}=n;return this._client.post(Q`/projects/${o}/roles/${e}`,{body:i,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/projects/${e}/roles`,Cs,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o}=n;return this._client.delete(Q`/projects/${o}/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var KM,Zfe=C(()=>{Ge();Pn();Qt();KM=class extends le{create(e,n,r){return this._client.post(Q`/organization/projects/${e}/service_accounts`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n,r){let{project_id:o}=n;return this._client.get(Q`/organization/projects/${o}/service_accounts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/service_accounts`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o}=n;return this._client.delete(Q`/organization/projects/${o}/service_accounts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var qM,Jfe=C(()=>{Ge();Pn();Qt();qM=class extends le{create(e,n,r){let{project_id:o,...i}=n;return this._client.post(Q`/projects/${o}/groups/${e}/roles`,{body:i,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n,r){let{project_id:o,...i}=n;return this._client.getAPIList(Q`/projects/${o}/groups/${e}/roles`,Cs,{query:i,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o,group_id:i}=n;return this._client.delete(Q`/projects/${o}/groups/${i}/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var AI,Xfe=C(()=>{Ge();Jfe();Jfe();Pn();Qt();AI=class extends le{constructor(){super(...arguments),this.roles=new qM(this._client)}create(e,n,r){return this._client.post(Q`/organization/projects/${e}/groups`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/groups`,Cs,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o}=n;return this._client.delete(Q`/organization/projects/${o}/groups/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};AI.Roles=qM});var GM,Qfe=C(()=>{Ge();Pn();Qt();GM=class extends le{create(e,n,r){let{project_id:o,...i}=n;return this._client.post(Q`/projects/${o}/users/${e}/roles`,{body:i,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n,r){let{project_id:o,...i}=n;return this._client.getAPIList(Q`/projects/${o}/users/${e}/roles`,Cs,{query:i,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o,user_id:i}=n;return this._client.delete(Q`/projects/${o}/users/${i}/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var kI,epe=C(()=>{Ge();Qfe();Qfe();Pn();Qt();kI=class extends le{constructor(){super(...arguments),this.roles=new GM(this._client)}create(e,n,r){return this._client.post(Q`/organization/projects/${e}/users`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n,r){let{project_id:o}=n;return this._client.get(Q`/organization/projects/${o}/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){let{project_id:o,...i}=n;return this._client.post(Q`/organization/projects/${o}/users/${e}`,{body:i,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/projects/${e}/users`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{project_id:o}=n;return this._client.delete(Q`/organization/projects/${o}/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};kI.Roles=GM});var Jd,tpe=C(()=>{Ge();Kfe();Kfe();qfe();qfe();Gfe();Gfe();Yfe();Yfe();Zfe();Zfe();Xfe();Xfe();epe();epe();Pn();Qt();Jd=class extends le{constructor(){super(...arguments),this.users=new kI(this._client),this.serviceAccounts=new KM(this._client),this.apiKeys=new jM(this._client),this.rateLimits=new WM(this._client),this.groups=new AI(this._client),this.roles=new HM(this._client),this.certificates=new VM(this._client)}create(e,n){return this._client.post("/organization/projects",{body:e,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n){return this._client.get(Q`/organization/projects/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){return this._client.post(Q`/organization/projects/${e}`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/projects",Xr,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}archive(e,n){return this._client.post(Q`/organization/projects/${e}/archive`,{...n,__security:{adminAPIKeyAuth:!0}})}};Jd.Users=kI;Jd.ServiceAccounts=KM;Jd.APIKeys=jM;Jd.RateLimits=WM;Jd.Groups=AI;Jd.Roles=HM;Jd.Certificates=VM});var YM,npe=C(()=>{Ge();Pn();Qt();YM=class extends le{create(e,n,r){return this._client.post(Q`/organization/users/${e}/roles`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/organization/users/${e}/roles`,Cs,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{user_id:o}=n;return this._client.delete(Q`/organization/users/${o}/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var MI,rpe=C(()=>{Ge();npe();npe();Pn();Qt();MI=class extends le{constructor(){super(...arguments),this.roles=new YM(this._client)}retrieve(e,n){return this._client.get(Q`/organization/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,n,r){return this._client.post(Q`/organization/users/${e}`,{body:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e={},n){return this._client.getAPIList("/organization/users",Xr,{query:e,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,n){return this._client.delete(Q`/organization/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};MI.Roles=YM});var Yc,ope=C(()=>{Ge();$fe();$fe();Ffe();Ffe();Ufe();Ufe();Bfe();Bfe();zfe();zfe();jfe();jfe();Hfe();Hfe();tpe();tpe();rpe();rpe();Yc=class extends le{constructor(){super(...arguments),this.auditLogs=new LM(this._client),this.adminAPIKeys=new RM(this._client),this.usage=new UM(this._client),this.invites=new $M(this._client),this.users=new MI(this._client),this.groups=new aC(this._client),this.roles=new FM(this._client),this.certificates=new DM(this._client),this.projects=new Jd(this._client)}};Yc.AuditLogs=LM;Yc.AdminAPIKeys=RM;Yc.Usage=UM;Yc.Invites=$M;Yc.Users=MI;Yc.Groups=aC;Yc.Roles=FM;Yc.Certificates=DM;Yc.Projects=Jd});var lC,ipe=C(()=>{Ge();ope();ope();lC=class extends le{constructor(){super(...arguments),this.organization=new Yc(this._client)}};lC.Organization=Yc});function*ZLt(t){if(!t)return;if(LWe in t){let{values:r,nulls:o}=t;yield*r.entries();for(let i of o)yield[i,null];return}let e=!1,n;t instanceof Headers?n=t.entries():Vde(t)?n=t:(e=!0,n=Object.entries(t??{}));for(let r of n){let o=r[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=Vde(r[1])?r[1]:[r[1]],s=!1;for(let a of i)a!==void 0&&(e&&!s&&(s=!0,yield[o,null]),yield[o,a])}}var LWe,Fe,Fo=C(()=>{zw();LWe=Symbol("brand.privateNullableHeaders");Fe=t=>{let e=new Headers,n=new Set;for(let r of t){let o=new Set;for(let[i,s]of ZLt(r)){let a=i.toLowerCase();o.has(a)||(e.delete(i),o.add(a)),s===null?(e.delete(i),n.add(a)):(e.append(i,s),n.delete(a))}}return{[LWe]:!0,values:e,nulls:n}}});var ZM,spe=C(()=>{Ge();Fo();ZM=class extends le{create(e,n){return this._client.post("/audio/speech",{body:e,...n,headers:Fe([{Accept:"application/octet-stream"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}});var JM,ape=C(()=>{Ge();mp();JM=class extends le{create(e,n){return this._client.post("/audio/transcriptions",dc({body:e,...n,stream:e.stream??!1,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}}});var XM,lpe=C(()=>{Ge();mp();XM=class extends le{create(e,n){return this._client.post("/audio/translations",dc({body:e,...n,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}}});var Vg,cpe=C(()=>{Ge();spe();spe();ape();ape();lpe();lpe();Vg=class extends le{constructor(){super(...arguments),this.transcriptions=new JM(this._client),this.translations=new XM(this._client),this.speech=new ZM(this._client)}};Vg.Transcriptions=JM;Vg.Translations=XM;Vg.Speech=ZM});var NI,upe=C(()=>{Ge();Pn();Qt();NI=class extends le{create(e,n){return this._client.post("/batches",{body:e,...n,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/batches/${e}`,{...n,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/batches",Fn,{query:e,...n,__security:{bearerAuth:!0}})}cancel(e,n){return this._client.post(Q`/batches/${e}/cancel`,{...n,__security:{bearerAuth:!0}})}}});var QM,dpe=C(()=>{Ge();Pn();Fo();Qt();QM=class extends le{create(e,n){return this._client.post("/assistants",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/assistants/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/assistants/${e}`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/assistants",Fn,{query:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/assistants/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}}});var eN,fpe=C(()=>{Ge();Fo();eN=class extends le{create(e,n){return this._client.post("/realtime/sessions",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}}});var tN,ppe=C(()=>{Ge();Fo();tN=class extends le{create(e,n){return this._client.post("/realtime/transcription_sessions",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}}});var cC,mpe=C(()=>{Ge();fpe();fpe();ppe();ppe();cC=class extends le{constructor(){super(...arguments),this.sessions=new eN(this._client),this.transcriptionSessions=new tN(this._client)}};cC.Sessions=eN;cC.TranscriptionSessions=tN});var nN,hpe=C(()=>{Ge();Fo();Qt();nN=class extends le{create(e,n){return this._client.post("/chatkit/sessions",{body:e,...n,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}cancel(e,n){return this._client.post(Q`/chatkit/sessions/${e}/cancel`,{...n,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}}});var rN,gpe=C(()=>{Ge();Pn();Fo();Qt();rN=class extends le{retrieve(e,n){return this._client.get(Q`/chatkit/threads/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/chatkit/threads",Xr,{query:e,...n,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/chatkit/threads/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}listItems(e,n={},r){return this._client.getAPIList(Q`/chatkit/threads/${e}/items`,Xr,{query:n,...r,headers:Fe([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}}});var uC,ype=C(()=>{Ge();hpe();hpe();gpe();gpe();uC=class extends le{constructor(){super(...arguments),this.sessions=new nN(this._client),this.threads=new rN(this._client)}};uC.Sessions=nN;uC.Threads=rN});var oN,wpe=C(()=>{Ge();Pn();Fo();Qt();oN=class extends le{create(e,n,r){return this._client.post(Q`/threads/${e}/messages`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n,r){let{thread_id:o}=n;return this._client.get(Q`/threads/${o}/messages/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){let{thread_id:o,...i}=n;return this._client.post(Q`/threads/${o}/messages/${e}`,{body:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/threads/${e}/messages`,Fn,{query:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,n,r){let{thread_id:o}=n;return this._client.delete(Q`/threads/${o}/messages/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}}});var iN,vpe=C(()=>{Ge();Pn();Fo();Qt();iN=class extends le{retrieve(e,n,r){let{thread_id:o,run_id:i,...s}=n;return this._client.get(Q`/threads/${o}/runs/${i}/steps/${e}`,{query:s,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e,n,r){let{thread_id:o,...i}=n;return this._client.getAPIList(Q`/threads/${o}/runs/${e}/steps`,Fn,{query:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}}});var DWe,$We=C(()=>{pp();T5();DWe=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),n=e.length,r=new Uint8Array(n);for(let o=0;o{Xd=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()||void 0}});var RU=C(()=>{zw();$We();xpe();wU();jde();SM();rfe()});var _l,RI,bpe,Wg,H5,Hm,LI,sN,OI,G5,Qd,K5,q5,$U,LU,DU,FWe,UWe,BWe,zWe,jWe,VWe,WWe,Kw,Cpe=C(()=>{fp();Afe();Wm();U5();RU();Kw=class extends oC{constructor(){super(...arguments),_l.add(this),bpe.set(this,[]),Wg.set(this,{}),H5.set(this,{}),Hm.set(this,void 0),LI.set(this,void 0),sN.set(this,void 0),OI.set(this,void 0),G5.set(this,void 0),Qd.set(this,void 0),K5.set(this,void 0),q5.set(this,void 0),$U.set(this,void 0)}[(bpe=new WeakMap,Wg=new WeakMap,H5=new WeakMap,Hm=new WeakMap,LI=new WeakMap,sN=new WeakMap,OI=new WeakMap,G5=new WeakMap,Qd=new WeakMap,K5=new WeakMap,q5=new WeakMap,$U=new WeakMap,_l=new WeakSet,Symbol.asyncIterator)](){let e=[],n=[],r=!1;return this.on("event",o=>{let i=n.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{r=!0;for(let o of n)o.resolve(void 0);n.length=0}),this.on("abort",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),this.on("error",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((i,s)=>n.push({resolve:i,reject:s})).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 n=new RI;return n._run(()=>n._fromReadableStream(e)),n}async _fromReadableStream(e,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=jg.fromReadableStream(e,this.controller);for await(let i of o)de(this,_l,"m",LU).call(this,i);if(o.controller.signal?.aborted)throw new zi;return this._addRun(de(this,_l,"m",DU).call(this))}toReadableStream(){return new jg(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,n,r,o){let i=new RI;return i._run(()=>i._runToolAssistantStream(e,n,r,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,n,r,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...r,stream:!0},a=await e.submitToolOutputs(n,s,{...o,signal:this.controller.signal});this._connected();for await(let l of a)de(this,_l,"m",LU).call(this,l);if(a.controller.signal?.aborted)throw new zi;return this._addRun(de(this,_l,"m",DU).call(this))}static createThreadAssistantStream(e,n,r){let o=new RI;return o._run(()=>o._threadAssistantStream(e,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,n,r,o){let i=new RI;return i._run(()=>i._runAssistantStream(e,n,r,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return de(this,K5,"f")}currentRun(){return de(this,q5,"f")}currentMessageSnapshot(){return de(this,Hm,"f")}currentRunStepSnapshot(){return de(this,$U,"f")}async finalRunSteps(){return await this.done(),Object.values(de(this,Wg,"f"))}async finalMessages(){return await this.done(),Object.values(de(this,H5,"f"))}async finalRun(){if(await this.done(),!de(this,LI,"f"))throw Error("Final run was not received.");return de(this,LI,"f")}async _createThreadAssistantStream(e,n,r){let o=r?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let i={...n,stream:!0},s=await e.createAndRun(i,{...r,signal:this.controller.signal});this._connected();for await(let a of s)de(this,_l,"m",LU).call(this,a);if(s.controller.signal?.aborted)throw new zi;return this._addRun(de(this,_l,"m",DU).call(this))}async _createAssistantStream(e,n,r,o){let i=o?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let s={...r,stream:!0},a=await e.create(n,s,{...o,signal:this.controller.signal});this._connected();for await(let l of a)de(this,_l,"m",LU).call(this,l);if(a.controller.signal?.aborted)throw new zi;return this._addRun(de(this,_l,"m",DU).call(this))}static accumulateDelta(e,n){for(let[r,o]of Object.entries(n)){if(!e.hasOwnProperty(r)){e[r]=o;continue}let i=e[r];if(i==null){e[r]=o;continue}if(r==="index"||r==="type"){e[r]=o;continue}if(typeof i=="string"&&typeof o=="string")i+=o;else if(typeof i=="number"&&typeof o=="number")i+=o;else if(_M(i)&&_M(o))i=this.accumulateDelta(i,o);else if(Array.isArray(i)&&Array.isArray(o)){if(i.every(s=>typeof s=="string"||typeof s=="number")){i.push(...o);continue}for(let s of o){if(!_M(s))throw new Error(`Expected array delta entry to be an object but got: ${s}`);let a=s.index;if(a==null)throw console.error(s),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let l=i[a];l==null?i.push(s):i[a]=this.accumulateDelta(l,s)}continue}else throw Error(`Unhandled record type: ${r}, deltaValue: ${o}, accValue: ${i}`);e[r]=i}return e}_addRun(e){return e}async _threadAssistantStream(e,n,r){return await this._createThreadAssistantStream(n,e,r)}async _runAssistantStream(e,n,r,o){return await this._createAssistantStream(n,e,r,o)}async _runToolAssistantStream(e,n,r,o){return await this._createToolAssistantStream(n,e,r,o)}};RI=Kw,LU=function(e){if(!this.ended)switch(Zt(this,K5,e,"f"),de(this,_l,"m",BWe).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":de(this,_l,"m",WWe).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":de(this,_l,"m",UWe).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":de(this,_l,"m",FWe).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},DU=function(){if(this.ended)throw new st("stream has ended, this shouldn't happen");if(!de(this,LI,"f"))throw Error("Final run has not been received");return de(this,LI,"f")},FWe=function(e){let[n,r]=de(this,_l,"m",jWe).call(this,e,de(this,Hm,"f"));Zt(this,Hm,n,"f"),de(this,H5,"f")[n.id]=n;for(let o of r){let i=n.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,n),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let i=o.text,s=n.content[o.index];if(s&&s.type=="text")this._emit("textDelta",i,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=de(this,sN,"f")){if(de(this,OI,"f"))switch(de(this,OI,"f").type){case"text":this._emit("textDone",de(this,OI,"f").text,de(this,Hm,"f"));break;case"image_file":this._emit("imageFileDone",de(this,OI,"f").image_file,de(this,Hm,"f"));break}Zt(this,sN,o.index,"f")}Zt(this,OI,n.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(de(this,sN,"f")!==void 0){let o=e.data.content[de(this,sN,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,de(this,Hm,"f"));break;case"text":this._emit("textDone",o.text,de(this,Hm,"f"));break}}de(this,Hm,"f")&&this._emit("messageDone",e.data),Zt(this,Hm,void 0,"f")}},UWe=function(e){let n=de(this,_l,"m",zWe).call(this,e);switch(Zt(this,$U,n,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let r=e.data.delta;if(r.step_details&&r.step_details.type=="tool_calls"&&r.step_details.tool_calls&&n.step_details.type=="tool_calls")for(let i of r.step_details.tool_calls)i.index==de(this,G5,"f")?this._emit("toolCallDelta",i,n.step_details.tool_calls[i.index]):(de(this,Qd,"f")&&this._emit("toolCallDone",de(this,Qd,"f")),Zt(this,G5,i.index,"f"),Zt(this,Qd,n.step_details.tool_calls[i.index],"f"),de(this,Qd,"f")&&this._emit("toolCallCreated",de(this,Qd,"f")));this._emit("runStepDelta",e.data.delta,n);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":Zt(this,$U,void 0,"f"),e.data.step_details.type=="tool_calls"&&de(this,Qd,"f")&&(this._emit("toolCallDone",de(this,Qd,"f")),Zt(this,Qd,void 0,"f")),this._emit("runStepDone",e.data,n);break;case"thread.run.step.in_progress":break}},BWe=function(e){de(this,bpe,"f").push(e),this._emit("event",e)},zWe=function(e){switch(e.event){case"thread.run.step.created":return de(this,Wg,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let n=de(this,Wg,"f")[e.data.id];if(!n)throw Error("Received a RunStepDelta before creation of a snapshot");let r=e.data;if(r.delta){let o=RI.accumulateDelta(n,r.delta);de(this,Wg,"f")[e.data.id]=o}return de(this,Wg,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":de(this,Wg,"f")[e.data.id]=e.data;break}if(de(this,Wg,"f")[e.data.id])return de(this,Wg,"f")[e.data.id];throw new Error("No snapshot available")},jWe=function(e,n){let r=[];switch(e.event){case"thread.message.created":return[e.data,r];case"thread.message.delta":if(!n)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 n.content){let s=n.content[i.index];n.content[i.index]=de(this,_l,"m",VWe).call(this,i,s)}else n.content[i.index]=i,r.push(i);return[n,r];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(n)return[n,r];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},VWe=function(e,n){return RI.accumulateDelta(n,e)},WWe=function(e){switch(Zt(this,q5,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":Zt(this,LI,e.data,"f"),de(this,Qd,"f")&&(this._emit("toolCallDone",de(this,Qd,"f")),Zt(this,Qd,void 0,"f"));break;case"thread.run.cancelling":break}}});var DI,_pe=C(()=>{Ge();vpe();vpe();Pn();Fo();Cpe();SM();Qt();DI=class extends le{constructor(){super(...arguments),this.steps=new iN(this._client)}create(e,n,r){let{include:o,...i}=n;return this._client.post(Q`/threads/${e}/runs`,{query:{include:o},body:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:n.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}retrieve(e,n,r){let{thread_id:o}=n;return this._client.get(Q`/threads/${o}/runs/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){let{thread_id:o,...i}=n;return this._client.post(Q`/threads/${o}/runs/${e}`,{body:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/threads/${e}/runs`,Fn,{query:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}cancel(e,n,r){let{thread_id:o}=n;return this._client.post(Q`/threads/${o}/runs/${e}/cancel`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,n,r){let o=await this.create(e,n,r);return await this.poll(o.id,{thread_id:e},r)}createAndStream(e,n,r){return Kw.createAssistantStream(e,this._client.beta.threads.runs,n,r)}async poll(e,n,r){let o=Fe([r?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":r?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(e,n,{...r,headers:{...r?.headers,...o}}).withResponse();switch(i.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let l=s.headers.get("openai-poll-after-ms");if(l){let c=parseInt(l);isNaN(c)||(a=c)}}await Bg(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,n,r){return Kw.createAssistantStream(e,this._client.beta.threads.runs,n,r)}submitToolOutputs(e,n,r){let{thread_id:o,...i}=n;return this._client.post(Q`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:n.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async submitToolOutputsAndPoll(e,n,r){let o=await this.submitToolOutputs(e,n,r);return await this.poll(o.id,n,r)}submitToolOutputsStream(e,n,r){return Kw.createToolAssistantStream(e,this._client.beta.threads.runs,n,r)}};DI.Steps=iN});var dC,Spe=C(()=>{Ge();wpe();wpe();_pe();_pe();Fo();Cpe();Qt();dC=class extends le{constructor(){super(...arguments),this.runs=new DI(this._client),this.messages=new oN(this._client)}create(e={},n){return this._client.post("/threads",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/threads/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/threads/${e}`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/threads/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}createAndRun(e,n){return this._client.post("/threads/runs",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:e.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll(e,n){let r=await this.createAndRun(e,n);return await this.runs.poll(r.id,{thread_id:r.thread_id},n)}createAndRunStream(e,n){return Kw.createThreadAssistantStream(e,this._client.beta.threads,n)}};dC.Runs=DI;dC.Messages=oN});var Km,Tpe=C(()=>{Ge();dpe();dpe();mpe();mpe();ype();ype();Spe();Spe();Km=class extends le{constructor(){super(...arguments),this.realtime=new cC(this._client),this.chatkit=new uC(this._client),this.assistants=new QM(this._client),this.threads=new dC(this._client)}};Km.Realtime=cC;Km.ChatKit=uC;Km.Assistants=QM;Km.Threads=dC});var $I,Ipe=C(()=>{Ge();$I=class extends le{create(e,n){return this._client.post("/completions",{body:e,...n,stream:e.stream??!1,__security:{bearerAuth:!0}})}}});var aN,Ppe=C(()=>{Ge();Fo();Qt();aN=class extends le{retrieve(e,n,r){let{container_id:o}=n;return this._client.get(Q`/containers/${o}/files/${e}/content`,{...r,headers:Fe([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}});var FI,Epe=C(()=>{Ge();Ppe();Ppe();Pn();Fo();mp();Qt();FI=class extends le{constructor(){super(...arguments),this.content=new aN(this._client)}create(e,n,r){return this._client.post(Q`/containers/${e}/files`,rC({body:n,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,n,r){let{container_id:o}=n;return this._client.get(Q`/containers/${o}/files/${e}`,{...r,__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/containers/${e}/files`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}delete(e,n,r){let{container_id:o}=n;return this._client.delete(Q`/containers/${o}/files/${e}`,{...r,headers:Fe([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}};FI.Content=aN});var fC,Ape=C(()=>{Ge();Epe();Epe();Pn();Fo();Qt();fC=class extends le{constructor(){super(...arguments),this.files=new FI(this._client)}create(e,n){return this._client.post("/containers",{body:e,...n,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/containers/${e}`,{...n,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/containers",Fn,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/containers/${e}`,{...n,headers:Fe([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}};fC.Files=FI});var lN,kpe=C(()=>{Ge();Pn();Qt();lN=class extends le{create(e,n,r){let{include:o,...i}=n;return this._client.post(Q`/conversations/${e}/items`,{query:{include:o},body:i,...r,__security:{bearerAuth:!0}})}retrieve(e,n,r){let{conversation_id:o,...i}=n;return this._client.get(Q`/conversations/${o}/items/${e}`,{query:i,...r,__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/conversations/${e}/items`,Xr,{query:n,...r,__security:{bearerAuth:!0}})}delete(e,n,r){let{conversation_id:o}=n;return this._client.delete(Q`/conversations/${o}/items/${e}`,{...r,__security:{bearerAuth:!0}})}}});var pC,Mpe=C(()=>{Ge();kpe();kpe();Qt();pC=class extends le{constructor(){super(...arguments),this.items=new lN(this._client)}create(e={},n){return this._client.post("/conversations",{body:e,...n,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/conversations/${e}`,{...n,__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/conversations/${e}`,{body:n,...r,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/conversations/${e}`,{...n,__security:{bearerAuth:!0}})}};pC.Items=lN});var UI,Npe=C(()=>{Ge();RU();UI=class extends le{create(e,n){let r=!!e.encoding_format,o=r?e.encoding_format:"base64";r&&os(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...n,__security:{bearerAuth:!0}});return r?i:(os(this._client).debug("embeddings/decoding base64 embeddings from base64"),i._thenUnwrap(s=>(s&&s.data&&s.data.forEach(a=>{let l=a.embedding;a.embedding=DWe(l)}),s)))}}});var cN,Ope=C(()=>{Ge();Pn();Qt();cN=class extends le{retrieve(e,n,r){let{eval_id:o,run_id:i}=n;return this._client.get(Q`/evals/${o}/runs/${i}/output_items/${e}`,{...r,__security:{bearerAuth:!0}})}list(e,n,r){let{eval_id:o,...i}=n;return this._client.getAPIList(Q`/evals/${o}/runs/${e}/output_items`,Fn,{query:i,...r,__security:{bearerAuth:!0}})}}});var BI,Rpe=C(()=>{Ge();Ope();Ope();Pn();Qt();BI=class extends le{constructor(){super(...arguments),this.outputItems=new cN(this._client)}create(e,n,r){return this._client.post(Q`/evals/${e}/runs`,{body:n,...r,__security:{bearerAuth:!0}})}retrieve(e,n,r){let{eval_id:o}=n;return this._client.get(Q`/evals/${o}/runs/${e}`,{...r,__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/evals/${e}/runs`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}delete(e,n,r){let{eval_id:o}=n;return this._client.delete(Q`/evals/${o}/runs/${e}`,{...r,__security:{bearerAuth:!0}})}cancel(e,n,r){let{eval_id:o}=n;return this._client.post(Q`/evals/${o}/runs/${e}`,{...r,__security:{bearerAuth:!0}})}};BI.OutputItems=cN});var mC,Lpe=C(()=>{Ge();Rpe();Rpe();Pn();Qt();mC=class extends le{constructor(){super(...arguments),this.runs=new BI(this._client)}create(e,n){return this._client.post("/evals",{body:e,...n,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/evals/${e}`,{...n,__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/evals/${e}`,{body:n,...r,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/evals",Fn,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/evals/${e}`,{...n,__security:{bearerAuth:!0}})}};mC.Runs=BI});var zI,Dpe=C(()=>{Ge();Pn();Fo();SM();Wm();mp();Qt();zI=class extends le{create(e,n){return this._client.post("/files",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}retrieve(e,n){return this._client.get(Q`/files/${e}`,{...n,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/files",Fn,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/files/${e}`,{...n,__security:{bearerAuth:!0}})}content(e,n){return this._client.get(Q`/files/${e}/content`,{...n,headers:Fe([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:n=5e3,maxWait:r=30*60*1e3}={}){let o=new Set(["processed","error","deleted"]),i=Date.now(),s=await this.retrieve(e);for(;!s.status||!o.has(s.status);)if(await Bg(n),s=await this.retrieve(e),Date.now()-i>r)throw new Fg({message:`Giving up on waiting for file ${e} to finish processing after ${r} milliseconds.`});return s}}});var uN,$pe=C(()=>{Ge();uN=class extends le{}});var dN,Fpe=C(()=>{Ge();dN=class extends le{run(e,n){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...n,__security:{bearerAuth:!0}})}validate(e,n){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...n,__security:{bearerAuth:!0}})}}});var jI,Upe=C(()=>{Ge();Fpe();Fpe();jI=class extends le{constructor(){super(...arguments),this.graders=new dN(this._client)}};jI.Graders=dN});var fN,Bpe=C(()=>{Ge();Pn();Qt();fN=class extends le{create(e,n,r){return this._client.getAPIList(Q`/fine_tuning/checkpoints/${e}/permissions`,uc,{body:n,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,n={},r){return this._client.get(Q`/fine_tuning/checkpoints/${e}/permissions`,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/fine_tuning/checkpoints/${e}/permissions`,Xr,{query:n,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,n,r){let{fine_tuned_model_checkpoint:o}=n;return this._client.delete(Q`/fine_tuning/checkpoints/${o}/permissions/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}}});var VI,zpe=C(()=>{Ge();Bpe();Bpe();VI=class extends le{constructor(){super(...arguments),this.permissions=new fN(this._client)}};VI.Permissions=fN});var pN,jpe=C(()=>{Ge();Pn();Qt();pN=class extends le{list(e,n={},r){return this._client.getAPIList(Q`/fine_tuning/jobs/${e}/checkpoints`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}}});var WI,Vpe=C(()=>{Ge();jpe();jpe();Pn();Qt();WI=class extends le{constructor(){super(...arguments),this.checkpoints=new pN(this._client)}create(e,n){return this._client.post("/fine_tuning/jobs",{body:e,...n,__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/fine_tuning/jobs/${e}`,{...n,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/fine_tuning/jobs",Fn,{query:e,...n,__security:{bearerAuth:!0}})}cancel(e,n){return this._client.post(Q`/fine_tuning/jobs/${e}/cancel`,{...n,__security:{bearerAuth:!0}})}listEvents(e,n={},r){return this._client.getAPIList(Q`/fine_tuning/jobs/${e}/events`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}pause(e,n){return this._client.post(Q`/fine_tuning/jobs/${e}/pause`,{...n,__security:{bearerAuth:!0}})}resume(e,n){return this._client.post(Q`/fine_tuning/jobs/${e}/resume`,{...n,__security:{bearerAuth:!0}})}};WI.Checkpoints=pN});var qm,Wpe=C(()=>{Ge();$pe();$pe();Upe();Upe();zpe();zpe();Vpe();Vpe();qm=class extends le{constructor(){super(...arguments),this.methods=new uN(this._client),this.jobs=new WI(this._client),this.checkpoints=new VI(this._client),this.alpha=new jI(this._client)}};qm.Methods=uN;qm.Jobs=WI;qm.Checkpoints=VI;qm.Alpha=jI});var mN,Hpe=C(()=>{Ge();mN=class extends le{}});var hC,Kpe=C(()=>{Ge();Hpe();Hpe();hC=class extends le{constructor(){super(...arguments),this.graderModels=new mN(this._client)}};hC.GraderModels=mN});var HI,qpe=C(()=>{Ge();mp();HI=class extends le{createVariation(e,n){return this._client.post("/images/variations",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}edit(e,n){return this._client.post("/images/edits",dc({body:e,...n,stream:e.stream??!1,__security:{bearerAuth:!0}},this._client))}generate(e,n){return this._client.post("/images/generations",{body:e,...n,stream:e.stream??!1,__security:{bearerAuth:!0}})}}});var KI,Gpe=C(()=>{Ge();Pn();Qt();KI=class extends le{retrieve(e,n){return this._client.get(Q`/models/${e}`,{...n,__security:{bearerAuth:!0}})}list(e){return this._client.getAPIList("/models",uc,{...e,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/models/${e}`,{...n,__security:{bearerAuth:!0}})}}});var qI,Ype=C(()=>{Ge();qI=class extends le{create(e,n){return this._client.post("/moderations",{body:e,...n,__security:{bearerAuth:!0}})}}});var hN,Zpe=C(()=>{Ge();Fo();Qt();hN=class extends le{accept(e,n,r){return this._client.post(Q`/realtime/calls/${e}/accept`,{body:n,...r,headers:Fe([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}hangup(e,n){return this._client.post(Q`/realtime/calls/${e}/hangup`,{...n,headers:Fe([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}refer(e,n,r){return this._client.post(Q`/realtime/calls/${e}/refer`,{body:n,...r,headers:Fe([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}reject(e,n={},r){return this._client.post(Q`/realtime/calls/${e}/reject`,{body:n,...r,headers:Fe([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}}});var gN,Jpe=C(()=>{Ge();gN=class extends le{create(e,n){return this._client.post("/realtime/client_secrets",{body:e,...n,__security:{bearerAuth:!0}})}}});var qw,Xpe=C(()=>{Ge();Zpe();Zpe();Jpe();Jpe();qw=class extends le{constructor(){super(...arguments),this.clientSecrets=new gN(this._client),this.calls=new hN(this._client)}};qw.ClientSecrets=gN;qw.Calls=hN});function HWe(t,e){return!e||!P1t(e)?{...t,output_parsed:null,output:t.output.map(n=>n.type==="function_call"?{...n,parsed_arguments:null}:n.type==="message"?{...n,content:n.content.map(r=>({...r,parsed:null}))}:n)}:Qpe(t,e)}function Qpe(t,e){let n=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:k1t(e,o)};if(o.type==="message"){let i=o.content.map(s=>s.type==="output_text"?{...s,parsed:I1t(e,s.text)}:s);return{...o,content:i}}return o}),r=Object.assign({},t,{output:n});return Object.getOwnPropertyDescriptor(t,"output_text")||Y5(r),Object.defineProperty(r,"output_parsed",{enumerable:!0,get(){for(let o of r.output)if(o.type==="message"){for(let i of o.content)if(i.type==="output_text"&&i.parsed!==null)return i.parsed}return null}}),r}function I1t(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function P1t(t){return!!TU(t.text?.format)}function E1t(t){return t?.$brand==="auto-parseable-tool"}function A1t(t,e){return t.find(n=>n.type==="function"&&n.name===e)}function k1t(t,e){let n=A1t(t.tools??[],e.name);return{...e,...e,parsed_arguments:E1t(n)?n.$parseRaw(e.arguments):n?.strict?JSON.parse(e.arguments):null}}function Y5(t){let e=[];for(let n of t.output)if(n.type==="message")for(let r of n.content)r.type==="output_text"&&e.push(r.text);t.output_text=e.join("")}var Z5=C(()=>{Wm();AM()});function M1t(t,e){return HWe(t,e)}var yN,J5,gC,X5,KWe,qWe,GWe,YWe,Q5,ZWe=C(()=>{fp();Wm();U5();Z5();Q5=class t extends oC{constructor(e){super(),yN.add(this),J5.set(this,void 0),gC.set(this,void 0),X5.set(this,void 0),Zt(this,J5,e,"f")}static createResponse(e,n,r){let o=new t(n);return o._run(()=>o._createOrRetrieveResponse(e,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,n,r){let o=r?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),de(this,yN,"m",KWe).call(this);let i,s=null;"response_id"in n?(i=await e.responses.retrieve(n.response_id,{stream:!0},{...r,signal:this.controller.signal,stream:!0}),s=n.starting_after??null):i=await e.responses.create({...n,stream:!0},{...r,signal:this.controller.signal}),this._connected();for await(let a of i)de(this,yN,"m",qWe).call(this,a,s);if(i.controller.signal?.aborted)throw new zi;return de(this,yN,"m",GWe).call(this)}[(J5=new WeakMap,gC=new WeakMap,X5=new WeakMap,yN=new WeakSet,KWe=function(){this.ended||Zt(this,gC,void 0,"f")},qWe=function(n,r){if(this.ended)return;let o=(s,a)=>{(r==null||a.sequence_number>r)&&this._emit(s,a)},i=de(this,yN,"m",YWe).call(this,n);switch(o("event",n),n.type){case"response.output_text.delta":{let s=i.output[n.output_index];if(!s)throw new st(`missing output at index ${n.output_index}`);if(s.type==="message"){let a=s.content[n.content_index];if(!a)throw new st(`missing content at index ${n.content_index}`);if(a.type!=="output_text")throw new st(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...n,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let s=i.output[n.output_index];if(!s)throw new st(`missing output at index ${n.output_index}`);s.type==="function_call"&&o("response.function_call_arguments.delta",{...n,snapshot:s.arguments});break}default:o(n.type,n);break}},GWe=function(){if(this.ended)throw new st("stream has ended, this shouldn't happen");let n=de(this,gC,"f");if(!n)throw new st("request ended without sending any events");Zt(this,gC,void 0,"f");let r=M1t(n,de(this,J5,"f"));return Zt(this,X5,r,"f"),r},YWe=function(n){let r=de(this,gC,"f");if(!r){if(n.type!=="response.created")throw new st(`When snapshot hasn't been set yet, expected 'response.created' event, got ${n.type}`);return r=Zt(this,gC,n.response,"f"),r}switch(n.type){case"response.output_item.added":{r.output.push(n.item);break}case"response.content_part.added":{let o=r.output[n.output_index];if(!o)throw new st(`missing output at index ${n.output_index}`);let i=o.type,s=n.part;i==="message"&&s.type!=="reasoning_text"?o.content.push(s):i==="reasoning"&&s.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(s));break}case"response.output_text.delta":{let o=r.output[n.output_index];if(!o)throw new st(`missing output at index ${n.output_index}`);if(o.type==="message"){let i=o.content[n.content_index];if(!i)throw new st(`missing content at index ${n.content_index}`);if(i.type!=="output_text")throw new st(`expected content to be 'output_text', got ${i.type}`);i.text+=n.delta}break}case"response.function_call_arguments.delta":{let o=r.output[n.output_index];if(!o)throw new st(`missing output at index ${n.output_index}`);o.type==="function_call"&&(o.arguments+=n.delta);break}case"response.reasoning_text.delta":{let o=r.output[n.output_index];if(!o)throw new st(`missing output at index ${n.output_index}`);if(o.type==="reasoning"){let i=o.content?.[n.content_index];if(!i)throw new st(`missing content at index ${n.content_index}`);if(i.type!=="reasoning_text")throw new st(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=n.delta}break}case"response.completed":{Zt(this,gC,n.response,"f");break}}return r},Symbol.asyncIterator)](){let e=[],n=[],r=!1;return this.on("event",o=>{let i=n.shift();i?i.resolve(o):e.push(o)}),this.on("end",()=>{r=!0;for(let o of n)o.resolve(void 0);n.length=0}),this.on("abort",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),this.on("error",o=>{r=!0;for(let i of n)i.reject(o);n.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((i,s)=>n.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=de(this,X5,"f");if(!e)throw new st("stream ended without producing a ChatCompletion");return e}}});var wN,eme=C(()=>{Ge();Pn();Qt();wN=class extends le{list(e,n={},r){return this._client.getAPIList(Q`/responses/${e}/input_items`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}}});var vN,tme=C(()=>{Ge();vN=class extends le{count(e={},n){return this._client.post("/responses/input_tokens",{body:e,...n,__security:{bearerAuth:!0}})}}});var Gw,nme=C(()=>{Z5();ZWe();Ge();eme();eme();tme();tme();Fo();Qt();Gw=class extends le{constructor(){super(...arguments),this.inputItems=new wN(this._client),this.inputTokens=new vN(this._client)}create(e,n){return this._client.post("/responses",{body:e,...n,stream:e.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(r=>("object"in r&&r.object==="response"&&Y5(r),r))}retrieve(e,n={},r){return this._client.get(Q`/responses/${e}`,{query:n,...r,stream:n?.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Y5(o),o))}delete(e,n){return this._client.delete(Q`/responses/${e}`,{...n,headers:Fe([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}parse(e,n){return this._client.responses.create(e,n)._thenUnwrap(r=>Qpe(r,e))}stream(e,n){return Q5.createResponse(this._client,e,n)}cancel(e,n){return this._client.post(Q`/responses/${e}/cancel`,{...n,__security:{bearerAuth:!0}})}compact(e,n){return this._client.post("/responses/compact",{body:e,...n,__security:{bearerAuth:!0}})}};Gw.InputItems=wN;Gw.InputTokens=vN});var xN,rme=C(()=>{Ge();Fo();Qt();xN=class extends le{retrieve(e,n){return this._client.get(Q`/skills/${e}/content`,{...n,headers:Fe([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}});var bN,ome=C(()=>{Ge();Fo();Qt();bN=class extends le{retrieve(e,n,r){let{skill_id:o}=n;return this._client.get(Q`/skills/${o}/versions/${e}/content`,{...r,headers:Fe([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}}});var GI,ime=C(()=>{Ge();ome();ome();Pn();mp();Qt();GI=class extends le{constructor(){super(...arguments),this.content=new bN(this._client)}create(e,n={},r){return this._client.post(Q`/skills/${e}/versions`,rC({body:n,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,n,r){let{skill_id:o}=n;return this._client.get(Q`/skills/${o}/versions/${e}`,{...r,__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/skills/${e}/versions`,Fn,{query:n,...r,__security:{bearerAuth:!0}})}delete(e,n,r){let{skill_id:o}=n;return this._client.delete(Q`/skills/${o}/versions/${e}`,{...r,__security:{bearerAuth:!0}})}};GI.Content=bN});var Yw,sme=C(()=>{Ge();rme();rme();ime();ime();Pn();mp();Qt();Yw=class extends le{constructor(){super(...arguments),this.content=new xN(this._client),this.versions=new GI(this._client)}create(e={},n){return this._client.post("/skills",rC({body:e,...n,__security:{bearerAuth:!0}},this._client))}retrieve(e,n){return this._client.get(Q`/skills/${e}`,{...n,__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/skills/${e}`,{body:n,...r,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/skills",Fn,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/skills/${e}`,{...n,__security:{bearerAuth:!0}})}};Yw.Content=xN;Yw.Versions=GI});var CN,ame=C(()=>{Ge();mp();Qt();CN=class extends le{create(e,n,r){return this._client.post(Q`/uploads/${e}/parts`,dc({body:n,...r,__security:{bearerAuth:!0}},this._client))}}});var yC,lme=C(()=>{Ge();ame();ame();Qt();yC=class extends le{constructor(){super(...arguments),this.parts=new CN(this._client)}create(e,n){return this._client.post("/uploads",{body:e,...n,__security:{bearerAuth:!0}})}cancel(e,n){return this._client.post(Q`/uploads/${e}/cancel`,{...n,__security:{bearerAuth:!0}})}complete(e,n,r){return this._client.post(Q`/uploads/${e}/complete`,{body:n,...r,__security:{bearerAuth:!0}})}};yC.Parts=CN});var JWe,XWe=C(()=>{JWe=async t=>{let e=await Promise.allSettled(t),n=e.filter(o=>o.status==="rejected");if(n.length){for(let o of n)console.error(o.reason);throw new Error(`${n.length} promise(s) failed - see the above errors`)}let r=[];for(let o of e)o.status==="fulfilled"&&r.push(o.value);return r}});var _N,cme=C(()=>{Ge();Pn();Fo();SM();XWe();Qt();_N=class extends le{create(e,n,r){return this._client.post(Q`/vector_stores/${e}/file_batches`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n,r){let{vector_store_id:o}=n;return this._client.get(Q`/vector_stores/${o}/file_batches/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}cancel(e,n,r){let{vector_store_id:o}=n;return this._client.post(Q`/vector_stores/${o}/file_batches/${e}/cancel`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,n,r){let o=await this.create(e,n);return await this.poll(e,o.id,r)}listFiles(e,n,r){let{vector_store_id:o,...i}=n;return this._client.getAPIList(Q`/vector_stores/${o}/file_batches/${e}/files`,Fn,{query:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}async poll(e,n,r){let o=Fe([r?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":r?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:s}=await this.retrieve(n,{vector_store_id:e},{...r,headers:o}).withResponse();switch(i.status){case"in_progress":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let l=s.headers.get("openai-poll-after-ms");if(l){let c=parseInt(l);isNaN(c)||(a=c)}}await Bg(a);break;case"failed":case"cancelled":case"completed":return i}}}async uploadAndPoll(e,{files:n,fileIds:r=[]},o){if(n==null||n.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,s=Math.min(i,n.length),a=this._client,l=n.values(),c=[...r];async function u(f){for(let p of f){let m=await a.files.create({file:p,purpose:"assistants"},o);c.push(m.id)}}let d=Array(s).fill(l).map(u);return await JWe(d),await this.createAndPoll(e,{file_ids:c})}}});var SN,ume=C(()=>{Ge();Pn();Fo();RU();Qt();SN=class extends le{create(e,n,r){return this._client.post(Q`/vector_stores/${e}/files`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n,r){let{vector_store_id:o}=n;return this._client.get(Q`/vector_stores/${o}/files/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){let{vector_store_id:o,...i}=n;return this._client.post(Q`/vector_stores/${o}/files/${e}`,{body:i,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e,n={},r){return this._client.getAPIList(Q`/vector_stores/${e}/files`,Fn,{query:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,n,r){let{vector_store_id:o}=n;return this._client.delete(Q`/vector_stores/${o}/files/${e}`,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,n,r){let o=await this.create(e,n,r);return await this.poll(e,o.id,r)}async poll(e,n,r){let o=Fe([r?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":r?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(n,{vector_store_id:e},{...r,headers:o}).withResponse(),s=i.data;switch(s.status){case"in_progress":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let l=i.response.headers.get("openai-poll-after-ms");if(l){let c=parseInt(l);isNaN(c)||(a=c)}}await Bg(a);break;case"failed":case"completed":return s}}}async upload(e,n,r){let o=await this._client.files.create({file:n,purpose:"assistants"},r);return this.create(e,{file_id:o.id},r)}async uploadAndPoll(e,n,r){let o=await this.upload(e,n,r);return await this.poll(e,o.id,r)}content(e,n,r){let{vector_store_id:o}=n;return this._client.getAPIList(Q`/vector_stores/${o}/files/${e}/content`,uc,{...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}}});var Zw,dme=C(()=>{Ge();cme();cme();ume();ume();Pn();Fo();Qt();Zw=class extends le{constructor(){super(...arguments),this.files=new SN(this._client),this.fileBatches=new _N(this._client)}create(e,n){return this._client.post("/vector_stores",{body:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,n){return this._client.get(Q`/vector_stores/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,n,r){return this._client.post(Q`/vector_stores/${e}`,{body:n,...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/vector_stores",Fn,{query:e,...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/vector_stores/${e}`,{...n,headers:Fe([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}search(e,n,r){return this._client.getAPIList(Q`/vector_stores/${e}/search`,uc,{body:n,method:"post",...r,headers:Fe([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};Zw.Files=SN;Zw.FileBatches=_N});var YI,fme=C(()=>{Ge();Pn();Fo();mp();Qt();YI=class extends le{create(e,n){return this._client.post("/videos",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}retrieve(e,n){return this._client.get(Q`/videos/${e}`,{...n,__security:{bearerAuth:!0}})}list(e={},n){return this._client.getAPIList("/videos",Xr,{query:e,...n,__security:{bearerAuth:!0}})}delete(e,n){return this._client.delete(Q`/videos/${e}`,{...n,__security:{bearerAuth:!0}})}createCharacter(e,n){return this._client.post("/videos/characters",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}downloadContent(e,n={},r){return this._client.get(Q`/videos/${e}/content`,{query:n,...r,headers:Fe([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit(e,n){return this._client.post("/videos/edits",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}extend(e,n){return this._client.post("/videos/extensions",dc({body:e,...n,__security:{bearerAuth:!0}},this._client))}getCharacter(e,n){return this._client.get(Q`/videos/characters/${e}`,{...n,__security:{bearerAuth:!0}})}remix(e,n,r){return this._client.post(Q`/videos/${e}/remix`,rC({body:n,...r,__security:{bearerAuth:!0}},this._client))}}});var TN,QWe,eq,ZI,pme=C(()=>{fp();Wm();Ge();Fo();ZI=class extends le{constructor(){super(...arguments),TN.add(this)}async unwrap(e,n,r=this._client.webhookSecret,o=300){return await this.verifySignature(e,n,r,o),JSON.parse(e)}async verifySignature(e,n,r=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");de(this,TN,"m",QWe).call(this,r);let i=Fe([n]).values,s=de(this,TN,"m",eq).call(this,i,"webhook-signature"),a=de(this,TN,"m",eq).call(this,i,"webhook-timestamp"),l=de(this,TN,"m",eq).call(this,i,"webhook-id"),c=parseInt(a,10);if(isNaN(c))throw new Ug("Invalid webhook timestamp format");let u=Math.floor(Date.now()/1e3);if(u-c>o)throw new Ug("Webhook timestamp is too old");if(c>u+o)throw new Ug("Webhook timestamp is too new");let d=s.split(" ").map(h=>h.startsWith("v1,")?h.substring(3):h),f=r.startsWith("whsec_")?Buffer.from(r.replace("whsec_",""),"base64"):Buffer.from(r,"utf-8"),p=l?`${l}.${a}.${e}`:`${a}.${e}`,m=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let h of d)try{let g=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,g,new TextEncoder().encode(p)))return}catch{continue}throw new Ug("The given webhook signature does not match the expected signature")}};TN=new WeakSet,QWe=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")},eq=function(e,n){if(!e)throw new Error("Headers are required");let r=e.get(n);if(r==null)throw new Error(`Missing required header: ${n}`);return r}});var eHe=C(()=>{pme()});var tHe=C(()=>{eHe()});var nHe=C(()=>{OWe();RWe();ipe();cpe();upe();Tpe();Ipe();Ape();Mpe();Npe();Lpe();Dpe();Wpe();Kpe();qpe();Gpe();Ype();Xpe();nme();sme();lme();dme();fme();tHe()});var mme,hme,tq,rHe,z1t,en,nq=C(()=>{fp();jde();zw();SM();x5();Kde();TM();YVe();rfe();Hde();pp();Pn();pWe();pp();mfe();nHe();A5();upe();Ipe();Npe();Dpe();qpe();Gpe();Ype();fme();ipe();cpe();Tpe();Dfe();Ape();Mpe();Lpe();Wpe();Kpe();Xpe();nme();sme();lme();dme();pme();Kde();Fo();xpe();wU();zw();z1t="workload-identity-auth",en=class{constructor({baseURL:e=Xd("OPENAI_BASE_URL"),apiKey:n=Xd("OPENAI_API_KEY")??null,adminAPIKey:r=Xd("OPENAI_ADMIN_KEY")??null,organization:o=Xd("OPENAI_ORG_ID")??null,project:i=Xd("OPENAI_PROJECT_ID")??null,webhookSecret:s=Xd("OPENAI_WEBHOOK_SECRET")??null,workloadIdentity:a,...l}={}){mme.add(this),tq.set(this,void 0),this.completions=new $I(this),this.chat=new sC(this),this.embeddings=new UI(this),this.files=new zI(this),this.images=new HI(this),this.audio=new Vg(this),this.moderations=new qI(this),this.models=new KI(this),this.fineTuning=new qm(this),this.graders=new hC(this),this.vectorStores=new Zw(this),this.webhooks=new ZI(this),this.beta=new Km(this),this.batches=new NI(this),this.uploads=new yC(this),this.admin=new lC(this),this.responses=new Gw(this),this.realtime=new qw(this),this.conversations=new pC(this),this.evals=new mC(this),this.containers=new fC(this),this.skills=new Yw(this),this.videos=new YI(this);let c={apiKey:n,adminAPIKey:r,organization:o,project:i,webhookSecret:s,workloadIdentity:a,...l,baseURL:e||"https://api.openai.com/v1"};if(n&&a)throw new st("The `apiKey` and `workloadIdentity` options are mutually exclusive");if(!n&&!r&&!a)throw new st("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");if(!c.dangerouslyAllowBrowser&&HVe())throw new st(`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=c.baseURL,this.timeout=c.timeout??hme.DEFAULT_TIMEOUT,this.logger=c.logger??console;let u="warn";this.logLevel=u,this.logLevel=ife(c.logLevel,"ClientOptions.logLevel",this)??ife(Xd("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=c.fetchOptions,this.maxRetries=c.maxRetries??2,this.fetch=c.fetch??C5(),Zt(this,tq,GVe,"f");let d=Xd("OPENAI_CUSTOM_HEADERS");if(d){let f={};for(let p of d.split(` `)){let m=p.indexOf(":");m>=0&&(f[p.substring(0,m).trim()]=p.substring(m+1).trim())}c.defaultHeaders=Fe([f,c.defaultHeaders])}this._options=c,a&&(this._workloadIdentityAuth=new M5(a,this.fetch)),this.apiKey=typeof n=="string"?n:null,this.adminAPIKey=r,this.organization=o,this.project=i,this.webhookSecret=s}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._options.apiKey,adminAPIKey:this.adminAPIKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:n},r={bearerAuth:!0,adminAPIKeyAuth:!0}){if(!(e.get("authorization")||e.get("api-key"))&&!(n.has("authorization")||n.has("api-key"))&&!(this._workloadIdentityAuth&&r.bearerAuth))throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted')}async authHeaders(e,n={bearerAuth:!0,adminAPIKeyAuth:!0}){return Fe([n.bearerAuth?await this.bearerAuth(e):null,n.adminAPIKeyAuth?await this.adminAPIKeyAuth(e):null])}async bearerAuth(e){if(this._workloadIdentityAuth)return Fe([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey!=null)return Fe([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth(e){if(this.adminAPIKey!=null)return Fe([{Authorization:`Bearer ${this.adminAPIKey}`}])}stringifyQuery(e){return sWe(e)}getUserAgent(){return`${this.constructor.name}/JS ${nC}`}defaultIdempotencyKey(){return`stainless-node-retry-${zde()}`}makeStatusError(e,n,r,o){return Bi.generate(e,n,r,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let n;try{n=await e()}catch(r){throw r instanceof st?r:new st(`Failed to get token from 'apiKey' function: ${r.message}`,{cause:r})}if(typeof n!="string"||!n)throw new st(`Expected 'apiKey' function argument to return a string but it returned ${n}`);return this.apiKey=n,!0}buildURL(e,n,r){let o=!de(this,mme,"m",rHe).call(this)&&r||this.baseURL,i=FVe(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),a=Object.fromEntries(i.searchParams);return(!Wde(s)||!Wde(a))&&(n={...a,...s,...n}),typeof n=="object"&&n&&!Array.isArray(n)&&(i.search=this.stringifyQuery(n)),i.toString()}async prepareOptions(e){(e.__security??{bearerAuth:!0}).bearerAuth&&await this._callApiKey()}async prepareRequest(e,{url:n,options:r}){}get(e,n){return this.methodRequest("get",e,n)}post(e,n){return this.methodRequest("post",e,n)}patch(e,n){return this.methodRequest("patch",e,n)}put(e,n){return this.methodRequest("put",e,n)}delete(e,n){return this.methodRequest("delete",e,n)}methodRequest(e,n,r){return this.request(Promise.resolve(r).then(o=>({method:e,path:n,...o})))}request(e,n=null){return new TI(this,this.makeRequest(e,n,void 0))}async makeRequest(e,n,r){let o=await e,i=o.maxRetries??this.maxRetries;n==null&&(n=i),await this.prepareOptions(o);let{req:s,url:a,timeout:l}=await this.buildRequest(o,{retryCount:i-n});await this.prepareRequest(s,{url:a,options:o});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=r===void 0?"":`, retryOf: ${r}`,d=Date.now();if(os(this).debug(`[${c}] sending request`,jw({retryOfRequestLogID:r,method:o.method,url:a,options:o,headers:s.headers})),o.signal?.aborted)throw new zi;let f=o.__security??{bearerAuth:!0},p=new AbortController,m=await this.fetchWithAuth(a,s,l,p,f).catch(hU),h=Date.now();if(m instanceof globalThis.Error){let w=`retrying, ${n} attempts remaining`;if(o.signal?.aborted)throw new zi;let v=mU(m)||/timed? ?out/i.test(String(m)+("cause"in m?String(m.cause):""));if(n)return os(this).info(`[${c}] connection ${v?"timed out":"failed"} - ${w}`),os(this).debug(`[${c}] connection ${v?"timed out":"failed"} (${w})`,jw({retryOfRequestLogID:r,url:a,durationMs:h-d,message:m.message})),this.retryRequest(o,n,r??c);throw os(this).info(`[${c}] connection ${v?"timed out":"failed"} - error; no more retries left`),os(this).debug(`[${c}] connection ${v?"timed out":"failed"} (error; no more retries left)`,jw({retryOfRequestLogID:r,url:a,durationMs:h-d,message:m.message})),m instanceof _I||m instanceof gU?m:v?new Fg:new tC({cause:m})}let g=[...m.headers.entries()].filter(([w])=>w==="x-request-id").map(([w,v])=>", "+w+": "+JSON.stringify(v)).join(""),y=`[${c}${u}${g}] ${s.method} ${a} ${m.ok?"succeeded":"failed"} with status ${m.status} in ${h-d}ms`;if(!m.ok){if(m.status===401&&this._workloadIdentityAuth&&f.bearerAuth&&!o.__metadata?.hasStreamingBody&&!o.__metadata?.workloadIdentityTokenRefreshed)return await Yde(m.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...o,__metadata:{...o.__metadata,workloadIdentityTokenRefreshed:!0}},n,r??c);let w=await this.shouldRetry(m);if(n&&w){let S=`retrying, ${n} attempts remaining`;return await Yde(m.body),os(this).info(`${y} - ${S}`),os(this).debug(`[${c}] response error (${S})`,jw({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,durationMs:h-d})),this.retryRequest(o,n,r??c,m.headers)}let v=w?"error; no more retries left":"error; not retryable";os(this).info(`${y} - ${v}`);let x=await m.text().catch(S=>hU(S).message),b=zVe(x),_=b?void 0:x;throw os(this).debug(`[${c}] response error (${v})`,jw({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,message:_,durationMs:Date.now()-d})),this.makeStatusError(m.status,b,_,m.headers)}return os(this).info(y),os(this).debug(`[${c}] response start`,jw({retryOfRequestLogID:r,url:m.url,status:m.status,headers:m.headers,durationMs:h-d})),{response:m,options:o,controller:p,requestLogID:c,retryOfRequestLogID:r,startTime:d}}getAPIList(e,n,r){return this.requestAPIList(n,r&&"then"in r?r.then(o=>({method:"get",path:e,...o})):{method:"get",path:e,...r})}requestAPIList(e,n){let r=this.makeRequest(n,null,void 0);return new bU(this,r,e)}async fetchWithAuth(e,n,r,o,i={bearerAuth:!0,adminAPIKeyAuth:!0}){if(this._workloadIdentityAuth&&i.bearerAuth){let a=n.headers,l=a.get("Authorization");if(!l||l===`Bearer ${z1t}`){let c=await this._workloadIdentityAuth.getToken();a.set("Authorization",`Bearer ${c}`)}}return await this.fetchWithTimeout(e,n,r,o)}async fetchWithTimeout(e,n,r,o){let{signal:i,method:s,...a}=n||{},l=this._makeAbort(o);i&&i.addEventListener("abort",l,{once:!0});let c=setTimeout(l,r),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,d={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(d.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(c)}}async shouldRetry(e){let n=e.headers.get("x-should-retry");return n==="true"?!0:n==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,n,r,o){let i,s=o?.get("retry-after-ms");if(s){let l=parseFloat(s);Number.isNaN(l)||(i=l)}let a=o?.get("retry-after");if(a&&!i){let l=parseFloat(a);Number.isNaN(l)?i=Date.parse(a)-Date.now():i=l*1e3}if(i===void 0){let l=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(n,l)}return await Bg(i),this.makeRequest(e,n-1,r)}calculateDefaultRetryTimeoutMillis(e,n){let i=n-e,s=Math.min(.5*Math.pow(2,i),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:n=0}={}){let r={...e},{method:o,path:i,query:s,defaultBaseURL:a}=r,l=this.buildURL(i,s,a);"timeout"in r&&BVe("timeout",r.timeout),r.timeout=r.timeout??this.timeout;let{bodyHeaders:c,body:u,isStreamingBody:d}=this.buildBody({options:r});d&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:o,bodyHeaders:c,retryCount:n});return{req:{method:o,headers:f,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...r.fetchOptions??{}},url:l,timeout:r.timeout}}async buildHeaders({options:e,method:n,bodyHeaders:r,retryCount:o}){let i={};this.idempotencyHeader&&n!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=Fe([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))}:{},...KVe(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e,e.__security??{bearerAuth:!0}),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(s,e.__security??{bearerAuth:!0}),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:n}}){if(!e)return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let r=Fe([n]),o=typeof globalThis.ReadableStream<"u"&&e instanceof globalThis.ReadableStream,i=!o&&(typeof e=="string"||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof globalThis.Blob<"u"&&e instanceof globalThis.Blob||e instanceof URLSearchParams||e instanceof FormData);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||o?{bodyHeaders:void 0,body:e,isStreamingBody:!i}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:_5(e),isStreamingBody:!0}:typeof e=="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e),isStreamingBody:!1}:{...de(this,tq,"f").call(this,{body:e,headers:r}),isStreamingBody:!1}}};hme=en,tq=new WeakMap,mme=new WeakSet,rHe=function(){return this.baseURL!=="https://api.openai.com/v1"};en.OpenAI=hme;en.DEFAULT_TIMEOUT=6e5;en.OpenAIError=st;en.APIError=Bi;en.APIConnectionError=tC;en.APIConnectionTimeoutError=Fg;en.APIUserAbortError=zi;en.NotFoundError=gM;en.ConflictError=yM;en.RateLimitError=vM;en.BadRequestError=pM;en.AuthenticationError=mM;en.InternalServerError=xM;en.PermissionDeniedError=hM;en.UnprocessableEntityError=wM;en.InvalidWebhookSignatureError=Ug;en.toFile=_U;en.Completions=$I;en.Chat=sC;en.Embeddings=UI;en.Files=zI;en.Images=HI;en.Audio=Vg;en.Moderations=qI;en.Models=KI;en.FineTuning=qm;en.Graders=hC;en.VectorStores=Zw;en.Webhooks=ZI;en.Beta=Km;en.Batches=NI;en.Uploads=yC;en.Admin=lC;en.Responses=Gw;en.Realtime=qw;en.Conversations=pC;en.Evals=mC;en.Containers=fC;en.Skills=Yw;en.Videos=YI});var JI,j1t,oHe=C(()=>{Fo();Wm();RU();nq();JI=class extends en{constructor({baseURL:e=Xd("OPENAI_BASE_URL"),apiKey:n=Xd("AZURE_OPENAI_API_KEY"),apiVersion:r=Xd("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:s,dangerouslyAllowBrowser:a,...l}={}){if(!r)throw new st("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 s=="function"&&(a=!0),!s&&!n)throw new st("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(s&&n)throw new st("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(l.defaultQuery={...l.defaultQuery,"api-version":r},e){if(o)throw new st("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new st("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:s??n,baseURL:e,...l,...a!==void 0?{dangerouslyAllowBrowser:a}:{}}),this.apiVersion="",this.apiVersion=r,this.deploymentName=i}async buildRequest(e,n={}){if(j1t.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!_M(e.body))throw new Error("Expected request body to be an object");let r=this.deploymentName||e.body.model||e.__metadata?.model;r!==void 0&&!this.baseURL.includes("/deployments")&&(e.path=`/deployments/${r}${e.path}`)}return super.buildRequest(e,n)}async authHeaders(e,n){let r=n??{bearerAuth:!0,adminAPIKeyAuth:!0};return r.bearerAuth&&typeof this._options.apiKey=="string"?Fe([{"api-key":this.apiKey}]):super.authHeaders(e,r)}},j1t=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"])});var Gm=C(()=>{nq();mfe();A5();nq();Pn();pp();oHe()});function hp(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===Fg.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===zi.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=pU(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=pU(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=pU(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=pU(t,"MODEL_NOT_FOUND"):e=t,e}var wC=C(()=>{$Ve();Gm()});function Xw(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function V1t(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 IN(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 Qw(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(!rc.isInstance(t))throw new Error("Invalid generic chat message");return V1t(t);default:throw new Error(`Unknown message type: ${e}`)}}function iHe(t){return t.includes("gpt-5.2-pro")}var Jw,vC=C(()=>{Kr();Jw=t=>t()});function Hg(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:n,azureOpenAIApiKey:r,azureOpenAIBasePath:o,baseURL:i,azureADTokenProvider:s,azureOpenAIEndpoint:a}=t;if((r||s)&&o&&e)return`${o}/${e}`;if((r||s)&&a&&e)return`${a}/openai/deployments/${e}`;if(r||s){if(!n)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${n}.openai.azure.com/openai/deployments/${e}`}return i}function gme(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function sHe(t){let e=Jw(()=>{if(gme(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&gme(t.values))return t.values;if(typeof t=="object"&&t!==null){let n=Object.entries(t).filter(([,r])=>typeof r=="string").map(([r,o])=>[r,o]);return new Headers(n)}return new Headers});return Object.fromEntries(e.entries())}function aHe(){let t=Hle();return(t==="node"||t==="deno")&&(t=`(${t}/${process.version}; ${process.platform}; ${process.arch})`),t}function Kg(t,e=!1,n="1.0.0"){let r=sHe(t),o=aHe(),i=`langchainjs${e?"-azure":""}-openai`;return{...r,"User-Agent":r["User-Agent"]?`${i}/${n} (${o})${r["User-Agent"]}`:`${i}/${n} (${o})`}}var xC=C(()=>{vC();Jo()});function lHe(t,e){let n;return cp(t)?n=Gb(t):n=t,e?.strict!==void 0&&(n.function.strict=e.strict),n}function W1t(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function cHe(t){let e=["namespace functions {",""];for(let n of t)n.description&&e.push(`// ${n.description}`),Object.keys(n.parameters.properties??{}).length>0?(e.push(`type ${n.name} = (_: {`),e.push(uHe(n.parameters,0)),e.push("}) => any;")):e.push(`type ${n.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(` `)}function uHe(t,e){let n=[];for(let[r,o]of Object.entries(t.properties??{}))o.description&&e<2&&n.push(`// ${o.description}`),t.required?.includes(r)?n.push(`${r}: ${rq(o,e)},`):n.push(`${r}?: ${rq(o,e)},`);return n.map(r=>" ".repeat(e)+r).join(` `)}function rq(t,e){if(W1t(t))return t.anyOf.map(n=>rq(n,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(n=>`"${n}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(n=>`${n}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(n=>`${n}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",uHe(t,e+2),"}"].join(` `);case"array":return t.items?`${rq(t.items,e)}[]`:"any[]";default:return""}}function oq(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 PN(t){return"type"in t&&t.type!=="function"}function dHe(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 fHe(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function XI(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 iq(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function pHe(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 mHe(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 hHe(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isComputerTool"in t&&t.isComputerTool===!0}function gHe(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function yHe(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 wHe(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 EN=C(()=>{pI();Bd();Bu()});var yme=C(()=>{Ql()});var uq={};zn(uq,{ZodISODate:()=>aq,ZodISODateTime:()=>sq,ZodISODuration:()=>cq,ZodISOTime:()=>lq,date:()=>vme,datetime:()=>wme,duration:()=>bme,time:()=>xme});function wme(t){return $se(sq,t)}function vme(t){return Fse(aq,t)}function xme(t){return Use(lq,t)}function bme(t){return Bse(cq,t)}var sq,aq,lq,cq,dq=C(()=>{Ql();fq();sq=ce("ZodISODateTime",(t,e)=>{Bie.init(t,e),Uo.init(t,e)});aq=ce("ZodISODate",(t,e)=>{zie.init(t,e),Uo.init(t,e)});lq=ce("ZodISOTime",(t,e)=>{jie.init(t,e),Uo.init(t,e)});cq=ce("ZodISODuration",(t,e)=>{Vie.init(t,e),Uo.init(t,e)})});var xHe,K1t,AN,Cme=C(()=>{Ql();Ql();xHe=(t,e)=>{DF.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>FF(t,n)},flatten:{value:n=>$F(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},K1t=ce("ZodError",xHe),AN=ce("ZodError",xHe,{Parent:Error})});var _me,Sme,Tme,Ime,Pme=C(()=>{Ql();Cme();_me=C6(AN),Sme=_6(AN),Tme=S6(AN),Ime=T6(AN)});function Eme(t){return Rse(UU,t)}function G1t(t){return B6(Mme,t)}function Y1t(t){return qF(pq,t)}function Z1t(t){return z6(ev,t)}function J1t(t){return j6(ev,t)}function X1t(t){return V6(ev,t)}function Q1t(t){return W6(ev,t)}function eDt(t){return H6(Nme,t)}function tDt(t){return K6(Ome,t)}function nDt(t){return q6(Rme,t)}function rDt(t){return G6(Lme,t)}function oDt(t){return Y6(Dme,t)}function iDt(t){return Z6($me,t)}function sDt(t){return J6(Fme,t)}function aDt(t){return X6(Ume,t)}function lDt(t){return Q6(Bme,t)}function cDt(t){return e3(zme,t)}function uDt(t){return t3(jme,t)}function dDt(t){return n3(Vme,t)}function fDt(t){return r3(Wme,t)}function pDt(t){return o3(Hme,t)}function mDt(t){return i3(Kme,t)}function hDt(t){return s3(qme,t)}function gDt(t,e,n={}){return wae(bHe,t,e,n)}function CHe(t){return zse(BU,t)}function Ame(t){return Vse(kN,t)}function yDt(t){return Wse(kN,t)}function wDt(t){return Hse(kN,t)}function vDt(t){return Kse(kN,t)}function xDt(t){return qse(kN,t)}function yq(t){return Gse(zU,t)}function bDt(t){return Zse(jU,t)}function CDt(t){return Xse(Gme,t)}function _Dt(t){return Qse(Gme,t)}function SDt(t){return eae(_He,t)}function TDt(t){return tae(SHe,t)}function IHe(t){return nae(THe,t)}function IDt(){return rae(PHe)}function QI(){return TT(EHe)}function wq(t){return GF(AHe,t)}function PDt(t){return oae(kHe,t)}function EDt(t){return iae(vq,t)}function MN(t,e){return a2(MHe,t,e)}function ADt(t){let e=t._zod.def.shape;return zHe(Object.keys(e))}function Yme(t,e){let n={type:"object",get shape(){return Qe.assignProp(this,"shape",{...t}),this.shape},...Qe.normalizeParams(e)};return new xq(n)}function kDt(t,e){return new xq({type:"object",get shape(){return Qe.assignProp(this,"shape",{...t}),this.shape},catchall:wq(),...Qe.normalizeParams(e)})}function MDt(t,e){return new xq({type:"object",get shape(){return Qe.assignProp(this,"shape",{...t}),this.shape},catchall:QI(),...Qe.normalizeParams(e)})}function bq(t,e){return new Zme({type:"union",options:t,...Qe.normalizeParams(e)})}function NDt(t,e,n){return new NHe({type:"union",options:e,discriminator:t,...Qe.normalizeParams(n)})}function RHe(t,e){return new OHe({type:"intersection",left:t,right:e})}function ODt(t,e,n){let r=e instanceof jn,o=r?n:e,i=r?e:null;return new LHe({type:"tuple",items:t,rest:i,...Qe.normalizeParams(o)})}function DHe(t,e,n){return new Jme({type:"record",keyType:t,valueType:e,...Qe.normalizeParams(n)})}function RDt(t,e,n){return new Jme({type:"record",keyType:bq([t,wq()]),valueType:e,...Qe.normalizeParams(n)})}function LDt(t,e,n){return new $He({type:"map",keyType:t,valueType:e,...Qe.normalizeParams(n)})}function DDt(t,e){return new FHe({type:"set",valueType:t,...Qe.normalizeParams(e)})}function UHe(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new FU({type:"enum",entries:n,...Qe.normalizeParams(e)})}function $Dt(t,e){return new FU({type:"enum",entries:t,...Qe.normalizeParams(e)})}function zHe(t,e){return new BHe({type:"literal",values:Array.isArray(t)?t:[t],...Qe.normalizeParams(e)})}function FDt(t){return mae(jHe,t)}function Qme(t){return new Xme({type:"transform",transform:t})}function mq(t){return new ehe({type:"optional",innerType:t})}function hq(t){return new VHe({type:"nullable",innerType:t})}function UDt(t){return mq(hq(t))}function HHe(t,e){return new WHe({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function qHe(t,e){return new KHe({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function GHe(t,e){return new the({type:"nonoptional",innerType:t,...Qe.normalizeParams(e)})}function BDt(t){return new YHe({type:"success",innerType:t})}function JHe(t,e){return new ZHe({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function zDt(t){return aae(XHe,t)}function gq(t,e){return new nhe({type:"pipe",in:t,out:e})}function e6e(t){return new QHe({type:"readonly",innerType:t})}function jDt(t,e){return new t6e({type:"template_literal",parts:t,...Qe.normalizeParams(e)})}function r6e(t){return new n6e({type:"lazy",getter:t})}function VDt(t){return new o6e({type:"promise",innerType:t})}function i6e(t){let e=new Ti({check:"custom"});return e._zod.check=t,e}function rhe(t,e){return hae(Cq,t??(()=>!0),e)}function s6e(t,e={}){return gae(Cq,t,e)}function a6e(t){let e=i6e(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Qe.issue(r,n.value,e._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),n.issues.push(Qe.issue(o))}},t(n.value,n)));return e}function WDt(t,e={error:`Input not instance of ${t.name}`}){let n=new Cq({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...Qe.normalizeParams(e)});return n._zod.bag.Class=t,n}function KDt(t){let e=r6e(()=>bq([Eme(t),CHe(),yq(),IHe(),MN(e),DHe(Eme(),e)]));return e}function qDt(t,e){return gq(Qme(t),e)}var pr,kme,UU,Uo,Mme,pq,ev,Nme,Ome,Rme,Lme,Dme,$me,Fme,Ume,Bme,zme,jme,Vme,Wme,Hme,Kme,qme,bHe,BU,kN,zU,jU,Gme,_He,SHe,THe,PHe,EHe,AHe,kHe,vq,MHe,xq,Zme,NHe,OHe,LHe,Jme,$He,FHe,FU,BHe,jHe,Xme,ehe,VHe,WHe,KHe,the,YHe,ZHe,XHe,nhe,QHe,t6e,n6e,o6e,Cq,HDt,fq=C(()=>{Ql();Ql();yme();dq();Pme();pr=ce("ZodType",(t,e)=>(jn.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>xs(t,n,r),t.brand=()=>t,t.register=(n,r)=>(n.add(t,r),t),t.parse=(n,r)=>_me(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>Tme(t,n,r),t.parseAsync=async(n,r)=>Sme(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Ime(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(s6e(n,r)),t.superRefine=n=>t.check(a6e(n)),t.overwrite=n=>t.check(bw(n)),t.optional=()=>mq(t),t.nullable=()=>hq(t),t.nullish=()=>mq(hq(t)),t.nonoptional=n=>GHe(t,n),t.array=()=>MN(t),t.or=n=>bq([t,n]),t.and=n=>RHe(t,n),t.transform=n=>gq(t,Qme(n)),t.default=n=>HHe(t,n),t.prefault=n=>qHe(t,n),t.catch=n=>JHe(t,n),t.pipe=n=>gq(t,n),t.readonly=()=>e6e(t),t.describe=n=>{let r=t.clone();return Oa.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Oa.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Oa.get(t);let r=t.clone();return Oa.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),kme=ce("_ZodString",(t,e)=>{CT.init(t,e),pr.init(t,e);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(ZF(...r)),t.includes=(...r)=>t.check(QF(...r)),t.startsWith=(...r)=>t.check(e2(...r)),t.endsWith=(...r)=>t.check(t2(...r)),t.min=(...r)=>t.check(Ib(...r)),t.max=(...r)=>t.check(kk(...r)),t.length=(...r)=>t.check(Mk(...r)),t.nonempty=(...r)=>t.check(Ib(1,...r)),t.lowercase=r=>t.check(JF(r)),t.uppercase=r=>t.check(XF(r)),t.trim=()=>t.check(o2()),t.normalize=(...r)=>t.check(r2(...r)),t.toLowerCase=()=>t.check(i2()),t.toUpperCase=()=>t.check(s2())}),UU=ce("ZodString",(t,e)=>{CT.init(t,e),kme.init(t,e),t.email=n=>t.check(B6(Mme,n)),t.url=n=>t.check(H6(Nme,n)),t.jwt=n=>t.check(s3(qme,n)),t.emoji=n=>t.check(K6(Ome,n)),t.guid=n=>t.check(qF(pq,n)),t.uuid=n=>t.check(z6(ev,n)),t.uuidv4=n=>t.check(j6(ev,n)),t.uuidv6=n=>t.check(V6(ev,n)),t.uuidv7=n=>t.check(W6(ev,n)),t.nanoid=n=>t.check(q6(Rme,n)),t.guid=n=>t.check(qF(pq,n)),t.cuid=n=>t.check(G6(Lme,n)),t.cuid2=n=>t.check(Y6(Dme,n)),t.ulid=n=>t.check(Z6($me,n)),t.base64=n=>t.check(r3(Wme,n)),t.base64url=n=>t.check(o3(Hme,n)),t.xid=n=>t.check(J6(Fme,n)),t.ksuid=n=>t.check(X6(Ume,n)),t.ipv4=n=>t.check(Q6(Bme,n)),t.ipv6=n=>t.check(e3(zme,n)),t.cidrv4=n=>t.check(t3(jme,n)),t.cidrv6=n=>t.check(n3(Vme,n)),t.e164=n=>t.check(i3(Kme,n)),t.datetime=n=>t.check(wme(n)),t.date=n=>t.check(vme(n)),t.time=n=>t.check(xme(n)),t.duration=n=>t.check(bme(n))});Uo=ce("ZodStringFormat",(t,e)=>{_o.init(t,e),kme.init(t,e)}),Mme=ce("ZodEmail",(t,e)=>{Mie.init(t,e),Uo.init(t,e)});pq=ce("ZodGUID",(t,e)=>{Aie.init(t,e),Uo.init(t,e)});ev=ce("ZodUUID",(t,e)=>{kie.init(t,e),Uo.init(t,e)});Nme=ce("ZodURL",(t,e)=>{Nie.init(t,e),Uo.init(t,e)});Ome=ce("ZodEmoji",(t,e)=>{Oie.init(t,e),Uo.init(t,e)});Rme=ce("ZodNanoID",(t,e)=>{Rie.init(t,e),Uo.init(t,e)});Lme=ce("ZodCUID",(t,e)=>{Lie.init(t,e),Uo.init(t,e)});Dme=ce("ZodCUID2",(t,e)=>{Die.init(t,e),Uo.init(t,e)});$me=ce("ZodULID",(t,e)=>{$ie.init(t,e),Uo.init(t,e)});Fme=ce("ZodXID",(t,e)=>{Fie.init(t,e),Uo.init(t,e)});Ume=ce("ZodKSUID",(t,e)=>{Uie.init(t,e),Uo.init(t,e)});Bme=ce("ZodIPv4",(t,e)=>{Wie.init(t,e),Uo.init(t,e)});zme=ce("ZodIPv6",(t,e)=>{Hie.init(t,e),Uo.init(t,e)});jme=ce("ZodCIDRv4",(t,e)=>{Kie.init(t,e),Uo.init(t,e)});Vme=ce("ZodCIDRv6",(t,e)=>{qie.init(t,e),Uo.init(t,e)});Wme=ce("ZodBase64",(t,e)=>{Yie.init(t,e),Uo.init(t,e)});Hme=ce("ZodBase64URL",(t,e)=>{Zie.init(t,e),Uo.init(t,e)});Kme=ce("ZodE164",(t,e)=>{Jie.init(t,e),Uo.init(t,e)});qme=ce("ZodJWT",(t,e)=>{Xie.init(t,e),Uo.init(t,e)});bHe=ce("ZodCustomStringFormat",(t,e)=>{Qie.init(t,e),Uo.init(t,e)});BU=ce("ZodNumber",(t,e)=>{R6.init(t,e),pr.init(t,e),t.gt=(r,o)=>t.check(xw(r,o)),t.gte=(r,o)=>t.check(Du(r,o)),t.min=(r,o)=>t.check(Du(r,o)),t.lt=(r,o)=>t.check(vw(r,o)),t.lte=(r,o)=>t.check(Yf(r,o)),t.max=(r,o)=>t.check(Yf(r,o)),t.int=r=>t.check(Ame(r)),t.safe=r=>t.check(Ame(r)),t.positive=r=>t.check(xw(0,r)),t.nonnegative=r=>t.check(Du(0,r)),t.negative=r=>t.check(vw(0,r)),t.nonpositive=r=>t.check(Yf(0,r)),t.multipleOf=(r,o)=>t.check(IT(r,o)),t.step=(r,o)=>t.check(IT(r,o)),t.finite=()=>t;let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});kN=ce("ZodNumberFormat",(t,e)=>{ese.init(t,e),BU.init(t,e)});zU=ce("ZodBoolean",(t,e)=>{BF.init(t,e),pr.init(t,e)});jU=ce("ZodBigInt",(t,e)=>{L6.init(t,e),pr.init(t,e),t.gte=(r,o)=>t.check(Du(r,o)),t.min=(r,o)=>t.check(Du(r,o)),t.gt=(r,o)=>t.check(xw(r,o)),t.gte=(r,o)=>t.check(Du(r,o)),t.min=(r,o)=>t.check(Du(r,o)),t.lt=(r,o)=>t.check(vw(r,o)),t.lte=(r,o)=>t.check(Yf(r,o)),t.max=(r,o)=>t.check(Yf(r,o)),t.positive=r=>t.check(xw(BigInt(0),r)),t.negative=r=>t.check(vw(BigInt(0),r)),t.nonpositive=r=>t.check(Yf(BigInt(0),r)),t.nonnegative=r=>t.check(Du(BigInt(0),r)),t.multipleOf=(r,o)=>t.check(IT(r,o));let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null});Gme=ce("ZodBigIntFormat",(t,e)=>{tse.init(t,e),jU.init(t,e)});_He=ce("ZodSymbol",(t,e)=>{nse.init(t,e),pr.init(t,e)});SHe=ce("ZodUndefined",(t,e)=>{rse.init(t,e),pr.init(t,e)});THe=ce("ZodNull",(t,e)=>{ose.init(t,e),pr.init(t,e)});PHe=ce("ZodAny",(t,e)=>{ise.init(t,e),pr.init(t,e)});EHe=ce("ZodUnknown",(t,e)=>{_T.init(t,e),pr.init(t,e)});AHe=ce("ZodNever",(t,e)=>{zF.init(t,e),pr.init(t,e)});kHe=ce("ZodVoid",(t,e)=>{sse.init(t,e),pr.init(t,e)});vq=ce("ZodDate",(t,e)=>{ase.init(t,e),pr.init(t,e),t.min=(r,o)=>t.check(Du(r,o)),t.max=(r,o)=>t.check(Yf(r,o));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});MHe=ce("ZodArray",(t,e)=>{jF.init(t,e),pr.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Ib(n,r)),t.nonempty=n=>t.check(Ib(1,n)),t.max=(n,r)=>t.check(kk(n,r)),t.length=(n,r)=>t.check(Mk(n,r)),t.unwrap=()=>t.element});xq=ce("ZodObject",(t,e)=>{lse.init(t,e),pr.init(t,e),Qe.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>UHe(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:QI()}),t.loose=()=>t.clone({...t._zod.def,catchall:QI()}),t.strict=()=>t.clone({...t._zod.def,catchall:wq()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>Qe.extend(t,n),t.merge=n=>Qe.merge(t,n),t.pick=n=>Qe.pick(t,n),t.omit=n=>Qe.omit(t,n),t.partial=(...n)=>Qe.partial(ehe,t,n[0]),t.required=(...n)=>Qe.required(the,t,n[0])});Zme=ce("ZodUnion",(t,e)=>{D6.init(t,e),pr.init(t,e),t.options=e.options});NHe=ce("ZodDiscriminatedUnion",(t,e)=>{Zme.init(t,e),cse.init(t,e)});OHe=ce("ZodIntersection",(t,e)=>{use.init(t,e),pr.init(t,e)});LHe=ce("ZodTuple",(t,e)=>{ST.init(t,e),pr.init(t,e),t.rest=n=>t.clone({...t._zod.def,rest:n})});Jme=ce("ZodRecord",(t,e)=>{dse.init(t,e),pr.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});$He=ce("ZodMap",(t,e)=>{fse.init(t,e),pr.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});FHe=ce("ZodSet",(t,e)=>{pse.init(t,e),pr.init(t,e),t.min=(...n)=>t.check(PT(...n)),t.nonempty=n=>t.check(PT(1,n)),t.max=(...n)=>t.check(Ak(...n)),t.size=(...n)=>t.check(YF(...n))});FU=ce("ZodEnum",(t,e)=>{mse.init(t,e),pr.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new FU({...e,checks:[],...Qe.normalizeParams(o),entries:i})},t.exclude=(r,o)=>{let i={...e.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new FU({...e,checks:[],...Qe.normalizeParams(o),entries:i})}});BHe=ce("ZodLiteral",(t,e)=>{hse.init(t,e),pr.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]}})});jHe=ce("ZodFile",(t,e)=>{gse.init(t,e),pr.init(t,e),t.min=(n,r)=>t.check(PT(n,r)),t.max=(n,r)=>t.check(Ak(n,r)),t.mime=(n,r)=>t.check(n2(Array.isArray(n)?n:[n],r))});Xme=ce("ZodTransform",(t,e)=>{VF.init(t,e),pr.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(Qe.issue(i,n.value,e));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),n.issues.push(Qe.issue(s))}};let o=e.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});ehe=ce("ZodOptional",(t,e)=>{$6.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});VHe=ce("ZodNullable",(t,e)=>{yse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});WHe=ce("ZodDefault",(t,e)=>{wse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});KHe=ce("ZodPrefault",(t,e)=>{vse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});the=ce("ZodNonOptional",(t,e)=>{xse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});YHe=ce("ZodSuccess",(t,e)=>{bse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});ZHe=ce("ZodCatch",(t,e)=>{Cse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});XHe=ce("ZodNaN",(t,e)=>{_se.init(t,e),pr.init(t,e)});nhe=ce("ZodPipe",(t,e)=>{WF.init(t,e),pr.init(t,e),t.in=e.in,t.out=e.out});QHe=ce("ZodReadonly",(t,e)=>{Sse.init(t,e),pr.init(t,e)});t6e=ce("ZodTemplateLiteral",(t,e)=>{Tse.init(t,e),pr.init(t,e)});n6e=ce("ZodLazy",(t,e)=>{Pse.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.getter()});o6e=ce("ZodPromise",(t,e)=>{Ise.init(t,e),pr.init(t,e),t.unwrap=()=>t._zod.def.innerType});Cq=ce("ZodCustom",(t,e)=>{Ese.init(t,e),pr.init(t,e)});HDt=(...t)=>yae({Pipe:nhe,Boolean:zU,String:UU,Transform:Xme},...t)});function YDt(t){vs({customError:t})}function ZDt(){return vs().customError}var GDt,l6e=C(()=>{Ql();GDt={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 ohe={};zn(ohe,{bigint:()=>e$t,boolean:()=>QDt,date:()=>t$t,number:()=>XDt,string:()=>JDt});function JDt(t){return Lse(UU,t)}function XDt(t){return jse(BU,t)}function QDt(t){return Yse(zU,t)}function e$t(t){return Jse(jU,t)}function t$t(t){return sae(vq,t)}var c6e=C(()=>{Ql();fq()});var se={};zn(se,{$brand:()=>hoe,$input:()=>Nse,$output:()=>Mse,NEVER:()=>moe,TimePrecision:()=>Dse,ZodAny:()=>PHe,ZodArray:()=>MHe,ZodBase64:()=>Wme,ZodBase64URL:()=>Hme,ZodBigInt:()=>jU,ZodBigIntFormat:()=>Gme,ZodBoolean:()=>zU,ZodCIDRv4:()=>jme,ZodCIDRv6:()=>Vme,ZodCUID:()=>Lme,ZodCUID2:()=>Dme,ZodCatch:()=>ZHe,ZodCustom:()=>Cq,ZodCustomStringFormat:()=>bHe,ZodDate:()=>vq,ZodDefault:()=>WHe,ZodDiscriminatedUnion:()=>NHe,ZodE164:()=>Kme,ZodEmail:()=>Mme,ZodEmoji:()=>Ome,ZodEnum:()=>FU,ZodError:()=>K1t,ZodFile:()=>jHe,ZodGUID:()=>pq,ZodIPv4:()=>Bme,ZodIPv6:()=>zme,ZodISODate:()=>aq,ZodISODateTime:()=>sq,ZodISODuration:()=>cq,ZodISOTime:()=>lq,ZodIntersection:()=>OHe,ZodIssueCode:()=>GDt,ZodJWT:()=>qme,ZodKSUID:()=>Ume,ZodLazy:()=>n6e,ZodLiteral:()=>BHe,ZodMap:()=>$He,ZodNaN:()=>XHe,ZodNanoID:()=>Rme,ZodNever:()=>AHe,ZodNonOptional:()=>the,ZodNull:()=>THe,ZodNullable:()=>VHe,ZodNumber:()=>BU,ZodNumberFormat:()=>kN,ZodObject:()=>xq,ZodOptional:()=>ehe,ZodPipe:()=>nhe,ZodPrefault:()=>KHe,ZodPromise:()=>o6e,ZodReadonly:()=>QHe,ZodRealError:()=>AN,ZodRecord:()=>Jme,ZodSet:()=>FHe,ZodString:()=>UU,ZodStringFormat:()=>Uo,ZodSuccess:()=>YHe,ZodSymbol:()=>_He,ZodTemplateLiteral:()=>t6e,ZodTransform:()=>Xme,ZodTuple:()=>LHe,ZodType:()=>pr,ZodULID:()=>$me,ZodURL:()=>Nme,ZodUUID:()=>ev,ZodUndefined:()=>SHe,ZodUnion:()=>Zme,ZodUnknown:()=>EHe,ZodVoid:()=>kHe,ZodXID:()=>Fme,_ZodString:()=>kme,_default:()=>HHe,any:()=>IDt,array:()=>MN,base64:()=>fDt,base64url:()=>pDt,bigint:()=>bDt,boolean:()=>yq,catch:()=>JHe,check:()=>i6e,cidrv4:()=>uDt,cidrv6:()=>dDt,clone:()=>xs,coerce:()=>ohe,config:()=>vs,core:()=>Cw,cuid:()=>rDt,cuid2:()=>oDt,custom:()=>rhe,date:()=>EDt,discriminatedUnion:()=>NDt,e164:()=>mDt,email:()=>G1t,emoji:()=>tDt,endsWith:()=>t2,enum:()=>UHe,file:()=>FDt,flattenError:()=>$F,float32:()=>yDt,float64:()=>wDt,formatError:()=>FF,function:()=>xae,getErrorMap:()=>ZDt,globalRegistry:()=>Oa,gt:()=>xw,gte:()=>Du,guid:()=>Y1t,includes:()=>QF,instanceof:()=>WDt,int:()=>Ame,int32:()=>vDt,int64:()=>CDt,intersection:()=>RHe,ipv4:()=>lDt,ipv6:()=>cDt,iso:()=>uq,json:()=>KDt,jwt:()=>hDt,keyof:()=>ADt,ksuid:()=>aDt,lazy:()=>r6e,length:()=>Mk,literal:()=>zHe,locales:()=>KF,looseObject:()=>MDt,lowercase:()=>JF,lt:()=>vw,lte:()=>Yf,map:()=>LDt,maxLength:()=>kk,maxSize:()=>Ak,mime:()=>n2,minLength:()=>Ib,minSize:()=>PT,multipleOf:()=>IT,nan:()=>zDt,nanoid:()=>nDt,nativeEnum:()=>$Dt,negative:()=>cae,never:()=>wq,nonnegative:()=>dae,nonoptional:()=>GHe,nonpositive:()=>uae,normalize:()=>r2,null:()=>IHe,nullable:()=>hq,nullish:()=>UDt,number:()=>CHe,object:()=>Yme,optional:()=>mq,overwrite:()=>bw,parse:()=>_me,parseAsync:()=>Sme,partialRecord:()=>RDt,pipe:()=>gq,positive:()=>lae,prefault:()=>qHe,preprocess:()=>qDt,prettifyError:()=>Eoe,promise:()=>VDt,property:()=>fae,readonly:()=>e6e,record:()=>DHe,refine:()=>s6e,regex:()=>ZF,regexes:()=>bT,registry:()=>U6,safeParse:()=>Tme,safeParseAsync:()=>Ime,set:()=>DDt,setErrorMap:()=>YDt,size:()=>YF,startsWith:()=>e2,strictObject:()=>kDt,string:()=>Eme,stringFormat:()=>gDt,stringbool:()=>HDt,success:()=>BDt,superRefine:()=>a6e,symbol:()=>SDt,templateLiteral:()=>jDt,toJSONSchema:()=>Pb,toLowerCase:()=>i2,toUpperCase:()=>s2,transform:()=>Qme,treeifyError:()=>Poe,trim:()=>o2,tuple:()=>ODt,uint32:()=>xDt,uint64:()=>_Dt,ulid:()=>iDt,undefined:()=>TDt,union:()=>bq,unknown:()=>QI,uppercase:()=>XF,url:()=>eDt,uuid:()=>Z1t,uuidv4:()=>J1t,uuidv6:()=>X1t,uuidv7:()=>Q1t,void:()=>PDt,xid:()=>sDt});var ihe=C(()=>{Ql();fq();yme();Cme();Pme();l6e();Ql();Ase();Ql();kse();dq();dq();c6e();vs(F6())});var u6e=C(()=>{ihe();ihe()});var tv=C(()=>{u6e()});var p6e,f6e,m6e,_q=C(()=>{p6e=Symbol("Let zodToJsonSchema decide on which parser to use"),f6e={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"},m6e=t=>typeof t=="string"?{...f6e,basePath:["#"],definitions:{},name:t}:{...f6e,basePath:["#"],definitions:{},...t}});function h6e(t){if(!t)return!0;for(let e in t)return!1;return!0}var VU,she=C(()=>{VU=t=>"_def"in t?t._def:t});var g6e,ahe=C(()=>{_q();she();g6e=t=>{let e=m6e(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[VU(o),{def:VU(o),path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}}});function lhe(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage={...t.errorMessage,[e]:n})}function Ar(t,e,n,r,o){t[e]=n,lhe(t,e,r,o)}var bC=C(()=>{});function y6e(){return{}}var che=C(()=>{});function w6e(t,e){let n={type:"array"};return t.type?._def?.typeName!==he.ZodAny&&(n.items=_n(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Ar(n,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Ar(n,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Ar(n,"minItems",t.exactLength.value,t.exactLength.message,e),Ar(n,"maxItems",t.exactLength.value,t.exactLength.message,e)),n}var uhe=C(()=>{_g();bC();_s()});function v6e(t,e){let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Ar(n,"minimum",r.value,r.message,e):Ar(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Ar(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Ar(n,"maximum",r.value,r.message,e):Ar(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Ar(n,"maximum",r.value,r.message,e));break;case"multipleOf":Ar(n,"multipleOf",r.value,r.message,e);break}return n}var dhe=C(()=>{bC()});function x6e(){return{type:"boolean"}}var fhe=C(()=>{});function b6e(t,e){return _n(t.type._def,e)}var phe=C(()=>{_s()});var C6e,mhe=C(()=>{_s();C6e=(t,e)=>_n(t.innerType._def,e)});function hhe(t,e,n){let r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,i)=>hhe(t,e,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return n$t(t,e)}}var n$t,ghe=C(()=>{bC();n$t=(t,e)=>{let n={type:"integer",format:"unix-time"};if(e.target==="openApi3")return n;for(let r of t.checks)switch(r.kind){case"min":Ar(n,"minimum",r.value,r.message,e);break;case"max":Ar(n,"maximum",r.value,r.message,e);break}return n}});function _6e(t,e){return{..._n(t.innerType._def,e),default:t.defaultValue()}}var yhe=C(()=>{_s()});function S6e(t,e,n){return e.effectStrategy==="input"?_n(t.schema._def,e,n):{}}var whe=C(()=>{_s()});function T6e(t){return{type:"string",enum:[...t.values]}}var vhe=C(()=>{});function I6e(t,e){let n=[_n(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),_n(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(i=>{if(r$t(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(r=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...l}=i;s=l}else r=void 0;o.push(s)}}),o.length?{allOf:o,...r}:void 0}var r$t,xhe=C(()=>{_s();r$t=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function P6e(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}var bhe=C(()=>{});function Sq(t,e){let n={type:"string"};function r(o){return e.patternStrategy==="escape"?o$t(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Ar(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Ar(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ym(n,"email",o.message,e);break;case"format:idn-email":Ym(n,"idn-email",o.message,e);break;case"pattern:zod":Zm(n,e0.email,o.message,e);break}break;case"url":Ym(n,"uri",o.message,e);break;case"uuid":Ym(n,"uuid",o.message,e);break;case"regex":Zm(n,o.regex,o.message,e);break;case"cuid":Zm(n,e0.cuid,o.message,e);break;case"cuid2":Zm(n,e0.cuid2,o.message,e);break;case"startsWith":Zm(n,RegExp(`^${r(o.value)}`),o.message,e);break;case"endsWith":Zm(n,RegExp(`${r(o.value)}$`),o.message,e);break;case"datetime":Ym(n,"date-time",o.message,e);break;case"date":Ym(n,"date",o.message,e);break;case"time":Ym(n,"time",o.message,e);break;case"duration":Ym(n,"duration",o.message,e);break;case"length":Ar(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Ar(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Zm(n,RegExp(r(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Ym(n,"ipv4",o.message,e),o.version!=="v4"&&Ym(n,"ipv6",o.message,e);break}case"emoji":Zm(n,e0.emoji,o.message,e);break;case"ulid":{Zm(n,e0.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ym(n,"binary",o.message,e);break}case"contentEncoding:base64":{Ar(n,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{Zm(n,e0.base64,o.message,e);break}}break}case"nanoid":Zm(n,e0.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}var Che,e0,o$t,Ym,Zm,E6e,Tq=C(()=>{bC();e0={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:()=>(Che===void 0&&(Che=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Che),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}$/};o$t=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Ym=(t,e,n,r)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&r.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,...n&&r.errorMessages&&{errorMessage:{format:n}}})):Ar(t,"format",e,n,r)},Zm=(t,e,n,r)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&r.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:E6e(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Ar(t,"pattern",E6e(e,r),n,r)},E6e=(t,e)=>{let n=typeof t=="function"?t():t;if(!e.applyRegexFlags||!n.flags)return n.source;let r={i:n.flags.includes("i"),m:n.flags.includes("m"),s:n.flags.includes("s")},o=r.i?n.source.toLowerCase():n.source,i="",s=!1,a=!1,l=!1;for(let c=0;c({...r,[o]:_n(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let n={type:"object",additionalProperties:_n(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return n;if(t.keyType?._def.typeName===he.ZodString&&t.keyType._def.checks?.length){let r=Object.entries(Sq(t.keyType._def,e)).reduce((o,[i,s])=>i==="type"?o:{...o,[i]:s},{});return{...n,propertyNames:r}}else if(t.keyType?._def.typeName===he.ZodEnum)return{...n,propertyNames:{enum:t.keyType._def.values}};return n}var Pq=C(()=>{_g();_s();Tq()});function A6e(t,e){if(e.mapStrategy==="record")return Iq(t,e);let n=_n(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},r=_n(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}var _he=C(()=>{_s();Pq()});function k6e(t){let e=t.values,r=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),o=Array.from(new Set(r.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}var She=C(()=>{});function M6e(){return{not:{}}}var The=C(()=>{});function N6e(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ihe=C(()=>{});function R6e(t,e){if(e.target==="openApi3")return O6e(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in WU&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,i)=>{let s=WU[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];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(r.length===n.length){let o=r.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:n.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(i=>!r.includes(i))],[])};return O6e(t,e)}var WU,O6e,Eq=C(()=>{_s();WU={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};O6e=(t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,o)=>_n(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0}});function L6e(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:WU[t.innerType._def.typeName],nullable:!0}:{type:[WU[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let r=_n(t.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let n=_n(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}var Phe=C(()=>{_s();Eq()});function D6e(t,e){let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",lhe(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Ar(n,"minimum",r.value,r.message,e):Ar(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Ar(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Ar(n,"maximum",r.value,r.message,e):Ar(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Ar(n,"maximum",r.value,r.message,e));break;case"multipleOf":Ar(n,"multipleOf",r.value,r.message,e);break}return n}var Ehe=C(()=>{bC()});function i$t(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":_n(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":_n(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function $6e(t,e){let n={type:"object",...Object.entries(t.shape()).reduce((r,[o,i])=>{if(i===void 0||i._def===void 0)return r;let s=[...e.currentPath,"properties",o],a=_n(i._def,{...e,currentPath:s,propertyPath:s});if(a===void 0)return r;if(e.openaiStrictMode&&i.isOptional()&&!i.isNullable()&&typeof i._def?.defaultValue>"u")throw new Error(`Zod field at \`${s.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:{...r.properties,[o]:a},required:i.isOptional()&&!e.openaiStrictMode?r.required:[...r.required,o]}},{properties:{},required:[]}),additionalProperties:i$t(t,e)};return n.required.length||delete n.required,n}var Ahe=C(()=>{_s()});var F6e,khe=C(()=>{_s();F6e=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return _n(t.innerType._def,{...e,currentPath:e.currentPath});let n=_n(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return n?{anyOf:[{not:{}},n]}:{}}});var U6e,Mhe=C(()=>{_s();U6e=(t,e)=>{if(e.pipeStrategy==="input")return _n(t.in._def,e);if(e.pipeStrategy==="output")return _n(t.out._def,e);let n=_n(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=_n(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}}});function B6e(t,e){return _n(t.type._def,e)}var Nhe=C(()=>{_s()});function z6e(t,e){let r={type:"array",uniqueItems:!0,items:_n(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Ar(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Ar(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}var Ohe=C(()=>{bC();_s()});function j6e(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>_n(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:_n(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>_n(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}var Rhe=C(()=>{_s()});function V6e(){return{not:{}}}var Lhe=C(()=>{});function W6e(){return{}}var Dhe=C(()=>{});var H6e,$he=C(()=>{_s();H6e=(t,e)=>_n(t.innerType._def,e)});function _n(t,e,n=!1){let r=e.seen.get(t);if(e.override){let s=e.override?.(t,e,r,n);if(s!==p6e)return s}if(r&&!n){let s=s$t(r,e);if(s!==void 0)return"$ref"in s&&e.seenRefs.add(s.$ref),s}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let i=l$t(t,t.typeName,e,n);return i&&c$t(t,e,i),o.jsonSchema=i,i}var s$t,a$t,l$t,c$t,_s=C(()=>{_g();che();uhe();dhe();fhe();phe();mhe();ghe();yhe();whe();vhe();xhe();bhe();_he();She();The();Ihe();Phe();Ehe();Ahe();khe();Mhe();Nhe();Pq();Ohe();Tq();Rhe();Lhe();Eq();Dhe();$he();_q();s$t=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let n=t.path.slice(e.basePath.length+1).join("_");return n!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[n]=t.def),{$ref:[...e.basePath,e.definitionPath,n].join("/")};case"relative":return{$ref:a$t(e.currentPath,t.path)};case"none":case"seen":return t.path.lengthe.currentPath[o]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},a$t=(t,e)=>{let n=0;for(;n{switch(e){case he.ZodString:return Sq(t,n);case he.ZodNumber:return D6e(t,n);case he.ZodObject:return $6e(t,n);case he.ZodBigInt:return v6e(t,n);case he.ZodBoolean:return x6e();case he.ZodDate:return hhe(t,n);case he.ZodUndefined:return V6e();case he.ZodNull:return N6e(n);case he.ZodArray:return w6e(t,n);case he.ZodUnion:case he.ZodDiscriminatedUnion:return R6e(t,n);case he.ZodIntersection:return I6e(t,n);case he.ZodTuple:return j6e(t,n);case he.ZodRecord:return Iq(t,n);case he.ZodLiteral:return P6e(t,n);case he.ZodEnum:return T6e(t);case he.ZodNativeEnum:return k6e(t);case he.ZodNullable:return L6e(t,n);case he.ZodOptional:return F6e(t,n);case he.ZodMap:return A6e(t,n);case he.ZodSet:return z6e(t,n);case he.ZodLazy:return _n(t.getter()._def,n);case he.ZodPromise:return B6e(t,n);case he.ZodNaN:case he.ZodNever:return M6e();case he.ZodEffects:return S6e(t,n,r);case he.ZodAny:return y6e();case he.ZodUnknown:return W6e();case he.ZodDefault:return _6e(t,n);case he.ZodBranded:return b6e(t,n);case he.ZodReadonly:return H6e(t,n);case he.ZodCatch:return C6e(t,n);case he.ZodPipeline:return U6e(t,n);case he.ZodFunction:case he.ZodVoid:case he.ZodSymbol:return;default:return(o=>{})(e)}},c$t=(t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),n)});var Fhe,Uhe=C(()=>{_s();ahe();she();Fhe=(t,e)=>{let n=g6e(e),r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=_n(t._def,r===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??{},i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i);let s=(()=>{if(h6e(n.definitions))return;let l={},c=new Set;for(let u=0;u<500;u++){let d=Object.entries(n.definitions).filter(([f])=>!c.has(f));if(d.length===0)break;for(let[f,p]of d)l[f]=_n(VU(p),{...n,currentPath:[...n.basePath,n.definitionPath,f]},!0)??{},c.add(f)}return l})(),a=r===void 0?s?{...o,[n.definitionPath]:s}:o:n.nameStrategy==="duplicate-ref"?{...o,...s||n.seenRefs.size?{[n.definitionPath]:{...s,...n.seenRefs.size?{[r]:o}:void 0}}:void 0}:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...s,[r]:o}};return n.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a}});var K6e=C(()=>{_q();ahe();bC();_s();che();uhe();dhe();fhe();phe();mhe();ghe();yhe();whe();vhe();xhe();bhe();_he();She();The();Ihe();Phe();Ehe();Ahe();khe();Mhe();Nhe();$he();Pq();Ohe();Tq();Rhe();Lhe();Eq();Dhe();Uhe();Uhe()});function q6e(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 nv(e,[],e)}function Bhe(t){if(typeof t=="boolean")return!1;if(t.type==="null")return!0;for(let e of t.oneOf??[])if(Bhe(e))return!0;for(let e of t.anyOf??[])if(Bhe(e))return!0;return!1}function nv(t,e,n){if(typeof t=="boolean")throw new TypeError(`Expected object schema but got boolean; path=${e.join("/")}`);if(!t0(t))throw new TypeError(`Expected ${JSON.stringify(t)} to be an object; path=${e.join("/")}`);let r=t.$defs;if(t0(r))for(let[f,p]of Object.entries(r))nv(p,[...e,"$defs",f],n);let o=t.definitions;if(t0(o))for(let[f,p]of Object.entries(o))nv(p,[...e,"definitions",f],n);t.type==="object"&&!("additionalProperties"in t)&&(t.additionalProperties=!1);let s=t.required??[],a=t.properties;if(t0(a)){for(let[f,p]of Object.entries(a))if(!Bhe(p)&&!s.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(a),t.properties=Object.fromEntries(Object.entries(a).map(([f,p])=>[f,nv(p,[...e,"properties",f],n)]))}let l=t.items;t0(l)&&(t.items=nv(l,[...e,"items"],n));let c=t.anyOf;Array.isArray(c)&&(t.anyOf=c.map((f,p)=>nv(f,[...e,"anyOf",String(p)],n)));let u=t.allOf;if(Array.isArray(u))if(u.length===1){let f=nv(u[0],[...e,"allOf","0"],n);Object.assign(t,f),delete t.allOf}else t.allOf=u.map((f,p)=>nv(f,[...e,"allOf",String(p)],n));t.default===null&&delete t.default;let d=t.$ref;if(d&&d$t(t,1)){if(typeof d!="string")throw new TypeError(`Received non-string $ref - ${d}; path=${e.join("/")}`);let f=u$t(n,d);if(typeof f=="boolean")throw new Error(`Expected \`$ref: ${d}\` to resolve to an object schema but got boolean`);if(!t0(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,nv(t,e,n)}return t}function u$t(t,e){if(!e.startsWith("#/"))throw new Error(`Unexpected $ref format ${JSON.stringify(e)}; Does not start with #/`);let n=e.slice(2).split("/"),r=t;for(let o of n){if(!t0(r))throw new Error(`encountered non-object entry while resolving ${e} - ${JSON.stringify(r)}`);let i=r[o];if(i===void 0)throw new Error(`Key ${o} not found while resolving ${e}`);r=i}return r}function t0(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function d$t(t,e){let n=0;for(let r in t)if(n++,n>e)return!0;return!1}var G6e=C(()=>{});function f$t(t,e){return Fhe(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function p$t(t){return q6e(Pb(t,{target:"draft-7"}))}function m$t(t){return"_zod"in t}function Y6e(t,e,n){return bWe({type:"json_schema",json_schema:{...n,name:e,strict:!0,schema:m$t(t)?p$t(t):f$t(t,{name:e})}},r=>t.parse(JSON.parse(r)))}var Z6e=C(()=>{tv();AM();K6e();Z5();G6e()});function X6e(t,e){if(typeof e<"u"&&!J6e.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${J6e.join(", ")}`);let n=!t.startsWith("gpt-3")&&!t.startsWith("gpt-4-")&&t!=="gpt-4";if(n&&!e)return"jsonSchema";if(!n&&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 h$t(t,e){let n={...t};return Object.defineProperties(n,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),n}function Q6e(t,e,n){if(Zf(t))return Y6e(t,e,n);if(hl(t))return h$t({type:"json_schema",json_schema:{...n,name:e,strict:!0,schema:Hr(t,{cycles:"ref",reused:"ref",override(r){r.jsonSchema.title=e}})}},r=>wT(t,JSON.parse(r)));throw new Error("Unsupported schema response format")}function e3e(t,e){if(e&&typeof e=="object"&&"images"in e&&Array.isArray(e.images)){let n=e.images.filter(r=>typeof r?.image_url?.url=="string").map(r=>({type:"image",url:r.image_url.url}));return[{type:"text",text:t},...n]}return t}var J6e,zhe=C(()=>{Bd();Bu();Ql();Z6e();J6e=["jsonSchema","functionCalling","jsonMode"]});var g$t,t3e,n3e=C(()=>{g$t={"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}},t3e=g$t});var n0,HU=C(()=>{wC();EN();vC();xC();zhe();n3e();Gm();Bd();Bu();Jo();vI();qd();jm();Uw();fM();n0=class extends dp{constructor(e){super(e??{});I(this,"temperature");I(this,"topP");I(this,"frequencyPenalty");I(this,"presencePenalty");I(this,"n");I(this,"logitBias");I(this,"model","gpt-3.5-turbo");I(this,"modelKwargs");I(this,"stop");I(this,"stopSequences");I(this,"user");I(this,"timeout");I(this,"streaming",!1);I(this,"streamUsage",!0);I(this,"maxTokens");I(this,"logprobs");I(this,"topLogprobs");I(this,"apiKey");I(this,"organization");I(this,"__includeRawResponse");I(this,"client");I(this,"clientConfig");I(this,"supportsStrictToolCalling");I(this,"audio");I(this,"modalities");I(this,"reasoning");I(this,"zdrEnabled");I(this,"service_tier");I(this,"promptCacheKey");I(this,"promptCacheRetention");I(this,"verbosity");I(this,"defaultOptions");I(this,"lc_serializable",!0);let n=typeof e?.configuration?.apiKey=="string"||typeof e?.configuration?.apiKey=="function"?e?.configuration?.apiKey:void 0;this.apiKey=e?.apiKey??n??In("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??In("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 n=this.invocationParams(e);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:n.temperature??void 0,ls_max_tokens:n.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(!Xw(this.model))return;let n;return this.reasoning!==void 0&&(n={...n,...this.reasoning}),e?.reasoning!==void 0&&(n={...n,...e.reasoning}),n}_getResponseFormat(e){return e&&e.type==="json_schema"&&e.json_schema.schema&&jr(e.json_schema.schema)?Q6e(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 r={baseURL:this.clientConfig.baseURL},o=Hg(r),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=Kg(i.defaultHeaders),this.client=new en(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,n){return XI(e)?wHe(e.metadata.customTool):Rg(e)?n?.strict!==void 0?{...e,function:{...e.function,strict:n.strict}}:e:lHe(e,n)}bindTools(e,n){let r;return n?.strict!==void 0?r=n.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling),this.withConfig({tools:e.map(o=>PN(o)||XI(o)?o:dHe(o)?o.extras.providerToolDefinition:this._convertChatOpenAIToolToCompletionsTool(o,{strict:r})),...n})}async stream(e,n){return super.stream(e,this._combineCallOptions(n))}async invoke(e,n){return super.invoke(e,this._combineCallOptions(n))}_combineLLMOutput(...e){return e.reduce((n,r)=>(r&&r.tokenUsage&&(n.tokenUsage.completionTokens+=r.tokenUsage.completionTokens??0,n.tokenUsage.promptTokens+=r.tokenUsage.promptTokens??0,n.tokenUsage.totalTokens+=r.tokenUsage.totalTokens??0),n),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}async getNumTokensFromMessages(e){let n=0,r=0,o=0;this.model==="gpt-3.5-turbo-0301"?(r=4,o=-1):(r=3,o=1);let i=await Promise.all(e.map(async s=>{let a=await this.getNumTokens(s.content),l=await this.getNumTokens(Qw(s)),c=s.name!==void 0?o+await this.getNumTokens(s.name):0,u=a+r+l+c,d=s;if(d._getType()==="function"&&(u-=2),d.additional_kwargs?.function_call&&(u+=3),d?.additional_kwargs.function_call?.name&&(u+=await this.getNumTokens(d.additional_kwargs.function_call?.name)),d.additional_kwargs.function_call?.arguments)try{u+=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)),u+=await this.getNumTokens(d.additional_kwargs.function_call?.arguments)}return n+=u,u}));return n+=3,{totalCount:n,countPerMessage:i}}async _getNumTokensFromGenerations(e){return(await Promise.all(e.map(async r=>r.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([r.message])).countPerMessage[0]:await this.getNumTokens(r.message.content)))).reduce((r,o)=>r+o,0)}async _getEstimatedTokenCountFromPrompt(e,n,r){let o=(await this.getNumTokensFromMessages(e)).totalCount;if(n&&r!=="auto"){let i=cHe(n);o+=await this.getNumTokens(i),o+=9}return n&&e.find(i=>i._getType()==="system")&&(o-=4),r==="none"?o+=1:typeof r=="object"&&(o+=await this.getNumTokens(r.name)+4),o}async moderateContent(e,n){let r=this._getClientOptions(n?.options),o=n?.model??"omni-moderation-latest",i={input:e,model:o};return this.caller.call(async()=>{try{return await this.client.moderations.create(i,r)}catch(s){throw hp(s)}})}get profile(){return t3e[this.model]??{}}_getStructuredOutputMethod(e){let n={...e};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(n?.method===void 0)return"jsonSchema"}else n.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return n.method}withStructuredOutput(e,n){let r,o,{schema:i,name:s,includeRaw:a}={...n,schema:e};if(n?.strict!==void 0&&n.method==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");let l=X6e(this.model,n?.method);if(l==="jsonMode"){jr(i)?o=Vm.fromZodSchema(i):o=new Gd;let f=Hr(i);r=this.withConfig({outputVersion:"v0",response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:s??"extract",...f}}})}else if(l==="jsonSchema"){let f={name:s??"extract",description:NT(i),schema:i,strict:n?.strict},p=Hr(f.schema);if(r=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}}}),jr(i)){let m=Vm.fromZodSchema(i);o=$w.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else o=new Gd}else{let f=s??"extract";if(jr(i)){let p=Hr(i);r=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}},...n?.strict!==void 0?{strict:n.strict}:{}}),o=new up({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=Hr(i);r=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}},...n?.strict!==void 0?{strict:n.strict}:{}}),o=new up({returnSingle:!0,keyName:f})}}if(!a)return r.pipe(o);let c=xl.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),u=xl.assign({parsed:()=>null}),d=c.withFallbacks({fallbacks:[u]});return Kc.from([{raw:r},d])}}});var Aq,jhe,Vhe,r3e,o3e,KU,NN=C(()=>{vC();zhe();Kr();fM();Aq={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=Bc({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 n=e.mime_type||t.mime_type||"",r;try{r=A3(n)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(r.type!=="audio"||r.subtype!=="wav"&&r.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:r.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=A3(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=Bc({dataUrl:t.url}),n=IN(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:n}:{}}}}if(t.source_type==="base64"){let e=IN(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`)}},jhe=({message:t,rawResponse:e,includeRawResponse:n})=>{let r=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let c of r??[])try{o.push(Xb(c,{returnId:!0}))}catch(u){i.push(Bw(c,u.message))}let s={function_call:t.function_call,tool_calls:r};n!==void 0&&(s.__raw_response=e);let a={model_provider:"openai",model_name:e.model,...e.system_fingerprint?{usage:{...e.usage},system_fingerprint:e.system_fingerprint}:{}};t.audio&&(s.audio=t.audio);let l=e3e(t.content||"",e.choices?.[0]?.message);return new kn({content:l,tool_calls:o,invalid_tool_calls:i,additional_kwargs:s,response_metadata:a,id:e.id})}default:return new rc(t.content||"",t.role??"unknown")}},Vhe=({delta:t,rawResponse:e,includeRawResponse:n,defaultRole:r})=>{let o=t.role??r,i=t.content??"",s;t.function_call?s={function_call:t.function_call}:t.tool_calls?s={tool_calls:t.tool_calls}:s={},n&&(s.__raw_response=e),t.audio&&(s.audio={...t.audio,index:e.choices[0].index});let a={model_provider:"openai",usage:{...e.usage}};if(o==="user")return new Ub({content:i,response_metadata:a});if(o==="assistant"){let l=[];if(Array.isArray(t.tool_calls))for(let c of t.tool_calls)l.push({name:c.function?.name,args:c.function?.arguments,id:c.id,index:c.index,type:"tool_call_chunk"});return new Yt({content:i,tool_call_chunks:l,additional_kwargs:s,id:e.id,response_metadata:a})}else return o==="system"?new Sg({content:i,response_metadata:a}):o==="developer"?new Sg({content:i,response_metadata:a,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Fb({content:i,additional_kwargs:s,name:t.name,response_metadata:a}):o==="tool"?new Bk({content:i,additional_kwargs:s,tool_call_id:t.tool_call_id,response_metadata:a}):new $b({content:i,role:o,response_metadata:a})},r3e=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=Lle(()=>{let[,n]=t.mimeType.split("/");return n==="wav"||n==="mp3"?n:"wav"});return{type:"input_audio",input_audio:{data:t.data.toString(),format:e}}}if(t.type==="file"){if(t.data){let e=IN(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}}}},o3e=({message:t,model:e})=>{let n=Qw(t);if(n==="system"&&Xw(e)&&(n="developer"),n==="developer")return{role:"developer",content:t.contentBlocks.filter(o=>o.type==="text")};if(n==="system")return{role:"system",content:t.contentBlocks.filter(o=>o.type==="text")};if(n==="assistant")return{role:"assistant",content:t.contentBlocks.filter(o=>o.type==="text")};if(n==="tool"&&Wd.isInstance(t))return{role:"tool",tool_call_id:t.tool_call_id,content:t.contentBlocks.filter(o=>o.type==="text")};if(n==="function")return{role:"function",name:t.name??"",content:t.contentBlocks.filter(o=>o.type==="text").join("")};function*r(o){for(let i of o){i.type==="text"&&(yield{type:"text",text:i.text});let s=r3e(i);s&&(yield s)}}return{role:"user",content:Array.from(r(t.contentBlocks))}},KU=({messages:t,model:e})=>t.flatMap(n=>{if("output_version"in n.response_metadata&&n.response_metadata?.output_version==="v1")return o3e({message:n});let r=Qw(n);r==="system"&&Xw(e)&&(r="developer");let o=typeof n.content=="string"?n.content:n.content.map(s=>tc(s)?kw(s,Aq):s),i={role:r,content:o};if(n.name!=null&&(i.name=n.name),n.additional_kwargs.function_call!=null&&(i.function_call=n.additional_kwargs.function_call),kn.isInstance(n)&&n.tool_calls?.length?i.tool_calls=n.tool_calls.map(cU):(n.additional_kwargs.tool_calls!=null&&(i.tool_calls=n.additional_kwargs.tool_calls),Wd.isInstance(n)&&n.tool_call_id!=null&&(i.tool_call_id=n.tool_call_id)),n.additional_kwargs.audio&&typeof n.additional_kwargs.audio=="object"&&"id"in n.additional_kwargs.audio){let s={role:"assistant",audio:{id:n.additional_kwargs.audio.id}};return[i,s]}return i})});var qg,kq=C(()=>{wC();EN();vC();HU();NN();Kr();ac();qg=class extends n0{invocationParams(t,e){let n;t?.strict!==void 0?n=t.strict:this.supportsStrictToolCalling!==void 0&&(n=this.supportsStrictToolCalling);let r={};t?.stream_options!==void 0?r={stream_options:t.stream_options}:this.streamUsage&&(this.streaming||e?.streaming)&&(r={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(s=>this._convertChatOpenAIToolToCompletionsTool(s,{strict:n})):void 0,tool_choice:oq(t?.tool_choice),response_format:this._getResponseFormat(t?.response_format),seed:t?.seed,...r,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),Xw(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,n){let r={},o=this.invocationParams(e),i=KU({messages:t,model:this.model});if(o.stream){let s=this._streamResponseChunks(t,e,n),a={};for await(let p of s){p.message.response_metadata={...p.generationInfo,...p.message.response_metadata};let m=p.generationInfo?.completion??0;a[m]===void 0?a[m]=p:a[m]=a[m].concat(p)}let l=Object.entries(a).sort(([p],[m])=>parseInt(p,10)-parseInt(m,10)).map(([p,m])=>m),{functions:c,function_call:u}=this.invocationParams(e),d=await this._getEstimatedTokenCountFromPrompt(t,c,u),f=await this._getNumTokensFromGenerations(l);return r.input_tokens=d,r.output_tokens=f,r.total_tokens=d+f,{generations:l,llmOutput:{estimatedTokenUsage:{promptTokens:r.input_tokens,completionTokens:r.output_tokens,totalTokens:r.total_tokens}}}}else{let s=await this.completionWithRetry({...o,stream:!1,messages:i},{signal:e?.signal,...e?.options}),{completion_tokens:a,prompt_tokens:l,total_tokens:c,prompt_tokens_details:u,completion_tokens_details:d}=s?.usage??{};a&&(r.output_tokens=(r.output_tokens??0)+a),l&&(r.input_tokens=(r.input_tokens??0)+l),c&&(r.total_tokens=(r.total_tokens??0)+c),(u?.audio_tokens!==null||u?.cached_tokens!==null)&&(r.input_token_details={...u?.audio_tokens!==null&&{audio:u?.audio_tokens},...u?.cached_tokens!==null&&{cache_read:u?.cached_tokens}}),(d?.audio_tokens!==null||d?.reasoning_tokens!==null)&&(r.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 s?.choices??[]){let h={text:p.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(p.message??{role:"assistant"},s)};h.generationInfo={...p.finish_reason?{finish_reason:p.finish_reason}:{},...p.logprobs?{logprobs:p.logprobs}:{}},rp(h.message)&&(h.message.usage_metadata=r),h.message=new kn(Object.fromEntries(Object.entries(h.message).filter(([g])=>!g.startsWith("lc_")))),f.push(h)}return{generations:f,llmOutput:{tokenUsage:{promptTokens:r.input_tokens,completionTokens:r.output_tokens,totalTokens:r.total_tokens}}}}}async*_streamResponseChunks(t,e,n){let r=KU({messages:t,model:this.model}),o={...this.invocationParams(e,{streaming:!0}),messages:r,stream:!0},i,s=await this.completionWithRetry(o,e),a;for await(let l of s){let c=l?.choices?.[0];if(l.usage&&(a=l.usage),!c)continue;let{delta:u}=c;if(!u)continue;let d=this._convertCompletionsDeltaToBaseMessageChunk(u,l,i);i=u.role??i;let f={prompt:e.promptIndex??0,completion:c.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};c.finish_reason!=null&&(p.finish_reason=c.finish_reason,p.system_fingerprint=l.system_fingerprint,p.model_name=l.model,p.service_tier=l.service_tier),this.logprobs&&(p.logprobs=c.logprobs);let m=new Jr({message:d,text:d.content,generationInfo:p});yield m,await n?.handleLLMNewToken(m.text??"",f,void 0,void 0,void 0,{chunk:m})}if(a){let l={...a.prompt_tokens_details?.audio_tokens!==null&&{audio:a.prompt_tokens_details?.audio_tokens},...a.prompt_tokens_details?.cached_tokens!==null&&{cache_read:a.prompt_tokens_details?.cached_tokens}},c={...a.completion_tokens_details?.audio_tokens!==null&&{audio:a.completion_tokens_details?.audio_tokens},...a.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:a.completion_tokens_details?.reasoning_tokens}};yield new Jr({message:new Yt({content:"",response_metadata:{usage:{...a}},usage_metadata:{input_tokens:a.prompt_tokens,output_tokens:a.completion_tokens,total_tokens:a.total_tokens,...Object.keys(l).length>0&&{input_token_details:l},...Object.keys(c).length>0&&{output_token_details:c}}}),text:""})}if(e.signal?.aborted)throw new Error("AbortError")}async completionWithRetry(t,e){let n=this._getClientOptions(e),r=t.response_format&&t.response_format.type==="json_schema";return this.caller.call(async()=>{try{return r&&!t.stream?await this.client.chat.completions.parse(t,n):await this.client.chat.completions.create(t,n)}catch(o){throw hp(o)}})}_convertCompletionsDeltaToBaseMessageChunk(t,e,n){return Vhe({delta:t,rawResponse:e,includeRawResponse:this.__includeRawResponse,defaultRole:n})}_convertCompletionsMessageToBaseMessage(t,e){return jhe({message:t,rawResponse:e,includeRawResponse:this.__includeRawResponse})}}});var Mq=C(()=>{xC();Gm();Jo()});var Whe=C(()=>{kq();Mq()});var ON,Hhe,Nq,u3e,Khe,d3e,Oq,Rq=C(()=>{EN();vC();NN();Kr();ac();fM();ON="__openai_function_call_ids__",Hhe=t=>{let e={...t?.input_tokens_details?.cached_tokens!=null&&{cache_read:t?.input_tokens_details?.cached_tokens}},n={...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:n}},Nq=t=>{if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e,n=[],r=[],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},s={};for(let a of t.output)if(a.type==="message")e=a.id,n.push(...a.content.flatMap(l=>l.type==="output_text"?("parsed"in l&&l.parsed!=null&&(s.parsed=l.parsed),{type:"text",text:l.text,annotations:l.annotations}):l.type==="refusal"?(s.refusal=l.refusal,[]):l));else if(a.type==="function_call"){let l={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(Xb(l,{returnId:!0}))}catch(c){let u;typeof c=="object"&&c!=null&&"message"in c&&typeof c.message=="string"&&(u=c.message),o.push(Bw(l,u))}s[ON]??(s[ON]={}),a.id&&(s[ON][a.call_id]=a.id)}else if(a.type==="reasoning")s.reasoning=a;else if(a.type==="custom_tool_call"){let l=pHe(a);l?r.push(l):o.push(Bw(a,"Malformed custom tool call"))}else if(a.type==="computer_call"){let l=mHe(a);l?r.push(l):o.push(Bw(a,"Malformed computer call"))}else s.tool_outputs??(s.tool_outputs=[]),s.tool_outputs.push(a);return new kn({id:e,content:n,tool_calls:r,invalid_tool_calls:o,usage_metadata:Hhe(t.usage),additional_kwargs:s,response_metadata:i})},u3e=t=>{let e=(t.summary.length>1?t.summary.reduce((n,r)=>{let o=n[n.length-1];return o.index===r.index?o.text+=r.text:n.push(r),n},[{...t.summary[0]}]):t.summary).map(n=>Object.fromEntries(Object.entries(n).filter(([r])=>r!=="index")));return{...t,summary:e}},Khe=t=>{let e=[],n={},r,o=[],i={model_provider:"openai"},s={},a;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")a=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}),s[ON]={[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}),s.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))s.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 l=Nq(t.response);r=Hhe(t.response.usage),t.response.text?.format?.type==="json_schema"&&(s.parsed??(s.parsed=JSON.parse(l.text)));for(let[c,u]of Object.entries(t.response))c!=="id"&&(i[c]=u)}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")n={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")s.refusal=t.refusal;else if(t.type==="response.output_item.added"&&"item"in t&&t.item.type==="reasoning"){let l=t.item.summary?t.item.summary.map((c,u)=>({...c,index:u})):void 0;s.reasoning={id:t.item.id,type:t.item.type,...l?{summary:l}:{}}}else if(t.type==="response.reasoning_summary_part.added")s.reasoning={type:"reasoning",summary:[{...t.part,index:t.summary_index}]};else if(t.type==="response.reasoning_summary_text.delta")s.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 Jr({text:e.map(l=>l.text).join(""),message:new Yt({id:a,content:e,tool_call_chunks:o,usage_metadata:r,additional_kwargs:s,response_metadata:i}),generationInfo:n})},d3e=t=>{let e=kn.isInstance(t)&&t.response_metadata?.model_provider==="openai";function*n(){let r=Jw(()=>{try{let y=Qw(t);return y==="system"||y==="developer"||y==="assistant"||y==="user"?y:"assistant"}catch{return"assistant"}}),o,i=new Set,s=new Set,a=new Map,l=new Map;function*c(){if(!o)return;let y=o.content;(typeof y=="string"&&y.length>0||Array.isArray(y)&&y.length>0)&&(yield o),o=void 0}let u=y=>{o||(o={type:"message",role:r,content:[]}),typeof o.content=="string"?o.content=o.content.length>0?[{type:"input_text",text:o.content},...y]:[...y]:o.content.push(...y)},d=y=>{if(typeof y=="string")return y;try{return JSON.stringify(y??{})}catch{return"{}"}},f=y=>{let w=Jw(()=>{let v=y.metadata?.detail;return v==="low"||v==="high"||v==="auto"?v:"auto"});if(y.fileId)return{type:"input_image",detail:w,file_id:y.fileId};if(y.url)return{type:"input_image",detail:w,image_url:y.url};if(y.data){let v=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64"),x=y.mimeType??"image/png";return{type:"input_image",detail:w,image_url:`data:${x};base64,${v}`}}},p=y=>{let w=IN(y);if(y.fileId&&typeof w=="string")return{type:"input_file",file_id:y.fileId,...w?{filename:w}:{}};if(y.url&&typeof w=="string")return{type:"input_file",file_url:y.url,...w?{filename:w}:{}};if(y.data&&typeof w=="string"){let v=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64");return{type:"input_file",file_data:`data:${y.mimeType??"application/octet-stream"};base64,${v}`,...w?{filename:w}:{}}}},m=y=>{let w=Jw(()=>{if(Array.isArray(y.summary)){let _=y.summary?.map(T=>T?.text).filter(T=>typeof T=="string")??[];if(_.length>0)return _}return y.reasoning?[y.reasoning]:[]}),v=w.length>0?w.map(b=>({type:"summary_text",text:b})):[{type:"summary_text",text:""}],x={type:"reasoning",id:y.id??"",summary:v};return y.reasoning&&(x.content=[{type:"reasoning_text",text:y.reasoning}]),x},h=y=>({type:"function_call",name:y.name??"",call_id:y.id??"",arguments:d(y.args)}),g=y=>{let w=d(y.output),v=y.status==="success"?"completed":y.status==="error"?"incomplete":void 0;return{type:"function_call_output",call_id:y.toolCallId??"",output:w,...v?{status:v}:{}}};for(let y of t.contentBlocks)if(y.type==="text")u([{type:"input_text",text:y.text}]);else if(y.type!=="invalid_tool_call"){if(y.type==="reasoning")yield*c(),yield m(y);else if(y.type==="tool_call"){yield*c();let w=y.id??"";w&&(i.add(w),a.delete(w)),yield h(y)}else if(y.type==="tool_call_chunk"){if(y.id){let w=a.get(y.id)??{name:y.name,args:[]};y.name&&(w.name=y.name),y.args&&w.args.push(y.args),a.set(y.id,w)}}else if(y.type==="server_tool_call"){yield*c();let w=y.id??"";w&&(s.add(w),l.delete(w)),yield h(y)}else if(y.type==="server_tool_call_chunk"){if(y.id){let w=l.get(y.id)??{name:y.name,args:[]};y.name&&(w.name=y.name),y.args&&w.args.push(y.args),l.set(y.id,w)}}else if(y.type==="server_tool_call_result")yield*c(),yield g(y);else if(y.type!=="audio")if(y.type==="file"){let w=p(y);w&&u([w])}else if(y.type==="image"){let w=f(y);w&&u([w])}else if(y.type==="video"){let w=p(y);w&&u([w])}else y.type==="text-plain"?y.text&&u([{type:"input_text",text:y.text}]):y.type==="non_standard"&&e&&(yield*c(),yield y.value)}yield*c();for(let[y,w]of a){if(!y||i.has(y))continue;let v=w.args.join("");!w.name&&!v||(yield{type:"function_call",call_id:y,name:w.name??"",arguments:v})}for(let[y,w]of l){if(!y||s.has(y))continue;let v=w.args.join("");!w.name&&!v||(yield{type:"function_call",call_id:y,name:w.name??"",arguments:v})}}return Array.from(n())},Oq=({messages:t,zdrEnabled:e,model:n})=>t.flatMap(r=>{let o=r.response_metadata;if(o?.output_version==="v1")return d3e(r);let i=r.additional_kwargs,s=Qw(r);if(s==="system"&&Xw(n)&&(s="developer"),s==="function")throw new Error("Function messages are not supported in Responses API");if(s==="tool"){let a=r;if(i?.type==="computer_call_output")return{type:"computer_call_output",output:(()=>{if(typeof a.content=="string")return{type:"input_image",image_url:a.content};if(Array.isArray(a.content)){let u=a.content.find(p=>p.type==="input_image");if(u)return u;let d=a.content.find(p=>p.type==="computer_screenshot");if(d)return d;let f=a.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:a.tool_call_id};if(a.additional_kwargs?.customTool)return{type:"custom_tool_call_output",call_id:a.tool_call_id,output:a.content};let l=Array.isArray(a.content)&&a.content.every(c=>typeof c=="object"&&c!==null&&"type"in c&&(c.type==="input_file"||c.type==="input_image"||c.type==="input_text"));return{type:"function_call_output",call_id:a.tool_call_id,id:a.id?.startsWith("fc_")?a.id:void 0,output:l?a.content:typeof a.content!="string"?JSON.stringify(a.content):a.content}}if(s==="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 a=[];if(i?.reasoning&&!e){let f=u3e(i.reasoning);a.push(f)}let{content:l}=r;i?.refusal&&(typeof l=="string"&&(l=[{type:"output_text",text:l,annotations:[]}]),l=[...l,{type:"refusal",refusal:i.refusal}]),(typeof l=="string"||l.length>0)&&a.push({type:"message",role:"assistant",...r.id&&!e&&r.id.startsWith("msg_")?{id:r.id}:{},content:Jw(()=>typeof l=="string"?l:l.flatMap(f=>f.type==="text"?{type:"output_text",text:f.text,annotations:f.annotations??[]}:f.type==="output_text"||f.type==="refusal"?f:[]))});let c=i?.[ON];kn.isInstance(r)&&r.tool_calls?.length?a.push(...r.tool_calls.map(f=>gHe(f)?{type:"custom_tool_call",id:f.call_id,call_id:f.id??"",input:f.args.input,name:f.name}:hHe(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:c?.[f.id]}})):i?.tool_calls&&a.push(...i.tool_calls.map(f=>({type:"function_call",name:f.function.name,call_id:f.id,arguments:f.function.arguments,...e?{}:{id:c?.[f.id]}})));let u=o?.output?.length?o?.output:i.tool_outputs,d=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(u!=null){let p=u?.filter(m=>d.includes(m.type));p.length>0&&a.push(...p)}return a}if(s==="user"||s==="system"||s==="developer"){if(typeof r.content=="string")return{type:"message",role:s,content:r.content};let a=[],l=r.content.flatMap(c=>{if(c.type==="mcp_approval_response"&&a.push({type:"mcp_approval_response",approval_request_id:c.approval_request_id,approve:c.approve}),tc(c))return kw(c,Aq);if(c.type==="text")return{type:"input_text",text:c.text};if(c.type==="image_url"){let u=Jw(()=>{if(typeof c.image_url=="string")return c.image_url;if(typeof c.image_url=="object"&&c.image_url!==null&&"url"in c.image_url)return c.image_url.url}),d=Jw(()=>{if(typeof c.image_url=="string")return"auto";if(typeof c.image_url=="object"&&c.image_url!==null&&"detail"in c.image_url)return c.image_url.detail});return{type:"input_image",image_url:u,detail:d}}return c.type==="input_text"||c.type==="input_image"||c.type==="input_file"?c:[]});return l.length>0&&a.push({type:"message",role:s,content:l}),a}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${s}`),[]})});var Lq,Dq=C(()=>{wC();EN();HU();Rq();qd();Lq=class extends n0{invocationParams(t){let e;t?.strict!==void 0&&(e=t.strict),e===void 0&&this.supportsStrictToolCalling!==void 0&&(e=this.supportsStrictToolCalling);let n={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:fHe(t?.tool_choice)?t?.tool_choice:(()=>{let o=oq(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},r=this._getReasoningParams(t);return r!==void 0&&(n.reasoning=r),n}async _generate(t,e,n){let r=this.invocationParams(e);if(r.stream){let o=this._streamResponseChunks(t,e,n),i;for await(let s of o)s.message.response_metadata={...s.generationInfo,...s.message.response_metadata},i=i?.concat(s)??s;return{generations:i?[i]:[],llmOutput:{estimatedTokenUsage:i?.message?.usage_metadata}}}else{let o=await this.completionWithRetry({input:Oq({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),...r,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:Nq(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,n){let r=await this.completionWithRetry({...this.invocationParams(e),input:Oq({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),stream:!0},e);for await(let o of r){let i=Khe(o);i!=null&&(yield i,await n?.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 n=this._getClientOptions(e);try{return t.text?.format?.type==="json_schema"&&!t.stream?await this.client.responses.parse(t,n):await this.client.responses.create(t,n)}catch(r){throw hp(r)}})}_reduceChatOpenAITools(t,e){let n=[];for(let r of t)if(PN(r))r.type==="image_generation"&&e?.stream&&(r.partial_images=1),n.push(r);else if(XI(r)){let o=r.metadata.customTool;n.push({type:"custom",name:o.name,description:o.description,format:o.format})}else Rg(r)?n.push({type:"function",name:r.function.name,parameters:r.function.parameters,description:r.function.description,strict:e?.strict??null}):iq(r)&&n.push(yHe(r));return n}}});var qhe=C(()=>{Mq();Dq()});var Zc,Ghe=C(()=>{EN();vC();HU();kq();Dq();Zc=class f3e extends n0{constructor(n){super(n);I(this,"useResponsesApi",!1);I(this,"responses");I(this,"completions");this.fields=n,this.useResponsesApi=n?.useResponsesApi??!1,this.responses=n?.responses??new Lq(n),this.completions=n?.completions??new qg(n)}get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}_useResponsesApi(n){let r=n?.tools?.some(PN),o=n?.previous_response_id!=null||n?.text!=null||n?.truncation!=null||n?.include!=null||n?.reasoning?.summary!=null||this.reasoning?.summary!=null,i=n?.tools?.some(iq)||n?.tools?.some(XI);return this.useResponsesApi||r||o||i||iHe(this.model)}getLsParams(n){let r=this._combineCallOptions(n);return this._useResponsesApi(n)?this.responses.getLsParams(r):this.completions.getLsParams(r)}invocationParams(n){let r=this._combineCallOptions(n);return this._useResponsesApi(n)?this.responses.invocationParams(r):this.completions.invocationParams(r)}async _generate(n,r,o){return this._useResponsesApi(r)?this.responses._generate(n,r):this.completions._generate(n,r,o)}async*_streamResponseChunks(n,r,o){if(this._useResponsesApi(r)){yield*this.responses._streamResponseChunks(n,this._combineCallOptions(r),o);return}yield*this.completions._streamResponseChunks(n,this._combineCallOptions(r),o)}withConfig(n){let r=new f3e(this.fields);return r.defaultOptions={...this.defaultOptions,...n},r}}});var p3e=C(()=>{Mq();Whe();qhe();Ghe()});var Yhe=C(()=>{wC();xC();Gm();ac();Jo();qd();Ude();fU()});var m3e=C(()=>{xC();Yhe();Gm();Jo()});var rv,Zhe=C(()=>{wC();xC();Gm();Jo();fU();dU();rv=class extends Qb{constructor(e){let n={maxConcurrency:2,...e};super(n);I(this,"model","text-embedding-ada-002");I(this,"modelName");I(this,"batchSize",512);I(this,"stripNewLines",!0);I(this,"dimensions");I(this,"timeout");I(this,"organization");I(this,"encodingFormat");I(this,"client");I(this,"clientConfig");I(this,"apiKey");let r=n?.apiKey??n?.openAIApiKey??In("OPENAI_API_KEY");this.organization=n?.configuration?.organization??In("OPENAI_ORGANIZATION"),this.model=n?.model??n?.modelName??this.model,this.modelName=this.model,this.batchSize=n?.batchSize??this.batchSize,this.stripNewLines=n?.stripNewLines??this.stripNewLines,this.timeout=n?.timeout,this.dimensions=n?.dimensions,this.encodingFormat=n?.encodingFormat,this.clientConfig={apiKey:r,organization:this.organization,dangerouslyAllowBrowser:!0,...e?.configuration}}async embedDocuments(e){let n=xI(this.stripNewLines?e.map(s=>s.replace(/\n/g," ")):e,this.batchSize),r=n.map(s=>{let a={model:this.model,input:s};return this.dimensions&&(a.dimensions=this.dimensions),this.encodingFormat&&(a.encoding_format=this.encodingFormat),this.embeddingWithRetry(a)}),o=await Promise.all(r),i=[];for(let s=0;s{try{return await this.client.embeddings.create(e,n)}catch(r){throw hp(r)}})}}});var Jhe,h3e=C(()=>{wC();xC();Zhe();Gm();Jo();Jhe=class extends rv{constructor(e){super(e);I(this,"azureOpenAIApiVersion");I(this,"azureOpenAIApiKey");I(this,"azureADTokenProvider");I(this,"azureOpenAIApiInstanceName");I(this,"azureOpenAIApiDeploymentName");I(this,"azureOpenAIBasePath");this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??(typeof e?.apiKey=="string"?e?.apiKey:void 0)??In("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??In("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??In("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??In("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(In("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||In("AZURE_OPENAI_API_DEPLOYMENT_NAME")),this.azureADTokenProvider=e?.azureADTokenProvider}async embeddingWithRetry(e){if(!this.client){let r={azureOpenAIApiDeploymentName:this.azureOpenAIApiDeploymentName,azureOpenAIApiInstanceName:this.azureOpenAIApiInstanceName,azureOpenAIApiKey:this.azureOpenAIApiKey,azureOpenAIBasePath:this.azureOpenAIBasePath,azureADTokenProvider:this.azureADTokenProvider,baseURL:this.clientConfig.baseURL},o=Hg(r),{apiKey:i,...s}=this.clientConfig,a={...s,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(a.apiKey=r.azureOpenAIApiKey),a.baseURL||delete a.baseURL,a.defaultHeaders=Kg(a.defaultHeaders,!0,"2.0.0"),this.client=new JI({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...a})}let n={};return this.azureOpenAIApiKey&&(n.headers={"api-key":this.azureOpenAIApiKey,...n.headers},n.query={"api-version":this.azureOpenAIApiVersion,...n.query}),this.caller.call(async()=>{try{return await this.client.embeddings.create(e,n)}catch(r){throw hp(r)}})}}});function Gg(t,e){let n=u2(e.schema),r=w2(e.schema);if(!e.schema||n||r)return new w3e({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(s,a,l)=>new Promise((c,u)=>{let d=Fi(l,{callbacks:a?.getChild()});vl.runWithConfig(Gu(d),async()=>{try{c(t(s,d))}catch(f){u(f)}})})});let o=e.schema,i=e.description??e.schema.description??`${e.name} tool`;return new b$t({...e,description:i,schema:o,func:async(s,a,l)=>new Promise((c,u)=>{let d,f=()=>{l?.signal&&d&&l.signal.removeEventListener("abort",d)};l?.signal&&(d=()=>{f(),u(Kb(l.signal))},l.signal.addEventListener("abort",d,{once:!0}));let p=Fi(l,{callbacks:a?.getChild()});vl.runWithConfig(Gu(p),async()=>{try{let m=await t(s,p);if(Vue(m)){c(m);return}if(l?.signal?.aborted){f();return}f(),c(m)}catch(m){f(),u(m)}})})})}function C$t(t){let{content:e,artifact:n,toolCallId:r,metadata:o}=t;return r&&!Ple(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Wd({status:"success",content:e,artifact:n,tool_call_id:r,name:t.name,metadata:o}):new Wd({status:"success",content:_$t(e),artifact:n,tool_call_id:r,name:t.name,metadata:o}):e}function _$t(t){try{return JSON.stringify(t)??""}catch{return`${t}`}}var g3e,y3e,w3e,b$t,gp=C(()=>{$n();L3();zk();Hb();sI();aI();Ng();rM();vg();Bu();Hue();qd();Jue();_g();P3();tv();g3e=class extends nU{constructor(e){super(e??{});I(this,"extras");I(this,"returnDirect",!1);I(this,"verboseParsingErrors",!1);I(this,"responseFormat","content");I(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,n){let r,o=fr(nM(this.defaultConfig,n));return Db(e)?(r=e.args,o={...o,toolCall:e}):r=e,this.call(r,o)}async call(e,n,r){let o=Db(e)?e.args:e,i;if(jr(this.schema))try{i=await MT(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h} Details: ${m.message}`),_ae(m)&&(h=`${h} ${se.prettifyError(m)}`),new S2(h,JSON.stringify(e))}else{let m=Yo(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(g=>`${g.keywordLocation}: ${g.error}`).join(` `)}`),new S2(h,JSON.stringify(e))}i=o}let s=Wb(n),a=Ws.configure(s.callbacks,this.callbacks,s.tags||r,this.tags,s.metadata,this.metadata,{verbose:this.verbose}),l;Db(e)&&(l=e.id),!l&&HFe(s)&&(l=s.toolCall.id);let c=await a?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),s.runId,void 0,void 0,void 0,s.runName,l);delete s.runId;let u;try{let m=await this._call(i,c,s);u=Vue(m)?await Xje(m,async h=>{try{await c?.handleToolEvent(h)}catch(g){await c?.handleToolError(g)}}):m}catch(m){throw await c?.handleToolError(m),m}let d,f;if(this.responseFormat==="content_and_artifact")if(Array.isArray(u)&&u.length===2)[d,f]=u;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple. Result: ${JSON.stringify(u)}`);else d=u;let p=C$t({content:d,artifact:f,toolCallId:l,name:this.name,metadata:this.metadata});return await c?.handleToolEnd(p),p}},y3e=class extends g3e{constructor(e){super(e);I(this,"schema",we.object({input:we.string().optional()}).transform(e=>e.input))}call(e,n){let r=typeof e=="string"||e==null?{input:e}:e;return super.call(r,n)}},w3e=class extends y3e{constructor(e){super(e);I(this,"name");I(this,"description");I(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,n){let r=Wb(n);return r.runName===void 0&&(r.runName=this.name),super.call(e,r)}_call(e,n,r){return this.func(e,n,r)}},b$t=class extends g3e{constructor(e){super(e);I(this,"description");I(this,"func");I(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,n,r){let o=Wb(n);return o.runName===void 0&&(o.runName=this.name),super.call(e,o,r)}_call(e,n,r){return this.func(e,n,r)}}});var Xhe=C(()=>{Gm();Jo();gp()});var v3e=C(()=>{});var x3e=C(()=>{});var b3e=C(()=>{});var C3e=C(()=>{});var _3e=C(()=>{});var S$t,T$t,I$t,P$t,E$t,A$t,k$t,M$t,N$t,O$t,vKn,S3e=C(()=>{Kr();gp();tv();S$t=se.object({type:se.literal("screenshot")}),T$t=se.object({type:se.literal("click"),x:se.number(),y:se.number(),button:se.enum(["left","right","wheel","back","forward"]).default("left")}),I$t=se.object({type:se.literal("double_click"),x:se.number(),y:se.number(),button:se.enum(["left","right","wheel","back","forward"]).default("left")}),P$t=se.object({type:se.literal("drag"),path:se.array(se.object({x:se.number(),y:se.number()}))}),E$t=se.object({type:se.literal("keypress"),keys:se.array(se.string())}),A$t=se.object({type:se.literal("move"),x:se.number(),y:se.number()}),k$t=se.object({type:se.literal("scroll"),x:se.number(),y:se.number(),scroll_x:se.number(),scroll_y:se.number()}),M$t=se.object({type:se.literal("type"),text:se.string()}),N$t=se.object({type:se.literal("wait"),duration:se.number().optional()}),O$t=se.discriminatedUnion("type",[S$t,T$t,I$t,P$t,E$t,A$t,k$t,M$t,N$t]),vKn=se.object({action:O$t})});var R$t,_Kn,T3e=C(()=>{gp();tv();R$t=se.object({type:se.literal("exec"),command:se.array(se.string()),env:se.record(se.string(),se.string()).optional(),working_directory:se.string().optional(),timeout_ms:se.number().optional(),user:se.string().optional()}),_Kn=se.discriminatedUnion("type",[R$t])});var PKn,I3e=C(()=>{gp();tv();PKn=se.object({commands:se.array(se.string()).describe("Array of shell commands to execute"),timeout_ms:se.number().optional().describe("Optional timeout in milliseconds for the commands"),max_output_length:se.number().optional().describe("Optional maximum number of characters to return from each command")})});var L$t,D$t,$$t,MKn,P3e=C(()=>{gp();tv();L$t=se.object({type:se.literal("create_file"),path:se.string(),diff:se.string()}),D$t=se.object({type:se.literal("update_file"),path:se.string(),diff:se.string()}),$$t=se.object({type:se.literal("delete_file"),path:se.string()}),MKn=se.discriminatedUnion("type",[L$t,D$t,$$t])});var E3e=C(()=>{Xhe();v3e();x3e();b3e();C3e();_3e();S3e();T3e();I3e();P3e()});var A3e=C(()=>{jm();gp();aI()});var k3e=C(()=>{NN()});var M3e=C(()=>{NN();Rq()});var Yg=C(()=>{wC();vC();xC();HU();NN();kq();Whe();Rq();Dq();qhe();Ghe();p3e();Yhe();m3e();Zhe();h3e();Xhe();E3e();A3e();k3e();M3e();Gm()});var $q,N3e=C(()=>{dU();fU();Jo();$q=class extends Qb{constructor(n){let r={maxConcurrency:2,...n};super(r);this.model="jina-clip-v2";this.batchSize=24;this.baseUrl="https://api.jina.ai/v1/embeddings";this.stripNewLines=!0;this.dimensions=1024;this.normalized=!0;let o=r?.apiKey||In("JINA_API_KEY")||In("JINA_AUTH_TOKEN");if(!o)throw new Error("Jina API key not found");this.apiKey=o,this.model=r?.model??r?.modelName??this.model,this.baseUrl=r?.baseUrl??this.baseUrl,this.dimensions=r?.dimensions??this.dimensions,this.batchSize=r?.batchSize??this.batchSize,this.stripNewLines=r?.stripNewLines??this.stripNewLines,this.normalized=r?.normalized??this.normalized}async embedDocuments(n){let r=xI(this.doStripNewLines(n),this.batchSize),o=r.map(a=>{let l=this.getParams(a);return this.embeddingWithRetry(l)}),i=await Promise.all(o),s=[];for(let a=0;atypeof r=="string"?r.replace(/\n/g," "):r.text?{text:r.text.replace(/\n/g," ")}:r):n}getParams(n,r){return{model:this.model,input:n,dimensions:this.dimensions,task:r?"retrieval.query":"retrieval.passage",normalized:this.normalized}}async embeddingWithRetry(n){let o=await(await fetch(this.baseUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(n)})).json();if("detail"in o&&o.detail)throw new Error(`${o.detail}`);return o.data.map(({embedding:i})=>i)}}});var r0,O3e=C(()=>{qe();Yg();r0=class extends rv{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 n={model:this.customConfig.modelName,input:e,encoding_format:"float"},r=this.customConfig.configuration,i=`${r?.baseURL||"https://api.openai.com/v1"}/embeddings`,s=this.customConfig.apiKey,l=await(r?.fetch||Qy)(i,{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json",...this.customConfig.headers||{}},body:JSON.stringify(n)});if(!l.ok){let u=await l.text();throw new Error(`Embedding API request failed: ${l.status} ${l.statusText} - ${u}`)}let c=await l.json();if(!c.data||!Array.isArray(c.data))throw new Error("Invalid API response format: missing or invalid data array");return c.data.map(u=>{if(!u.embedding||!Array.isArray(u.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return u.embedding})}}});var Fq,F$t,is,o0=C(()=>{It();Su();Nf();ye();Se();qe();_de();Bde();Yg();Fq=require("obsidian");Zg();N3e();O3e();F$t={"copilot-plus":r0,"copilot-plus-jina":$q,openai:rv,cohereai:rv,google:Cde,"azure openai":Jhe,ollama:Fde,"lm-studio":r0,"3rd party (openai-format)":rv,siliconflow:r0,openrouterai:r0},is=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>q().plusLicenseKey,"copilot-plus-jina":()=>q().plusLicenseKey,openai:()=>q().openAIApiKey,cohereai:()=>q().cohereApiKey,google:()=>q().googleApiKey,"azure openai":()=>q().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key",siliconflow:()=>q().siliconflowApiKey,openrouterai:()=>q().openRouterAiApiKey};this.initialize(),Ho(()=>this.initialize())}initialize(){let e=q().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let n=F$t[e.provider];if(!n)throw console.warn(`Unknown provider: ${e.provider} for model: ${e.name}`),new Error(`Unknown provider: ${e.provider} for model: ${e.name}`);return n}buildModelMap(e){t.modelMap={};let n=t.modelMap;e.forEach(r=>{if(r.enabled){if(!Object.values(um).contains(r.provider)){console.warn(`Unknown provider: ${r.provider} for embedding model: ${r.name}`);return}let o=this.getProviderConstructor(r),i=r.apiKey||this.providerApiKeyMap[r.provider](),s=ln(r);n[s]={hasApiKey:!!i,EmbeddingConstructor:o,vendor:r.provider}}})}static getModelName(e){let n=e;if(n.model)return n.model;if(n.modelName)return n.modelName;throw new Error(`Embeddings instance missing model or modelName properties: ${JSON.stringify(e)}`)}getCustomModel(e){return this.activeEmbeddingModels.filter(n=>{let r=ln(n);return e===r})[0]}async getEmbeddingsAPI(){let n=q().embeddingModelKey;if(!Object.prototype.hasOwnProperty.call(t.modelMap,n))throw new Gn(`No embedding model found for: ${n}`);let r=this.getCustomModel(n);if(r.plusExclusive&&!q().isPlusUser)throw new Fq.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Gn("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await di.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new Fq.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Gn("Believer-only model selected but user is not on Believer plan")}let o=t.modelMap[n];if(!o.hasApiKey)throw new Gn(`API key is not provided for the embedding model: ${n}`);let i=await this.getEmbeddingConfig(r);try{return t.embeddingModel=new o.EmbeddingConstructor(i),t.embeddingModel}catch(s){let a=s instanceof Error?s.message:String(s);throw new Gn(`Error creating embedding model: ${n}. ${a}`)}}async getEmbeddingConfig(e){let n=q(),r=e.name,o={maxRetries:3,maxConcurrency:3},s={"copilot-plus":{modelName:r,apiKey:await pn(n.plusLicenseKey),timeout:1e4,batchSize:q().embeddingBatchSize,configuration:{baseURL:jy,fetch:e.enableCors?fo:void 0}},"copilot-plus-jina":{model:r,apiKey:await pn(n.plusLicenseKey),timeout:1e4,batchSize:q().embeddingBatchSize,dimensions:e.dimensions,baseUrl:jy+"/embeddings",configuration:{fetch:e.enableCors?fo:void 0}},openai:{modelName:r,apiKey:await pn(e.apiKey||n.openAIApiKey),timeout:1e4,batchSize:q().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?fo:void 0}},cohereai:{modelName:r,apiKey:await pn(e.apiKey||n.cohereApiKey),timeout:1e4,batchSize:q().embeddingBatchSize,configuration:{baseURL:e.baseUrl||Cu.cohereai.host,fetch:e.enableCors?fo:void 0}},google:{modelName:r,apiKey:await pn(n.googleApiKey)},"azure openai":{modelName:r,azureOpenAIApiKey:await pn(e.apiKey||n.azureOpenAIApiKey),azureOpenAIApiInstanceName:e.azureOpenAIApiInstanceName||n.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:e.azureOpenAIApiEmbeddingDeploymentName||n.azureOpenAIApiEmbeddingDeploymentName,azureOpenAIApiVersion:e.azureOpenAIApiVersion||n.azureOpenAIApiVersion},ollama:{baseUrl:e.baseUrl||"http://localhost:11434",model:r,truncate:!0,headers:{Authorization:`Bearer ${await pn(e.apiKey||"default-key")}`}},"lm-studio":{modelName:r,openAIApiKey:await pn(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?fo:void 0}},"3rd party (openai-format)":{modelName:r,openAIApiKey:await pn(e.apiKey||""),batchSize:q().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?fo:void 0,dangerouslyAllowBrowser:!0}},siliconflow:{modelName:r,apiKey:await pn(e.apiKey||n.siliconflowApiKey),batchSize:q().embeddingBatchSize,configuration:{baseURL:e.baseUrl||Cu.siliconflow.host,fetch:e.enableCors?fo:void 0}},openrouterai:{modelName:r,apiKey:await pn(e.apiKey||n.openRouterAiApiKey),batchSize:q().embeddingBatchSize,configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?fo:void 0}}}[e.provider]||{};return{...o,...s}}async ping(e){let n=async r=>{let o={...e,enableCors:r},i=await this.getEmbeddingConfig(o);await new(this.getProviderConstructor(o))(i).embedQuery("test")};try{return await n(!1),!0}catch(r){k("First ping attempt failed, trying with CORS...");try{return await n(!0),new Fq.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: `+Xt(r)+` with CORS Error: `+Xt(o);throw new Error(i)}}}}});function L3e(t){return t.replace(/\\/g,"/").replace(/\/+$/,"")}function Jm(t){return(t.miyoServerUrl||"").trim()}function Fa(t){return!t.enableMiyo||!Qhe()?!1:!R3e.Platform.isMobile||!!Jm(t)}function Jg(t){return t.vault.getName()}function Uq(t,e){let n=L3e(e).replace(/^\/+/,""),r=Jg(t);return r?`${r}/${n}`:n}function i0(t,e){let n=L3e(e),r=Jg(t);if(!r)return n;let o=`${r}/`;return n.startsWith(o)?n.slice(o.length):n}var R3e,yp=C(()=>{ns();R3e=require("obsidian")});var D3e,Bq,$3e=C(()=>{ye();Se();qe();D3e=require("obsidian"),Bq=class t{constructor(){this.cachedBaseUrl=null}static getInstance(){return t.instance||(t.instance=new t),t.instance}async resolveBaseUrl(e={}){let n=(e.overrideUrl||"").trim();if(n.length>0)return this.normalizeBaseUrl(n);if(this.cachedBaseUrl&&!e.forceRefresh)return this.cachedBaseUrl;if(!D3e.Platform.isDesktopApp)return null;let r=await this.readServiceConfig();if(r==="missing"){let i=this.getDefaultBaseUrl();return this.cachedBaseUrl=null,q().debug&&k(`Miyo service discovery file missing; using fallback ${i}`),i}if(!r)return this.cachedBaseUrl=null,null;let o=this.normalizeBaseUrl(`http://${r.host}:${r.port}`);return this.cachedBaseUrl=o,o}normalizeBaseUrl(e){return e.trim().replace(/\/+$/,"")}getDefaultBaseUrl(){return this.normalizeBaseUrl("http://127.0.0.1:8742")}getServiceFilePaths(){let e=this.getNodeRequire();if(!e)return[];let n=e("os"),r=e("process"),o=e("path"),i=n.homedir(),s=n.platform(),a=r.env||{};if(s==="win32"){let l=(a.LOCALAPPDATA||"").trim(),c=(a.APPDATA||"").trim();return[l,o.join(i,"AppData","Local"),c,o.join(i,"AppData","Roaming")].filter((d,f,p)=>d.length>0&&p.indexOf(d)===f).map(d=>o.join(d,"Miyo","service.json"))}return s==="linux"?[o.join(i,".config","Miyo","service.json")]:s==="darwin"?[o.join(i,"Library","Application Support","Miyo","service.json")]:(ee(`Miyo service discovery unsupported platform: ${s}`),[])}async readServiceConfig(){let e=this.getServiceFilePaths();if(e.length===0)return null;let n=this.getNodeRequire();if(!n)return null;let r=n("fs"),o=!1;for(let i of e)try{let s=await r.promises.readFile(i,"utf8"),a=JSON.parse(s);return!a.host||typeof a.host!="string"?(ee("Miyo service discovery missing host"),null):typeof a.port!="number"||Number.isNaN(a.port)?(ee("Miyo service discovery missing port"),null):(q().debug&&k(`Miyo service discovery resolved host=${a.host} port=${a.port}`),a)}catch(s){if(this.isMissingFileError(s)){o=!0;continue}return q().debug&&ee(`Miyo service discovery failed: ${Xt(s)}`),null}return o?"missing":null}isMissingFileError(e){return e?.code==="ENOENT"}getNodeRequire(){let e=window?.require;return typeof e=="function"?e:null}}});var F3e,wp,RN=C(()=>{Su();ye();$3e();Se();qe();F3e=require("obsidian"),wp=class{constructor(){this.discovery=Bq.getInstance()}async resolveBaseUrl(e){let n=await this.discovery.resolveBaseUrl({overrideUrl:e});if(!n)throw new Error("Miyo base URL not available");return n}async isBackendAvailable(e){try{let n=await this.resolveBaseUrl(e),r=await this.requestJson(n,"/v0/health",{method:"GET"});return r?.status!=="ok"?(ee(`Miyo health check failed: status="${r?.status??"unknown"}"`),!1):!0}catch(n){return ee(`Miyo backend availability check failed: ${Xt(n)}`),!1}}async getFolder(e,n){return this.requestJson(e,"/v0/folder",{method:"GET",query:{path:n}})}async scanFolder(e,n,r=!1){return this.requestJson(e,"/v0/scan",{method:"POST",body:{path:n,force:r}})}async listFolderFiles(e,n){return this.requestJson(e,"/v0/folder/files",{method:"GET",query:{folder_name:n.folderName,title:n.title,file_path:n.filePath,mtime_after:n.mtimeAfter,mtime_before:n.mtimeBefore,offset:n.offset,limit:n.limit,order_by:n.orderBy}})}async getDocumentsByPath(e,n,r){return this.requestJson(e,"/v0/folder/documents",{method:"GET",query:{path:r,folder_name:n}})}async search(e,n,r,o,i){let s={query:r,...n?{folder_name:n}:{},limit:o,...i&&i.length>0?{filters:i}:{}};return q().debug&&k("Miyo search request:",{baseUrl:e,payload:s}),this.requestJson(e,"/v0/search",{method:"POST",body:s})}async searchRelated(e,n,r){let o={file_path:n,...r?.folderName?{folder_name:r.folderName}:{},...typeof r?.limit=="number"?{limit:r.limit}:{},...r?.filters&&r.filters.length>0?{filters:r.filters}:{}};return this.requestJson(e,"/v0/search/related",{method:"POST",body:o})}async parseDoc(e,n,r){return this.requestJson(e,"/v0/parse-doc",{method:"POST",body:{folder_name:n,path:r}})}async buildHeaders(){let e=q(),n={},r=e.plusLicenseKey?await pn(e.plusLicenseKey):"";return r&&(n.Authorization=`Bearer ${r}`),n}async requestJson(e,n,r){let o=new URL(n,e);r.query&&Object.entries(r.query).forEach(([c,u])=>{u!=null&&o.searchParams.set(c,String(u))});let i=r.body?JSON.stringify(r.body):void 0,s=await this.buildHeaders();k("Miyo request:",{method:r.method,url:o.toString(),hasBody:!!i,hasAuthorizationHeader:!!s.Authorization,...q().debug&&r.method==="POST"?{postBody:r.body}:{}});let a=await(0,F3e.requestUrl)({url:o.toString(),method:r.method,headers:s,contentType:i?"application/json":void 0,body:i,throw:!1});if(a.status>=400){let u=this.parseResponseJson(a.json,a.text)?.detail||a.text||"";throw ee(`Miyo request failed (${a.status}): ${u}`),new Error(u?`Miyo request failed with status ${a.status}: ${u}`:`Miyo request failed with status ${a.status}`)}let l=this.parseResponseJson(a.json,a.text);return q().debug&&k(`Miyo request ${r.method} ${o.toString()} succeeded`),l}parseResponseJson(e,n){if(typeof e=="string")try{return JSON.parse(e)}catch(r){return z(`Failed to parse Miyo JSON response: ${Xt(r)}`),{}}if(e!=null)return e;if(n)try{return JSON.parse(n)}catch(r){return z(`Failed to parse Miyo text response: ${Xt(r)}`),{}}return{}}}});var U3e,zq,B3e=C(()=>{U3e=require("obsidian");ye();RN();yp();Se();zq=class{constructor(e){this.app=e;this.client=new wp}async initialize(e){try{let n=await this.getBaseUrl();await this.client.getFolder(n,this.getFolderName())}catch(n){ee(`Miyo backend initialization failed: ${n}`),new U3e.Notice("Failed to initialize Miyo backend. Check Miyo service discovery or folder setup.")}}async clearIndex(e){ee("Miyo clearIndex requested from Copilot, but folder lifecycle is managed in Miyo.")}requiresEmbeddings(){return!1}async upsert(e){k(`Skipping direct Miyo upsert for ${e.path}; Miyo manages indexing itself.`)}async upsertBatch(e){return e.length>0&&k(`Skipping direct Miyo batch upsert for ${e.length} documents.`),0}async removeByPath(e){k(`Skipping direct Miyo delete for ${e}; Miyo manages file lifecycle itself.`)}async getIndexedFiles(){let e=await this.getAllIndexedFiles();return Array.from(new Set(e.map(n=>this.toVaultPath(n.path)))).sort()}async getLatestFileMtime(){return(await this.getAllIndexedFiles()).reduce((n,r)=>Math.max(n,r.mtime??0),0)}async isIndexEmpty(){return(await this.getAllIndexedFiles()).length===0}async hasIndex(e){return(await this.getDocumentsByPath(e)).length>0}async getDocumentsByPath(e){let n=await this.getBaseUrl(),r=Uq(this.app,e);return((await this.client.getDocumentsByPath(n,this.getFolderName(),r)).documents??[]).map(s=>this.fromMiyoDocument(e,s))}async checkAndHandleEmbeddingModelChange(e){return!1}async save(){}async checkIndexIntegrity(){}async garbageCollect(){return k("Skipping Miyo garbage collection; folder lifecycle is managed in Miyo."),0}markFileMissingEmbeddings(e){}clearFilesMissingEmbeddings(){}getFilesMissingEmbeddings(){return[]}markUnsavedChanges(){}onunload(){}isRemoteBackend(){return!0}async requestIndexRefresh(e=!1){let n=await this.getBaseUrl();await this.client.scanFolder(n,this.getFolderName(),e)}async getBaseUrl(){let e=Jm(q());return this.client.resolveBaseUrl(e)}getFolderName(){return Jg(this.app)}async getAllIndexedFiles(){let e=await this.getBaseUrl(),n=200,r=0,o=null,i=[];do{let s=await this.client.listFolderFiles(e,{folderName:this.getFolderName(),offset:r,limit:n}),a=s.files??[];if(i.push(...a),o===null&&(o=s.total??a.length),r+=a.length,a.length===0)break}while(r{z3e={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"},j3e={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},qU=Object.keys(z3e)});function So(t,e){if(e.length\d+)\$)?(?-?\d*\.?\d*)(?[dfs])/g,function(...n){let r=n[n.length-1],{width:o,type:i,position:s}=r,a=s?e[Number.parseInt(s)-1]:e.shift(),l=o===""?0:Number.parseInt(o);switch(i){case"d":return a.toString().padStart(l,"0");case"f":{let c=a,[u,d]=o.split(".").map(f=>Number.parseFloat(f));return typeof d=="number"&&d>=0&&(c=c.toFixed(d)),typeof u=="number"&&u>=0?c.toString().padStart(l,"0"):c.toString()}case"s":return l<0?a.toString().padEnd(-l," "):a.toString().padStart(l," ");default:return a}})}function z$t(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function j$t(){return typeof process<"u"&&process.release&&process.release.name==="node"}function q3e(){return BigInt(Math.floor(performance.now()*1e6))}function s0(t){return typeof t=="number"&&(t=BigInt(t)),t{let r=e.get(n);return r!==void 0&&e.set(n,0),r===t.length})}function Vq(t,e){let n={},r=e.length;for(let o=0;o({...n,document:{...n.document,...e.reduce((r,o)=>{let i=o.split("."),s=i.pop(),a=r;for(let l of i)a[l]=a[l]??{},a=a[l];return a[s]=null,r},n.document)}}))}function Ss(t){return t?.constructor?.name==="AsyncFunction"}var U$t,B$t,W3e,H3e,K3e,ege,V$t,ss=C(()=>{Ua();U$t=Date.now().toString().slice(5),B$t=0,W3e=BigInt(1e3),H3e=BigInt(1e6),K3e=BigInt(1e9),ege=65535;V$t={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function qt(t,...e){let n=new Error(G3e(H$t[t]??`Unsupported Orama Error code: ${t}`,...e));return n.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(n),n}var W$t,H$t,Ua=C(()=>{jq();ss();W$t=qU.join(` - `),H$t={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: - ${W$t}`,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 Z3e(t){return{raw:Number(t),formatted:s0(t)}}function J3e(t){if(t.id){if(typeof t.id!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return GU()}function nge(t,e){for(let[n,r]of Object.entries(e)){let o=t[n];if(!(typeof o>"u")&&!(r==="geopoint"&&typeof o=="object"&&typeof o.lon=="number"&&typeof o.lat=="number")&&!(r==="enum"&&(typeof o=="string"||typeof o=="number"))){if(r==="enum[]"&&Array.isArray(o)){let i=o.length;for(let s=0;s{Ua();ss();ss();K$t={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},q$t={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function Q3e(){return{idToInternalId:new Map,internalIdToId:[],save:G$t,load:Y$t}}function G$t(t){return{internalIdToId:t.internalIdToId}}function Y$t(t,e){let{internalIdToId:n}=e;t.internalDocumentIDStore.idToInternalId.clear(),t.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let o=0;ot.internalIdToId.length?mo(t,e.toString()):e}function vp(t,e){if(t.internalIdToId.length{});function J$t(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function X$t(t,e){let n=mo(t.sharedInternalDocumentStore,e);return t.docs[n]}function Q$t(t,e){let n=e.length,r=Array.from({length:n});for(let o=0;o"u"?!1:(delete t.docs[n],t.count--,!0)}function rFt(t){return t.count}function oFt(t,e){let n=e;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:t}}function iFt(t){return{docs:t.docs,count:t.count}}function eKe(){return{create:J$t,get:X$t,getMultiple:Q$t,getAll:eFt,store:tFt,remove:nFt,count:rFt,load:oFt,save:iFt}}var ige=C(()=>{xp()});function nKe(t,e){let n=[],r=t.plugins?.length;if(!r)return n;for(let o=0;o{Ua();tKe=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function Qm(t,e,n,r){if(t.some(Ss))return(async()=>{for(let i of t)await i(e,n,r)})();for(let i of t)i(e,n,r)}function a0(t,e,n){if(t.some(Ss))return(async()=>{for(let o of t)await o(e,n)})();for(let o of t)o(e,n)}function UN(t,e,n,r,o){if(t.some(Ss))return(async()=>{for(let s of t)await s(e,n,r,o)})();for(let s of t)s(e,n,r,o)}function BN(t,e,n,r){if(t.some(Ss))return(async()=>{for(let i of t)await i(e,n,r)})();for(let i of t)i(e,n,r)}function iKe(t,e){if(t.some(Ss))return(async()=>{for(let r of t)await r(e)})();for(let r of t)r(e)}var oKe,sge,CC=C(()=>{ss();oKe=["tokenizer","index","documentsStore","sorter"],sge=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function age(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(bp(t.l),bp(t.r))+1,e.h=Math.max(bp(e.l),bp(e.r))+1,e}function lge(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(bp(t.l),bp(t.r))+1,e.h=Math.max(bp(e.l),bp(e.r))+1,e}function aKe(t,e,n){let r=[];function o(i){i!==null&&(e=e&&i.k<=n&&So(r,i.v),n>i.k&&o(i.r))}return o(t.root),r}function cge(t,e,n=!1){let r=[];if(t===null)return r;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(n&&i.k>=e&&So(r,i.v),!n&&i.k>e&&So(r,i.v),o.push(i.r),o.push(i.l))}return r}function uge(t,e,n=!1){let r=[];if(t===null)return r;let o=[t.root];for(;o.length>0;){let i=o.pop();i&&(n&&i.k<=e&&So(r,i.v),!n&&i.kt.k)t=t.r;else return t;return null}function cKe(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function uKe(t,e,n,r=500){function o(i,s,a){if(i===null)return sKe++,{k:s,v:a,l:null,r:null,h:0};if(si.k)i.r=o(i.r,s,a);else return i.v.push(...a),i;return sKe%r===0?aFt(i,s):i}t.root=o(t.root,e,n)}function aFt(t,e){t.h=1+Math.max(bp(t.l),bp(t.r));let n=bp(t.l)-bp(t.r);return n>1&&et.r.k?age(t):n>1&&e>t.l.k?(t.l=age(t.l),lge(t)):n<-1&&e{if(n.l===null&&n.r===null)r===null?t.root=null:r.l===n?r.l=null:r.r=null;else if(n.l!=null&&n.r!=null){let i=n.r,s=n;for(;i.l!=null;)s=i,i=i.l;n.k=i.k,s===n?s.r=i.r:s.l=i.r}else{let i=n.l!=null?n.l:n.r;r===null?t.root=i:r.l===n?r.l=i:r.r=i}})()}function fKe(t,e,n){let r=lKe(t.root,n);if(r){if(r.v.length===1){lFt(t,n);return}r.v.splice(r.v.indexOf(e),1)}}var sKe,pKe=C(()=>{ss();sKe=0});function mKe(){return{numberToDocumentId:new Map}}function hKe(t,e,n){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(n),t):(t.numberToDocumentId.set(e,[n]),t)}function gKe(t,e,n){t?.numberToDocumentId.set(n,t?.numberToDocumentId.get(n)?.filter(r=>r!==e)??[]),t?.numberToDocumentId.get(n)?.length===0&&t?.numberToDocumentId.delete(n)}function yKe(t,e){let n=Object.keys(e);if(n.length!==1)throw new Error("Invalid operation");let r=n[0];switch(r){case"eq":{let o=e[r];return t.numberToDocumentId.get(o)??[]}case"in":{let o=e[r],i=[];for(let s of o){let a=t.numberToDocumentId.get(s);a!=null&&So(i,a)}return i}case"nin":{let o=e[r],i=[],s=t.numberToDocumentId.keys();for(let a of s){if(o.includes(a))continue;let l=t.numberToDocumentId.get(a);l!=null&&So(i,l)}return i}}throw new Error("Invalid operation")}function wKe(t,e){let n=Object.keys(e);if(n.length!==1)throw new Error("Invalid operation");let r=n[0];switch(r){case"containsAll":{let i=e[r].map(s=>t.numberToDocumentId.get(s)??[]);return DN(i)}}throw new Error("Invalid operation")}var vKe=C(()=>{ss()});function cFt(t,e,n){if(n<0)return-1;if(t===e)return 0;let r=t.length,o=e.length;if(r===0)return o<=n?o:-1;if(o===0)return r<=n?r:-1;if(t=t.toLowerCase(),e=e.toLowerCase(),e.startsWith(t)||t.startsWith(e))return 0;if(Math.abs(r-o)>n)return-1;let i=[];for(let s=0;s<=r;s++){i[s]=[s];for(let a=1;a<=o;a++)i[s][a]=s===0?a:0}for(let s=1;s<=r;s++){let a=1/0;for(let l=1;l<=o;l++)t[s-1]===e[l-1]?i[s][l]=i[s-1][l-1]:i[s][l]=Math.min(i[s-1][l]+1,i[s][l-1]+1,i[s-1][l-1]+1),a=Math.min(a,i[s][l]);if(a>n)return-1}return i[r][o]<=n?i[r][o]:-1}function dge(t,e,n){let r=cFt(t,e,n);return{distance:r,isBounded:r>=0}}var fge=C(()=>{});function zN(t,e){t.w=e.w+t.s}function Hq(t,e){t.d.push(e)}function uFt(t,e){let n=t.d.indexOf(e);return n===-1?!1:(t.d.splice(n,1),!0)}function mge(t,e,n,r,o){if(t.e){let{w:i,d:s}=t;if(r&&i!==n)return{};if(LN(e,i)==null&&(o?Math.abs(n.length-i.length)<=o&&dge(n,i,o).isBounded&&(e[i]=[]):e[i]=[]),LN(e,i)!=null&&s.length>0){let a=new Set(e[i]),l=s.length;for(let c=0;c0)){let l=new Set(i[s]),c=a.length;for(let u=0;u=e.length)){e[n]in t.c&&ZU(t.c[e[n]],e,n+1,r,o,i),ZU(t,e,n+1,r-1,o,i);for(let s in t.c)ZU(t.c[s],e,n,r-1,o,i);for(let s in t.c)s!==e[n]&&ZU(t.c[s],e,n+1,r-1,o,i)}}}function hge(t,{term:e,exact:n,tolerance:r}){if(r&&!n){let o={};return r=r||0,ZU(t,e,0,r||0,r,o),o}else{let o=e.length;for(let s=0;s{fge();ss();pge=class{constructor(e,n,r){I(this,"k");I(this,"s");I(this,"c",{});I(this,"d",[]);I(this,"e");I(this,"w","");this.k=e,this.s=n,this.e=r}toJSON(){return{w:this.w,s:this.s,c:this.c,d:this.d,e:this.e}}}});function SKe(){return{root:null}}function TKe(t,e,n){let r={point:e,docIDs:n};if(t.root==null){t.root=r;return}let o=t.root,i=0;for(;o!==null;){if(o.point.lon===e.lon&&o.point.lat===e.lat){let a=o.docIDs??[];o.docIDs=Array.from(new Set([...a,...n||[]]));return}if(i%2===0)if(e.lon-1){r.docIDs?.splice(l,1),(r.docIDs==null||r.docIDs.length===0)&&(i!=null?s==="left"?i.left=r.left!==null?r.left:r.right:s==="right"&&(i.right=r.right!==null?r.right:r.left):t.root=r.left!==null?r.left:r.right);return}}let a=o%2;i=r,a===0?e.lon0;){let{node:c,depth:u}=a.pop();if(c===null)continue;let d=s(e,c.point);(r?d<=n:d>n)&&l.push({point:c.point,docIDs:c.docIDs??[]}),c.left!=null&&a.push({node:c.left,depth:u+1}),c.right!=null&&a.push({node:c.right,depth:u+1})}return o&&l.sort((c,u)=>{let d=s(e,c.point),f=s(e,u.point);return o.toLowerCase()==="asc"?d-f:f-d}),l}function EKe(t,e,n=!0,r=null,o=!1){let i=[{node:t,depth:0}],s=[];for(;i.length>0;){let l=i.pop();if(l==null||l.node==null)continue;let{node:c,depth:u}=l,d=u+1;c.left!=null&&i.push({node:c.left,depth:d}),c.right!=null&&i.push({node:c.right,depth:d});let f=fFt(e,c.point);f&&n?s.push({point:c.point,docIDs:c.docIDs??[]}):!f&&!n&&s.push({point:c.point,docIDs:c.docIDs??[]})}let a=dFt(e);if(r){let l=o?kKe:AKe;s.sort((c,u)=>{let d=l(a,c.point),f=l(a,u.point);return r.toLowerCase()==="asc"?d-f:f-d})}return s}function dFt(t){let e=0,n=0,r=0,o=t.length;for(let s=0,a=o-1;so!=d>o&&r<(u-l)*(o-c)/(d-c)+l&&(n=!n)}return n}function AKe(t,e){let n=Math.PI/180,r=t.lat*n,o=e.lat*n,i=(e.lat-t.lat)*n,s=(e.lon-t.lon)*n,a=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(s/2)*Math.sin(s/2);return 6371e3*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}function kKe(t,e){let r=.0033528106647474805,o=(1-r)*6378137,i=Math.PI/180,s=t.lat*i,a=e.lat*i,l=(e.lon-t.lon)*i,c=Math.atan((1-r)*Math.tan(s)),u=Math.atan((1-r)*Math.tan(a)),d=Math.sin(c),f=Math.cos(c),p=Math.sin(u),m=Math.cos(u),h=l,g,y=1e3,w,v,x,b,_;do{let D=Math.sin(h),$=Math.cos(h);x=Math.sqrt(m*D*(m*D)+(f*p-d*m*$)*(f*p-d*m*$)),b=d*p+f*m*$,_=Math.atan2(x,b),w=f*m*D/x,v=1-w*w;let B=b-2*d*p/v,W=r/16*v*(4+r*(4-3*v));g=h,h=l+(1-W)*r*w*(_+W*x*(B+W*b*(-1+2*B*B)))}while(Math.abs(h-g)>1e-12&&--y>0);let T=v*(6378137*6378137-o*o)/(o*o),S=1+T/16384*(4096+T*(-768+T*(320-175*T))),P=T/1024*(256+T*(-128+T*(74-47*T))),A=P*x*(b-2*d*p/v+P/4*(b*(-1+2*x*x)-P/6*_*(-3+4*x*x)*(-3+4*_*_)));return o*S*(_-A)}var MKe=C(()=>{});function Kq(t,e,n=0,r){if(e===0)throw qt("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;hg[1]-h[1]);if(n===1)return a;let l=a.length,c=[];for(let h of o.entries())c.push([h[0],h[1][0],h[1][1]]);let u=c.sort((h,g)=>h[2]>g[2]?-1:h[2]g[1]?-1:h[1]"u"){if(n===0)return[];d=0}let f=u.length,p=new Array(f);for(let h=0;h{Ua()});function yge(t,e){let n=0;for(let r=0;r=r&&i.push([s,u])}return i.sort((s,a)=>a[1]-s[1])}var Gq=C(()=>{});function pFt(t,e,n,r,o){let i=mo(t.sharedInternalDocumentStore,n);t.avgFieldLength[e]=((t.avgFieldLength[e]??0)*(o-1)+r.length)/o,t.fieldLengths[e][i]=r.length,t.frequencies[e][i]={}}function mFt(t,e,n,r,o){let i=0;for(let l of r)l===o&&i++;let s=mo(t.sharedInternalDocumentStore,n),a=i/r.length;t.frequencies[e][s][o]=a,o in t.tokenOccurrences[e]||(t.tokenOccurrences[e][o]=0),t.tokenOccurrences[e][o]=(t.tokenOccurrences[e][o]??0)+1}function hFt(t,e,n,r){let o=mo(t.sharedInternalDocumentStore,n);r>1?t.avgFieldLength[e]=(t.avgFieldLength[e]*r-t.fieldLengths[e][o])/(r-1):t.avgFieldLength[e]=void 0,t.fieldLengths[e][o]=void 0,t.frequencies[e][o]=void 0}function gFt(t,e,n){t.tokenOccurrences[e][n]--}function yFt(t,e,n,r,o){let i=Array.from(o),s=e.avgFieldLength[n],a=e.fieldLengths[n],l=e.tokenOccurrences[n],c=e.frequencies[n],u=typeof l[r]=="number"?l[r]??0:0,d=[],f=i.length;for(let p=0;p{let c=mo(e.sharedInternalDocumentStore,r),{type:u,node:d}=e.indexes[n];switch(u){case"Bool":{d[l?"true":"false"].push(c);break}case"AVL":{let f=a?.avlRebalanceThreshold??1;uKe(d,l,[c],f);break}case"Radix":{let f=i.tokenize(l,o,n);t.insertDocumentScoreParameters(e,n,c,f,s);for(let p of f)t.insertTokenScoreParameters(e,n,c,f,p),bKe(d,p,c);break}case"Flat":{hKe(d,l,c);break}case"BKD":{TKe(d,l,[c]);break}}}}function vFt(t,e,n,r,o,i,s,a,l,c){if(ov(i))return xFt(e,n,o,r);let u=wFt(t,e,n,r,s,a,l,c);if(!FN(i))return u(o);let d=o,f=d.length;for(let p=0;p({[s]:[],...i}),{});for(let i of r){let s=n[i];if(typeof e.indexes[i]>"u")throw qt("UNKNOWN_FILTER_PROPERTY",i);let{node:a,type:l,isArray:c}=e.indexes[i];if(l==="Bool"){let f=a[s.toString()];So(o[i],f);continue}if(l==="BKD"){let d;if("radius"in s)d="radius";else if("polygon"in s)d="polygon";else throw new Error(`Invalid operation ${s}`);if(d==="radius"){let{value:f,coordinates:p,unit:m="m",inside:h=!0,highPrecision:g=!1}=s[d],y=tge(f,m),w=PKe(a.root,p,y,h,void 0,g);So(o[i],w.flatMap(({docIDs:v})=>v))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=s[d],h=EKe(a.root,f,p,void 0,m);So(o[i],h.flatMap(({docIDs:g})=>g))}continue}if(l==="Radix"&&(typeof s=="string"||Array.isArray(s))){for(let d of[s].flat()){let f=t.tokenizer.tokenize(d,t.language,i);for(let p of f){let m=hge(a,{term:p,exact:!0});So(o[i],Object.values(m).flat())}}continue}let u=Object.keys(s);if(u.length>1)throw qt("INVALID_FILTER_OPERATION",u.length);if(l==="Flat"){let d=c?wKe:yKe;So(o[i],d(a,s));continue}if(l==="AVL"){let d=u[0],f=s[d],p=[];switch(d){case"gt":{p=cge(a,f,!1);break}case"gte":{p=cge(a,f,!0);break}case"lt":{p=uge(a,f,!1);break}case"lte":{p=uge(a,f,!0);break}case"eq":{p=dKe(a,f)??[];break}case"between":{let[m,h]=f;p=aKe(a,m,h);break}}So(o[i],p)}}return DN(Object.values(o))}function SFt(t){return t.searchableProperties}function TFt(t){return t.searchablePropertiesWithTypes}function RKe(t){let e=l0(t.e,t.s,t.k);e.d=t.d,e.w=t.w;for(let n of Object.keys(t.c))e.c[n]=RKe(t.c[n]);return e}function IFt(t){return{numberToDocumentId:new Map(t)}}function PFt(t){return Array.from(t.numberToDocumentId.entries())}function EFt(t,e){let{indexes:n,vectorIndexes:r,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:a,avgFieldLength:l,fieldLengths:c}=e,u={},d={};for(let f of Object.keys(n)){let{node:p,type:m,isArray:h}=n[f];switch(m){case"Radix":u[f]={type:"Radix",node:RKe(p),isArray:h};break;case"Flat":u[f]={type:"Flat",node:IFt(p),isArray:h};break;default:u[f]=n[f]}}for(let f of Object.keys(r)){let p=r[f].vectors;for(let m in p)p[m]=[p[m][0],new Float32Array(p[m][1])];d[f]={size:r[f].size,vectors:p}}return{sharedInternalDocumentStore:t,indexes:u,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:i,frequencies:s,tokenOccurrences:a,avgFieldLength:l,fieldLengths:c}}function AFt(t){let{indexes:e,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:a,fieldLengths:l}=t,c={};for(let d of Object.keys(n)){let f=n[d].vectors;for(let p in f)f[p]=[f[p][0],Array.from(f[p][1])];c[d]={size:n[d].size,vectors:f}}let u={};for(let d of Object.keys(e)){let{type:f,node:p,isArray:m}=e[d];if(f!=="Flat"){u[d]=e[d];continue}u[d]={type:"Flat",node:PFt(p),isArray:m}}return{indexes:u,vectorIndexes:c,searchableProperties:r,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:s,avgFieldLength:a,fieldLengths:l}}function LKe(){return{create:OKe,insert:vFt,remove:bFt,insertDocumentScoreParameters:pFt,insertTokenScoreParameters:mFt,removeDocumentScoreParameters:hFt,removeTokenScoreParameters:gFt,calculateResultScores:yFt,search:CFt,searchByWhereClause:_Ft,getSearchableProperties:SFt,getSearchablePropertiesWithTypes:TFt,load:EFt,save:AFt}}var wge=C(()=>{Ua();pKe();vKe();_Ke();MKe();ss();JU();Gq();YU();xp()});function DKe(t,e,n,r,o){let i={language:t.tokenizer.language,sharedInternalDocumentStore:e,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[s,a]of Object.entries(n)){let l=`${o}${o?".":""}${s}`;if(!r.includes(l)){if(typeof a=="object"&&!Array.isArray(a)){let c=DKe(t,e,a,r,l);So(i.sortableProperties,c.sortableProperties),i.sorts={...i.sorts,...c.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...c.sortablePropertiesWithTypes};continue}if(!ov(a))switch(a){case"boolean":case"number":case"string":i.sortableProperties.push(l),i.sortablePropertiesWithTypes[l]=a,i.sorts[l]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:a};break;case"geopoint":case"enum":continue;case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw qt("INVALID_SORT_SCHEMA_TYPE",Array.isArray(a)?"array":a,l)}}}return i}function MFt(t,e,n,r){return r?.enabled!==!1?DKe(t,e,n,(r||{}).unsortableProperties||[],""):{disabled:!0}}function NFt(t,e,n,r){if(!t.enabled)return;t.isSorted=!1;let o=mo(t.sharedInternalDocumentStore,n),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&vge(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,r])}function $Ke(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let n of e)DFt(t,n);t.isSorted=!0}function OFt(t,e,n){return e[1].localeCompare(n[1],V3e(t))}function RFt(t,e){return t[1]-e[1]}function LFt(t,e){return e[1]?-1:1}function DFt(t,e){let n=t.sorts[e],r;switch(n.type){case"string":r=OFt.bind(null,t.language);break;case"number":r=RFt.bind(null);break;case"boolean":r=LFt.bind(null);break}n.orderedDocs.sort(r);let o=n.orderedDocs.length;for(let i=0;i!n.orderedDocsToRemove.has(r[0])),n.orderedDocsToRemove.clear())}function FFt(t,e,n){if(!t.enabled)return;let r=t.sorts[e],o=mo(t.sharedInternalDocumentStore,n);r.docs.get(o)&&(r.docs.delete(o),r.orderedDocsToRemove.set(o,!0))}function UFt(t,e,n){if(!t.enabled)throw qt("SORT_DISABLED");let r=n.property,o=n.order==="DESC",i=t.sorts[r];if(!i)throw qt("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",r,t.sortableProperties.join(", "));return vge(t,r),$Ke(t),e.sort((s,a)=>{let l=i.docs.get(mo(t.sharedInternalDocumentStore,s[0])),c=i.docs.get(mo(t.sharedInternalDocumentStore,a[0])),u=typeof l<"u",d=typeof c<"u";return!u&&!d?0:u?d?o?c-l:l-c:-1:1}),e}function BFt(t){return t.enabled?t.sortableProperties:[]}function zFt(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function jFt(t,e){let n=e;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((o,i)=>{let{docs:s,orderedDocs:a,type:l}=n.sorts[i];return o[i]={docs:new Map(Object.entries(s).map(([c,u])=>[+c,u])),orderedDocsToRemove:new Map,orderedDocs:a,type:l},o},{});return{sharedInternalDocumentStore:t,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function VFt(t){if(!t.enabled)return{enabled:!1};$Ft(t),$Ke(t);let e=Object.keys(t.sorts).reduce((n,r)=>{let{docs:o,orderedDocs:i,type:s}=t.sorts[r];return n[r]={docs:Object.fromEntries(o.entries()),orderedDocs:i,type:s},n},{});return{language:t.language,sortableProperties:t.sortableProperties,sortablePropertiesWithTypes:t.sortablePropertiesWithTypes,sorts:e,enabled:t.enabled,isSorted:t.isSorted}}function FKe(){return{create:MFt,insert:NFt,remove:FFt,save:VFt,load:jFt,sortBy:UFt,getSortableProperties:BFt,getSortablePropertiesWithTypes:zFt}}var xge=C(()=>{Ua();YU();xp();ss();jq()});function KFt(t){return t<192||t>383?t:HFt[t-192]||t}function UKe(t){let e=[];for(let n=0;n{HFt=[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 jKe(t){let e,n,r,o,i,s;if(t.length<3)return t;let a=t.substring(0,1);if(a=="y"&&(t=a.toUpperCase()+t.substring(1)),r=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,r.test(t)?t=t.replace(r,"$1$2"):o.test(t)&&(t=t.replace(o,"$1$2")),r=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,r.test(t)){let l=r.exec(t);r=new RegExp(bge),r.test(l[1])&&(r=/.$/,t=t.replace(r,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(zKe),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),s=new RegExp("^"+Xg+Zq+"[^aeiouwxy]$"),o.test(t)?t=t+"e":i.test(t)?(r=/.$/,t=t.replace(r,"")):s.test(t)&&(t=t+"e")));if(r=/^(.+?)y$/,r.test(t)&&(e=r.exec(t)?.[1],r=new RegExp(zKe),e&&r.test(e)&&(t=e+"i")),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(t)){let l=r.exec(t);e=l?.[1],n=l?.[2],r=new RegExp(bge),e&&r.test(e)&&(t=e+qFt[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(t)){let l=r.exec(t);e=l?.[1],n=l?.[2],r=new RegExp(bge),e&&r.test(e)&&(t=e+GFt[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,o=/^(.+?)(s|t)(ion)$/,r.test(t))e=r.exec(t)?.[1],r=new RegExp(Yq),e&&r.test(e)&&(t=e);else if(o.test(t)){let l=o.exec(t);e=l?.[1]??""+l?.[2]??"",o=new RegExp(Yq),o.test(e)&&(t=e)}return r=/^(.+?)e$/,r.test(t)&&(e=r.exec(t)?.[1],r=new RegExp(Yq),o=new RegExp(ZFt),i=new RegExp("^"+Xg+Zq+"[^aeiouwxy]$"),e&&(r.test(e)||o.test(e)&&!i.test(e))&&(t=e)),r=/ll$/,o=new RegExp(Yq),r.test(t)&&o.test(t)&&(r=/.$/,t=t.replace(r,"")),a=="y"&&(t=a.toLowerCase()+t.substring(1)),t}var qFt,GFt,YFt,Zq,Xg,XU,bge,ZFt,Yq,zKe,VKe=C(()=>{qFt={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"},GFt={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},YFt="[^aeiou]",Zq="[aeiouy]",Xg=YFt+"[^aeiouy]*",XU=Zq+"[aeiou]*",bge="^("+Xg+")?"+XU+Xg,ZFt="^("+Xg+")?"+XU+Xg+"("+XU+")?$",Yq="^("+Xg+")?"+XU+Xg+XU+Xg,zKe="^("+Xg+")?"+Zq});function Cge(t,e){let n=`${this.language}:${t}:${e}`;return this.normalizationCache.has(n)?this.normalizationCache.get(n):this.stopWords?.includes(e)?(this.normalizationCache.set(n,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(t)&&(e=this.stemmer(e)),e=UKe(e),this.normalizationCache.set(n,e),e)}function JFt(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function WKe(t,e,n){if(e&&e!==this.language)throw qt("LANGUAGE_NOT_SUPPORTED",e);if(typeof t!="string")return[t];let r;if(n&&this.tokenizeSkipProperties.has(n))r=[this.normalizeToken.bind(this,n??"")(t)];else{let i=j3e[this.language];r=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,n??"")).filter(Boolean)}let o=JFt(r);return this.allowDuplicates?o:Array.from(new Set(o))}function _ge(t={}){if(!t.language)t.language="english";else if(!qU.includes(t.language))throw qt("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw qt("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=jKe;else throw qt("MISSING_STEMMER",t.language);let n;if(t.stopWords!==!1){if(n=[],Array.isArray(t.stopWords))n=t.stopWords;else if(typeof t.stopWords=="function")n=t.stopWords(n);else if(t.stopWords)throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(n))throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of n)if(typeof o!="string")throw qt("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let r={tokenize:WKe,language:t.language,stemmer:e,stemmerSkipProperties:new Set(t.stemmerSkipProperties?[t.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(t.tokenizeSkipProperties?[t.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!t.allowDuplicates,normalizeToken:Cge,normalizationCache:new Map};return r.tokenize=WKe.bind(r),r.normalizeToken=Cge,r}var Jq=C(()=>{Ua();BKe();jq();VKe()});function QFt(t){let e={formatElapsedTime:Z3e,getDocumentIndexId:J3e,getDocumentProperties:Vq,validateSchema:nge};for(let n of sge){let r=n;if(t[r]){if(typeof t[r]!="function")throw qt("COMPONENT_MUST_BE_FUNCTION",r)}else t[r]=e[r]}for(let n of Object.keys(t))if(!oKe.includes(n)&&!sge.includes(n))throw qt("UNSUPPORTED_COMPONENT",n)}function jN({schema:t,sort:e,language:n,components:r,id:o,plugins:i}){r||(r={}),o||(o=GU());let s=r.tokenizer,a=r.index,l=r.documentsStore,c=r.sorter;if(s?s.tokenize?s=s:s=_ge(s):s=_ge({language:n??"english"}),r.tokenizer&&n)throw qt("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let u=Q3e();a||(a=LKe()),c||(c=FKe()),l||(l=eKe()),QFt(r);let{getDocumentProperties:d,getDocumentIndexId:f,validateSchema:p,formatElapsedTime:m}=r,h={data:{},caches:{},schema:t,tokenizer:s,index:a,sorter:c,documentsStore:l,internalDocumentIDStore:u,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:e2t()};h.data={index:h.index.create(h,u,t),docs:h.documentsStore.create(h,u),sorting:h.sorter.create(h,u,t,e)};for(let y of tKe)h[y]=(h[y]??[]).concat(nKe(h,y));let g=h.afterCreate;return g&&iKe(g,h),h}function e2t(){return"{{VERSION}}"}var HKe=C(()=>{YU();ige();rKe();CC();wge();xp();xge();Jq();Ua();ss()});var KKe=C(()=>{});var Sge=C(()=>{YU();ige();wge();Jq();xge();xp()});var Xq,Tge,Ige,Pge=C(()=>{Xq="fulltext",Tge="hybrid",Ige="vector"});var _C,SC,Ege=C(()=>{Pge();_C=Symbol("orama.insertions"),SC=Symbol("orama.removals")});function Age(t){typeof t[_C]!="number"&&(queueMicrotask(()=>{t[_C]=void 0}),t[_C]=0),t[_C]>1e3?(qKe("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[_C]=-1):t[_C]>=0&&t[_C]++}function kge(t){typeof t[SC]!="number"&&(queueMicrotask(()=>{t[SC]=void 0}),t[SC]=0),t[SC]>1e3?(qKe("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[SC]=-1):t[SC]>=0&&t[SC]++}var qKe,Mge=C(()=>{Ege();qKe=globalThis.process?.emitWarning??function(e,n){console.warn(`[WARNING] [${n.code}] ${e}`)}});function QU(t,e,n,r,o){let i=t.validateSchema(e,t.schema);if(i)throw qt("SCHEMA_VALIDATION_FAILURE",i);return Ss(t.index.beforeInsert)||Ss(t.index.insert)||Ss(t.index.afterInsert)?o2t(t,e,n,r,o):i2t(t,e,n,r,o)}async function o2t(t,e,n,r,o){let{index:i,docs:s}=t.data,a=t.getDocumentIndexId(e);if(typeof a!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof a);if(!t.documentsStore.store(s,a,e))throw qt("DOCUMENT_ALREADY_EXISTS",a);let l=t.documentsStore.count(s);r||await Qm(t.beforeInsert,t,a,e);let c=t.index.getSearchableProperties(i),u=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,c);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=u[f];GKe(m,h,f,p)}return await s2t(t,a,c,d,l,n,e,o),r||await Qm(t.afterInsert,t,a,e),Age(t),a}function i2t(t,e,n,r,o){let{index:i,docs:s}=t.data,a=t.getDocumentIndexId(e);if(typeof a!="string")throw qt("DOCUMENT_ID_MUST_BE_STRING",typeof a);if(!t.documentsStore.store(s,a,e))throw qt("DOCUMENT_ALREADY_EXISTS",a);let l=t.documentsStore.count(s);r||Qm(t.beforeInsert,t,a,e);let c=t.index.getSearchableProperties(i),u=t.index.getSearchablePropertiesWithTypes(i),d=t.getDocumentProperties(e,c);for(let[f,p]of Object.entries(d)){if(typeof p>"u")continue;let m=typeof p,h=u[f];GKe(m,h,f,p)}return a2t(t,a,c,d,l,n,e,o),r||Qm(t.afterInsert,t,a,e),Age(t),a}function GKe(t,e,n,r){if(!(X3e(e)&&typeof r=="object"&&typeof r.lon=="number"&&typeof r.lat=="number")&&!(ov(e)&&Array.isArray(r))&&!(FN(e)&&Array.isArray(r))&&!(n2t.has(e)&&r2t.has(t))&&t!==e)throw qt("INVALID_DOCUMENT_PROPERTY",n,e,t)}async function s2t(t,e,n,r,o,i,s,a){for(let u of n){let d=r[u];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[u];await t.index.beforeInsert?.(t.data.index,u,e,d,f,i,t.tokenizer,o),await t.index.insert(t.index,t.data.index,u,e,d,f,i,t.tokenizer,o,a),await t.index.afterInsert?.(t.data.index,u,e,d,f,i,t.tokenizer,o)}let l=t.sorter.getSortableProperties(t.data.sorting),c=t.getDocumentProperties(s,l);for(let u of l){let d=c[u];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[u];t.sorter.insert(t.data.sorting,u,e,d,f,i)}}function a2t(t,e,n,r,o,i,s,a){for(let u of n){let d=r[u];if(typeof d>"u")continue;let f=t.index.getSearchablePropertiesWithTypes(t.data.index)[u];t.index.beforeInsert?.(t.data.index,u,e,d,f,i,t.tokenizer,o),t.index.insert(t.index,t.data.index,u,e,d,f,i,t.tokenizer,o,a),t.index.afterInsert?.(t.data.index,u,e,d,f,i,t.tokenizer,o)}let l=t.sorter.getSortableProperties(t.data.sorting),c=t.getDocumentProperties(s,l);for(let u of l){let d=c[u];if(typeof d>"u")continue;let f=t.sorter.getSortablePropertiesWithTypes(t.data.sorting)[u];t.sorter.insert(t.data.sorting,u,e,d,f,i)}}var n2t,r2t,Nge=C(()=>{Sge();ss();CC();Mge();Ua();n2t=new Set(["enum","enum[]"]),r2t=new Set(["string","number"])});function c0(t,e,n,r){return Ss(t.index.beforeRemove)||Ss(t.index.remove)||Ss(t.index.afterRemove)?l2t(t,e,n,r):c2t(t,e,n,r)}async function l2t(t,e,n,r){let o=!0,{index:i,docs:s}=t.data,a=t.documentsStore.get(s,e);if(!a)return!1;let l=vp(t.internalDocumentIDStore,mo(t.internalDocumentIDStore,e)),c=t.documentsStore.count(s);r||await Qm(t.beforeRemove,t,l);let u=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(a,u);for(let h of u){let g=f[h];if(typeof g>"u")continue;let y=d[h];await t.index.beforeRemove?.(t.data.index,h,l,g,y,n,t.tokenizer,c),await t.index.remove(t.index,t.data.index,h,e,g,y,n,t.tokenizer,c)||(o=!1),await t.index.afterRemove?.(t.data.index,h,l,g,y,n,t.tokenizer,c)}let p=await t.sorter.getSortableProperties(t.data.sorting),m=await t.getDocumentProperties(a,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return r||await Qm(t.afterRemove,t,l),t.documentsStore.remove(t.data.docs,e),kge(t),o}function c2t(t,e,n,r){let o=!0,{index:i,docs:s}=t.data,a=t.documentsStore.get(s,e);if(!a)return!1;let l=vp(t.internalDocumentIDStore,mo(t.internalDocumentIDStore,e)),c=t.documentsStore.count(s);r||Qm(t.beforeRemove,t,l);let u=t.index.getSearchableProperties(i),d=t.index.getSearchablePropertiesWithTypes(i),f=t.getDocumentProperties(a,u);for(let h of u){let g=f[h];if(typeof g>"u")continue;let y=d[h];t.index.beforeRemove?.(t.data.index,h,l,g,y,n,t.tokenizer,c),t.index.remove(t.index,t.data.index,h,e,g,y,n,t.tokenizer,c)||(o=!1),t.index.afterRemove?.(t.data.index,h,l,g,y,n,t.tokenizer,c)}let p=t.sorter.getSortableProperties(t.data.sorting),m=t.getDocumentProperties(a,p);for(let h of p)typeof m[h]>"u"||t.sorter.remove(t.data.sorting,h,e);return r||Qm(t.afterRemove,t,l),t.documentsStore.remove(t.data.docs,e),kge(t),o}function eB(t,e,n,r,o){return Ss(t.index.beforeRemove)||Ss(t.index.remove)||Ss(t.index.afterRemove)||Ss(t.beforeRemoveMultiple)||Ss(t.afterRemoveMultiple)?u2t(t,e,n,r,o):d2t(t,e,n,r,o)}async function u2t(t,e,n,r,o){let i=0;n||(n=1e3);let s=o?[]:e.map(a=>vp(t.internalDocumentIDStore,mo(t.internalDocumentIDStore,a)));return o||await a0(t.beforeRemoveMultiple,t,s),await new Promise((a,l)=>{let c=0;async function u(){let d=e.slice(c*n,++c*n);if(!d.length)return a();for(let f of d)try{await c0(t,f,r,o)&&i++}catch(p){l(p)}setTimeout(u,0)}setTimeout(u,0)}),o||await a0(t.afterRemoveMultiple,t,s),i}function d2t(t,e,n,r,o){let i=0;n||(n=1e3);let s=o?[]:e.map(c=>vp(t.internalDocumentIDStore,mo(t.internalDocumentIDStore,c)));o||a0(t.beforeRemoveMultiple,t,s);let a=0;function l(){let c=e.slice(a*n,++a*n);if(c.length){for(let u of c)c0(t,u,r,o)&&i++;setTimeout(l,0)}}return l(),o||a0(t.afterRemoveMultiple,t,s),i}var Oge=C(()=>{CC();xp();Mge();ss()});function f2t(t,e){return t[1]-e[1]}function p2t(t,e){return e[1]-t[1]}function m2t(t="desc"){return t.toLowerCase()==="asc"?f2t:p2t}function VN(t,e,n){let r={},o=e.map(([c])=>c),i=t.documentsStore.getMultiple(t.data.docs,o),s=Object.keys(n),a=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let c of s){let u;if(a[c]==="number"){let{ranges:d}=n[c],f=d.length,p=Array.from({length:f});for(let m=0;m{for(let o of t){let i=`${o.from}-${o.to}`;n?.has(i)||r>=o.from&&r<=o.to&&(e[i]===void 0?e[i]=1:(e[i]++,n?.add(i)))}}}function ZKe(t,e,n){let r=e==="boolean"?"false":"";return o=>{let i=o?.toString()??r;n?.has(i)||(t[i]=(t[i]??0)+1,n?.add(i))}}var Qq=C(()=>{Ua();ss()});function WN(t,e){let n=new Map,r=[];for(let o of t)n.set(o,!0);for(let o of e){let[i]=o;n.has(i)&&(r.push(o),n.delete(i))}return r}var eG=C(()=>{});function HN(t,e,n){let r=n.properties,o=r.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let y=0;y"u")throw qt("UNKNOWN_GROUP_BY_PROPERTY",w);if(!JKe.includes(i[w]))throw qt("INVALID_GROUP_BY_PROPERTY",w,JKe.join(", "),i[w])}let s=e.map(([y])=>vp(t.internalDocumentIDStore,y)),a=t.documentsStore.getMultiple(t.data.docs,s),l=a.length,c=n.maxResult||Number.MAX_SAFE_INTEGER,u=[],d={};for(let y=0;y"u")continue;let S=typeof T!="boolean"?T:""+T,P=v.perValue[S]??{indexes:[],count:0};P.count>=c||(P.indexes.push(b),P.count++,v.perValue[S]=P,x.add(T))}u.push(Array.from(x)),d[w]=v}let f=XKe(u),p=f.length,m=[];for(let y=0;y_-T),x.indexes.length!==0&&m.push(x)}let h=m.length,g=Array.from({length:h});for(let y=0;y({id:s[S],score:e[S][1],document:a[S]})),b=v.reducer.bind(null,w.values),_=v.getInitialValue(w.indexes.length),T=x.reduce(b,_);g[y]={values:w.values,result:T}}return g}function XKe(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let n=t[e],r=XKe(t,e+1),o=[];for(let i of n)for(let s of r){let a=[i];So(a,s),o.push(a)}return o}var h2t,JKe,tG=C(()=>{Ua();ss();xp();h2t={reducer:(t,e,n,r)=>(e[r]=n,e),getInitialValue:t=>Array.from({length:t})},JKe=["string","number","boolean"]});function QKe(t,e,n){let r=Xm(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(nG,e.relevance??{});let a=Object.keys(t.data.index.vectorIndexes),l=e.facets&&Object.keys(e.facets).length>0,{limit:c=10,offset:u=0,term:d,properties:f,threshold:p=0,distinctOn:m,includeVectors:h=!1}=e,g=e.preflight===!0,{index:y,docs:w}=t.data,v=t.tokenizer.tokenize(d??"",n),x=t.caches.propertiesToSearch;if(!x){let D=t.index.getSearchablePropertiesWithTypes(y);x=t.index.getSearchableProperties(y),x=x.filter($=>D[$].startsWith("string")),t.caches.propertiesToSearch=x}if(f&&f!=="*"){for(let D of f)if(!x.includes(D))throw qt("UNKNOWN_INDEX",D,x.join(", "));x=x.filter(D=>f.includes(D))}let b=u0(t.tokenizer,t.index,t.documentsStore,n,e,x,v,t.documentsStore.count(w),r),_=Object.keys(e.where??{}).length>0,T=[];_&&(T=t.index.searchByWhereClause(b,y,e.where));let S=v.length;if(S||f?.length){let D=x.length;for(let $=0;$[D,0]));let P=Object.entries(b.uniqueDocsIDs).map(([D,$])=>[+D,$]);if(_&&(P=WN(T,P)),e.sortBy)if(typeof e.sortBy=="function"){let D=P.map(([W])=>W),B=t.documentsStore.getMultiple(t.data.docs,D).map((W,F)=>[P[F][0],P[F][1],W]);B.sort(e.sortBy),P=B.map(([W,F])=>[W,F])}else P=t.sorter.sortBy(t.data.sorting,P,e.sortBy).map(([D,$])=>[mo(t.internalDocumentIDStore,D),$]);else P=P.sort(Y3e);let A;g||(A=m?t5e(t,P,u,c,m):rG(t,P,u,c));let O={elapsed:{formatted:"",raw:0},hits:[],count:P.length};if(typeof A<"u"&&(O.hits=A.filter(Boolean),h||Wq(O,a)),l){let D=VN(t,P,e.facets);O.facets=D}return e.groupBy&&(O.groups=HN(t,P,e.groupBy)),O.elapsed=t.formatElapsedTime(Xm()-b.timeStart),O}async function s(){t.beforeSearch&&await BN(t.beforeSearch,t,e,n);let a=i();return t.afterSearch&&await UN(t.afterSearch,t,e,n,a),a}return o?s():i()}var e5e=C(()=>{JU();Qq();eG();tG();CC();xp();Ua();ss();d0()});function Rge(t,e,n="english"){let r=Xm(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:a}=e;if(a&&(!("value"in a)||!("property"in a)))throw qt("INVALID_VECTOR_INPUT",Object.keys(a).join(", "));let{limit:l=10,offset:c=0,includeVectors:u=!1}=e,d=t.data.index.vectorIndexes[a.property],f=d.size,p=d.vectors,m=e.facets&&Object.keys(e.facets).length>0,h=Object.keys(e.where??{}).length>0,{index:g,docs:y}=t.data;if(a?.value.length!==f)throw a?.property===void 0||a?.value.length===void 0?qt("INVALID_INPUT_VECTOR","undefined",f,"undefined"):qt("INVALID_INPUT_VECTOR",a.property,f,a.value.length);a instanceof Float32Array||(a.value=new Float32Array(a.value));let w=qq(a.value,p,f,e.similarity).map(([D,$])=>[mo(t.internalDocumentIDStore,D),$]),v=t.caches.propertiesToSearch;if(!v){let D=t.index.getSearchablePropertiesWithTypes(g);v=t.index.getSearchableProperties(g),v=v.filter($=>D[$].startsWith("string")),t.caches.propertiesToSearch=v}let x=[],b=u0(t.tokenizer,t.index,t.documentsStore,n,e,v,x,t.documentsStore.count(y),r),_=[];h&&(_=t.index.searchByWhereClause(b,g,e.where),w=WN(_,w));let T=[];m&&(T=VN(t,w,e.facets));let S=Array.from({length:l});for(let D=0;D{d0();ss();Qq();Ua();Gq();eG();tG();xp();CC()});function r5e(t,e,n){let r=Xm(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{offset:a=0,limit:l=10,includeVectors:c=!1}=e,u=e.facets&&Object.keys(e.facets).length>0,d=g2t(t,e,n),f=y2t(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,g=v2t(d,f,e.term??"",h),y=t.tokenizer.tokenize(e.term??"",n),w=t.caches.propertiesToSearch;if(!w){let O=t.index.getSearchablePropertiesWithTypes(p);w=t.index.getSearchableProperties(p),w=w.filter(D=>O[D].startsWith("string")),t.caches.propertiesToSearch=w}if(e.properties&&e.properties!=="*"){for(let O of e.properties)if(!w.includes(O))throw qt("UNKNOWN_INDEX",O,w.join(", "));w=w.filter(O=>e.properties.includes(O))}let v=u0(t.tokenizer,t.index,t.documentsStore,n,e,w,y,t.documentsStore.count(m),r),x=Object.keys(e.where??{}).length>0,b=[];x&&(b=t.index.searchByWhereClause(v,p,e.where),g=WN(b,g));let _;u&&(_=VN(t,g,e.facets));let T;e.groupBy&&(T=HN(t,g,e.groupBy));let S=rG(t,g,a,l).filter(Boolean),P=Xm(),A={count:g.length,elapsed:{raw:Number(P-r),formatted:s0(P-r)},hits:S,..._?{facets:_}:{},...T?{groups:T}:{}};if(!c){let O=Object.keys(t.data.index.vectorIndexes);Wq(A,O)}return A}async function s(){t.beforeSearch&&await BN(t.beforeSearch,t,e,n);let a=i();return t.afterSearch&&await UN(t.afterSearch,t,e,n,a),a}return o?s():i()}function g2t(t,e,n){let r=Xm();e.relevance=Object.assign(nG,e.relevance??{});let{term:o="",properties:i,threshold:s=0}=e,{index:a,docs:l}=t.data,c=t.tokenizer.tokenize(o,n),u=t.caches.propertiesToSearch;if(!u){let m=t.index.getSearchablePropertiesWithTypes(a);u=t.index.getSearchableProperties(a),u=u.filter(h=>m[h].startsWith("string")),t.caches.propertiesToSearch=u}if(i&&i!=="*"){let m=new Set(u),h=new Set(i);for(let g of i)if(!m.has(g))throw qt("UNKNOWN_INDEX",g,u.join(", "));u=u.filter(g=>h.has(g))}let d=u0(t.tokenizer,t.index,t.documentsStore,n,e,u,c,t.documentsStore.count(l),r),f=c.length;if(f||i&&i.length>0){let m=u.length;for(let h=0;h[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return o5e(p)}function y2t(t,e){let n=e.vector,r=t.data.index.vectorIndexes[n?.property],o=r.size,i=r.vectors;if(n&&(!n.value||!n.property))throw qt("INVALID_VECTOR_INPUT",Object.keys(n).join(", "));if(n.value.length!==o)throw qt("INVALID_INPUT_VECTOR",n.property,o,n.value.length);n instanceof Float32Array||(n.value=new Float32Array(n.value));let s=qq(n.value,i,o,e.similarity).map(([a,l])=>[mo(t.internalDocumentIDStore,a),l]);return o5e(s)}function Dge([,t]){return t}function o5e(t){let e=Math.max.apply(Math,t.map(Dge));return t.map(([n,r])=>[n,r/e])}function n5e(t,e){return t/e}function w2t(t,e){return(n,r)=>n*t+r*e}function v2t(t,e,n,r){let o=Math.max.apply(Math,t.map(Dge)),i=Math.max.apply(Math,e.map(Dge)),s=r&&r.text&&r.vector,{text:a,vector:l}=s?r:x2t(n),c=new Map,u=t.length,d=w2t(a,l);for(let p=0;pm[1]-p[1])}function x2t(t){return{text:.5,vector:.5}}var i5e=C(()=>{ss();eG();JU();Ua();d0();Qq();tG();Gq();xp();d0();CC()});function u0(t,e,n,r,o,i,s,a,l){let c={},u={};for(let d of i){let f={};for(let p of s)f[p]=[];c[d]=f,u[d]=[]}return{timeStart:l,tokenizer:t,index:e,documentsStore:n,language:r,params:o,docsCount:a,uniqueDocsIDs:{},indexMap:c,docsIntersection:u}}function Zu(t,e,n){let r=e.mode??Xq;if(r===Xq)return QKe(t,e,n);if(r===Ige)return Rge(t,e);if(r===Tge)return r5e(t,e);throw qt("INVALID_SEARCH_MODE",r)}function t5e(t,e,n,r,o){let i=t.data.docs,s=new Map,a=[],l=new Set,c=e.length,u=0;for(let d=0;d"u")continue;let[p,m]=f;if(l.has(p))continue;let h=t.documentsStore.get(i,p),g=$N(h,o);if(!(typeof g>"u"||s.has(g))&&(s.set(g,!0),u++,!(u<=n)&&(a.push({id:vp(t.internalDocumentIDStore,p),score:m,document:h}),l.add(p),u>=n+r)))break}return a}function rG(t,e,n,r){let o=t.data.docs,i=Array.from({length:r}),s=new Set;for(let a=n;a"u")break;let[c,u]=l;if(!s.has(c)){let d=t.documentsStore.get(o,c);i[a]={id:vp(t.internalDocumentIDStore,c),score:u,document:d},s.add(c)}}return i}var nG,d0=C(()=>{xp();Ua();ss();Pge();e5e();Lge();i5e();nG={k:1.2,b:.75,d:.5}});function oG(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 $ge(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 s5e=C(()=>{});var a5e=C(()=>{CC();Ua();Nge();Oge();ss()});var l5e=C(()=>{Ua();d0()});var c5e=C(()=>{fge();ss();JU();Jq()});var iG=C(()=>{HKe();KKe();Nge();Oge();d0();Lge();s5e();a5e();l5e();Ege();Sge();c5e()});function S2t(t,e){let n=u5e(t,r=>e.priority<=r.priority);t.splice(n+1,0,e)}function u5e(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}var R9n,L9n,C2t,_2t,Fge,T2t,f0,Uge=C(()=>{R9n=new Error("timeout while waiting for mutex to become available"),L9n=new Error("mutex already locked"),C2t=new Error("request for lock canceled"),_2t=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(u){try{c(r.next(u))}catch(d){s(d)}}function l(u){try{c(r.throw(u))}catch(d){s(d)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})},Fge=class{constructor(e,n=C2t){this._value=e,this._cancelError=n,this._queue=[],this._weightedWaiters=[]}acquire(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((r,o)=>{let i={resolve:r,reject:o,weight:e,priority:n},s=u5e(this._queue,a=>n<=a.priority);s===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(s+1,0,i)})}runExclusive(e){return _2t(this,arguments,void 0,function*(n,r=1,o=0){let[i,s]=yield this.acquire(r,o);try{return yield n(i)}finally{s()}})}waitForUnlock(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,n)?Promise.resolve():new Promise(r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),S2t(this._weightedWaiters[e-1],{resolve:r,priority:n})})}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 n=this._value;this._value-=e.weight,e.resolve([n,this._newReleaser(e.weight)])}_newReleaser(e){let n=!1;return()=>{n||(n=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let n=this._weightedWaiters[e-1];n&&(n.forEach(r=>r.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let n=this._value;n>0;n--){let r=this._weightedWaiters[n-1];if(!r)continue;let o=r.findIndex(i=>i.priority<=e);(o===-1?r:r.splice(0,o)).forEach(i=>i.resolve())}}}_couldLockImmediately(e,n){return(this._queue.length===0||this._queue[0].prioritye(),1,n)}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()}}});function f5e(t){let e="";for(let n=0;n>>4]+d5e[t[n]&15];return e}function E2t(t,e){return t<>>32-e}function Jc(t){let e=new TextEncoder().encode(t),n=e.length,r=(n+8>>>6)+1<<6,o=new Uint8Array(r);o.set(e),o[n]=128;let i=new DataView(o.buffer),s=n*8>>>0,a=Math.floor(n/536870912);i.setUint32(r-8,s,!0),i.setUint32(r-4,a,!0);let l=1732584193,c=-271733879,u=-1732584194,d=271733878,f=new Int32Array(16);for(let h=0;h>>e|t<<32-e}function p5e(t){let e=new TextEncoder().encode(t),n=e.length,r=(n+8>>>6)+1<<6,o=new Uint8Array(r);o.set(e),o[n]=128;let i=new DataView(o.buffer),s=n*8>>>0,a=Math.floor(n/536870912);i.setUint32(r-8,a,!1),i.setUint32(r-4,s,!1);let l=1779033703,c=-1150833019,u=1013904242,d=-1521486534,f=1359893119,p=-1694144372,m=528734635,h=1541459225,g=new Int32Array(64);for(let v=0;v>>3,F=Qg(B,17)^Qg(B,19)^B>>>10;g[D]=g[D-16]+W+g[D-7]+F|0}let x=l,b=c,_=u,T=d,S=f,P=p,A=m,O=h;for(let D=0;D<64;D++){let $=Qg(S,6)^Qg(S,11)^Qg(S,25),B=S&P^~S&A,W=O+$+B+A2t[D]+g[D]|0,F=Qg(x,2)^Qg(x,13)^Qg(x,22),Z=x&b^x&_^b&_,V=F+Z|0;O=A,A=P,P=S,S=T+W|0,T=_,_=b,b=x,x=W+V|0}l=l+x|0,c=c+b|0,u=u+_|0,d=d+T|0,f=f+S|0,p=p+P|0,m=m+A|0,h=h+O|0}let y=new Uint8Array(32),w=new DataView(y.buffer);return w.setInt32(0,l,!1),w.setInt32(4,c,!1),w.setInt32(8,u,!1),w.setInt32(12,d,!1),w.setInt32(16,f,!1),w.setInt32(20,p,!1),w.setInt32(24,m,!1),w.setInt32(28,h,!1),f5e(y)}var d5e,I2t,P2t,A2t,TC=C(()=>{d5e="0123456789abcdef";I2t=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]),P2t=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];A2t=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])});var Bge,k2t,sG,m5e=C(()=>{Nf();ye();Se();iG();Bge="copilot-index-chunk-",k2t=".json",sG=class{constructor(e,n,r){this.app=e;this.baseDir=n;this.identifier=r}getChunkPath(e){return`${this.baseDir}/${Bge}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${Bge}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${k2t}`}assignDocumentToPartition(e,n){let o=Array.from(e).reduce((i,s)=>(i<<5)-i+s.charCodeAt(0),0);return Math.abs(o)%n}distributeDocumentsToPartitions(e,n){let r=new Map,o={};for(let s=0;s{i+=s.length,q().debug&&k(`Partition ${a+1}: ${s.length} documents`)}),q().debug&&(k(`Total documents distributed: ${i}`),i!==e.length&&console.error(`Document count mismatch! Original: ${e.length}, Distributed: ${i}`)),r}async ensureDirectoryExists(e){let n=e.substring(0,e.lastIndexOf("/"));await this.app.vault.adapter.exists(n)||await this.app.vault.adapter.mkdir(n)}async saveDatabase(e){try{let n=$ge(e),r=q().numPartitions;if(r===1){let c=this.getLegacyPath();await this.ensureDirectoryExists(c),await this.app.vault.adapter.write(c,JSON.stringify({...n,schema:e.schema}));return}let o=n.docs?.docs,i=Array.isArray(o)?o:Object.values(o||{});if(q().debug&&k(`Starting save with ${i.length??0} total documents`),!i||i.length===0){let c={numPartitions:r,schema:e.schema,lastModified:Date.now(),documentPartitions:{}},u=this.getMetadataPath();await this.ensureDirectoryExists(u),await this.app.vault.adapter.write(u,JSON.stringify(c)),q().debug&&k("Saved empty database state");return}let s=this.distributeDocumentsToPartitions(i,r),a={numPartitions:r,schema:e.schema,lastModified:Date.now(),documentPartitions:Object.fromEntries(i.map(c=>[c.id,this.assignDocumentToPartition(String(c.id),r)]))};await this.saveMetadata(a);let l={...n,docs:{docs:{},count:0},index:{...n.index,vectorIndexes:void 0}};for(let[c,u]of s.entries()){let d={index:{vectorIndexes:{embedding:{size:n.index.vectorIndexes.embedding.size,vectors:Object.fromEntries(Object.entries(n.index.vectorIndexes.embedding.vectors).filter(([m])=>u.some(h=>h.id===m)))}}},docs:{docs:Object.fromEntries(u.map((m,h)=>[(h+1).toString(),m])),count:u.length}},f=c===0?{...l,docs:d.docs,index:{...l.index,vectorIndexes:d.index.vectorIndexes}}:d,p=this.getChunkPath(c);await this.ensureDirectoryExists(p),await this.app.vault.adapter.write(p,JSON.stringify(f)),q().debug&&k(`Saved partition ${c+1}/${r}`)}q().debug&&k("Saved all partitions")}catch(n){throw console.error("Error saving database:",n),new Gn(`Failed to save database: ${n.message}`)}}async loadDatabase(){try{let e=this.getLegacyPath();if(await this.app.vault.adapter.exists(e)){let l=JSON.parse(await this.app.vault.adapter.read(e));if(!l?.schema)throw new Gn("Invalid legacy database format");let c=jN({schema:l.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return oG(c,l),c}let n=await this.loadMetadata(),r=jN({schema:n.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}}),o=null,i=[];for(let l=0;lObject.values(u.docs.docs)).find(u=>u.id===l);c?(s[a.toString()]=c,a++):q().debug&&console.warn(`Document ${l} not found in any chunk`)}return o.docs.docs=s,o.docs.count=Object.keys(s).length,o.internalDocumentIDStore.internalIdToId=Object.values(s).map(l=>l.id),o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(l=>l.index?.vectorIndexes?.embedding?.vectors||{})),oG(r,o),r}catch(e){throw console.error("Error loading database:",e),new Gn(`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 n=await this.app.vault.adapter.list(this.baseDir);for(let r of n.files)r.startsWith(`${this.baseDir}/${Bge}${this.identifier}`)&&await this.app.vault.adapter.remove(r)}catch(e){throw console.error("Error clearing storage:",e),new Gn(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(q().numPartitions===1)return await this.app.vault.adapter.exists(e);let n=this.getMetadataPath();return await this.app.vault.adapter.exists(n)||await this.app.vault.adapter.exists(e)}async loadMetadata(){let e=this.getMetadataPath();if(!await this.app.vault.adapter.exists(e))throw new Gn("No existing database found");let n=JSON.parse(await this.app.vault.adapter.read(e));if(!n?.schema)throw new Gn("Invalid metadata file: missing schema");return n}async saveMetadata(e){let n=this.getMetadataPath();await this.ensureDirectoryExists(n),await this.app.vault.adapter.write(n,JSON.stringify(e))}}});var g5e={};zn(g5e,{categorizePatterns:()=>ey,createPatternSettingsValue:()=>ty,extractAppIgnoreSettings:()=>Wge,getAllQAMarkdownContent:()=>Vge,getDecodedPatterns:()=>eh,getExtensionPattern:()=>Hge,getFilePattern:()=>KN,getMatchingPatterns:()=>Bo,getTagPattern:()=>tB,getVectorLength:()=>jge,isInternalExcludedFile:()=>nB,previewPatternValue:()=>O2t,shouldIndexFile:()=>Qr});async function jge(t){if(!t)throw new Gn("Embedding instance not found.");try{let n=await t.embedQuery("Sample text for embedding");if(!n||n.length===0)throw new Gn("Failed to get valid embedding vector length");return k(`Detected vector length: ${n.length} for model: ${is.getModelName(t)}`),n.length}catch(e){throw z("Error getting vector length:",e),new Gn("Failed to determine embedding vector length. Please check your Copilot settings to make sure you have a working embedding model.")}}async function Vge(t){let e="",{inclusions:n,exclusions:r}=Bo(),o=t.vault.getMarkdownFiles().filter(i=>Qr(i,n,r));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(s=>e+=s+" ")),e}function eh(t){let e=[];return e.push(...t.split(",").map(n=>{let r=n.trim();try{return decodeURIComponent(r)}catch{return r}}).filter(n=>n.length>0)),e}function M2t(){return q().qaExclusions?eh(q().qaExclusions):[]}function N2t(){return q().qaInclusions?eh(q().qaInclusions):[]}function Bo(t){let e=t?.inclusions?eh(t.inclusions):t?.isProject?[]:N2t(),n=t?.exclusions?eh(t.exclusions):t?.isProject?[]:M2t();return{inclusions:e.length>0?ey(e):null,exclusions:n.length>0?ey(n):null}}function Qr(t,e,n,r){return!(nB(t)||n&&h5e(t.path,n)||e&&!h5e(t.path,e)||r&&!e)}function ey(t){let e=[],n=[],r=[],o=[],i=/^#[^\s#]+$/,s=/^\*\.([a-zA-Z0-9.]+)$/,a=/^\[\[(.*?)\]\]$/;return t.forEach(l=>{i.test(l)?e.push(l):s.test(l)?n.push(l):a.test(l)?o.push(l):r.push(l)}),{tagPatterns:e,extensionPatterns:n,folderPatterns:r,notePatterns:o}}function O2t(t){return eh(t).join(", ")}function ty({tagPatterns:t,extensionPatterns:e,folderPatterns:n,notePatterns:r}){return[...t??[],...e??[],...r??[],...n??[]].map(i=>encodeURIComponent(i)).join(",")}function R2t(t,e){if(e.length===0)return!1;let n=app.vault.getAbstractFileByPath(t);if(n instanceof zge.TFile){let r=eg(n);if(e.some(o=>r.some(i=>i.toLowerCase()===TA(o).toLowerCase())))return!0}return!1}function L2t(t,e){if(e.length===0)return!1;let n=t.toLowerCase();return e.some(r=>{let o=r.slice(1).toLowerCase();return n.endsWith(o)})}function D2t(t,e){if(e.length===0)return!1;let n=t.replace(/\\/g,"/");return e.some(r=>{let o=r.replace(/\\/g,"/").replace(/\/$/,"");return n.startsWith(o)&&(n.length===o.length||n[o.length]==="/")})}function $2t(t,e){if(e.length===0)return!1;let n=app.vault.getAbstractFileByPath(t);return!!(n instanceof zge.TFile&&e.some(r=>r.slice(2,-2)===n.basename))}function h5e(t,e){if(!e)return!1;let{tagPatterns:n,extensionPatterns:r,folderPatterns:o,notePatterns:i}=e;return R2t(t,n??[])||L2t(t,r??[])||D2t(t,o??[])||$2t(t,i??[])}function Wge(t){let e=[];try{let n=t.vault;if(typeof n.getConfig=="function"){let r=n.getConfig("userIgnoreFilters");r&&Array.isArray(r)&&r.forEach(o=>{typeof o=="string"&&e.push(o.endsWith("/")?o.slice(0,-1):o)})}}catch(n){ee("Error getting userIgnoreFilters from Obsidian config",n)}return e}function tB(t){return`#${t}`}function KN(t){return`[[${t.basename}]]`}function Hge(t){return`*.${t}`}function F2t(){return[Ds.getLogPath()]}function U2t(){let e=(q().projectsFolder||"").trim();return e?[`${e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/\/+$/,"")}/`]:[]}function B2t(t){if(new Set(F2t()).has(t))return!0;let n=U2t();if(n.length===0)return!1;for(let r of n){if(!t.startsWith(r))continue;let o=t.slice(r.length),i=o.split("/");if(i.length===2&&i[1]==="project.md"||o.startsWith("unsupported/")||o==="unsupported")return!0}return!1}function nB(t){return B2t(t.path)}var zge,fc=C(()=>{Nf();o0();ye();Se();HS();qe();zge=require("obsidian")});var w5e={};zn(w5e,{DBOperations:()=>IC});var ny,y5e,IC,aG=C(()=>{o0();Nf();ye();Se();qe();iG();Uge();TC();ny=require("obsidian");m5e();fc();y5e=25,IC=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new f0;Ho(()=>{(async()=>{try{let n=q();ny.Platform.isMobile&&n.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):ny.Platform.isMobile&&!n.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await is.getInstance().getEmbeddingsAPI());let r=await this.getDbPath();this.dbPath&&r!==this.dbPath&&(k("Path change detected, reinitializing database..."),this.dbPath=r,await this.initializeChunkedStorage(),await this.initializeDB(await is.getInstance().getEmbeddingsAPI()),k("Database reinitialized with new path:",r))}catch(n){z("DBOperations settings change handler failed",n)}})()})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Gn("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new sG(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),ny.Platform.isMobile&&q().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Gn("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),k("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(r){z("Failed to load existing semantic index database, creating new one:",r)}let n=await this.createNewDb(e);return this.oramaDb=n,n}catch(n){z("Error initializing semantic index database:",n),new ny.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(ny.Platform.isMobile&&q().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await is.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Gn("Semantic index database not found.")}catch(e){throw z("Failed to initialize database during save:",e),new Gn("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,q().debug&&k("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw z("Error saving semantic index database:",e),e}}}async clearIndex(e){try{this.oramaDb||await this.initializeDB(e),await this.chunkedStorage?.clearStorage(),await new Promise(n=>window.setTimeout(n,100)),this.oramaDb=await this.createNewDb(e),await this.saveDB(),new ny.Notice("Local Copilot index cleared successfully."),k("Local Copilot index cleared successfully, new instance created.")}catch(n){throw z("Error clearing the local Copilot index:",n),new ny.Notice("An error occurred while clearing the local Copilot index."),n}}async removeDocs(e){if(!this.oramaDb)throw new Gn("Semantic index database not found.");try{let n=await Zu(this.oramaDb,{term:e,properties:["path"]});n.hits.length>0&&(await eB(this.oramaDb,n.hits.map(r=>r.id),500),q().debug&&k(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(n){z("Error deleting document from local Copilotindex:",n)}}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().catch(e=>z("saveDB on unload failed",e))}getCurrentDbPath(){return this.dbPath}async getDbPath(){let e=this.app.vault.getRoot().path,n;if(q().enableIndexSync)n=this.app.vault.configDir;else{let r=e==="/"?"":e;n=`${r===""||r.startsWith("/")?"":"/"}${r}/.copilot-index`,await this.app.vault.adapter.exists(n)||(await this.app.vault.adapter.mkdir(n),k("Created directory:",n))}return n}getVaultIdentifier(){let e=this.app.vault.getName();return Jc(e)}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Gn("Embedding instance not found.");let n=await jge(e);if(!n||n===0)throw new Gn("Invalid vector length detected. Please check if your embedding model is working.");let r=this.createDynamicSchema(n),o=jN({schema:r,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return k(`Created new semantic index database for ${this.dbPath}. Embedding model: ${is.getModelName(e)} with vector length ${n}.`),this.isIndexLoaded=!0,o}static async getDocsByPath(e,n){if(!e)throw new Error("DB not initialized");return n?(await t.getAllDocuments(e)).filter(i=>i.path===n).map(i=>({document:i,score:1})):void 0}static async getDocsByEmbedding(e,n,r){return(await Zu(e,{mode:"vector",vector:{value:n,property:"embedding"},limit:r.limit,similarity:r.similarity,includeVectors:!0})).hits}static async getLatestFileMtime(e){if(!e)throw new Error("DB not initialized");try{let n=await Zu(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return n.hits.length>0?n.hits[0].document.mtime:0}catch(n){return z("Error getting latest file mtime from VectorDB:",n),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 n=this.oramaDb;return await this.upsertMutex.runExclusive(async()=>{try{let r=this.chunkedStorage?.assignDocumentToPartition(String(e.id),q().numPartitions),o=await Zu(n,{term:String(e.id),properties:["id"],limit:1});o.hits.length>0&&await c0(n,o.hits[0].id);try{return await QU(n,e),k(`${o.hits.length>0?"Updated":"Inserted"} document ${String(e.id)} in partition ${r}`),this.markUnsavedChanges(),e}catch(i){if(z(`Failed to ${o.hits.length>0?"update":"insert"} document ${String(e.id)}:`,i),o.hits.length>0)try{await QU(n,o.hits[0].document)}catch(s){z("Failed to restore previous document version:",s)}return}}catch(r){z(`Error upserting document ${String(e.id)}:`,r);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await Zu(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return z("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){k("Semantic index database not loaded in memory. Checking for existing index...");try{await this.initializeDB(e)}catch(o){throw z("Failed to initialize database:",o),new Gn("Failed to initialize semantic index database. Please check your embedding model settings.")}if(!this.oramaDb)return k("No existing index found. Will create new index."),!1}let n=await Zu(this.oramaDb,{term:"",limit:1}),r;if(n.hits.length>0){let o=n.hits[0];typeof o=="object"&&o!==null&&"document"in o&&(r=o.document.embeddingModel)}if(r){let o=is.getModelName(e);if(!kAe(r,o))return new ny.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),k(`Detected change in embedding model from "${r}" to "${o}". Rebuilding Copilot index from scratch.`),this.oramaDb=await this.createNewDb(e),await this.saveDB(),!0}else k("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await Zu(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(r=>r.document)}async garbageCollect(){if(!this.oramaDb){k("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await is.getInstance().getEmbeddingsAPI();if(!e)throw new Gn("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Gn("Failed to initialize database after attempt.")}catch(e){throw z("Failed to initialize database during garbage collection:",e),new Gn("Failed to initialize database. Please check your embedding model settings.")}}try{let e=this.app.vault.getMarkdownFiles(),n=new Set(e.map(l=>l.path)),{inclusions:r,exclusions:o}=Bo(),i=new Set(e.filter(l=>Qr(l,r,o)).map(l=>l.path)),a=(await t.getAllDocuments(this.oramaDb)).filter(l=>!n.has(l.path)||!i.has(l.path));return a.length===0?0:(k("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(a.map(l=>l.path))).join(", ")),a.length===1?await c0(this.oramaDb,a[0].id):await eB(this.oramaDb,a.map(l=>l.id),500),await this.saveDB(),a.length)}catch(e){throw z("Error garbage collecting the Copilot index:",e),new Gn("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Gn("Semantic index database not found.");try{let e=await t.getAllDocuments(this.oramaDb),n=new Set;return e.forEach(r=>{n.add(r.path)}),Array.from(n).sort()}catch(e){throw z("Error getting indexed files:",e),new Gn("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await Zu(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw z("Error checking if database is empty:",e),new Gn("Failed to check if database is empty.")}}async hasIndex(e){if(!this.oramaDb)return!1;let n=await t.getDocsByPath(this.oramaDb,e);return n!==void 0&&n.length>0}async hasEmbeddings(e){if(!this.oramaDb)return!1;let n=await t.getDocsByPath(this.oramaDb,e);return!n||n.length===0?!1:n.every(r=>r?.document?.embedding&&Array.isArray(r.document.embedding)&&r.document.embedding.length>0)}async getDocsJsonByPaths(e){if(!this.oramaDb)throw new Gn("Semantic index database not found.");let n={};for(let r of e){let o=await t.getDocsByPath(this.oramaDb,r);o&&o.length>0&&(n[r]=o.map(i=>i.document))}return n}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 Gn("Orama database not found.");try{let e=await this.getIndexedFiles(),n=[];for(let r=0;r0?k(`Integrity check: ${n.length} file(s) missing embeddings, marked for re-indexing:`,n.join(", ")):k("Index integrity check completed. All documents have embeddings.")}catch(e){throw z("Error checking index integrity:",e),new Gn("Failed to check index integrity.")}}async yieldToEventLoop(){await new Promise(e=>{if(typeof window<"u"){let n=window;if(n.requestIdleCallback){n.requestIdleCallback(()=>e());return}}window.setTimeout(e,0)})}}});var lG,v5e=C(()=>{aG();lG=class{constructor(e){this.dbOps=new IC(e)}async initialize(e){await this.dbOps.initializeDB(e)}async clearIndex(e){await this.dbOps.clearIndex(e)}requiresEmbeddings(){return!0}async upsert(e){return await this.dbOps.upsert(e)}async upsertBatch(e){let n=0;for(let r of e)await this.dbOps.upsert(r)&&(n+=1);return n}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 n=this.dbOps.getDb();if(!n)throw new Error("Database is not loaded. Please restart the plugin.");let r=await IC.getDocsByPath(n,e);return r?r.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()}isRemoteBackend(){return!1}getDb(){return this.dbOps.getDb()}async reinitializeForIndexSyncChange(e){let n=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==n&&await this.dbOps.initializeDB(e)}getDbOperations(){return this.dbOps}}});var qN,z2t,rB,x5e=C(()=>{Ir();Qi();ye();Se();qN=require("obsidian");fc();z2t=5e3,rB=class{constructor(e,n,r){this.app=e;this.indexOps=n;this.indexBackend=r;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.listenersActive=!1;this.handleActiveLeafChange=async e=>{if(!this.shouldHandleEvents()||qN.Platform.isMobile&&q().disableIndexOnMobile&&!this.indexBackend.isRemoteBackend()||ym()!=="copilot_plus")return;let r=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof qN.MarkdownView?i.file:null,this.lastActiveFileMtime=this.lastActiveFile?.stat?.mtime??null,!(!r||r===this.lastActiveFile)&&!(!r?.stat?.mtime||o===null)&&r.extension==="md"){let{inclusions:s,exclusions:a}=Bo(),l=Qr(r,s,a),c=o!==null&&r.stat.mtime>o;l&&c&&this.debouncedReindexFile(r)}};this.debouncedReindexFile=e=>{this.shouldHandleEvents()&&(this.debounceTimer!==null&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{q().debug&&k("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e).catch(n=>z("reindexFile failed",n)),this.debounceTimer=null},z2t))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof qN.TFile&&await this.indexBackend.removeByPath(e.path)};this.syncEventListeners(),Ho(()=>{this.syncEventListeners()})}shouldHandleEvents(){return q().enableSemanticSearchV3?!(this.indexBackend.isRemoteBackend()&&!this.indexBackend.requiresEmbeddings()):!1}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(k("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 qge(t){return Kge.add(t),()=>{Kge.delete(t)}}function oB(){Kge.forEach(t=>t())}var Kge,Gge=C(()=>{Kge=new Set});var cG,b5e=C(()=>{cG=class{constructor(e){this.lastRequestTime=0;this.requestsPerMin=e}setRequestsPerMin(e){this.requestsPerMin=e}getRequestsPerMin(){return this.requestsPerMin}async wait(){let n=Date.now()-this.lastRequestTime,r=Math.max(0,6e4/this.requestsPerMin-n);r>0&&await new Promise(o=>window.setTimeout(o,r)),this.lastRequestTime=Date.now()}}});var fi,Yge=C(()=>{fi=class{constructor(t){I(this,"pageContent");I(this,"metadata");I(this,"id");this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}}});var Zge,C5e=C(()=>{Ra();Zge=class extends gr{constructor(){super(...arguments);I(this,"lc_namespace",["langchain_core","documents","transformers"])}invoke(e,n){return this.transformDocuments(e)}}});var iv=C(()=>{$n();Yge();C5e()});var _5e,Xge,S5e=C(()=>{iv();rde();_5e=class extends Zge{constructor(e){super(e);I(this,"lc_namespace",["langchain","document_transformers","text_splitters"]);I(this,"chunkSize",1e3);I(this,"chunkOverlap",200);I(this,"keepSeparator",!1);I(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??(n=>n.length),this.chunkOverlap>=this.chunkSize)throw new Error("Cannot have chunkOverlap >= chunkSize")}async transformDocuments(e,n={}){return this.splitDocuments(e,n)}splitOnSeparator(e,n){let r;if(n)if(this.keepSeparator){let o=n.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");r=e.split(new RegExp(`(?=${o})`))}else r=e.split(n);else r=e.split("");return r.filter(o=>o!=="")}async createDocuments(e,n=[],r={}){let o=n.length>0?n:[...Array(e.length)].map(()=>({})),{chunkHeader:i="",chunkOverlapHeader:s="(cont'd) ",appendChunkOverlapHeader:a=!1}=r,l=new Array;for(let c=0;cg){let b=this.numberOfNewLines(u,g,x);d-=b}a&&(h+=s)}let y=this.numberOfNewLines(m),w=o[c].loc&&typeof o[c].loc=="object"?{...o[c].loc}:{};w.lines={from:d,to:d+y};let v={...o[c],loc:w};h+=m,l.push(new fi({pageContent:h,metadata:v})),d+=y,f=m,p=g}}return l}numberOfNewLines(e,n,r){return(e.slice(n,r).match(/\n/g)||[]).length}async splitDocuments(e,n={}){let r=e.filter(s=>s.pageContent!==void 0),o=r.map(s=>s.pageContent),i=r.map(s=>s.metadata);return this.createDocuments(o,i,n)}joinDocs(e,n){let r=e.join(n).trim();return r===""?null:r}async mergeSplits(e,n){let r=[],o=[],i=0;for(let a of e){let l=await this.lengthFunction(a);if(i+l+o.length*n.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 c=this.joinDocs(o,n);for(c!==null&&r.push(c);i>this.chunkOverlap||i+l+o.length*n.length>this.chunkSize&&i>0;)i-=await this.lengthFunction(o[0]),o.shift()}o.push(a),i+=l}let s=this.joinDocs(o,n);return s!==null&&r.push(s),r}},Xge=class Jge extends _5e{constructor(n){super(n);I(this,"separators",[` `,` `," ",""]);this.separators=n?.separators??this.separators,this.keepSeparator=n?.keepSeparator??!0}static lc_name(){return"RecursiveCharacterTextSplitter"}async _splitText(n,r){let o=[],i=r[r.length-1],s;for(let u=0;u","
","

","
","

  • ","

    ","

    ","

    ","

    ","

    ","
    ","","","","
    ","","
      ","
        ","
        ","