@iflow-ai/iflow-cli 0.2.19-beta.2 → 0.2.19-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle/iflow.js CHANGED
@@ -410,14 +410,14 @@ ${JSON.stringify(u,null,2)}`),u.usage&&(this.lastUsageMetadata={total_tokens:u.u
410
410
  \u8FD9\u4E2A\u662F\u9519\u8BEF\u7684json\u683C\u5F0F\uFF1A
411
411
  ${e}
412
412
 
413
- \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 p5(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 zf.STOP;case"length":return zf.MAX_TOKENS;case"content_filter":return zf.SAFETY;case"tool_calls":return zf.MALFORMED_FUNCTION_CALL;default:return zf.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 y3,Jf,zq,Jq,NZ,h5=Ie(()=>{"use strict";y3="Qwen3-Coder",Jf="Qwen3-Coder",zq="text-embedding-v1",Jq="gemini-2.5-flash-lite",NZ="https://apis.iflow.cn/v1"});async function cPe(t,e,r,n){if(e===Vr.LOGIN_WITH_IFLOW){let i=await pN(e,r),o=await Hq();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||NZ,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max"})}if(e===Vr.CLOUD_SHELL){let i=await pN(e,r),o=await bRt(i);return new D7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var uPe=Ie(()=>{"use strict";T7();jq();CRt();m0e();lPe();h5();});function wwn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function Kb(t){let e=wwn(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 OZ(){return Kb("apiKey")}function MZ(){return Kb("baseUrl")||Kb("url")}function kZ(){return Kb("modelName")||Kb("model")}function NRt(t){let e=Kb(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 ORt(t){let e=Kb(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function MRt(t){let e=Kb(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function C0e(){return!!(OZ()||MZ()||kZ())}function fPe(){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"],n=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=Kb(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=NRt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=ORt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=MRt(o);s!==void 0&&(t[o]=s)}),t}function Swn(){return{apiKey:OZ(),baseUrl:MZ(),model:kZ()}}var dPe=Ie(()=>{"use strict";});async function pPe(t,e,r){await Gq()&&(await h0e()||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=OZ(),u=MZ(),f=kZ(),d=r?.apiKey||c,p=r?.baseUrl||u||xwn[e],h=t.getModel()||f||y3,g={model:h,authType:e,proxy:t?.getProxy(),multimodalModelName:r?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Vr.CLOUD_SHELL?g:e===Vr.LOGIN_WITH_IFLOW?(g.baseUrl=p||NZ,g):([...Zm,Vr.OPENAI_COMPATIBLE].includes(e)&&d&&(g.apiKey=d,g.baseUrl=p,g.model=h),g)}async function hPe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.19-beta.2 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Zm,Vr.IDEA_LAB].includes(t.authType)||t.authType===Vr.OPENAI_COMPATIBLE)return new Yq(t);if(t.authType===Vr.LOGIN_WITH_IFLOW||t.authType===Vr.CLOUD_SHELL)return cPe(i,t.authType,e,r);if([...Zm,Vr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Vr.USE_GEMINI||t.authType===Vr.USE_VERTEX_AI)return new i0e({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Vr,Zm,xwn,T7=Ie(()=>{"use strict";nc();uPe();h5();lPe();dPe();jq();(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"})(Vr||(Vr={}));Zm=[Vr.IFLOW,Vr.IDEA_LAB],xwn={[Vr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Vr.IFLOW]:NZ}});var _0e,kRt=Ie(()=>{"use strict";_0e=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 is,ai,os,Kf=Ie(()=>{"use strict";is=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s=!0,a=!1,c=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=c}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"})(ai||(ai={}));(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"})(os||(os={}))});function gN(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 w0e=Ie(()=>{"use strict";});var Pc,S0e=Ie(()=>{"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"})(Pc||(Pc={}))});function Twn(t){return{text:t.text}}function Dwn(t,e){return[{text:`[Tool '${e}' provided the following ${t.type} data with mime-type: ${t.mimeType}]`},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Iwn(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:`[Tool '${e}' provided the following embedded resource with mime-type: ${n}]`},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Rwn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function Bwn(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 Twn(o);case"image":case"audio":return Dwn(o,n);case"resource":return Iwn(o,n);case"resource_link":return Rwn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function Nwn(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`[Image: ${n.mimeType}]`;case"audio":return`[Audio: ${n.mimeType}]`;case"resource_link":return`[Link to ${n.title||n.name}: ${n.uri}]`;case"resource":return n.resource?.text?n.resource.text:`[Embedded Resource: ${n.resource?.mimeType||"unknown type"}]`;default:return`[Unknown content type: ${n.type}]`}}).join(`
413
+ \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 p5(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 zf.STOP;case"length":return zf.MAX_TOKENS;case"content_filter":return zf.SAFETY;case"tool_calls":return zf.MALFORMED_FUNCTION_CALL;default:return zf.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 y3,Jf,zq,Jq,NZ,h5=Ie(()=>{"use strict";y3="Qwen3-Coder",Jf="Qwen3-Coder",zq="text-embedding-v1",Jq="gemini-2.5-flash-lite",NZ="https://apis.iflow.cn/v1"});async function cPe(t,e,r,n){if(e===Vr.LOGIN_WITH_IFLOW){let i=await pN(e,r),o=await Hq();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||NZ,authType:e,debugMode:r.getDebugMode(),multimodalModelName:"qwen-vl-max"})}if(e===Vr.CLOUD_SHELL){let i=await pN(e,r),o=await bRt(i);return new D7(i,o.projectId,t,n,o.userTier)}throw new Error(`Unsupported authType: ${e}`)}var uPe=Ie(()=>{"use strict";T7();jq();CRt();m0e();lPe();h5();});function wwn(t){return t.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}function Kb(t){let e=wwn(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 OZ(){return Kb("apiKey")}function MZ(){return Kb("baseUrl")||Kb("url")}function kZ(){return Kb("modelName")||Kb("model")}function NRt(t){let e=Kb(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 ORt(t){let e=Kb(t);if(e===void 0)return;let r=Number(e);return isNaN(r)?void 0:r}function MRt(t){let e=Kb(t);if(e!==void 0)return e.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function C0e(){return!!(OZ()||MZ()||kZ())}function fPe(){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"],n=["maxSessionTurns","memoryDiscoveryMaxDirs"],i=["coreTools","excludeTools","allowMCPServers","excludeMCPServers"];return e.forEach(o=>{let s=Kb(o);s!==void 0&&(t[o]=s)}),r.forEach(o=>{let s=NRt(o);s!==void 0&&(t[o]=s)}),n.forEach(o=>{let s=ORt(o);s!==void 0&&(t[o]=s)}),i.forEach(o=>{let s=MRt(o);s!==void 0&&(t[o]=s)}),t}function Swn(){return{apiKey:OZ(),baseUrl:MZ(),model:kZ()}}var dPe=Ie(()=>{"use strict";});async function pPe(t,e,r){await Gq()&&(await h0e()||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=OZ(),u=MZ(),f=kZ(),d=r?.apiKey||c,p=r?.baseUrl||u||xwn[e],h=t.getModel()||f||y3,g={model:h,authType:e,proxy:t?.getProxy(),multimodalModelName:r?.multimodalModelName,debugMode:t?.getDebugMode()};return e===Vr.CLOUD_SHELL?g:e===Vr.LOGIN_WITH_IFLOW?(g.baseUrl=p||NZ,g):([...Zm,Vr.OPENAI_COMPATIBLE].includes(e)&&d&&(g.apiKey=d,g.baseUrl=p,g.model=h),g)}async function hPe(t,e,r){let i={headers:{"User-Agent":`iFlowCLI/0.2.19-beta.3 (${process.platform}; ${process.arch})`}};if(t.authType&&[...Zm,Vr.IDEA_LAB].includes(t.authType)||t.authType===Vr.OPENAI_COMPATIBLE)return new Yq(t);if(t.authType===Vr.LOGIN_WITH_IFLOW||t.authType===Vr.CLOUD_SHELL)return cPe(i,t.authType,e,r);if([...Zm,Vr.OPENAI_COMPATIBLE].includes(t.authType)||t.authType===Vr.USE_GEMINI||t.authType===Vr.USE_VERTEX_AI)return new i0e({apiKey:t.apiKey===""?void 0:t.apiKey,vertexai:t.vertexai,httpOptions:i}).models;throw new Error(`Error creating contentGenerator: Unsupported authType: ${t.authType}`)}var Vr,Zm,xwn,T7=Ie(()=>{"use strict";nc();uPe();h5();lPe();dPe();jq();(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"})(Vr||(Vr={}));Zm=[Vr.IFLOW,Vr.IDEA_LAB],xwn={[Vr.IDEA_LAB]:"https://idealab.alibaba-inc.com/api/openai/v1",[Vr.IFLOW]:NZ}});var _0e,kRt=Ie(()=>{"use strict";_0e=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 is,ai,os,Kf=Ie(()=>{"use strict";is=class{name;displayName;description;icon;parameterSchema;isOutputMarkdown;canUpdateOutput;aliases;constructor(e,r,n,i,o,s=!0,a=!1,c=[]){this.name=e,this.displayName=r,this.description=n,this.icon=i,this.parameterSchema=o,this.isOutputMarkdown=s,this.canUpdateOutput=a,this.aliases=c}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"})(ai||(ai={}));(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"})(os||(os={}))});function gN(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 w0e=Ie(()=>{"use strict";});var Pc,S0e=Ie(()=>{"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"})(Pc||(Pc={}))});function Twn(t){return{text:t.text}}function Dwn(t,e){return[{text:`[Tool '${e}' provided the following ${t.type} data with mime-type: ${t.mimeType}]`},{inlineData:{mimeType:t.mimeType,data:t.data}}]}function Iwn(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:`[Tool '${e}' provided the following embedded resource with mime-type: ${n}]`},{inlineData:{mimeType:n,data:r.blob}}]}return null}function Rwn(t){return{text:`Resource Link: ${t.title||t.name} at ${t.uri}`}}function Bwn(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 Twn(o);case"image":case"audio":return Dwn(o,n);case"resource":return Iwn(o,n);case"resource_link":return Rwn(o);default:return null}}).filter(o=>o!==null):[{text:"[Error: Could not parse tool response]"}]}function Nwn(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`[Image: ${n.mimeType}]`;case"audio":return`[Audio: ${n.mimeType}]`;case"resource_link":return`[Link to ${n.title||n.name}: ${n.uri}]`;case"resource":return n.resource?.text?n.resource.text:`[Embedded Resource: ${n.resource?.mimeType||"unknown type"}]`;default:return`[Unknown content type: ${n.type}]`}}).join(`
414
414
  `):"```json\n"+JSON.stringify(t,null,2)+"\n```"}function LRt(t){let e=t.replace(/[^a-zA-Z0-9_.-]/g,"_");return e.length>63&&(e=e.slice(0,28)+"___"+e.slice(-32)),e}var nm,LZ=Ie(()=>{"use strict";w0e();S0e();Kf();nc();nm=class t extends is{mcpTool;serverName;serverToolName;parameterSchemaJson;timeout;trust;static allowlist=new Set;constructor(e,r,n,i,o,s,a,c){super(c??LRt(n),`${n} (${r} MCP Server)`,i,os.Hammer,{type:sr.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:"Confirm MCP Tool Execution",serverName:this.serverName,toolName:this.serverToolName,toolDisplayName:this.name,onConfirm:async s=>{s===ai.ProceedAlwaysServer?t.allowlist.add(n):s===ai.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: ${gN(i[0])} with response: ${gN(o)}`;return{llmContent:a,returnDisplay:`Error: MCP tool '${this.serverToolName}' reported an error.`,error:{message:a,type:Pc.MCP_TOOL_ERROR}}}return{llmContent:Bwn(o),returnDisplay:Nwn(o)}}}});var FRt=B((ZBo,PRt)=>{"use strict";PRt.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 VRt=B((eNo,jRt)=>{"use strict";var GRt="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",URt=new RegExp("^"+GRt+"$"),QRt="|&;()<> \\t",Own='"((\\\\"|[^"])*?)"',Mwn="'((\\\\'|[^'])*?)'",kwn=/^#$/,qRt="'",HRt='"',mPe="$",AN="",Lwn=4294967296;for(gPe=0;gPe<4;gPe++)AN+=(Lwn*Math.random()).toString(16);var gPe,Pwn=new RegExp("^"+AN);function Fwn(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 Uwn(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+AN+JSON.stringify(n)+AN:e+n}function Qwn(t,e,r){r||(r={});var n=r.escape||"\\",i="(\\"+n+`['"`+QRt+`]|[^\\s'"`+QRt+"])+",o=new RegExp(["("+GRt+")","("+i+"|"+Own+"|"+Mwn+")+"].join("|"),"g"),s=Fwn(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(URt.test(u))return{op:u};var f=!1,d=!1,p="",h=!1,g;function A(){g+=1;var w,S,T=u.charAt(g);if(T==="{"){if(g+=1,u.charAt(g)==="}")throw new Error("Bad substitution: "+u.slice(g-2,g+1));if(w=u.indexOf("}",g),w<0)throw new Error("Bad substitution: "+u.slice(g));S=u.slice(g,w),g=w}else if(/[*@#?$!_-]/.test(T))S=T,g+=1;else{var N=u.slice(g);w=N.match(/[^\w\d_]/),w?(S=N.slice(0,w.index),g+=w.index-1):(S=N,g=u.length)}return Uwn(e,"",S)}for(g=0;g<u.length;g++){var y=u.charAt(g);if(h=h||!f&&(y==="*"||y==="?"),d)p+=y,d=!1;else if(f)y===f?f=!1:f==qRt?p+=y:y===n?(g+=1,y=u.charAt(g),y===HRt||y===n||y===mPe?p+=y:p+=n+y):y===mPe?p+=A():p+=y;else if(y===HRt||y===qRt)f=y;else{if(URt.test(y))return{op:u};if(kwn.test(y)){a=!0;var v={comment:t.slice(c.index+g+1)};return p.length?[p,v]:[v]}else y===n?d=!0:y===mPe?p+=A():p+=y}}return h?{op:"glob",pattern:p}:p}).reduce(function(c,u){return typeof u>"u"?c:c.concat(u)},[])}jRt.exports=function(e,r,n){var i=Qwn(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("("+AN+".*?"+AN+")","g"));return a.length===1?o.concat(a[0]):o.concat(a.filter(Boolean).map(function(c){return Pwn.test(c)?JSON.parse(c.split(AN)[1]):c}))},[])}});var x0e=B(APe=>{"use strict";APe.quote=FRt();APe.parse=VRt()});var Js,yPe,An,Xb,PZ=Ie(()=>{(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})(Js||(Js={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(yPe||(yPe={}));An=Js.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xb=t=>{switch(typeof t){case"undefined":return An.undefined;case"string":return An.string;case"number":return Number.isNaN(t)?An.nan:An.number;case"boolean":return An.boolean;case"function":return An.function;case"bigint":return An.bigint;case"symbol":return An.symbol;case"object":return Array.isArray(t)?An.array:t===null?An.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?An.promise:typeof Map<"u"&&t instanceof Map?An.map:typeof Set<"u"&&t instanceof Set?An.set:typeof Date<"u"&&t instanceof Date?An.date:An.object;default:return An.unknown}}});var Lr,qwn,M1,T0e=Ie(()=>{PZ();Lr=Js.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"]),qwn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),M1=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,Js.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()}};M1.create=t=>new M1(t)});var Hwn,I7,EPe=Ie(()=>{T0e();PZ();Hwn=(t,e)=>{let r;switch(t.code){case Lr.invalid_type:t.received===An.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Lr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Js.jsonStringifyReplacer)}`;break;case Lr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Js.joinValues(t.keys,", ")}`;break;case Lr.invalid_union:r="Invalid input";break;case Lr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Js.joinValues(t.options)}`;break;case Lr.invalid_enum_value:r=`Invalid enum value. Expected ${Js.joinValues(t.options)}, received '${t.received}'`;break;case Lr.invalid_arguments:r="Invalid function arguments";break;case Lr.invalid_return_type:r="Invalid function return type";break;case Lr.invalid_date:r="Invalid date";break;case Lr.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}"`:Js.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Lr.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 Lr.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 Lr.custom:r="Invalid input";break;case Lr.invalid_intersection_types:r="Intersection results could not be merged";break;case Lr.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Lr.not_finite:r="Number must be finite";break;default:r=e.defaultError,Js.assertNever(t)}return{message:r}},I7=Hwn});function Gwn(t){$Rt=t}function Kq(){return $Rt}var $Rt,D0e=Ie(()=>{EPe();$Rt=I7});function ln(t,e){let r=Kq(),n=FZ({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===I7?void 0:I7].filter(i=>!!i)});t.common.issues.push(n)}var FZ,jwn,im,ji,yN,e2,I0e,R0e,xx,Xq,vPe=Ie(()=>{D0e();EPe();FZ=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}},jwn=[];im=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 ji;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 ji;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}}},ji=Object.freeze({status:"aborted"}),yN=t=>({status:"dirty",value:t}),e2=t=>({status:"valid",value:t}),I0e=t=>t.status==="aborted",R0e=t=>t.status==="dirty",xx=t=>t.status==="valid",Xq=t=>typeof Promise<"u"&&t instanceof Promise});var WRt=Ie(()=>{});var Xn,YRt=Ie(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Xn||(Xn={}))});function Xo(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 XRt(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 aSn(t){return new RegExp(`^${XRt(t)}$`)}function ZRt(t){let e=`${KRt}T${XRt(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 lSn(t,e){return!!((e==="v4"||!e)&&eSn.test(t)||(e==="v6"||!e)&&rSn.test(t))}function cSn(t,e){if(!Jwn.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 uSn(t,e){return!!((e==="v4"||!e)&&tSn.test(t)||(e==="v6"||!e)&&nSn.test(t))}function fSn(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 Zq(t){if(t instanceof k1){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=B6.create(Zq(n))}return new k1({...t._def,shape:()=>e})}else return t instanceof N7?new N7({...t._def,type:Zq(t.element)}):t instanceof B6?B6.create(Zq(t.unwrap())):t instanceof e8?e8.create(Zq(t.unwrap())):t instanceof Zb?Zb.create(t.items.map(e=>Zq(e))):t}function CPe(t,e){let r=Xb(t),n=Xb(e);if(t===e)return{valid:!0,data:t};if(r===An.object&&n===An.object){let i=Js.objectKeys(e),o=Js.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let c=CPe(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===An.array&&n===An.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=CPe(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===An.date&&n===An.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function eBt(t,e){return new IN({values:t,typeName:eo.ZodEnum,...Xo(e)})}function JRt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function tBt(t,e={},r){return t?Dx.create().superRefine((n,i)=>{let o=t(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=JRt(e,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=JRt(e,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Dx.create()}var N6,zRt,hs,Vwn,$wn,Wwn,Ywn,zwn,Jwn,Kwn,Xwn,Zwn,bPe,eSn,tSn,rSn,nSn,iSn,oSn,KRt,sSn,Tx,EN,vN,bN,CN,eH,_N,wN,Dx,B7,m5,tH,N7,k1,SN,R7,B0e,xN,Zb,N0e,rH,nH,O0e,TN,DN,IN,RN,Ix,O6,B6,e8,BN,NN,iH,dSn,UZ,QZ,ON,pSn,eo,hSn,rBt,nBt,mSn,gSn,iBt,ASn,ySn,ESn,vSn,bSn,CSn,_Sn,wSn,SSn,xSn,TSn,DSn,ISn,RSn,BSn,NSn,OSn,MSn,kSn,LSn,PSn,FSn,USn,QSn,qSn,HSn,GSn,jSn,VSn,$Sn,WSn,YSn,zSn,JSn,oBt=Ie(()=>{T0e();D0e();YRt();vPe();PZ();N6=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}},zRt=(t,e)=>{if(xx(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 M1(t.common.issues);return this._error=r,this._error}}};hs=class{get description(){return this._def.description}_getType(e){return Xb(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Xb(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new im,ctx:{common:e.parent.common,data:e.data,parsedType:Xb(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xq(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:Xb(e)},i=this._parseSync({data:e,path:n.path,parent:n});return zRt(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xb(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return xx(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=>xx(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:Xb(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(Xq(i)?i:Promise.resolve(i));return zRt(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:Lr.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 O6({schema:this,typeName:eo.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 B6.create(this,this._def)}nullable(){return e8.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N7.create(this)}promise(){return Ix.create(this,this._def)}or(e){return SN.create([this,e],this._def)}and(e){return xN.create(this,e,this._def)}transform(e){return new O6({...Xo(this._def),schema:this,typeName:eo.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new BN({...Xo(this._def),innerType:this,defaultValue:r,typeName:eo.ZodDefault})}brand(){return new UZ({typeName:eo.ZodBranded,type:this,...Xo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new NN({...Xo(this._def),innerType:this,catchValue:r,typeName:eo.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return QZ.create(this,e)}readonly(){return ON.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vwn=/^c[^\s-]{8,}$/i,$wn=/^[0-9a-z]+$/,Wwn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ywn=/^[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,zwn=/^[a-z0-9_-]{21}$/i,Jwn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kwn=/^[-+]?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)?)??$/,Xwn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zwn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",eSn=/^(?:(?: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])$/,tSn=/^(?:(?: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])$/,rSn=/^(([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]))$/,nSn=/^(([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])$/,iSn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oSn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,KRt="((\\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])))",sSn=new RegExp(`^${KRt}$`);Tx=class t extends hs{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==An.string){let o=this._getOrReturnCtx(e);return ln(o,{code:Lr.invalid_type,expected:An.string,received:o.parsedType}),ji}let n=new im,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:Lr.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:Lr.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:Lr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&ln(i,{code:Lr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Xwn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"email",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")bPe||(bPe=new RegExp(Zwn,"u")),bPe.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"emoji",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Ywn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"uuid",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")zwn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"nanoid",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Vwn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")$wn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cuid2",code:Lr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Wwn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ulid",code:Lr.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:Lr.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:Lr.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:Lr.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:Lr.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:Lr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?ZRt(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Lr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?sSn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Lr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?aSn(o).test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{code:Lr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Kwn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"duration",code:Lr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?lSn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"ip",code:Lr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?cSn(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"jwt",code:Lr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?uSn(e.data,o.version)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"cidr",code:Lr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?iSn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64",code:Lr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?oSn.test(e.data)||(i=this._getOrReturnCtx(e,i),ln(i,{validation:"base64url",code:Lr.invalid_string,message:o.message}),n.dirty()):Js.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Lr.invalid_string,...Xn.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Xn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Xn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Xn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Xn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Xn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Xn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Xn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Xn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Xn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Xn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Xn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Xn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Xn.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,...Xn.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,...Xn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Xn.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Xn.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Xn.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Xn.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Xn.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Xn.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Xn.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Xn.errToObj(r)})}nonempty(e){return this.min(1,Xn.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}};Tx.create=t=>new Tx({checks:[],typeName:eo.ZodString,coerce:t?.coerce??!1,...Xo(t)});EN=class t extends hs{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)!==An.number){let o=this._getOrReturnCtx(e);return ln(o,{code:Lr.invalid_type,expected:An.number,received:o.parsedType}),ji}let n,i=new im;for(let o of this._def.checks)o.kind==="int"?Js.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),ln(n,{code:Lr.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:Lr.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:Lr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?fSn(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),ln(n,{code:Lr.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:Lr.not_finite,message:o.message}),i.dirty()):Js.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xn.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Xn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xn.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Xn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Xn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Xn.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"&&Js.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)}};EN.create=t=>new EN({checks:[],typeName:eo.ZodNumber,coerce:t?.coerce||!1,...Xo(t)});vN=class t extends hs{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)!==An.bigint)return this._getInvalidInput(e);let n,i=new im;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:Lr.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:Lr.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:Lr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Js.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Lr.invalid_type,expected:An.bigint,received:r.parsedType}),ji}gte(e,r){return this.setLimit("min",e,!0,Xn.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Xn.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Xn.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Xn.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Xn.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:Xn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Xn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Xn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Xn.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Xn.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}};vN.create=t=>new vN({checks:[],typeName:eo.ZodBigInt,coerce:t?.coerce??!1,...Xo(t)});bN=class extends hs{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==An.boolean){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.boolean,received:n.parsedType}),ji}return e2(e.data)}};bN.create=t=>new bN({typeName:eo.ZodBoolean,coerce:t?.coerce||!1,...Xo(t)});CN=class t extends hs{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==An.date){let o=this._getOrReturnCtx(e);return ln(o,{code:Lr.invalid_type,expected:An.date,received:o.parsedType}),ji}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return ln(o,{code:Lr.invalid_date}),ji}let n=new im,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),ln(i,{code:Lr.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:Lr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Js.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:Xn.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Xn.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}};CN.create=t=>new CN({checks:[],coerce:t?.coerce||!1,typeName:eo.ZodDate,...Xo(t)});eH=class extends hs{_parse(e){if(this._getType(e)!==An.symbol){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.symbol,received:n.parsedType}),ji}return e2(e.data)}};eH.create=t=>new eH({typeName:eo.ZodSymbol,...Xo(t)});_N=class extends hs{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.undefined,received:n.parsedType}),ji}return e2(e.data)}};_N.create=t=>new _N({typeName:eo.ZodUndefined,...Xo(t)});wN=class extends hs{_parse(e){if(this._getType(e)!==An.null){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.null,received:n.parsedType}),ji}return e2(e.data)}};wN.create=t=>new wN({typeName:eo.ZodNull,...Xo(t)});Dx=class extends hs{constructor(){super(...arguments),this._any=!0}_parse(e){return e2(e.data)}};Dx.create=t=>new Dx({typeName:eo.ZodAny,...Xo(t)});B7=class extends hs{constructor(){super(...arguments),this._unknown=!0}_parse(e){return e2(e.data)}};B7.create=t=>new B7({typeName:eo.ZodUnknown,...Xo(t)});m5=class extends hs{_parse(e){let r=this._getOrReturnCtx(e);return ln(r,{code:Lr.invalid_type,expected:An.never,received:r.parsedType}),ji}};m5.create=t=>new m5({typeName:eo.ZodNever,...Xo(t)});tH=class extends hs{_parse(e){if(this._getType(e)!==An.undefined){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.void,received:n.parsedType}),ji}return e2(e.data)}};tH.create=t=>new tH({typeName:eo.ZodVoid,...Xo(t)});N7=class t extends hs{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==An.array)return ln(r,{code:Lr.invalid_type,expected:An.array,received:r.parsedType}),ji;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?Lr.too_big:Lr.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:Lr.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:Lr.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 N6(r,s,r.path,a)))).then(s=>im.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new N6(r,s,r.path,a)));return im.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Xn.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Xn.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Xn.toString(r)}})}nonempty(e){return this.min(1,e)}};N7.create=(t,e)=>new N7({type:t,minLength:null,maxLength:null,exactLength:null,typeName:eo.ZodArray,...Xo(e)});k1=class t extends hs{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=Js.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==An.object){let u=this._getOrReturnCtx(e);return ln(u,{code:Lr.invalid_type,expected:An.object,received:u.parsedType}),ji}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof m5&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let f=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new N6(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof m5){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")a.length>0&&(ln(i,{code:Lr.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 f of a){let d=i.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new N6(i,d,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of c){let d=await f.key,p=await f.value;u.push({key:d,value:p,alwaysSet:f.alwaysSet})}return u}).then(u=>im.mergeObjectSync(n,u)):im.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Xn.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:Xn.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:eo.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 Js.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 Js.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Zq(this)}partial(e){let r={};for(let n of Js.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 Js.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof B6;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return eBt(Js.objectKeys(this.shape))}};k1.create=(t,e)=>new k1({shape:()=>t,unknownKeys:"strip",catchall:m5.create(),typeName:eo.ZodObject,...Xo(e)});k1.strictCreate=(t,e)=>new k1({shape:()=>t,unknownKeys:"strict",catchall:m5.create(),typeName:eo.ZodObject,...Xo(e)});k1.lazycreate=(t,e)=>new k1({shape:t,unknownKeys:"strip",catchall:m5.create(),typeName:eo.ZodObject,...Xo(e)});SN=class extends hs{_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 M1(a.ctx.common.issues));return ln(r,{code:Lr.invalid_union,unionErrors:s}),ji}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},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,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 M1(c));return ln(r,{code:Lr.invalid_union,unionErrors:a}),ji}}get options(){return this._def.options}};SN.create=(t,e)=>new SN({options:t,typeName:eo.ZodUnion,...Xo(e)});R7=t=>t instanceof TN?R7(t.schema):t instanceof O6?R7(t.innerType()):t instanceof DN?[t.value]:t instanceof IN?t.options:t instanceof RN?Js.objectValues(t.enum):t instanceof BN?R7(t._def.innerType):t instanceof _N?[void 0]:t instanceof wN?[null]:t instanceof B6?[void 0,...R7(t.unwrap())]:t instanceof e8?[null,...R7(t.unwrap())]:t instanceof UZ||t instanceof ON?R7(t.unwrap()):t instanceof NN?R7(t._def.innerType):[],B0e=class t extends hs{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.object)return ln(r,{code:Lr.invalid_type,expected:An.object,received:r.parsedType}),ji;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:Lr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ji)}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=R7(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:eo.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...Xo(n)})}};xN=class extends hs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(I0e(o)||I0e(s))return ji;let a=CPe(o.value,s.value);return a.valid?((R0e(o)||R0e(s))&&r.dirty(),{status:r.value,value:a.data}):(ln(n,{code:Lr.invalid_intersection_types}),ji)};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}))}};xN.create=(t,e,r)=>new xN({left:t,right:e,typeName:eo.ZodIntersection,...Xo(r)});Zb=class t extends hs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.array)return ln(n,{code:Lr.invalid_type,expected:An.array,received:n.parsedType}),ji;if(n.data.length<this._def.items.length)return ln(n,{code:Lr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ji;!this._def.rest&&n.data.length>this._def.items.length&&(ln(n,{code:Lr.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 N6(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>im.mergeArray(r,s)):im.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Zb.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zb({items:t,typeName:eo.ZodTuple,rest:null,...Xo(e)})};N0e=class t extends hs{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!==An.object)return ln(n,{code:Lr.invalid_type,expected:An.object,received:n.parsedType}),ji;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new N6(n,a,n.path,a)),value:s._parse(new N6(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?im.mergeObjectAsync(r,i):im.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof hs?new t({keyType:e,valueType:r,typeName:eo.ZodRecord,...Xo(n)}):new t({keyType:Tx.create(),valueType:e,typeName:eo.ZodRecord,...Xo(r)})}},rH=class extends hs{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!==An.map)return ln(n,{code:Lr.invalid_type,expected:An.map,received:n.parsedType}),ji;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new N6(n,a,n.path,[u,"key"])),value:o._parse(new N6(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,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return ji;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(u.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return ji;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(u.value,f.value)}return{status:r.value,value:a}}}};rH.create=(t,e,r)=>new rH({valueType:e,keyType:t,typeName:eo.ZodMap,...Xo(r)});nH=class t extends hs{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==An.set)return ln(n,{code:Lr.invalid_type,expected:An.set,received:n.parsedType}),ji;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ln(n,{code:Lr.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:Lr.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 f of c){if(f.status==="aborted")return ji;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new N6(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:Xn.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Xn.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};nH.create=(t,e)=>new nH({valueType:t,minSize:null,maxSize:null,typeName:eo.ZodSet,...Xo(e)});O0e=class t extends hs{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.function)return ln(r,{code:Lr.invalid_type,expected:An.function,received:r.parsedType}),ji;function n(a,c){return FZ({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Kq(),I7].filter(u=>!!u),issueData:{code:Lr.invalid_arguments,argumentsError:c}})}function i(a,c){return FZ({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Kq(),I7].filter(u=>!!u),issueData:{code:Lr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ix){let a=this;return e2(async function(...c){let u=new M1([]),f=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return e2(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new M1([n(c,u.error)]);let f=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(f,o);if(!d.success)throw new M1([i(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Zb.create(e).rest(B7.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||Zb.create([]).rest(B7.create()),returns:r||B7.create(),typeName:eo.ZodFunction,...Xo(n)})}},TN=class extends hs{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})}};TN.create=(t,e)=>new TN({getter:t,typeName:eo.ZodLazy,...Xo(e)});DN=class extends hs{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ln(r,{received:r.data,code:Lr.invalid_literal,expected:this._def.value}),ji}return{status:"valid",value:e.data}}get value(){return this._def.value}};DN.create=(t,e)=>new DN({value:t,typeName:eo.ZodLiteral,...Xo(e)});IN=class t extends hs{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return ln(r,{expected:Js.joinValues(n),received:r.parsedType,code:Lr.invalid_type}),ji}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:Lr.invalid_enum_value,options:n}),ji}return e2(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})}};IN.create=eBt;RN=class extends hs{_parse(e){let r=Js.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==An.string&&n.parsedType!==An.number){let i=Js.objectValues(r);return ln(n,{expected:Js.joinValues(i),received:n.parsedType,code:Lr.invalid_type}),ji}if(this._cache||(this._cache=new Set(Js.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Js.objectValues(r);return ln(n,{received:n.data,code:Lr.invalid_enum_value,options:i}),ji}return e2(e.data)}get enum(){return this._def.values}};RN.create=(t,e)=>new RN({values:t,typeName:eo.ZodNativeEnum,...Xo(e)});Ix=class extends hs{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==An.promise&&r.common.async===!1)return ln(r,{code:Lr.invalid_type,expected:An.promise,received:r.parsedType}),ji;let n=r.parsedType===An.promise?r.data:Promise.resolve(r.data);return e2(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ix.create=(t,e)=>new Ix({type:t,typeName:eo.ZodPromise,...Xo(e)});O6=class extends hs{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===eo.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 ji;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ji:c.status==="dirty"?yN(c.value):r.value==="dirty"?yN(c.value):c});{if(r.value==="aborted")return ji;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ji:a.status==="dirty"?yN(a.value):r.value==="dirty"?yN(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"?ji:(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"?ji:(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(!xx(s))return ji;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=>xx(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ji);Js.assertNever(i)}};O6.create=(t,e,r)=>new O6({schema:t,typeName:eo.ZodEffects,effect:e,...Xo(r)});O6.createWithPreprocess=(t,e,r)=>new O6({schema:e,effect:{type:"preprocess",transform:t},typeName:eo.ZodEffects,...Xo(r)});B6=class extends hs{_parse(e){return this._getType(e)===An.undefined?e2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};B6.create=(t,e)=>new B6({innerType:t,typeName:eo.ZodOptional,...Xo(e)});e8=class extends hs{_parse(e){return this._getType(e)===An.null?e2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e8.create=(t,e)=>new e8({innerType:t,typeName:eo.ZodNullable,...Xo(e)});BN=class extends hs{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===An.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};BN.create=(t,e)=>new BN({innerType:t,typeName:eo.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Xo(e)});NN=class extends hs{_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 Xq(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new M1(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new M1(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};NN.create=(t,e)=>new NN({innerType:t,typeName:eo.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Xo(e)});iH=class extends hs{_parse(e){if(this._getType(e)!==An.nan){let n=this._getOrReturnCtx(e);return ln(n,{code:Lr.invalid_type,expected:An.nan,received:n.parsedType}),ji}return{status:"valid",value:e.data}}};iH.create=t=>new iH({typeName:eo.ZodNaN,...Xo(t)});dSn=Symbol("zod_brand"),UZ=class extends hs{_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}},QZ=class t extends hs{_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"?ji:o.status==="dirty"?(r.dirty(),yN(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"?ji: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:eo.ZodPipeline})}},ON=class extends hs{_parse(e){let r=this._def.innerType._parse(e),n=i=>(xx(i)&&(i.value=Object.freeze(i.value)),i);return Xq(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};ON.create=(t,e)=>new ON({innerType:t,typeName:eo.ZodReadonly,...Xo(e)});pSn={object:k1.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"})(eo||(eo={}));hSn=(t,e={message:`Input not instance of ${t.name}`})=>tBt(r=>r instanceof t,e),rBt=Tx.create,nBt=EN.create,mSn=iH.create,gSn=vN.create,iBt=bN.create,ASn=CN.create,ySn=eH.create,ESn=_N.create,vSn=wN.create,bSn=Dx.create,CSn=B7.create,_Sn=m5.create,wSn=tH.create,SSn=N7.create,xSn=k1.create,TSn=k1.strictCreate,DSn=SN.create,ISn=B0e.create,RSn=xN.create,BSn=Zb.create,NSn=N0e.create,OSn=rH.create,MSn=nH.create,kSn=O0e.create,LSn=TN.create,PSn=DN.create,FSn=IN.create,USn=RN.create,QSn=Ix.create,qSn=O6.create,HSn=B6.create,GSn=e8.create,jSn=O6.createWithPreprocess,VSn=QZ.create,$Sn=()=>rBt().optional(),WSn=()=>nBt().optional(),YSn=()=>iBt().optional(),zSn={string:(t=>Tx.create({...t,coerce:!0})),number:(t=>EN.create({...t,coerce:!0})),boolean:(t=>bN.create({...t,coerce:!0})),bigint:(t=>vN.create({...t,coerce:!0})),date:(t=>CN.create({...t,coerce:!0}))},JSn=ji});var Oe={};B1(Oe,{BRAND:()=>dSn,DIRTY:()=>yN,EMPTY_PATH:()=>jwn,INVALID:()=>ji,NEVER:()=>JSn,OK:()=>e2,ParseStatus:()=>im,Schema:()=>hs,ZodAny:()=>Dx,ZodArray:()=>N7,ZodBigInt:()=>vN,ZodBoolean:()=>bN,ZodBranded:()=>UZ,ZodCatch:()=>NN,ZodDate:()=>CN,ZodDefault:()=>BN,ZodDiscriminatedUnion:()=>B0e,ZodEffects:()=>O6,ZodEnum:()=>IN,ZodError:()=>M1,ZodFirstPartyTypeKind:()=>eo,ZodFunction:()=>O0e,ZodIntersection:()=>xN,ZodIssueCode:()=>Lr,ZodLazy:()=>TN,ZodLiteral:()=>DN,ZodMap:()=>rH,ZodNaN:()=>iH,ZodNativeEnum:()=>RN,ZodNever:()=>m5,ZodNull:()=>wN,ZodNullable:()=>e8,ZodNumber:()=>EN,ZodObject:()=>k1,ZodOptional:()=>B6,ZodParsedType:()=>An,ZodPipeline:()=>QZ,ZodPromise:()=>Ix,ZodReadonly:()=>ON,ZodRecord:()=>N0e,ZodSchema:()=>hs,ZodSet:()=>nH,ZodString:()=>Tx,ZodSymbol:()=>eH,ZodTransformer:()=>O6,ZodTuple:()=>Zb,ZodType:()=>hs,ZodUndefined:()=>_N,ZodUnion:()=>SN,ZodUnknown:()=>B7,ZodVoid:()=>tH,addIssueToContext:()=>ln,any:()=>bSn,array:()=>SSn,bigint:()=>gSn,boolean:()=>iBt,coerce:()=>zSn,custom:()=>tBt,date:()=>ASn,datetimeRegex:()=>ZRt,defaultErrorMap:()=>I7,discriminatedUnion:()=>ISn,effect:()=>qSn,enum:()=>FSn,function:()=>kSn,getErrorMap:()=>Kq,getParsedType:()=>Xb,instanceof:()=>hSn,intersection:()=>RSn,isAborted:()=>I0e,isAsync:()=>Xq,isDirty:()=>R0e,isValid:()=>xx,late:()=>pSn,lazy:()=>LSn,literal:()=>PSn,makeIssue:()=>FZ,map:()=>OSn,nan:()=>mSn,nativeEnum:()=>USn,never:()=>_Sn,null:()=>vSn,nullable:()=>GSn,number:()=>nBt,object:()=>xSn,objectUtil:()=>yPe,oboolean:()=>YSn,onumber:()=>WSn,optional:()=>HSn,ostring:()=>$Sn,pipeline:()=>VSn,preprocess:()=>jSn,promise:()=>QSn,quotelessJson:()=>qwn,record:()=>NSn,set:()=>MSn,setErrorMap:()=>Gwn,strictObject:()=>TSn,string:()=>rBt,symbol:()=>ySn,transformer:()=>qSn,tuple:()=>BSn,undefined:()=>ESn,union:()=>DSn,unknown:()=>CSn,util:()=>Js,void:()=>wSn});var _Pe=Ie(()=>{D0e();vPe();WRt();PZ();oBt();T0e()});var qZ=Ie(()=>{_Pe();_Pe()});var oH,sBt,M0e,aBt,lBt,KSn,L6,L1,HZ,t8,P6,k0e,cBt,L0e,uBt,fBt,dBt,GZ,M6,pBt,hBt,Rx,MN,P0e,jZ,mBt,XSn,ZSn,exn,wPe,gBt,ABt,F0e,txn,U0e,Q0e,q0e,yBt,EBt,SPe,vBt,bBt,rxn,nxn,xPe,ixn,TPe,oxn,DPe,sxn,axn,lxn,cxn,uxn,fxn,dxn,VZ,pxn,IPe,RPe,BPe,hxn,mxn,CBt,gxn,$Z,Axn,yxn,Exn,vxn,NPe,H0e,INo,bxn,Cxn,_Bt,_xn,wxn,Sxn,xxn,Txn,Dxn,Ixn,Rxn,Bxn,Nxn,Oxn,Mxn,kxn,Lxn,Pxn,Fxn,Uxn,OPe,Qxn,G0e,qxn,Hxn,RNo,BNo,NNo,ONo,MNo,kNo,k6,Bx=Ie(()=>{qZ();oH="2025-06-18",sBt=[oH,"2025-03-26","2024-11-05","2024-10-07"],M0e="2.0",aBt=Oe.union([Oe.string(),Oe.number().int()]),lBt=Oe.string(),KSn=Oe.object({progressToken:Oe.optional(aBt)}).passthrough(),L6=Oe.object({_meta:Oe.optional(KSn)}).passthrough(),L1=Oe.object({method:Oe.string(),params:Oe.optional(L6)}),HZ=Oe.object({_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),t8=Oe.object({method:Oe.string(),params:Oe.optional(HZ)}),P6=Oe.object({_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),k0e=Oe.union([Oe.string(),Oe.number().int()]),cBt=Oe.object({jsonrpc:Oe.literal(M0e),id:k0e}).merge(L1).strict(),L0e=t=>cBt.safeParse(t).success,uBt=Oe.object({jsonrpc:Oe.literal(M0e)}).merge(t8).strict(),fBt=t=>uBt.safeParse(t).success,dBt=Oe.object({jsonrpc:Oe.literal(M0e),id:k0e,result:P6}).strict(),GZ=t=>dBt.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"})(M6||(M6={}));pBt=Oe.object({jsonrpc:Oe.literal(M0e),id:k0e,error:Oe.object({code:Oe.number().int(),message:Oe.string(),data:Oe.optional(Oe.unknown())})}).strict(),hBt=t=>pBt.safeParse(t).success,Rx=Oe.union([cBt,uBt,dBt,pBt]),MN=P6.strict(),P0e=t8.extend({method:Oe.literal("notifications/cancelled"),params:HZ.extend({requestId:k0e,reason:Oe.string().optional()})}),jZ=Oe.object({name:Oe.string(),title:Oe.optional(Oe.string())}).passthrough(),mBt=jZ.extend({version:Oe.string()}),XSn=Oe.object({experimental:Oe.optional(Oe.object({}).passthrough()),sampling:Oe.optional(Oe.object({}).passthrough()),elicitation:Oe.optional(Oe.object({}).passthrough()),roots:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough())}).passthrough(),ZSn=L1.extend({method:Oe.literal("initialize"),params:L6.extend({protocolVersion:Oe.string(),capabilities:XSn,clientInfo:mBt})}),exn=Oe.object({experimental:Oe.optional(Oe.object({}).passthrough()),logging:Oe.optional(Oe.object({}).passthrough()),completions:Oe.optional(Oe.object({}).passthrough()),prompts:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough()),resources:Oe.optional(Oe.object({subscribe:Oe.optional(Oe.boolean()),listChanged:Oe.optional(Oe.boolean())}).passthrough()),tools:Oe.optional(Oe.object({listChanged:Oe.optional(Oe.boolean())}).passthrough())}).passthrough(),wPe=P6.extend({protocolVersion:Oe.string(),capabilities:exn,serverInfo:mBt,instructions:Oe.optional(Oe.string())}),gBt=t8.extend({method:Oe.literal("notifications/initialized")}),ABt=t=>gBt.safeParse(t).success,F0e=L1.extend({method:Oe.literal("ping")}),txn=Oe.object({progress:Oe.number(),total:Oe.optional(Oe.number()),message:Oe.optional(Oe.string())}).passthrough(),U0e=t8.extend({method:Oe.literal("notifications/progress"),params:HZ.merge(txn).extend({progressToken:aBt})}),Q0e=L1.extend({params:L6.extend({cursor:Oe.optional(lBt)}).optional()}),q0e=P6.extend({nextCursor:Oe.optional(lBt)}),yBt=Oe.object({uri:Oe.string(),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),EBt=yBt.extend({text:Oe.string()}),SPe=Oe.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),vBt=yBt.extend({blob:SPe}),bBt=jZ.extend({uri:Oe.string(),description:Oe.optional(Oe.string()),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}),rxn=jZ.extend({uriTemplate:Oe.string(),description:Oe.optional(Oe.string()),mimeType:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}),nxn=Q0e.extend({method:Oe.literal("resources/list")}),xPe=q0e.extend({resources:Oe.array(bBt)}),ixn=Q0e.extend({method:Oe.literal("resources/templates/list")}),TPe=q0e.extend({resourceTemplates:Oe.array(rxn)}),oxn=L1.extend({method:Oe.literal("resources/read"),params:L6.extend({uri:Oe.string()})}),DPe=P6.extend({contents:Oe.array(Oe.union([EBt,vBt]))}),sxn=t8.extend({method:Oe.literal("notifications/resources/list_changed")}),axn=L1.extend({method:Oe.literal("resources/subscribe"),params:L6.extend({uri:Oe.string()})}),lxn=L1.extend({method:Oe.literal("resources/unsubscribe"),params:L6.extend({uri:Oe.string()})}),cxn=t8.extend({method:Oe.literal("notifications/resources/updated"),params:HZ.extend({uri:Oe.string()})}),uxn=Oe.object({name:Oe.string(),description:Oe.optional(Oe.string()),required:Oe.optional(Oe.boolean())}).passthrough(),fxn=jZ.extend({description:Oe.optional(Oe.string()),arguments:Oe.optional(Oe.array(uxn)),_meta:Oe.optional(Oe.object({}).passthrough())}),dxn=Q0e.extend({method:Oe.literal("prompts/list")}),VZ=q0e.extend({prompts:Oe.array(fxn)}),pxn=L1.extend({method:Oe.literal("prompts/get"),params:L6.extend({name:Oe.string(),arguments:Oe.optional(Oe.record(Oe.string()))})}),IPe=Oe.object({type:Oe.literal("text"),text:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),RPe=Oe.object({type:Oe.literal("image"),data:SPe,mimeType:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),BPe=Oe.object({type:Oe.literal("audio"),data:SPe,mimeType:Oe.string(),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),hxn=Oe.object({type:Oe.literal("resource"),resource:Oe.union([EBt,vBt]),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),mxn=bBt.extend({type:Oe.literal("resource_link")}),CBt=Oe.union([IPe,RPe,BPe,mxn,hxn]),gxn=Oe.object({role:Oe.enum(["user","assistant"]),content:CBt}).passthrough(),$Z=P6.extend({description:Oe.optional(Oe.string()),messages:Oe.array(gxn)}),Axn=t8.extend({method:Oe.literal("notifications/prompts/list_changed")}),yxn=Oe.object({title:Oe.optional(Oe.string()),readOnlyHint:Oe.optional(Oe.boolean()),destructiveHint:Oe.optional(Oe.boolean()),idempotentHint:Oe.optional(Oe.boolean()),openWorldHint:Oe.optional(Oe.boolean())}).passthrough(),Exn=jZ.extend({description:Oe.optional(Oe.string()),inputSchema:Oe.object({type:Oe.literal("object"),properties:Oe.optional(Oe.object({}).passthrough()),required:Oe.optional(Oe.array(Oe.string()))}).passthrough(),outputSchema:Oe.optional(Oe.object({type:Oe.literal("object"),properties:Oe.optional(Oe.object({}).passthrough()),required:Oe.optional(Oe.array(Oe.string()))}).passthrough()),annotations:Oe.optional(yxn),_meta:Oe.optional(Oe.object({}).passthrough())}),vxn=Q0e.extend({method:Oe.literal("tools/list")}),NPe=q0e.extend({tools:Oe.array(Exn)}),H0e=P6.extend({content:Oe.array(CBt).default([]),structuredContent:Oe.object({}).passthrough().optional(),isError:Oe.optional(Oe.boolean())}),INo=H0e.or(P6.extend({toolResult:Oe.unknown()})),bxn=L1.extend({method:Oe.literal("tools/call"),params:L6.extend({name:Oe.string(),arguments:Oe.optional(Oe.record(Oe.unknown()))})}),Cxn=t8.extend({method:Oe.literal("notifications/tools/list_changed")}),_Bt=Oe.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_xn=L1.extend({method:Oe.literal("logging/setLevel"),params:L6.extend({level:_Bt})}),wxn=t8.extend({method:Oe.literal("notifications/message"),params:HZ.extend({level:_Bt,logger:Oe.optional(Oe.string()),data:Oe.unknown()})}),Sxn=Oe.object({name:Oe.string().optional()}).passthrough(),xxn=Oe.object({hints:Oe.optional(Oe.array(Sxn)),costPriority:Oe.optional(Oe.number().min(0).max(1)),speedPriority:Oe.optional(Oe.number().min(0).max(1)),intelligencePriority:Oe.optional(Oe.number().min(0).max(1))}).passthrough(),Txn=Oe.object({role:Oe.enum(["user","assistant"]),content:Oe.union([IPe,RPe,BPe])}).passthrough(),Dxn=L1.extend({method:Oe.literal("sampling/createMessage"),params:L6.extend({messages:Oe.array(Txn),systemPrompt:Oe.optional(Oe.string()),includeContext:Oe.optional(Oe.enum(["none","thisServer","allServers"])),temperature:Oe.optional(Oe.number()),maxTokens:Oe.number().int(),stopSequences:Oe.optional(Oe.array(Oe.string())),metadata:Oe.optional(Oe.object({}).passthrough()),modelPreferences:Oe.optional(xxn)})}),Ixn=P6.extend({model:Oe.string(),stopReason:Oe.optional(Oe.enum(["endTurn","stopSequence","maxTokens"]).or(Oe.string())),role:Oe.enum(["user","assistant"]),content:Oe.discriminatedUnion("type",[IPe,RPe,BPe])}),Rxn=Oe.object({type:Oe.literal("boolean"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),default:Oe.optional(Oe.boolean())}).passthrough(),Bxn=Oe.object({type:Oe.literal("string"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),minLength:Oe.optional(Oe.number()),maxLength:Oe.optional(Oe.number()),format:Oe.optional(Oe.enum(["email","uri","date","date-time"]))}).passthrough(),Nxn=Oe.object({type:Oe.enum(["number","integer"]),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),minimum:Oe.optional(Oe.number()),maximum:Oe.optional(Oe.number())}).passthrough(),Oxn=Oe.object({type:Oe.literal("string"),title:Oe.optional(Oe.string()),description:Oe.optional(Oe.string()),enum:Oe.array(Oe.string()),enumNames:Oe.optional(Oe.array(Oe.string()))}).passthrough(),Mxn=Oe.union([Rxn,Bxn,Nxn,Oxn]),kxn=L1.extend({method:Oe.literal("elicitation/create"),params:L6.extend({message:Oe.string(),requestedSchema:Oe.object({type:Oe.literal("object"),properties:Oe.record(Oe.string(),Mxn),required:Oe.optional(Oe.array(Oe.string()))}).passthrough()})}),Lxn=P6.extend({action:Oe.enum(["accept","decline","cancel"]),content:Oe.optional(Oe.record(Oe.string(),Oe.unknown()))}),Pxn=Oe.object({type:Oe.literal("ref/resource"),uri:Oe.string()}).passthrough(),Fxn=Oe.object({type:Oe.literal("ref/prompt"),name:Oe.string()}).passthrough(),Uxn=L1.extend({method:Oe.literal("completion/complete"),params:L6.extend({ref:Oe.union([Fxn,Pxn]),argument:Oe.object({name:Oe.string(),value:Oe.string()}).passthrough(),context:Oe.optional(Oe.object({arguments:Oe.optional(Oe.record(Oe.string(),Oe.string()))}))})}),OPe=P6.extend({completion:Oe.object({values:Oe.array(Oe.string()).max(100),total:Oe.optional(Oe.number().int()),hasMore:Oe.optional(Oe.boolean())}).passthrough()}),Qxn=Oe.object({uri:Oe.string().startsWith("file://"),name:Oe.optional(Oe.string()),_meta:Oe.optional(Oe.object({}).passthrough())}).passthrough(),G0e=L1.extend({method:Oe.literal("roots/list")}),qxn=P6.extend({roots:Oe.array(Qxn)}),Hxn=t8.extend({method:Oe.literal("notifications/roots/list_changed")}),RNo=Oe.union([F0e,ZSn,Uxn,_xn,pxn,dxn,nxn,ixn,oxn,axn,lxn,bxn,vxn]),BNo=Oe.union([P0e,U0e,gBt,Hxn]),NNo=Oe.union([MN,Ixn,Lxn,qxn]),ONo=Oe.union([F0e,Dxn,kxn,G0e]),MNo=Oe.union([P0e,U0e,wxn,cxn,sxn,Cxn,Axn]),kNo=Oe.union([MN,wPe,OPe,$Z,VZ,xPe,TPe,DPe,H0e,NPe]),k6=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}}});function wBt(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 Gxn,j0e,SBt=Ie(()=>{Bx();Gxn=6e4,j0e=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(P0e,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(U0e,r=>{this._onprogress(r)}),this.setRequestHandler(F0e,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 k6(M6.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),GZ(c)||hBt(c)?this._onresponse(c):L0e(c)?this._onrequest(c,u):fBt(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 k6(M6.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:M6.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,f,d)=>this.request(u,f,{...d,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 f;if(!a.signal.aborted)return s?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:M6.InternalError,message:(f=u.message)!==null&&f!==void 0?f:"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),GZ(e))n(e);else{let i=new k6(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,f,d,p,h,g;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),(f=n?.signal)===null||f===void 0||f.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:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:A}});let v=T=>{var N;this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),(N=this._transport)===null||N===void 0||N.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:A,reason:String(T)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`))),c(T)};this._responseHandlers.set(A,T=>{var N;if(!(!((N=n?.signal)===null||N===void 0)&&N.aborted)){if(T instanceof Error)return c(T);try{let P=r.parse(T.result);a(P)}catch(P){c(P)}}}),(p=n?.signal)===null||p===void 0||p.addEventListener("abort",()=>{var T;v((T=n?.signal)===null||T===void 0?void 0:T.reason)});let w=(h=n?.timeout)!==null&&h!==void 0?h:Gxn,S=()=>v(new k6(M6.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(A,w,n?.maxTotalTimeout,S,(g=n?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:s}).catch(T=>{this._cleanupTimeout(A),c(T)})})}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(f=>this._onerror(f))});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 TBt=B((V0e,xBt)=>{(function(t,e){typeof V0e=="object"&&typeof xBt<"u"?e(V0e):typeof define=="function"&&define.amd?define(["exports"],e):e(t.URI=t.URI||{})})(V0e,(function(t){"use strict";function e(){for(var at=arguments.length,Je=Array(at),dt=0;dt<at;dt++)Je[dt]=arguments[dt];if(Je.length>1){Je[0]=Je[0].slice(0,-1);for(var xt=Je.length-1,mt=1;mt<xt;++mt)Je[mt]=Je[mt].slice(1,-1);return Je[xt]=Je[xt].slice(1),Je.join("")}else return Je[0]}function r(at){return"(?:"+at+")"}function n(at){return at===void 0?"undefined":at===null?"null":Object.prototype.toString.call(at).split(" ").pop().split("]").shift().toLowerCase()}function i(at){return at.toUpperCase()}function o(at){return at!=null?at instanceof Array?at:typeof at.length!="number"||at.split||at.setInterval||at.call?[at]:Array.prototype.slice.call(at):[]}function s(at,Je){var dt=at;if(Je)for(var xt in Je)dt[xt]=Je[xt];return dt}function a(at){var Je="[A-Za-z]",dt="[\\x0D]",xt="[0-9]",mt="[\\x22]",Ar=e(xt,"[A-Fa-f]"),Ir="[\\x0A]",zr="[\\x20]",an=r(r("%[EFef]"+Ar+"%"+Ar+Ar+"%"+Ar+Ar)+"|"+r("%[89A-Fa-f]"+Ar+"%"+Ar+Ar)+"|"+r("%"+Ar+Ar)),En="[\\:\\/\\?\\#\\[\\]\\@]",Vn="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Pi=e(En,Vn),Hi=at?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",bn=at?"[\\uE000-\\uF8FF]":"[]",Si=e(Je,xt,"[\\-\\.\\_\\~]",Hi),xi=r(Je+e(Je,xt,"[\\+\\-\\.]")+"*"),Ji=r(r(an+"|"+e(Si,Vn,"[\\:]"))+"*"),Jl=r(r("25[0-5]")+"|"+r("2[0-4]"+xt)+"|"+r("1"+xt+xt)+"|"+r("[1-9]"+xt)+"|"+xt),Gs=r(r("25[0-5]")+"|"+r("2[0-4]"+xt)+"|"+r("1"+xt+xt)+"|"+r("0?[1-9]"+xt)+"|0?0?"+xt),js=r(Gs+"\\."+Gs+"\\."+Gs+"\\."+Gs),Oi=r(Ar+"{1,4}"),Kl=r(r(Oi+"\\:"+Oi)+"|"+js),Uo=r(r(Oi+"\\:")+"{6}"+Kl),xn=r("\\:\\:"+r(Oi+"\\:")+"{5}"+Kl),$c=r(r(Oi)+"?\\:\\:"+r(Oi+"\\:")+"{4}"+Kl),La=r(r(r(Oi+"\\:")+"{0,1}"+Oi)+"?\\:\\:"+r(Oi+"\\:")+"{3}"+Kl),Oo=r(r(r(Oi+"\\:")+"{0,2}"+Oi)+"?\\:\\:"+r(Oi+"\\:")+"{2}"+Kl),Wc=r(r(r(Oi+"\\:")+"{0,3}"+Oi)+"?\\:\\:"+Oi+"\\:"+Kl),va=r(r(r(Oi+"\\:")+"{0,4}"+Oi)+"?\\:\\:"+Kl),ws=r(r(r(Oi+"\\:")+"{0,5}"+Oi)+"?\\:\\:"+Oi),Al=r(r(r(Oi+"\\:")+"{0,6}"+Oi)+"?\\:\\:"),je=r([Uo,xn,$c,La,Oo,Wc,va,ws,Al].join("|")),$e=r(r(Si+"|"+an)+"+"),At=r(je+"\\%25"+$e),St=r(je+r("\\%25|\\%(?!"+Ar+"{2})")+$e),Mt=r("[vV]"+Ar+"+\\."+e(Si,Vn,"[\\:]")+"+"),tr=r("\\["+r(St+"|"+je+"|"+Mt)+"\\]"),yr=r(r(an+"|"+e(Si,Vn))+"*"),ur=r(tr+"|"+js+"(?!"+yr+")|"+yr),wr=r(xt+"*"),Sr=r(r(Ji+"@")+"?"+ur+r("\\:"+wr)+"?"),Mr=r(an+"|"+e(Si,Vn,"[\\:\\@]")),Cn=r(Mr+"*"),fo=r(Mr+"+"),Ss=r(r(an+"|"+e(Si,Vn,"[\\@]"))+"+"),Ti=r(r("\\/"+Cn)+"*"),nl=r("\\/"+r(fo+Ti)+"?"),Pa=r(Ss+Ti),kf=r(fo+Ti),Xl="(?!"+Mr+")",Ch=r(Ti+"|"+nl+"|"+Pa+"|"+kf+"|"+Xl),np=r(r(Mr+"|"+e("[\\/\\?]",bn))+"*"),Zl=r(r(Mr+"|[\\/\\?]")+"*"),P0=r(r("\\/\\/"+Sr+Ti)+"|"+nl+"|"+kf+"|"+Xl),F0=r(xi+"\\:"+P0+r("\\?"+np)+"?"+r("\\#"+Zl)+"?"),ip=r(r("\\/\\/"+Sr+Ti)+"|"+nl+"|"+Pa+"|"+Xl),Nc=r(ip+r("\\?"+np)+"?"+r("\\#"+Zl)+"?"),Up=r(F0+"|"+Nc),Lf=r(xi+"\\:"+P0+r("\\?"+np)+"?"),df="^("+xi+")\\:"+r(r("\\/\\/("+r("("+Ji+")@")+"?("+ur+")"+r("\\:("+wr+")")+"?)")+"?("+Ti+"|"+nl+"|"+kf+"|"+Xl+")")+r("\\?("+np+")")+"?"+r("\\#("+Zl+")")+"?$",Qp="^(){0}"+r(r("\\/\\/("+r("("+Ji+")@")+"?("+ur+")"+r("\\:("+wr+")")+"?)")+"?("+Ti+"|"+nl+"|"+Pa+"|"+Xl+")")+r("\\?("+np+")")+"?"+r("\\#("+Zl+")")+"?$",U0="^("+xi+")\\:"+r(r("\\/\\/("+r("("+Ji+")@")+"?("+ur+")"+r("\\:("+wr+")")+"?)")+"?("+Ti+"|"+nl+"|"+kf+"|"+Xl+")")+r("\\?("+np+")")+"?$",uu="^"+r("\\#("+Zl+")")+"?$",J2="^"+r("("+Ji+")@")+"?("+ur+")"+r("\\:("+wr+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",Je,xt,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",Si,Vn),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",Si,Vn),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",Si,Vn),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",Si,Vn),"g"),NOT_QUERY:new RegExp(e("[^\\%]",Si,Vn,"[\\:\\@\\/\\?]",bn),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",Si,Vn,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",Si,Vn),"g"),UNRESERVED:new RegExp(Si,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",Si,Pi),"g"),PCT_ENCODED:new RegExp(an,"g"),IPV4ADDRESS:new RegExp("^("+js+")$"),IPV6ADDRESS:new RegExp("^\\[?("+je+")"+r(r("\\%25|\\%(?!"+Ar+"{2})")+"("+$e+")")+"?\\]?$")}}var c=a(!1),u=a(!0),f=(function(){function at(Je,dt){var xt=[],mt=!0,Ar=!1,Ir=void 0;try{for(var zr=Je[Symbol.iterator](),an;!(mt=(an=zr.next()).done)&&(xt.push(an.value),!(dt&&xt.length===dt));mt=!0);}catch(En){Ar=!0,Ir=En}finally{try{!mt&&zr.return&&zr.return()}finally{if(Ar)throw Ir}}return xt}return function(Je,dt){if(Array.isArray(Je))return Je;if(Symbol.iterator in Object(Je))return at(Je,dt);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),d=function(at){if(Array.isArray(at)){for(var Je=0,dt=Array(at.length);Je<at.length;Je++)dt[Je]=at[Je];return dt}else return Array.from(at)},p=2147483647,h=36,g=1,A=26,y=38,v=700,w=72,S=128,T="-",N=/^xn--/,P=/[^\0-\x7E]/,U=/[\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-g,F=Math.floor,O=String.fromCharCode;function q(at){throw new RangeError(Q[at])}function L(at,Je){for(var dt=[],xt=at.length;xt--;)dt[xt]=Je(at[xt]);return dt}function M(at,Je){var dt=at.split("@"),xt="";dt.length>1&&(xt=dt[0]+"@",at=dt[1]),at=at.replace(U,".");var mt=at.split("."),Ar=L(mt,Je).join(".");return xt+Ar}function j(at){for(var Je=[],dt=0,xt=at.length;dt<xt;){var mt=at.charCodeAt(dt++);if(mt>=55296&&mt<=56319&&dt<xt){var Ar=at.charCodeAt(dt++);(Ar&64512)==56320?Je.push(((mt&1023)<<10)+(Ar&1023)+65536):(Je.push(mt),dt--)}else Je.push(mt)}return Je}var G=function(Je){return String.fromCodePoint.apply(String,d(Je))},W=function(Je){return Je-48<10?Je-22:Je-65<26?Je-65:Je-97<26?Je-97:h},V=function(Je,dt){return Je+22+75*(Je<26)-((dt!=0)<<5)},ee=function(Je,dt,xt){var mt=0;for(Je=xt?F(Je/v):Je>>1,Je+=F(Je/dt);Je>D*A>>1;mt+=h)Je=F(Je/D);return F(mt+(D+1)*Je/(Je+y))},J=function(Je){var dt=[],xt=Je.length,mt=0,Ar=S,Ir=w,zr=Je.lastIndexOf(T);zr<0&&(zr=0);for(var an=0;an<zr;++an)Je.charCodeAt(an)>=128&&q("not-basic"),dt.push(Je.charCodeAt(an));for(var En=zr>0?zr+1:0;En<xt;){for(var Vn=mt,Pi=1,Hi=h;;Hi+=h){En>=xt&&q("invalid-input");var bn=W(Je.charCodeAt(En++));(bn>=h||bn>F((p-mt)/Pi))&&q("overflow"),mt+=bn*Pi;var Si=Hi<=Ir?g:Hi>=Ir+A?A:Hi-Ir;if(bn<Si)break;var xi=h-Si;Pi>F(p/xi)&&q("overflow"),Pi*=xi}var Ji=dt.length+1;Ir=ee(mt-Vn,Ji,Vn==0),F(mt/Ji)>p-Ar&&q("overflow"),Ar+=F(mt/Ji),mt%=Ji,dt.splice(mt++,0,Ar)}return String.fromCodePoint.apply(String,dt)},he=function(Je){var dt=[];Je=j(Je);var xt=Je.length,mt=S,Ar=0,Ir=w,zr=!0,an=!1,En=void 0;try{for(var Vn=Je[Symbol.iterator](),Pi;!(zr=(Pi=Vn.next()).done);zr=!0){var Hi=Pi.value;Hi<128&&dt.push(O(Hi))}}catch(St){an=!0,En=St}finally{try{!zr&&Vn.return&&Vn.return()}finally{if(an)throw En}}var bn=dt.length,Si=bn;for(bn&&dt.push(T);Si<xt;){var xi=p,Ji=!0,Jl=!1,Gs=void 0;try{for(var js=Je[Symbol.iterator](),Oi;!(Ji=(Oi=js.next()).done);Ji=!0){var Kl=Oi.value;Kl>=mt&&Kl<xi&&(xi=Kl)}}catch(St){Jl=!0,Gs=St}finally{try{!Ji&&js.return&&js.return()}finally{if(Jl)throw Gs}}var Uo=Si+1;xi-mt>F((p-Ar)/Uo)&&q("overflow"),Ar+=(xi-mt)*Uo,mt=xi;var xn=!0,$c=!1,La=void 0;try{for(var Oo=Je[Symbol.iterator](),Wc;!(xn=(Wc=Oo.next()).done);xn=!0){var va=Wc.value;if(va<mt&&++Ar>p&&q("overflow"),va==mt){for(var ws=Ar,Al=h;;Al+=h){var je=Al<=Ir?g:Al>=Ir+A?A:Al-Ir;if(ws<je)break;var $e=ws-je,At=h-je;dt.push(O(V(je+$e%At,0))),ws=F($e/At)}dt.push(O(V(ws,0))),Ir=ee(Ar,Uo,Si==bn),Ar=0,++Si}}}catch(St){$c=!0,La=St}finally{try{!xn&&Oo.return&&Oo.return()}finally{if($c)throw La}}++Ar,++mt}return dt.join("")},be=function(Je){return M(Je,function(dt){return N.test(dt)?J(dt.slice(4).toLowerCase()):dt})},ge=function(Je){return M(Je,function(dt){return P.test(dt)?"xn--"+he(dt):dt})},_e={version:"2.1.0",ucs2:{decode:j,encode:G},decode:J,encode:he,toASCII:ge,toUnicode:be},we={};function oe(at){var Je=at.charCodeAt(0),dt=void 0;return Je<16?dt="%0"+Je.toString(16).toUpperCase():Je<128?dt="%"+Je.toString(16).toUpperCase():Je<2048?dt="%"+(Je>>6|192).toString(16).toUpperCase()+"%"+(Je&63|128).toString(16).toUpperCase():dt="%"+(Je>>12|224).toString(16).toUpperCase()+"%"+(Je>>6&63|128).toString(16).toUpperCase()+"%"+(Je&63|128).toString(16).toUpperCase(),dt}function Ae(at){for(var Je="",dt=0,xt=at.length;dt<xt;){var mt=parseInt(at.substr(dt+1,2),16);if(mt<128)Je+=String.fromCharCode(mt),dt+=3;else if(mt>=194&&mt<224){if(xt-dt>=6){var Ar=parseInt(at.substr(dt+4,2),16);Je+=String.fromCharCode((mt&31)<<6|Ar&63)}else Je+=at.substr(dt,6);dt+=6}else if(mt>=224){if(xt-dt>=9){var Ir=parseInt(at.substr(dt+4,2),16),zr=parseInt(at.substr(dt+7,2),16);Je+=String.fromCharCode((mt&15)<<12|(Ir&63)<<6|zr&63)}else Je+=at.substr(dt,9);dt+=9}else Je+=at.substr(dt,3),dt+=3}return Je}function pe(at,Je){function dt(xt){var mt=Ae(xt);return mt.match(Je.UNRESERVED)?mt:xt}return at.scheme&&(at.scheme=String(at.scheme).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_SCHEME,"")),at.userinfo!==void 0&&(at.userinfo=String(at.userinfo).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_USERINFO,oe).replace(Je.PCT_ENCODED,i)),at.host!==void 0&&(at.host=String(at.host).replace(Je.PCT_ENCODED,dt).toLowerCase().replace(Je.NOT_HOST,oe).replace(Je.PCT_ENCODED,i)),at.path!==void 0&&(at.path=String(at.path).replace(Je.PCT_ENCODED,dt).replace(at.scheme?Je.NOT_PATH:Je.NOT_PATH_NOSCHEME,oe).replace(Je.PCT_ENCODED,i)),at.query!==void 0&&(at.query=String(at.query).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_QUERY,oe).replace(Je.PCT_ENCODED,i)),at.fragment!==void 0&&(at.fragment=String(at.fragment).replace(Je.PCT_ENCODED,dt).replace(Je.NOT_FRAGMENT,oe).replace(Je.PCT_ENCODED,i)),at}function ie(at){return at.replace(/^0*(.*)/,"$1")||"0"}function de(at,Je){var dt=at.match(Je.IPV4ADDRESS)||[],xt=f(dt,2),mt=xt[1];return mt?mt.split(".").map(ie).join("."):at}function X(at,Je){var dt=at.match(Je.IPV6ADDRESS)||[],xt=f(dt,3),mt=xt[1],Ar=xt[2];if(mt){for(var Ir=mt.toLowerCase().split("::").reverse(),zr=f(Ir,2),an=zr[0],En=zr[1],Vn=En?En.split(":").map(ie):[],Pi=an.split(":").map(ie),Hi=Je.IPV4ADDRESS.test(Pi[Pi.length-1]),bn=Hi?7:8,Si=Pi.length-bn,xi=Array(bn),Ji=0;Ji<bn;++Ji)xi[Ji]=Vn[Ji]||Pi[Si+Ji]||"";Hi&&(xi[bn-1]=de(xi[bn-1],Je));var Jl=xi.reduce(function(Uo,xn,$c){if(!xn||xn==="0"){var La=Uo[Uo.length-1];La&&La.index+La.length===$c?La.length++:Uo.push({index:$c,length:1})}return Uo},[]),Gs=Jl.sort(function(Uo,xn){return xn.length-Uo.length})[0],js=void 0;if(Gs&&Gs.length>1){var Oi=xi.slice(0,Gs.index),Kl=xi.slice(Gs.index+Gs.length);js=Oi.join(":")+"::"+Kl.join(":")}else js=xi.join(":");return Ar&&(js+="%"+Ar),js}else return at}var ce=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,me="".match(/(){0}/)[1]===void 0;function ue(at){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt={},xt=Je.iri!==!1?u:c;Je.reference==="suffix"&&(at=(Je.scheme?Je.scheme+":":"")+"//"+at);var mt=at.match(ce);if(mt){me?(dt.scheme=mt[1],dt.userinfo=mt[3],dt.host=mt[4],dt.port=parseInt(mt[5],10),dt.path=mt[6]||"",dt.query=mt[7],dt.fragment=mt[8],isNaN(dt.port)&&(dt.port=mt[5])):(dt.scheme=mt[1]||void 0,dt.userinfo=at.indexOf("@")!==-1?mt[3]:void 0,dt.host=at.indexOf("//")!==-1?mt[4]:void 0,dt.port=parseInt(mt[5],10),dt.path=mt[6]||"",dt.query=at.indexOf("?")!==-1?mt[7]:void 0,dt.fragment=at.indexOf("#")!==-1?mt[8]:void 0,isNaN(dt.port)&&(dt.port=at.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?mt[4]:void 0)),dt.host&&(dt.host=X(de(dt.host,xt),xt)),dt.scheme===void 0&&dt.userinfo===void 0&&dt.host===void 0&&dt.port===void 0&&!dt.path&&dt.query===void 0?dt.reference="same-document":dt.scheme===void 0?dt.reference="relative":dt.fragment===void 0?dt.reference="absolute":dt.reference="uri",Je.reference&&Je.reference!=="suffix"&&Je.reference!==dt.reference&&(dt.error=dt.error||"URI is not a "+Je.reference+" reference.");var Ar=we[(Je.scheme||dt.scheme||"").toLowerCase()];if(!Je.unicodeSupport&&(!Ar||!Ar.unicodeSupport)){if(dt.host&&(Je.domainHost||Ar&&Ar.domainHost))try{dt.host=_e.toASCII(dt.host.replace(xt.PCT_ENCODED,Ae).toLowerCase())}catch(Ir){dt.error=dt.error||"Host's domain name can not be converted to ASCII via punycode: "+Ir}pe(dt,c)}else pe(dt,xt);Ar&&Ar.parse&&Ar.parse(dt,Je)}else dt.error=dt.error||"URI can not be parsed.";return dt}function K(at,Je){var dt=Je.iri!==!1?u:c,xt=[];return at.userinfo!==void 0&&(xt.push(at.userinfo),xt.push("@")),at.host!==void 0&&xt.push(X(de(String(at.host),dt),dt).replace(dt.IPV6ADDRESS,function(mt,Ar,Ir){return"["+Ar+(Ir?"%25"+Ir:"")+"]"})),(typeof at.port=="number"||typeof at.port=="string")&&(xt.push(":"),xt.push(String(at.port))),xt.length?xt.join(""):void 0}var re=/^\.\.?\//,xe=/^\/\.(\/|$)/,ye=/^\/\.\.(\/|$)/,te=/^\/?(?:.|\n)*?(?=\/|$)/;function Ne(at){for(var Je=[];at.length;)if(at.match(re))at=at.replace(re,"");else if(at.match(xe))at=at.replace(xe,"/");else if(at.match(ye))at=at.replace(ye,"/"),Je.pop();else if(at==="."||at==="..")at="";else{var dt=at.match(te);if(dt){var xt=dt[0];at=at.slice(xt.length),Je.push(xt)}else throw new Error("Unexpected dot segment condition")}return Je.join("")}function qe(at){var Je=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},dt=Je.iri?u:c,xt=[],mt=we[(Je.scheme||at.scheme||"").toLowerCase()];if(mt&&mt.serialize&&mt.serialize(at,Je),at.host&&!dt.IPV6ADDRESS.test(at.host)){if(Je.domainHost||mt&&mt.domainHost)try{at.host=Je.iri?_e.toUnicode(at.host):_e.toASCII(at.host.replace(dt.PCT_ENCODED,Ae).toLowerCase())}catch(zr){at.error=at.error||"Host's domain name can not be converted to "+(Je.iri?"Unicode":"ASCII")+" via punycode: "+zr}}pe(at,dt),Je.reference!=="suffix"&&at.scheme&&(xt.push(at.scheme),xt.push(":"));var Ar=K(at,Je);if(Ar!==void 0&&(Je.reference!=="suffix"&&xt.push("//"),xt.push(Ar),at.path&&at.path.charAt(0)!=="/"&&xt.push("/")),at.path!==void 0){var Ir=at.path;!Je.absolutePath&&(!mt||!mt.absolutePath)&&(Ir=Ne(Ir)),Ar===void 0&&(Ir=Ir.replace(/^\/\//,"/%2F")),xt.push(Ir)}return at.query!==void 0&&(xt.push("?"),xt.push(at.query)),at.fragment!==void 0&&(xt.push("#"),xt.push(at.fragment)),xt.join("")}function Qe(at,Je){var dt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},xt=arguments[3],mt={};return xt||(at=ue(qe(at,dt),dt),Je=ue(qe(Je,dt),dt)),dt=dt||{},!dt.tolerant&&Je.scheme?(mt.scheme=Je.scheme,mt.userinfo=Je.userinfo,mt.host=Je.host,mt.port=Je.port,mt.path=Ne(Je.path||""),mt.query=Je.query):(Je.userinfo!==void 0||Je.host!==void 0||Je.port!==void 0?(mt.userinfo=Je.userinfo,mt.host=Je.host,mt.port=Je.port,mt.path=Ne(Je.path||""),mt.query=Je.query):(Je.path?(Je.path.charAt(0)==="/"?mt.path=Ne(Je.path):((at.userinfo!==void 0||at.host!==void 0||at.port!==void 0)&&!at.path?mt.path="/"+Je.path:at.path?mt.path=at.path.slice(0,at.path.lastIndexOf("/")+1)+Je.path:mt.path=Je.path,mt.path=Ne(mt.path)),mt.query=Je.query):(mt.path=at.path,Je.query!==void 0?mt.query=Je.query:mt.query=at.query),mt.userinfo=at.userinfo,mt.host=at.host,mt.port=at.port),mt.scheme=at.scheme),mt.fragment=Je.fragment,mt}function He(at,Je,dt){var xt=s({scheme:"null"},dt);return qe(Qe(ue(at,xt),ue(Je,xt),xt,!0),xt)}function ae(at,Je){return typeof at=="string"?at=qe(ue(at,Je),Je):n(at)==="object"&&(at=ue(qe(at,Je),Je)),at}function Be(at,Je,dt){return typeof at=="string"?at=qe(ue(at,dt),dt):n(at)==="object"&&(at=qe(at,dt)),typeof Je=="string"?Je=qe(ue(Je,dt),dt):n(Je)==="object"&&(Je=qe(Je,dt)),at===Je}function Me(at,Je){return at&&at.toString().replace(!Je||!Je.iri?c.ESCAPE:u.ESCAPE,oe)}function Le(at,Je){return at&&at.toString().replace(!Je||!Je.iri?c.PCT_ENCODED:u.PCT_ENCODED,Ae)}var et={scheme:"http",domainHost:!0,parse:function(Je,dt){return Je.host||(Je.error=Je.error||"HTTP URIs must have a host."),Je},serialize:function(Je,dt){var xt=String(Je.scheme).toLowerCase()==="https";return(Je.port===(xt?443:80)||Je.port==="")&&(Je.port=void 0),Je.path||(Je.path="/"),Je}},nt={scheme:"https",domainHost:et.domainHost,parse:et.parse,serialize:et.serialize};function pt(at){return typeof at.secure=="boolean"?at.secure:String(at.scheme).toLowerCase()==="wss"}var Et={scheme:"ws",domainHost:!0,parse:function(Je,dt){var xt=Je;return xt.secure=pt(xt),xt.resourceName=(xt.path||"/")+(xt.query?"?"+xt.query:""),xt.path=void 0,xt.query=void 0,xt},serialize:function(Je,dt){if((Je.port===(pt(Je)?443:80)||Je.port==="")&&(Je.port=void 0),typeof Je.secure=="boolean"&&(Je.scheme=Je.secure?"wss":"ws",Je.secure=void 0),Je.resourceName){var xt=Je.resourceName.split("?"),mt=f(xt,2),Ar=mt[0],Ir=mt[1];Je.path=Ar&&Ar!=="/"?Ar:void 0,Je.query=Ir,Je.resourceName=void 0}return Je.fragment=void 0,Je}},It={scheme:"wss",domainHost:Et.domainHost,parse:Et.parse,serialize:Et.serialize},hr={},Br=!0,Fe="[A-Za-z0-9\\-\\.\\_\\~"+(Br?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ct="[0-9A-Fa-f]",ut=r(r("%[EFef]"+ct+"%"+ct+ct+"%"+ct+ct)+"|"+r("%[89A-Fa-f]"+ct+"%"+ct+ct)+"|"+r("%"+ct+ct)),Ut="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ht="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Lt=e(Ht,'[\\"\\\\]'),Qt="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Zt=new RegExp(Fe,"g"),Jt=new RegExp(ut,"g"),cn=new RegExp(e("[^]",Ut,"[\\.]",'[\\"]',Lt),"g"),Ur=new RegExp(e("[^]",Fe,Qt),"g"),Zr=Ur;function tn(at){var Je=Ae(at);return Je.match(Zt)?Je:at}var zn={scheme:"mailto",parse:function(Je,dt){var xt=Je,mt=xt.to=xt.path?xt.path.split(","):[];if(xt.path=void 0,xt.query){for(var Ar=!1,Ir={},zr=xt.query.split("&"),an=0,En=zr.length;an<En;++an){var Vn=zr[an].split("=");switch(Vn[0]){case"to":for(var Pi=Vn[1].split(","),Hi=0,bn=Pi.length;Hi<bn;++Hi)mt.push(Pi[Hi]);break;case"subject":xt.subject=Le(Vn[1],dt);break;case"body":xt.body=Le(Vn[1],dt);break;default:Ar=!0,Ir[Le(Vn[0],dt)]=Le(Vn[1],dt);break}}Ar&&(xt.headers=Ir)}xt.query=void 0;for(var Si=0,xi=mt.length;Si<xi;++Si){var Ji=mt[Si].split("@");if(Ji[0]=Le(Ji[0]),dt.unicodeSupport)Ji[1]=Le(Ji[1],dt).toLowerCase();else try{Ji[1]=_e.toASCII(Le(Ji[1],dt).toLowerCase())}catch(Jl){xt.error=xt.error||"Email address's domain name can not be converted to ASCII via punycode: "+Jl}mt[Si]=Ji.join("@")}return xt},serialize:function(Je,dt){var xt=Je,mt=o(Je.to);if(mt){for(var Ar=0,Ir=mt.length;Ar<Ir;++Ar){var zr=String(mt[Ar]),an=zr.lastIndexOf("@"),En=zr.slice(0,an).replace(Jt,tn).replace(Jt,i).replace(cn,oe),Vn=zr.slice(an+1);try{Vn=dt.iri?_e.toUnicode(Vn):_e.toASCII(Le(Vn,dt).toLowerCase())}catch(Si){xt.error=xt.error||"Email address's domain name can not be converted to "+(dt.iri?"Unicode":"ASCII")+" via punycode: "+Si}mt[Ar]=En+"@"+Vn}xt.path=mt.join(",")}var Pi=Je.headers=Je.headers||{};Je.subject&&(Pi.subject=Je.subject),Je.body&&(Pi.body=Je.body);var Hi=[];for(var bn in Pi)Pi[bn]!==hr[bn]&&Hi.push(bn.replace(Jt,tn).replace(Jt,i).replace(Ur,oe)+"="+Pi[bn].replace(Jt,tn).replace(Jt,i).replace(Zr,oe));return Hi.length&&(xt.query=Hi.join("&")),xt}},ri=/^([^\:]+)\:(.*)/,On={scheme:"urn",parse:function(Je,dt){var xt=Je.path&&Je.path.match(ri),mt=Je;if(xt){var Ar=dt.scheme||mt.scheme||"urn",Ir=xt[1].toLowerCase(),zr=xt[2],an=Ar+":"+(dt.nid||Ir),En=we[an];mt.nid=Ir,mt.nss=zr,mt.path=void 0,En&&(mt=En.parse(mt,dt))}else mt.error=mt.error||"URN can not be parsed.";return mt},serialize:function(Je,dt){var xt=dt.scheme||Je.scheme||"urn",mt=Je.nid,Ar=xt+":"+(dt.nid||mt),Ir=we[Ar];Ir&&(Je=Ir.serialize(Je,dt));var zr=Je,an=Je.nss;return zr.path=(mt||dt.nid)+":"+an,zr}},ni=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,qi={scheme:"urn:uuid",parse:function(Je,dt){var xt=Je;return xt.uuid=xt.nss,xt.nss=void 0,!dt.tolerant&&(!xt.uuid||!xt.uuid.match(ni))&&(xt.error=xt.error||"UUID is not valid."),xt},serialize:function(Je,dt){var xt=Je;return xt.nss=(Je.uuid||"").toLowerCase(),xt}};we[et.scheme]=et,we[nt.scheme]=nt,we[Et.scheme]=Et,we[It.scheme]=It,we[zn.scheme]=zn,we[On.scheme]=On,we[qi.scheme]=qi,t.SCHEMES=we,t.pctEncChar=oe,t.pctDecChars=Ae,t.parse=ue,t.removeDotSegments=Ne,t.serialize=qe,t.resolveComponents=Qe,t.resolve=He,t.normalize=ae,t.equal=Be,t.escapeComponent=Me,t.unescapeComponent=Le,Object.defineProperty(t,"__esModule",{value:!0})}))});var sH=B((UNo,DBt)=>{"use strict";DBt.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 RBt=B((QNo,IBt)=>{"use strict";IBt.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 kN=B((qNo,OBt)=>{"use strict";OBt.exports={copy:jxn,checkDataType:MPe,checkDataTypes:Vxn,coerceToTypes:$xn,toHash:LPe,getProperty:PPe,escapeQuotes:FPe,equal:sH(),ucs2length:RBt(),varOccurences:zxn,varReplace:Jxn,schemaHasRules:Kxn,schemaHasRulesExcept:Xxn,schemaUnknownRules:Zxn,toQuotedString:kPe,getPathExpr:eTn,getPath:tTn,getData:iTn,unescapeFragment:oTn,unescapeJsonPointer:QPe,escapeFragment:sTn,escapeJsonPointer:UPe};function jxn(t,e){e=e||{};for(var r in t)e[r]=t[r];return e}function MPe(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 Vxn(t,e,r){switch(t.length){case 1:return MPe(t[0],e,r,!0);default:var n="",i=LPe(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?" && ":"")+MPe(o,e,r,!0);return n}}var BBt=LPe(["string","number","integer","boolean","null"]);function $xn(t,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var i=e[n];(BBt[i]||t==="array"&&i==="array")&&(r[r.length]=i)}if(r.length)return r}else{if(BBt[e])return[e];if(t==="array"&&e==="array")return["array"]}}function LPe(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!0;return e}var Wxn=/^[a-z$_][a-z$_0-9]*$/i,Yxn=/'|\\/g;function PPe(t){return typeof t=="number"?"["+t+"]":Wxn.test(t)?"."+t:"['"+FPe(t)+"']"}function FPe(t){return t.replace(Yxn,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function zxn(t,e){e+="[^0-9]";var r=t.match(new RegExp(e,"g"));return r?r.length:0}function Jxn(t,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),t.replace(new RegExp(e,"g"),r+"$1")}function Kxn(t,e){if(typeof t=="boolean")return!t;for(var r in t)if(e[r])return!0}function Xxn(t,e,r){if(typeof t=="boolean")return!t&&r!="not";for(var n in t)if(n!=r&&e[n])return!0}function Zxn(t,e){if(typeof t!="boolean"){for(var r in t)if(!e[r])return r}}function kPe(t){return"'"+FPe(t)+"'"}function eTn(t,e,r,n){var i=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return NBt(t,i)}function tTn(t,e,r){var n=kPe(r?"/"+UPe(e):PPe(e));return NBt(t,n)}var rTn=/^\/(?:[^~]|~0|~1)*$/,nTn=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function iTn(t,e,r){var n,i,o,s;if(t==="")return"rootData";if(t[0]=="/"){if(!rTn.test(t))throw new Error("Invalid JSON-pointer: "+t);i=t,o="rootData"}else{if(s=t.match(nTn),!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 f=c[u];f&&(o+=PPe(QPe(f)),a+=" && "+o)}return a}function NBt(t,e){return t=='""'?e:(t+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function oTn(t){return QPe(decodeURIComponent(t))}function sTn(t){return encodeURIComponent(UPe(t))}function UPe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}function QPe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}});var qPe=B((HNo,MBt)=>{"use strict";var aTn=kN();MBt.exports=lTn;function lTn(t){aTn.copy(t,this)}});var LBt=B((GNo,kBt)=>{"use strict";var Nx=kBt.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(){};$0e(e,n,i,t,"",t)};Nx.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nx.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nx.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nx.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 $0e(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 f in n){var d=n[f];if(Array.isArray(d)){if(f in Nx.arrayKeywords)for(var p=0;p<d.length;p++)$0e(t,e,r,d[p],i+"/"+f+"/"+p,o,i,f,n,p)}else if(f in Nx.propsKeywords){if(d&&typeof d=="object")for(var h in d)$0e(t,e,r,d[h],i+"/"+f+"/"+cTn(h),o,i,f,n,h)}else(f in Nx.keywords||t.allKeys&&!(f in Nx.skipKeywords))&&$0e(t,e,r,d,i+"/"+f,o,i,f,n)}r(n,i,o,s,a,c,u)}}function cTn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var X0e=B((jNo,QBt)=>{"use strict";var WZ=TBt(),PBt=sH(),J0e=kN(),W0e=qPe(),uTn=LBt();QBt.exports=Mx;Mx.normalizeId=Ox;Mx.fullPath=Y0e;Mx.url=z0e;Mx.ids=mTn;Mx.inlineRef=HPe;Mx.schema=K0e;function Mx(t,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Mx.call(this,t,e,n);if(n=n||this._schemas[r],n instanceof W0e)return HPe(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var i=K0e.call(this,e,r),o,s,a;return i&&(o=i.schema,e=i.root,a=i.baseId),o instanceof W0e?s=o.validate||t.call(this,o.schema,e,void 0,a):o!==void 0&&(s=HPe(o,this._opts.inlineRefs)?o:t.call(this,o,e,void 0,a)),s}function K0e(t,e){var r=WZ.parse(e),n=UBt(r),i=Y0e(this._getId(t.schema));if(Object.keys(t.schema).length===0||n!==i){var o=Ox(n),s=this._refs[o];if(typeof s=="string")return fTn.call(this,t,s,r);if(s instanceof W0e)s.validate||this._compile(s),t=s;else if(s=this._schemas[o],s instanceof W0e){if(s.validate||this._compile(s),o==Ox(e))return{schema:s,root:t,baseId:i};t=s}else return;if(!t.schema)return;i=Y0e(this._getId(t.schema))}return FBt.call(this,r,i,t.schema,t)}function fTn(t,e,r){var n=K0e.call(this,t,e);if(n){var i=n.schema,o=n.baseId;t=n.root;var s=this._getId(i);return s&&(o=z0e(o,s)),FBt.call(this,r,o,i,t)}}var dTn=J0e.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function FBt(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=J0e.unescapeFragment(s),r=r[s],r===void 0)break;var a;if(!dTn[s]&&(a=this._getId(r),a&&(e=z0e(e,a)),r.$ref)){var c=z0e(e,r.$ref),u=K0e.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 pTn=J0e.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function HPe(t,e){if(e===!1)return!1;if(e===void 0||e===!0)return GPe(t);if(e)return jPe(t)<=e}function GPe(t){var e;if(Array.isArray(t)){for(var r=0;r<t.length;r++)if(e=t[r],typeof e=="object"&&!GPe(e))return!1}else for(var n in t)if(n=="$ref"||(e=t[n],typeof e=="object"&&!GPe(e)))return!1;return!0}function jPe(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+=jPe(r)),e==1/0)return 1/0}else for(var i in t){if(i=="$ref")return 1/0;if(pTn[i])e++;else if(r=t[i],typeof r=="object"&&(e+=jPe(r)+1),e==1/0)return 1/0}return e}function Y0e(t,e){e!==!1&&(t=Ox(t));var r=WZ.parse(t);return UBt(r)}function UBt(t){return WZ.serialize(t).split("#")[0]+"#"}var hTn=/#\/?$/;function Ox(t){return t?t.replace(hTn,""):""}function z0e(t,e){return e=Ox(e),WZ.resolve(t,e)}function mTn(t){var e=Ox(this._getId(t)),r={"":e},n={"":Y0e(e,!1)},i={},o=this;return uTn(t,{allKeys:!0},function(s,a,c,u,f,d,p){if(a!==""){var h=o._getId(s),g=r[u],A=n[u]+"/"+f;if(p!==void 0&&(A+="/"+(typeof p=="number"?p:J0e.escapeFragment(p))),typeof h=="string"){h=g=Ox(g?WZ.resolve(g,h):h);var y=o._refs[h];if(typeof y=="string"&&(y=o._refs[y]),y&&y.schema){if(!PBt(s,y.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=Ox(A))if(h[0]=="#"){if(i[h]&&!PBt(s,i[h]))throw new Error('id "'+h+'" resolves to more than one schema');i[h]=s}else o._refs[h]=A}r[a]=g,n[a]=A}}),i}});var Z0e=B((VNo,HBt)=>{"use strict";var VPe=X0e();HBt.exports={Validation:qBt(gTn),MissingRef:qBt($Pe)};function gTn(t){this.message="validation failed",this.errors=t,this.ajv=this.validation=!0}$Pe.message=function(t,e){return"can't resolve reference "+e+" from id "+t};function $Pe(t,e,r){this.message=r||$Pe.message(t,e),this.missingRef=VPe.url(t,e),this.missingSchema=VPe.normalizeId(VPe.fullPath(this.missingRef))}function qBt(t){return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}});var WPe=B(($No,GBt)=>{"use strict";GBt.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]},f={key:c,value:s[c]};return o(u,f)}}})(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,f=Object.keys(s).sort(n&&n(s));for(c="",a=0;a<f.length;a++){var d=f[a],p=o(s[d]);p&&(c&&(c+=","),c+=JSON.stringify(d)+":"+p)}return i.splice(u,1),"{"+c+"}"}})(t)}});var YPe=B((WNo,jBt)=>{"use strict";jBt.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",f=e.level,d=e.dataLevel,p=e.schema[r],h=e.schemaPath+e.util.getProperty(r),g=e.errSchemaPath+"/"+r,N=!e.opts.allErrors,Q,A="data"+(d||""),T="valid"+f;if(e.schema===!1){e.isTop?N=!0:i+=" var "+T+" = false; ";var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(Q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , 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&&N?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 "+T+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var w=e.isTop,f=e.level=0,d=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 S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,d=e.dataLevel,A="data"+(d||"");if(a&&(e.baseId=e.resolve.url(e.baseId,a)),o&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+f+" = errors;"}var T="valid"+f,N=!e.opts.allErrors,P="",U="",Q,D=e.schema.type,F=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(F?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],F=!0)),F&&D.length==1&&(D=D[0],F=!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 O=e.util.coerceToTypes(e.opts.coerceTypes,D);var q=e.RULES.types[D];if(O||F||q===!0||q&&!te(q)){var h=e.schemaPath+".type",g=e.errSchemaPath+"/type",h=e.schemaPath+".type",g=e.errSchemaPath+"/type",L=F?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[L](D,A,e.opts.strictNumbers,!0)+") { ",O){var M="dataType"+f,j="coerced"+f;i+=" var "+M+" = typeof "+A+"; var "+j+" = undefined; ",e.opts.coerceTypes=="array"&&(i+=" if ("+M+" == 'object' && Array.isArray("+A+") && "+A+".length == 1) { "+A+" = "+A+"[0]; "+M+" = typeof "+A+"; if ("+e.util.checkDataType(e.schema.type,A,e.opts.strictNumbers)+") "+j+" = "+A+"; } "),i+=" if ("+j+" !== undefined) ; ";var G=O;if(G)for(var W,V=-1,ee=G.length-1;V<ee;)W=G[V+=1],W=="string"?i+=" else if ("+M+" == 'number' || "+M+" == 'boolean') "+j+" = '' + "+A+"; else if ("+A+" === null) "+j+" = ''; ":W=="number"||W=="integer"?(i+=" else if ("+M+" == 'boolean' || "+A+" === null || ("+M+" == 'string' && "+A+" && "+A+" == +"+A+" ",W=="integer"&&(i+=" && !("+A+" % 1)"),i+=")) "+j+" = +"+A+"; "):W=="boolean"?i+=" else if ("+A+" === 'false' || "+A+" === 0 || "+A+" === null) "+j+" = false; else if ("+A+" === 'true' || "+A+" === 1) "+j+" = true; ":W=="null"?i+=" else if ("+A+" === '' || "+A+" === 0 || "+A+" === false) "+j+" = null; ":e.opts.coerceTypes=="array"&&W=="array"&&(i+=" else if ("+M+" == 'string' || "+M+" == 'number' || "+M+" == 'boolean' || "+A+" == null) "+j+" = ["+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(g)+" , params: { type: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?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&&N?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 ("+j+" !== undefined) { ";var J=d?"data"+(d-1||""):"parentData",he=d?e.dataPathArr[d]:"parentDataProperty";i+=" "+A+" = "+j+"; ",d||(i+="if ("+J+" !== undefined)"),i+=" "+J+"["+he+"] = "+j+"; } "}else{var y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(Q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?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&&N?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")+" ",N&&(i+=" } if (errors === ",w?i+="0":i+="errs_"+f,i+=") { ",U+="}");else{var be=e.RULES;if(be){for(var q,ge=-1,_e=be.length-1;ge<_e;)if(q=be[ge+=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),oe=we;if(oe)for(var Ae,pe=-1,ie=oe.length-1;pe<ie;){Ae=oe[pe+=1];var de=p[Ae];if(de.default!==void 0){var X=A+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+X;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else i+=" if ("+X+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+X+" === null || "+X+" === '' "),i+=" ) "+X+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}else if(q.type=="array"&&Array.isArray(e.schema.items)){var ce=e.schema.items;if(ce){for(var de,V=-1,me=ce.length-1;V<me;)if(de=ce[V+=1],de.default!==void 0){var X=A+"["+V+"]";if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+X;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else i+=" if ("+X+" === undefined ",e.opts.useDefaults=="empty"&&(i+=" || "+X+" === null || "+X+" === '' "),i+=" ) "+X+" = ",e.opts.useDefaults=="shared"?i+=" "+e.useDefault(de.default)+" ":i+=" "+JSON.stringify(de.default)+" ",i+="; "}}}}var ue=q.rules;if(ue){for(var K,re=-1,xe=ue.length-1;re<xe;)if(K=ue[re+=1],Ne(K)){var ye=K.code(e,K.keyword,q.type);ye&&(i+=" "+ye+" ",N&&(P+="}"))}}if(N&&(i+=" "+P+" ",P=""),q.type&&(i+=" } ",D&&D===q.type&&!O)){i+=" else { ";var h=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(Q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",F?i+=""+D.join(","):i+=""+D,i+="' } ",e.opts.messages!==!1&&(i+=" , message: 'should be ",F?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&&N?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+=" } "}N&&(i+=" if (errors === ",w?i+="0":i+="errs_"+f,i+=") { ",U+="}")}}}N&&(i+=" "+U+" "),w?(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 "+T+" = errors === errs_"+f+";";function te(Qe){for(var He=Qe.rules,ae=0;ae<He.length;ae++)if(Ne(He[ae]))return!0}function Ne(Qe){return e.schema[Qe.keyword]!==void 0||Qe.implements&&qe(Qe)}function qe(Qe){for(var He=Qe.implements,ae=0;ae<He.length;ae++)if(e.schema[He[ae]]!==void 0)return!0}return i}});var zBt=B((YNo,YBt)=>{"use strict";var eme=X0e(),rme=kN(),$Bt=Z0e(),ATn=WPe(),VBt=YPe(),yTn=rme.ucs2length,ETn=sH(),vTn=$Bt.Validation;YBt.exports=zPe;function zPe(t,e,r,n){var i=this,o=this._opts,s=[void 0],a={},c=[],u={},f=[],d={},p=[];e=e||{schema:t,refVal:s,refs:a};var h=bTn.call(this,t,e,n),g=this._compilations[h.index];if(h.compiling)return g.callValidate=S;var A=this._formats,y=this.RULES;try{var v=T(t,e,r,n);g.validate=v;var w=g.callValidate;return w&&(w.schema=v.schema,w.errors=null,w.refs=v.refs,w.refVal=v.refVal,w.root=v.root,w.$async=v.$async,o.sourceCode&&(w.source=v.source)),v}finally{CTn.call(this,t,e,n)}function S(){var L=g.validate,M=L.apply(this,arguments);return S.errors=L.errors,M}function T(L,M,j,G){var W=!M||M&&M.schema==L;if(M.schema!=e.schema)return zPe.call(i,L,M,j,G);var V=L.$async===!0,ee=VBt({isTop:!0,schema:L,isRoot:W,baseId:G,root:M,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:$Bt.MissingRef,RULES:y,validate:VBt,util:rme,resolve:eme,resolveRef:N,usePattern:F,useDefault:O,useCustomRule:q,opts:o,formats:A,logger:i.logger,self:i});ee=tme(s,STn)+tme(c,_Tn)+tme(f,wTn)+tme(p,xTn)+ee,o.processCode&&(ee=o.processCode(ee,L));var J;try{var he=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",ee);J=he(i,y,A,e,s,f,p,ETn,yTn,vTn),s[0]=J}catch(be){throw i.logger.error("Error compiling schema, function code:",ee),be}return J.schema=L,J.errors=null,J.refs=a,J.refVal=s,J.root=W?J:M,V&&(J.$async=!0),o.sourceCode===!0&&(J.source={code:ee,patterns:c,defaults:f}),J}function N(L,M,j){M=eme.url(L,M);var G=a[M],W,V;if(G!==void 0)return W=s[G],V="refVal["+G+"]",D(W,V);if(!j&&e.refs){var ee=e.refs[M];if(ee!==void 0)return W=e.refVal[ee],V=P(M,W),D(W,V)}V=P(M);var J=eme.call(i,T,e,M);if(J===void 0){var he=r&&r[M];he&&(J=eme.inlineRef(he,o.inlineRefs)?he:zPe.call(i,he,e,r,L))}if(J===void 0)U(M);else return Q(M,J),D(J,V)}function P(L,M){var j=s.length;return s[j]=M,a[L]=j,"refVal"+j}function U(L){delete a[L]}function Q(L,M){var j=a[L];s[j]=M}function D(L,M){return typeof L=="object"||typeof L=="boolean"?{code:M,schema:L,inline:!0}:{code:M,$async:L&&!!L.$async}}function F(L){var M=u[L];return M===void 0&&(M=u[L]=c.length,c[M]=L),"pattern"+M}function O(L){switch(typeof L){case"boolean":case"number":return""+L;case"string":return rme.toQuotedString(L);case"object":if(L===null)return"null";var M=ATn(L),j=d[M];return j===void 0&&(j=d[M]=f.length,f[j]=L),"default"+j}}function q(L,M,j,G){if(i._opts.validateSchema!==!1){var W=L.definition.dependencies;if(W&&!W.every(function(oe){return Object.prototype.hasOwnProperty.call(j,oe)}))throw new Error("parent schema must have all required keywords: "+W.join(","));var V=L.definition.validateSchema;if(V){var ee=V(M);if(!ee){var J="keyword schema is invalid: "+i.errorsText(V.errors);if(i._opts.validateSchema=="log")i.logger.error(J);else throw new Error(J)}}}var he=L.definition.compile,be=L.definition.inline,ge=L.definition.macro,_e;if(he)_e=he.call(i,M,j,G);else if(ge)_e=ge.call(i,M,j,G),o.validateSchema!==!1&&i.validateSchema(_e,!0);else if(be)_e=be.call(i,G,L.keyword,M,j);else if(_e=L.definition.validate,!_e)return;if(_e===void 0)throw new Error('custom keyword "'+L.keyword+'"failed to compile');var we=p.length;return p[we]=_e,{code:"customRule"+we,validate:_e}}}function bTn(t,e,r){var n=WBt.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 CTn(t,e,r){var n=WBt.call(this,t,e,r);n>=0&&this._compilations.splice(n,1)}function WBt(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 _Tn(t,e){return"var pattern"+t+" = new RegExp("+rme.toQuotedString(e[t])+");"}function wTn(t){return"var default"+t+" = defaults["+t+"];"}function STn(t,e){return e[t]===void 0?"":"var refVal"+t+" = refVal["+t+"];"}function xTn(t){return"var customRule"+t+" = customRules["+t+"];"}function tme(t,e){if(!t.length)return"";for(var r="",n=0;n<t.length;n++)r+=e(n,t);return r}});var KBt=B((zNo,JBt)=>{"use strict";var nme=JBt.exports=function(){this._cache={}};nme.prototype.put=function(e,r){this._cache[e]=r};nme.prototype.get=function(e){return this._cache[e]};nme.prototype.del=function(e){delete this._cache[e]};nme.prototype.clear=function(){this._cache={}}});var cNt=B((JNo,lNt)=>{"use strict";var TTn=kN(),DTn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ITn=[0,31,28,31,30,31,30,31,31,30,31,30,31],RTn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,XBt=/^(?=.{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,BTn=/^(?:[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,NTn=/^(?:[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,ZBt=/^(?:(?:[^\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,eNt=/^(?:(?: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,tNt=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,rNt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,nNt=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,iNt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;lNt.exports=ime;function ime(t){return t=t=="full"?"full":"fast",TTn.copy(ime[t])}ime.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":ZBt,url:eNt,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:XBt,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:aNt,uuid:tNt,"json-pointer":rNt,"json-pointer-uri-fragment":nNt,"relative-json-pointer":iNt};ime.full={date:oNt,time:sNt,"date-time":kTn,uri:PTn,"uri-reference":NTn,"uri-template":ZBt,url:eNt,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:XBt,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:aNt,uuid:tNt,"json-pointer":rNt,"json-pointer-uri-fragment":nNt,"relative-json-pointer":iNt};function OTn(t){return t%4===0&&(t%100!==0||t%400===0)}function oNt(t){var e=t.match(DTn);if(!e)return!1;var r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n==2&&OTn(r)?29:ITn[n])}function sNt(t,e){var r=t.match(RTn);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 MTn=/t|\s/i;function kTn(t){var e=t.split(MTn);return e.length==2&&oNt(e[0])&&sNt(e[1],!0)}var LTn=/\/|:/;function PTn(t){return LTn.test(t)&&BTn.test(t)}var FTn=/[^\\]\\Z/;function aNt(t){if(FTn.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var fNt=B((KNo,uNt)=>{"use strict";uNt.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,f="data"+(s||""),d="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 g=e.resolveRef(e.baseId,a,e.isRoot);if(g===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: "+f+" "),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(g.inline){var w=e.util.copy(e);w.level++;var S="valid"+w.level;w.schema=g.schema,w.schemaPath="",w.errSchemaPath=a;var T=e.validate(w).replace(/validate\.schema/g,g.code);i+=" "+T+" ",u&&(i+=" if ("+S+") { ")}else p=g.$async===!0||e.async&&g.$async!==!1,h=g.code}if(h){var y=y||[];y.push(i),i="",e.opts.passContext?i+=" "+h+".call(this, ":i+=" "+h+"( ",i+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var N=s?"data"+(s-1||""):"parentData",P=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+N+" , "+P+", rootData) ";var U=i;if(i=y.pop(),p){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+d+"; "),i+=" try { await "+U+"; ",u&&(i+=" "+d+" = 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+=" "+d+" = false; "),i+=" } ",u&&(i+=" if ("+d+") { ")}else i+=" if (!"+U+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}});var pNt=B((XNo,dNt)=>{"use strict";dNt.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),f="";u.level++;var d="valid"+u.level,p=u.baseId,h=!0,g=o;if(g)for(var A,y=-1,v=g.length-1;y<v;)A=g[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 ("+d+") { ",f+="}"));return c&&(h?i+=" if (true) { ":i+=" "+f.slice(0,-1)+" "),i}});var mNt=B((ZNo,hNt)=>{"use strict";hNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.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 w=g.baseId;i+=" var "+h+" = errors; var "+p+" = false; ";var S=e.compositeRule;e.compositeRule=g.compositeRule=!0;var T=a;if(T)for(var N,P=-1,U=T.length-1;P<U;)N=T[P+=1],g.schema=N,g.schemaPath=c+"["+P+"]",g.errSchemaPath=u+"/"+P,i+=" "+e.validate(g)+" ",g.baseId=w,i+=" "+p+" = "+p+" || "+y+"; if (!"+p+") { ",A+="}";e.compositeRule=g.compositeRule=S,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: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(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 f&&(i+=" if (true) { ");return i}});var ANt=B((eOo,gNt)=>{"use strict";gNt.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 ENt=B((tOo,yNt)=>{"use strict";yNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a,h||(i+=" var schema"+o+" = validate.schema"+c+";"),i+="var "+p+" = equal("+d+", 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: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&f?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+=" }",f&&(i+=" else { "),i}});var bNt=B((rOo,vNt)=>{"use strict";vNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v="i"+o,w=g.dataLevel=e.dataLevel+1,S="data"+w,T=e.baseId,N=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+";",N){var P=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var U=d+"["+v+"]";g.dataPathArr[w]=v;var Q=e.validate(g);g.baseId=T,e.util.varOccurences(Q,S)<2?i+=" "+e.util.varReplace(Q,S,U)+" ":i+=" var "+S+" = "+U+"; "+Q+" ",i+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=P,i+=" "+A+" if (!"+y+") {"}else i+=" if ("+d+".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: "+d+" "),i+=" } "):i+=" {} ";var F=i;return i=D.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+F+"]); ":i+=" validate.errors = ["+F+"]; return false; ":i+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { ",N&&(i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(i+=" } "),i}});var _Nt=B((nOo,CNt)=>{"use strict";CNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";h.level++;var A="valid"+h.level,y={},v={},w=e.opts.ownProperties;for(P in a)if(P!="__proto__"){var S=a[P],T=Array.isArray(S)?v:y;T[P]=S}i+="var "+p+" = errors;";var N=e.errorPath;i+="var missing"+o+";";for(var P in v)if(T=v[P],T.length){if(i+=" if ( "+d+e.util.getProperty(P)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(P)+"') "),f){i+=" && ( ";var U=T;if(U)for(var Q,D=-1,F=U.length-1;D<F;){Q=U[D+=1],D&&(i+=" || ");var O=e.util.getProperty(Q),q=d+O;i+=" ( ( "+q+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(Q)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?Q:O)+") ) "}i+=")) { ";var L="missing"+o,M="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(N,L,!0):N+" + "+L);var j=j||[];j.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { property: '"+e.util.escapeQuotes(P)+"', missingProperty: '"+M+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",T.length==1?i+="property "+e.util.escapeQuotes(T[0]):i+="properties "+e.util.escapeQuotes(T.join(", ")),i+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var G=i;i=j.pop(),!e.compositeRule&&f?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 W=T;if(W)for(var Q,V=-1,ee=W.length-1;V<ee;){Q=W[V+=1];var O=e.util.getProperty(Q),M=e.util.escapeQuotes(Q),q=d+O;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(N,Q,e.opts.jsonPointers)),i+=" if ( "+q+" === undefined ",w&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+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(P)+"', missingProperty: '"+M+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(i+=" , message: 'should have ",T.length==1?i+="property "+e.util.escapeQuotes(T[0]):i+="properties "+e.util.escapeQuotes(T.join(", ")),i+=" when property "+e.util.escapeQuotes(P)+" is present' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}i+=" } ",f&&(g+="}",i+=" else { ")}e.errorPath=N;var J=h.baseId;for(var P in y){var S=y[P];(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(i+=" "+A+" = true; if ( "+d+e.util.getProperty(P)+" !== undefined ",w&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(P)+"') "),i+=") { ",h.schema=S,h.schemaPath=c+e.util.getProperty(P),h.errSchemaPath=u+"/"+e.util.escapeFragment(P),i+=" "+e.validate(h)+" ",h.baseId=J,i+=" } ",f&&(i+=" if ("+A+") { ",g+="}"))}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var SNt=B((iOo,wNt)=>{"use strict";wNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=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("+d+", "+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: "+d+" "),i+=" } "):i+=" {} ";var w=i;return i=v.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" }",f&&(i+=" else { "),i}});var TNt=B((oOo,xNt)=>{"use strict";xNt.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,f=!e.opts.allErrors,d="data"+(s||"");if(e.opts.format===!1)return f&&(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 g=e.opts.unknownFormats,A=Array.isArray(g);if(p){var y="format"+o,v="isObject"+o,w="formatType"+o;i+=" var "+y+" = formats["+h+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+w+" = "+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+=" (",g!="ignore"&&(i+=" ("+h+" && !"+y+" ",A&&(i+=" && self._opts.unknownFormats.indexOf("+h+") == -1 "),i+=") || "),i+=" ("+y+" && "+w+" == '"+n+"' && !(typeof "+y+" == 'function' ? ",e.async?i+=" (async"+o+" ? await "+y+"("+d+") : "+y+"("+d+")) ":i+=" "+y+"("+d+") ",i+=" : "+y+".test("+d+"))))) {"}else{var y=e.formats[a];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+a+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(i+=" if (true) { "),i;if(A&&g.indexOf(a)>=0)return f&&(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,w=v&&y.type||"string";if(v){var S=y.async===!0;y=y.validate}if(w!=n)return f&&(i+=" if (true) { "),i;if(S){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(a)+".validate";i+=" if (!(await "+T+"("+d+"))) { "}else{i+=" if (! ";var T="formats"+e.util.getProperty(a);v&&(T+=".validate"),typeof y=="function"?i+=" "+T+"("+d+") ":i+=" "+T+".test("+d+") ",i+=") { "}}var N=N||[];N.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: "+d+" "),i+=" } "):i+=" {} ";var P=i;return i=N.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+P+"]); ":i+=" validate.errors = ["+P+"]; return false; ":i+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",f&&(i+=" else { "),i}});var INt=B((sOo,DNt)=>{"use strict";DNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e);g.level++;var A="valid"+g.level,y=e.schema.then,v=e.schema.else,w=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),T=g.baseId;if(w||S){var N;g.createErrors=!1,g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" var "+h+" = errors; var "+p+" = true; ";var P=e.compositeRule;e.compositeRule=g.compositeRule=!0,i+=" "+e.validate(g)+" ",g.baseId=T,g.createErrors=!0,i+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=P,w?(i+=" if ("+A+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",i+=" "+e.validate(g)+" ",g.baseId=T,i+=" "+p+" = "+A+"; ",w&&S?(N="ifClause"+o,i+=" var "+N+" = 'then'; "):N="'then'",i+=" } ",S&&(i+=" else { ")):i+=" if (!"+A+") { ",S&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",i+=" "+e.validate(g)+" ",g.baseId=T,i+=" "+p+" = "+A+"; ",w&&S?(N="ifClause"+o,i+=" var "+N+" = 'else'; "):N="'else'",i+=" } "),i+=" if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+N+" } ",e.opts.messages!==!1&&(i+=` , message: 'should match "' + `+N+` + '" schema' `),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),i+=" } ",f&&(i+=" else { ")}else f&&(i+=" if (true) { ");return i}});var BNt=B((aOo,RNt)=>{"use strict";RNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v="i"+o,w=g.dataLevel=e.dataLevel+1,S="data"+w,T=e.baseId;if(i+="var "+h+" = errors;var "+p+";",Array.isArray(a)){var N=e.schema.additionalItems;if(N===!1){i+=" "+p+" = "+d+".length <= "+a.length+"; ";var P=u;u=e.errSchemaPath+"/additionalItems",i+=" if (!"+p+") { ";var U=U||[];U.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: "+d+" "),i+=" } "):i+=" {} ";var Q=i;i=U.pop(),!e.compositeRule&&f?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=P,f&&(A+="}",i+=" else { ")}var D=a;if(D){for(var F,O=-1,q=D.length-1;O<q;)if(F=D[O+=1],e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)){i+=" "+y+" = true; if ("+d+".length > "+O+") { ";var L=d+"["+O+"]";g.schema=F,g.schemaPath=c+"["+O+"]",g.errSchemaPath=u+"/"+O,g.errorPath=e.util.getPathExpr(e.errorPath,O,e.opts.jsonPointers,!0),g.dataPathArr[w]=O;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,S)<2?i+=" "+e.util.varReplace(M,S,L)+" ":i+=" var "+S+" = "+L+"; "+M+" ",i+=" } ",f&&(i+=" if ("+y+") { ",A+="}")}}if(typeof N=="object"&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))){g.schema=N,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",i+=" "+y+" = true; if ("+d+".length > "+a.length+") { for (var "+v+" = "+a.length+"; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var L=d+"["+v+"]";g.dataPathArr[w]=v;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,S)<2?i+=" "+e.util.varReplace(M,S,L)+" ":i+=" var "+S+" = "+L+"; "+M+" ",f&&(i+=" if (!"+y+") break; "),i+=" } } ",f&&(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)){g.schema=a,g.schemaPath=c,g.errSchemaPath=u,i+=" for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var L=d+"["+v+"]";g.dataPathArr[w]=v;var M=e.validate(g);g.baseId=T,e.util.varOccurences(M,S)<2?i+=" "+e.util.varReplace(M,S,L)+" ":i+=" var "+S+" = "+L+"; "+M+" ",f&&(i+=" if (!"+y+") break; "),i+=" }"}return f&&(i+=" "+A+" if ("+h+" == errors) {"),i}});var JPe=B((lOo,NNt)=>{"use strict";NNt.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,f=!e.opts.allErrors,T,d="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 g=r=="maximum",A=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[A],v=e.opts.$data&&y&&y.$data,w=g?"<":">",S=g?">":"<",T=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 N=e.util.getData(y.$data,s,e.dataPathArr),P="exclusive"+o,U="exclType"+o,Q="exclIsNumber"+o,D="op"+o,F="' + "+D+" + '";i+=" var schemaExcl"+o+" = "+N+"; ",N="schemaExcl"+o,i+=" var "+P+"; var "+U+" = typeof "+N+"; if ("+U+" != 'boolean' && "+U+" != 'undefined' && "+U+" != 'number') { ";var T=A,O=O||[];O.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(T||"_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: "+d+" "),i+=" } "):i+=" {} ";var q=i;i=O.pop(),!e.compositeRule&&f?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+=" "+U+" == 'number' ? ( ("+P+" = "+h+" === undefined || "+N+" "+w+"= "+h+") ? "+d+" "+S+"= "+N+" : "+d+" "+S+" "+h+" ) : ( ("+P+" = "+N+" === true) ? "+d+" "+S+"= "+h+" : "+d+" "+S+" "+h+" ) || "+d+" !== "+d+") { var op"+o+" = "+P+" ? '"+w+"' : '"+w+"='; ",a===void 0&&(T=A,u=e.errSchemaPath+"/"+A,h=N,p=v)}else{var Q=typeof y=="number",F=w;if(Q&&p){var D="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" ( "+h+" === undefined || "+y+" "+w+"= "+h+" ? "+d+" "+S+"= "+y+" : "+d+" "+S+" "+h+" ) || "+d+" !== "+d+") { "}else{Q&&a===void 0?(P=!0,T=A,u=e.errSchemaPath+"/"+A,h=y,S+="="):(Q&&(h=Math[g?"min":"max"](y,a)),y===(Q?h:!0)?(P=!0,T=A,u=e.errSchemaPath+"/"+A,S+="="):(P=!1,F+="="));var D="'"+F+"'";i+=" if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+d+" "+S+" "+h+" || "+d+" !== "+d+") { "}}T=T||r;var O=O||[];O.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+h+", exclusive: "+P+" } ",e.opts.messages!==!1&&(i+=" , message: 'should be "+F+" ",p?i+="' + "+h:i+=""+h+"'"),e.opts.verbose&&(i+=" , schema: ",p?i+="validate.schema"+c:i+=""+a,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var q=i;return i=O.pop(),!e.compositeRule&&f?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+=" } ",f&&(i+=" else { "),i}});var KPe=B((cOo,ONt)=>{"use strict";ONt.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,f=!e.opts.allErrors,A,d="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 g=r=="maxItems"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" "+d+".length "+g+" "+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: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?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+="} ",f&&(i+=" else { "),i}});var XPe=B((uOo,MNt)=>{"use strict";MNt.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,f=!e.opts.allErrors,A,d="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 g=r=="maxLength"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),e.opts.unicode===!1?i+=" "+d+".length ":i+=" ucs2length("+d+") ",i+=" "+g+" "+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: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?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+="} ",f&&(i+=" else { "),i}});var ZPe=B((fOo,kNt)=>{"use strict";kNt.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,f=!e.opts.allErrors,A,d="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 g=r=="maxProperties"?">":"<";i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'number') || "),i+=" Object.keys("+d+").length "+g+" "+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: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=y.pop(),!e.compositeRule&&f?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+="} ",f&&(i+=" else { "),i}});var PNt=B((dOo,LNt)=>{"use strict";LNt.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,f=!e.opts.allErrors,d="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+" = "+d+" / "+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 g=g||[];g.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: "+d+" "),i+=" } "):i+=" {} ";var A=i;return i=g.pop(),!e.compositeRule&&f?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+="} ",f&&(i+=" else { "),i}});var UNt=B((pOo,FNt)=>{"use strict";FNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e);h.level++;var g="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 ("+g+") { ";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: "+d+" "),i+=" } "):i+=" {} ";var w=i;i=v.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+w+"]); ":i+=" validate.errors = ["+w+"]; return false; ":i+=" var err = "+w+"; 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: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(i+=" if (false) { ");return i}});var qNt=B((hOo,QNt)=>{"use strict";QNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h="errs__"+o,g=e.util.copy(e),A="";g.level++;var y="valid"+g.level,v=g.baseId,w="prevValid"+o,S="passingSchemas"+o;i+="var "+h+" = errors , "+w+" = false , "+p+" = false , "+S+" = null; ";var T=e.compositeRule;e.compositeRule=g.compositeRule=!0;var N=a;if(N)for(var P,U=-1,Q=N.length-1;U<Q;)P=N[U+=1],(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))?(g.schema=P,g.schemaPath=c+"["+U+"]",g.errSchemaPath=u+"/"+U,i+=" "+e.validate(g)+" ",g.baseId=v):i+=" var "+y+" = true; ",U&&(i+=" if ("+y+" && "+w+") { "+p+" = false; "+S+" = ["+S+", "+U+"]; } else { ",A+="}"),i+=" if ("+y+") { "+p+" = "+w+" = true; "+S+" = "+U+"; }";return e.compositeRule=g.compositeRule=T,i+=""+A+"if (!"+p+") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+S+" } ",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: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(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 GNt=B((mOo,HNt)=>{"use strict";HNt.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,f=!e.opts.allErrors,d="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 g=p?"(new RegExp("+h+"))":e.usePattern(a);i+="if ( ",p&&(i+=" ("+h+" !== undefined && typeof "+h+" != 'string') || "),i+=" !"+g+".test("+d+") ) { ";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: "+d+" "),i+=" } "):i+=" {} ";var y=i;return i=A.pop(),!e.compositeRule&&f?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+="} ",f&&(i+=" else { "),i}});var VNt=B((gOo,jNt)=>{"use strict";jNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";h.level++;var A="valid"+h.level,y="key"+o,v="idx"+o,w=h.dataLevel=e.dataLevel+1,S="data"+w,T="dataProperties"+o,N=Object.keys(a||{}).filter(V),P=e.schema.patternProperties||{},U=Object.keys(P).filter(V),Q=e.schema.additionalProperties,D=N.length||U.length,F=Q===!1,O=typeof Q=="object"&&Object.keys(Q).length,q=e.opts.removeAdditional,L=F||O||q,M=e.opts.ownProperties,j=e.baseId,G=e.schema.required;if(G&&!(e.opts.$data&&G.$data)&&G.length<e.opts.loopRequired)var W=e.util.toHash(G);function V(Le){return Le!=="__proto__"}if(i+="var "+p+" = errors;var "+A+" = true;",M&&(i+=" var "+T+" = undefined;"),L){if(M?i+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+y+" = "+T+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",D){if(i+=" var isAdditional"+o+" = !(false ",N.length)if(N.length>8)i+=" || validate.schema"+c+".hasOwnProperty("+y+") ";else{var ee=N;if(ee)for(var J,he=-1,be=ee.length-1;he<be;)J=ee[he+=1],i+=" || "+y+" == "+e.util.toQuotedString(J)+" "}if(U.length){var ge=U;if(ge)for(var _e,we=-1,oe=ge.length-1;we<oe;)_e=ge[we+=1],i+=" || "+e.usePattern(_e)+".test("+y+") "}i+=" ); if (isAdditional"+o+") { "}if(q=="all")i+=" delete "+d+"["+y+"]; ";else{var Ae=e.errorPath,pe="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),F)if(q)i+=" delete "+d+"["+y+"]; ";else{i+=" "+A+" = false; ";var ie=u;u=e.errSchemaPath+"/additionalProperties";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { additionalProperty: '"+pe+"' } ",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: "+d+" "),i+=" } "):i+=" {} ";var X=i;i=de.pop(),!e.compositeRule&&f?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++; ",u=ie,f&&(i+=" break; ")}else if(O)if(q=="failing"){i+=" var "+p+" = errors; ";var ce=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 me=d+"["+y+"]";h.dataPathArr[w]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,S)<2?i+=" "+e.util.varReplace(ue,S,me)+" ":i+=" var "+S+" = "+me+"; "+ue+" ",i+=" if (!"+A+") { errors = "+p+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+d+"["+y+"]; } ",e.compositeRule=h.compositeRule=ce}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 me=d+"["+y+"]";h.dataPathArr[w]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,S)<2?i+=" "+e.util.varReplace(ue,S,me)+" ":i+=" var "+S+" = "+me+"; "+ue+" ",f&&(i+=" if (!"+A+") break; ")}e.errorPath=Ae}D&&(i+=" } "),i+=" } ",f&&(i+=" if ("+A+") { ",g+="}")}var K=e.opts.useDefaults&&!e.compositeRule;if(N.length){var re=N;if(re)for(var J,xe=-1,ye=re.length-1;xe<ye;){J=re[xe+=1];var te=a[J];if(e.opts.strictKeywords?typeof te=="object"&&Object.keys(te).length>0||te===!1:e.util.schemaHasRules(te,e.RULES.all)){var Ne=e.util.getProperty(J),me=d+Ne,qe=K&&te.default!==void 0;h.schema=te,h.schemaPath=c+Ne,h.errSchemaPath=u+"/"+e.util.escapeFragment(J),h.errorPath=e.util.getPath(e.errorPath,J,e.opts.jsonPointers),h.dataPathArr[w]=e.util.toQuotedString(J);var ue=e.validate(h);if(h.baseId=j,e.util.varOccurences(ue,S)<2){ue=e.util.varReplace(ue,S,me);var Qe=me}else{var Qe=S;i+=" var "+S+" = "+me+"; "}if(qe)i+=" "+ue+" ";else{if(W&&W[J]){i+=" if ( "+Qe+" === undefined ",M&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=") { "+A+" = false; ";var Ae=e.errorPath,ie=u,He=e.util.escapeQuotes(J);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,J,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var de=de||[];de.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+He+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+He+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var X=i;i=de.pop(),!e.compositeRule&&f?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++; ",u=ie,e.errorPath=Ae,i+=" } else { "}else f?(i+=" if ( "+Qe+" === undefined ",M&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=") { "+A+" = true; } else { "):(i+=" if ("+Qe+" !== undefined ",M&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),i+=" ) { ");i+=" "+ue+" } "}}f&&(i+=" if ("+A+") { ",g+="}")}}if(U.length){var ae=U;if(ae)for(var _e,Be=-1,Me=ae.length-1;Be<Me;){_e=ae[Be+=1];var te=P[_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),M?i+=" "+T+" = "+T+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+T+".length; "+v+"++) { var "+y+" = "+T+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",i+=" if ("+e.usePattern(_e)+".test("+y+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var me=d+"["+y+"]";h.dataPathArr[w]=y;var ue=e.validate(h);h.baseId=j,e.util.varOccurences(ue,S)<2?i+=" "+e.util.varReplace(ue,S,me)+" ":i+=" var "+S+" = "+me+"; "+ue+" ",f&&(i+=" if (!"+A+") break; "),i+=" } ",f&&(i+=" else "+A+" = true; "),i+=" } ",f&&(i+=" if ("+A+") { ",g+="}")}}}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var WNt=B((AOo,$Nt)=>{"use strict";$Nt.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,f=!e.opts.allErrors,d="data"+(s||""),p="errs__"+o,h=e.util.copy(e),g="";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,w="i"+o,S="' + "+y+" + '",T=h.dataLevel=e.dataLevel+1,N="data"+T,P="dataProperties"+o,U=e.opts.ownProperties,Q=e.baseId;U&&(i+=" var "+P+" = undefined; "),U?i+=" "+P+" = "+P+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+P+".length; "+v+"++) { var "+y+" = "+P+"["+v+"]; ":i+=" for (var "+y+" in "+d+") { ",i+=" var startErrs"+o+" = errors; ";var D=y,F=e.compositeRule;e.compositeRule=h.compositeRule=!0;var O=e.validate(h);h.baseId=Q,e.util.varOccurences(O,N)<2?i+=" "+e.util.varReplace(O,N,D)+" ":i+=" var "+N+" = "+D+"; "+O+" ",e.compositeRule=h.compositeRule=F,i+=" if (!"+A+") { for (var "+w+"=startErrs"+o+"; "+w+"<errors; "+w+"++) { vErrors["+w+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(i+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { propertyName: '"+S+"' } ",e.opts.messages!==!1&&(i+=" , message: 'property name \\'"+S+"\\' is invalid' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; "),f&&(i+=" break; "),i+=" } }"}return f&&(i+=" "+g+" if ("+p+" == errors) {"),i}});var zNt=B((yOo,YNt)=>{"use strict";YNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=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 w,S=-1,T=v.length-1;S<T;){w=v[S+=1];var N=e.schema.properties[w];N&&(e.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:e.util.schemaHasRules(N,e.RULES.all))||(y[y.length]=w)}}else var y=a;if(h||y.length){var P=e.errorPath,U=h||y.length>=e.opts.loopRequired,Q=e.opts.ownProperties;if(f)if(i+=" var missing"+o+"; ",U){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,F="schema"+o+"["+D+"]",O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,F,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+" = "+d+"["+A+"["+D+"]] !== undefined ",Q&&(i+=" && Object.prototype.hasOwnProperty.call("+d+", "+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: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var L=i;i=q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else{i+=" if ( ";var M=y;if(M)for(var j,D=-1,G=M.length-1;D<G;){j=M[D+=1],D&&(i+=" || ");var W=e.util.getProperty(j),V=d+W;i+=" ( ( "+V+" === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") && (missing"+o+" = "+e.util.toQuotedString(e.opts.jsonPointers?j:W)+") ) "}i+=") { ";var F="missing"+o,O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(P,F,!0):P+" + "+F);var q=q||[];q.push(i),i="",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var L=i;i=q.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+L+"]); ":i+=" validate.errors = ["+L+"]; return false; ":i+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else { "}else if(U){h||(i+=" var "+A+" = validate.schema"+c+"; ");var D="i"+o,F="schema"+o+"["+D+"]",O="' + "+F+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(P,F,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: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),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 ("+d+"["+A+"["+D+"]] === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", "+A+"["+D+"]) "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(i+=" } ")}else{var ee=y;if(ee)for(var j,J=-1,he=ee.length-1;J<he;){j=ee[J+=1];var W=e.util.getProperty(j),O=e.util.escapeQuotes(j),V=d+W;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(P,j,e.opts.jsonPointers)),i+=" if ( "+V+" === undefined ",Q&&(i+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(j)+"') "),i+=") { var err = ",e.createErrors!==!1?(i+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+O+"' } ",e.opts.messages!==!1&&(i+=" , message: '",e.opts._errorDataPathProperty?i+="is a required property":i+="should have required property \\'"+O+"\\'",i+="' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ",i+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=P}else f&&(i+=" if (true) {");return i}});var KNt=B((EOo,JNt)=>{"use strict";JNt.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,f=!e.opts.allErrors,d="data"+(s||""),p="valid"+o,h=e.opts.$data&&a&&a.$data,g;if(h?(i+=" var schema"+o+" = "+e.util.getData(a.$data,s,e.dataPathArr)+"; ",g="schema"+o):g=a,(a||h)&&e.opts.uniqueItems!==!1){h&&(i+=" var "+p+"; if ("+g+" === false || "+g+" === undefined) "+p+" = true; else if (typeof "+g+" != 'boolean') "+p+" = false; else { "),i+=" var i = "+d+".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("+d+"[i], "+d+"[j])) { "+p+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[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 w=w||[];w.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: "+d+" "),i+=" } "):i+=" {} ";var S=i;i=w.pop(),!e.compositeRule&&f?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+=" } ",f&&(i+=" else { ")}else f&&(i+=" if (true) { ");return i}});var ZNt=B((vOo,XNt)=>{"use strict";XNt.exports={$ref:fNt(),allOf:pNt(),anyOf:mNt(),$comment:ANt(),const:ENt(),contains:bNt(),dependencies:_Nt(),enum:SNt(),format:TNt(),if:INt(),items:BNt(),maximum:JPe(),minimum:JPe(),maxItems:KPe(),minItems:KPe(),maxLength:XPe(),minLength:XPe(),maxProperties:ZPe(),minProperties:ZPe(),multipleOf:PNt(),not:UNt(),oneOf:qNt(),pattern:GNt(),properties:VNt(),propertyNames:WNt(),required:zNt(),uniqueItems:KNt(),validate:YPe()}});var rOt=B((bOo,tOt)=>{"use strict";var eOt=ZNt(),eFe=kN().toHash;tOt.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=eFe(r),e.types=eFe(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(f){r.push(f),e.all[f]=!0})}r.push(s);var u=e.all[s]={keyword:s,code:eOt[s],implements:a};return u}),e.all.$comment={keyword:"$comment",code:eOt.$comment},o.type&&(e.types[o.type]=o)}),e.keywords=eFe(r.concat(n)),e.custom={},e}});var oOt=B((COo,iOt)=>{"use strict";var nOt=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];iOt.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<nOt.length;o++){var s=nOt[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 lOt=B((_Oo,aOt)=>{"use strict";var UTn=Z0e().MissingRef;aOt.exports=sOt;function sOt(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)?sOt.call(n,{$ref:c},!0):Promise.resolve()}function s(a){try{return n._compile(a)}catch(u){if(u instanceof UTn)return c(u);throw u}function c(u){var f=u.missingSchema;if(h(f))throw new Error("Schema "+f+" is loaded but "+u.missingRef+" cannot be resolved");var d=n._loadingSchemas[f];return d||(d=n._loadingSchemas[f]=n._opts.loadSchema(f),d.then(p,p)),d.then(function(g){if(!h(f))return o(g).then(function(){h(f)||n.addSchema(g,f,void 0,e)})}).then(function(){return s(a)});function p(){delete n._loadingSchemas[f]}function h(g){return n._refs[g]||n._schemas[g]}}}}});var uOt=B((wOo,cOt)=>{"use strict";cOt.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,f=!e.opts.allErrors,d,p="data"+(s||""),h="valid"+o,g="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,w="definition"+o,S=v.definition,T="",N,P,U,Q,D;if(A&&S.$data){D="keywordValidate"+o;var F=S.validateSchema;i+=" var "+w+" = RULES.custom['"+r+"'].definition; var "+D+" = "+w+".validate;"}else{if(Q=e.useCustomRule(v,a,e.schema,e),!Q)return;y="validate.schema"+c,D=Q.code,N=S.compile,P=S.inline,U=S.macro}var O=D+".errors",q="i"+o,L="ruleErr"+o,M=S.async;if(M&&!e.async)throw new Error("async keyword in sync schema");if(P||U||(i+=""+O+" = null;"),i+="var "+g+" = errors;var "+h+";",A&&S.$data&&(T+="}",i+=" if ("+y+" === undefined) { "+h+" = true; } else { ",F&&(T+="}",i+=" "+h+" = "+w+".validateSchema("+y+"); if ("+h+") { ")),P)S.statements?i+=" "+Q.validate+" ":i+=" "+h+" = "+Q.validate+"; ";else if(U){var j=e.util.copy(e),T="";j.level++;var G="valid"+j.level;j.schema=Q.validate,j.schemaPath="";var W=e.compositeRule;e.compositeRule=j.compositeRule=!0;var V=e.validate(j).replace(/validate\.schema/g,D);e.compositeRule=j.compositeRule=W,i+=" "+V}else{var ee=ee||[];ee.push(i),i="",i+=" "+D+".call( ",e.opts.passContext?i+="this":i+="self",N||S.schema===!1?i+=" , "+p+" ":i+=" , "+y+" , "+p+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",e.errorPath!='""'&&(i+=" + "+e.errorPath);var J=s?"data"+(s-1||""):"parentData",he=s?e.dataPathArr[s]:"parentDataProperty";i+=" , "+J+" , "+he+" , rootData ) ";var be=i;i=ee.pop(),S.errors===!1?(i+=" "+h+" = ",M&&(i+="await "),i+=""+be+"; "):M?(O="customErrors"+o,i+=" var "+O+" = null; try { "+h+" = await "+be+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+O+" = e.errors; else throw e; } "):i+=" "+O+" = null; "+h+" = "+be+"; "}if(S.modifying&&(i+=" if ("+J+") "+p+" = "+J+"["+he+"];"),i+=""+T,S.valid)f&&(i+=" if (true) { ");else{i+=" if ( ",S.valid===void 0?(i+=" !",U?i+=""+G:i+=""+h):i+=" "+!S.valid+" ",i+=") { ",d=v.keyword;var ee=ee||[];ee.push(i),i="";var ee=ee||[];ee.push(i),i="",e.createErrors!==!1?(i+=" { keyword: '"+(d||"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 ge=i;i=ee.pop(),!e.compositeRule&&f?e.async?i+=" throw new ValidationError(["+ge+"]); ":i+=" validate.errors = ["+ge+"]; return false; ":i+=" var err = "+ge+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var _e=i;i=ee.pop(),P?S.errors?S.errors!="full"&&(i+=" for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } "):S.errors===!1?i+=" "+_e+" ":(i+=" if ("+g+" == errors) { "+_e+" } else { for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } } "):U?(i+=" var err = ",e.createErrors!==!1?(i+=" { keyword: '"+(d||"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&&f&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):S.errors===!1?i+=" "+_e+" ":(i+=" if (Array.isArray("+O+")) { if (vErrors === null) vErrors = "+O+"; else vErrors = vErrors.concat("+O+"); errors = vErrors.length; for (var "+q+"="+g+"; "+q+"<errors; "+q+"++) { var "+L+" = vErrors["+q+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; "+L+'.schemaPath = "'+u+'"; ',e.opts.verbose&&(i+=" "+L+".schema = "+y+"; "+L+".data = "+p+"; "),i+=" } } else { "+_e+" } "),i+=" } ",f&&(i+=" else { ")}return i}});var tFe=B((SOo,QTn)=>{QTn.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 pOt=B((xOo,dOt)=>{"use strict";var fOt=tFe();dOt.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:fOt.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:fOt.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 mOt=B((TOo,hOt)=>{"use strict";var qTn=/^[a-z_$][a-z0-9_$-]*$/i,HTn=uOt(),GTn=pOt();hOt.exports={add:jTn,get:VTn,remove:$Tn,validate:rFe};function jTn(t,e){var r=this.RULES;if(r.keywords[t])throw new Error("Keyword "+t+" is already defined");if(!qTn.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 f,d=0;d<r.length;d++){var p=r[d];if(p.type==c){f=p;break}}f||(f={type:c,rules:[]},r.push(f));var h={keyword:a,definition:u,custom:!0,code:HTn,implements:u.implements};f.rules.push(h),r.custom[a]=h}return this}function VTn(t){var e=this.RULES.custom[t];return e?e.definition:this.RULES.keywords[t]||!1}function $Tn(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 rFe(t,e){rFe.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(GTn,!0);if(r(t))return!0;if(rFe.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var gOt=B((DOo,WTn)=>{WTn.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 xOt=B((IOo,SOt)=>{"use strict";var yOt=zBt(),LN=X0e(),YTn=KBt(),EOt=qPe(),zTn=WPe(),JTn=cNt(),KTn=rOt(),vOt=oOt(),bOt=kN();SOt.exports=Xf;Xf.prototype.validate=ZTn;Xf.prototype.compile=eDn;Xf.prototype.addSchema=tDn;Xf.prototype.addMetaSchema=rDn;Xf.prototype.validateSchema=nDn;Xf.prototype.getSchema=oDn;Xf.prototype.removeSchema=aDn;Xf.prototype.addFormat=mDn;Xf.prototype.errorsText=hDn;Xf.prototype._addSchema=lDn;Xf.prototype._compile=cDn;Xf.prototype.compileAsync=lOt();var ame=mOt();Xf.prototype.addKeyword=ame.add;Xf.prototype.getKeyword=ame.get;Xf.prototype.removeKeyword=ame.remove;Xf.prototype.validateKeyword=ame.validate;var COt=Z0e();Xf.ValidationError=COt.Validation;Xf.MissingRefError=COt.MissingRef;Xf.$dataMetaSchema=vOt;var sme="http://json-schema.org/draft-07/schema",AOt=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],XTn=["/properties"];function Xf(t){if(!(this instanceof Xf))return new Xf(t);t=this._opts=bOt.copy(t)||{},bDn(this),this._schemas={},this._refs={},this._fragments={},this._formats=JTn(t.format),this._cache=t.cache||new YTn,this._loadingSchemas={},this._compilations=[],this.RULES=KTn(),this._getId=uDn(t),t.loopRequired=t.loopRequired||1/0,t.errorDataPath=="property"&&(t._errorDataPathProperty=!0),t.serialize===void 0&&(t.serialize=zTn),this._metaOpts=vDn(this),t.formats&&yDn(this),t.keywords&&EDn(this),gDn(this),typeof t.meta=="object"&&this.addMetaSchema(t.meta),t.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ADn(this)}function ZTn(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 eDn(t,e){var r=this._addSchema(t,void 0,e);return r.validate||this._compile(r)}function tDn(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=LN.normalizeId(e||o),wOt(this,e),this._schemas[e]=this._addSchema(t,r,n,!0),this}function rDn(t,e,r){return this.addSchema(t,e,r,!0),this}function nDn(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||iDn(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 iDn(t){var e=t._opts.meta;return t._opts.defaultMeta=typeof e=="object"?t._getId(e)||e:t.getSchema(sme)?sme:void 0,t._opts.defaultMeta}function oDn(t){var e=_Ot(this,t);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return sDn(this,t)}}function sDn(t,e){var r=LN.schema.call(t,{schema:{}},e);if(r){var n=r.schema,i=r.root,o=r.baseId,s=yOt.call(t,n,i,void 0,o);return t._fragments[e]=new EOt({ref:e,fragment:!0,schema:n,root:i,baseId:o,validate:s}),s}}function _Ot(t,e){return e=LN.normalizeId(e),t._schemas[e]||t._refs[e]||t._fragments[e]}function aDn(t){if(t instanceof RegExp)return ome(this,this._schemas,t),ome(this,this._refs,t),this;switch(typeof t){case"undefined":return ome(this,this._schemas),ome(this,this._refs),this._cache.clear(),this;case"string":var e=_Ot(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=LN.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this}function ome(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 lDn(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=LN.normalizeId(this._getId(t));a&&n&&wOt(this,a);var c=this._opts.validateSchema!==!1&&!e,u;c&&!(u=a&&a==LN.normalizeId(t.$schema))&&this.validateSchema(t,!0);var f=LN.ids.call(this,t),d=new EOt({id:a,schema:t,localRefs:f,cacheKey:o,meta:r});return a[0]!="#"&&n&&(this._refs[a]=d),this._cache.put(o,d),c&&u&&this.validateSchema(t,!0),d}function cDn(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=yOt.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 uDn(t){switch(t.schemaId){case"auto":return pDn;case"id":return fDn;default:return dDn}}function fDn(t){return t.$id&&this.logger.warn("schema $id ignored",t.$id),t.id}function dDn(t){return t.id&&this.logger.warn("schema id ignored",t.id),t.$id}function pDn(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 hDn(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 mDn(t,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[t]=e,this}function gDn(t){var e;if(t._opts.$data&&(e=gOt(),t.addMetaSchema(e,e.$id,!0)),t._opts.meta!==!1){var r=tFe();t._opts.$data&&(r=vOt(r,XTn)),t.addMetaSchema(r,sme,!0),t._refs["http://json-schema.org/schema"]=sme}}function ADn(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 yDn(t){for(var e in t._opts.formats){var r=t._opts.formats[e];t.addFormat(e,r)}}function EDn(t){for(var e in t._opts.keywords){var r=t._opts.keywords[e];t.addKeyword(e,r)}}function wOt(t,e){if(t._schemas[e]||t._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function vDn(t){for(var e=bOt.copy(t._opts),r=0;r<AOt.length;r++)delete e[AOt[r]];return e}function bDn(t){var e=t._opts.logger;if(e===!1)t.logger={log:nFe,warn:nFe,error:nFe};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 nFe(){}});var TOt,E3,aH=Ie(()=>{SBt();Bx();TOt=ze(xOt(),1),E3=class extends j0e{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 TOt.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=wBt(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:oH,capabilities:this._capabilities,clientInfo:this._clientInfo}},wPe,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!sBt.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"},MN,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},OPe,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},MN,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},$Z,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},VZ,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},xPe,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},TPe,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},DPe,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},MN,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},MN,r)}async callTool(e,r=H0e,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 k6(M6.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent)try{if(!o(i.structuredContent))throw new k6(M6.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(o.errors)}`)}catch(s){throw s instanceof k6?s:new k6(M6.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},NPe,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var NOt=B((OOo,BOt)=>{BOt.exports=ROt;ROt.sync=_Dn;var DOt=Se("fs");function CDn(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 IOt(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:CDn(e,r)}function ROt(t,e,r){DOt.stat(t,function(n,i){r(n,n?!1:IOt(i,t,e))})}function _Dn(t,e){return IOt(DOt.statSync(t),t,e)}});var POt=B((MOo,LOt)=>{LOt.exports=MOt;MOt.sync=wDn;var OOt=Se("fs");function MOt(t,e,r){OOt.stat(t,function(n,i){r(n,n?!1:kOt(i,e))})}function wDn(t,e){return kOt(OOt.statSync(t),e)}function kOt(t,e){return t.isFile()&&SDn(t,e)}function SDn(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),f=a|c,d=r&u||r&c&&i===s||r&a&&n===o||r&f&&o===0;return d}});var UOt=B((LOo,FOt)=>{var kOo=Se("fs"),lme;process.platform==="win32"||global.TESTING_WINDOWS?lme=NOt():lme=POt();FOt.exports=iFe;iFe.sync=xDn;function iFe(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){iFe(t,e||{},function(o,s){o?i(o):n(s)})})}lme(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function xDn(t,e){try{return lme.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var $Ot=B((POo,VOt)=>{var lH=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",QOt=Se("path"),TDn=lH?";":":",qOt=UOt(),HOt=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),GOt=(t,e)=>{let r=e.colon||TDn,n=t.match(/\//)||lH&&t.match(/\\/)?[""]:[...lH?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=lH?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=lH?i.split(r):[""];return lH&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},jOt=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=GOt(t,e),s=[],a=u=>new Promise((f,d)=>{if(u===n.length)return e.all&&s.length?f(s):d(HOt(t));let p=n[u],h=/^".*"$/.test(p)?p.slice(1,-1):p,g=QOt.join(h,t),A=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;f(c(A,u,0))}),c=(u,f,d)=>new Promise((p,h)=>{if(d===i.length)return p(a(f+1));let g=i[d];qOt(u+g,{pathExt:o},(A,y)=>{if(!A&&y)if(e.all)s.push(u+g);else return p(u+g);return p(c(u,f,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},DDn=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=GOt(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=QOt.join(c,t),f=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let p=f+n[d];try{if(qOt.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 HOt(t)};VOt.exports=jOt;jOt.sync=DDn});var YOt=B((FOo,oFe)=>{"use strict";var WOt=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};oFe.exports=WOt;oFe.exports.default=WOt});var XOt=B((UOo,KOt)=>{"use strict";var zOt=Se("path"),IDn=$Ot(),RDn=YOt();function JOt(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=IDn.sync(t.command,{path:r[RDn({env:r})],pathExt:e?zOt.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=zOt.resolve(i?t.options.cwd:"",s)),s}function BDn(t){return JOt(t)||JOt(t,!0)}KOt.exports=BDn});var ZOt=B((QOo,aFe)=>{"use strict";var sFe=/([()\][%!^"`<>&|;, *?])/g;function NDn(t){return t=t.replace(sFe,"^$1"),t}function ODn(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(sFe,"^$1"),e&&(t=t.replace(sFe,"^$1")),t}aFe.exports.command=NDn;aFe.exports.argument=ODn});var tMt=B((qOo,eMt)=>{"use strict";eMt.exports=/^#!(.*)/});var nMt=B((HOo,rMt)=>{"use strict";var MDn=tMt();rMt.exports=(t="")=>{let e=t.match(MDn);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var oMt=B((GOo,iMt)=>{"use strict";var lFe=Se("fs"),kDn=nMt();function LDn(t){let r=Buffer.alloc(150),n;try{n=lFe.openSync(t,"r"),lFe.readSync(n,r,0,150,0),lFe.closeSync(n)}catch{}return kDn(r.toString())}iMt.exports=LDn});var cMt=B((jOo,lMt)=>{"use strict";var PDn=Se("path"),sMt=XOt(),aMt=ZOt(),FDn=oMt(),UDn=process.platform==="win32",QDn=/\.(?:com|exe)$/i,qDn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function HDn(t){t.file=sMt(t);let e=t.file&&FDn(t.file);return e?(t.args.unshift(t.file),t.command=e,sMt(t)):t.file}function GDn(t){if(!UDn)return t;let e=HDn(t),r=!QDn.test(e);if(t.options.forceShell||r){let n=qDn.test(e);t.command=PDn.normalize(t.command),t.command=aMt.command(t.command),t.args=t.args.map(o=>aMt.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 jDn(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:GDn(n)}lMt.exports=jDn});var dMt=B((VOo,fMt)=>{"use strict";var cFe=process.platform==="win32";function uFe(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 VDn(t,e){if(!cFe)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=uMt(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function uMt(t,e){return cFe&&t===1&&!e.file?uFe(e.original,"spawn"):null}function $Dn(t,e){return cFe&&t===1&&!e.file?uFe(e.original,"spawnSync"):null}fMt.exports={hookChildProcess:VDn,verifyENOENT:uMt,verifyENOENTSync:$Dn,notFoundError:uFe}});var mMt=B(($Oo,cH)=>{"use strict";var pMt=Se("child_process"),fFe=cMt(),dFe=dMt();function hMt(t,e,r){let n=fFe(t,e,r),i=pMt.spawn(n.command,n.args,n.options);return dFe.hookChildProcess(i,n),i}function WDn(t,e,r){let n=fFe(t,e,r),i=pMt.spawnSync(n.command,n.args,n.options);return i.error=i.error||dFe.verifyENOENTSync(i.status,n),i}cH.exports=hMt;cH.exports.spawn=hMt;cH.exports.sync=WDn;cH.exports._parse=fFe;cH.exports._enoent=dFe});function YDn(t){return Rx.parse(JSON.parse(t))}function gMt(t){return JSON.stringify(t)+`
415
415
  `}var cme,AMt=Ie(()=>{Bx();cme=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
416
416
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),YDn(r)}clear(){this._buffer=void 0}}});import ume from"node:process";import{PassThrough as zDn}from"node:stream";function KDn(){let t={};for(let e of JDn){let r=ume.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}function XDn(){return"type"in ume}var yMt,JDn,uH,pFe=Ie(()=>{yMt=ze(mMt(),1);AMt();JDn=ume.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];uH=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new cme,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new zDn)}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,yMt.default)(this._serverParams.command,(n=this._serverParams.args)!==null&&n!==void 0?n:[],{env:{...KDn(),...this._serverParams.env},stdio:["pipe","pipe",(i=this._serverParams.stderr)!==null&&i!==void 0?i:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:ume.platform==="win32"&&XDn(),cwd:this._serverParams.cwd}),this._process.on("error",c=>{var u,f;if(c.name==="AbortError"){(u=this.onclose)===null||u===void 0||u.call(this);return}r(c),(f=this.onerror)===null||f===void 0||f.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=gMt(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});function hFe(t){}function dme(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=hFe,onError:r=hFe,onRetry:n=hFe,onComment:i}=t,o="",s=!0,a,c="",u="";function f(A){let y=s?A.replace(/^\xEF\xBB\xBF/,""):A,[v,w]=ZDn(`${o}${y}`);for(let S of v)d(S);o=w,s=!1}function d(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),w=A[y+1]===" "?2:1,S=A.slice(y+w);p(v,S,A);return}p(A,"",A)}function p(A,y,v){switch(A){case"event":u=y;break;case"data":c=`${c}${y}
417
417
  `;break;case"id":a=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?n(parseInt(y,10)):r(new fme(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:v}));break;default:r(new fme(`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(`
418
418
  `)?c.slice(0,-1):c}),a=void 0,c="",u=""}function g(A={}){o&&A.consume&&d(o),s=!0,a=void 0,c="",u="",o=""}return{feed:f,reset:g}}function ZDn(t){let e=[],r="",n=0;for(;n<t.length;){let i=t.indexOf("\r",n),o=t.indexOf(`
419
419
  `,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]===`
420
- `&&n++}}return[e,r]}var fme,mFe=Ie(()=>{fme=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 eIn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function gFe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(gFe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${gFe(t.cause)}`:t.message:`${t}`}function EMt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function tIn(){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 hme,bMt,wFe,Ks,Xp,Xu,O7,P1,PN,fH,pme,mme,JZ,hH,KZ,kx,dH,mH,pH,YZ,g5,AFe,yFe,EFe,vMt,vFe,bFe,zZ,CFe,_Fe,FN,CMt=Ie(()=>{mFe();hme=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(EMt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(EMt(this),r)}};bMt=t=>{throw TypeError(t)},wFe=(t,e,r)=>e.has(t)||bMt("Cannot "+r),Ks=(t,e,r)=>(wFe(t,e,"read from private field"),r?r.call(t):e.get(t)),Xp=(t,e,r)=>e.has(t)?bMt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xu=(t,e,r,n)=>(wFe(t,e,"write to private field"),e.set(t,r),r),O7=(t,e,r)=>(wFe(t,e,"access private method"),r),FN=class extends EventTarget{constructor(e,r){var n,i;super(),Xp(this,g5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xp(this,P1),Xp(this,PN),Xp(this,fH),Xp(this,pme),Xp(this,mme),Xp(this,JZ),Xp(this,hH),Xp(this,KZ,null),Xp(this,kx),Xp(this,dH),Xp(this,mH,null),Xp(this,pH,null),Xp(this,YZ,null),Xp(this,yFe,async o=>{var s;Ks(this,dH).reset();let{body:a,redirected:c,status:u,headers:f}=o;if(u===204){O7(this,g5,zZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Xu(this,fH,new URL(o.url)):Xu(this,fH,void 0),u!==200){O7(this,g5,zZ).call(this,`Non-200 status code (${u})`,u);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){O7(this,g5,zZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ks(this,P1)===this.CLOSED)return;Xu(this,P1,this.OPEN);let d=new Event("open");if((s=Ks(this,YZ))==null||s.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){O7(this,g5,zZ).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),g=!0;do{let{done:A,value:y}=await h.read();y&&Ks(this,dH).feed(p.decode(y,{stream:!A})),A&&(g=!1,Ks(this,dH).reset(),O7(this,g5,CFe).call(this))}while(g)}),Xp(this,EFe,o=>{Xu(this,kx,void 0),!(o.name==="AbortError"||o.type==="aborted")&&O7(this,g5,CFe).call(this,gFe(o))}),Xp(this,vFe,o=>{typeof o.id=="string"&&Xu(this,KZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ks(this,fH)?Ks(this,fH).origin:Ks(this,PN).origin,lastEventId:o.id||""});Ks(this,pH)&&(!o.event||o.event==="message")&&Ks(this,pH).call(this,s),this.dispatchEvent(s)}),Xp(this,bFe,o=>{Xu(this,JZ,o)}),Xp(this,_Fe,()=>{Xu(this,hH,void 0),Ks(this,P1)===this.CONNECTING&&O7(this,g5,AFe).call(this)});try{if(e instanceof URL)Xu(this,PN,e);else if(typeof e=="string")Xu(this,PN,new URL(e,tIn()));else throw new Error("Invalid URL")}catch{throw eIn("An invalid or illegal string was specified")}Xu(this,dH,dme({onEvent:Ks(this,vFe),onRetry:Ks(this,bFe)})),Xu(this,P1,this.CONNECTING),Xu(this,JZ,3e3),Xu(this,mme,(n=r?.fetch)!=null?n:globalThis.fetch),Xu(this,pme,(i=r?.withCredentials)!=null?i:!1),O7(this,g5,AFe).call(this)}get readyState(){return Ks(this,P1)}get url(){return Ks(this,PN).href}get withCredentials(){return Ks(this,pme)}get onerror(){return Ks(this,mH)}set onerror(e){Xu(this,mH,e)}get onmessage(){return Ks(this,pH)}set onmessage(e){Xu(this,pH,e)}get onopen(){return Ks(this,YZ)}set onopen(e){Xu(this,YZ,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(){Ks(this,hH)&&clearTimeout(Ks(this,hH)),Ks(this,P1)!==this.CLOSED&&(Ks(this,kx)&&Ks(this,kx).abort(),Xu(this,P1,this.CLOSED),Xu(this,kx,void 0))}};P1=new WeakMap,PN=new WeakMap,fH=new WeakMap,pme=new WeakMap,mme=new WeakMap,JZ=new WeakMap,hH=new WeakMap,KZ=new WeakMap,kx=new WeakMap,dH=new WeakMap,mH=new WeakMap,pH=new WeakMap,YZ=new WeakMap,g5=new WeakSet,AFe=function(){Xu(this,P1,this.CONNECTING),Xu(this,kx,new AbortController),Ks(this,mme)(Ks(this,PN),O7(this,g5,vMt).call(this)).then(Ks(this,yFe)).catch(Ks(this,EFe))},yFe=new WeakMap,EFe=new WeakMap,vMt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ks(this,KZ)?{"Last-Event-ID":Ks(this,KZ)}:void 0},cache:"no-store",signal:(t=Ks(this,kx))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},vFe=new WeakMap,bFe=new WeakMap,zZ=function(t,e){var r;Ks(this,P1)!==this.CLOSED&&Xu(this,P1,this.CLOSED);let n=new hme("error",{code:e,message:t});(r=Ks(this,mH))==null||r.call(this,n),this.dispatchEvent(n)},CFe=function(t,e){var r;if(Ks(this,P1)===this.CLOSED)return;Xu(this,P1,this.CONNECTING);let n=new hme("error",{code:e,message:t});(r=Ks(this,mH))==null||r.call(this,n),this.dispatchEvent(n),Xu(this,hH,setTimeout(Ks(this,_Fe),Ks(this,JZ)))},_Fe=new WeakMap,FN.CONNECTING=0,FN.OPEN=1,FN.CLOSED=2});async function rIn(t){return(await SFe).getRandomValues(new Uint8Array(t))}async function nIn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await rIn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function iIn(t){return await nIn(t)}async function oIn(t){let e=await(await SFe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xFe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await iIn(t),r=await oIn(e);return{code_verifier:e,code_challenge:r}}var SFe,_Mt=Ie(()=>{SFe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Jh,wMt,TFe,sIn,SMt,DFe,xMt,aIn,lIn,TMt,iMo,oMo,IFe=Ie(()=>{qZ();Jh=Oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),Oe.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"}),wMt=Oe.object({resource:Oe.string().url(),authorization_servers:Oe.array(Jh).optional(),jwks_uri:Oe.string().url().optional(),scopes_supported:Oe.array(Oe.string()).optional(),bearer_methods_supported:Oe.array(Oe.string()).optional(),resource_signing_alg_values_supported:Oe.array(Oe.string()).optional(),resource_name:Oe.string().optional(),resource_documentation:Oe.string().optional(),resource_policy_uri:Oe.string().url().optional(),resource_tos_uri:Oe.string().url().optional(),tls_client_certificate_bound_access_tokens:Oe.boolean().optional(),authorization_details_types_supported:Oe.array(Oe.string()).optional(),dpop_signing_alg_values_supported:Oe.array(Oe.string()).optional(),dpop_bound_access_tokens_required:Oe.boolean().optional()}).passthrough(),TFe=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),service_documentation:Jh.optional(),revocation_endpoint:Jh.optional(),revocation_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),introspection_endpoint:Oe.string().optional(),introspection_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),code_challenge_methods_supported:Oe.array(Oe.string()).optional()}).passthrough(),sIn=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,userinfo_endpoint:Jh.optional(),jwks_uri:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),acr_values_supported:Oe.array(Oe.string()).optional(),subject_types_supported:Oe.array(Oe.string()),id_token_signing_alg_values_supported:Oe.array(Oe.string()),id_token_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),id_token_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),userinfo_signing_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),request_object_signing_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),display_values_supported:Oe.array(Oe.string()).optional(),claim_types_supported:Oe.array(Oe.string()).optional(),claims_supported:Oe.array(Oe.string()).optional(),service_documentation:Oe.string().optional(),claims_locales_supported:Oe.array(Oe.string()).optional(),ui_locales_supported:Oe.array(Oe.string()).optional(),claims_parameter_supported:Oe.boolean().optional(),request_parameter_supported:Oe.boolean().optional(),request_uri_parameter_supported:Oe.boolean().optional(),require_request_uri_registration:Oe.boolean().optional(),op_policy_uri:Jh.optional(),op_tos_uri:Jh.optional()}).passthrough(),SMt=sIn.merge(TFe.pick({code_challenge_methods_supported:!0})),DFe=Oe.object({access_token:Oe.string(),id_token:Oe.string().optional(),token_type:Oe.string(),expires_in:Oe.number().optional(),scope:Oe.string().optional(),refresh_token:Oe.string().optional()}).strip(),xMt=Oe.object({error:Oe.string(),error_description:Oe.string().optional(),error_uri:Oe.string().optional()}),aIn=Oe.object({redirect_uris:Oe.array(Jh),token_endpoint_auth_method:Oe.string().optional(),grant_types:Oe.array(Oe.string()).optional(),response_types:Oe.array(Oe.string()).optional(),client_name:Oe.string().optional(),client_uri:Jh.optional(),logo_uri:Jh.optional(),scope:Oe.string().optional(),contacts:Oe.array(Oe.string()).optional(),tos_uri:Jh.optional(),policy_uri:Oe.string().optional(),jwks_uri:Jh.optional(),jwks:Oe.any().optional(),software_id:Oe.string().optional(),software_version:Oe.string().optional(),software_statement:Oe.string().optional()}).strip(),lIn=Oe.object({client_id:Oe.string(),client_secret:Oe.string().optional(),client_id_issued_at:Oe.number().optional(),client_secret_expires_at:Oe.number().optional()}).strip(),TMt=aIn.merge(lIn),iMo=Oe.object({error:Oe.string(),error_description:Oe.string().optional()}).strip(),oMo=Oe.object({token:Oe.string(),token_type_hint:Oe.string().optional()}).strip()});function DMt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function IMt({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 RMt=Ie(()=>{});var vp,XZ,UN,QN,qN,ZZ,eee,tee,M7,ree,nee,iee,oee,see,aee,lee,cee,BMt,NMt=Ie(()=>{vp=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}},XZ=class extends vp{};XZ.errorCode="invalid_request";UN=class extends vp{};UN.errorCode="invalid_client";QN=class extends vp{};QN.errorCode="invalid_grant";qN=class extends vp{};qN.errorCode="unauthorized_client";ZZ=class extends vp{};ZZ.errorCode="unsupported_grant_type";eee=class extends vp{};eee.errorCode="invalid_scope";tee=class extends vp{};tee.errorCode="access_denied";M7=class extends vp{};M7.errorCode="server_error";ree=class extends vp{};ree.errorCode="temporarily_unavailable";nee=class extends vp{};nee.errorCode="unsupported_response_type";iee=class extends vp{};iee.errorCode="unsupported_token_type";oee=class extends vp{};oee.errorCode="invalid_token";see=class extends vp{};see.errorCode="method_not_allowed";aee=class extends vp{};aee.errorCode="too_many_requests";lee=class extends vp{};lee.errorCode="invalid_client_metadata";cee=class extends vp{};cee.errorCode="insufficient_scope";BMt={[XZ.errorCode]:XZ,[UN.errorCode]:UN,[QN.errorCode]:QN,[qN.errorCode]:qN,[ZZ.errorCode]:ZZ,[eee.errorCode]:eee,[tee.errorCode]:tee,[M7.errorCode]:M7,[ree.errorCode]:ree,[nee.errorCode]:nee,[iee.errorCode]:iee,[oee.errorCode]:oee,[see.errorCode]:see,[aee.errorCode]:aee,[lee.errorCode]:lee,[cee.errorCode]:cee}});function MMt(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 kMt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":cIn(i,o,r);return;case"client_secret_post":uIn(i,o,n);return;case"none":fIn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function cIn(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 uIn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function fIn(t,e){e.set("client_id",t)}async function BFe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=xMt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=BMt[i]||M7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new M7(i)}}async function Lx(t,e){var r,n;try{return await RFe(t,e)}catch(i){if(i instanceof UN||i instanceof qN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await RFe(t,e);if(i instanceof QN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await RFe(t,e);throw i}}async function RFe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await pIn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await dIn(e,t,s),u=await yIn(a,{fetchFn:o}),f=await Promise.resolve(t.clientInformation());if(!f){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 vIn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),f=A}if(r!==void 0){let A=await t.codeVerifier(),y=await OFe(a,{metadata:u,clientInformation:f,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let d=await t.tokens();if(d?.refresh_token)try{let A=await MFe(a,{metadata:u,clientInformation:f,refreshToken:d.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof vp)||A instanceof M7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:g}=await EIn(a,{metadata:u,clientInformation:f,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(h),"REDIRECT"}async function dIn(t,e,r){let n=DMt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!IMt({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 uee(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 pIn(t,e,r=fetch){let n=await gIn(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 wMt.parse(await n.json())}async function NFe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?NFe(t,void 0,r):void 0;throw n}}function hIn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function OMt(t,e,r=fetch){return await NFe(t,{"MCP-Protocol-Version":e},r)}function mIn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function gIn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:oH,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let f=hIn(e,s.pathname);c=new URL(f,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await OMt(c,a,r);if(!n?.metadataUrl&&mIn(u,s.pathname)){let f=new URL(`/.well-known/${e}`,s);u=await OMt(f,a,r)}return u}function AIn(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 yIn(t,{fetchFn:e=fetch,protocolVersion:r=oH}={}){var n;let i={"MCP-Protocol-Version":r},o=AIn(t);for(let{url:s,type:a}of o){let c=await NFe(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 TFe.parse(await c.json());{let u=SMt.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 EIn(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 f=await xFe(),d=f.code_verifier,p=f.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:d}}async function OFe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let f="authorization_code",d=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:f,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=MMt(r,A);kMt(y,r,p,h)}s&&h.set("resource",s.href);let g=await(c??fetch)(d,{method:"POST",headers:p,body:h});if(!g.ok)throw await BFe(g);return DFe.parse(await g.json())}async function MFe(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 f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(f,d,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=MMt(r,h);kMt(g,r,f,d)}i&&d.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:f,body:d});if(!p.ok)throw await BFe(p);return DFe.parse({refresh_token:n,...await p.json()})}async function vIn(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 BFe(o);return TMt.parse(await o.json())}var F1,gme=Ie(()=>{_Mt();Bx();IFe();IFe();RMt();NMt();F1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var kFe,gH,LMt=Ie(()=>{CMt();Bx();gme();kFe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},gH=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 F1("No auth provider");let r;try{r=await Lx(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 F1;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 FN(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let f=await i(a,{...c,headers:u});return f.status===401&&f.headers.has("www-authenticate")&&(this._resourceMetadataUrl=uee(f)),f}}),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 kFe(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(f){s(f),(c=this.onerror)===null||c===void 0||c.call(this,f),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let f=a,d;try{d=Rx.parse(JSON.parse(f.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,d)}})}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 F1("No auth provider");if(await Lx(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1("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=uee(a),await Lx(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1;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 Ame,PMt=Ie(()=>{mFe();Ame=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=dme({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 bIn,fee,Px,LFe=Ie(()=>{Bx();gme();PMt();bIn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},fee=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Px=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:bIn}async _authThenStart(){var e;if(!this._authProvider)throw new F1("No auth provider");let r;try{r=await Lx(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 F1;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 fee(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,f,d;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ame).getReader();for(;;){let{value:h,done:g}=await p.read();if(g)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=Rx.parse(JSON.parse(h.data));o!==void 0&&GZ(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((f=this.onerror)===null||f===void 0||f.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){(d=this.onerror)===null||d===void 0||d.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 F1("No auth provider");if(await Lx(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1("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:L0e(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 f={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},d=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,f),p=d.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=uee(d),await Lx(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1;return this.send(e)}let y=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${y}`)}if(d.status===202){ABt(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 g=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=d.headers.get("content-type");if(g)if(A?.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await d.json(),v=Array.isArray(y)?y.map(w=>Rx.parse(w)):[Rx.parse(y)];for(let w of v)(o=this.onmessage)===null||o===void 0||o.call(this,w)}else throw new fee(-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 fee(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 CIn}from"node:fs/promises";var dee,pee,HN,PFe=Ie(()=>{"use strict";QX();gme();(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"})(dee||(dee={}));pee=class extends Error{code;constructor(e,r){super(r),this.code=e}},HN=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||lx.default}async start(){if(this._isClosed)throw new Error("Transport is closed");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 MFe(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("Unauthorized: OAuth required")}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 pee(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 pee(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error("No auth provider configured");try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await OFe(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("Client information not available")}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===lx.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error("Transport is closed");if(!this._websocket)throw new Error("Transport not started");if(this._websocket.readyState!==lx.default.OPEN)throw new Error("WebSocket is not open");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 pee(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:dee.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.19-beta.2",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:dee.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await CIn(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:dee.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 FMt,yme,UMt=Ie(()=>{"use strict";FMt=ze(Fhe(),1);yme=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("Scopes must be provided in the oauth config for Google Credentials provider");this.auth=new FMt.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("Failed to get access token from Google ADC");return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as _In}from"node:child_process";import{promisify as wIn}from"node:util";import{platform as SIn}from"node:os";import{URL as xIn}from"node:url";function TIn(t){let e;try{e=new xIn(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 qMt(t){TIn(t);let e=SIn(),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 QMt(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 QMt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var QMt,HMt=Ie(()=>{"use strict";QMt=wIn(_In)});function Ds(t){return t instanceof Error&&"code"in t}function Tr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function FFe(t){if(t&&typeof t=="object"&&"response"in t){let r=DIn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new vme(r.error.message);case 401:return new Fx(r.error.message);case 403:return new Eme(r.error.message);default:}}return t}function DIn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Eme,Fx,vme,_f=Ie(()=>{"use strict";Eme=class extends Error{},Fx=class extends Error{},vme=class extends Error{}});import{promises as AH}from"node:fs";import*as bme from"node:path";import*as GMt from"node:os";var Kh,Cme=Ie(()=>{"use strict";_f();Kh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=GMt.homedir();return bme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=bme.dirname(this.getTokenFilePath());await AH.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await AH.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(`Failed to load MCP OAuth tokens: ${Tr(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 AH.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(f){throw console.error(`Failed to save MCP OAuth token: ${Tr(f)}`),f}}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 AH.unlink(i):await AH.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(`Failed to remove MCP OAuth token: ${Tr(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 AH.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(`Failed to clear MCP OAuth tokens: ${Tr(e)}`)}}}});var Xh,_me=Ie(()=>{"use strict";_f();Xh=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}: ${Tr(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}: ${Tr(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("Dynamic client registration is supported at:",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("Dynamic client registration is supported at:",i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Tr(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(`Found resource metadata URI from www-authenticate header: ${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("OAuth configuration discovered successfully from www-authenticate header"),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 jMt from"node:http";import*as hee from"node:crypto";import{URL as UFe}from"node:url";var v3,QFe=Ie(()=>{"use strict";HMt();Cme();_f();_me();v3=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(`Client registration failed: ${o.status} ${o.statusText} - ${s}`)}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Xh.extractBaseUrl(e);return Xh.discoverOAuthConfig(r)}static generatePKCEParams(){let e=hee.randomBytes(32).toString("base64url"),r=hee.createHash("sha256").update(e).digest("base64url"),n=hee.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=jMt.createServer(async(o,s)=>{try{let a=new UFe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end("Not found");return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),f=a.searchParams.get("error");if(f){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
420
+ `&&n++}}return[e,r]}var fme,mFe=Ie(()=>{fme=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 eIn(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function gFe(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(gFe).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${gFe(t.cause)}`:t.message:`${t}`}function EMt(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}function tIn(){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 hme,bMt,wFe,Ks,Xp,Xu,O7,P1,PN,fH,pme,mme,JZ,hH,KZ,kx,dH,mH,pH,YZ,g5,AFe,yFe,EFe,vMt,vFe,bFe,zZ,CFe,_Fe,FN,CMt=Ie(()=>{mFe();hme=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(EMt(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(EMt(this),r)}};bMt=t=>{throw TypeError(t)},wFe=(t,e,r)=>e.has(t)||bMt("Cannot "+r),Ks=(t,e,r)=>(wFe(t,e,"read from private field"),r?r.call(t):e.get(t)),Xp=(t,e,r)=>e.has(t)?bMt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Xu=(t,e,r,n)=>(wFe(t,e,"write to private field"),e.set(t,r),r),O7=(t,e,r)=>(wFe(t,e,"access private method"),r),FN=class extends EventTarget{constructor(e,r){var n,i;super(),Xp(this,g5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xp(this,P1),Xp(this,PN),Xp(this,fH),Xp(this,pme),Xp(this,mme),Xp(this,JZ),Xp(this,hH),Xp(this,KZ,null),Xp(this,kx),Xp(this,dH),Xp(this,mH,null),Xp(this,pH,null),Xp(this,YZ,null),Xp(this,yFe,async o=>{var s;Ks(this,dH).reset();let{body:a,redirected:c,status:u,headers:f}=o;if(u===204){O7(this,g5,zZ).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Xu(this,fH,new URL(o.url)):Xu(this,fH,void 0),u!==200){O7(this,g5,zZ).call(this,`Non-200 status code (${u})`,u);return}if(!(f.get("content-type")||"").startsWith("text/event-stream")){O7(this,g5,zZ).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ks(this,P1)===this.CLOSED)return;Xu(this,P1,this.OPEN);let d=new Event("open");if((s=Ks(this,YZ))==null||s.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){O7(this,g5,zZ).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let p=new TextDecoder,h=a.getReader(),g=!0;do{let{done:A,value:y}=await h.read();y&&Ks(this,dH).feed(p.decode(y,{stream:!A})),A&&(g=!1,Ks(this,dH).reset(),O7(this,g5,CFe).call(this))}while(g)}),Xp(this,EFe,o=>{Xu(this,kx,void 0),!(o.name==="AbortError"||o.type==="aborted")&&O7(this,g5,CFe).call(this,gFe(o))}),Xp(this,vFe,o=>{typeof o.id=="string"&&Xu(this,KZ,o.id);let s=new MessageEvent(o.event||"message",{data:o.data,origin:Ks(this,fH)?Ks(this,fH).origin:Ks(this,PN).origin,lastEventId:o.id||""});Ks(this,pH)&&(!o.event||o.event==="message")&&Ks(this,pH).call(this,s),this.dispatchEvent(s)}),Xp(this,bFe,o=>{Xu(this,JZ,o)}),Xp(this,_Fe,()=>{Xu(this,hH,void 0),Ks(this,P1)===this.CONNECTING&&O7(this,g5,AFe).call(this)});try{if(e instanceof URL)Xu(this,PN,e);else if(typeof e=="string")Xu(this,PN,new URL(e,tIn()));else throw new Error("Invalid URL")}catch{throw eIn("An invalid or illegal string was specified")}Xu(this,dH,dme({onEvent:Ks(this,vFe),onRetry:Ks(this,bFe)})),Xu(this,P1,this.CONNECTING),Xu(this,JZ,3e3),Xu(this,mme,(n=r?.fetch)!=null?n:globalThis.fetch),Xu(this,pme,(i=r?.withCredentials)!=null?i:!1),O7(this,g5,AFe).call(this)}get readyState(){return Ks(this,P1)}get url(){return Ks(this,PN).href}get withCredentials(){return Ks(this,pme)}get onerror(){return Ks(this,mH)}set onerror(e){Xu(this,mH,e)}get onmessage(){return Ks(this,pH)}set onmessage(e){Xu(this,pH,e)}get onopen(){return Ks(this,YZ)}set onopen(e){Xu(this,YZ,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(){Ks(this,hH)&&clearTimeout(Ks(this,hH)),Ks(this,P1)!==this.CLOSED&&(Ks(this,kx)&&Ks(this,kx).abort(),Xu(this,P1,this.CLOSED),Xu(this,kx,void 0))}};P1=new WeakMap,PN=new WeakMap,fH=new WeakMap,pme=new WeakMap,mme=new WeakMap,JZ=new WeakMap,hH=new WeakMap,KZ=new WeakMap,kx=new WeakMap,dH=new WeakMap,mH=new WeakMap,pH=new WeakMap,YZ=new WeakMap,g5=new WeakSet,AFe=function(){Xu(this,P1,this.CONNECTING),Xu(this,kx,new AbortController),Ks(this,mme)(Ks(this,PN),O7(this,g5,vMt).call(this)).then(Ks(this,yFe)).catch(Ks(this,EFe))},yFe=new WeakMap,EFe=new WeakMap,vMt=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ks(this,KZ)?{"Last-Event-ID":Ks(this,KZ)}:void 0},cache:"no-store",signal:(t=Ks(this,kx))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},vFe=new WeakMap,bFe=new WeakMap,zZ=function(t,e){var r;Ks(this,P1)!==this.CLOSED&&Xu(this,P1,this.CLOSED);let n=new hme("error",{code:e,message:t});(r=Ks(this,mH))==null||r.call(this,n),this.dispatchEvent(n)},CFe=function(t,e){var r;if(Ks(this,P1)===this.CLOSED)return;Xu(this,P1,this.CONNECTING);let n=new hme("error",{code:e,message:t});(r=Ks(this,mH))==null||r.call(this,n),this.dispatchEvent(n),Xu(this,hH,setTimeout(Ks(this,_Fe),Ks(this,JZ)))},_Fe=new WeakMap,FN.CONNECTING=0,FN.OPEN=1,FN.CLOSED=2});async function rIn(t){return(await SFe).getRandomValues(new Uint8Array(t))}async function nIn(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r="",n=await rIn(t);for(let i=0;i<t;i++){let o=n[i]%e.length;r+=e[o]}return r}async function iIn(t){return await nIn(t)}async function oIn(t){let e=await(await SFe).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xFe(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await iIn(t),r=await oIn(e);return{code_verifier:e,code_challenge:r}}var SFe,_Mt=Ie(()=>{SFe=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto)});var Jh,wMt,TFe,sIn,SMt,DFe,xMt,aIn,lIn,TMt,iMo,oMo,IFe=Ie(()=>{qZ();Jh=Oe.string().url().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:Oe.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),Oe.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"}),wMt=Oe.object({resource:Oe.string().url(),authorization_servers:Oe.array(Jh).optional(),jwks_uri:Oe.string().url().optional(),scopes_supported:Oe.array(Oe.string()).optional(),bearer_methods_supported:Oe.array(Oe.string()).optional(),resource_signing_alg_values_supported:Oe.array(Oe.string()).optional(),resource_name:Oe.string().optional(),resource_documentation:Oe.string().optional(),resource_policy_uri:Oe.string().url().optional(),resource_tos_uri:Oe.string().url().optional(),tls_client_certificate_bound_access_tokens:Oe.boolean().optional(),authorization_details_types_supported:Oe.array(Oe.string()).optional(),dpop_signing_alg_values_supported:Oe.array(Oe.string()).optional(),dpop_bound_access_tokens_required:Oe.boolean().optional()}).passthrough(),TFe=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),service_documentation:Jh.optional(),revocation_endpoint:Jh.optional(),revocation_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),introspection_endpoint:Oe.string().optional(),introspection_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),code_challenge_methods_supported:Oe.array(Oe.string()).optional()}).passthrough(),sIn=Oe.object({issuer:Oe.string(),authorization_endpoint:Jh,token_endpoint:Jh,userinfo_endpoint:Jh.optional(),jwks_uri:Jh,registration_endpoint:Jh.optional(),scopes_supported:Oe.array(Oe.string()).optional(),response_types_supported:Oe.array(Oe.string()),response_modes_supported:Oe.array(Oe.string()).optional(),grant_types_supported:Oe.array(Oe.string()).optional(),acr_values_supported:Oe.array(Oe.string()).optional(),subject_types_supported:Oe.array(Oe.string()),id_token_signing_alg_values_supported:Oe.array(Oe.string()),id_token_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),id_token_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),userinfo_signing_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),userinfo_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),request_object_signing_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_alg_values_supported:Oe.array(Oe.string()).optional(),request_object_encryption_enc_values_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_methods_supported:Oe.array(Oe.string()).optional(),token_endpoint_auth_signing_alg_values_supported:Oe.array(Oe.string()).optional(),display_values_supported:Oe.array(Oe.string()).optional(),claim_types_supported:Oe.array(Oe.string()).optional(),claims_supported:Oe.array(Oe.string()).optional(),service_documentation:Oe.string().optional(),claims_locales_supported:Oe.array(Oe.string()).optional(),ui_locales_supported:Oe.array(Oe.string()).optional(),claims_parameter_supported:Oe.boolean().optional(),request_parameter_supported:Oe.boolean().optional(),request_uri_parameter_supported:Oe.boolean().optional(),require_request_uri_registration:Oe.boolean().optional(),op_policy_uri:Jh.optional(),op_tos_uri:Jh.optional()}).passthrough(),SMt=sIn.merge(TFe.pick({code_challenge_methods_supported:!0})),DFe=Oe.object({access_token:Oe.string(),id_token:Oe.string().optional(),token_type:Oe.string(),expires_in:Oe.number().optional(),scope:Oe.string().optional(),refresh_token:Oe.string().optional()}).strip(),xMt=Oe.object({error:Oe.string(),error_description:Oe.string().optional(),error_uri:Oe.string().optional()}),aIn=Oe.object({redirect_uris:Oe.array(Jh),token_endpoint_auth_method:Oe.string().optional(),grant_types:Oe.array(Oe.string()).optional(),response_types:Oe.array(Oe.string()).optional(),client_name:Oe.string().optional(),client_uri:Jh.optional(),logo_uri:Jh.optional(),scope:Oe.string().optional(),contacts:Oe.array(Oe.string()).optional(),tos_uri:Jh.optional(),policy_uri:Oe.string().optional(),jwks_uri:Jh.optional(),jwks:Oe.any().optional(),software_id:Oe.string().optional(),software_version:Oe.string().optional(),software_statement:Oe.string().optional()}).strip(),lIn=Oe.object({client_id:Oe.string(),client_secret:Oe.string().optional(),client_id_issued_at:Oe.number().optional(),client_secret_expires_at:Oe.number().optional()}).strip(),TMt=aIn.merge(lIn),iMo=Oe.object({error:Oe.string(),error_description:Oe.string().optional()}).strip(),oMo=Oe.object({token:Oe.string(),token_type_hint:Oe.string().optional()}).strip()});function DMt(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function IMt({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 RMt=Ie(()=>{});var vp,XZ,UN,QN,qN,ZZ,eee,tee,M7,ree,nee,iee,oee,see,aee,lee,cee,BMt,NMt=Ie(()=>{vp=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}},XZ=class extends vp{};XZ.errorCode="invalid_request";UN=class extends vp{};UN.errorCode="invalid_client";QN=class extends vp{};QN.errorCode="invalid_grant";qN=class extends vp{};qN.errorCode="unauthorized_client";ZZ=class extends vp{};ZZ.errorCode="unsupported_grant_type";eee=class extends vp{};eee.errorCode="invalid_scope";tee=class extends vp{};tee.errorCode="access_denied";M7=class extends vp{};M7.errorCode="server_error";ree=class extends vp{};ree.errorCode="temporarily_unavailable";nee=class extends vp{};nee.errorCode="unsupported_response_type";iee=class extends vp{};iee.errorCode="unsupported_token_type";oee=class extends vp{};oee.errorCode="invalid_token";see=class extends vp{};see.errorCode="method_not_allowed";aee=class extends vp{};aee.errorCode="too_many_requests";lee=class extends vp{};lee.errorCode="invalid_client_metadata";cee=class extends vp{};cee.errorCode="insufficient_scope";BMt={[XZ.errorCode]:XZ,[UN.errorCode]:UN,[QN.errorCode]:QN,[qN.errorCode]:qN,[ZZ.errorCode]:ZZ,[eee.errorCode]:eee,[tee.errorCode]:tee,[M7.errorCode]:M7,[ree.errorCode]:ree,[nee.errorCode]:nee,[iee.errorCode]:iee,[oee.errorCode]:oee,[see.errorCode]:see,[aee.errorCode]:aee,[lee.errorCode]:lee,[cee.errorCode]:cee}});function MMt(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 kMt(t,e,r,n){let{client_id:i,client_secret:o}=e;switch(t){case"client_secret_basic":cIn(i,o,r);return;case"client_secret_post":uIn(i,o,n);return;case"none":fIn(i,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function cIn(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 uIn(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function fIn(t,e){e.set("client_id",t)}async function BFe(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=xMt.parse(JSON.parse(r)),{error:i,error_description:o,error_uri:s}=n,a=BMt[i]||M7;return new a(o||"",s)}catch(n){let i=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new M7(i)}}async function Lx(t,e){var r,n;try{return await RFe(t,e)}catch(i){if(i instanceof UN||i instanceof qN)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await RFe(t,e);if(i instanceof QN)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await RFe(t,e);throw i}}async function RFe(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:i,fetchFn:o}){let s,a;try{s=await pIn(e,{resourceMetadataUrl:i},o),s.authorization_servers&&s.authorization_servers.length>0&&(a=s.authorization_servers[0])}catch{}a||(a=e);let c=await dIn(e,t,s),u=await yIn(a,{fetchFn:o}),f=await Promise.resolve(t.clientInformation());if(!f){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 vIn(a,{metadata:u,clientMetadata:t.clientMetadata,fetchFn:o});await t.saveClientInformation(A),f=A}if(r!==void 0){let A=await t.codeVerifier(),y=await OFe(a,{metadata:u,clientInformation:f,authorizationCode:r,codeVerifier:A,redirectUri:t.redirectUrl,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(y),"AUTHORIZED"}let d=await t.tokens();if(d?.refresh_token)try{let A=await MFe(a,{metadata:u,clientInformation:f,refreshToken:d.refresh_token,resource:c,addClientAuthentication:t.addClientAuthentication,fetchFn:o});return await t.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof vp)||A instanceof M7))throw A}let p=t.state?await t.state():void 0,{authorizationUrl:h,codeVerifier:g}=await EIn(a,{metadata:u,clientInformation:f,state:p,redirectUrl:t.redirectUrl,scope:n||t.clientMetadata.scope,resource:c});return await t.saveCodeVerifier(g),await t.redirectToAuthorization(h),"REDIRECT"}async function dIn(t,e,r){let n=DMt(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!IMt({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 uee(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 pIn(t,e,r=fetch){let n=await gIn(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 wMt.parse(await n.json())}async function NFe(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?NFe(t,void 0,r):void 0;throw n}}function hIn(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function OMt(t,e,r=fetch){return await NFe(t,{"MCP-Protocol-Version":e},r)}function mIn(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function gIn(t,e,r,n){var i,o;let s=new URL(t),a=(i=n?.protocolVersion)!==null&&i!==void 0?i:oH,c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{let f=hIn(e,s.pathname);c=new URL(f,(o=n?.metadataServerUrl)!==null&&o!==void 0?o:s),c.search=s.search}let u=await OMt(c,a,r);if(!n?.metadataUrl&&mIn(u,s.pathname)){let f=new URL(`/.well-known/${e}`,s);u=await OMt(f,a,r)}return u}function AIn(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 yIn(t,{fetchFn:e=fetch,protocolVersion:r=oH}={}){var n;let i={"MCP-Protocol-Version":r},o=AIn(t);for(let{url:s,type:a}of o){let c=await NFe(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 TFe.parse(await c.json());{let u=SMt.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 EIn(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 f=await xFe(),d=f.code_verifier,p=f.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:d}}async function OFe(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:i,redirectUri:o,resource:s,addClientAuthentication:a,fetchFn:c}){var u;let f="authorization_code",d=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let p=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),h=new URLSearchParams({grant_type:f,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=MMt(r,A);kMt(y,r,p,h)}s&&h.set("resource",s.href);let g=await(c??fetch)(d,{method:"POST",headers:p,body:h});if(!g.ok)throw await BFe(g);return DFe.parse(await g.json())}async function MFe(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 f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:n});if(o)o(f,d,t,e);else{let h=(a=e?.token_endpoint_auth_methods_supported)!==null&&a!==void 0?a:[],g=MMt(r,h);kMt(g,r,f,d)}i&&d.set("resource",i.href);let p=await(s??fetch)(u,{method:"POST",headers:f,body:d});if(!p.ok)throw await BFe(p);return DFe.parse({refresh_token:n,...await p.json()})}async function vIn(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 BFe(o);return TMt.parse(await o.json())}var F1,gme=Ie(()=>{_Mt();Bx();IFe();IFe();RMt();NMt();F1=class extends Error{constructor(e){super(e??"Unauthorized")}}});var kFe,gH,LMt=Ie(()=>{CMt();Bx();gme();kFe=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},gH=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 F1("No auth provider");let r;try{r=await Lx(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 F1;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 FN(this._url.href,{...this._eventSourceInit,fetch:async(a,c)=>{let u=await this._commonHeaders();u.set("Accept","text/event-stream");let f=await i(a,{...c,headers:u});return f.status===401&&f.headers.has("www-authenticate")&&(this._resourceMetadataUrl=uee(f)),f}}),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 kFe(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(f){s(f),(c=this.onerror)===null||c===void 0||c.call(this,f),this.close();return}o()}),this._eventSource.onmessage=a=>{var c,u;let f=a,d;try{d=Rx.parse(JSON.parse(f.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,d)}})}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 F1("No auth provider");if(await Lx(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1("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=uee(a),await Lx(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1;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 Ame,PMt=Ie(()=>{mFe();Ame=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let i;super({start(o){i=dme({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 bIn,fee,Px,LFe=Ie(()=>{Bx();gme();PMt();bIn={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},fee=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Px=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:bIn}async _authThenStart(){var e;if(!this._authProvider)throw new F1("No auth provider");let r;try{r=await Lx(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 F1;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 fee(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,f,d;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ame).getReader();for(;;){let{value:h,done:g}=await p.read();if(g)break;if(h.id&&(s=h.id,i?.(h.id)),!h.event||h.event==="message")try{let A=Rx.parse(JSON.parse(h.data));o!==void 0&&GZ(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((f=this.onerror)===null||f===void 0||f.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){(d=this.onerror)===null||d===void 0||d.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 F1("No auth provider");if(await Lx(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1("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:L0e(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 f={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},d=await((i=this._fetch)!==null&&i!==void 0?i:fetch)(this._url,f),p=d.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!d.ok){if(d.status===401&&this._authProvider){if(this._resourceMetadataUrl=uee(d),await Lx(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new F1;return this.send(e)}let y=await d.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${d.status}): ${y}`)}if(d.status===202){ABt(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 g=(Array.isArray(e)?e:[e]).filter(y=>"method"in y&&"id"in y&&y.id!==void 0).length>0,A=d.headers.get("content-type");if(g)if(A?.includes("text/event-stream"))this._handleSseStream(d.body,{onresumptiontoken:c},!1);else if(A?.includes("application/json")){let y=await d.json(),v=Array.isArray(y)?y.map(w=>Rx.parse(w)):[Rx.parse(y)];for(let w of v)(o=this.onmessage)===null||o===void 0||o.call(this,w)}else throw new fee(-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 fee(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 CIn}from"node:fs/promises";var dee,pee,HN,PFe=Ie(()=>{"use strict";QX();gme();(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"})(dee||(dee={}));pee=class extends Error{code;constructor(e,r){super(r),this.code=e}},HN=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||lx.default}async start(){if(this._isClosed)throw new Error("Transport is closed");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 MFe(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("Unauthorized: OAuth required")}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 pee(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 pee(void 0,`Failed to create WebSocket: ${s}`))}})}async finishAuth(e){if(!this._authProvider)throw new Error("No auth provider configured");try{let r=await this._authProvider.clientInformation();if(r){let n=this._authProvider.redirectUrl.toString(),i=await OFe(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("Client information not available")}catch(r){throw new Error(`Failed to exchange authorization code for access token: ${r}`)}}async close(){this._isClosed=!0,this._websocket&&this._websocket.readyState===lx.default.OPEN?this._websocket.close():this.onclose?.()}async send(e){if(this._isClosed)throw new Error("Transport is closed");if(!this._websocket)throw new Error("Transport not started");if(this._websocket.readyState!==lx.default.OPEN)throw new Error("WebSocket is not open");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 pee(void 0,`Failed to send message: ${r instanceof Error?r.message:String(r)}`)}}async _transformRequest(e){if(e.method==="initialize")return{type:dee.CLI_CONNECT,id:e.id,timestamp:Date.now(),payload:{clientInfo:{version:"0.2.19-beta.3",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:dee.SHOW_DIFF,id:e.id,timestamp:Date.now(),payload:{originalText:await CIn(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:dee.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 FMt,yme,UMt=Ie(()=>{"use strict";FMt=ze(Fhe(),1);yme=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("Scopes must be provided in the oauth config for Google Credentials provider");this.auth=new FMt.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("Failed to get access token from Google ADC");return}return{access_token:r.token,token_type:"Bearer"}}saveTokens(e){}redirectToAuthorization(e){}saveCodeVerifier(e){}codeVerifier(){return""}}});import{execFile as _In}from"node:child_process";import{promisify as wIn}from"node:util";import{platform as SIn}from"node:os";import{URL as xIn}from"node:url";function TIn(t){let e;try{e=new xIn(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 qMt(t){TIn(t);let e=SIn(),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 QMt(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 QMt(a,[t],i);return}catch{continue}}throw new Error(`Failed to open browser: ${o instanceof Error?o.message:"Unknown error"}`)}}var QMt,HMt=Ie(()=>{"use strict";QMt=wIn(_In)});function Ds(t){return t instanceof Error&&"code"in t}function Tr(t){if(t instanceof Error)return t.message;try{return String(t)}catch{return"Failed to get error details"}}function FFe(t){if(t&&typeof t=="object"&&"response"in t){let r=DIn(t);if(r.error&&r.error.message&&r.error.code)switch(r.error.code){case 400:return new vme(r.error.message);case 401:return new Fx(r.error.message);case 403:return new Eme(r.error.message);default:}}return t}function DIn(t){return typeof t.response?.data=="string"?JSON.parse(t.response?.data):t.response?.data}var Eme,Fx,vme,_f=Ie(()=>{"use strict";Eme=class extends Error{},Fx=class extends Error{},vme=class extends Error{}});import{promises as AH}from"node:fs";import*as bme from"node:path";import*as GMt from"node:os";var Kh,Cme=Ie(()=>{"use strict";_f();Kh=class{static TOKEN_FILE="mcp-oauth-tokens.json";static CONFIG_DIR=".iflow";static getTokenFilePath(){let e=GMt.homedir();return bme.join(e,this.CONFIG_DIR,this.TOKEN_FILE)}static async ensureConfigDir(){let e=bme.dirname(this.getTokenFilePath());await AH.mkdir(e,{recursive:!0})}static async loadTokens(){let e=new Map;try{let r=this.getTokenFilePath(),n=await AH.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(`Failed to load MCP OAuth tokens: ${Tr(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 AH.writeFile(u,JSON.stringify(c,null,2),{mode:384})}catch(f){throw console.error(`Failed to save MCP OAuth token: ${Tr(f)}`),f}}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 AH.unlink(i):await AH.writeFile(i,JSON.stringify(n,null,2),{mode:384})}catch(o){console.error(`Failed to remove MCP OAuth token: ${Tr(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 AH.unlink(e)}catch(e){e.code!=="ENOENT"&&console.error(`Failed to clear MCP OAuth tokens: ${Tr(e)}`)}}}});var Xh,_me=Ie(()=>{"use strict";_f();Xh=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}: ${Tr(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}: ${Tr(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("Dynamic client registration is supported at:",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("Dynamic client registration is supported at:",i.registration_endpoint),o}return null}catch(r){return console.debug(`Failed to discover OAuth configuration: ${Tr(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(`Found resource metadata URI from www-authenticate header: ${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("OAuth configuration discovered successfully from www-authenticate header"),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 jMt from"node:http";import*as hee from"node:crypto";import{URL as UFe}from"node:url";var v3,QFe=Ie(()=>{"use strict";HMt();Cme();_f();_me();v3=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(`Client registration failed: ${o.status} ${o.statusText} - ${s}`)}return await o.json()}static async discoverOAuthFromMCPServer(e){let r=Xh.extractBaseUrl(e);return Xh.discoverOAuthConfig(r)}static generatePKCEParams(){let e=hee.randomBytes(32).toString("base64url"),r=hee.createHash("sha256").update(e).digest("base64url"),n=hee.randomBytes(16).toString("base64url");return{codeVerifier:e,codeChallenge:r,state:n}}static async startCallbackServer(e){return new Promise((r,n)=>{let i=jMt.createServer(async(o,s)=>{try{let a=new UFe(o.url,`http://localhost:${this.REDIRECT_PORT}`);if(a.pathname!==this.REDIRECT_PATH){s.writeHead(404),s.end("Not found");return}let c=a.searchParams.get("code"),u=a.searchParams.get("state"),f=a.searchParams.get("error");if(f){s.writeHead(this.HTTP_OK,{"Content-Type":"text/html"}),s.end(`
421
421
  <html>
422
422
  <body>
423
423
  <h1>Authentication Failed</h1>
@@ -1803,6 +1803,7 @@ IMPORTANT: Always use the ${Gc.Name} and '${av.Name}'tool to plan and track task
1803
1803
  - **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
1804
1804
  - **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
1805
1805
  - **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
1806
+ - **Constructive Follow-up:** When no tool calls are made (i.e., after completing a task), attempt to provide 2 next-step suggestions based on context.
1806
1807
 
1807
1808
  ## Security and Safety Rules
1808
1809
  - **Explain Critical Commands:** Before executing commands with '${nf.Name}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
@@ -1827,7 +1828,7 @@ IMPORTANT: Always use the ${Gc.Name} and '${av.Name}'tool to plan and track task
1827
1828
  `:""}
1828
1829
  - When ${ey.Name} returns a message about a redirect to a different host, you should immediately make a new ${ey.Name} request with the redirect URL provided in the response.
1829
1830
  - You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
1830
- - When asked to kill process, you always find process id first using the '${nf.Name}' tool, then do kill operation, ENSURE exclude your own iflow process (named iflow) to avoid self-termination.
1831
+ - When asked to kill process, you always narrow down the scope by finding process id first using the '${nf.Name}' tool to avoid self-termination and accidentally killing unrelated processes, then carefully verify the process before kill operation.
1831
1832
 
1832
1833
  ## Interaction Details
1833
1834
  - **Help Command:** The user can use '/help' to display help information.
@@ -3076,7 +3077,7 @@ Content from @${F}:
3076
3077
  `,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function Wyt(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=igo(t,e);return r?{line:n.line+1,column:n.column+1}:n}var ogo=t=>`\\u{${t.codePointAt(0).toString(16)}}`,Yyt=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??=`${ago(this.#t.message)}${this.#e===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#r}${this.fileName?` in ${this.fileName}`:""}${e?`
3077
3078
 
3078
3079
  ${e}
3079
- `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=sgo(r,this.#t.message);if(n)return(0,DKr.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}},sgo=(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)}:Wyt(t,Number(n),{oneBased:!0})},ago=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${ogo(n)})`);function zyt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Yyt({jsonParseError:n,fileName:r,input:t})}}var SXr=ze(_Xr(),1);import{fileURLToPath as o1o}from"node:url";function wXr(t){return t instanceof URL?o1o(t):t}var l1o=t=>a1o.resolve(wXr(t)??".","package.json"),c1o=(t,e)=>{let r=typeof t=="string"?zyt(t):t;return e&&(0,SXr.default)(r),r};async function xXr({cwd:t,normalize:e=!0}={}){let r=await s1o.readFile(l1o(t),"utf8");return c1o(r,e)}async function TXr(t){let e=await nKr("package.json",t);if(e)return{packageJson:await xXr({...t,cwd:u1o.dirname(e)}),path:e}}import{fileURLToPath as f1o}from"url";import d1o from"path";var p1o=f1o(import.meta.url),h1o=d1o.dirname(p1o),qTe;async function IJ(){if(qTe)return qTe;let t=await TXr({cwd:h1o});if(t)return qTe=t.packageJson,qTe}async function z9(){let t=await IJ();return"0.2.19-beta.2"}import mF from"node:process";var DXr={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=mF.platform,r="no sandbox";mF.env.SANDBOX&&mF.env.SANDBOX!=="sandbox-exec"?r=mF.env.SANDBOX:mF.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${mF.env.SEATBELT_PROFILE||"unknown"})`);let n=t.services.config?.getModel()||"Unknown",i=await z9(),o=t.services.settings.merged.selectedAuthType||"",s=mF.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())}};rn();var GTe="\x1B[32m";var RXr="\x1B[31m",Bv="\x1B[36m",Om="\x1B[90m";var Ma="\x1B[0m";function HTe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3080
+ `:""}`}set message(e){this.#r=e}#i(e){if(!this.#t)return;let r=this.#e,n=sgo(r,this.#t.message);if(n)return(0,DKr.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}},sgo=(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)}:Wyt(t,Number(n),{oneBased:!0})},ago=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,n)=>`"${n}"(${ogo(n)})`);function zyt(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(n){throw new Yyt({jsonParseError:n,fileName:r,input:t})}}var SXr=ze(_Xr(),1);import{fileURLToPath as o1o}from"node:url";function wXr(t){return t instanceof URL?o1o(t):t}var l1o=t=>a1o.resolve(wXr(t)??".","package.json"),c1o=(t,e)=>{let r=typeof t=="string"?zyt(t):t;return e&&(0,SXr.default)(r),r};async function xXr({cwd:t,normalize:e=!0}={}){let r=await s1o.readFile(l1o(t),"utf8");return c1o(r,e)}async function TXr(t){let e=await nKr("package.json",t);if(e)return{packageJson:await xXr({...t,cwd:u1o.dirname(e)}),path:e}}import{fileURLToPath as f1o}from"url";import d1o from"path";var p1o=f1o(import.meta.url),h1o=d1o.dirname(p1o),qTe;async function IJ(){if(qTe)return qTe;let t=await TXr({cwd:h1o});if(t)return qTe=t.packageJson,qTe}async function z9(){let t=await IJ();return"0.2.19-beta.3"}import mF from"node:process";var DXr={name:"about",description:"show version info",kind:"built-in",action:async t=>{let e=mF.platform,r="no sandbox";mF.env.SANDBOX&&mF.env.SANDBOX!=="sandbox-exec"?r=mF.env.SANDBOX:mF.env.SANDBOX==="sandbox-exec"&&(r=`sandbox-exec (${mF.env.SEATBELT_PROFILE||"unknown"})`);let n=t.services.config?.getModel()||"Unknown",i=await z9(),o=t.services.settings.merged.selectedAuthType||"",s=mF.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())}};rn();var GTe="\x1B[32m";var RXr="\x1B[31m",Bv="\x1B[36m",Om="\x1B[90m";var Ma="\x1B[0m";function HTe(t,e,r,n=!1){let i="";if(t.length===0)return i="\u{1F534} ",`${i}${e}
3080
3081
  ${RXr}No agents found${Ma}
3081
3082
  `;i="\u{1F7E2} ";let o=`${i}${e}
3082
3083
  `;for(let s of t)n?o+=m1o(s):o+=`${GTe}- ${s.agentType}${Ma}
@@ -4008,7 +4009,7 @@ CRITICAL: Unhandled Promise Rejection!
4008
4009
  =========================================
4009
4010
  Reason: ${e}${e instanceof Error&&e.stack?`
4010
4011
  Stack trace:
4011
- ${e.stack}`:""}`;Ba.emit("log-error",n),t||(t=!0,Ba.emit("open-debug-console"))})}function MCo(){console.log("\u{1F50D} Crash diagnostics enabled - Core dump and crash files will be generated on crash"),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.19-beta.2"}},r=`crash-${Date.now()}-${process.pid}.json`,n=wCo.join(process.cwd(),r);try{ICo.writeFileSync(n,JSON.stringify(e,null,2)),console.error(`\u{1F4A5} Crash detected! Crash info written to: ${n}`),console.error("\u{1F4CB} Core dump will be generated...")}catch(i){console.error("\u274C Failed to write crash file:",i)}process.abort()}),process.on("warning",t=>{console.warn("\u26A0\uFE0F Node.js Warning:",{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error("\u{1F6A8} Unhandled Promise Rejection detected:",{reason:t,promise:e.toString()})})}async function bpn(){OCo();let t=process.cwd(),e=uc(t);if(await Pan(),e.errors.length>0){for(let f of e.errors){let d=`Error in ${f.path}: ${f.message}`;process.env.NO_COLOR||(d=`\x1B[31m${d}\x1B[0m`),console.error(d),console.error(`Please fix ${f.path} and try again.`)}process.exit(1)}let r=await jIe(),n=OR(t),i=await _fe(e.merged,n,yJ,r);if(i.getDebugMode()&&MCo(),TCo.setDefaultResultOrder(RCo(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error("Error: The --prompt-interactive flag is not supported when piping input from stdin."),process.exit(1)),i.getListExtensions()){console.log("Installed extensions:");for(let f of n)console.log(`- ${f.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:f}=await Promise.resolve().then(()=>(s5t(),Oan)),d=(await Promise.resolve().then(()=>(sbt(),obt))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:f}=await Promise.resolve().then(()=>(i5t(),van)),d=(await Promise.resolve().then(()=>(sbt(),obt))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Vr.CLOUD_SHELL),nin(i.getDebugMode()),await i.initialize();try{await i.setIdeModeAndSyncConnection(!0)}catch(f){console.error("Failed to connect to IDE server:",f)}if(zl.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(zl.setActiveTheme(e.merged.theme)||console.warn(`Warning: Theme "${e.merged.theme}" not found.`)),!process.env.SANDBOX){let f=e.merged.autoConfigureMaxOldSpaceSize?BCo(i):[],d=i.getSandbox();if(d){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let p=TF(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,multimodalModelName:e.merged.multimodalModelName})}catch(p){console.error("Error authenticating:",p),process.exit(1)}await vcn(d,f,i),process.exit(0)}else f.length>0&&(await NCo(f),process.exit(0))}if(e.merged.selectedAuthType===Vr.LOGIN_WITH_IFLOW&&i.isBrowserLaunchSuppressed()&&await pN(e.merged.selectedAuthType,i),i.getExperimentalAcp())return i.getAcpPort()?await Bdn(i,e,i.getAcpPort()):Ndn(i,e);let o=i.getQuestion(),s=[...await bcn(),...await _cn(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&o?.length===0){console.clear();let f=await z9();vpn(Epn(t),e);let d,p=async()=>{try{if(console.clear(),vpn(Epn(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d)try{d.unmount(),await new Promise(h=>process.nextTick(h))}catch(h){console.error("Error during unmount:",h)}d=Epe((0,ede.jsx)(abt.default.StrictMode,{children:(0,ede.jsx)(B5t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0})}),{exitOnCtrlC:!1,stdout:g6t(),stdin:process.stdin,patchConsole:!0})}catch(h){console.error("Error during resume:",h)}};process.on("SIGCONT",p),wfe(()=>{process.off("SIGCONT",p)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d=Epe((0,ede.jsx)(abt.default.StrictMode,{children:(0,ede.jsx)(B5t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume})}),{exitOnCtrlC:!1,stdout:g6t()}),e.merged.disableAutoUpdate||bdn().then(h=>{tcn(h,e,i.getProjectRoot())}).catch(h=>{i.getDebugMode()&&console.error("Update check failed:",h)}),wfe(()=>d.unmount());return}!process.stdin.isTTY&&!o&&(o+=await gcn()),o||(console.error("No input provided via stdin."),process.exit(1));let c=Math.random().toString(16).slice(2);Zz(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 kCo(i,n,e,r);await wcn(u,o,c),process.exit(0)}function vpn(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 kCo(t,e,r,n){let i=t;if(t.getApprovalMode()!==Bi.YOLO){let o=r.merged.excludeTools||[],s=[nf.Name,xp.Name,pd.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await _fe(c,e,t.getSessionId(),u),await i.initialize()}return await LCo(r.merged.selectedAuthType,i,r)}async function LCo(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!C0e()&&(console.error(`Please set an Auth method in your ${gF} or specify one of the following environment variables before running:
4012
+ ${e.stack}`:""}`;Ba.emit("log-error",n),t||(t=!0,Ba.emit("open-debug-console"))})}function MCo(){console.log("\u{1F50D} Crash diagnostics enabled - Core dump and crash files will be generated on crash"),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.19-beta.3"}},r=`crash-${Date.now()}-${process.pid}.json`,n=wCo.join(process.cwd(),r);try{ICo.writeFileSync(n,JSON.stringify(e,null,2)),console.error(`\u{1F4A5} Crash detected! Crash info written to: ${n}`),console.error("\u{1F4CB} Core dump will be generated...")}catch(i){console.error("\u274C Failed to write crash file:",i)}process.abort()}),process.on("warning",t=>{console.warn("\u26A0\uFE0F Node.js Warning:",{name:t.name,message:t.message,stack:t.stack})}),process.on("unhandledRejection",(t,e)=>{console.error("\u{1F6A8} Unhandled Promise Rejection detected:",{reason:t,promise:e.toString()})})}async function bpn(){OCo();let t=process.cwd(),e=uc(t);if(await Pan(),e.errors.length>0){for(let f of e.errors){let d=`Error in ${f.path}: ${f.message}`;process.env.NO_COLOR||(d=`\x1B[31m${d}\x1B[0m`),console.error(d),console.error(`Please fix ${f.path} and try again.`)}process.exit(1)}let r=await jIe(),n=OR(t),i=await _fe(e.merged,n,yJ,r);if(i.getDebugMode()&&MCo(),TCo.setDefaultResultOrder(RCo(e.merged.dnsResolutionOrder)),r.promptInteractive&&!process.stdin.isTTY&&(console.error("Error: The --prompt-interactive flag is not supported when piping input from stdin."),process.exit(1)),i.getListExtensions()){console.log("Installed extensions:");for(let f of n)console.log(`- ${f.config.name}`);process.exit(0)}if(r._&&r._[0]==="agent"){let{agentCommand:f}=await Promise.resolve().then(()=>(s5t(),Oan)),d=(await Promise.resolve().then(()=>(sbt(),obt))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}if(r._&&r._[0]==="commands"){let{commandsCommand:f}=await Promise.resolve().then(()=>(i5t(),van)),d=(await Promise.resolve().then(()=>(sbt(),obt))).default;await d().scriptName("iflow").command(f).help().version(!1).parse(),process.exit(0)}e.merged.selectedAuthType||process.env.CLOUD_SHELL==="true"&&e.setValue("User","selectedAuthType",Vr.CLOUD_SHELL),nin(i.getDebugMode()),await i.initialize();try{await i.setIdeModeAndSyncConnection(!0)}catch(f){console.error("Failed to connect to IDE server:",f)}if(zl.loadCustomThemes(e.merged.customThemes),e.merged.theme&&(zl.setActiveTheme(e.merged.theme)||console.warn(`Warning: Theme "${e.merged.theme}" not found.`)),!process.env.SANDBOX){let f=e.merged.autoConfigureMaxOldSpaceSize?BCo(i):[],d=i.getSandbox();if(d){if(e.merged.selectedAuthType&&!e.merged.useExternalAuth)try{let p=TF(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,multimodalModelName:e.merged.multimodalModelName})}catch(p){console.error("Error authenticating:",p),process.exit(1)}await vcn(d,f,i),process.exit(0)}else f.length>0&&(await NCo(f),process.exit(0))}if(e.merged.selectedAuthType===Vr.LOGIN_WITH_IFLOW&&i.isBrowserLaunchSuppressed()&&await pN(e.merged.selectedAuthType,i),i.getExperimentalAcp())return i.getAcpPort()?await Bdn(i,e,i.getAcpPort()):Ndn(i,e);let o=i.getQuestion(),s=[...await bcn(),...await _cn(t)];if(!!r.promptInteractive||!!r.continue||!!r.resume||process.stdin.isTTY&&o?.length===0){console.clear();let f=await z9();vpn(Epn(t),e);let d,p=async()=>{try{if(console.clear(),vpn(Epn(t),e),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d)try{d.unmount(),await new Promise(h=>process.nextTick(h))}catch(h){console.error("Error during unmount:",h)}d=Epe((0,ede.jsx)(abt.default.StrictMode,{children:(0,ede.jsx)(B5t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume,fgMode:!0})}),{exitOnCtrlC:!1,stdout:g6t(),stdin:process.stdin,patchConsole:!0})}catch(h){console.error("Error during resume:",h)}};process.on("SIGCONT",p),wfe(()=>{process.off("SIGCONT",p)}),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),d=Epe((0,ede.jsx)(abt.default.StrictMode,{children:(0,ede.jsx)(B5t,{config:i,settings:e,startupWarnings:s,version:f,continueMode:!!r.continue,resumeMode:!!r.resume,resumeSessionId:r.resume})}),{exitOnCtrlC:!1,stdout:g6t()}),e.merged.disableAutoUpdate||bdn().then(h=>{tcn(h,e,i.getProjectRoot())}).catch(h=>{i.getDebugMode()&&console.error("Update check failed:",h)}),wfe(()=>d.unmount());return}!process.stdin.isTTY&&!o&&(o+=await gcn()),o||(console.error("No input provided via stdin."),process.exit(1));let c=Math.random().toString(16).slice(2);Zz(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 kCo(i,n,e,r);await wcn(u,o,c),process.exit(0)}function vpn(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 kCo(t,e,r,n){let i=t;if(t.getApprovalMode()!==Bi.YOLO){let o=r.merged.excludeTools||[],s=[nf.Name,xp.Name,pd.Name],a=[...new Set([...o,...s])],c={...r.merged,excludeTools:a},u={...n};i=await _fe(c,e,t.getSessionId(),u),await i.initialize()}return await LCo(r.merged.selectedAuthType,i,r)}async function LCo(t,e,r){!t&&!process.env.GEMINI_API_KEY&&!C0e()&&(console.error(`Please set an Auth method in your ${gF} or specify one of the following environment variables before running:
4012
4013
  - apiKey, APIKEY, API_KEY, api_key
4013
4014
  - baseUrl, BASEURL, BASE_URL, base_url
4014
4015
  - modelName, MODELNAME, MODEL_NAME, model_name `),process.exit(1)),t||(C0e()?t=Vr.IFLOW:t=Vr.IFLOW);let n=TF(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,multimodalModelName:r.merged.multimodalModelName}),e}bpn().catch(t=>{console.error("An unexpected critical error occurred:"),t instanceof Error?console.error(t.stack):console.error(String(t)),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflow-ai/iflow-cli",
3
- "version": "0.2.19-beta.2",
3
+ "version": "0.2.19-beta.3",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },