@iflow-ai/iflow-cli 0.2.35-beta.0 → 0.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/iflow.js +5 -5
- package/package.json +1 -1
package/bundle/iflow.js
CHANGED
|
@@ -831,14 +831,14 @@ ${JSON.stringify(p,null,2)}`),p.usage&&(this.lastUsageMetadata={total_tokens:p.u
|
|
|
831
831
|
\u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
|
|
832
832
|
${e}
|
|
833
833
|
|
|
834
|
-
\u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw s4(n),console.error("QWen JSON fix failed:",n),n}}extractTextFromRequest(e){let r="";if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of n)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)r+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,c]of Object.entries(s.functionResponse.response))c!=null&&(r+=String(c)+" ")}}return r+=e.config?.systemInstruction,r.trim()}extractTextFromEmbedRequest(e){if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let n of r)if(typeof n=="object"&&n!==null&&"parts"in n&&n.parts){let i=Array.isArray(n.parts)?n.parts:[n.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null&&"text"in n&&n.text)return n.text}}return""}extractSystemInstruction(e){let r="";if(typeof e=="string")r=e;else if(Array.isArray(e)){for(let n of e)typeof n=="object"&&n!==null&&"text"in n&&n.text&&(r+=n.text+" ");r=r.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let n=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of n)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(r+=i.text+" ");r=r.trim()}else"text"in e&&e.text&&(r=e.text);return r}convertToOpenAITools(e){if(!e||e.length===0)return[];let r=[];for(let n of e)if(n.functionDeclarations&&Array.isArray(n.functionDeclarations))for(let i of n.functionDeclarations)r.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return r}convertParameters(e){if(!e)return;let r={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(r[e.type]?e.type=r[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=r[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let n=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=n(a)}return i.items&&(o.items=n(i.items)),i.required&&(o.required=i.required),o};return n(e)}mapFinishReason(e){switch(e){case"stop":return y7.STOP;case"length":return y7.MAX_TOKENS;case"content_filter":return y7.SAFETY;case"tool_calls":return y7.MALFORMED_FUNCTION_CALL;default:return y7.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var v1,Xu,oU,sU,YK,tMt,a4=ae(()=>{"use strict";v1="Qwen3-Coder",Xu="Qwen3-Coder",oU="text-embedding-v1",sU="gemini-2.5-flash-lite",YK="https://apis.iflow.cn/v1",tMt="https://ducky.code.alibaba-inc.com/v1/openai"});async function PFe(t,e,r,n){if(e===$t.LOGIN_WITH_IFLOW){let i=await cD(e,r),o=await y5();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new iU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||YK,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===$t.CLOUD_SHELL){let i=await cD(e,r),o=await ANt(i);return new P8(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var LFe=ae(()=>{"use strict";m3();b7();yNt();uhe();MFe();a4();});function NOn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function _5(t){let e=NOn(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function JK(){return _5("apiKey")}function KK(){return _5("baseUrl")||_5("url")}function XK(){return _5("modelName")||_5("model")}function rMt(t){let e=_5(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function nMt(t){let e=_5(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function iMt(t){let e=_5(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function g0e(){return!!(JK()||KK()||XK())}function FFe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=_5(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=rMt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=nMt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=iMt(o);s!==void 0&&(t[o]=s)}),t}function OOn(){return{apiKey:JK(),baseUrl:KK(),model:XK()}}var UFe=ae(()=>{"use strict";});async function QFe(t,e,r){await IF()&&(await che()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=JK(),u=KK(),d=XK(),f=r?.apiKey||c,p=r?.baseUrl||u||kOn[e],h=t.getModel()||d||v1,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===$t.CLOUD_SHELL?m:e===$t.LOGIN_WITH_IFLOW?(m.baseUrl=p||YK,m.multimodalModelName="qwen3-vl-plus",f&&(m.apiKey=f),m):([...Hg,$t.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function qFe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.35-beta.0 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Hg,$t.IDEA_LAB].includes(t.authType)||t.authType===$t.OPENAI_COMPATIBLE)return new iU({...t,config:e});if(t.authType===$t.LOGIN_WITH_IFLOW||t.authType===$t.CLOUD_SHELL)return PFe(i,t.authType,e,r);if([...Hg,$t.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===$t.USE_GEMINI||t.authType===$t.USE_VERTEX_AI)return new Zpe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var $t,Hg,kOn,m3=ae(()=>{"use strict";il();LFe();a4();MFe();UFe();b7();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})($t||($t={}));Hg=[$t.IFLOW,$t.AONE],kOn={[$t.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[$t.IFLOW]:YK,[$t.AONE]:tMt}});var A0e,oMt=ae(()=>{"use strict";A0e=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var fo,Yr,po,ho,su=ae(()=>{"use strict";fo=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Yr||(Yr={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(po||(po={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(ho||(ho={}))});function xD(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var y0e=ae(()=>{"use strict";});var Va,ZK=ae(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(Va||(Va={}))});function MOn(t){return{text:t.text}}function POn(t,e){return[{text:M.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function LOn(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:M.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function FOn(t){return{text:M.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function UOn(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return MOn(o);case"image":case"audio":return POn(o,n);case"resource":return LOn(o,n);case"resource_link":return FOn(o);default:return null}}).filter(o=>o!==null):[{text:M.t("mcpTool.errors.parseResponseFailed")}]}function QOn(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return M.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return M.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return M.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:M.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||M.t("mcpTool.display.unknownType")});default:return M.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
|
|
834
|
+
\u8BF7\u76F4\u63A5\u8F93\u51FA\u4E00\u4E2A\u6B63\u786E\u7684json\u683C\u5F0F\uFF1A`;try{let n=await fetch("https://apis.iflow.cn/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:"QWen3-4B",messages:[{role:"user",content:r}],temperature:.1,max_tokens:1e3})});if(!n.ok)throw new Error(`API error: ${n.status}`);let i=await n.json();if(!i||!i.choices||!Array.isArray(i.choices)||i.choices.length===0)throw new Error("Invalid response format - missing or empty choices array");let o=i.choices[0]?.message?.content;if(!o||typeof o!="string")throw new Error("Invalid response - missing or invalid message content");let s=o.trim();if(s.startsWith("```json")?s=s.replace(/^```json\s*/,"").replace(/\s*```$/,""):s.startsWith("```")&&(s=s.replace(/^```\s*/,"").replace(/\s*```$/,"")),!s)throw new Error("Fixed JSON is empty after processing");return JSON.parse(s)}catch(n){throw s4(n),console.error("QWen JSON fix failed:",n),n}}extractTextFromRequest(e){let r="";if(e.contents){let n=Array.isArray(e.contents)?e.contents:[e.contents];for(let i of n)if(i&&typeof i=="object"&&"parts"in i&&i.parts){let o=Array.isArray(i.parts)?i.parts:[i.parts];for(let s of o)if(s&&typeof s=="object"&&"text"in s&&s.text)r+=s.text+" ";else if(s.functionResponse&&s.functionResponse.response)for(let[a,c]of Object.entries(s.functionResponse.response))c!=null&&(r+=String(c)+" ")}}return r+=e.config?.systemInstruction,r.trim()}extractTextFromEmbedRequest(e){if(e.contents){let r=Array.isArray(e.contents)?e.contents:[e.contents];for(let n of r)if(typeof n=="object"&&n!==null&&"parts"in n&&n.parts){let i=Array.isArray(n.parts)?n.parts:[n.parts];for(let o of i)if(typeof o=="object"&&o!==null&&"text"in o&&o.text)return o.text}else{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null&&"text"in n&&n.text)return n.text}}return""}extractSystemInstruction(e){let r="";if(typeof e=="string")r=e;else if(Array.isArray(e)){for(let n of e)typeof n=="object"&&n!==null&&"text"in n&&n.text&&(r+=n.text+" ");r=r.trim()}else if(typeof e=="object"&&e!==null)if("parts"in e&&e.parts){let n=Array.isArray(e.parts)?e.parts:[e.parts];for(let i of n)typeof i=="object"&&i!==null&&"text"in i&&i.text&&(r+=i.text+" ");r=r.trim()}else"text"in e&&e.text&&(r=e.text);return r}convertToOpenAITools(e){if(!e||e.length===0)return[];let r=[];for(let n of e)if(n.functionDeclarations&&Array.isArray(n.functionDeclarations))for(let i of n.functionDeclarations)r.push({type:"function",function:{name:i.name||"",description:i.description,parameters:this.convertParameters(i.parameters||i.parametersJsonSchema)}});return r}convertParameters(e){if(!e)return;let r={STRING:"string",INTEGER:"integer",NUMBER:"number",BOOLEAN:"boolean",OBJECT:"object",ARRAY:"array"};if(typeof e=="object"&&e.type){if(typeof e.type=="string"&&(r[e.type]?e.type=r[e.type]:e.type=e.type.toLowerCase()),e.properties)for(let i in e.properties){let o=e.properties[i],s={};o.type&&(s.type=r[o.type]),o.description&&(s.description=o.description),e.properties[i]=s}return e.items&&(e.items=this.convertParameters(e.items)),e}let n=i=>{if(!i)return;let o={};if(i.type)switch(i.type){case"STRING":o.type="string";break;case"INTEGER":o.type="integer";break;case"NUMBER":o.type="number";break;case"BOOLEAN":o.type="boolean";break;case"OBJECT":o.type="object";break;case"ARRAY":o.type="array";break;default:o.type=i.type.toLowerCase()}if(o.type="object",i.description&&(o.description=i.description),i.enum&&(o.enum=i.enum),i.properties){o.properties={};for(let[s,a]of Object.entries(i.properties))o.properties[s]=n(a)}return i.items&&(o.items=n(i.items)),i.required&&(o.required=i.required),o};return n(e)}mapFinishReason(e){switch(e){case"stop":return y7.STOP;case"length":return y7.MAX_TOKENS;case"content_filter":return y7.SAFETY;case"tool_calls":return y7.MALFORMED_FUNCTION_CALL;default:return y7.OTHER}}convertResponseSchema(e){if(e)return e.type==="object"||e.type==="OBJECT"?{type:"json_schema",json_schema:{name:e.name||"",description:e.description||"",schema:this.convertSchemaToJsonSchema(e),strict:!0}}:{type:"json_schema",json_schema:{name:"response_schema",description:"Generated response schema",schema:this.convertSchemaToJsonSchema(e),strict:!0}}}convertSchemaToJsonSchema(e){if(!e)return{};let r={};if(e.type)switch(e.type){case"STRING":r.type="string";break;case"INTEGER":r.type="integer";break;case"NUMBER":r.type="number";break;case"BOOLEAN":r.type="boolean";break;case"OBJECT":r.type="object";break;case"ARRAY":r.type="array";break;default:r.type=typeof e.type=="string"?e.type.toLowerCase():e.type}if(e.description&&(r.description=e.description),e.enum&&(r.enum=e.enum),e.properties){r.properties={};for(let[n,i]of Object.entries(e.properties))r.properties[n]=this.convertSchemaToJsonSchema(i)}return e.items&&(r.items=this.convertSchemaToJsonSchema(e.items)),e.required&&(r.required=e.required),r.type==="object"&&!("additionalProperties"in r)&&(r.additionalProperties=!1),r}}});var v1,Xu,oU,sU,YK,tMt,a4=ae(()=>{"use strict";v1="Qwen3-Coder",Xu="Qwen3-Coder",oU="text-embedding-v1",sU="gemini-2.5-flash-lite",YK="https://apis.iflow.cn/v1",tMt="https://ducky.code.alibaba-inc.com/v1/openai"});async function PFe(t,e,r,n){if(e===$t.LOGIN_WITH_IFLOW){let i=await cD(e,r),o=await y5();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new iU({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||YK,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen3-vl-plus",config:r})}if(e===$t.CLOUD_SHELL){let i=await cD(e,r),o=await ANt(i);return new P8(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var LFe=ae(()=>{"use strict";m3();b7();yNt();uhe();MFe();a4();});function NOn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function _5(t){let e=NOn(t),r=`IFLOW_${t}`;if(process.env[r])return process.env[r];let n=`IFLOW_${e}`;if(process.env[n])return process.env[n];let i=`iflow_${t}`;if(process.env[i])return process.env[i];let o=`iflow_${e}`;if(process.env[o])return process.env[o]}function JK(){return _5("apiKey")}function KK(){return _5("baseUrl")||_5("url")}function XK(){return _5("modelName")||_5("model")}function rMt(t){let e=_5(t);if(e===void 0)return;let r=e.toLowerCase();if(r==="true"||r==="1"||r==="yes")return!0;if(r==="false"||r==="0"||r==="no")return!1}function nMt(t){let e=_5(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function iMt(t){let e=_5(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function g0e(){return!!(JK()||KK()||XK())}function FFe(){let t={},e=["theme","selectedAuthType","sandbox","toolDiscoveryCommand","toolCallCommand","mcpServerCommand","contextFileName","preferredEditor","apiKey","baseUrl","modelName","searchApiKey","multimodalModelName","memoryImportFormat"],r=["useExternalAuth","showMemoryUsage","usageStatisticsEnabled","autoConfigureMaxOldSpaceSize","hideWindowTitle","hideTips","hideBanner","vimMode","ideModeFeature","ideMode","disableAutoUpdate","skipNextSpeakerCheck","useRipgrep"],n=["maxSessionTurns","memoryDiscoveryMaxDirs","tokensLimit","compressionTokenThreshold","shellTimeout"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=_5(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=rMt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=nMt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=iMt(o);s!==void 0&&(t[o]=s)}),t}function OOn(){return{apiKey:JK(),baseUrl:KK(),model:XK()}}var UFe=ae(()=>{"use strict";});async function QFe(t,e,r){await IF()&&(await che()||console.log("OAuth2 credentials cleared due to expiration. Please authenticate when prompted."));let i=process.env.GEMINI_API_KEY,o=process.env.GOOGLE_API_KEY,s=process.env.GOOGLE_CLOUD_PROJECT,a=process.env.GOOGLE_CLOUD_LOCATION,c=JK(),u=KK(),d=XK(),f=r?.apiKey||c,p=r?.baseUrl||u||kOn[e],h=t.getModel()||d||v1,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===$t.CLOUD_SHELL?m:e===$t.LOGIN_WITH_IFLOW?(m.baseUrl=p||YK,m.multimodalModelName="qwen3-vl-plus",f&&(m.apiKey=f),m):([...Hg,$t.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function qFe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.35 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Hg,$t.IDEA_LAB].includes(t.authType)||t.authType===$t.OPENAI_COMPATIBLE)return new iU({...t,config:e});if(t.authType===$t.LOGIN_WITH_IFLOW||t.authType===$t.CLOUD_SHELL)return PFe(i,t.authType,e,r);if([...Hg,$t.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===$t.USE_GEMINI||t.authType===$t.USE_VERTEX_AI)return new Zpe({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var $t,Hg,kOn,m3=ae(()=>{"use strict";il();LFe();a4();MFe();UFe();b7();(function(t){t.LOGIN_WITH_IFLOW="oauth-iflow",t.USE_GEMINI="gemini-api-key",t.USE_VERTEX_AI="vertex-ai",t.CLOUD_SHELL="cloud-shell",t.IFLOW="iflow",t.AONE="aone",t.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})($t||($t={}));Hg=[$t.IFLOW,$t.AONE],kOn={[$t.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[$t.IFLOW]:YK,[$t.AONE]:tMt}});var A0e,oMt=ae(()=>{"use strict";A0e=class{prompts=new Map;registerPrompt(e){if(this.prompts.has(e.name)){let r=`${e.serverName}_${e.name}`;console.warn(`Prompt with name "${e.name}" is already registered. Renaming to "${r}".`),this.prompts.set(r,{...e,name:r})}else this.prompts.set(e.name,e)}getAllPrompts(){return Array.from(this.prompts.values()).sort((e,r)=>e.name.localeCompare(r.name))}getPrompt(e){return this.prompts.get(e)}getPromptsByServer(e){let r=[];for(let n of this.prompts.values())n.serverName===e&&r.push(n);return r.sort((n,i)=>n.name.localeCompare(i.name))}clear(){this.prompts.clear()}removePromptsByServer(e){for(let[r,n]of this.prompts.entries())n.serverName===e&&this.prompts.delete(r)}}});var fo,Yr,po,ho,su=ae(()=>{"use strict";fo=class{name;displayName;description;icon;kind;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s,a=!0,c=!1,u=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.kind=o,this.parameterSchema=s,this.isOutputMarkdown=a,this.canUpdateOutput=c,this.aliases=u}get schema(){return{name:this.name,description:this.description,parameters:this.parameterSchema}}validateToolParams(e){return null}getDescription(e){return JSON.stringify(e)}shouldConfirmExecute(e,r){return Promise.resolve(!1)}toolLocations(e){return[]}};(function(t){t.ProceedOnce="proceed_once",t.ProceedAlways="proceed_always",t.ProceedAlwaysServer="proceed_always_server",t.ProceedAlwaysTool="proceed_always_tool",t.ModifyWithEditor="modify_with_editor",t.Cancel="cancel"})(Yr||(Yr={}));(function(t){t.FileSearch="fileSearch",t.Folder="folder",t.Globe="globe",t.Hammer="hammer",t.LightBulb="lightBulb",t.Pencil="pencil",t.Regex="regex",t.Terminal="terminal"})(po||(po={}));(function(t){t.Read="read",t.Edit="edit",t.Delete="delete",t.Move="move",t.Search="search",t.Execute="execute",t.Think="think",t.Fetch="fetch",t.Other="other"})(ho||(ho={}))});function xD(t,e){let r=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="object"&&i!==null){if(r.has(i))return"[Circular]";r.add(i)}return i},e)}var y0e=ae(()=>{"use strict";});var Va,ZK=ae(()=>{"use strict";(function(t){t.INVALID_TOOL_PARAMS="invalid_tool_params",t.UNKNOWN="unknown",t.UNHANDLED_EXCEPTION="unhandled_exception",t.TOOL_NOT_REGISTERED="tool_not_registered",t.EXECUTION_FAILED="execution_failed",t.FILE_NOT_FOUND="file_not_found",t.FILE_WRITE_FAILURE="file_write_failure",t.READ_CONTENT_FAILURE="read_content_failure",t.ATTEMPT_TO_CREATE_EXISTING_FILE="attempt_to_create_existing_file",t.FILE_TOO_LARGE="file_too_large",t.PERMISSION_DENIED="permission_denied",t.NO_SPACE_LEFT="no_space_left",t.TARGET_IS_DIRECTORY="target_is_directory",t.PATH_NOT_IN_WORKSPACE="path_not_in_workspace",t.SEARCH_PATH_NOT_FOUND="search_path_not_found",t.SEARCH_PATH_NOT_A_DIRECTORY="search_path_not_a_directory",t.EDIT_PREPARATION_FAILURE="edit_preparation_failure",t.EDIT_NO_OCCURRENCE_FOUND="edit_no_occurrence_found",t.EDIT_EXPECTED_OCCURRENCE_MISMATCH="edit_expected_occurrence_mismatch",t.EDIT_NO_CHANGE="edit_no_change",t.GLOB_EXECUTION_ERROR="glob_execution_error",t.GREP_EXECUTION_ERROR="grep_execution_error",t.LS_EXECUTION_ERROR="ls_execution_error",t.PATH_IS_NOT_A_DIRECTORY="path_is_not_a_directory",t.MCP_TOOL_ERROR="mcp_tool_error",t.MEMORY_TOOL_EXECUTION_ERROR="memory_tool_execution_error",t.READ_MANY_FILES_SEARCH_ERROR="read_many_files_search_error",t.DISCOVERED_TOOL_EXECUTION_ERROR="discovered_tool_execution_error",t.WEB_FETCH_NO_URL_IN_PROMPT="web_fetch_no_url_in_prompt",t.WEB_FETCH_FALLBACK_FAILED="web_fetch_fallback_failed",t.WEB_FETCH_PROCESSING_ERROR="web_fetch_processing_error",t.WEB_SEARCH_FAILED="web_search_failed",t.HOOK_BLOCKED="hook_blocked"})(Va||(Va={}))});function MOn(t){return{text:t.text}}function POn(t,e){return[{text:M.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function LOn(t,e){let r=t.resource;if(r?.text)return{text:r.text};if(r?.blob){let n=r.mimeType||"application/octet-stream";return[{text:M.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function FOn(t){return{text:M.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function UOn(t){let e=t?.[0]?.functionResponse,r=e?.response?.content,n=e?.name||"unknown tool";return Array.isArray(r)?r.flatMap(o=>{switch(o.type){case"text":return MOn(o);case"image":case"audio":return POn(o,n);case"resource":return LOn(o,n);case"resource_link":return FOn(o);default:return null}}).filter(o=>o!==null):[{text:M.t("mcpTool.errors.parseResponseFailed")}]}function QOn(t){let e=t?.[0]?.functionResponse?.response?.content;return Array.isArray(e)?e.map(n=>{switch(n.type){case"text":return n.text;case"image":return M.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return M.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return M.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:M.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||M.t("mcpTool.display.unknownType")});default:return M.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
|
|
835
835
|
`):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function sMt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var Th,eX=ae(()=>{"use strict";y0e();ZK();su();il();Vn();Th=class t extends fo{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??sMt(n),`${n} (${r} MCP Server)`,i,po.Hammer,ho.Other,{type:Lt.OBJECT},!0,!1),this.mcpTool=e,this.serverName=r,this.serverToolName=n,this.parameterSchemaJson=o,this.timeout=s,this.trust=a}asFullyQualifiedTool(){return new t(this.mcpTool,this.serverName,this.serverToolName,this.description,this.parameterSchemaJson,this.timeout,this.trust,`${this.serverName}__${this.serverToolName}`)}get schema(){return{name:this.name,description:this.description,parametersJsonSchema:this.parameterSchemaJson}}async shouldConfirmExecute(e,r){let n=this.serverName,i=`${this.serverName}.${this.serverToolName}`;return this.trust||t.allowlist.has(n)||t.allowlist.has(i)?!1:{type:"mcp",title:M.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===Yr.ProceedAlwaysServer?t.allowlist.add(n):s===Yr.ProceedAlwaysTool&&t.allowlist.add(i)}}}isMCPToolError(e){let n=e?.[0]?.functionResponse?.response;if(n){let i=n?.error,o=i?.isError;if(i&&(o===!0||o==="true"))return!0}return!1}async execute(e){let{callId:r,...n}=e,i=[{name:this.serverToolName,args:n}],o=await this.mcpTool.callTool(i);if(this.isMCPToolError(o)){let a=`MCP tool '${this.serverToolName}' reported tool error for function call: ${xD(i[0])} with response: ${xD(o)}`;return{llmContent:a,returnDisplay:M.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:Va.MCP_TOOL_ERROR}}}return{llmContent:UOn(o),returnDisplay:QOn(o)}}}});var lMt=D((gLo,aMt)=>{"use strict";aMt.exports=function(e){return e.map(function(r){return r===""?"''":r&&typeof r=="object"?r.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(r)&&!/'/.test(r)?"'"+r.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(r)?'"'+r.replace(/(["\\$`!])/g,"\\$1")+'"':String(r).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var mMt=D((ALo,hMt)=>{"use strict";var pMt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",cMt=new RegExp("^"+pMt+"$"),uMt="|&;()<> \\t",qOn='"((\\\\"|[^"])*?)"',GOn="'((\\\\'|[^'])*?)'",HOn=/^#$/,dMt="'",fMt='"',GFe="$",SD="",VOn=4294967296;for(HFe=0;HFe<4;HFe++)SD+=(VOn*Math.random()).toString(16);var HFe,WOn=new RegExp("^"+SD);function $On(t,e){for(var r=e.lastIndex,n=[],i;i=e.exec(t);)n.push(i),e.lastIndex===i.index&&(e.lastIndex+=1);return e.lastIndex=r,n}function jOn(t,e,r){var n=typeof t=="function"?t(r):t[r];return typeof n>"u"&&r!=""?n="":typeof n>"u"&&(n="$"),typeof n=="object"?e+SD+JSON.stringify(n)+SD:e+n}function zOn(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+uMt+`]|[^\\s'"`+uMt+"])+",o=new RegExp(["("+pMt+")","("+i+"|"+qOn+"|"+GOn+")+"].join("|"),"g"),s=$On(t,o);if(s.length===0)return[];e||(e={});var a=!1;return s.map(function(c){var u=c[0];if(!u||a)return;if(cMt.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function g(){m+=1;var E,C,x=u.charAt(m);if(x==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(E=u.indexOf("}",m),E<0)throw new Error("Bad substitution: "+u.slice(m));C=u.slice(m,E),m=E}else if(/[*@#?$!_-]/.test(x))C=x,m+=1;else{var w=u.slice(m);E=w.match(/[^\w\d_]/),E?(C=w.slice(0,E.index),m+=E.index-1):(C=w,m=u.length)}return jOn(e,"",C)}for(m=0;m<u.length;m++){var A=u.charAt(m);if(h=h||!d&&(A==="*"||A==="?"),f)p+=A,f=!1;else if(d)A===d?d=!1:d==dMt?p+=A:A===n?(m+=1,A=u.charAt(m),A===fMt||A===n||A===GFe?p+=A:p+=n+A):A===GFe?p+=g():p+=A;else if(A===fMt||A===dMt)d=A;else{if(cMt.test(A))return{op:u};if(HOn.test(A)){a=!0;var y={comment:t.slice(c.index+m+1)};return p.length?[p,y]:[y]}else A===n?f=!0:A===GFe?p+=g():p+=A}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}hMt.exports=function(e,r,n){var i=zOn(e,r,n);return typeof r!="function"?i:i.reduce(function(o,s){if(typeof s=="object")return o.concat(s);var a=s.split(RegExp("("+SD+".*?"+SD+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return WOn.test(c)?JSON.parse(c.split(SD)[1]):c}))},[])}});var E0e=D(VFe=>{"use strict";VFe.quote=lMt();VFe.parse=mMt()});var xs,WFe,rn,T5,tX=ae(()=>{(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(xs||(xs={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(WFe||(WFe={}));rn=xs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),T5=t=>{switch(typeof t){case"undefined":return rn.undefined;case"string":return rn.string;case"number":return Number.isNaN(t)?rn.nan:rn.number;case"boolean":return rn.boolean;case"function":return rn.function;case"bigint":return rn.bigint;case"symbol":return rn.symbol;case"object":return Array.isArray(t)?rn.array:t===null?rn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?rn.promise:typeof Map<"u"&&t instanceof Map?rn.map:typeof Set<"u"&&t instanceof Set?rn.set:typeof Date<"u"&&t instanceof Date?rn.date:rn.object;default:return rn.unknown}}});var yr,YOn,Vg,v0e=ae(()=>{tX();yr=xs.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"]),YOn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Vg=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xs.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Vg.create=t=>new Vg(t)});var JOn,V8,$Fe=ae(()=>{v0e();tX();JOn=(t,e)=>{let r;switch(t.code){case yr.invalid_type:t.received===rn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case yr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,xs.jsonStringifyReplacer)}`;break;case yr.unrecognized_keys:r=`Unrecognized key(s) in object: ${xs.joinValues(t.keys,", ")}`;break;case yr.invalid_union:r="Invalid input";break;case yr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${xs.joinValues(t.options)}`;break;case yr.invalid_enum_value:r=`Invalid enum value. Expected ${xs.joinValues(t.options)}, received '${t.received}'`;break;case yr.invalid_arguments:r="Invalid function arguments";break;case yr.invalid_return_type:r="Invalid function return type";break;case yr.invalid_date:r="Invalid date";break;case yr.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:xs.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case yr.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case yr.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case yr.custom:r="Invalid input";break;case yr.invalid_intersection_types:r="Intersection results could not be merged";break;case yr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case yr.not_finite:r="Number must be finite";break;default:r=e.defaultError,xs.assertNever(t)}return{message:r}},V8=JOn});function KOn(t){gMt=t}function aU(){return gMt}var gMt,C0e=ae(()=>{$Fe();gMt=V8});function jr(t,e){let r=aU(),n=rX({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===V8?void 0:V8].filter(i=>!!i)});t.common.issues.push(n)}var rX,XOn,Ih,Ii,wD,E0,b0e,x0e,eS,lU,jFe=ae(()=>{C0e();$Fe();rX=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},XOn=[];Ih=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return Ii;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Ii;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},Ii=Object.freeze({status:"aborted"}),wD=t=>({status:"dirty",value:t}),E0=t=>({status:"valid",value:t}),b0e=t=>t.status==="aborted",x0e=t=>t.status==="dirty",eS=t=>t.status==="valid",lU=t=>typeof Promise<"u"&&t instanceof Promise});var AMt=ae(()=>{});var On,yMt=ae(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(On||(On={}))});function ko(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:c}=t;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function bMt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function mkn(t){return new RegExp(`^${bMt(t)}$`)}function xMt(t){let e=`${CMt}T${bMt(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function gkn(t,e){return!!((e==="v4"||!e)&&lkn.test(t)||(e==="v6"||!e)&&ukn.test(t))}function Akn(t,e){if(!ikn.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function ykn(t,e){return!!((e==="v4"||!e)&&ckn.test(t)||(e==="v6"||!e)&&dkn.test(t))}function Ekn(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function cU(t){if(t instanceof Wg){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=_3.create(cU(n))}return new Wg({...t._def,shape:()=>e})}else return t instanceof j8?new j8({...t._def,type:cU(t.element)}):t instanceof _3?_3.create(cU(t.unwrap())):t instanceof D5?D5.create(cU(t.unwrap())):t instanceof I5?I5.create(t.items.map(e=>cU(e))):t}function YFe(t,e){let r=T5(t),n=T5(e);if(t===e)return{valid:!0,data:t};if(r===rn.object&&n===rn.object){let i=xs.objectKeys(e),o=xs.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=YFe(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===rn.array&&n===rn.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],c=YFe(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===rn.date&&n===rn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function SMt(t,e){return new PD({values:t,typeName:Oi.ZodEnum,...ko(e)})}function vMt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function wMt(t,e={},r){return t?rS.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=vMt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=vMt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):rS.create()}var T3,EMt,Jo,ZOn,ekn,tkn,rkn,nkn,ikn,okn,skn,akn,zFe,lkn,ckn,ukn,dkn,fkn,pkn,CMt,hkn,tS,_D,TD,ID,DD,uU,RD,BD,rS,$8,l4,dU,j8,Wg,ND,W8,S0e,OD,I5,w0e,fU,pU,_0e,kD,MD,PD,LD,nS,I3,_3,D5,FD,UD,hU,vkn,nX,iX,QD,Ckn,Oi,bkn,_Mt,TMt,xkn,Skn,IMt,wkn,_kn,Tkn,Ikn,Dkn,Rkn,Bkn,Nkn,Okn,kkn,Mkn,Pkn,Lkn,Fkn,Ukn,Qkn,qkn,Gkn,Hkn,Vkn,Wkn,$kn,jkn,zkn,Ykn,Jkn,Kkn,Xkn,Zkn,eMn,tMn,rMn,nMn,iMn,DMt=ae(()=>{v0e();C0e();yMt();jFe();tX();T3=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}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}},EMt=(t,e)=>{if(eS(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Vg(t.common.issues);return this._error=r,this._error}}};Jo=class{get description(){return this._def.description}_getType(e){return T5(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:T5(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ih,ctx:{common:e.parent.common,data:e.data,parsedType:T5(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(lU(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T5(e)},i=this._parseSync({data:e,path:n.path,parent:n});return EMt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T5(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return eS(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>eS(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:T5(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(lU(i)?i:Promise.resolve(i));return EMt(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:yr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new I3({schema:this,typeName:Oi.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return _3.create(this,this._def)}nullable(){return D5.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j8.create(this)}promise(){return nS.create(this,this._def)}or(e){return ND.create([this,e],this._def)}and(e){return OD.create(this,e,this._def)}transform(e){return new I3({...ko(this._def),schema:this,typeName:Oi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new FD({...ko(this._def),innerType:this,defaultValue:r,typeName:Oi.ZodDefault})}brand(){return new nX({typeName:Oi.ZodBranded,type:this,...ko(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new UD({...ko(this._def),innerType:this,catchValue:r,typeName:Oi.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return iX.create(this,e)}readonly(){return QD.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZOn=/^c[^\s-]{8,}$/i,ekn=/^[0-9a-z]+$/,tkn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rkn=/^[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,nkn=/^[a-z0-9_-]{21}$/i,ikn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,okn=/^[-+]?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)?)??$/,skn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,akn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lkn=/^(?:(?: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])$/,ckn=/^(?:(?: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])$/,ukn=/^(([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]))$/,dkn=/^(([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])$/,fkn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pkn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,CMt="((\\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])))",hkn=new RegExp(`^${CMt}$`);tS=class t extends Jo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==rn.string){let o=this._getOrReturnCtx(e);return jr(o,{code:yr.invalid_type,expected:rn.string,received:o.parsedType}),Ii}let n=new Ih,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?jr(i,{code:yr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&jr(i,{code:yr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")skn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"email",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")zFe||(zFe=new RegExp(akn,"u")),zFe.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"emoji",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")rkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"uuid",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")nkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"nanoid",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")ZOn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"cuid",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")ekn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"cuid2",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")tkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"ulid",code:yr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),jr(i,{validation:"url",code:yr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"regex",code:yr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?xMt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?hkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?mkn(o).test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?okn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"duration",code:yr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?gkn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"ip",code:yr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Akn(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"jwt",code:yr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?ykn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"cidr",code:yr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?fkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"base64",code:yr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?pkn.test(e.data)||(i=this._getOrReturnCtx(e,i),jr(i,{validation:"base64url",code:yr.invalid_string,message:o.message}),n.dirty()):xs.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:yr.invalid_string,...On.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...On.errToObj(e)})}url(e){return this._addCheck({kind:"url",...On.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...On.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...On.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...On.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...On.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...On.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...On.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...On.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...On.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...On.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...On.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...On.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,...On.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,...On.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...On.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...On.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...On.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...On.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...On.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...On.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...On.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...On.errToObj(r)})}nonempty(e){return this.min(1,On.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};tS.create=t=>new tS({checks:[],typeName:Oi.ZodString,coerce:t?.coerce??!1,...ko(t)});_D=class t extends Jo{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)!==rn.number){let o=this._getOrReturnCtx(e);return jr(o,{code:yr.invalid_type,expected:rn.number,received:o.parsedType}),Ii}let n,i=new Ih;for(let o of this._def.checks)o.kind==="int"?xs.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Ekn(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.not_finite,message:o.message}),i.dirty()):xs.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,On.toString(r))}gt(e,r){return this.setLimit("min",e,!1,On.toString(r))}lte(e,r){return this.setLimit("max",e,!0,On.toString(r))}lt(e,r){return this.setLimit("max",e,!1,On.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:On.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:On.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:On.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:On.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:On.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:On.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:On.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:On.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:On.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:On.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xs.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};_D.create=t=>new _D({checks:[],typeName:Oi.ZodNumber,coerce:t?.coerce||!1,...ko(t)});TD=class t extends Jo{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)!==rn.bigint)return this._getInvalidInput(e);let n,i=new Ih;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),jr(n,{code:yr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):xs.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return jr(r,{code:yr.invalid_type,expected:rn.bigint,received:r.parsedType}),Ii}gte(e,r){return this.setLimit("min",e,!0,On.toString(r))}gt(e,r){return this.setLimit("min",e,!1,On.toString(r))}lte(e,r){return this.setLimit("max",e,!0,On.toString(r))}lt(e,r){return this.setLimit("max",e,!1,On.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:On.toString(i)}]})}_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:On.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:On.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:On.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:On.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:On.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};TD.create=t=>new TD({checks:[],typeName:Oi.ZodBigInt,coerce:t?.coerce??!1,...ko(t)});ID=class extends Jo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==rn.boolean){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.boolean,received:n.parsedType}),Ii}return E0(e.data)}};ID.create=t=>new ID({typeName:Oi.ZodBoolean,coerce:t?.coerce||!1,...ko(t)});DD=class t extends Jo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==rn.date){let o=this._getOrReturnCtx(e);return jr(o,{code:yr.invalid_type,expected:rn.date,received:o.parsedType}),Ii}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return jr(o,{code:yr.invalid_date}),Ii}let n=new Ih,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),jr(i,{code:yr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):xs.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:On.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:On.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};DD.create=t=>new DD({checks:[],coerce:t?.coerce||!1,typeName:Oi.ZodDate,...ko(t)});uU=class extends Jo{_parse(e){if(this._getType(e)!==rn.symbol){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.symbol,received:n.parsedType}),Ii}return E0(e.data)}};uU.create=t=>new uU({typeName:Oi.ZodSymbol,...ko(t)});RD=class extends Jo{_parse(e){if(this._getType(e)!==rn.undefined){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.undefined,received:n.parsedType}),Ii}return E0(e.data)}};RD.create=t=>new RD({typeName:Oi.ZodUndefined,...ko(t)});BD=class extends Jo{_parse(e){if(this._getType(e)!==rn.null){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.null,received:n.parsedType}),Ii}return E0(e.data)}};BD.create=t=>new BD({typeName:Oi.ZodNull,...ko(t)});rS=class extends Jo{constructor(){super(...arguments),this._any=!0}_parse(e){return E0(e.data)}};rS.create=t=>new rS({typeName:Oi.ZodAny,...ko(t)});$8=class extends Jo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E0(e.data)}};$8.create=t=>new $8({typeName:Oi.ZodUnknown,...ko(t)});l4=class extends Jo{_parse(e){let r=this._getOrReturnCtx(e);return jr(r,{code:yr.invalid_type,expected:rn.never,received:r.parsedType}),Ii}};l4.create=t=>new l4({typeName:Oi.ZodNever,...ko(t)});dU=class extends Jo{_parse(e){if(this._getType(e)!==rn.undefined){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.void,received:n.parsedType}),Ii}return E0(e.data)}};dU.create=t=>new dU({typeName:Oi.ZodVoid,...ko(t)});j8=class t extends Jo{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==rn.array)return jr(r,{code:yr.invalid_type,expected:rn.array,received:r.parsedType}),Ii;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(jr(r,{code:s?yr.too_big:yr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(jr(r,{code:yr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(jr(r,{code:yr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new T3(r,s,r.path,a)))).then(s=>Ih.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new T3(r,s,r.path,a)));return Ih.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:On.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:On.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:On.toString(r)}})}nonempty(e){return this.min(1,e)}};j8.create=(t,e)=>new j8({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Oi.ZodArray,...ko(e)});Wg=class t extends Jo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=xs.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==rn.object){let u=this._getOrReturnCtx(e);return jr(u,{code:yr.invalid_type,expected:rn.object,received:u.parsedType}),Ii}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof l4&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=o[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new T3(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof l4){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(jr(i,{code:yr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new T3(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>Ih.mergeObjectSync(n,u)):Ih.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return On.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:On.errToObj(e).message??i}:{message:i}}}:{}})}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:Oi.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of xs.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of xs.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return cU(this)}partial(e){let r={};for(let n of xs.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of xs.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof _3;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return SMt(xs.objectKeys(this.shape))}};Wg.create=(t,e)=>new Wg({shape:()=>t,unknownKeys:"strip",catchall:l4.create(),typeName:Oi.ZodObject,...ko(e)});Wg.strictCreate=(t,e)=>new Wg({shape:()=>t,unknownKeys:"strict",catchall:l4.create(),typeName:Oi.ZodObject,...ko(e)});Wg.lazycreate=(t,e)=>new Wg({shape:t,unknownKeys:"strip",catchall:l4.create(),typeName:Oi.ZodObject,...ko(e)});ND=class extends Jo{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Vg(a.ctx.common.issues));return jr(r,{code:yr.invalid_union,unionErrors:s}),Ii}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Vg(c));return jr(r,{code:yr.invalid_union,unionErrors:a}),Ii}}get options(){return this._def.options}};ND.create=(t,e)=>new ND({options:t,typeName:Oi.ZodUnion,...ko(e)});W8=t=>t instanceof kD?W8(t.schema):t instanceof I3?W8(t.innerType()):t instanceof MD?[t.value]:t instanceof PD?t.options:t instanceof LD?xs.objectValues(t.enum):t instanceof FD?W8(t._def.innerType):t instanceof RD?[void 0]:t instanceof BD?[null]:t instanceof _3?[void 0,...W8(t.unwrap())]:t instanceof D5?[null,...W8(t.unwrap())]:t instanceof nX||t instanceof QD?W8(t.unwrap()):t instanceof UD?W8(t._def.innerType):[],S0e=class t extends Jo{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==rn.object)return jr(r,{code:yr.invalid_type,expected:rn.object,received:r.parsedType}),Ii;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(jr(r,{code:yr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ii)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=W8(o.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(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:Oi.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ko(n)})}};OD=class extends Jo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(b0e(o)||b0e(s))return Ii;let a=YFe(o.value,s.value);return a.valid?((x0e(o)||x0e(s))&&r.dirty(),{status:r.value,value:a.data}):(jr(n,{code:yr.invalid_intersection_types}),Ii)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};OD.create=(t,e,r)=>new OD({left:t,right:e,typeName:Oi.ZodIntersection,...ko(r)});I5=class t extends Jo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==rn.array)return jr(n,{code:yr.invalid_type,expected:rn.array,received:n.parsedType}),Ii;if(n.data.length<this._def.items.length)return jr(n,{code:yr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ii;!this._def.rest&&n.data.length>this._def.items.length&&(jr(n,{code:yr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new T3(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Ih.mergeArray(r,s)):Ih.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};I5.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I5({items:t,typeName:Oi.ZodTuple,rest:null,...ko(e)})};w0e=class t extends Jo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==rn.object)return jr(n,{code:yr.invalid_type,expected:rn.object,received:n.parsedType}),Ii;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new T3(n,a,n.path,a)),value:s._parse(new T3(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ih.mergeObjectAsync(r,i):Ih.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Jo?new t({keyType:e,valueType:r,typeName:Oi.ZodRecord,...ko(n)}):new t({keyType:tS.create(),valueType:e,typeName:Oi.ZodRecord,...ko(r)})}},fU=class extends Jo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==rn.map)return jr(n,{code:yr.invalid_type,expected:rn.map,received:n.parsedType}),Ii;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new T3(n,a,n.path,[u,"key"])),value:o._parse(new T3(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Ii;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Ii;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};fU.create=(t,e,r)=>new fU({valueType:e,keyType:t,typeName:Oi.ZodMap,...ko(r)});pU=class t extends Jo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==rn.set)return jr(n,{code:yr.invalid_type,expected:rn.set,received:n.parsedType}),Ii;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(jr(n,{code:yr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(jr(n,{code:yr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let d of c){if(d.status==="aborted")return Ii;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new T3(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:On.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:On.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};pU.create=(t,e)=>new pU({valueType:t,minSize:null,maxSize:null,typeName:Oi.ZodSet,...ko(e)});_0e=class t extends Jo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==rn.function)return jr(r,{code:yr.invalid_type,expected:rn.function,received:r.parsedType}),Ii;function n(a,c){return rX({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,aU(),V8].filter(u=>!!u),issueData:{code:yr.invalid_arguments,argumentsError:c}})}function i(a,c){return rX({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,aU(),V8].filter(u=>!!u),issueData:{code:yr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof nS){let a=this;return E0(async function(...c){let u=new Vg([]),d=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),f=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(h=>{throw u.addIssue(i(f,h)),u})})}else{let a=this;return E0(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Vg([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Vg([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:I5.create(e).rest($8.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||I5.create([]).rest($8.create()),returns:r||$8.create(),typeName:Oi.ZodFunction,...ko(n)})}},kD=class extends Jo{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};kD.create=(t,e)=>new kD({getter:t,typeName:Oi.ZodLazy,...ko(e)});MD=class extends Jo{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return jr(r,{received:r.data,code:yr.invalid_literal,expected:this._def.value}),Ii}return{status:"valid",value:e.data}}get value(){return this._def.value}};MD.create=(t,e)=>new MD({value:t,typeName:Oi.ZodLiteral,...ko(e)});PD=class t extends Jo{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return jr(r,{expected:xs.joinValues(n),received:r.parsedType,code:yr.invalid_type}),Ii}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return jr(r,{received:r.data,code:yr.invalid_enum_value,options:n}),Ii}return E0(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};PD.create=SMt;LD=class extends Jo{_parse(e){let r=xs.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==rn.string&&n.parsedType!==rn.number){let i=xs.objectValues(r);return jr(n,{expected:xs.joinValues(i),received:n.parsedType,code:yr.invalid_type}),Ii}if(this._cache||(this._cache=new Set(xs.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=xs.objectValues(r);return jr(n,{received:n.data,code:yr.invalid_enum_value,options:i}),Ii}return E0(e.data)}get enum(){return this._def.values}};LD.create=(t,e)=>new LD({values:t,typeName:Oi.ZodNativeEnum,...ko(e)});nS=class extends Jo{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==rn.promise&&r.common.async===!1)return jr(r,{code:yr.invalid_type,expected:rn.promise,received:r.parsedType}),Ii;let n=r.parsedType===rn.promise?r.data:Promise.resolve(r.data);return E0(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};nS.create=(t,e)=>new nS({type:t,typeName:Oi.ZodPromise,...ko(e)});I3=class extends Jo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{jr(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Ii;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Ii:c.status==="dirty"?wD(c.value):r.value==="dirty"?wD(c.value):c});{if(r.value==="aborted")return Ii;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Ii:a.status==="dirty"?wD(a.value):r.value==="dirty"?wD(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ii:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Ii:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!eS(s))return Ii;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>eS(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Ii);xs.assertNever(i)}};I3.create=(t,e,r)=>new I3({schema:t,typeName:Oi.ZodEffects,effect:e,...ko(r)});I3.createWithPreprocess=(t,e,r)=>new I3({schema:e,effect:{type:"preprocess",transform:t},typeName:Oi.ZodEffects,...ko(r)});_3=class extends Jo{_parse(e){return this._getType(e)===rn.undefined?E0(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_3.create=(t,e)=>new _3({innerType:t,typeName:Oi.ZodOptional,...ko(e)});D5=class extends Jo{_parse(e){return this._getType(e)===rn.null?E0(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};D5.create=(t,e)=>new D5({innerType:t,typeName:Oi.ZodNullable,...ko(e)});FD=class extends Jo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===rn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};FD.create=(t,e)=>new FD({innerType:t,typeName:Oi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ko(e)});UD=class extends Jo{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return lU(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Vg(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Vg(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};UD.create=(t,e)=>new UD({innerType:t,typeName:Oi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ko(e)});hU=class extends Jo{_parse(e){if(this._getType(e)!==rn.nan){let n=this._getOrReturnCtx(e);return jr(n,{code:yr.invalid_type,expected:rn.nan,received:n.parsedType}),Ii}return{status:"valid",value:e.data}}};hU.create=t=>new hU({typeName:Oi.ZodNaN,...ko(t)});vkn=Symbol("zod_brand"),nX=class extends Jo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},iX=class t extends Jo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ii:o.status==="dirty"?(r.dirty(),wD(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ii:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:Oi.ZodPipeline})}},QD=class extends Jo{_parse(e){let r=this._def.innerType._parse(e),n=i=>(eS(i)&&(i.value=Object.freeze(i.value)),i);return lU(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};QD.create=(t,e)=>new QD({innerType:t,typeName:Oi.ZodReadonly,...ko(e)});Ckn={object:Wg.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"})(Oi||(Oi={}));bkn=(t,e={message:`Input not instance of ${t.name}`})=>wMt(r=>r instanceof t,e),_Mt=tS.create,TMt=_D.create,xkn=hU.create,Skn=TD.create,IMt=ID.create,wkn=DD.create,_kn=uU.create,Tkn=RD.create,Ikn=BD.create,Dkn=rS.create,Rkn=$8.create,Bkn=l4.create,Nkn=dU.create,Okn=j8.create,kkn=Wg.create,Mkn=Wg.strictCreate,Pkn=ND.create,Lkn=S0e.create,Fkn=OD.create,Ukn=I5.create,Qkn=w0e.create,qkn=fU.create,Gkn=pU.create,Hkn=_0e.create,Vkn=kD.create,Wkn=MD.create,$kn=PD.create,jkn=LD.create,zkn=nS.create,Ykn=I3.create,Jkn=_3.create,Kkn=D5.create,Xkn=I3.createWithPreprocess,Zkn=iX.create,eMn=()=>_Mt().optional(),tMn=()=>TMt().optional(),rMn=()=>IMt().optional(),nMn={string:(t=>tS.create({...t,coerce:!0})),number:(t=>_D.create({...t,coerce:!0})),boolean:(t=>ID.create({...t,coerce:!0})),bigint:(t=>TD.create({...t,coerce:!0})),date:(t=>DD.create({...t,coerce:!0}))},iMn=Ii});var te={};Uf(te,{BRAND:()=>vkn,DIRTY:()=>wD,EMPTY_PATH:()=>XOn,INVALID:()=>Ii,NEVER:()=>iMn,OK:()=>E0,ParseStatus:()=>Ih,Schema:()=>Jo,ZodAny:()=>rS,ZodArray:()=>j8,ZodBigInt:()=>TD,ZodBoolean:()=>ID,ZodBranded:()=>nX,ZodCatch:()=>UD,ZodDate:()=>DD,ZodDefault:()=>FD,ZodDiscriminatedUnion:()=>S0e,ZodEffects:()=>I3,ZodEnum:()=>PD,ZodError:()=>Vg,ZodFirstPartyTypeKind:()=>Oi,ZodFunction:()=>_0e,ZodIntersection:()=>OD,ZodIssueCode:()=>yr,ZodLazy:()=>kD,ZodLiteral:()=>MD,ZodMap:()=>fU,ZodNaN:()=>hU,ZodNativeEnum:()=>LD,ZodNever:()=>l4,ZodNull:()=>BD,ZodNullable:()=>D5,ZodNumber:()=>_D,ZodObject:()=>Wg,ZodOptional:()=>_3,ZodParsedType:()=>rn,ZodPipeline:()=>iX,ZodPromise:()=>nS,ZodReadonly:()=>QD,ZodRecord:()=>w0e,ZodSchema:()=>Jo,ZodSet:()=>pU,ZodString:()=>tS,ZodSymbol:()=>uU,ZodTransformer:()=>I3,ZodTuple:()=>I5,ZodType:()=>Jo,ZodUndefined:()=>RD,ZodUnion:()=>ND,ZodUnknown:()=>$8,ZodVoid:()=>dU,addIssueToContext:()=>jr,any:()=>Dkn,array:()=>Okn,bigint:()=>Skn,boolean:()=>IMt,coerce:()=>nMn,custom:()=>wMt,date:()=>wkn,datetimeRegex:()=>xMt,defaultErrorMap:()=>V8,discriminatedUnion:()=>Lkn,effect:()=>Ykn,enum:()=>$kn,function:()=>Hkn,getErrorMap:()=>aU,getParsedType:()=>T5,instanceof:()=>bkn,intersection:()=>Fkn,isAborted:()=>b0e,isAsync:()=>lU,isDirty:()=>x0e,isValid:()=>eS,late:()=>Ckn,lazy:()=>Vkn,literal:()=>Wkn,makeIssue:()=>rX,map:()=>qkn,nan:()=>xkn,nativeEnum:()=>jkn,never:()=>Bkn,null:()=>Ikn,nullable:()=>Kkn,number:()=>TMt,object:()=>kkn,objectUtil:()=>WFe,oboolean:()=>rMn,onumber:()=>tMn,optional:()=>Jkn,ostring:()=>eMn,pipeline:()=>Zkn,preprocess:()=>Xkn,promise:()=>zkn,quotelessJson:()=>YOn,record:()=>Qkn,set:()=>Gkn,setErrorMap:()=>KOn,strictObject:()=>Mkn,string:()=>_Mt,symbol:()=>_kn,transformer:()=>Ykn,tuple:()=>Ukn,undefined:()=>Tkn,union:()=>Pkn,unknown:()=>Rkn,util:()=>xs,void:()=>Nkn});var JFe=ae(()=>{C0e();jFe();AMt();tX();DMt();v0e()});var iS=ae(()=>{JFe();JFe()});var mU,RMt,T0e,BMt,NMt,oMn,B3,$g,oX,R5,N3,I0e,OMt,D0e,kMt,MMt,PMt,sX,D3,LMt,FMt,oS,qD,R0e,aX,UMt,sMn,aMn,lMn,KFe,QMt,qMt,B0e,cMn,N0e,O0e,k0e,GMt,HMt,XFe,VMt,WMt,uMn,dMn,ZFe,fMn,eUe,pMn,tUe,hMn,mMn,gMn,AMn,yMn,EMn,vMn,lX,CMn,rUe,nUe,iUe,bMn,xMn,$Mt,SMn,cX,wMn,_Mn,TMn,IMn,oUe,M0e,$Lo,DMn,RMn,jMt,BMn,NMn,OMn,kMn,MMn,PMn,LMn,FMn,UMn,QMn,qMn,GMn,HMn,VMn,WMn,$Mn,jMn,sUe,zMn,P0e,YMn,JMn,jLo,zLo,YLo,JLo,KLo,XLo,R3,sS=ae(()=>{iS();mU="2025-06-18",RMt=[mU,"2025-03-26","2024-11-05","2024-10-07"],T0e="2.0",BMt=te.union([te.string(),te.number().int()]),NMt=te.string(),oMn=te.object({progressToken:te.optional(BMt)}).passthrough(),B3=te.object({_meta:te.optional(oMn)}).passthrough(),$g=te.object({method:te.string(),params:te.optional(B3)}),oX=te.object({_meta:te.optional(te.object({}).passthrough())}).passthrough(),R5=te.object({method:te.string(),params:te.optional(oX)}),N3=te.object({_meta:te.optional(te.object({}).passthrough())}).passthrough(),I0e=te.union([te.string(),te.number().int()]),OMt=te.object({jsonrpc:te.literal(T0e),id:I0e}).merge($g).strict(),D0e=t=>OMt.safeParse(t).success,kMt=te.object({jsonrpc:te.literal(T0e)}).merge(R5).strict(),MMt=t=>kMt.safeParse(t).success,PMt=te.object({jsonrpc:te.literal(T0e),id:I0e,result:N3}).strict(),sX=t=>PMt.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(D3||(D3={}));LMt=te.object({jsonrpc:te.literal(T0e),id:I0e,error:te.object({code:te.number().int(),message:te.string(),data:te.optional(te.unknown())})}).strict(),FMt=t=>LMt.safeParse(t).success,oS=te.union([OMt,kMt,PMt,LMt]),qD=N3.strict(),R0e=R5.extend({method:te.literal("notifications/cancelled"),params:oX.extend({requestId:I0e,reason:te.string().optional()})}),aX=te.object({name:te.string(),title:te.optional(te.string())}).passthrough(),UMt=aX.extend({version:te.string()}),sMn=te.object({experimental:te.optional(te.object({}).passthrough()),sampling:te.optional(te.object({}).passthrough()),elicitation:te.optional(te.object({}).passthrough()),roots:te.optional(te.object({listChanged:te.optional(te.boolean())}).passthrough())}).passthrough(),aMn=$g.extend({method:te.literal("initialize"),params:B3.extend({protocolVersion:te.string(),capabilities:sMn,clientInfo:UMt})}),lMn=te.object({experimental:te.optional(te.object({}).passthrough()),logging:te.optional(te.object({}).passthrough()),completions:te.optional(te.object({}).passthrough()),prompts:te.optional(te.object({listChanged:te.optional(te.boolean())}).passthrough()),resources:te.optional(te.object({subscribe:te.optional(te.boolean()),listChanged:te.optional(te.boolean())}).passthrough()),tools:te.optional(te.object({listChanged:te.optional(te.boolean())}).passthrough())}).passthrough(),KFe=N3.extend({protocolVersion:te.string(),capabilities:lMn,serverInfo:UMt,instructions:te.optional(te.string())}),QMt=R5.extend({method:te.literal("notifications/initialized")}),qMt=t=>QMt.safeParse(t).success,B0e=$g.extend({method:te.literal("ping")}),cMn=te.object({progress:te.number(),total:te.optional(te.number()),message:te.optional(te.string())}).passthrough(),N0e=R5.extend({method:te.literal("notifications/progress"),params:oX.merge(cMn).extend({progressToken:BMt})}),O0e=$g.extend({params:B3.extend({cursor:te.optional(NMt)}).optional()}),k0e=N3.extend({nextCursor:te.optional(NMt)}),GMt=te.object({uri:te.string(),mimeType:te.optional(te.string()),_meta:te.optional(te.object({}).passthrough())}).passthrough(),HMt=GMt.extend({text:te.string()}),XFe=te.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),VMt=GMt.extend({blob:XFe}),WMt=aX.extend({uri:te.string(),description:te.optional(te.string()),mimeType:te.optional(te.string()),_meta:te.optional(te.object({}).passthrough())}),uMn=aX.extend({uriTemplate:te.string(),description:te.optional(te.string()),mimeType:te.optional(te.string()),_meta:te.optional(te.object({}).passthrough())}),dMn=O0e.extend({method:te.literal("resources/list")}),ZFe=k0e.extend({resources:te.array(WMt)}),fMn=O0e.extend({method:te.literal("resources/templates/list")}),eUe=k0e.extend({resourceTemplates:te.array(uMn)}),pMn=$g.extend({method:te.literal("resources/read"),params:B3.extend({uri:te.string()})}),tUe=N3.extend({contents:te.array(te.union([HMt,VMt]))}),hMn=R5.extend({method:te.literal("notifications/resources/list_changed")}),mMn=$g.extend({method:te.literal("resources/subscribe"),params:B3.extend({uri:te.string()})}),gMn=$g.extend({method:te.literal("resources/unsubscribe"),params:B3.extend({uri:te.string()})}),AMn=R5.extend({method:te.literal("notifications/resources/updated"),params:oX.extend({uri:te.string()})}),yMn=te.object({name:te.string(),description:te.optional(te.string()),required:te.optional(te.boolean())}).passthrough(),EMn=aX.extend({description:te.optional(te.string()),arguments:te.optional(te.array(yMn)),_meta:te.optional(te.object({}).passthrough())}),vMn=O0e.extend({method:te.literal("prompts/list")}),lX=k0e.extend({prompts:te.array(EMn)}),CMn=$g.extend({method:te.literal("prompts/get"),params:B3.extend({name:te.string(),arguments:te.optional(te.record(te.string()))})}),rUe=te.object({type:te.literal("text"),text:te.string(),_meta:te.optional(te.object({}).passthrough())}).passthrough(),nUe=te.object({type:te.literal("image"),data:XFe,mimeType:te.string(),_meta:te.optional(te.object({}).passthrough())}).passthrough(),iUe=te.object({type:te.literal("audio"),data:XFe,mimeType:te.string(),_meta:te.optional(te.object({}).passthrough())}).passthrough(),bMn=te.object({type:te.literal("resource"),resource:te.union([HMt,VMt]),_meta:te.optional(te.object({}).passthrough())}).passthrough(),xMn=WMt.extend({type:te.literal("resource_link")}),$Mt=te.union([rUe,nUe,iUe,xMn,bMn]),SMn=te.object({role:te.enum(["user","assistant"]),content:$Mt}).passthrough(),cX=N3.extend({description:te.optional(te.string()),messages:te.array(SMn)}),wMn=R5.extend({method:te.literal("notifications/prompts/list_changed")}),_Mn=te.object({title:te.optional(te.string()),readOnlyHint:te.optional(te.boolean()),destructiveHint:te.optional(te.boolean()),idempotentHint:te.optional(te.boolean()),openWorldHint:te.optional(te.boolean())}).passthrough(),TMn=aX.extend({description:te.optional(te.string()),inputSchema:te.object({type:te.literal("object"),properties:te.optional(te.object({}).passthrough()),required:te.optional(te.array(te.string()))}).passthrough(),outputSchema:te.optional(te.object({type:te.literal("object"),properties:te.optional(te.object({}).passthrough()),required:te.optional(te.array(te.string()))}).passthrough()),annotations:te.optional(_Mn),_meta:te.optional(te.object({}).passthrough())}),IMn=O0e.extend({method:te.literal("tools/list")}),oUe=k0e.extend({tools:te.array(TMn)}),M0e=N3.extend({content:te.array($Mt).default([]),structuredContent:te.object({}).passthrough().optional(),isError:te.optional(te.boolean())}),$Lo=M0e.or(N3.extend({toolResult:te.unknown()})),DMn=$g.extend({method:te.literal("tools/call"),params:B3.extend({name:te.string(),arguments:te.optional(te.record(te.unknown()))})}),RMn=R5.extend({method:te.literal("notifications/tools/list_changed")}),jMt=te.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),BMn=$g.extend({method:te.literal("logging/setLevel"),params:B3.extend({level:jMt})}),NMn=R5.extend({method:te.literal("notifications/message"),params:oX.extend({level:jMt,logger:te.optional(te.string()),data:te.unknown()})}),OMn=te.object({name:te.string().optional()}).passthrough(),kMn=te.object({hints:te.optional(te.array(OMn)),costPriority:te.optional(te.number().min(0).max(1)),speedPriority:te.optional(te.number().min(0).max(1)),intelligencePriority:te.optional(te.number().min(0).max(1))}).passthrough(),MMn=te.object({role:te.enum(["user","assistant"]),content:te.union([rUe,nUe,iUe])}).passthrough(),PMn=$g.extend({method:te.literal("sampling/createMessage"),params:B3.extend({messages:te.array(MMn),systemPrompt:te.optional(te.string()),includeContext:te.optional(te.enum(["none","thisServer","allServers"])),temperature:te.optional(te.number()),maxTokens:te.number().int(),stopSequences:te.optional(te.array(te.string())),metadata:te.optional(te.object({}).passthrough()),modelPreferences:te.optional(kMn)})}),LMn=N3.extend({model:te.string(),stopReason:te.optional(te.enum(["endTurn","stopSequence","maxTokens"]).or(te.string())),role:te.enum(["user","assistant"]),content:te.discriminatedUnion("type",[rUe,nUe,iUe])}),FMn=te.object({type:te.literal("boolean"),title:te.optional(te.string()),description:te.optional(te.string()),default:te.optional(te.boolean())}).passthrough(),UMn=te.object({type:te.literal("string"),title:te.optional(te.string()),description:te.optional(te.string()),minLength:te.optional(te.number()),maxLength:te.optional(te.number()),format:te.optional(te.enum(["email","uri","date","date-time"]))}).passthrough(),QMn=te.object({type:te.enum(["number","integer"]),title:te.optional(te.string()),description:te.optional(te.string()),minimum:te.optional(te.number()),maximum:te.optional(te.number())}).passthrough(),qMn=te.object({type:te.literal("string"),title:te.optional(te.string()),description:te.optional(te.string()),enum:te.array(te.string()),enumNames:te.optional(te.array(te.string()))}).passthrough(),GMn=te.union([FMn,UMn,QMn,qMn]),HMn=$g.extend({method:te.literal("elicitation/create"),params:B3.extend({message:te.string(),requestedSchema:te.object({type:te.literal("object"),properties:te.record(te.string(),GMn),required:te.optional(te.array(te.string()))}).passthrough()})}),VMn=N3.extend({action:te.enum(["accept","decline","cancel"]),content:te.optional(te.record(te.string(),te.unknown()))}),WMn=te.object({type:te.literal("ref/resource"),uri:te.string()}).passthrough(),$Mn=te.object({type:te.literal("ref/prompt"),name:te.string()}).passthrough(),jMn=$g.extend({method:te.literal("completion/complete"),params:B3.extend({ref:te.union([$Mn,WMn]),argument:te.object({name:te.string(),value:te.string()}).passthrough(),context:te.optional(te.object({arguments:te.optional(te.record(te.string(),te.string()))}))})}),sUe=N3.extend({completion:te.object({values:te.array(te.string()).max(100),total:te.optional(te.number().int()),hasMore:te.optional(te.boolean())}).passthrough()}),zMn=te.object({uri:te.string().startsWith("file://"),name:te.optional(te.string()),_meta:te.optional(te.object({}).passthrough())}).passthrough(),P0e=$g.extend({method:te.literal("roots/list")}),YMn=N3.extend({roots:te.array(zMn)}),JMn=R5.extend({method:te.literal("notifications/roots/list_changed")}),jLo=te.union([B0e,aMn,jMn,BMn,CMn,vMn,dMn,fMn,pMn,mMn,gMn,DMn,IMn]),zLo=te.union([R0e,N0e,QMt,JMn]),YLo=te.union([qD,LMn,VMn,YMn]),JLo=te.union([B0e,PMn,HMn,P0e]),KLo=te.union([R0e,N0e,NMn,AMn,hMn,RMn,wMn]),XLo=te.union([qD,KFe,sUe,cX,lX,ZFe,eUe,tUe,M0e,oUe]),R3=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function zMt(t,e){return Object.entries(e).reduce((r,[n,i])=>(i&&typeof i=="object"?r[n]=r[n]?{...r[n],...i}:i:r[n]=i,r),{...t})}var KMn,L0e,YMt=ae(()=>{sS();KMn=6e4,L0e=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(R0e,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(N0e,r=>{this._onprogress(r)}),this.setRequestHandler(B0e,r=>({}))}_setupTimeout(e,r,n,i,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new R3(D3.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,i;this._transport=e;let o=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{o?.(),this._onclose()};let s=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{s?.(c),this._onerror(c)};let a=(i=this._transport)===null||i===void 0?void 0:i.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),sX(c)||FMt(c)?this._onresponse(c):D0e(c)?this._onrequest(c,u):MMt(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new R3(D3.ConnectionClosed,"Connection closed");for(let i of r.values())i(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){var n,i;let o=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,s=this._transport;if(o===void 0){s?.send({jsonrpc:"2.0",id:e.id,error:{code:D3.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:s?.sessionId,_meta:(i=e.params)===null||i===void 0?void 0:i._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,d,f)=>this.request(u,d,{...f,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>o(e,c)).then(u=>{if(!a.signal.aborted)return s?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var d;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:D3.InternalError,message:(d=u.message)!==null&&d!==void 0?d:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(i),a=this._timeoutInfo.get(i);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){s(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),sX(e))n(e);else{let i=new R3(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}=n??{};return new Promise((a,c)=>{var u,d,f,p,h,m;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(d=n?.signal)===null||d===void 0||d.throwIfAborted();let g=this._requestMessageId++,A={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),A.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:g}});let y=x=>{var w;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(w=this._transport)===null||w===void 0||w.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(x)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`))),c(x)};this._responseHandlers.set(g,x=>{var w;if(!(!((w=n?.signal)===null||w===void 0)&&w.aborted)){if(x instanceof Error)return c(x);try{let O=r.parse(x.result);a(O)}catch(O){c(O)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var x;y((x=n?.signal)===null||x===void 0?void 0:x.reason)});let E=(h=n?.timeout)!==null&&h!==void 0?h:KMn,C=()=>y(new R3(D3.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(g,E,n?.maxTotalTimeout,C,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(A,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(x=>{this._cleanupTimeout(g),c(x)})})}async notification(e,r){var n,i;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((i=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&i!==void 0?i:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(d=>this._onerror(d))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>Promise.resolve(r(e.parse(i),o)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}});var KMt=D((F0e,JMt)=>{(function(t,e){typeof F0e=="object"&&typeof JMt<"u"?e(F0e):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(F0e,(function(t){"use strict";function e(){for(var et=arguments.length,He=Array(et),rt=0;rt<et;rt++)He[rt]=arguments[rt];if(He.length>1){He[0]=He[0].slice(0,-1);for(var pt=He.length-1,gt=1;gt<pt;++gt)He[gt]=He[gt].slice(1,-1);return He[pt]=He[pt].slice(1),He.join("")}else return He[0]}function r(et){return"(?:"+et+")"}function n(et){return et===void 0?"undefined":et===null?"null":Object.prototype.toString.call(et).split(" ").pop().split("]").shift().toLowerCase()}function i(et){return et.toUpperCase()}function o(et){return et!=null?et instanceof Array?et:typeof et.length!="number"||et.split||et.setInterval||et.call?[et]:Array.prototype.slice.call(et):[]}function s(et,He){var rt=et;if(He)for(var pt in He)rt[pt]=He[pt];return rt}function a(et){var He="[A-Za-z]",rt="[\\x0D]",pt="[0-9]",gt="[\\x22]",jt=e(pt,"[A-Fa-f]"),Cr="[\\x0A]",Qr="[\\x20]",hn=r(r("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+r("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+r("%"+jt+jt)),gi="[\\:\\/\\?\\#\\[\\]\\@]",ai="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",$i=e(gi,ai),ji=et?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",In=et?"[\\uE000-\\uF8FF]":"[]",Ti=e(He,pt,"[\\-\\.\\_\\~]",ji),Vo=r(He+e(He,pt,"[\\+\\-\\.]")+"*"),Eo=r(r(hn+"|"+e(Ti,ai,"[\\:]"))+"*"),Pl=r(r("25[0-5]")+"|"+r("2[0-4]"+pt)+"|"+r("1"+pt+pt)+"|"+r("[1-9]"+pt)+"|"+pt),Pa=r(r("25[0-5]")+"|"+r("2[0-4]"+pt)+"|"+r("1"+pt+pt)+"|"+r("0?[1-9]"+pt)+"|0?0?"+pt),Ll=r(Pa+"\\."+Pa+"\\."+Pa+"\\."+Pa),lo=r(jt+"{1,4}"),hc=r(r(lo+"\\:"+lo)+"|"+Ll),Lo=r(r(lo+"\\:")+"{6}"+hc),Pi=r("\\:\\:"+r(lo+"\\:")+"{5}"+hc),Ad=r(r(lo)+"?\\:\\:"+r(lo+"\\:")+"{4}"+hc),mc=r(r(r(lo+"\\:")+"{0,1}"+lo)+"?\\:\\:"+r(lo+"\\:")+"{3}"+hc),yd=r(r(r(lo+"\\:")+"{0,2}"+lo)+"?\\:\\:"+r(lo+"\\:")+"{2}"+hc),Ed=r(r(r(lo+"\\:")+"{0,3}"+lo)+"?\\:\\:"+lo+"\\:"+hc),La=r(r(r(lo+"\\:")+"{0,4}"+lo)+"?\\:\\:"+hc),Gs=r(r(r(lo+"\\:")+"{0,5}"+lo)+"?\\:\\:"+lo),gc=r(r(r(lo+"\\:")+"{0,6}"+lo)+"?\\:\\:"),Pe=r([Lo,Pi,Ad,mc,yd,Ed,La,Gs,gc].join("|")),Ue=r(r(Ti+"|"+hn)+"+"),st=r(Pe+"\\%25"+Ue),ft=r(Pe+r("\\%25|\\%(?!"+jt+"{2})")+Ue),Ct=r("[vV]"+jt+"+\\."+e(Ti,ai,"[\\:]")+"+"),kt=r("\\["+r(ft+"|"+Pe+"|"+Ct)+"\\]"),nr=r(r(hn+"|"+e(Ti,ai))+"*"),er=r(kt+"|"+Ll+"(?!"+nr+")|"+nr),mr=r(pt+"*"),gr=r(r(Eo+"@")+"?"+er+r("\\:"+mr)+"?"),wr=r(hn+"|"+e(Ti,ai,"[\\:\\@]")),Bn=r(wr+"*"),Xi=r(wr+"+"),rs=r(r(hn+"|"+e(Ti,ai,"[\\@]"))+"+"),Ri=r(r("\\/"+Bn)+"*"),ml=r("\\/"+r(Xi+Ri)+"?"),Ac=r(rs+Ri),Kd=r(Xi+Ri),gl="(?!"+wr+")",UA=r(Ri+"|"+ml+"|"+Ac+"|"+Kd+"|"+gl),pp=r(r(wr+"|"+e("[\\/\\?]",In))+"*"),fh=r(r(wr+"|[\\/\\?]")+"*"),Cm=r(r("\\/\\/"+gr+Ri)+"|"+ml+"|"+Kd+"|"+gl),p6=r(Vo+"\\:"+Cm+r("\\?"+pp)+"?"+r("\\#"+fh)+"?"),K2=r(r("\\/\\/"+gr+Ri)+"|"+ml+"|"+Ac+"|"+gl),wu=r(K2+r("\\?"+pp)+"?"+r("\\#"+fh)+"?"),Sg=r(p6+"|"+wu),_u=r(Vo+"\\:"+Cm+r("\\?"+pp)+"?"),Xd="^("+Vo+")\\:"+r(r("\\/\\/("+r("("+Eo+")@")+"?("+er+")"+r("\\:("+mr+")")+"?)")+"?("+Ri+"|"+ml+"|"+Kd+"|"+gl+")")+r("\\?("+pp+")")+"?"+r("\\#("+fh+")")+"?$",bm="^(){0}"+r(r("\\/\\/("+r("("+Eo+")@")+"?("+er+")"+r("\\:("+mr+")")+"?)")+"?("+Ri+"|"+ml+"|"+Ac+"|"+gl+")")+r("\\?("+pp+")")+"?"+r("\\#("+fh+")")+"?$",d0="^("+Vo+")\\:"+r(r("\\/\\/("+r("("+Eo+")@")+"?("+er+")"+r("\\:("+mr+")")+"?)")+"?("+Ri+"|"+ml+"|"+Kd+"|"+gl+")")+r("\\?("+pp+")")+"?$",Tu="^"+r("\\#("+fh+")")+"?$",wg="^"+r("("+Eo+")@")+"?("+er+")"+r("\\:("+mr+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",He,pt,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Ti,ai),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Ti,ai),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Ti,ai),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Ti,ai),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Ti,ai,"[\\:\\@\\/\\?]",In),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Ti,ai,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Ti,ai),"g"),UNRESERVED:new RegExp(Ti,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Ti,$i),"g"),PCT_ENCODED:new RegExp(hn,"g"),IPV4ADDRESS:new RegExp("^("+Ll+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Pe+")"+r(r("\\%25|\\%(?!"+jt+"{2})")+"("+Ue+")")+"?\\]?$")}}var c=a(!1),u=a(!0),d=(function(){function et(He,rt){var pt=[],gt=!0,jt=!1,Cr=void 0;try{for(var Qr=He[Symbol.iterator](),hn;!(gt=(hn=Qr.next()).done)&&(pt.push(hn.value),!(rt&&pt.length===rt));gt=!0);}catch(gi){jt=!0,Cr=gi}finally{try{!gt&&Qr.return&&Qr.return()}finally{if(jt)throw Cr}}return pt}return function(He,rt){if(Array.isArray(He))return He;if(Symbol.iterator in Object(He))return et(He,rt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),f=function(et){if(Array.isArray(et)){for(var He=0,rt=Array(et.length);He<et.length;He++)rt[He]=et[He];return rt}else return Array.from(et)},p=2147483647,h=36,m=1,g=26,A=38,y=700,E=72,C=128,x="-",w=/^xn--/,O=/[^\0-\x7E]/,N=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-m,k=Math.floor,B=String.fromCharCode;function F(et){throw new RangeError(U[et])}function L(et,He){for(var rt=[],pt=et.length;pt--;)rt[pt]=He(et[pt]);return rt}function R(et,He){var rt=et.split("@"),pt="";rt.length>1&&(pt=rt[0]+"@",et=rt[1]),et=et.replace(N,".");var gt=et.split("."),jt=L(gt,He).join(".");return pt+jt}function q(et){for(var He=[],rt=0,pt=et.length;rt<pt;){var gt=et.charCodeAt(rt++);if(gt>=55296&><=56319&&rt<pt){var jt=et.charCodeAt(rt++);(jt&64512)==56320?He.push(((gt&1023)<<10)+(jt&1023)+65536):(He.push(gt),rt--)}else He.push(gt)}return He}var Q=function(He){return String.fromCodePoint.apply(String,f(He))},V=function(He){return He-48<10?He-22:He-65<26?He-65:He-97<26?He-97:h},H=function(He,rt){return He+22+75*(He<26)-((rt!=0)<<5)},J=function(He,rt,pt){var gt=0;for(He=pt?k(He/y):He>>1,He+=k(He/rt);He>S*g>>1;gt+=h)He=k(He/S);return k(gt+(S+1)*He/(He+A))},X=function(He){var rt=[],pt=He.length,gt=0,jt=C,Cr=E,Qr=He.lastIndexOf(x);Qr<0&&(Qr=0);for(var hn=0;hn<Qr;++hn)He.charCodeAt(hn)>=128&&F("not-basic"),rt.push(He.charCodeAt(hn));for(var gi=Qr>0?Qr+1:0;gi<pt;){for(var ai=gt,$i=1,ji=h;;ji+=h){gi>=pt&&F("invalid-input");var In=V(He.charCodeAt(gi++));(In>=h||In>k((p-gt)/$i))&&F("overflow"),gt+=In*$i;var Ti=ji<=Cr?m:ji>=Cr+g?g:ji-Cr;if(In<Ti)break;var Vo=h-Ti;$i>k(p/Vo)&&F("overflow"),$i*=Vo}var Eo=rt.length+1;Cr=J(gt-ai,Eo,ai==0),k(gt/Eo)>p-jt&&F("overflow"),jt+=k(gt/Eo),gt%=Eo,rt.splice(gt++,0,jt)}return String.fromCodePoint.apply(String,rt)},he=function(He){var rt=[];He=q(He);var pt=He.length,gt=C,jt=0,Cr=E,Qr=!0,hn=!1,gi=void 0;try{for(var ai=He[Symbol.iterator](),$i;!(Qr=($i=ai.next()).done);Qr=!0){var ji=$i.value;ji<128&&rt.push(B(ji))}}catch(ft){hn=!0,gi=ft}finally{try{!Qr&&ai.return&&ai.return()}finally{if(hn)throw gi}}var In=rt.length,Ti=In;for(In&&rt.push(x);Ti<pt;){var Vo=p,Eo=!0,Pl=!1,Pa=void 0;try{for(var Ll=He[Symbol.iterator](),lo;!(Eo=(lo=Ll.next()).done);Eo=!0){var hc=lo.value;hc>=gt&&hc<Vo&&(Vo=hc)}}catch(ft){Pl=!0,Pa=ft}finally{try{!Eo&&Ll.return&&Ll.return()}finally{if(Pl)throw Pa}}var Lo=Ti+1;Vo-gt>k((p-jt)/Lo)&&F("overflow"),jt+=(Vo-gt)*Lo,gt=Vo;var Pi=!0,Ad=!1,mc=void 0;try{for(var yd=He[Symbol.iterator](),Ed;!(Pi=(Ed=yd.next()).done);Pi=!0){var La=Ed.value;if(La<gt&&++jt>p&&F("overflow"),La==gt){for(var Gs=jt,gc=h;;gc+=h){var Pe=gc<=Cr?m:gc>=Cr+g?g:gc-Cr;if(Gs<Pe)break;var Ue=Gs-Pe,st=h-Pe;rt.push(B(H(Pe+Ue%st,0))),Gs=k(Ue/st)}rt.push(B(H(Gs,0))),Cr=J(jt,Lo,Ti==In),jt=0,++Ti}}}catch(ft){Ad=!0,mc=ft}finally{try{!Pi&&yd.return&&yd.return()}finally{if(Ad)throw mc}}++jt,++gt}return rt.join("")},Ce=function(He){return R(He,function(rt){return w.test(rt)?X(rt.slice(4).toLowerCase()):rt})},ge=function(He){return R(He,function(rt){return O.test(rt)?"xn--"+he(rt):rt})},be={version:"2.1.0",ucs2:{decode:q,encode:Q},decode:X,encode:he,toASCII:ge,toUnicode:Ce},xe={};function se(et){var He=et.charCodeAt(0),rt=void 0;return He<16?rt="%0"+He.toString(16).toUpperCase():He<128?rt="%"+He.toString(16).toUpperCase():He<2048?rt="%"+(He>>6|192).toString(16).toUpperCase()+"%"+(He&63|128).toString(16).toUpperCase():rt="%"+(He>>12|224).toString(16).toUpperCase()+"%"+(He>>6&63|128).toString(16).toUpperCase()+"%"+(He&63|128).toString(16).toUpperCase(),rt}function me(et){for(var He="",rt=0,pt=et.length;rt<pt;){var gt=parseInt(et.substr(rt+1,2),16);if(gt<128)He+=String.fromCharCode(gt),rt+=3;else if(gt>=194&><224){if(pt-rt>=6){var jt=parseInt(et.substr(rt+4,2),16);He+=String.fromCharCode((gt&31)<<6|jt&63)}else He+=et.substr(rt,6);rt+=6}else if(gt>=224){if(pt-rt>=9){var Cr=parseInt(et.substr(rt+4,2),16),Qr=parseInt(et.substr(rt+7,2),16);He+=String.fromCharCode((gt&15)<<12|(Cr&63)<<6|Qr&63)}else He+=et.substr(rt,9);rt+=9}else He+=et.substr(rt,3),rt+=3}return He}function ve(et,He){function rt(pt){var gt=me(pt);return gt.match(He.UNRESERVED)?gt:pt}return et.scheme&&(et.scheme=String(et.scheme).replace(He.PCT_ENCODED,rt).toLowerCase().replace(He.NOT_SCHEME,"")),et.userinfo!==void 0&&(et.userinfo=String(et.userinfo).replace(He.PCT_ENCODED,rt).replace(He.NOT_USERINFO,se).replace(He.PCT_ENCODED,i)),et.host!==void 0&&(et.host=String(et.host).replace(He.PCT_ENCODED,rt).toLowerCase().replace(He.NOT_HOST,se).replace(He.PCT_ENCODED,i)),et.path!==void 0&&(et.path=String(et.path).replace(He.PCT_ENCODED,rt).replace(et.scheme?He.NOT_PATH:He.NOT_PATH_NOSCHEME,se).replace(He.PCT_ENCODED,i)),et.query!==void 0&&(et.query=String(et.query).replace(He.PCT_ENCODED,rt).replace(He.NOT_QUERY,se).replace(He.PCT_ENCODED,i)),et.fragment!==void 0&&(et.fragment=String(et.fragment).replace(He.PCT_ENCODED,rt).replace(He.NOT_FRAGMENT,se).replace(He.PCT_ENCODED,i)),et}function ee(et){return et.replace(/^0*(.*)/,"$1")||"0"}function ce(et,He){var rt=et.match(He.IPV4ADDRESS)||[],pt=d(rt,2),gt=pt[1];return gt?gt.split(".").map(ee).join("."):et}function Y(et,He){var rt=et.match(He.IPV6ADDRESS)||[],pt=d(rt,3),gt=pt[1],jt=pt[2];if(gt){for(var Cr=gt.toLowerCase().split("::").reverse(),Qr=d(Cr,2),hn=Qr[0],gi=Qr[1],ai=gi?gi.split(":").map(ee):[],$i=hn.split(":").map(ee),ji=He.IPV4ADDRESS.test($i[$i.length-1]),In=ji?7:8,Ti=$i.length-In,Vo=Array(In),Eo=0;Eo<In;++Eo)Vo[Eo]=ai[Eo]||$i[Ti+Eo]||"";ji&&(Vo[In-1]=ce(Vo[In-1],He));var Pl=Vo.reduce(function(Lo,Pi,Ad){if(!Pi||Pi==="0"){var mc=Lo[Lo.length-1];mc&&mc.index+mc.length===Ad?mc.length++:Lo.push({index:Ad,length:1})}return Lo},[]),Pa=Pl.sort(function(Lo,Pi){return Pi.length-Lo.length})[0],Ll=void 0;if(Pa&&Pa.length>1){var lo=Vo.slice(0,Pa.index),hc=Vo.slice(Pa.index+Pa.length);Ll=lo.join(":")+"::"+hc.join(":")}else Ll=Vo.join(":");return jt&&(Ll+="%"+jt),Ll}else return et}var re=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ue="".match(/(){0}/)[1]===void 0;function Z(et){var He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},rt={},pt=He.iri!==!1?u:c;He.reference==="suffix"&&(et=(He.scheme?He.scheme+":":"")+"//"+et);var gt=et.match(re);if(gt){ue?(rt.scheme=gt[1],rt.userinfo=gt[3],rt.host=gt[4],rt.port=parseInt(gt[5],10),rt.path=gt[6]||"",rt.query=gt[7],rt.fragment=gt[8],isNaN(rt.port)&&(rt.port=gt[5])):(rt.scheme=gt[1]||void 0,rt.userinfo=et.indexOf("@")!==-1?gt[3]:void 0,rt.host=et.indexOf("//")!==-1?gt[4]:void 0,rt.port=parseInt(gt[5],10),rt.path=gt[6]||"",rt.query=et.indexOf("?")!==-1?gt[7]:void 0,rt.fragment=et.indexOf("#")!==-1?gt[8]:void 0,isNaN(rt.port)&&(rt.port=et.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?gt[4]:void 0)),rt.host&&(rt.host=Y(ce(rt.host,pt),pt)),rt.scheme===void 0&&rt.userinfo===void 0&&rt.host===void 0&&rt.port===void 0&&!rt.path&&rt.query===void 0?rt.reference="same-document":rt.scheme===void 0?rt.reference="relative":rt.fragment===void 0?rt.reference="absolute":rt.reference="uri",He.reference&&He.reference!=="suffix"&&He.reference!==rt.reference&&(rt.error=rt.error||"URI is not a "+He.reference+" reference.");var jt=xe[(He.scheme||rt.scheme||"").toLowerCase()];if(!He.unicodeSupport&&(!jt||!jt.unicodeSupport)){if(rt.host&&(He.domainHost||jt&&jt.domainHost))try{rt.host=be.toASCII(rt.host.replace(pt.PCT_ENCODED,me).toLowerCase())}catch(Cr){rt.error=rt.error||"Host's domain name can not be converted to ASCII via punycode: "+Cr}ve(rt,c)}else ve(rt,pt);jt&&jt.parse&&jt.parse(rt,He)}else rt.error=rt.error||"URI can not be parsed.";return rt}function $(et,He){var rt=He.iri!==!1?u:c,pt=[];return et.userinfo!==void 0&&(pt.push(et.userinfo),pt.push("@")),et.host!==void 0&&pt.push(Y(ce(String(et.host),rt),rt).replace(rt.IPV6ADDRESS,function(gt,jt,Cr){return"["+jt+(Cr?"%25"+Cr:"")+"]"})),(typeof et.port=="number"||typeof et.port=="string")&&(pt.push(":"),pt.push(String(et.port))),pt.length?pt.join(""):void 0}var j=/^\.\.?\//,Ee=/^\/\.(\/|$)/,de=/^\/\.\.(\/|$)/,z=/^\/?(?:.|\n)*?(?=\/|$)/;function Te(et){for(var He=[];et.length;)if(et.match(j))et=et.replace(j,"");else if(et.match(Ee))et=et.replace(Ee,"/");else if(et.match(de))et=et.replace(de,"/"),He.pop();else if(et==="."||et==="..")et="";else{var rt=et.match(z);if(rt){var pt=rt[0];et=et.slice(pt.length),He.push(pt)}else throw new Error("Unexpected dot segment condition")}return He.join("")}function Be(et){var He=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},rt=He.iri?u:c,pt=[],gt=xe[(He.scheme||et.scheme||"").toLowerCase()];if(gt&>.serialize&>.serialize(et,He),et.host&&!rt.IPV6ADDRESS.test(et.host)){if(He.domainHost||gt&>.domainHost)try{et.host=He.iri?be.toUnicode(et.host):be.toASCII(et.host.replace(rt.PCT_ENCODED,me).toLowerCase())}catch(Qr){et.error=et.error||"Host's domain name can not be converted to "+(He.iri?"Unicode":"ASCII")+" via punycode: "+Qr}}ve(et,rt),He.reference!=="suffix"&&et.scheme&&(pt.push(et.scheme),pt.push(":"));var jt=$(et,He);if(jt!==void 0&&(He.reference!=="suffix"&&pt.push("//"),pt.push(jt),et.path&&et.path.charAt(0)!=="/"&&pt.push("/")),et.path!==void 0){var Cr=et.path;!He.absolutePath&&(!gt||!gt.absolutePath)&&(Cr=Te(Cr)),jt===void 0&&(Cr=Cr.replace(/^\/\//,"/%2F")),pt.push(Cr)}return et.query!==void 0&&(pt.push("?"),pt.push(et.query)),et.fragment!==void 0&&(pt.push("#"),pt.push(et.fragment)),pt.join("")}function Oe(et,He){var rt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},pt=arguments[3],gt={};return pt||(et=Z(Be(et,rt),rt),He=Z(Be(He,rt),rt)),rt=rt||{},!rt.tolerant&&He.scheme?(gt.scheme=He.scheme,gt.userinfo=He.userinfo,gt.host=He.host,gt.port=He.port,gt.path=Te(He.path||""),gt.query=He.query):(He.userinfo!==void 0||He.host!==void 0||He.port!==void 0?(gt.userinfo=He.userinfo,gt.host=He.host,gt.port=He.port,gt.path=Te(He.path||""),gt.query=He.query):(He.path?(He.path.charAt(0)==="/"?gt.path=Te(He.path):((et.userinfo!==void 0||et.host!==void 0||et.port!==void 0)&&!et.path?gt.path="/"+He.path:et.path?gt.path=et.path.slice(0,et.path.lastIndexOf("/")+1)+He.path:gt.path=He.path,gt.path=Te(gt.path)),gt.query=He.query):(gt.path=et.path,He.query!==void 0?gt.query=He.query:gt.query=et.query),gt.userinfo=et.userinfo,gt.host=et.host,gt.port=et.port),gt.scheme=et.scheme),gt.fragment=He.fragment,gt}function ke(et,He,rt){var pt=s({scheme:"null"},rt);return Be(Oe(Z(et,pt),Z(He,pt),pt,!0),pt)}function le(et,He){return typeof et=="string"?et=Be(Z(et,He),He):n(et)==="object"&&(et=Z(Be(et,He),He)),et}function Ie(et,He,rt){return typeof et=="string"?et=Be(Z(et,rt),rt):n(et)==="object"&&(et=Be(et,rt)),typeof He=="string"?He=Be(Z(He,rt),rt):n(He)==="object"&&(He=Be(He,rt)),et===He}function De(et,He){return et&&et.toString().replace(!He||!He.iri?c.ESCAPE:u.ESCAPE,se)}function Re(et,He){return et&&et.toString().replace(!He||!He.iri?c.PCT_ENCODED:u.PCT_ENCODED,me)}var Ge={scheme:"http",domainHost:!0,parse:function(He,rt){return He.host||(He.error=He.error||"HTTP URIs must have a host."),He},serialize:function(He,rt){var pt=String(He.scheme).toLowerCase()==="https";return(He.port===(pt?443:80)||He.port==="")&&(He.port=void 0),He.path||(He.path="/"),He}},Ke={scheme:"https",domainHost:Ge.domainHost,parse:Ge.parse,serialize:Ge.serialize};function tt(et){return typeof et.secure=="boolean"?et.secure:String(et.scheme).toLowerCase()==="wss"}var ut={scheme:"ws",domainHost:!0,parse:function(He,rt){var pt=He;return pt.secure=tt(pt),pt.resourceName=(pt.path||"/")+(pt.query?"?"+pt.query:""),pt.path=void 0,pt.query=void 0,pt},serialize:function(He,rt){if((He.port===(tt(He)?443:80)||He.port==="")&&(He.port=void 0),typeof He.secure=="boolean"&&(He.scheme=He.secure?"wss":"ws",He.secure=void 0),He.resourceName){var pt=He.resourceName.split("?"),gt=d(pt,2),jt=gt[0],Cr=gt[1];He.path=jt&&jt!=="/"?jt:void 0,He.query=Cr,He.resourceName=void 0}return He.fragment=void 0,He}},ht={scheme:"wss",domainHost:ut.domainHost,parse:ut.parse,serialize:ut.serialize},Jt={},Sr=!0,br="[A-Za-z0-9\\-\\.\\_\\~"+(Sr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",fr="[0-9A-Fa-f]",wt=r(r("%[EFef]"+fr+"%"+fr+fr+"%"+fr+fr)+"|"+r("%[89A-Fa-f]"+fr+"%"+fr+fr)+"|"+r("%"+fr+fr)),vr="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",sr="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Pt=e(sr,'[\\"\\\\]'),Kt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",rr=new RegExp(br,"g"),Ar=new RegExp(wt,"g"),Cn=new RegExp(e("[^]",vr,"[\\.]",'[\\"]',Pt),"g"),Hr=new RegExp(e("[^]",br,Kt),"g"),Fr=Hr;function Jr(et){var He=me(et);return He.match(rr)?He:et}var si={scheme:"mailto",parse:function(He,rt){var pt=He,gt=pt.to=pt.path?pt.path.split(","):[];if(pt.path=void 0,pt.query){for(var jt=!1,Cr={},Qr=pt.query.split("&"),hn=0,gi=Qr.length;hn<gi;++hn){var ai=Qr[hn].split("=");switch(ai[0]){case"to":for(var $i=ai[1].split(","),ji=0,In=$i.length;ji<In;++ji)gt.push($i[ji]);break;case"subject":pt.subject=Re(ai[1],rt);break;case"body":pt.body=Re(ai[1],rt);break;default:jt=!0,Cr[Re(ai[0],rt)]=Re(ai[1],rt);break}}jt&&(pt.headers=Cr)}pt.query=void 0;for(var Ti=0,Vo=gt.length;Ti<Vo;++Ti){var Eo=gt[Ti].split("@");if(Eo[0]=Re(Eo[0]),rt.unicodeSupport)Eo[1]=Re(Eo[1],rt).toLowerCase();else try{Eo[1]=be.toASCII(Re(Eo[1],rt).toLowerCase())}catch(Pl){pt.error=pt.error||"Email address's domain name can not be converted to ASCII via punycode: "+Pl}gt[Ti]=Eo.join("@")}return pt},serialize:function(He,rt){var pt=He,gt=o(He.to);if(gt){for(var jt=0,Cr=gt.length;jt<Cr;++jt){var Qr=String(gt[jt]),hn=Qr.lastIndexOf("@"),gi=Qr.slice(0,hn).replace(Ar,Jr).replace(Ar,i).replace(Cn,se),ai=Qr.slice(hn+1);try{ai=rt.iri?be.toUnicode(ai):be.toASCII(Re(ai,rt).toLowerCase())}catch(Ti){pt.error=pt.error||"Email address's domain name can not be converted to "+(rt.iri?"Unicode":"ASCII")+" via punycode: "+Ti}gt[jt]=gi+"@"+ai}pt.path=gt.join(",")}var $i=He.headers=He.headers||{};He.subject&&($i.subject=He.subject),He.body&&($i.body=He.body);var ji=[];for(var In in $i)$i[In]!==Jt[In]&&ji.push(In.replace(Ar,Jr).replace(Ar,i).replace(Hr,se)+"="+$i[In].replace(Ar,Jr).replace(Ar,i).replace(Fr,se));return ji.length&&(pt.query=ji.join("&")),pt}},mi=/^([^\:]+)\:(.*)/,Rn={scheme:"urn",parse:function(He,rt){var pt=He.path&&He.path.match(mi),gt=He;if(pt){var jt=rt.scheme||gt.scheme||"urn",Cr=pt[1].toLowerCase(),Qr=pt[2],hn=jt+":"+(rt.nid||Cr),gi=xe[hn];gt.nid=Cr,gt.nss=Qr,gt.path=void 0,gi&&(gt=gi.parse(gt,rt))}else gt.error=gt.error||"URN can not be parsed.";return gt},serialize:function(He,rt){var pt=rt.scheme||He.scheme||"urn",gt=He.nid,jt=pt+":"+(rt.nid||gt),Cr=xe[jt];Cr&&(He=Cr.serialize(He,rt));var Qr=He,hn=He.nss;return Qr.path=(gt||rt.nid)+":"+hn,Qr}},ao=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Wi={scheme:"urn:uuid",parse:function(He,rt){var pt=He;return pt.uuid=pt.nss,pt.nss=void 0,!rt.tolerant&&(!pt.uuid||!pt.uuid.match(ao))&&(pt.error=pt.error||"UUID is not valid."),pt},serialize:function(He,rt){var pt=He;return pt.nss=(He.uuid||"").toLowerCase(),pt}};xe[Ge.scheme]=Ge,xe[Ke.scheme]=Ke,xe[ut.scheme]=ut,xe[ht.scheme]=ht,xe[si.scheme]=si,xe[Rn.scheme]=Rn,xe[Wi.scheme]=Wi,t.SCHEMES=xe,t.pctEncChar=se,t.pctDecChars=me,t.parse=Z,t.removeDotSegments=Te,t.serialize=Be,t.resolveComponents=Oe,t.resolve=ke,t.normalize=le,t.equal=Ie,t.escapeComponent=De,t.unescapeComponent=Re,Object.defineProperty(t,"__esModule",{value:!0})}))});var gU=D((rFo,XMt)=>{"use strict";XMt.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var s=o[i];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var ePt=D((nFo,ZMt)=>{"use strict";ZMt.exports=function(e){for(var r=0,n=e.length,i=0,o;i<n;)r++,o=e.charCodeAt(i++),o>=55296&&o<=56319&&i<n&&(o=e.charCodeAt(i),(o&64512)==56320&&i++);return r}});var GD=D((iFo,nPt)=>{"use strict";nPt.exports={copy:XMn,checkDataType:aUe,checkDataTypes:ZMn,coerceToTypes:ePn,toHash:cUe,getProperty:uUe,escapeQuotes:dUe,equal:gU(),ucs2length:ePt(),varOccurences:nPn,varReplace:iPn,schemaHasRules:oPn,schemaHasRulesExcept:sPn,schemaUnknownRules:aPn,toQuotedString:lUe,getPathExpr:lPn,getPath:cPn,getData:fPn,unescapeFragment:pPn,unescapeJsonPointer:pUe,escapeFragment:hPn,escapeJsonPointer:fUe};function XMn(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function aUe(t,e,r,n){var i=n?" !== ":" === ",o=n?" || ":" && ",s=n?"!":"",a=n?"":"!";switch(t){case"null":return e+i+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+o+"typeof "+e+i+'"object"'+o+a+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+i+'"number"'+o+a+"("+e+" % 1)"+o+e+i+e+(r?o+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+i+'"'+t+'"'+(r?o+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+i+'"'+t+'"'}}function ZMn(t,e,r){switch(t.length){case 1:return aUe(t[0],e,r,!0);default:var n="",i=cUe(t);i.array&&i.object&&(n=i.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer;for(var o in i)n+=(n?" && ":"")+aUe(o,e,r,!0);return n}}var tPt=cUe(["string","number","integer","boolean","null"]);function ePn(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(tPt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(tPt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function cUe(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var tPn=/^[a-z$_][a-z$_0-9]*$/i,rPn=/'|\\/g;function uUe(t){return typeof t=="number"?"["+t+"]":tPn.test(t)?"."+t:"['"+dUe(t)+"']"}function dUe(t){return t.replace(rPn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function nPn(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function iPn(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function oPn(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function sPn(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function aPn(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function lUe(t){return"'"+dUe(t)+"'"}function lPn(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return rPt(t,i)}function cPn(t,e,r){var n=lUe(r?"/"+fUe(e):uUe(e));return rPt(t,n)}var uPn=/^\/(?:[^~]|~0|~1)*$/,dPn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fPn(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!uPn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(dPn),!s)throw new Error("Invalid JSON-pointer: "+t);if(n=+s[1],i=s[2],i=="#"){if(n>=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(o="data"+(e-n||""),!i)return o}for(var a=o,c=i.split("/"),u=0;u<c.length;u++){var d=c[u];d&&(o+=uUe(pUe(d)),a+=" && "+o)}return a}function rPt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function pPn(t){return pUe(decodeURIComponent(t))}function hPn(t){return encodeURIComponent(fUe(t))}function fUe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function pUe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var hUe=D((oFo,iPt)=>{"use strict";var mPn=GD();iPt.exports=gPn;function gPn(t){mPn.copy(t,this)}});var sPt=D((sFo,oPt)=>{"use strict";var aS=oPt.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};U0e(e,n,i,t,"",t)};aS.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};aS.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};aS.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};aS.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function U0e(t,e,r,n,i,o,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,o,s,a,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in aS.arrayKeywords)for(var p=0;p<f.length;p++)U0e(t,e,r,f[p],i+"/"+d+"/"+p,o,i,d,n,p)}else if(d in aS.propsKeywords){if(f&&typeof f=="object")for(var h in f)U0e(t,e,r,f[h],i+"/"+d+"/"+APn(h),o,i,d,n,h)}else(d in aS.keywords||t.allKeys&&!(d in aS.skipKeywords))&&U0e(t,e,r,f,i+"/"+d,o,i,d,n)}r(n,i,o,s,a,c,u)}}function APn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var W0e=D((aFo,uPt)=>{"use strict";var uX=KMt(),aPt=gU(),H0e=GD(),Q0e=hUe(),yPn=sPt();uPt.exports=cS;cS.normalizeId=lS;cS.fullPath=q0e;cS.url=G0e;cS.ids=xPn;cS.inlineRef=mUe;cS.schema=V0e;function cS(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return cS.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof Q0e)return mUe(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=V0e.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof Q0e?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=mUe(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function V0e(t,e){var r=uX.parse(e),n=cPt(r),i=q0e(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=lS(n),s=this._refs[o];if(typeof s=="string")return EPn.call(this,t,s,r);if(s instanceof Q0e)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof Q0e){if(s.validate||this._compile(s),o==lS(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=q0e(this._getId(t.schema))}return lPt.call(this,r,i,t.schema,t)}function EPn(t,e,r){var n=V0e.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=G0e(o,s)),lPt.call(this,r,o,i,t)}}var vPn=H0e.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function lPt(t,e,r,n){if(t.fragment=t.fragment||"",t.fragment.slice(0,1)=="/"){for(var i=t.fragment.split("/"),o=1;o<i.length;o++){var s=i[o];if(s){if(s=H0e.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!vPn[s]&&(a=this._getId(r),a&&(e=G0e(e,a)),r.$ref)){var c=G0e(e,r.$ref),u=V0e.call(this,n,c);u&&(r=u.schema,n=u.root,e=u.baseId)}}}if(r!==void 0&&r!==n.schema)return{schema:r,root:n,baseId:e}}}var CPn=H0e.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function mUe(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return gUe(t);if(e)return AUe(t)<=e}function gUe(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!gUe(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!gUe(e)))return!1;return!0}function AUe(t){var e=0,r;if(Array.isArray(t)){for(var n=0;n<t.length;n++)if(r=t[n],typeof r=="object"&&(e+=AUe(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(CPn[i])e++;else if(r=t[i],typeof r=="object"&&(e+=AUe(r)+1),e==1/0)return 1/0}return e}function q0e(t,e){e!==!1&&(t=lS(t));var r=uX.parse(t);return cPt(r)}function cPt(t){return uX.serialize(t).split("#")[0]+"#"}var bPn=/#\/?$/;function lS(t){return t?t.replace(bPn,""):""}function G0e(t,e){return e=lS(e),uX.resolve(t,e)}function xPn(t){var e=lS(this._getId(t)),r={"":e},n={"":q0e(e,!1)},i={},o=this;return yPn(t,{allKeys:!0},function(s,a,c,u,d,f,p){if(a!==""){var h=o._getId(s),m=r[u],g=n[u]+"/"+d;if(p!==void 0&&(g+="/"+(typeof p=="number"?p:H0e.escapeFragment(p))),typeof h=="string"){h=m=lS(m?uX.resolve(m,h):h);var A=o._refs[h];if(typeof A=="string"&&(A=o._refs[A]),A&&A.schema){if(!aPt(s,A.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=lS(g))if(h[0]=="#"){if(i[h]&&!aPt(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=g}r[a]=m,n[a]=g}}),i}});var $0e=D((lFo,fPt)=>{"use strict";var yUe=W0e();fPt.exports={Validation:dPt(SPn),MissingRef:dPt(EUe)};function SPn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}EUe.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function EUe(t,e,r){this.message=r||EUe.message(t,e),this.missingRef=yUe.url(t,e),this.missingSchema=yUe.normalizeId(yUe.fullPath(this.missingRef))}function dPt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var vUe=D((cFo,pPt)=>{"use strict";pPt.exports=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(o){return function(s){return function(a,c){var u={key:a,value:s[a]},d={key:c,value:s[c]};return o(u,d)}}})(e.cmp),i=[];return(function o(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var a,c;if(Array.isArray(s)){for(c="[",a=0;a<s.length;a++)a&&(c+=","),c+=o(s[a])||"null";return c+"]"}if(s===null)return"null";if(i.indexOf(s)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=i.push(s)-1,d=Object.keys(s).sort(n&&n(s));for(c="",a=0;a<d.length;a++){var f=d[a],p=o(s[f]);p&&(c&&(c+=","),c+=JSON.stringify(f)+":"+p)}return i.splice(u,1),"{"+c+"}"}})(t)}});var CUe=D((uFo,hPt)=>{"use strict";hPt.exports=function(e,r,n){var i="",o=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),a=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}if(e.isTop&&(i+=" var validate = ",o&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",a&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" "+("/*# sourceURL="+a+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var r="false schema",d=e.level,f=e.dataLevel,p=e.schema[r],h=e.schemaPath+e.util.getProperty(r),m=e.errSchemaPath+"/"+r,w=!e.opts.allErrors,U,g="data"+(f||""),x="valid"+d;if(e.schema===!1){e.isTop?w=!0:i+=" var "+x+" = false; ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&w?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?o?i+=" return data; ":i+=" validate.errors = null; return true; ":i+=" var "+x+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var E=e.isTop,d=e.level=0,f=e.dataLevel=0,g="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var C="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,f=e.dataLevel,g="data"+(f||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+d+" = errors;"}var x="valid"+d,w=!e.opts.allErrors,O="",N="",U,S=e.schema.type,k=Array.isArray(S);if(S&&e.opts.nullable&&e.schema.nullable===!0&&(k?S.indexOf("null")==-1&&(S=S.concat("null")):S!="null"&&(S=[S,"null"],k=!0)),k&&S.length==1&&(S=S[0],k=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),S){if(e.opts.coerceTypes)var B=e.util.coerceToTypes(e.opts.coerceTypes,S);var F=e.RULES.types[S];if(B||k||F===!0||F&&!z(F)){var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=e.schemaPath+".type",m=e.errSchemaPath+"/type",L=k?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[L](S,g,e.opts.strictNumbers,!0)+") { ",B){var R="dataType"+d,q="coerced"+d;i+=" var "+R+" = typeof "+g+"; var "+q+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+R+" == 'object' && Array.isArray("+g+") && "+g+".length == 1) { "+g+" = "+g+"[0]; "+R+" = typeof "+g+"; if ("+e.util.checkDataType(e.schema.type,g,e.opts.strictNumbers)+") "+q+" = "+g+"; } "),i+=" if ("+q+" !== undefined) ; ";var Q=B;if(Q)for(var V,H=-1,J=Q.length-1;H<J;)V=Q[H+=1],V=="string"?i+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+q+" = '' + "+g+"; else if ("+g+" === null) "+q+" = ''; ":V=="number"||V=="integer"?(i+=" else if ("+R+" == 'boolean' || "+g+" === null || ("+R+" == 'string' && "+g+" && "+g+" == +"+g+" ",V=="integer"&&(i+=" && !("+g+" % 1)"),i+=")) "+q+" = +"+g+"; "):V=="boolean"?i+=" else if ("+g+" === 'false' || "+g+" === 0 || "+g+" === null) "+q+" = false; else if ("+g+" === 'true' || "+g+" === 1) "+q+" = true; ":V=="null"?i+=" else if ("+g+" === '' || "+g+" === 0 || "+g+" === false) "+q+" = null; ":e.opts.coerceTypes=="array"&&V=="array"&&(i+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+g+" == null) "+q+" = ["+g+"]; ");i+=" else { ";var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",k?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",k?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&w?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+q+" !== undefined) { ";var X=f?"data"+(f-1||""):"parentData",he=f?e.dataPathArr[f]:"parentDataProperty";i+=" "+g+" = "+q+"; ",f||(i+="if ("+X+" !== undefined)"),i+=" "+X+"["+he+"] = "+q+"; } "}else{var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",k?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",k?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&w?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",w&&(i+=" } if (errors === ",E?i+="0":i+="errs_"+d,i+=") { ",N+="}");else{var Ce=e.RULES;if(Ce){for(var F,ge=-1,be=Ce.length-1;ge<be;)if(F=Ce[ge+=1],z(F)){if(F.type&&(i+=" if ("+e.util.checkDataType(F.type,g,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var p=e.schema.properties,xe=Object.keys(p),se=xe;if(se)for(var me,ve=-1,ee=se.length-1;ve<ee;){me=se[ve+=1];var ce=p[me];if(ce.default!==void 0){var Y=g+e.util.getProperty(me);if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+Y;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else i+=" if ("+Y+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+Y+" === null || "+Y+" === '' "),i+=" ) "+Y+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(ce.default)+" ":i+=" "+JSON.stringify(ce.default)+" ",i+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var re=e.schema.items;if(re){for(var ce,H=-1,ue=re.length-1;H<ue;)if(ce=re[H+=1],ce.default!==void 0){var Y=g+"["+H+"]";if(e.compositeRule){if(e.opts.strictDefaults){var C="default is ignored for: "+Y;if(e.opts.strictDefaults==="log")e.logger.warn(C);else throw new Error(C)}}else i+=" if ("+Y+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+Y+" === null || "+Y+" === '' "),i+=" ) "+Y+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(ce.default)+" ":i+=" "+JSON.stringify(ce.default)+" ",i+="; "}}}}var Z=F.rules;if(Z){for(var $,j=-1,Ee=Z.length-1;j<Ee;)if($=Z[j+=1],Te($)){var de=$.code(e,$.keyword,F.type);de&&(i+=" "+de+" ",w&&(O+="}"))}}if(w&&(i+=" "+O+" ",O=""),F.type&&(i+=" } ",S&&S===F.type&&!B)){i+=" else { ";var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",k?i+=""+S.join(","):i+=""+S,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",k?i+=""+S.join(","):i+=""+S,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&w?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}w&&(i+=" if (errors === ",E?i+="0":i+="errs_"+d,i+=") { ",N+="}")}}}w&&(i+=" "+N+" "),E?(o?(i+=" if (errors === 0) return data; ",i+=" else throw new ValidationError(vErrors); "):(i+=" validate.errors = vErrors; ",i+=" return errors === 0; "),i+=" }; return validate;"):i+=" var "+x+" = errors === errs_"+d+";";function z(Oe){for(var ke=Oe.rules,le=0;le<ke.length;le++)if(Te(ke[le]))return!0}function Te(Oe){return e.schema[Oe.keyword]!==void 0||Oe.implements&&Be(Oe)}function Be(Oe){for(var ke=Oe.implements,le=0;le<ke.length;le++)if(e.schema[ke[le]]!==void 0)return!0}return i}});var EPt=D((dFo,yPt)=>{"use strict";var j0e=W0e(),Y0e=GD(),gPt=$0e(),wPn=vUe(),mPt=CUe(),_Pn=Y0e.ucs2length,TPn=gU(),IPn=gPt.Validation;yPt.exports=bUe;function bUe(t,e,r,n){var i=this,o=this._opts,s=[void 0],a={},c=[],u={},d=[],f={},p=[];e=e||{schema:t,refVal:s,refs:a};var h=DPn.call(this,t,e,n),m=this._compilations[h.index];if(h.compiling)return m.callValidate=C;var g=this._formats,A=this.RULES;try{var y=x(t,e,r,n);m.validate=y;var E=m.callValidate;return E&&(E.schema=y.schema,E.errors=null,E.refs=y.refs,E.refVal=y.refVal,E.root=y.root,E.$async=y.$async,o.sourceCode&&(E.source=y.source)),y}finally{RPn.call(this,t,e,n)}function C(){var L=m.validate,R=L.apply(this,arguments);return C.errors=L.errors,R}function x(L,R,q,Q){var V=!R||R&&R.schema==L;if(R.schema!=e.schema)return bUe.call(i,L,R,q,Q);var H=L.$async===!0,J=mPt({isTop:!0,schema:L,isRoot:V,baseId:Q,root:R,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:gPt.MissingRef,RULES:A,validate:mPt,util:Y0e,resolve:j0e,resolveRef:w,usePattern:k,useDefault:B,useCustomRule:F,opts:o,formats:g,logger:i.logger,self:i});J=z0e(s,OPn)+z0e(c,BPn)+z0e(d,NPn)+z0e(p,kPn)+J,o.processCode&&(J=o.processCode(J,L));var X;try{var he=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",J);X=he(i,A,g,e,s,d,p,TPn,_Pn,IPn),s[0]=X}catch(Ce){throw i.logger.error("Error compiling schema, function code:",J),Ce}return X.schema=L,X.errors=null,X.refs=a,X.refVal=s,X.root=V?X:R,H&&(X.$async=!0),o.sourceCode===!0&&(X.source={code:J,patterns:c,defaults:d}),X}function w(L,R,q){R=j0e.url(L,R);var Q=a[R],V,H;if(Q!==void 0)return V=s[Q],H="refVal["+Q+"]",S(V,H);if(!q&&e.refs){var J=e.refs[R];if(J!==void 0)return V=e.refVal[J],H=O(R,V),S(V,H)}H=O(R);var X=j0e.call(i,x,e,R);if(X===void 0){var he=r&&r[R];he&&(X=j0e.inlineRef(he,o.inlineRefs)?he:bUe.call(i,he,e,r,L))}if(X===void 0)N(R);else return U(R,X),S(X,H)}function O(L,R){var q=s.length;return s[q]=R,a[L]=q,"refVal"+q}function N(L){delete a[L]}function U(L,R){var q=a[L];s[q]=R}function S(L,R){return typeof L=="object"||typeof L=="boolean"?{code:R,schema:L,inline:!0}:{code:R,$async:L&&!!L.$async}}function k(L){var R=u[L];return R===void 0&&(R=u[L]=c.length,c[R]=L),"pattern"+R}function B(L){switch(typeof L){case"boolean":case"number":return""+L;case"string":return Y0e.toQuotedString(L);case"object":if(L===null)return"null";var R=wPn(L),q=f[R];return q===void 0&&(q=f[R]=d.length,d[q]=L),"default"+q}}function F(L,R,q,Q){if(i._opts.validateSchema!==!1){var V=L.definition.dependencies;if(V&&!V.every(function(se){return Object.prototype.hasOwnProperty.call(q,se)}))throw new Error("parent schema must have all required keywords: "+V.join(","));var H=L.definition.validateSchema;if(H){var J=H(R);if(!J){var X="keyword schema is invalid: "+i.errorsText(H.errors);if(i._opts.validateSchema=="log")i.logger.error(X);else throw new Error(X)}}}var he=L.definition.compile,Ce=L.definition.inline,ge=L.definition.macro,be;if(he)be=he.call(i,R,q,Q);else if(ge)be=ge.call(i,R,q,Q),o.validateSchema!==!1&&i.validateSchema(be,!0);else if(Ce)be=Ce.call(i,Q,L.keyword,R,q);else if(be=L.definition.validate,!be)return;if(be===void 0)throw new Error('custom keyword "'+L.keyword+'"failed to compile');var xe=p.length;return p[xe]=be,{code:"customRule"+xe,validate:be}}}function DPn(t,e,r){var n=APt.call(this,t,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:t,root:e,baseId:r},{index:n,compiling:!1})}function RPn(t,e,r){var n=APt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function APt(t,e,r){for(var n=0;n<this._compilations.length;n++){var i=this._compilations[n];if(i.schema==t&&i.root==e&&i.baseId==r)return n}return-1}function BPn(t,e){return"var pattern"+t+" = new RegExp("+Y0e.toQuotedString(e[t])+");"}function NPn(t){return"var default"+t+" = defaults["+t+"];"}function OPn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function kPn(t){return"var customRule"+t+" = customRules["+t+"];"}function z0e(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var CPt=D((fFo,vPt)=>{"use strict";var J0e=vPt.exports=function(){this._cache={}};J0e.prototype.put=function(e,r){this._cache[e]=r};J0e.prototype.get=function(e){return this._cache[e]};J0e.prototype.del=function(e){delete this._cache[e]};J0e.prototype.clear=function(){this._cache={}}});var OPt=D((pFo,NPt)=>{"use strict";var MPn=GD(),PPn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,LPn=[0,31,28,31,30,31,30,31,31,30,31,30,31],FPn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,bPt=/^(?=.{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,UPn=/^(?:[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,QPn=/^(?:[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,xPt=/^(?:(?:[^\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,SPt=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,wPt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,_Pt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,TPt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,IPt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;NPt.exports=K0e;function K0e(t){return t=t=="full"?"full":"fast",MPn.copy(K0e[t])}K0e.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":xPt,url:SPt,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:bPt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:BPt,uuid:wPt,"json-pointer":_Pt,"json-pointer-uri-fragment":TPt,"relative-json-pointer":IPt};K0e.full={date:DPt,time:RPt,"date-time":HPn,uri:WPn,"uri-reference":QPn,"uri-template":xPt,url:SPt,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:bPt,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:BPt,uuid:wPt,"json-pointer":_Pt,"json-pointer-uri-fragment":TPt,"relative-json-pointer":IPt};function qPn(t){return t%4===0&&(t%100!==0||t%400===0)}function DPt(t){var e=t.match(PPn);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&qPn(r)?29:LPn[n])}function RPt(t,e){var r=t.match(FPn);if(!r)return!1;var n=r[1],i=r[2],o=r[3],s=r[5];return(n<=23&&i<=59&&o<=59||n==23&&i==59&&o==60)&&(!e||s)}var GPn=/t|\s/i;function HPn(t){var e=t.split(GPn);return e.length==2&&DPt(e[0])&&RPt(e[1],!0)}var VPn=/\/|:/;function WPn(t){return VPn.test(t)&&UPn.test(t)}var $Pn=/[^\\]\\Z/;function BPt(t){if($Pn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var MPt=D((hFo,kPt)=>{"use strict";kPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,d="data"+(s||""),f="valid"+o,p,h;if(a=="#"||a=="#/")e.isRoot?(p=e.async,h="validate"):(p=e.root.schema.$async===!0,h="root.refVal[0]");else{var m=e.resolveRef(e.baseId,a,e.isRoot);if(m===void 0){var g=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(g);var A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(a)+"' } ",e.opts.messages!==!1&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(a)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(a)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var y=i;i=A.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(g),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,g)}else if(m.inline){var E=e.util.copy(e);E.level++;var C="valid"+E.level;E.schema=m.schema,E.schemaPath="",E.errSchemaPath=a;var x=e.validate(E).replace(/validate\.schema/g,m.code);i+=" "+x+" ",u&&(i+=" if ("+C+") { ")}else p=m.$async===!0||e.async&&m.$async!==!1,h=m.code}if(h){var A=A||[];A.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var w=s?"data"+(s-1||""):"parentData",O=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+w+" , "+O+", rootData) ";var N=i;if(i=A.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+f+"; "),i+=" try { await "+N+"; ",u&&(i+=" "+f+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+f+" = false; "),i+=" } ",u&&(i+=" if ("+f+") { ")}else i+=" if (!"+N+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var LPt=D((mFo,PPt)=>{"use strict";PPt.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.schemaPath+e.util.getProperty(r),a=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u=e.util.copy(e),d="";u.level++;var f="valid"+u.level,p=u.baseId,h=!0,m=o;if(m)for(var g,A=-1,y=m.length-1;A<y;)g=m[A+=1],(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all))&&(h=!1,u.schema=g,u.schemaPath=s+"["+A+"]",u.errSchemaPath=a+"/"+A,i+=" "+e.validate(u)+" ",u.baseId=p,c&&(i+=" if ("+f+") { ",d+="}"));return c&&(h?i+=" if (true) { ":i+=" "+d.slice(0,-1)+" "),i}});var UPt=D((gFo,FPt)=>{"use strict";FPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y=a.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(y){var E=m.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var C=e.compositeRule;e.compositeRule=m.compositeRule=!0;var x=a;if(x)for(var w,O=-1,N=x.length-1;O<N;)w=x[O+=1],m.schema=w,m.schemaPath=c+"["+O+"]",m.errSchemaPath=u+"/"+O,i+=" "+e.validate(m)+" ",m.baseId=E,i+=" "+p+" = "+p+" || "+A+"; if (!"+p+") { ",g+="}";e.compositeRule=m.compositeRule=C,i+=" "+g+" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else d&&(i+=" if (true) { ");return i}});var qPt=D((AFo,QPt)=>{"use strict";QPt.exports=function(e,r,n){var i=" ",o=e.schema[r],s=e.errSchemaPath+"/"+r,a=!e.opts.allErrors,c=e.util.toQuotedString(o);return e.opts.$comment===!0?i+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(i+=" self._opts.$comment("+c+", "+e.util.toQuotedString(s)+", validate.root.schema);"),i}});var HPt=D((yFo,GPt)=>{"use strict";GPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,h||(i+=" var schema"+o+" = validate.schema"+c+";"),i+="var "+p+" = equal("+f+", schema"+o+"); if (!"+p+") { ";var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to constant' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",d&&(i+=" else { "),i}});var WPt=D((EFo,VPt)=>{"use strict";VPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y="i"+o,E=m.dataLevel=e.dataLevel+1,C="data"+E,x=e.baseId,w=e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all);if(i+="var "+h+" = errors;var "+p+";",w){var O=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+A+" = false; for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var N=f+"["+y+"]";m.dataPathArr[E]=y;var U=e.validate(m);m.baseId=x,e.util.varOccurences(U,C)<2?i+=" "+e.util.varReplace(U,C,N)+" ":i+=" var "+C+" = "+N+"; "+U+" ",i+=" if ("+A+") break; } ",e.compositeRule=m.compositeRule=O,i+=" "+g+" if (!"+A+") {"}else i+=" if ("+f+".length == 0) {";var S=S||[];S.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should contain a valid item' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var k=i;return i=S.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+k+"]); ":i+=" validate.errors = ["+k+"]; return false; ":i+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",w&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var jPt=D((vFo,$Pt)=>{"use strict";$Pt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="valid"+h.level,A={},y={},E=e.opts.ownProperties;for(O in a)if(O!="__proto__"){var C=a[O],x=Array.isArray(C)?y:A;x[O]=C}i+="var "+p+" = errors;";var w=e.errorPath;i+="var missing"+o+";";for(var O in y)if(x=y[O],x.length){if(i+=" if ( "+f+e.util.getProperty(O)+" !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),d){i+=" && ( ";var N=x;if(N)for(var U,S=-1,k=N.length-1;S<k;){U=N[S+=1],S&&(i+=" || ");var B=e.util.getProperty(U),F=f+B;i+=" ( ( "+F+" === undefined ",E&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(U)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:B)+") ) "}i+=")) { ";var L="missing"+o,R="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(w,L,!0):w+" + "+L);var q=q||[];q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(O)+"', missingProperty: '"+R+"', depsCount: "+x.length+", deps: '"+e.util.escapeQuotes(x.length==1?x[0]:x.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",x.length==1?i+="property "+e.util.escapeQuotes(x[0]):i+="properties "+e.util.escapeQuotes(x.join(", ")),i+=" when property "+e.util.escapeQuotes(O)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Q=i;i=q.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+Q+"]); ":i+=" validate.errors = ["+Q+"]; return false; ":i+=" var err = "+Q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{i+=" ) { ";var V=x;if(V)for(var U,H=-1,J=V.length-1;H<J;){U=V[H+=1];var B=e.util.getProperty(U),R=e.util.escapeQuotes(U),F=f+B;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(w,U,e.opts.jsonPointers)),i+=" if ( "+F+" === undefined ",E&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(U)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(O)+"', missingProperty: '"+R+"', depsCount: "+x.length+", deps: '"+e.util.escapeQuotes(x.length==1?x[0]:x.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",x.length==1?i+="property "+e.util.escapeQuotes(x[0]):i+="properties "+e.util.escapeQuotes(x.join(", ")),i+=" when property "+e.util.escapeQuotes(O)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",d&&(m+="}",i+=" else { ")}e.errorPath=w;var X=h.baseId;for(var O in A){var C=A[O];(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))&&(i+=" "+g+" = true; if ( "+f+e.util.getProperty(O)+" !== undefined ",E&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(O)+"') "),i+=") { ",h.schema=C,h.schemaPath=c+e.util.getProperty(O),h.errSchemaPath=u+"/"+e.util.escapeFragment(O),i+=" "+e.validate(h)+" ",h.baseId=X,i+=" } ",d&&(i+=" if ("+g+") { ",m+="}"))}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var YPt=D((CFo,zPt)=>{"use strict";zPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var g="i"+o,A="schema"+o;h||(i+=" var "+A+" = validate.schema"+c+";"),i+="var "+p+";",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=""+p+" = false;for (var "+g+"=0; "+g+"<"+A+".length; "+g+"++) if (equal("+f+", "+A+"["+g+"])) { "+p+" = true; break; }",h&&(i+=" } "),i+=" if (!"+p+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var E=i;return i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+E+"]); ":i+=" validate.errors = ["+E+"]; return false; ":i+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",d&&(i+=" else { "),i}});var KPt=D((bFo,JPt)=>{"use strict";JPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||"");if(e.opts.format===!1)return d&&(i+=" if (true) { "),i;var p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=e.opts.unknownFormats,g=Array.isArray(m);if(p){var A="format"+o,y="isObject"+o,E="formatType"+o;i+=" var "+A+" = formats["+h+"]; var "+y+" = typeof "+A+" == 'object' && !("+A+" instanceof RegExp) && "+A+".validate; var "+E+" = "+y+" && "+A+".type || 'string'; if ("+y+") { ",e.async&&(i+=" var async"+o+" = "+A+".async; "),i+=" "+A+" = "+A+".validate; } if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" (",m!="ignore"&&(i+=" ("+h+" && !"+A+" ",g&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+A+" && "+E+" == '"+n+"' && !(typeof "+A+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+A+"("+f+") : "+A+"("+f+")) ":i+=" "+A+"("+f+") ",i+=" : "+A+".test("+f+"))))) {"}else{var A=e.formats[a];if(!A){if(m=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(i+=" if (true) { "),i;if(g&&m.indexOf(a)>=0)return d&&(i+=" if (true) { "),i;throw new Error('unknown format "'+a+'" is used in schema at path "'+e.errSchemaPath+'"')}var y=typeof A=="object"&&!(A instanceof RegExp)&&A.validate,E=y&&A.type||"string";if(y){var C=A.async===!0;A=A.validate}if(E!=n)return d&&(i+=" if (true) { "),i;if(C){if(!e.async)throw new Error("async format in sync schema");var x="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+x+"("+f+"))) { "}else{i+=" if (! ";var x="formats"+e.util.getProperty(a);y&&(x+=".validate"),typeof A=="function"?i+=" "+x+"("+f+") ":i+=" "+x+".test("+f+") ",i+=") { "}}var w=w||[];w.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match format "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var O=i;return i=w.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+O+"]); ":i+=" validate.errors = ["+O+"]; return false; ":i+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { "),i}});var ZPt=D((xFo,XPt)=>{"use strict";XPt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e);m.level++;var g="valid"+m.level,A=e.schema.then,y=e.schema.else,E=A!==void 0&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all)),C=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),x=m.baseId;if(E||C){var w;m.createErrors=!1,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var O=e.compositeRule;e.compositeRule=m.compositeRule=!0,i+=" "+e.validate(m)+" ",m.baseId=x,m.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=O,E?(i+=" if ("+g+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(m)+" ",m.baseId=x,i+=" "+p+" = "+g+"; ",E&&C?(w="ifClause"+o,i+=" var "+w+" = 'then'; "):w="'then'",i+=" } ",C&&(i+=" else { ")):i+=" if (!"+g+") { ",C&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(m)+" ",m.baseId=x,i+=" "+p+" = "+g+"; ",E&&C?(w="ifClause"+o,i+=" var "+w+" = 'else'; "):w="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+w+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+w+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var tLt=D((SFo,eLt)=>{"use strict";eLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y="i"+o,E=m.dataLevel=e.dataLevel+1,C="data"+E,x=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var w=e.schema.additionalItems;if(w===!1){i+=" "+p+" = "+f+".length <= "+a.length+"; ";var O=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var N=N||[];N.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+a.length+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have more than "+a.length+" items' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var U=i;i=N.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+U+"]); ":i+=" validate.errors = ["+U+"]; return false; ":i+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u=O,d&&(g+="}",i+=" else { ")}var S=a;if(S){for(var k,B=-1,F=S.length-1;B<F;)if(k=S[B+=1],e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all)){i+=" "+A+" = true; if ("+f+".length > "+B+") { ";var L=f+"["+B+"]";m.schema=k,m.schemaPath=c+"["+B+"]",m.errSchemaPath=u+"/"+B,m.errorPath=e.util.getPathExpr(e.errorPath,B,e.opts.jsonPointers,!0),m.dataPathArr[E]=B;var R=e.validate(m);m.baseId=x,e.util.varOccurences(R,C)<2?i+=" "+e.util.varReplace(R,C,L)+" ":i+=" var "+C+" = "+L+"; "+R+" ",i+=" } ",d&&(i+=" if ("+A+") { ",g+="}")}}if(typeof w=="object"&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all))){m.schema=w,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+A+" = true; if ("+f+".length > "+a.length+") { for (var "+y+" = "+a.length+"; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var L=f+"["+y+"]";m.dataPathArr[E]=y;var R=e.validate(m);m.baseId=x,e.util.varOccurences(R,C)<2?i+=" "+e.util.varReplace(R,C,L)+" ":i+=" var "+C+" = "+L+"; "+R+" ",d&&(i+=" if (!"+A+") break; "),i+=" } } ",d&&(i+=" if ("+A+") { ",g+="}")}}else if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" for (var "+y+" = 0; "+y+" < "+f+".length; "+y+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers,!0);var L=f+"["+y+"]";m.dataPathArr[E]=y;var R=e.validate(m);m.baseId=x,e.util.varOccurences(R,C)<2?i+=" "+e.util.varReplace(R,C,L)+" ":i+=" var "+C+" = "+L+"; "+R+" ",d&&(i+=" if (!"+A+") break; "),i+=" }"}return d&&(i+=" "+g+" if ("+h+" == errors) {"),i}});var xUe=D((wFo,rLt)=>{"use strict";rLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,x,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=r=="maximum",g=m?"exclusiveMaximum":"exclusiveMinimum",A=e.schema[g],y=e.opts.$data&&A&&A.$data,E=m?"<":">",C=m?">":"<",x=void 0;if(!(p||typeof a=="number"||a===void 0))throw new Error(r+" must be number");if(!(y||A===void 0||typeof A=="number"||typeof A=="boolean"))throw new Error(g+" must be number or boolean");if(y){var w=e.util.getData(A.$data,s,e.dataPathArr),O="exclusive"+o,N="exclType"+o,U="exclIsNumber"+o,S="op"+o,k="' + "+S+" + '";i+=" var schemaExcl"+o+" = "+w+"; ",w="schemaExcl"+o,i+=" var "+O+"; var "+N+" = typeof "+w+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var x=g,B=B||[];B.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(x||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+g+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var F=i;i=B.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+N+" == 'number' ? ( ("+O+" = "+h+" === undefined || "+w+" "+E+"= "+h+") ? "+f+" "+C+"= "+w+" : "+f+" "+C+" "+h+" ) : ( ("+O+" = "+w+" === true) ? "+f+" "+C+"= "+h+" : "+f+" "+C+" "+h+" ) || "+f+" !== "+f+") { var op"+o+" = "+O+" ? '"+E+"' : '"+E+"='; ",a===void 0&&(x=g,u=e.errSchemaPath+"/"+g,h=w,p=y)}else{var U=typeof A=="number",k=E;if(U&&p){var S="'"+k+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+A+" "+E+"= "+h+" ? "+f+" "+C+"= "+A+" : "+f+" "+C+" "+h+" ) || "+f+" !== "+f+") { "}else{U&&a===void 0?(O=!0,x=g,u=e.errSchemaPath+"/"+g,h=A,C+="="):(U&&(h=Math[m?"min":"max"](A,a)),A===(U?h:!0)?(O=!0,x=g,u=e.errSchemaPath+"/"+g,C+="="):(O=!1,k+="="));var S="'"+k+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+" "+C+" "+h+" || "+f+" !== "+f+") { "}}x=x||r;var B=B||[];B.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(x||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+S+", limit: "+h+", exclusive: "+O+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+k+" ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var F=i;return i=B.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { "),i}});var SUe=D((_Fo,nLt)=>{"use strict";nLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,g,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxItems"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+".length "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxItems"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var wUe=D((TFo,iLt)=>{"use strict";iLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,g,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxLength"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?i+=" "+f+".length ":i+=" ucs2length("+f+") ",i+=" "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be ",r=="maxLength"?i+="longer":i+="shorter",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var _Ue=D((IFo,oLt)=>{"use strict";oLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,g,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");var m=r=="maxProperties"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" Object.keys("+f+").length "+m+" "+h+") { ";var g=r,A=A||[];A.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(g||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have ",r=="maxProperties"?i+="more":i+="fewer",i+=" than ",p?i+="' + "+h+" + '":i+=""+a,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+y+"]); ":i+=" validate.errors = ["+y+"]; return false; ":i+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var aLt=D((DFo,sLt)=>{"use strict";sLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;if(p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a,!(p||typeof a=="number"))throw new Error(r+" must be number");i+="var division"+o+";if (",p&&(i+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || "),i+=" (division"+o+" = "+f+" / "+h+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+o+" !== parseInt(division"+o+") ",i+=" ) ",p&&(i+=" ) "),i+=" ) { ";var m=m||[];m.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+h+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be multiple of ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;return i=m.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var cLt=D((RFo,lLt)=>{"use strict";lLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e);h.level++;var m="valid"+h.level;if(e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u,i+=" var "+p+" = errors; ";var g=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var A;h.opts.allErrors&&(A=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,A&&(h.opts.allErrors=A),e.compositeRule=h.compositeRule=g,i+=" if ("+m+") { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var E=i;i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+E+"]); ":i+=" validate.errors = ["+E+"]; return false; ":i+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(i+=" } ")}else i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: 'should NOT be valid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(i+=" if (false) { ");return i}});var dLt=D((BFo,uLt)=>{"use strict";uLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h="errs__"+o,m=e.util.copy(e),g="";m.level++;var A="valid"+m.level,y=m.baseId,E="prevValid"+o,C="passingSchemas"+o;i+="var "+h+" = errors , "+E+" = false , "+p+" = false , "+C+" = null; ";var x=e.compositeRule;e.compositeRule=m.compositeRule=!0;var w=a;if(w)for(var O,N=-1,U=w.length-1;N<U;)O=w[N+=1],(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))?(m.schema=O,m.schemaPath=c+"["+N+"]",m.errSchemaPath=u+"/"+N,i+=" "+e.validate(m)+" ",m.baseId=y):i+=" var "+A+" = true; ",N&&(i+=" if ("+A+" && "+E+") { "+p+" = false; "+C+" = ["+C+", "+N+"]; } else { ",g+="}"),i+=" if ("+A+") { "+p+" = "+E+" = true; "+C+" = "+N+"; }";return e.compositeRule=m.compositeRule=x,i+=""+g+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+C+" } ",e.opts.messages!==!1&&(i+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(i+=" } "),i}});var pLt=D((NFo,fLt)=>{"use strict";fLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p=e.opts.$data&&a&&a.$data,h;p?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",h="schema"+o):h=a;var m=p?"(new RegExp("+h+"))":e.usePattern(a);i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" !"+m+".test("+f+") ) { ";var g=g||[];g.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",p?i+=""+h:i+=""+e.util.toQuotedString(a),i+=" } ",e.opts.messages!==!1&&(i+=` , message: 'should match pattern "`,p?i+="' + "+h+" + '":i+=""+e.util.escapeQuotes(a),i+=`"' `),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+e.util.toQuotedString(a),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+A+"]); ":i+=" validate.errors = ["+A+"]; return false; ":i+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var mLt=D((OFo,hLt)=>{"use strict";hLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="valid"+h.level,A="key"+o,y="idx"+o,E=h.dataLevel=e.dataLevel+1,C="data"+E,x="dataProperties"+o,w=Object.keys(a||{}).filter(H),O=e.schema.patternProperties||{},N=Object.keys(O).filter(H),U=e.schema.additionalProperties,S=w.length||N.length,k=U===!1,B=typeof U=="object"&&Object.keys(U).length,F=e.opts.removeAdditional,L=k||B||F,R=e.opts.ownProperties,q=e.baseId,Q=e.schema.required;if(Q&&!(e.opts.$data&&Q.$data)&&Q.length<e.opts.loopRequired)var V=e.util.toHash(Q);function H(Re){return Re!=="__proto__"}if(i+="var "+p+" = errors;var "+g+" = true;",R&&(i+=" var "+x+" = undefined;"),L){if(R?i+=" "+x+" = "+x+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+x+".length; "+y+"++) { var "+A+" = "+x+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",S){if(i+=" var isAdditional"+o+" = !(false ",w.length)if(w.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+A+") ";else{var J=w;if(J)for(var X,he=-1,Ce=J.length-1;he<Ce;)X=J[he+=1],i+=" || "+A+" == "+e.util.toQuotedString(X)+" "}if(N.length){var ge=N;if(ge)for(var be,xe=-1,se=ge.length-1;xe<se;)be=ge[xe+=1],i+=" || "+e.usePattern(be)+".test("+A+") "}i+=" ); if (isAdditional"+o+") { "}if(F=="all")i+=" delete "+f+"["+A+"]; ";else{var me=e.errorPath,ve="' + "+A+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers)),k)if(F)i+=" delete "+f+"["+A+"]; ";else{i+=" "+g+" = false; ";var ee=u;u=e.errSchemaPath+"/additionalProperties";var ce=ce||[];ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+ve+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is an invalid additional property":i+="should NOT have additional properties",i+="' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Y=i;i=ce.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+Y+"]); ":i+=" validate.errors = ["+Y+"]; return false; ":i+=" var err = "+Y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ee,d&&(i+=" break; ")}else if(B)if(F=="failing"){i+=" var "+p+" = errors; ";var re=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=U,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[E]=A;var Z=e.validate(h);h.baseId=q,e.util.varOccurences(Z,C)<2?i+=" "+e.util.varReplace(Z,C,ue)+" ":i+=" var "+C+" = "+ue+"; "+Z+" ",i+=" if (!"+g+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+A+"]; } ",e.compositeRule=h.compositeRule=re}else{h.schema=U,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[E]=A;var Z=e.validate(h);h.baseId=q,e.util.varOccurences(Z,C)<2?i+=" "+e.util.varReplace(Z,C,ue)+" ":i+=" var "+C+" = "+ue+"; "+Z+" ",d&&(i+=" if (!"+g+") break; ")}e.errorPath=me}S&&(i+=" } "),i+=" } ",d&&(i+=" if ("+g+") { ",m+="}")}var $=e.opts.useDefaults&&!e.compositeRule;if(w.length){var j=w;if(j)for(var X,Ee=-1,de=j.length-1;Ee<de;){X=j[Ee+=1];var z=a[X];if(e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)){var Te=e.util.getProperty(X),ue=f+Te,Be=$&&z.default!==void 0;h.schema=z,h.schemaPath=c+Te,h.errSchemaPath=u+"/"+e.util.escapeFragment(X),h.errorPath=e.util.getPath(e.errorPath,X,e.opts.jsonPointers),h.dataPathArr[E]=e.util.toQuotedString(X);var Z=e.validate(h);if(h.baseId=q,e.util.varOccurences(Z,C)<2){Z=e.util.varReplace(Z,C,ue);var Oe=ue}else{var Oe=C;i+=" var "+C+" = "+ue+"; "}if(Be)i+=" "+Z+" ";else{if(V&&V[X]){i+=" if ( "+Oe+" === undefined ",R&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=") { "+g+" = false; ";var me=e.errorPath,ee=u,ke=e.util.escapeQuotes(X);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(me,X,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var ce=ce||[];ce.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+ke+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+ke+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Y=i;i=ce.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+Y+"]); ":i+=" validate.errors = ["+Y+"]; return false; ":i+=" var err = "+Y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ee,e.errorPath=me,i+=" } else { "}else d?(i+=" if ( "+Oe+" === undefined ",R&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=") { "+g+" = true; } else { "):(i+=" if ("+Oe+" !== undefined ",R&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=" ) { ");i+=" "+Z+" } "}}d&&(i+=" if ("+g+") { ",m+="}")}}if(N.length){var le=N;if(le)for(var be,Ie=-1,De=le.length-1;Ie<De;){be=le[Ie+=1];var z=O[be];if(e.opts.strictKeywords?typeof z=="object"&&Object.keys(z).length>0||z===!1:e.util.schemaHasRules(z,e.RULES.all)){h.schema=z,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(be),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(be),R?i+=" "+x+" = "+x+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+x+".length; "+y+"++) { var "+A+" = "+x+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",i+=" if ("+e.usePattern(be)+".test("+A+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,A,e.opts.jsonPointers);var ue=f+"["+A+"]";h.dataPathArr[E]=A;var Z=e.validate(h);h.baseId=q,e.util.varOccurences(Z,C)<2?i+=" "+e.util.varReplace(Z,C,ue)+" ":i+=" var "+C+" = "+ue+"; "+Z+" ",d&&(i+=" if (!"+g+") break; "),i+=" } ",d&&(i+=" else "+g+" = true; "),i+=" } ",d&&(i+=" if ("+g+") { ",m+="}")}}}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var ALt=D((kFo,gLt)=>{"use strict";gLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="errs__"+o,h=e.util.copy(e),m="";h.level++;var g="valid"+h.level;if(i+="var "+p+" = errors;",e.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:e.util.schemaHasRules(a,e.RULES.all)){h.schema=a,h.schemaPath=c,h.errSchemaPath=u;var A="key"+o,y="idx"+o,E="i"+o,C="' + "+A+" + '",x=h.dataLevel=e.dataLevel+1,w="data"+x,O="dataProperties"+o,N=e.opts.ownProperties,U=e.baseId;N&&(i+=" var "+O+" = undefined; "),N?i+=" "+O+" = "+O+" || Object.keys("+f+"); for (var "+y+"=0; "+y+"<"+O+".length; "+y+"++) { var "+A+" = "+O+"["+y+"]; ":i+=" for (var "+A+" in "+f+") { ",i+=" var startErrs"+o+" = errors; ";var S=A,k=e.compositeRule;e.compositeRule=h.compositeRule=!0;var B=e.validate(h);h.baseId=U,e.util.varOccurences(B,w)<2?i+=" "+e.util.varReplace(B,w,S)+" ":i+=" var "+w+" = "+S+"; "+B+" ",e.compositeRule=h.compositeRule=k,i+=" if (!"+g+") { for (var "+E+"=startErrs"+o+"; "+E+"<errors; "+E+"++) { vErrors["+E+"].propertyName = "+A+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+C+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+C+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),d&&(i+=" break; "),i+=" } }"}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var ELt=D((MFo,yLt)=>{"use strict";yLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a;var g="schema"+o;if(!h)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var A=[],y=a;if(y)for(var E,C=-1,x=y.length-1;C<x;){E=y[C+=1];var w=e.schema.properties[E];w&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all))||(A[A.length]=E)}}else var A=a;if(h||A.length){var O=e.errorPath,N=h||A.length>=e.opts.loopRequired,U=e.opts.ownProperties;if(d)if(i+=" var missing"+o+"; ",N){h||(i+=" var "+g+" = validate.schema"+c+"; ");var S="i"+o,k="schema"+o+"["+S+"]",B="' + "+k+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(O,k,e.opts.jsonPointers)),i+=" var "+p+" = true; ",h&&(i+=" if (schema"+o+" === undefined) "+p+" = true; else if (!Array.isArray(schema"+o+")) "+p+" = false; else {"),i+=" for (var "+S+" = 0; "+S+" < "+g+".length; "+S+"++) { "+p+" = "+f+"["+g+"["+S+"]] !== undefined ",U&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+g+"["+S+"]) "),i+="; if (!"+p+") break; } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var L=i;i=F.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var R=A;if(R)for(var q,S=-1,Q=R.length-1;S<Q;){q=R[S+=1],S&&(i+=" || ");var V=e.util.getProperty(q),H=f+V;i+=" ( ( "+H+" === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:V)+") ) "}i+=") { ";var k="missing"+o,B="' + "+k+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(O,k,!0):O+" + "+k);var F=F||[];F.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var L=i;i=F.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(N){h||(i+=" var "+g+" = validate.schema"+c+"; ");var S="i"+o,k="schema"+o+"["+S+"]",B="' + "+k+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(O,k,e.opts.jsonPointers)),h&&(i+=" if ("+g+" && !Array.isArray("+g+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+g+" !== undefined) { "),i+=" for (var "+S+" = 0; "+S+" < "+g+".length; "+S+"++) { if ("+f+"["+g+"["+S+"]] === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+g+"["+S+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(i+=" } ")}else{var J=A;if(J)for(var q,X=-1,he=J.length-1;X<he;){q=J[X+=1];var V=e.util.getProperty(q),B=e.util.escapeQuotes(q),H=f+V;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(O,q,e.opts.jsonPointers)),i+=" if ( "+H+" === undefined ",U&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+B+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+B+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=O}else d&&(i+=" if (true) {");return i}});var CLt=D((PFo,vLt)=>{"use strict";vLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,m;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",m="schema"+o):m=a,(a||h)&&e.opts.uniqueItems!==!1){h&&(i+=" var "+p+"; if ("+m+" === false || "+m+" === undefined) "+p+" = true; else if (typeof "+m+" != 'boolean') "+p+" = false; else { "),i+=" var i = "+f+".length , "+p+" = true , j; if (i > 1) { ";var g=e.schema.items&&e.schema.items.type,A=Array.isArray(g);if(!g||g=="object"||g=="array"||A&&(g.indexOf("object")>=0||g.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+p+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var y="checkDataType"+(A?"s":"");i+=" if ("+e.util[y](g,"item",e.opts.strictNumbers,!0)+") continue; ",A&&(i+=` if (typeof item == 'string') item = '"' + item; `),i+=" if (typeof itemIndices[item] == 'number') { "+p+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var E=E||[];E.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",h?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var C=i;i=E.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+C+"]); ":i+=" validate.errors = ["+C+"]; return false; ":i+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var xLt=D((LFo,bLt)=>{"use strict";bLt.exports={$ref:MPt(),allOf:LPt(),anyOf:UPt(),$comment:qPt(),const:HPt(),contains:WPt(),dependencies:jPt(),enum:YPt(),format:KPt(),if:ZPt(),items:tLt(),maximum:xUe(),minimum:xUe(),maxItems:SUe(),minItems:SUe(),maxLength:wUe(),minLength:wUe(),maxProperties:_Ue(),minProperties:_Ue(),multipleOf:aLt(),not:cLt(),oneOf:dLt(),pattern:pLt(),properties:mLt(),propertyNames:ALt(),required:ELt(),uniqueItems:CLt(),validate:CUe()}});var _Lt=D((FFo,wLt)=>{"use strict";var SLt=xLt(),TUe=GD().toHash;wLt.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],i=["number","integer","string","array","object","boolean","null"];return e.all=TUe(r),e.types=TUe(i),e.forEach(function(o){o.rules=o.rules.map(function(s){var a;if(typeof s=="object"){var c=Object.keys(s)[0];a=s[c],s=c,a.forEach(function(d){r.push(d),e.all[d]=!0})}r.push(s);var u=e.all[s]={keyword:s,code:SLt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:SLt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=TUe(r.concat(n)),e.custom={},e}});var DLt=D((UFo,ILt)=>{"use strict";var TLt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];ILt.exports=function(t,e){for(var r=0;r<e.length;r++){t=JSON.parse(JSON.stringify(t));var n=e[r].split("/"),i=t,o;for(o=1;o<n.length;o++)i=i[n[o]];for(o=0;o<TLt.length;o++){var s=TLt[o],a=i[s];a&&(i[s]={anyOf:[a,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}});var NLt=D((QFo,BLt)=>{"use strict";var jPn=$0e().MissingRef;BLt.exports=RLt;function RLt(t,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var i=o(t).then(function(){var a=n._addSchema(t,void 0,e);return a.validate||s(a)});return r&&i.then(function(a){r(null,a)},r),i;function o(a){var c=a.$schema;return c&&!n.getSchema(c)?RLt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof jPn)return c(u);throw u}function c(u){var d=u.missingSchema;if(h(d))throw new Error("Schema "+d+" is loaded but "+u.missingRef+" cannot be resolved");var f=n._loadingSchemas[d];return f||(f=n._loadingSchemas[d]=n._opts.loadSchema(d),f.then(p,p)),f.then(function(m){if(!h(d))return o(m).then(function(){h(d)||n.addSchema(m,d,void 0,e)})}).then(function(){return s(a)});function p(){delete n._loadingSchemas[d]}function h(m){return n._refs[m]||n._schemas[m]}}}}});var kLt=D((qFo,OLt)=>{"use strict";OLt.exports=function(e,r,n){var i=" ",o=e.level,s=e.dataLevel,a=e.schema[r],c=e.schemaPath+e.util.getProperty(r),u=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,f,p="data"+(s||""),h="valid"+o,m="errs__"+o,g=e.opts.$data&&a&&a.$data,A;g?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",A="schema"+o):A=a;var y=this,E="definition"+o,C=y.definition,x="",w,O,N,U,S;if(g&&C.$data){S="keywordValidate"+o;var k=C.validateSchema;i+=" var "+E+" = RULES.custom['"+r+"'].definition; var "+S+" = "+E+".validate;"}else{if(U=e.useCustomRule(y,a,e.schema,e),!U)return;A="validate.schema"+c,S=U.code,w=C.compile,O=C.inline,N=C.macro}var B=S+".errors",F="i"+o,L="ruleErr"+o,R=C.async;if(R&&!e.async)throw new Error("async keyword in sync schema");if(O||N||(i+=""+B+" = null;"),i+="var "+m+" = errors;var "+h+";",g&&C.$data&&(x+="}",i+=" if ("+A+" === undefined) { "+h+" = true; } else { ",k&&(x+="}",i+=" "+h+" = "+E+".validateSchema("+A+"); if ("+h+") { ")),O)C.statements?i+=" "+U.validate+" ":i+=" "+h+" = "+U.validate+"; ";else if(N){var q=e.util.copy(e),x="";q.level++;var Q="valid"+q.level;q.schema=U.validate,q.schemaPath="";var V=e.compositeRule;e.compositeRule=q.compositeRule=!0;var H=e.validate(q).replace(/validate\.schema/g,S);e.compositeRule=q.compositeRule=V,i+=" "+H}else{var J=J||[];J.push(i),i="",i+=" "+S+".call( ",e.opts.passContext?i+="this":i+="self",w||C.schema===!1?i+=" , "+p+" ":i+=" , "+A+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var X=s?"data"+(s-1||""):"parentData",he=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+X+" , "+he+" , rootData ) ";var Ce=i;i=J.pop(),C.errors===!1?(i+=" "+h+" = ",R&&(i+="await "),i+=""+Ce+"; "):R?(B="customErrors"+o,i+=" var "+B+" = null; try { "+h+" = await "+Ce+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+B+" = e.errors; else throw e; } "):i+=" "+B+" = null; "+h+" = "+Ce+"; "}if(C.modifying&&(i+=" if ("+X+") "+p+" = "+X+"["+he+"];"),i+=""+x,C.valid)d&&(i+=" if (true) { ");else{i+=" if ( ",C.valid===void 0?(i+=" !",N?i+=""+Q:i+=""+h):i+=" "+!C.valid+" ",i+=") { ",f=y.keyword;var J=J||[];J.push(i),i="";var J=J||[];J.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var ge=i;i=J.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+ge+"]); ":i+=" validate.errors = ["+ge+"]; return false; ":i+=" var err = "+ge+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var be=i;i=J.pop(),O?C.errors?C.errors!="full"&&(i+=" for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+L+" = vErrors["+F+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+A+"; "+L+".data = "+p+"; "),i+=" } "):C.errors===!1?i+=" "+be+" ":(i+=" if ("+m+" == errors) { "+be+" } else { for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+L+" = vErrors["+F+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+A+"; "+L+".data = "+p+"; "),i+=" } } "):N?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+y.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+y.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&d&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):C.errors===!1?i+=" "+be+" ":(i+=" if (Array.isArray("+B+")) { if (vErrors === null) vErrors = "+B+"; else vErrors = vErrors.concat("+B+"); errors = vErrors.length; for (var "+F+"="+m+"; "+F+"<errors; "+F+"++) { var "+L+" = vErrors["+F+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; "+L+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+L+".schema = "+A+"; "+L+".data = "+p+"; "),i+=" } } else { "+be+" } "),i+=" } ",d&&(i+=" else { ")}return i}});var IUe=D((GFo,zPn)=>{zPn.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var LLt=D((HFo,PLt)=>{"use strict";var MLt=IUe();PLt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:MLt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:MLt.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var ULt=D((VFo,FLt)=>{"use strict";var YPn=/^[a-z_$][a-z0-9_$-]*$/i,JPn=kLt(),KPn=LLt();FLt.exports={add:XPn,get:ZPn,remove:eLn,validate:DUe};function XPn(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!YPn.test(t))throw new Error("Keyword "+t+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var i=0;i<n.length;i++)s(t,n[i],e);else s(t,n,e);var o=e.metaSchema;o&&(e.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(o,!0))}r.keywords[t]=r.all[t]=!0;function s(a,c,u){for(var d,f=0;f<r.length;f++){var p=r[f];if(p.type==c){d=p;break}}d||(d={type:c,rules:[]},r.push(d));var h={keyword:a,definition:u,custom:!0,code:JPn,implements:u.implements};d.rules.push(h),r.custom[a]=h}return this}function ZPn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function eLn(t){var e=this.RULES;delete e.keywords[t],delete e.all[t],delete e.custom[t];for(var r=0;r<e.length;r++)for(var n=e[r].rules,i=0;i<n.length;i++)if(n[i].keyword==t){n.splice(i,1);break}return this}function DUe(t,e){DUe.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(KPn,!0);if(r(t))return!0;if(DUe.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var QLt=D((WFo,tLn)=>{tLn.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var JLt=D(($Fo,YLt)=>{"use strict";var GLt=EPt(),HD=W0e(),rLn=CPt(),HLt=hUe(),nLn=vUe(),iLn=OPt(),oLn=_Lt(),VLt=DLt(),WLt=GD();YLt.exports=Zu;Zu.prototype.validate=aLn;Zu.prototype.compile=lLn;Zu.prototype.addSchema=cLn;Zu.prototype.addMetaSchema=uLn;Zu.prototype.validateSchema=dLn;Zu.prototype.getSchema=pLn;Zu.prototype.removeSchema=mLn;Zu.prototype.addFormat=xLn;Zu.prototype.errorsText=bLn;Zu.prototype._addSchema=gLn;Zu.prototype._compile=ALn;Zu.prototype.compileAsync=NLt();var eme=ULt();Zu.prototype.addKeyword=eme.add;Zu.prototype.getKeyword=eme.get;Zu.prototype.removeKeyword=eme.remove;Zu.prototype.validateKeyword=eme.validate;var $Lt=$0e();Zu.ValidationError=$Lt.Validation;Zu.MissingRefError=$Lt.MissingRef;Zu.$dataMetaSchema=VLt;var Z0e="http://json-schema.org/draft-07/schema",qLt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],sLn=["/properties"];function Zu(t){if(!(this instanceof Zu))return new Zu(t);t=this._opts=WLt.copy(t)||{},DLn(this),this._schemas={},this._refs={},this._fragments={},this._formats=iLn(t.format),this._cache=t.cache||new rLn,this._loadingSchemas={},this._compilations=[],this.RULES=oLn(),this._getId=yLn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=nLn),this._metaOpts=ILn(this),t.formats&&_Ln(this),t.keywords&&TLn(this),SLn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),wLn(this)}function aLn(t,e){var r;if(typeof t=="string"){if(r=this.getSchema(t),!r)throw new Error('no schema with key or ref "'+t+'"')}else{var n=this._addSchema(t);r=n.validate||this._compile(n)}var i=r(e);return r.$async!==!0&&(this.errors=r.errors),i}function lLn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function cLn(t,e,r,n){if(Array.isArray(t)){for(var i=0;i<t.length;i++)this.addSchema(t[i],void 0,r,n);return this}var o=this._getId(t);if(o!==void 0&&typeof o!="string")throw new Error("schema id must be string");return e=HD.normalizeId(e||o),zLt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function uLn(t,e,r){return this.addSchema(t,e,r,!0),this}function dLn(t,e){var r=t.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||fLn(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(r,t);if(!n&&e){var i="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(i);else throw new Error(i)}return n}function fLn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Z0e)?Z0e:void 0,t._opts.defaultMeta}function pLn(t){var e=jLt(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return hLn(this,t)}}function hLn(t,e){var r=HD.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=GLt.call(t,n,i,void 0,o);return t._fragments[e]=new HLt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function jLt(t,e){return e=HD.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function mLn(t){if(t instanceof RegExp)return X0e(this,this._schemas,t),X0e(this,this._refs,t),this;switch(typeof t){case"undefined":return X0e(this,this._schemas),X0e(this,this._refs),this._cache.clear(),this;case"string":var e=jLt(this,t);return e&&this._cache.del(e.cacheKey),delete this._schemas[t],delete this._refs[t],this;case"object":var r=this._opts.serialize,n=r?r(t):t;this._cache.del(n);var i=this._getId(t);i&&(i=HD.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function X0e(t,e,r){for(var n in e){var i=e[n];!i.meta&&(!r||r.test(n))&&(t._cache.del(i.cacheKey),delete e[n])}}function gLn(t,e,r,n){if(typeof t!="object"&&typeof t!="boolean")throw new Error("schema should be object or boolean");var i=this._opts.serialize,o=i?i(t):t,s=this._cache.get(o);if(s)return s;n=n||this._opts.addUsedSchema!==!1;var a=HD.normalizeId(this._getId(t));a&&n&&zLt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==HD.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=HD.ids.call(this,t),f=new HLt({id:a,schema:t,localRefs:d,cacheKey:o,meta:r});return a[0]!="#"&&n&&(this._refs[a]=f),this._cache.put(o,f),c&&u&&this.validateSchema(t,!0),f}function ALn(t,e){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=e||i,t.schema.$async===!0&&(i.$async=!0),i;t.compiling=!0;var r;t.meta&&(r=this._opts,this._opts=this._metaOpts);var n;try{n=GLt.call(this,t.schema,e,t.localRefs)}catch(o){throw delete t.validate,o}finally{t.compiling=!1,t.meta&&(this._opts=r)}return t.validate=n,t.refs=n.refs,t.refVal=n.refVal,t.root=n.root,n;function i(){var o=t.validate,s=o.apply(this,arguments);return i.errors=o.errors,s}}function yLn(t){switch(t.schemaId){case"auto":return CLn;case"id":return ELn;default:return vLn}}function ELn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function vLn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function CLn(t){if(t.$id&&t.id&&t.$id!=t.id)throw new Error("schema $id is different from id");return t.$id||t.id}function bLn(t,e){if(t=t||this.errors,!t)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,n=e.dataVar===void 0?"data":e.dataVar,i="",o=0;o<t.length;o++){var s=t[o];s&&(i+=n+s.dataPath+" "+s.message+r)}return i.slice(0,-r.length)}function xLn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function SLn(t){var e;if(t._opts.$data&&(e=QLt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=IUe();t._opts.$data&&(r=VLt(r,sLn)),t.addMetaSchema(r,Z0e,!0),t._refs["http://json-schema.org/schema"]=Z0e}}function wLn(t){var e=t._opts.schemas;if(e)if(Array.isArray(e))t.addSchema(e);else for(var r in e)t.addSchema(e[r],r)}function _Ln(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function TLn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function zLt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function ILn(t){for(var e=WLt.copy(t._opts),r=0;r<qLt.length;r++)delete e[qLt[r]];return e}function DLn(t){var e=t._opts.logger;if(e===!1)t.logger={log:RUe,warn:RUe,error:RUe};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");t.logger=e}}function RUe(){}});var KLt,C1,AU=ae(()=>{YMt();sS();KLt=Fe(JLt(),1),C1=class extends L0e{constructor(e,r){var n;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._ajv=new KLt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=zMt(this._capabilities,e)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:mU,capabilities:this._capabilities,clientInfo:this._clientInfo}},KFe,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!RMt.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,i,o,s;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},qD,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},sUe,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},qD,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},cX,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},lX,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ZFe,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},eUe,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},tUe,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},qD,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},qD,r)}async callTool(e,r=M0e,n){let i=await this.request({method:"tools/call",params:e},r,n),o=this.getToolOutputValidator(e.name);if(o){if(!i.structuredContent&&!i.isError)throw new R3(D3.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new R3(D3.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof R3?s:new R3(D3.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return i}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let r of e)if(r.outputSchema)try{let n=this._ajv.compile(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},oUe,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var rFt=D((JFo,tFt)=>{tFt.exports=eFt;eFt.sync=BLn;var XLt=ye("fs");function RLn(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function ZLt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:RLn(e,r)}function eFt(t,e,r){XLt.stat(t,function(n,i){r(n,n?!1:ZLt(i,t,e))})}function BLn(t,e){return ZLt(XLt.statSync(t),t,e)}});var aFt=D((KFo,sFt)=>{sFt.exports=iFt;iFt.sync=NLn;var nFt=ye("fs");function iFt(t,e,r){nFt.stat(t,function(n,i){r(n,n?!1:oFt(i,e))})}function NLn(t,e){return oFt(nFt.statSync(t),e)}function oFt(t,e){return t.isFile()&&OLn(t,e)}function OLn(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),d=a|c,f=r&u||r&c&&i===s||r&a&&n===o||r&d&&o===0;return f}});var cFt=D((ZFo,lFt)=>{var XFo=ye("fs"),tme;process.platform==="win32"||global.TESTING_WINDOWS?tme=rFt():tme=aFt();lFt.exports=BUe;BUe.sync=kLn;function BUe(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){BUe(t,e||{},function(o,s){o?i(o):n(s)})})}tme(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function kLn(t,e){try{return tme.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var gFt=D((eUo,mFt)=>{var yU=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",uFt=ye("path"),MLn=yU?";":":",dFt=cFt(),fFt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),pFt=(t,e)=>{let r=e.colon||MLn,n=t.match(/\//)||yU&&t.match(/\\/)?[""]:[...yU?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=yU?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=yU?i.split(r):[""];return yU&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},hFt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=pFt(t,e),s=[],a=u=>new Promise((d,f)=>{if(u===n.length)return e.all&&s.length?d(s):f(fFt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,m=uFt.join(h,t),g=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;d(c(g,u,0))}),c=(u,d,f)=>new Promise((p,h)=>{if(f===i.length)return p(a(d+1));let m=i[f];dFt(u+m,{pathExt:o},(g,A)=>{if(!g&&A)if(e.all)s.push(u+m);else return p(u+m);return p(c(u,d,f+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},PLn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=pFt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=uFt.join(c,t),d=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let f=0;f<n.length;f++){let p=d+n[f];try{if(dFt.sync(p,{pathExt:i}))if(e.all)o.push(p);else return p}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw fFt(t)};mFt.exports=hFt;hFt.sync=PLn});var yFt=D((tUo,NUe)=>{"use strict";var AFt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};NUe.exports=AFt;NUe.exports.default=AFt});var bFt=D((rUo,CFt)=>{"use strict";var EFt=ye("path"),LLn=gFt(),FLn=yFt();function vFt(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=LLn.sync(t.command,{path:r[FLn({env:r})],pathExt:e?EFt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=EFt.resolve(i?t.options.cwd:"",s)),s}function ULn(t){return vFt(t)||vFt(t,!0)}CFt.exports=ULn});var xFt=D((nUo,kUe)=>{"use strict";var OUe=/([()\][%!^"`<>&|;, *?])/g;function QLn(t){return t=t.replace(OUe,"^$1"),t}function qLn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(OUe,"^$1"),e&&(t=t.replace(OUe,"^$1")),t}kUe.exports.command=QLn;kUe.exports.argument=qLn});var wFt=D((iUo,SFt)=>{"use strict";SFt.exports=/^#!(.*)/});var TFt=D((oUo,_Ft)=>{"use strict";var GLn=wFt();_Ft.exports=(t="")=>{let e=t.match(GLn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var DFt=D((sUo,IFt)=>{"use strict";var MUe=ye("fs"),HLn=TFt();function VLn(t){let r=Buffer.alloc(150),n;try{n=MUe.openSync(t,"r"),MUe.readSync(n,r,0,150,0),MUe.closeSync(n)}catch{}return HLn(r.toString())}IFt.exports=VLn});var OFt=D((aUo,NFt)=>{"use strict";var WLn=ye("path"),RFt=bFt(),BFt=xFt(),$Ln=DFt(),jLn=process.platform==="win32",zLn=/\.(?:com|exe)$/i,YLn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function JLn(t){t.file=RFt(t);let e=t.file&&$Ln(t.file);return e?(t.args.unshift(t.file),t.command=e,RFt(t)):t.file}function KLn(t){if(!jLn)return t;let e=JLn(t),r=!zLn.test(e);if(t.options.forceShell||r){let n=YLn.test(e);t.command=WLn.normalize(t.command),t.command=BFt.command(t.command),t.args=t.args.map(o=>BFt.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function XLn(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:KLn(n)}NFt.exports=XLn});var PFt=D((lUo,MFt)=>{"use strict";var PUe=process.platform==="win32";function LUe(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function ZLn(t,e){if(!PUe)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kFt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kFt(t,e){return PUe&&t===1&&!e.file?LUe(e.original,"spawn"):null}function eFn(t,e){return PUe&&t===1&&!e.file?LUe(e.original,"spawnSync"):null}MFt.exports={hookChildProcess:ZLn,verifyENOENT:kFt,verifyENOENTSync:eFn,notFoundError:LUe}});var UFt=D((cUo,EU)=>{"use strict";var LFt=ye("child_process"),FUe=OFt(),UUe=PFt();function FFt(t,e,r){let n=FUe(t,e,r),i=LFt.spawn(n.command,n.args,n.options);return UUe.hookChildProcess(i,n),i}function tFn(t,e,r){let n=FUe(t,e,r),i=LFt.spawnSync(n.command,n.args,n.options);return i.error=i.error||UUe.verifyENOENTSync(i.status,n),i}EU.exports=FFt;EU.exports.spawn=FFt;EU.exports.sync=tFn;EU.exports._parse=FUe;EU.exports._enoent=UUe});function rFn(t){return oS.parse(JSON.parse(t))}function QFt(t){return JSON.stringify(t)+`
|
|
836
836
|
`}var rme,qFt=ae(()=>{sS();rme=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
837
837
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),rFn(r)}clear(){this._buffer=void 0}}});import nme from"node:process";import{PassThrough as nFn}from"node:stream";function oFn(){let t={};for(let e of iFn){let r=nme.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function sFn(){return"type"in nme}var GFt,iFn,vU,QUe=ae(()=>{GFt=Fe(UFt(),1);qFt();iFn=nme.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];vU=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new rme,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new nFn)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{var n,i,o,s,a;this._process=(0,GFt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...oFn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:nme.platform==="win32"&&sFn(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,d;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(d=this.onerror)===null||d===void 0||d.call(this,c)}),this._process.on("spawn",()=>{e()}),this._process.on("close",c=>{var u;this._process=void 0,(u=this.onclose)===null||u===void 0||u.call(this)}),(o=this._process.stdin)===null||o===void 0||o.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),(s=this._process.stdout)===null||s===void 0||s.on("data",c=>{this._readBuffer.append(c),this.processReadBuffer()}),(a=this._process.stdout)===null||a===void 0||a.on("error",c=>{var u;(u=this.onerror)===null||u===void 0||u.call(this,c)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,r;return this._stderrStream?this._stderrStream:(r=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&r!==void 0?r:null}get pid(){var e,r;return(r=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&r!==void 0?r:null}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(r=>{var n;if(!(!((n=this._process)===null||n===void 0)&&n.stdin))throw new Error("Not connected");let i=QFt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function qUe(t){}function ome(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=qUe,onError:r=qUe,onRetry:n=qUe,onComment:i}=t,o="",s=!0,a,c="",u="";function d(g){let A=s?g.replace(/^\xEF\xBB\xBF/,""):g,[y,E]=aFn(`${o}${A}`);for(let C of y)f(C);o=E,s=!1}function f(g){if(g===""){h();return}if(g.startsWith(":")){i&&i(g.slice(g.startsWith(": ")?2:1));return}let A=g.indexOf(":");if(A!==-1){let y=g.slice(0,A),E=g[A+1]===" "?2:1,C=g.slice(A+E);p(y,C,g);return}p(g,"",g)}function p(g,A,y){switch(g){case"event":u=A;break;case"data":c=`${c}${A}
|
|
838
838
|
`;break;case"id":a=A.includes("\0")?void 0:A;break;case"retry":/^\d+$/.test(A)?n(parseInt(A,10)):r(new ime(`Invalid \`retry\` value: "${A}"`,{type:"invalid-retry",value:A,line:y}));break;default:r(new ime(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:A,line:y}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
|
|
839
839
|
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(g={}){o&&g.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function aFn(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
|
|
840
840
|
`,n),s=-1;if(i!==-1&&o!==-1?s=Math.min(i,o):i!==-1?i===t.length-1?s=-1:s=i:o!==-1&&(s=o),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
841
|
-
`&&n++}}return[e,r]}var ime,GUe=ae(()=>{ime=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function lFn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function HUe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(HUe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${HUe(t.cause)}`:t.message:`${t}`}function HFt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function cFn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var ame,WFt,KUe,Ss,Hf,au,z8,jg,VD,CU,sme,lme,pX,SU,hX,uS,bU,wU,xU,dX,c4,VUe,WUe,$Ue,VFt,jUe,zUe,fX,YUe,JUe,WD,$Ft=ae(()=>{GUe();ame=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(HFt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(HFt(this),r)}};WFt=t=>{throw TypeError(t)},KUe=(t,e,r)=>e.has(t)||WFt("Cannot "+r),Ss=(t,e,r)=>(KUe(t,e,"read from private field"),r?r.call(t):e.get(t)),Hf=(t,e,r)=>e.has(t)?WFt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),au=(t,e,r,n)=>(KUe(t,e,"write to private field"),e.set(t,r),r),z8=(t,e,r)=>(KUe(t,e,"access private method"),r),WD=class extends EventTarget{constructor(e,r){var n,i;super(),Hf(this,c4),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Hf(this,jg),Hf(this,VD),Hf(this,CU),Hf(this,sme),Hf(this,lme),Hf(this,pX),Hf(this,SU),Hf(this,hX,null),Hf(this,uS),Hf(this,bU),Hf(this,wU,null),Hf(this,xU,null),Hf(this,dX,null),Hf(this,WUe,async o=>{var s;Ss(this,bU).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){z8(this,c4,fX).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?au(this,CU,new URL(o.url)):au(this,CU,void 0),u!==200){z8(this,c4,fX).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){z8(this,c4,fX).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ss(this,jg)===this.CLOSED)return;au(this,jg,this.OPEN);let f=new Event("open");if((s=Ss(this,dX))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){z8(this,c4,fX).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Ss(this,bU).feed(p.decode(A,{stream:!g})),g&&(m=!1,Ss(this,bU).reset(),z8(this,c4,YUe).call(this))}while(m)}),Hf(this,$Ue,o=>{au(this,uS,void 0),!(o.name==="AbortError"||o.type==="aborted")&&z8(this,c4,YUe).call(this,HUe(o))}),Hf(this,jUe,o=>{typeof o.id=="string"&&au(this,hX,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ss(this,CU)?Ss(this,CU).origin:Ss(this,VD).origin,lastEventId:o.id||""});Ss(this,xU)&&(!o.event||o.event==="message")&&Ss(this,xU).call(this,s),this.dispatchEvent(s)}),Hf(this,zUe,o=>{au(this,pX,o)}),Hf(this,JUe,()=>{au(this,SU,void 0),Ss(this,jg)===this.CONNECTING&&z8(this,c4,VUe).call(this)});try{if(e instanceof URL)au(this,VD,e);else if(typeof e=="string")au(this,VD,new URL(e,cFn()));else throw new Error("Invalid URL")}catch{throw lFn("An invalid or illegal string was specified")}au(this,bU,ome({onEvent:Ss(this,jUe),onRetry:Ss(this,zUe)})),au(this,jg,this.CONNECTING),au(this,pX,3e3),au(this,lme,(n=r?.fetch)!=null?n:globalThis.fetch),au(this,sme,(i=r?.withCredentials)!=null?i:!1),z8(this,c4,VUe).call(this)}get readyState(){return Ss(this,jg)}get url(){return Ss(this,VD).href}get withCredentials(){return Ss(this,sme)}get onerror(){return Ss(this,wU)}set onerror(e){au(this,wU,e)}get onmessage(){return Ss(this,xU)}set onmessage(e){au(this,xU,e)}get onopen(){return Ss(this,dX)}set onopen(e){au(this,dX,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ss(this,SU)&&clearTimeout(Ss(this,SU)),Ss(this,jg)!==this.CLOSED&&(Ss(this,uS)&&Ss(this,uS).abort(),au(this,jg,this.CLOSED),au(this,uS,void 0))}};jg=new WeakMap,VD=new WeakMap,CU=new WeakMap,sme=new WeakMap,lme=new WeakMap,pX=new WeakMap,SU=new WeakMap,hX=new WeakMap,uS=new WeakMap,bU=new WeakMap,wU=new WeakMap,xU=new WeakMap,dX=new WeakMap,c4=new WeakSet,VUe=function(){au(this,jg,this.CONNECTING),au(this,uS,new AbortController),Ss(this,lme)(Ss(this,VD),z8(this,c4,VFt).call(this)).then(Ss(this,WUe)).catch(Ss(this,$Ue))},WUe=new WeakMap,$Ue=new WeakMap,VFt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ss(this,hX)?{"Last-Event-ID":Ss(this,hX)}:void 0},cache:"no-store",signal:(t=Ss(this,uS))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},jUe=new WeakMap,zUe=new WeakMap,fX=function(t,e){var r;Ss(this,jg)!==this.CLOSED&&au(this,jg,this.CLOSED);let n=new ame("error",{code:e,message:t});(r=Ss(this,wU))==null||r.call(this,n),this.dispatchEvent(n)},YUe=function(t,e){var r;if(Ss(this,jg)===this.CLOSED)return;au(this,jg,this.CONNECTING);let n=new ame("error",{code:e,message:t});(r=Ss(this,wU))==null||r.call(this,n),this.dispatchEvent(n),au(this,SU,setTimeout(Ss(this,JUe),Ss(this,pX)))},JUe=new WeakMap,WD.CONNECTING=0,WD.OPEN=1,WD.CLOSED=2});async function uFn(t){return(await XUe).getRandomValues(new Uint8Array(t))}async function dFn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await uFn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function fFn(t){return await dFn(t)}async function pFn(t){let e=await(await XUe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function ZUe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await fFn(t),r=await pFn(e);return{code_verifier:e,code_challenge:r}}var XUe,jFt=ae(()=>{XUe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Dp,zFt,eQe,hFn,YFt,tQe,JFt,mFn,gFn,KFt,CUo,bUo,rQe=ae(()=>{iS();Dp=te.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:te.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),te.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),zFt=te.object({resource:te.string().url(),authorization_servers:te.array(Dp).optional(),jwks_uri:te.string().url().optional(),scopes_supported:te.array(te.string()).optional(),bearer_methods_supported:te.array(te.string()).optional(),resource_signing_alg_values_supported:te.array(te.string()).optional(),resource_name:te.string().optional(),resource_documentation:te.string().optional(),resource_policy_uri:te.string().url().optional(),resource_tos_uri:te.string().url().optional(),tls_client_certificate_bound_access_tokens:te.boolean().optional(),authorization_details_types_supported:te.array(te.string()).optional(),dpop_signing_alg_values_supported:te.array(te.string()).optional(),dpop_bound_access_tokens_required:te.boolean().optional()}).passthrough(),eQe=te.object({issuer:te.string(),authorization_endpoint:Dp,token_endpoint:Dp,registration_endpoint:Dp.optional(),scopes_supported:te.array(te.string()).optional(),response_types_supported:te.array(te.string()),response_modes_supported:te.array(te.string()).optional(),grant_types_supported:te.array(te.string()).optional(),token_endpoint_auth_methods_supported:te.array(te.string()).optional(),token_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),service_documentation:Dp.optional(),revocation_endpoint:Dp.optional(),revocation_endpoint_auth_methods_supported:te.array(te.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),introspection_endpoint:te.string().optional(),introspection_endpoint_auth_methods_supported:te.array(te.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),code_challenge_methods_supported:te.array(te.string()).optional()}).passthrough(),hFn=te.object({issuer:te.string(),authorization_endpoint:Dp,token_endpoint:Dp,userinfo_endpoint:Dp.optional(),jwks_uri:Dp,registration_endpoint:Dp.optional(),scopes_supported:te.array(te.string()).optional(),response_types_supported:te.array(te.string()),response_modes_supported:te.array(te.string()).optional(),grant_types_supported:te.array(te.string()).optional(),acr_values_supported:te.array(te.string()).optional(),subject_types_supported:te.array(te.string()),id_token_signing_alg_values_supported:te.array(te.string()),id_token_encryption_alg_values_supported:te.array(te.string()).optional(),id_token_encryption_enc_values_supported:te.array(te.string()).optional(),userinfo_signing_alg_values_supported:te.array(te.string()).optional(),userinfo_encryption_alg_values_supported:te.array(te.string()).optional(),userinfo_encryption_enc_values_supported:te.array(te.string()).optional(),request_object_signing_alg_values_supported:te.array(te.string()).optional(),request_object_encryption_alg_values_supported:te.array(te.string()).optional(),request_object_encryption_enc_values_supported:te.array(te.string()).optional(),token_endpoint_auth_methods_supported:te.array(te.string()).optional(),token_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),display_values_supported:te.array(te.string()).optional(),claim_types_supported:te.array(te.string()).optional(),claims_supported:te.array(te.string()).optional(),service_documentation:te.string().optional(),claims_locales_supported:te.array(te.string()).optional(),ui_locales_supported:te.array(te.string()).optional(),claims_parameter_supported:te.boolean().optional(),request_parameter_supported:te.boolean().optional(),request_uri_parameter_supported:te.boolean().optional(),require_request_uri_registration:te.boolean().optional(),op_policy_uri:Dp.optional(),op_tos_uri:Dp.optional()}).passthrough(),YFt=hFn.merge(eQe.pick({code_challenge_methods_supported:!0})),tQe=te.object({access_token:te.string(),id_token:te.string().optional(),token_type:te.string(),expires_in:te.number().optional(),scope:te.string().optional(),refresh_token:te.string().optional()}).strip(),JFt=te.object({error:te.string(),error_description:te.string().optional(),error_uri:te.string().optional()}),mFn=te.object({redirect_uris:te.array(Dp),token_endpoint_auth_method:te.string().optional(),grant_types:te.array(te.string()).optional(),response_types:te.array(te.string()).optional(),client_name:te.string().optional(),client_uri:Dp.optional(),logo_uri:Dp.optional(),scope:te.string().optional(),contacts:te.array(te.string()).optional(),tos_uri:Dp.optional(),policy_uri:te.string().optional(),jwks_uri:Dp.optional(),jwks:te.any().optional(),software_id:te.string().optional(),software_version:te.string().optional(),software_statement:te.string().optional()}).strip(),gFn=te.object({client_id:te.string(),client_secret:te.string().optional(),client_id_issued_at:te.number().optional(),client_secret_expires_at:te.number().optional()}).strip(),KFt=mFn.merge(gFn),CUo=te.object({error:te.string(),error_description:te.string().optional()}).strip(),bUo=te.object({token:te.string(),token_type_hint:te.string().optional()}).strip()});function XFt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function ZFt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var eUt=ae(()=>{});var lf,mX,$D,jD,zD,gX,AX,yX,Y8,EX,vX,CX,bX,xX,SX,wX,_X,tUt,rUt=ae(()=>{lf=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},mX=class extends lf{};mX.errorCode="invalid_request";$D=class extends lf{};$D.errorCode="invalid_client";jD=class extends lf{};jD.errorCode="invalid_grant";zD=class extends lf{};zD.errorCode="unauthorized_client";gX=class extends lf{};gX.errorCode="unsupported_grant_type";AX=class extends lf{};AX.errorCode="invalid_scope";yX=class extends lf{};yX.errorCode="access_denied";Y8=class extends lf{};Y8.errorCode="server_error";EX=class extends lf{};EX.errorCode="temporarily_unavailable";vX=class extends lf{};vX.errorCode="unsupported_response_type";CX=class extends lf{};CX.errorCode="unsupported_token_type";bX=class extends lf{};bX.errorCode="invalid_token";xX=class extends lf{};xX.errorCode="method_not_allowed";SX=class extends lf{};SX.errorCode="too_many_requests";wX=class extends lf{};wX.errorCode="invalid_client_metadata";_X=class extends lf{};_X.errorCode="insufficient_scope";tUt={[mX.errorCode]:mX,[$D.errorCode]:$D,[jD.errorCode]:jD,[zD.errorCode]:zD,[gX.errorCode]:gX,[AX.errorCode]:AX,[yX.errorCode]:yX,[Y8.errorCode]:Y8,[EX.errorCode]:EX,[vX.errorCode]:vX,[CX.errorCode]:CX,[bX.errorCode]:bX,[xX.errorCode]:xX,[SX.errorCode]:SX,[wX.errorCode]:wX,[_X.errorCode]:_X}});function iUt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function oUt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":AFn(i,o,r);return;case"client_secret_post":yFn(i,o,n);return;case"none":EFn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function AFn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function yFn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function EFn(t,e){e.set("client_id",t)}async function iQe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=JFt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=tUt[i]||Y8;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Y8(i)}}async function dS(t,e){var r,n;try{return await nQe(t,e)}catch(i){if(i instanceof $D||i instanceof zD)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await nQe(t,e);if(i instanceof jD)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await nQe(t,e);throw i}}async function nQe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await CFn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await vFn(e,t,s),u=await _Fn(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await IFn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await sQe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await aQe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof lf)||g instanceof Y8))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await TFn(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function vFn(t,e,r){let n=XFt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!ZFt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function TX(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function CFn(t,e,r=fetch){let n=await SFn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return zFt.parse(await n.json())}async function oQe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?oQe(t,void 0,r):void 0;throw n}}function bFn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function nUt(t,e,r=fetch){return await oQe(t,{"MCP-Protocol-Version":e},r)}function xFn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function SFn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:mU,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=bFn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await nUt(c,a,r);if(!n?.metadataUrl&&xFn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await nUt(d,a,r)}return u}function wFn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function _Fn(t,{fetchFn:e=fetch,protocolVersion:r=mU}={}){var n;let i={"MCP-Protocol-Version":r},o=wFn(t);for(let{url:s,type:a}of o){let c=await oQe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return eQe.parse(await c.json());{let u=YFt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function TFn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await ZUe(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function sQe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=iUt(r,g);oUt(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await iQe(m);return tQe.parse(await m.json())}async function aQe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=iUt(r,h);oUt(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await iQe(p);return tQe.parse({refresh_token:n,...await p.json()})}async function IFn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await iQe(o);return KFt.parse(await o.json())}var zg,cme=ae(()=>{jFt();sS();rQe();rQe();eUt();rUt();zg=class extends Error{constructor(e){super(e??"Unauthorized")}}});var lQe,_U,sUt=ae(()=>{$Ft();sS();cme();lQe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},_U=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new zg("No auth provider");let r;try{r=await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new zg;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new WD(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=TX(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new lQe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=oS.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new zg("No auth provider");if(await dS(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=TX(a),await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var ume,aUt=ae(()=>{GUe();ume=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=ome({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var DFn,IX,fS,cQe=ae(()=>{sS();cme();aUt();DFn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},IX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},fS=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:DFn}async _authThenStart(){var e;if(!this._authProvider)throw new zg("No auth provider");let r;try{r=await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new zg;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new IX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new ume).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=oS.parse(JSON.parse(h.data));o!==void 0&&sX(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new zg("No auth provider");if(await dS(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:D0e(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=TX(f),await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg;return this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(f.status===202){qMt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>oS.parse(E)):[oS.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new IX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new IX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as RFn}from"node:fs/promises";var DX,RX,YD,uQe=ae(()=>{"use strict";CL();cme();Vn();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(DX||(DX={}));RX=class extends Error{code;constructor(e,r){super(r),this.code=e}},YD=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||E8.default}async start(){if(this._isClosed)throw new Error(M.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await aQe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(M.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new RX(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new RX(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(M.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await sQe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(M.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===E8.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(M.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(M.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==E8.default.OPEN)throw new Error(M.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new RX(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:DX.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.35-beta.0",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:DX.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await RFn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:DX.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var lUt,dme,cUt=ae(()=>{"use strict";lUt=Fe(dK(),1);Vn();dme=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(M.t("mcp.auth.scopesRequired"));this.auth=new lUt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(M.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as BFn}from"node:child_process";import{promisify as NFn}from"node:util";import{platform as OFn}from"node:os";import{URL as kFn}from"node:url";function MFn(t){let e;try{e=new kFn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function dUt(t){MFn(t);let e=OFn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await uUt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await uUt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var uUt,fUt=ae(()=>{"use strict";uUt=NFn(BFn)});function ls(t){return t instanceof Error&&"code"in t}function or(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function dQe(t){if(t&&typeof t=="object"&&"response"in t){let r=PFn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new pme(r.error.message);case 401:return new pS(r.error.message);case 403:return new fme(r.error.message);default:}}return t}function PFn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var fme,pS,pme,lu=ae(()=>{"use strict";fme=class extends Error{},pS=class extends Error{},pme=class extends Error{}});import{promises as TU}from"node:fs";import*as hme from"node:path";import*as pUt from"node:os";var Rp,mme=ae(()=>{"use strict";lu();Vn();Rp=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=pUt.homedir();return hme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=hme.dirname(this.getTokenFilePath());await TU.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await TU.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(M.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:or(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await TU.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(M.t("mcp.tokenStorage.errors.failedToSaveToken",{error:or(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await TU.unlink(i):await TU.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(M.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:or(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await TU.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(M.t("mcp.tokenStorage.errors.failedToClearTokens",{error:or(e)}))}}}});var Bp,gme=ae(()=>{"use strict";lu();Vn();Bp=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${or(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${or(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(M.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(M.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${or(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(M.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(M.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as hUt from"node:http";import*as BX from"node:crypto";import{URL as fQe}from"node:url";var b1,pQe=ae(()=>{"use strict";fUt();mme();lu();gme();Vn();b1=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(M.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Bp.extractBaseUrl(e);return Bp.discoverOAuthConfig(r)}static generatePKCEParams(){let e=BX.randomBytes(32).toString("base64url"),r=BX.createHash("sha256").update(e).digest("base64url"),n=BX.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=hUt.createServer(async(o,s)=>{try{let a=new fQe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(M.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
841
|
+
`&&n++}}return[e,r]}var ime,GUe=ae(()=>{ime=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}});function lFn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function HUe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(HUe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${HUe(t.cause)}`:t.message:`${t}`}function HFt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function cFn(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var ame,WFt,KUe,Ss,Hf,au,z8,jg,VD,CU,sme,lme,pX,SU,hX,uS,bU,wU,xU,dX,c4,VUe,WUe,$Ue,VFt,jUe,zUe,fX,YUe,JUe,WD,$Ft=ae(()=>{GUe();ame=class extends Event{constructor(e,r){var n,i;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(i=r?.message)!=null?i:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(HFt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(HFt(this),r)}};WFt=t=>{throw TypeError(t)},KUe=(t,e,r)=>e.has(t)||WFt("Cannot "+r),Ss=(t,e,r)=>(KUe(t,e,"read from private field"),r?r.call(t):e.get(t)),Hf=(t,e,r)=>e.has(t)?WFt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),au=(t,e,r,n)=>(KUe(t,e,"write to private field"),e.set(t,r),r),z8=(t,e,r)=>(KUe(t,e,"access private method"),r),WD=class extends EventTarget{constructor(e,r){var n,i;super(),Hf(this,c4),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Hf(this,jg),Hf(this,VD),Hf(this,CU),Hf(this,sme),Hf(this,lme),Hf(this,pX),Hf(this,SU),Hf(this,hX,null),Hf(this,uS),Hf(this,bU),Hf(this,wU,null),Hf(this,xU,null),Hf(this,dX,null),Hf(this,WUe,async o=>{var s;Ss(this,bU).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){z8(this,c4,fX).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?au(this,CU,new URL(o.url)):au(this,CU,void 0),u!==200){z8(this,c4,fX).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){z8(this,c4,fX).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ss(this,jg)===this.CLOSED)return;au(this,jg,this.OPEN);let f=new Event("open");if((s=Ss(this,dX))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){z8(this,c4,fX).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),m=!0;do{let{done:g,value:A}=await h.read();A&&Ss(this,bU).feed(p.decode(A,{stream:!g})),g&&(m=!1,Ss(this,bU).reset(),z8(this,c4,YUe).call(this))}while(m)}),Hf(this,$Ue,o=>{au(this,uS,void 0),!(o.name==="AbortError"||o.type==="aborted")&&z8(this,c4,YUe).call(this,HUe(o))}),Hf(this,jUe,o=>{typeof o.id=="string"&&au(this,hX,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ss(this,CU)?Ss(this,CU).origin:Ss(this,VD).origin,lastEventId:o.id||""});Ss(this,xU)&&(!o.event||o.event==="message")&&Ss(this,xU).call(this,s),this.dispatchEvent(s)}),Hf(this,zUe,o=>{au(this,pX,o)}),Hf(this,JUe,()=>{au(this,SU,void 0),Ss(this,jg)===this.CONNECTING&&z8(this,c4,VUe).call(this)});try{if(e instanceof URL)au(this,VD,e);else if(typeof e=="string")au(this,VD,new URL(e,cFn()));else throw new Error("Invalid URL")}catch{throw lFn("An invalid or illegal string was specified")}au(this,bU,ome({onEvent:Ss(this,jUe),onRetry:Ss(this,zUe)})),au(this,jg,this.CONNECTING),au(this,pX,3e3),au(this,lme,(n=r?.fetch)!=null?n:globalThis.fetch),au(this,sme,(i=r?.withCredentials)!=null?i:!1),z8(this,c4,VUe).call(this)}get readyState(){return Ss(this,jg)}get url(){return Ss(this,VD).href}get withCredentials(){return Ss(this,sme)}get onerror(){return Ss(this,wU)}set onerror(e){au(this,wU,e)}get onmessage(){return Ss(this,xU)}set onmessage(e){au(this,xU,e)}get onopen(){return Ss(this,dX)}set onopen(e){au(this,dX,e)}addEventListener(e,r,n){let i=r;super.addEventListener(e,i,n)}removeEventListener(e,r,n){let i=r;super.removeEventListener(e,i,n)}close(){Ss(this,SU)&&clearTimeout(Ss(this,SU)),Ss(this,jg)!==this.CLOSED&&(Ss(this,uS)&&Ss(this,uS).abort(),au(this,jg,this.CLOSED),au(this,uS,void 0))}};jg=new WeakMap,VD=new WeakMap,CU=new WeakMap,sme=new WeakMap,lme=new WeakMap,pX=new WeakMap,SU=new WeakMap,hX=new WeakMap,uS=new WeakMap,bU=new WeakMap,wU=new WeakMap,xU=new WeakMap,dX=new WeakMap,c4=new WeakSet,VUe=function(){au(this,jg,this.CONNECTING),au(this,uS,new AbortController),Ss(this,lme)(Ss(this,VD),z8(this,c4,VFt).call(this)).then(Ss(this,WUe)).catch(Ss(this,$Ue))},WUe=new WeakMap,$Ue=new WeakMap,VFt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ss(this,hX)?{"Last-Event-ID":Ss(this,hX)}:void 0},cache:"no-store",signal:(t=Ss(this,uS))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},jUe=new WeakMap,zUe=new WeakMap,fX=function(t,e){var r;Ss(this,jg)!==this.CLOSED&&au(this,jg,this.CLOSED);let n=new ame("error",{code:e,message:t});(r=Ss(this,wU))==null||r.call(this,n),this.dispatchEvent(n)},YUe=function(t,e){var r;if(Ss(this,jg)===this.CLOSED)return;au(this,jg,this.CONNECTING);let n=new ame("error",{code:e,message:t});(r=Ss(this,wU))==null||r.call(this,n),this.dispatchEvent(n),au(this,SU,setTimeout(Ss(this,JUe),Ss(this,pX)))},JUe=new WeakMap,WD.CONNECTING=0,WD.OPEN=1,WD.CLOSED=2});async function uFn(t){return(await XUe).getRandomValues(new Uint8Array(t))}async function dFn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await uFn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function fFn(t){return await dFn(t)}async function pFn(t){let e=await(await XUe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function ZUe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await fFn(t),r=await pFn(e);return{code_verifier:e,code_challenge:r}}var XUe,jFt=ae(()=>{XUe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Dp,zFt,eQe,hFn,YFt,tQe,JFt,mFn,gFn,KFt,CUo,bUo,rQe=ae(()=>{iS();Dp=te.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:te.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),te.NEVER}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),zFt=te.object({resource:te.string().url(),authorization_servers:te.array(Dp).optional(),jwks_uri:te.string().url().optional(),scopes_supported:te.array(te.string()).optional(),bearer_methods_supported:te.array(te.string()).optional(),resource_signing_alg_values_supported:te.array(te.string()).optional(),resource_name:te.string().optional(),resource_documentation:te.string().optional(),resource_policy_uri:te.string().url().optional(),resource_tos_uri:te.string().url().optional(),tls_client_certificate_bound_access_tokens:te.boolean().optional(),authorization_details_types_supported:te.array(te.string()).optional(),dpop_signing_alg_values_supported:te.array(te.string()).optional(),dpop_bound_access_tokens_required:te.boolean().optional()}).passthrough(),eQe=te.object({issuer:te.string(),authorization_endpoint:Dp,token_endpoint:Dp,registration_endpoint:Dp.optional(),scopes_supported:te.array(te.string()).optional(),response_types_supported:te.array(te.string()),response_modes_supported:te.array(te.string()).optional(),grant_types_supported:te.array(te.string()).optional(),token_endpoint_auth_methods_supported:te.array(te.string()).optional(),token_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),service_documentation:Dp.optional(),revocation_endpoint:Dp.optional(),revocation_endpoint_auth_methods_supported:te.array(te.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),introspection_endpoint:te.string().optional(),introspection_endpoint_auth_methods_supported:te.array(te.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),code_challenge_methods_supported:te.array(te.string()).optional()}).passthrough(),hFn=te.object({issuer:te.string(),authorization_endpoint:Dp,token_endpoint:Dp,userinfo_endpoint:Dp.optional(),jwks_uri:Dp,registration_endpoint:Dp.optional(),scopes_supported:te.array(te.string()).optional(),response_types_supported:te.array(te.string()),response_modes_supported:te.array(te.string()).optional(),grant_types_supported:te.array(te.string()).optional(),acr_values_supported:te.array(te.string()).optional(),subject_types_supported:te.array(te.string()),id_token_signing_alg_values_supported:te.array(te.string()),id_token_encryption_alg_values_supported:te.array(te.string()).optional(),id_token_encryption_enc_values_supported:te.array(te.string()).optional(),userinfo_signing_alg_values_supported:te.array(te.string()).optional(),userinfo_encryption_alg_values_supported:te.array(te.string()).optional(),userinfo_encryption_enc_values_supported:te.array(te.string()).optional(),request_object_signing_alg_values_supported:te.array(te.string()).optional(),request_object_encryption_alg_values_supported:te.array(te.string()).optional(),request_object_encryption_enc_values_supported:te.array(te.string()).optional(),token_endpoint_auth_methods_supported:te.array(te.string()).optional(),token_endpoint_auth_signing_alg_values_supported:te.array(te.string()).optional(),display_values_supported:te.array(te.string()).optional(),claim_types_supported:te.array(te.string()).optional(),claims_supported:te.array(te.string()).optional(),service_documentation:te.string().optional(),claims_locales_supported:te.array(te.string()).optional(),ui_locales_supported:te.array(te.string()).optional(),claims_parameter_supported:te.boolean().optional(),request_parameter_supported:te.boolean().optional(),request_uri_parameter_supported:te.boolean().optional(),require_request_uri_registration:te.boolean().optional(),op_policy_uri:Dp.optional(),op_tos_uri:Dp.optional()}).passthrough(),YFt=hFn.merge(eQe.pick({code_challenge_methods_supported:!0})),tQe=te.object({access_token:te.string(),id_token:te.string().optional(),token_type:te.string(),expires_in:te.number().optional(),scope:te.string().optional(),refresh_token:te.string().optional()}).strip(),JFt=te.object({error:te.string(),error_description:te.string().optional(),error_uri:te.string().optional()}),mFn=te.object({redirect_uris:te.array(Dp),token_endpoint_auth_method:te.string().optional(),grant_types:te.array(te.string()).optional(),response_types:te.array(te.string()).optional(),client_name:te.string().optional(),client_uri:Dp.optional(),logo_uri:Dp.optional(),scope:te.string().optional(),contacts:te.array(te.string()).optional(),tos_uri:Dp.optional(),policy_uri:te.string().optional(),jwks_uri:Dp.optional(),jwks:te.any().optional(),software_id:te.string().optional(),software_version:te.string().optional(),software_statement:te.string().optional()}).strip(),gFn=te.object({client_id:te.string(),client_secret:te.string().optional(),client_id_issued_at:te.number().optional(),client_secret_expires_at:te.number().optional()}).strip(),KFt=mFn.merge(gFn),CUo=te.object({error:te.string(),error_description:te.string().optional()}).strip(),bUo=te.object({token:te.string(),token_type_hint:te.string().optional()}).strip()});function XFt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function ZFt({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let i=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return i.startsWith(o)}var eUt=ae(()=>{});var lf,mX,$D,jD,zD,gX,AX,yX,Y8,EX,vX,CX,bX,xX,SX,wX,_X,tUt,rUt=ae(()=>{lf=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},mX=class extends lf{};mX.errorCode="invalid_request";$D=class extends lf{};$D.errorCode="invalid_client";jD=class extends lf{};jD.errorCode="invalid_grant";zD=class extends lf{};zD.errorCode="unauthorized_client";gX=class extends lf{};gX.errorCode="unsupported_grant_type";AX=class extends lf{};AX.errorCode="invalid_scope";yX=class extends lf{};yX.errorCode="access_denied";Y8=class extends lf{};Y8.errorCode="server_error";EX=class extends lf{};EX.errorCode="temporarily_unavailable";vX=class extends lf{};vX.errorCode="unsupported_response_type";CX=class extends lf{};CX.errorCode="unsupported_token_type";bX=class extends lf{};bX.errorCode="invalid_token";xX=class extends lf{};xX.errorCode="method_not_allowed";SX=class extends lf{};SX.errorCode="too_many_requests";wX=class extends lf{};wX.errorCode="invalid_client_metadata";_X=class extends lf{};_X.errorCode="insufficient_scope";tUt={[mX.errorCode]:mX,[$D.errorCode]:$D,[jD.errorCode]:jD,[zD.errorCode]:zD,[gX.errorCode]:gX,[AX.errorCode]:AX,[yX.errorCode]:yX,[Y8.errorCode]:Y8,[EX.errorCode]:EX,[vX.errorCode]:vX,[CX.errorCode]:CX,[bX.errorCode]:bX,[xX.errorCode]:xX,[SX.errorCode]:SX,[wX.errorCode]:wX,[_X.errorCode]:_X}});function iUt(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function oUt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":AFn(i,o,r);return;case"client_secret_post":yFn(i,o,n);return;case"none":EFn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function AFn(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function yFn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function EFn(t,e){e.set("client_id",t)}async function iQe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=JFt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=tUt[i]||Y8;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new Y8(i)}}async function dS(t,e){var r,n;try{return await nQe(t,e)}catch(i){if(i instanceof $D||i instanceof zD)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await nQe(t,e);if(i instanceof jD)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await nQe(t,e);throw i}}async function nQe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await CFn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await vFn(e,t,s),u=await _Fn(a,{fetchFn:o}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let g=await IFn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(g),d=g}if(r!==void 0){let g=await t.codeVerifier(),A=await sQe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:g,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let g=await aQe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof lf)||g instanceof Y8))throw g}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await TFn(a,{metadata:u,clientInformation:d,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(m),await t.redirectToAuthorization(h),"REDIRECT"}async function vFn(t,e,r){let n=XFt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!ZFt({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function TX(t){let e=t.headers.get("WWW-Authenticate");if(!e)return;let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;let o=/resource_metadata="([^"]*)"/.exec(e);if(o)try{return new URL(o[1])}catch{return}}async function CFn(t,e,r=fetch){let n=await SFn(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return zFt.parse(await n.json())}async function oQe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?oQe(t,void 0,r):void 0;throw n}}function bFn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function nUt(t,e,r=fetch){return await oQe(t,{"MCP-Protocol-Version":e},r)}function xFn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function SFn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:mU,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=bFn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await nUt(c,a,r);if(!n?.metadataUrl&&xFn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await nUt(d,a,r)}return u}function wFn(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let i=e.pathname;return i.endsWith("/")&&(i=i.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${i}`,e.origin),type:"oidc"}),n.push({url:new URL(`${i}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function _Fn(t,{fetchFn:e=fetch,protocolVersion:r=mU}={}){var n;let i={"MCP-Protocol-Version":r},o=wFn(t);for(let{url:s,type:a}of o){let c=await oQe(s,i,e);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(a==="oauth")return eQe.parse(await c.json());{let u=YFt.parse(await c.json());if(!(!((n=u.code_challenge_methods_supported)===null||n===void 0)&&n.includes("S256")))throw new Error(`Incompatible OIDC provider at ${s}: does not support S256 code challenge method required by MCP specification`);return u}}}}async function TFn(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:i,state:o,resource:s}){let a="code",c="S256",u;if(e){if(u=new URL(e.authorization_endpoint),!e.response_types_supported.includes(a))throw new Error(`Incompatible auth server: does not support response type ${a}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else u=new URL("/authorize",t);let d=await ZUe(),f=d.code_verifier,p=d.code_challenge;return u.searchParams.set("response_type",a),u.searchParams.set("client_id",r.client_id),u.searchParams.set("code_challenge",p),u.searchParams.set("code_challenge_method",c),u.searchParams.set("redirect_uri",String(n)),o&&u.searchParams.set("state",o),i&&u.searchParams.set("scope",i),i?.includes("offline_access")&&u.searchParams.append("prompt","consent"),s&&u.searchParams.set("resource",s.href),{authorizationUrl:u,codeVerifier:f}}async function sQe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let d="authorization_code",f=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(d))throw new Error(`Incompatible auth server: does not support grant type ${d}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:d,code:n,code_verifier:i,redirect_uri:String(o)});if(a)a(p,h,t,e);else{let g=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],A=iUt(r,g);oUt(A,r,p,h)}s&&h.set("resource",s.href);let m=await(c??fetch)(f,{method:"POST",headers:p,body:h});if(!m.ok)throw await iQe(m);return tQe.parse(await m.json())}async function aQe(t,{metadata:e,clientInformation:r,refreshToken:n,resource:i,addClientAuthentication:o,fetchFn:s}){var a;let c="refresh_token",u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);let d=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(d,f,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],m=iUt(r,h);oUt(m,r,d,f)}i&&f.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:d,body:f});if(!p.ok)throw await iQe(p);return tQe.parse({refresh_token:n,...await p.json()})}async function IFn(t,{metadata:e,clientMetadata:r,fetchFn:n}){let i;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");i=new URL(e.registration_endpoint)}else i=new URL("/register",t);let o=await(n??fetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw await iQe(o);return KFt.parse(await o.json())}var zg,cme=ae(()=>{jFt();sS();rQe();rQe();eUt();rUt();zg=class extends Error{constructor(e){super(e??"Unauthorized")}}});var lQe,_U,sUt=ae(()=>{$Ft();sS();cme();lQe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},_U=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new zg("No auth provider");let r;try{r=await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new zg;return await this._startOrAuth()}async _commonHeaders(){var e;let r={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;let i=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((o,s)=>{this._eventSource=new WD(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let d=await i(a,{...c,headers:u});return d.status===401&&d.headers.has("www-authenticate")&&(this._resourceMetadataUrl=TX(d)),d}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{var c;if(a.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let u=new lQe(a.code,a.message,a);s(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{var c;let u=a;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(d){s(d),(c=this.onerror)===null||c===void 0||c.call(this,d),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let d=a,f;try{f=oS.parse(JSON.parse(d.data))}catch(p){(c=this.onerror)===null||c===void 0||c.call(this,p);return}(u=this.onmessage)===null||u===void 0||u.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new zg("No auth provider");if(await dS(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,i;if(!this._endpoint)throw new Error("Not connected");try{let o=await this._commonHeaders();o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},a=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,s);if(!a.ok){if(a.status===401&&this._authProvider){if(this._resourceMetadataUrl=TX(a),await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg;return this.send(e)}let c=await a.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}setProtocolVersion(e){this._protocolVersion=e}}});var ume,aUt=ae(()=>{GUe();ume=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=ome({onEvent:s=>{o.enqueue(s)},onError(s){e==="terminate"?o.error(s):typeof e=="function"&&e(s)},onRetry:r,onComment:n})},transform(o){i.feed(o)}})}}});var DFn,IX,fS,cQe=ae(()=>{sS();cme();aUt();DFn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},IX=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},fS=class{constructor(e,r){var n;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:DFn}async _authThenStart(){var e;if(!this._authProvider)throw new zg("No auth provider");let r;try{r=await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new zg;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let r={};if(this._authProvider){let i=await this._authProvider.tokens();i&&(r.Authorization=`Bearer ${i.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);let n=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,i;let{resumptionToken:o}=e;try{let s=await this._commonHeaders();s.set("Accept","text/event-stream"),o&&s.set("last-event-id",o);let a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:s,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!a.ok){if(a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new IX(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}_getNextReconnectionDelay(e){let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,i=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),i)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,r=0){var n;let i=this._reconnectionOptions.maxRetries;if(i>0&&r>=i){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${i}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:i,replayMessageId:o}=r,s;(async()=>{var c,u,d,f;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new ume).getReader();for(;;){let{value:h,done:m}=await p.read();if(m)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let g=oS.parse(JSON.parse(h.data));o!==void 0&&sX(g)&&(g.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,g)}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g)}}}catch(p){if((d=this.onerror)===null||d===void 0||d.call(this,new Error(`SSE stream disconnected: ${p}`)),n&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:i,replayMessageId:o},0)}catch(h){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new zg("No auth provider");if(await dS(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,i,o,s;try{let{resumptionToken:a,onresumptiontoken:c}=r||{};if(a){this._startOrAuthSse({resumptionToken:a,replayMessageId:D0e(e)?e.id:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");let d={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},f=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,d),p=f.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=TX(f),await dS(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new zg;return this.send(e)}let A=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${A}`)}if(f.status===202){qMt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(A=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,A)});return}let m=(Array.isArray(e)?e:[e]).filter(A=>"method"in A&&"id"in A&&A.id!==void 0).length>0,g=f.headers.get("content-type");if(m)if(g?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(g?.includes("application/json")){let A=await f.json(),y=Array.isArray(A)?A.map(E=>oS.parse(E)):[oS.parse(A)];for(let E of y)(o=this.onmessage)===null||o===void 0||o.call(this,E)}else throw new IX(-1,`Unexpected content type: ${g}`)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{let i=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:i,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},s=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,o);if(!s.ok&&s.status!==405)throw new IX(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}}});import{readFile as RFn}from"node:fs/promises";var DX,RX,YD,uQe=ae(()=>{"use strict";CL();cme();Vn();(function(t){t.CLI_CONNECT="cli_connect",t.PING="ping",t.GET_ACTIVE_FILE="get_active_file",t.GET_FILE_CONTENT="get_file_content",t.GET_SELECTED_TEXT="get_selected_text",t.SHOW_DIFF="show_diff"})(DX||(DX={}));RX=class extends Error{code;constructor(e,r){super(r),this.code=e}},YD=class{_websocket;_url;_authProvider;_websocketOptions;_WebSocket;_protocolVersion;_isClosed=!1;_specialIds=new Set;onclose;onerror;onmessage;sessionId;constructor(e,r){this._url=e,this._authProvider=r?.authProvider,this._websocketOptions=r?.websocketOptions,this._WebSocket=r?.WebSocket||E8.default}async start(){if(this._isClosed)throw new Error(M.t("websocketClient.errors.transportClosed"));let e=null;if(this._authProvider)try{let i=await this._authProvider.tokens();i?.access_token&&(e=i.access_token)}catch(i){try{let o=await this._authProvider.clientInformation();if(o){let s=await this._authProvider.tokens();if(s?.refresh_token){let a=await aQe(this._url,{clientInformation:o,refreshToken:s.refresh_token,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(a),a?.access_token&&(e=a.access_token)}}}catch{if(this._authProvider.redirectToAuthorization){let s=this._authProvider.redirectUrl;throw await this._authProvider.redirectToAuthorization(typeof s=="string"?new URL(s):s),new Error(M.t("websocketClient.errors.unauthorizedOAuth"))}throw i}}let r={...this._websocketOptions?.headers};e&&(r.Authorization=`Bearer ${e}`),this._protocolVersion&&(r["MCP-Protocol-Version"]=this._protocolVersion);let n=new URL(this._url.toString());return n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),new Promise((i,o)=>{try{let s={headers:r};this._websocket=new this._WebSocket(n.toString(),s),this._websocket.on("open",()=>{i()}),this._websocket.on("error",a=>{let c=a.code!==void 0?a.code:void 0;o(new RX(c,`WebSocket error: ${a.message}`))}),this._websocket.on("message",async a=>{try{let c=a.toString(),u=JSON.parse(c);if(this._specialIds.has(Number(u.id))||u.type==="welcome")return;this.onmessage?.(await this._transformResponse(u))}catch(c){this.onerror?.(new Error(`Failed to parse WebSocket message: ${c instanceof Error?c.message:String(c)}`))}}),this._websocket.on("close",()=>{this._isClosed||(this._isClosed=!0,this.onclose?.())})}catch(s){o(new RX(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(M.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await sQe(this._url,{clientInformation:r,authorizationCode:e,codeVerifier:await this._authProvider.codeVerifier(),redirectUri:n,addClientAuthentication:this._authProvider.addClientAuthentication});await this._authProvider.saveTokens(i)}else throw new Error(M.t("websocketClient.errors.clientInfoNotAvailable"))}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===E8.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(M.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(M.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==E8.default.OPEN)throw new Error(M.t("websocketClient.errors.websocketNotOpen"));try{if(e.method==="notifications/initialized")return;let r=await this._transformRequest(e),n=JSON.stringify(r);this._websocket.send(n)}catch(r){throw new RX(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:DX.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.35",platform:process.platform,workingDirectory:process.cwd()}}};if(e.method==="tools/call"&&e.params?.name==="openDiff"){let{arguments:r}=e.params||{},{filePath:n,newContent:i}=r||{};return{type:DX.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await RFn(n,"utf8"),modifiedText:i}}}return e}async _transformResponse(e){if(e.type==="connection_ack")return{jsonrpc:"2.0",id:e.id,result:{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{}},serverInfo:{name:"JetBrains Plugin Server",title:"JetBrains Plugin Server",version:"1.0.0"}}};if(e.type==="selection_changed"){let r=await this._getSelectedText();return{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0,selectedText:r}]}}}}return e.type==="active_file_changed"?{jsonrpc:"2.0",method:"ide/contextUpdate",params:{workspaceState:{openFiles:[{path:e.payload.fileName,timestamp:Date.now(),isActive:!0}]}}}:e}async _getSelectedText(){if(!this._websocket)return"";let e=performance.now();return this._specialIds.add(e),this._websocket.send(JSON.stringify({type:DX.GET_SELECTED_TEXT,id:e,timestamp:Date.now()})),new Promise((r,n)=>{this._websocket.once("message",i=>{try{let o=JSON.parse(i.toString());Number(o.id)===e&&(this._specialIds.delete(e),o.payload.success?r(o.payload.data.text):n(o.payload.error))}catch{r("")}})})}setProtocolVersion(e){this._protocolVersion=e}}});var lUt,dme,cUt=ae(()=>{"use strict";lUt=Fe(dK(),1);Vn();dme=class{config;auth;redirectUrl="";clientMetadata={client_name:"iFlow CLI (Google ADC)",redirect_uris:[],grant_types:[],response_types:[],token_endpoint_auth_method:"none"};_clientInformation;constructor(e){this.config=e;let r=this.config?.oauth?.scopes;if(!r||r.length===0)throw new Error(M.t("mcp.auth.scopesRequired"));this.auth=new lUt.GoogleAuth({scopes:r})}clientInformation(){return this._clientInformation}saveClientInformation(e){this._clientInformation=e}async tokens(){let r=await(await this.auth.getClient()).getAccessToken();if(!r.token){console.error(M.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as BFn}from"node:child_process";import{promisify as NFn}from"node:util";import{platform as OFn}from"node:os";import{URL as kFn}from"node:url";function MFn(t){let e;try{e=new kFn(t)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Unsafe protocol: ${e.protocol}. Only HTTP and HTTPS are allowed.`);if(/[\r\n\x00-\x1f]/.test(t))throw new Error("URL contains invalid characters")}async function dUt(t){MFn(t);let e=OFn(),r,n;switch(e){case"darwin":r="open",n=[t];break;case"win32":r="powershell.exe",n=["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-Command",`Start-Process '${t.replace(/'/g,"''")}'`];break;case"linux":case"freebsd":case"openbsd":r="xdg-open",n=[t];break;default:throw new Error(`Unsupported platform: ${e}`)}let i={env:{...process.env,SHELL:void 0},detached:!0,stdio:"ignore"};try{await uUt(r,n,i)}catch(o){if((e==="linux"||e==="freebsd"||e==="openbsd")&&r==="xdg-open"){let s=["gnome-open","kde-open","firefox","chromium","google-chrome"];for(let a of s)try{await uUt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var uUt,fUt=ae(()=>{"use strict";uUt=NFn(BFn)});function ls(t){return t instanceof Error&&"code"in t}function or(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function dQe(t){if(t&&typeof t=="object"&&"response"in t){let r=PFn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new pme(r.error.message);case 401:return new pS(r.error.message);case 403:return new fme(r.error.message);default:}}return t}function PFn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var fme,pS,pme,lu=ae(()=>{"use strict";fme=class extends Error{},pS=class extends Error{},pme=class extends Error{}});import{promises as TU}from"node:fs";import*as hme from"node:path";import*as pUt from"node:os";var Rp,mme=ae(()=>{"use strict";lu();Vn();Rp=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=pUt.homedir();return hme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=hme.dirname(this.getTokenFilePath());await TU.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await TU.readFile(r,"utf-8"),i=JSON.parse(n);for(let o of i)e.set(o.serverName,o)}catch(r){r.code!=="ENOENT"&&console.error(M.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:or(r)}))}return e}static async saveToken(e,r,n,i,o){await this.ensureConfigDir();let s=await this.loadTokens(),a={serverName:e,token:r,clientId:n,tokenUrl:i,mcpServerUrl:o,updatedAt:Date.now()};s.set(e,a);let c=Array.from(s.values()),u=this.getTokenFilePath();try{await TU.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(M.t("mcp.tokenStorage.errors.failedToSaveToken",{error:or(d)})),d}}static async getToken(e){return(await this.loadTokens()).get(e)||null}static async removeToken(e){let r=await this.loadTokens();if(r.delete(e)){let n=Array.from(r.values()),i=this.getTokenFilePath();try{n.length===0?await TU.unlink(i):await TU.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(M.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:or(o)}))}}}static isTokenExpired(e){if(!e.expiresAt)return!1;let r=300*1e3;return Date.now()+r>=e.expiresAt}static async clearAllTokens(){try{let e=this.getTokenFilePath();await TU.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(M.t("mcp.tokenStorage.errors.failedToClearTokens",{error:or(e)}))}}}});var Bp,gme=ae(()=>{"use strict";lu();Vn();Bp=class{static buildWellKnownUrls(e){let r=new URL(e),n=`${r.protocol}//${r.host}`;return{protectedResource:new URL("/.well-known/oauth-protected-resource",n).toString(),authorizationServer:new URL("/.well-known/oauth-authorization-server",n).toString()}}static async fetchProtectedResourceMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch protected resource metadata from ${e}: ${or(r)}`),null}}static async fetchAuthorizationServerMetadata(e){try{let r=await fetch(e);return r.ok?await r.json():null}catch(r){return console.debug(`Failed to fetch authorization server metadata from ${e}: ${or(r)}`),null}}static metadataToOAuthConfig(e){return{authorizationUrl:e.authorization_endpoint,tokenUrl:e.token_endpoint,scopes:e.scopes_supported||[]}}static async discoverOAuthConfig(e){try{let r=this.buildWellKnownUrls(e),n=await this.fetchProtectedResourceMetadata(r.protectedResource);if(n?.authorization_servers?.length){let o=n.authorization_servers[0],s=new URL("/.well-known/oauth-authorization-server",o).toString(),a=await this.fetchAuthorizationServerMetadata(s);if(a){let c=this.metadataToOAuthConfig(a);return a.registration_endpoint&&console.log(M.t("mcp.oauth.discovery.dynamicRegistrationSupported"),a.registration_endpoint),c}}console.debug(`Trying OAuth discovery fallback at ${r.authorizationServer}`);let i=await this.fetchAuthorizationServerMetadata(r.authorizationServer);if(i){let o=this.metadataToOAuthConfig(i);return i.registration_endpoint&&console.log(M.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${or(r)}`),null}}static parseWWWAuthenticateHeader(e){let r=e.match(/resource_metadata="([^"]+)"/);return r?r[1]:null}static async discoverOAuthFromWWWAuthenticate(e){let r=this.parseWWWAuthenticateHeader(e);if(!r)return null;console.log(M.t("mcp.oauth.discovery.foundResourceMetadataUri",{uri:r}));let n=await this.fetchProtectedResourceMetadata(r);if(!n?.authorization_servers?.length)return null;let i=n.authorization_servers[0],o=new URL("/.well-known/oauth-authorization-server",i).toString(),s=await this.fetchAuthorizationServerMetadata(o);return s?(console.log(M.t("mcp.oauth.discovery.configDiscoveredFromWwwAuth")),this.metadataToOAuthConfig(s)):null}static extractBaseUrl(e){let r=new URL(e);return`${r.protocol}//${r.host}`}static isSSEEndpoint(e){return e.includes("/sse")||!e.includes("/mcp")}static buildResourceParameter(e){let r=new URL(e);return`${r.protocol}//${r.host}`}}});import*as hUt from"node:http";import*as BX from"node:crypto";import{URL as fQe}from"node:url";var b1,pQe=ae(()=>{"use strict";fUt();mme();lu();gme();Vn();b1=class{static REDIRECT_PORT=7777;static REDIRECT_PATH="/oauth/callback";static HTTP_OK=200;static HTTP_REDIRECT=302;static async registerClient(e,r){let i={client_name:"iFlow CLI MCP Client",redirect_uris:[r.redirectUri||`http://localhost:${this.REDIRECT_PORT}${this.REDIRECT_PATH}`],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",code_challenge_method:["S256"],scope:r.scopes?.join(" ")||""},o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!o.ok){let s=await o.text();throw new Error(M.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Bp.extractBaseUrl(e);return Bp.discoverOAuthConfig(r)}static generatePKCEParams(){let e=BX.randomBytes(32).toString("base64url"),r=BX.createHash("sha256").update(e).digest("base64url"),n=BX.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=hUt.createServer(async(o,s)=>{try{let a=new fQe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(M.t("mcp.ui.notFound"));return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),d=a.searchParams.get("error");if(d){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
|
|
842
842
|
<html>
|
|
843
843
|
<body>
|
|
844
844
|
<h1>${M.t("mcp.ui.authenticationFailed")}</h1>
|
|
@@ -4092,7 +4092,7 @@ ${de.description}`:de.subject||de.description||"Thinking...",[]),ue=(0,ga.useCal
|
|
|
4092
4092
|
`,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function z6t(t,e,{oneBased:r=!1}={}){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");let n=mAo(t,e);return r?{line:n.line+1,column:n.column+1}:n}var gAo=t=>`\\u{${t.codePointAt(0).toString(16)}}`,Y6t=class t extends Error{name="JSONError";fileName;#e;#t;#r;#n;#o;constructor(e){if(typeof e=="string")super(),this.#r=e;else{let{jsonParseError:r,fileName:n,input:i}=e;super(void 0,{cause:r}),this.#e=i,this.#t=r,this.fileName=n}Error.captureStackTrace?.(this,t)}get message(){this.#r??=`${yAo(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
4093
4093
|
|
|
4094
4094
|
${e}
|
|
4095
|
-
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=AAo(r,this.#t.message);if(n)return(0,rtn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},AAo=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:z6t(t,Number(n),{oneBased:!0})},yAo=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${gAo(n)})`);function J6t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Y6t({jsonParseError:n,fileName:r,input:t})}}var Ztn=Fe(Ktn(),1);import{fileURLToPath as g3o}from"node:url";function Xtn(t){return t instanceof URL?g3o(t):t}var E3o=t=>y3o.resolve(Xtn(t)??".","package.json"),v3o=(t,e)=>{let r=typeof t=="string"?J6t(t):t;return e&&(0,Ztn.default)(r),r};async function ern({cwd:t,normalize:e=!0}={}){let r=await A3o.readFile(E3o(t),"utf8");return v3o(r,e)}async function trn(t){let e=await Ben("package.json",t);if(e)return{packageJson:await ern({...t,cwd:C3o.dirname(e)}),path:e}}import{fileURLToPath as b3o}from"url";import x3o from"path";var S3o=b3o(import.meta.url),w3o=x3o.dirname(S3o),sTe;async function Uj(){if(sTe)return sTe;let t=await trn({cwd:w3o});if(t)return sTe=t.packageJson,sTe}async function vT(){let t=await Uj();return"0.2.35
|
|
4095
|
+
`:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=AAo(r,this.#t.message);if(n)return(0,rtn.codeFrameColumns)(r,{start:n},{highlightCode:e})}get codeFrame(){return this.#n??=this.#i(!0),this.#n}get rawCodeFrame(){return this.#o??=this.#i(!1),this.#o}},AAo=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:n,line:i,column:o}=r.groups;return i&&o?{line:Number(i),column:Number(o)}:z6t(t,Number(n),{oneBased:!0})},yAo=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${gAo(n)})`);function J6t(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Y6t({jsonParseError:n,fileName:r,input:t})}}var Ztn=Fe(Ktn(),1);import{fileURLToPath as g3o}from"node:url";function Xtn(t){return t instanceof URL?g3o(t):t}var E3o=t=>y3o.resolve(Xtn(t)??".","package.json"),v3o=(t,e)=>{let r=typeof t=="string"?J6t(t):t;return e&&(0,Ztn.default)(r),r};async function ern({cwd:t,normalize:e=!0}={}){let r=await A3o.readFile(E3o(t),"utf8");return v3o(r,e)}async function trn(t){let e=await Ben("package.json",t);if(e)return{packageJson:await ern({...t,cwd:C3o.dirname(e)}),path:e}}import{fileURLToPath as b3o}from"url";import x3o from"path";var S3o=b3o(import.meta.url),w3o=x3o.dirname(S3o),sTe;async function Uj(){if(sTe)return sTe;let t=await trn({cwd:w3o});if(t)return sTe=t.packageJson,sTe}async function vT(){let t=await Uj();return"0.2.35"}vs();Ot();import lM from"node:process";var rrn={name:"about",description:M.t("command.about"),kind:"built-in",action:async t=>{let e=lM.platform,r=M.t("aboutCommand.noSandbox");lM.env.SANDBOX&&lM.env.SANDBOX!=="sandbox-exec"?r=lM.env.SANDBOX:lM.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${lM.env.SEATBELT_PROFILE||M.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||M.t("aboutCommand.unknown"),i=await vT(),o=t.services.settings.merged.selectedAuthType||"",s=lM.env.GOOGLE_CLOUD_PROJECT||"",a={type:"about",cliVersion:i,osVersion:e,sandboxEnv:r,modelVersion:n,selectedAuthType:o,gcpProject:s};t.ui.addItem(a,Date.now())}};Ot();Ot();vs();var lTe="\x1B[32m";var irn="\x1B[31m",CT="\x1B[36m",s0="\x1B[90m";var tl="\x1B[0m";function aTe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
|
|
4096
4096
|
${irn}${M.t("agentsCommand.list.noAgentsFound")}${tl}
|
|
4097
4097
|
`;i="\u{1F7E2} ";let o=`${i}${e}
|
|
4098
4098
|
`;for(let s of t)n?o+=_3o(s):o+=`${lTe}- ${s.agentType}${tl}
|
|
@@ -4135,7 +4135,7 @@ ${s0}${M.t("agentsCommand.list.builtinAgents")}${tl}
|
|
|
4135
4135
|
${s0}${M.t("agentsCommand.list.generalPurpose")}
|
|
4136
4136
|
${tl}`;let c=n.length+i.length;t.ui.addItem({type:"info",text:`${lTe}${M.t("agentsCommand.refresh.success",{count:c})}${tl}
|
|
4137
4137
|
|
|
4138
|
-
${lTe}${a.trim()}${tl}`},Date.now())}catch(e){let r=or(e);t.ui.addItem({type:"error",text:`${irn}${M.t("agentsCommand.refresh.error",{error:r})}${tl}`},Date.now())}}},{name:"online",description:M.t("agentsCommand.subCommands.online"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:M.t("agentsCommand.subCommands.install"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Ot();var srn={name:"auth",description:M.t("command.auth"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};aD();import mx from"node:process";import T3o from"node:os";vs();Ot();var Qj="
|
|
4138
|
+
${lTe}${a.trim()}${tl}`},Date.now())}catch(e){let r=or(e);t.ui.addItem({type:"error",text:`${irn}${M.t("agentsCommand.refresh.error",{error:r})}${tl}`},Date.now())}}},{name:"online",description:M.t("agentsCommand.subCommands.online"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agents-online"})},{name:"install",description:M.t("agentsCommand.subCommands.install"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"agent-install"})}]};Ot();var srn={name:"auth",description:M.t("command.auth"),kind:"built-in",action:(t,e)=>({type:"dialog",dialog:"auth"})};aD();import mx from"node:process";import T3o from"node:os";vs();Ot();var Qj="fda13a5d (local modifications)";Ot();async function I3o(t,e){let r="https://apis.iflow.cn/v1/bug/report",i={content:JSON.stringify(t,null,2)},o={"Content-Type":"application/json"};e&&(o.Authorization=`Bearer ${e}`);try{let s=await fetch(r,{method:"POST",headers:o,body:JSON.stringify(i)});if(s.ok){let a=await s.json();return console.log("Bug report data sent successfully to endpoint"),a.success&&a.data?a.data:(console.warn("Unexpected response format from endpoint:",a),null)}else return console.warn(`Failed to send bug report to endpoint: ${s.status} ${s.statusText}`),null}catch(s){return console.warn("Failed to send bug report to endpoint:",s),null}}var arn={name:"bug",description:M.t("command.bug"),kind:"built-in",action:async(t,e)=>{let r=(e||"").trim(),{config:n}=t.services,i=bD(),o=`${mx.platform} ${mx.version}`,s=M.t("bugCommand.noSandbox");mx.env.SANDBOX&&mx.env.SANDBOX!=="sandbox-exec"?s=mx.env.SANDBOX.replace(/^iflow-(?:code-)?/,""):mx.env.SANDBOX==="sandbox-exec"&&(s=`sandbox-exec (${mx.env.SEATBELT_PROFILE||"unknown"})`);let a=n?.getModel()||M.t("bugCommand.unknown"),c=await vT(),u=vj(mx.memoryUsage().rss),d=i.getInMemoryErrors(),f=M.t("bugCommand.noRecentErrors");d.length>0&&(f=d.slice(-3).map(O=>M.t("bugCommand.errorWithTimestamp",{timestamp:O.timestamp,error:O.error})).join(`
|
|
4139
4139
|
|
|
4140
4140
|
`));let p=T3o.userInfo().username,h=w=>{if(!p)return w;let O=new RegExp(`/${p}/`,"g");return w.replace(O,"/user/")},m=`CLI Version: ${c}
|
|
4141
4141
|
Git Commit: ${Qj}
|
|
@@ -5178,7 +5178,7 @@ ${M.t("gemini.errors.criticalUnhandledRejection")}
|
|
|
5178
5178
|
=========================================
|
|
5179
5179
|
${M.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
|
|
5180
5180
|
${M.t("gemini.errors.stackTrace")}
|
|
5181
|
-
${e.stack}`:""}`;Zs.emit("log-error",n),t||(t=!0,Zs.emit("open-debug-console"))})}function ASo(){console.log(M.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.35
|
|
5181
|
+
${e.stack}`:""}`;Zs.emit("log-error",n),t||(t=!0,Zs.emit("open-debug-console"))})}function ASo(){console.log(M.t("gemini.crashDiagnosticsEnabled")),process.setUncaughtExceptionCaptureCallback(t=>{let e={timestamp:new Date().toISOString(),error:{name:t.name,message:t.message,stack:t.stack},memory:process.memoryUsage(),pid:process.pid,cwd:process.cwd(),nodeVersion:process.version,platform:process.platform,arch:process.arch,uptime:process.uptime(),env:{NODE_ENV:"production",SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.35"}},r=`crash-${Date.now()}-${process.pid}.json`,n=aSo.join(process.cwd(),r);try{fSo.writeFileSync(n,JSON.stringify(e,null,2)),console.error(M.t("gemini.crashDetected",{crashFilePath:n})),console.error(M.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(M.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(M.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(M.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function $mn(){gSo();let t=process.cwd(),e=jl(t);if(!e.user.settings.cna){let p=await i0e();p&&e.setValue("User","cna",p)}if(await Eun(),e.errors.length>0){for(let p of e.errors){let h=M.t("gemini.errorInFile",{path:p.path,message:p.message});process.env.NO_COLOR||(h=`\x1B[31m${h}\x1B[0m`),console.error(h),console.error(M.t("gemini.pleaseFixFileAndTryAgain",{path:p.path}))}process.exit(1)}let r=await LIe();(!!r.prompt&&!r.promptInteractive&&!r.continue&&!r.resume||r.experimentalAcp)&&(process.env.IFLOW_NON_INTERACTIVE="true");let i=OT(t),o=await PM(e.merged,i,o0.generateSessionId(),r);if(M.changeLanguage(o.getLanguage()),o.getDebugMode()&&ASo(),uSo.setDefaultResultOrder(pSo(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(M.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),o.getListExtensions()){console.debug(M.t("gemini.installedExtensions"));for(let p of i)console.debug(`- ${p.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:p}=await Promise.resolve().then(()=>(V5t(),gun)),h=(await Promise.resolve().then(()=>(C8t(),v8t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:p}=await Promise.resolve().then(()=>(G5t(),nun)),h=(await Promise.resolve().then(()=>(C8t(),v8t))).default;await h().scriptName("iflow").command(p).help().version(!1).parse(),process.exit(0)}if(e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",$t.CLOUD_SHELL),Gsn(o.getDebugMode()),await o.initialize(),ka.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ka.setActiveTheme(e.merged.theme)||console.warn(M.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let p=e.merged.autoConfigureMaxOldSpaceSize?hSo(o):[],h=o.getSandbox();if(h){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let m=xM(e.merged.selectedAuthType);if(m)throw new Error(m);await o.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(m){console.error(M.t("gemini.errorAuthenticating"),m),process.exit(1)}await Cfn(h,p,o),process.exit(0)}else p.length>0&&(await mSo(p),process.exit(0))}if(e.merged.selectedAuthType===$t.LOGIN_WITH_IFLOW&&o.isBrowserLaunchSuppressed()&&await cD(e.merged.selectedAuthType,o),o.getExperimentalAcp())return o.getAcpPort()?await nmn(o,e,i,r,o.getAcpPort()):J0n(o,e,i,r);let s=o.getQuestion(),a=[...await bfn(),...await Sfn(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&s?.length===0){console.clear();let p=await vT();Wmn(Vmn(t),e);try{await o.setIdeModeAndSyncConnection(!0)}catch(E){console.error(M.t("gemini.failedToConnectToIdeServer"),E)}let h,m=async()=>{try{if(console.clear(),Wmn(Vmn(t),e),h)try{h.unmount(),await new Promise(x=>process.nextTick(x))}catch(x){console.error(M.t("gemini.errorDuringUnmount"),x)}let{executeSessionStartHooks:E}=await Promise.resolve().then(()=>(dM(),uM)),C=await E(o,"resume");h=lfe((0,nue.jsx)(b8t.default.StrictMode,{children:(0,nue.jsx)(wvt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0,sessionStartContext:C})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1})}catch(E){console.error(M.t("gemini.errorDuringResume"),E)}};process.on("SIGCONT",m),Sce(()=>{process.off("SIGCONT",m)});let g="startup";(r.continue||r.resume)&&(g="resume");let{executeSessionStartHooks:A}=await Promise.resolve().then(()=>(dM(),uM)),y=await A(o,g);h=lfe((0,nue.jsx)(b8t.default.StrictMode,{children:(0,nue.jsx)(wvt,{instance:()=>h,config:o,settings:e,startupWarnings:a,version:p,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,sessionStartContext:y})}),{exitOnCtrlC:!1,isScreenReaderEnabled:!1}),e.merged.disableAutoUpdate||G0n().then(E=>{Fdn(E,e,o.getProjectRoot())}).catch(E=>{o.getDebugMode()&&console.error(M.t("gemini.updateCheckFailed"),E)}),Sce(()=>h.unmount());return}!process.stdin.isTTY&&!s&&(s+=await Afn()),s||(console.error(M.t("gemini.noInputProvidedViaStdin")),process.exit(1));let u=Math.random().toString(16).slice(2);K$(o,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:s,prompt_id:u,auth_type:o.getContentGeneratorConfig()?.authType,prompt_length:s.length});let d=await ySo(o,i,e,r),f=r.outputFile||r.output_file;await _fn(d,s,u,f),process.exit(0)}function Wmn(t,e){if(!e.merged.hideWindowTitle){let r=(process.env.CLI_TITLE||`iFlow - ${t}`).replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${r}\x07`),process.on("exit",()=>{process.stdout.write("\x1B]2;\x07")})}}async function ySo(t,e,r,n){let i=t;if(t.getApprovalMode()!==$n.YOLO){let o=r.merged.excludeTools||[],s=[pu.Name,Af.Name,ld.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await PM(c,e,t.getSessionId(),u),await i.initialize()}return await ESo(r.merged.selectedAuthType,i,r)}async function ESo(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!g0e()&&(console.error(M.t("gemini.pleaseSetAuthMethod",{userSettingsPath:oM})),process.exit(1)),t||(g0e()?t=$t.IFLOW:t=$t.IFLOW);let n=xM(t);return n!=null&&(console.error(n),process.exit(1)),await e.refreshAuth(t,{apiKey:r.merged.apiKey,baseUrl:r.merged.baseUrl,modelName:r.merged.modelName}),e}$mn().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
|
|
5182
5182
|
/**
|
|
5183
5183
|
* @license
|
|
5184
5184
|
* Copyright 2025 Google LLC
|