@iflow-ai/iflow-cli 0.2.27-beta.0 → 0.2.27

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.
Files changed (2) hide show
  1. package/bundle/iflow.js +4 -4
  2. package/package.json +1 -1
package/bundle/iflow.js CHANGED
@@ -596,14 +596,14 @@ ${JSON.stringify(d,null,2)}`),d.usage&&(this.lastUsageMetadata={total_tokens:d.u
596
596
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
597
597
  ${e}
598
598
 
599
- \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 cv(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 bw.STOP;case"length":return bw.MAX_TOKENS;case"content_filter":return bw.SAFETY;case"tool_calls":return bw.MALFORMED_FUNCTION_CALL;default:return bw.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 _3,ef,Eq,vq,XX,uv=De(()=>{"use strict";_3="Qwen3-Coder",ef="Qwen3-Coder",Eq="text-embedding-v1",vq="gemini-2.5-flash-lite",XX="https://apis.iflow.cn/v1"});async function lFe(t,e,r,n){if(e===xr.LOGIN_WITH_IFLOW){let i=await JB(e,r),o=await VC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new yq({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||XX,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===xr.CLOUD_SHELL){let i=await JB(e,r),o=await yDt(i);return new _7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var cFe=De(()=>{"use strict";N6();ww();EDt();Ahe();aFe();uv();});function e7n(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function YC(t){let e=e7n(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 ZX(){return YC("apiKey")}function eZ(){return YC("baseUrl")||YC("url")}function tZ(){return YC("modelName")||YC("model")}function RIt(t){let e=YC(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 BIt(t){let e=YC(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function NIt(t){let e=YC(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function $he(){return!!(ZX()||eZ()||tZ())}function uFe(){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=YC(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=RIt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=BIt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=NIt(o);s!==void 0&&(t[o]=s)}),t}function t7n(){return{apiKey:ZX(),baseUrl:eZ(),model:tZ()}}var dFe=De(()=>{"use strict";});async function fFe(t,e,r){await aq()&&(await ghe()||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=ZX(),u=eZ(),d=tZ(),f=r?.apiKey||c,p=r?.baseUrl||u||r7n[e],h=t.getModel()||d||_3,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===xr.CLOUD_SHELL?m:e===xr.LOGIN_WITH_IFLOW?(m.baseUrl=p||XX,m.multimodalModelName="qwen-vl-max",f&&(m.apiKey=f),m):([...q1,xr.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function pFe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.27-beta.0 (${process.platform}; ${process.arch})`}};if(t.authType&&[...q1,xr.IDEA_LAB].includes(t.authType)||t.authType===xr.OPENAI_COMPATIBLE)return new yq({...t,config:e});if(t.authType===xr.LOGIN_WITH_IFLOW||t.authType===xr.CLOUD_SHELL)return lFe(i,t.authType,e,r);if([...q1,xr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===xr.USE_GEMINI||t.authType===xr.USE_VERTEX_AI)return new she({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var xr,q1,r7n,N6=De(()=>{"use strict";Yl();cFe();uv();aFe();dFe();ww();(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.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(xr||(xr={}));q1=[xr.IFLOW],r7n={[xr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[xr.IFLOW]:XX}});var Whe,OIt=De(()=>{"use strict";Whe=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 $o,un,Wo,jo,Dd=De(()=>{"use strict";$o=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"})(un||(un={}));(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"})(Wo||(Wo={}));(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"})(jo||(jo={}))});function rN(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 jhe=De(()=>{"use strict";});var fc,zhe=De(()=>{"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"})(fc||(fc={}))});function n7n(t){return{text:t.text}}function i7n(t,e){return[{text:H.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function o7n(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:H.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function s7n(t){return{text:H.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function a7n(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 n7n(o);case"image":case"audio":return i7n(o,n);case"resource":return o7n(o,n);case"resource_link":return s7n(o);default:return null}}).filter(o=>o!==null):[{text:H.t("mcpTool.errors.parseResponseFailed")}]}function l7n(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 H.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return H.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return H.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:H.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||H.t("mcpTool.display.unknownType")});default:return H.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
599
+ \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 cv(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 bw.STOP;case"length":return bw.MAX_TOKENS;case"content_filter":return bw.SAFETY;case"tool_calls":return bw.MALFORMED_FUNCTION_CALL;default:return bw.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 _3,ef,Eq,vq,XX,uv=De(()=>{"use strict";_3="Qwen3-Coder",ef="Qwen3-Coder",Eq="text-embedding-v1",vq="gemini-2.5-flash-lite",XX="https://apis.iflow.cn/v1"});async function lFe(t,e,r,n){if(e===xr.LOGIN_WITH_IFLOW){let i=await JB(e,r),o=await VC();if(!o)throw new Error("No API key found. Please re-authenticate.");let s=r.getContentGeneratorConfig();return new yq({model:r.getModel(),apiKey:o,baseUrl:s?.baseUrl||XX,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max",config:r})}if(e===xr.CLOUD_SHELL){let i=await JB(e,r),o=await yDt(i);return new _7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var cFe=De(()=>{"use strict";N6();ww();EDt();Ahe();aFe();uv();});function e7n(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function YC(t){let e=e7n(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 ZX(){return YC("apiKey")}function eZ(){return YC("baseUrl")||YC("url")}function tZ(){return YC("modelName")||YC("model")}function RIt(t){let e=YC(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 BIt(t){let e=YC(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function NIt(t){let e=YC(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function $he(){return!!(ZX()||eZ()||tZ())}function uFe(){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=YC(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=RIt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=BIt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=NIt(o);s!==void 0&&(t[o]=s)}),t}function t7n(){return{apiKey:ZX(),baseUrl:eZ(),model:tZ()}}var dFe=De(()=>{"use strict";});async function fFe(t,e,r){await aq()&&(await ghe()||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=ZX(),u=eZ(),d=tZ(),f=r?.apiKey||c,p=r?.baseUrl||u||r7n[e],h=t.getModel()||d||_3,m={model:h,authType:e,proxy:t?.getProxy(),debugMode:t?.getDebugMode(),config:t};return e===xr.CLOUD_SHELL?m:e===xr.LOGIN_WITH_IFLOW?(m.baseUrl=p||XX,m.multimodalModelName="qwen-vl-max",f&&(m.apiKey=f),m):([...q1,xr.OPENAI_COMPATIBLE].includes(e)&&f&&(m.apiKey=f,m.baseUrl=p,m.model=h),m)}async function pFe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.27 (${process.platform}; ${process.arch})`}};if(t.authType&&[...q1,xr.IDEA_LAB].includes(t.authType)||t.authType===xr.OPENAI_COMPATIBLE)return new yq({...t,config:e});if(t.authType===xr.LOGIN_WITH_IFLOW||t.authType===xr.CLOUD_SHELL)return lFe(i,t.authType,e,r);if([...q1,xr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===xr.USE_GEMINI||t.authType===xr.USE_VERTEX_AI)return new she({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var xr,q1,r7n,N6=De(()=>{"use strict";Yl();cFe();uv();aFe();dFe();ww();(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.IDEA_LAB="idealab",t.OPENAI_COMPATIBLE="openai-compatible"})(xr||(xr={}));q1=[xr.IFLOW],r7n={[xr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[xr.IFLOW]:XX}});var Whe,OIt=De(()=>{"use strict";Whe=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 $o,un,Wo,jo,Dd=De(()=>{"use strict";$o=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"})(un||(un={}));(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"})(Wo||(Wo={}));(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"})(jo||(jo={}))});function rN(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 jhe=De(()=>{"use strict";});var fc,zhe=De(()=>{"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"})(fc||(fc={}))});function n7n(t){return{text:t.text}}function i7n(t,e){return[{text:H.t("mcpTool.messages.mediaDataProvided",{toolName:e,type:t.type,mimeType:t.mimeType})},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function o7n(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:H.t("mcpTool.messages.embeddedResourceProvided",{toolName:e,mimeType:n})},{inlineData:{mimeType:n,data:r.blob}}]}return null}function s7n(t){return{text:H.t("mcpTool.messages.resourceLink",{title:t.title||t.name,uri:t.uri})}}function a7n(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 n7n(o);case"image":case"audio":return i7n(o,n);case"resource":return o7n(o,n);case"resource_link":return s7n(o);default:return null}}).filter(o=>o!==null):[{text:H.t("mcpTool.errors.parseResponseFailed")}]}function l7n(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 H.t("mcpTool.display.image",{mimeType:n.mimeType});case"audio":return H.t("mcpTool.display.audio",{mimeType:n.mimeType});case"resource_link":return H.t("mcpTool.display.resourceLink",{title:n.title||n.name,uri:n.uri});case"resource":return n.resource?.text?n.resource.text:H.t("mcpTool.display.embeddedResource",{mimeType:n.resource?.mimeType||H.t("mcpTool.display.unknownType")});default:return H.t("mcpTool.display.unknownContentType",{type:n.type})}}).join(`
600
600
  `):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function MIt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var n0,rZ=De(()=>{"use strict";jhe();zhe();Dd();Yl();Vo();n0=class t extends $o{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??MIt(n),`${n} (${r} MCP Server)`,i,Wo.Hammer,jo.Other,{type:or.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:H.t("mcpTool.messages.confirmExecution"),serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===un.ProceedAlwaysServer?t.allowlist.add(n):s===un.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: ${rN(i[0])} with response: ${rN(o)}`;return{llmContent:a,returnDisplay:H.t("mcpTool.errors.toolReportedError",{toolName:this.serverToolName}),error:{message:a,type:fc.MCP_TOOL_ERROR}}}return{llmContent:a7n(o),returnDisplay:l7n(o)}}}});var FIt=N((OSo,kIt)=>{"use strict";kIt.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 GIt=N((MSo,HIt)=>{"use strict";var qIt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",PIt=new RegExp("^"+qIt+"$"),LIt="|&;()<> \\t",c7n='"((\\\\"|[^"])*?)"',u7n="'((\\\\'|[^'])*?)'",d7n=/^#$/,UIt="'",QIt='"',hFe="$",nN="",f7n=4294967296;for(mFe=0;mFe<4;mFe++)nN+=(f7n*Math.random()).toString(16);var mFe,p7n=new RegExp("^"+nN);function h7n(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 m7n(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+nN+JSON.stringify(n)+nN:e+n}function g7n(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+LIt+`]|[^\\s'"`+LIt+"])+",o=new RegExp(["("+qIt+")","("+i+"|"+c7n+"|"+u7n+")+"].join("|"),"g"),s=h7n(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(PIt.test(u))return{op:u};var d=!1,f=!1,p="",h=!1,m;function A(){m+=1;var S,x,w=u.charAt(m);if(w==="{"){if(m+=1,u.charAt(m)==="}")throw new Error("Bad substitution: "+u.slice(m-2,m+1));if(S=u.indexOf("}",m),S<0)throw new Error("Bad substitution: "+u.slice(m));x=u.slice(m,S),m=S}else if(/[*@#?$!_-]/.test(w))x=w,m+=1;else{var B=u.slice(m);S=B.match(/[^\w\d_]/),S?(x=B.slice(0,S.index),m+=S.index-1):(x=B,m=u.length)}return m7n(e,"",x)}for(m=0;m<u.length;m++){var y=u.charAt(m);if(h=h||!d&&(y==="*"||y==="?"),f)p+=y,f=!1;else if(d)y===d?d=!1:d==UIt?p+=y:y===n?(m+=1,y=u.charAt(m),y===QIt||y===n||y===hFe?p+=y:p+=n+y):y===hFe?p+=A():p+=y;else if(y===QIt||y===UIt)d=y;else{if(PIt.test(y))return{op:u};if(d7n.test(y)){a=!0;var v={comment:t.slice(c.index+m+1)};return p.length?[p,v]:[v]}else y===n?f=!0:y===hFe?p+=A():p+=y}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}HIt.exports=function(e,r,n){var i=g7n(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("("+nN+".*?"+nN+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return p7n.test(c)?JSON.parse(c.split(nN)[1]):c}))},[])}});var Yhe=N(gFe=>{"use strict";gFe.quote=FIt();gFe.parse=GIt()});var Gs,AFe,yn,JC,nZ=De(()=>{(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})(Gs||(Gs={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(AFe||(AFe={}));yn=Gs.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),JC=t=>{switch(typeof t){case"undefined":return yn.undefined;case"string":return yn.string;case"number":return Number.isNaN(t)?yn.nan:yn.number;case"boolean":return yn.boolean;case"function":return yn.function;case"bigint":return yn.bigint;case"symbol":return yn.symbol;case"object":return Array.isArray(t)?yn.array:t===null?yn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?yn.promise:typeof Map<"u"&&t instanceof Map?yn.map:typeof Set<"u"&&t instanceof Set?yn.set:typeof Date<"u"&&t instanceof Date?yn.date:yn.object;default:return yn.unknown}}});var Fr,A7n,H1,Jhe=De(()=>{nZ();Fr=Gs.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"]),A7n=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),H1=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,Gs.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()}};H1.create=t=>new H1(t)});var y7n,w7,yFe=De(()=>{Jhe();nZ();y7n=(t,e)=>{let r;switch(t.code){case Fr.invalid_type:t.received===yn.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Fr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Gs.jsonStringifyReplacer)}`;break;case Fr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Gs.joinValues(t.keys,", ")}`;break;case Fr.invalid_union:r="Invalid input";break;case Fr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Gs.joinValues(t.options)}`;break;case Fr.invalid_enum_value:r=`Invalid enum value. Expected ${Gs.joinValues(t.options)}, received '${t.received}'`;break;case Fr.invalid_arguments:r="Invalid function arguments";break;case Fr.invalid_return_type:r="Invalid function return type";break;case Fr.invalid_date:r="Invalid date";break;case Fr.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}"`:Gs.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Fr.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 Fr.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 Fr.custom:r="Invalid input";break;case Fr.invalid_intersection_types:r="Intersection results could not be merged";break;case Fr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Fr.not_finite:r="Number must be finite";break;default:r=e.defaultError,Gs.assertNever(t)}return{message:r}},w7=y7n});function E7n(t){VIt=t}function Cq(){return VIt}var VIt,Khe=De(()=>{yFe();VIt=w7});function ln(t,e){let r=Cq(),n=iZ({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===w7?void 0:w7].filter(i=>!!i)});t.common.issues.push(n)}var iZ,v7n,i0,Li,iN,rg,Xhe,Zhe,Iw,bq,EFe=De(()=>{Khe();yFe();iZ=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}},v7n=[];i0=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 Li;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 Li;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}}},Li=Object.freeze({status:"aborted"}),iN=t=>({status:"dirty",value:t}),rg=t=>({status:"valid",value:t}),Xhe=t=>t.status==="aborted",Zhe=t=>t.status==="dirty",Iw=t=>t.status==="valid",bq=t=>typeof Promise<"u"&&t instanceof Promise});var $It=De(()=>{});var Yn,WIt=De(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Yn||(Yn={}))});function ns(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 JIt(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 P7n(t){return new RegExp(`^${JIt(t)}$`)}function KIt(t){let e=`${YIt}T${JIt(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 L7n(t,e){return!!((e==="v4"||!e)&&R7n.test(t)||(e==="v6"||!e)&&N7n.test(t))}function U7n(t,e){if(!w7n.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 Q7n(t,e){return!!((e==="v4"||!e)&&B7n.test(t)||(e==="v6"||!e)&&O7n.test(t))}function q7n(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 _q(t){if(t instanceof G1){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=M6.create(_q(n))}return new G1({...t._def,shape:()=>e})}else return t instanceof I7?new I7({...t._def,type:_q(t.element)}):t instanceof M6?M6.create(_q(t.unwrap())):t instanceof XC?XC.create(_q(t.unwrap())):t instanceof KC?KC.create(t.items.map(e=>_q(e))):t}function CFe(t,e){let r=JC(t),n=JC(e);if(t===e)return{valid:!0,data:t};if(r===yn.object&&n===yn.object){let i=Gs.objectKeys(e),o=Gs.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=CFe(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===yn.array&&n===yn.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=CFe(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===yn.date&&n===yn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function XIt(t,e){return new mN({values:t,typeName:Yi.ZodEnum,...ns(e)})}function zIt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function ZIt(t,e={},r){return t?Bw.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=zIt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=zIt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Bw.create()}var k6,jIt,As,C7n,b7n,_7n,S7n,x7n,w7n,T7n,D7n,I7n,vFe,R7n,B7n,N7n,O7n,M7n,k7n,YIt,F7n,Rw,oN,sN,aN,lN,Sq,cN,uN,Bw,D7,dv,xq,I7,G1,dN,T7,eme,fN,KC,tme,wq,Tq,rme,pN,hN,mN,gN,Nw,F6,M6,XC,AN,yN,Dq,H7n,oZ,sZ,EN,G7n,Yi,V7n,eRt,tRt,$7n,W7n,rRt,j7n,z7n,Y7n,J7n,K7n,X7n,Z7n,e_n,t_n,r_n,n_n,i_n,o_n,s_n,a_n,l_n,c_n,u_n,d_n,f_n,p_n,h_n,m_n,g_n,A_n,y_n,E_n,v_n,C_n,b_n,__n,S_n,x_n,w_n,nRt=De(()=>{Jhe();Khe();WIt();EFe();nZ();k6=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}},jIt=(t,e)=>{if(Iw(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 H1(t.common.issues);return this._error=r,this._error}}};As=class{get description(){return this._def.description}_getType(e){return JC(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:JC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new i0,ctx:{common:e.parent.common,data:e.data,parsedType:JC(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(bq(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:JC(e)},i=this._parseSync({data:e,path:n.path,parent:n});return jIt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:JC(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Iw(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=>Iw(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:JC(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(bq(i)?i:Promise.resolve(i));return jIt(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:Fr.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 F6({schema:this,typeName:Yi.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 M6.create(this,this._def)}nullable(){return XC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return I7.create(this)}promise(){return Nw.create(this,this._def)}or(e){return dN.create([this,e],this._def)}and(e){return fN.create(this,e,this._def)}transform(e){return new F6({...ns(this._def),schema:this,typeName:Yi.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new AN({...ns(this._def),innerType:this,defaultValue:r,typeName:Yi.ZodDefault})}brand(){return new oZ({typeName:Yi.ZodBranded,type:this,...ns(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new yN({...ns(this._def),innerType:this,catchValue:r,typeName:Yi.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return sZ.create(this,e)}readonly(){return EN.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C7n=/^c[^\s-]{8,}$/i,b7n=/^[0-9a-z]+$/,_7n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S7n=/^[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,x7n=/^[a-z0-9_-]{21}$/i,w7n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T7n=/^[-+]?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)?)??$/,D7n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,I7n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",R7n=/^(?:(?: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])$/,B7n=/^(?:(?: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])$/,N7n=/^(([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]))$/,O7n=/^(([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])$/,M7n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k7n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,YIt="((\\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])))",F7n=new RegExp(`^${YIt}$`);Rw=class t extends As{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==yn.string){let o=this._getOrReturnCtx(e);return ln(o,{code:Fr.invalid_type,expected:yn.string,received:o.parsedType}),Li}let n=new i0,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.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),ln(i,{code:Fr.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?ln(i,{code:Fr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&ln(i,{code:Fr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")D7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"email",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")vFe||(vFe=new RegExp(I7n,"u")),vFe.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"emoji",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")S7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"uuid",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")x7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"nanoid",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")C7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")b7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid2",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")_7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ulid",code:Fr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ln(i,{validation:"url",code:Fr.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),ln(i,{validation:"regex",code:Fr.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),ln(i,{code:Fr.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),ln(i,{code:Fr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?KIt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?F7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?P7n(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?T7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"duration",code:Fr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?L7n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ip",code:Fr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?U7n(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"jwt",code:Fr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Q7n(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cidr",code:Fr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?M7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64",code:Fr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?k7n.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64url",code:Fr.invalid_string,message:o.message}),n.dirty()):Gs.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Fr.invalid_string,...Yn.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Yn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Yn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Yn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Yn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Yn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Yn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Yn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Yn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Yn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Yn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Yn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Yn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Yn.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,...Yn.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,...Yn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Yn.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Yn.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Yn.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Yn.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Yn.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Yn.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Yn.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Yn.errToObj(r)})}nonempty(e){return this.min(1,Yn.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}};Rw.create=t=>new Rw({checks:[],typeName:Yi.ZodString,coerce:t?.coerce??!1,...ns(t)});oN=class t extends As{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)!==yn.number){let o=this._getOrReturnCtx(e);return ln(o,{code:Fr.invalid_type,expected:yn.number,received:o.parsedType}),Li}let n,i=new i0;for(let o of this._def.checks)o.kind==="int"?Gs.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:Fr.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),ln(n,{code:Fr.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),ln(n,{code:Fr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?q7n(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Fr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:Fr.not_finite,message:o.message}),i.dirty()):Gs.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Yn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Yn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Yn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Yn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Yn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Yn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Yn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Yn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Yn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Yn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Yn.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Yn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Yn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Yn.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"&&Gs.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)}};oN.create=t=>new oN({checks:[],typeName:Yi.ZodNumber,coerce:t?.coerce||!1,...ns(t)});sN=class t extends As{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)!==yn.bigint)return this._getInvalidInput(e);let n,i=new i0;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),ln(n,{code:Fr.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),ln(n,{code:Fr.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),ln(n,{code:Fr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Gs.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Fr.invalid_type,expected:yn.bigint,received:r.parsedType}),Li}gte(e,r){return this.setLimit("min",e,!0,Yn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Yn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Yn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Yn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Yn.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:Yn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Yn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Yn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Yn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Yn.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}};sN.create=t=>new sN({checks:[],typeName:Yi.ZodBigInt,coerce:t?.coerce??!1,...ns(t)});aN=class extends As{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==yn.boolean){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.boolean,received:n.parsedType}),Li}return rg(e.data)}};aN.create=t=>new aN({typeName:Yi.ZodBoolean,coerce:t?.coerce||!1,...ns(t)});lN=class t extends As{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==yn.date){let o=this._getOrReturnCtx(e);return ln(o,{code:Fr.invalid_type,expected:yn.date,received:o.parsedType}),Li}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return ln(o,{code:Fr.invalid_date}),Li}let n=new i0,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Fr.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),ln(i,{code:Fr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Gs.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:Yn.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Yn.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}};lN.create=t=>new lN({checks:[],coerce:t?.coerce||!1,typeName:Yi.ZodDate,...ns(t)});Sq=class extends As{_parse(e){if(this._getType(e)!==yn.symbol){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.symbol,received:n.parsedType}),Li}return rg(e.data)}};Sq.create=t=>new Sq({typeName:Yi.ZodSymbol,...ns(t)});cN=class extends As{_parse(e){if(this._getType(e)!==yn.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.undefined,received:n.parsedType}),Li}return rg(e.data)}};cN.create=t=>new cN({typeName:Yi.ZodUndefined,...ns(t)});uN=class extends As{_parse(e){if(this._getType(e)!==yn.null){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.null,received:n.parsedType}),Li}return rg(e.data)}};uN.create=t=>new uN({typeName:Yi.ZodNull,...ns(t)});Bw=class extends As{constructor(){super(...arguments),this._any=!0}_parse(e){return rg(e.data)}};Bw.create=t=>new Bw({typeName:Yi.ZodAny,...ns(t)});D7=class extends As{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rg(e.data)}};D7.create=t=>new D7({typeName:Yi.ZodUnknown,...ns(t)});dv=class extends As{_parse(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Fr.invalid_type,expected:yn.never,received:r.parsedType}),Li}};dv.create=t=>new dv({typeName:Yi.ZodNever,...ns(t)});xq=class extends As{_parse(e){if(this._getType(e)!==yn.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.void,received:n.parsedType}),Li}return rg(e.data)}};xq.create=t=>new xq({typeName:Yi.ZodVoid,...ns(t)});I7=class t extends As{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==yn.array)return ln(r,{code:Fr.invalid_type,expected:yn.array,received:r.parsedType}),Li;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(ln(r,{code:s?Fr.too_big:Fr.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&&(ln(r,{code:Fr.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&&(ln(r,{code:Fr.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 k6(r,s,r.path,a)))).then(s=>i0.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new k6(r,s,r.path,a)));return i0.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Yn.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Yn.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Yn.toString(r)}})}nonempty(e){return this.min(1,e)}};I7.create=(t,e)=>new I7({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Yi.ZodArray,...ns(e)});G1=class t extends As{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=Gs.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==yn.object){let u=this._getOrReturnCtx(e);return ln(u,{code:Fr.invalid_type,expected:yn.object,received:u.parsedType}),Li}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof dv&&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 k6(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof dv){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&&(ln(i,{code:Fr.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 k6(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=>i0.mergeObjectSync(n,u)):i0.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Yn.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:Yn.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:Yi.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 Gs.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 Gs.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _q(this)}partial(e){let r={};for(let n of Gs.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 Gs.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof M6;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return XIt(Gs.objectKeys(this.shape))}};G1.create=(t,e)=>new G1({shape:()=>t,unknownKeys:"strip",catchall:dv.create(),typeName:Yi.ZodObject,...ns(e)});G1.strictCreate=(t,e)=>new G1({shape:()=>t,unknownKeys:"strict",catchall:dv.create(),typeName:Yi.ZodObject,...ns(e)});G1.lazycreate=(t,e)=>new G1({shape:t,unknownKeys:"strip",catchall:dv.create(),typeName:Yi.ZodObject,...ns(e)});dN=class extends As{_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 H1(a.ctx.common.issues));return ln(r,{code:Fr.invalid_union,unionErrors:s}),Li}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 H1(c));return ln(r,{code:Fr.invalid_union,unionErrors:a}),Li}}get options(){return this._def.options}};dN.create=(t,e)=>new dN({options:t,typeName:Yi.ZodUnion,...ns(e)});T7=t=>t instanceof pN?T7(t.schema):t instanceof F6?T7(t.innerType()):t instanceof hN?[t.value]:t instanceof mN?t.options:t instanceof gN?Gs.objectValues(t.enum):t instanceof AN?T7(t._def.innerType):t instanceof cN?[void 0]:t instanceof uN?[null]:t instanceof M6?[void 0,...T7(t.unwrap())]:t instanceof XC?[null,...T7(t.unwrap())]:t instanceof oZ||t instanceof EN?T7(t.unwrap()):t instanceof yN?T7(t._def.innerType):[],eme=class t extends As{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yn.object)return ln(r,{code:Fr.invalid_type,expected:yn.object,received:r.parsedType}),Li;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}):(ln(r,{code:Fr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Li)}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=T7(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:Yi.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...ns(n)})}};fN=class extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(Xhe(o)||Xhe(s))return Li;let a=CFe(o.value,s.value);return a.valid?((Zhe(o)||Zhe(s))&&r.dirty(),{status:r.value,value:a.data}):(ln(n,{code:Fr.invalid_intersection_types}),Li)};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}))}};fN.create=(t,e,r)=>new fN({left:t,right:e,typeName:Yi.ZodIntersection,...ns(r)});KC=class t extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yn.array)return ln(n,{code:Fr.invalid_type,expected:yn.array,received:n.parsedType}),Li;if(n.data.length<this._def.items.length)return ln(n,{code:Fr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Li;!this._def.rest&&n.data.length>this._def.items.length&&(ln(n,{code:Fr.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 k6(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>i0.mergeArray(r,s)):i0.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};KC.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new KC({items:t,typeName:Yi.ZodTuple,rest:null,...ns(e)})};tme=class t extends As{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!==yn.object)return ln(n,{code:Fr.invalid_type,expected:yn.object,received:n.parsedType}),Li;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new k6(n,a,n.path,a)),value:s._parse(new k6(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?i0.mergeObjectAsync(r,i):i0.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof As?new t({keyType:e,valueType:r,typeName:Yi.ZodRecord,...ns(n)}):new t({keyType:Rw.create(),valueType:e,typeName:Yi.ZodRecord,...ns(r)})}},wq=class extends As{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!==yn.map)return ln(n,{code:Fr.invalid_type,expected:yn.map,received:n.parsedType}),Li;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new k6(n,a,n.path,[u,"key"])),value:o._parse(new k6(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 Li;(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 Li;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};wq.create=(t,e,r)=>new wq({valueType:e,keyType:t,typeName:Yi.ZodMap,...ns(r)});Tq=class t extends As{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==yn.set)return ln(n,{code:Fr.invalid_type,expected:yn.set,received:n.parsedType}),Li;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ln(n,{code:Fr.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&&(ln(n,{code:Fr.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 Li;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 k6(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:Yn.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Yn.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Tq.create=(t,e)=>new Tq({valueType:t,minSize:null,maxSize:null,typeName:Yi.ZodSet,...ns(e)});rme=class t extends As{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yn.function)return ln(r,{code:Fr.invalid_type,expected:yn.function,received:r.parsedType}),Li;function n(a,c){return iZ({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cq(),w7].filter(u=>!!u),issueData:{code:Fr.invalid_arguments,argumentsError:c}})}function i(a,c){return iZ({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cq(),w7].filter(u=>!!u),issueData:{code:Fr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Nw){let a=this;return rg(async function(...c){let u=new H1([]),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 rg(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new H1([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new H1([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:KC.create(e).rest(D7.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||KC.create([]).rest(D7.create()),returns:r||D7.create(),typeName:Yi.ZodFunction,...ns(n)})}},pN=class extends As{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})}};pN.create=(t,e)=>new pN({getter:t,typeName:Yi.ZodLazy,...ns(e)});hN=class extends As{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ln(r,{received:r.data,code:Fr.invalid_literal,expected:this._def.value}),Li}return{status:"valid",value:e.data}}get value(){return this._def.value}};hN.create=(t,e)=>new hN({value:t,typeName:Yi.ZodLiteral,...ns(e)});mN=class t extends As{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ln(r,{expected:Gs.joinValues(n),received:r.parsedType,code:Fr.invalid_type}),Li}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 ln(r,{received:r.data,code:Fr.invalid_enum_value,options:n}),Li}return rg(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})}};mN.create=XIt;gN=class extends As{_parse(e){let r=Gs.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==yn.string&&n.parsedType!==yn.number){let i=Gs.objectValues(r);return ln(n,{expected:Gs.joinValues(i),received:n.parsedType,code:Fr.invalid_type}),Li}if(this._cache||(this._cache=new Set(Gs.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Gs.objectValues(r);return ln(n,{received:n.data,code:Fr.invalid_enum_value,options:i}),Li}return rg(e.data)}get enum(){return this._def.values}};gN.create=(t,e)=>new gN({values:t,typeName:Yi.ZodNativeEnum,...ns(e)});Nw=class extends As{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==yn.promise&&r.common.async===!1)return ln(r,{code:Fr.invalid_type,expected:yn.promise,received:r.parsedType}),Li;let n=r.parsedType===yn.promise?r.data:Promise.resolve(r.data);return rg(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Nw.create=(t,e)=>new Nw({type:t,typeName:Yi.ZodPromise,...ns(e)});F6=class extends As{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Yi.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=>{ln(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 Li;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Li:c.status==="dirty"?iN(c.value):r.value==="dirty"?iN(c.value):c});{if(r.value==="aborted")return Li;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Li:a.status==="dirty"?iN(a.value):r.value==="dirty"?iN(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"?Li:(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"?Li:(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(!Iw(s))return Li;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=>Iw(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Li);Gs.assertNever(i)}};F6.create=(t,e,r)=>new F6({schema:t,typeName:Yi.ZodEffects,effect:e,...ns(r)});F6.createWithPreprocess=(t,e,r)=>new F6({schema:e,effect:{type:"preprocess",transform:t},typeName:Yi.ZodEffects,...ns(r)});M6=class extends As{_parse(e){return this._getType(e)===yn.undefined?rg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M6.create=(t,e)=>new M6({innerType:t,typeName:Yi.ZodOptional,...ns(e)});XC=class extends As{_parse(e){return this._getType(e)===yn.null?rg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};XC.create=(t,e)=>new XC({innerType:t,typeName:Yi.ZodNullable,...ns(e)});AN=class extends As{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===yn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};AN.create=(t,e)=>new AN({innerType:t,typeName:Yi.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ns(e)});yN=class extends As{_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 bq(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new H1(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new H1(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};yN.create=(t,e)=>new yN({innerType:t,typeName:Yi.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ns(e)});Dq=class extends As{_parse(e){if(this._getType(e)!==yn.nan){let n=this._getOrReturnCtx(e);return ln(n,{code:Fr.invalid_type,expected:yn.nan,received:n.parsedType}),Li}return{status:"valid",value:e.data}}};Dq.create=t=>new Dq({typeName:Yi.ZodNaN,...ns(t)});H7n=Symbol("zod_brand"),oZ=class extends As{_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}},sZ=class t extends As{_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"?Li:o.status==="dirty"?(r.dirty(),iN(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"?Li: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:Yi.ZodPipeline})}},EN=class extends As{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Iw(i)&&(i.value=Object.freeze(i.value)),i);return bq(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};EN.create=(t,e)=>new EN({innerType:t,typeName:Yi.ZodReadonly,...ns(e)});G7n={object:G1.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"})(Yi||(Yi={}));V7n=(t,e={message:`Input not instance of ${t.name}`})=>ZIt(r=>r instanceof t,e),eRt=Rw.create,tRt=oN.create,$7n=Dq.create,W7n=sN.create,rRt=aN.create,j7n=lN.create,z7n=Sq.create,Y7n=cN.create,J7n=uN.create,K7n=Bw.create,X7n=D7.create,Z7n=dv.create,e_n=xq.create,t_n=I7.create,r_n=G1.create,n_n=G1.strictCreate,i_n=dN.create,o_n=eme.create,s_n=fN.create,a_n=KC.create,l_n=tme.create,c_n=wq.create,u_n=Tq.create,d_n=rme.create,f_n=pN.create,p_n=hN.create,h_n=mN.create,m_n=gN.create,g_n=Nw.create,A_n=F6.create,y_n=M6.create,E_n=XC.create,v_n=F6.createWithPreprocess,C_n=sZ.create,b_n=()=>eRt().optional(),__n=()=>tRt().optional(),S_n=()=>rRt().optional(),x_n={string:(t=>Rw.create({...t,coerce:!0})),number:(t=>oN.create({...t,coerce:!0})),boolean:(t=>aN.create({...t,coerce:!0})),bigint:(t=>sN.create({...t,coerce:!0})),date:(t=>lN.create({...t,coerce:!0}))},w_n=Li});var fe={};P1(fe,{BRAND:()=>H7n,DIRTY:()=>iN,EMPTY_PATH:()=>v7n,INVALID:()=>Li,NEVER:()=>w_n,OK:()=>rg,ParseStatus:()=>i0,Schema:()=>As,ZodAny:()=>Bw,ZodArray:()=>I7,ZodBigInt:()=>sN,ZodBoolean:()=>aN,ZodBranded:()=>oZ,ZodCatch:()=>yN,ZodDate:()=>lN,ZodDefault:()=>AN,ZodDiscriminatedUnion:()=>eme,ZodEffects:()=>F6,ZodEnum:()=>mN,ZodError:()=>H1,ZodFirstPartyTypeKind:()=>Yi,ZodFunction:()=>rme,ZodIntersection:()=>fN,ZodIssueCode:()=>Fr,ZodLazy:()=>pN,ZodLiteral:()=>hN,ZodMap:()=>wq,ZodNaN:()=>Dq,ZodNativeEnum:()=>gN,ZodNever:()=>dv,ZodNull:()=>uN,ZodNullable:()=>XC,ZodNumber:()=>oN,ZodObject:()=>G1,ZodOptional:()=>M6,ZodParsedType:()=>yn,ZodPipeline:()=>sZ,ZodPromise:()=>Nw,ZodReadonly:()=>EN,ZodRecord:()=>tme,ZodSchema:()=>As,ZodSet:()=>Tq,ZodString:()=>Rw,ZodSymbol:()=>Sq,ZodTransformer:()=>F6,ZodTuple:()=>KC,ZodType:()=>As,ZodUndefined:()=>cN,ZodUnion:()=>dN,ZodUnknown:()=>D7,ZodVoid:()=>xq,addIssueToContext:()=>ln,any:()=>K7n,array:()=>t_n,bigint:()=>W7n,boolean:()=>rRt,coerce:()=>x_n,custom:()=>ZIt,date:()=>j7n,datetimeRegex:()=>KIt,defaultErrorMap:()=>w7,discriminatedUnion:()=>o_n,effect:()=>A_n,enum:()=>h_n,function:()=>d_n,getErrorMap:()=>Cq,getParsedType:()=>JC,instanceof:()=>V7n,intersection:()=>s_n,isAborted:()=>Xhe,isAsync:()=>bq,isDirty:()=>Zhe,isValid:()=>Iw,late:()=>G7n,lazy:()=>f_n,literal:()=>p_n,makeIssue:()=>iZ,map:()=>c_n,nan:()=>$7n,nativeEnum:()=>m_n,never:()=>Z7n,null:()=>J7n,nullable:()=>E_n,number:()=>tRt,object:()=>r_n,objectUtil:()=>AFe,oboolean:()=>S_n,onumber:()=>__n,optional:()=>y_n,ostring:()=>b_n,pipeline:()=>C_n,preprocess:()=>v_n,promise:()=>g_n,quotelessJson:()=>A7n,record:()=>l_n,set:()=>u_n,setErrorMap:()=>E7n,strictObject:()=>n_n,string:()=>eRt,symbol:()=>z7n,transformer:()=>A_n,tuple:()=>a_n,undefined:()=>Y7n,union:()=>i_n,unknown:()=>X7n,util:()=>Gs,void:()=>e_n});var bFe=De(()=>{Khe();EFe();$It();nZ();nRt();Jhe()});var Ow=De(()=>{bFe();bFe()});var Iq,iRt,nme,oRt,sRt,T_n,U6,V1,aZ,ZC,Q6,ime,aRt,ome,lRt,cRt,uRt,lZ,P6,dRt,fRt,Mw,vN,sme,cZ,pRt,D_n,I_n,R_n,_Fe,hRt,mRt,ame,B_n,lme,cme,ume,gRt,ARt,SFe,yRt,ERt,N_n,O_n,xFe,M_n,wFe,k_n,TFe,F_n,P_n,L_n,U_n,Q_n,q_n,H_n,uZ,G_n,DFe,IFe,RFe,V_n,$_n,vRt,W_n,dZ,j_n,z_n,Y_n,J_n,BFe,dme,cxo,K_n,X_n,CRt,Z_n,eSn,tSn,rSn,nSn,iSn,oSn,sSn,aSn,lSn,cSn,uSn,dSn,fSn,pSn,hSn,mSn,NFe,gSn,fme,ASn,ySn,uxo,dxo,fxo,pxo,hxo,mxo,L6,kw=De(()=>{Ow();Iq="2025-06-18",iRt=[Iq,"2025-03-26","2024-11-05","2024-10-07"],nme="2.0",oRt=fe.union([fe.string(),fe.number().int()]),sRt=fe.string(),T_n=fe.object({progressToken:fe.optional(oRt)}).passthrough(),U6=fe.object({_meta:fe.optional(T_n)}).passthrough(),V1=fe.object({method:fe.string(),params:fe.optional(U6)}),aZ=fe.object({_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),ZC=fe.object({method:fe.string(),params:fe.optional(aZ)}),Q6=fe.object({_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),ime=fe.union([fe.string(),fe.number().int()]),aRt=fe.object({jsonrpc:fe.literal(nme),id:ime}).merge(V1).strict(),ome=t=>aRt.safeParse(t).success,lRt=fe.object({jsonrpc:fe.literal(nme)}).merge(ZC).strict(),cRt=t=>lRt.safeParse(t).success,uRt=fe.object({jsonrpc:fe.literal(nme),id:ime,result:Q6}).strict(),lZ=t=>uRt.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"})(P6||(P6={}));dRt=fe.object({jsonrpc:fe.literal(nme),id:ime,error:fe.object({code:fe.number().int(),message:fe.string(),data:fe.optional(fe.unknown())})}).strict(),fRt=t=>dRt.safeParse(t).success,Mw=fe.union([aRt,lRt,uRt,dRt]),vN=Q6.strict(),sme=ZC.extend({method:fe.literal("notifications/cancelled"),params:aZ.extend({requestId:ime,reason:fe.string().optional()})}),cZ=fe.object({name:fe.string(),title:fe.optional(fe.string())}).passthrough(),pRt=cZ.extend({version:fe.string()}),D_n=fe.object({experimental:fe.optional(fe.object({}).passthrough()),sampling:fe.optional(fe.object({}).passthrough()),elicitation:fe.optional(fe.object({}).passthrough()),roots:fe.optional(fe.object({listChanged:fe.optional(fe.boolean())}).passthrough())}).passthrough(),I_n=V1.extend({method:fe.literal("initialize"),params:U6.extend({protocolVersion:fe.string(),capabilities:D_n,clientInfo:pRt})}),R_n=fe.object({experimental:fe.optional(fe.object({}).passthrough()),logging:fe.optional(fe.object({}).passthrough()),completions:fe.optional(fe.object({}).passthrough()),prompts:fe.optional(fe.object({listChanged:fe.optional(fe.boolean())}).passthrough()),resources:fe.optional(fe.object({subscribe:fe.optional(fe.boolean()),listChanged:fe.optional(fe.boolean())}).passthrough()),tools:fe.optional(fe.object({listChanged:fe.optional(fe.boolean())}).passthrough())}).passthrough(),_Fe=Q6.extend({protocolVersion:fe.string(),capabilities:R_n,serverInfo:pRt,instructions:fe.optional(fe.string())}),hRt=ZC.extend({method:fe.literal("notifications/initialized")}),mRt=t=>hRt.safeParse(t).success,ame=V1.extend({method:fe.literal("ping")}),B_n=fe.object({progress:fe.number(),total:fe.optional(fe.number()),message:fe.optional(fe.string())}).passthrough(),lme=ZC.extend({method:fe.literal("notifications/progress"),params:aZ.merge(B_n).extend({progressToken:oRt})}),cme=V1.extend({params:U6.extend({cursor:fe.optional(sRt)}).optional()}),ume=Q6.extend({nextCursor:fe.optional(sRt)}),gRt=fe.object({uri:fe.string(),mimeType:fe.optional(fe.string()),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),ARt=gRt.extend({text:fe.string()}),SFe=fe.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),yRt=gRt.extend({blob:SFe}),ERt=cZ.extend({uri:fe.string(),description:fe.optional(fe.string()),mimeType:fe.optional(fe.string()),_meta:fe.optional(fe.object({}).passthrough())}),N_n=cZ.extend({uriTemplate:fe.string(),description:fe.optional(fe.string()),mimeType:fe.optional(fe.string()),_meta:fe.optional(fe.object({}).passthrough())}),O_n=cme.extend({method:fe.literal("resources/list")}),xFe=ume.extend({resources:fe.array(ERt)}),M_n=cme.extend({method:fe.literal("resources/templates/list")}),wFe=ume.extend({resourceTemplates:fe.array(N_n)}),k_n=V1.extend({method:fe.literal("resources/read"),params:U6.extend({uri:fe.string()})}),TFe=Q6.extend({contents:fe.array(fe.union([ARt,yRt]))}),F_n=ZC.extend({method:fe.literal("notifications/resources/list_changed")}),P_n=V1.extend({method:fe.literal("resources/subscribe"),params:U6.extend({uri:fe.string()})}),L_n=V1.extend({method:fe.literal("resources/unsubscribe"),params:U6.extend({uri:fe.string()})}),U_n=ZC.extend({method:fe.literal("notifications/resources/updated"),params:aZ.extend({uri:fe.string()})}),Q_n=fe.object({name:fe.string(),description:fe.optional(fe.string()),required:fe.optional(fe.boolean())}).passthrough(),q_n=cZ.extend({description:fe.optional(fe.string()),arguments:fe.optional(fe.array(Q_n)),_meta:fe.optional(fe.object({}).passthrough())}),H_n=cme.extend({method:fe.literal("prompts/list")}),uZ=ume.extend({prompts:fe.array(q_n)}),G_n=V1.extend({method:fe.literal("prompts/get"),params:U6.extend({name:fe.string(),arguments:fe.optional(fe.record(fe.string()))})}),DFe=fe.object({type:fe.literal("text"),text:fe.string(),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),IFe=fe.object({type:fe.literal("image"),data:SFe,mimeType:fe.string(),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),RFe=fe.object({type:fe.literal("audio"),data:SFe,mimeType:fe.string(),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),V_n=fe.object({type:fe.literal("resource"),resource:fe.union([ARt,yRt]),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),$_n=ERt.extend({type:fe.literal("resource_link")}),vRt=fe.union([DFe,IFe,RFe,$_n,V_n]),W_n=fe.object({role:fe.enum(["user","assistant"]),content:vRt}).passthrough(),dZ=Q6.extend({description:fe.optional(fe.string()),messages:fe.array(W_n)}),j_n=ZC.extend({method:fe.literal("notifications/prompts/list_changed")}),z_n=fe.object({title:fe.optional(fe.string()),readOnlyHint:fe.optional(fe.boolean()),destructiveHint:fe.optional(fe.boolean()),idempotentHint:fe.optional(fe.boolean()),openWorldHint:fe.optional(fe.boolean())}).passthrough(),Y_n=cZ.extend({description:fe.optional(fe.string()),inputSchema:fe.object({type:fe.literal("object"),properties:fe.optional(fe.object({}).passthrough()),required:fe.optional(fe.array(fe.string()))}).passthrough(),outputSchema:fe.optional(fe.object({type:fe.literal("object"),properties:fe.optional(fe.object({}).passthrough()),required:fe.optional(fe.array(fe.string()))}).passthrough()),annotations:fe.optional(z_n),_meta:fe.optional(fe.object({}).passthrough())}),J_n=cme.extend({method:fe.literal("tools/list")}),BFe=ume.extend({tools:fe.array(Y_n)}),dme=Q6.extend({content:fe.array(vRt).default([]),structuredContent:fe.object({}).passthrough().optional(),isError:fe.optional(fe.boolean())}),cxo=dme.or(Q6.extend({toolResult:fe.unknown()})),K_n=V1.extend({method:fe.literal("tools/call"),params:U6.extend({name:fe.string(),arguments:fe.optional(fe.record(fe.unknown()))})}),X_n=ZC.extend({method:fe.literal("notifications/tools/list_changed")}),CRt=fe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Z_n=V1.extend({method:fe.literal("logging/setLevel"),params:U6.extend({level:CRt})}),eSn=ZC.extend({method:fe.literal("notifications/message"),params:aZ.extend({level:CRt,logger:fe.optional(fe.string()),data:fe.unknown()})}),tSn=fe.object({name:fe.string().optional()}).passthrough(),rSn=fe.object({hints:fe.optional(fe.array(tSn)),costPriority:fe.optional(fe.number().min(0).max(1)),speedPriority:fe.optional(fe.number().min(0).max(1)),intelligencePriority:fe.optional(fe.number().min(0).max(1))}).passthrough(),nSn=fe.object({role:fe.enum(["user","assistant"]),content:fe.union([DFe,IFe,RFe])}).passthrough(),iSn=V1.extend({method:fe.literal("sampling/createMessage"),params:U6.extend({messages:fe.array(nSn),systemPrompt:fe.optional(fe.string()),includeContext:fe.optional(fe.enum(["none","thisServer","allServers"])),temperature:fe.optional(fe.number()),maxTokens:fe.number().int(),stopSequences:fe.optional(fe.array(fe.string())),metadata:fe.optional(fe.object({}).passthrough()),modelPreferences:fe.optional(rSn)})}),oSn=Q6.extend({model:fe.string(),stopReason:fe.optional(fe.enum(["endTurn","stopSequence","maxTokens"]).or(fe.string())),role:fe.enum(["user","assistant"]),content:fe.discriminatedUnion("type",[DFe,IFe,RFe])}),sSn=fe.object({type:fe.literal("boolean"),title:fe.optional(fe.string()),description:fe.optional(fe.string()),default:fe.optional(fe.boolean())}).passthrough(),aSn=fe.object({type:fe.literal("string"),title:fe.optional(fe.string()),description:fe.optional(fe.string()),minLength:fe.optional(fe.number()),maxLength:fe.optional(fe.number()),format:fe.optional(fe.enum(["email","uri","date","date-time"]))}).passthrough(),lSn=fe.object({type:fe.enum(["number","integer"]),title:fe.optional(fe.string()),description:fe.optional(fe.string()),minimum:fe.optional(fe.number()),maximum:fe.optional(fe.number())}).passthrough(),cSn=fe.object({type:fe.literal("string"),title:fe.optional(fe.string()),description:fe.optional(fe.string()),enum:fe.array(fe.string()),enumNames:fe.optional(fe.array(fe.string()))}).passthrough(),uSn=fe.union([sSn,aSn,lSn,cSn]),dSn=V1.extend({method:fe.literal("elicitation/create"),params:U6.extend({message:fe.string(),requestedSchema:fe.object({type:fe.literal("object"),properties:fe.record(fe.string(),uSn),required:fe.optional(fe.array(fe.string()))}).passthrough()})}),fSn=Q6.extend({action:fe.enum(["accept","decline","cancel"]),content:fe.optional(fe.record(fe.string(),fe.unknown()))}),pSn=fe.object({type:fe.literal("ref/resource"),uri:fe.string()}).passthrough(),hSn=fe.object({type:fe.literal("ref/prompt"),name:fe.string()}).passthrough(),mSn=V1.extend({method:fe.literal("completion/complete"),params:U6.extend({ref:fe.union([hSn,pSn]),argument:fe.object({name:fe.string(),value:fe.string()}).passthrough(),context:fe.optional(fe.object({arguments:fe.optional(fe.record(fe.string(),fe.string()))}))})}),NFe=Q6.extend({completion:fe.object({values:fe.array(fe.string()).max(100),total:fe.optional(fe.number().int()),hasMore:fe.optional(fe.boolean())}).passthrough()}),gSn=fe.object({uri:fe.string().startsWith("file://"),name:fe.optional(fe.string()),_meta:fe.optional(fe.object({}).passthrough())}).passthrough(),fme=V1.extend({method:fe.literal("roots/list")}),ASn=Q6.extend({roots:fe.array(gSn)}),ySn=ZC.extend({method:fe.literal("notifications/roots/list_changed")}),uxo=fe.union([ame,I_n,mSn,Z_n,G_n,H_n,O_n,M_n,k_n,P_n,L_n,K_n,J_n]),dxo=fe.union([sme,lme,hRt,ySn]),fxo=fe.union([vN,oSn,fSn,ASn]),pxo=fe.union([ame,iSn,dSn,fme]),hxo=fe.union([sme,lme,eSn,U_n,F_n,X_n,j_n]),mxo=fe.union([vN,_Fe,NFe,dZ,uZ,xFe,wFe,TFe,dme,BFe]),L6=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function bRt(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 ESn,pme,_Rt=De(()=>{kw();ESn=6e4,pme=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(sme,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(lme,r=>{this._onprogress(r)}),this.setRequestHandler(ame,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 L6(P6.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),lZ(c)||fRt(c)?this._onresponse(c):ome(c)?this._onrequest(c,u):cRt(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 L6(P6.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:P6.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:P6.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),lZ(e))n(e);else{let i=new L6(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 A=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:A};n?.onprogress&&(this._progressHandlers.set(A,n.onprogress),y.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:A}});let v=w=>{var B;this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),(B=this._transport)===null||B===void 0||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:A,reason:String(w)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(L=>this._onerror(new Error(`Failed to send cancellation: ${L}`))),c(w)};this._responseHandlers.set(A,w=>{var B;if(!(!((B=n?.signal)===null||B===void 0)&&B.aborted)){if(w instanceof Error)return c(w);try{let L=r.parse(w.result);a(L)}catch(L){c(L)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var w;v((w=n?.signal)===null||w===void 0?void 0:w.reason)});let S=(h=n?.timeout)!==null&&h!==void 0?h:ESn,x=()=>v(new L6(P6.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(A,S,n?.maxTotalTimeout,x,(m=n?.resetTimeoutOnProgress)!==null&&m!==void 0?m:!1),this._transport.send(y,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(w=>{this._cleanupTimeout(A),c(w)})})}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 xRt=N((hme,SRt)=>{(function(t,e){typeof hme=="object"&&typeof SRt<"u"?e(hme):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(hme,(function(t){"use strict";function e(){for(var lt=arguments.length,Ke=Array(lt),ft=0;ft<lt;ft++)Ke[ft]=arguments[ft];if(Ke.length>1){Ke[0]=Ke[0].slice(0,-1);for(var Tt=Ke.length-1,yt=1;yt<Tt;++yt)Ke[yt]=Ke[yt].slice(1,-1);return Ke[Tt]=Ke[Tt].slice(1),Ke.join("")}else return Ke[0]}function r(lt){return"(?:"+lt+")"}function n(lt){return lt===void 0?"undefined":lt===null?"null":Object.prototype.toString.call(lt).split(" ").pop().split("]").shift().toLowerCase()}function i(lt){return lt.toUpperCase()}function o(lt){return lt!=null?lt instanceof Array?lt:typeof lt.length!="number"||lt.split||lt.setInterval||lt.call?[lt]:Array.prototype.slice.call(lt):[]}function s(lt,Ke){var ft=lt;if(Ke)for(var Tt in Ke)ft[Tt]=Ke[Tt];return ft}function a(lt){var Ke="[A-Za-z]",ft="[\\x0D]",Tt="[0-9]",yt="[\\x22]",gr=e(Tt,"[A-Fa-f]"),Br="[\\x0A]",Jr="[\\x20]",dn=r(r("%[EFef]"+gr+"%"+gr+gr+"%"+gr+gr)+"|"+r("%[89A-Fa-f]"+gr+"%"+gr+gr)+"|"+r("%"+gr+gr)),di="[\\:\\/\\?\\#\\[\\]\\@]",ei="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ii=e(di,ei),Qi=lt?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",bn=lt?"[\\uE000-\\uF8FF]":"[]",Ti=e(Ke,Tt,"[\\-\\.\\_\\~]",Qi),mo=r(Ke+e(Ke,Tt,"[\\+\\-\\.]")+"*"),Xi=r(r(dn+"|"+e(Ti,ei,"[\\:]"))+"*"),Hl=r(r("25[0-5]")+"|"+r("2[0-4]"+Tt)+"|"+r("1"+Tt+Tt)+"|"+r("[1-9]"+Tt)+"|"+Tt),ws=r(r("25[0-5]")+"|"+r("2[0-4]"+Tt)+"|"+r("1"+Tt+Tt)+"|"+r("0?[1-9]"+Tt)+"|0?0?"+Tt),js=r(ws+"\\."+ws+"\\."+ws+"\\."+ws),Di=r(gr+"{1,4}"),Gl=r(r(Di+"\\:"+Di)+"|"+js),To=r(r(Di+"\\:")+"{6}"+Gl),bi=r("\\:\\:"+r(Di+"\\:")+"{5}"+Gl),Lc=r(r(Di)+"?\\:\\:"+r(Di+"\\:")+"{4}"+Gl),Da=r(r(r(Di+"\\:")+"{0,1}"+Di)+"?\\:\\:"+r(Di+"\\:")+"{3}"+Gl),go=r(r(r(Di+"\\:")+"{0,2}"+Di)+"?\\:\\:"+r(Di+"\\:")+"{2}"+Gl),Uc=r(r(r(Di+"\\:")+"{0,3}"+Di)+"?\\:\\:"+Di+"\\:"+Gl),Ts=r(r(r(Di+"\\:")+"{0,4}"+Di)+"?\\:\\:"+Gl),Ds=r(r(r(Di+"\\:")+"{0,5}"+Di)+"?\\:\\:"+Di),il=r(r(r(Di+"\\:")+"{0,6}"+Di)+"?\\:\\:"),$e=r([To,bi,Lc,Da,go,Uc,Ts,Ds,il].join("|")),je=r(r(Ti+"|"+dn)+"+"),gt=r($e+"\\%25"+je),wt=r($e+r("\\%25|\\%(?!"+gr+"{2})")+je),Ft=r("[vV]"+gr+"+\\."+e(Ti,ei,"[\\:]")+"+"),er=r("\\["+r(wt+"|"+$e+"|"+Ft)+"\\]"),hr=r(r(dn+"|"+e(Ti,ei))+"*"),dr=r(er+"|"+js+"(?!"+hr+")|"+hr),Sr=r(Tt+"*"),Dr=r(r(Xi+"@")+"?"+dr+r("\\:"+Sr)+"?"),kr=r(dn+"|"+e(Ti,ei,"[\\:\\@]")),En=r(kr+"*"),$i=r(kr+"+"),Is=r(r(dn+"|"+e(Ti,ei,"[\\@]"))+"+"),Ri=r(r("\\/"+En)+"*"),Ga=r("\\/"+r($i+Ri)+"?"),nc=r(Is+Ri),qd=r($i+Ri),Vl="(?!"+kr+")",g1=r(Ri+"|"+Ga+"|"+nc+"|"+qd+"|"+Vl),_c=r(r(kr+"|"+e("[\\/\\?]",bn))+"*"),Sc=r(r(kr+"|[\\/\\?]")+"*"),Pm=r(r("\\/\\/"+Dr+Ri)+"|"+Ga+"|"+qd+"|"+Vl),U0=r(mo+"\\:"+Pm+r("\\?"+_c)+"?"+r("\\#"+Sc)+"?"),Vp=r(r("\\/\\/"+Dr+Ri)+"|"+Ga+"|"+nc+"|"+Vl),ol=r(Vp+r("\\?"+_c)+"?"+r("\\#"+Sc)+"?"),$p=r(U0+"|"+ol),Hd=r(mo+"\\:"+Pm+r("\\?"+_c)+"?"),vf="^("+mo+")\\:"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+dr+")"+r("\\:("+Sr+")")+"?)")+"?("+Ri+"|"+Ga+"|"+qd+"|"+Vl+")")+r("\\?("+_c+")")+"?"+r("\\#("+Sc+")")+"?$",Wp="^(){0}"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+dr+")"+r("\\:("+Sr+")")+"?)")+"?("+Ri+"|"+Ga+"|"+nc+"|"+Vl+")")+r("\\?("+_c+")")+"?"+r("\\#("+Sc+")")+"?$",Th="^("+mo+")\\:"+r(r("\\/\\/("+r("("+Xi+")@")+"?("+dr+")"+r("\\:("+Sr+")")+"?)")+"?("+Ri+"|"+Ga+"|"+qd+"|"+Vl+")")+r("\\?("+_c+")")+"?$",nu="^"+r("\\#("+Sc+")")+"?$",i2="^"+r("("+Xi+")@")+"?("+dr+")"+r("\\:("+Sr+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Ke,Tt,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Ti,ei),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Ti,ei),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Ti,ei),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Ti,ei),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Ti,ei,"[\\:\\@\\/\\?]",bn),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Ti,ei,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Ti,ei),"g"),UNRESERVED:new RegExp(Ti,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Ti,Ii),"g"),PCT_ENCODED:new RegExp(dn,"g"),IPV4ADDRESS:new RegExp("^("+js+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$e+")"+r(r("\\%25|\\%(?!"+gr+"{2})")+"("+je+")")+"?\\]?$")}}var c=a(!1),u=a(!0),d=(function(){function lt(Ke,ft){var Tt=[],yt=!0,gr=!1,Br=void 0;try{for(var Jr=Ke[Symbol.iterator](),dn;!(yt=(dn=Jr.next()).done)&&(Tt.push(dn.value),!(ft&&Tt.length===ft));yt=!0);}catch(di){gr=!0,Br=di}finally{try{!yt&&Jr.return&&Jr.return()}finally{if(gr)throw Br}}return Tt}return function(Ke,ft){if(Array.isArray(Ke))return Ke;if(Symbol.iterator in Object(Ke))return lt(Ke,ft);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),f=function(lt){if(Array.isArray(lt)){for(var Ke=0,ft=Array(lt.length);Ke<lt.length;Ke++)ft[Ke]=lt[Ke];return ft}else return Array.from(lt)},p=2147483647,h=36,m=1,A=26,y=38,v=700,S=72,x=128,w="-",B=/^xn--/,L=/[^\0-\x7E]/,F=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=h-m,U=Math.floor,M=String.fromCharCode;function Q(lt){throw new RangeError(q[lt])}function k(lt,Ke){for(var ft=[],Tt=lt.length;Tt--;)ft[Tt]=Ke(lt[Tt]);return ft}function O(lt,Ke){var ft=lt.split("@"),Tt="";ft.length>1&&(Tt=ft[0]+"@",lt=ft[1]),lt=lt.replace(F,".");var yt=lt.split("."),gr=k(yt,Ke).join(".");return Tt+gr}function $(lt){for(var Ke=[],ft=0,Tt=lt.length;ft<Tt;){var yt=lt.charCodeAt(ft++);if(yt>=55296&&yt<=56319&&ft<Tt){var gr=lt.charCodeAt(ft++);(gr&64512)==56320?Ke.push(((yt&1023)<<10)+(gr&1023)+65536):(Ke.push(yt),ft--)}else Ke.push(yt)}return Ke}var G=function(Ke){return String.fromCodePoint.apply(String,f(Ke))},z=function(Ke){return Ke-48<10?Ke-22:Ke-65<26?Ke-65:Ke-97<26?Ke-97:h},W=function(Ke,ft){return Ke+22+75*(Ke<26)-((ft!=0)<<5)},ee=function(Ke,ft,Tt){var yt=0;for(Ke=Tt?U(Ke/v):Ke>>1,Ke+=U(Ke/ft);Ke>D*A>>1;yt+=h)Ke=U(Ke/D);return U(yt+(D+1)*Ke/(Ke+y))},X=function(Ke){var ft=[],Tt=Ke.length,yt=0,gr=x,Br=S,Jr=Ke.lastIndexOf(w);Jr<0&&(Jr=0);for(var dn=0;dn<Jr;++dn)Ke.charCodeAt(dn)>=128&&Q("not-basic"),ft.push(Ke.charCodeAt(dn));for(var di=Jr>0?Jr+1:0;di<Tt;){for(var ei=yt,Ii=1,Qi=h;;Qi+=h){di>=Tt&&Q("invalid-input");var bn=z(Ke.charCodeAt(di++));(bn>=h||bn>U((p-yt)/Ii))&&Q("overflow"),yt+=bn*Ii;var Ti=Qi<=Br?m:Qi>=Br+A?A:Qi-Br;if(bn<Ti)break;var mo=h-Ti;Ii>U(p/mo)&&Q("overflow"),Ii*=mo}var Xi=ft.length+1;Br=ee(yt-ei,Xi,ei==0),U(yt/Xi)>p-gr&&Q("overflow"),gr+=U(yt/Xi),yt%=Xi,ft.splice(yt++,0,gr)}return String.fromCodePoint.apply(String,ft)},he=function(Ke){var ft=[];Ke=$(Ke);var Tt=Ke.length,yt=x,gr=0,Br=S,Jr=!0,dn=!1,di=void 0;try{for(var ei=Ke[Symbol.iterator](),Ii;!(Jr=(Ii=ei.next()).done);Jr=!0){var Qi=Ii.value;Qi<128&&ft.push(M(Qi))}}catch(wt){dn=!0,di=wt}finally{try{!Jr&&ei.return&&ei.return()}finally{if(dn)throw di}}var bn=ft.length,Ti=bn;for(bn&&ft.push(w);Ti<Tt;){var mo=p,Xi=!0,Hl=!1,ws=void 0;try{for(var js=Ke[Symbol.iterator](),Di;!(Xi=(Di=js.next()).done);Xi=!0){var Gl=Di.value;Gl>=yt&&Gl<mo&&(mo=Gl)}}catch(wt){Hl=!0,ws=wt}finally{try{!Xi&&js.return&&js.return()}finally{if(Hl)throw ws}}var To=Ti+1;mo-yt>U((p-gr)/To)&&Q("overflow"),gr+=(mo-yt)*To,yt=mo;var bi=!0,Lc=!1,Da=void 0;try{for(var go=Ke[Symbol.iterator](),Uc;!(bi=(Uc=go.next()).done);bi=!0){var Ts=Uc.value;if(Ts<yt&&++gr>p&&Q("overflow"),Ts==yt){for(var Ds=gr,il=h;;il+=h){var $e=il<=Br?m:il>=Br+A?A:il-Br;if(Ds<$e)break;var je=Ds-$e,gt=h-$e;ft.push(M(W($e+je%gt,0))),Ds=U(je/gt)}ft.push(M(W(Ds,0))),Br=ee(gr,To,Ti==bn),gr=0,++Ti}}}catch(wt){Lc=!0,Da=wt}finally{try{!bi&&go.return&&go.return()}finally{if(Lc)throw Da}}++gr,++yt}return ft.join("")},Ee=function(Ke){return O(Ke,function(ft){return B.test(ft)?X(ft.slice(4).toLowerCase()):ft})},ye=function(Ke){return O(Ke,function(ft){return L.test(ft)?"xn--"+he(ft):ft})},_e={version:"2.1.0",ucs2:{decode:$,encode:G},decode:X,encode:he,toASCII:ye,toUnicode:Ee},we={};function de(lt){var Ke=lt.charCodeAt(0),ft=void 0;return Ke<16?ft="%0"+Ke.toString(16).toUpperCase():Ke<128?ft="%"+Ke.toString(16).toUpperCase():Ke<2048?ft="%"+(Ke>>6|192).toString(16).toUpperCase()+"%"+(Ke&63|128).toString(16).toUpperCase():ft="%"+(Ke>>12|224).toString(16).toUpperCase()+"%"+(Ke>>6&63|128).toString(16).toUpperCase()+"%"+(Ke&63|128).toString(16).toUpperCase(),ft}function ve(lt){for(var Ke="",ft=0,Tt=lt.length;ft<Tt;){var yt=parseInt(lt.substr(ft+1,2),16);if(yt<128)Ke+=String.fromCharCode(yt),ft+=3;else if(yt>=194&&yt<224){if(Tt-ft>=6){var gr=parseInt(lt.substr(ft+4,2),16);Ke+=String.fromCharCode((yt&31)<<6|gr&63)}else Ke+=lt.substr(ft,6);ft+=6}else if(yt>=224){if(Tt-ft>=9){var Br=parseInt(lt.substr(ft+4,2),16),Jr=parseInt(lt.substr(ft+7,2),16);Ke+=String.fromCharCode((yt&15)<<12|(Br&63)<<6|Jr&63)}else Ke+=lt.substr(ft,9);ft+=9}else Ke+=lt.substr(ft,3),ft+=3}return Ke}function Se(lt,Ke){function ft(Tt){var yt=ve(Tt);return yt.match(Ke.UNRESERVED)?yt:Tt}return lt.scheme&&(lt.scheme=String(lt.scheme).replace(Ke.PCT_ENCODED,ft).toLowerCase().replace(Ke.NOT_SCHEME,"")),lt.userinfo!==void 0&&(lt.userinfo=String(lt.userinfo).replace(Ke.PCT_ENCODED,ft).replace(Ke.NOT_USERINFO,de).replace(Ke.PCT_ENCODED,i)),lt.host!==void 0&&(lt.host=String(lt.host).replace(Ke.PCT_ENCODED,ft).toLowerCase().replace(Ke.NOT_HOST,de).replace(Ke.PCT_ENCODED,i)),lt.path!==void 0&&(lt.path=String(lt.path).replace(Ke.PCT_ENCODED,ft).replace(lt.scheme?Ke.NOT_PATH:Ke.NOT_PATH_NOSCHEME,de).replace(Ke.PCT_ENCODED,i)),lt.query!==void 0&&(lt.query=String(lt.query).replace(Ke.PCT_ENCODED,ft).replace(Ke.NOT_QUERY,de).replace(Ke.PCT_ENCODED,i)),lt.fragment!==void 0&&(lt.fragment=String(lt.fragment).replace(Ke.PCT_ENCODED,ft).replace(Ke.NOT_FRAGMENT,de).replace(Ke.PCT_ENCODED,i)),lt}function se(lt){return lt.replace(/^0*(.*)/,"$1")||"0"}function Ae(lt,Ke){var ft=lt.match(Ke.IPV4ADDRESS)||[],Tt=d(ft,2),yt=Tt[1];return yt?yt.split(".").map(se).join("."):lt}function Z(lt,Ke){var ft=lt.match(Ke.IPV6ADDRESS)||[],Tt=d(ft,3),yt=Tt[1],gr=Tt[2];if(yt){for(var Br=yt.toLowerCase().split("::").reverse(),Jr=d(Br,2),dn=Jr[0],di=Jr[1],ei=di?di.split(":").map(se):[],Ii=dn.split(":").map(se),Qi=Ke.IPV4ADDRESS.test(Ii[Ii.length-1]),bn=Qi?7:8,Ti=Ii.length-bn,mo=Array(bn),Xi=0;Xi<bn;++Xi)mo[Xi]=ei[Xi]||Ii[Ti+Xi]||"";Qi&&(mo[bn-1]=Ae(mo[bn-1],Ke));var Hl=mo.reduce(function(To,bi,Lc){if(!bi||bi==="0"){var Da=To[To.length-1];Da&&Da.index+Da.length===Lc?Da.length++:To.push({index:Lc,length:1})}return To},[]),ws=Hl.sort(function(To,bi){return bi.length-To.length})[0],js=void 0;if(ws&&ws.length>1){var Di=mo.slice(0,ws.index),Gl=mo.slice(ws.index+ws.length);js=Di.join(":")+"::"+Gl.join(":")}else js=mo.join(":");return gr&&(js+="%"+gr),js}else return lt}var oe=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ge="".match(/(){0}/)[1]===void 0;function ae(lt){var Ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ft={},Tt=Ke.iri!==!1?u:c;Ke.reference==="suffix"&&(lt=(Ke.scheme?Ke.scheme+":":"")+"//"+lt);var yt=lt.match(oe);if(yt){ge?(ft.scheme=yt[1],ft.userinfo=yt[3],ft.host=yt[4],ft.port=parseInt(yt[5],10),ft.path=yt[6]||"",ft.query=yt[7],ft.fragment=yt[8],isNaN(ft.port)&&(ft.port=yt[5])):(ft.scheme=yt[1]||void 0,ft.userinfo=lt.indexOf("@")!==-1?yt[3]:void 0,ft.host=lt.indexOf("//")!==-1?yt[4]:void 0,ft.port=parseInt(yt[5],10),ft.path=yt[6]||"",ft.query=lt.indexOf("?")!==-1?yt[7]:void 0,ft.fragment=lt.indexOf("#")!==-1?yt[8]:void 0,isNaN(ft.port)&&(ft.port=lt.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?yt[4]:void 0)),ft.host&&(ft.host=Z(Ae(ft.host,Tt),Tt)),ft.scheme===void 0&&ft.userinfo===void 0&&ft.host===void 0&&ft.port===void 0&&!ft.path&&ft.query===void 0?ft.reference="same-document":ft.scheme===void 0?ft.reference="relative":ft.fragment===void 0?ft.reference="absolute":ft.reference="uri",Ke.reference&&Ke.reference!=="suffix"&&Ke.reference!==ft.reference&&(ft.error=ft.error||"URI is not a "+Ke.reference+" reference.");var gr=we[(Ke.scheme||ft.scheme||"").toLowerCase()];if(!Ke.unicodeSupport&&(!gr||!gr.unicodeSupport)){if(ft.host&&(Ke.domainHost||gr&&gr.domainHost))try{ft.host=_e.toASCII(ft.host.replace(Tt.PCT_ENCODED,ve).toLowerCase())}catch(Br){ft.error=ft.error||"Host's domain name can not be converted to ASCII via punycode: "+Br}Se(ft,c)}else Se(ft,Tt);gr&&gr.parse&&gr.parse(ft,Ke)}else ft.error=ft.error||"URI can not be parsed.";return ft}function K(lt,Ke){var ft=Ke.iri!==!1?u:c,Tt=[];return lt.userinfo!==void 0&&(Tt.push(lt.userinfo),Tt.push("@")),lt.host!==void 0&&Tt.push(Z(Ae(String(lt.host),ft),ft).replace(ft.IPV6ADDRESS,function(yt,gr,Br){return"["+gr+(Br?"%25"+Br:"")+"]"})),(typeof lt.port=="number"||typeof lt.port=="string")&&(Tt.push(":"),Tt.push(String(lt.port))),Tt.length?Tt.join(""):void 0}var ne=/^\.\.?\//,Te=/^\/\.(\/|$)/,me=/^\/\.\.(\/|$)/,te=/^\/?(?:.|\n)*?(?=\/|$)/;function ke(lt){for(var Ke=[];lt.length;)if(lt.match(ne))lt=lt.replace(ne,"");else if(lt.match(Te))lt=lt.replace(Te,"/");else if(lt.match(me))lt=lt.replace(me,"/"),Ke.pop();else if(lt==="."||lt==="..")lt="";else{var ft=lt.match(te);if(ft){var Tt=ft[0];lt=lt.slice(Tt.length),Ke.push(Tt)}else throw new Error("Unexpected dot segment condition")}return Ke.join("")}function Ue(lt){var Ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ft=Ke.iri?u:c,Tt=[],yt=we[(Ke.scheme||lt.scheme||"").toLowerCase()];if(yt&&yt.serialize&&yt.serialize(lt,Ke),lt.host&&!ft.IPV6ADDRESS.test(lt.host)){if(Ke.domainHost||yt&&yt.domainHost)try{lt.host=Ke.iri?_e.toUnicode(lt.host):_e.toASCII(lt.host.replace(ft.PCT_ENCODED,ve).toLowerCase())}catch(Jr){lt.error=lt.error||"Host's domain name can not be converted to "+(Ke.iri?"Unicode":"ASCII")+" via punycode: "+Jr}}Se(lt,ft),Ke.reference!=="suffix"&&lt.scheme&&(Tt.push(lt.scheme),Tt.push(":"));var gr=K(lt,Ke);if(gr!==void 0&&(Ke.reference!=="suffix"&&Tt.push("//"),Tt.push(gr),lt.path&&lt.path.charAt(0)!=="/"&&Tt.push("/")),lt.path!==void 0){var Br=lt.path;!Ke.absolutePath&&(!yt||!yt.absolutePath)&&(Br=ke(Br)),gr===void 0&&(Br=Br.replace(/^\/\//,"/%2F")),Tt.push(Br)}return lt.query!==void 0&&(Tt.push("?"),Tt.push(lt.query)),lt.fragment!==void 0&&(Tt.push("#"),Tt.push(lt.fragment)),Tt.join("")}function He(lt,Ke){var ft=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Tt=arguments[3],yt={};return Tt||(lt=ae(Ue(lt,ft),ft),Ke=ae(Ue(Ke,ft),ft)),ft=ft||{},!ft.tolerant&&Ke.scheme?(yt.scheme=Ke.scheme,yt.userinfo=Ke.userinfo,yt.host=Ke.host,yt.port=Ke.port,yt.path=ke(Ke.path||""),yt.query=Ke.query):(Ke.userinfo!==void 0||Ke.host!==void 0||Ke.port!==void 0?(yt.userinfo=Ke.userinfo,yt.host=Ke.host,yt.port=Ke.port,yt.path=ke(Ke.path||""),yt.query=Ke.query):(Ke.path?(Ke.path.charAt(0)==="/"?yt.path=ke(Ke.path):((lt.userinfo!==void 0||lt.host!==void 0||lt.port!==void 0)&&!lt.path?yt.path="/"+Ke.path:lt.path?yt.path=lt.path.slice(0,lt.path.lastIndexOf("/")+1)+Ke.path:yt.path=Ke.path,yt.path=ke(yt.path)),yt.query=Ke.query):(yt.path=lt.path,Ke.query!==void 0?yt.query=Ke.query:yt.query=lt.query),yt.userinfo=lt.userinfo,yt.host=lt.host,yt.port=lt.port),yt.scheme=lt.scheme),yt.fragment=Ke.fragment,yt}function Ge(lt,Ke,ft){var Tt=s({scheme:"null"},ft);return Ue(He(ae(lt,Tt),ae(Ke,Tt),Tt,!0),Tt)}function pe(lt,Ke){return typeof lt=="string"?lt=Ue(ae(lt,Ke),Ke):n(lt)==="object"&&(lt=ae(Ue(lt,Ke),Ke)),lt}function Re(lt,Ke,ft){return typeof lt=="string"?lt=Ue(ae(lt,ft),ft):n(lt)==="object"&&(lt=Ue(lt,ft)),typeof Ke=="string"?Ke=Ue(ae(Ke,ft),ft):n(Ke)==="object"&&(Ke=Ue(Ke,ft)),lt===Ke}function Ne(lt,Ke){return lt&&lt.toString().replace(!Ke||!Ke.iri?c.ESCAPE:u.ESCAPE,de)}function Le(lt,Ke){return lt&&lt.toString().replace(!Ke||!Ke.iri?c.PCT_ENCODED:u.PCT_ENCODED,ve)}var Xe={scheme:"http",domainHost:!0,parse:function(Ke,ft){return Ke.host||(Ke.error=Ke.error||"HTTP URIs must have a host."),Ke},serialize:function(Ke,ft){var Tt=String(Ke.scheme).toLowerCase()==="https";return(Ke.port===(Tt?443:80)||Ke.port==="")&&(Ke.port=void 0),Ke.path||(Ke.path="/"),Ke}},st={scheme:"https",domainHost:Xe.domainHost,parse:Xe.parse,serialize:Xe.serialize};function mt(lt){return typeof lt.secure=="boolean"?lt.secure:String(lt.scheme).toLowerCase()==="wss"}var bt={scheme:"ws",domainHost:!0,parse:function(Ke,ft){var Tt=Ke;return Tt.secure=mt(Tt),Tt.resourceName=(Tt.path||"/")+(Tt.query?"?"+Tt.query:""),Tt.path=void 0,Tt.query=void 0,Tt},serialize:function(Ke,ft){if((Ke.port===(mt(Ke)?443:80)||Ke.port==="")&&(Ke.port=void 0),typeof Ke.secure=="boolean"&&(Ke.scheme=Ke.secure?"wss":"ws",Ke.secure=void 0),Ke.resourceName){var Tt=Ke.resourceName.split("?"),yt=d(Tt,2),gr=yt[0],Br=yt[1];Ke.path=gr&&gr!=="/"?gr:void 0,Ke.query=Br,Ke.resourceName=void 0}return Ke.fragment=void 0,Ke}},Rt={scheme:"wss",domainHost:bt.domainHost,parse:bt.parse,serialize:bt.serialize},Ar={},Mr=!0,Qe="[A-Za-z0-9\\-\\.\\_\\~"+(Mr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ut="[0-9A-Fa-f]",dt=r(r("%[EFef]"+ut+"%"+ut+ut+"%"+ut+ut)+"|"+r("%[89A-Fa-f]"+ut+"%"+ut+ut)+"|"+r("%"+ut+ut)),Lt="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ut="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Pt=e(Ut,'[\\"\\\\]'),Ht="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Xt=new RegExp(Qe,"g"),Wt=new RegExp(dt,"g"),an=new RegExp(e("[^]",Lt,"[\\.]",'[\\"]',Pt),"g"),Ur=new RegExp(e("[^]",Qe,Ht),"g"),tn=Ur;function rn(lt){var Ke=ve(lt);return Ke.match(Xt)?Ke:lt}var Wn={scheme:"mailto",parse:function(Ke,ft){var Tt=Ke,yt=Tt.to=Tt.path?Tt.path.split(","):[];if(Tt.path=void 0,Tt.query){for(var gr=!1,Br={},Jr=Tt.query.split("&"),dn=0,di=Jr.length;dn<di;++dn){var ei=Jr[dn].split("=");switch(ei[0]){case"to":for(var Ii=ei[1].split(","),Qi=0,bn=Ii.length;Qi<bn;++Qi)yt.push(Ii[Qi]);break;case"subject":Tt.subject=Le(ei[1],ft);break;case"body":Tt.body=Le(ei[1],ft);break;default:gr=!0,Br[Le(ei[0],ft)]=Le(ei[1],ft);break}}gr&&(Tt.headers=Br)}Tt.query=void 0;for(var Ti=0,mo=yt.length;Ti<mo;++Ti){var Xi=yt[Ti].split("@");if(Xi[0]=Le(Xi[0]),ft.unicodeSupport)Xi[1]=Le(Xi[1],ft).toLowerCase();else try{Xi[1]=_e.toASCII(Le(Xi[1],ft).toLowerCase())}catch(Hl){Tt.error=Tt.error||"Email address's domain name can not be converted to ASCII via punycode: "+Hl}yt[Ti]=Xi.join("@")}return Tt},serialize:function(Ke,ft){var Tt=Ke,yt=o(Ke.to);if(yt){for(var gr=0,Br=yt.length;gr<Br;++gr){var Jr=String(yt[gr]),dn=Jr.lastIndexOf("@"),di=Jr.slice(0,dn).replace(Wt,rn).replace(Wt,i).replace(an,de),ei=Jr.slice(dn+1);try{ei=ft.iri?_e.toUnicode(ei):_e.toASCII(Le(ei,ft).toLowerCase())}catch(Ti){Tt.error=Tt.error||"Email address's domain name can not be converted to "+(ft.iri?"Unicode":"ASCII")+" via punycode: "+Ti}yt[gr]=di+"@"+ei}Tt.path=yt.join(",")}var Ii=Ke.headers=Ke.headers||{};Ke.subject&&(Ii.subject=Ke.subject),Ke.body&&(Ii.body=Ke.body);var Qi=[];for(var bn in Ii)Ii[bn]!==Ar[bn]&&Qi.push(bn.replace(Wt,rn).replace(Wt,i).replace(Ur,de)+"="+Ii[bn].replace(Wt,rn).replace(Wt,i).replace(tn,de));return Qi.length&&(Tt.query=Qi.join("&")),Tt}},Zn=/^([^\:]+)\:(.*)/,Bn={scheme:"urn",parse:function(Ke,ft){var Tt=Ke.path&&Ke.path.match(Zn),yt=Ke;if(Tt){var gr=ft.scheme||yt.scheme||"urn",Br=Tt[1].toLowerCase(),Jr=Tt[2],dn=gr+":"+(ft.nid||Br),di=we[dn];yt.nid=Br,yt.nss=Jr,yt.path=void 0,di&&(yt=di.parse(yt,ft))}else yt.error=yt.error||"URN can not be parsed.";return yt},serialize:function(Ke,ft){var Tt=ft.scheme||Ke.scheme||"urn",yt=Ke.nid,gr=Tt+":"+(ft.nid||yt),Br=we[gr];Br&&(Ke=Br.serialize(Ke,ft));var Jr=Ke,dn=Ke.nss;return Jr.path=(yt||ft.nid)+":"+dn,Jr}},ho=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Vi={scheme:"urn:uuid",parse:function(Ke,ft){var Tt=Ke;return Tt.uuid=Tt.nss,Tt.nss=void 0,!ft.tolerant&&(!Tt.uuid||!Tt.uuid.match(ho))&&(Tt.error=Tt.error||"UUID is not valid."),Tt},serialize:function(Ke,ft){var Tt=Ke;return Tt.nss=(Ke.uuid||"").toLowerCase(),Tt}};we[Xe.scheme]=Xe,we[st.scheme]=st,we[bt.scheme]=bt,we[Rt.scheme]=Rt,we[Wn.scheme]=Wn,we[Bn.scheme]=Bn,we[Vi.scheme]=Vi,t.SCHEMES=we,t.pctEncChar=de,t.pctDecChars=ve,t.parse=ae,t.removeDotSegments=ke,t.serialize=Ue,t.resolveComponents=He,t.resolve=Ge,t.normalize=pe,t.equal=Re,t.escapeComponent=Ne,t.unescapeComponent=Le,Object.defineProperty(t,"__esModule",{value:!0})}))});var Rq=N((Exo,wRt)=>{"use strict";wRt.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 DRt=N((vxo,TRt)=>{"use strict";TRt.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 CN=N((Cxo,BRt)=>{"use strict";BRt.exports={copy:vSn,checkDataType:OFe,checkDataTypes:CSn,coerceToTypes:bSn,toHash:kFe,getProperty:FFe,escapeQuotes:PFe,equal:Rq(),ucs2length:DRt(),varOccurences:xSn,varReplace:wSn,schemaHasRules:TSn,schemaHasRulesExcept:DSn,schemaUnknownRules:ISn,toQuotedString:MFe,getPathExpr:RSn,getPath:BSn,getData:MSn,unescapeFragment:kSn,unescapeJsonPointer:UFe,escapeFragment:FSn,escapeJsonPointer:LFe};function vSn(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function OFe(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 CSn(t,e,r){switch(t.length){case 1:return OFe(t[0],e,r,!0);default:var n="",i=kFe(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?" && ":"")+OFe(o,e,r,!0);return n}}var IRt=kFe(["string","number","integer","boolean","null"]);function bSn(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(IRt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(IRt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function kFe(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var _Sn=/^[a-z$_][a-z$_0-9]*$/i,SSn=/'|\\/g;function FFe(t){return typeof t=="number"?"["+t+"]":_Sn.test(t)?"."+t:"['"+PFe(t)+"']"}function PFe(t){return t.replace(SSn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function xSn(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function wSn(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function TSn(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function DSn(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function ISn(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function MFe(t){return"'"+PFe(t)+"'"}function RSn(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return RRt(t,i)}function BSn(t,e,r){var n=MFe(r?"/"+LFe(e):FFe(e));return RRt(t,n)}var NSn=/^\/(?:[^~]|~0|~1)*$/,OSn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function MSn(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!NSn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(OSn),!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+=FFe(UFe(d)),a+=" && "+o)}return a}function RRt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function kSn(t){return UFe(decodeURIComponent(t))}function FSn(t){return encodeURIComponent(LFe(t))}function LFe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function UFe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var QFe=N((bxo,NRt)=>{"use strict";var PSn=CN();NRt.exports=LSn;function LSn(t){PSn.copy(t,this)}});var MRt=N((_xo,ORt)=>{"use strict";var Fw=ORt.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(){};mme(e,n,i,t,"",t)};Fw.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Fw.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Fw.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Fw.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 mme(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 Fw.arrayKeywords)for(var p=0;p<f.length;p++)mme(t,e,r,f[p],i+"/"+d+"/"+p,o,i,d,n,p)}else if(d in Fw.propsKeywords){if(f&&typeof f=="object")for(var h in f)mme(t,e,r,f[h],i+"/"+d+"/"+USn(h),o,i,d,n,h)}else(d in Fw.keywords||t.allKeys&&!(d in Fw.skipKeywords))&&mme(t,e,r,f,i+"/"+d,o,i,d,n)}r(n,i,o,s,a,c,u)}}function USn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Cme=N((Sxo,LRt)=>{"use strict";var fZ=xRt(),kRt=Rq(),Eme=CN(),gme=QFe(),QSn=MRt();LRt.exports=Lw;Lw.normalizeId=Pw;Lw.fullPath=Ame;Lw.url=yme;Lw.ids=$Sn;Lw.inlineRef=qFe;Lw.schema=vme;function Lw(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Lw.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof gme)return qFe(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=vme.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof gme?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=qFe(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function vme(t,e){var r=fZ.parse(e),n=PRt(r),i=Ame(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=Pw(n),s=this._refs[o];if(typeof s=="string")return qSn.call(this,t,s,r);if(s instanceof gme)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof gme){if(s.validate||this._compile(s),o==Pw(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=Ame(this._getId(t.schema))}return FRt.call(this,r,i,t.schema,t)}function qSn(t,e,r){var n=vme.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=yme(o,s)),FRt.call(this,r,o,i,t)}}var HSn=Eme.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function FRt(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=Eme.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!HSn[s]&&(a=this._getId(r),a&&(e=yme(e,a)),r.$ref)){var c=yme(e,r.$ref),u=vme.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 GSn=Eme.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function qFe(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return HFe(t);if(e)return GFe(t)<=e}function HFe(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!HFe(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!HFe(e)))return!1;return!0}function GFe(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+=GFe(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(GSn[i])e++;else if(r=t[i],typeof r=="object"&&(e+=GFe(r)+1),e==1/0)return 1/0}return e}function Ame(t,e){e!==!1&&(t=Pw(t));var r=fZ.parse(t);return PRt(r)}function PRt(t){return fZ.serialize(t).split("#")[0]+"#"}var VSn=/#\/?$/;function Pw(t){return t?t.replace(VSn,""):""}function yme(t,e){return e=Pw(e),fZ.resolve(t,e)}function $Sn(t){var e=Pw(this._getId(t)),r={"":e},n={"":Ame(e,!1)},i={},o=this;return QSn(t,{allKeys:!0},function(s,a,c,u,d,f,p){if(a!==""){var h=o._getId(s),m=r[u],A=n[u]+"/"+d;if(p!==void 0&&(A+="/"+(typeof p=="number"?p:Eme.escapeFragment(p))),typeof h=="string"){h=m=Pw(m?fZ.resolve(m,h):h);var y=o._refs[h];if(typeof y=="string"&&(y=o._refs[y]),y&&y.schema){if(!kRt(s,y.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=Pw(A))if(h[0]=="#"){if(i[h]&&!kRt(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=A}r[a]=m,n[a]=A}}),i}});var bme=N((xxo,QRt)=>{"use strict";var VFe=Cme();QRt.exports={Validation:URt(WSn),MissingRef:URt($Fe)};function WSn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}$Fe.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function $Fe(t,e,r){this.message=r||$Fe.message(t,e),this.missingRef=VFe.url(t,e),this.missingSchema=VFe.normalizeId(VFe.fullPath(this.missingRef))}function URt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var WFe=N((wxo,qRt)=>{"use strict";qRt.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 jFe=N((Txo,HRt)=>{"use strict";HRt.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,B=!e.opts.allErrors,q,A="data"+(f||""),w="valid"+d;if(e.schema===!1){e.isTop?B=!0:i+=" var "+w+" = false; ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"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: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; 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 "+w+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var S=e.isTop,d=e.level=0,f=e.dataLevel=0,A="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 x="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var d=e.level,f=e.dataLevel,A="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 w="valid"+d,B=!e.opts.allErrors,L="",F="",q,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!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")),D){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,D);var Q=e.RULES.types[D];if(M||U||Q===!0||Q&&!te(Q)){var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",h=e.schemaPath+".type",m=e.errSchemaPath+"/type",k=U?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[k](D,A,e.opts.strictNumbers,!0)+") { ",M){var O="dataType"+d,$="coerced"+d;i+=" var "+O+" = typeof "+A+"; var "+$+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+O+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+O+" = typeof "+A+"; if ("+e.util.checkDataType(e.schema.type,A,e.opts.strictNumbers)+") "+$+" = "+A+"; } "),i+=" if ("+$+" !== undefined) ; ";var G=M;if(G)for(var z,W=-1,ee=G.length-1;W<ee;)z=G[W+=1],z=="string"?i+=" else if ("+O+" == 'number' || "+O+" == 'boolean') "+$+" = '' + "+A+"; else if ("+A+" === null) "+$+" = ''; ":z=="number"||z=="integer"?(i+=" else if ("+O+" == 'boolean' || "+A+" === null || ("+O+" == 'string' && "+A+" && "+A+" == +"+A+" ",z=="integer"&&(i+=" && !("+A+" % 1)"),i+=")) "+$+" = +"+A+"; "):z=="boolean"?i+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+$+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+$+" = true; ":z=="null"?i+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+$+" = null; ":e.opts.coerceTypes=="array"&&z=="array"&&(i+=" else if ("+O+" == 'string' || "+O+" == 'number' || "+O+" == 'boolean' || "+A+" == null) "+$+" = ["+A+"]; ");i+=" else { ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",U?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+D.join(","):i+=""+D,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } if ("+$+" !== undefined) { ";var X=f?"data"+(f-1||""):"parentData",he=f?e.dataPathArr[f]:"parentDataProperty";i+=" "+A+" = "+$+"; ",f||(i+="if ("+X+" !== undefined)"),i+=" "+X+"["+he+"] = "+$+"; } "}else{var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",U?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+D.join(","):i+=""+D,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}i+=" } "}}if(e.schema.$ref&&!s)i+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",B&&(i+=" } if (errors === ",S?i+="0":i+="errs_"+d,i+=") { ",F+="}");else{var Ee=e.RULES;if(Ee){for(var Q,ye=-1,_e=Ee.length-1;ye<_e;)if(Q=Ee[ye+=1],te(Q)){if(Q.type&&(i+=" if ("+e.util.checkDataType(Q.type,A,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(Q.type=="object"&&e.schema.properties){var p=e.schema.properties,we=Object.keys(p),de=we;if(de)for(var ve,Se=-1,se=de.length-1;Se<se;){ve=de[Se+=1];var Ae=p[ve];if(Ae.default!==void 0){var Z=A+e.util.getProperty(ve);if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+Z;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else i+=" if ("+Z+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+Z+" === null || "+Z+" === '' "),i+=" ) "+Z+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(Ae.default)+" ":i+=" "+JSON.stringify(Ae.default)+" ",i+="; "}}}else if(Q.type=="array"&&Array.isArray(e.schema.items)){var oe=e.schema.items;if(oe){for(var Ae,W=-1,ge=oe.length-1;W<ge;)if(Ae=oe[W+=1],Ae.default!==void 0){var Z=A+"["+W+"]";if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+Z;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else i+=" if ("+Z+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+Z+" === null || "+Z+" === '' "),i+=" ) "+Z+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(Ae.default)+" ":i+=" "+JSON.stringify(Ae.default)+" ",i+="; "}}}}var ae=Q.rules;if(ae){for(var K,ne=-1,Te=ae.length-1;ne<Te;)if(K=ae[ne+=1],ke(K)){var me=K.code(e,K.keyword,Q.type);me&&(i+=" "+me+" ",B&&(L+="}"))}}if(B&&(i+=" "+L+" ",L=""),Q.type&&(i+=" } ",D&&D===Q.type&&!M)){i+=" else { ";var h=e.schemaPath+".type",m=e.errSchemaPath+"/type",y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: { type: '",U?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",U?i+=""+D.join(","):i+=""+D,i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+A+" "),i+=" } "):i+=" {} ";var v=i;i=y.pop(),!e.compositeRule&&B?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } "}B&&(i+=" if (errors === ",S?i+="0":i+="errs_"+d,i+=") { ",F+="}")}}}B&&(i+=" "+F+" "),S?(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 "+w+" = errors === errs_"+d+";";function te(He){for(var Ge=He.rules,pe=0;pe<Ge.length;pe++)if(ke(Ge[pe]))return!0}function ke(He){return e.schema[He.keyword]!==void 0||He.implements&&Ue(He)}function Ue(He){for(var Ge=He.implements,pe=0;pe<Ge.length;pe++)if(e.schema[Ge[pe]]!==void 0)return!0}return i}});var jRt=N((Dxo,WRt)=>{"use strict";var _me=Cme(),xme=CN(),VRt=bme(),jSn=WFe(),GRt=jFe(),zSn=xme.ucs2length,YSn=Rq(),JSn=VRt.Validation;WRt.exports=zFe;function zFe(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=KSn.call(this,t,e,n),m=this._compilations[h.index];if(h.compiling)return m.callValidate=x;var A=this._formats,y=this.RULES;try{var v=w(t,e,r,n);m.validate=v;var S=m.callValidate;return S&&(S.schema=v.schema,S.errors=null,S.refs=v.refs,S.refVal=v.refVal,S.root=v.root,S.$async=v.$async,o.sourceCode&&(S.source=v.source)),v}finally{XSn.call(this,t,e,n)}function x(){var k=m.validate,O=k.apply(this,arguments);return x.errors=k.errors,O}function w(k,O,$,G){var z=!O||O&&O.schema==k;if(O.schema!=e.schema)return zFe.call(i,k,O,$,G);var W=k.$async===!0,ee=GRt({isTop:!0,schema:k,isRoot:z,baseId:G,root:O,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:VRt.MissingRef,RULES:y,validate:GRt,util:xme,resolve:_me,resolveRef:B,usePattern:U,useDefault:M,useCustomRule:Q,opts:o,formats:A,logger:i.logger,self:i});ee=Sme(s,txn)+Sme(c,ZSn)+Sme(d,exn)+Sme(p,rxn)+ee,o.processCode&&(ee=o.processCode(ee,k));var X;try{var he=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",ee);X=he(i,y,A,e,s,d,p,YSn,zSn,JSn),s[0]=X}catch(Ee){throw i.logger.error("Error compiling schema, function code:",ee),Ee}return X.schema=k,X.errors=null,X.refs=a,X.refVal=s,X.root=z?X:O,W&&(X.$async=!0),o.sourceCode===!0&&(X.source={code:ee,patterns:c,defaults:d}),X}function B(k,O,$){O=_me.url(k,O);var G=a[O],z,W;if(G!==void 0)return z=s[G],W="refVal["+G+"]",D(z,W);if(!$&&e.refs){var ee=e.refs[O];if(ee!==void 0)return z=e.refVal[ee],W=L(O,z),D(z,W)}W=L(O);var X=_me.call(i,w,e,O);if(X===void 0){var he=r&&r[O];he&&(X=_me.inlineRef(he,o.inlineRefs)?he:zFe.call(i,he,e,r,k))}if(X===void 0)F(O);else return q(O,X),D(X,W)}function L(k,O){var $=s.length;return s[$]=O,a[k]=$,"refVal"+$}function F(k){delete a[k]}function q(k,O){var $=a[k];s[$]=O}function D(k,O){return typeof k=="object"||typeof k=="boolean"?{code:O,schema:k,inline:!0}:{code:O,$async:k&&!!k.$async}}function U(k){var O=u[k];return O===void 0&&(O=u[k]=c.length,c[O]=k),"pattern"+O}function M(k){switch(typeof k){case"boolean":case"number":return""+k;case"string":return xme.toQuotedString(k);case"object":if(k===null)return"null";var O=jSn(k),$=f[O];return $===void 0&&($=f[O]=d.length,d[$]=k),"default"+$}}function Q(k,O,$,G){if(i._opts.validateSchema!==!1){var z=k.definition.dependencies;if(z&&!z.every(function(de){return Object.prototype.hasOwnProperty.call($,de)}))throw new Error("parent schema must have all required keywords: "+z.join(","));var W=k.definition.validateSchema;if(W){var ee=W(O);if(!ee){var X="keyword schema is invalid: "+i.errorsText(W.errors);if(i._opts.validateSchema=="log")i.logger.error(X);else throw new Error(X)}}}var he=k.definition.compile,Ee=k.definition.inline,ye=k.definition.macro,_e;if(he)_e=he.call(i,O,$,G);else if(ye)_e=ye.call(i,O,$,G),o.validateSchema!==!1&&i.validateSchema(_e,!0);else if(Ee)_e=Ee.call(i,G,k.keyword,O,$);else if(_e=k.definition.validate,!_e)return;if(_e===void 0)throw new Error('custom keyword "'+k.keyword+'"failed to compile');var we=p.length;return p[we]=_e,{code:"customRule"+we,validate:_e}}}function KSn(t,e,r){var n=$Rt.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 XSn(t,e,r){var n=$Rt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function $Rt(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 ZSn(t,e){return"var pattern"+t+" = new RegExp("+xme.toQuotedString(e[t])+");"}function exn(t){return"var default"+t+" = defaults["+t+"];"}function txn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function rxn(t){return"var customRule"+t+" = customRules["+t+"];"}function Sme(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var YRt=N((Ixo,zRt)=>{"use strict";var wme=zRt.exports=function(){this._cache={}};wme.prototype.put=function(e,r){this._cache[e]=r};wme.prototype.get=function(e){return this._cache[e]};wme.prototype.del=function(e){delete this._cache[e]};wme.prototype.clear=function(){this._cache={}}});var aBt=N((Rxo,sBt)=>{"use strict";var nxn=CN(),ixn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,oxn=[0,31,28,31,30,31,30,31,31,30,31,30,31],sxn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,JRt=/^(?=.{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,axn=/^(?:[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,lxn=/^(?:[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,KRt=/^(?:(?:[^\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,XRt=/^(?:(?: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,ZRt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,eBt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tBt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,rBt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;sBt.exports=Tme;function Tme(t){return t=t=="full"?"full":"fast",nxn.copy(Tme[t])}Tme.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":KRt,url:XRt,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:JRt,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:oBt,uuid:ZRt,"json-pointer":eBt,"json-pointer-uri-fragment":tBt,"relative-json-pointer":rBt};Tme.full={date:nBt,time:iBt,"date-time":dxn,uri:pxn,"uri-reference":lxn,"uri-template":KRt,url:XRt,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:JRt,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:oBt,uuid:ZRt,"json-pointer":eBt,"json-pointer-uri-fragment":tBt,"relative-json-pointer":rBt};function cxn(t){return t%4===0&&(t%100!==0||t%400===0)}function nBt(t){var e=t.match(ixn);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&cxn(r)?29:oxn[n])}function iBt(t,e){var r=t.match(sxn);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 uxn=/t|\s/i;function dxn(t){var e=t.split(uxn);return e.length==2&&nBt(e[0])&&iBt(e[1],!0)}var fxn=/\/|:/;function pxn(t){return fxn.test(t)&&axn.test(t)}var hxn=/[^\\]\\Z/;function oBt(t){if(hxn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var cBt=N((Bxo,lBt)=>{"use strict";lBt.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 A=e.MissingRefError.message(e.baseId,a);if(e.opts.missingRefs=="fail"){e.logger.error(A);var y=y||[];y.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 v=i;i=y.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(A),u&&(i+=" if (true) { ");else throw new e.MissingRefError(e.baseId,a,A)}else if(m.inline){var S=e.util.copy(e);S.level++;var x="valid"+S.level;S.schema=m.schema,S.schemaPath="",S.errSchemaPath=a;var w=e.validate(S).replace(/validate\.schema/g,m.code);i+=" "+w+" ",u&&(i+=" if ("+x+") { ")}else p=m.$async===!0||e.async&&m.$async!==!1,h=m.code}if(h){var y=y||[];y.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+d+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var B=s?"data"+(s-1||""):"parentData",L=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+B+" , "+L+", rootData) ";var F=i;if(i=y.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+f+"; "),i+=" try { await "+F+"; ",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 (!"+F+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var dBt=N((Nxo,uBt)=>{"use strict";uBt.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 A,y=-1,v=m.length-1;y<v;)A=m[y+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))&&(h=!1,u.schema=A,u.schemaPath=s+"["+y+"]",u.errSchemaPath=a+"/"+y,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 pBt=N((Oxo,fBt)=>{"use strict";fBt.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),A="";m.level++;var y="valid"+m.level,v=a.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(v){var S=m.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var x=e.compositeRule;e.compositeRule=m.compositeRule=!0;var w=a;if(w)for(var B,L=-1,F=w.length-1;L<F;)B=w[L+=1],m.schema=B,m.schemaPath=c+"["+L+"]",m.errSchemaPath=u+"/"+L,i+=" "+e.validate(m)+" ",m.baseId=S,i+=" "+p+" = "+p+" || "+y+"; if (!"+p+") { ",A+="}";e.compositeRule=m.compositeRule=x,i+=" "+A+" 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 mBt=N((Mxo,hBt)=>{"use strict";hBt.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 ABt=N((kxo,gBt)=>{"use strict";gBt.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 A=A||[];A.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 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 EBt=N((Fxo,yBt)=>{"use strict";yBt.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),A="";m.level++;var y="valid"+m.level,v="i"+o,S=m.dataLevel=e.dataLevel+1,x="data"+S,w=e.baseId,B=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+";",B){var L=e.compositeRule;e.compositeRule=m.compositeRule=!0,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var F=f+"["+v+"]";m.dataPathArr[S]=v;var q=e.validate(m);m.baseId=w,e.util.varOccurences(q,x)<2?i+=" "+e.util.varReplace(q,x,F)+" ":i+=" var "+x+" = "+F+"; "+q+" ",i+=" if ("+y+") break; } ",e.compositeRule=m.compositeRule=L,i+=" "+A+" if (!"+y+") {"}else i+=" if ("+f+".length == 0) {";var D=D||[];D.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 U=i;return i=D.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+=" } else { ",B&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var CBt=N((Pxo,vBt)=>{"use strict";vBt.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 A="valid"+h.level,y={},v={},S=e.opts.ownProperties;for(L in a)if(L!="__proto__"){var x=a[L],w=Array.isArray(x)?v:y;w[L]=x}i+="var "+p+" = errors;";var B=e.errorPath;i+="var missing"+o+";";for(var L in v)if(w=v[L],w.length){if(i+=" if ( "+f+e.util.getProperty(L)+" !== undefined ",S&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),d){i+=" && ( ";var F=w;if(F)for(var q,D=-1,U=F.length-1;D<U;){q=F[D+=1],D&&(i+=" || ");var M=e.util.getProperty(q),Q=f+M;i+=" ( ( "+Q+" === undefined ",S&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}i+=")) { ";var k="missing"+o,O="' + "+k+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(B,k,!0):B+" + "+k);var $=$||[];$.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(L)+"', missingProperty: '"+O+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",w.length==1?i+="property "+e.util.escapeQuotes(w[0]):i+="properties "+e.util.escapeQuotes(w.join(", ")),i+=" when property "+e.util.escapeQuotes(L)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var G=i;i=$.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++; "}else{i+=" ) { ";var z=w;if(z)for(var q,W=-1,ee=z.length-1;W<ee;){q=z[W+=1];var M=e.util.getProperty(q),O=e.util.escapeQuotes(q),Q=f+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(B,q,e.opts.jsonPointers)),i+=" if ( "+Q+" === undefined ",S&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(L)+"', missingProperty: '"+O+"', depsCount: "+w.length+", deps: '"+e.util.escapeQuotes(w.length==1?w[0]:w.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",w.length==1?i+="property "+e.util.escapeQuotes(w[0]):i+="properties "+e.util.escapeQuotes(w.join(", ")),i+=" when property "+e.util.escapeQuotes(L)+" 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=B;var X=h.baseId;for(var L in y){var x=y[L];(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))&&(i+=" "+A+" = true; if ( "+f+e.util.getProperty(L)+" !== undefined ",S&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(L)+"') "),i+=") { ",h.schema=x,h.schemaPath=c+e.util.getProperty(L),h.errSchemaPath=u+"/"+e.util.escapeFragment(L),i+=" "+e.validate(h)+" ",h.baseId=X,i+=" } ",d&&(i+=" if ("+A+") { ",m+="}"))}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var _Bt=N((Lxo,bBt)=>{"use strict";bBt.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 A="i"+o,y="schema"+o;h||(i+=" var "+y+" = 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 "+A+"=0; "+A+"<"+y+".length; "+A+"++) if (equal("+f+", "+y+"["+A+"])) { "+p+" = true; break; }",h&&(i+=" } "),i+=" if (!"+p+") { ";var v=v||[];v.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 S=i;return i=v.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",d&&(i+=" else { "),i}});var xBt=N((Uxo,SBt)=>{"use strict";SBt.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,A=Array.isArray(m);if(p){var y="format"+o,v="isObject"+o,S="formatType"+o;i+=" var "+y+" = formats["+h+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+S+" = "+v+" && "+y+".type || 'string'; if ("+v+") { ",e.async&&(i+=" var async"+o+" = "+y+".async; "),i+=" "+y+" = "+y+".validate; } if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" (",m!="ignore"&&(i+=" ("+h+" && !"+y+" ",A&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+y+" && "+S+" == '"+n+"' && !(typeof "+y+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+y+"("+f+") : "+y+"("+f+")) ":i+=" "+y+"("+f+") ",i+=" : "+y+".test("+f+"))))) {"}else{var y=e.formats[a];if(!y){if(m=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),d&&(i+=" if (true) { "),i;if(A&&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 v=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,S=v&&y.type||"string";if(v){var x=y.async===!0;y=y.validate}if(S!=n)return d&&(i+=" if (true) { "),i;if(x){if(!e.async)throw new Error("async format in sync schema");var w="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+w+"("+f+"))) { "}else{i+=" if (! ";var w="formats"+e.util.getProperty(a);v&&(w+=".validate"),typeof y=="function"?i+=" "+w+"("+f+") ":i+=" "+w+".test("+f+") ",i+=") { "}}var B=B||[];B.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 L=i;return i=B.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+=" } ",d&&(i+=" else { "),i}});var TBt=N((Qxo,wBt)=>{"use strict";wBt.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 A="valid"+m.level,y=e.schema.then,v=e.schema.else,S=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),x=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),w=m.baseId;if(S||x){var B;m.createErrors=!1,m.schema=a,m.schemaPath=c,m.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var L=e.compositeRule;e.compositeRule=m.compositeRule=!0,i+=" "+e.validate(m)+" ",m.baseId=w,m.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=m.compositeRule=L,S?(i+=" if ("+A+") { ",m.schema=e.schema.then,m.schemaPath=e.schemaPath+".then",m.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(m)+" ",m.baseId=w,i+=" "+p+" = "+A+"; ",S&&x?(B="ifClause"+o,i+=" var "+B+" = 'then'; "):B="'then'",i+=" } ",x&&(i+=" else { ")):i+=" if (!"+A+") { ",x&&(m.schema=e.schema.else,m.schemaPath=e.schemaPath+".else",m.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(m)+" ",m.baseId=w,i+=" "+p+" = "+A+"; ",S&&x?(B="ifClause"+o,i+=" var "+B+" = 'else'; "):B="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+B+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+B+` + '" 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 IBt=N((qxo,DBt)=>{"use strict";DBt.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),A="";m.level++;var y="valid"+m.level,v="i"+o,S=m.dataLevel=e.dataLevel+1,x="data"+S,w=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var B=e.schema.additionalItems;if(B===!1){i+=" "+p+" = "+f+".length <= "+a.length+"; ";var L=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var F=F||[];F.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 q=i;i=F.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++; ",i+=" } ",u=L,d&&(A+="}",i+=" else { ")}var D=a;if(D){for(var U,M=-1,Q=D.length-1;M<Q;)if(U=D[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){i+=" "+y+" = true; if ("+f+".length > "+M+") { ";var k=f+"["+M+"]";m.schema=U,m.schemaPath=c+"["+M+"]",m.errSchemaPath=u+"/"+M,m.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),m.dataPathArr[S]=M;var O=e.validate(m);m.baseId=w,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,k)+" ":i+=" var "+x+" = "+k+"; "+O+" ",i+=" } ",d&&(i+=" if ("+y+") { ",A+="}")}}if(typeof B=="object"&&(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))){m.schema=B,m.schemaPath=e.schemaPath+".additionalItems",m.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+y+" = true; if ("+f+".length > "+a.length+") { for (var "+v+" = "+a.length+"; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var k=f+"["+v+"]";m.dataPathArr[S]=v;var O=e.validate(m);m.baseId=w,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,k)+" ":i+=" var "+x+" = "+k+"; "+O+" ",d&&(i+=" if (!"+y+") break; "),i+=" } } ",d&&(i+=" if ("+y+") { ",A+="}")}}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 "+v+" = 0; "+v+" < "+f+".length; "+v+"++) { ",m.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var k=f+"["+v+"]";m.dataPathArr[S]=v;var O=e.validate(m);m.baseId=w,e.util.varOccurences(O,x)<2?i+=" "+e.util.varReplace(O,x,k)+" ":i+=" var "+x+" = "+k+"; "+O+" ",d&&(i+=" if (!"+y+") break; "),i+=" }"}return d&&(i+=" "+A+" if ("+h+" == errors) {"),i}});var YFe=N((Hxo,RBt)=>{"use strict";RBt.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,w,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",A=m?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[A],v=e.opts.$data&&y&&y.$data,S=m?"<":">",x=m?">":"<",w=void 0;if(!(p||typeof a=="number"||a===void 0))throw new Error(r+" must be number");if(!(v||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(A+" must be number or boolean");if(v){var B=e.util.getData(y.$data,s,e.dataPathArr),L="exclusive"+o,F="exclType"+o,q="exclIsNumber"+o,D="op"+o,U="' + "+D+" + '";i+=" var schemaExcl"+o+" = "+B+"; ",B="schemaExcl"+o,i+=" var "+L+"; var "+F+" = typeof "+B+"; if ("+F+" != 'boolean' && "+F+" != 'undefined' && "+F+" != 'number') { ";var w=A,M=M||[];M.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(w||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(i+=" , message: '"+A+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Q=i;i=M.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++; ",i+=" } else if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+F+" == 'number' ? ( ("+L+" = "+h+" === undefined || "+B+" "+S+"= "+h+") ? "+f+" "+x+"= "+B+" : "+f+" "+x+" "+h+" ) : ( ("+L+" = "+B+" === true) ? "+f+" "+x+"= "+h+" : "+f+" "+x+" "+h+" ) || "+f+" !== "+f+") { var op"+o+" = "+L+" ? '"+S+"' : '"+S+"='; ",a===void 0&&(w=A,u=e.errSchemaPath+"/"+A,h=B,p=v)}else{var q=typeof y=="number",U=S;if(q&&p){var D="'"+U+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+y+" "+S+"= "+h+" ? "+f+" "+x+"= "+y+" : "+f+" "+x+" "+h+" ) || "+f+" !== "+f+") { "}else{q&&a===void 0?(L=!0,w=A,u=e.errSchemaPath+"/"+A,h=y,x+="="):(q&&(h=Math[m?"min":"max"](y,a)),y===(q?h:!0)?(L=!0,w=A,u=e.errSchemaPath+"/"+A,x+="="):(L=!1,U+="="));var D="'"+U+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+f+" "+x+" "+h+" || "+f+" !== "+f+") { "}}w=w||r;var M=M||[];M.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(w||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+h+", exclusive: "+L+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+U+" ",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 Q=i;return i=M.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++; ",i+=" } ",d&&(i+=" else { "),i}});var JFe=N((Gxo,BBt)=>{"use strict";BBt.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,A,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 A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_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 v=i;return i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var KFe=N((Vxo,NBt)=>{"use strict";NBt.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,A,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 A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_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 v=i;return i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var XFe=N(($xo,OBt)=>{"use strict";OBt.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,A,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 A=r,y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(A||"_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 v=i;return i=y.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",d&&(i+=" else { "),i}});var kBt=N((Wxo,MBt)=>{"use strict";MBt.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 A=i;return i=m.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 PBt=N((jxo,FBt)=>{"use strict";FBt.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 A=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1;var y;h.opts.allErrors&&(y=h.opts.allErrors,h.opts.allErrors=!1),i+=" "+e.validate(h)+" ",h.createErrors=!0,y&&(h.opts.allErrors=y),e.compositeRule=h.compositeRule=A,i+=" if ("+m+") { ";var v=v||[];v.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 S=i;i=v.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+S+"]); ":i+=" validate.errors = ["+S+"]; return false; ":i+=" var err = "+S+"; 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 UBt=N((zxo,LBt)=>{"use strict";LBt.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),A="";m.level++;var y="valid"+m.level,v=m.baseId,S="prevValid"+o,x="passingSchemas"+o;i+="var "+h+" = errors , "+S+" = false , "+p+" = false , "+x+" = null; ";var w=e.compositeRule;e.compositeRule=m.compositeRule=!0;var B=a;if(B)for(var L,F=-1,q=B.length-1;F<q;)L=B[F+=1],(e.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:e.util.schemaHasRules(L,e.RULES.all))?(m.schema=L,m.schemaPath=c+"["+F+"]",m.errSchemaPath=u+"/"+F,i+=" "+e.validate(m)+" ",m.baseId=v):i+=" var "+y+" = true; ",F&&(i+=" if ("+y+" && "+S+") { "+p+" = false; "+x+" = ["+x+", "+F+"]; } else { ",A+="}"),i+=" if ("+y+") { "+p+" = "+S+" = true; "+x+" = "+F+"; }";return e.compositeRule=m.compositeRule=w,i+=""+A+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+x+" } ",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 qBt=N((Yxo,QBt)=>{"use strict";QBt.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 A=A||[];A.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 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 GBt=N((Jxo,HBt)=>{"use strict";HBt.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 A="valid"+h.level,y="key"+o,v="idx"+o,S=h.dataLevel=e.dataLevel+1,x="data"+S,w="dataProperties"+o,B=Object.keys(a||{}).filter(W),L=e.schema.patternProperties||{},F=Object.keys(L).filter(W),q=e.schema.additionalProperties,D=B.length||F.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,Q=e.opts.removeAdditional,k=U||M||Q,O=e.opts.ownProperties,$=e.baseId,G=e.schema.required;if(G&&!(e.opts.$data&&G.$data)&&G.length<e.opts.loopRequired)var z=e.util.toHash(G);function W(Le){return Le!=="__proto__"}if(i+="var "+p+" = errors;var "+A+" = true;",O&&(i+=" var "+w+" = undefined;"),k){if(O?i+=" "+w+" = "+w+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+w+".length; "+v+"++) { var "+y+" = "+w+"["+v+"]; ":i+=" for (var "+y+" in "+f+") { ",D){if(i+=" var isAdditional"+o+" = !(false ",B.length)if(B.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+y+") ";else{var ee=B;if(ee)for(var X,he=-1,Ee=ee.length-1;he<Ee;)X=ee[he+=1],i+=" || "+y+" == "+e.util.toQuotedString(X)+" "}if(F.length){var ye=F;if(ye)for(var _e,we=-1,de=ye.length-1;we<de;)_e=ye[we+=1],i+=" || "+e.usePattern(_e)+".test("+y+") "}i+=" ); if (isAdditional"+o+") { "}if(Q=="all")i+=" delete "+f+"["+y+"]; ";else{var ve=e.errorPath,Se="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),U)if(Q)i+=" delete "+f+"["+y+"]; ";else{i+=" "+A+" = false; ";var se=u;u=e.errSchemaPath+"/additionalProperties";var Ae=Ae||[];Ae.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+Se+"' } ",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 Z=i;i=Ae.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+Z+"]); ":i+=" validate.errors = ["+Z+"]; return false; ":i+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=se,d&&(i+=" break; ")}else if(M)if(Q=="failing"){i+=" var "+p+" = errors; ";var oe=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=q,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=f+"["+y+"]";h.dataPathArr[S]=y;var ae=e.validate(h);h.baseId=$,e.util.varOccurences(ae,x)<2?i+=" "+e.util.varReplace(ae,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ae+" ",i+=" if (!"+A+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+y+"]; } ",e.compositeRule=h.compositeRule=oe}else{h.schema=q,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=f+"["+y+"]";h.dataPathArr[S]=y;var ae=e.validate(h);h.baseId=$,e.util.varOccurences(ae,x)<2?i+=" "+e.util.varReplace(ae,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ae+" ",d&&(i+=" if (!"+A+") break; ")}e.errorPath=ve}D&&(i+=" } "),i+=" } ",d&&(i+=" if ("+A+") { ",m+="}")}var K=e.opts.useDefaults&&!e.compositeRule;if(B.length){var ne=B;if(ne)for(var X,Te=-1,me=ne.length-1;Te<me;){X=ne[Te+=1];var te=a[X];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){var ke=e.util.getProperty(X),ge=f+ke,Ue=K&&te.default!==void 0;h.schema=te,h.schemaPath=c+ke,h.errSchemaPath=u+"/"+e.util.escapeFragment(X),h.errorPath=e.util.getPath(e.errorPath,X,e.opts.jsonPointers),h.dataPathArr[S]=e.util.toQuotedString(X);var ae=e.validate(h);if(h.baseId=$,e.util.varOccurences(ae,x)<2){ae=e.util.varReplace(ae,x,ge);var He=ge}else{var He=x;i+=" var "+x+" = "+ge+"; "}if(Ue)i+=" "+ae+" ";else{if(z&&z[X]){i+=" if ( "+He+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=") { "+A+" = false; ";var ve=e.errorPath,se=u,Ge=e.util.escapeQuotes(X);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(ve,X,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var Ae=Ae||[];Ae.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+Ge+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+Ge+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var Z=i;i=Ae.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+Z+"]); ":i+=" validate.errors = ["+Z+"]; return false; ":i+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=se,e.errorPath=ve,i+=" } else { "}else d?(i+=" if ( "+He+" === undefined ",O&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=") { "+A+" = true; } else { "):(i+=" if ("+He+" !== undefined ",O&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(X)+"') "),i+=" ) { ");i+=" "+ae+" } "}}d&&(i+=" if ("+A+") { ",m+="}")}}if(F.length){var pe=F;if(pe)for(var _e,Re=-1,Ne=pe.length-1;Re<Ne;){_e=pe[Re+=1];var te=L[_e];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){h.schema=te,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(_e),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(_e),O?i+=" "+w+" = "+w+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+w+".length; "+v+"++) { var "+y+" = "+w+"["+v+"]; ":i+=" for (var "+y+" in "+f+") { ",i+=" if ("+e.usePattern(_e)+".test("+y+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var ge=f+"["+y+"]";h.dataPathArr[S]=y;var ae=e.validate(h);h.baseId=$,e.util.varOccurences(ae,x)<2?i+=" "+e.util.varReplace(ae,x,ge)+" ":i+=" var "+x+" = "+ge+"; "+ae+" ",d&&(i+=" if (!"+A+") break; "),i+=" } ",d&&(i+=" else "+A+" = true; "),i+=" } ",d&&(i+=" if ("+A+") { ",m+="}")}}}return d&&(i+=" "+m+" if ("+p+" == errors) {"),i}});var $Bt=N((Kxo,VBt)=>{"use strict";VBt.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 A="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 y="key"+o,v="idx"+o,S="i"+o,x="' + "+y+" + '",w=h.dataLevel=e.dataLevel+1,B="data"+w,L="dataProperties"+o,F=e.opts.ownProperties,q=e.baseId;F&&(i+=" var "+L+" = undefined; "),F?i+=" "+L+" = "+L+" || Object.keys("+f+"); for (var "+v+"=0; "+v+"<"+L+".length; "+v+"++) { var "+y+" = "+L+"["+v+"]; ":i+=" for (var "+y+" in "+f+") { ",i+=" var startErrs"+o+" = errors; ";var D=y,U=e.compositeRule;e.compositeRule=h.compositeRule=!0;var M=e.validate(h);h.baseId=q,e.util.varOccurences(M,B)<2?i+=" "+e.util.varReplace(M,B,D)+" ":i+=" var "+B+" = "+D+"; "+M+" ",e.compositeRule=h.compositeRule=U,i+=" if (!"+A+") { for (var "+S+"=startErrs"+o+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+x+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+x+"\\' 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 jBt=N((Xxo,WBt)=>{"use strict";WBt.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 A="schema"+o;if(!h)if(a.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],v=a;if(v)for(var S,x=-1,w=v.length-1;x<w;){S=v[x+=1];var B=e.schema.properties[S];B&&(e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all))||(y[y.length]=S)}}else var y=a;if(h||y.length){var L=e.errorPath,F=h||y.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(d)if(i+=" var missing"+o+"; ",F){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,U="schema"+o+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(L,U,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 "+D+" = 0; "+D+" < "+A+".length; "+D+"++) { "+p+" = "+f+"["+A+"["+D+"]] !== undefined ",q&&(i+=" && Object.prototype.hasOwnProperty.call("+f+", "+A+"["+D+"]) "),i+="; if (!"+p+") break; } ",h&&(i+=" } "),i+=" if (!"+p+") { ";var Q=Q||[];Q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var k=i;i=Q.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 { "}else{i+=" if ( ";var O=y;if(O)for(var $,D=-1,G=O.length-1;D<G;){$=O[D+=1],D&&(i+=" || ");var z=e.util.getProperty($),W=f+z;i+=" ( ( "+W+" === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes($)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?$:z)+") ) "}i+=") { ";var U="missing"+o,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(L,U,!0):L+" + "+U);var Q=Q||[];Q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var k=i;i=Q.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 { "}else if(F){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,U="schema"+o+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(L,U,e.opts.jsonPointers)),h&&(i+=" if ("+A+" && !Array.isArray("+A+")) { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",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 ("+A+" !== undefined) { "),i+=" for (var "+D+" = 0; "+D+" < "+A+".length; "+D+"++) { if ("+f+"["+A+"["+D+"]] === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+A+"["+D+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",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 ee=y;if(ee)for(var $,X=-1,he=ee.length-1;X<he;){$=ee[X+=1];var z=e.util.getProperty($),M=e.util.escapeQuotes($),W=f+z;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(L,$,e.opts.jsonPointers)),i+=" if ( "+W+" === undefined ",q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes($)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+M+"\\'",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=L}else d&&(i+=" if (true) {");return i}});var YBt=N((Zxo,zBt)=>{"use strict";zBt.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 A=e.schema.items&&e.schema.items.type,y=Array.isArray(A);if(!A||A=="object"||A=="array"||y&&(A.indexOf("object")>=0||A.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 v="checkDataType"+(y?"s":"");i+=" if ("+e.util[v](A,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(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 S=S||[];S.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 x=i;i=S.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+x+"]); ":i+=" validate.errors = ["+x+"]; return false; ":i+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",d&&(i+=" else { ")}else d&&(i+=" if (true) { ");return i}});var KBt=N((ewo,JBt)=>{"use strict";JBt.exports={$ref:cBt(),allOf:dBt(),anyOf:pBt(),$comment:mBt(),const:ABt(),contains:EBt(),dependencies:CBt(),enum:_Bt(),format:xBt(),if:TBt(),items:IBt(),maximum:YFe(),minimum:YFe(),maxItems:JFe(),minItems:JFe(),maxLength:KFe(),minLength:KFe(),maxProperties:XFe(),minProperties:XFe(),multipleOf:kBt(),not:PBt(),oneOf:UBt(),pattern:qBt(),properties:GBt(),propertyNames:$Bt(),required:jBt(),uniqueItems:YBt(),validate:jFe()}});var eNt=N((two,ZBt)=>{"use strict";var XBt=KBt(),ZFe=CN().toHash;ZBt.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=ZFe(r),e.types=ZFe(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:XBt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:XBt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=ZFe(r.concat(n)),e.custom={},e}});var nNt=N((rwo,rNt)=>{"use strict";var tNt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];rNt.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<tNt.length;o++){var s=tNt[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 sNt=N((nwo,oNt)=>{"use strict";var mxn=bme().MissingRef;oNt.exports=iNt;function iNt(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)?iNt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof mxn)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 lNt=N((iwo,aNt)=>{"use strict";aNt.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,A=e.opts.$data&&a&&a.$data,y;A?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",y="schema"+o):y=a;var v=this,S="definition"+o,x=v.definition,w="",B,L,F,q,D;if(A&&x.$data){D="keywordValidate"+o;var U=x.validateSchema;i+=" var "+S+" = RULES.custom['"+r+"'].definition; var "+D+" = "+S+".validate;"}else{if(q=e.useCustomRule(v,a,e.schema,e),!q)return;y="validate.schema"+c,D=q.code,B=x.compile,L=x.inline,F=x.macro}var M=D+".errors",Q="i"+o,k="ruleErr"+o,O=x.async;if(O&&!e.async)throw new Error("async keyword in sync schema");if(L||F||(i+=""+M+" = null;"),i+="var "+m+" = errors;var "+h+";",A&&x.$data&&(w+="}",i+=" if ("+y+" === undefined) { "+h+" = true; } else { ",U&&(w+="}",i+=" "+h+" = "+S+".validateSchema("+y+"); if ("+h+") { ")),L)x.statements?i+=" "+q.validate+" ":i+=" "+h+" = "+q.validate+"; ";else if(F){var $=e.util.copy(e),w="";$.level++;var G="valid"+$.level;$.schema=q.validate,$.schemaPath="";var z=e.compositeRule;e.compositeRule=$.compositeRule=!0;var W=e.validate($).replace(/validate\.schema/g,D);e.compositeRule=$.compositeRule=z,i+=" "+W}else{var ee=ee||[];ee.push(i),i="",i+=" "+D+".call( ",e.opts.passContext?i+="this":i+="self",B||x.schema===!1?i+=" , "+p+" ":i+=" , "+y+" , "+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 Ee=i;i=ee.pop(),x.errors===!1?(i+=" "+h+" = ",O&&(i+="await "),i+=""+Ee+"; "):O?(M="customErrors"+o,i+=" var "+M+" = null; try { "+h+" = await "+Ee+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):i+=" "+M+" = null; "+h+" = "+Ee+"; "}if(x.modifying&&(i+=" if ("+X+") "+p+" = "+X+"["+he+"];"),i+=""+w,x.valid)d&&(i+=" if (true) { ");else{i+=" if ( ",x.valid===void 0?(i+=" !",F?i+=""+G:i+=""+h):i+=" "+!x.valid+" ",i+=") { ",f=v.keyword;var ee=ee||[];ee.push(i),i="";var ee=ee||[];ee.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),i+=" } "):i+=" {} ";var ye=i;i=ee.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+ye+"]); ":i+=" validate.errors = ["+ye+"]; return false; ":i+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _e=i;i=ee.pop(),L?x.errors?x.errors!="full"&&(i+=" for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+k+" = vErrors["+Q+"]; if ("+k+".dataPath === undefined) "+k+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+k+".schemaPath === undefined) { "+k+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+k+".schema = "+y+"; "+k+".data = "+p+"; "),i+=" } "):x.errors===!1?i+=" "+_e+" ":(i+=" if ("+m+" == errors) { "+_e+" } else { for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+k+" = vErrors["+Q+"]; if ("+k+".dataPath === undefined) "+k+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+k+".schemaPath === undefined) { "+k+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+k+".schema = "+y+"; "+k+".data = "+p+"; "),i+=" } } "):F?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(i+=` , message: 'should pass "`+v.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; ")):x.errors===!1?i+=" "+_e+" ":(i+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+Q+"="+m+"; "+Q+"<errors; "+Q+"++) { var "+k+" = vErrors["+Q+"]; if ("+k+".dataPath === undefined) "+k+".dataPath = (dataPath || '') + "+e.errorPath+"; "+k+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+k+".schema = "+y+"; "+k+".data = "+p+"; "),i+=" } } else { "+_e+" } "),i+=" } ",d&&(i+=" else { ")}return i}});var ePe=N((owo,gxn)=>{gxn.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 dNt=N((swo,uNt)=>{"use strict";var cNt=ePe();uNt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:cNt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:cNt.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 pNt=N((awo,fNt)=>{"use strict";var Axn=/^[a-z_$][a-z0-9_$-]*$/i,yxn=lNt(),Exn=dNt();fNt.exports={add:vxn,get:Cxn,remove:bxn,validate:tPe};function vxn(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!Axn.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:yxn,implements:u.implements};d.rules.push(h),r.custom[a]=h}return this}function Cxn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function bxn(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 tPe(t,e){tPe.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(Exn,!0);if(r(t))return!0;if(tPe.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var hNt=N((lwo,_xn)=>{_xn.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 SNt=N((cwo,_Nt)=>{"use strict";var gNt=jRt(),bN=Cme(),Sxn=YRt(),ANt=QFe(),xxn=WFe(),wxn=aBt(),Txn=eNt(),yNt=nNt(),ENt=CN();_Nt.exports=tf;tf.prototype.validate=Ixn;tf.prototype.compile=Rxn;tf.prototype.addSchema=Bxn;tf.prototype.addMetaSchema=Nxn;tf.prototype.validateSchema=Oxn;tf.prototype.getSchema=kxn;tf.prototype.removeSchema=Pxn;tf.prototype.addFormat=$xn;tf.prototype.errorsText=Vxn;tf.prototype._addSchema=Lxn;tf.prototype._compile=Uxn;tf.prototype.compileAsync=sNt();var Rme=pNt();tf.prototype.addKeyword=Rme.add;tf.prototype.getKeyword=Rme.get;tf.prototype.removeKeyword=Rme.remove;tf.prototype.validateKeyword=Rme.validate;var vNt=bme();tf.ValidationError=vNt.Validation;tf.MissingRefError=vNt.MissingRef;tf.$dataMetaSchema=yNt;var Ime="http://json-schema.org/draft-07/schema",mNt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Dxn=["/properties"];function tf(t){if(!(this instanceof tf))return new tf(t);t=this._opts=ENt.copy(t)||{},Kxn(this),this._schemas={},this._refs={},this._fragments={},this._formats=wxn(t.format),this._cache=t.cache||new Sxn,this._loadingSchemas={},this._compilations=[],this.RULES=Txn(),this._getId=Qxn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=xxn),this._metaOpts=Jxn(this),t.formats&&zxn(this),t.keywords&&Yxn(this),Wxn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),jxn(this)}function Ixn(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 Rxn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function Bxn(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=bN.normalizeId(e||o),bNt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function Nxn(t,e,r){return this.addSchema(t,e,r,!0),this}function Oxn(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||Mxn(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 Mxn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(Ime)?Ime:void 0,t._opts.defaultMeta}function kxn(t){var e=CNt(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Fxn(this,t)}}function Fxn(t,e){var r=bN.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=gNt.call(t,n,i,void 0,o);return t._fragments[e]=new ANt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function CNt(t,e){return e=bN.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function Pxn(t){if(t instanceof RegExp)return Dme(this,this._schemas,t),Dme(this,this._refs,t),this;switch(typeof t){case"undefined":return Dme(this,this._schemas),Dme(this,this._refs),this._cache.clear(),this;case"string":var e=CNt(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=bN.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function Dme(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 Lxn(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=bN.normalizeId(this._getId(t));a&&n&&bNt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==bN.normalizeId(t.$schema))&&this.validateSchema(t,!0);var d=bN.ids.call(this,t),f=new ANt({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 Uxn(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=gNt.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 Qxn(t){switch(t.schemaId){case"auto":return Gxn;case"id":return qxn;default:return Hxn}}function qxn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function Hxn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function Gxn(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 Vxn(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 $xn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function Wxn(t){var e;if(t._opts.$data&&(e=hNt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=ePe();t._opts.$data&&(r=yNt(r,Dxn)),t.addMetaSchema(r,Ime,!0),t._refs["http://json-schema.org/schema"]=Ime}}function jxn(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 zxn(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function Yxn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function bNt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Jxn(t){for(var e=ENt.copy(t._opts),r=0;r<mNt.length;r++)delete e[mNt[r]];return e}function Kxn(t){var e=t._opts.logger;if(e===!1)t.logger={log:rPe,warn:rPe,error:rPe};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 rPe(){}});var xNt,S3,Bq=De(()=>{_Rt();kw();xNt=Ye(SNt(),1),S3=class extends pme{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 xNt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=bRt(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:Iq,capabilities:this._capabilities,clientInfo:this._clientInfo}},_Fe,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!iRt.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"},vN,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},NFe,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},vN,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},dZ,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},uZ,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},xFe,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},wFe,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},TFe,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},vN,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},vN,r)}async callTool(e,r=dme,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 L6(P6.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new L6(P6.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof L6?s:new L6(P6.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},BFe,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var RNt=N((pwo,INt)=>{INt.exports=DNt;DNt.sync=Zxn;var wNt=Oe("fs");function Xxn(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 TNt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Xxn(e,r)}function DNt(t,e,r){wNt.stat(t,function(n,i){r(n,n?!1:TNt(i,t,e))})}function Zxn(t,e){return TNt(wNt.statSync(t),t,e)}});var kNt=N((hwo,MNt)=>{MNt.exports=NNt;NNt.sync=ewn;var BNt=Oe("fs");function NNt(t,e,r){BNt.stat(t,function(n,i){r(n,n?!1:ONt(i,e))})}function ewn(t,e){return ONt(BNt.statSync(t),e)}function ONt(t,e){return t.isFile()&&twn(t,e)}function twn(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 PNt=N((gwo,FNt)=>{var mwo=Oe("fs"),Bme;process.platform==="win32"||global.TESTING_WINDOWS?Bme=RNt():Bme=kNt();FNt.exports=nPe;nPe.sync=rwn;function nPe(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){nPe(t,e||{},function(o,s){o?i(o):n(s)})})}Bme(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function rwn(t,e){try{return Bme.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var VNt=N((Awo,GNt)=>{var Nq=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",LNt=Oe("path"),nwn=Nq?";":":",UNt=PNt(),QNt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),qNt=(t,e)=>{let r=e.colon||nwn,n=t.match(/\//)||Nq&&t.match(/\\/)?[""]:[...Nq?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Nq?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Nq?i.split(r):[""];return Nq&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},HNt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=qNt(t,e),s=[],a=u=>new Promise((d,f)=>{if(u===n.length)return e.all&&s.length?d(s):f(QNt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,m=LNt.join(h,t),A=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;d(c(A,u,0))}),c=(u,d,f)=>new Promise((p,h)=>{if(f===i.length)return p(a(d+1));let m=i[f];UNt(u+m,{pathExt:o},(A,y)=>{if(!A&&y)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)},iwn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=qNt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=LNt.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(UNt.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 QNt(t)};GNt.exports=HNt;HNt.sync=iwn});var WNt=N((ywo,iPe)=>{"use strict";var $Nt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};iPe.exports=$Nt;iPe.exports.default=$Nt});var JNt=N((Ewo,YNt)=>{"use strict";var jNt=Oe("path"),own=VNt(),swn=WNt();function zNt(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=own.sync(t.command,{path:r[swn({env:r})],pathExt:e?jNt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=jNt.resolve(i?t.options.cwd:"",s)),s}function awn(t){return zNt(t)||zNt(t,!0)}YNt.exports=awn});var KNt=N((vwo,sPe)=>{"use strict";var oPe=/([()\][%!^"`<>&|;, *?])/g;function lwn(t){return t=t.replace(oPe,"^$1"),t}function cwn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(oPe,"^$1"),e&&(t=t.replace(oPe,"^$1")),t}sPe.exports.command=lwn;sPe.exports.argument=cwn});var ZNt=N((Cwo,XNt)=>{"use strict";XNt.exports=/^#!(.*)/});var tOt=N((bwo,eOt)=>{"use strict";var uwn=ZNt();eOt.exports=(t="")=>{let e=t.match(uwn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var nOt=N((_wo,rOt)=>{"use strict";var aPe=Oe("fs"),dwn=tOt();function fwn(t){let r=Buffer.alloc(150),n;try{n=aPe.openSync(t,"r"),aPe.readSync(n,r,0,150,0),aPe.closeSync(n)}catch{}return dwn(r.toString())}rOt.exports=fwn});var aOt=N((Swo,sOt)=>{"use strict";var pwn=Oe("path"),iOt=JNt(),oOt=KNt(),hwn=nOt(),mwn=process.platform==="win32",gwn=/\.(?:com|exe)$/i,Awn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ywn(t){t.file=iOt(t);let e=t.file&&hwn(t.file);return e?(t.args.unshift(t.file),t.command=e,iOt(t)):t.file}function Ewn(t){if(!mwn)return t;let e=ywn(t),r=!gwn.test(e);if(t.options.forceShell||r){let n=Awn.test(e);t.command=pwn.normalize(t.command),t.command=oOt.command(t.command),t.args=t.args.map(o=>oOt.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 vwn(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:Ewn(n)}sOt.exports=vwn});var uOt=N((xwo,cOt)=>{"use strict";var lPe=process.platform==="win32";function cPe(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 Cwn(t,e){if(!lPe)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=lOt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function lOt(t,e){return lPe&&t===1&&!e.file?cPe(e.original,"spawn"):null}function bwn(t,e){return lPe&&t===1&&!e.file?cPe(e.original,"spawnSync"):null}cOt.exports={hookChildProcess:Cwn,verifyENOENT:lOt,verifyENOENTSync:bwn,notFoundError:cPe}});var pOt=N((wwo,Oq)=>{"use strict";var dOt=Oe("child_process"),uPe=aOt(),dPe=uOt();function fOt(t,e,r){let n=uPe(t,e,r),i=dOt.spawn(n.command,n.args,n.options);return dPe.hookChildProcess(i,n),i}function _wn(t,e,r){let n=uPe(t,e,r),i=dOt.spawnSync(n.command,n.args,n.options);return i.error=i.error||dPe.verifyENOENTSync(i.status,n),i}Oq.exports=fOt;Oq.exports.spawn=fOt;Oq.exports.sync=_wn;Oq.exports._parse=uPe;Oq.exports._enoent=dPe});function Swn(t){return Mw.parse(JSON.parse(t))}function hOt(t){return JSON.stringify(t)+`
601
601
  `}var Nme,mOt=De(()=>{kw();Nme=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
602
602
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Swn(r)}clear(){this._buffer=void 0}}});import Ome from"node:process";import{PassThrough as xwn}from"node:stream";function Twn(){let t={};for(let e of wwn){let r=Ome.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function Dwn(){return"type"in Ome}var gOt,wwn,Mq,fPe=De(()=>{gOt=Ye(pOt(),1);mOt();wwn=Ome.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];Mq=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Nme,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new xwn)}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,gOt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...Twn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Ome.platform==="win32"&&Dwn(),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=hOt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function pPe(t){}function kme(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=pPe,onError:r=pPe,onRetry:n=pPe,onComment:i}=t,o="",s=!0,a,c="",u="";function d(A){let y=s?A.replace(/^\xEF\xBB\xBF/,""):A,[v,S]=Iwn(`${o}${y}`);for(let x of v)f(x);o=S,s=!1}function f(A){if(A===""){h();return}if(A.startsWith(":")){i&&i(A.slice(A.startsWith(": ")?2:1));return}let y=A.indexOf(":");if(y!==-1){let v=A.slice(0,y),S=A[y+1]===" "?2:1,x=A.slice(y+S);p(v,x,A);return}p(A,"",A)}function p(A,y,v){switch(A){case"event":u=y;break;case"data":c=`${c}${y}
603
603
  `;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new Mme(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:v}));break;default:r(new Mme(`Unknown field "${A.length>20?`${A.slice(0,20)}\u2026`:A}"`,{type:"unknown-field",field:A,value:y,line:v}));break}}function h(){c.length>0&&e({id:a,event:u||void 0,data:c.endsWith(`
604
604
  `)?c.slice(0,-1):c}),a=void 0,c="",u=""}function m(A={}){o&&A.consume&&f(o),s=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:m}}function Iwn(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
605
605
  `,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]===`
606
- `&&n++}}return[e,r]}var Mme,hPe=De(()=>{Mme=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 Rwn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function mPe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(mPe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${mPe(t.cause)}`:t.message:`${t}`}function AOt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function Bwn(){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 Pme,EOt,_Pe,Vs,oh,Xu,R7,$1,_N,kq,Fme,Lme,mZ,Lq,gZ,Uw,Fq,Uq,Pq,pZ,fv,gPe,APe,yPe,yOt,EPe,vPe,hZ,CPe,bPe,SN,vOt=De(()=>{hPe();Pme=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(AOt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(AOt(this),r)}};EOt=t=>{throw TypeError(t)},_Pe=(t,e,r)=>e.has(t)||EOt("Cannot "+r),Vs=(t,e,r)=>(_Pe(t,e,"read from private field"),r?r.call(t):e.get(t)),oh=(t,e,r)=>e.has(t)?EOt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xu=(t,e,r,n)=>(_Pe(t,e,"write to private field"),e.set(t,r),r),R7=(t,e,r)=>(_Pe(t,e,"access private method"),r),SN=class extends EventTarget{constructor(e,r){var n,i;super(),oh(this,fv),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,oh(this,$1),oh(this,_N),oh(this,kq),oh(this,Fme),oh(this,Lme),oh(this,mZ),oh(this,Lq),oh(this,gZ,null),oh(this,Uw),oh(this,Fq),oh(this,Uq,null),oh(this,Pq,null),oh(this,pZ,null),oh(this,APe,async o=>{var s;Vs(this,Fq).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){R7(this,fv,hZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Xu(this,kq,new URL(o.url)):Xu(this,kq,void 0),u!==200){R7(this,fv,hZ).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){R7(this,fv,hZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Vs(this,$1)===this.CLOSED)return;Xu(this,$1,this.OPEN);let f=new Event("open");if((s=Vs(this,pZ))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){R7(this,fv,hZ).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:A,value:y}=await h.read();y&&Vs(this,Fq).feed(p.decode(y,{stream:!A})),A&&(m=!1,Vs(this,Fq).reset(),R7(this,fv,CPe).call(this))}while(m)}),oh(this,yPe,o=>{Xu(this,Uw,void 0),!(o.name==="AbortError"||o.type==="aborted")&&R7(this,fv,CPe).call(this,mPe(o))}),oh(this,EPe,o=>{typeof o.id=="string"&&Xu(this,gZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Vs(this,kq)?Vs(this,kq).origin:Vs(this,_N).origin,lastEventId:o.id||""});Vs(this,Pq)&&(!o.event||o.event==="message")&&Vs(this,Pq).call(this,s),this.dispatchEvent(s)}),oh(this,vPe,o=>{Xu(this,mZ,o)}),oh(this,bPe,()=>{Xu(this,Lq,void 0),Vs(this,$1)===this.CONNECTING&&R7(this,fv,gPe).call(this)});try{if(e instanceof URL)Xu(this,_N,e);else if(typeof e=="string")Xu(this,_N,new URL(e,Bwn()));else throw new Error("Invalid URL")}catch{throw Rwn("An invalid or illegal string was specified")}Xu(this,Fq,kme({onEvent:Vs(this,EPe),onRetry:Vs(this,vPe)})),Xu(this,$1,this.CONNECTING),Xu(this,mZ,3e3),Xu(this,Lme,(n=r?.fetch)!=null?n:globalThis.fetch),Xu(this,Fme,(i=r?.withCredentials)!=null?i:!1),R7(this,fv,gPe).call(this)}get readyState(){return Vs(this,$1)}get url(){return Vs(this,_N).href}get withCredentials(){return Vs(this,Fme)}get onerror(){return Vs(this,Uq)}set onerror(e){Xu(this,Uq,e)}get onmessage(){return Vs(this,Pq)}set onmessage(e){Xu(this,Pq,e)}get onopen(){return Vs(this,pZ)}set onopen(e){Xu(this,pZ,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(){Vs(this,Lq)&&clearTimeout(Vs(this,Lq)),Vs(this,$1)!==this.CLOSED&&(Vs(this,Uw)&&Vs(this,Uw).abort(),Xu(this,$1,this.CLOSED),Xu(this,Uw,void 0))}};$1=new WeakMap,_N=new WeakMap,kq=new WeakMap,Fme=new WeakMap,Lme=new WeakMap,mZ=new WeakMap,Lq=new WeakMap,gZ=new WeakMap,Uw=new WeakMap,Fq=new WeakMap,Uq=new WeakMap,Pq=new WeakMap,pZ=new WeakMap,fv=new WeakSet,gPe=function(){Xu(this,$1,this.CONNECTING),Xu(this,Uw,new AbortController),Vs(this,Lme)(Vs(this,_N),R7(this,fv,yOt).call(this)).then(Vs(this,APe)).catch(Vs(this,yPe))},APe=new WeakMap,yPe=new WeakMap,yOt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Vs(this,gZ)?{"Last-Event-ID":Vs(this,gZ)}:void 0},cache:"no-store",signal:(t=Vs(this,Uw))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},EPe=new WeakMap,vPe=new WeakMap,hZ=function(t,e){var r;Vs(this,$1)!==this.CLOSED&&Xu(this,$1,this.CLOSED);let n=new Pme("error",{code:e,message:t});(r=Vs(this,Uq))==null||r.call(this,n),this.dispatchEvent(n)},CPe=function(t,e){var r;if(Vs(this,$1)===this.CLOSED)return;Xu(this,$1,this.CONNECTING);let n=new Pme("error",{code:e,message:t});(r=Vs(this,Uq))==null||r.call(this,n),this.dispatchEvent(n),Xu(this,Lq,setTimeout(Vs(this,bPe),Vs(this,mZ)))},bPe=new WeakMap,SN.CONNECTING=0,SN.OPEN=1,SN.CLOSED=2});async function Nwn(t){return(await SPe).getRandomValues(new Uint8Array(t))}async function Own(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await Nwn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function Mwn(t){return await Own(t)}async function kwn(t){let e=await(await SPe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xPe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await Mwn(t),r=await kwn(e);return{code_verifier:e,code_challenge:r}}var SPe,COt=De(()=>{SPe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Xh,bOt,wPe,Fwn,_Ot,TPe,SOt,Pwn,Lwn,xOt,Lwo,Uwo,DPe=De(()=>{Ow();Xh=fe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:fe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),fe.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"}),bOt=fe.object({resource:fe.string().url(),authorization_servers:fe.array(Xh).optional(),jwks_uri:fe.string().url().optional(),scopes_supported:fe.array(fe.string()).optional(),bearer_methods_supported:fe.array(fe.string()).optional(),resource_signing_alg_values_supported:fe.array(fe.string()).optional(),resource_name:fe.string().optional(),resource_documentation:fe.string().optional(),resource_policy_uri:fe.string().url().optional(),resource_tos_uri:fe.string().url().optional(),tls_client_certificate_bound_access_tokens:fe.boolean().optional(),authorization_details_types_supported:fe.array(fe.string()).optional(),dpop_signing_alg_values_supported:fe.array(fe.string()).optional(),dpop_bound_access_tokens_required:fe.boolean().optional()}).passthrough(),wPe=fe.object({issuer:fe.string(),authorization_endpoint:Xh,token_endpoint:Xh,registration_endpoint:Xh.optional(),scopes_supported:fe.array(fe.string()).optional(),response_types_supported:fe.array(fe.string()),response_modes_supported:fe.array(fe.string()).optional(),grant_types_supported:fe.array(fe.string()).optional(),token_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),service_documentation:Xh.optional(),revocation_endpoint:Xh.optional(),revocation_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),introspection_endpoint:fe.string().optional(),introspection_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),code_challenge_methods_supported:fe.array(fe.string()).optional()}).passthrough(),Fwn=fe.object({issuer:fe.string(),authorization_endpoint:Xh,token_endpoint:Xh,userinfo_endpoint:Xh.optional(),jwks_uri:Xh,registration_endpoint:Xh.optional(),scopes_supported:fe.array(fe.string()).optional(),response_types_supported:fe.array(fe.string()),response_modes_supported:fe.array(fe.string()).optional(),grant_types_supported:fe.array(fe.string()).optional(),acr_values_supported:fe.array(fe.string()).optional(),subject_types_supported:fe.array(fe.string()),id_token_signing_alg_values_supported:fe.array(fe.string()),id_token_encryption_alg_values_supported:fe.array(fe.string()).optional(),id_token_encryption_enc_values_supported:fe.array(fe.string()).optional(),userinfo_signing_alg_values_supported:fe.array(fe.string()).optional(),userinfo_encryption_alg_values_supported:fe.array(fe.string()).optional(),userinfo_encryption_enc_values_supported:fe.array(fe.string()).optional(),request_object_signing_alg_values_supported:fe.array(fe.string()).optional(),request_object_encryption_alg_values_supported:fe.array(fe.string()).optional(),request_object_encryption_enc_values_supported:fe.array(fe.string()).optional(),token_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),display_values_supported:fe.array(fe.string()).optional(),claim_types_supported:fe.array(fe.string()).optional(),claims_supported:fe.array(fe.string()).optional(),service_documentation:fe.string().optional(),claims_locales_supported:fe.array(fe.string()).optional(),ui_locales_supported:fe.array(fe.string()).optional(),claims_parameter_supported:fe.boolean().optional(),request_parameter_supported:fe.boolean().optional(),request_uri_parameter_supported:fe.boolean().optional(),require_request_uri_registration:fe.boolean().optional(),op_policy_uri:Xh.optional(),op_tos_uri:Xh.optional()}).passthrough(),_Ot=Fwn.merge(wPe.pick({code_challenge_methods_supported:!0})),TPe=fe.object({access_token:fe.string(),id_token:fe.string().optional(),token_type:fe.string(),expires_in:fe.number().optional(),scope:fe.string().optional(),refresh_token:fe.string().optional()}).strip(),SOt=fe.object({error:fe.string(),error_description:fe.string().optional(),error_uri:fe.string().optional()}),Pwn=fe.object({redirect_uris:fe.array(Xh),token_endpoint_auth_method:fe.string().optional(),grant_types:fe.array(fe.string()).optional(),response_types:fe.array(fe.string()).optional(),client_name:fe.string().optional(),client_uri:Xh.optional(),logo_uri:Xh.optional(),scope:fe.string().optional(),contacts:fe.array(fe.string()).optional(),tos_uri:Xh.optional(),policy_uri:fe.string().optional(),jwks_uri:Xh.optional(),jwks:fe.any().optional(),software_id:fe.string().optional(),software_version:fe.string().optional(),software_statement:fe.string().optional()}).strip(),Lwn=fe.object({client_id:fe.string(),client_secret:fe.string().optional(),client_id_issued_at:fe.number().optional(),client_secret_expires_at:fe.number().optional()}).strip(),xOt=Pwn.merge(Lwn),Lwo=fe.object({error:fe.string(),error_description:fe.string().optional()}).strip(),Uwo=fe.object({token:fe.string(),token_type_hint:fe.string().optional()}).strip()});function wOt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function TOt({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 DOt=De(()=>{});var _p,AZ,xN,wN,TN,yZ,EZ,vZ,B7,CZ,bZ,_Z,SZ,xZ,wZ,TZ,DZ,IOt,ROt=De(()=>{_p=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}},AZ=class extends _p{};AZ.errorCode="invalid_request";xN=class extends _p{};xN.errorCode="invalid_client";wN=class extends _p{};wN.errorCode="invalid_grant";TN=class extends _p{};TN.errorCode="unauthorized_client";yZ=class extends _p{};yZ.errorCode="unsupported_grant_type";EZ=class extends _p{};EZ.errorCode="invalid_scope";vZ=class extends _p{};vZ.errorCode="access_denied";B7=class extends _p{};B7.errorCode="server_error";CZ=class extends _p{};CZ.errorCode="temporarily_unavailable";bZ=class extends _p{};bZ.errorCode="unsupported_response_type";_Z=class extends _p{};_Z.errorCode="unsupported_token_type";SZ=class extends _p{};SZ.errorCode="invalid_token";xZ=class extends _p{};xZ.errorCode="method_not_allowed";wZ=class extends _p{};wZ.errorCode="too_many_requests";TZ=class extends _p{};TZ.errorCode="invalid_client_metadata";DZ=class extends _p{};DZ.errorCode="insufficient_scope";IOt={[AZ.errorCode]:AZ,[xN.errorCode]:xN,[wN.errorCode]:wN,[TN.errorCode]:TN,[yZ.errorCode]:yZ,[EZ.errorCode]:EZ,[vZ.errorCode]:vZ,[B7.errorCode]:B7,[CZ.errorCode]:CZ,[bZ.errorCode]:bZ,[_Z.errorCode]:_Z,[SZ.errorCode]:SZ,[xZ.errorCode]:xZ,[wZ.errorCode]:wZ,[TZ.errorCode]:TZ,[DZ.errorCode]:DZ}});function NOt(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 OOt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":Uwn(i,o,r);return;case"client_secret_post":Qwn(i,o,n);return;case"none":qwn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Uwn(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 Qwn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function qwn(t,e){e.set("client_id",t)}async function RPe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=SOt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=IOt[i]||B7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new B7(i)}}async function Qw(t,e){var r,n;try{return await IPe(t,e)}catch(i){if(i instanceof xN||i instanceof TN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await IPe(t,e);if(i instanceof wN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await IPe(t,e);throw i}}async function IPe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await Gwn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await Hwn(e,t,s),u=await zwn(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 A=await Jwn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),d=A}if(r!==void 0){let A=await t.codeVerifier(),y=await NPe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let A=await OPe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof _p)||A instanceof B7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await Ywn(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 Hwn(t,e,r){let n=wOt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!TOt({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 IZ(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 Gwn(t,e,r=fetch){let n=await Wwn(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 bOt.parse(await n.json())}async function BPe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?BPe(t,void 0,r):void 0;throw n}}function Vwn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function BOt(t,e,r=fetch){return await BPe(t,{"MCP-Protocol-Version":e},r)}function $wn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function Wwn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:Iq,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=Vwn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await BOt(c,a,r);if(!n?.metadataUrl&&$wn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await BOt(d,a,r)}return u}function jwn(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 zwn(t,{fetchFn:e=fetch,protocolVersion:r=Iq}={}){var n;let i={"MCP-Protocol-Version":r},o=jwn(t);for(let{url:s,type:a}of o){let c=await BPe(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 wPe.parse(await c.json());{let u=_Ot.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 Ywn(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 xPe(),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 NPe(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 A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],y=NOt(r,A);OOt(y,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 RPe(m);return TPe.parse(await m.json())}async function OPe(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=NOt(r,h);OOt(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 RPe(p);return TPe.parse({refresh_token:n,...await p.json()})}async function Jwn(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 RPe(o);return xOt.parse(await o.json())}var W1,Ume=De(()=>{COt();kw();DPe();DPe();DOt();ROt();W1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var MPe,Qq,MOt=De(()=>{vOt();kw();Ume();MPe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Qq=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 W1("No auth provider");let r;try{r=await Qw(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 W1;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 SN(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=IZ(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 MPe(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=Mw.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 W1("No auth provider");if(await Qw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1("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=IZ(a),await Qw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1;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 Qme,kOt=De(()=>{hPe();Qme=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=kme({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 Kwn,RZ,qw,kPe=De(()=>{kw();Ume();kOt();Kwn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},RZ=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},qw=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:Kwn}async _authThenStart(){var e;if(!this._authProvider)throw new W1("No auth provider");let r;try{r=await Qw(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 W1;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 RZ(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 Qme).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 A=Mw.parse(JSON.parse(h.data));o!==void 0&&lZ(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}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 W1("No auth provider");if(await Qw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1("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:ome(e)?e.id:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});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=IZ(f),await Qw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1;return this.send(e)}let y=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${y}`)}if(f.status===202){mRt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let m=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=f.headers.get("content-type");if(m)if(A?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await f.json(),v=Array.isArray(y)?y.map(S=>Mw.parse(S)):[Mw.parse(y)];for(let S of v)(o=this.onmessage)===null||o===void 0||o.call(this,S)}else throw new RZ(-1,`Unexpected content type: ${A}`)}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 RZ(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 Xwn}from"node:fs/promises";var BZ,NZ,DN,FPe=De(()=>{"use strict";rQ();Ume();Vo();(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"})(BZ||(BZ={}));NZ=class extends Error{code;constructor(e,r){super(r),this.code=e}},DN=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||a7.default}async start(){if(this._isClosed)throw new Error(H.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 OPe(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(H.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 NZ(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 NZ(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(H.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await NPe(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(H.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===a7.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(H.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(H.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==a7.default.OPEN)throw new Error(H.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 NZ(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:BZ.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.27-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:BZ.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await Xwn(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:BZ.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 FOt,qme,POt=De(()=>{"use strict";FOt=Ye(OX(),1);Vo();qme=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(H.t("mcp.auth.scopesRequired"));this.auth=new FOt.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(H.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as Zwn}from"node:child_process";import{promisify as eTn}from"node:util";import{platform as tTn}from"node:os";import{URL as rTn}from"node:url";function nTn(t){let e;try{e=new rTn(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 UOt(t){nTn(t);let e=tTn(),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 LOt(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 LOt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var LOt,QOt=De(()=>{"use strict";LOt=eTn(Zwn)});function Bs(t){return t instanceof Error&&"code"in t}function wr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function PPe(t){if(t&&typeof t=="object"&&"response"in t){let r=iTn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Gme(r.error.message);case 401:return new Hw(r.error.message);case 403:return new Hme(r.error.message);default:}}return t}function iTn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Hme,Hw,Gme,Zu=De(()=>{"use strict";Hme=class extends Error{},Hw=class extends Error{},Gme=class extends Error{}});import{promises as qq}from"node:fs";import*as Vme from"node:path";import*as qOt from"node:os";var Zh,$me=De(()=>{"use strict";Zu();Vo();Zh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=qOt.homedir();return Vme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Vme.dirname(this.getTokenFilePath());await qq.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await qq.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(H.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:wr(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 qq.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(H.t("mcp.tokenStorage.errors.failedToSaveToken",{error:wr(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 qq.unlink(i):await qq.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(H.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:wr(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 qq.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(H.t("mcp.tokenStorage.errors.failedToClearTokens",{error:wr(e)}))}}}});var em,Wme=De(()=>{"use strict";Zu();Vo();em=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}: ${wr(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}: ${wr(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(H.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(H.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${wr(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(H.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(H.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 HOt from"node:http";import*as OZ from"node:crypto";import{URL as LPe}from"node:url";var x3,UPe=De(()=>{"use strict";QOt();$me();Zu();Wme();Vo();x3=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(H.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=em.extractBaseUrl(e);return em.discoverOAuthConfig(r)}static generatePKCEParams(){let e=OZ.randomBytes(32).toString("base64url"),r=OZ.createHash("sha256").update(e).digest("base64url"),n=OZ.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=HOt.createServer(async(o,s)=>{try{let a=new LPe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(H.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(`
606
+ `&&n++}}return[e,r]}var Mme,hPe=De(()=>{Mme=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 Rwn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function mPe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(mPe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${mPe(t.cause)}`:t.message:`${t}`}function AOt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function Bwn(){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 Pme,EOt,_Pe,Vs,oh,Xu,R7,$1,_N,kq,Fme,Lme,mZ,Lq,gZ,Uw,Fq,Uq,Pq,pZ,fv,gPe,APe,yPe,yOt,EPe,vPe,hZ,CPe,bPe,SN,vOt=De(()=>{hPe();Pme=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(AOt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(AOt(this),r)}};EOt=t=>{throw TypeError(t)},_Pe=(t,e,r)=>e.has(t)||EOt("Cannot "+r),Vs=(t,e,r)=>(_Pe(t,e,"read from private field"),r?r.call(t):e.get(t)),oh=(t,e,r)=>e.has(t)?EOt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xu=(t,e,r,n)=>(_Pe(t,e,"write to private field"),e.set(t,r),r),R7=(t,e,r)=>(_Pe(t,e,"access private method"),r),SN=class extends EventTarget{constructor(e,r){var n,i;super(),oh(this,fv),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,oh(this,$1),oh(this,_N),oh(this,kq),oh(this,Fme),oh(this,Lme),oh(this,mZ),oh(this,Lq),oh(this,gZ,null),oh(this,Uw),oh(this,Fq),oh(this,Uq,null),oh(this,Pq,null),oh(this,pZ,null),oh(this,APe,async o=>{var s;Vs(this,Fq).reset();let{body:a,redirected:c,status:u,headers:d}=o;if(u===204){R7(this,fv,hZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Xu(this,kq,new URL(o.url)):Xu(this,kq,void 0),u!==200){R7(this,fv,hZ).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){R7(this,fv,hZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Vs(this,$1)===this.CLOSED)return;Xu(this,$1,this.OPEN);let f=new Event("open");if((s=Vs(this,pZ))==null||s.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){R7(this,fv,hZ).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:A,value:y}=await h.read();y&&Vs(this,Fq).feed(p.decode(y,{stream:!A})),A&&(m=!1,Vs(this,Fq).reset(),R7(this,fv,CPe).call(this))}while(m)}),oh(this,yPe,o=>{Xu(this,Uw,void 0),!(o.name==="AbortError"||o.type==="aborted")&&R7(this,fv,CPe).call(this,mPe(o))}),oh(this,EPe,o=>{typeof o.id=="string"&&Xu(this,gZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Vs(this,kq)?Vs(this,kq).origin:Vs(this,_N).origin,lastEventId:o.id||""});Vs(this,Pq)&&(!o.event||o.event==="message")&&Vs(this,Pq).call(this,s),this.dispatchEvent(s)}),oh(this,vPe,o=>{Xu(this,mZ,o)}),oh(this,bPe,()=>{Xu(this,Lq,void 0),Vs(this,$1)===this.CONNECTING&&R7(this,fv,gPe).call(this)});try{if(e instanceof URL)Xu(this,_N,e);else if(typeof e=="string")Xu(this,_N,new URL(e,Bwn()));else throw new Error("Invalid URL")}catch{throw Rwn("An invalid or illegal string was specified")}Xu(this,Fq,kme({onEvent:Vs(this,EPe),onRetry:Vs(this,vPe)})),Xu(this,$1,this.CONNECTING),Xu(this,mZ,3e3),Xu(this,Lme,(n=r?.fetch)!=null?n:globalThis.fetch),Xu(this,Fme,(i=r?.withCredentials)!=null?i:!1),R7(this,fv,gPe).call(this)}get readyState(){return Vs(this,$1)}get url(){return Vs(this,_N).href}get withCredentials(){return Vs(this,Fme)}get onerror(){return Vs(this,Uq)}set onerror(e){Xu(this,Uq,e)}get onmessage(){return Vs(this,Pq)}set onmessage(e){Xu(this,Pq,e)}get onopen(){return Vs(this,pZ)}set onopen(e){Xu(this,pZ,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(){Vs(this,Lq)&&clearTimeout(Vs(this,Lq)),Vs(this,$1)!==this.CLOSED&&(Vs(this,Uw)&&Vs(this,Uw).abort(),Xu(this,$1,this.CLOSED),Xu(this,Uw,void 0))}};$1=new WeakMap,_N=new WeakMap,kq=new WeakMap,Fme=new WeakMap,Lme=new WeakMap,mZ=new WeakMap,Lq=new WeakMap,gZ=new WeakMap,Uw=new WeakMap,Fq=new WeakMap,Uq=new WeakMap,Pq=new WeakMap,pZ=new WeakMap,fv=new WeakSet,gPe=function(){Xu(this,$1,this.CONNECTING),Xu(this,Uw,new AbortController),Vs(this,Lme)(Vs(this,_N),R7(this,fv,yOt).call(this)).then(Vs(this,APe)).catch(Vs(this,yPe))},APe=new WeakMap,yPe=new WeakMap,yOt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Vs(this,gZ)?{"Last-Event-ID":Vs(this,gZ)}:void 0},cache:"no-store",signal:(t=Vs(this,Uw))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},EPe=new WeakMap,vPe=new WeakMap,hZ=function(t,e){var r;Vs(this,$1)!==this.CLOSED&&Xu(this,$1,this.CLOSED);let n=new Pme("error",{code:e,message:t});(r=Vs(this,Uq))==null||r.call(this,n),this.dispatchEvent(n)},CPe=function(t,e){var r;if(Vs(this,$1)===this.CLOSED)return;Xu(this,$1,this.CONNECTING);let n=new Pme("error",{code:e,message:t});(r=Vs(this,Uq))==null||r.call(this,n),this.dispatchEvent(n),Xu(this,Lq,setTimeout(Vs(this,bPe),Vs(this,mZ)))},bPe=new WeakMap,SN.CONNECTING=0,SN.OPEN=1,SN.CLOSED=2});async function Nwn(t){return(await SPe).getRandomValues(new Uint8Array(t))}async function Own(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await Nwn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function Mwn(t){return await Own(t)}async function kwn(t){let e=await(await SPe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xPe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await Mwn(t),r=await kwn(e);return{code_verifier:e,code_challenge:r}}var SPe,COt=De(()=>{SPe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Xh,bOt,wPe,Fwn,_Ot,TPe,SOt,Pwn,Lwn,xOt,Lwo,Uwo,DPe=De(()=>{Ow();Xh=fe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:fe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),fe.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"}),bOt=fe.object({resource:fe.string().url(),authorization_servers:fe.array(Xh).optional(),jwks_uri:fe.string().url().optional(),scopes_supported:fe.array(fe.string()).optional(),bearer_methods_supported:fe.array(fe.string()).optional(),resource_signing_alg_values_supported:fe.array(fe.string()).optional(),resource_name:fe.string().optional(),resource_documentation:fe.string().optional(),resource_policy_uri:fe.string().url().optional(),resource_tos_uri:fe.string().url().optional(),tls_client_certificate_bound_access_tokens:fe.boolean().optional(),authorization_details_types_supported:fe.array(fe.string()).optional(),dpop_signing_alg_values_supported:fe.array(fe.string()).optional(),dpop_bound_access_tokens_required:fe.boolean().optional()}).passthrough(),wPe=fe.object({issuer:fe.string(),authorization_endpoint:Xh,token_endpoint:Xh,registration_endpoint:Xh.optional(),scopes_supported:fe.array(fe.string()).optional(),response_types_supported:fe.array(fe.string()),response_modes_supported:fe.array(fe.string()).optional(),grant_types_supported:fe.array(fe.string()).optional(),token_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),service_documentation:Xh.optional(),revocation_endpoint:Xh.optional(),revocation_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),introspection_endpoint:fe.string().optional(),introspection_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),code_challenge_methods_supported:fe.array(fe.string()).optional()}).passthrough(),Fwn=fe.object({issuer:fe.string(),authorization_endpoint:Xh,token_endpoint:Xh,userinfo_endpoint:Xh.optional(),jwks_uri:Xh,registration_endpoint:Xh.optional(),scopes_supported:fe.array(fe.string()).optional(),response_types_supported:fe.array(fe.string()),response_modes_supported:fe.array(fe.string()).optional(),grant_types_supported:fe.array(fe.string()).optional(),acr_values_supported:fe.array(fe.string()).optional(),subject_types_supported:fe.array(fe.string()),id_token_signing_alg_values_supported:fe.array(fe.string()),id_token_encryption_alg_values_supported:fe.array(fe.string()).optional(),id_token_encryption_enc_values_supported:fe.array(fe.string()).optional(),userinfo_signing_alg_values_supported:fe.array(fe.string()).optional(),userinfo_encryption_alg_values_supported:fe.array(fe.string()).optional(),userinfo_encryption_enc_values_supported:fe.array(fe.string()).optional(),request_object_signing_alg_values_supported:fe.array(fe.string()).optional(),request_object_encryption_alg_values_supported:fe.array(fe.string()).optional(),request_object_encryption_enc_values_supported:fe.array(fe.string()).optional(),token_endpoint_auth_methods_supported:fe.array(fe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:fe.array(fe.string()).optional(),display_values_supported:fe.array(fe.string()).optional(),claim_types_supported:fe.array(fe.string()).optional(),claims_supported:fe.array(fe.string()).optional(),service_documentation:fe.string().optional(),claims_locales_supported:fe.array(fe.string()).optional(),ui_locales_supported:fe.array(fe.string()).optional(),claims_parameter_supported:fe.boolean().optional(),request_parameter_supported:fe.boolean().optional(),request_uri_parameter_supported:fe.boolean().optional(),require_request_uri_registration:fe.boolean().optional(),op_policy_uri:Xh.optional(),op_tos_uri:Xh.optional()}).passthrough(),_Ot=Fwn.merge(wPe.pick({code_challenge_methods_supported:!0})),TPe=fe.object({access_token:fe.string(),id_token:fe.string().optional(),token_type:fe.string(),expires_in:fe.number().optional(),scope:fe.string().optional(),refresh_token:fe.string().optional()}).strip(),SOt=fe.object({error:fe.string(),error_description:fe.string().optional(),error_uri:fe.string().optional()}),Pwn=fe.object({redirect_uris:fe.array(Xh),token_endpoint_auth_method:fe.string().optional(),grant_types:fe.array(fe.string()).optional(),response_types:fe.array(fe.string()).optional(),client_name:fe.string().optional(),client_uri:Xh.optional(),logo_uri:Xh.optional(),scope:fe.string().optional(),contacts:fe.array(fe.string()).optional(),tos_uri:Xh.optional(),policy_uri:fe.string().optional(),jwks_uri:Xh.optional(),jwks:fe.any().optional(),software_id:fe.string().optional(),software_version:fe.string().optional(),software_statement:fe.string().optional()}).strip(),Lwn=fe.object({client_id:fe.string(),client_secret:fe.string().optional(),client_id_issued_at:fe.number().optional(),client_secret_expires_at:fe.number().optional()}).strip(),xOt=Pwn.merge(Lwn),Lwo=fe.object({error:fe.string(),error_description:fe.string().optional()}).strip(),Uwo=fe.object({token:fe.string(),token_type_hint:fe.string().optional()}).strip()});function wOt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function TOt({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 DOt=De(()=>{});var _p,AZ,xN,wN,TN,yZ,EZ,vZ,B7,CZ,bZ,_Z,SZ,xZ,wZ,TZ,DZ,IOt,ROt=De(()=>{_p=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}},AZ=class extends _p{};AZ.errorCode="invalid_request";xN=class extends _p{};xN.errorCode="invalid_client";wN=class extends _p{};wN.errorCode="invalid_grant";TN=class extends _p{};TN.errorCode="unauthorized_client";yZ=class extends _p{};yZ.errorCode="unsupported_grant_type";EZ=class extends _p{};EZ.errorCode="invalid_scope";vZ=class extends _p{};vZ.errorCode="access_denied";B7=class extends _p{};B7.errorCode="server_error";CZ=class extends _p{};CZ.errorCode="temporarily_unavailable";bZ=class extends _p{};bZ.errorCode="unsupported_response_type";_Z=class extends _p{};_Z.errorCode="unsupported_token_type";SZ=class extends _p{};SZ.errorCode="invalid_token";xZ=class extends _p{};xZ.errorCode="method_not_allowed";wZ=class extends _p{};wZ.errorCode="too_many_requests";TZ=class extends _p{};TZ.errorCode="invalid_client_metadata";DZ=class extends _p{};DZ.errorCode="insufficient_scope";IOt={[AZ.errorCode]:AZ,[xN.errorCode]:xN,[wN.errorCode]:wN,[TN.errorCode]:TN,[yZ.errorCode]:yZ,[EZ.errorCode]:EZ,[vZ.errorCode]:vZ,[B7.errorCode]:B7,[CZ.errorCode]:CZ,[bZ.errorCode]:bZ,[_Z.errorCode]:_Z,[SZ.errorCode]:SZ,[xZ.errorCode]:xZ,[wZ.errorCode]:wZ,[TZ.errorCode]:TZ,[DZ.errorCode]:DZ}});function NOt(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 OOt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":Uwn(i,o,r);return;case"client_secret_post":Qwn(i,o,n);return;case"none":qwn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Uwn(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 Qwn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function qwn(t,e){e.set("client_id",t)}async function RPe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=SOt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=IOt[i]||B7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new B7(i)}}async function Qw(t,e){var r,n;try{return await IPe(t,e)}catch(i){if(i instanceof xN||i instanceof TN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await IPe(t,e);if(i instanceof wN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await IPe(t,e);throw i}}async function IPe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await Gwn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await Hwn(e,t,s),u=await zwn(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 A=await Jwn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),d=A}if(r!==void 0){let A=await t.codeVerifier(),y=await NPe(a,{metadata:u,clientInformation:d,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let f=await t.tokens();if(f?.refresh_token)try{let A=await OPe(a,{metadata:u,clientInformation:d,refreshToken:f.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof _p)||A instanceof B7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:m}=await Ywn(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 Hwn(t,e,r){let n=wOt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!TOt({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 IZ(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 Gwn(t,e,r=fetch){let n=await Wwn(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 bOt.parse(await n.json())}async function BPe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?BPe(t,void 0,r):void 0;throw n}}function Vwn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function BOt(t,e,r=fetch){return await BPe(t,{"MCP-Protocol-Version":e},r)}function $wn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function Wwn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:Iq,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let d=Vwn(e,s.pathname);c=new URL(d,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await BOt(c,a,r);if(!n?.metadataUrl&&$wn(u,s.pathname)){let d=new URL(`/.well-known/${e}`,s);u=await BOt(d,a,r)}return u}function jwn(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 zwn(t,{fetchFn:e=fetch,protocolVersion:r=Iq}={}){var n;let i={"MCP-Protocol-Version":r},o=jwn(t);for(let{url:s,type:a}of o){let c=await BPe(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 wPe.parse(await c.json());{let u=_Ot.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 Ywn(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 xPe(),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 NPe(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 A=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],y=NOt(r,A);OOt(y,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 RPe(m);return TPe.parse(await m.json())}async function OPe(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=NOt(r,h);OOt(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 RPe(p);return TPe.parse({refresh_token:n,...await p.json()})}async function Jwn(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 RPe(o);return xOt.parse(await o.json())}var W1,Ume=De(()=>{COt();kw();DPe();DPe();DOt();ROt();W1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var MPe,Qq,MOt=De(()=>{vOt();kw();Ume();MPe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Qq=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 W1("No auth provider");let r;try{r=await Qw(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 W1;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 SN(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=IZ(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 MPe(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=Mw.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 W1("No auth provider");if(await Qw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1("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=IZ(a),await Qw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1;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 Qme,kOt=De(()=>{hPe();Qme=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=kme({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 Kwn,RZ,qw,kPe=De(()=>{kw();Ume();kOt();Kwn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},RZ=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},qw=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:Kwn}async _authThenStart(){var e;if(!this._authProvider)throw new W1("No auth provider");let r;try{r=await Qw(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 W1;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 RZ(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 Qme).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 A=Mw.parse(JSON.parse(h.data));o!==void 0&&lZ(A)&&(A.id=o),(c=this.onmessage)===null||c===void 0||c.call(this,A)}catch(A){(u=this.onerror)===null||u===void 0||u.call(this,A)}}}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 W1("No auth provider");if(await Qw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1("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:ome(e)?e.id:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});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=IZ(f),await Qw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new W1;return this.send(e)}let y=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${y}`)}if(f.status===202){mRt(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(y=>{var v;return(v=this.onerror)===null||v===void 0?void 0:v.call(this,y)});return}let m=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=f.headers.get("content-type");if(m)if(A?.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await f.json(),v=Array.isArray(y)?y.map(S=>Mw.parse(S)):[Mw.parse(y)];for(let S of v)(o=this.onmessage)===null||o===void 0||o.call(this,S)}else throw new RZ(-1,`Unexpected content type: ${A}`)}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 RZ(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 Xwn}from"node:fs/promises";var BZ,NZ,DN,FPe=De(()=>{"use strict";rQ();Ume();Vo();(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"})(BZ||(BZ={}));NZ=class extends Error{code;constructor(e,r){super(r),this.code=e}},DN=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||a7.default}async start(){if(this._isClosed)throw new Error(H.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 OPe(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(H.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 NZ(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 NZ(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error(H.t("websocketClient.errors.noAuthProvider"));try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await NPe(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(H.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===a7.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error(H.t("websocketClient.errors.transportClosed"));if(!this._websocket)throw new Error(H.t("websocketClient.errors.transportNotStarted"));if(this._websocket.readyState!==a7.default.OPEN)throw new Error(H.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 NZ(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:BZ.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.27",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:BZ.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await Xwn(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:BZ.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 FOt,qme,POt=De(()=>{"use strict";FOt=Ye(OX(),1);Vo();qme=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(H.t("mcp.auth.scopesRequired"));this.auth=new FOt.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(H.t("mcp.auth.failedToGetAccessToken"));return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as Zwn}from"node:child_process";import{promisify as eTn}from"node:util";import{platform as tTn}from"node:os";import{URL as rTn}from"node:url";function nTn(t){let e;try{e=new rTn(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 UOt(t){nTn(t);let e=tTn(),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 LOt(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 LOt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var LOt,QOt=De(()=>{"use strict";LOt=eTn(Zwn)});function Bs(t){return t instanceof Error&&"code"in t}function wr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function PPe(t){if(t&&typeof t=="object"&&"response"in t){let r=iTn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new Gme(r.error.message);case 401:return new Hw(r.error.message);case 403:return new Hme(r.error.message);default:}}return t}function iTn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Hme,Hw,Gme,Zu=De(()=>{"use strict";Hme=class extends Error{},Hw=class extends Error{},Gme=class extends Error{}});import{promises as qq}from"node:fs";import*as Vme from"node:path";import*as qOt from"node:os";var Zh,$me=De(()=>{"use strict";Zu();Vo();Zh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=qOt.homedir();return Vme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=Vme.dirname(this.getTokenFilePath());await qq.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await qq.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(H.t("mcp.tokenStorage.errors.failedToLoadTokens",{error:wr(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 qq.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(d){throw console.error(H.t("mcp.tokenStorage.errors.failedToSaveToken",{error:wr(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 qq.unlink(i):await qq.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(H.t("mcp.tokenStorage.errors.failedToRemoveToken",{error:wr(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 qq.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(H.t("mcp.tokenStorage.errors.failedToClearTokens",{error:wr(e)}))}}}});var em,Wme=De(()=>{"use strict";Zu();Vo();em=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}: ${wr(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}: ${wr(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(H.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(H.t("mcp.oauth.discovery.dynamicRegistrationSupported"),i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${wr(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(H.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(H.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 HOt from"node:http";import*as OZ from"node:crypto";import{URL as LPe}from"node:url";var x3,UPe=De(()=>{"use strict";QOt();$me();Zu();Wme();Vo();x3=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(H.t("mcp.auth.clientRegistrationFailed",{status:o.status,statusText:o.statusText,error:s}))}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=em.extractBaseUrl(e);return em.discoverOAuthConfig(r)}static generatePKCEParams(){let e=OZ.randomBytes(32).toString("base64url"),r=OZ.createHash("sha256").update(e).digest("base64url"),n=OZ.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=HOt.createServer(async(o,s)=>{try{let a=new LPe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end(H.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(`
607
607
  <html>
608
608
  <body>
609
609
  <h1>${H.t("mcp.ui.authenticationFailed")}</h1>
@@ -3250,7 +3250,7 @@ Content from @${U}:
3250
3250
  `,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function hAt(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=Wao(t,e);return r?{line:n.line+1,column:n.column+1}:n}var jao=t=>`\\u{${t.codePointAt(0).toString(16)}}`,mAt=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?`
3251
3251
 
3252
3252
  ${e}
3253
- `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=zao(r,this.#t.message);if(n)return(0,Yjr.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}},zao=(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)}:hAt(t,Number(n),{oneBased:!0})},Yao=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${jao(n)})`);function gAt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new mAt({jsonParseError:n,fileName:r,input:t})}}var Wzr=Ye(Vzr(),1);import{fileURLToPath as jlo}from"node:url";function $zr(t){return t instanceof URL?jlo(t):t}var Jlo=t=>Ylo.resolve($zr(t)??".","package.json"),Klo=(t,e)=>{let r=typeof t=="string"?gAt(t):t;return e&&(0,Wzr.default)(r),r};async function jzr({cwd:t,normalize:e=!0}={}){let r=await zlo.readFile(Jlo(t),"utf8");return Klo(r,e)}async function zzr(t){let e=await Sjr("package.json",t);if(e)return{packageJson:await jzr({...t,cwd:Xlo.dirname(e)}),path:e}}import{fileURLToPath as Zlo}from"url";import eco from"path";var tco=Zlo(import.meta.url),rco=eco.dirname(tco),awe;async function QY(){if(awe)return awe;let t=await zzr({cwd:rco});if(t)return awe=t.packageJson,awe}async function JI(){let t=await QY();return"0.2.27-beta.0"}import OP from"node:process";nr();var Yzr={name:"about",description:H.t("command.about"),kind:"built-in",action:async t=>{let e=OP.platform,r=H.t("aboutCommand.noSandbox");OP.env.SANDBOX&&OP.env.SANDBOX!=="sandbox-exec"?r=OP.env.SANDBOX:OP.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${OP.env.SEATBELT_PROFILE||H.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||H.t("aboutCommand.unknown"),i=await JI(),o=t.services.settings.merged.selectedAuthType||"",s=OP.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())}};nr();nr();var cwe="\x1B[32m";var Kzr="\x1B[31m",KI="\x1B[36m",M0="\x1B[90m";var _l="\x1B[0m";function lwe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3253
+ `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=zao(r,this.#t.message);if(n)return(0,Yjr.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}},zao=(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)}:hAt(t,Number(n),{oneBased:!0})},Yao=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${jao(n)})`);function gAt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new mAt({jsonParseError:n,fileName:r,input:t})}}var Wzr=Ye(Vzr(),1);import{fileURLToPath as jlo}from"node:url";function $zr(t){return t instanceof URL?jlo(t):t}var Jlo=t=>Ylo.resolve($zr(t)??".","package.json"),Klo=(t,e)=>{let r=typeof t=="string"?gAt(t):t;return e&&(0,Wzr.default)(r),r};async function jzr({cwd:t,normalize:e=!0}={}){let r=await zlo.readFile(Jlo(t),"utf8");return Klo(r,e)}async function zzr(t){let e=await Sjr("package.json",t);if(e)return{packageJson:await jzr({...t,cwd:Xlo.dirname(e)}),path:e}}import{fileURLToPath as Zlo}from"url";import eco from"path";var tco=Zlo(import.meta.url),rco=eco.dirname(tco),awe;async function QY(){if(awe)return awe;let t=await zzr({cwd:rco});if(t)return awe=t.packageJson,awe}async function JI(){let t=await QY();return"0.2.27"}import OP from"node:process";nr();var Yzr={name:"about",description:H.t("command.about"),kind:"built-in",action:async t=>{let e=OP.platform,r=H.t("aboutCommand.noSandbox");OP.env.SANDBOX&&OP.env.SANDBOX!=="sandbox-exec"?r=OP.env.SANDBOX:OP.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${OP.env.SEATBELT_PROFILE||H.t("aboutCommand.unknown")})`);let n=t.services.config?.getModel()||H.t("aboutCommand.unknown"),i=await JI(),o=t.services.settings.merged.selectedAuthType||"",s=OP.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())}};nr();nr();var cwe="\x1B[32m";var Kzr="\x1B[31m",KI="\x1B[36m",M0="\x1B[90m";var _l="\x1B[0m";function lwe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3254
3254
  ${Kzr}${H.t("agentsCommand.list.noAgentsFound")}${_l}
3255
3255
  `;i="\u{1F7E2} ";let o=`${i}${e}
3256
3256
  `;for(let s of t)n?o+=nco(s):o+=`${cwe}- ${s.agentType}${_l}
@@ -4109,7 +4109,7 @@ ${H.t("gemini.errors.criticalUnhandledRejection")}
4109
4109
  =========================================
4110
4110
  ${H.t("gemini.errors.reason",{reason:e})}${e instanceof Error&&e.stack?`
4111
4111
  ${H.t("gemini.errors.stackTrace")}
4112
- ${e.stack}`:""}`;xa.emit("log-error",n),t||(t=!0,xa.emit("open-debug-console"))})}function syo(){console.log(H.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:process.env.NODE_ENV,SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.27-beta.0"}},r=`crash-${Date.now()}-${process.pid}.json`,n=J3o.join(process.cwd(),r);try{tyo.writeFileSync(n,JSON.stringify(e,null,2)),console.error(H.t("gemini.crashDetected",{crashFilePath:n})),console.error(H.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(H.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(H.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(H.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function Ucn(){oyo();let t=process.cwd(),e=Fc(t);if(!e.user.settings.cna){let d=await Dhe();d&&e.setValue("User","cna",d)}if(await Dnn(),e.errors.length>0){for(let d of e.errors){let f=H.t("gemini.errorInFile",{path:d.path,message:d.message});process.env.NO_COLOR||(f=`\x1B[31m${f}\x1B[0m`),console.error(f),console.error(H.t("gemini.pleaseFixFileAndTryAgain",{path:d.path}))}process.exit(1)}let r=await nDe(),n=cR(t),i=await iL(e.merged,n,jg.generateSessionId(),r);if(H.changeLanguage(i.getLanguage()),i.getDebugMode()&&syo(),Z3o.setDefaultResultOrder(ryo(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(H.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),i.getListExtensions()){console.debug(H.t("gemini.installedExtensions"));for(let d of n)console.debug(`- ${d.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:d}=await Promise.resolve().then(()=>(b6t(),xnn)),f=(await Promise.resolve().then(()=>(q4t(),Q4t))).default;await f().scriptName("iflow").command(d).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:d}=await Promise.resolve().then(()=>(v6t(),fnn)),f=(await Promise.resolve().then(()=>(q4t(),Q4t))).default;await f().scriptName("iflow").command(d).help().version(!1).parse(),process.exit(0)}e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",xr.CLOUD_SHELL),ten(i.getDebugMode()),await i.initialize();try{await i.setIdeModeAndSyncConnection(!0)}catch(d){console.error(H.t("gemini.failedToConnectToIdeServer"),d)}if(ql.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ql.setActiveTheme(e.merged.theme)||console.warn(H.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let d=e.merged.autoConfigureMaxOldSpaceSize?nyo(i):[],f=i.getSandbox();if(f){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let p=$P(e.merged.selectedAuthType);if(p)throw new Error(p);await i.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(p){console.error(H.t("gemini.errorAuthenticating"),p),process.exit(1)}await mon(f,d,i),process.exit(0)}else d.length>0&&(await iyo(d),process.exit(0))}if(e.merged.selectedAuthType===xr.LOGIN_WITH_IFLOW&&i.isBrowserLaunchSuppressed()&&await JB(e.merged.selectedAuthType,i),i.getExperimentalAcp())return i.getAcpPort()?await Jln(i,e,n,r,i.getAcpPort()):Gln(i,e,n,r);let o=i.getQuestion(),s=[...await gon(),...await yon(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&o?.length===0){console.clear();let d=await JI();Lcn(Pcn(t),e);let f,p=async()=>{try{if(console.clear(),Lcn(Pcn(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),f)try{f.unmount(),await new Promise(h=>process.nextTick(h))}catch(h){console.error(H.t("gemini.errorDuringUnmount"),h)}f=bfe((0,ede.jsx)(H4t.default.StrictMode,{children:(0,ede.jsx)(J6t,{config:i,settings:e,startupWarnings:s,version:d,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0})}),{exitOnCtrlC:!1,stdout:LAt(),stdin:process.stdin,patchConsole:!0})}catch(h){console.error(H.t("gemini.errorDuringResume"),h)}};process.on("SIGCONT",p),Eue(()=>{process.off("SIGCONT",p)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),f=bfe((0,ede.jsx)(H4t.default.StrictMode,{children:(0,ede.jsx)(J6t,{config:i,settings:e,startupWarnings:s,version:d,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume})}),{exitOnCtrlC:!1,stdout:LAt()}),e.merged.disableAutoUpdate||kln().then(h=>{Win(h,e,i.getProjectRoot())}).catch(h=>{i.getDebugMode()&&console.error(H.t("gemini.updateCheckFailed"),h)}),Eue(()=>f.unmount());return}!process.stdin.isTTY&&!o&&(o+=await don()),o||(console.error(H.t("gemini.noInputProvidedViaStdin")),process.exit(1));let c=Math.random().toString(16).slice(2);aY(i,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:o,prompt_id:c,auth_type:i.getContentGeneratorConfig()?.authType,prompt_length:o.length});let u=await ayo(i,n,e,r);await Eon(u,o,c),process.exit(0)}function Lcn(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 ayo(t,e,r,n){let i=t;if(t.getApprovalMode()!==si.YOLO){let o=r.merged.excludeTools||[],s=[wu.Name,Np.Name,df.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await iL(c,e,t.getSessionId(),u),await i.initialize()}return await lyo(r.merged.selectedAuthType,i,r)}async function lyo(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!$he()&&(console.error(H.t("gemini.pleaseSetAuthMethod",{userSettingsPath:MP})),process.exit(1)),t||($he()?t=xr.IFLOW:t=xr.IFLOW);let n=$P(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}Ucn().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
4112
+ ${e.stack}`:""}`;xa.emit("log-error",n),t||(t=!0,xa.emit("open-debug-console"))})}function syo(){console.log(H.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:process.env.NODE_ENV,SANDBOX:process.env.SANDBOX,CLI_VERSION:"0.2.27"}},r=`crash-${Date.now()}-${process.pid}.json`,n=J3o.join(process.cwd(),r);try{tyo.writeFileSync(n,JSON.stringify(e,null,2)),console.error(H.t("gemini.crashDetected",{crashFilePath:n})),console.error(H.t("gemini.coreDumpWillBeGenerated"))}catch(i){console.error(H.t("gemini.failedToWriteCrashFile"),i)}process.abort()}),process.on("warning",t=>{console.warn(H.t("gemini.debug.nodejsWarning"),{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error(H.t("gemini.debug.unhandledPromiseRejectionDetected"),{reason:t,promise:e.toString()})})}async function Ucn(){oyo();let t=process.cwd(),e=Fc(t);if(!e.user.settings.cna){let d=await Dhe();d&&e.setValue("User","cna",d)}if(await Dnn(),e.errors.length>0){for(let d of e.errors){let f=H.t("gemini.errorInFile",{path:d.path,message:d.message});process.env.NO_COLOR||(f=`\x1B[31m${f}\x1B[0m`),console.error(f),console.error(H.t("gemini.pleaseFixFileAndTryAgain",{path:d.path}))}process.exit(1)}let r=await nDe(),n=cR(t),i=await iL(e.merged,n,jg.generateSessionId(),r);if(H.changeLanguage(i.getLanguage()),i.getDebugMode()&&syo(),Z3o.setDefaultResultOrder(ryo(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error(H.t("gemini.errors.promptInteractiveFlagNotSupported")),process.exit(1)),i.getListExtensions()){console.debug(H.t("gemini.installedExtensions"));for(let d of n)console.debug(`- ${d.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:d}=await Promise.resolve().then(()=>(b6t(),xnn)),f=(await Promise.resolve().then(()=>(q4t(),Q4t))).default;await f().scriptName("iflow").command(d).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:d}=await Promise.resolve().then(()=>(v6t(),fnn)),f=(await Promise.resolve().then(()=>(q4t(),Q4t))).default;await f().scriptName("iflow").command(d).help().version(!1).parse(),process.exit(0)}e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",xr.CLOUD_SHELL),ten(i.getDebugMode()),await i.initialize();try{await i.setIdeModeAndSyncConnection(!0)}catch(d){console.error(H.t("gemini.failedToConnectToIdeServer"),d)}if(ql.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(ql.setActiveTheme(e.merged.theme)||console.warn(H.t("gemini.themeNotFound",{theme:e.merged.theme}))),!process.env.SANDBOX){let d=e.merged.autoConfigureMaxOldSpaceSize?nyo(i):[],f=i.getSandbox();if(f){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let p=$P(e.merged.selectedAuthType);if(p)throw new Error(p);await i.refreshAuth(e.merged.selectedAuthType,{apiKey:e.merged.apiKey,baseUrl:e.merged.baseUrl,modelName:e.merged.modelName})}catch(p){console.error(H.t("gemini.errorAuthenticating"),p),process.exit(1)}await mon(f,d,i),process.exit(0)}else d.length>0&&(await iyo(d),process.exit(0))}if(e.merged.selectedAuthType===xr.LOGIN_WITH_IFLOW&&i.isBrowserLaunchSuppressed()&&await JB(e.merged.selectedAuthType,i),i.getExperimentalAcp())return i.getAcpPort()?await Jln(i,e,n,r,i.getAcpPort()):Gln(i,e,n,r);let o=i.getQuestion(),s=[...await gon(),...await yon(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&o?.length===0){console.clear();let d=await JI();Lcn(Pcn(t),e);let f,p=async()=>{try{if(console.clear(),Lcn(Pcn(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),f)try{f.unmount(),await new Promise(h=>process.nextTick(h))}catch(h){console.error(H.t("gemini.errorDuringUnmount"),h)}f=bfe((0,ede.jsx)(H4t.default.StrictMode,{children:(0,ede.jsx)(J6t,{config:i,settings:e,startupWarnings:s,version:d,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0})}),{exitOnCtrlC:!1,stdout:LAt(),stdin:process.stdin,patchConsole:!0})}catch(h){console.error(H.t("gemini.errorDuringResume"),h)}};process.on("SIGCONT",p),Eue(()=>{process.off("SIGCONT",p)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),f=bfe((0,ede.jsx)(H4t.default.StrictMode,{children:(0,ede.jsx)(J6t,{config:i,settings:e,startupWarnings:s,version:d,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume})}),{exitOnCtrlC:!1,stdout:LAt()}),e.merged.disableAutoUpdate||kln().then(h=>{Win(h,e,i.getProjectRoot())}).catch(h=>{i.getDebugMode()&&console.error(H.t("gemini.updateCheckFailed"),h)}),Eue(()=>f.unmount());return}!process.stdin.isTTY&&!o&&(o+=await don()),o||(console.error(H.t("gemini.noInputProvidedViaStdin")),process.exit(1));let c=Math.random().toString(16).slice(2);aY(i,{"event.name":"user_prompt","event.timestamp":new Date().toISOString(),prompt:o,prompt_id:c,auth_type:i.getContentGeneratorConfig()?.authType,prompt_length:o.length});let u=await ayo(i,n,e,r);await Eon(u,o,c),process.exit(0)}function Lcn(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 ayo(t,e,r,n){let i=t;if(t.getApprovalMode()!==si.YOLO){let o=r.merged.excludeTools||[],s=[wu.Name,Np.Name,df.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await iL(c,e,t.getSessionId(),u),await i.initialize()}return await lyo(r.merged.selectedAuthType,i,r)}async function lyo(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!$he()&&(console.error(H.t("gemini.pleaseSetAuthMethod",{userSettingsPath:MP})),process.exit(1)),t||($he()?t=xr.IFLOW:t=xr.IFLOW);let n=$P(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}Ucn().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
4113
4113
  /**
4114
4114
  * @license
4115
4115
  * Copyright 2025 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflow-ai/iflow-cli",
3
- "version": "0.2.27-beta.0",
3
+ "version": "0.2.27",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },